UGDK  0.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
collisionmanager.h
Go to the documentation of this file.
1 #ifndef PYRAMIDWORKS_COLLISION_COLLISIONMANAGER_H_
2 #define PYRAMIDWORKS_COLLISION_COLLISIONMANAGER_H_
3 
4 #include <string>
5 #include <map>
6 #include <set>
9 #include <ugdk/action.h>
10 #include <ugdk/util/uncopyable.h>
11 
12 namespace pyramidworks {
13 namespace collision {
14 
18  public:
19  CollisionManager(const ugdk::ikdtree::Box<2>& tree_bounding_box);
21 
23  void Generate(const std::string &name);
24  void Generate(const char n[]) { const std::string str(n); Generate(str); }
25 
27  void Generate(const std::string &name, const std::string &parent);
28  void Generate(const char n[], const char p[]) {
29  const std::string name(n), parent(p);
30  Generate(name, parent);
31  }
32 
34 
37  CollisionClass* Get(const std::string &name) { return cache_[name]; }
38  CollisionClass* Get(const char n[]) { const std::string str(n); return Get(str); }
39 
40  void AddActiveObject(const CollisionObject* obj) { active_objects_.insert(obj); }
41  void RemoveActiveObject(const CollisionObject* obj) { active_objects_.erase(obj); }
42 
45 
46  private:
47  const ugdk::ikdtree::Box<2> tree_bounding_box_;
48  std::map<std::string, CollisionClass*> cache_;
49  std::set<const CollisionObject*> active_objects_;
50 };
51 
52 } // namespace collision
53 } // namespace pyramidworks
54 
55 #endif /* PYRAMIDWORKS_COLLISION_COLLISIONMANAGER_H_ */