Panda3D

interrogateElement.h

00001 // Filename: interrogateElement.h
00002 // Created by:  drose (11Aug00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef INTERROGATEELEMENT_H
00016 #define INTERROGATEELEMENT_H
00017 
00018 #include "dtoolbase.h"
00019 
00020 #include "interrogateComponent.h"
00021 
00022 class IndexRemapper;
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //       Class : InterrogateElement
00026 // Description : An internal representation of a data element, like a
00027 //               data member or a global variable.
00028 ////////////////////////////////////////////////////////////////////
00029 class EXPCL_DTOOLCONFIG InterrogateElement : public InterrogateComponent {
00030 public:
00031   INLINE InterrogateElement(InterrogateModuleDef *def = NULL);
00032   INLINE InterrogateElement(const InterrogateElement &copy);
00033   INLINE void operator = (const InterrogateElement &copy);
00034 
00035   INLINE bool is_global() const;
00036 
00037   INLINE bool has_scoped_name() const;
00038   INLINE const string &get_scoped_name() const;
00039 
00040   INLINE TypeIndex get_type() const;
00041   INLINE bool has_getter() const;
00042   INLINE FunctionIndex get_getter() const;
00043   INLINE bool has_setter() const;
00044   INLINE FunctionIndex get_setter() const;
00045 
00046   void output(ostream &out) const;
00047   void input(istream &in);
00048 
00049   void remap_indices(const IndexRemapper &remap);
00050 
00051 private:
00052   enum Flags {
00053     F_global          = 0x0001,
00054     F_has_getter      = 0x0002,
00055     F_has_setter      = 0x0004
00056   };
00057 
00058   int _flags;
00059   string _scoped_name;
00060   TypeIndex _type;
00061   FunctionIndex _getter;
00062   FunctionIndex _setter;
00063 
00064   friend class InterrogateBuilder;
00065 };
00066 
00067 INLINE ostream &operator << (ostream &out, const InterrogateElement &element);
00068 INLINE istream &operator >> (istream &in, InterrogateElement &element);
00069 
00070 #include "interrogateElement.I"
00071 
00072 #endif
 All Classes Functions Variables Enumerations