00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PEEKABOT_SCENE_TREE_HH_INCLUDED
00024 #define PEEKABOT_SCENE_TREE_HH_INCLUDED
00025
00026
00027 #include <map>
00028 #include <string>
00029 #include <boost/utility.hpp>
00030 #include <boost/thread/recursive_mutex.hpp>
00031
00032 #include "Types.hh"
00033
00034
00035 namespace peekabot
00036 {
00037 class SceneObject;
00038 class SceneTreePtr;
00039
00040
00044 class SceneTree : public boost::noncopyable
00045 {
00046 public:
00047 SceneTree();
00048
00049 virtual ~SceneTree() throw();
00050
00051 SceneObject *get_root() throw();
00052
00053 SceneObject *get_object(ObjectID id) throw();
00054
00059 SceneObject *get_object(
00060 const std::string &path,
00061 SceneObject *path_parent = 0) throw();
00062
00063 private:
00064 friend class SceneTreePtr;
00065
00066 typedef boost::recursive_mutex SceneTreeMutex;
00067
00068 SceneTreeMutex m_scene_mutex;
00069
00070 private:
00071 SceneObject *m_root;
00072
00076 class TranslationTable : public boost::noncopyable
00077 {
00078 public:
00087 TranslationTable(SceneObject *root) throw();
00088
00089 SceneObject *translate(ObjectID id) const throw();
00090
00091 private:
00092 void on_child_attached(SceneObject *object) throw();
00093
00105 void on_detached(SceneObject *object) throw();
00106
00107 bool add_rule(SceneObject *object) throw();
00108
00109 bool remove_rule(SceneObject *object) throw();
00110
00111 private:
00112 typedef std::map<ObjectID, SceneObject *> TranslationMap;
00113
00114 TranslationMap m_id_map;
00115 };
00116
00117 TranslationTable m_translation_table;
00118 };
00119 }
00120
00121
00122 #endif // PEEKABOT_SCENE_TREE_HH_INCLUDED