Project Malmo  0.17.0
Public Member Functions | Public Attributes | Friends | List of all members
malmo::TimestampedReward Class Reference

A map of int:double storing a value on each dimension, with an attached timestamp saying when it was collected. More...

#include <TimestampedReward.h>

Public Member Functions

 TimestampedReward ()
 Constructs an empty reward.
 
 TimestampedReward (float reward)
 Constructs from a single reward float (assumes default dimension of 0)
 
TimestampedRewardcreateFromXML (boost::posix_time::ptime timestamp, std::string xml_string)
 Constructs from an XML string.
 
TimestampedRewardcreateFromSimpleString (boost::posix_time::ptime timestamp, std::string simple_string)
 Constructs from a simple string.
 
 TimestampedReward (boost::posix_time::ptime timestamp, const schemas::Reward &reward)
 Constructs from an XML node element.
 
void setValuesFromRewardStructure (const schemas::Reward &reward)
 Sets the values stored in this reward to be those from the specified XML structure.
 
std::string getAsXML (bool prettyPrint) const
 Formats as an XML string. More...
 
std::string getAsSimpleString () const
 Formats as a simple string. More...
 
bool hasValueOnDimension (int dimension) const
 Returns whether a reward value is stored on the specified dimension.
 
double getValueOnDimension (int dimension) const
 Returns the reward value stored on the specified dimension.
 
double getValue () const
 Returns the reward value stored on dimension zero. By default the reward producers store their output here.
 
void add (const TimestampedReward &other)
 Merge the specified reward structure into this one, adding rewards that are on the same dimension.
 

Public Attributes

boost::posix_time::ptime timestamp
 The timestamp.
 

Friends

std::ostream & operator<< (std::ostream &os, const TimestampedReward &tsf)
 Stream a readable version, for casual inspection.
 

Detailed Description

A map of int:double storing a value on each dimension, with an attached timestamp saying when it was collected.

Member Function Documentation

std::string malmo::TimestampedReward::getAsSimpleString ( ) const

Formats as a simple string.

Returns
The reward in simple string form.
std::string malmo::TimestampedReward::getAsXML ( bool  prettyPrint) const

Formats as an XML string.

Parameters
prettyPrintIf true, add indentation and newlines to the XML to make it more readable.
Returns
The reward as an XML string.

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