Gazebo Sim
API Reference
10.0.0~pre1
insert_drive_file
Tutorials
library_books
Classes
toc
Namespaces
insert_drive_file
Files
launch
Gazebo Website
Index
List
Hierarchy
Members: All
Members: Functions
Members: Variables
Members: Typedefs
Members: Enumerations
Members: Enumerator
List
Members
Functions
Typedefs
Variables
Enumerations
Enumerator
src
gz-sim
include
gz
sim
components
SemanticDescription.hh
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2025 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_SEMANTIC_DESCRIPTION_HH_
18
#define GZ_SIM_COMPONENTS_SEMANTIC_DESCRIPTION_HH_
19
20
#include <gz/msgs/stringmsg.pb.h>
21
22
#include <istream>
23
#include <ostream>
24
#include <string>
25
26
#include "
gz/sim/components/Component.hh
"
27
#include "
gz/sim/components/Factory.hh
"
28
#include "
gz/sim/components/Serialization.hh
"
29
#include "gz/sim/config.hh"
30
31
namespace
gz
32
{
33
namespace
sim
34
{
35
// Inline bracket to help doxygen filtering.
36
inline
namespace
GZ_SIM_VERSION_NAMESPACE
37
{
38
namespace
serializers
39
{
40
class
SemanticDescriptionSerializer
41
{
42
public
:
43
static
std::ostream
&
Serialize
(
std::ostream
&_out,
const
std::string
&_desc)
44
{
45
msgs::StringMsg msg;
46
msg.set_data(_desc);
47
msg.SerializeToOstream(&_out);
48
return
_out;
49
}
50
51
public
:
52
static
std::istream
&
Deserialize
(
std::istream
&_in,
std::string
&_desc)
53
{
54
msgs::StringMsg msg;
55
msg.ParsePartialFromIstream(&_in);
56
_desc = msg.
data
();
57
return
_in;
58
}
59
};
60
}
// namespace serializers
61
namespace
components
62
{
67
using
SemanticDescription
= Component<
std::string
,
class
SemanticDescriptionTag,
68
serializers::StringSerializer>;
69
GZ_SIM_REGISTER_COMPONENT
("gz_sim_components.SemanticDescription",
70
SemanticDescription)
71
}
// namespace components
72
}
// namespace GZ_SIM_VERSION_NAMESPACE
73
}
// namespace sim
74
}
// namespace gz
75
#endif