1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 #ifndef ICEPY_TYPES_H
6 #define ICEPY_TYPES_H
7 
8 #include <Config.h>
9 #include <Util.h>
10 #include <Ice/FactoryTable.h>
11 #include <Ice/Object.h>
12 #include <Ice/SlicedDataF.h>
13 #include <IceUtil/OutputUtil.h>
14 
15 #include <set>
16 
17 namespace IcePy
18 {
19 
20 class Buffer;
21 typedef IceUtil::Handle<Buffer> BufferPtr;
22 
23 class ExceptionInfo;
24 typedef IceUtil::Handle<ExceptionInfo> ExceptionInfoPtr;
25 typedef std::vector<ExceptionInfoPtr> ExceptionInfoList;
26 
27 class ClassInfo;
28 typedef IceUtil::Handle<ClassInfo> ClassInfoPtr;
29 typedef std::vector<ClassInfoPtr> ClassInfoList;
30 
31 class ValueInfo;
32 typedef IceUtil::Handle<ValueInfo> ValueInfoPtr;
33 
34 //
35 // This class is raised as an exception when object marshaling needs to be aborted.
36 //
37 class AbortMarshaling
38 {
39 };
40 
41 typedef std::map<PyObject*, Ice::ObjectPtr> ObjectMap;
42 
43 class ObjectReader;
44 typedef IceUtil::Handle<ObjectReader> ObjectReaderPtr;
45 
46 //
47 // The delayed nature of class unmarshaling in the Ice protocol requires us to
48 // handle unmarshaling using a callback strategy. An instance of UnmarshalCallback
49 // is supplied to each type's unmarshal() member function. For all types except
50 // classes, the callback is invoked with the unmarshaled value before unmarshal()
51 // returns. For class instances, however, the callback may not be invoked until
52 // the stream's finished() function is called.
53 //
54 class UnmarshalCallback : public IceUtil::Shared
55 {
56 public:
57 
58     virtual ~UnmarshalCallback();
59 
60     //
61     // The unmarshaled() member function receives the unmarshaled value. The
62     // last two arguments are the values passed to unmarshal() for use by
63     // UnmarshalCallback implementations.
64     //
65     virtual void unmarshaled(PyObject*, PyObject*, void*) = 0;
66 };
67 typedef IceUtil::Handle<UnmarshalCallback> UnmarshalCallbackPtr;
68 
69 //
70 // ReadObjectCallback retains all of the information necessary to store an unmarshaled
71 // Slice value as a Python object.
72 //
73 class ReadObjectCallback : public IceUtil::Shared
74 {
75 public:
76 
77     ReadObjectCallback(const ValueInfoPtr&, const UnmarshalCallbackPtr&, PyObject*, void*);
78     ~ReadObjectCallback();
79 
80     void invoke(const ::Ice::ObjectPtr&);
81 
82 private:
83 
84     ValueInfoPtr _info;
85     UnmarshalCallbackPtr _cb;
86     PyObject* _target;
87     void* _closure;
88 };
89 typedef IceUtil::Handle<ReadObjectCallback> ReadObjectCallbackPtr;
90 
91 //
92 // This class assists during unmarshaling of Slice classes and exceptions.
93 // We attach an instance to a stream.
94 //
95 class StreamUtil
96 {
97 public:
98 
99     StreamUtil();
100     ~StreamUtil();
101 
102     //
103     // Keep a reference to a ReadObjectCallback for patching purposes.
104     //
105     void add(const ReadObjectCallbackPtr&);
106 
107     //
108     // Keep track of object instances that have preserved slices.
109     //
110     void add(const ObjectReaderPtr&);
111 
112     //
113     // Updated the sliced data information for all stored object instances.
114     //
115     void updateSlicedData();
116 
117     static void setSlicedDataMember(PyObject*, const Ice::SlicedDataPtr&);
118     static Ice::SlicedDataPtr getSlicedDataMember(PyObject*, ObjectMap*);
119 
120 private:
121 
122     std::vector<ReadObjectCallbackPtr> _callbacks;
123     std::set<ObjectReaderPtr> _readers;
124     static PyObject* _slicedDataType;
125     static PyObject* _sliceInfoType;
126 };
127 
128 struct PrintObjectHistory
129 {
130     int index;
131     std::map<PyObject*, int> objects;
132 };
133 
134 //
135 // Base class for type information.
136 //
137 class TypeInfo : public UnmarshalCallback
138 {
139 public:
140 
141     virtual std::string getId() const = 0;
142 
143     virtual bool validate(PyObject*) = 0;
144 
145     virtual bool variableLength() const = 0;
146     virtual int wireSize() const = 0;
147     virtual Ice::OptionalFormat optionalFormat() const = 0;
148 
149     virtual bool usesClasses() const; // Default implementation returns false.
150 
151     virtual void unmarshaled(PyObject*, PyObject*, void*); // Default implementation is assert(false).
152 
153     virtual void destroy();
154 
155 protected:
156 
157     TypeInfo();
158 
159 public:
160 
161     //
162     // The marshal and unmarshal functions can raise Ice exceptions, and may raise
163     // AbortMarshaling if an error occurs.
164     //
165     virtual void marshal(PyObject*, Ice::OutputStream*, ObjectMap*, bool, const Ice::StringSeq* = 0) = 0;
166     virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, PyObject*, void*, bool,
167                            const Ice::StringSeq* = 0) = 0;
168 
169     virtual void print(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*) = 0;
170 };
171 typedef IceUtil::Handle<TypeInfo> TypeInfoPtr;
172 
173 //
174 // Primitive type information.
175 //
176 class PrimitiveInfo : public TypeInfo
177 {
178 public:
179 
180     enum Kind
181     {
182         KindBool,
183         KindByte,
184         KindShort,
185         KindInt,
186         KindLong,
187         KindFloat,
188         KindDouble,
189         KindString
190     };
191 
192     PrimitiveInfo(Kind);
193 
194     virtual std::string getId() const;
195 
196     virtual bool validate(PyObject*);
197 
198     virtual bool variableLength() const;
199     virtual int wireSize() const;
200     virtual Ice::OptionalFormat optionalFormat() const;
201 
202     virtual void marshal(PyObject*, Ice::OutputStream*, ObjectMap*, bool, const Ice::StringSeq* = 0);
203     virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, PyObject*, void*, bool,
204                            const Ice::StringSeq* = 0);
205 
206     virtual void print(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*);
207 
208     const Kind kind;
209 };
210 typedef IceUtil::Handle<PrimitiveInfo> PrimitiveInfoPtr;
211 
212 //
213 // Enum information.
214 //
215 typedef std::map<Ice::Int, PyObjectHandle> EnumeratorMap;
216 
217 class EnumInfo : public TypeInfo
218 {
219 public:
220 
221     EnumInfo(const std::string&, PyObject*, PyObject*);
222 
223     virtual std::string getId() const;
224 
225     virtual bool validate(PyObject*);
226 
227     virtual bool variableLength() const;
228     virtual int wireSize() const;
229     virtual Ice::OptionalFormat optionalFormat() const;
230 
231     virtual void marshal(PyObject*, Ice::OutputStream*, ObjectMap*, bool, const Ice::StringSeq* = 0);
232     virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, PyObject*, void*, bool,
233                            const Ice::StringSeq* = 0);
234 
235     virtual void print(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*);
236 
237     virtual void destroy();
238 
239     Ice::Int valueForEnumerator(PyObject*) const;
240     PyObject* enumeratorForValue(Ice::Int) const;
241 
242     const std::string id;
243     PyObject* pythonType; // Borrowed reference - the enclosing Python module owns the reference.
244     const Ice::Int maxValue;
245     const EnumeratorMap enumerators;
246 };
247 typedef IceUtil::Handle<EnumInfo> EnumInfoPtr;
248 
249 class DataMember : public UnmarshalCallback
250 {
251 public:
252 
253     virtual void unmarshaled(PyObject*, PyObject*, void*);
254 
255     std::string name;
256     std::vector<std::string> metaData;
257     TypeInfoPtr type;
258     bool optional;
259     int tag;
260 };
261 typedef IceUtil::Handle<DataMember> DataMemberPtr;
262 typedef std::vector<DataMemberPtr> DataMemberList;
263 
264 //
265 // Struct information.
266 //
267 class StructInfo : public TypeInfo
268 {
269 public:
270 
271     StructInfo(const std::string&, PyObject*, PyObject*);
272 
273     virtual std::string getId() const;
274 
275     virtual bool validate(PyObject*);
276 
277     virtual bool variableLength() const;
278     virtual int wireSize() const;
279     virtual Ice::OptionalFormat optionalFormat() const;
280 
281     virtual bool usesClasses() const;
282 
283     virtual void marshal(PyObject*, Ice::OutputStream*, ObjectMap*, bool, const Ice::StringSeq* = 0);
284     virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, PyObject*, void*, bool,
285                            const Ice::StringSeq* = 0);
286 
287     virtual void print(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*);
288 
289     virtual void destroy();
290 
291     static PyObject* instantiate(PyObject*);
292 
293     const std::string id;
294     const DataMemberList members;
295     PyObject* pythonType; // Borrowed reference - the enclosing Python module owns the reference.
296 
297 private:
298 
299     bool _variableLength;
300     int _wireSize;
301     PyObjectHandle _nullMarshalValue;
302 };
303 typedef IceUtil::Handle<StructInfo> StructInfoPtr;
304 
305 //
306 // Sequence information.
307 //
308 class SequenceInfo : public TypeInfo
309 {
310 public:
311 
312     SequenceInfo(const std::string&, PyObject*, PyObject*);
313 
314     virtual std::string getId() const;
315 
316     virtual bool validate(PyObject*);
317 
318     virtual bool variableLength() const;
319     virtual int wireSize() const;
320     virtual Ice::OptionalFormat optionalFormat() const;
321 
322     virtual bool usesClasses() const;
323 
324     virtual void marshal(PyObject*, Ice::OutputStream*, ObjectMap*, bool, const Ice::StringSeq* = 0);
325     virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, PyObject*, void*, bool,
326                            const Ice::StringSeq* = 0);
327 
328     virtual void print(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*);
329 
330     virtual void destroy();
331 
332     enum BuiltinType
333     {
334         BuiltinTypeBool = 0,
335         BuiltinTypeByte = 1,
336         BuiltinTypeShort = 2,
337         BuiltinTypeInt = 3,
338         BuiltinTypeLong = 4,
339         BuiltinTypeFloat = 5,
340         BuiltinTypeDouble = 6
341     };
342 
343 private:
344 
345     struct SequenceMapping : public UnmarshalCallback
346     {
347         enum Type { SEQ_DEFAULT, SEQ_TUPLE, SEQ_LIST, SEQ_ARRAY, SEQ_NUMPYARRAY, SEQ_MEMORYVIEW };
348 
349         SequenceMapping(Type);
350         SequenceMapping(const Ice::StringSeq&);
351 
352         void init(const Ice::StringSeq&);
353 
354         static bool getType(const Ice::StringSeq&, Type&);
355 
356         virtual void unmarshaled(PyObject*, PyObject*, void*);
357 
358         PyObject* createContainer(int) const;
359         void setItem(PyObject*, int, PyObject*) const;
360 
361         Type type;
362         PyObjectHandle factory;
363     };
364     typedef IceUtil::Handle<SequenceMapping> SequenceMappingPtr;
365 
366     PyObject* getSequence(const PrimitiveInfoPtr&, PyObject*);
367     void marshalPrimitiveSequence(const PrimitiveInfoPtr&, PyObject*, Ice::OutputStream*);
368     void unmarshalPrimitiveSequence(const PrimitiveInfoPtr&, Ice::InputStream*, const UnmarshalCallbackPtr&,
369                                     PyObject*, void*, const SequenceMappingPtr&);
370 
371     PyObject* createSequenceFromMemory(const SequenceMappingPtr&, const char*, Py_ssize_t, BuiltinType, bool);
372 
373 public:
374 
375     const std::string id;
376     const SequenceMappingPtr mapping;
377     const TypeInfoPtr elementType;
378 };
379 typedef IceUtil::Handle<SequenceInfo> SequenceInfoPtr;
380 
381 class Buffer : public IceUtil::Shared
382 {
383 public:
384 
385     Buffer(const char*, Py_ssize_t, SequenceInfo::BuiltinType);
386     ~Buffer();
387     const char* data() const;
388     Py_ssize_t size() const;
389     SequenceInfo::BuiltinType type();
390 
391 private:
392 
393     const char* _data;
394     const Py_ssize_t _size;
395     const SequenceInfo::BuiltinType _type;
396 };
397 
398 //
399 // Custom information.
400 //
401 class CustomInfo : public TypeInfo
402 {
403 public:
404 
405     CustomInfo(const std::string&, PyObject*);
406 
407     virtual std::string getId() const;
408 
409     virtual bool validate(PyObject*);
410 
411     virtual bool variableLength() const;
412     virtual int wireSize() const;
413     virtual Ice::OptionalFormat optionalFormat() const;
414 
415     virtual bool usesClasses() const;
416 
417     virtual void marshal(PyObject*, Ice::OutputStream*, ObjectMap*, bool, const Ice::StringSeq* = 0);
418     virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, PyObject*, void*, bool,
419                            const Ice::StringSeq* = 0);
420 
421     virtual void print(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*);
422 
423     const std::string id;
424     PyObject* pythonType; // Borrowed reference - the enclosing Python module owns the reference.
425 };
426 typedef IceUtil::Handle<CustomInfo> CustomInfoPtr;
427 
428 //
429 // Dictionary information.
430 //
431 class DictionaryInfo : public TypeInfo
432 {
433 public:
434 
435     DictionaryInfo(const std::string&, PyObject*, PyObject*);
436 
437     virtual std::string getId() const;
438 
439     virtual bool validate(PyObject*);
440 
441     virtual bool variableLength() const;
442     virtual int wireSize() const;
443     virtual Ice::OptionalFormat optionalFormat() const;
444 
445     virtual bool usesClasses() const;
446 
447     virtual void marshal(PyObject*, Ice::OutputStream*, ObjectMap*, bool, const Ice::StringSeq* = 0);
448     virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, PyObject*, void*, bool,
449                            const Ice::StringSeq* = 0);
450     virtual void unmarshaled(PyObject*, PyObject*, void*);
451 
452     virtual void print(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*);
453 
454     virtual void destroy();
455 
456     class KeyCallback : public UnmarshalCallback
457     {
458     public:
459 
460         virtual void unmarshaled(PyObject*, PyObject*, void*);
461 
462         PyObjectHandle key;
463     };
464     typedef IceUtil::Handle<KeyCallback> KeyCallbackPtr;
465 
466     std::string id;
467     TypeInfoPtr keyType;
468     TypeInfoPtr valueType;
469 
470 private:
471 
472     bool _variableLength;
473     int _wireSize;
474 };
475 typedef IceUtil::Handle<DictionaryInfo> DictionaryInfoPtr;
476 
477 typedef std::vector<TypeInfoPtr> TypeInfoList;
478 
479 class ClassInfo : public TypeInfo
480 {
481 public:
482 
483     ClassInfo(const std::string&);
484 
485     void define(PyObject*, PyObject*, PyObject*);
486 
487     virtual std::string getId() const;
488 
489     virtual bool validate(PyObject*);
490 
491     virtual bool variableLength() const;
492     virtual int wireSize() const;
493     virtual Ice::OptionalFormat optionalFormat() const;
494 
495     virtual bool usesClasses() const;
496 
497     virtual void marshal(PyObject*, Ice::OutputStream*, ObjectMap*, bool, const Ice::StringSeq* = 0);
498     virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, PyObject*, void*, bool,
499                            const Ice::StringSeq* = 0);
500 
501     virtual void print(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*);
502 
503     virtual void destroy();
504 
505     const std::string id;
506     const ClassInfoPtr base;
507     const ClassInfoList interfaces;
508     PyObject* pythonType; // Borrowed reference - the enclosing Python module owns the reference.
509     PyObject* typeObj; // Borrowed reference - the "_t_XXX" variable owns the reference.
510     const bool defined;
511 };
512 
513 //
514 // Value type information
515 //
516 
517 class ValueInfo : public TypeInfo
518 {
519 public:
520 
521     ValueInfo(const std::string&);
522 
523     void define(PyObject*, int, bool, bool, PyObject*, PyObject*);
524 
525     virtual std::string getId() const;
526 
527     virtual bool validate(PyObject*);
528 
529     virtual bool variableLength() const;
530     virtual int wireSize() const;
531     virtual Ice::OptionalFormat optionalFormat() const;
532 
533     virtual bool usesClasses() const;
534 
535     virtual void marshal(PyObject*, Ice::OutputStream*, ObjectMap*, bool, const Ice::StringSeq* = 0);
536     virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, PyObject*, void*, bool,
537                            const Ice::StringSeq* = 0);
538 
539     virtual void print(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*);
540 
541     virtual void destroy();
542 
543     void printMembers(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*);
544 
545     const std::string id;
546     const Ice::Int compactId;
547     const bool preserve;
548     const bool interface;
549     const ValueInfoPtr base;
550     const DataMemberList members;
551     const DataMemberList optionalMembers;
552     PyObject* pythonType; // Borrowed reference - the enclosing Python module owns the reference.
553     PyObject* typeObj; // Borrowed reference - the "_t_XXX" variable owns the reference.
554     const bool defined;
555 };
556 
557 //
558 // Proxy information.
559 //
560 class ProxyInfo : public TypeInfo
561 {
562 public:
563 
564     ProxyInfo(const std::string&);
565 
566     void define(PyObject*);
567 
568     virtual std::string getId() const;
569 
570     virtual bool validate(PyObject*);
571 
572     virtual bool variableLength() const;
573     virtual int wireSize() const;
574     virtual Ice::OptionalFormat optionalFormat() const;
575 
576     virtual void marshal(PyObject*, Ice::OutputStream*, ObjectMap*, bool, const Ice::StringSeq* = 0);
577     virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, PyObject*, void*, bool,
578                            const Ice::StringSeq* = 0);
579 
580     virtual void print(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*);
581 
582     const std::string id;
583     PyObject* pythonType; // Borrowed reference - the enclosing Python module owns the reference.
584     PyObject* typeObj; // Borrowed reference - the "_t_XXX" variable owns the reference.
585 };
586 typedef IceUtil::Handle<ProxyInfo> ProxyInfoPtr;
587 
588 //
589 // Exception information.
590 //
591 class ExceptionInfo : public IceUtil::Shared
592 {
593 public:
594 
595     void marshal(PyObject*, Ice::OutputStream*, ObjectMap*);
596     PyObject* unmarshal(Ice::InputStream*);
597 
598     void print(PyObject*, IceUtilInternal::Output&);
599     void printMembers(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*);
600 
601     std::string id;
602     bool preserve;
603     ExceptionInfoPtr base;
604     DataMemberList members;
605     DataMemberList optionalMembers;
606     bool usesClasses;
607     PyObject* pythonType; // Borrowed reference - the enclosing Python module owns the reference.
608 
609 private:
610 
611     void writeMembers(PyObject*, Ice::OutputStream*, const DataMemberList&, ObjectMap*) const;
612 };
613 
614 //
615 // ObjectWriter wraps a Python object for marshaling.
616 //
617 class ObjectWriter : public Ice::Object
618 {
619 public:
620 
621     ObjectWriter(PyObject*, ObjectMap*, const ValueInfoPtr&);
622     ~ObjectWriter();
623 
624     virtual void ice_preMarshal();
625 
626     virtual void _iceWrite(Ice::OutputStream*) const;
627     virtual void _iceRead(Ice::InputStream*);
628 
629 private:
630 
631     void writeMembers(Ice::OutputStream*, const DataMemberList&) const;
632 
633     PyObject* _object;
634     ObjectMap* _map;
635     ValueInfoPtr _info;
636     ValueInfoPtr _formal;
637 };
638 
639 //
640 // ObjectReader unmarshals the state of an Ice object.
641 //
642 class ObjectReader : public Ice::Object
643 {
644 public:
645 
646     ObjectReader(PyObject*, const ValueInfoPtr&);
647     ~ObjectReader();
648 
649     virtual void ice_postUnmarshal();
650 
651     virtual void _iceWrite(Ice::OutputStream*) const;
652     virtual void _iceRead(Ice::InputStream*);
653 
654     virtual ValueInfoPtr getInfo() const;
655 
656     PyObject* getObject() const; // Borrowed reference.
657 
658     Ice::SlicedDataPtr getSlicedData() const;
659 
660 private:
661 
662     PyObject* _object;
663     ValueInfoPtr _info;
664     Ice::SlicedDataPtr _slicedData;
665 };
666 
667 //
668 // ExceptionWriter wraps a Python user exception for marshaling.
669 //
670 class ExceptionWriter : public Ice::UserException
671 {
672 public:
673 
674     ExceptionWriter(const PyObjectHandle&, const ExceptionInfoPtr& = 0);
675     ~ExceptionWriter() throw();
676 
677     virtual std::string ice_id() const;
678 #ifndef ICE_CPP11_MAPPING
679     virtual Ice::UserException* ice_clone() const;
680 #endif
681     virtual void ice_throw() const;
682 
683     virtual void _write(Ice::OutputStream*) const;
684     virtual void _read(Ice::InputStream*);
685 
686     virtual bool _usesClasses() const;
687 
688 protected:
689 
_writeImpl(Ice::OutputStream *)690     virtual void _writeImpl(Ice::OutputStream*) const {}
_readImpl(Ice::InputStream *)691     virtual void _readImpl(Ice::InputStream*) {}
692 
693 private:
694 
695     PyObjectHandle _ex;
696     ExceptionInfoPtr _info;
697     ObjectMap _objects;
698 };
699 
700 //
701 // ExceptionReader creates a Python user exception and unmarshals it.
702 //
703 class ExceptionReader : public Ice::UserException
704 {
705 public:
706 
707     ExceptionReader(const ExceptionInfoPtr&);
708     ~ExceptionReader() throw();
709 
710     virtual std::string ice_id() const;
711 #ifndef ICE_CPP11_MAPPING
712     virtual Ice::UserException* ice_clone() const;
713 #endif
714     virtual void ice_throw() const;
715 
716     virtual void _write(Ice::OutputStream*) const;
717     virtual void _read(Ice::InputStream*);
718 
719     virtual bool _usesClasses() const;
720 
721     PyObject* getException() const; // Borrowed reference.
722 
723     Ice::SlicedDataPtr getSlicedData() const;
724 
725 protected:
726 
_writeImpl(Ice::OutputStream *)727     virtual void _writeImpl(Ice::OutputStream*) const {}
_readImpl(Ice::InputStream *)728     virtual void _readImpl(Ice::InputStream*) {}
729 
730 private:
731 
732     ExceptionInfoPtr _info;
733     PyObjectHandle _ex;
734     Ice::SlicedDataPtr _slicedData;
735 };
736 
737 class IdResolver : public Ice::CompactIdResolver
738 {
739 public:
740 
741     virtual ::std::string resolve(Ice::Int) const;
742 };
743 
744 ClassInfoPtr lookupClassInfo(const std::string&);
745 ValueInfoPtr lookupValueInfo(const std::string&);
746 ExceptionInfoPtr lookupExceptionInfo(const std::string&);
747 
748 extern PyObject* Unset;
749 
750 bool initTypes(PyObject*);
751 
752 PyObject* createType(const TypeInfoPtr&);
753 TypeInfoPtr getType(PyObject*);
754 
755 PyObject* createException(const ExceptionInfoPtr&);
756 ExceptionInfoPtr getException(PyObject*);
757 
758 PyObject* createBuffer(const BufferPtr&);
759 
760 }
761 
762 extern "C" PyObject* IcePy_defineEnum(PyObject*, PyObject*);
763 extern "C" PyObject* IcePy_defineStruct(PyObject*, PyObject*);
764 extern "C" PyObject* IcePy_defineSequence(PyObject*, PyObject*);
765 extern "C" PyObject* IcePy_defineCustom(PyObject*, PyObject*);
766 extern "C" PyObject* IcePy_defineDictionary(PyObject*, PyObject*);
767 extern "C" PyObject* IcePy_declareProxy(PyObject*, PyObject*);
768 extern "C" PyObject* IcePy_defineProxy(PyObject*, PyObject*);
769 extern "C" PyObject* IcePy_declareClass(PyObject*, PyObject*);
770 extern "C" PyObject* IcePy_defineClass(PyObject*, PyObject*);
771 extern "C" PyObject* IcePy_declareValue(PyObject*, PyObject*);
772 extern "C" PyObject* IcePy_defineValue(PyObject*, PyObject*);
773 extern "C" PyObject* IcePy_defineException(PyObject*, PyObject*);
774 extern "C" PyObject* IcePy_stringify(PyObject*, PyObject*);
775 extern "C" PyObject* IcePy_stringifyException(PyObject*, PyObject*);
776 
777 #endif
778