Gazebo Sim

API Reference

9.0.0~pre1
components/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 GZ_SIM_COMPONENTS_ACTOR_HH_
18#define GZ_SIM_COMPONENTS_ACTOR_HH_
19
20#include <gz/msgs/actor.pb.h>
21
22#include <chrono>
23#include <ratio>
24#include <string>
25
26#include <sdf/Actor.hh>
27
31#include <gz/sim/Conversions.hh>
32#include <gz/sim/config.hh>
33
34namespace gz
35{
36namespace sim
37{
38// Inline bracket to help doxygen filtering.
39inline namespace GZ_SIM_VERSION_NAMESPACE {
40namespace serializers
41{
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
64 std::chrono::steady_clock::duration &_time)
65 {
66 int64_t time;
67 _in >> time;
69 return _in;
70 }
71 };
72}
73
74namespace components
75{
79 using Actor =
81 GZ_SIM_REGISTER_COMPONENT("gz_sim_components.Actor", Actor)
82
83
84 using AnimationTime = Component<std::chrono::steady_clock::duration,
85 class AnimationTimeTag, serializers::AnimationTimeSerializer>;
86 GZ_SIM_REGISTER_COMPONENT("gz_sim_components.AnimationTime",
87 AnimationTime)
88
90 using AnimationName = Component<std::string, class AnimationNameTag,
91 serializers::StringSerializer>;
92 GZ_SIM_REGISTER_COMPONENT("gz_sim_components.AnimationName",
93 AnimationName)
94}
95}
96}
97}
98
99#endif