Thrive
locked_map.h
1 #pragma once
2 
3 #include "engine/system.h"
4 #include "engine/touchable.h"
5 #include "engine/typedefs.h"
6 #include "scripting/luabind.h"
7 #include <luabind/object.hpp>
8 #include <string>
9 #include <unordered_set>
10 
11 namespace luabind {
12 class scope;
13 }
14 
15 
16 namespace thrive {
17 
18 class StorageContainer;
19 
23 class LockedMap {
24 
25 public:
26 
38  static luabind::scope
39  luaBindings();
40 
41 
48  void
49  addLock(
50  std::string lockName
51  );
52 
62  bool
63  isLocked(
64  std::string conceptName
65  ) const;
66 
73  void
74  unlock(
75  std::string conceptName
76  );
77 
84  const std::unordered_set<std::string>&
85  locksList() const;
86 
87  void
88  load(
89  const StorageContainer& storage
90  );
91 
93  storage() const;
94 
95 private:
96 
100  std::unordered_set<std::string> m_locks;
101 
102 };
103 
104 
105 
106 }
107 
void addLock(std::string lockName)
Locks a concept such that calls querying for the lock may restrict themselves.
Definition: locked_map.cpp:27
void unlock(std::string conceptName)
Unlocks a concept such that calls querying for the lock may allow themselves.
Definition: locked_map.cpp:42
static luabind::scope luaBindings()
Lua bindings.
Definition: locked_map.cpp:15
Object that contains a set of locked concepts represented and accessed by strings.
Definition: locked_map.h:23
Definition: bullet_to_ogre_system.h:5
bool isLocked(std::string conceptName) const
Checks if a lock exists in this LockedMap, otherwise it may be assumed available. ...
Definition: locked_map.cpp:34
Definition: bullet_ogre_conversion.h:6
const std::unordered_set< std::string > & locksList() const
Gets the set of all held locks.
Definition: locked_map.cpp:61
A key-value storage for serialization.
Definition: serialization.h:36