00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef ATTRIBNODEREGISTRY_H
00016 #define ATTRIBNODEREGISTRY_H
00017
00018 #include "pandabase.h"
00019 #include "nodePath.h"
00020 #include "ordered_vector.h"
00021 #include "lightMutex.h"
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 class EXPCL_PANDA_PGRAPH AttribNodeRegistry {
00039 protected:
00040 AttribNodeRegistry();
00041
00042 PUBLISHED:
00043 void add_node(const NodePath &attrib_node);
00044 bool remove_node(const NodePath &attrib_node);
00045 NodePath lookup_node(const NodePath &orig_node) const;
00046
00047 int get_num_nodes() const;
00048 NodePath get_node(int n) const;
00049 MAKE_SEQ(get_nodes, get_num_nodes, get_node);
00050 TypeHandle get_node_type(int n) const;
00051 string get_node_name(int n) const;
00052
00053 int find_node(const NodePath &attrib_node) const;
00054 int find_node(TypeHandle type, const string &name) const;
00055 void remove_node(int n);
00056 void clear();
00057
00058 void output(ostream &out) const;
00059 void write(ostream &out) const;
00060
00061 INLINE static AttribNodeRegistry *get_global_ptr();
00062
00063 private:
00064 static void make_global_ptr();
00065
00066 class Entry {
00067 public:
00068 INLINE Entry(const NodePath &node);
00069 INLINE Entry(TypeHandle type, const string &name);
00070 INLINE bool operator < (const Entry &other) const;
00071
00072 TypeHandle _type;
00073 string _name;
00074 NodePath _node;
00075 };
00076
00077 typedef ov_set<Entry> Entries;
00078 Entries _entries;
00079
00080 LightMutex _lock;
00081
00082 static AttribNodeRegistry * TVOLATILE _global_ptr;
00083 };
00084
00085 #include "attribNodeRegistry.I"
00086
00087 #endif
00088