Skip to content
Alex Dickhans edited this page Dec 15, 2021 · 5 revisions

Shared flags

Shared flags are configurations that are passed into and shared between all states. To do this we will have a charged pointer that we will pass into all states so they can read the global configurations. We will need a class that will create a easy way to access a hash map that you can use to store a key to all the objects in a efficient and easy to implement way.

Class implementation

This class will have a few parts, variables holding the shared flag values, and the getters and setters for those variables. This will be a part of super class State so all states will inherit the information during instantiation. The class will have these variables.

std::unordered_map<std::string, double> sharedDoubleValues;
std::unordered_map<std::string, bool> sharedBoolValues;
std::unordered_map<std::string, int> sharedIntValues;
std::unordered_map<std::string, std::string> sharedStringValues;
std::unordered_map<std::string, sharedFlags> sharedFlagValues;