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

dtool/src/interrogate/interfaceMakerPythonSimple.h

Go to the documentation of this file.
00001 // Filename: interfaceMakerPythonSimple.h
00002 // Created by:  drose (01Oct01)
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 INTERFACEMAKERPYTHONSIMPLE_H
00020 #define INTERFACEMAKERPYTHONSIMPLE_H
00021 
00022 #include "dtoolbase.h"
00023 
00024 #include "interfaceMakerPython.h"
00025 #include "interrogate_interface.h"
00026 
00027 class FunctionRemap;
00028 
00029 ////////////////////////////////////////////////////////////////////
00030 //       Class : InterfaceMakerPythonSimple
00031 // Description : An InterfaceMaker for generating simple Python
00032 //               function wrappers around C++ code.  This allows the
00033 //               C++ code to be called by Python, but not necessarily
00034 //               in a user-friendly or object-oriented way.
00035 //
00036 //               You probably want to use InterfaceMakerPythonObj for
00037 //               a full object-oriented solution.  This InterfaceMaker
00038 //               is primarily useful as a stopgap for our old
00039 //               Python-based FFI system.
00040 ////////////////////////////////////////////////////////////////////
00041 class InterfaceMakerPythonSimple : public InterfaceMakerPython {
00042 public:
00043   InterfaceMakerPythonSimple(InterrogateModuleDef *def);
00044   virtual ~InterfaceMakerPythonSimple();
00045 
00046   virtual void write_prototypes(ostream &out);
00047   virtual void write_functions(ostream &out);
00048 
00049   virtual void write_module(ostream &out, InterrogateModuleDef *def);
00050 
00051   virtual bool synthesize_this_parameter();
00052 
00053 protected:
00054   virtual string get_wrapper_prefix();
00055   virtual string get_unique_prefix();
00056 
00057   virtual void
00058   record_function_wrapper(InterrogateFunction &ifunc, 
00059                           FunctionWrapperIndex wrapper_index);
00060 
00061 private:
00062   void write_prototype_for(ostream &out, Function *func);
00063   void write_function_for(ostream &out, Function *func);
00064   void write_function_instance(ostream &out, Function *func,
00065                                FunctionRemap *remap);
00066 
00067   void pack_return_value(ostream &out, int indent_level,
00068                          FunctionRemap *remap, string return_expr);
00069 };
00070 
00071 #endif

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