UserCmdManager.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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 #ifndef GAZEBO_PHYSICS_USERCMDMANAGER_HH_
18 #define GAZEBO_PHYSICS_USERCMDMANAGER_HH_
19 
20 #include <string>
21 
23 
24 #include "gazebo/msgs/msgs.hh"
26 
27 namespace gazebo
28 {
29  namespace physics
30  {
31  class UserCmdPrivate;
32 
35  class GZ_PHYSICS_VISIBLE UserCmd
36  {
43  public: UserCmd(const unsigned int _id,
44  physics::WorldPtr _world,
45  const std::string &_description,
46  const msgs::UserCmd::Type &_type);
47 
49  public: virtual ~UserCmd();
50 
52  public: virtual void Undo();
53 
55  public: virtual void Redo();
56 
59  public: unsigned int Id() const;
60 
63  public: std::string Description() const;
64 
67  public: msgs::UserCmd::Type Type() const;
68 
71  protected: UserCmdPrivate *dataPtr;
72  };
73 
74  class UserCmdManagerPrivate;
75 
77  class GZ_PHYSICS_VISIBLE UserCmdManager
78  {
81  public: explicit UserCmdManager(const WorldPtr _world);
82 
84  public: virtual ~UserCmdManager();
85 
89  private: void OnUserCmdMsg(ConstUserCmdPtr &_msg);
90 
94  private: void OnUndoRedoMsg(ConstUndoRedoPtr &_msg);
95 
97  private: void PublishCurrentStats();
98 
101  private: UserCmdManagerPrivate *dataPtr;
102  };
103  }
104 }
105 #endif
106 
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
Forward declarations for the common classes.
Definition: Animation.hh:26
Forward declarations for transport.
default namespace for gazebo
UserCmdPrivate * dataPtr
Definition: UserCmdManager.hh:71
Class which represents a user command, which can be "undone" and "redone".
Definition: UserCmdManager.hh:35
Manages user commands from the server side.
Definition: UserCmdManager.hh:77