TorqueScript  0.2
consoleobjectregistry.hpp
1 
15 #pragma once
16 
17 #include <vector>
18 #include <memory>
19 #include <unordered_map>
20 
21 #include <torquescript/function.hpp>
22 #include <torquescript/consoleobject.hpp>
23 #include <torquescript/storedvalue.hpp>
24 #include <torquescript/stringhelpers.hpp>
25 #include <torquescript/storedvaluestack.hpp>
26 
27 #define NAMESPACE_EMPTY ""
28 #define PACKAGE_EMPTY ""
29 
30 namespace TorqueScript
31 {
33  class Compiler;
34  class CodeBlock;
35  class ExecutionState;
36 
38  {
39  public:
41 
42  void setConsoleObject(const std::string& name, std::shared_ptr<ConsoleObject> value);
43  std::shared_ptr<ConsoleObject> getConsoleObject(const std::string& name);
44  std::shared_ptr<ConsoleObject> getConsoleObject(const unsigned int id);
45 
46  std::string getConsoleObjectName(std::shared_ptr<ConsoleObject> target);
47  unsigned int getConsoleObjectID(std::shared_ptr<ConsoleObject> target);
48 
49  unsigned int addConsoleObject(std::shared_ptr<ConsoleObject> value);
50 
51  void removeConsoleObject(const std::string& name);
52  void removeConsoleObject(std::shared_ptr<ConsoleObject> target);
53 
54  private:
55  unsigned int mNextObjectID;
56 
58  std::unordered_map<unsigned int, std::shared_ptr<ConsoleObject>> mConsoleObjectsByID;
59 
61  std::unordered_map<std::string, std::shared_ptr<ConsoleObject>> mConsoleObjectsByName;
62  };
63 }
Definition: consoleobjectregistry.hpp:38
Definition: ast.hpp:28