00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #ifndef INTERFACEMAKERPYTHONOBJ_H
00020 #define INTERFACEMAKERPYTHONOBJ_H
00021 
00022 #include "dtoolbase.h"
00023 
00024 #include "interfaceMakerPython.h"
00025 #include "interrogate_interface.h"
00026 
00027 #include <map>
00028 
00029 class InterrogateType;
00030 class InterrogateFunction;
00031 class FunctionRemap;
00032 class CPPInstance;
00033 class FunctionWriterPtrFromPython;
00034 class FunctionWriterPtrToPython;
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 class InterfaceMakerPythonObj : public InterfaceMakerPython {
00043 public:
00044   InterfaceMakerPythonObj(InterrogateModuleDef *def);
00045   virtual ~InterfaceMakerPythonObj();
00046 
00047   virtual void write_prototypes(ostream &out);
00048   virtual void write_functions(ostream &out);
00049 
00050   virtual void write_module(ostream &out, InterrogateModuleDef *def);
00051 
00052   virtual bool synthesize_this_parameter();
00053 
00054   static string get_builder_name(CPPType *struct_type);
00055 
00056 protected:
00057   virtual string get_wrapper_prefix();
00058 
00059 private:
00060   void write_class_wrapper(ostream &out, Object *object);
00061   void write_prototype_for(ostream &out, Function *func);
00062   void write_function_for(ostream &out, Function *func);
00063   void write_function_instance(ostream &out, int indent_level, Function *func,
00064                                FunctionRemap *remap, string &expected_params);
00065 
00066   void pack_return_value(ostream &out, int indent_level,
00067                          FunctionRemap *remap, string return_expr);
00068 
00069   FunctionWriterPtrFromPython *get_ptr_from_python(CPPType *type);
00070   FunctionWriterPtrToPython *get_ptr_to_python(CPPType *type);
00071 
00072   typedef map<CPPType *, FunctionWriter *> PtrConverter;
00073   PtrConverter _from_python;
00074   PtrConverter _to_python;
00075 };
00076 
00077 #endif