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 #ifdef _WIN32
25  // Ensure that Winsock2.h is included before Windows.h, which can get
26  // pulled in by anybody (e.g., Boost).
27  #include <Winsock2.h>
28 #endif
29 
30 #include <string>
31 
32 #include <sdf/sdf.hh>
33 
35 #include "gazebo/common/Time.hh"
36 #include "gazebo/util/system.hh"
37 
38 namespace gazebo
39 {
40  namespace physics
41  {
44 
49  class GZ_PHYSICS_VISIBLE State
50  {
52  public: State();
53 
62  public: State(const std::string &_name,
63  const common::Time &_realTime,
64  const common::Time &_simTime,
65  const uint64_t _iterations);
66 
68  public: virtual ~State();
69 
74  public: virtual void Load(const sdf::ElementPtr _elem);
75 
79  public: State &operator=(const State &_state);
80 
84  public: State operator-(const State &_state) const;
85 
89  public: std::string GetName() const;
90 
94  public: void SetName(const std::string &_name);
95 
98  public: common::Time GetWallTime() const;
99 
102  public: common::Time GetRealTime() const;
103 
106  public: common::Time GetSimTime() const;
107 
110  public: uint64_t GetIterations() const;
111 
115  public: virtual void SetWallTime(const common::Time &_time);
116 
119  public: virtual void SetRealTime(const common::Time &_time);
120 
123  public: virtual void SetSimTime(const common::Time &_time);
124 
127  public: virtual void SetIterations(const uint64_t _iterations);
128 
130  protected: std::string name;
131 
133  protected: common::Time wallTime, realTime, simTime;
134 
137  protected: uint64_t iterations = 0;
138  };
140  }
141 }
142 #endif
std::string name
Name associated with this State.
Definition: State.hh:130
common::Time wallTime
Times for the state data.
Definition: State.hh:133
State of an entity.
Definition: State.hh:49
default namespace for gazebo
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44