Ignition Gazebo

API Reference

6.0.0~pre1
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 <ratio>
24 #include <string>
25 
26 #include <sdf/Actor.hh>
27 
32 #include <ignition/gazebo/config.hh>
33 
34 namespace ignition
35 {
36 namespace gazebo
37 {
38 // Inline bracket to help doxygen filtering.
39 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
40 namespace serializers
41 {
42  using ActorSerializer =
44 
46  {
51  public: static std::ostream &Serialize(std::ostream &_out,
52  const std::chrono::steady_clock::duration &_time)
53  {
54  _out << std::chrono::duration_cast<std::chrono::nanoseconds>(
55  _time).count();
56  return _out;
57  }
58 
63  public: static std::istream &Deserialize(std::istream &_in,
64  std::chrono::steady_clock::duration &_time)
65  {
66  int64_t time;
67  _in >> time;
69  return _in;
70  }
71  };
72 }
73 
74 namespace components
75 {
79  using Actor =
81  IGN_GAZEBO_REGISTER_COMPONENT("ign_gazebo_components.Actor", Actor)
82 
83 
84  using AnimationTime = Component<std::chrono::steady_clock::duration,
85  class AnimationTimeTag, serializers::AnimationTimeSerializer>;
86  IGN_GAZEBO_REGISTER_COMPONENT("ign_gazebo_components.AnimationTime",
87  AnimationTime)
88 
90  using AnimationName = Component<std::string, class AnimationNameTag,
91  serializers::StringSerializer>;
92  IGN_GAZEBO_REGISTER_COMPONENT("ign_gazebo_components.AnimationName",
93  AnimationName)
94 }
95 }
96 }
97 }
98 
99 #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:63
static std::ostream & Serialize(std::ostream &_out, const std::chrono::steady_clock::duration &_time)
Serialization for std::chrono::steady_clock::duration.
Definition: Actor.hh:51
#define IGN_GAZEBO_REGISTER_COMPONENT(_compType, _classname)
Static component registration macro.
Definition: Factory.hh:373
Serialization for that converts components data types to ignition::msgs. This assumes that convert<Da...
Definition: Serialization.hh:98
A component type that wraps any data type. The intention is for this class to be used to create simpl...
Definition: Component.hh:324
This library is part of the Ignition Robotics project.
STL class.