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

A StateGrid describes a map of grid positions to the current state of each position. More...

#include <StateGrid.h>

Public Member Functions

 StateGrid ()
 
 StateGrid (StateGridInfo &_i, size_t _w=1, size_t _h=1, int init_val=0)
 
 StateGrid (StateGridInfo &_i, const std::string &filename)
 
 StateGrid (const StateGrid &)=default
 
 StateGrid (StateGrid &&in)=default
 
 ~StateGrid ()
 
StateGridoperator= (const StateGrid &)=default
 
StateGridoperator= (StateGrid &&)=default
 
size_t GetWidth () const
 
size_t GetHeight () const
 
size_t GetSize () const
 
const emp::vector< int > GetStates () const
 
const StateGridInfoGetInfo () const
 
int & operator() (size_t x, size_t y)
 
int operator() (size_t x, size_t y) const
 
int GetState (size_t x, size_t y) const
 
int GetState (size_t id) const
 
StateGridSetState (size_t x, size_t y, int in)
 
char GetSymbol (size_t x, size_t y) const
 
double GetScoreChange (size_t x, size_t y) const
 
const std::string & GetName (size_t x, size_t y) const
 
emp::BitVector IsState (int target_state)
 Return a BitVector indicating which positions in the state grid have a particular state. More...
 
template<typename... Ts>
void AddState (Ts &&...args)
 Setup the StateGridInfo with possible states. More...
 
template<typename... Ts>
StateGridLoad (Ts &&...args)
 Load in the contents of a StateGrid using the file information provided. More...
 
template<typename... Ts>
const StateGridPrint (std::ostream &os=std::cout) const
 Print the current status of the StateGrid to an output stream. More...
 
template<typename... Ts>
const StateGridWrite (Ts &&...args) const
 Store the current status of the StateGrid to a file. More...
 

Protected Attributes

size_t width
 Width of the overall grid. More...
 
size_t height
 Height of the overall grid. More...
 
emp::vector< int > states
 Specific states at each position in the grid. More...
 
StateGridInfo info
 Information about the set of states used in this grid. More...
 

Detailed Description

A StateGrid describes a map of grid positions to the current state of each position.

Constructor & Destructor Documentation

emp::StateGrid::StateGrid ( )
inline
emp::StateGrid::StateGrid ( StateGridInfo _i,
size_t  _w = 1,
size_t  _h = 1,
int  init_val = 0 
)
inline
emp::StateGrid::StateGrid ( StateGridInfo _i,
const std::string &  filename 
)
inline
emp::StateGrid::StateGrid ( const StateGrid )
default
emp::StateGrid::StateGrid ( StateGrid &&  in)
default
emp::StateGrid::~StateGrid ( )
inline

Member Function Documentation

template<typename... Ts>
void emp::StateGrid::AddState ( Ts &&...  args)
inline

Setup the StateGridInfo with possible states.

size_t emp::StateGrid::GetHeight ( ) const
inline
const StateGridInfo& emp::StateGrid::GetInfo ( ) const
inline
const std::string& emp::StateGrid::GetName ( size_t  x,
size_t  y 
) const
inline
double emp::StateGrid::GetScoreChange ( size_t  x,
size_t  y 
) const
inline
size_t emp::StateGrid::GetSize ( ) const
inline
int emp::StateGrid::GetState ( size_t  x,
size_t  y 
) const
inline
int emp::StateGrid::GetState ( size_t  id) const
inline
const emp::vector<int> emp::StateGrid::GetStates ( ) const
inline
char emp::StateGrid::GetSymbol ( size_t  x,
size_t  y 
) const
inline
size_t emp::StateGrid::GetWidth ( ) const
inline
emp::BitVector emp::StateGrid::IsState ( int  target_state)
inline

Return a BitVector indicating which positions in the state grid have a particular state.

template<typename... Ts>
StateGrid& emp::StateGrid::Load ( Ts &&...  args)
inline

Load in the contents of a StateGrid using the file information provided.

int& emp::StateGrid::operator() ( size_t  x,
size_t  y 
)
inline
int emp::StateGrid::operator() ( size_t  x,
size_t  y 
) const
inline
StateGrid& emp::StateGrid::operator= ( const StateGrid )
default
StateGrid& emp::StateGrid::operator= ( StateGrid &&  )
default
template<typename... Ts>
const StateGrid& emp::StateGrid::Print ( std::ostream &  os = std::cout) const
inline

Print the current status of the StateGrid to an output stream.

StateGrid& emp::StateGrid::SetState ( size_t  x,
size_t  y,
int  in 
)
inline
template<typename... Ts>
const StateGrid& emp::StateGrid::Write ( Ts &&...  args) const
inline

Store the current status of the StateGrid to a file.

Member Data Documentation

size_t emp::StateGrid::height
protected

Height of the overall grid.

StateGridInfo emp::StateGrid::info
protected

Information about the set of states used in this grid.

emp::vector<int> emp::StateGrid::states
protected

Specific states at each position in the grid.

size_t emp::StateGrid::width
protected

Width of the overall grid.


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