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

dtool/src/interrogatedb/interrogateFunction.h

Go to the documentation of this file.
00001 // Filename: interrogateFunction.h
00002 // Created by:  drose (01Aug00)
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 INTERROGATEFUNCTION_H
00020 #define INTERROGATEFUNCTION_H
00021 
00022 #include "dtoolbase.h"
00023 
00024 #include "interrogateComponent.h"
00025 
00026 #include <vector>
00027 #include <map>
00028 
00029 class IndexRemapper;
00030 class CPPInstance;
00031 
00032 ////////////////////////////////////////////////////////////////////
00033 //       Class : InterrogateFunction
00034 // Description : An internal representation of a function.
00035 ////////////////////////////////////////////////////////////////////
00036 class EXPCL_DTOOLCONFIG InterrogateFunction : public InterrogateComponent {
00037 public:
00038   INLINE InterrogateFunction(InterrogateModuleDef *def = NULL);
00039   INLINE InterrogateFunction(const InterrogateFunction &copy);
00040   void operator = (const InterrogateFunction &copy);
00041 
00042   INLINE bool is_global() const;
00043   INLINE bool is_virtual() const;
00044   INLINE bool is_method() const;
00045   INLINE TypeIndex get_class() const;
00046 
00047   INLINE bool has_scoped_name() const;
00048   INLINE const string &get_scoped_name() const;
00049 
00050   INLINE bool has_comment() const;
00051   INLINE const string &get_comment() const;
00052 
00053   INLINE bool has_prototype() const;
00054   INLINE const string &get_prototype() const;
00055 
00056   INLINE int number_of_c_wrappers() const;
00057   INLINE FunctionWrapperIndex get_c_wrapper(int n) const;
00058 
00059   INLINE int number_of_python_wrappers() const;
00060   INLINE FunctionWrapperIndex get_python_wrapper(int n) const;
00061 
00062   void output(ostream &out) const;
00063   void input(istream &in);
00064 
00065   void remap_indices(const IndexRemapper &remap);
00066 
00067 private:
00068   enum Flags {
00069     F_global          = 0x0001,
00070     F_virtual         = 0x0002,
00071     F_method          = 0x0004,
00072     F_typecast        = 0x0008,
00073     F_getter          = 0x0010,
00074     F_setter          = 0x0020,
00075   };
00076 
00077   int _flags;
00078   string _scoped_name;
00079   string _comment;
00080   string _prototype;
00081   TypeIndex _class;
00082 
00083   typedef vector<FunctionWrapperIndex> Wrappers;
00084   Wrappers _c_wrappers;
00085   Wrappers _python_wrappers;
00086 
00087 public:
00088   // The rest of the members in this class aren't part of the public
00089   // interface to interrogate, but are used internally as the
00090   // interrogate database is built.  They are valid only during the
00091   // session of interrogate that generates the database, and will not
00092   // be filled in when the database is reloaded from disk.
00093 
00094   // This must be a pointer, rather than a concrete map, so we don't
00095   // risk trying to create a map in one DLL and access it in another.
00096   // Silly Windows.
00097   typedef map<string, CPPInstance *> Instances;
00098   Instances *_instances;
00099   string _expression;
00100 
00101   friend class InterrogateBuilder;
00102   friend class InterfaceMakerC;
00103   friend class InterfaceMakerPythonSimple;
00104   friend class FunctionRemap;
00105 };
00106 
00107 INLINE ostream &operator << (ostream &out, const InterrogateFunction &function);
00108 INLINE istream &operator >> (istream &in, InterrogateFunction &function);
00109 
00110 #include "interrogateFunction.I"
00111 
00112 #endif

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