00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00030
00031
00032
00033
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
00061
00062
00063 class Inherit {
00064 public:
00065 INLINE Inherit();
00066 INLINE Inherit(TypeRegistryNode *top, int bit_count,
00067 SubtreeMaskType bits);
00068 INLINE Inherit(const Inherit ©);
00069 INLINE void operator = (const Inherit ©);
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
00089
00090
00091
00092 TopInheritance _top_inheritance;
00093
00094
00095 int _visit_count;
00096 };
00097
00098 #include "typeRegistryNode.I"
00099
00100 #endif