00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef TYPEREGISTRYNODE_H
00016 #define TYPEREGISTRYNODE_H
00017
00018 #include "dtoolbase.h"
00019
00020 #include "typeHandle.h"
00021 #include "numeric_types.h"
00022
00023 #include <assert.h>
00024 #include <vector>
00025
00026
00027
00028
00029
00030
00031
00032
00033 class EXPCL_DTOOL TypeRegistryNode {
00034 public:
00035 TypeRegistryNode(TypeHandle handle, const string &name, TypeHandle &ref);
00036
00037 static bool is_derived_from(const TypeRegistryNode *child,
00038 const TypeRegistryNode *base);
00039
00040 static TypeHandle get_parent_towards(const TypeRegistryNode *child,
00041 const TypeRegistryNode *base);
00042
00043 void clear_subtree();
00044 void define_subtree();
00045
00046 TypeHandle _handle;
00047 string _name;
00048 TypeHandle &_ref;
00049 typedef vector<TypeRegistryNode *> Classes;
00050 Classes _parent_classes;
00051 Classes _child_classes;
00052
00053 #ifdef DO_MEMORY_USAGE
00054 AtomicAdjust::Integer _memory_usage[TypeHandle::MC_limit];
00055 #endif
00056
00057 static bool _paranoid_inheritance;
00058
00059 private:
00060 typedef int SubtreeMaskType;
00061
00062
00063
00064
00065 class Inherit {
00066 public:
00067 INLINE Inherit();
00068 INLINE Inherit(TypeRegistryNode *top, int bit_count,
00069 SubtreeMaskType bits);
00070 INLINE Inherit(const Inherit ©);
00071 INLINE void operator = (const Inherit ©);
00072
00073 INLINE bool operator < (const Inherit &other) const;
00074 INLINE static bool is_derived_from(const Inherit &child, const Inherit &base);
00075
00076 TypeRegistryNode *_top;
00077 SubtreeMaskType _mask;
00078 SubtreeMaskType _bits;
00079 };
00080 typedef vector<Inherit> TopInheritance;
00081
00082 void r_build_subtrees(TypeRegistryNode *top,
00083 int bit_count, SubtreeMaskType bits);
00084
00085 static bool check_derived_from(const TypeRegistryNode *child,
00086 const TypeRegistryNode *base);
00087
00088 Inherit _inherit;
00089
00090
00091
00092
00093
00094 TopInheritance _top_inheritance;
00095
00096
00097 int _visit_count;
00098 };
00099
00100 #include "typeRegistryNode.I"
00101
00102 #endif