Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

dtool/src/interrogate/interfaceMakerPythonObj.h

Go to the documentation of this file.
00001 // Filename: interfaceMakerPythonObj.h
00002 // Created by:  drose (19Sep01)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
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 //       Class : InterfaceMakerPythonObj
00038 // Description : An InterfaceMaker suitable for generating
00039 //               object-oriented Python code, that can be imported and
00040 //               used directly by Python.
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

Generated on Thu May 1 22:13:01 2003 for DTool by doxygen1.3