Fast DDS  Version 3.6.1.0
Fast DDS
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 
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 
35 {
36  OMG,
37  EPROSIMA,
38 };
39 
47 FASTDDS_EXPORTED_API ReturnCode_t idl_serialize(
48  const DynamicType::_ref_type& dynamic_type,
49  std::ostream& output) noexcept;
50 
58 FASTDDS_EXPORTED_API ReturnCode_t json_serialize(
59  const DynamicData::_ref_type& data,
60  DynamicDataJsonFormat format,
61  std::ostream& output) noexcept;
62 
71 FASTDDS_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
typename traits< DynamicData >::ref_type _ref_type
Definition: DynamicData.hpp:35
typename traits< DynamicType >::ref_type _ref_type
Definition: DynamicType.hpp:36
Definition: DomainParticipant.hpp:46
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.
DynamicDataJsonFormat
Definition: utils.hpp:35
int32_t ReturnCode_t
Definition: DDSReturnCode.hpp:59
FASTDDS_EXPORTED_API ReturnCode_t idl_serialize(const DynamicType::_ref_type &dynamic_type, std::ostream &output) noexcept
Serializes a DynamicType into its IDL representation.
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.