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

panda/src/express/typeRegistryNode.h

Go to the documentation of this file.
00001 // Filename: typeRegistryNode.h
00002 // Created by:  drose (06Aug01)
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 TYPEREGISTRYNODE_H
00020 #define TYPEREGISTRYNODE_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "typeHandle.h"
00025 
00026 #include "pvector.h"
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //       Class : TypeRegistryNode
00030 // Description : This is a single entry in the TypeRegistry.
00031 //               Normally, user code will never directly access this
00032 //               class; this class is hidden within the TypeRegistry
00033 //               accessors.
00034 ////////////////////////////////////////////////////////////////////
00035 class EXPCL_PANDAEXPRESS TypeRegistryNode {
00036 public:
00037   TypeRegistryNode(TypeHandle handle, const string &name, TypeHandle &ref);
00038 
00039   static bool is_derived_from(const TypeRegistryNode *child,
00040                               const TypeRegistryNode *base);
00041 
00042   static TypeHandle get_parent_towards(const TypeRegistryNode *child,
00043                                        const TypeRegistryNode *base);
00044 
00045   void clear_subtree();
00046   void define_subtree();
00047 
00048   TypeHandle _handle;
00049   string _name;
00050   TypeHandle &_ref;
00051   typedef pvector<TypeRegistryNode *> Classes;
00052   Classes _parent_classes;
00053   Classes _child_classes;
00054 
00055   static bool _paranoid_inheritance;
00056 
00057 private:
00058   typedef int SubtreeMaskType;
00059 
00060   // This class defines the inheritance relationship of this node from
00061   // some ancestor denoted as a "subtree top" node.  This is usually
00062   // the nearest ancestor that has multiple inheritance.
00063   class Inherit {
00064   public:
00065     INLINE Inherit();
00066     INLINE Inherit(TypeRegistryNode *top, int bit_count, 
00067                    SubtreeMaskType bits);
00068     INLINE Inherit(const Inherit &copy);
00069     INLINE void operator = (const Inherit &copy);
00070     
00071     INLINE bool operator < (const Inherit &other) const;
00072     INLINE static bool is_derived_from(const Inherit &child, const Inherit &base);
00073 
00074     TypeRegistryNode *_top;
00075     SubtreeMaskType _mask;
00076     SubtreeMaskType _bits;
00077   };
00078   typedef pvector<Inherit> TopInheritance;
00079 
00080   void r_build_subtrees(TypeRegistryNode *top, 
00081                         int bit_count, SubtreeMaskType bits);
00082 
00083   static bool check_derived_from(const TypeRegistryNode *child,
00084                                  const TypeRegistryNode *base);
00085 
00086   Inherit _inherit;
00087 
00088   // The _top_inheritance member is only filled for nodes that are
00089   // denoted as "subtree top" nodes.  It represents the complete set
00090   // of subtree_top nodes that this node inherits from, directly or
00091   // indirectly.
00092   TopInheritance _top_inheritance;
00093 
00094   // _visit_count is only used during r_build_subtree().
00095   int _visit_count;
00096 };
00097 
00098 #include "typeRegistryNode.I"
00099 
00100 #endif

Generated on Fri May 2 00:38:44 2003 for Panda by doxygen1.3