| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
utils.hpp
1// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
18
19#ifndef FASTDDS_DDS_XTYPES__UTILS_HPP
20#define FASTDDS_DDS_XTYPES__UTILS_HPP
21
22#include <iostream>
23#include <string>
24
25#include <fastdds/dds/core/ReturnCode.hpp>
26#include <fastdds/dds/xtypes/dynamic_types/DynamicData.hpp>
27#include <fastdds/dds/xtypes/dynamic_types/DynamicType.hpp>
28#include <fastdds/fastdds_dll.hpp>
29
30 namespace eprosima {
31 namespace fastdds {
32 namespace dds {
33
34 enum class DynamicDataJsonFormat
35{
36 OMG,
37 EPROSIMA,
38};
39
47FASTDDS_EXPORTED_API ReturnCode_t idl_serialize(
48 const DynamicType::_ref_type& dynamic_type,
49 std::ostream& output) noexcept;
50
58FASTDDS_EXPORTED_API ReturnCode_t json_serialize(
59 const DynamicData::_ref_type& data,
60 DynamicDataJsonFormat format,
61 std::ostream& output) noexcept;
62
71FASTDDS_EXPORTED_API ReturnCode_t json_deserialize(
72 const std::string& input,
73 const DynamicType::_ref_type& dynamic_type,
74 DynamicDataJsonFormat format,
75 DynamicData::_ref_type& data) noexcept;
76
77} // dds
78} // fastdds
79} // eprosima
80
81#endif // FASTDDS_DDS_XTYPES__UTILS_HPP
eprosima::fastdds::dds::DynamicData::_ref_type
typename traits< DynamicData >::ref_type _ref_type
Definition DynamicData.hpp:35
eprosima::fastdds::dds::DynamicType::_ref_type
typename traits< DynamicType >::ref_type _ref_type
Definition DynamicType.hpp:36
eprosima::fastdds::dds
Definition BuiltinTopicKey.hpp:26
eprosima::fastdds::dds::json_deserialize
FASTDDS_EXPORTED_API ReturnCode_t json_deserialize(const std::string &input, const DynamicType::_ref_type &dynamic_type, DynamicDataJsonFormat format, DynamicData::_ref_type &data) noexcept
Deserializes a JSON object string into a DynamicData.
eprosima::fastdds::dds::DynamicDataJsonFormat
DynamicDataJsonFormat
Definition utils.hpp:35
eprosima::fastdds::dds::DynamicDataJsonFormat::OMG
@ OMG
Definition utils.hpp:36
eprosima::fastdds::dds::DynamicDataJsonFormat::EPROSIMA
@ EPROSIMA
Definition utils.hpp:37
eprosima::fastdds::dds::ReturnCode_t
int32_t ReturnCode_t
Definition DDSReturnCode.hpp:59
eprosima::fastdds::dds::idl_serialize
FASTDDS_EXPORTED_API ReturnCode_t idl_serialize(const DynamicType::_ref_type &dynamic_type, std::ostream &output) noexcept
Serializes a DynamicType into its IDL representation.
eprosima::fastdds::dds::json_serialize
FASTDDS_EXPORTED_API ReturnCode_t json_serialize(const DynamicData::_ref_type &data, DynamicDataJsonFormat format, std::ostream &output) noexcept
Serializes a DynamicData into a JSON object, which is then dumped into an std::ostream.
eprosima::fastdds
eprosima
eProsima namespace.