State.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17/* Desc: A generic physics state
18 * Author: Nate Koenig
19 */
20
21#ifndef _STATE_HH_
22#define _STATE_HH_
23
24#include <string>
25
26#include <sdf/sdf.hh>
27
29#include "gazebo/common/Time.hh"
30#include "gazebo/util/system.hh"
31
32namespace gazebo
33{
34 namespace physics
35 {
38
43 class GZ_PHYSICS_VISIBLE State
44 {
46 public: State();
47
56 public: State(const std::string &_name,
57 const common::Time &_realTime,
58 const common::Time &_simTime,
59 const uint64_t _iterations);
60
62 public: virtual ~State();
63
68 public: virtual void Load(const sdf::ElementPtr _elem);
69
73 public: State &operator=(const State &_state);
74
78 public: State operator-(const State &_state) const;
79
83 public: std::string GetName() const;
84
88 public: void SetName(const std::string &_name);
89
92 public: common::Time GetWallTime() const;
93
96 public: common::Time GetRealTime() const;
97
100 public: common::Time GetSimTime() const;
101
104 public: uint64_t GetIterations() const;
105
109 public: virtual void SetWallTime(const common::Time &_time);
110
113 public: virtual void SetRealTime(const common::Time &_time);
114
117 public: virtual void SetSimTime(const common::Time &_time);
118
121 public: virtual void SetIterations(const uint64_t _iterations);
122
124 protected: std::string name;
125
127 protected: common::Time wallTime, realTime, simTime;
128
131 protected: uint64_t iterations = 0;
132 };
134 }
135}
136#endif
default namespace for gazebo
A Time class, can be used to hold wall- or sim-time.
Definition Time.hh:48
State of an entity.
Definition State.hh:44
virtual void SetRealTime(const common::Time &_time)
Set the real time when this state was generated.
virtual void SetSimTime(const common::Time &_time)
Set the sim time when this state was generated.
uint64_t iterations
The number of simulation iterations when this state was generated.
Definition State.hh:131
void SetName(const std::string &_name)
Set the name associated with this State.
common::Time wallTime
Times for the state data.
Definition State.hh:127
virtual void SetWallTime(const common::Time &_time)
Set the wall time when this state was generated.
State & operator=(const State &_state)
Assignment operator.
State()
Default constructor.
uint64_t GetIterations() const
Get the iterations when this state was generated.
virtual ~State()
Destructor.
std::string GetName() const
Get the name associated with this State.
std::string name
Name associated with this State.
Definition State.hh:124
common::Time GetRealTime() const
Get the real time when this state was generated.
common::Time GetSimTime() const
Get the sim time when this state was generated.
common::Time GetWallTime() const
Get the wall time when this state was generated.
virtual void Load(const sdf::ElementPtr _elem)
Load state from SDF element.
common::Time simTime
Definition State.hh:127
virtual void SetIterations(const uint64_t _iterations)
Set the iterations when this state was generated.
common::Time realTime
Definition State.hh:127
State(const std::string &_name, const common::Time &_realTime, const common::Time &_simTime, const uint64_t _iterations)
Constructor.
State operator-(const State &_state) const
Subtraction operator.
Forward declarations for the common classes.
Definition Animation.hh:27