Project Malmo  0.37.0
WorldState.h
1 // --------------------------------------------------------------------------------------------------
2 // Copyright (c) 2016 Microsoft Corporation
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5 // associated documentation files (the "Software"), to deal in the Software without restriction,
6 // including without limitation the rights to use, copy, modify, merge, publish, distribute,
7 // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8 // furnished to do so, subject to the following conditions:
9 //
10 // The above copyright notice and this permission notice shall be included in all copies or
11 // substantial portions of the Software.
12 //
13 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
14 // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
16 // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18 // --------------------------------------------------------------------------------------------------
19 
20 #ifndef _WORLDSTATE_H_
21 #define _WORLDSTATE_H_
22 
23 // Local:
24 #include "TimestampedReward.h"
25 #include "TimestampedString.h"
26 #include "TimestampedVideoFrame.h"
27 
28 // STL:
29 #include <vector>
30 
31 namespace malmo
32 {
34  struct WorldState
35  {
36  WorldState();
37 
39  void clear();
40 
43 
46 
48 
52 
54 
58 
60 
64 
66 
69  std::vector< boost::shared_ptr< TimestampedVideoFrame > > video_frames;
70 
72 
75  std::vector< boost::shared_ptr< TimestampedReward > > rewards;
76 
78 
81  std::vector< boost::shared_ptr< TimestampedString > > observations;
82 
84  std::vector< boost::shared_ptr< TimestampedString > > mission_control_messages;
85 
87  std::vector< boost::shared_ptr< TimestampedString > > errors;
88 
89  friend std::ostream& operator<<(std::ostream& os, const WorldState& ws);
90  };
91 }
92 
93 #endif
Represents the state of the game world at a moment in time.
Definition: WorldState.h:35
int number_of_observations_since_last_state
Contains the number of observations that have been received since the last time the world state was t...
Definition: WorldState.h:63
bool is_mission_running
Specifies whether the mission was still running at the moment this world state was taken.
Definition: WorldState.h:45
std::vector< boost::shared_ptr< TimestampedVideoFrame > > video_frames
Contains the timestamped video frames that are stored in this world state.
Definition: WorldState.h:69
std::vector< boost::shared_ptr< TimestampedReward > > rewards
Contains the timestamped rewards that are stored in this world state.
Definition: WorldState.h:75
std::vector< boost::shared_ptr< TimestampedString > > errors
If there are errors in receiving the messages then we log them here.
Definition: WorldState.h:87
std::vector< boost::shared_ptr< TimestampedString > > mission_control_messages
Contains the timestamped mission control messages that are stored in this world state.
Definition: WorldState.h:84
int number_of_video_frames_since_last_state
Contains the number of video frames that have been received since the last time the world state was t...
Definition: WorldState.h:51
std::vector< boost::shared_ptr< TimestampedString > > observations
Contains the timestamped observations that are stored in this world state.
Definition: WorldState.h:81
bool has_mission_begun
Specifies whether the mission had begun when this world state was taken (whether or not it has since ...
Definition: WorldState.h:42
int number_of_rewards_since_last_state
Contains the number of rewards that have been received since the last time the world state was taken.
Definition: WorldState.h:57
void clear()
Resets the world state to be empty, with no mission running.