Thrive
bio_process_registry.h
1 #pragma once
2 
3 #include "scripting/luabind.h"
4 #include "engine/typedefs.h"
5 
6 #include <boost/range/adaptor/map.hpp>
7 #include <vector>
8 #include <unordered_map>
9 
10 namespace luabind {
11 class scope;
12 }
13 
14 
15 namespace thrive {
16 
17 using BoostCompoundMapIterator = boost::range_detail::select_second_mutable_range<std::unordered_map<std::string, CompoundId>>;
18 using BoostAbsorbedMapIterator = boost::range_detail::select_first_range<std::unordered_map<CompoundId, float>>;
19 
26 
27 public:
28 
44  static luabind::scope
45  luaBindings();
46 
47  static void
48  loadFromXML(
49  const std::string& filename
50  );
51 
76  static BioProcessId
78  const std::string& internalName,
79  const std::string& displayName,
80  int energyCost,
81  double speedFactor,
82  std::vector<std::pair<CompoundId, int>> inputCompounds,
83  std::vector<std::pair<CompoundId, int>> outputCompounds
84  );
85 
95  static std::string
97  BioProcessId id
98  );
99 
109  static std::string
111  BioProcessId id
112  );
113 
114  static double
115  getSpeedFactor(
116  BioProcessId id
117  );
118 
119  static int
120  getEnergyCost(
121  BioProcessId id
122  );
123 
133  static BioProcessId
134  getId(
135  const std::string& internalName
136  );
137 
138 
145  static const BoostCompoundMapIterator
146  getList();
147 
148  static const std::vector<std::pair<CompoundId, int>>&
149  getInputCompounds(
150  BioProcessId id
151  );
152 
153  static const std::vector<std::pair<CompoundId, int>>&
154  getOutputCompounds(
155  BioProcessId id
156  );
157 
158  BioProcessRegistry() = delete;
159 
160 };
161 
162 }
163 
static BioProcessId getId(const std::string &internalName)
Obtains the Id of an internal name corresponding to a registered process.
Definition: bio_process_registry.cpp:211
static std::string getDisplayName(BioProcessId id)
Obtains the display name of an compound.
Definition: bio_process_registry.cpp:173
Static abstract class keeping track of a predefined biological processes, their Id's, internal and displayed names as well as various data.
Definition: bio_process_registry.h:25
static std::string getInternalName(BioProcessId id)
Obtains the internal name of an compound.
Definition: bio_process_registry.cpp:183
Definition: bullet_to_ogre_system.h:5
static luabind::scope luaBindings()
Lua bindings.
Definition: bio_process_registry.cpp:14
Definition: bullet_ogre_conversion.h:6
static BioProcessId registerBioProcess(const std::string &internalName, const std::string &displayName, int energyCost, double speedFactor, std::vector< std::pair< CompoundId, int >> inputCompounds, std::vector< std::pair< CompoundId, int >> outputCompounds)
Registers a new process type.
Definition: bio_process_registry.cpp:146
static const BoostCompoundMapIterator getList()
Obtains the IDs of all currently registered concepts.
Definition: bio_process_registry.cpp:228