Project Malmo  0.21.0
Public Member Functions | List of all members
malmo::ParameterSet Class Reference

Class which contains a list of key/value parameters for a mission. More...

#include <ParameterSet.h>

Public Member Functions

 ParameterSet ()
 Constructs a parameter set.
 
 ParameterSet (const boost::property_tree::ptree parameters)
 Constructs a parameter set using the provided property tree. More...
 
 ParameterSet (const std::string &json)
 Constructs a parameter set from the provided JSON string. More...
 
std::string toJson ()
 Returns a JSON representation of the parameter set. More...
 
void set (const std::string &key, const std::string &value)
 Sets the value of a key as a string. More...
 
std::string get (const std::string &key) const
 Gets the value of a key as a string. More...
 
void setInt (const std::string &key, const int value)
 Sets the value of a key as an integer. More...
 
int getInt (const std::string &key) const
 Gets the value of a key as an integer. More...
 
void setDouble (const std::string &key, const double value)
 Sets the value of a key as a double. More...
 
double getDouble (const std::string &key) const
 Gets the value of a key as a double. More...
 
void setBool (const std::string &key, const bool value)
 Sets the value of a key as a boolean. More...
 
bool getBool (const std::string &key) const
 Gets the value of a key as a boolean. More...
 
std::vector< std::string > keys () const
 Gets the keys in the parameter set. More...
 
void setIterationCount (const int iteration_count)
 Sets the number of iterations that these parameters should be tested. More...
 
int getIterationCount () const
 Gets the number of iterations that these parameters should be tested. More...
 

Detailed Description

Class which contains a list of key/value parameters for a mission.

Only supports a flat hierarchy.

Constructor & Destructor Documentation

◆ ParameterSet() [1/2]

malmo::ParameterSet::ParameterSet ( const boost::property_tree::ptree  parameters)

Constructs a parameter set using the provided property tree.

Parameters
parametersA property tree containing the parameters.

◆ ParameterSet() [2/2]

malmo::ParameterSet::ParameterSet ( const std::string &  json)

Constructs a parameter set from the provided JSON string.

Parameters
jsonA JSON string describing the parameter set.

Member Function Documentation

◆ get()

std::string malmo::ParameterSet::get ( const std::string &  key) const

Gets the value of a key as a string.

Parameters
keyThe parameter name.
Returns
The value of the key.

◆ getBool()

bool malmo::ParameterSet::getBool ( const std::string &  key) const

Gets the value of a key as a boolean.

Parameters
keyThe parameter name.
Returns
The key value.

◆ getDouble()

double malmo::ParameterSet::getDouble ( const std::string &  key) const

Gets the value of a key as a double.

Parameters
keyThe parameter name.
Returns
The key value.

◆ getInt()

int malmo::ParameterSet::getInt ( const std::string &  key) const

Gets the value of a key as an integer.

Parameters
keyThe parameter name.
Returns
The key value.

◆ getIterationCount()

int malmo::ParameterSet::getIterationCount ( ) const

Gets the number of iterations that these parameters should be tested.

Returns
The number of iterations.

◆ keys()

std::vector<std::string> malmo::ParameterSet::keys ( ) const

Gets the keys in the parameter set.

Returns
The keys as a list of strings.

◆ set()

void malmo::ParameterSet::set ( const std::string &  key,
const std::string &  value 
)

Sets the value of a key as a string.

Parameters
keyThe parameter name.
valueThe parameter value.

◆ setBool()

void malmo::ParameterSet::setBool ( const std::string &  key,
const bool  value 
)

Sets the value of a key as a boolean.

Parameters
keyThe parameter name.
valueThe parameter value.

◆ setDouble()

void malmo::ParameterSet::setDouble ( const std::string &  key,
const double  value 
)

Sets the value of a key as a double.

Parameters
keyThe parameter name.
valueThe parameter value.

◆ setInt()

void malmo::ParameterSet::setInt ( const std::string &  key,
const int  value 
)

Sets the value of a key as an integer.

Parameters
keyThe parameter name.
valueThe parameter value.

◆ setIterationCount()

void malmo::ParameterSet::setIterationCount ( const int  iteration_count)

Sets the number of iterations that these parameters should be tested.

Parameters
iteration_countThe number of iterations.

◆ toJson()

std::string malmo::ParameterSet::toJson ( )

Returns a JSON representation of the parameter set.

Returns
A JSON string representing the parameter set.

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