21 #ifndef _WORLDSTATE_HH_
22 #define _WORLDSTATE_HH_
61 public:
explicit WorldState(
const sdf::ElementPtr _sdf);
70 public:
void Load(
const WorldPtr _world);
76 public:
virtual void Load(
const sdf::ElementPtr _elem);
80 public:
void SetWorld(
const WorldPtr _world);
86 public:
ModelState_M GetModelStates(
const boost::regex &_regex)
const;
96 public:
unsigned int GetModelStateCount()
const;
102 public:
ModelState GetModelState(
const std::string &_modelName)
const;
108 public:
bool HasModelState(
const std::string &_modelName)
const;
114 public:
bool IsZero()
const;
118 public:
void FillSDF(sdf::ElementPtr _sdf);
123 public:
virtual void SetWallTime(
const common::Time &_time);
127 public:
virtual void SetRealTime(
const common::Time &_time);
131 public:
virtual void SetSimTime(
const common::Time &_time);
136 public:
virtual void SetIterations(
const uint64_t _iterations);
157 public:
inline friend std::ostream &
operator<<(std::ostream &_out,
160 _out <<
"<state world_name='" << _state.
name <<
"'>"
161 <<
"<sim_time>" << _state.
simTime <<
"</sim_time>"
162 <<
"<wall_time>" << _state.
wallTime <<
"</wall_time>"
163 <<
"<real_time>" << _state.
realTime <<
"</real_time>"
164 <<
"<iterations>" << _state.
iterations <<
"</iterations>";
167 if (_state.insertions.size() > 0)
169 _out <<
"<insertions>";
170 for (std::vector<std::string>::const_iterator iter =
171 _state.insertions.begin();
172 iter != _state.insertions.end(); ++iter)
176 _out <<
"</insertions>";
180 if (_state.deletions.size() > 0)
182 _out <<
"<deletions>";
183 for (std::vector<std::string>::const_iterator iter =
184 _state.deletions.begin();
185 iter != _state.deletions.end(); ++iter)
187 _out <<
"<name>" << (*iter) <<
"</name>";
189 _out <<
"</deletions>";
193 for (ModelState_M::const_iterator iter = _state.modelStates.begin();
194 iter != _state.modelStates.end(); ++iter)
196 _out << iter->second;
209 private: std::vector<std::string> insertions;
213 private: std::vector<std::string> deletions;
friend std::ostream & operator<<(std::ostream &_out, const gazebo::physics::WorldState &_state)
Stream insertion operator.
Definition: WorldState.hh:157
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:318
std::string name
Name associated with this State.
Definition: State.hh:130
common::Time realTime
Definition: State.hh:133
State of an entity.
Definition: State.hh:49
std::map< std::string, ModelState > ModelState_M
Definition: PhysicsTypes.hh:204
common::Time wallTime
Times for the state data.
Definition: State.hh:133
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:80
common::Time simTime
Definition: State.hh:133
Store state information of a physics::Model object.
Definition: ModelState.hh:50
uint64_t iterations
The number of simulation iterations when this state was generated.
Definition: State.hh:137
Store state information of a physics::World object.
Definition: WorldState.hh:46
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:39