Empirical
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
emp::StateGridInfo Class Reference

Full information about the states available in a state grid and meanings of each state. More...

#include <StateGrid.h>

Classes

struct  StateInfo
 Information about what a particular state type means in a state grid. More...
 

Public Member Functions

 StateGridInfo ()
 
 StateGridInfo (const StateGridInfo &)=default
 
 StateGridInfo (StateGridInfo &&)=default
 
 ~StateGridInfo ()
 
StateGridInfooperator= (const StateGridInfo &)=default
 
StateGridInfooperator= (StateGridInfo &&)=default
 
size_t GetNumStates () const
 
char GetSymbol (int state_id) const
 
double GetScoreChange (int state_id) const
 
const std::string & GetName (int state_id) const
 
const std::string & GetDesc (int state_id) const
 
int GetState (char symbol) const
 
int GetState (const std::string &name) const
 
void AddState (int id, char symbol, double mult=1.0, std::string name="", std::string desc="")
 

Protected Member Functions

size_t GetKey (int state_id) const
 
size_t GetKey (char symbol) const
 
size_t GetKey (const std::string &name) const
 

Protected Attributes

emp::vector< StateInfostates
 All available states. Position is key ID. More...
 
std::map< int, size_t > state_map
 Map of state_id to key ID (state_id can be < 0) More...
 
std::map< char, size_t > symbol_map
 Map of symbols to associated key ID. More...
 
std::map< std::string, size_t > name_map
 Map of names to associated key ID. More...
 

Detailed Description

Full information about the states available in a state grid and meanings of each state.

Constructor & Destructor Documentation

emp::StateGridInfo::StateGridInfo ( )
inline
emp::StateGridInfo::StateGridInfo ( const StateGridInfo )
default
emp::StateGridInfo::StateGridInfo ( StateGridInfo &&  )
default
emp::StateGridInfo::~StateGridInfo ( )
inline

Member Function Documentation

void emp::StateGridInfo::AddState ( int  id,
char  symbol,
double  mult = 1.0,
std::string  name = "",
std::string  desc = "" 
)
inline
const std::string& emp::StateGridInfo::GetDesc ( int  state_id) const
inline
size_t emp::StateGridInfo::GetKey ( int  state_id) const
inlineprotected
size_t emp::StateGridInfo::GetKey ( char  symbol) const
inlineprotected
size_t emp::StateGridInfo::GetKey ( const std::string &  name) const
inlineprotected
const std::string& emp::StateGridInfo::GetName ( int  state_id) const
inline
size_t emp::StateGridInfo::GetNumStates ( ) const
inline
double emp::StateGridInfo::GetScoreChange ( int  state_id) const
inline
int emp::StateGridInfo::GetState ( char  symbol) const
inline
int emp::StateGridInfo::GetState ( const std::string &  name) const
inline
char emp::StateGridInfo::GetSymbol ( int  state_id) const
inline
StateGridInfo& emp::StateGridInfo::operator= ( const StateGridInfo )
default
StateGridInfo& emp::StateGridInfo::operator= ( StateGridInfo &&  )
default

Member Data Documentation

std::map<std::string, size_t> emp::StateGridInfo::name_map
protected

Map of names to associated key ID.

std::map<int, size_t> emp::StateGridInfo::state_map
protected

Map of state_id to key ID (state_id can be < 0)

emp::vector<StateInfo> emp::StateGridInfo::states
protected

All available states. Position is key ID.

std::map<char, size_t> emp::StateGridInfo::symbol_map
protected

Map of symbols to associated key ID.


The documentation for this class was generated from the following file: