libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
SolutionData Class Reference

Info storage class. More...

#include <solutiondata.h>

Public Member Functions

 SolutionData (SolutionData *SD)
 
void copySolutionData (SolutionData *SD)
 copy the data of a solutionData pointer into this one More...
 
const std::map< std::string,
int > & 
getIntMap ()
 
const std::map< std::string,
double > & 
getDoubleMap ()
 
const std::map< std::string,
std::string > & 
getStringMap ()
 
const std::map< std::string,
SolutionData * > & 
getSDMap ()
 
std::multimap< std::string,
std::string > 
getStringAsMultimapMap ()
 transform the string map into a multimap of strings More...
 
void setMapEntry (std::string key, int val)
 
void setMapEntry (std::string key, double val)
 
void setMapEntry (std::string key, std::string val)
 
void setMapEntry (std::string key, SolutionData *val)
 
void incrementMapEntry (std::string key)
 search in the int (first) and the double maps the key param and if found increment by 1 its value. More...
 
void incrementMapEntry (std::string key, int val)
 search in the int (first) and the double maps the key param and if found increment by val its value. More...
 
int getIntMapEntry (std::string key)
 
double getDoubleMapEntry (std::string key)
 
std::string getStringMapEntry (std::string key)
 
SolutionDatagetSDMapEntry (std::string key)
 
std::string getHumanReadableData ()
 Transform the data into human readable strings. More...
 
void print ()
 Call getHumanReadableData() and print the return value.
 
Json::Value getJsonValue ()
 Transform the data into json. More...
 
void loadFromJsonValue (Json::Value root)
 Fill the maps with data retrived from root, a json value. More...
 
std::string getSpace ()
 
void setSpace (std::string s)
 Set the space to leave for this specific map when creating a human readable string.
 
int getSize ()
 
void setSize (int s)
 
void clear ()
 clean all the maps.
 

Detailed Description

Info storage class.

An instance of SolutionData is used to cache the data retrived during computation (especially of GTP) It stores the data on maps, it has three different basic maps -> int, double, and string maps, and a recursive one of pointers on SolutionData. To save and entry, use setMapEntry, and to retrieve it get<>MapEntry.

Member Function Documentation

void SolutionData::copySolutionData ( SolutionData SD)

copy the data of a solutionData pointer into this one

Parameters
SDthe solution data to copy
const std::map< std::string, double > & SolutionData::getDoubleMap ( )
Returns
the double map
double SolutionData::getDoubleMapEntry ( std::string  key)
Parameters
keythe key to look for in the double map
Returns
: the value corresponding to the key in the double map.
std::string SolutionData::getHumanReadableData ( )

Transform the data into human readable strings.

Returns
: a human readable string
const std::map< std::string, int > & SolutionData::getIntMap ( )
Returns
the int map
int SolutionData::getIntMapEntry ( std::string  key)
Parameters
keythe key to look for in the int map
Returns
: the value corresponding to the key in the int map.
Json::Value SolutionData::getJsonValue ( )

Transform the data into json.

Returns
: a json value containing all the data in the maps
const std::map< std::string, SolutionData * > & SolutionData::getSDMap ( )
Returns
the solution data recursive map
SolutionData * SolutionData::getSDMapEntry ( std::string  key)
Parameters
keythe key to look for in the SolutionData map
Returns
: the value corresponding to the key in the SolutionData map.
int SolutionData::getSize ( )
Returns
: the indentation to leave between the line begining and the start of the values
std::string SolutionData::getSpace ( )
Returns
: the space to leave for this specific map for human readable string.
std::multimap< std::string, std::string > SolutionData::getStringAsMultimapMap ( )

transform the string map into a multimap of strings

Returns
string multimap
const std::map< std::string, std::string > & SolutionData::getStringMap ( )
Returns
the string map
std::string SolutionData::getStringMapEntry ( std::string  key)
Parameters
keythe key to look for in the string map
Returns
: the value corresponding to the key in the string map.
void SolutionData::incrementMapEntry ( std::string  key)

search in the int (first) and the double maps the key param and if found increment by 1 its value.

Parameters
keythe key of the value to increment
void SolutionData::incrementMapEntry ( std::string  key,
int  val 
)

search in the int (first) and the double maps the key param and if found increment by val its value.

Parameters
keythe key of the value to increment
valthe value with which to increment the value corresponding to the key
void SolutionData::loadFromJsonValue ( Json::Value  root)

Fill the maps with data retrived from root, a json value.

Parameters
roota json value containing solutionData info
void SolutionData::setMapEntry ( std::string  key,
int  val 
)
Parameters
keythe key of the int value val
valthe value to store in the map
void SolutionData::setMapEntry ( std::string  key,
double  val 
)
Parameters
keythe key of the double value val
valthe value to store in the map
void SolutionData::setMapEntry ( std::string  key,
std::string  val 
)
Parameters
keythe key of the string value val
valthe value to store in the map
void SolutionData::setMapEntry ( std::string  key,
SolutionData val 
)
Parameters
keythe key of the SolutionData* value val
valthe value to store in the map
void SolutionData::setSize ( int  s)
Parameters
sthe indentation to leave between the line begining and the start of the values

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