Ignition Gazebo

API Reference

4.0.0
Actor.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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 IGNITION_GAZEBO_COMPONENTS_ACTOR_HH_
18 #define IGNITION_GAZEBO_COMPONENTS_ACTOR_HH_
19 
20 #include <ignition/msgs/actor.pb.h>
21 
22 #include <chrono>
23 #include <string>
24 
25 #include <sdf/Actor.hh>
26 
31 #include <ignition/gazebo/config.hh>
32 
33 namespace ignition
34 {
35 namespace gazebo
36 {
37 // Inline bracket to help doxygen filtering.
38 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
39 namespace serializers
40 {
41  using ActorSerializer =
43 
45  {
50  public: static std::ostream &Serialize(std::ostream &_out,
51  const std::chrono::steady_clock::duration &_time)
52  {
53  _out << std::chrono::duration_cast<std::chrono::milliseconds>(
54  _time).count();
55  return _out;
56  }
57 
62  public: static std::istream &Deserialize(std::istream &_in,
63  std::chrono::steady_clock::duration &_time)
64  {
65  int64_t time;
66  _in >> time;
68  return _in;
69  }
70  };
71 }
72 
73 namespace components
74 {
78  using Actor =
80  IGN_GAZEBO_REGISTER_COMPONENT("ign_gazebo_components.Actor", Actor)
81 
82 
83  using AnimationTime = Component<std::chrono::steady_clock::duration,
84  class AnimationTimeTag, serializers::AnimationTimeSerializer>;
85  IGN_GAZEBO_REGISTER_COMPONENT("ign_gazebo_components.AnimationTime",
86  AnimationTime)
87 
89  using AnimationName = Component<std::string, class AnimationNameTag,
90  serializers::StringSerializer>;
91  IGN_GAZEBO_REGISTER_COMPONENT("ign_gazebo_components.AnimationName",
92  AnimationName)
93 }
94 }
95 }
96 }
97 
98 #endif
STL class.
static std::istream & Deserialize(std::istream &_in, std::chrono::steady_clock::duration &_time)
Deserialization for std::chrono::steady_clock::duration.
Definition: Actor.hh:62
static std::ostream & Serialize(std::ostream &_out, const std::chrono::steady_clock::duration &_time)
Serialization for std::chrono::steady_clock::duration.
Definition: Actor.hh:50
#define IGN_GAZEBO_REGISTER_COMPONENT(_compType, _classname)
Static component registration macro.
Definition: Factory.hh:331
Serialization for that converts components data types to ignition::msgs. This assumes that convert<Da...
Definition: Serialization.hh:72
A component type that wraps any data type. The intention is for this class to be used to create simpl...
Definition: Component.hh:316
This library is part of the Ignition Robotics project.
STL class.