diff --git a/.github/workflows/mirror.yml b/.github/workflows/mirror.yml index 23cdb07a9..b82bc3eb2 100644 --- a/.github/workflows/mirror.yml +++ b/.github/workflows/mirror.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: dest_branch: - - '1.x' + - '2.x' steps: - name: Mirror action step id: mirror diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 495c13a11..ee8668b06 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -2,27 +2,23 @@ name: nightly on: + workflow_dispatch: schedule: - cron: '0 5 * * *' jobs: - - reusable_tests_v2: - name: reusable_tests_v2 + reusable_tests: + strategy: + fail-fast: false + matrix: + - custom_version_build: 'v2' + ref: '1.x' + - custom_version_build: 'v3' + ref: 'main' + name: reusable_tests uses: ./.github/workflows/reusable-workflow.yml with: - custom_version_build: 'v2' + custom_version_build: ${{ matrix.custom_version_build }} dependencies_artifact_postfix: '_nightly' - ref: '1.x' + ref: ${{ matrix.ref }} secrets: inherit - - # Uncomment this block to run the tests for Fast DDS v3 when Fast DDS Statistics Backend is updated - # Also specify here (and above) the workflow version/branch to use (@v0, @main, etc.) - # reusable_tests_v3: - # name: reusable_tests_v3 - # uses: ./.github/workflows/reusable-workflow.yml - # with: - # custom_version_build: 'v3' - # dependencies_artifact_postfix: '_nightly' - # ref: 'main' - # secrets: inherit diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 487c1d722..aeb783eae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,7 +34,7 @@ jobs: name: reusable_tests uses: ./.github/workflows/reusable-workflow.yml with: - custom_version_build: ${{ inputs.custom_version_build || 'v2' }} + custom_version_build: ${{ inputs.custom_version_build || 'v3' }} dependencies_artifact_postfix: ${{ inputs.dependencies_artifact_postfix || '_nightly' }} ref: ${{ github.ref }} secrets: inherit diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d6bc7ed0..8b8800bac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,10 +44,10 @@ include(${PROJECT_SOURCE_DIR}/cmake/common/asan.cmake) ############################################################################### # Load external projects. ############################################################################### -set(FASTDDS_MIN_VERSION "2.13.0") +set(FASTDDS_MIN_VERSION "3.0.0") find_package(fastcdr REQUIRED) -find_package(fastrtps ${FASTDDS_MIN_VERSION} REQUIRED) +find_package(fastdds ${FASTDDS_MIN_VERSION} REQUIRED) ############################################################################### # Test system configuration diff --git a/cmake/packaging/Config.cmake.in b/cmake/packaging/Config.cmake.in index 76f77cc3e..fbcf04c9b 100644 --- a/cmake/packaging/Config.cmake.in +++ b/cmake/packaging/Config.cmake.in @@ -12,8 +12,8 @@ if(NOT fastcdr_FOUND) find_package(fastcdr) endif() -if(NOT fastrtps_FOUND) - find_package(fastrtps) +if(NOT fastdds_FOUND) + find_package(fastdds) endif() include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake) diff --git a/colcon.meta b/colcon.meta index 46982a737..b16f53821 100644 --- a/colcon.meta +++ b/colcon.meta @@ -1,7 +1,7 @@ { "names": { - "fastrtps": + "fastdds": { "cmake-args": [ @@ -12,7 +12,7 @@ { "cmake-args": [ - "-DBUILD_DOCS=OFF", + "-DBUILD_DOCS=ON", "-DCOMPILE_EXAMPLES=OFF", ] } diff --git a/colcon.pkg b/colcon.pkg index c3e26109c..9d6100e1f 100644 --- a/colcon.pkg +++ b/colcon.pkg @@ -1,5 +1,5 @@ { "name": "fastdds_statistics_backend", "type": "cmake", - "build-dependencies": ["fastrtps"] + "build-dependencies": ["fastcdr", "fastdds"] } diff --git a/docs/code/StatisticsBackendTests.cpp b/docs/code/StatisticsBackendTests.cpp index 82abbc2f4..e1bc01ebd 100644 --- a/docs/code/StatisticsBackendTests.cpp +++ b/docs/code/StatisticsBackendTests.cpp @@ -44,22 +44,13 @@ void init_monitor_examples() StatisticsBackend::init_monitor(0); // Init a monitor for a Fast DDS Discovery Server network which server is located in IPv4 - // address 127.0.0.1 and port 11811 using UDP as transport layer, and that uses the default GUID prefix - // eprosima::fastdds::rtps::DEFAULT_ROS2_SERVER_GUIDPREFIX. + // address 127.0.0.1 and port 11811 using UDP as transport layer. // The monitor has no listener associated. EntityId disc_server_monitor_id = StatisticsBackend::init_monitor("UDPv4:[127.0.0.1]:11811"); - - // Init a monitor for a Fast DDS Discovery Server network which server is located in IPv4 - // address 127.0.0.1 and port 11811 using UDP as transport layer, and that uses the GUID prefix - // "44.53.01.5f.45.50.52.4f.53.49.4d.41". - // The monitor has no listener associated. - EntityId disc_server_prefix_monitor_id = - StatisticsBackend::init_monitor("44.53.01.5f.45.50.52.4f.53.49.4d.41", "UDPv4:[localhost]:11811"); //!-- static_cast(domain_monitor_id); static_cast(disc_server_monitor_id); - static_cast(disc_server_prefix_monitor_id); } { //CONF-INIT-MONITOR-LISTENER-EXAMPLE @@ -70,23 +61,14 @@ void init_monitor_examples() StatisticsBackend::init_monitor(0, &domain_listener); // Init a monitor for a Fast DDS Discovery Server network which server is located in IPv4 - // address 127.0.0.1 and port 11811 using UDP as transport layer, and that uses the default GUID prefix - // eprosima::fastdds::rtps::DEFAULT_ROS2_SERVER_GUIDPREFIX. + // address 127.0.0.1 and port 11811 using UDP as transport layer. // The monitor uses a custom listener. EntityId disc_server_monitor_id = StatisticsBackend::init_monitor("UDPv4:[127.0.0.1]:11811", &domain_listener); - // Init a monitor for a Fast DDS Discovery Server network which server is located in IPv4 - // address 127.0.0.1 and port 11811 using UDP transport layer, and that uses the GUID prefix - // "44.53.01.5f.45.50.52.4f.53.49.4d.41". - // The monitor uses a custom listener. - EntityId disc_server_prefix_monitor_id = - StatisticsBackend::init_monitor("44.53.01.5f.45.50.52.4f.53.49.4d.41", "UDPv4:[127.0.0.1]:11811", - &domain_listener); //!-- static_cast(domain_monitor_id); static_cast(disc_server_monitor_id); - static_cast(disc_server_prefix_monitor_id); } { //CONF-INIT-MONITOR-MASKS-EXAMPLE @@ -103,24 +85,15 @@ void init_monitor_examples() StatisticsBackend::init_monitor(0, &domain_listener, callback_mask, datakind_mask); // Init a monitor for a Fast DDS Discovery Server network which server is located in IPv4 - // address 127.0.0.1 and port 11811 using UDP transport layer, and that uses the default GUID prefix - // eprosima::fastdds::rtps::DEFAULT_ROS2_SERVER_GUIDPREFIX. + // address 127.0.0.1 and port 11811 using UDP transport layer. // The monitor uses a custom listener, a CallbackMask, and a DataKindMask. EntityId disc_server_monitor_id = StatisticsBackend::init_monitor("UDPv4:[localhost]:11811", &domain_listener, callback_mask, datakind_mask); - // Init a monitor for a Fast DDS Discovery Server network which server is located in IPv4 - // address 127.0.0.1 and port 11811 using UDP transport layer, and that uses the GUID prefix - // "44.53.01.5f.45.50.52.4f.53.49.4d.41". - // The monitor uses a custom listener, a CallbackMask, and a DataKindMask. - EntityId disc_server_prefix_monitor_id = - StatisticsBackend::init_monitor("44.53.01.5f.45.50.52.4f.53.49.4d.41", "UDPv4:[127.0.0.1]:11811", - &domain_listener, callback_mask, datakind_mask); //!-- static_cast(domain_monitor_id); static_cast(disc_server_monitor_id); - static_cast(disc_server_prefix_monitor_id); } } diff --git a/docs/conf.py b/docs/conf.py index f306d0573..72d2efa7b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -40,7 +40,7 @@ def get_cmake_project_version(cmakelists): } """ matches = re.findall( - 'project\(.*VERSION\s+(\d+)\.(\d+)\.(\d+)', + r'project\(.*VERSION\s+(\d+)\.(\d+)\.(\d+)', "".join(open(cmakelists, 'r').readlines()), flags=re.MULTILINE)[0] return { @@ -297,7 +297,7 @@ def configure_doxyfile( # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = 'en' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: diff --git a/docs/doxygen-config.in b/docs/doxygen-config.in index 3cb133006..fb22ec974 100644 --- a/docs/doxygen-config.in +++ b/docs/doxygen-config.in @@ -162,7 +162,8 @@ FILE_PATTERNS = *.c \ RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = "*/nlohmann-json/*" +EXCLUDE_PATTERNS = "*/nlohmann-json/*" \ + "*/topic_types/* EXCLUDE_SYMBOLS = EXAMPLE_PATH = "@PROJECT_SOURCE_DIR@" EXAMPLE_PATTERNS = * diff --git a/docs/requirements.txt b/docs/requirements.txt index 734953be4..bcd2ab2f4 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -2,18 +2,19 @@ breathe==4.35.0 colcon-common-extensions==0.2.1 colcon-mixin==0.2.0 doc8==0.10.1 -docutils==0.16.0 +docutils==0.20.1 GitPython==3.1.41 setuptools==67.6.0 -sphinx_rtd_theme==0.5.2 -sphinx-tabs==3.2.0 -sphinx==4.3.1 -sphinxcontrib-applehelp==1.0.4 -sphinxcontrib-devhelp==1.0.2 -sphinxcontrib-htmlhelp==2.0.1 +sphinx_rtd_theme==2.0.0 +sphinx-tabs==3.4.5 +sphinx==7.3.6 +sphinxcontrib-applehelp==1.0.8 +sphinxcontrib-devhelp==1.0.6 +sphinxcontrib-htmlhelp==2.0.5 sphinxcontrib-imagehelper==1.1.1 -sphinxcontrib-plantuml==0.22 -sphinxcontrib-qthelp==1.0.3 -sphinxcontrib-serializinghtml==1.1.5 -sphinxcontrib.spelling==7.2.1 +sphinxcontrib-plantuml==0.29 +sphinxcontrib-qthelp==1.0.7 +sphinxcontrib-serializinghtml==1.1.10 +sphinxcontrib.spelling==8.0.0 vcstool==0.3.0 +xmlschema==2.1.1 diff --git a/docs/rst/notes/notes.rst b/docs/rst/notes/notes.rst index 9fbb23712..6a1570783 100644 --- a/docs/rst/notes/notes.rst +++ b/docs/rst/notes/notes.rst @@ -46,12 +46,12 @@ This release includes the following **dependencies update**: - `v2.14.0 `_ * - Fast DDS Gen - `eProsima/Fast-DDS-Gen `_ - - `v3.0.0 `_ + - `v3.0.0 `__ - `v3.3.0 `_ * - IDL Parser - `eProsima/IDL-Parser `_ - `v1.7.2 `_ - - `v3.0.0 `_ + - `v3.0.0 `__ Previous versions diff --git a/docs/rst/notes/previous_versions/v1.0.0.rst b/docs/rst/notes/previous_versions/v1.0.0.rst index 9d3bd3449..d78041cd7 100644 --- a/docs/rst/notes/previous_versions/v1.0.0.rst +++ b/docs/rst/notes/previous_versions/v1.0.0.rst @@ -38,7 +38,7 @@ This release includes the following **dependencies update**: * - Fast DDS Gen - `eProsima/Fast-DDS-Gen `_ - `v2.5.1 `_ - - `v3.0.0 `_ + - `v3.0.0 `__ * - IDL Parser - `eProsima/IDL-Parser `_ - `v1.6.0 `_ diff --git a/docs/rst/statistics_backend/get_data.rst b/docs/rst/statistics_backend/get_data.rst index 51c69361e..70ad1b475 100644 --- a/docs/rst/statistics_backend/get_data.rst +++ b/docs/rst/statistics_backend/get_data.rst @@ -9,7 +9,7 @@ Get statistical data |DataKind-api| within a time frame (for more information about all the reported |DataKind-api|, please refer to :ref:`types_data_kind`). This time interval is evenly divided into the specified number of bins, each one with size -:math:`(t_to - t_from)/(\# of bins)`. +:math:`(t_{to} - t_{from})/(\# bins)`. For each of these bins, a new |StatisticsData-api| value is calculated applying the given |StatisticKind-api| to all the data points in it. The result is a collection of |StatisticsData-api| elements with size equal to the number of specified bins. diff --git a/docs/rst/statistics_backend/init_monitor.rst b/docs/rst/statistics_backend/init_monitor.rst index cbdb87e5e..52428c7ed 100644 --- a/docs/rst/statistics_backend/init_monitor.rst +++ b/docs/rst/statistics_backend/init_monitor.rst @@ -9,7 +9,7 @@ Initializing a monitor on a certain Domain ID makes *eProsima Fast DDS Statistic start monitoring the statistics data and entity discoveries on that domain. No statistics data will be gathered unless there is a monitor initialized in the required domain. -|StatisticsBackend-api| provides three overloads of |init_monitor-api| that can be used to start a monitorization on a +|StatisticsBackend-api| provides two overloads of |init_monitor-api| that can be used to start a monitorization on a DDS domain or a *Fast DDS* Discovery Server network. .. literalinclude:: /code/StatisticsBackendTests.cpp diff --git a/examples/cpp/HelloWorldExample/CMakeLists.txt b/examples/cpp/HelloWorldExample/CMakeLists.txt index 59ebfa150..11f5eda6d 100644 --- a/examples/cpp/HelloWorldExample/CMakeLists.txt +++ b/examples/cpp/HelloWorldExample/CMakeLists.txt @@ -25,8 +25,8 @@ if(NOT fastcdr_FOUND) find_package(fastcdr REQUIRED) endif() -if(NOT fastrtps_FOUND) - find_package(fastrtps REQUIRED) +if(NOT fastdds_FOUND) + find_package(fastdds REQUIRED) endif() if(NOT fastdds_statistics_backend_FOUND) @@ -43,7 +43,6 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR endif() endif() -message(STATUS "Configuring HelloWorld example...") file(GLOB HELLOWORLD_EXAMPLE_SOURCES_CXX "*.cxx") file(GLOB HELLOWORLD_EXAMPLE_SOURCES_CPP "*.cpp") @@ -52,6 +51,7 @@ target_compile_definitions(HelloWorldExample PRIVATE $<$>,$>:__DEBUG> $<$:__INTERNALDEBUG> # Internal debug activated. ) -target_link_libraries(HelloWorldExample fastrtps fastcdr fastdds_statistics_backend) + +target_link_libraries(HelloWorldExample fastdds fastcdr fastdds_statistics_backend) install(TARGETS HelloWorldExample RUNTIME DESTINATION examples/cpp/HelloWorldExample/${BIN_INSTALL_DIR}) diff --git a/examples/cpp/HelloWorldExample/HelloWorld.cxx b/examples/cpp/HelloWorldExample/HelloWorld.cxx deleted file mode 100644 index 4b415d677..000000000 --- a/examples/cpp/HelloWorldExample/HelloWorld.cxx +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file HelloWorld.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "HelloWorld.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - - - -HelloWorld::HelloWorld() -{ -} - -HelloWorld::~HelloWorld() -{ -} - -HelloWorld::HelloWorld( - const HelloWorld& x) -{ - m_index = x.m_index; - m_message = x.m_message; -} - -HelloWorld::HelloWorld( - HelloWorld&& x) noexcept -{ - m_index = x.m_index; - m_message = std::move(x.m_message); -} - -HelloWorld& HelloWorld::operator =( - const HelloWorld& x) -{ - - m_index = x.m_index; - m_message = x.m_message; - return *this; -} - -HelloWorld& HelloWorld::operator =( - HelloWorld&& x) noexcept -{ - - m_index = x.m_index; - m_message = std::move(x.m_message); - return *this; -} - -bool HelloWorld::operator ==( - const HelloWorld& x) const -{ - return (m_index == x.m_index && - m_message == x.m_message); -} - -bool HelloWorld::operator !=( - const HelloWorld& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void HelloWorld::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t HelloWorld::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& HelloWorld::index() -{ - return m_index; -} - - -/*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ -void HelloWorld::message( - const std::string& _message) -{ - m_message = _message; -} - -/*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ -void HelloWorld::message( - std::string&& _message) -{ - m_message = std::move(_message); -} - -/*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ -const std::string& HelloWorld::message() const -{ - return m_message; -} - -/*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ -std::string& HelloWorld::message() -{ - return m_message; -} - - -// Include auxiliary functions like for serializing/deserializing. -#include "HelloWorldCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/examples/cpp/HelloWorldExample/HelloWorld.h b/examples/cpp/HelloWorldExample/HelloWorld.hpp similarity index 70% rename from examples/cpp/HelloWorldExample/HelloWorld.h rename to examples/cpp/HelloWorldExample/HelloWorld.hpp index 5cd0ddba5..69c2ce55d 100644 --- a/examples/cpp/HelloWorldExample/HelloWorld.h +++ b/examples/cpp/HelloWorldExample/HelloWorld.hpp @@ -13,32 +13,19 @@ // limitations under the License. /*! - * @file HelloWorld.h + * @file HelloWorld.hpp * This header file contains the declaration of the described types in the IDL file. * * This file was generated by the tool fastddsgen. */ -#include -#include "HelloWorldv1.h" +#ifndef FAST_DDS_GENERATED__HELLOWORLD_HPP +#define FAST_DDS_GENERATED__HELLOWORLD_HPP -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_HELLOWORLD_H_ -#define _FAST_DDS_GENERATED_HELLOWORLD_H_ - -#include -#include #include -#include #include -#include - +#include #include -#include -#include - - #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) @@ -64,17 +51,6 @@ #define HELLOWORLD_DllAPI #endif // _WIN32 -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - - - /*! * @brief This class represents the structure HelloWorld defined by the user in the IDL file. * @ingroup HelloWorld @@ -86,100 +62,155 @@ class HelloWorld /*! * @brief Default constructor. */ - eProsima_user_DllExport HelloWorld(); + eProsima_user_DllExport HelloWorld() + { + } /*! * @brief Default destructor. */ - eProsima_user_DllExport ~HelloWorld(); + eProsima_user_DllExport ~HelloWorld() + { + } /*! * @brief Copy constructor. * @param x Reference to the object HelloWorld that will be copied. */ eProsima_user_DllExport HelloWorld( - const HelloWorld& x); + const HelloWorld& x) + { + m_index = x.m_index; + + m_message = x.m_message; + + } /*! * @brief Move constructor. * @param x Reference to the object HelloWorld that will be copied. */ eProsima_user_DllExport HelloWorld( - HelloWorld&& x) noexcept; + HelloWorld&& x) noexcept + { + m_index = x.m_index; + m_message = std::move(x.m_message); + } /*! * @brief Copy assignment. * @param x Reference to the object HelloWorld that will be copied. */ eProsima_user_DllExport HelloWorld& operator =( - const HelloWorld& x); + const HelloWorld& x) + { + + m_index = x.m_index; + + m_message = x.m_message; + + return *this; + } /*! * @brief Move assignment. * @param x Reference to the object HelloWorld that will be copied. */ eProsima_user_DllExport HelloWorld& operator =( - HelloWorld&& x) noexcept; + HelloWorld&& x) noexcept + { + + m_index = x.m_index; + m_message = std::move(x.m_message); + return *this; + } /*! * @brief Comparison operator. * @param x HelloWorld object to compare. */ eProsima_user_DllExport bool operator ==( - const HelloWorld& x) const; + const HelloWorld& x) const + { + return (m_index == x.m_index && + m_message == x.m_message); + } /*! * @brief Comparison operator. * @param x HelloWorld object to compare. */ eProsima_user_DllExport bool operator !=( - const HelloWorld& x) const; + const HelloWorld& x) const + { + return !(*this == x); + } /*! * @brief This function sets a value in member index * @param _index New value for member index */ eProsima_user_DllExport void index( - uint32_t _index); + uint32_t _index) + { + m_index = _index; + } /*! * @brief This function returns the value of member index * @return Value of member index */ - eProsima_user_DllExport uint32_t index() const; + eProsima_user_DllExport uint32_t index() const + { + return m_index; + } /*! * @brief This function returns a reference to member index * @return Reference to member index */ - eProsima_user_DllExport uint32_t& index(); - + eProsima_user_DllExport uint32_t& index() + { + return m_index; + } /*! * @brief This function copies the value in member message * @param _message New value to be copied in member message */ eProsima_user_DllExport void message( - const std::string& _message); + const std::string& _message) + { + m_message = _message; + } /*! * @brief This function moves the value in member message * @param _message New value to be moved in member message */ eProsima_user_DllExport void message( - std::string&& _message); + std::string&& _message) + { + m_message = std::move(_message); + } /*! * @brief This function returns a constant reference to member message * @return Constant reference to member message */ - eProsima_user_DllExport const std::string& message() const; + eProsima_user_DllExport const std::string& message() const + { + return m_message; + } /*! * @brief This function returns a reference to member message * @return Reference to member message */ - eProsima_user_DllExport std::string& message(); + eProsima_user_DllExport std::string& message() + { + return m_message; + } private: @@ -188,8 +219,6 @@ class HelloWorld }; -#endif // _FAST_DDS_GENERATED_HELLOWORLD_H_ - +#endif // _FAST_DDS_GENERATED_HELLOWORLD_HPP_ -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/examples/cpp/HelloWorldExample/HelloWorldCdrAux.hpp b/examples/cpp/HelloWorldExample/HelloWorldCdrAux.hpp index c6ec50b41..73944cdac 100644 --- a/examples/cpp/HelloWorldExample/HelloWorldCdrAux.hpp +++ b/examples/cpp/HelloWorldExample/HelloWorldCdrAux.hpp @@ -19,10 +19,10 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP +#define FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP -#include "HelloWorld.h" +#include "HelloWorld.hpp" constexpr uint32_t HelloWorld_max_cdr_typesize {264UL}; constexpr uint32_t HelloWorld_max_key_cdr_typesize {0UL}; @@ -34,8 +34,6 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const HelloWorld& data); @@ -44,5 +42,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP diff --git a/examples/cpp/HelloWorldExample/HelloWorldCdrAux.ipp b/examples/cpp/HelloWorldExample/HelloWorldCdrAux.ipp index b46c646b5..e555188bf 100644 --- a/examples/cpp/HelloWorldExample/HelloWorldCdrAux.ipp +++ b/examples/cpp/HelloWorldExample/HelloWorldCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP +#define FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP #include "HelloWorldCdrAux.hpp" @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -115,8 +113,13 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const HelloWorld& data) { + static_cast(scdr); static_cast(data); + scdr << data.index(); + + scdr << data.message(); + } @@ -124,5 +127,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP diff --git a/examples/cpp/HelloWorldExample/HelloWorldPubSubTypes.cxx b/examples/cpp/HelloWorldExample/HelloWorldPubSubTypes.cxx index 050724b99..ede207994 100644 --- a/examples/cpp/HelloWorldExample/HelloWorldPubSubTypes.cxx +++ b/examples/cpp/HelloWorldExample/HelloWorldPubSubTypes.cxx @@ -19,63 +19,56 @@ * This file was generated by the tool fastddsgen. */ +#include "HelloWorldPubSubTypes.hpp" +#include #include -#include "HelloWorldPubSubTypes.h" #include "HelloWorldCdrAux.hpp" +#include "HelloWorldTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - - HelloWorldPubSubType::HelloWorldPubSubType() { - setName("HelloWorld"); - uint32_t type_size = -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(HelloWorld::getMaxCdrSerializedSize()); -#else - HelloWorld_max_cdr_typesize; -#endif + set_name("HelloWorld"); + uint32_t type_size = HelloWorld_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = HelloWorld_max_key_cdr_typesize > 16 ? HelloWorld_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = HelloWorld_max_key_cdr_typesize > 16 ? HelloWorld_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } HelloWorldPubSubType::~HelloWorldPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool HelloWorldPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - HelloWorld* p_type = static_cast(data); + const HelloWorld* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; -#if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); -#endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -90,16 +83,12 @@ bool HelloWorldPubSubType::serialize( } // Get the serialized length -#if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); -#else - payload->length = static_cast(ser.get_serialized_data_length()); -#endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool HelloWorldPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -108,18 +97,14 @@ bool HelloWorldPubSubType::deserialize( HelloWorld* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN -#if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR -#endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -132,90 +117,101 @@ bool HelloWorldPubSubType::deserialize( return true; } -std::function HelloWorldPubSubType::getSerializedSizeProvider( - void* data, +uint32_t HelloWorldPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { -#if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; -#else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } -#endif // FASTCDR_VERSION_MAJOR == 1 - }; + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } } -void* HelloWorldPubSubType::createData() +void* HelloWorldPubSubType::create_data() { return reinterpret_cast(new HelloWorld()); } -void HelloWorldPubSubType::deleteData( +void HelloWorldPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } -bool HelloWorldPubSubType::getKey( - void* data, - InstanceHandle_t* handle, +bool HelloWorldPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + HelloWorld data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool HelloWorldPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - HelloWorld* p_type = static_cast(data); + const HelloWorld* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), HelloWorld_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); -#if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); -#else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); -#endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || HelloWorld_max_key_cdr_typesize > 16) { - m_md5.init(); -#if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); -#else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); -#endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } +void HelloWorldPubSubType::register_type_object_representation() +{ + register_HelloWorld_type_identifier(type_identifiers_); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "HelloWorldCdrAux.ipp" diff --git a/examples/cpp/HelloWorldExample/HelloWorldPubSubTypes.h b/examples/cpp/HelloWorldExample/HelloWorldPubSubTypes.hpp similarity index 59% rename from examples/cpp/HelloWorldExample/HelloWorldPubSubTypes.h rename to examples/cpp/HelloWorldExample/HelloWorldPubSubTypes.hpp index cb61cd6ba..c9b0647ae 100644 --- a/examples/cpp/HelloWorldExample/HelloWorldPubSubTypes.h +++ b/examples/cpp/HelloWorldExample/HelloWorldPubSubTypes.hpp @@ -13,31 +13,29 @@ // limitations under the License. /*! - * @file HelloWorldPubSubTypes.h + * @file HelloWorldPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ +#ifndef FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP #include #include -#include -#include -#include +#include +#include +#include -#include "HelloWorld.h" +#include "HelloWorld.hpp" -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) #error \ Generated HelloWorld is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - - +#endif // FASTDDS_GEN_API_VER /*! @@ -55,41 +53,36 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType eProsima_user_DllExport ~HelloWorldPubSubType() override; eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, + eprosima::fastdds::rtps::SerializedPayload_t& payload, void* data) override; - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, bool force_md5 = false) override; - eProsima_user_DllExport void* createData() override; + eProsima_user_DllExport void* create_data() override; - eProsima_user_DllExport void deleteData( + eProsima_user_DllExport void delete_data( void* data) override; + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED eProsima_user_DllExport inline bool is_bounded() const override { @@ -99,13 +92,9 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override { static_cast(data_representation); return false; @@ -123,10 +112,12 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - MD5 m_md5; - unsigned char* m_keyBuffer; +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; }; -#endif // _FAST_DDS_GENERATED_HELLOWORLD_PUBSUBTYPES_H_ +#endif // FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP diff --git a/examples/cpp/HelloWorldExample/HelloWorldPublisher.cpp b/examples/cpp/HelloWorldExample/HelloWorldPublisher.cpp index 8bfacf223..95500299a 100644 --- a/examples/cpp/HelloWorldExample/HelloWorldPublisher.cpp +++ b/examples/cpp/HelloWorldExample/HelloWorldPublisher.cpp @@ -25,10 +25,9 @@ #include #include #include -#include -#include #include "HelloWorldPublisher.h" +#include "HelloWorldPubSubTypes.hpp" using namespace eprosima::fastdds::dds; using namespace eprosima::fastdds::rtps; @@ -146,8 +145,8 @@ HelloWorldPublisher::~HelloWorldPublisher() } void HelloWorldPublisher::PubListener::on_publication_matched( - eprosima::fastdds::dds::DataWriter*, - const eprosima::fastdds::dds::PublicationMatchedStatus& info) + DataWriter*, + const PublicationMatchedStatus& info) { if (info.current_count_change == 1) { diff --git a/examples/cpp/HelloWorldExample/HelloWorldPublisher.h b/examples/cpp/HelloWorldExample/HelloWorldPublisher.h index 88f54caa1..c4840ab3c 100644 --- a/examples/cpp/HelloWorldExample/HelloWorldPublisher.h +++ b/examples/cpp/HelloWorldExample/HelloWorldPublisher.h @@ -17,8 +17,8 @@ * */ -#ifndef _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_HELLOWORLDPUBLISHER_H_ -#define _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_HELLOWORLDPUBLISHER_H_ +#ifndef FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__HELLOWORLDPUBLISHER_H +#define FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__HELLOWORLDPUBLISHER_H #include @@ -26,7 +26,7 @@ #include #include -#include "HelloWorldPubSubTypes.h" +#include "HelloWorld.hpp" /** * Class used to group into a single working unit a Publisher with a DataWriter, its listener, and a TypeSupport member @@ -111,4 +111,4 @@ class HelloWorldPublisher -#endif /* _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_HELLOWORLDPUBLISHER_H_ */ +#endif /* FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__HELLOWORLDPUBLISHER_H */ diff --git a/examples/cpp/HelloWorldExample/HelloWorldSubscriber.cpp b/examples/cpp/HelloWorldExample/HelloWorldSubscriber.cpp index 517fea12c..4a5a1467f 100644 --- a/examples/cpp/HelloWorldExample/HelloWorldSubscriber.cpp +++ b/examples/cpp/HelloWorldExample/HelloWorldSubscriber.cpp @@ -24,10 +24,9 @@ #include #include #include -#include -#include #include "HelloWorldSubscriber.h" +#include "HelloWorldPubSubTypes.hpp" using namespace eprosima::fastdds::dds; using namespace eprosima::fastdds::rtps; @@ -185,7 +184,7 @@ void HelloWorldSubscriber::SubListener::on_data_available( DataReader* reader) { SampleInfo info; - while ((reader->take_next_sample(&hello_, &info) == ReturnCode_t::RETCODE_OK) && !is_stopped()) + while ((reader->take_next_sample(&hello_, &info) == RETCODE_OK) && !is_stopped()) { if (info.instance_state == ALIVE_INSTANCE_STATE) { diff --git a/examples/cpp/HelloWorldExample/HelloWorldSubscriber.h b/examples/cpp/HelloWorldExample/HelloWorldSubscriber.h index 7cecd95e0..d7df78bd3 100644 --- a/examples/cpp/HelloWorldExample/HelloWorldSubscriber.h +++ b/examples/cpp/HelloWorldExample/HelloWorldSubscriber.h @@ -17,8 +17,8 @@ * */ -#ifndef _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_HELLOWORLDSUBSCRIBER_H_ -#define _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_HELLOWORLDSUBSCRIBER_H_ +#ifndef FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__HELLO_WORLD_SUBSCRIBER_H +#define FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__HELLO_WORLD_SUBSCRIBER_H #include #include @@ -28,7 +28,7 @@ #include #include -#include "HelloWorldPubSubTypes.h" +#include "HelloWorld.hpp" /** * Class used to group into a single working unit a Subscriber with a DataReader, its listener, and a TypeSupport member @@ -125,4 +125,4 @@ class HelloWorldSubscriber static std::condition_variable terminate_cv_; }; -#endif /* _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_HELLOWORLDSUBSCRIBER_H_ */ +#endif /* FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__HELLO_WORLD_SUBSCRIBER_H */ diff --git a/examples/cpp/HelloWorldExample/HelloWorldTypeObjectSupport.cxx b/examples/cpp/HelloWorldExample/HelloWorldTypeObjectSupport.cxx new file mode 100644 index 000000000..bd5689623 --- /dev/null +++ b/examples/cpp/HelloWorldExample/HelloWorldTypeObjectSupport.cxx @@ -0,0 +1,145 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file HelloWorldTypeObjectSupport.cxx + * Source file containing the implementation to register the TypeObject representation of the described types in the IDL file + * + * This file was generated by the tool fastddsgen. + */ + +#include "HelloWorldTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "HelloWorld.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_HelloWorld_type_identifier( + TypeIdentifierPair& type_ids_HelloWorld) +{ + + ReturnCode_t return_code_HelloWorld {eprosima::fastdds::dds::RETCODE_OK}; + return_code_HelloWorld = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "HelloWorld", type_ids_HelloWorld); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_HelloWorld) + { + StructTypeFlag struct_flags_HelloWorld = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::FINAL, + false, false); + QualifiedTypeName type_name_HelloWorld = "HelloWorld"; + eprosima::fastcdr::optional type_ann_builtin_HelloWorld; + eprosima::fastcdr::optional ann_custom_HelloWorld; + AppliedAnnotationSeq tmp_ann_custom_HelloWorld; + eprosima::fastcdr::optional verbatim_HelloWorld; + if (!tmp_ann_custom_HelloWorld.empty()) + { + ann_custom_HelloWorld = tmp_ann_custom_HelloWorld; + } + + CompleteTypeDetail detail_HelloWorld = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_HelloWorld, ann_custom_HelloWorld, type_name_HelloWorld.to_string()); + CompleteStructHeader header_HelloWorld; + header_HelloWorld = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_HelloWorld); + CompleteStructMemberSeq member_seq_HelloWorld; + { + TypeIdentifierPair type_ids_index; + ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; + return_code_index = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_index); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_index = 0x00000000; + bool common_index_ec {false}; + CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; + if (!common_index_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); + return; + } + MemberName name_index = "index"; + eprosima::fastcdr::optional member_ann_builtin_index; + ann_custom_HelloWorld.reset(); + CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_HelloWorld); + CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); + TypeObjectUtils::add_complete_struct_member(member_seq_HelloWorld, member_index); + } + { + TypeIdentifierPair type_ids_message; + ReturnCode_t return_code_message {eprosima::fastdds::dds::RETCODE_OK}; + return_code_message = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_message); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_message) + { + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded", type_ids_message)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_message = 0x00000001; + bool common_message_ec {false}; + CommonStructMember common_message {TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_message, common_message_ec))}; + if (!common_message_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure message member TypeIdentifier inconsistent."); + return; + } + MemberName name_message = "message"; + eprosima::fastcdr::optional member_ann_builtin_message; + ann_custom_HelloWorld.reset(); + CompleteMemberDetail detail_message = TypeObjectUtils::build_complete_member_detail(name_message, member_ann_builtin_message, ann_custom_HelloWorld); + CompleteStructMember member_message = TypeObjectUtils::build_complete_struct_member(common_message, detail_message); + TypeObjectUtils::add_complete_struct_member(member_seq_HelloWorld, member_message); + } + CompleteStructType struct_type_HelloWorld = TypeObjectUtils::build_complete_struct_type(struct_flags_HelloWorld, header_HelloWorld, member_seq_HelloWorld); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_HelloWorld, type_name_HelloWorld.to_string(), type_ids_HelloWorld)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "HelloWorld already registered in TypeObjectRegistry for a different type."); + } + } +} + diff --git a/examples/cpp/HelloWorldExample/HelloWorldTypeObjectSupport.hpp b/examples/cpp/HelloWorldExample/HelloWorldTypeObjectSupport.hpp new file mode 100644 index 000000000..ec922163d --- /dev/null +++ b/examples/cpp/HelloWorldExample/HelloWorldTypeObjectSupport.hpp @@ -0,0 +1,56 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file HelloWorldTypeObjectSupport.hpp + * Header file containing the API required to register the TypeObject representation of the described types in the IDL file + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP + +#include + + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register HelloWorld related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_HelloWorld_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP diff --git a/examples/cpp/HelloWorldExample/HelloWorldv1.cxx b/examples/cpp/HelloWorldExample/HelloWorldv1.cxx deleted file mode 100644 index 1a133a1e2..000000000 --- a/examples/cpp/HelloWorldExample/HelloWorldv1.cxx +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file HelloWorld.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "HelloWorld.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define HelloWorld_max_cdr_typesize 264ULL; - - - - -HelloWorld::HelloWorld() -{ - // unsigned long m_index - m_index = 0; - // /type_d() m_message - - -} - -HelloWorld::~HelloWorld() -{ -} - -HelloWorld::HelloWorld( - const HelloWorld& x) -{ - m_index = x.m_index; - - - m_message = x.m_message; - -} - -HelloWorld::HelloWorld( - HelloWorld&& x) noexcept -{ - m_index = x.m_index; - - - m_message = std::move(x.m_message); - -} - -HelloWorld& HelloWorld::operator =( - const HelloWorld& x) -{ - m_index = x.m_index; - - - m_message = x.m_message; - - return *this; -} - -HelloWorld& HelloWorld::operator =( - HelloWorld&& x) noexcept -{ - m_index = x.m_index; - - - m_message = std::move(x.m_message); - - return *this; -} - -bool HelloWorld::operator ==( - const HelloWorld& x) const -{ - return (m_index == x.m_index && - m_message == x.m_message); -} - -bool HelloWorld::operator !=( - const HelloWorld& x) const -{ - return !(*this == x); -} - -size_t HelloWorld::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return HelloWorld_max_cdr_typesize; -} - -size_t HelloWorld::getCdrSerializedSize( - const HelloWorld& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.message().size() + 1; - - - return current_alignment - initial_alignment; -} - - -void HelloWorld::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_index; - - scdr << m_message.c_str(); - -} - -void HelloWorld::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_index; - - - - dcdr >> m_message; - - -} - - -bool HelloWorld::isKeyDefined() -{ - return false; -} - -void HelloWorld::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ -void HelloWorld::index( - uint32_t _index) -{ - m_index = _index; -} - -/*! - * @brief This function returns the value of member index - * @return Value of member index - */ -uint32_t HelloWorld::index() const -{ - return m_index; -} - -/*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ -uint32_t& HelloWorld::index() -{ - return m_index; -} - - -/*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ -void HelloWorld::message( - const std::string& _message) -{ - m_message = _message; -} - -/*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ -void HelloWorld::message( - std::string&& _message) -{ - m_message = std::move(_message); -} - -/*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ -const std::string& HelloWorld::message() const -{ - return m_message; -} - -/*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ -std::string& HelloWorld::message() -{ - return m_message; -} - - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/examples/cpp/HelloWorldExample/HelloWorldv1.h b/examples/cpp/HelloWorldExample/HelloWorldv1.h deleted file mode 100644 index 9f6f726e0..000000000 --- a/examples/cpp/HelloWorldExample/HelloWorldv1.h +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file HelloWorld.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_HELLOWORLD_H_ -#define _FAST_DDS_GENERATED_HELLOWORLD_H_ - - -#include - -#include -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(HELLOWORLD_SOURCE) -#define HELLOWORLD_DllAPI __declspec( dllexport ) -#else -#define HELLOWORLD_DllAPI __declspec( dllimport ) -#endif // HELLOWORLD_SOURCE -#else -#define HELLOWORLD_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define HELLOWORLD_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - - - -/*! - * @brief This class represents the structure HelloWorld defined by the user in the IDL file. - * @ingroup HelloWorld - */ -class HelloWorld -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport HelloWorld(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~HelloWorld(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld( - const HelloWorld& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld( - HelloWorld&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld& operator =( - const HelloWorld& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object HelloWorld that will be copied. - */ - eProsima_user_DllExport HelloWorld& operator =( - HelloWorld&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x HelloWorld object to compare. - */ - eProsima_user_DllExport bool operator ==( - const HelloWorld& x) const; - - /*! - * @brief Comparison operator. - * @param x HelloWorld object to compare. - */ - eProsima_user_DllExport bool operator !=( - const HelloWorld& x) const; - - /*! - * @brief This function sets a value in member index - * @param _index New value for member index - */ - eProsima_user_DllExport void index( - uint32_t _index); - - /*! - * @brief This function returns the value of member index - * @return Value of member index - */ - eProsima_user_DllExport uint32_t index() const; - - /*! - * @brief This function returns a reference to member index - * @return Reference to member index - */ - eProsima_user_DllExport uint32_t& index(); - - - /*! - * @brief This function copies the value in member message - * @param _message New value to be copied in member message - */ - eProsima_user_DllExport void message( - const std::string& _message); - - /*! - * @brief This function moves the value in member message - * @param _message New value to be moved in member message - */ - eProsima_user_DllExport void message( - std::string&& _message); - - /*! - * @brief This function returns a constant reference to member message - * @return Constant reference to member message - */ - eProsima_user_DllExport const std::string& message() const; - - /*! - * @brief This function returns a reference to member message - * @return Reference to member message - */ - eProsima_user_DllExport std::string& message(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const HelloWorld& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - -private: - - uint32_t m_index; - std::string m_message; - -}; - - -#endif // _FAST_DDS_GENERATED_HELLOWORLD_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/examples/cpp/HelloWorldExample/Monitor.h b/examples/cpp/HelloWorldExample/Monitor.h index 3c0e53226..2bb5bcd9c 100644 --- a/examples/cpp/HelloWorldExample/Monitor.h +++ b/examples/cpp/HelloWorldExample/Monitor.h @@ -16,8 +16,8 @@ * @file Monitor.h */ -#ifndef _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_MONITOR_H_ -#define _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_MONITOR_H_ +#ifndef FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__MONITOR_H +#define FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__MONITOR_H #include #include @@ -164,4 +164,4 @@ class Monitor static std::condition_variable terminate_cv_; }; -#endif /* _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_MONITOR_H_ */ +#endif /* FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__MONITOR_H */ diff --git a/examples/cpp/HelloWorldExample/arg_configuration.h b/examples/cpp/HelloWorldExample/arg_configuration.h index 9814d618d..06ca3d749 100644 --- a/examples/cpp/HelloWorldExample/arg_configuration.h +++ b/examples/cpp/HelloWorldExample/arg_configuration.h @@ -17,8 +17,8 @@ * */ -#ifndef _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_ARG_CONFIGURATION_H_ -#define _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_ARG_CONFIGURATION_H_ +#ifndef FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE__ARG_CONFIGURATION_H +#define FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE__ARG_CONFIGURATION_H #include #include @@ -156,4 +156,4 @@ void print_warning( std::cerr << "WARNING: " << opt << " is a " << type << " option, ignoring argument." << std::endl; } -#endif /* _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_ARG_CONFIGURATION_H_ */ +#endif /* FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE__ARG_CONFIGURATION_H */ diff --git a/examples/cpp/ROS2Prometheus/CMakeLists.txt b/examples/cpp/ROS2Prometheus/CMakeLists.txt index b271d233b..fb15688cd 100644 --- a/examples/cpp/ROS2Prometheus/CMakeLists.txt +++ b/examples/cpp/ROS2Prometheus/CMakeLists.txt @@ -21,7 +21,7 @@ endif() project(ROS2Prometheus) find_package(fastcdr REQUIRED) -find_package(fastrtps REQUIRED) +find_package(fastdds REQUIRED) find_package(fastdds_statistics_backend REQUIRED) find_package(prometheus-cpp CONFIG REQUIRED) @@ -44,6 +44,6 @@ target_compile_definitions(ROS2Prometheus PRIVATE $<$>,$>:__DEBUG> $<$:__INTERNALDEBUG> # Internal debug activated. ) -target_link_libraries(ROS2Prometheus fastrtps fastcdr fastdds_statistics_backend prometheus-cpp::pull) +target_link_libraries(ROS2Prometheus fastdds fastcdr fastdds_statistics_backend prometheus-cpp::pull) install(TARGETS ROS2Prometheus RUNTIME DESTINATION examples/cpp/ROS2Prometheus/${BIN_INSTALL_DIR}) diff --git a/examples/cpp/ROS2Prometheus/Monitor.h b/examples/cpp/ROS2Prometheus/Monitor.h index 5736d6aec..c5dc02350 100644 --- a/examples/cpp/ROS2Prometheus/Monitor.h +++ b/examples/cpp/ROS2Prometheus/Monitor.h @@ -16,8 +16,8 @@ * @file Monitor.h */ -#ifndef MONITOR_H_ -#define MONITOR_H_ +#ifndef FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_ROS2PROMETHEUS__MONITOR_H +#define FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_ROS2PROMETHEUS__MONITOR_H #include #include @@ -162,4 +162,4 @@ class Monitor prometheus::Gauge* publication_throughput_mean_; }; -#endif /* MONITOR_H_ */ +#endif /* FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_ROS2PROMETHEUS__MONITOR_H */ diff --git a/examples/cpp/ROS2Prometheus/arg_configuration.h b/examples/cpp/ROS2Prometheus/arg_configuration.h index a81825e6b..31de169c6 100644 --- a/examples/cpp/ROS2Prometheus/arg_configuration.h +++ b/examples/cpp/ROS2Prometheus/arg_configuration.h @@ -17,8 +17,8 @@ * */ -#ifndef _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_ARG_CONFIGURATION_H_ -#define _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_ARG_CONFIGURATION_H_ +#ifndef FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_ROS2PROMETHEUS__ARG_CONFIGURATION_H +#define FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_ROS2PROMETHEUS__ARG_CONFIGURATION_H #include #include @@ -138,4 +138,4 @@ void print_warning( std::cerr << "WARNING: " << opt << " is a " << type << " option, ignoring argument." << std::endl; } -#endif /* _EPROSIMA_FASTDDSSTATISTICSBACKEND_EXAMPLES_CPP_HELLOWORLDEXAMPLE_ARG_CONFIGURATION_H_ */ +#endif /* FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_ROS2PROMETHEUS_ARG_CONFIGURATION_H */ diff --git a/examples/cpp/ROS2Prometheus/optionparser.h b/examples/cpp/ROS2Prometheus/optionparser.h index 16fda026f..5575e19a2 100644 --- a/examples/cpp/ROS2Prometheus/optionparser.h +++ b/examples/cpp/ROS2Prometheus/optionparser.h @@ -217,23 +217,24 @@ #define OPTIONPARSER_H_ /** @brief The namespace of The Lean Mean C++ Option Parser. */ -namespace option -{ +namespace option { #ifdef _MSC_VER #include #pragma intrinsic(_BitScanReverse) struct MSC_Builtin_CLZ { - static int builtin_clz(unsigned x) - { - unsigned long index; - _BitScanReverse(&index, x); - return 32-index; // int is always 32bit on Windows, even for target x64 - } + static int builtin_clz( + unsigned x) + { + unsigned long index; + _BitScanReverse(&index, x); + return 32 - index; // int is always 32bit on Windows, even for target x64 + } + }; #define __builtin_clz(x) MSC_Builtin_CLZ::builtin_clz(x) -#endif +#endif // ifdef _MSC_VER class Option; @@ -245,14 +246,14 @@ class Option; */ enum ArgStatus { - //! The option does not take an argument. - ARG_NONE, - //! The argument is acceptable for the option. - ARG_OK, - //! The argument is not acceptable but that's non-fatal because the option's argument is optional. - ARG_IGNORE, - //! The argument is not acceptable and that's fatal. - ARG_ILLEGAL + //! The option does not take an argument. + ARG_NONE, + //! The argument is acceptable for the option. + ARG_OK, + //! The argument is not acceptable but that's non-fatal because the option's argument is optional. + ARG_IGNORE, + //! The argument is not acceptable and that's fatal. + ARG_ILLEGAL }; /** @@ -283,7 +284,9 @@ enum ArgStatus * @li @c Arg::Optional @copybrief Arg::Optional * */ -typedef ArgStatus (*CheckArg)(const Option& option, bool msg); +typedef ArgStatus (* CheckArg)( + const Option& option, + bool msg); /** * @brief Describes an option, its help text (usage) and how it should be parsed. @@ -309,112 +312,112 @@ typedef ArgStatus (*CheckArg)(const Option& option, bool msg); */ struct Descriptor { - /** - * @brief Index of this option's linked list in the array filled in by the parser. - * - * Command line options whose Descriptors have the same index will end up in the same - * linked list in the order in which they appear on the command line. If you have - * multiple long option aliases that refer to the same option, give their descriptors - * the same @c index. - * - * If you have options that mean exactly opposite things - * (e.g. @c --enable-foo and @c --disable-foo ), you should also give them the same - * @c index, but distinguish them through different values for @ref type. - * That way they end up in the same list and you can just take the last element of the - * list and use its type. This way you get the usual behaviour where switches later - * on the command line override earlier ones without having to code it manually. - * - * @par Tip: - * Use an enum rather than plain ints for better readability, as shown in the example - * at Descriptor. - */ - const unsigned index; - - /** - * @brief Used to distinguish between options with the same @ref index. - * See @ref index for details. - * - * It is recommended that you use an enum rather than a plain int to make your - * code more readable. - */ - const int type; - - /** - * @brief Each char in this string will be accepted as a short option character. - * - * The string must not include the minus character @c '-' or you'll get undefined - * behaviour. - * - * If this Descriptor should not have short option characters, use the empty - * string "". NULL is not permitted here! - * - * See @ref longopt for more information. - */ - const char* const shortopt; - - /** - * @brief The long option name (without the leading @c -- ). - * - * If this Descriptor should not have a long option name, use the empty - * string "". NULL is not permitted here! - * - * While @ref shortopt allows multiple short option characters, each - * Descriptor can have only a single long option name. If you have multiple - * long option names referring to the same option use separate Descriptors - * that have the same @ref index and @ref type. You may repeat - * short option characters in such an alias Descriptor but there's no need to. - * - * @par Dummy Descriptors: - * You can use dummy Descriptors with an - * empty string for both @ref shortopt and @ref longopt to add text to - * the usage that is not related to a specific option. See @ref help. - * The first dummy Descriptor will be used for unknown options (see below). - * - * @par Unknown Option Descriptor: - * The first dummy Descriptor in the list of Descriptors, - * whose @ref shortopt and @ref longopt are both the empty string, will be used - * as the Descriptor for unknown options. An unknown option is a string in - * the argument vector that is not a lone minus @c '-' but starts with a minus - * character and does not match any Descriptor's @ref shortopt or @ref longopt. @n - * Note that the dummy descriptor's @ref check_arg function @e will be called and - * its return value will be evaluated as usual. I.e. if it returns @ref ARG_ILLEGAL - * the parsing will be aborted with Parser::error()==true. @n - * if @c check_arg does not return @ref ARG_ILLEGAL the descriptor's - * @ref index @e will be used to pick the linked list into which - * to put the unknown option. @n - * If there is no dummy descriptor, unknown options will be dropped silently. - * - */ - const char* const longopt; - - /** - * @brief For each option that matches @ref shortopt or @ref longopt this function - * will be called to check a potential argument to the option. - * - * This function will be called even if there is no potential argument. In that case - * it will be passed @c NULL as @c arg parameter. Do not confuse this with the empty - * string. - * - * See @ref CheckArg for more information. - */ - const CheckArg check_arg; - - /** - * @brief The usage text associated with the options in this Descriptor. - * - * You can use option::printUsage() to format your usage message based on - * the @c help texts. You can use dummy Descriptors where - * @ref shortopt and @ref longopt are both the empty string to add text to - * the usage that is not related to a specific option. - * - * See option::printUsage() for special formatting characters you can use in - * @c help to get a column layout. - * - * @attention - * Must be UTF-8-encoded. If your compiler supports C++11 you can use the "u8" - * prefix to make sure string literals are properly encoded. - */ - const char* help; + /** + * @brief Index of this option's linked list in the array filled in by the parser. + * + * Command line options whose Descriptors have the same index will end up in the same + * linked list in the order in which they appear on the command line. If you have + * multiple long option aliases that refer to the same option, give their descriptors + * the same @c index. + * + * If you have options that mean exactly opposite things + * (e.g. @c --enable-foo and @c --disable-foo ), you should also give them the same + * @c index, but distinguish them through different values for @ref type. + * That way they end up in the same list and you can just take the last element of the + * list and use its type. This way you get the usual behaviour where switches later + * on the command line override earlier ones without having to code it manually. + * + * @par Tip: + * Use an enum rather than plain ints for better readability, as shown in the example + * at Descriptor. + */ + const unsigned index; + + /** + * @brief Used to distinguish between options with the same @ref index. + * See @ref index for details. + * + * It is recommended that you use an enum rather than a plain int to make your + * code more readable. + */ + const int type; + + /** + * @brief Each char in this string will be accepted as a short option character. + * + * The string must not include the minus character @c '-' or you'll get undefined + * behaviour. + * + * If this Descriptor should not have short option characters, use the empty + * string "". NULL is not permitted here! + * + * See @ref longopt for more information. + */ + const char* const shortopt; + + /** + * @brief The long option name (without the leading @c -- ). + * + * If this Descriptor should not have a long option name, use the empty + * string "". NULL is not permitted here! + * + * While @ref shortopt allows multiple short option characters, each + * Descriptor can have only a single long option name. If you have multiple + * long option names referring to the same option use separate Descriptors + * that have the same @ref index and @ref type. You may repeat + * short option characters in such an alias Descriptor but there's no need to. + * + * @par Dummy Descriptors: + * You can use dummy Descriptors with an + * empty string for both @ref shortopt and @ref longopt to add text to + * the usage that is not related to a specific option. See @ref help. + * The first dummy Descriptor will be used for unknown options (see below). + * + * @par Unknown Option Descriptor: + * The first dummy Descriptor in the list of Descriptors, + * whose @ref shortopt and @ref longopt are both the empty string, will be used + * as the Descriptor for unknown options. An unknown option is a string in + * the argument vector that is not a lone minus @c '-' but starts with a minus + * character and does not match any Descriptor's @ref shortopt or @ref longopt. @n + * Note that the dummy descriptor's @ref check_arg function @e will be called and + * its return value will be evaluated as usual. I.e. if it returns @ref ARG_ILLEGAL + * the parsing will be aborted with Parser::error()==true. @n + * if @c check_arg does not return @ref ARG_ILLEGAL the descriptor's + * @ref index @e will be used to pick the linked list into which + * to put the unknown option. @n + * If there is no dummy descriptor, unknown options will be dropped silently. + * + */ + const char* const longopt; + + /** + * @brief For each option that matches @ref shortopt or @ref longopt this function + * will be called to check a potential argument to the option. + * + * This function will be called even if there is no potential argument. In that case + * it will be passed @c NULL as @c arg parameter. Do not confuse this with the empty + * string. + * + * See @ref CheckArg for more information. + */ + const CheckArg check_arg; + + /** + * @brief The usage text associated with the options in this Descriptor. + * + * You can use option::printUsage() to format your usage message based on + * the @c help texts. You can use dummy Descriptors where + * @ref shortopt and @ref longopt are both the empty string to add text to + * the usage that is not related to a specific option. + * + * See option::printUsage() for special formatting characters you can use in + * @c help to get a column layout. + * + * @attention + * Must be UTF-8-encoded. If your compiler supports C++11 you can use the "u8" + * prefix to make sure string literals are properly encoded. + */ + const char* help; }; /** @@ -436,397 +439,424 @@ struct Descriptor */ class Option { - Option* next_; - Option* prev_; + Option* next_; + Option* prev_; + public: - /** - * @brief Pointer to this Option's Descriptor. - * - * Remember that the first dummy descriptor (see @ref Descriptor::longopt) is used - * for unknown options. - * - * @attention - * @c desc==NULL signals that this Option is unused. This is the default state of - * elements in the result array. You don't need to test @c desc explicitly. You - * can simply write something like this: - * @code - * if (options[CREATE]) - * { - * ... - * } - * @endcode - * This works because of operator const Option*() . - */ - const Descriptor* desc; - - /** - * @brief The name of the option as used on the command line. - * - * The main purpose of this string is to be presented to the user in messages. - * - * In the case of a long option, this is the actual @c argv pointer, i.e. the first - * character is a '-'. In the case of a short option this points to the option - * character within the @c argv string. - * - * Note that in the case of a short option group or an attached option argument, this - * string will contain additional characters following the actual name. Use @ref namelen - * to filter out the actual option name only. - * - */ - const char* name; - - /** - * @brief Pointer to this Option's argument (if any). - * - * NULL if this option has no argument. Do not confuse this with the empty string which - * is a valid argument. - */ - const char* arg; - - /** - * @brief The length of the option @ref name. - * - * Because @ref name points into the actual @c argv string, the option name may be - * followed by more characters (e.g. other short options in the same short option group). - * This value is the number of bytes (not characters!) that are part of the actual name. - * - * For a short option, this length is always 1. For a long option this length is always - * at least 2 if single minus long options are permitted and at least 3 if they are disabled. - * - * @note - * In the pathological case of a minus within a short option group (e.g. @c -xf-z), this - * length is incorrect, because this case will be misinterpreted as a long option and the - * name will therefore extend to the string's 0-terminator or a following '=" character - * if there is one. This is irrelevant for most uses of @ref name and @c namelen. If you - * really need to distinguish the case of a long and a short option, compare @ref name to - * the @c argv pointers. A long option's @c name is always identical to one of them, - * whereas a short option's is never. - */ - int namelen; - - /** - * @brief Returns Descriptor::type of this Option's Descriptor, or 0 if this Option - * is invalid (unused). - * - * Because this method (and last(), too) can be used even on unused Options with desc==0, you can (provided - * you arrange your types properly) switch on type() without testing validity first. - * @code - * enum OptionType { UNUSED=0, DISABLED=0, ENABLED=1 }; - * enum OptionIndex { FOO }; - * const Descriptor usage[] = { - * { FOO, ENABLED, "", "enable-foo", Arg::None, 0 }, - * { FOO, DISABLED, "", "disable-foo", Arg::None, 0 }, - * { 0, 0, 0, 0, 0, 0 } }; - * ... - * switch(options[FOO].last()->type()) // no validity check required! - * { - * case ENABLED: ... - * case DISABLED: ... // UNUSED==DISABLED ! - * } - * @endcode - */ - int type() const - { - return desc == 0 ? 0 : desc->type; - } - - /** - * @brief Returns Descriptor::index of this Option's Descriptor, or -1 if this Option - * is invalid (unused). - */ - int index() const - { - return desc == 0 ? -1 : (int)desc->index; - } - - /** - * @brief Returns the number of times this Option (or others with the same Descriptor::index) - * occurs in the argument vector. - * - * This corresponds to the number of elements in the linked list this Option is part of. - * It doesn't matter on which element you call count(). The return value is always the same. - * - * Use this to implement cumulative options, such as -v, -vv, -vvv for - * different verbosity levels. - * - * Returns 0 when called for an unused/invalid option. - */ - int count() - { - int c = (desc == 0 ? 0 : 1); - Option* p = first(); - while (!p->isLast()) - { - ++c; - p = p->next_; - }; - return c; - } - - /** - * @brief Returns true iff this is the first element of the linked list. - * - * The first element in the linked list is the first option on the command line - * that has the respective Descriptor::index value. - * - * Returns true for an unused/invalid option. - */ - bool isFirst() const - { - return isTagged(prev_); - } - - /** - * @brief Returns true iff this is the last element of the linked list. - * - * The last element in the linked list is the last option on the command line - * that has the respective Descriptor::index value. - * - * Returns true for an unused/invalid option. - */ - bool isLast() const - { - return isTagged(next_); - } - - /** - * @brief Returns a pointer to the first element of the linked list. - * - * Use this when you want the first occurrence of an option on the command line to - * take precedence. Note that this is not the way most programs handle options. - * You should probably be using last() instead. - * - * @note - * This method may be called on an unused/invalid option and will return a pointer to the - * option itself. - */ - Option* first() - { - Option* p = this; - while (!p->isFirst()) - p = p->prev_; - return p; - } - - /** - * @brief Returns a pointer to the last element of the linked list. - * - * Use this when you want the last occurrence of an option on the command line to - * take precedence. This is the most common way of handling conflicting options. - * - * @note - * This method may be called on an unused/invalid option and will return a pointer to the - * option itself. - * - * @par Tip: - * If you have options with opposite meanings (e.g. @c --enable-foo and @c --disable-foo), you - * can assign them the same Descriptor::index to get them into the same list. Distinguish them by - * Descriptor::type and all you have to do is check last()->type() to get - * the state listed last on the command line. - */ - Option* last() - { - return first()->prevwrap(); - } - - /** - * @brief Returns a pointer to the previous element of the linked list or NULL if - * called on first(). - * - * If called on first() this method returns NULL. Otherwise it will return the - * option with the same Descriptor::index that precedes this option on the command - * line. - */ - Option* prev() - { - return isFirst() ? 0 : prev_; - } - - /** - * @brief Returns a pointer to the previous element of the linked list with wrap-around from - * first() to last(). - * - * If called on first() this method returns last(). Otherwise it will return the - * option with the same Descriptor::index that precedes this option on the command - * line. - */ - Option* prevwrap() - { - return untag(prev_); - } - - /** - * @brief Returns a pointer to the next element of the linked list or NULL if called - * on last(). - * - * If called on last() this method returns NULL. Otherwise it will return the - * option with the same Descriptor::index that follows this option on the command - * line. - */ - Option* next() - { - return isLast() ? 0 : next_; - } - - /** - * @brief Returns a pointer to the next element of the linked list with wrap-around from - * last() to first(). - * - * If called on last() this method returns first(). Otherwise it will return the - * option with the same Descriptor::index that follows this option on the command - * line. - */ - Option* nextwrap() - { - return untag(next_); - } - - /** - * @brief Makes @c new_last the new last() by chaining it into the list after last(). - * - * It doesn't matter which element you call append() on. The new element will always - * be appended to last(). - * - * @attention - * @c new_last must not yet be part of a list, or that list will become corrupted, because - * this method does not unchain @c new_last from an existing list. - */ - void append(Option* new_last) - { - Option* p = last(); - Option* f = first(); - p->next_ = new_last; - new_last->prev_ = p; - new_last->next_ = tag(f); - f->prev_ = tag(new_last); - } - - /** - * @brief Casts from Option to const Option* but only if this Option is valid. - * - * If this Option is valid (i.e. @c desc!=NULL), returns this. - * Otherwise returns NULL. This allows testing an Option directly - * in an if-clause to see if it is used: - * @code - * if (options[CREATE]) - * { - * ... - * } - * @endcode - * It also allows you to write loops like this: - * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) - * fname = opt->arg; ... @endcode - */ - operator const Option*() const - { - return desc ? this : 0; - } - - /** - * @brief Casts from Option to Option* but only if this Option is valid. - * - * If this Option is valid (i.e. @c desc!=NULL), returns this. - * Otherwise returns NULL. This allows testing an Option directly - * in an if-clause to see if it is used: - * @code - * if (options[CREATE]) - * { - * ... - * } - * @endcode - * It also allows you to write loops like this: - * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) - * fname = opt->arg; ... @endcode - */ - operator Option*() - { - return desc ? this : 0; - } - - /** - * @brief Creates a new Option that is a one-element linked list and has NULL - * @ref desc, @ref name, @ref arg and @ref namelen. - */ - Option() : - desc(0), name(0), arg(0), namelen(0) - { - prev_ = tag(this); - next_ = tag(this); - } - - /** - * @brief Creates a new Option that is a one-element linked list and has the given - * values for @ref desc, @ref name and @ref arg. - * - * If @c name_ points at a character other than '-' it will be assumed to refer to a - * short option and @ref namelen will be set to 1. Otherwise the length will extend to - * the first '=' character or the string's 0-terminator. - */ - Option(const Descriptor* desc_, const char* name_, const char* arg_) - { - init(desc_, name_, arg_); - } - - /** - * @brief Makes @c *this a copy of @c orig except for the linked list pointers. - * - * After this operation @c *this will be a one-element linked list. - */ - void operator=(const Option& orig) - { - init(orig.desc, orig.name, orig.arg); - } - - /** - * @brief Makes @c *this a copy of @c orig except for the linked list pointers. - * - * After this operation @c *this will be a one-element linked list. - */ - Option(const Option& orig) - { - init(orig.desc, orig.name, orig.arg); - } + + /** + * @brief Pointer to this Option's Descriptor. + * + * Remember that the first dummy descriptor (see @ref Descriptor::longopt) is used + * for unknown options. + * + * @attention + * @c desc==NULL signals that this Option is unused. This is the default state of + * elements in the result array. You don't need to test @c desc explicitly. You + * can simply write something like this: + * @code + * if (options[CREATE]) + * { + * ... + * } + * @endcode + * This works because of operator const Option*() . + */ + const Descriptor* desc; + + /** + * @brief The name of the option as used on the command line. + * + * The main purpose of this string is to be presented to the user in messages. + * + * In the case of a long option, this is the actual @c argv pointer, i.e. the first + * character is a '-'. In the case of a short option this points to the option + * character within the @c argv string. + * + * Note that in the case of a short option group or an attached option argument, this + * string will contain additional characters following the actual name. Use @ref namelen + * to filter out the actual option name only. + * + */ + const char* name; + + /** + * @brief Pointer to this Option's argument (if any). + * + * NULL if this option has no argument. Do not confuse this with the empty string which + * is a valid argument. + */ + const char* arg; + + /** + * @brief The length of the option @ref name. + * + * Because @ref name points into the actual @c argv string, the option name may be + * followed by more characters (e.g. other short options in the same short option group). + * This value is the number of bytes (not characters!) that are part of the actual name. + * + * For a short option, this length is always 1. For a long option this length is always + * at least 2 if single minus long options are permitted and at least 3 if they are disabled. + * + * @note + * In the pathological case of a minus within a short option group (e.g. @c -xf-z), this + * length is incorrect, because this case will be misinterpreted as a long option and the + * name will therefore extend to the string's 0-terminator or a following '=" character + * if there is one. This is irrelevant for most uses of @ref name and @c namelen. If you + * really need to distinguish the case of a long and a short option, compare @ref name to + * the @c argv pointers. A long option's @c name is always identical to one of them, + * whereas a short option's is never. + */ + int namelen; + + /** + * @brief Returns Descriptor::type of this Option's Descriptor, or 0 if this Option + * is invalid (unused). + * + * Because this method (and last(), too) can be used even on unused Options with desc==0, you can (provided + * you arrange your types properly) switch on type() without testing validity first. + * @code + * enum OptionType { UNUSED=0, DISABLED=0, ENABLED=1 }; + * enum OptionIndex { FOO }; + * const Descriptor usage[] = { + * { FOO, ENABLED, "", "enable-foo", Arg::None, 0 }, + * { FOO, DISABLED, "", "disable-foo", Arg::None, 0 }, + * { 0, 0, 0, 0, 0, 0 } }; + * ... + * switch(options[FOO].last()->type()) // no validity check required! + * { + * case ENABLED: ... + * case DISABLED: ... // UNUSED==DISABLED ! + * } + * @endcode + */ + int type() const + { + return desc == 0 ? 0 : desc->type; + } + + /** + * @brief Returns Descriptor::index of this Option's Descriptor, or -1 if this Option + * is invalid (unused). + */ + int index() const + { + return desc == 0 ? -1 : (int)desc->index; + } + + /** + * @brief Returns the number of times this Option (or others with the same Descriptor::index) + * occurs in the argument vector. + * + * This corresponds to the number of elements in the linked list this Option is part of. + * It doesn't matter on which element you call count(). The return value is always the same. + * + * Use this to implement cumulative options, such as -v, -vv, -vvv for + * different verbosity levels. + * + * Returns 0 when called for an unused/invalid option. + */ + int count() + { + int c = (desc == 0 ? 0 : 1); + Option* p = first(); + while (!p->isLast()) + { + ++c; + p = p->next_; + } + return c; + } + + /** + * @brief Returns true iff this is the first element of the linked list. + * + * The first element in the linked list is the first option on the command line + * that has the respective Descriptor::index value. + * + * Returns true for an unused/invalid option. + */ + bool isFirst() const + { + return isTagged(prev_); + } + + /** + * @brief Returns true iff this is the last element of the linked list. + * + * The last element in the linked list is the last option on the command line + * that has the respective Descriptor::index value. + * + * Returns true for an unused/invalid option. + */ + bool isLast() const + { + return isTagged(next_); + } + + /** + * @brief Returns a pointer to the first element of the linked list. + * + * Use this when you want the first occurrence of an option on the command line to + * take precedence. Note that this is not the way most programs handle options. + * You should probably be using last() instead. + * + * @note + * This method may be called on an unused/invalid option and will return a pointer to the + * option itself. + */ + Option* first() + { + Option* p = this; + while (!p->isFirst()) + { + p = p->prev_; + } + return p; + } + + /** + * @brief Returns a pointer to the last element of the linked list. + * + * Use this when you want the last occurrence of an option on the command line to + * take precedence. This is the most common way of handling conflicting options. + * + * @note + * This method may be called on an unused/invalid option and will return a pointer to the + * option itself. + * + * @par Tip: + * If you have options with opposite meanings (e.g. @c --enable-foo and @c --disable-foo), you + * can assign them the same Descriptor::index to get them into the same list. Distinguish them by + * Descriptor::type and all you have to do is check last()->type() to get + * the state listed last on the command line. + */ + Option* last() + { + return first()->prevwrap(); + } + + /** + * @brief Returns a pointer to the previous element of the linked list or NULL if + * called on first(). + * + * If called on first() this method returns NULL. Otherwise it will return the + * option with the same Descriptor::index that precedes this option on the command + * line. + */ + Option* prev() + { + return isFirst() ? 0 : prev_; + } + + /** + * @brief Returns a pointer to the previous element of the linked list with wrap-around from + * first() to last(). + * + * If called on first() this method returns last(). Otherwise it will return the + * option with the same Descriptor::index that precedes this option on the command + * line. + */ + Option* prevwrap() + { + return untag(prev_); + } + + /** + * @brief Returns a pointer to the next element of the linked list or NULL if called + * on last(). + * + * If called on last() this method returns NULL. Otherwise it will return the + * option with the same Descriptor::index that follows this option on the command + * line. + */ + Option* next() + { + return isLast() ? 0 : next_; + } + + /** + * @brief Returns a pointer to the next element of the linked list with wrap-around from + * last() to first(). + * + * If called on last() this method returns first(). Otherwise it will return the + * option with the same Descriptor::index that follows this option on the command + * line. + */ + Option* nextwrap() + { + return untag(next_); + } + + /** + * @brief Makes @c new_last the new last() by chaining it into the list after last(). + * + * It doesn't matter which element you call append() on. The new element will always + * be appended to last(). + * + * @attention + * @c new_last must not yet be part of a list, or that list will become corrupted, because + * this method does not unchain @c new_last from an existing list. + */ + void append( + Option* new_last) + { + Option* p = last(); + Option* f = first(); + p->next_ = new_last; + new_last->prev_ = p; + new_last->next_ = tag(f); + f->prev_ = tag(new_last); + } + + /** + * @brief Casts from Option to const Option* but only if this Option is valid. + * + * If this Option is valid (i.e. @c desc!=NULL), returns this. + * Otherwise returns NULL. This allows testing an Option directly + * in an if-clause to see if it is used: + * @code + * if (options[CREATE]) + * { + * ... + * } + * @endcode + * It also allows you to write loops like this: + * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) + * fname = opt->arg; ... @endcode + */ + operator const Option*() const + { + return desc ? this : 0; + } + + /** + * @brief Casts from Option to Option* but only if this Option is valid. + * + * If this Option is valid (i.e. @c desc!=NULL), returns this. + * Otherwise returns NULL. This allows testing an Option directly + * in an if-clause to see if it is used: + * @code + * if (options[CREATE]) + * { + * ... + * } + * @endcode + * It also allows you to write loops like this: + * @code for (Option* opt = options[FILE]; opt; opt = opt->next()) + * fname = opt->arg; ... @endcode + */ + operator Option*() + { + return desc ? this : 0; + } + + /** + * @brief Creates a new Option that is a one-element linked list and has NULL + * @ref desc, @ref name, @ref arg and @ref namelen. + */ + Option() + : desc(0) + , name(0) + , arg(0) + , namelen(0) + { + prev_ = tag(this); + next_ = tag(this); + } + + /** + * @brief Creates a new Option that is a one-element linked list and has the given + * values for @ref desc, @ref name and @ref arg. + * + * If @c name_ points at a character other than '-' it will be assumed to refer to a + * short option and @ref namelen will be set to 1. Otherwise the length will extend to + * the first '=' character or the string's 0-terminator. + */ + Option( + const Descriptor* desc_, + const char* name_, + const char* arg_) + { + init(desc_, name_, arg_); + } + + /** + * @brief Makes @c *this a copy of @c orig except for the linked list pointers. + * + * After this operation @c *this will be a one-element linked list. + */ + void operator =( + const Option& orig) + { + init(orig.desc, orig.name, orig.arg); + } + + /** + * @brief Makes @c *this a copy of @c orig except for the linked list pointers. + * + * After this operation @c *this will be a one-element linked list. + */ + Option( + const Option& orig) + { + init(orig.desc, orig.name, orig.arg); + } private: - /** - * @internal - * @brief Sets the fields of this Option to the given values (extracting @c name if necessary). - * - * If @c name_ points at a character other than '-' it will be assumed to refer to a - * short option and @ref namelen will be set to 1. Otherwise the length will extend to - * the first '=' character or the string's 0-terminator. - */ - void init(const Descriptor* desc_, const char* name_, const char* arg_) - { - desc = desc_; - name = name_; - arg = arg_; - prev_ = tag(this); - next_ = tag(this); - namelen = 0; - if (name == 0) - return; - namelen = 1; - if (name[0] != '-') - return; - while (name[namelen] != 0 && name[namelen] != '=') - ++namelen; - } - - static Option* tag(Option* ptr) - { - return (Option*) ((unsigned long long) ptr | 1); - } - - static Option* untag(Option* ptr) - { - return (Option*) ((unsigned long long) ptr & ~1ull); - } - - static bool isTagged(Option* ptr) - { - return ((unsigned long long) ptr & 1); - } + + /** + * @internal + * @brief Sets the fields of this Option to the given values (extracting @c name if necessary). + * + * If @c name_ points at a character other than '-' it will be assumed to refer to a + * short option and @ref namelen will be set to 1. Otherwise the length will extend to + * the first '=' character or the string's 0-terminator. + */ + void init( + const Descriptor* desc_, + const char* name_, + const char* arg_) + { + desc = desc_; + name = name_; + arg = arg_; + prev_ = tag(this); + next_ = tag(this); + namelen = 0; + if (name == 0) + { + return; + } + namelen = 1; + if (name[0] != '-') + { + return; + } + while (name[namelen] != 0 && name[namelen] != '=') + { + ++namelen; + } + } + + static Option* tag( + Option* ptr) + { + return (Option*) ((unsigned long long) ptr | 1); + } + + static Option* untag( + Option* ptr) + { + return (Option*) ((unsigned long long) ptr & ~1ull); + } + + static bool isTagged( + Option* ptr) + { + return ((unsigned long long) ptr & 1); + } + }; /** @@ -885,20 +915,29 @@ class Option */ struct Arg { - //! @brief For options that don't take an argument: Returns ARG_NONE. - static ArgStatus None(const Option&, bool) - { - return ARG_NONE; - } - - //! @brief Returns ARG_OK if the argument is attached and ARG_IGNORE otherwise. - static ArgStatus Optional(const Option& option, bool) - { - if (option.arg && option.name[option.namelen] != 0) - return ARG_OK; - else - return ARG_IGNORE; - } + //! @brief For options that don't take an argument: Returns ARG_NONE. + static ArgStatus None( + const Option&, + bool) + { + return ARG_NONE; + } + + //! @brief Returns ARG_OK if the argument is attached and ARG_IGNORE otherwise. + static ArgStatus Optional( + const Option& option, + bool) + { + if (option.arg && option.name[option.namelen] != 0) + { + return ARG_OK; + } + else + { + return ARG_IGNORE; + } + } + }; /** @@ -912,112 +951,155 @@ struct Arg */ struct Stats { - /** - * @brief Number of elements needed for a @c buffer[] array to be used for - * @ref Parser::parse() "parsing" the same argument vectors that were fed - * into this Stats object. - * - * @note - * This number is always 1 greater than the actual number needed, to give - * you a sentinel element. - */ - unsigned buffer_max; - - /** - * @brief Number of elements needed for an @c options[] array to be used for - * @ref Parser::parse() "parsing" the same argument vectors that were fed - * into this Stats object. - * - * @note - * @li This number is always 1 greater than the actual number needed, to give - * you a sentinel element. - * @li This number depends only on the @c usage, not the argument vectors, because - * the @c options array needs exactly one slot for each possible Descriptor::index. - */ - unsigned options_max; - - /** - * @brief Creates a Stats object with counts set to 1 (for the sentinel element). - */ - Stats() : - buffer_max(1), options_max(1) // 1 more than necessary as sentinel - { - } - - /** - * @brief Creates a new Stats object and immediately updates it for the - * given @c usage and argument vector. You may pass 0 for @c argc and/or @c argv, - * if you just want to update @ref options_max. - * - * @note - * The calls to Stats methods must match the later calls to Parser methods. - * See Parser::parse() for the meaning of the arguments. - */ - Stats(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // - bool single_minus_longopt = false) : - buffer_max(1), options_max(1) // 1 more than necessary as sentinel - { - add(gnu, usage, argc, argv, min_abbr_len, single_minus_longopt); - } - - //! @brief Stats(...) with non-const argv. - Stats(bool gnu, const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // - bool single_minus_longopt = false) : - buffer_max(1), options_max(1) // 1 more than necessary as sentinel - { - add(gnu, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); - } - - //! @brief POSIX Stats(...) (gnu==false). - Stats(const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // - bool single_minus_longopt = false) : - buffer_max(1), options_max(1) // 1 more than necessary as sentinel - { - add(false, usage, argc, argv, min_abbr_len, single_minus_longopt); - } - - //! @brief POSIX Stats(...) (gnu==false) with non-const argv. - Stats(const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // - bool single_minus_longopt = false) : - buffer_max(1), options_max(1) // 1 more than necessary as sentinel - { - add(false, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); - } - - /** - * @brief Updates this Stats object for the - * given @c usage and argument vector. You may pass 0 for @c argc and/or @c argv, - * if you just want to update @ref options_max. - * - * @note - * The calls to Stats methods must match the later calls to Parser methods. - * See Parser::parse() for the meaning of the arguments. - */ - void add(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // - bool single_minus_longopt = false); - - //! @brief add() with non-const argv. - void add(bool gnu, const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // - bool single_minus_longopt = false) - { - add(gnu, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); - } - - //! @brief POSIX add() (gnu==false). - void add(const Descriptor usage[], int argc, const char** argv, int min_abbr_len = 0, // - bool single_minus_longopt = false) - { - add(false, usage, argc, argv, min_abbr_len, single_minus_longopt); - } - - //! @brief POSIX add() (gnu==false) with non-const argv. - void add(const Descriptor usage[], int argc, char** argv, int min_abbr_len = 0, // - bool single_minus_longopt = false) - { - add(false, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); - } + /** + * @brief Number of elements needed for a @c buffer[] array to be used for + * @ref Parser::parse() "parsing" the same argument vectors that were fed + * into this Stats object. + * + * @note + * This number is always 1 greater than the actual number needed, to give + * you a sentinel element. + */ + unsigned buffer_max; + + /** + * @brief Number of elements needed for an @c options[] array to be used for + * @ref Parser::parse() "parsing" the same argument vectors that were fed + * into this Stats object. + * + * @note + * @li This number is always 1 greater than the actual number needed, to give + * you a sentinel element. + * @li This number depends only on the @c usage, not the argument vectors, because + * the @c options array needs exactly one slot for each possible Descriptor::index. + */ + unsigned options_max; + + /** + * @brief Creates a Stats object with counts set to 1 (for the sentinel element). + */ + Stats() + : buffer_max(1) + , options_max(1) // 1 more than necessary as sentinel + { + } + + /** + * @brief Creates a new Stats object and immediately updates it for the + * given @c usage and argument vector. You may pass 0 for @c argc and/or @c argv, + * if you just want to update @ref options_max. + * + * @note + * The calls to Stats methods must match the later calls to Parser methods. + * See Parser::parse() for the meaning of the arguments. + */ + Stats( + bool gnu, + const Descriptor usage[], + int argc, + const char** argv, + int min_abbr_len = 0, // + bool single_minus_longopt = false) + : buffer_max(1) + , options_max(1) // 1 more than necessary as sentinel + { + add(gnu, usage, argc, argv, min_abbr_len, single_minus_longopt); + } + + //! @brief Stats(...) with non-const argv. + Stats( + bool gnu, + const Descriptor usage[], + int argc, + char** argv, + int min_abbr_len = 0, // + bool single_minus_longopt = false) + : buffer_max(1) + , options_max(1) // 1 more than necessary as sentinel + { + add(gnu, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); + } + + //! @brief POSIX Stats(...) (gnu==false). + Stats( + const Descriptor usage[], + int argc, + const char** argv, + int min_abbr_len = 0, // + bool single_minus_longopt = false) + : buffer_max(1) + , options_max(1) // 1 more than necessary as sentinel + { + add(false, usage, argc, argv, min_abbr_len, single_minus_longopt); + } + + //! @brief POSIX Stats(...) (gnu==false) with non-const argv. + Stats( + const Descriptor usage[], + int argc, + char** argv, + int min_abbr_len = 0, // + bool single_minus_longopt = false) + : buffer_max(1) + , options_max(1) // 1 more than necessary as sentinel + { + add(false, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); + } + + /** + * @brief Updates this Stats object for the + * given @c usage and argument vector. You may pass 0 for @c argc and/or @c argv, + * if you just want to update @ref options_max. + * + * @note + * The calls to Stats methods must match the later calls to Parser methods. + * See Parser::parse() for the meaning of the arguments. + */ + void add( + bool gnu, + const Descriptor usage[], + int argc, + const char** argv, + int min_abbr_len = 0, // + bool single_minus_longopt = false); + + //! @brief add() with non-const argv. + void add( + bool gnu, + const Descriptor usage[], + int argc, + char** argv, + int min_abbr_len = 0, // + bool single_minus_longopt = false) + { + add(gnu, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); + } + + //! @brief POSIX add() (gnu==false). + void add( + const Descriptor usage[], + int argc, + const char** argv, + int min_abbr_len = 0, // + bool single_minus_longopt = false) + { + add(false, usage, argc, argv, min_abbr_len, single_minus_longopt); + } + + //! @brief POSIX add() (gnu==false) with non-const argv. + void add( + const Descriptor usage[], + int argc, + char** argv, + int min_abbr_len = 0, // + bool single_minus_longopt = false) + { + add(false, usage, argc, (const char**) argv, min_abbr_len, single_minus_longopt); + } + private: - class CountOptionsAction; + + class CountOptionsAction; }; /** @@ -1042,310 +1124,411 @@ struct Stats */ class Parser { - int op_count; //!< @internal @brief see optionsCount() - int nonop_count; //!< @internal @brief see nonOptionsCount() - const char** nonop_args; //!< @internal @brief see nonOptions() - bool err; //!< @internal @brief see error() + int op_count; //!< @internal @brief see optionsCount() + int nonop_count; //!< @internal @brief see nonOptionsCount() + const char** nonop_args; //!< @internal @brief see nonOptions() + bool err; //!< @internal @brief see error() + public: - /** - * @brief Creates a new Parser. - */ - Parser() : - op_count(0), nonop_count(0), nonop_args(0), err(false) - { - } - - /** - * @brief Creates a new Parser and immediately parses the given argument vector. - * @copydetails parse() - */ - Parser(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], - int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) : - op_count(0), nonop_count(0), nonop_args(0), err(false) - { - parse(gnu, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); - } - - //! @brief Parser(...) with non-const argv. - Parser(bool gnu, const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], - int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) : - op_count(0), nonop_count(0), nonop_args(0), err(false) - { - parse(gnu, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); - } - - //! @brief POSIX Parser(...) (gnu==false). - Parser(const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], int min_abbr_len = 0, - bool single_minus_longopt = false, int bufmax = -1) : - op_count(0), nonop_count(0), nonop_args(0), err(false) - { - parse(false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); - } - - //! @brief POSIX Parser(...) (gnu==false) with non-const argv. - Parser(const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], int min_abbr_len = 0, - bool single_minus_longopt = false, int bufmax = -1) : - op_count(0), nonop_count(0), nonop_args(0), err(false) - { - parse(false, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); - } - - /** - * @brief Parses the given argument vector. - * - * @param gnu if true, parse() will not stop at the first non-option argument. Instead it will - * reorder arguments so that all non-options are at the end. This is the default behaviour - * of GNU getopt() but is not conforming to POSIX. @n - * Note, that once the argument vector has been reordered, the @c gnu flag will have - * no further effect on this argument vector. So it is enough to pass @c gnu==true when - * creating Stats. - * @param usage Array of Descriptor objects that describe the options to support. The last entry - * of this array must have 0 in all fields. - * @param argc The number of elements from @c argv that are to be parsed. If you pass -1, the number - * will be determined automatically. In that case the @c argv list must end with a NULL - * pointer. - * @param argv The arguments to be parsed. If you pass -1 as @c argc the last pointer in the @c argv - * list must be NULL to mark the end. - * @param options Each entry is the first element of a linked list of Options. Each new option - * that is parsed will be appended to the list specified by that Option's - * Descriptor::index. If an entry is not yet used (i.e. the Option is invalid), - * it will be replaced rather than appended to. @n - * The minimum length of this array is the greatest Descriptor::index value that - * occurs in @c usage @e PLUS ONE. - * @param buffer Each argument that is successfully parsed (including unknown arguments, if they - * have a Descriptor whose CheckArg does not return @ref ARG_ILLEGAL) will be stored in this - * array. parse() scans the array for the first invalid entry and begins writing at that - * index. You can pass @c bufmax to limit the number of options stored. - * @param min_abbr_len Passing a value min_abbr_len > 0 enables abbreviated long - * options. The parser will match a prefix of a long option as if it was - * the full long option (e.g. @c --foob=10 will be interpreted as if it was - * @c --foobar=10 ), as long as the prefix has at least @c min_abbr_len characters - * (not counting the @c -- ) and is unambiguous. - * @n Be careful if combining @c min_abbr_len=1 with @c single_minus_longopt=true - * because the ambiguity check does not consider short options and abbreviated - * single minus long options will take precedence over short options. - * @param single_minus_longopt Passing @c true for this option allows long options to begin with - * a single minus. The double minus form will still be recognized. Note that - * single minus long options take precedence over short options and short option - * groups. E.g. @c -file would be interpreted as @c --file and not as - * -f -i -l -e (assuming a long option named @c "file" exists). - * @param bufmax The greatest index in the @c buffer[] array that parse() will write to is - * @c bufmax-1. If there are more options, they will be processed (in particular - * their CheckArg will be called) but not stored. @n - * If you used Stats::buffer_max to dimension this array, you can pass - * -1 (or not pass @c bufmax at all) which tells parse() that the buffer is - * "large enough". - * @attention - * Remember that @c options and @c buffer store Option @e objects, not pointers. Therefore it - * is not possible for the same object to be in both arrays. For those options that are found in - * both @c buffer[] and @c options[] the respective objects are independent copies. And only the - * objects in @c options[] are properly linked via Option::next() and Option::prev(). - * You can iterate over @c buffer[] to - * process all options in the order they appear in the argument vector, but if you want access to - * the other Options with the same Descriptor::index, then you @e must access the linked list via - * @c options[]. You can get the linked list in options from a buffer object via something like - * @c options[buffer[i].index()]. - */ - void parse(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], - int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1); - - //! @brief parse() with non-const argv. - void parse(bool gnu, const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], - int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) - { - parse(gnu, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); - } - - //! @brief POSIX parse() (gnu==false). - void parse(const Descriptor usage[], int argc, const char** argv, Option options[], Option buffer[], - int min_abbr_len = 0, bool single_minus_longopt = false, int bufmax = -1) - { - parse(false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); - } - - //! @brief POSIX parse() (gnu==false) with non-const argv. - void parse(const Descriptor usage[], int argc, char** argv, Option options[], Option buffer[], int min_abbr_len = 0, - bool single_minus_longopt = false, int bufmax = -1) - { - parse(false, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); - } - - /** - * @brief Returns the number of valid Option objects in @c buffer[]. - * - * @note - * @li The returned value always reflects the number of Options in the buffer[] array used for - * the most recent call to parse(). - * @li The count (and the buffer[]) includes unknown options if they are collected - * (see Descriptor::longopt). - */ - int optionsCount() - { - return op_count; - } - - /** - * @brief Returns the number of non-option arguments that remained at the end of the - * most recent parse() that actually encountered non-option arguments. - * - * @note - * A parse() that does not encounter non-option arguments will leave this value - * as well as nonOptions() undisturbed. This means you can feed the Parser a - * default argument vector that contains non-option arguments (e.g. a default filename). - * Then you feed it the actual arguments from the user. If the user has supplied at - * least one non-option argument, all of the non-option arguments from the default - * disappear and are replaced by the user's non-option arguments. However, if the - * user does not supply any non-option arguments the defaults will still be in - * effect. - */ - int nonOptionsCount() - { - return nonop_count; - } - - /** - * @brief Returns a pointer to an array of non-option arguments (only valid - * if nonOptionsCount() >0 ). - * - * @note - * @li parse() does not copy arguments, so this pointer points into the actual argument - * vector as passed to parse(). - * @li As explained at nonOptionsCount() this pointer is only changed by parse() calls - * that actually encounter non-option arguments. A parse() call that encounters only - * options, will not change nonOptions(). - */ - const char** nonOptions() - { - return nonop_args; - } - - /** - * @brief Returns nonOptions()[i] (@e without checking if i is in range!). - */ - const char* nonOption(int i) - { - return nonOptions()[i]; - } - - /** - * @brief Returns @c true if an unrecoverable error occurred while parsing options. - * - * An illegal argument to an option (i.e. CheckArg returns @ref ARG_ILLEGAL) is an - * unrecoverable error that aborts the parse. Unknown options are only an error if - * their CheckArg function returns @ref ARG_ILLEGAL. Otherwise they are collected. - * In that case if you want to exit the program if either an illegal argument - * or an unknown option has been passed, use code like this - * - * @code - * if (parser.error() || options[UNKNOWN]) - * exit(1); - * @endcode - * - */ - bool error() - { - return err; - } + /** + * @brief Creates a new Parser. + */ + Parser() + : op_count(0) + , nonop_count(0) + , nonop_args(0) + , err(false) + { + } + + /** + * @brief Creates a new Parser and immediately parses the given argument vector. + * @copydetails parse() + */ + Parser( + bool gnu, + const Descriptor usage[], + int argc, + const char** argv, + Option options[], + Option buffer[], + int min_abbr_len = 0, + bool single_minus_longopt = false, + int bufmax = -1) + : op_count(0) + , nonop_count(0) + , nonop_args(0) + , err(false) + { + parse(gnu, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + //! @brief Parser(...) with non-const argv. + Parser( + bool gnu, + const Descriptor usage[], + int argc, + char** argv, + Option options[], + Option buffer[], + int min_abbr_len = 0, + bool single_minus_longopt = false, + int bufmax = -1) + : op_count(0) + , nonop_count(0) + , nonop_args(0) + , err(false) + { + parse(gnu, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + //! @brief POSIX Parser(...) (gnu==false). + Parser( + const Descriptor usage[], + int argc, + const char** argv, + Option options[], + Option buffer[], + int min_abbr_len = 0, + bool single_minus_longopt = false, + int bufmax = -1) + : op_count(0) + , nonop_count(0) + , nonop_args(0) + , err(false) + { + parse(false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + //! @brief POSIX Parser(...) (gnu==false) with non-const argv. + Parser( + const Descriptor usage[], + int argc, + char** argv, + Option options[], + Option buffer[], + int min_abbr_len = 0, + bool single_minus_longopt = false, + int bufmax = -1) + : op_count(0) + , nonop_count(0) + , nonop_args(0) + , err(false) + { + parse(false, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + /** + * @brief Parses the given argument vector. + * + * @param gnu if true, parse() will not stop at the first non-option argument. Instead it will + * reorder arguments so that all non-options are at the end. This is the default behaviour + * of GNU getopt() but is not conforming to POSIX. @n + * Note, that once the argument vector has been reordered, the @c gnu flag will have + * no further effect on this argument vector. So it is enough to pass @c gnu==true when + * creating Stats. + * @param usage Array of Descriptor objects that describe the options to support. The last entry + * of this array must have 0 in all fields. + * @param argc The number of elements from @c argv that are to be parsed. If you pass -1, the number + * will be determined automatically. In that case the @c argv list must end with a NULL + * pointer. + * @param argv The arguments to be parsed. If you pass -1 as @c argc the last pointer in the @c argv + * list must be NULL to mark the end. + * @param options Each entry is the first element of a linked list of Options. Each new option + * that is parsed will be appended to the list specified by that Option's + * Descriptor::index. If an entry is not yet used (i.e. the Option is invalid), + * it will be replaced rather than appended to. @n + * The minimum length of this array is the greatest Descriptor::index value that + * occurs in @c usage @e PLUS ONE. + * @param buffer Each argument that is successfully parsed (including unknown arguments, if they + * have a Descriptor whose CheckArg does not return @ref ARG_ILLEGAL) will be stored in this + * array. parse() scans the array for the first invalid entry and begins writing at that + * index. You can pass @c bufmax to limit the number of options stored. + * @param min_abbr_len Passing a value min_abbr_len > 0 enables abbreviated long + * options. The parser will match a prefix of a long option as if it was + * the full long option (e.g. @c --foob=10 will be interpreted as if it was + * @c --foobar=10 ), as long as the prefix has at least @c min_abbr_len characters + * (not counting the @c -- ) and is unambiguous. + * @n Be careful if combining @c min_abbr_len=1 with @c single_minus_longopt=true + * because the ambiguity check does not consider short options and abbreviated + * single minus long options will take precedence over short options. + * @param single_minus_longopt Passing @c true for this option allows long options to begin with + * a single minus. The double minus form will still be recognized. Note that + * single minus long options take precedence over short options and short option + * groups. E.g. @c -file would be interpreted as @c --file and not as + * -f -i -l -e (assuming a long option named @c "file" exists). + * @param bufmax The greatest index in the @c buffer[] array that parse() will write to is + * @c bufmax-1. If there are more options, they will be processed (in particular + * their CheckArg will be called) but not stored. @n + * If you used Stats::buffer_max to dimension this array, you can pass + * -1 (or not pass @c bufmax at all) which tells parse() that the buffer is + * "large enough". + * @attention + * Remember that @c options and @c buffer store Option @e objects, not pointers. Therefore it + * is not possible for the same object to be in both arrays. For those options that are found in + * both @c buffer[] and @c options[] the respective objects are independent copies. And only the + * objects in @c options[] are properly linked via Option::next() and Option::prev(). + * You can iterate over @c buffer[] to + * process all options in the order they appear in the argument vector, but if you want access to + * the other Options with the same Descriptor::index, then you @e must access the linked list via + * @c options[]. You can get the linked list in options from a buffer object via something like + * @c options[buffer[i].index()]. + */ + void parse( + bool gnu, + const Descriptor usage[], + int argc, + const char** argv, + Option options[], + Option buffer[], + int min_abbr_len = 0, + bool single_minus_longopt = false, + int bufmax = -1); + + //! @brief parse() with non-const argv. + void parse( + bool gnu, + const Descriptor usage[], + int argc, + char** argv, + Option options[], + Option buffer[], + int min_abbr_len = 0, + bool single_minus_longopt = false, + int bufmax = -1) + { + parse(gnu, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + //! @brief POSIX parse() (gnu==false). + void parse( + const Descriptor usage[], + int argc, + const char** argv, + Option options[], + Option buffer[], + int min_abbr_len = 0, + bool single_minus_longopt = false, + int bufmax = -1) + { + parse(false, usage, argc, argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + //! @brief POSIX parse() (gnu==false) with non-const argv. + void parse( + const Descriptor usage[], + int argc, + char** argv, + Option options[], + Option buffer[], + int min_abbr_len = 0, + bool single_minus_longopt = false, + int bufmax = -1) + { + parse(false, usage, argc, (const char**) argv, options, buffer, min_abbr_len, single_minus_longopt, bufmax); + } + + /** + * @brief Returns the number of valid Option objects in @c buffer[]. + * + * @note + * @li The returned value always reflects the number of Options in the buffer[] array used for + * the most recent call to parse(). + * @li The count (and the buffer[]) includes unknown options if they are collected + * (see Descriptor::longopt). + */ + int optionsCount() + { + return op_count; + } + + /** + * @brief Returns the number of non-option arguments that remained at the end of the + * most recent parse() that actually encountered non-option arguments. + * + * @note + * A parse() that does not encounter non-option arguments will leave this value + * as well as nonOptions() undisturbed. This means you can feed the Parser a + * default argument vector that contains non-option arguments (e.g. a default filename). + * Then you feed it the actual arguments from the user. If the user has supplied at + * least one non-option argument, all of the non-option arguments from the default + * disappear and are replaced by the user's non-option arguments. However, if the + * user does not supply any non-option arguments the defaults will still be in + * effect. + */ + int nonOptionsCount() + { + return nonop_count; + } + + /** + * @brief Returns a pointer to an array of non-option arguments (only valid + * if nonOptionsCount() >0 ). + * + * @note + * @li parse() does not copy arguments, so this pointer points into the actual argument + * vector as passed to parse(). + * @li As explained at nonOptionsCount() this pointer is only changed by parse() calls + * that actually encounter non-option arguments. A parse() call that encounters only + * options, will not change nonOptions(). + */ + const char** nonOptions() + { + return nonop_args; + } + + /** + * @brief Returns nonOptions()[i] (@e without checking if i is in range!). + */ + const char* nonOption( + int i) + { + return nonOptions()[i]; + } + + /** + * @brief Returns @c true if an unrecoverable error occurred while parsing options. + * + * An illegal argument to an option (i.e. CheckArg returns @ref ARG_ILLEGAL) is an + * unrecoverable error that aborts the parse. Unknown options are only an error if + * their CheckArg function returns @ref ARG_ILLEGAL. Otherwise they are collected. + * In that case if you want to exit the program if either an illegal argument + * or an unknown option has been passed, use code like this + * + * @code + * if (parser.error() || options[UNKNOWN]) + * exit(1); + * @endcode + * + */ + bool error() + { + return err; + } private: - friend struct Stats; - class StoreOptionAction; - struct Action; - - /** - * @internal - * @brief This is the core function that does all the parsing. - * @retval false iff an unrecoverable error occurred. - */ - static bool workhorse(bool gnu, const Descriptor usage[], int numargs, const char** args, Action& action, - bool single_minus_longopt, bool print_errors, int min_abbr_len); - - /** - * @internal - * @brief Returns true iff @c st1 is a prefix of @c st2 and - * in case @c st2 is longer than @c st1, then - * the first additional character is '='. - * - * @par Examples: - * @code - * streq("foo", "foo=bar") == true - * streq("foo", "foobar") == false - * streq("foo", "foo") == true - * streq("foo=bar", "foo") == false - * @endcode - */ - static bool streq(const char* st1, const char* st2) - { - while (*st1 != 0) - if (*st1++ != *st2++) - return false; - return (*st2 == 0 || *st2 == '='); - } - - /** - * @internal - * @brief Like streq() but handles abbreviations. - * - * Returns true iff @c st1 and @c st2 have a common - * prefix with the following properties: - * @li (if min > 0) its length is at least @c min characters or the same length as @c st1 (whichever is smaller). - * @li (if min <= 0) its length is the same as that of @c st1 - * @li within @c st2 the character following the common prefix is either '=' or end-of-string. - * - * Examples: - * @code - * streqabbr("foo", "foo=bar",) == true - * streqabbr("foo", "fo=bar" , 2) == true - * streqabbr("foo", "fo" , 2) == true - * streqabbr("foo", "fo" , 0) == false - * streqabbr("foo", "f=bar" , 2) == false - * streqabbr("foo", "f" , 2) == false - * streqabbr("fo" , "foo=bar",) == false - * streqabbr("foo", "foobar" ,) == false - * streqabbr("foo", "fobar" ,) == false - * streqabbr("foo", "foo" ,) == true - * @endcode - */ - static bool streqabbr(const char* st1, const char* st2, long long min) - { - const char* st1start = st1; - while (*st1 != 0 && (*st1 == *st2)) - { - ++st1; - ++st2; - } - - return (*st1 == 0 || (min > 0 && (st1 - st1start) >= min)) && (*st2 == 0 || *st2 == '='); - } - - /** - * @internal - * @brief Returns true iff character @c ch is contained in the string @c st. - * - * Returns @c true for @c ch==0 . - */ - static bool instr(char ch, const char* st) - { - while (*st != 0 && *st != ch) - ++st; - return *st == ch; - } - - /** - * @internal - * @brief Rotates args[-count],...,args[-1],args[0] to become - * args[0],args[-count],...,args[-1]. - */ - static void shift(const char** args, int count) - { - for (int i = 0; i > -count; --i) - { - const char* temp = args[i]; - args[i] = args[i - 1]; - args[i - 1] = temp; - } - } + + friend struct Stats; + class StoreOptionAction; + struct Action; + + /** + * @internal + * @brief This is the core function that does all the parsing. + * @retval false iff an unrecoverable error occurred. + */ + static bool workhorse( + bool gnu, + const Descriptor usage[], + int numargs, + const char** args, + Action& action, + bool single_minus_longopt, + bool print_errors, + int min_abbr_len); + + /** + * @internal + * @brief Returns true iff @c st1 is a prefix of @c st2 and + * in case @c st2 is longer than @c st1, then + * the first additional character is '='. + * + * @par Examples: + * @code + * streq("foo", "foo=bar") == true + * streq("foo", "foobar") == false + * streq("foo", "foo") == true + * streq("foo=bar", "foo") == false + * @endcode + */ + static bool streq( + const char* st1, + const char* st2) + { + while (*st1 != 0) + { + if (*st1++ != *st2++) + { + return false; + } + } + return (*st2 == 0 || *st2 == '='); + } + + /** + * @internal + * @brief Like streq() but handles abbreviations. + * + * Returns true iff @c st1 and @c st2 have a common + * prefix with the following properties: + * @li (if min > 0) its length is at least @c min characters or the same length as @c st1 (whichever is smaller). + * @li (if min <= 0) its length is the same as that of @c st1 + * @li within @c st2 the character following the common prefix is either '=' or end-of-string. + * + * Examples: + * @code + * streqabbr("foo", "foo=bar",) == true + * streqabbr("foo", "fo=bar" , 2) == true + * streqabbr("foo", "fo" , 2) == true + * streqabbr("foo", "fo" , 0) == false + * streqabbr("foo", "f=bar" , 2) == false + * streqabbr("foo", "f" , 2) == false + * streqabbr("fo" , "foo=bar",) == false + * streqabbr("foo", "foobar" ,) == false + * streqabbr("foo", "fobar" ,) == false + * streqabbr("foo", "foo" ,) == true + * @endcode + */ + static bool streqabbr( + const char* st1, + const char* st2, + long long min) + { + const char* st1start = st1; + while (*st1 != 0 && (*st1 == *st2)) + { + ++st1; + ++st2; + } + + return (*st1 == 0 || (min > 0 && (st1 - st1start) >= min)) && (*st2 == 0 || *st2 == '='); + } + + /** + * @internal + * @brief Returns true iff character @c ch is contained in the string @c st. + * + * Returns @c true for @c ch==0 . + */ + static bool instr( + char ch, + const char* st) + { + while (*st != 0 && *st != ch) + { + ++st; + } + return *st == ch; + } + + /** + * @internal + * @brief Rotates args[-count],...,args[-1],args[0] to become + * args[0],args[-count],...,args[-1]. + */ + static void shift( + const char** args, + int count) + { + for (int i = 0; i > -count; --i) + { + const char* temp = args[i]; + args[i] = args[i - 1]; + args[i - 1] = temp; + } + } + }; /** @@ -1355,33 +1538,37 @@ class Parser */ struct Parser::Action { - /** - * @brief Called by Parser::workhorse() for each Option that has been successfully - * parsed (including unknown - * options if they have a Descriptor whose Descriptor::check_arg does not return - * @ref ARG_ILLEGAL. - * - * Returns @c false iff a fatal error has occured and the parse should be aborted. - */ - virtual bool perform(Option&) - { - return true; - } - - /** - * @brief Called by Parser::workhorse() after finishing the parse. - * @param numargs the number of non-option arguments remaining - * @param args pointer to the first remaining non-option argument (if numargs > 0). - * - * @return - * @c false iff a fatal error has occurred. - */ - virtual bool finished(int numargs, const char** args) - { - (void) numargs; - (void) args; - return true; - } + /** + * @brief Called by Parser::workhorse() for each Option that has been successfully + * parsed (including unknown + * options if they have a Descriptor whose Descriptor::check_arg does not return + * @ref ARG_ILLEGAL. + * + * Returns @c false iff a fatal error has occured and the parse should be aborted. + */ + virtual bool perform( + Option&) + { + return true; + } + + /** + * @brief Called by Parser::workhorse() after finishing the parse. + * @param numargs the number of non-option arguments remaining + * @param args pointer to the first remaining non-option argument (if numargs > 0). + * + * @return + * @c false iff a fatal error has occurred. + */ + virtual bool finished( + int numargs, + const char** args) + { + (void) numargs; + (void) args; + return true; + } + }; /** @@ -1389,26 +1576,33 @@ struct Parser::Action * @brief An Action to pass to Parser::workhorse() that will increment a counter for * each parsed Option. */ -class Stats::CountOptionsAction: public Parser::Action +class Stats::CountOptionsAction : public Parser::Action { - unsigned* buffer_max; + unsigned* buffer_max; + public: - /** - * Creates a new CountOptionsAction that will increase @c *buffer_max_ for each - * parsed Option. - */ - CountOptionsAction(unsigned* buffer_max_) : - buffer_max(buffer_max_) - { - } - - bool perform(Option&) - { - if (*buffer_max == 0x7fffffff) - return false; // overflow protection: don't accept number of options that doesn't fit signed int - ++*buffer_max; - return true; - } + + /** + * Creates a new CountOptionsAction that will increase @c *buffer_max_ for each + * parsed Option. + */ + CountOptionsAction( + unsigned* buffer_max_) + : buffer_max(buffer_max_) + { + } + + bool perform( + Option&) + { + if (*buffer_max == 0x7fffffff) + { + return false; // overflow protection: don't accept number of options that doesn't fit signed int + } + ++*buffer_max; + return true; + } + }; /** @@ -1416,268 +1610,357 @@ class Stats::CountOptionsAction: public Parser::Action * @brief An Action to pass to Parser::workhorse() that will store each parsed Option in * appropriate arrays (see Parser::parse()). */ -class Parser::StoreOptionAction: public Parser::Action +class Parser::StoreOptionAction : public Parser::Action { - Parser& parser; - Option* options; - Option* buffer; - int bufmax; //! Number of slots in @c buffer. @c -1 means "large enough". -public: - /** - * @brief Creates a new StoreOption action. - * @param parser_ the parser whose op_count should be updated. - * @param options_ each Option @c o is chained into the linked list @c options_[o.desc->index] - * @param buffer_ each Option is appended to this array as long as there's a free slot. - * @param bufmax_ number of slots in @c buffer_. @c -1 means "large enough". - */ - StoreOptionAction(Parser& parser_, Option options_[], Option buffer_[], int bufmax_) : - parser(parser_), options(options_), buffer(buffer_), bufmax(bufmax_) - { - // find first empty slot in buffer (if any) - int bufidx = 0; - while ((bufmax < 0 || bufidx < bufmax) && buffer[bufidx]) - ++bufidx; - - // set parser's optionCount - parser.op_count = bufidx; - } - - bool perform(Option& option) - { - if (bufmax < 0 || parser.op_count < bufmax) - { - if (parser.op_count == 0x7fffffff) - return false; // overflow protection: don't accept number of options that doesn't fit signed int - - buffer[parser.op_count] = option; - int idx = buffer[parser.op_count].desc->index; - if (options[idx]) - options[idx].append(buffer[parser.op_count]); - else - options[idx] = buffer[parser.op_count]; - ++parser.op_count; - } - return true; // NOTE: an option that is discarded because of a full buffer is not fatal - } - - bool finished(int numargs, const char** args) - { - // only overwrite non-option argument list if there's at least 1 - // new non-option argument. Otherwise we keep the old list. This - // makes it easy to use default non-option arguments. - if (numargs > 0) - { - parser.nonop_count = numargs; - parser.nonop_args = args; - } - - return true; - } -}; + Parser& parser; + Option* options; + Option* buffer; + int bufmax; //! Number of slots in @c buffer. @c -1 means "large enough". -inline void Parser::parse(bool gnu, const Descriptor usage[], int argc, const char** argv, Option options[], - Option buffer[], int min_abbr_len, bool single_minus_longopt, int bufmax) -{ - StoreOptionAction action(*this, options, buffer, bufmax); - err = !workhorse(gnu, usage, argc, argv, action, single_minus_longopt, true, min_abbr_len); -} +public: -inline void Stats::add(bool gnu, const Descriptor usage[], int argc, const char** argv, int min_abbr_len, - bool single_minus_longopt) -{ - // determine size of options array. This is the greatest index used in the usage + 1 - int i = 0; - while (usage[i].shortopt != 0) - { - if (usage[i].index + 1 >= options_max) - options_max = (usage[i].index + 1) + 1; // 1 more than necessary as sentinel - - ++i; - } - - CountOptionsAction action(&buffer_max); - Parser::workhorse(gnu, usage, argc, argv, action, single_minus_longopt, false, min_abbr_len); -} + /** + * @brief Creates a new StoreOption action. + * @param parser_ the parser whose op_count should be updated. + * @param options_ each Option @c o is chained into the linked list @c options_[o.desc->index] + * @param buffer_ each Option is appended to this array as long as there's a free slot. + * @param bufmax_ number of slots in @c buffer_. @c -1 means "large enough". + */ + StoreOptionAction( + Parser& parser_, + Option options_[], + Option buffer_[], + int bufmax_) + : parser(parser_) + , options(options_) + , buffer(buffer_) + , bufmax(bufmax_) + { + // find first empty slot in buffer (if any) + int bufidx = 0; + while ((bufmax < 0 || bufidx < bufmax) && buffer[bufidx]) + { + ++bufidx; + } -inline bool Parser::workhorse(bool gnu, const Descriptor usage[], int numargs, const char** args, Action& action, - bool single_minus_longopt, bool print_errors, int min_abbr_len) -{ - // protect against NULL pointer - if (args == 0) - numargs = 0; + // set parser's optionCount + parser.op_count = bufidx; + } - int nonops = 0; + bool perform( + Option& option) + { + if (bufmax < 0 || parser.op_count < bufmax) + { + if (parser.op_count == 0x7fffffff) + { + return false; // overflow protection: don't accept number of options that doesn't fit signed int - while (numargs != 0 && *args != 0) - { - const char* param = *args; // param can be --long-option, -srto or non-option argument + } + buffer[parser.op_count] = option; + int idx = buffer[parser.op_count].desc->index; + if (options[idx]) + { + options[idx].append(buffer[parser.op_count]); + } + else + { + options[idx] = buffer[parser.op_count]; + } + ++parser.op_count; + } + return true; // NOTE: an option that is discarded because of a full buffer is not fatal + } - // in POSIX mode the first non-option argument terminates the option list - // a lone minus character is a non-option argument - if (param[0] != '-' || param[1] == 0) + bool finished( + int numargs, + const char** args) { - if (gnu) - { - ++nonops; - ++args; + // only overwrite non-option argument list if there's at least 1 + // new non-option argument. Otherwise we keep the old list. This + // makes it easy to use default non-option arguments. if (numargs > 0) - --numargs; - continue; - } - else - break; - } + { + parser.nonop_count = numargs; + parser.nonop_args = args; + } - // -- terminates the option list. The -- itself is skipped. - if (param[1] == '-' && param[2] == 0) - { - shift(args, nonops); - ++args; - if (numargs > 0) - --numargs; - break; + return true; } - bool handle_short_options; - const char* longopt_name; - if (param[1] == '-') // if --long-option +}; + +inline void Parser::parse( + bool gnu, + const Descriptor usage[], + int argc, + const char** argv, + Option options[], + Option buffer[], + int min_abbr_len, + bool single_minus_longopt, + int bufmax) +{ + StoreOptionAction action(*this, options, buffer, bufmax); + err = !workhorse(gnu, usage, argc, argv, action, single_minus_longopt, true, min_abbr_len); +} + +inline void Stats::add( + bool gnu, + const Descriptor usage[], + int argc, + const char** argv, + int min_abbr_len, + bool single_minus_longopt) +{ + // determine size of options array. This is the greatest index used in the usage + 1 + int i = 0; + while (usage[i].shortopt != 0) { - handle_short_options = false; - longopt_name = param + 2; + if (usage[i].index + 1 >= options_max) + { + options_max = (usage[i].index + 1) + 1; // 1 more than necessary as sentinel + + } + ++i; } - else + + CountOptionsAction action(&buffer_max); + Parser::workhorse(gnu, usage, argc, argv, action, single_minus_longopt, false, min_abbr_len); +} + +inline bool Parser::workhorse( + bool gnu, + const Descriptor usage[], + int numargs, + const char** args, + Action& action, + bool single_minus_longopt, + bool print_errors, + int min_abbr_len) +{ + // protect against NULL pointer + if (args == 0) { - handle_short_options = true; - longopt_name = param + 1; //for testing a potential -long-option + numargs = 0; } - bool try_single_minus_longopt = single_minus_longopt; - bool have_more_args = (numargs > 1 || numargs < 0); // is referencing argv[1] valid? + int nonops = 0; - do // loop over short options in group, for long options the body is executed only once + while (numargs != 0 && *args != 0) { - int idx; + const char* param = *args; // param can be --long-option, -srto or non-option argument - const char* optarg; - - /******************** long option **********************/ - if (handle_short_options == false || try_single_minus_longopt) - { - idx = 0; - while (usage[idx].longopt != 0 && !streq(usage[idx].longopt, longopt_name)) - ++idx; + // in POSIX mode the first non-option argument terminates the option list + // a lone minus character is a non-option argument + if (param[0] != '-' || param[1] == 0) + { + if (gnu) + { + ++nonops; + ++args; + if (numargs > 0) + { + --numargs; + } + continue; + } + else + { + break; + } + } - if (usage[idx].longopt == 0 && min_abbr_len > 0) // if we should try to match abbreviated long options + // -- terminates the option list. The -- itself is skipped. + if (param[1] == '-' && param[2] == 0) { - int i1 = 0; - while (usage[i1].longopt != 0 && !streqabbr(usage[i1].longopt, longopt_name, min_abbr_len)) - ++i1; - if (usage[i1].longopt != 0) - { // now test if the match is unambiguous by checking for another match - int i2 = i1 + 1; - while (usage[i2].longopt != 0 && !streqabbr(usage[i2].longopt, longopt_name, min_abbr_len)) - ++i2; - - if (usage[i2].longopt == 0) // if there was no second match it's unambiguous, so accept i1 as idx - idx = i1; - } + shift(args, nonops); + ++args; + if (numargs > 0) + { + --numargs; + } + break; } - // if we found something, disable handle_short_options (only relevant if single_minus_longopt) - if (usage[idx].longopt != 0) - handle_short_options = false; + bool handle_short_options; + const char* longopt_name; + if (param[1] == '-') // if --long-option + { + handle_short_options = false; + longopt_name = param + 2; + } + else + { + handle_short_options = true; + longopt_name = param + 1; //for testing a potential -long-option + } - try_single_minus_longopt = false; // prevent looking for longopt in the middle of shortopt group + bool try_single_minus_longopt = single_minus_longopt; + bool have_more_args = (numargs > 1 || numargs < 0); // is referencing argv[1] valid? - optarg = longopt_name; - while (*optarg != 0 && *optarg != '=') - ++optarg; - if (*optarg == '=') // attached argument - ++optarg; - else - // possibly detached argument - optarg = (have_more_args ? args[1] : 0); - } - - /************************ short option ***********************************/ - if (handle_short_options) - { - if (*++param == 0) // point at the 1st/next option character - break; // end of short option group - - idx = 0; - while (usage[idx].shortopt != 0 && !instr(*param, usage[idx].shortopt)) - ++idx; - - if (param[1] == 0) // if the potential argument is separate - optarg = (have_more_args ? args[1] : 0); - else - // if the potential argument is attached - optarg = param + 1; - } - - const Descriptor* descriptor = &usage[idx]; - - if (descriptor->shortopt == 0) /************** unknown option ********************/ - { - // look for dummy entry (shortopt == "" and longopt == "") to use as Descriptor for unknown options - idx = 0; - while (usage[idx].shortopt != 0 && (usage[idx].shortopt[0] != 0 || usage[idx].longopt[0] != 0)) - ++idx; - descriptor = (usage[idx].shortopt == 0 ? 0 : &usage[idx]); - } - - if (descriptor != 0) - { - Option option(descriptor, param, optarg); - switch (descriptor->check_arg(option, print_errors)) + do // loop over short options in group, for long options the body is executed only once { - case ARG_ILLEGAL: - return false; // fatal - case ARG_OK: - // skip one element of the argument vector, if it's a separated argument - if (optarg != 0 && have_more_args && optarg == args[1]) + int idx; + + const char* optarg; + + /******************** long option **********************/ + if (handle_short_options == false || try_single_minus_longopt) + { + idx = 0; + while (usage[idx].longopt != 0 && !streq(usage[idx].longopt, longopt_name)) + { + ++idx; + } + + if (usage[idx].longopt == 0 && min_abbr_len > 0) // if we should try to match abbreviated long options + { + int i1 = 0; + while (usage[i1].longopt != 0 && !streqabbr(usage[i1].longopt, longopt_name, min_abbr_len)) + { + ++i1; + } + if (usage[i1].longopt != 0) + { + // now test if the match is unambiguous by checking for another match + int i2 = i1 + 1; + while (usage[i2].longopt != 0 && !streqabbr(usage[i2].longopt, longopt_name, min_abbr_len)) + { + ++i2; + } + + if (usage[i2].longopt == 0) // if there was no second match it's unambiguous, so accept i1 as idx + { + idx = i1; + } + } + } + + // if we found something, disable handle_short_options (only relevant if single_minus_longopt) + if (usage[idx].longopt != 0) + { + handle_short_options = false; + } + + try_single_minus_longopt = false; // prevent looking for longopt in the middle of shortopt group + + optarg = longopt_name; + while (*optarg != 0 && *optarg != '=') + { + ++optarg; + } + if (*optarg == '=') // attached argument + { + ++optarg; + } + else + { + // possibly detached argument + optarg = (have_more_args ? args[1] : 0); + } + } + + /************************ short option ***********************************/ + if (handle_short_options) + { + if (*++param == 0) // point at the 1st/next option character + { + break; // end of short option group + + } + idx = 0; + while (usage[idx].shortopt != 0 && !instr(*param, usage[idx].shortopt)) + { + ++idx; + } + + if (param[1] == 0) // if the potential argument is separate + { + optarg = (have_more_args ? args[1] : 0); + } + else + { + // if the potential argument is attached + optarg = param + 1; + } + } + + const Descriptor* descriptor = &usage[idx]; + + if (descriptor->shortopt == 0) /************** unknown option ********************/ + { + // look for dummy entry (shortopt == "" and longopt == "") to use as Descriptor for unknown options + idx = 0; + while (usage[idx].shortopt != 0 && (usage[idx].shortopt[0] != 0 || usage[idx].longopt[0] != 0)) + { + ++idx; + } + descriptor = (usage[idx].shortopt == 0 ? 0 : &usage[idx]); + } + + if (descriptor != 0) { - shift(args, nonops); - if (numargs > 0) - --numargs; - ++args; + Option option(descriptor, param, optarg); + switch (descriptor->check_arg(option, print_errors)) + { + case ARG_ILLEGAL: + return false; // fatal + case ARG_OK: + // skip one element of the argument vector, if it's a separated argument + if (optarg != 0 && have_more_args && optarg == args[1]) + { + shift(args, nonops); + if (numargs > 0) + { + --numargs; + } + ++args; + } + + // No further short options are possible after an argument + handle_short_options = false; + + break; + case ARG_IGNORE: + case ARG_NONE: + option.arg = 0; + break; + } + + if (!action.perform(option)) + { + return false; + } } - // No further short options are possible after an argument - handle_short_options = false; + } while (handle_short_options); - break; - case ARG_IGNORE: - case ARG_NONE: - option.arg = 0; - break; + shift(args, nonops); + ++args; + if (numargs > 0) + { + --numargs; } - if (!action.perform(option)) - return false; - } + } // while - } while (handle_short_options); - - shift(args, nonops); - ++args; - if (numargs > 0) - --numargs; - - } // while - - if (numargs > 0 && *args == 0) // It's a bug in the caller if numargs is greater than the actual number - numargs = 0; // of arguments, but as a service to the user we fix this if we spot it. + if (numargs > 0 && *args == 0) // It's a bug in the caller if numargs is greater than the actual number + { + numargs = 0; // of arguments, but as a service to the user we fix this if we spot it. - if (numargs < 0) // if we don't know the number of remaining non-option arguments - { // we need to count them - numargs = 0; - while (args[numargs] != 0) - ++numargs; - } + } + if (numargs < 0) // if we don't know the number of remaining non-option arguments + { + // we need to count them + numargs = 0; + while (args[numargs] != 0) + { + ++numargs; + } + } - return action.finished(numargs + nonops, args - nonops); + return action.finished(numargs + nonops, args - nonops); } /** @@ -1686,893 +1969,1016 @@ inline bool Parser::workhorse(bool gnu, const Descriptor usage[], int numargs, c */ struct PrintUsageImplementation { - /** - * @internal - * @brief Interface for Functors that write (part of) a string somewhere. - */ - struct IStringWriter - { /** - * @brief Writes the given number of chars beginning at the given pointer somewhere. + * @internal + * @brief Interface for Functors that write (part of) a string somewhere. */ - virtual void operator()(const char*, int) + struct IStringWriter { - } - }; + /** + * @brief Writes the given number of chars beginning at the given pointer somewhere. + */ + virtual void operator ()( + const char*, + int) + { + } - /** - * @internal - * @brief Encapsulates a function with signature func(string, size) where - * string can be initialized with a const char* and size with an int. - */ - template - struct FunctionWriter: public IStringWriter - { - Function* write; + }; - virtual void operator()(const char* str, int size) + /** + * @internal + * @brief Encapsulates a function with signature func(string, size) where + * string can be initialized with a const char* and size with an int. + */ + template + struct FunctionWriter : public IStringWriter { - (*write)(str, size); - } + Function* write; - FunctionWriter(Function* w) : - write(w) - { - } - }; + virtual void operator ()( + const char* str, + int size) + { + (*write)(str, size); + } - /** - * @internal - * @brief Encapsulates a reference to an object with a write(string, size) - * method like that of @c std::ostream. - */ - template - struct OStreamWriter: public IStringWriter - { - OStream& ostream; + FunctionWriter( + Function* w) + : write(w) + { + } - virtual void operator()(const char* str, int size) - { - ostream.write(str, size); - } + }; - OStreamWriter(OStream& o) : - ostream(o) + /** + * @internal + * @brief Encapsulates a reference to an object with a write(string, size) + * method like that of @c std::ostream. + */ + template + struct OStreamWriter : public IStringWriter { - } - }; + OStream& ostream; - /** - * @internal - * @brief Like OStreamWriter but encapsulates a @c const reference, which is - * typically a temporary object of a user class. - */ - template - struct TemporaryWriter: public IStringWriter - { - const Temporary& userstream; - - virtual void operator()(const char* str, int size) - { - userstream.write(str, size); - } + virtual void operator ()( + const char* str, + int size) + { + ostream.write(str, size); + } - TemporaryWriter(const Temporary& u) : - userstream(u) - { - } - }; + OStreamWriter( + OStream& o) + : ostream(o) + { + } - /** - * @internal - * @brief Encapsulates a function with the signature func(fd, string, size) (the - * signature of the @c write() system call) - * where fd can be initialized from an int, string from a const char* and size from an int. - */ - template - struct SyscallWriter: public IStringWriter - { - Syscall* write; - int fd; + }; - virtual void operator()(const char* str, int size) + /** + * @internal + * @brief Like OStreamWriter but encapsulates a @c const reference, which is + * typically a temporary object of a user class. + */ + template + struct TemporaryWriter : public IStringWriter { - (*write)(fd, str, size); - } + const Temporary& userstream; - SyscallWriter(Syscall* w, int f) : - write(w), fd(f) - { - } - }; + virtual void operator ()( + const char* str, + int size) + { + userstream.write(str, size); + } + + TemporaryWriter( + const Temporary& u) + : userstream(u) + { + } - /** - * @internal - * @brief Encapsulates a function with the same signature as @c std::fwrite(). - */ - template - struct StreamWriter: public IStringWriter - { - Function* fwrite; - Stream* stream; - - virtual void operator()(const char* str, int size) - { - (*fwrite)(str, size, 1, stream); - } - - StreamWriter(Function* w, Stream* s) : - fwrite(w), stream(s) - { - } - }; - - /** - * @internal - * @brief Sets i1 = max(i1, i2) - */ - static void upmax(int& i1, int i2) - { - i1 = (i1 >= i2 ? i1 : i2); - } - - /** - * @internal - * @brief Moves the "cursor" to column @c want_x assuming it is currently at column @c x - * and sets @c x=want_x . - * If x > want_x , a line break is output before indenting. - * - * @param write Spaces and possibly a line break are written via this functor to get - * the desired indentation @c want_x . - * @param[in,out] x the current indentation. Set to @c want_x by this method. - * @param want_x the desired indentation. - */ - static void indent(IStringWriter& write, int& x, int want_x) - { - int indent = want_x - x; - if (indent < 0) - { - write("\n", 1); - indent = want_x; - } - - if (indent > 0) - { - char space = ' '; - for (int i = 0; i < indent; ++i) - write(&space, 1); - x = want_x; - } - } - - /** - * @brief Returns true if ch is the unicode code point of a wide character. - * - * @note - * The following character ranges are treated as wide - * @code - * 1100..115F - * 2329..232A (just 2 characters!) - * 2E80..A4C6 except for 303F - * A960..A97C - * AC00..D7FB - * F900..FAFF - * FE10..FE6B - * FF01..FF60 - * FFE0..FFE6 - * 1B000...... - * @endcode - */ - static bool isWideChar(unsigned ch) - { - if (ch == 0x303F) - return false; - - return ((0x1100 <= ch && ch <= 0x115F) || (0x2329 <= ch && ch <= 0x232A) || (0x2E80 <= ch && ch <= 0xA4C6) - || (0xA960 <= ch && ch <= 0xA97C) || (0xAC00 <= ch && ch <= 0xD7FB) || (0xF900 <= ch && ch <= 0xFAFF) - || (0xFE10 <= ch && ch <= 0xFE6B) || (0xFF01 <= ch && ch <= 0xFF60) || (0xFFE0 <= ch && ch <= 0xFFE6) - || (0x1B000 <= ch)); - } - - /** - * @internal - * @brief Splits a @c Descriptor[] array into tables, rows, lines and columns and - * iterates over these components. - * - * The top-level organizational unit is the @e table. - * A table begins at a Descriptor with @c help!=NULL and extends up to - * a Descriptor with @c help==NULL. - * - * A table consists of @e rows. Due to line-wrapping and explicit breaks - * a row may take multiple lines on screen. Rows within the table are separated - * by \\n. They never cross Descriptor boundaries. This means a row ends either - * at \\n or the 0 at the end of the help string. - * - * A row consists of columns/cells. Columns/cells within a row are separated by \\t. - * Line breaks within a cell are marked by \\v. - * - * Rows in the same table need not have the same number of columns/cells. The - * extreme case are interjections, which are rows that contain neither \\t nor \\v. - * These are NOT treated specially by LinePartIterator, but they are treated - * specially by printUsage(). - * - * LinePartIterator iterates through the usage at 3 levels: table, row and part. - * Tables and rows are as described above. A @e part is a line within a cell. - * LinePartIterator iterates through 1st parts of all cells, then through the 2nd - * parts of all cells (if any),... @n - * Example: The row "1 \v 3 \t 2 \v 4" has 2 cells/columns and 4 parts. - * The parts will be returned in the order 1, 2, 3, 4. - * - * It is possible that some cells have fewer parts than others. In this case - * LinePartIterator will "fill up" these cells with 0-length parts. IOW, LinePartIterator - * always returns the same number of parts for each column. Note that this is different - * from the way rows and columns are handled. LinePartIterator does @e not guarantee that - * the same number of columns will be returned for each row. - * - */ - class LinePartIterator - { - const Descriptor* tablestart; //!< The 1st descriptor of the current table. - const Descriptor* rowdesc; //!< The Descriptor that contains the current row. - const char* rowstart; //!< Ptr to 1st character of current row within rowdesc->help. - const char* ptr; //!< Ptr to current part within the current row. - int col; //!< Index of current column. - int len; //!< Length of the current part (that ptr points at) in BYTES - int screenlen; //!< Length of the current part in screen columns (taking narrow/wide chars into account). - int max_line_in_block; //!< Greatest index of a line within the block. This is the number of \\v within the cell with the most \\vs. - int line_in_block; //!< Line index within the current cell of the current part. - int target_line_in_block; //!< Line index of the parts we should return to the user on this iteration. - bool hit_target_line; //!< Flag whether we encountered a part with line index target_line_in_block in the current cell. + }; /** - * @brief Determines the byte and character lengths of the part at @ref ptr and - * stores them in @ref len and @ref screenlen respectively. + * @internal + * @brief Encapsulates a function with the signature func(fd, string, size) (the + * signature of the @c write() system call) + * where fd can be initialized from an int, string from a const char* and size from an int. */ - void update_length() - { - screenlen = 0; - for (len = 0; ptr[len] != 0 && ptr[len] != '\v' && ptr[len] != '\t' && ptr[len] != '\n'; ++len) - { - ++screenlen; - unsigned ch = (unsigned char) ptr[len]; - if (ch > 0xC1) // everything <= 0xC1 (yes, even 0xC1 itself) is not a valid UTF-8 start byte + template + struct SyscallWriter : public IStringWriter + { + Syscall* write; + int fd; + + virtual void operator ()( + const char* str, + int size) { - // int __builtin_clz (unsigned int x) - // Returns the number of leading 0-bits in x, starting at the most significant bit - unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff); - ch = ch & mask; // mask out length bits, we don't verify their correctness - while (((unsigned char) ptr[len + 1] ^ 0x80) <= 0x3F) // while next byte is continuation byte - { - ch = (ch << 6) ^ (unsigned char) ptr[len + 1] ^ 0x80; // add continuation to char code - ++len; - } - // ch is the decoded unicode code point - if (ch >= 0x1100 && isWideChar(ch)) // the test for 0x1100 is here to avoid the function call in the Latin case - ++screenlen; + (*write)(fd, str, size); } - } - } - public: - //! @brief Creates an iterator for @c usage. - LinePartIterator(const Descriptor usage[]) : - tablestart(usage), rowdesc(0), rowstart(0), ptr(0), col(-1), len(0), max_line_in_block(0), line_in_block(0), - target_line_in_block(0), hit_target_line(true) - { - } + SyscallWriter( + Syscall* w, + int f) + : write(w) + , fd(f) + { + } + + }; /** - * @brief Moves iteration to the next table (if any). Has to be called once on a new - * LinePartIterator to move to the 1st table. - * @retval false if moving to next table failed because no further table exists. + * @internal + * @brief Encapsulates a function with the same signature as @c std::fwrite(). */ - bool nextTable() + template + struct StreamWriter : public IStringWriter { - // If this is NOT the first time nextTable() is called after the constructor, - // then skip to the next table break (i.e. a Descriptor with help == 0) - if (rowdesc != 0) - { - while (tablestart->help != 0 && tablestart->shortopt != 0) - ++tablestart; - } + Function* fwrite; + Stream* stream; + + virtual void operator ()( + const char* str, + int size) + { + (*fwrite)(str, size, 1, stream); + } - // Find the next table after the break (if any) - while (tablestart->help == 0 && tablestart->shortopt != 0) - ++tablestart; + StreamWriter( + Function* w, + Stream* s) + : fwrite(w) + , stream(s) + { + } - restartTable(); - return rowstart != 0; - } + }; /** - * @brief Reset iteration to the beginning of the current table. + * @internal + * @brief Sets i1 = max(i1, i2) */ - void restartTable() + static void upmax( + int& i1, + int i2) { - rowdesc = tablestart; - rowstart = tablestart->help; - ptr = 0; + i1 = (i1 >= i2 ? i1 : i2); } /** - * @brief Moves iteration to the next row (if any). Has to be called once after each call to - * @ref nextTable() to move to the 1st row of the table. - * @retval false if moving to next row failed because no further row exists. + * @internal + * @brief Moves the "cursor" to column @c want_x assuming it is currently at column @c x + * and sets @c x=want_x . + * If x > want_x , a line break is output before indenting. + * + * @param write Spaces and possibly a line break are written via this functor to get + * the desired indentation @c want_x . + * @param[in,out] x the current indentation. Set to @c want_x by this method. + * @param want_x the desired indentation. */ - bool nextRow() + static void indent( + IStringWriter& write, + int& x, + int want_x) { - if (ptr == 0) - { - restartRow(); - return rowstart != 0; - } - - while (*ptr != 0 && *ptr != '\n') - ++ptr; - - if (*ptr == 0) - { - if ((rowdesc + 1)->help == 0) // table break - return false; - - ++rowdesc; - rowstart = rowdesc->help; - } - else // if (*ptr == '\n') - { - rowstart = ptr + 1; - } + int indent = want_x - x; + if (indent < 0) + { + write("\n", 1); + indent = want_x; + } - restartRow(); - return true; + if (indent > 0) + { + char space = ' '; + for (int i = 0; i < indent; ++i) + { + write(&space, 1); + } + x = want_x; + } } /** - * @brief Reset iteration to the beginning of the current row. + * @brief Returns true if ch is the unicode code point of a wide character. + * + * @note + * The following character ranges are treated as wide + * @code + * 1100..115F + * 2329..232A (just 2 characters!) + * 2E80..A4C6 except for 303F + * A960..A97C + * AC00..D7FB + * F900..FAFF + * FE10..FE6B + * FF01..FF60 + * FFE0..FFE6 + * 1B000...... + * @endcode */ - void restartRow() + static bool isWideChar( + unsigned ch) { - ptr = rowstart; - col = -1; - len = 0; - screenlen = 0; - max_line_in_block = 0; - line_in_block = 0; - target_line_in_block = 0; - hit_target_line = true; + if (ch == 0x303F) + { + return false; + } + + return ((0x1100 <= ch && ch <= 0x115F) || (0x2329 <= ch && ch <= 0x232A) || (0x2E80 <= ch && ch <= 0xA4C6) + || (0xA960 <= ch && ch <= 0xA97C) || (0xAC00 <= ch && ch <= 0xD7FB) || (0xF900 <= ch && ch <= 0xFAFF) + || (0xFE10 <= ch && ch <= 0xFE6B) || (0xFF01 <= ch && ch <= 0xFF60) || (0xFFE0 <= ch && ch <= 0xFFE6) + || (0x1B000 <= ch)); } /** - * @brief Moves iteration to the next part (if any). Has to be called once after each call to - * @ref nextRow() to move to the 1st part of the row. - * @retval false if moving to next part failed because no further part exists. + * @internal + * @brief Splits a @c Descriptor[] array into tables, rows, lines and columns and + * iterates over these components. + * + * The top-level organizational unit is the @e table. + * A table begins at a Descriptor with @c help!=NULL and extends up to + * a Descriptor with @c help==NULL. + * + * A table consists of @e rows. Due to line-wrapping and explicit breaks + * a row may take multiple lines on screen. Rows within the table are separated + * by \\n. They never cross Descriptor boundaries. This means a row ends either + * at \\n or the 0 at the end of the help string. + * + * A row consists of columns/cells. Columns/cells within a row are separated by \\t. + * Line breaks within a cell are marked by \\v. + * + * Rows in the same table need not have the same number of columns/cells. The + * extreme case are interjections, which are rows that contain neither \\t nor \\v. + * These are NOT treated specially by LinePartIterator, but they are treated + * specially by printUsage(). + * + * LinePartIterator iterates through the usage at 3 levels: table, row and part. + * Tables and rows are as described above. A @e part is a line within a cell. + * LinePartIterator iterates through 1st parts of all cells, then through the 2nd + * parts of all cells (if any),... @n + * Example: The row "1 \v 3 \t 2 \v 4" has 2 cells/columns and 4 parts. + * The parts will be returned in the order 1, 2, 3, 4. + * + * It is possible that some cells have fewer parts than others. In this case + * LinePartIterator will "fill up" these cells with 0-length parts. IOW, LinePartIterator + * always returns the same number of parts for each column. Note that this is different + * from the way rows and columns are handled. LinePartIterator does @e not guarantee that + * the same number of columns will be returned for each row. * - * See @ref LinePartIterator for details about the iteration. */ - bool next() + class LinePartIterator { - if (ptr == 0) - return false; - - if (col == -1) - { - col = 0; - update_length(); - return true; - } - - ptr += len; - while (true) - { - switch (*ptr) + const Descriptor* tablestart; //!< The 1st descriptor of the current table. + const Descriptor* rowdesc; //!< The Descriptor that contains the current row. + const char* rowstart; //!< Ptr to 1st character of current row within rowdesc->help. + const char* ptr; //!< Ptr to current part within the current row. + int col; //!< Index of current column. + int len; //!< Length of the current part (that ptr points at) in BYTES + int screenlen; //!< Length of the current part in screen columns (taking narrow/wide chars into account). + int max_line_in_block; //!< Greatest index of a line within the block. This is the number of \\v within the cell with the most \\vs. + int line_in_block; //!< Line index within the current cell of the current part. + int target_line_in_block; //!< Line index of the parts we should return to the user on this iteration. + bool hit_target_line; //!< Flag whether we encountered a part with line index target_line_in_block in the current cell. + + /** + * @brief Determines the byte and character lengths of the part at @ref ptr and + * stores them in @ref len and @ref screenlen respectively. + */ + void update_length() { - case '\v': - upmax(max_line_in_block, ++line_in_block); - ++ptr; - break; - case '\t': - if (!hit_target_line) // if previous column did not have the targetline - { // then "insert" a 0-length part - update_length(); - hit_target_line = true; - return true; + screenlen = 0; + for (len = 0; ptr[len] != 0 && ptr[len] != '\v' && ptr[len] != '\t' && ptr[len] != '\n'; ++len) + { + ++screenlen; + unsigned ch = (unsigned char) ptr[len]; + if (ch > 0xC1) // everything <= 0xC1 (yes, even 0xC1 itself) is not a valid UTF-8 start byte + { + // int __builtin_clz (unsigned int x) + // Returns the number of leading 0-bits in x, starting at the most significant bit + unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff); + ch = ch & mask; // mask out length bits, we don't verify their correctness + while (((unsigned char) ptr[len + 1] ^ 0x80) <= 0x3F) // while next byte is continuation byte + { + ch = (ch << 6) ^ (unsigned char) ptr[len + 1] ^ 0x80; // add continuation to char code + ++len; + } + // ch is the decoded unicode code point + if (ch >= 0x1100 && isWideChar(ch)) // the test for 0x1100 is here to avoid the function call in the Latin case + { + ++screenlen; + } + } } + } - hit_target_line = false; - line_in_block = 0; - ++col; - ++ptr; - break; - case 0: - case '\n': - if (!hit_target_line) // if previous column did not have the targetline - { // then "insert" a 0-length part - update_length(); - hit_target_line = true; - return true; + public: + + //! @brief Creates an iterator for @c usage. + LinePartIterator( + const Descriptor usage[]) + : tablestart(usage) + , rowdesc(0) + , rowstart(0) + , ptr(0) + , col(-1) + , len(0) + , max_line_in_block(0) + , line_in_block(0) + , target_line_in_block(0) + , hit_target_line(true) + { + } + + /** + * @brief Moves iteration to the next table (if any). Has to be called once on a new + * LinePartIterator to move to the 1st table. + * @retval false if moving to next table failed because no further table exists. + */ + bool nextTable() + { + // If this is NOT the first time nextTable() is called after the constructor, + // then skip to the next table break (i.e. a Descriptor with help == 0) + if (rowdesc != 0) + { + while (tablestart->help != 0 && tablestart->shortopt != 0) + { + ++tablestart; + } } - if (++target_line_in_block > max_line_in_block) + // Find the next table after the break (if any) + while (tablestart->help == 0 && tablestart->shortopt != 0) { - update_length(); - return false; + ++tablestart; } - hit_target_line = false; - line_in_block = 0; - col = 0; - ptr = rowstart; - continue; - default: - ++ptr; - continue; - } // switch + restartTable(); + return rowstart != 0; + } - if (line_in_block == target_line_in_block) + /** + * @brief Reset iteration to the beginning of the current table. + */ + void restartTable() { - update_length(); - hit_target_line = true; - return true; + rowdesc = tablestart; + rowstart = tablestart->help; + ptr = 0; } - } // while - } - - /** - * @brief Returns the index (counting from 0) of the column in which - * the part pointed to by @ref data() is located. - */ - int column() - { - return col; - } - /** - * @brief Returns the index (counting from 0) of the line within the current column - * this part belongs to. - */ - int line() - { - return target_line_in_block; // NOT line_in_block !!! It would be wrong if !hit_target_line - } + /** + * @brief Moves iteration to the next row (if any). Has to be called once after each call to + * @ref nextTable() to move to the 1st row of the table. + * @retval false if moving to next row failed because no further row exists. + */ + bool nextRow() + { + if (ptr == 0) + { + restartRow(); + return rowstart != 0; + } - /** - * @brief Returns the length of the part pointed to by @ref data() in raw chars (not UTF-8 characters). - */ - int length() - { - return len; - } + while (*ptr != 0 && *ptr != '\n') + { + ++ptr; + } - /** - * @brief Returns the width in screen columns of the part pointed to by @ref data(). - * Takes multi-byte UTF-8 sequences and wide characters into account. - */ - int screenLength() - { - return screenlen; - } + if (*ptr == 0) + { + if ((rowdesc + 1)->help == 0) // table break + { + return false; + } - /** - * @brief Returns the current part of the iteration. - */ - const char* data() - { - return ptr; - } - }; - - /** - * @internal - * @brief Takes input and line wraps it, writing out one line at a time so that - * it can be interleaved with output from other columns. - * - * The LineWrapper is used to handle the last column of each table as well as interjections. - * The LineWrapper is called once for each line of output. If the data given to it fits - * into the designated width of the last column it is simply written out. If there - * is too much data, an appropriate split point is located and only the data up to this - * split point is written out. The rest of the data is queued for the next line. - * That way the last column can be line wrapped and interleaved with data from - * other columns. The following example makes this clearer: - * @code - * Column 1,1 Column 2,1 This is a long text - * Column 1,2 Column 2,2 that does not fit into - * a single line. - * @endcode - * - * The difficulty in producing this output is that the whole string - * "This is a long text that does not fit into a single line" is the - * 1st and only part of column 3. In order to produce the above - * output the string must be output piecemeal, interleaved with - * the data from the other columns. - */ - class LineWrapper - { - static const int bufmask = 15; //!< Must be a power of 2 minus 1. - /** - * @brief Ring buffer for length component of pair (data, length). - */ - int lenbuf[bufmask + 1]; - /** - * @brief Ring buffer for data component of pair (data, length). - */ - const char* datbuf[bufmask + 1]; - /** - * @brief The indentation of the column to which the LineBuffer outputs. LineBuffer - * assumes that the indentation has already been written when @ref process() - * is called, so this value is only used when a buffer flush requires writing - * additional lines of output. - */ - int x; - /** - * @brief The width of the column to line wrap. - */ - int width; - int head; //!< @brief index for next write - int tail; //!< @brief index for next read - 1 (i.e. increment tail BEFORE read) + ++rowdesc; + rowstart = rowdesc->help; + } + else // if (*ptr == '\n') + { + rowstart = ptr + 1; + } - /** - * @brief Multiple methods of LineWrapper may decide to flush part of the buffer to - * free up space. The contract of process() says that only 1 line is output. So - * this variable is used to track whether something has output a line. It is - * reset at the beginning of process() and checked at the end to decide if - * output has already occurred or is still needed. - */ - bool wrote_something; + restartRow(); + return true; + } - bool buf_empty() - { - return ((tail + 1) & bufmask) == head; - } + /** + * @brief Reset iteration to the beginning of the current row. + */ + void restartRow() + { + ptr = rowstart; + col = -1; + len = 0; + screenlen = 0; + max_line_in_block = 0; + line_in_block = 0; + target_line_in_block = 0; + hit_target_line = true; + } - bool buf_full() - { - return tail == head; - } + /** + * @brief Moves iteration to the next part (if any). Has to be called once after each call to + * @ref nextRow() to move to the 1st part of the row. + * @retval false if moving to next part failed because no further part exists. + * + * See @ref LinePartIterator for details about the iteration. + */ + bool next() + { + if (ptr == 0) + { + return false; + } - void buf_store(const char* data, int len) - { - lenbuf[head] = len; - datbuf[head] = data; - head = (head + 1) & bufmask; - } + if (col == -1) + { + col = 0; + update_length(); + return true; + } - //! @brief Call BEFORE reading ...buf[tail]. - void buf_next() - { - tail = (tail + 1) & bufmask; - } + ptr += len; + while (true) + { + switch (*ptr) + { + case '\v': + upmax(max_line_in_block, ++line_in_block); + ++ptr; + break; + case '\t': + if (!hit_target_line) // if previous column did not have the targetline + { + // then "insert" a 0-length part + update_length(); + hit_target_line = true; + return true; + } + + hit_target_line = false; + line_in_block = 0; + ++col; + ++ptr; + break; + case 0: + case '\n': + if (!hit_target_line) // if previous column did not have the targetline + { + // then "insert" a 0-length part + update_length(); + hit_target_line = true; + return true; + } + + if (++target_line_in_block > max_line_in_block) + { + update_length(); + return false; + } + + hit_target_line = false; + line_in_block = 0; + col = 0; + ptr = rowstart; + continue; + default: + ++ptr; + continue; + } // switch + + if (line_in_block == target_line_in_block) + { + update_length(); + hit_target_line = true; + return true; + } + } // while + } - /** - * @brief Writes (data,len) into the ring buffer. If the buffer is full, a single line - * is flushed out of the buffer into @c write. - */ - void output(IStringWriter& write, const char* data, int len) - { - if (buf_full()) - write_one_line(write); + /** + * @brief Returns the index (counting from 0) of the column in which + * the part pointed to by @ref data() is located. + */ + int column() + { + return col; + } - buf_store(data, len); - } + /** + * @brief Returns the index (counting from 0) of the line within the current column + * this part belongs to. + */ + int line() + { + return target_line_in_block; // NOT line_in_block !!! It would be wrong if !hit_target_line + } - /** - * @brief Writes a single line of output from the buffer to @c write. - */ - void write_one_line(IStringWriter& write) - { - if (wrote_something) // if we already wrote something, we need to start a new line - { - write("\n", 1); - int _ = 0; - indent(write, _, x); - } + /** + * @brief Returns the length of the part pointed to by @ref data() in raw chars (not UTF-8 characters). + */ + int length() + { + return len; + } - if (!buf_empty()) - { - buf_next(); - write(datbuf[tail], lenbuf[tail]); - } + /** + * @brief Returns the width in screen columns of the part pointed to by @ref data(). + * Takes multi-byte UTF-8 sequences and wide characters into account. + */ + int screenLength() + { + return screenlen; + } - wrote_something = true; - } - public: + /** + * @brief Returns the current part of the iteration. + */ + const char* data() + { + return ptr; + } - /** - * @brief Writes out all remaining data from the LineWrapper using @c write. - * Unlike @ref process() this method indents all lines including the first and - * will output a \\n at the end (but only if something has been written). - */ - void flush(IStringWriter& write) - { - if (buf_empty()) - return; - int _ = 0; - indent(write, _, x); - wrote_something = false; - while (!buf_empty()) - write_one_line(write); - write("\n", 1); - } + }; /** - * @brief Process, wrap and output the next piece of data. + * @internal + * @brief Takes input and line wraps it, writing out one line at a time so that + * it can be interleaved with output from other columns. * - * process() will output at least one line of output. This is not necessarily - * the @c data passed in. It may be data queued from a prior call to process(). - * If the internal buffer is full, more than 1 line will be output. + * The LineWrapper is used to handle the last column of each table as well as interjections. + * The LineWrapper is called once for each line of output. If the data given to it fits + * into the designated width of the last column it is simply written out. If there + * is too much data, an appropriate split point is located and only the data up to this + * split point is written out. The rest of the data is queued for the next line. + * That way the last column can be line wrapped and interleaved with data from + * other columns. The following example makes this clearer: + * @code + * Column 1,1 Column 2,1 This is a long text + * Column 1,2 Column 2,2 that does not fit into + * a single line. + * @endcode * - * process() assumes that the a proper amount of indentation has already been - * output. It won't write any further indentation before the 1st line. If - * more than 1 line is written due to buffer constraints, the lines following - * the first will be indented by this method, though. - * - * No \\n is written by this method after the last line that is written. - * - * @param write where to write the data. - * @param data the new chunk of data to write. - * @param len the length of the chunk of data to write. + * The difficulty in producing this output is that the whole string + * "This is a long text that does not fit into a single line" is the + * 1st and only part of column 3. In order to produce the above + * output the string must be output piecemeal, interleaved with + * the data from the other columns. */ - void process(IStringWriter& write, const char* data, int len) + class LineWrapper { - wrote_something = false; + static const int bufmask = 15; //!< Must be a power of 2 minus 1. + /** + * @brief Ring buffer for length component of pair (data, length). + */ + int lenbuf[bufmask + 1]; + /** + * @brief Ring buffer for data component of pair (data, length). + */ + const char* datbuf[bufmask + 1]; + /** + * @brief The indentation of the column to which the LineBuffer outputs. LineBuffer + * assumes that the indentation has already been written when @ref process() + * is called, so this value is only used when a buffer flush requires writing + * additional lines of output. + */ + int x; + /** + * @brief The width of the column to line wrap. + */ + int width; + int head; //!< @brief index for next write + int tail; //!< @brief index for next read - 1 (i.e. increment tail BEFORE read) + + /** + * @brief Multiple methods of LineWrapper may decide to flush part of the buffer to + * free up space. The contract of process() says that only 1 line is output. So + * this variable is used to track whether something has output a line. It is + * reset at the beginning of process() and checked at the end to decide if + * output has already occurred or is still needed. + */ + bool wrote_something; + + bool buf_empty() + { + return ((tail + 1) & bufmask) == head; + } + + bool buf_full() + { + return tail == head; + } + + void buf_store( + const char* data, + int len) + { + lenbuf[head] = len; + datbuf[head] = data; + head = (head + 1) & bufmask; + } - while (len > 0) - { - if (len <= width) // quick test that works because utf8width <= len (all wide chars have at least 2 bytes) + //! @brief Call BEFORE reading ...buf[tail]. + void buf_next() { - output(write, data, len); - len = 0; + tail = (tail + 1) & bufmask; } - else // if (len > width) it's possible (but not guaranteed) that utf8len > width + + /** + * @brief Writes (data,len) into the ring buffer. If the buffer is full, a single line + * is flushed out of the buffer into @c write. + */ + void output( + IStringWriter& write, + const char* data, + int len) { - int utf8width = 0; - int maxi = 0; - while (maxi < len && utf8width < width) - { - int charbytes = 1; - unsigned ch = (unsigned char) data[maxi]; - if (ch > 0xC1) // everything <= 0xC1 (yes, even 0xC1 itself) is not a valid UTF-8 start byte + if (buf_full()) { - // int __builtin_clz (unsigned int x) - // Returns the number of leading 0-bits in x, starting at the most significant bit - unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff); - ch = ch & mask; // mask out length bits, we don't verify their correctness - while ((maxi + charbytes < len) && // - (((unsigned char) data[maxi + charbytes] ^ 0x80) <= 0x3F)) // while next byte is continuation byte - { - ch = (ch << 6) ^ (unsigned char) data[maxi + charbytes] ^ 0x80; // add continuation to char code - ++charbytes; - } - // ch is the decoded unicode code point - if (ch >= 0x1100 && isWideChar(ch)) // the test for 0x1100 is here to avoid the function call in the Latin case - { - if (utf8width + 2 > width) - break; - ++utf8width; - } + write_one_line(write); } - ++utf8width; - maxi += charbytes; - } - // data[maxi-1] is the last byte of the UTF-8 sequence of the last character that fits - // onto the 1st line. If maxi == len, all characters fit on the line. + buf_store(data, len); + } - if (maxi == len) - { - output(write, data, len); - len = 0; - } - else // if (maxi < len) at least 1 character (data[maxi] that is) doesn't fit on the line - { - int i; - for (i = maxi; i >= 0; --i) - if (data[i] == ' ') - break; + /** + * @brief Writes a single line of output from the buffer to @c write. + */ + void write_one_line( + IStringWriter& write) + { + if (wrote_something) // if we already wrote something, we need to start a new line + { + write("\n", 1); + int _ = 0; + indent(write, _, x); + } + + if (!buf_empty()) + { + buf_next(); + write(datbuf[tail], lenbuf[tail]); + } - if (i >= 0) + wrote_something = true; + } + + public: + + /** + * @brief Writes out all remaining data from the LineWrapper using @c write. + * Unlike @ref process() this method indents all lines including the first and + * will output a \\n at the end (but only if something has been written). + */ + void flush( + IStringWriter& write) + { + if (buf_empty()) { - output(write, data, i); - data += i + 1; - len -= i + 1; + return; } - else // did not find a space to split at => split before data[maxi] - { // data[maxi] is always the beginning of a character, never a continuation byte - output(write, data, maxi); - data += maxi; - len -= maxi; + int _ = 0; + indent(write, _, x); + wrote_something = false; + while (!buf_empty()) + { + write_one_line(write); } - } + write("\n", 1); } - } - if (!wrote_something) // if we didn't already write something to make space in the buffer - write_one_line(write); // write at most one line of actual output - } - /** - * @brief Constructs a LineWrapper that wraps its output to fit into - * screen columns @c x1 (incl.) to @c x2 (excl.). - * - * @c x1 gives the indentation LineWrapper uses if it needs to indent. - */ - LineWrapper(int x1, int x2) : - x(x1), width(x2 - x1), head(0), tail(bufmask) - { - if (width < 2) // because of wide characters we need at least width 2 or the code breaks - width = 2; - } - }; - - /** - * @internal - * @brief This is the implementation that is shared between all printUsage() templates. - * Because all printUsage() templates share this implementation, there is no template bloat. - */ - static void printUsage(IStringWriter& write, const Descriptor usage[], int width = 80, // - int last_column_min_percent = 50, int last_column_own_line_max_percent = 75) - { - if (width < 1) // protect against nonsense values - width = 80; - - if (width > 10000) // protect against overflow in the following computation - width = 10000; - - int last_column_min_width = ((width * last_column_min_percent) + 50) / 100; - int last_column_own_line_max_width = ((width * last_column_own_line_max_percent) + 50) / 100; - if (last_column_own_line_max_width == 0) - last_column_own_line_max_width = 1; - - LinePartIterator part(usage); - while (part.nextTable()) - { - - /***************** Determine column widths *******************************/ - - const int maxcolumns = 8; // 8 columns are enough for everyone - int col_width[maxcolumns]; - int lastcolumn; - int leftwidth; - int overlong_column_threshold = 10000; - do - { - lastcolumn = 0; - for (int i = 0; i < maxcolumns; ++i) - col_width[i] = 0; - - part.restartTable(); - while (part.nextRow()) + /** + * @brief Process, wrap and output the next piece of data. + * + * process() will output at least one line of output. This is not necessarily + * the @c data passed in. It may be data queued from a prior call to process(). + * If the internal buffer is full, more than 1 line will be output. + * + * process() assumes that the a proper amount of indentation has already been + * output. It won't write any further indentation before the 1st line. If + * more than 1 line is written due to buffer constraints, the lines following + * the first will be indented by this method, though. + * + * No \\n is written by this method after the last line that is written. + * + * @param write where to write the data. + * @param data the new chunk of data to write. + * @param len the length of the chunk of data to write. + */ + void process( + IStringWriter& write, + const char* data, + int len) + { + wrote_something = false; + + while (len > 0) + { + if (len <= width) // quick test that works because utf8width <= len (all wide chars have at least 2 bytes) + { + output(write, data, len); + len = 0; + } + else // if (len > width) it's possible (but not guaranteed) that utf8len > width + { + int utf8width = 0; + int maxi = 0; + while (maxi < len && utf8width < width) + { + int charbytes = 1; + unsigned ch = (unsigned char) data[maxi]; + if (ch > 0xC1) // everything <= 0xC1 (yes, even 0xC1 itself) is not a valid UTF-8 start byte + { + // int __builtin_clz (unsigned int x) + // Returns the number of leading 0-bits in x, starting at the most significant bit + unsigned mask = (unsigned) -1 >> __builtin_clz(ch ^ 0xff); + ch = ch & mask; // mask out length bits, we don't verify their correctness + while ((maxi + charbytes < len) && // + (((unsigned char) data[maxi + charbytes] ^ 0x80) <= 0x3F)) // while next byte is continuation byte + { + ch = (ch << 6) ^ (unsigned char) data[maxi + charbytes] ^ 0x80; // add continuation to char code + ++charbytes; + } + // ch is the decoded unicode code point + if (ch >= 0x1100 && isWideChar(ch)) // the test for 0x1100 is here to avoid the function call in the Latin case + { + if (utf8width + 2 > width) + { + break; + } + ++utf8width; + } + } + ++utf8width; + maxi += charbytes; + } + + // data[maxi-1] is the last byte of the UTF-8 sequence of the last character that fits + // onto the 1st line. If maxi == len, all characters fit on the line. + + if (maxi == len) + { + output(write, data, len); + len = 0; + } + else // if (maxi < len) at least 1 character (data[maxi] that is) doesn't fit on the line + { + int i; + for (i = maxi; i >= 0; --i) + { + if (data[i] == ' ') + { + break; + } + } + + if (i >= 0) + { + output(write, data, i); + data += i + 1; + len -= i + 1; + } + else // did not find a space to split at => split before data[maxi] + { + // data[maxi] is always the beginning of a character, never a continuation byte + output(write, data, maxi); + data += maxi; + len -= maxi; + } + } + } + } + if (!wrote_something) // if we didn't already write something to make space in the buffer + { + write_one_line(write); // write at most one line of actual output + } + } + + /** + * @brief Constructs a LineWrapper that wraps its output to fit into + * screen columns @c x1 (incl.) to @c x2 (excl.). + * + * @c x1 gives the indentation LineWrapper uses if it needs to indent. + */ + LineWrapper( + int x1, + int x2) + : x(x1) + , width(x2 - x1) + , head(0) + , tail(bufmask) { - while (part.next()) - { - if (part.column() < maxcolumns) + if (width < 2) // because of wide characters we need at least width 2 or the code breaks { - upmax(lastcolumn, part.column()); - if (part.screenLength() < overlong_column_threshold) - // We don't let rows that don't use table separators (\t or \v) influence - // the width of column 0. This allows the user to interject section headers - // or explanatory paragraphs that do not participate in the table layout. - if (part.column() > 0 || part.line() > 0 || part.data()[part.length()] == '\t' - || part.data()[part.length()] == '\v') - upmax(col_width[part.column()], part.screenLength()); + width = 2; } - } } - /* - * If the last column doesn't fit on the same - * line as the other columns, we can fix that by starting it on its own line. - * However we can't do this for any of the columns 0..lastcolumn-1. - * If their sum exceeds the maximum width we try to fix this by iteratively - * ignoring the widest line parts in the width determination until - * we arrive at a series of column widths that fit into one line. - * The result is a layout where everything is nicely formatted - * except for a few overlong fragments. - * */ - - leftwidth = 0; - overlong_column_threshold = 0; - for (int i = 0; i < lastcolumn; ++i) + }; + + /** + * @internal + * @brief This is the implementation that is shared between all printUsage() templates. + * Because all printUsage() templates share this implementation, there is no template bloat. + */ + static void printUsage( + IStringWriter& write, + const Descriptor usage[], + int width = 80, // + int last_column_min_percent = 50, + int last_column_own_line_max_percent = 75) + { + if (width < 1) // protect against nonsense values + { + width = 80; + } + + if (width > 10000) // protect against overflow in the following computation { - leftwidth += col_width[i]; - upmax(overlong_column_threshold, col_width[i]); + width = 10000; } - } while (leftwidth > width); - - /**************** Determine tab stops and last column handling **********************/ - - int tabstop[maxcolumns]; - tabstop[0] = 0; - for (int i = 1; i < maxcolumns; ++i) - tabstop[i] = tabstop[i - 1] + col_width[i - 1]; - - int rightwidth = width - tabstop[lastcolumn]; - bool print_last_column_on_own_line = false; - if (rightwidth < last_column_min_width && // if we don't have the minimum requested width for the last column - ( col_width[lastcolumn] == 0 || // and all last columns are > overlong_column_threshold - rightwidth < col_width[lastcolumn] // or there is at least one last column that requires more than the space available - ) - ) - { - print_last_column_on_own_line = true; - rightwidth = last_column_own_line_max_width; - } - - // If lastcolumn == 0 we must disable print_last_column_on_own_line because - // otherwise 2 copies of the last (and only) column would be output. - // Actually this is just defensive programming. It is currently not - // possible that lastcolumn==0 and print_last_column_on_own_line==true - // at the same time, because lastcolumn==0 => tabstop[lastcolumn] == 0 => - // rightwidth==width => rightwidth>=last_column_min_width (unless someone passes - // a bullshit value >100 for last_column_min_percent) => the above if condition - // is false => print_last_column_on_own_line==false - if (lastcolumn == 0) - print_last_column_on_own_line = false; - - LineWrapper lastColumnLineWrapper(width - rightwidth, width); - LineWrapper interjectionLineWrapper(0, width); - - part.restartTable(); - - /***************** Print out all rows of the table *************************************/ - - while (part.nextRow()) - { - int x = -1; - while (part.next()) + int last_column_min_width = ((width * last_column_min_percent) + 50) / 100; + int last_column_own_line_max_width = ((width * last_column_own_line_max_percent) + 50) / 100; + if (last_column_own_line_max_width == 0) { - if (part.column() > lastcolumn) - continue; // drop excess columns (can happen if lastcolumn == maxcolumns-1) - - if (part.column() == 0) - { - if (x >= 0) - write("\n", 1); - x = 0; - } - - indent(write, x, tabstop[part.column()]); - - if ((part.column() < lastcolumn) - && (part.column() > 0 || part.line() > 0 || part.data()[part.length()] == '\t' - || part.data()[part.length()] == '\v')) - { - write(part.data(), part.length()); - x += part.screenLength(); - } - else // either part.column() == lastcolumn or we are in the special case of - // an interjection that doesn't contain \v or \t - { - // NOTE: This code block is not necessarily executed for - // each line, because some rows may have fewer columns. - - LineWrapper& lineWrapper = (part.column() == 0) ? interjectionLineWrapper : lastColumnLineWrapper; - - if (!print_last_column_on_own_line || part.column() != lastcolumn) - lineWrapper.process(write, part.data(), part.length()); - } - } // while - - if (print_last_column_on_own_line) + last_column_own_line_max_width = 1; + } + + LinePartIterator part(usage); + while (part.nextTable()) { - part.restartRow(); - while (part.next()) - { - if (part.column() == lastcolumn) + + /***************** Determine column widths *******************************/ + + const int maxcolumns = 8; // 8 columns are enough for everyone + int col_width[maxcolumns]; + int lastcolumn; + int leftwidth; + int overlong_column_threshold = 10000; + do + { + lastcolumn = 0; + for (int i = 0; i < maxcolumns; ++i) + { + col_width[i] = 0; + } + + part.restartTable(); + while (part.nextRow()) + { + while (part.next()) + { + if (part.column() < maxcolumns) + { + upmax(lastcolumn, part.column()); + if (part.screenLength() < overlong_column_threshold) + { + // We don't let rows that don't use table separators (\t or \v) influence + // the width of column 0. This allows the user to interject section headers + // or explanatory paragraphs that do not participate in the table layout. + if (part.column() > 0 || part.line() > 0 || part.data()[part.length()] == '\t' + || part.data()[part.length()] == '\v') + { + upmax(col_width[part.column()], part.screenLength()); + } + } + } + } + } + + /* + * If the last column doesn't fit on the same + * line as the other columns, we can fix that by starting it on its own line. + * However we can't do this for any of the columns 0..lastcolumn-1. + * If their sum exceeds the maximum width we try to fix this by iteratively + * ignoring the widest line parts in the width determination until + * we arrive at a series of column widths that fit into one line. + * The result is a layout where everything is nicely formatted + * except for a few overlong fragments. + * */ + + leftwidth = 0; + overlong_column_threshold = 0; + for (int i = 0; i < lastcolumn; ++i) + { + leftwidth += col_width[i]; + upmax(overlong_column_threshold, col_width[i]); + } + + } while (leftwidth > width); + + /**************** Determine tab stops and last column handling **********************/ + + int tabstop[maxcolumns]; + tabstop[0] = 0; + for (int i = 1; i < maxcolumns; ++i) { - write("\n", 1); - int _ = 0; - indent(write, _, width - rightwidth); - lastColumnLineWrapper.process(write, part.data(), part.length()); + tabstop[i] = tabstop[i - 1] + col_width[i - 1]; } - } - } - write("\n", 1); - lastColumnLineWrapper.flush(write); - interjectionLineWrapper.flush(write); - } + int rightwidth = width - tabstop[lastcolumn]; + bool print_last_column_on_own_line = false; + if (rightwidth < last_column_min_width && // if we don't have the minimum requested width for the last column + ( col_width[lastcolumn] == 0 || // and all last columns are > overlong_column_threshold + rightwidth < col_width[lastcolumn] // or there is at least one last column that requires more than the space available + ) + ) + { + print_last_column_on_own_line = true; + rightwidth = last_column_own_line_max_width; + } + + // If lastcolumn == 0 we must disable print_last_column_on_own_line because + // otherwise 2 copies of the last (and only) column would be output. + // Actually this is just defensive programming. It is currently not + // possible that lastcolumn==0 and print_last_column_on_own_line==true + // at the same time, because lastcolumn==0 => tabstop[lastcolumn] == 0 => + // rightwidth==width => rightwidth>=last_column_min_width (unless someone passes + // a bullshit value >100 for last_column_min_percent) => the above if condition + // is false => print_last_column_on_own_line==false + if (lastcolumn == 0) + { + print_last_column_on_own_line = false; + } + + LineWrapper lastColumnLineWrapper(width - rightwidth, width); + LineWrapper interjectionLineWrapper(0, width); + + part.restartTable(); + + /***************** Print out all rows of the table *************************************/ + + while (part.nextRow()) + { + int x = -1; + while (part.next()) + { + if (part.column() > lastcolumn) + { + continue; // drop excess columns (can happen if lastcolumn == maxcolumns-1) + + } + if (part.column() == 0) + { + if (x >= 0) + { + write("\n", 1); + } + x = 0; + } + + indent(write, x, tabstop[part.column()]); + + if ((part.column() < lastcolumn) + && (part.column() > 0 || part.line() > 0 || part.data()[part.length()] == '\t' + || part.data()[part.length()] == '\v')) + { + write(part.data(), part.length()); + x += part.screenLength(); + } + else // either part.column() == lastcolumn or we are in the special case of + // an interjection that doesn't contain \v or \t + { + // NOTE: This code block is not necessarily executed for + // each line, because some rows may have fewer columns. + + LineWrapper& lineWrapper = + (part.column() == 0) ? interjectionLineWrapper : lastColumnLineWrapper; + + if (!print_last_column_on_own_line || part.column() != lastcolumn) + { + lineWrapper.process(write, part.data(), part.length()); + } + } + } // while + + if (print_last_column_on_own_line) + { + part.restartRow(); + while (part.next()) + { + if (part.column() == lastcolumn) + { + write("\n", 1); + int _ = 0; + indent(write, _, width - rightwidth); + lastColumnLineWrapper.process(write, part.data(), part.length()); + } + } + } + + write("\n", 1); + lastColumnLineWrapper.flush(write); + interjectionLineWrapper.flush(write); + } + } } - } } ; @@ -2775,47 +3181,74 @@ struct PrintUsageImplementation * @endcode */ template -void printUsage(OStream& prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, - int last_column_own_line_max_percent = 75) +void printUsage( + OStream& prn, + const Descriptor usage[], + int width = 80, + int last_column_min_percent = 50, + int last_column_own_line_max_percent = 75) { - PrintUsageImplementation::OStreamWriter write(prn); - PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); + PrintUsageImplementation::OStreamWriter write(prn); + PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, + last_column_own_line_max_percent); } template -void printUsage(Function* prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, - int last_column_own_line_max_percent = 75) +void printUsage( + Function* prn, + const Descriptor usage[], + int width = 80, + int last_column_min_percent = 50, + int last_column_own_line_max_percent = 75) { - PrintUsageImplementation::FunctionWriter write(prn); - PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); + PrintUsageImplementation::FunctionWriter write(prn); + PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, + last_column_own_line_max_percent); } template -void printUsage(const Temporary& prn, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, - int last_column_own_line_max_percent = 75) +void printUsage( + const Temporary& prn, + const Descriptor usage[], + int width = 80, + int last_column_min_percent = 50, + int last_column_own_line_max_percent = 75) { - PrintUsageImplementation::TemporaryWriter write(prn); - PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); + PrintUsageImplementation::TemporaryWriter write(prn); + PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, + last_column_own_line_max_percent); } template -void printUsage(Syscall* prn, int fd, const Descriptor usage[], int width = 80, int last_column_min_percent = 50, - int last_column_own_line_max_percent = 75) +void printUsage( + Syscall* prn, + int fd, + const Descriptor usage[], + int width = 80, + int last_column_min_percent = 50, + int last_column_own_line_max_percent = 75) { - PrintUsageImplementation::SyscallWriter write(prn, fd); - PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); + PrintUsageImplementation::SyscallWriter write(prn, fd); + PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, + last_column_own_line_max_percent); } template -void printUsage(Function* prn, Stream* stream, const Descriptor usage[], int width = 80, int last_column_min_percent = - 50, - int last_column_own_line_max_percent = 75) +void printUsage( + Function* prn, + Stream* stream, + const Descriptor usage[], + int width = 80, + int last_column_min_percent = + 50, + int last_column_own_line_max_percent = 75) { - PrintUsageImplementation::StreamWriter write(prn, stream); - PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, last_column_own_line_max_percent); + PrintUsageImplementation::StreamWriter write(prn, stream); + PrintUsageImplementation::printUsage(write, usage, width, last_column_min_percent, + last_column_own_line_max_percent); } -} +} // namespace option // namespace option #endif /* OPTIONPARSER_H_ */ \ No newline at end of file diff --git a/include/fastdds_statistics_backend/StatisticsBackend.hpp b/include/fastdds_statistics_backend/StatisticsBackend.hpp index 3218c7a77..873876f84 100644 --- a/include/fastdds_statistics_backend/StatisticsBackend.hpp +++ b/include/fastdds_statistics_backend/StatisticsBackend.hpp @@ -16,8 +16,8 @@ * @file StatisticsBackend.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_STATISTICSBACKEND_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_STATISTICSBACKEND_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND__STATISTICS_BACKEND_HPP +#define FASTDDS_STATISTICS_BACKEND__STATISTICS_BACKEND_HPP #include #include @@ -91,8 +91,6 @@ class StatisticsBackend * * This function creates a new statistics DomainParticipant that starts monitoring * the network of the server with the given locators. - * The server \c GuidPrefix_t is set to the default one: \c eprosima::fastdds::rtps::DEFAULT_ROS2_SERVER_GUIDPREFIX. - * If any other server is to be used, call the overload method that receives the \c GuidPrefix_t as parameter. * * The format to specify a locator is: kind:[IP]:port, where: * * \b kind is one of { \c UDPv4, \c TCPv4, \c UDPv6, \c TCPv4 } @@ -119,39 +117,6 @@ class StatisticsBackend std::string app_id = app_id_str[(int)AppId::UNKNOWN], std::string app_metadata = ""); - /** - * @brief Starts monitoring the network corresponding to a server. - * - * This function creates a new statistics DomainParticipant that starts monitoring - * the network of the server with the given \c GuidPrefix_t and with the given locators. - * - * The format to specify a locator is: kind:[IP]:port, where: - * * \b kind is one of { \c UDPv4, \c TCPv4, \c UDPv6, \c TCPv4 } - * * \b IP is the IP address - * * \b port is the IP port - * Note that \c SHM locators are not supported. For any server configured with shared memory locators, - * initialize the monitor using only the non shared memory locators. - * - * @param discovery_server_guid_prefix Server \c GuidPrefix_t to be monitored. - * @param discovery_server_locators The locator list of the server whose network is to be monitored, - * formatted as a semicolon separated list of locators. - * @param domain_listener Listener with the callback to use to inform of events. - * @param callback_mask Mask of the callbacks. Only the events that have the mask bit set will be informed. - * @param data_mask Mask of the data types that will be monitored. - * @param app_id App id of the monitor participant. - * @param app_metadata Metadata of the monitor participant. - * @return The ID of the created statistics Domain. - */ - FASTDDS_STATISTICS_BACKEND_DllAPI - static EntityId init_monitor( - std::string discovery_server_guid_prefix, - std::string discovery_server_locators, - DomainListener* domain_listener = nullptr, - CallbackMask callback_mask = CallbackMask::all(), - DataKindMask data_mask = DataKindMask::none(), - std::string app_id = app_id_str[(int)AppId::UNKNOWN], - std::string app_metadata = ""); - /** * @brief Restarts a given monitor. * @@ -612,4 +577,4 @@ class StatisticsBackend } // namespace statistics_backend } // namespace eprosima -#endif //_EPROSIMA_FASTDDS_STATISTICS_BACKEND_STATISTICSBACKEND_HPP_ +#endif //FASTDDS_STATISTICS_BACKEND__STATISTICS_BACKEND_HPP diff --git a/include/fastdds_statistics_backend/config.h.in b/include/fastdds_statistics_backend/config.h.in index 0678577de..b9d63e67c 100644 --- a/include/fastdds_statistics_backend/config.h.in +++ b/include/fastdds_statistics_backend/config.h.in @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef _FASTDDS_STATISTICS_BACKEND_CONFIG_H_ -#define _FASTDDS_STATISTICS_BACKEND_CONFIG_H_ +#ifndef FASTDDS_STATISTICS_BACKEND__CONFIG_H +#define FASTDDS_STATISTICS_BACKEND__CONFIG_H #ifndef FASTDDS_STATISTICS_BACKEND_VERSION_MAJOR #define FASTDDS_STATISTICS_BACKEND_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ diff --git a/include/fastdds_statistics_backend/eProsima_auto_link.h b/include/fastdds_statistics_backend/eProsima_auto_link.h index f7412a4d5..d9b9624c5 100644 --- a/include/fastdds_statistics_backend/eProsima_auto_link.h +++ b/include/fastdds_statistics_backend/eProsima_auto_link.h @@ -13,11 +13,11 @@ // limitations under the License. /* - Expected defines. - - EPROSIMA_LIB_NAME - - FASTDDS_STATISTICS_BACKEND_VERSION_MAJOR - - FASTDDS_STATISTICS_BACKEND_VERSION_MINOT -*/ + Expected defines. + - EPROSIMA_LIB_NAME + - FASTDDS_STATISTICS_BACKEND_VERSION_MAJOR + - FASTDDS_STATISTICS_BACKEND_VERSION_MINOT + */ #if defined(_MSC_VER) #define EPROSIMA_STRINGIZE(X) EPROSIMA_DO_STRINGIZE(X) @@ -29,37 +29,38 @@ #define EPROSIMA_LIB_DEBUG_TAG #endif // _DEBUG - // Select linkage option. +// Select linkage option. #if (defined(_DLL) || defined(_RTLDLL)) && defined(EPROSIMA_DYN_LINK) #define EPROSIMA_LIB_PREFIX #elif defined(EPROSIMA_DYN_LINK) #error "Mixing a dll eprosima library with a static runtime is a bad idea" #else #define EPROSIMA_LIB_PREFIX "lib" - #endif + #endif // if (defined(_DLL) || defined(_RTLDLL)) && defined(EPROSIMA_DYN_LINK) - // Include library +// Include library #if defined(EPROSIMA_LIB_NAME) \ - && defined(EPROSIMA_LIB_PREFIX) \ - && defined(EPROSIMA_LIB_DEBUG_TAG) \ - && defined(FASTDDS_STATISTICS_BACKEND_VERSION_MAJOR) \ - && defined(FASTDDS_STATISTICS_BACKEND_VERSION_MINOR) - #pragma comment(lib, EPROSIMA_LIB_PREFIX EPROSIMA_STRINGIZE(EPROSIMA_LIB_NAME) EPROSIMA_LIB_DEBUG_TAG "-" EPROSIMA_STRINGIZE(FASTDDS_STATISTICS_BACKEND_VERSION_MAJOR) "." EPROSIMA_STRINGIZE(FASTDDS_STATISTICS_BACKEND_VERSION_MINOR) ".lib") + && defined(EPROSIMA_LIB_PREFIX) \ + && defined(EPROSIMA_LIB_DEBUG_TAG) \ + && defined(FASTDDS_STATISTICS_BACKEND_VERSION_MAJOR) \ + && defined(FASTDDS_STATISTICS_BACKEND_VERSION_MINOR) + #pragma \ + comment(lib, EPROSIMA_LIB_PREFIX EPROSIMA_STRINGIZE(EPROSIMA_LIB_NAME) EPROSIMA_LIB_DEBUG_TAG "-" EPROSIMA_STRINGIZE(FASTDDS_STATISTICS_BACKEND_VERSION_MAJOR) "." EPROSIMA_STRINGIZE(FASTDDS_STATISTICS_BACKEND_VERSION_MINOR) ".lib") #else #error "Some required macros where not defined" - #endif + #endif // if defined(EPROSIMA_LIB_NAME) && defined(EPROSIMA_LIB_PREFIX) && defined(EPROSIMA_LIB_DEBUG_TAG) && defined(FASTDDS_STATISTICS_BACKEND_VERSION_MAJOR) && defined(FASTDDS_STATISTICS_BACKEND_VERSION_MINOR) #endif // _MSC_VER // Undef macros #ifdef EPROSIMA_LIB_PREFIX #undef EPROSIMA_LIB_PREFIX -#endif +#endif // ifdef EPROSIMA_LIB_PREFIX #ifdef EPROSIMA_LIB_NAME #undef EPROSIMA_LIB_NAME -#endif +#endif // ifdef EPROSIMA_LIB_NAME #ifdef EPROSIMA_LIB_DEBUG_TAG #undef EPROSIMA_LIB_DEBUG_TAG -#endif +#endif // ifdef EPROSIMA_LIB_DEBUG_TAG diff --git a/include/fastdds_statistics_backend/exception/Exception.hpp b/include/fastdds_statistics_backend/exception/Exception.hpp index e1f7b6323..d551f1884 100644 --- a/include/fastdds_statistics_backend/exception/Exception.hpp +++ b/include/fastdds_statistics_backend/exception/Exception.hpp @@ -16,8 +16,8 @@ * @file Exception.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_EXCEPTION_EXCEPTION_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_EXCEPTION_EXCEPTION_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_EXCEPTION__EXCEPTION_HPP +#define FASTDDS_STATISTICS_BACKEND_EXCEPTION__EXCEPTION_HPP #include #include @@ -259,4 +259,4 @@ class Inconsistency : public Exception } // namespace statistics_backend } // namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_EXCEPTION_EXCEPTION_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_EXCEPTION__EXCEPTION_HPP diff --git a/include/fastdds_statistics_backend/fastdds_statistics_backend_dll.h b/include/fastdds_statistics_backend/fastdds_statistics_backend_dll.h index fb1809892..bb0d01cef 100644 --- a/include/fastdds_statistics_backend/fastdds_statistics_backend_dll.h +++ b/include/fastdds_statistics_backend/fastdds_statistics_backend_dll.h @@ -12,8 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DLL_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DLL_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND__FASTDDS_STATISTICS_BACKEND_DLL_H +#define FASTDDS_STATISTICS_BACKEND__FASTDDS_STATISTICS_BACKEND_DLL_H #include "config.h" @@ -73,4 +73,4 @@ #include "eProsima_auto_link.h" #endif // auto-linking disabled -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DLL_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND__FASTDDS_STATISTICS_BACKEND_DLL_H diff --git a/include/fastdds_statistics_backend/listener/CallbackMask.hpp b/include/fastdds_statistics_backend/listener/CallbackMask.hpp index e8dbe1ed4..20d9f6253 100644 --- a/include/fastdds_statistics_backend/listener/CallbackMask.hpp +++ b/include/fastdds_statistics_backend/listener/CallbackMask.hpp @@ -16,8 +16,8 @@ * @file CallbackMask.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_LISTENER_CALLBACKMASK_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_LISTENER_CALLBACKMASK_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_LISTENER__CALLBACKMASK_HPP +#define FASTDDS_STATISTICS_BACKEND_LISTENER__CALLBACKMASK_HPP #include @@ -86,4 +86,4 @@ using CallbackMask = Bitmask; } // namespace statistics_backend } // namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_LISTENER_CALLBACKMASK_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_LISTENER__CALLBACKMASK_HPP diff --git a/include/fastdds_statistics_backend/listener/DomainListener.hpp b/include/fastdds_statistics_backend/listener/DomainListener.hpp index dea8a245d..f9c5ac63d 100644 --- a/include/fastdds_statistics_backend/listener/DomainListener.hpp +++ b/include/fastdds_statistics_backend/listener/DomainListener.hpp @@ -16,8 +16,8 @@ * @file DomainListener.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_LISTENER_DOMAINLISTENER_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_LISTENER_DOMAINLISTENER_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_LISTENER__DOMAINLISTENER_HPP +#define FASTDDS_STATISTICS_BACKEND_LISTENER__DOMAINLISTENER_HPP #include #include @@ -216,4 +216,4 @@ class FASTDDS_STATISTICS_BACKEND_DllAPI DomainListener } // namespace statistics_backend } // namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_LISTENER_DOMAINLISTENER_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_LISTENER__DOMAINLISTENER_HPP diff --git a/include/fastdds_statistics_backend/listener/PhysicalListener.hpp b/include/fastdds_statistics_backend/listener/PhysicalListener.hpp index f32701c86..a5de222dd 100644 --- a/include/fastdds_statistics_backend/listener/PhysicalListener.hpp +++ b/include/fastdds_statistics_backend/listener/PhysicalListener.hpp @@ -16,8 +16,8 @@ * @file PhysicalListener.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_LISTENER_PHYSICALLISTENER_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_LISTENER_PHYSICALLISTENER_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_LISTENER__PHYSICAL_LISTENER_HPP +#define FASTDDS_STATISTICS_BACKEND_LISTENER__PHYSICAL_LISTENER_HPP #include #include @@ -96,4 +96,4 @@ class FASTDDS_STATISTICS_BACKEND_DllAPI PhysicalListener : public DomainListener } // namespace statistics_backend } // namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_LISTENER_PHYSICALLISTENER_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_LISTENER__PHYSICAL_LISTENER_HPP diff --git a/include/fastdds_statistics_backend/nlohmann-json/json.hpp b/include/fastdds_statistics_backend/nlohmann-json/json.hpp index e821c79a3..847d013d9 100644 --- a/include/fastdds_statistics_backend/nlohmann-json/json.hpp +++ b/include/fastdds_statistics_backend/nlohmann-json/json.hpp @@ -1,31 +1,31 @@ /* __ _____ _____ _____ - __| | __| | | | JSON for Modern C++ -| | |__ | | | | | | version 3.9.1 -|_____|_____|_____|_|___| https://github.com/nlohmann/json - -Licensed under the MIT License . -SPDX-License-Identifier: MIT -Copyright (c) 2013-2019 Niels Lohmann . - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ + __| | __| | | | JSON for Modern C++ + | | |__ | | | | | | version 3.9.1 + |_____|_____|_____|_|___| https://github.com/nlohmann/json + + Licensed under the MIT License . + SPDX-License-Identifier: MIT + Copyright (c) 2013-2019 Niels Lohmann . + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ #ifndef INCLUDE_NLOHMANN_JSON_HPP_ #define INCLUDE_NLOHMANN_JSON_HPP_ @@ -78,10 +78,8 @@ SOFTWARE. #include // size_t -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { /// struct to capture the start position of the current token struct position_t { @@ -122,454 +120,503 @@ struct position_t #if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 14) #if defined(JSON_HEDLEY_VERSION) #undef JSON_HEDLEY_VERSION -#endif +#endif // if defined(JSON_HEDLEY_VERSION) #define JSON_HEDLEY_VERSION 14 #if defined(JSON_HEDLEY_STRINGIFY_EX) #undef JSON_HEDLEY_STRINGIFY_EX -#endif +#endif // if defined(JSON_HEDLEY_STRINGIFY_EX) #define JSON_HEDLEY_STRINGIFY_EX(x) #x #if defined(JSON_HEDLEY_STRINGIFY) #undef JSON_HEDLEY_STRINGIFY -#endif +#endif // if defined(JSON_HEDLEY_STRINGIFY) #define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) #if defined(JSON_HEDLEY_CONCAT_EX) #undef JSON_HEDLEY_CONCAT_EX -#endif -#define JSON_HEDLEY_CONCAT_EX(a,b) a##b +#endif // if defined(JSON_HEDLEY_CONCAT_EX) +#define JSON_HEDLEY_CONCAT_EX(a, b) a ## b #if defined(JSON_HEDLEY_CONCAT) #undef JSON_HEDLEY_CONCAT -#endif -#define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) +#endif // if defined(JSON_HEDLEY_CONCAT) +#define JSON_HEDLEY_CONCAT(a, b) JSON_HEDLEY_CONCAT_EX(a, b) #if defined(JSON_HEDLEY_CONCAT3_EX) #undef JSON_HEDLEY_CONCAT3_EX -#endif -#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c +#endif // if defined(JSON_HEDLEY_CONCAT3_EX) +#define JSON_HEDLEY_CONCAT3_EX(a, b, c) a ## b ## c #if defined(JSON_HEDLEY_CONCAT3) #undef JSON_HEDLEY_CONCAT3 -#endif -#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) +#endif // if defined(JSON_HEDLEY_CONCAT3) +#define JSON_HEDLEY_CONCAT3(a, b, c) JSON_HEDLEY_CONCAT3_EX(a, b, c) #if defined(JSON_HEDLEY_VERSION_ENCODE) #undef JSON_HEDLEY_VERSION_ENCODE -#endif -#define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) +#endif // if defined(JSON_HEDLEY_VERSION_ENCODE) +#define JSON_HEDLEY_VERSION_ENCODE(major, minor, revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) #if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) #undef JSON_HEDLEY_VERSION_DECODE_MAJOR -#endif +#endif // if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) #define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) #if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) #undef JSON_HEDLEY_VERSION_DECODE_MINOR -#endif +#endif // if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) #define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) #if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) #undef JSON_HEDLEY_VERSION_DECODE_REVISION -#endif +#endif // if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) #define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) #if defined(JSON_HEDLEY_GNUC_VERSION) #undef JSON_HEDLEY_GNUC_VERSION -#endif +#endif // if defined(JSON_HEDLEY_GNUC_VERSION) #if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #elif defined(__GNUC__) #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) -#endif +#endif // if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) #if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) #undef JSON_HEDLEY_GNUC_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) #if defined(JSON_HEDLEY_GNUC_VERSION) - #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_GNUC_VERSION) #if defined(JSON_HEDLEY_MSVC_VERSION) #undef JSON_HEDLEY_MSVC_VERSION -#endif +#endif // if defined(JSON_HEDLEY_MSVC_VERSION) #if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) - #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, \ + (_MSC_FULL_VER % 10000000) / 100000, \ + (_MSC_FULL_VER % 100000) / 100) #elif defined(_MSC_FULL_VER) && !defined(__ICL) - #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, \ + (_MSC_FULL_VER % 1000000) / 10000, \ + (_MSC_FULL_VER % 10000) / 10) #elif defined(_MSC_VER) && !defined(__ICL) #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) -#endif +#endif // if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) #if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) #undef JSON_HEDLEY_MSVC_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) #if !defined(JSON_HEDLEY_MSVC_VERSION) - #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) (0) #elif defined(_MSC_VER) && (_MSC_VER >= 1400) - #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major, minor, \ + patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) #elif defined(_MSC_VER) && (_MSC_VER >= 1200) - #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major, minor, \ + patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) #else - #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) -#endif + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major, minor, patch) (_MSC_VER >= ((major * 100) + (minor))) +#endif // if !defined(JSON_HEDLEY_MSVC_VERSION) #if defined(JSON_HEDLEY_INTEL_VERSION) #undef JSON_HEDLEY_INTEL_VERSION -#endif +#endif // if defined(JSON_HEDLEY_INTEL_VERSION) #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) - #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, \ + __INTEL_COMPILER_UPDATE) #elif defined(__INTEL_COMPILER) && !defined(__ICL) #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) -#endif +#endif // if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) #if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) #undef JSON_HEDLEY_INTEL_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) #if defined(JSON_HEDLEY_INTEL_VERSION) - #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_INTEL_VERSION) #if defined(JSON_HEDLEY_INTEL_CL_VERSION) #undef JSON_HEDLEY_INTEL_CL_VERSION -#endif +#endif // if defined(JSON_HEDLEY_INTEL_CL_VERSION) #if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) -#endif +#endif // if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) #if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) #if defined(JSON_HEDLEY_INTEL_CL_VERSION) - #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_INTEL_CL_VERSION) #if defined(JSON_HEDLEY_PGI_VERSION) #undef JSON_HEDLEY_PGI_VERSION -#endif +#endif // if defined(JSON_HEDLEY_PGI_VERSION) #if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) -#endif +#endif // if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) #if defined(JSON_HEDLEY_PGI_VERSION_CHECK) #undef JSON_HEDLEY_PGI_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_PGI_VERSION_CHECK) #if defined(JSON_HEDLEY_PGI_VERSION) - #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_PGI_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_PGI_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_PGI_VERSION) #if defined(JSON_HEDLEY_SUNPRO_VERSION) #undef JSON_HEDLEY_SUNPRO_VERSION -#endif +#endif // if defined(JSON_HEDLEY_SUNPRO_VERSION) #if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) - #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> \ + 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), \ + (__SUNPRO_C & 0xf) * 10) #elif defined(__SUNPRO_C) - #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, \ + (__SUNPRO_C) & 0xf) #elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) - #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> \ + 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), \ + (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) #elif defined(__SUNPRO_CC) - #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) -#endif + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, \ + (__SUNPRO_CC) & 0xf) +#endif // if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) #if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) #if defined(JSON_HEDLEY_SUNPRO_VERSION) - #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_SUNPRO_VERSION) #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) #undef JSON_HEDLEY_EMSCRIPTEN_VERSION -#endif +#endif // if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) #if defined(__EMSCRIPTEN__) - #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) -#endif + #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, \ + __EMSCRIPTEN_tiny__) +#endif // if defined(__EMSCRIPTEN__) #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) #if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) - #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) #if defined(JSON_HEDLEY_ARM_VERSION) #undef JSON_HEDLEY_ARM_VERSION -#endif +#endif // if defined(JSON_HEDLEY_ARM_VERSION) #if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) - #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, \ + (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) #elif defined(__CC_ARM) && defined(__ARMCC_VERSION) - #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) -#endif + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, \ + (__ARMCC_VERSION % 1000000) / 10000, \ + (__ARMCC_VERSION % 10000) / 100) +#endif // if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) #if defined(JSON_HEDLEY_ARM_VERSION_CHECK) #undef JSON_HEDLEY_ARM_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_ARM_VERSION_CHECK) #if defined(JSON_HEDLEY_ARM_VERSION) - #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_ARM_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_ARM_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_ARM_VERSION) #if defined(JSON_HEDLEY_IBM_VERSION) #undef JSON_HEDLEY_IBM_VERSION -#endif +#endif // if defined(JSON_HEDLEY_IBM_VERSION) #if defined(__ibmxl__) - #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, \ + __ibmxl_modification__) #elif defined(__xlC__) && defined(__xlC_ver__) #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) #elif defined(__xlC__) #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) -#endif +#endif // if defined(__ibmxl__) #if defined(JSON_HEDLEY_IBM_VERSION_CHECK) #undef JSON_HEDLEY_IBM_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_IBM_VERSION_CHECK) #if defined(JSON_HEDLEY_IBM_VERSION) - #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_IBM_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_IBM_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_IBM_VERSION) #if defined(JSON_HEDLEY_TI_VERSION) #undef JSON_HEDLEY_TI_VERSION -#endif +#endif // if defined(JSON_HEDLEY_TI_VERSION) #if \ defined(__TI_COMPILER_VERSION__) && \ ( \ - defined(__TMS470__) || defined(__TI_ARM__) || \ - defined(__MSP430__) || \ - defined(__TMS320C2000__) \ - ) + defined(__TMS470__) || defined(__TI_ARM__) || \ + defined(__MSP430__) || \ + defined(__TMS320C2000__) \ +) #if (__TI_COMPILER_VERSION__ >= 16000000) - #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif -#endif + #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \ + (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif // if (__TI_COMPILER_VERSION__ >= 16000000) +#endif // if defined(__TI_COMPILER_VERSION__) && ( defined(__TMS470__) || defined(__TI_ARM__) || defined(__MSP430__) || defined(__TMS320C2000__) ) #if defined(JSON_HEDLEY_TI_VERSION_CHECK) #undef JSON_HEDLEY_TI_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_TI_VERSION_CHECK) #if defined(JSON_HEDLEY_TI_VERSION) - #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_TI_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_TI_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_TI_VERSION) #if defined(JSON_HEDLEY_TI_CL2000_VERSION) #undef JSON_HEDLEY_TI_CL2000_VERSION -#endif +#endif // if defined(JSON_HEDLEY_TI_CL2000_VERSION) #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) - #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif + #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \ + (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif // if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) #if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) #if defined(JSON_HEDLEY_TI_CL2000_VERSION) - #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_TI_CL2000_VERSION) #if defined(JSON_HEDLEY_TI_CL430_VERSION) #undef JSON_HEDLEY_TI_CL430_VERSION -#endif +#endif // if defined(JSON_HEDLEY_TI_CL430_VERSION) #if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) - #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif + #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \ + (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif // if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) #if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) #if defined(JSON_HEDLEY_TI_CL430_VERSION) - #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_TI_CL430_VERSION) #if defined(JSON_HEDLEY_TI_ARMCL_VERSION) #undef JSON_HEDLEY_TI_ARMCL_VERSION -#endif +#endif // if defined(JSON_HEDLEY_TI_ARMCL_VERSION) #if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) - #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif + #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \ + (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif // if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) #if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) #if defined(JSON_HEDLEY_TI_ARMCL_VERSION) - #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_TI_ARMCL_VERSION) #if defined(JSON_HEDLEY_TI_CL6X_VERSION) #undef JSON_HEDLEY_TI_CL6X_VERSION -#endif +#endif // if defined(JSON_HEDLEY_TI_CL6X_VERSION) #if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) - #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif + #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \ + (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif // if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) #if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) #if defined(JSON_HEDLEY_TI_CL6X_VERSION) - #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_TI_CL6X_VERSION) #if defined(JSON_HEDLEY_TI_CL7X_VERSION) #undef JSON_HEDLEY_TI_CL7X_VERSION -#endif +#endif // if defined(JSON_HEDLEY_TI_CL7X_VERSION) #if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) - #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif + #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \ + (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif // if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) #if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) #if defined(JSON_HEDLEY_TI_CL7X_VERSION) - #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_TI_CL7X_VERSION) #if defined(JSON_HEDLEY_TI_CLPRU_VERSION) #undef JSON_HEDLEY_TI_CLPRU_VERSION -#endif +#endif // if defined(JSON_HEDLEY_TI_CLPRU_VERSION) #if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) - #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) -#endif + #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, \ + (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif // if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) #if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) #if defined(JSON_HEDLEY_TI_CLPRU_VERSION) - #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_TI_CLPRU_VERSION) #if defined(JSON_HEDLEY_CRAY_VERSION) #undef JSON_HEDLEY_CRAY_VERSION -#endif +#endif // if defined(JSON_HEDLEY_CRAY_VERSION) #if defined(_CRAYC) #if defined(_RELEASE_PATCHLEVEL) #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) #else #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) - #endif -#endif + #endif // if defined(_RELEASE_PATCHLEVEL) +#endif // if defined(_CRAYC) #if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) #undef JSON_HEDLEY_CRAY_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) #if defined(JSON_HEDLEY_CRAY_VERSION) - #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_CRAY_VERSION) #if defined(JSON_HEDLEY_IAR_VERSION) #undef JSON_HEDLEY_IAR_VERSION -#endif +#endif // if defined(JSON_HEDLEY_IAR_VERSION) #if defined(__IAR_SYSTEMS_ICC__) #if __VER__ > 1000 - #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), \ + (__VER__ % 1000)) #else #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(VER / 100, __VER__ % 100, 0) - #endif -#endif + #endif // if __VER__ > 1000 +#endif // if defined(__IAR_SYSTEMS_ICC__) #if defined(JSON_HEDLEY_IAR_VERSION_CHECK) #undef JSON_HEDLEY_IAR_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_IAR_VERSION_CHECK) #if defined(JSON_HEDLEY_IAR_VERSION) - #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_IAR_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_IAR_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_IAR_VERSION) #if defined(JSON_HEDLEY_TINYC_VERSION) #undef JSON_HEDLEY_TINYC_VERSION -#endif +#endif // if defined(JSON_HEDLEY_TINYC_VERSION) #if defined(__TINYC__) - #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) -#endif + #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, \ + __TINYC__ % 100) +#endif // if defined(__TINYC__) #if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) #undef JSON_HEDLEY_TINYC_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) #if defined(JSON_HEDLEY_TINYC_VERSION) - #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_TINYC_VERSION) #if defined(JSON_HEDLEY_DMC_VERSION) #undef JSON_HEDLEY_DMC_VERSION -#endif +#endif // if defined(JSON_HEDLEY_DMC_VERSION) #if defined(__DMC__) #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) -#endif +#endif // if defined(__DMC__) #if defined(JSON_HEDLEY_DMC_VERSION_CHECK) #undef JSON_HEDLEY_DMC_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_DMC_VERSION_CHECK) #if defined(JSON_HEDLEY_DMC_VERSION) - #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_DMC_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_DMC_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_DMC_VERSION) #if defined(JSON_HEDLEY_COMPCERT_VERSION) #undef JSON_HEDLEY_COMPCERT_VERSION -#endif +#endif // if defined(JSON_HEDLEY_COMPCERT_VERSION) #if defined(__COMPCERT_VERSION__) - #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) -#endif + #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, \ + (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) +#endif // if defined(__COMPCERT_VERSION__) #if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) #if defined(JSON_HEDLEY_COMPCERT_VERSION) - #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_COMPCERT_VERSION) #if defined(JSON_HEDLEY_PELLES_VERSION) #undef JSON_HEDLEY_PELLES_VERSION -#endif +#endif // if defined(JSON_HEDLEY_PELLES_VERSION) #if defined(__POCC__) #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) -#endif +#endif // if defined(__POCC__) #if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) #undef JSON_HEDLEY_PELLES_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) #if defined(JSON_HEDLEY_PELLES_VERSION) - #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_PELLES_VERSION) #if defined(JSON_HEDLEY_GCC_VERSION) #undef JSON_HEDLEY_GCC_VERSION -#endif +#endif // if defined(JSON_HEDLEY_GCC_VERSION) #if \ defined(JSON_HEDLEY_GNUC_VERSION) && \ !defined(__clang__) && \ @@ -585,295 +632,310 @@ struct position_t !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ !defined(__COMPCERT__) #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION -#endif +#endif // if defined(JSON_HEDLEY_GNUC_VERSION) && !defined(__clang__) && !defined(JSON_HEDLEY_INTEL_VERSION) && !defined(JSON_HEDLEY_PGI_VERSION) && !defined(JSON_HEDLEY_ARM_VERSION) && !defined(JSON_HEDLEY_TI_VERSION) && !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && !defined(JSON_HEDLEY_TI_CL430_VERSION) && !defined(JSON_HEDLEY_TI_CL2000_VERSION) && !defined(JSON_HEDLEY_TI_CL6X_VERSION) && !defined(JSON_HEDLEY_TI_CL7X_VERSION) && !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && !defined(__COMPCERT__) #if defined(JSON_HEDLEY_GCC_VERSION_CHECK) #undef JSON_HEDLEY_GCC_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_GCC_VERSION_CHECK) #if defined(JSON_HEDLEY_GCC_VERSION) - #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) + #define JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, \ + patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) #else - #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) -#endif + #define JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) (0) +#endif // if defined(JSON_HEDLEY_GCC_VERSION) #if defined(JSON_HEDLEY_HAS_ATTRIBUTE) #undef JSON_HEDLEY_HAS_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_HAS_ATTRIBUTE) #if defined(__has_attribute) #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) #else #define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) -#endif +#endif // if defined(__has_attribute) #if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) #if defined(__has_attribute) - #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute) + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) __has_attribute(attribute) #else - #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute, major, minor, patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, \ + patch) +#endif // if defined(__has_attribute) #if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) #if defined(__has_attribute) - #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) __has_attribute(attribute) + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute, major, minor, patch) __has_attribute(attribute) #else - #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute, major, minor, patch) JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, \ + patch) +#endif // if defined(__has_attribute) #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) #if \ defined(__has_cpp_attribute) && \ defined(__cplusplus) && \ - (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0)) #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) #else #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) -#endif +#endif // if defined(__has_cpp_attribute) && defined(__cplusplus) && (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0)) #if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS -#endif +#endif // if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) #if !defined(__cplusplus) || !defined(__has_cpp_attribute) - #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns, attribute) (0) #elif \ !defined(JSON_HEDLEY_PGI_VERSION) && \ !defined(JSON_HEDLEY_IAR_VERSION) && \ - (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ - (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) - #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0)) && \ + (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19, 20, 0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns, attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) #else - #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) -#endif + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns, attribute) (0) +#endif // if !defined(__cplusplus) || !defined(__has_cpp_attribute) #if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) #if defined(__has_cpp_attribute) && defined(__cplusplus) - #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) __has_cpp_attribute(attribute) #else - #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major, \ + minor, \ + patch) +#endif // if defined(__has_cpp_attribute) && defined(__cplusplus) #if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) #if defined(__has_cpp_attribute) && defined(__cplusplus) - #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) __has_cpp_attribute(attribute) #else - #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute, major, minor, patch) JSON_HEDLEY_GCC_VERSION_CHECK(major, \ + minor, \ + patch) +#endif // if defined(__has_cpp_attribute) && defined(__cplusplus) #if defined(JSON_HEDLEY_HAS_BUILTIN) #undef JSON_HEDLEY_HAS_BUILTIN -#endif +#endif // if defined(JSON_HEDLEY_HAS_BUILTIN) #if defined(__has_builtin) #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) #else #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) -#endif +#endif // if defined(__has_builtin) #if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) #undef JSON_HEDLEY_GNUC_HAS_BUILTIN -#endif +#endif // if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) #if defined(__has_builtin) - #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin, major, minor, patch) __has_builtin(builtin) #else - #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin, major, minor, patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, \ + patch) +#endif // if defined(__has_builtin) #if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) #undef JSON_HEDLEY_GCC_HAS_BUILTIN -#endif +#endif // if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) #if defined(__has_builtin) - #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin, major, minor, patch) __has_builtin(builtin) #else - #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin, major, minor, patch) JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) +#endif // if defined(__has_builtin) #if defined(JSON_HEDLEY_HAS_FEATURE) #undef JSON_HEDLEY_HAS_FEATURE -#endif +#endif // if defined(JSON_HEDLEY_HAS_FEATURE) #if defined(__has_feature) #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) #else #define JSON_HEDLEY_HAS_FEATURE(feature) (0) -#endif +#endif // if defined(__has_feature) #if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) #undef JSON_HEDLEY_GNUC_HAS_FEATURE -#endif +#endif // if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) #if defined(__has_feature) - #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature, major, minor, patch) __has_feature(feature) #else - #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature, major, minor, patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, \ + patch) +#endif // if defined(__has_feature) #if defined(JSON_HEDLEY_GCC_HAS_FEATURE) #undef JSON_HEDLEY_GCC_HAS_FEATURE -#endif +#endif // if defined(JSON_HEDLEY_GCC_HAS_FEATURE) #if defined(__has_feature) - #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature, major, minor, patch) __has_feature(feature) #else - #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature, major, minor, patch) JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) +#endif // if defined(__has_feature) #if defined(JSON_HEDLEY_HAS_EXTENSION) #undef JSON_HEDLEY_HAS_EXTENSION -#endif +#endif // if defined(JSON_HEDLEY_HAS_EXTENSION) #if defined(__has_extension) #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) #else #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) -#endif +#endif // if defined(__has_extension) #if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) #undef JSON_HEDLEY_GNUC_HAS_EXTENSION -#endif +#endif // if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) #if defined(__has_extension) - #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension, major, minor, patch) __has_extension(extension) #else - #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension, major, minor, patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, \ + patch) +#endif // if defined(__has_extension) #if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) #undef JSON_HEDLEY_GCC_HAS_EXTENSION -#endif +#endif // if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) #if defined(__has_extension) - #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension, major, minor, patch) __has_extension(extension) #else - #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension, major, minor, patch) JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, \ + patch) +#endif // if defined(__has_extension) #if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) #if defined(__has_declspec_attribute) #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) #else #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) -#endif +#endif // if defined(__has_declspec_attribute) #if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) #if defined(__has_declspec_attribute) - #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) __has_declspec_attribute(attribute) #else - #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) JSON_HEDLEY_GNUC_VERSION_CHECK( \ + major, minor, patch) +#endif // if defined(__has_declspec_attribute) #if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) #if defined(__has_declspec_attribute) - #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) __has_declspec_attribute(attribute) #else - #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute, major, minor, patch) JSON_HEDLEY_GCC_VERSION_CHECK(major, \ + minor, \ + patch) +#endif // if defined(__has_declspec_attribute) #if defined(JSON_HEDLEY_HAS_WARNING) #undef JSON_HEDLEY_HAS_WARNING -#endif +#endif // if defined(JSON_HEDLEY_HAS_WARNING) #if defined(__has_warning) #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) #else #define JSON_HEDLEY_HAS_WARNING(warning) (0) -#endif +#endif // if defined(__has_warning) #if defined(JSON_HEDLEY_GNUC_HAS_WARNING) #undef JSON_HEDLEY_GNUC_HAS_WARNING -#endif +#endif // if defined(JSON_HEDLEY_GNUC_HAS_WARNING) #if defined(__has_warning) - #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning, major, minor, patch) __has_warning(warning) #else - #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning, major, minor, patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major, minor, \ + patch) +#endif // if defined(__has_warning) #if defined(JSON_HEDLEY_GCC_HAS_WARNING) #undef JSON_HEDLEY_GCC_HAS_WARNING -#endif +#endif // if defined(JSON_HEDLEY_GCC_HAS_WARNING) #if defined(__has_warning) - #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) + #define JSON_HEDLEY_GCC_HAS_WARNING(warning, major, minor, patch) __has_warning(warning) #else - #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GCC_HAS_WARNING(warning, major, minor, patch) JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, patch) +#endif // if defined(__has_warning) #if \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ defined(__clang__) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ - JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ - (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) + JSON_HEDLEY_GCC_VERSION_CHECK(3, 0, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18, 4, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 7, 0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2, 0, 1) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 1, 0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 0, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(5, 0, 0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0, 9, 17) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(8, 0, 0) || \ + (JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) && defined(__C99_PRAGMA_OPERATOR)) #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15, 0, 0) #define JSON_HEDLEY_PRAGMA(value) __pragma(value) #else #define JSON_HEDLEY_PRAGMA(value) -#endif +#endif // if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || defined(__clang__) || JSON_HEDLEY_GCC_VERSION_CHECK(3, 0, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) || JSON_HEDLEY_PGI_VERSION_CHECK(18, 4, 0) || JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 7, 0) || JSON_HEDLEY_TI_CL430_VERSION_CHECK(2, 0, 1) || JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 1, 0) || JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 0, 0) || JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || JSON_HEDLEY_CRAY_VERSION_CHECK(5, 0, 0) || JSON_HEDLEY_TINYC_VERSION_CHECK(0, 9, 17) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(8, 0, 0) || (JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) && defined(__C99_PRAGMA_OPERATOR)) #if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) #undef JSON_HEDLEY_DIAGNOSTIC_PUSH -#endif +#endif // if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) #if defined(JSON_HEDLEY_DIAGNOSTIC_POP) #undef JSON_HEDLEY_DIAGNOSTIC_POP -#endif +#endif // if defined(JSON_HEDLEY_DIAGNOSTIC_POP) #if defined(__clang__) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4, 6, 0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") #elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + JSON_HEDLEY_MSVC_VERSION_CHECK(15, 0, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) -#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) +#elif JSON_HEDLEY_ARM_VERSION_CHECK(5, 6, 0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") #elif \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 4, 0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8, 1, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2, 90, 0) #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") #else #define JSON_HEDLEY_DIAGNOSTIC_PUSH #define JSON_HEDLEY_DIAGNOSTIC_POP -#endif +#endif // if defined(__clang__) /* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ -#endif +#endif // if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) #if defined(__cplusplus) # if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") # if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") @@ -892,60 +954,60 @@ struct position_t _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ xpr \ JSON_HEDLEY_DIAGNOSTIC_POP -# endif +# endif // if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") # else # define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ xpr \ JSON_HEDLEY_DIAGNOSTIC_POP -# endif -# endif -#endif +# endif // if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") +# endif // if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") +#endif // if defined(__cplusplus) #if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x -#endif +#endif // if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) #if defined(JSON_HEDLEY_CONST_CAST) #undef JSON_HEDLEY_CONST_CAST -#endif +#endif // if defined(JSON_HEDLEY_CONST_CAST) #if defined(__cplusplus) # define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) #elif \ - JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4, 6, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) # define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ - ((T) (expr)); \ + ((T) (expr)); \ JSON_HEDLEY_DIAGNOSTIC_POP \ })) #else # define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) -#endif +#endif // if defined(__cplusplus) #if defined(JSON_HEDLEY_REINTERPRET_CAST) #undef JSON_HEDLEY_REINTERPRET_CAST -#endif +#endif // if defined(JSON_HEDLEY_REINTERPRET_CAST) #if defined(__cplusplus) #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) #else #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) -#endif +#endif // if defined(__cplusplus) #if defined(JSON_HEDLEY_STATIC_CAST) #undef JSON_HEDLEY_STATIC_CAST -#endif +#endif // if defined(JSON_HEDLEY_STATIC_CAST) #if defined(__cplusplus) #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) #else #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) -#endif +#endif // if defined(__cplusplus) #if defined(JSON_HEDLEY_CPP_CAST) #undef JSON_HEDLEY_CPP_CAST -#endif +#endif // if defined(JSON_HEDLEY_CPP_CAST) #if defined(__cplusplus) # if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") # define JSON_HEDLEY_CPP_CAST(T, expr) \ @@ -953,226 +1015,232 @@ struct position_t _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ ((T) (expr)) \ JSON_HEDLEY_DIAGNOSTIC_POP -# elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) +# elif JSON_HEDLEY_IAR_VERSION_CHECK(8, 3, 0) # define JSON_HEDLEY_CPP_CAST(T, expr) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("diag_suppress=Pe137") \ JSON_HEDLEY_DIAGNOSTIC_POP # else # define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) -# endif +# endif // if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") #else # define JSON_HEDLEY_CPP_CAST(T, expr) (expr) -#endif +#endif // if defined(__cplusplus) #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED -#endif +#endif // if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) #if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") -#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) -#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20, 7, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") -#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4, 3, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) #elif \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) && !defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma \ + ("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) && defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2, 90, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED -#endif +#endif // if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS -#endif +#endif // if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") -#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) -#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4, 3, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) #elif \ - JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) + JSON_HEDLEY_TI_VERSION_CHECK(16, 9, 0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8, 0, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 3, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") -#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS -#endif +#endif // if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES -#endif +#endif // if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) #if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) - #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma \ + ("clang diagnostic ignored \"-Wunknown-attributes\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4, 6, 0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma \ + ("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") -#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) -#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) -#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20, 7, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") -#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 14, 0) && defined(__cplusplus) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") #elif \ - JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) + JSON_HEDLEY_TI_VERSION_CHECK(18, 1, 0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8, 3, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES -#endif +#endif // if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") #if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL -#endif +#endif // if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) #if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") -#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3, 0, 0) #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") #else #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL -#endif +#endif // if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") #if defined(JSON_HEDLEY_DEPRECATED) #undef JSON_HEDLEY_DEPRECATED -#endif +#endif // if defined(JSON_HEDLEY_DEPRECATED) #if defined(JSON_HEDLEY_DEPRECATED_FOR) #undef JSON_HEDLEY_DEPRECATED_FOR -#endif +#endif // if defined(JSON_HEDLEY_DEPRECATED_FOR) #if \ - JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + JSON_HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) #elif \ JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) + JSON_HEDLEY_GCC_VERSION_CHECK(4, 5, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5, 6, 0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 13, 0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(18, 1, 0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18, 1, 0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8, 3, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 3, 0) #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) - #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) + #define JSON_HEDLEY_DEPRECATED_FOR(since, \ + replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) #elif defined(__cplusplus) && (__cplusplus >= 201402L) - #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) - #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) + #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_( \ + [[deprecated("Since " #since)]]) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_( \ + [[deprecated("Since " #since "; use " #replacement)]]) #elif \ JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + JSON_HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) #elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ - JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + JSON_HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || \ + JSON_HEDLEY_PELLES_VERSION_CHECK(6, 50, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") #else #define JSON_HEDLEY_DEPRECATED(since) #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) -#endif +#endif // if JSON_HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) || JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #if defined(JSON_HEDLEY_UNAVAILABLE) #undef JSON_HEDLEY_UNAVAILABLE -#endif +#endif // if defined(JSON_HEDLEY_UNAVAILABLE) #if \ JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + JSON_HEDLEY_GCC_VERSION_CHECK(4, 3, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) #else #define JSON_HEDLEY_UNAVAILABLE(available_since) -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(warning) || JSON_HEDLEY_GCC_VERSION_CHECK(4, 3, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) #undef JSON_HEDLEY_WARN_UNUSED_RESULT -#endif +#endif // if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) #if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG -#endif +#endif // if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) #if \ JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + JSON_HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0) && defined(__cplusplus)) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) #elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) @@ -1187,27 +1255,27 @@ struct position_t #else #define JSON_HEDLEY_WARN_UNUSED_RESULT #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || JSON_HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0) && defined(__cplusplus)) || JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) #if defined(JSON_HEDLEY_SENTINEL) #undef JSON_HEDLEY_SENTINEL -#endif +#endif // if defined(JSON_HEDLEY_SENTINEL) #if \ JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) + JSON_HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5, 4, 0) #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) #else #define JSON_HEDLEY_SENTINEL(position) -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || JSON_HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_ARM_VERSION_CHECK(5, 4, 0) #if defined(JSON_HEDLEY_NO_RETURN) #undef JSON_HEDLEY_NO_RETURN -#endif -#if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +#endif // if defined(JSON_HEDLEY_NO_RETURN) +#if JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_NO_RETURN __noreturn -#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #define JSON_HEDLEY_NO_RETURN _Noreturn @@ -1215,225 +1283,235 @@ struct position_t #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) #elif \ JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + JSON_HEDLEY_GCC_VERSION_CHECK(3, 2, 0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0) #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") #elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + JSON_HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) -#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6, 0, 0) && defined(__cplusplus) #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") -#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3, 2, 0) #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9, 0, 0) #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) #else #define JSON_HEDLEY_NO_RETURN -#endif +#endif // if JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) #if defined(JSON_HEDLEY_NO_ESCAPE) #undef JSON_HEDLEY_NO_ESCAPE -#endif +#endif // if defined(JSON_HEDLEY_NO_ESCAPE) #if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) #else #define JSON_HEDLEY_NO_ESCAPE -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) #if defined(JSON_HEDLEY_UNREACHABLE) #undef JSON_HEDLEY_UNREACHABLE -#endif +#endif // if defined(JSON_HEDLEY_UNREACHABLE) #if defined(JSON_HEDLEY_UNREACHABLE_RETURN) #undef JSON_HEDLEY_UNREACHABLE_RETURN -#endif +#endif // if defined(JSON_HEDLEY_UNREACHABLE_RETURN) #if defined(JSON_HEDLEY_ASSUME) #undef JSON_HEDLEY_ASSUME -#endif +#endif // if defined(JSON_HEDLEY_ASSUME) #if \ - JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + JSON_HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #define JSON_HEDLEY_ASSUME(expr) __assume(expr) #elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) #elif \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 2, 0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4, 0, 0) #if defined(__cplusplus) #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) #else #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) - #endif -#endif + #endif // if defined(__cplusplus) +#endif // if JSON_HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #if \ (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) + JSON_HEDLEY_GCC_VERSION_CHECK(4, 5, 0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18, 10, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13, 1, 5) #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() #elif defined(JSON_HEDLEY_ASSUME) #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) -#endif +#endif // if (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || JSON_HEDLEY_GCC_VERSION_CHECK(4, 5, 0) || JSON_HEDLEY_PGI_VERSION_CHECK(18, 10, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_IBM_VERSION_CHECK(13, 1, 5) #if !defined(JSON_HEDLEY_ASSUME) #if defined(JSON_HEDLEY_UNREACHABLE) #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) #else #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) - #endif -#endif + #endif // if defined(JSON_HEDLEY_UNREACHABLE) +#endif // if !defined(JSON_HEDLEY_ASSUME) #if defined(JSON_HEDLEY_UNREACHABLE) #if \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) - #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 2, 0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4, 0, 0) + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), \ + (value)) #else #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() - #endif + #endif // if JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 2, 0) || JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4, 0, 0) #else #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) -#endif +#endif // if defined(JSON_HEDLEY_UNREACHABLE) #if !defined(JSON_HEDLEY_UNREACHABLE) #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) -#endif +#endif // if !defined(JSON_HEDLEY_UNREACHABLE) JSON_HEDLEY_DIAGNOSTIC_PUSH #if JSON_HEDLEY_HAS_WARNING("-Wpedantic") #pragma clang diagnostic ignored "-Wpedantic" -#endif +#endif // if JSON_HEDLEY_HAS_WARNING("-Wpedantic") #if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" -#endif -#if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) +#endif // if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) +#if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros", 4, 0, 0) #if defined(__clang__) #pragma clang diagnostic ignored "-Wvariadic-macros" #elif defined(JSON_HEDLEY_GCC_VERSION) #pragma GCC diagnostic ignored "-Wvariadic-macros" - #endif -#endif + #endif // if defined(__clang__) +#endif // if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros", 4, 0, 0) #if defined(JSON_HEDLEY_NON_NULL) #undef JSON_HEDLEY_NON_NULL -#endif +#endif // if defined(JSON_HEDLEY_NON_NULL) #if \ JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + JSON_HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) #else #define JSON_HEDLEY_NON_NULL(...) -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || JSON_HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) JSON_HEDLEY_DIAGNOSTIC_POP #if defined(JSON_HEDLEY_PRINTF_FORMAT) #undef JSON_HEDLEY_PRINTF_FORMAT -#endif -#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) - #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) -#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) - #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) +#endif // if defined(JSON_HEDLEY_PRINTF_FORMAT) +#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format, 4, 4, 0) && !defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx, \ + first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) +#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format, 4, 4, 0) && defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx, \ + first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) #elif \ JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) - #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) - #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) + JSON_HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5, 6, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx, \ + first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6, 0, 0) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) __declspec(vaformat(printf, string_idx, \ + first_to_check)) #else - #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) -#endif + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx, first_to_check) +#endif // if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format, 4, 4, 0) && !defined(__USE_MINGW_ANSI_STDIO) #if defined(JSON_HEDLEY_CONSTEXPR) #undef JSON_HEDLEY_CONSTEXPR -#endif +#endif // if defined(JSON_HEDLEY_CONSTEXPR) #if defined(__cplusplus) #if __cplusplus >= 201103L #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) - #endif -#endif + #endif // if __cplusplus >= 201103L +#endif // if defined(__cplusplus) #if !defined(JSON_HEDLEY_CONSTEXPR) #define JSON_HEDLEY_CONSTEXPR -#endif +#endif // if !defined(JSON_HEDLEY_CONSTEXPR) #if defined(JSON_HEDLEY_PREDICT) #undef JSON_HEDLEY_PREDICT -#endif +#endif // if defined(JSON_HEDLEY_PREDICT) #if defined(JSON_HEDLEY_LIKELY) #undef JSON_HEDLEY_LIKELY -#endif +#endif // if defined(JSON_HEDLEY_LIKELY) #if defined(JSON_HEDLEY_UNLIKELY) #undef JSON_HEDLEY_UNLIKELY -#endif +#endif // if defined(JSON_HEDLEY_UNLIKELY) #if defined(JSON_HEDLEY_UNPREDICTABLE) #undef JSON_HEDLEY_UNPREDICTABLE -#endif +#endif // if defined(JSON_HEDLEY_UNPREDICTABLE) #if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) -#endif +#endif // if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) #if \ - (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) -# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) -# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) -# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) -# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) -# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(9, 0, 0) +# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability((expr), (value), \ + (probability)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1, (probability)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0, (probability)) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), \ + 1 ) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), \ + 0 ) #elif \ - (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ - JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3, 0, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 15, 0) && defined(__cplusplus)) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 7, 0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3, 1, 0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 1, 0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6, 1, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0, 9, 27) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8, 1, 0) # define JSON_HEDLEY_PREDICT(expr, expected, probability) \ (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) # define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ (__extension__ ({ \ double hedley_probability_ = (probability); \ - ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), \ + 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ })) # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ (__extension__ ({ \ double hedley_probability_ = (probability); \ - ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), \ + 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ })) # define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) # define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) @@ -1443,253 +1521,253 @@ JSON_HEDLEY_DIAGNOSTIC_POP # define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) # define JSON_HEDLEY_LIKELY(expr) (!!(expr)) # define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) -#endif +#endif // if (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || JSON_HEDLEY_GCC_VERSION_CHECK(9, 0, 0) #if !defined(JSON_HEDLEY_UNPREDICTABLE) #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) -#endif +#endif // if !defined(JSON_HEDLEY_UNPREDICTABLE) #if defined(JSON_HEDLEY_MALLOC) #undef JSON_HEDLEY_MALLOC -#endif +#endif // if defined(JSON_HEDLEY_MALLOC) #if \ JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + JSON_HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12, 1, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0) #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") #elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + JSON_HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #define JSON_HEDLEY_MALLOC __declspec(restrict) #else #define JSON_HEDLEY_MALLOC -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || JSON_HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || JSON_HEDLEY_IBM_VERSION_CHECK(12, 1, 0) || JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) #if defined(JSON_HEDLEY_PURE) #undef JSON_HEDLEY_PURE -#endif +#endif // if defined(JSON_HEDLEY_PURE) #if \ - JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2, 96, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) # define JSON_HEDLEY_PURE __attribute__((__pure__)) -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0) # define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") #elif defined(__cplusplus) && \ ( \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2, 0, 1) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4, 0, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) \ ) # define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") #else # define JSON_HEDLEY_PURE -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(pure) || JSON_HEDLEY_GCC_VERSION_CHECK(2, 96, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) #if defined(JSON_HEDLEY_CONST) #undef JSON_HEDLEY_CONST -#endif +#endif // if defined(JSON_HEDLEY_CONST) #if \ JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + JSON_HEDLEY_GCC_VERSION_CHECK(2, 5, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) #define JSON_HEDLEY_CONST __attribute__((__const__)) #elif \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0) #define JSON_HEDLEY_CONST _Pragma("no_side_effect") #else #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(const) || JSON_HEDLEY_GCC_VERSION_CHECK(2, 5, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) || JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) #if defined(JSON_HEDLEY_RESTRICT) #undef JSON_HEDLEY_RESTRICT -#endif +#endif // if defined(JSON_HEDLEY_RESTRICT) #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) #define JSON_HEDLEY_RESTRICT restrict #elif \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ - JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3, 1, 0) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14, 0, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17, 10, 0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 2, 4) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8, 1, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 14, 0) && defined(__cplusplus)) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) || \ defined(__clang__) #define JSON_HEDLEY_RESTRICT __restrict -#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 3, 0) && !defined(__cplusplus) #define JSON_HEDLEY_RESTRICT _Restrict #else #define JSON_HEDLEY_RESTRICT -#endif +#endif // if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) #if defined(JSON_HEDLEY_INLINE) #undef JSON_HEDLEY_INLINE -#endif +#endif // if defined(JSON_HEDLEY_INLINE) #if \ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ (defined(__cplusplus) && (__cplusplus >= 199711L)) #define JSON_HEDLEY_INLINE inline #elif \ defined(JSON_HEDLEY_GCC_VERSION) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) + JSON_HEDLEY_ARM_VERSION_CHECK(6, 2, 0) #define JSON_HEDLEY_INLINE __inline__ #elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + JSON_HEDLEY_MSVC_VERSION_CHECK(12, 0, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 1, 0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3, 1, 0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 2, 0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8, 0, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) #define JSON_HEDLEY_INLINE __inline #else #define JSON_HEDLEY_INLINE -#endif +#endif // if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || (defined(__cplusplus) && (__cplusplus >= 199711L)) #if defined(JSON_HEDLEY_ALWAYS_INLINE) #undef JSON_HEDLEY_ALWAYS_INLINE -#endif +#endif // if defined(JSON_HEDLEY_ALWAYS_INLINE) #if \ - JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) # define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE #elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + JSON_HEDLEY_MSVC_VERSION_CHECK(12, 0, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) # define JSON_HEDLEY_ALWAYS_INLINE __forceinline #elif defined(__cplusplus) && \ ( \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6, 1, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) \ ) # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) # define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") #else # define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || JSON_HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) #if defined(JSON_HEDLEY_NEVER_INLINE) #undef JSON_HEDLEY_NEVER_INLINE -#endif +#endif // if defined(JSON_HEDLEY_NEVER_INLINE) #if \ JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ - JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ - (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ - (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ - (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ - JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ - JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + JSON_HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) #elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + JSON_HEDLEY_MSVC_VERSION_CHECK(13, 10, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) -#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(10, 2, 0) #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") -#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6, 0, 0) && defined(__cplusplus) #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") -#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3, 2, 0) #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9, 0, 0) #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) #else #define JSON_HEDLEY_NEVER_INLINE -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || JSON_HEDLEY_GCC_VERSION_CHECK(4, 0, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || JSON_HEDLEY_IBM_VERSION_CHECK(10, 1, 0) || JSON_HEDLEY_TI_VERSION_CHECK(15, 12, 0) || (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4, 8, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5, 2, 0) || (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6, 4, 0) || (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 0, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL430_VERSION_CHECK(4, 3, 0) || (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) || JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1, 2, 0) || JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2, 1, 0) #if defined(JSON_HEDLEY_PRIVATE) #undef JSON_HEDLEY_PRIVATE -#endif +#endif // if defined(JSON_HEDLEY_PRIVATE) #if defined(JSON_HEDLEY_PUBLIC) #undef JSON_HEDLEY_PUBLIC -#endif +#endif // if defined(JSON_HEDLEY_PUBLIC) #if defined(JSON_HEDLEY_IMPORT) #undef JSON_HEDLEY_IMPORT -#endif +#endif // if defined(JSON_HEDLEY_IMPORT) #if defined(_WIN32) || defined(__CYGWIN__) # define JSON_HEDLEY_PRIVATE # define JSON_HEDLEY_PUBLIC __declspec(dllexport) @@ -1697,52 +1775,52 @@ JSON_HEDLEY_DIAGNOSTIC_POP #else # if \ JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ - JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || \ + ( \ + defined(__TI_EABI__) && \ ( \ - defined(__TI_EABI__) && \ - ( \ - (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ - ) \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) \ + ) \ ) # define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) # define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) # else # define JSON_HEDLEY_PRIVATE # define JSON_HEDLEY_PUBLIC -# endif +# endif // if JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || JSON_HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 11, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || JSON_HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || ( defined(__TI_EABI__) && ( (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 2, 0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7, 5, 0) ) ) # define JSON_HEDLEY_IMPORT extern -#endif +#endif // if defined(_WIN32) || defined(__CYGWIN__) #if defined(JSON_HEDLEY_NO_THROW) #undef JSON_HEDLEY_NO_THROW -#endif +#endif // if defined(JSON_HEDLEY_NO_THROW) #if \ JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + JSON_HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) #elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + JSON_HEDLEY_MSVC_VERSION_CHECK(13, 1, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) #define JSON_HEDLEY_NO_THROW __declspec(nothrow) #else #define JSON_HEDLEY_NO_THROW -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || JSON_HEDLEY_GCC_VERSION_CHECK(3, 3, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) #if defined(JSON_HEDLEY_FALL_THROUGH) #undef JSON_HEDLEY_FALL_THROUGH -#endif +#endif // if defined(JSON_HEDLEY_FALL_THROUGH) #if \ JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) + JSON_HEDLEY_GCC_VERSION_CHECK(7, 0, 0) #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) -#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang, fallthrough) #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) #elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) @@ -1750,24 +1828,24 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_HEDLEY_FALL_THROUGH __fallthrough #else #define JSON_HEDLEY_FALL_THROUGH -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || JSON_HEDLEY_GCC_VERSION_CHECK(7, 0, 0) #if defined(JSON_HEDLEY_RETURNS_NON_NULL) #undef JSON_HEDLEY_RETURNS_NON_NULL -#endif +#endif // if defined(JSON_HEDLEY_RETURNS_NON_NULL) #if \ JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) + JSON_HEDLEY_GCC_VERSION_CHECK(4, 9, 0) #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) #elif defined(_Ret_notnull_) /* SAL */ #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ #else #define JSON_HEDLEY_RETURNS_NON_NULL -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || JSON_HEDLEY_GCC_VERSION_CHECK(4, 9, 0) #if defined(JSON_HEDLEY_ARRAY_PARAM) #undef JSON_HEDLEY_ARRAY_PARAM -#endif +#endif // if defined(JSON_HEDLEY_ARRAY_PARAM) #if \ defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ !defined(__STDC_NO_VLA__) && \ @@ -1777,106 +1855,110 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_HEDLEY_ARRAY_PARAM(name) (name) #else #define JSON_HEDLEY_ARRAY_PARAM(name) -#endif +#endif // if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__STDC_NO_VLA__) && !defined(__cplusplus) && !defined(JSON_HEDLEY_PGI_VERSION) && !defined(JSON_HEDLEY_TINYC_VERSION) #if defined(JSON_HEDLEY_IS_CONSTANT) #undef JSON_HEDLEY_IS_CONSTANT -#endif +#endif // if defined(JSON_HEDLEY_IS_CONSTANT) #if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) #undef JSON_HEDLEY_REQUIRE_CONSTEXPR -#endif +#endif // if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) /* JSON_HEDLEY_IS_CONSTEXPR_ is for HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ #if defined(JSON_HEDLEY_IS_CONSTEXPR_) #undef JSON_HEDLEY_IS_CONSTEXPR_ -#endif +#endif // if defined(JSON_HEDLEY_IS_CONSTEXPR_) #if \ JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ - JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ - (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ - JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) + JSON_HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0, 9, 19) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6, 1, 0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0) && !defined(__cplusplus)) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8, 1, 0) #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) -#endif +#endif // if JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || JSON_HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_TINYC_VERSION_CHECK(0, 9, 19) || JSON_HEDLEY_ARM_VERSION_CHECK(4, 1, 0) || JSON_HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6, 1, 0) || (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5, 10, 0) && !defined(__cplusplus)) || JSON_HEDLEY_CRAY_VERSION_CHECK(8, 1, 0) #if !defined(__cplusplus) # if \ - JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ - JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ - JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) + JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8, 1, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5, 4, 0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0, 9, 24) #if defined(__INTPTR_TYPE__) - #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) (( \ + expr) * 0)) : (int*) 0)), int*) #else #include - #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) -#endif + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * \ + 0)) : (int*) 0)), int*) +#endif // if defined(__INTPTR_TYPE__) # elif \ - ( \ - defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ - !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ - !defined(JSON_HEDLEY_PGI_VERSION) && \ - !defined(JSON_HEDLEY_IAR_VERSION)) || \ - JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ - JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ - JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) + ( \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4, 9, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(17, 0, 0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12, 1, 0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5, 3, 0) #if defined(__INTPTR_TYPE__) - #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, \ + void*: 0) #else #include #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) -#endif +#endif // if defined(__INTPTR_TYPE__) # elif \ - defined(JSON_HEDLEY_GCC_VERSION) || \ - defined(JSON_HEDLEY_INTEL_VERSION) || \ - defined(JSON_HEDLEY_TINYC_VERSION) || \ - defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ - JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ - defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ - defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ - defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ - defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ - defined(__clang__) + defined(JSON_HEDLEY_GCC_VERSION) || \ + defined(JSON_HEDLEY_INTEL_VERSION) || \ + defined(JSON_HEDLEY_TINYC_VERSION) || \ + defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(18, 12, 0) || \ + defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ + defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ + defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ + defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ + defined(__clang__) # define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ sizeof(void) != \ sizeof(*( \ - 1 ? \ - ((void*) ((expr) * 0L) ) : \ -((struct { char v[sizeof(void) * 2]; } *) 1) \ - ) \ - ) \ - ) -# endif -#endif + 1 ? \ + ((void*) ((expr) * 0L)) : \ + ((struct { char v[sizeof(void) * 2]; } \ + *) 1) \ + ) \ + ) \ + ) +# endif // if JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || JSON_HEDLEY_GCC_VERSION_CHECK(3, 4, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || JSON_HEDLEY_IBM_VERSION_CHECK(13, 1, 0) || JSON_HEDLEY_CRAY_VERSION_CHECK(8, 1, 0) || JSON_HEDLEY_ARM_VERSION_CHECK(5, 4, 0) || JSON_HEDLEY_TINYC_VERSION_CHECK(0, 9, 24) +#endif // if !defined(__cplusplus) #if defined(JSON_HEDLEY_IS_CONSTEXPR_) #if !defined(JSON_HEDLEY_IS_CONSTANT) #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) - #endif + #endif // if !defined(JSON_HEDLEY_IS_CONSTANT) #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) #else #if !defined(JSON_HEDLEY_IS_CONSTANT) #define JSON_HEDLEY_IS_CONSTANT(expr) (0) - #endif + #endif // if !defined(JSON_HEDLEY_IS_CONSTANT) #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) -#endif +#endif // if defined(JSON_HEDLEY_IS_CONSTEXPR_) #if defined(JSON_HEDLEY_BEGIN_C_DECLS) #undef JSON_HEDLEY_BEGIN_C_DECLS -#endif +#endif // if defined(JSON_HEDLEY_BEGIN_C_DECLS) #if defined(JSON_HEDLEY_END_C_DECLS) #undef JSON_HEDLEY_END_C_DECLS -#endif +#endif // if defined(JSON_HEDLEY_END_C_DECLS) #if defined(JSON_HEDLEY_C_DECL) #undef JSON_HEDLEY_C_DECL -#endif +#endif // if defined(JSON_HEDLEY_C_DECL) #if defined(__cplusplus) #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { #define JSON_HEDLEY_END_C_DECLS } @@ -1885,32 +1967,33 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_HEDLEY_BEGIN_C_DECLS #define JSON_HEDLEY_END_C_DECLS #define JSON_HEDLEY_C_DECL -#endif +#endif // if defined(__cplusplus) #if defined(JSON_HEDLEY_STATIC_ASSERT) #undef JSON_HEDLEY_STATIC_ASSERT -#endif +#endif // if defined(JSON_HEDLEY_STATIC_ASSERT) #if \ - !defined(__cplusplus) && ( \ - (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ - (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ - JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ - defined(_Static_assert) \ - ) + !defined(__cplusplus) && ( \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ + (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(6, 0, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || \ + defined(_Static_assert) \ +) # define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) #elif \ - (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ - JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) -# define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) + (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(16, 0, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) +# define JSON_HEDLEY_STATIC_ASSERT(expr, \ + message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) #else # define JSON_HEDLEY_STATIC_ASSERT(expr, message) -#endif +#endif // if !defined(__cplusplus) && ( (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || JSON_HEDLEY_GCC_VERSION_CHECK(6, 0, 0) || JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) || defined(_Static_assert) ) #if defined(JSON_HEDLEY_NULL) #undef JSON_HEDLEY_NULL -#endif +#endif // if defined(JSON_HEDLEY_NULL) #if defined(__cplusplus) #if __cplusplus >= 201103L #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) @@ -1918,16 +2001,16 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_HEDLEY_NULL NULL #else #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) - #endif + #endif // if __cplusplus >= 201103L #elif defined(NULL) #define JSON_HEDLEY_NULL NULL #else #define JSON_HEDLEY_NULL ((void*) 0) -#endif +#endif // if defined(__cplusplus) #if defined(JSON_HEDLEY_MESSAGE) #undef JSON_HEDLEY_MESSAGE -#endif +#endif // if defined(JSON_HEDLEY_MESSAGE) #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") # define JSON_HEDLEY_MESSAGE(msg) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ @@ -1935,22 +2018,22 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_PRAGMA(message msg) \ JSON_HEDLEY_DIAGNOSTIC_POP #elif \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + JSON_HEDLEY_GCC_VERSION_CHECK(4, 4, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) -#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) +#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5, 0, 0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) -#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8, 0, 0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) -#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2, 0, 0) # define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) #else # define JSON_HEDLEY_MESSAGE(msg) -#endif +#endif // if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") #if defined(JSON_HEDLEY_WARNING) #undef JSON_HEDLEY_WARNING -#endif +#endif // if defined(JSON_HEDLEY_WARNING) #if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") # define JSON_HEDLEY_WARNING(msg) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ @@ -1958,24 +2041,24 @@ JSON_HEDLEY_DIAGNOSTIC_POP JSON_HEDLEY_PRAGMA(clang warning msg) \ JSON_HEDLEY_DIAGNOSTIC_POP #elif \ - JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ - JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ - JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + JSON_HEDLEY_GCC_VERSION_CHECK(4, 8, 0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18, 4, 0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13, 0, 0) # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) #elif \ - JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + JSON_HEDLEY_MSVC_VERSION_CHECK(15, 0, 0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) #else # define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) -#endif +#endif // if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") #if defined(JSON_HEDLEY_REQUIRE) #undef JSON_HEDLEY_REQUIRE -#endif +#endif // if defined(JSON_HEDLEY_REQUIRE) #if defined(JSON_HEDLEY_REQUIRE_MSG) #undef JSON_HEDLEY_REQUIRE_MSG -#endif +#endif // if defined(JSON_HEDLEY_REQUIRE_MSG) #if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) # if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") # define JSON_HEDLEY_REQUIRE(expr) \ @@ -1983,98 +2066,99 @@ JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ __attribute__((diagnose_if(!(expr), #expr, "error"))) \ JSON_HEDLEY_DIAGNOSTIC_POP -# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ +# define JSON_HEDLEY_REQUIRE_MSG(expr, msg) \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ __attribute__((diagnose_if(!(expr), msg, "error"))) \ JSON_HEDLEY_DIAGNOSTIC_POP # else # define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) -# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) -# endif +# define JSON_HEDLEY_REQUIRE_MSG(expr, msg) __attribute__((diagnose_if(!(expr), msg, "error"))) +# endif // if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") #else # define JSON_HEDLEY_REQUIRE(expr) -# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) -#endif +# define JSON_HEDLEY_REQUIRE_MSG(expr, msg) +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) #if defined(JSON_HEDLEY_FLAGS) #undef JSON_HEDLEY_FLAGS -#endif +#endif // if defined(JSON_HEDLEY_FLAGS) #if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) #else #define JSON_HEDLEY_FLAGS -#endif +#endif // if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) #if defined(JSON_HEDLEY_FLAGS_CAST) #undef JSON_HEDLEY_FLAGS_CAST -#endif -#if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) +#endif // if defined(JSON_HEDLEY_FLAGS_CAST) +#if JSON_HEDLEY_INTEL_VERSION_CHECK(19, 0, 0) # define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ JSON_HEDLEY_DIAGNOSTIC_PUSH \ _Pragma("warning(disable:188)") \ ((T) (expr)); \ JSON_HEDLEY_DIAGNOSTIC_POP \ - })) + })) #else # define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) -#endif +#endif // if JSON_HEDLEY_INTEL_VERSION_CHECK(19, 0, 0) #if defined(JSON_HEDLEY_EMPTY_BASES) #undef JSON_HEDLEY_EMPTY_BASES -#endif +#endif // if defined(JSON_HEDLEY_EMPTY_BASES) #if \ - (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ - JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + (JSON_HEDLEY_MSVC_VERSION_CHECK(19, 0, 23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20, 0, 0)) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) #else #define JSON_HEDLEY_EMPTY_BASES -#endif +#endif // if (JSON_HEDLEY_MSVC_VERSION_CHECK(19, 0, 23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20, 0, 0)) || JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021, 1, 0) /* Remaining macros are deprecated. */ #if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK -#endif +#endif // if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) #if defined(__clang__) - #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major, minor, patch) (0) #else - #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) -#endif + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major, minor, patch) JSON_HEDLEY_GCC_VERSION_CHECK(major, minor, \ + patch) +#endif // if defined(__clang__) #if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) #define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) #define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) #undef JSON_HEDLEY_CLANG_HAS_BUILTIN -#endif +#endif // if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) #define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) #if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) #undef JSON_HEDLEY_CLANG_HAS_FEATURE -#endif +#endif // if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) #define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) #if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) #undef JSON_HEDLEY_CLANG_HAS_EXTENSION -#endif +#endif // if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) #define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) #if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE -#endif +#endif // if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) #define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) #if defined(JSON_HEDLEY_CLANG_HAS_WARNING) #undef JSON_HEDLEY_CLANG_HAS_WARNING -#endif +#endif // if defined(JSON_HEDLEY_CLANG_HAS_WARNING) #define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) #endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ @@ -2088,13 +2172,13 @@ JSON_HEDLEY_DIAGNOSTIC_POP #if defined(__clang__) #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" - #endif + #endif // if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" - #endif - #endif -#endif + #endif // if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 + #endif // if defined(__clang__) +#endif // if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) // C++ language standard detection #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) @@ -2106,95 +2190,95 @@ JSON_HEDLEY_DIAGNOSTIC_POP #define JSON_HAS_CPP_14 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) #define JSON_HAS_CPP_14 -#endif +#endif // if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) // disable float-equal warnings on GCC/clang #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wfloat-equal" -#endif +#endif // if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) // disable documentation warnings on clang #if defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdocumentation" -#endif +#endif // if defined(__clang__) // allow to disable exceptions #if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) #define JSON_THROW(exception) throw exception #define JSON_TRY try - #define JSON_CATCH(exception) catch(exception) - #define JSON_INTERNAL_CATCH(exception) catch(exception) + #define JSON_CATCH(exception) catch (exception) + #define JSON_INTERNAL_CATCH(exception) catch (exception) #else #include #define JSON_THROW(exception) std::abort() - #define JSON_TRY if(true) - #define JSON_CATCH(exception) if(false) - #define JSON_INTERNAL_CATCH(exception) if(false) -#endif + #define JSON_TRY if (true) + #define JSON_CATCH(exception) if (false) + #define JSON_INTERNAL_CATCH(exception) if (false) +#endif // if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) // override exception macros #if defined(JSON_THROW_USER) #undef JSON_THROW #define JSON_THROW JSON_THROW_USER -#endif +#endif // if defined(JSON_THROW_USER) #if defined(JSON_TRY_USER) #undef JSON_TRY #define JSON_TRY JSON_TRY_USER -#endif +#endif // if defined(JSON_TRY_USER) #if defined(JSON_CATCH_USER) #undef JSON_CATCH #define JSON_CATCH JSON_CATCH_USER #undef JSON_INTERNAL_CATCH #define JSON_INTERNAL_CATCH JSON_CATCH_USER -#endif +#endif // if defined(JSON_CATCH_USER) #if defined(JSON_INTERNAL_CATCH_USER) #undef JSON_INTERNAL_CATCH #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER -#endif +#endif // if defined(JSON_INTERNAL_CATCH_USER) // allow to override assert #if !defined(JSON_ASSERT) #include // assert #define JSON_ASSERT(x) assert(x) -#endif +#endif // if !defined(JSON_ASSERT) // allow to access some private functions (needed by the test suite) #if defined(JSON_TESTS_PRIVATE) #define JSON_PRIVATE_UNLESS_TESTED public #else #define JSON_PRIVATE_UNLESS_TESTED private -#endif +#endif // if defined(JSON_TESTS_PRIVATE) /*! -@brief macro to briefly define a mapping between an enum and JSON -@def NLOHMANN_JSON_SERIALIZE_ENUM -@since version 3.4.0 -*/ + @brief macro to briefly define a mapping between an enum and JSON + @def NLOHMANN_JSON_SERIALIZE_ENUM + @since version 3.4.0 + */ #define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ template \ - inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ + inline void to_json(BasicJsonType & j, const ENUM_TYPE& e) \ { \ static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ static const std::pair m[] = __VA_ARGS__; \ auto it = std::find_if(std::begin(m), std::end(m), \ - [e](const std::pair& ej_pair) -> bool \ - { \ - return ej_pair.first == e; \ - }); \ + [e](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.first == e; \ + }); \ j = ((it != std::end(m)) ? it : std::begin(m))->second; \ } \ template \ - inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ + inline void from_json(const BasicJsonType& j, ENUM_TYPE & e) \ { \ static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ static const std::pair m[] = __VA_ARGS__; \ auto it = std::find_if(std::begin(m), std::end(m), \ - [&j](const std::pair& ej_pair) -> bool \ - { \ - return ej_pair.second == j; \ - }); \ + [&j](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.second == j; \ + }); \ e = ((it != std::end(m)) ? it : std::begin(m))->first; \ } @@ -2202,223 +2286,697 @@ JSON_HEDLEY_DIAGNOSTIC_POP // may be removed in the future once the class is split. #define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ - template class ObjectType, \ - template class ArrayType, \ - class StringType, class BooleanType, class NumberIntegerType, \ - class NumberUnsignedType, class NumberFloatType, \ - template class AllocatorType, \ - template class JSONSerializer, \ - class BinaryType> + template class ObjectType, \ + template class ArrayType, \ + class StringType, class BooleanType, class NumberIntegerType, \ + class NumberUnsignedType, class NumberFloatType, \ + template class AllocatorType, \ + template class JSONSerializer, \ + class BinaryType> #define NLOHMANN_BASIC_JSON_TPL \ basic_json + NumberIntegerType, NumberUnsignedType, NumberFloatType, \ + AllocatorType, JSONSerializer, BinaryType> // Macros to simplify conversion from/to types #define NLOHMANN_JSON_EXPAND( x ) x -#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME +#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, \ + _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, \ + _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, \ + _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME, ...) NAME #define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ - NLOHMANN_JSON_PASTE64, \ - NLOHMANN_JSON_PASTE63, \ - NLOHMANN_JSON_PASTE62, \ - NLOHMANN_JSON_PASTE61, \ - NLOHMANN_JSON_PASTE60, \ - NLOHMANN_JSON_PASTE59, \ - NLOHMANN_JSON_PASTE58, \ - NLOHMANN_JSON_PASTE57, \ - NLOHMANN_JSON_PASTE56, \ - NLOHMANN_JSON_PASTE55, \ - NLOHMANN_JSON_PASTE54, \ - NLOHMANN_JSON_PASTE53, \ - NLOHMANN_JSON_PASTE52, \ - NLOHMANN_JSON_PASTE51, \ - NLOHMANN_JSON_PASTE50, \ - NLOHMANN_JSON_PASTE49, \ - NLOHMANN_JSON_PASTE48, \ - NLOHMANN_JSON_PASTE47, \ - NLOHMANN_JSON_PASTE46, \ - NLOHMANN_JSON_PASTE45, \ - NLOHMANN_JSON_PASTE44, \ - NLOHMANN_JSON_PASTE43, \ - NLOHMANN_JSON_PASTE42, \ - NLOHMANN_JSON_PASTE41, \ - NLOHMANN_JSON_PASTE40, \ - NLOHMANN_JSON_PASTE39, \ - NLOHMANN_JSON_PASTE38, \ - NLOHMANN_JSON_PASTE37, \ - NLOHMANN_JSON_PASTE36, \ - NLOHMANN_JSON_PASTE35, \ - NLOHMANN_JSON_PASTE34, \ - NLOHMANN_JSON_PASTE33, \ - NLOHMANN_JSON_PASTE32, \ - NLOHMANN_JSON_PASTE31, \ - NLOHMANN_JSON_PASTE30, \ - NLOHMANN_JSON_PASTE29, \ - NLOHMANN_JSON_PASTE28, \ - NLOHMANN_JSON_PASTE27, \ - NLOHMANN_JSON_PASTE26, \ - NLOHMANN_JSON_PASTE25, \ - NLOHMANN_JSON_PASTE24, \ - NLOHMANN_JSON_PASTE23, \ - NLOHMANN_JSON_PASTE22, \ - NLOHMANN_JSON_PASTE21, \ - NLOHMANN_JSON_PASTE20, \ - NLOHMANN_JSON_PASTE19, \ - NLOHMANN_JSON_PASTE18, \ - NLOHMANN_JSON_PASTE17, \ - NLOHMANN_JSON_PASTE16, \ - NLOHMANN_JSON_PASTE15, \ - NLOHMANN_JSON_PASTE14, \ - NLOHMANN_JSON_PASTE13, \ - NLOHMANN_JSON_PASTE12, \ - NLOHMANN_JSON_PASTE11, \ - NLOHMANN_JSON_PASTE10, \ - NLOHMANN_JSON_PASTE9, \ - NLOHMANN_JSON_PASTE8, \ - NLOHMANN_JSON_PASTE7, \ - NLOHMANN_JSON_PASTE6, \ - NLOHMANN_JSON_PASTE5, \ - NLOHMANN_JSON_PASTE4, \ - NLOHMANN_JSON_PASTE3, \ - NLOHMANN_JSON_PASTE2, \ - NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) + NLOHMANN_JSON_PASTE64, \ + NLOHMANN_JSON_PASTE63, \ + NLOHMANN_JSON_PASTE62, \ + NLOHMANN_JSON_PASTE61, \ + NLOHMANN_JSON_PASTE60, \ + NLOHMANN_JSON_PASTE59, \ + NLOHMANN_JSON_PASTE58, \ + NLOHMANN_JSON_PASTE57, \ + NLOHMANN_JSON_PASTE56, \ + NLOHMANN_JSON_PASTE55, \ + NLOHMANN_JSON_PASTE54, \ + NLOHMANN_JSON_PASTE53, \ + NLOHMANN_JSON_PASTE52, \ + NLOHMANN_JSON_PASTE51, \ + NLOHMANN_JSON_PASTE50, \ + NLOHMANN_JSON_PASTE49, \ + NLOHMANN_JSON_PASTE48, \ + NLOHMANN_JSON_PASTE47, \ + NLOHMANN_JSON_PASTE46, \ + NLOHMANN_JSON_PASTE45, \ + NLOHMANN_JSON_PASTE44, \ + NLOHMANN_JSON_PASTE43, \ + NLOHMANN_JSON_PASTE42, \ + NLOHMANN_JSON_PASTE41, \ + NLOHMANN_JSON_PASTE40, \ + NLOHMANN_JSON_PASTE39, \ + NLOHMANN_JSON_PASTE38, \ + NLOHMANN_JSON_PASTE37, \ + NLOHMANN_JSON_PASTE36, \ + NLOHMANN_JSON_PASTE35, \ + NLOHMANN_JSON_PASTE34, \ + NLOHMANN_JSON_PASTE33, \ + NLOHMANN_JSON_PASTE32, \ + NLOHMANN_JSON_PASTE31, \ + NLOHMANN_JSON_PASTE30, \ + NLOHMANN_JSON_PASTE29, \ + NLOHMANN_JSON_PASTE28, \ + NLOHMANN_JSON_PASTE27, \ + NLOHMANN_JSON_PASTE26, \ + NLOHMANN_JSON_PASTE25, \ + NLOHMANN_JSON_PASTE24, \ + NLOHMANN_JSON_PASTE23, \ + NLOHMANN_JSON_PASTE22, \ + NLOHMANN_JSON_PASTE21, \ + NLOHMANN_JSON_PASTE20, \ + NLOHMANN_JSON_PASTE19, \ + NLOHMANN_JSON_PASTE18, \ + NLOHMANN_JSON_PASTE17, \ + NLOHMANN_JSON_PASTE16, \ + NLOHMANN_JSON_PASTE15, \ + NLOHMANN_JSON_PASTE14, \ + NLOHMANN_JSON_PASTE13, \ + NLOHMANN_JSON_PASTE12, \ + NLOHMANN_JSON_PASTE11, \ + NLOHMANN_JSON_PASTE10, \ + NLOHMANN_JSON_PASTE9, \ + NLOHMANN_JSON_PASTE8, \ + NLOHMANN_JSON_PASTE7, \ + NLOHMANN_JSON_PASTE6, \ + NLOHMANN_JSON_PASTE5, \ + NLOHMANN_JSON_PASTE4, \ + NLOHMANN_JSON_PASTE3, \ + NLOHMANN_JSON_PASTE2, \ + NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) #define NLOHMANN_JSON_PASTE2(func, v1) func(v1) #define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) #define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) #define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) -#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) -#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) -#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) -#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) -#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) -#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) -#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) -#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) -#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) -#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) -#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) -#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) -#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) -#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) -#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) -#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) -#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) -#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) -#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) -#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) -#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) -#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) -#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) -#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) -#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) -#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) -#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) -#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) -#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) -#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) -#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) -#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) -#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) -#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) -#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) -#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) -#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) -#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) -#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) -#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) -#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) -#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) -#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) -#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) -#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) -#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) -#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) -#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) -#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) -#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) -#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) -#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) -#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) -#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) -#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) -#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) -#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) -#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) -#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) +#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, \ + v4, v5) +#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, \ + v3, v4, \ + v5, v6) +#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, \ + v2, \ + v3, \ + v4, \ + v5, \ + v6, \ + v7) +#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8( \ + func, v2, v3, v4, v5, v6, v7, v8) +#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) +#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) +#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) +#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) +#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, \ + v1) \ + NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) +#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2( \ + func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) +#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, \ + v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15) +#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, \ + v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16) +#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, \ + v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17) +#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, \ + v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18) +#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18, v19) +#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, \ + v7, v8, v9, v10, v11, v12, \ + v13, v14, v15, v16, v17, \ + v18, v19, v20) +#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, \ + v6, v7, v8, v9, v10, \ + v11, v12, v13, v14, \ + v15, v16, v17, v18, \ + v19, v20, v21) +#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, \ + v5, v6, v7, v8, \ + v9, v10, v11, \ + v12, v13, v14, \ + v15, v16, v17, \ + v18, v19, v20, \ + v21, v22) +#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, \ + v3, v4, v5, \ + v6, v7, v8, \ + v9, v10, \ + v11, v12, \ + v13, v14, \ + v15, v16, \ + v17, v18, \ + v19, v20, \ + v21, v22, \ + v23) +#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, \ + v2, v3, \ + v4, v5, \ + v6, v7, \ + v8, v9, \ + v10, \ + v11, \ + v12, \ + v13, \ + v14, \ + v15, \ + v16, \ + v17, \ + v18, \ + v19, \ + v20, \ + v21, \ + v22, \ + v23, \ + v24) +#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25( \ + func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, \ + v24, v25) +#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26) +#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27) +#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) +#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) +#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) +#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2( \ + func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, \ + v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) +#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, \ + v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32) +#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, \ + v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, \ + v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32, v33) +#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, \ + v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, \ + v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32, v33, v34) +#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, \ + v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, \ + v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32, v33, v34, v35) +#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, \ + v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, \ + v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32, v33, v34, v35, v36) +#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, \ + v8, v9, v10, v11, v12, v13, v14, \ + v15, v16, v17, v18, v19, v20, \ + v21, v22, v23, v24, v25, v26, \ + v27, v28, v29, v30, v31, v32, \ + v33, v34, v35, v36, v37) +#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, \ + v7, v8, v9, v10, v11, v12, \ + v13, v14, v15, v16, v17, \ + v18, v19, v20, v21, v22, \ + v23, v24, v25, v26, v27, \ + v28, v29, v30, v31, v32, \ + v33, v34, v35, v36, v37, \ + v38) +#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, \ + v6, v7, v8, v9, v10, \ + v11, v12, v13, v14, \ + v15, v16, v17, v18, \ + v19, v20, v21, v22, \ + v23, v24, v25, v26, \ + v27, v28, v29, v30, \ + v31, v32, v33, v34, \ + v35, v36, v37, v38, \ + v39) +#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, \ + v5, v6, v7, v8, \ + v9, v10, v11, \ + v12, v13, v14, \ + v15, v16, v17, \ + v18, v19, v20, \ + v21, v22, v23, \ + v24, v25, v26, \ + v27, v28, v29, \ + v30, v31, v32, \ + v33, v34, v35, \ + v36, v37, v38, \ + v39, v40) +#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, \ + v3, v4, v5, \ + v6, v7, v8, \ + v9, v10, \ + v11, v12, \ + v13, v14, \ + v15, v16, \ + v17, v18, \ + v19, v20, \ + v21, v22, \ + v23, v24, \ + v25, v26, \ + v27, v28, \ + v29, v30, \ + v31, v32, \ + v33, v34, \ + v35, v36, \ + v37, v38, \ + v39, v40, \ + v41) +#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, \ + v2, v3, \ + v4, v5, \ + v6, v7, \ + v8, v9, \ + v10, \ + v11, \ + v12, \ + v13, \ + v14, \ + v15, \ + v16, \ + v17, \ + v18, \ + v19, \ + v20, \ + v21, \ + v22, \ + v23, \ + v24, \ + v25, \ + v26, \ + v27, \ + v28, \ + v29, \ + v30, \ + v31, \ + v32, \ + v33, \ + v34, \ + v35, \ + v36, \ + v37, \ + v38, \ + v39, \ + v40, \ + v41, \ + v42) +#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43( \ + func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, \ + v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) +#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, \ + v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) +#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, \ + v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) +#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, \ + v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) +#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, \ + v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) +#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, \ + v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) +#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2( \ + func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, \ + v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, \ + v47, v48, v49) +#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, \ + v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, \ + v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, \ + v42, v43, v44, v45, v46, v47, v48, v49, v50) +#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, \ + v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, \ + v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, \ + v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) +#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, \ + v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, \ + v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, \ + v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, \ + v52) +#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, \ + v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, \ + v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, \ + v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, \ + v52, v53) +#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, \ + v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, \ + v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, \ + v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, \ + v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, \ + v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, \ + v52, v53, v54) +#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, \ + v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, \ + v8, v9, v10, v11, v12, v13, v14, \ + v15, v16, v17, v18, v19, v20, \ + v21, v22, v23, v24, v25, v26, \ + v27, v28, v29, v30, v31, v32, \ + v33, v34, v35, v36, v37, v38, \ + v39, v40, v41, v42, v43, v44, \ + v45, v46, v47, v48, v49, v50, \ + v51, v52, v53, v54, v55) +#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, \ + v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, \ + v7, v8, v9, v10, v11, v12, \ + v13, v14, v15, v16, v17, \ + v18, v19, v20, v21, v22, \ + v23, v24, v25, v26, v27, \ + v28, v29, v30, v31, v32, \ + v33, v34, v35, v36, v37, \ + v38, v39, v40, v41, v42, \ + v43, v44, v45, v46, v47, \ + v48, v49, v50, v51, v52, \ + v53, v54, v55, v56) +#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, \ + v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, \ + v6, v7, v8, v9, v10, \ + v11, v12, v13, v14, \ + v15, v16, v17, v18, \ + v19, v20, v21, v22, \ + v23, v24, v25, v26, \ + v27, v28, v29, v30, \ + v31, v32, v33, v34, \ + v35, v36, v37, v38, \ + v39, v40, v41, v42, \ + v43, v44, v45, v46, \ + v47, v48, v49, v50, \ + v51, v52, v53, v54, \ + v55, v56, v57) +#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, \ + v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, \ + v5, v6, v7, v8, \ + v9, v10, v11, \ + v12, v13, v14, \ + v15, v16, v17, \ + v18, v19, v20, \ + v21, v22, v23, \ + v24, v25, v26, \ + v27, v28, v29, \ + v30, v31, v32, \ + v33, v34, v35, \ + v36, v37, v38, \ + v39, v40, v41, \ + v42, v43, v44, \ + v45, v46, v47, \ + v48, v49, v50, \ + v51, v52, v53, \ + v54, v55, v56, \ + v57, v58) +#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, \ + v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, \ + v3, v4, v5, \ + v6, v7, v8, \ + v9, v10, \ + v11, v12, \ + v13, v14, \ + v15, v16, \ + v17, v18, \ + v19, v20, \ + v21, v22, \ + v23, v24, \ + v25, v26, \ + v27, v28, \ + v29, v30, \ + v31, v32, \ + v33, v34, \ + v35, v36, \ + v37, v38, \ + v39, v40, \ + v41, v42, \ + v43, v44, \ + v45, v46, \ + v47, v48, \ + v49, v50, \ + v51, v52, \ + v53, v54, \ + v55, v56, \ + v57, v58, \ + v59) +#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, \ + v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, \ + v2, v3, \ + v4, v5, \ + v6, v7, \ + v8, v9, \ + v10, \ + v11, \ + v12, \ + v13, \ + v14, \ + v15, \ + v16, \ + v17, \ + v18, \ + v19, \ + v20, \ + v21, \ + v22, \ + v23, \ + v24, \ + v25, \ + v26, \ + v27, \ + v28, \ + v29, \ + v30, \ + v31, \ + v32, \ + v33, \ + v34, \ + v35, \ + v36, \ + v37, \ + v38, \ + v39, \ + v40, \ + v41, \ + v42, \ + v43, \ + v44, \ + v45, \ + v46, \ + v47, \ + v48, \ + v49, \ + v50, \ + v51, \ + v52, \ + v53, \ + v54, \ + v55, \ + v56, \ + v57, \ + v58, \ + v59, \ + v60) +#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, \ + v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61( \ + func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, \ + v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, \ + v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) +#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, \ + v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, \ + v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, \ + v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) +#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, \ + v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, \ + v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, \ + v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, \ + v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, \ + v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, \ + v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) #define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; #define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); /*! -@brief macro -@def NLOHMANN_DEFINE_TYPE_INTRUSIVE -@since version 3.9.0 -*/ + @brief macro + @def NLOHMANN_DEFINE_TYPE_INTRUSIVE + @since version 3.9.0 + */ #define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ - friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ - friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE( \ + NLOHMANN_JSON_TO, \ + __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type & nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE( \ + NLOHMANN_JSON_FROM, \ + __VA_ARGS__)) } /*! -@brief macro -@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE -@since version 3.9.0 -*/ + @brief macro + @def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE + @since version 3.9.0 + */ #define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ - inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ - inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE( \ + NLOHMANN_JSON_TO, \ + __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type & nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE( \ + NLOHMANN_JSON_FROM, \ + __VA_ARGS__)) } #ifndef JSON_USE_IMPLICIT_CONVERSIONS #define JSON_USE_IMPLICIT_CONVERSIONS 1 -#endif +#endif // ifndef JSON_USE_IMPLICIT_CONVERSIONS #if JSON_USE_IMPLICIT_CONVERSIONS #define JSON_EXPLICIT #else #define JSON_EXPLICIT explicit -#endif +#endif // if JSON_USE_IMPLICIT_CONVERSIONS -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { //////////////// // exceptions // //////////////// /*! -@brief general exception of the @ref basic_json class + @brief general exception of the @ref basic_json class -This class is an extension of `std::exception` objects with a member @a id for -exception ids. It is used as the base class for all exceptions thrown by the -@ref basic_json class. This class can hence be used as "wildcard" to catch -exceptions. + This class is an extension of `std::exception` objects with a member @a id for + exception ids. It is used as the base class for all exceptions thrown by the + @ref basic_json class. This class can hence be used as "wildcard" to catch + exceptions. -Subclasses: -- @ref parse_error for exceptions indicating a parse error -- @ref invalid_iterator for exceptions indicating errors with iterators -- @ref type_error for exceptions indicating executing a member function with + Subclasses: + - @ref parse_error for exceptions indicating a parse error + - @ref invalid_iterator for exceptions indicating errors with iterators + - @ref type_error for exceptions indicating executing a member function with a wrong type -- @ref out_of_range for exceptions indicating access out of the defined range -- @ref other_error for exceptions indicating other library errors + - @ref out_of_range for exceptions indicating access out of the defined range + - @ref other_error for exceptions indicating other library errors -@internal -@note To have nothrow-copy-constructible exceptions, we internally use + @internal + @note To have nothrow-copy-constructible exceptions, we internally use `std::runtime_error` which can cope with arbitrary-length error messages. Intermediate strings are built with static functions and then passed to the actual constructor. -@endinternal + @endinternal -@liveexample{The following code shows how arbitrary library exceptions can be -caught.,exception} + @liveexample{The following code shows how arbitrary library exceptions can be + caught.,exception} -@since version 3.0.0 -*/ + @since version 3.0.0 + */ class exception : public std::exception { - public: +public: + /// returns the explanatory string JSON_HEDLEY_RETURNS_NON_NULL const char* what() const noexcept override @@ -2429,302 +2987,367 @@ class exception : public std::exception /// the id of the exception const int id; - protected: +protected: + JSON_HEDLEY_NON_NULL(3) - exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} + exception( + int id_, + const char* what_arg) + : id(id_) + , m(what_arg) + { + } - static std::string name(const std::string& ename, int id_) + static std::string name( + const std::string& ename, + int id_) { return "[json.exception." + ename + "." + std::to_string(id_) + "] "; } - private: +private: + /// an exception object as storage for error messages std::runtime_error m; }; /*! -@brief exception indicating a parse error - -This exception is thrown by the library when a parse error occurs. Parse errors -can occur during the deserialization of JSON text, CBOR, MessagePack, as well -as when using JSON Patch. - -Member @a byte holds the byte index of the last read character in the input -file. - -Exceptions have ids 1xx. - -name / id | example message | description ------------------------------- | --------------- | ------------------------- -json.exception.parse_error.101 | parse error at 2: unexpected end of input; expected string literal | This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member @a byte indicates the error position. -json.exception.parse_error.102 | parse error at 14: missing or wrong low surrogate | JSON uses the `\uxxxx` format to describe Unicode characters. Code points above above 0xFFFF are split into two `\uxxxx` entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point. -json.exception.parse_error.103 | parse error: code points above 0x10FFFF are invalid | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid. -json.exception.parse_error.104 | parse error: JSON patch must be an array of objects | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects. -json.exception.parse_error.105 | parse error: operation must have string member 'op' | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors. -json.exception.parse_error.106 | parse error: array index '01' must not begin with '0' | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number without a leading `0`. -json.exception.parse_error.107 | parse error: JSON pointer must be empty or begin with '/' - was: 'foo' | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character. -json.exception.parse_error.108 | parse error: escape character '~' must be followed with '0' or '1' | In a JSON Pointer, only `~0` and `~1` are valid escape sequences. -json.exception.parse_error.109 | parse error: array index 'one' is not a number | A JSON Pointer array index must be a number. -json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read. -json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read. -json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read. -json.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet). -json.exception.parse_error.115 | parse error at byte 5: syntax error while parsing UBJSON high-precision number: invalid number text: 1A | A UBJSON high-precision number could not be parsed. - -@note For an input with n bytes, 1 is the index of the first character and n+1 + @brief exception indicating a parse error + + This exception is thrown by the library when a parse error occurs. Parse errors + can occur during the deserialization of JSON text, CBOR, MessagePack, as well + as when using JSON Patch. + + Member @a byte holds the byte index of the last read character in the input + file. + + Exceptions have ids 1xx. + + name / id | example message | description + ------------------------------ | --------------- | ------------------------- + json.exception.parse_error.101 | parse error at 2: unexpected end of input; expected string literal | This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member @a byte indicates the error position. + json.exception.parse_error.102 | parse error at 14: missing or wrong low surrogate | JSON uses the `\uxxxx` format to describe Unicode characters. Code points above above 0xFFFF are split into two `\uxxxx` entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point. + json.exception.parse_error.103 | parse error: code points above 0x10FFFF are invalid | Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid. + json.exception.parse_error.104 | parse error: JSON patch must be an array of objects | [RFC 6902](https://tools.ietf.org/html/rfc6902) requires a JSON Patch document to be a JSON document that represents an array of objects. + json.exception.parse_error.105 | parse error: operation must have string member 'op' | An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors. + json.exception.parse_error.106 | parse error: array index '01' must not begin with '0' | An array index in a JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) may be `0` or any number without a leading `0`. + json.exception.parse_error.107 | parse error: JSON pointer must be empty or begin with '/' - was: 'foo' | A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a `/` character. + json.exception.parse_error.108 | parse error: escape character '~' must be followed with '0' or '1' | In a JSON Pointer, only `~0` and `~1` are valid escape sequences. + json.exception.parse_error.109 | parse error: array index 'one' is not a number | A JSON Pointer array index must be a number. + json.exception.parse_error.110 | parse error at 1: cannot read 2 bytes from vector | When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read. + json.exception.parse_error.112 | parse error at 1: error reading CBOR; last byte: 0xF8 | Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read. + json.exception.parse_error.113 | parse error at 2: expected a CBOR string; last byte: 0x98 | While parsing a map key, a value that is not a string has been read. + json.exception.parse_error.114 | parse error: Unsupported BSON record type 0x0F | The parsing of the corresponding BSON record type is not implemented (yet). + json.exception.parse_error.115 | parse error at byte 5: syntax error while parsing UBJSON high-precision number: invalid number text: 1A | A UBJSON high-precision number could not be parsed. + + @note For an input with n bytes, 1 is the index of the first character and n+1 is the index of the terminating null byte or the end of file. This also holds true when reading a byte vector (CBOR or MessagePack). -@liveexample{The following code shows how a `parse_error` exception can be -caught.,parse_error} + @liveexample{The following code shows how a `parse_error` exception can be + caught.,parse_error} -@sa - @ref exception for the base class of the library exceptions -@sa - @ref invalid_iterator for exceptions indicating errors with iterators -@sa - @ref type_error for exceptions indicating executing a member function with + @sa - @ref exception for the base class of the library exceptions + @sa - @ref invalid_iterator for exceptions indicating errors with iterators + @sa - @ref type_error for exceptions indicating executing a member function with a wrong type -@sa - @ref out_of_range for exceptions indicating access out of the defined range -@sa - @ref other_error for exceptions indicating other library errors + @sa - @ref out_of_range for exceptions indicating access out of the defined range + @sa - @ref other_error for exceptions indicating other library errors -@since version 3.0.0 -*/ + @since version 3.0.0 + */ class parse_error : public exception { - public: +public: + /*! - @brief create a parse error exception - @param[in] id_ the id of the exception - @param[in] pos the position where the error occurred (or with + @brief create a parse error exception + @param[in] id_ the id of the exception + @param[in] pos the position where the error occurred (or with chars_read_total=0 if the position cannot be determined) - @param[in] what_arg the explanatory string - @return parse_error object - */ - static parse_error create(int id_, const position_t& pos, const std::string& what_arg) + @param[in] what_arg the explanatory string + @return parse_error object + */ + static parse_error create( + int id_, + const position_t& pos, + const std::string& what_arg) { std::string w = exception::name("parse_error", id_) + "parse error" + - position_string(pos) + ": " + what_arg; + position_string(pos) + ": " + what_arg; return parse_error(id_, pos.chars_read_total, w.c_str()); } - static parse_error create(int id_, std::size_t byte_, const std::string& what_arg) + static parse_error create( + int id_, + std::size_t byte_, + const std::string& what_arg) { std::string w = exception::name("parse_error", id_) + "parse error" + - (byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") + - ": " + what_arg; + (byte_ != 0 ? (" at byte " + std::to_string(byte_)) : "") + + ": " + what_arg; return parse_error(id_, byte_, w.c_str()); } /*! - @brief byte index of the parse error + @brief byte index of the parse error - The byte index of the last read character in the input file. + The byte index of the last read character in the input file. - @note For an input with n bytes, 1 is the index of the first character and + @note For an input with n bytes, 1 is the index of the first character and n+1 is the index of the terminating null byte or the end of file. This also holds true when reading a byte vector (CBOR or MessagePack). - */ + */ const std::size_t byte; - private: - parse_error(int id_, std::size_t byte_, const char* what_arg) - : exception(id_, what_arg), byte(byte_) {} +private: + + parse_error( + int id_, + std::size_t byte_, + const char* what_arg) + : exception(id_, what_arg) + , byte(byte_) + { + } - static std::string position_string(const position_t& pos) + static std::string position_string( + const position_t& pos) { return " at line " + std::to_string(pos.lines_read + 1) + ", column " + std::to_string(pos.chars_read_current_line); } + }; /*! -@brief exception indicating errors with iterators - -This exception is thrown if iterators passed to a library function do not match -the expected semantics. - -Exceptions have ids 2xx. - -name / id | example message | description ------------------------------------ | --------------- | ------------------------- -json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. -json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion. -json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function @ref erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from. -json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (@ref begin(), @ref end()), because this is the only way the single stored value is expressed. All other ranges are invalid. -json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the @ref begin() iterator, because it is the only way to address the stored value. All other iterators are invalid. -json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range. -json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key. -json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. -json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. -json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. -json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to. -json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container. -json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered. -json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to @ref begin(). - -@liveexample{The following code shows how an `invalid_iterator` exception can be -caught.,invalid_iterator} - -@sa - @ref exception for the base class of the library exceptions -@sa - @ref parse_error for exceptions indicating a parse error -@sa - @ref type_error for exceptions indicating executing a member function with + @brief exception indicating errors with iterators + + This exception is thrown if iterators passed to a library function do not match + the expected semantics. + + Exceptions have ids 2xx. + + name / id | example message | description + ----------------------------------- | --------------- | ------------------------- + json.exception.invalid_iterator.201 | iterators are not compatible | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. + json.exception.invalid_iterator.202 | iterator does not fit current value | In an erase or insert function, the passed iterator @a pos does not belong to the JSON value for which the function was called. It hence does not define a valid position for the deletion/insertion. + json.exception.invalid_iterator.203 | iterators do not fit current value | Either iterator passed to function @ref erase(IteratorType first, IteratorType last) does not belong to the JSON value from which values shall be erased. It hence does not define a valid range to delete values from. + json.exception.invalid_iterator.204 | iterators out of range | When an iterator range for a primitive type (number, boolean, or string) is passed to a constructor or an erase function, this range has to be exactly (@ref begin(), @ref end()), because this is the only way the single stored value is expressed. All other ranges are invalid. + json.exception.invalid_iterator.205 | iterator out of range | When an iterator for a primitive type (number, boolean, or string) is passed to an erase function, the iterator has to be the @ref begin() iterator, because it is the only way to address the stored value. All other iterators are invalid. + json.exception.invalid_iterator.206 | cannot construct with iterators from null | The iterators passed to constructor @ref basic_json(InputIT first, InputIT last) belong to a JSON null value and hence to not define a valid range. + json.exception.invalid_iterator.207 | cannot use key() for non-object iterators | The key() member function can only be used on iterators belonging to a JSON object, because other types do not have a concept of a key. + json.exception.invalid_iterator.208 | cannot use operator[] for object iterators | The operator[] to specify a concrete offset cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. + json.exception.invalid_iterator.209 | cannot use offsets with object iterators | The offset operators (+, -, +=, -=) cannot be used on iterators belonging to a JSON object, because JSON objects are unordered. + json.exception.invalid_iterator.210 | iterators do not fit | The iterator range passed to the insert function are not compatible, meaning they do not belong to the same container. Therefore, the range (@a first, @a last) is invalid. + json.exception.invalid_iterator.211 | passed iterators may not belong to container | The iterator range passed to the insert function must not be a subrange of the container to insert to. + json.exception.invalid_iterator.212 | cannot compare iterators of different containers | When two iterators are compared, they must belong to the same container. + json.exception.invalid_iterator.213 | cannot compare order of object iterators | The order of object iterators cannot be compared, because JSON objects are unordered. + json.exception.invalid_iterator.214 | cannot get value | Cannot get value for iterator: Either the iterator belongs to a null value or it is an iterator to a primitive type (number, boolean, or string), but the iterator is different to @ref begin(). + + @liveexample{The following code shows how an `invalid_iterator` exception can be + caught.,invalid_iterator} + + @sa - @ref exception for the base class of the library exceptions + @sa - @ref parse_error for exceptions indicating a parse error + @sa - @ref type_error for exceptions indicating executing a member function with a wrong type -@sa - @ref out_of_range for exceptions indicating access out of the defined range -@sa - @ref other_error for exceptions indicating other library errors + @sa - @ref out_of_range for exceptions indicating access out of the defined range + @sa - @ref other_error for exceptions indicating other library errors -@since version 3.0.0 -*/ + @since version 3.0.0 + */ class invalid_iterator : public exception { - public: - static invalid_iterator create(int id_, const std::string& what_arg) +public: + + static invalid_iterator create( + int id_, + const std::string& what_arg) { std::string w = exception::name("invalid_iterator", id_) + what_arg; return invalid_iterator(id_, w.c_str()); } - private: +private: + JSON_HEDLEY_NON_NULL(3) - invalid_iterator(int id_, const char* what_arg) - : exception(id_, what_arg) {} + invalid_iterator( + int id_, + const char* what_arg) + : exception(id_, what_arg) + { + } + }; /*! -@brief exception indicating executing a member function with a wrong type - -This exception is thrown in case of a type error; that is, a library function is -executed on a JSON value whose type does not match the expected semantics. - -Exceptions have ids 3xx. - -name / id | example message | description ------------------------------ | --------------- | ------------------------- -json.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead. -json.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types. -json.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a @ref basic_json object with @ref get_ref, the type of the reference must match the value type. For instance, for a JSON array, the @a ReferenceType must be @ref array_t &. -json.exception.type_error.304 | cannot use at() with string | The @ref at() member functions can only be executed for certain JSON types. -json.exception.type_error.305 | cannot use operator[] with string | The @ref operator[] member functions can only be executed for certain JSON types. -json.exception.type_error.306 | cannot use value() with string | The @ref value() member functions can only be executed for certain JSON types. -json.exception.type_error.307 | cannot use erase() with string | The @ref erase() member functions can only be executed for certain JSON types. -json.exception.type_error.308 | cannot use push_back() with string | The @ref push_back() and @ref operator+= member functions can only be executed for certain JSON types. -json.exception.type_error.309 | cannot use insert() with | The @ref insert() member functions can only be executed for certain JSON types. -json.exception.type_error.310 | cannot use swap() with number | The @ref swap() member functions can only be executed for certain JSON types. -json.exception.type_error.311 | cannot use emplace_back() with string | The @ref emplace_back() member function can only be executed for certain JSON types. -json.exception.type_error.312 | cannot use update() with string | The @ref update() member functions can only be executed for certain JSON types. -json.exception.type_error.313 | invalid value to unflatten | The @ref unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined. -json.exception.type_error.314 | only objects can be unflattened | The @ref unflatten function only works for an object whose keys are JSON Pointers. -json.exception.type_error.315 | values in object must be primitive | The @ref unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive. -json.exception.type_error.316 | invalid UTF-8 byte at index 10: 0x7E | The @ref dump function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. | -json.exception.type_error.317 | JSON value cannot be serialized to requested format | The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON) | - -@liveexample{The following code shows how a `type_error` exception can be -caught.,type_error} - -@sa - @ref exception for the base class of the library exceptions -@sa - @ref parse_error for exceptions indicating a parse error -@sa - @ref invalid_iterator for exceptions indicating errors with iterators -@sa - @ref out_of_range for exceptions indicating access out of the defined range -@sa - @ref other_error for exceptions indicating other library errors - -@since version 3.0.0 -*/ + @brief exception indicating executing a member function with a wrong type + + This exception is thrown in case of a type error; that is, a library function is + executed on a JSON value whose type does not match the expected semantics. + + Exceptions have ids 3xx. + + name / id | example message | description + ----------------------------- | --------------- | ------------------------- + json.exception.type_error.301 | cannot create object from initializer list | To create an object from an initializer list, the initializer list must consist only of a list of pairs whose first element is a string. When this constraint is violated, an array is created instead. + json.exception.type_error.302 | type must be object, but is array | During implicit or explicit value conversion, the JSON type must be compatible to the target type. For instance, a JSON string can only be converted into string types, but not into numbers or boolean types. + json.exception.type_error.303 | incompatible ReferenceType for get_ref, actual type is object | To retrieve a reference to a value stored in a @ref basic_json object with @ref get_ref, the type of the reference must match the value type. For instance, for a JSON array, the @a ReferenceType must be @ref array_t &. + json.exception.type_error.304 | cannot use at() with string | The @ref at() member functions can only be executed for certain JSON types. + json.exception.type_error.305 | cannot use operator[] with string | The @ref operator[] member functions can only be executed for certain JSON types. + json.exception.type_error.306 | cannot use value() with string | The @ref value() member functions can only be executed for certain JSON types. + json.exception.type_error.307 | cannot use erase() with string | The @ref erase() member functions can only be executed for certain JSON types. + json.exception.type_error.308 | cannot use push_back() with string | The @ref push_back() and @ref operator+= member functions can only be executed for certain JSON types. + json.exception.type_error.309 | cannot use insert() with | The @ref insert() member functions can only be executed for certain JSON types. + json.exception.type_error.310 | cannot use swap() with number | The @ref swap() member functions can only be executed for certain JSON types. + json.exception.type_error.311 | cannot use emplace_back() with string | The @ref emplace_back() member function can only be executed for certain JSON types. + json.exception.type_error.312 | cannot use update() with string | The @ref update() member functions can only be executed for certain JSON types. + json.exception.type_error.313 | invalid value to unflatten | The @ref unflatten function converts an object whose keys are JSON Pointers back into an arbitrary nested JSON value. The JSON Pointers must not overlap, because then the resulting value would not be well defined. + json.exception.type_error.314 | only objects can be unflattened | The @ref unflatten function only works for an object whose keys are JSON Pointers. + json.exception.type_error.315 | values in object must be primitive | The @ref unflatten function only works for an object whose keys are JSON Pointers and whose values are primitive. + json.exception.type_error.316 | invalid UTF-8 byte at index 10: 0x7E | The @ref dump function only works with UTF-8 encoded strings; that is, if you assign a `std::string` to a JSON value, make sure it is UTF-8 encoded. | + json.exception.type_error.317 | JSON value cannot be serialized to requested format | The dynamic type of the object cannot be represented in the requested serialization format (e.g. a raw `true` or `null` JSON object cannot be serialized to BSON) | + + @liveexample{The following code shows how a `type_error` exception can be + caught.,type_error} + + @sa - @ref exception for the base class of the library exceptions + @sa - @ref parse_error for exceptions indicating a parse error + @sa - @ref invalid_iterator for exceptions indicating errors with iterators + @sa - @ref out_of_range for exceptions indicating access out of the defined range + @sa - @ref other_error for exceptions indicating other library errors + + @since version 3.0.0 + */ class type_error : public exception { - public: - static type_error create(int id_, const std::string& what_arg) +public: + + static type_error create( + int id_, + const std::string& what_arg) { std::string w = exception::name("type_error", id_) + what_arg; return type_error(id_, w.c_str()); } - private: +private: + JSON_HEDLEY_NON_NULL(3) - type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} + type_error( + int id_, + const char* what_arg) + : exception(id_, what_arg) + { + } + }; /*! -@brief exception indicating access out of the defined range - -This exception is thrown in case a library function is called on an input -parameter that exceeds the expected range, for instance in case of array -indices or nonexisting object keys. - -Exceptions have ids 4xx. - -name / id | example message | description -------------------------------- | --------------- | ------------------------- -json.exception.out_of_range.401 | array index 3 is out of range | The provided array index @a i is larger than @a size-1. -json.exception.out_of_range.402 | array index '-' (3) is out of range | The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it. -json.exception.out_of_range.403 | key 'foo' not found | The provided key was not found in the JSON object. -json.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved. -json.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. -json.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF. -json.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON and BSON only support integer numbers up to 9223372036854775807. (until version 3.8.0) | -json.exception.out_of_range.408 | excessive array size: 8658170730974374167 | The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. | -json.exception.out_of_range.409 | BSON key cannot contain code point U+0000 (at byte 2) | Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string | - -@liveexample{The following code shows how an `out_of_range` exception can be -caught.,out_of_range} - -@sa - @ref exception for the base class of the library exceptions -@sa - @ref parse_error for exceptions indicating a parse error -@sa - @ref invalid_iterator for exceptions indicating errors with iterators -@sa - @ref type_error for exceptions indicating executing a member function with + @brief exception indicating access out of the defined range + + This exception is thrown in case a library function is called on an input + parameter that exceeds the expected range, for instance in case of array + indices or nonexisting object keys. + + Exceptions have ids 4xx. + + name / id | example message | description + ------------------------------- | --------------- | ------------------------- + json.exception.out_of_range.401 | array index 3 is out of range | The provided array index @a i is larger than @a size-1. + json.exception.out_of_range.402 | array index '-' (3) is out of range | The special array index `-` in a JSON Pointer never describes a valid element of the array, but the index past the end. That is, it can only be used to add elements at this position, but not to read it. + json.exception.out_of_range.403 | key 'foo' not found | The provided key was not found in the JSON object. + json.exception.out_of_range.404 | unresolved reference token 'foo' | A reference token in a JSON Pointer could not be resolved. + json.exception.out_of_range.405 | JSON pointer has no parent | The JSON Patch operations 'remove' and 'add' can not be applied to the root element of the JSON value. + json.exception.out_of_range.406 | number overflow parsing '10E1000' | A parsed number could not be stored as without changing it to NaN or INF. + json.exception.out_of_range.407 | number overflow serializing '9223372036854775808' | UBJSON and BSON only support integer numbers up to 9223372036854775807. (until version 3.8.0) | + json.exception.out_of_range.408 | excessive array size: 8658170730974374167 | The size (following `#`) of an UBJSON array or object exceeds the maximal capacity. | + json.exception.out_of_range.409 | BSON key cannot contain code point U+0000 (at byte 2) | Key identifiers to be serialized to BSON cannot contain code point U+0000, since the key is stored as zero-terminated c-string | + + @liveexample{The following code shows how an `out_of_range` exception can be + caught.,out_of_range} + + @sa - @ref exception for the base class of the library exceptions + @sa - @ref parse_error for exceptions indicating a parse error + @sa - @ref invalid_iterator for exceptions indicating errors with iterators + @sa - @ref type_error for exceptions indicating executing a member function with a wrong type -@sa - @ref other_error for exceptions indicating other library errors + @sa - @ref other_error for exceptions indicating other library errors -@since version 3.0.0 -*/ + @since version 3.0.0 + */ class out_of_range : public exception { - public: - static out_of_range create(int id_, const std::string& what_arg) +public: + + static out_of_range create( + int id_, + const std::string& what_arg) { std::string w = exception::name("out_of_range", id_) + what_arg; return out_of_range(id_, w.c_str()); } - private: +private: + JSON_HEDLEY_NON_NULL(3) - out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} + out_of_range( + int id_, + const char* what_arg) + : exception(id_, what_arg) + { + } + }; /*! -@brief exception indicating other library errors + @brief exception indicating other library errors -This exception is thrown in case of errors that cannot be classified with the -other exception types. + This exception is thrown in case of errors that cannot be classified with the + other exception types. -Exceptions have ids 5xx. + Exceptions have ids 5xx. -name / id | example message | description ------------------------------- | --------------- | ------------------------- -json.exception.other_error.501 | unsuccessful: {"op":"test","path":"/baz", "value":"bar"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed. + name / id | example message | description + ------------------------------ | --------------- | ------------------------- + json.exception.other_error.501 | unsuccessful: {"op":"test","path":"/baz", "value":"bar"} | A JSON Patch operation 'test' failed. The unsuccessful operation is also printed. -@sa - @ref exception for the base class of the library exceptions -@sa - @ref parse_error for exceptions indicating a parse error -@sa - @ref invalid_iterator for exceptions indicating errors with iterators -@sa - @ref type_error for exceptions indicating executing a member function with + @sa - @ref exception for the base class of the library exceptions + @sa - @ref parse_error for exceptions indicating a parse error + @sa - @ref invalid_iterator for exceptions indicating errors with iterators + @sa - @ref type_error for exceptions indicating executing a member function with a wrong type -@sa - @ref out_of_range for exceptions indicating access out of the defined range + @sa - @ref out_of_range for exceptions indicating access out of the defined range -@liveexample{The following code shows how an `other_error` exception can be -caught.,other_error} + @liveexample{The following code shows how an `other_error` exception can be + caught.,other_error} -@since version 3.0.0 -*/ + @since version 3.0.0 + */ class other_error : public exception { - public: - static other_error create(int id_, const std::string& what_arg) +public: + + static other_error create( + int id_, + const std::string& what_arg) { std::string w = exception::name("other_error", id_) + what_arg; return other_error(id_, w.c_str()); } - private: +private: + JSON_HEDLEY_NON_NULL(3) - other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} + other_error( + int id_, + const char* what_arg) + : exception(id_, what_arg) + { + } + }; } // namespace detail } // namespace nlohmann @@ -2737,10 +3360,8 @@ class other_error : public exception #include // size_t #include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { // alias templates to reduce boilerplate template using enable_if_t = typename std::enable_if::type; @@ -2759,6 +3380,7 @@ struct index_sequence { return sizeof...(Ints); } + }; template @@ -2766,17 +3388,17 @@ struct merge_and_renumber; template struct merge_and_renumber, index_sequence> - : index_sequence < I1..., (sizeof...(I1) + I2)... > {}; + : index_sequence < I1..., (sizeof...(I1) + I2)... > {}; template struct make_index_sequence : merge_and_renumber < typename make_index_sequence < N / 2 >::type, - typename make_index_sequence < N - N / 2 >::type > {}; + typename make_index_sequence < N - N / 2 >::type > {}; template<> struct make_index_sequence<0> : index_sequence<> {}; template<> struct make_index_sequence<1> : index_sequence<0> {}; -template +template using index_sequence_for = make_index_sequence; // dispatch utility (taken from ranges-v3) @@ -2810,25 +3432,21 @@ constexpr T static_const::value; // #include -namespace nlohmann -{ -namespace detail -{ -template struct make_void +namespace nlohmann { +namespace detail { +template struct make_void { using type = void; }; -template using void_t = typename make_void::type; +template using void_t = typename make_void::type; } // namespace detail } // namespace nlohmann // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { template struct iterator_types {}; @@ -2854,7 +3472,7 @@ struct iterator_traits template struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> - : iterator_types + : iterator_types { }; @@ -2883,55 +3501,57 @@ struct iterator_traits::value>> // https://en.cppreference.com/w/cpp/experimental/is_detected -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { struct nonesuch { nonesuch() = delete; ~nonesuch() = delete; - nonesuch(nonesuch const&) = delete; - nonesuch(nonesuch const&&) = delete; - void operator=(nonesuch const&) = delete; - void operator=(nonesuch&&) = delete; + nonesuch( + nonesuch const&) = delete; + nonesuch( + nonesuch const&&) = delete; + void operator =( + nonesuch const&) = delete; + void operator =( + nonesuch&&) = delete; }; template class Op, - class... Args> + class AlwaysVoid, + template class Op, + class ... Args> struct detector { using value_t = std::false_type; using type = Default; }; -template class Op, class... Args> +template class Op, class ... Args> struct detector>, Op, Args...> { using value_t = std::true_type; using type = Op; }; -template class Op, class... Args> +template class Op, class ... Args> using is_detected = typename detector::value_t; -template class Op, class... Args> +template class Op, class ... Args> using detected_t = typename detector::type; -template class Op, class... Args> +template class Op, class ... Args> using detected_or = detector; -template class Op, class... Args> +template class Op, class ... Args> using detected_or_t = typename detected_or::type; -template class Op, class... Args> +template class Op, class ... Args> using is_detected_exact = std::is_same>; -template class Op, class... Args> +template class Op, class ... Args> using is_detected_convertible = - std::is_convertible, To>; + std::is_convertible, To>; } // namespace detail } // namespace nlohmann @@ -2946,69 +3566,68 @@ using is_detected_convertible = #include // vector /*! -@brief namespace for Niels Lohmann -@see https://github.com/nlohmann -@since version 1.0.0 -*/ -namespace nlohmann -{ + @brief namespace for Niels Lohmann + @see https://github.com/nlohmann + @since version 1.0.0 + */ +namespace nlohmann { /*! -@brief default JSONSerializer template argument + @brief default JSONSerializer template argument -This serializer ignores the template arguments and uses ADL -([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) -for serialization. -*/ + This serializer ignores the template arguments and uses ADL + ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) + for serialization. + */ template struct adl_serializer; -template class ObjectType = - std::map, - template class ArrayType = std::vector, - class StringType = std::string, class BooleanType = bool, - class NumberIntegerType = std::int64_t, - class NumberUnsignedType = std::uint64_t, - class NumberFloatType = double, - template class AllocatorType = std::allocator, - template class JSONSerializer = - adl_serializer, - class BinaryType = std::vector> +template class ObjectType = + std::map, + template class ArrayType = std::vector, + class StringType = std::string, class BooleanType = bool, + class NumberIntegerType = std::int64_t, + class NumberUnsignedType = std::uint64_t, + class NumberFloatType = double, + template class AllocatorType = std::allocator, + template class JSONSerializer = + adl_serializer, + class BinaryType = std::vector> class basic_json; /*! -@brief JSON Pointer + @brief JSON Pointer -A JSON pointer defines a string syntax for identifying a specific value -within a JSON document. It can be used with functions `at` and -`operator[]`. Furthermore, JSON pointers are the base for JSON patches. + A JSON pointer defines a string syntax for identifying a specific value + within a JSON document. It can be used with functions `at` and + `operator[]`. Furthermore, JSON pointers are the base for JSON patches. -@sa [RFC 6901](https://tools.ietf.org/html/rfc6901) + @sa [RFC 6901](https://tools.ietf.org/html/rfc6901) -@since version 2.0.0 -*/ + @since version 2.0.0 + */ template class json_pointer; /*! -@brief default JSON class + @brief default JSON class -This type is the default specialization of the @ref basic_json class which -uses the standard template types. + This type is the default specialization of the @ref basic_json class which + uses the standard template types. -@since version 1.0.0 -*/ + @since version 1.0.0 + */ using json = basic_json<>; template struct ordered_map; /*! -@brief ordered JSON class + @brief ordered JSON class -This type preserves the insertion order of object keys. + This type preserves the insertion order of object keys. -@since version 3.9.0 -*/ + @since version 3.9.0 + */ using ordered_json = basic_json; } // namespace nlohmann @@ -3016,18 +3635,16 @@ using ordered_json = basic_json; #endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ -namespace nlohmann -{ +namespace nlohmann { /*! -@brief detail namespace with internal helper functions + @brief detail namespace with internal helper functions -This namespace collects functions that should not be exposed, -implementations of some @ref basic_json methods, and meta-programming helpers. + This namespace collects functions that should not be exposed, + implementations of some @ref basic_json methods, and meta-programming helpers. -@since version 2.1.0 -*/ -namespace detail -{ + @since version 2.1.0 + */ +namespace detail { ///////////// // helpers // ///////////// @@ -3087,10 +3704,10 @@ using iterator_category_t = typename T::iterator_category; template using iterator_t = typename T::iterator; -template +template using to_json_function = decltype(T::to_json(std::declval()...)); -template +template using from_json_function = decltype(T::from_json(std::declval()...)); template @@ -3112,13 +3729,13 @@ struct is_getable template struct has_from_json < BasicJsonType, T, - enable_if_t < !is_basic_json::value >> + enable_if_t < !is_basic_json::value >> { using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = - is_detected_exact::value; + is_detected_exact::value; }; // This trait checks if JSONSerializer::from_json(json const&) exists @@ -3132,8 +3749,8 @@ struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_jso using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = - is_detected_exact::value; + is_detected_exact::value; }; // This trait checks if BasicJsonType::json_serializer::to_json exists @@ -3147,8 +3764,8 @@ struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> using serializer = typename BasicJsonType::template json_serializer; static constexpr bool value = - is_detected_exact::value; + is_detected_exact::value; }; @@ -3162,16 +3779,18 @@ struct is_iterator_traits : std::false_type {}; template struct is_iterator_traits> { - private: +private: + using traits = iterator_traits; - public: +public: + static constexpr auto value = - is_detected::value && - is_detected::value && - is_detected::value && - is_detected::value && - is_detected::value; + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value; }; // source: https://stackoverflow.com/a/37193089/4116453 @@ -3183,13 +3802,13 @@ template struct is_complete_type : std::true_type {}; template + typename = void> struct is_compatible_object_type_impl : std::false_type {}; template struct is_compatible_object_type_impl < BasicJsonType, CompatibleObjectType, - enable_if_t < is_detected::value&& + enable_if_t < is_detected::value && is_detected::value >> { @@ -3197,10 +3816,10 @@ struct is_compatible_object_type_impl < // macOS's is_constructible does not play well with nonesuch... static constexpr bool value = - std::is_constructible::value && - std::is_constructible::value; + std::is_constructible::value && + std::is_constructible::value; }; template @@ -3208,40 +3827,40 @@ struct is_compatible_object_type : is_compatible_object_type_impl {}; template + typename = void> struct is_constructible_object_type_impl : std::false_type {}; template struct is_constructible_object_type_impl < BasicJsonType, ConstructibleObjectType, - enable_if_t < is_detected::value&& + enable_if_t < is_detected::value && is_detected::value >> { using object_t = typename BasicJsonType::object_t; static constexpr bool value = - (std::is_default_constructible::value && - (std::is_move_assignable::value || - std::is_copy_assignable::value) && - (std::is_constructible::value && - std::is_same < - typename object_t::mapped_type, - typename ConstructibleObjectType::mapped_type >::value)) || - (has_from_json::value || - has_non_default_from_json < - BasicJsonType, - typename ConstructibleObjectType::mapped_type >::value); + (std::is_default_constructible::value && + (std::is_move_assignable::value || + std::is_copy_assignable::value) && + (std::is_constructible::value && + std::is_same < + typename object_t::mapped_type, + typename ConstructibleObjectType::mapped_type >::value)) || + (has_from_json::value || + has_non_default_from_json < + BasicJsonType, + typename ConstructibleObjectType::mapped_type >::value); }; template struct is_constructible_object_type : is_constructible_object_type_impl {}; + ConstructibleObjectType> {}; template + typename = void> struct is_compatible_string_type_impl : std::false_type {}; template @@ -3251,7 +3870,7 @@ struct is_compatible_string_type_impl < value_type_t, CompatibleStringType>::value >> { static constexpr auto value = - std::is_constructible::value; + std::is_constructible::value; }; template @@ -3259,7 +3878,7 @@ struct is_compatible_string_type : is_compatible_string_type_impl {}; template + typename = void> struct is_constructible_string_type_impl : std::false_type {}; template @@ -3269,8 +3888,8 @@ struct is_constructible_string_type_impl < value_type_t, ConstructibleStringType>::value >> { static constexpr auto value = - std::is_constructible::value; + std::is_constructible::value; }; template @@ -3283,17 +3902,17 @@ struct is_compatible_array_type_impl : std::false_type {}; template struct is_compatible_array_type_impl < BasicJsonType, CompatibleArrayType, - enable_if_t < is_detected::value&& - is_detected::value&& -// This is needed because json_reverse_iterator has a ::iterator type... -// Therefore it is detected as a CompatibleArrayType. -// The real fix would be to have an Iterable concept. + enable_if_t < is_detected::value && + is_detected::value && + // This is needed because json_reverse_iterator has a ::iterator type... + // Therefore it is detected as a CompatibleArrayType. + // The real fix would be to have an Iterable concept. !is_iterator_traits < - iterator_traits>::value >> + iterator_traits>::value >> { static constexpr bool value = - std::is_constructible::value; + std::is_constructible::value; }; template @@ -3308,35 +3927,35 @@ struct is_constructible_array_type_impl < BasicJsonType, ConstructibleArrayType, enable_if_t::value >> - : std::true_type {}; + : std::true_type {}; template struct is_constructible_array_type_impl < BasicJsonType, ConstructibleArrayType, enable_if_t < !std::is_same::value&& - std::is_default_constructible::value&& -(std::is_move_assignable::value || - std::is_copy_assignable::value)&& -is_detected::value&& -is_detected::value&& -is_complete_type < -detected_t>::value >> + typename BasicJsonType::value_type>::value && + std::is_default_constructible::value && + (std::is_move_assignable::value || + std::is_copy_assignable::value) && + is_detected::value && + is_detected::value && + is_complete_type < + detected_t>::value >> { static constexpr bool value = - // This is needed because json_reverse_iterator has a ::iterator type, - // furthermore, std::back_insert_iterator (and other iterators) have a - // base class `iterator`... Therefore it is detected as a - // ConstructibleArrayType. The real fix would be to have an Iterable - // concept. - !is_iterator_traits>::value && - - (std::is_same::value || - has_from_json::value || - has_non_default_from_json < - BasicJsonType, typename ConstructibleArrayType::value_type >::value); + // This is needed because json_reverse_iterator has a ::iterator type, + // furthermore, std::back_insert_iterator (and other iterators) have a + // base class `iterator`... Therefore it is detected as a + // ConstructibleArrayType. The real fix would be to have an Iterable + // concept. + !is_iterator_traits>::value && + + (std::is_same::value || + has_from_json::value || + has_non_default_from_json < + BasicJsonType, typename ConstructibleArrayType::value_type >::value); }; template @@ -3344,14 +3963,14 @@ struct is_constructible_array_type : is_constructible_array_type_impl {}; template + typename = void> struct is_compatible_integer_type_impl : std::false_type {}; template struct is_compatible_integer_type_impl < RealIntegerType, CompatibleNumberIntegerType, - enable_if_t < std::is_integral::value&& - std::is_integral::value&& + enable_if_t < std::is_integral::value && + std::is_integral::value && !std::is_same::value >> { // is there an assert somewhere on overflows? @@ -3359,19 +3978,19 @@ struct is_compatible_integer_type_impl < using CompatibleLimits = std::numeric_limits; static constexpr auto value = - std::is_constructible::value && - CompatibleLimits::is_integer && - RealLimits::is_signed == CompatibleLimits::is_signed; + std::is_constructible::value && + CompatibleLimits::is_integer && + RealLimits::is_signed == CompatibleLimits::is_signed; }; template struct is_compatible_integer_type : is_compatible_integer_type_impl {}; + CompatibleNumberIntegerType> {}; template -struct is_compatible_type_impl: std::false_type {}; +struct is_compatible_type_impl : std::false_type {}; template struct is_compatible_type_impl < @@ -3379,7 +3998,7 @@ struct is_compatible_type_impl < enable_if_t::value >> { static constexpr bool value = - has_to_json::value; + has_to_json::value; }; template @@ -3387,16 +4006,16 @@ struct is_compatible_type : is_compatible_type_impl {}; // https://en.cppreference.com/w/cpp/types/conjunction -template struct conjunction : std::true_type { }; +template struct conjunction : std::true_type { }; template struct conjunction : B1 { }; -template +template struct conjunction -: std::conditional, B1>::type {}; + : std::conditional, B1>::type {}; template struct is_constructible_tuple : std::false_type {}; -template +template struct is_constructible_tuple> : conjunction...> {}; } // namespace detail } // namespace nlohmann @@ -3409,38 +4028,36 @@ struct is_constructible_tuple> : conjunction // uint8_t #include // string -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { /////////////////////////// // JSON type enumeration // /////////////////////////// /*! -@brief the JSON type enumeration - -This enumeration collects the different JSON types. It is internally used to -distinguish the stored values, and the functions @ref basic_json::is_null(), -@ref basic_json::is_object(), @ref basic_json::is_array(), -@ref basic_json::is_string(), @ref basic_json::is_boolean(), -@ref basic_json::is_number() (with @ref basic_json::is_number_integer(), -@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), -@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and -@ref basic_json::is_structured() rely on it. - -@note There are three enumeration entries (number_integer, number_unsigned, and -number_float), because the library distinguishes these three types for numbers: -@ref basic_json::number_unsigned_t is used for unsigned integers, -@ref basic_json::number_integer_t is used for signed integers, and -@ref basic_json::number_float_t is used for floating-point numbers or to -approximate integers which do not fit in the limits of their respective type. - -@sa @ref basic_json::basic_json(const value_t value_type) -- create a JSON -value with the default value for a given type - -@since version 1.0.0 -*/ + @brief the JSON type enumeration + + This enumeration collects the different JSON types. It is internally used to + distinguish the stored values, and the functions @ref basic_json::is_null(), + @ref basic_json::is_object(), @ref basic_json::is_array(), + @ref basic_json::is_string(), @ref basic_json::is_boolean(), + @ref basic_json::is_number() (with @ref basic_json::is_number_integer(), + @ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), + @ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and + @ref basic_json::is_structured() rely on it. + + @note There are three enumeration entries (number_integer, number_unsigned, and + number_float), because the library distinguishes these three types for numbers: + @ref basic_json::number_unsigned_t is used for unsigned integers, + @ref basic_json::number_integer_t is used for signed integers, and + @ref basic_json::number_float_t is used for floating-point numbers or to + approximate integers which do not fit in the limits of their respective type. + + @sa @ref basic_json::basic_json(const value_t value_type) -- create a JSON + value with the default value for a given type + + @since version 1.0.0 + */ enum class value_t : std::uint8_t { null, ///< null value @@ -3456,41 +4073,44 @@ enum class value_t : std::uint8_t }; /*! -@brief comparison operator for JSON types - -Returns an ordering that is similar to Python: -- order: null < boolean < number < object < array < string < binary -- furthermore, each type is not smaller than itself -- discarded values are not comparable -- binary is represented as a b"" string in python and directly comparable to a - string; however, making a binary array directly comparable with a string would - be surprising behavior in a JSON file. - -@since version 1.0.0 -*/ -inline bool operator<(const value_t lhs, const value_t rhs) noexcept + @brief comparison operator for JSON types + + Returns an ordering that is similar to Python: + - order: null < boolean < number < object < array < string < binary + - furthermore, each type is not smaller than itself + - discarded values are not comparable + - binary is represented as a b"" string in python and directly comparable to a + string; however, making a binary array directly comparable with a string would + be surprising behavior in a JSON file. + + @since version 1.0.0 + */ +inline bool operator <( + const value_t lhs, + const value_t rhs) noexcept { static constexpr std::array order = {{ - 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, - 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, - 6 /* binary */ - } + 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, + 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, + 6 /* binary */ + } }; const auto l_index = static_cast(lhs); const auto r_index = static_cast(rhs); return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; } + } // namespace detail } // namespace nlohmann -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { template -void from_json(const BasicJsonType& j, typename std::nullptr_t& n) +void from_json( + const BasicJsonType& j, + typename std::nullptr_t& n) { if (JSON_HEDLEY_UNLIKELY(!j.is_null())) { @@ -3501,10 +4121,12 @@ void from_json(const BasicJsonType& j, typename std::nullptr_t& n) // overloads for basic_json template parameters template < typename BasicJsonType, typename ArithmeticType, - enable_if_t < std::is_arithmetic::value&& - !std::is_same::value, - int > = 0 > -void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val) + enable_if_t < std::is_arithmetic::value && + !std::is_same::value, + int > = 0 > +void get_arithmetic_value( + const BasicJsonType& j, + ArithmeticType& val) { switch (static_cast(j)) { @@ -3530,7 +4152,9 @@ void get_arithmetic_value(const BasicJsonType& j, ArithmeticType& val) } template -void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b) +void from_json( + const BasicJsonType& j, + typename BasicJsonType::boolean_t& b) { if (JSON_HEDLEY_UNLIKELY(!j.is_boolean())) { @@ -3540,7 +4164,9 @@ void from_json(const BasicJsonType& j, typename BasicJsonType::boolean_t& b) } template -void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s) +void from_json( + const BasicJsonType& j, + typename BasicJsonType::string_t& s) { if (JSON_HEDLEY_UNLIKELY(!j.is_string())) { @@ -3552,11 +4178,13 @@ void from_json(const BasicJsonType& j, typename BasicJsonType::string_t& s) template < typename BasicJsonType, typename ConstructibleStringType, enable_if_t < - is_constructible_string_type::value&& + is_constructible_string_type::value && !std::is_same::value, + ConstructibleStringType>::value, int > = 0 > -void from_json(const BasicJsonType& j, ConstructibleStringType& s) +void from_json( + const BasicJsonType& j, + ConstructibleStringType& s) { if (JSON_HEDLEY_UNLIKELY(!j.is_string())) { @@ -3567,26 +4195,34 @@ void from_json(const BasicJsonType& j, ConstructibleStringType& s) } template -void from_json(const BasicJsonType& j, typename BasicJsonType::number_float_t& val) +void from_json( + const BasicJsonType& j, + typename BasicJsonType::number_float_t& val) { get_arithmetic_value(j, val); } template -void from_json(const BasicJsonType& j, typename BasicJsonType::number_unsigned_t& val) +void from_json( + const BasicJsonType& j, + typename BasicJsonType::number_unsigned_t& val) { get_arithmetic_value(j, val); } template -void from_json(const BasicJsonType& j, typename BasicJsonType::number_integer_t& val) +void from_json( + const BasicJsonType& j, + typename BasicJsonType::number_integer_t& val) { get_arithmetic_value(j, val); } template::value, int> = 0> -void from_json(const BasicJsonType& j, EnumType& e) + enable_if_t::value, int> = 0> +void from_json( + const BasicJsonType& j, + EnumType& e) { typename std::underlying_type::type val; get_arithmetic_value(j, val); @@ -3595,8 +4231,10 @@ void from_json(const BasicJsonType& j, EnumType& e) // forward_list doesn't have an insert method template::value, int> = 0> -void from_json(const BasicJsonType& j, std::forward_list& l) + enable_if_t::value, int> = 0> +void from_json( + const BasicJsonType& j, + std::forward_list& l) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { @@ -3604,16 +4242,18 @@ void from_json(const BasicJsonType& j, std::forward_list& l) } l.clear(); std::transform(j.rbegin(), j.rend(), - std::front_inserter(l), [](const BasicJsonType & i) - { - return i.template get(); - }); + std::front_inserter(l), [](const BasicJsonType& i) + { + return i.template get(); + }); } // valarray doesn't have an insert method template::value, int> = 0> -void from_json(const BasicJsonType& j, std::valarray& l) + enable_if_t::value, int> = 0> +void from_json( + const BasicJsonType& j, + std::valarray& l) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { @@ -3621,15 +4261,17 @@ void from_json(const BasicJsonType& j, std::valarray& l) } l.resize(j.size()); std::transform(j.begin(), j.end(), std::begin(l), - [](const BasicJsonType & elem) - { - return elem.template get(); - }); + [](const BasicJsonType& elem) + { + return elem.template get(); + }); } template -auto from_json(const BasicJsonType& j, T (&arr)[N]) --> decltype(j.template get(), void()) +auto from_json( + const BasicJsonType& j, + T (& arr)[N]) +-> decltype(j.template get(), void ()) { for (std::size_t i = 0; i < N; ++i) { @@ -3638,15 +4280,20 @@ auto from_json(const BasicJsonType& j, T (&arr)[N]) } template -void from_json_array_impl(const BasicJsonType& j, typename BasicJsonType::array_t& arr, priority_tag<3> /*unused*/) +void from_json_array_impl( + const BasicJsonType& j, + typename BasicJsonType::array_t& arr, + priority_tag<3> /*unused*/) { arr = *j.template get_ptr(); } template -auto from_json_array_impl(const BasicJsonType& j, std::array& arr, - priority_tag<2> /*unused*/) --> decltype(j.template get(), void()) +auto from_json_array_impl( + const BasicJsonType& j, + std::array& arr, + priority_tag<2> /*unused*/) +-> decltype(j.template get(), void ()) { for (std::size_t i = 0; i < N; ++i) { @@ -3655,68 +4302,79 @@ auto from_json_array_impl(const BasicJsonType& j, std::array& arr, } template -auto from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr, priority_tag<1> /*unused*/) +auto from_json_array_impl( + const BasicJsonType& j, + ConstructibleArrayType& arr, + priority_tag<1> /*unused*/) -> decltype( arr.reserve(std::declval()), j.template get(), - void()) + void ()) { using std::end; ConstructibleArrayType ret; ret.reserve(j.size()); std::transform(j.begin(), j.end(), - std::inserter(ret, end(ret)), [](const BasicJsonType & i) - { - // get() returns *this, this won't call a from_json - // method when value_type is BasicJsonType - return i.template get(); - }); + std::inserter(ret, end(ret)), [](const BasicJsonType& i) + { + // get() returns *this, this won't call a from_json + // method when value_type is BasicJsonType + return i.template get(); + }); arr = std::move(ret); } template -void from_json_array_impl(const BasicJsonType& j, ConstructibleArrayType& arr, - priority_tag<0> /*unused*/) +void from_json_array_impl( + const BasicJsonType& j, + ConstructibleArrayType& arr, + priority_tag<0> /*unused*/) { using std::end; ConstructibleArrayType ret; std::transform( j.begin(), j.end(), std::inserter(ret, end(ret)), - [](const BasicJsonType & i) - { - // get() returns *this, this won't call a from_json - // method when value_type is BasicJsonType - return i.template get(); - }); + [](const BasicJsonType& i) + { + // get() returns *this, this won't call a from_json + // method when value_type is BasicJsonType + return i.template get(); + }); arr = std::move(ret); } template < typename BasicJsonType, typename ConstructibleArrayType, - enable_if_t < - is_constructible_array_type::value&& - !is_constructible_object_type::value&& - !is_constructible_string_type::value&& - !std::is_same::value&& - !is_basic_json::value, - int > = 0 > -auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr) --> decltype(from_json_array_impl(j, arr, priority_tag<3> {}), + enable_if_t < + is_constructible_array_type::value && + !is_constructible_object_type::value && + !is_constructible_string_type::value && + !std::is_same::value && + !is_basic_json::value, + int > = 0 > +auto from_json( + const BasicJsonType& j, + ConstructibleArrayType& arr) +-> decltype(from_json_array_impl(j, arr, priority_tag<3> + { + }), j.template get(), void()) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { JSON_THROW(type_error::create(302, "type must be array, but is " + - std::string(j.type_name()))); + std::string(j.type_name()))); } from_json_array_impl(j, arr, priority_tag<3> {}); } template -void from_json(const BasicJsonType& j, typename BasicJsonType::binary_t& bin) +void from_json( + const BasicJsonType& j, + typename BasicJsonType::binary_t& bin) { if (JSON_HEDLEY_UNLIKELY(!j.is_binary())) { @@ -3727,8 +4385,10 @@ void from_json(const BasicJsonType& j, typename BasicJsonType::binary_t& bin) } template::value, int> = 0> -void from_json(const BasicJsonType& j, ConstructibleObjectType& obj) + enable_if_t::value, int> = 0> +void from_json( + const BasicJsonType& j, + ConstructibleObjectType& obj) { if (JSON_HEDLEY_UNLIKELY(!j.is_object())) { @@ -3741,10 +4401,10 @@ void from_json(const BasicJsonType& j, ConstructibleObjectType& obj) std::transform( inner_object->begin(), inner_object->end(), std::inserter(ret, ret.begin()), - [](typename BasicJsonType::object_t::value_type const & p) - { - return value_type(p.first, p.second.template get()); - }); + [](typename BasicJsonType::object_t::value_type const& p) + { + return value_type(p.first, p.second.template get()); + }); obj = std::move(ret); } @@ -3753,14 +4413,16 @@ void from_json(const BasicJsonType& j, ConstructibleObjectType& obj) // overloads for boolean_t etc. in case of a custom BooleanType which is not // an arithmetic type? template < typename BasicJsonType, typename ArithmeticType, - enable_if_t < - std::is_arithmetic::value&& - !std::is_same::value&& - !std::is_same::value&& - !std::is_same::value&& - !std::is_same::value, - int > = 0 > -void from_json(const BasicJsonType& j, ArithmeticType& val) + enable_if_t < + std::is_arithmetic::value && + !std::is_same::value && + !std::is_same::value && + !std::is_same::value && + !std::is_same::value, + int > = 0 > +void from_json( + const BasicJsonType& j, + ArithmeticType& val) { switch (static_cast(j)) { @@ -3791,27 +4453,36 @@ void from_json(const BasicJsonType& j, ArithmeticType& val) } template -void from_json(const BasicJsonType& j, std::pair& p) +void from_json( + const BasicJsonType& j, + std::pair& p) { p = {j.at(0).template get(), j.at(1).template get()}; } template -void from_json_tuple_impl(const BasicJsonType& j, Tuple& t, index_sequence /*unused*/) +void from_json_tuple_impl( + const BasicJsonType& j, + Tuple& t, + index_sequence /*unused*/) { t = std::make_tuple(j.at(Idx).template get::type>()...); } -template -void from_json(const BasicJsonType& j, std::tuple& t) +template +void from_json( + const BasicJsonType& j, + std::tuple& t) { from_json_tuple_impl(j, t, index_sequence_for {}); } template < typename BasicJsonType, typename Key, typename Value, typename Compare, typename Allocator, - typename = enable_if_t < !std::is_constructible < - typename BasicJsonType::string_t, Key >::value >> -void from_json(const BasicJsonType& j, std::map& m) + typename = enable_if_t < !std::is_constructible < + typename BasicJsonType::string_t, Key >::value >> +void from_json( + const BasicJsonType& j, + std::map& m) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { @@ -3829,9 +4500,11 @@ void from_json(const BasicJsonType& j, std::map& } template < typename BasicJsonType, typename Key, typename Value, typename Hash, typename KeyEqual, typename Allocator, - typename = enable_if_t < !std::is_constructible < - typename BasicJsonType::string_t, Key >::value >> -void from_json(const BasicJsonType& j, std::unordered_map& m) + typename = enable_if_t < !std::is_constructible < + typename BasicJsonType::string_t, Key >::value >> +void from_json( + const BasicJsonType& j, + std::unordered_map& m) { if (JSON_HEDLEY_UNLIKELY(!j.is_array())) { @@ -3851,20 +4524,22 @@ void from_json(const BasicJsonType& j, std::unordered_map - auto operator()(const BasicJsonType& j, T& val) const + auto operator ()( + const BasicJsonType& j, + T& val) const noexcept(noexcept(from_json(j, val))) - -> decltype(from_json(j, val), void()) + -> decltype(from_json(j, val), void ()) { return from_json(j, val); } + }; } // namespace detail /// namespace to hold default `from_json` function /// to see why this is required: /// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html -namespace -{ +namespace { constexpr const auto& from_json = detail::static_const::value; } // namespace } // namespace nlohmann @@ -3894,28 +4569,33 @@ constexpr const auto& from_json = detail::static_const::va // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { template -void int_to_string( string_type& target, std::size_t value ) +void int_to_string( + string_type& target, + std::size_t value ) { // For ADL using std::to_string; target = to_string(value); } + template class iteration_proxy_value { - public: +public: + using difference_type = std::ptrdiff_t; using value_type = iteration_proxy_value; - using pointer = value_type * ; - using reference = value_type & ; + using pointer = value_type*; + using reference = value_type&; using iterator_category = std::input_iterator_tag; - using string_type = typename std::remove_cv< typename std::remove_reference().key() ) >::type >::type; + using string_type = + typename std::remove_cv< typename std::remove_reference().key()) > + ::type >::type; + +private: - private: /// the iterator IteratorType anchor; /// an index for arrays (used to create key names) @@ -3927,17 +4607,22 @@ template class iteration_proxy_value /// an empty string (to return a reference for primitive values) const string_type empty_str = ""; - public: - explicit iteration_proxy_value(IteratorType it) noexcept : anchor(it) {} +public: + + explicit iteration_proxy_value( + IteratorType it) noexcept + : anchor(it) + { + } /// dereference operator (needed for range-based for) - iteration_proxy_value& operator*() + iteration_proxy_value& operator *() { return *this; } /// increment operator (needed for range-based for) - iteration_proxy_value& operator++() + iteration_proxy_value& operator ++() { ++anchor; ++array_index; @@ -3946,13 +4631,15 @@ template class iteration_proxy_value } /// equality operator (needed for InputIterator) - bool operator==(const iteration_proxy_value& o) const + bool operator ==( + const iteration_proxy_value& o) const { return anchor == o.anchor; } /// inequality operator (needed for range-based for) - bool operator!=(const iteration_proxy_value& o) const + bool operator !=( + const iteration_proxy_value& o) const { return anchor != o.anchor; } @@ -3990,19 +4677,25 @@ template class iteration_proxy_value { return anchor.value(); } + }; /// proxy class for the items() function template class iteration_proxy { - private: +private: + /// the container to iterate typename IteratorType::reference container; - public: +public: + /// construct iteration proxy from a container - explicit iteration_proxy(typename IteratorType::reference cont) noexcept - : container(cont) {} + explicit iteration_proxy( + typename IteratorType::reference cont) noexcept + : container(cont) + { + } /// return iterator begin (needed for range-based for) iteration_proxy_value begin() noexcept @@ -4015,23 +4708,28 @@ template class iteration_proxy { return iteration_proxy_value(container.end()); } + }; // Structured Bindings Support // For further reference see https://blog.tartanllama.xyz/structured-bindings/ // And see https://github.com/nlohmann/json/pull/1391 template = 0> -auto get(const nlohmann::detail::iteration_proxy_value& i) -> decltype(i.key()) +auto get( + const nlohmann::detail::iteration_proxy_value& i) -> decltype(i.key()) { return i.key(); } + // Structured Bindings Support // For further reference see https://blog.tartanllama.xyz/structured-bindings/ // And see https://github.com/nlohmann/json/pull/1391 template = 0> -auto get(const nlohmann::detail::iteration_proxy_value& i) -> decltype(i.value()) +auto get( + const nlohmann::detail::iteration_proxy_value& i) -> decltype(i.value()) { return i.value(); } + } // namespace detail } // namespace nlohmann @@ -4039,28 +4737,30 @@ auto get(const nlohmann::detail::iteration_proxy_value& i) -> decl // Structured Bindings Support to the iteration_proxy_value class // For further reference see https://blog.tartanllama.xyz/structured-bindings/ // And see https://github.com/nlohmann/json/pull/1391 -namespace std -{ +namespace std { #if defined(__clang__) - // Fix: https://github.com/nlohmann/json/issues/1401 +// Fix: https://github.com/nlohmann/json/issues/1401 #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wmismatched-tags" -#endif +#endif // if defined(__clang__) template class tuple_size<::nlohmann::detail::iteration_proxy_value> - : public std::integral_constant {}; + : public std::integral_constant +{ +}; template class tuple_element> { - public: +public: + using type = decltype( - get(std::declval < - ::nlohmann::detail::iteration_proxy_value> ())); + get(std::declval < + ::nlohmann::detail::iteration_proxy_value> ())); }; #if defined(__clang__) #pragma clang diagnostic pop -#endif +#endif // if defined(__clang__) } // namespace std // #include @@ -4070,10 +4770,8 @@ class tuple_element> // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { ////////////////// // constructors // ////////////////// @@ -4084,19 +4782,24 @@ template<> struct external_constructor { template - static void construct(BasicJsonType& j, typename BasicJsonType::boolean_t b) noexcept + static void construct( + BasicJsonType& j, + typename BasicJsonType::boolean_t b) noexcept { j.m_type = value_t::boolean; j.m_value = b; j.assert_invariant(); } + }; template<> struct external_constructor { template - static void construct(BasicJsonType& j, const typename BasicJsonType::string_t& s) + static void construct( + BasicJsonType& j, + const typename BasicJsonType::string_t& s) { j.m_type = value_t::string; j.m_value = s; @@ -4104,7 +4807,9 @@ struct external_constructor } template - static void construct(BasicJsonType& j, typename BasicJsonType::string_t&& s) + static void construct( + BasicJsonType& j, + typename BasicJsonType::string_t&& s) { j.m_type = value_t::string; j.m_value = std::move(s); @@ -4112,21 +4817,26 @@ struct external_constructor } template < typename BasicJsonType, typename CompatibleStringType, - enable_if_t < !std::is_same::value, - int > = 0 > - static void construct(BasicJsonType& j, const CompatibleStringType& str) + enable_if_t < !std::is_same::value, + int > = 0 > + static void construct( + BasicJsonType& j, + const CompatibleStringType& str) { j.m_type = value_t::string; j.m_value.string = j.template create(str); j.assert_invariant(); } + }; template<> struct external_constructor { template - static void construct(BasicJsonType& j, const typename BasicJsonType::binary_t& b) + static void construct( + BasicJsonType& j, + const typename BasicJsonType::binary_t& b) { j.m_type = value_t::binary; typename BasicJsonType::binary_t value{b}; @@ -4135,56 +4845,70 @@ struct external_constructor } template - static void construct(BasicJsonType& j, typename BasicJsonType::binary_t&& b) + static void construct( + BasicJsonType& j, + typename BasicJsonType::binary_t&& b) { j.m_type = value_t::binary; typename BasicJsonType::binary_t value{std::move(b)}; j.m_value = value; j.assert_invariant(); } + }; template<> struct external_constructor { template - static void construct(BasicJsonType& j, typename BasicJsonType::number_float_t val) noexcept + static void construct( + BasicJsonType& j, + typename BasicJsonType::number_float_t val) noexcept { j.m_type = value_t::number_float; j.m_value = val; j.assert_invariant(); } + }; template<> struct external_constructor { template - static void construct(BasicJsonType& j, typename BasicJsonType::number_unsigned_t val) noexcept + static void construct( + BasicJsonType& j, + typename BasicJsonType::number_unsigned_t val) noexcept { j.m_type = value_t::number_unsigned; j.m_value = val; j.assert_invariant(); } + }; template<> struct external_constructor { template - static void construct(BasicJsonType& j, typename BasicJsonType::number_integer_t val) noexcept + static void construct( + BasicJsonType& j, + typename BasicJsonType::number_integer_t val) noexcept { j.m_type = value_t::number_integer; j.m_value = val; j.assert_invariant(); } + }; template<> struct external_constructor { template - static void construct(BasicJsonType& j, const typename BasicJsonType::array_t& arr) + static void construct( + BasicJsonType& j, + const typename BasicJsonType::array_t& arr) { j.m_type = value_t::array; j.m_value = arr; @@ -4192,7 +4916,9 @@ struct external_constructor } template - static void construct(BasicJsonType& j, typename BasicJsonType::array_t&& arr) + static void construct( + BasicJsonType& j, + typename BasicJsonType::array_t&& arr) { j.m_type = value_t::array; j.m_value = std::move(arr); @@ -4200,9 +4926,11 @@ struct external_constructor } template < typename BasicJsonType, typename CompatibleArrayType, - enable_if_t < !std::is_same::value, - int > = 0 > - static void construct(BasicJsonType& j, const CompatibleArrayType& arr) + enable_if_t < !std::is_same::value, + int > = 0 > + static void construct( + BasicJsonType& j, + const CompatibleArrayType& arr) { using std::begin; using std::end; @@ -4212,7 +4940,9 @@ struct external_constructor } template - static void construct(BasicJsonType& j, const std::vector& arr) + static void construct( + BasicJsonType& j, + const std::vector& arr) { j.m_type = value_t::array; j.m_value = value_t::array; @@ -4225,8 +4955,10 @@ struct external_constructor } template::value, int> = 0> - static void construct(BasicJsonType& j, const std::valarray& arr) + enable_if_t::value, int> = 0> + static void construct( + BasicJsonType& j, + const std::valarray& arr) { j.m_type = value_t::array; j.m_value = value_t::array; @@ -4237,13 +4969,16 @@ struct external_constructor } j.assert_invariant(); } + }; template<> struct external_constructor { template - static void construct(BasicJsonType& j, const typename BasicJsonType::object_t& obj) + static void construct( + BasicJsonType& j, + const typename BasicJsonType::object_t& obj) { j.m_type = value_t::object; j.m_value = obj; @@ -4251,7 +4986,9 @@ struct external_constructor } template - static void construct(BasicJsonType& j, typename BasicJsonType::object_t&& obj) + static void construct( + BasicJsonType& j, + typename BasicJsonType::object_t&& obj) { j.m_type = value_t::object; j.m_value = std::move(obj); @@ -4259,8 +4996,10 @@ struct external_constructor } template < typename BasicJsonType, typename CompatibleObjectType, - enable_if_t < !std::is_same::value, int > = 0 > - static void construct(BasicJsonType& j, const CompatibleObjectType& obj) + enable_if_t < !std::is_same::value, int > = 0 > + static void construct( + BasicJsonType& j, + const CompatibleObjectType& obj) { using std::begin; using std::end; @@ -4269,6 +5008,7 @@ struct external_constructor j.m_value.object = j.template create(begin(obj), end(obj)); j.assert_invariant(); } + }; ///////////// @@ -4276,101 +5016,134 @@ struct external_constructor ///////////// template::value, int> = 0> -void to_json(BasicJsonType& j, T b) noexcept + enable_if_t::value, int> = 0> +void to_json( + BasicJsonType& j, + T b) noexcept { external_constructor::construct(j, b); } template::value, int> = 0> -void to_json(BasicJsonType& j, const CompatibleString& s) + enable_if_t::value, int> = 0> +void to_json( + BasicJsonType& j, + const CompatibleString& s) { external_constructor::construct(j, s); } template -void to_json(BasicJsonType& j, typename BasicJsonType::string_t&& s) +void to_json( + BasicJsonType& j, + typename BasicJsonType::string_t&& s) { external_constructor::construct(j, std::move(s)); } template::value, int> = 0> -void to_json(BasicJsonType& j, FloatType val) noexcept + enable_if_t::value, int> = 0> +void to_json( + BasicJsonType& j, + FloatType val) noexcept { external_constructor::construct(j, static_cast(val)); } template::value, int> = 0> -void to_json(BasicJsonType& j, CompatibleNumberUnsignedType val) noexcept + enable_if_t::value, int> = 0> +void to_json( + BasicJsonType& j, + CompatibleNumberUnsignedType val) noexcept { - external_constructor::construct(j, static_cast(val)); + external_constructor::construct(j, + static_cast(val)); } template::value, int> = 0> -void to_json(BasicJsonType& j, CompatibleNumberIntegerType val) noexcept + enable_if_t::value, int> = 0> +void to_json( + BasicJsonType& j, + CompatibleNumberIntegerType val) noexcept { - external_constructor::construct(j, static_cast(val)); + external_constructor::construct(j, + static_cast(val)); } template::value, int> = 0> -void to_json(BasicJsonType& j, EnumType e) noexcept + enable_if_t::value, int> = 0> +void to_json( + BasicJsonType& j, + EnumType e) noexcept { using underlying_type = typename std::underlying_type::type; external_constructor::construct(j, static_cast(e)); } template -void to_json(BasicJsonType& j, const std::vector& e) +void to_json( + BasicJsonType& j, + const std::vector& e) { external_constructor::construct(j, e); } template < typename BasicJsonType, typename CompatibleArrayType, - enable_if_t < is_compatible_array_type::value&& - !is_compatible_object_type::value&& - !is_compatible_string_type::value&& - !std::is_same::value&& - !is_basic_json::value, - int > = 0 > -void to_json(BasicJsonType& j, const CompatibleArrayType& arr) + enable_if_t < is_compatible_array_type::value && + !is_compatible_object_type::value && + !is_compatible_string_type::value && + !std::is_same::value && + !is_basic_json::value, + int > = 0 > +void to_json( + BasicJsonType& j, + const CompatibleArrayType& arr) { external_constructor::construct(j, arr); } template -void to_json(BasicJsonType& j, const typename BasicJsonType::binary_t& bin) +void to_json( + BasicJsonType& j, + const typename BasicJsonType::binary_t& bin) { external_constructor::construct(j, bin); } template::value, int> = 0> -void to_json(BasicJsonType& j, const std::valarray& arr) + enable_if_t::value, int> = 0> +void to_json( + BasicJsonType& j, + const std::valarray& arr) { external_constructor::construct(j, std::move(arr)); } template -void to_json(BasicJsonType& j, typename BasicJsonType::array_t&& arr) +void to_json( + BasicJsonType& j, + typename BasicJsonType::array_t&& arr) { external_constructor::construct(j, std::move(arr)); } template < typename BasicJsonType, typename CompatibleObjectType, - enable_if_t < is_compatible_object_type::value&& !is_basic_json::value, int > = 0 > -void to_json(BasicJsonType& j, const CompatibleObjectType& obj) + enable_if_t < is_compatible_object_type::value && !is_basic_json::value, int > = 0 > +void to_json( + BasicJsonType& j, + const CompatibleObjectType& obj) { external_constructor::construct(j, obj); } template -void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj) +void to_json( + BasicJsonType& j, + typename BasicJsonType::object_t&& obj) { external_constructor::construct(j, std::move(obj)); } @@ -4378,35 +5151,47 @@ void to_json(BasicJsonType& j, typename BasicJsonType::object_t&& obj) template < typename BasicJsonType, typename T, std::size_t N, enable_if_t < !std::is_constructible::value, - int > = 0 > -void to_json(BasicJsonType& j, const T(&arr)[N]) + const T(&)[N]>::value, + int > = 0 > +void to_json( + BasicJsonType& j, + const T (& arr)[N]) { external_constructor::construct(j, arr); } -template < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible::value&& std::is_constructible::value, int > = 0 > -void to_json(BasicJsonType& j, const std::pair& p) +template < typename BasicJsonType, typename T1, typename T2, enable_if_t < std::is_constructible::value && std::is_constructible::value, int > = 0 > +void to_json( + BasicJsonType& j, + const std::pair& p) { j = { p.first, p.second }; } // for https://github.com/nlohmann/json/pull/1134 template>::value, int> = 0> -void to_json(BasicJsonType& j, const T& b) + enable_if_t>::value, int> = 0> +void to_json( + BasicJsonType& j, + const T& b) { j = { {b.key(), b.value()} }; } template -void to_json_tuple_impl(BasicJsonType& j, const Tuple& t, index_sequence /*unused*/) +void to_json_tuple_impl( + BasicJsonType& j, + const Tuple& t, + index_sequence /*unused*/) { j = { std::get(t)... }; } template::value, int > = 0> -void to_json(BasicJsonType& j, const T& t) +void to_json( + BasicJsonType& j, + const T& t) { to_json_tuple_impl(j, t, make_index_sequence::value> {}); } @@ -4414,61 +5199,67 @@ void to_json(BasicJsonType& j, const T& t) struct to_json_fn { template - auto operator()(BasicJsonType& j, T&& val) const noexcept(noexcept(to_json(j, std::forward(val)))) - -> decltype(to_json(j, std::forward(val)), void()) + auto operator ()( + BasicJsonType& j, + T&& val) const noexcept(noexcept(to_json(j, std::forward(val)))) + -> decltype(to_json(j, std::forward(val)), void ()) { return to_json(j, std::forward(val)); } + }; } // namespace detail /// namespace to hold default `to_json` function -namespace -{ +namespace { constexpr const auto& to_json = detail::static_const::value; } // namespace } // namespace nlohmann -namespace nlohmann -{ +namespace nlohmann { template struct adl_serializer { /*! - @brief convert a JSON value to any value type + @brief convert a JSON value to any value type - This function is usually called by the `get()` function of the - @ref basic_json class (either explicit or via conversion operators). + This function is usually called by the `get()` function of the + @ref basic_json class (either explicit or via conversion operators). - @param[in] j JSON value to read from - @param[in,out] val value to write to - */ + @param[in] j JSON value to read from + @param[in,out] val value to write to + */ template - static auto from_json(BasicJsonType&& j, ValueType& val) noexcept( + static auto from_json( + BasicJsonType&& j, + ValueType& val) noexcept( noexcept(::nlohmann::from_json(std::forward(j), val))) - -> decltype(::nlohmann::from_json(std::forward(j), val), void()) + -> decltype(::nlohmann::from_json(std::forward(j), val), void ()) { ::nlohmann::from_json(std::forward(j), val); } /*! - @brief convert any value type to a JSON value + @brief convert any value type to a JSON value - This function is usually called by the constructors of the @ref basic_json - class. + This function is usually called by the constructors of the @ref basic_json + class. - @param[in,out] j JSON value to write to - @param[in] val value to read from - */ + @param[in,out] j JSON value to write to + @param[in] val value to read from + */ template - static auto to_json(BasicJsonType& j, ValueType&& val) noexcept( + static auto to_json( + BasicJsonType& j, + ValueType&& val) noexcept( noexcept(::nlohmann::to_json(j, std::forward(val)))) - -> decltype(::nlohmann::to_json(j, std::forward(val)), void()) + -> decltype(::nlohmann::to_json(j, std::forward(val)), void ()) { ::nlohmann::to_json(j, std::forward(val)); } + }; } // namespace nlohmann @@ -4480,161 +5271,176 @@ struct adl_serializer #include // tie #include // move -namespace nlohmann -{ +namespace nlohmann { /*! -@brief an internal type for a backed binary type + @brief an internal type for a backed binary type -This type extends the template parameter @a BinaryType provided to `basic_json` -with a subtype used by BSON and MessagePack. This type exists so that the user -does not have to specify a type themselves with a specific naming scheme in -order to override the binary type. + This type extends the template parameter @a BinaryType provided to `basic_json` + with a subtype used by BSON and MessagePack. This type exists so that the user + does not have to specify a type themselves with a specific naming scheme in + order to override the binary type. -@tparam BinaryType container to store bytes (`std::vector` by + @tparam BinaryType container to store bytes (`std::vector` by default) -@since version 3.8.0 -*/ + @since version 3.8.0 + */ template class byte_container_with_subtype : public BinaryType { - public: +public: + /// the type of the underlying container using container_type = BinaryType; byte_container_with_subtype() noexcept(noexcept(container_type())) : container_type() - {} + { + } - byte_container_with_subtype(const container_type& b) noexcept(noexcept(container_type(b))) + byte_container_with_subtype( + const container_type& b) noexcept(noexcept(container_type(b))) : container_type(b) - {} + { + } - byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b)))) + byte_container_with_subtype( + container_type&& b) noexcept(noexcept(container_type(std::move(b)))) : container_type(std::move(b)) - {} + { + } - byte_container_with_subtype(const container_type& b, std::uint8_t subtype) noexcept(noexcept(container_type(b))) + byte_container_with_subtype( + const container_type& b, + std::uint8_t subtype) noexcept(noexcept(container_type(b))) : container_type(b) , m_subtype(subtype) , m_has_subtype(true) - {} + { + } - byte_container_with_subtype(container_type&& b, std::uint8_t subtype) noexcept(noexcept(container_type(std::move(b)))) + byte_container_with_subtype( + container_type&& b, + std::uint8_t subtype) noexcept(noexcept(container_type(std::move(b)))) : container_type(std::move(b)) , m_subtype(subtype) , m_has_subtype(true) - {} + { + } - bool operator==(const byte_container_with_subtype& rhs) const + bool operator ==( + const byte_container_with_subtype& rhs) const { return std::tie(static_cast(*this), m_subtype, m_has_subtype) == std::tie(static_cast(rhs), rhs.m_subtype, rhs.m_has_subtype); } - bool operator!=(const byte_container_with_subtype& rhs) const + bool operator !=( + const byte_container_with_subtype& rhs) const { return !(rhs == *this); } /*! - @brief sets the binary subtype + @brief sets the binary subtype - Sets the binary subtype of the value, also flags a binary JSON value as - having a subtype, which has implications for serialization. + Sets the binary subtype of the value, also flags a binary JSON value as + having a subtype, which has implications for serialization. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @sa @ref subtype() -- return the binary subtype - @sa @ref clear_subtype() -- clears the binary subtype - @sa @ref has_subtype() -- returns whether or not the binary value has a - subtype + @sa @ref subtype() -- return the binary subtype + @sa @ref clear_subtype() -- clears the binary subtype + @sa @ref has_subtype() -- returns whether or not the binary value has a + subtype - @since version 3.8.0 - */ - void set_subtype(std::uint8_t subtype) noexcept + @since version 3.8.0 + */ + void set_subtype( + std::uint8_t subtype) noexcept { m_subtype = subtype; m_has_subtype = true; } /*! - @brief return the binary subtype + @brief return the binary subtype - Returns the numerical subtype of the value if it has a subtype. If it does - not have a subtype, this function will return size_t(-1) as a sentinel - value. + Returns the numerical subtype of the value if it has a subtype. If it does + not have a subtype, this function will return size_t(-1) as a sentinel + value. - @return the numerical subtype of the binary value + @return the numerical subtype of the binary value - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @sa @ref set_subtype() -- sets the binary subtype - @sa @ref clear_subtype() -- clears the binary subtype - @sa @ref has_subtype() -- returns whether or not the binary value has a - subtype + @sa @ref set_subtype() -- sets the binary subtype + @sa @ref clear_subtype() -- clears the binary subtype + @sa @ref has_subtype() -- returns whether or not the binary value has a + subtype - @since version 3.8.0 - */ + @since version 3.8.0 + */ constexpr std::uint8_t subtype() const noexcept { return m_subtype; } /*! - @brief return whether the value has a subtype + @brief return whether the value has a subtype - @return whether the value has a subtype + @return whether the value has a subtype - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @sa @ref subtype() -- return the binary subtype - @sa @ref set_subtype() -- sets the binary subtype - @sa @ref clear_subtype() -- clears the binary subtype + @sa @ref subtype() -- return the binary subtype + @sa @ref set_subtype() -- sets the binary subtype + @sa @ref clear_subtype() -- clears the binary subtype - @since version 3.8.0 - */ + @since version 3.8.0 + */ constexpr bool has_subtype() const noexcept { return m_has_subtype; } /*! - @brief clears the binary subtype + @brief clears the binary subtype - Clears the binary subtype and flags the value as not having a subtype, which - has implications for serialization; for instance MessagePack will prefer the - bin family over the ext family. + Clears the binary subtype and flags the value as not having a subtype, which + has implications for serialization; for instance MessagePack will prefer the + bin family over the ext family. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @sa @ref subtype() -- return the binary subtype - @sa @ref set_subtype() -- sets the binary subtype - @sa @ref has_subtype() -- returns whether or not the binary value has a - subtype + @sa @ref subtype() -- return the binary subtype + @sa @ref set_subtype() -- sets the binary subtype + @sa @ref has_subtype() -- returns whether or not the binary value has a + subtype - @since version 3.8.0 - */ + @since version 3.8.0 + */ void clear_subtype() noexcept { m_subtype = 0; m_has_subtype = false; } - private: +private: + std::uint8_t m_subtype = 0; bool m_has_subtype = false; }; @@ -4653,31 +5459,32 @@ class byte_container_with_subtype : public BinaryType #include // size_t, uint8_t #include // hash -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { // boost::hash_combine -inline std::size_t combine(std::size_t seed, std::size_t h) noexcept +inline std::size_t combine( + std::size_t seed, + std::size_t h) noexcept { seed ^= h + 0x9e3779b9 + (seed << 6U) + (seed >> 2U); return seed; } /*! -@brief hash a JSON value + @brief hash a JSON value -The hash function tries to rely on std::hash where possible. Furthermore, the -type of the JSON value is taken into account to have different hash values for -null, 0, 0U, and false, etc. + The hash function tries to rely on std::hash where possible. Furthermore, the + type of the JSON value is taken into account to have different hash values for + null, 0, 0U, and false, etc. -@tparam BasicJsonType basic_json specialization -@param j JSON value to hash -@return hash value of j -*/ + @tparam BasicJsonType basic_json specialization + @param j JSON value to hash + @return hash value of j + */ template -std::size_t hash(const BasicJsonType& j) +std::size_t hash( + const BasicJsonType& j) { using string_t = typename BasicJsonType::string_t; using number_integer_t = typename BasicJsonType::number_integer_t; @@ -4804,60 +5611,70 @@ std::size_t hash(const BasicJsonType& j) // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { /// the supported input formats -enum class input_format_t { json, cbor, msgpack, ubjson, bson }; +enum class input_format_t +{ + json, cbor, msgpack, ubjson, bson +}; //////////////////// // input adapters // //////////////////// /*! -Input adapter for stdio file access. This adapter read only 1 byte and do not use any - buffer. This adapter is a very low level adapter. -*/ + Input adapter for stdio file access. This adapter read only 1 byte and do not use any + buffer. This adapter is a very low level adapter. + */ class file_input_adapter { - public: +public: + using char_type = char; JSON_HEDLEY_NON_NULL(2) - explicit file_input_adapter(std::FILE* f) noexcept + explicit file_input_adapter( + std::FILE* f) noexcept : m_file(f) - {} + { + } // make class move-only - file_input_adapter(const file_input_adapter&) = delete; - file_input_adapter(file_input_adapter&&) = default; - file_input_adapter& operator=(const file_input_adapter&) = delete; - file_input_adapter& operator=(file_input_adapter&&) = delete; + file_input_adapter( + const file_input_adapter&) = delete; + file_input_adapter( + file_input_adapter&&) = default; + file_input_adapter& operator =( + const file_input_adapter&) = delete; + file_input_adapter& operator =( + file_input_adapter&&) = delete; std::char_traits::int_type get_character() noexcept { return std::fgetc(m_file); } - private: +private: + /// the file pointer to read from std::FILE* m_file; }; /*! -Input adapter for a (caching) istream. Ignores a UFT Byte Order Mark at -beginning of input. Does not support changing the underlying std::streambuf -in mid-input. Maintains underlying std::istream and std::streambuf to support -subsequent use of standard std::istream operations to process any input -characters following those used in parsing the JSON input. Clears the -std::istream flags; any input errors (e.g., EOF) will be detected by the first -subsequent call for input from the std::istream. -*/ + Input adapter for a (caching) istream. Ignores a UFT Byte Order Mark at + beginning of input. Does not support changing the underlying std::streambuf + in mid-input. Maintains underlying std::istream and std::streambuf to support + subsequent use of standard std::istream operations to process any input + characters following those used in parsing the JSON input. Clears the + std::istream flags; any input errors (e.g., EOF) will be detected by the first + subsequent call for input from the std::istream. + */ class input_stream_adapter { - public: +public: + using char_type = char; ~input_stream_adapter() @@ -4870,16 +5687,25 @@ class input_stream_adapter } } - explicit input_stream_adapter(std::istream& i) - : is(&i), sb(i.rdbuf()) - {} + explicit input_stream_adapter( + std::istream& i) + : is(&i) + , sb(i.rdbuf()) + { + } // delete because of pointer members - input_stream_adapter(const input_stream_adapter&) = delete; - input_stream_adapter& operator=(input_stream_adapter&) = delete; - input_stream_adapter& operator=(input_stream_adapter&& rhs) = delete; - - input_stream_adapter(input_stream_adapter&& rhs) noexcept : is(rhs.is), sb(rhs.sb) + input_stream_adapter( + const input_stream_adapter&) = delete; + input_stream_adapter& operator =( + input_stream_adapter&) = delete; + input_stream_adapter& operator =( + input_stream_adapter&& rhs) = delete; + + input_stream_adapter( + input_stream_adapter&& rhs) noexcept + : is(rhs.is) + , sb(rhs.sb) { rhs.is = nullptr; rhs.sb = nullptr; @@ -4899,7 +5725,8 @@ class input_stream_adapter return res; } - private: +private: + /// the associated input stream std::istream* is = nullptr; std::streambuf* sb = nullptr; @@ -4910,11 +5737,17 @@ class input_stream_adapter template class iterator_input_adapter { - public: +public: + using char_type = typename std::iterator_traits::value_type; - iterator_input_adapter(IteratorType first, IteratorType last) - : current(std::move(first)), end(std::move(last)) {} + iterator_input_adapter( + IteratorType first, + IteratorType last) + : current(std::move(first)) + , end(std::move(last)) + { + } typename std::char_traits::int_type get_character() { @@ -4930,7 +5763,8 @@ class iterator_input_adapter } } - private: +private: + IteratorType current; IteratorType end; @@ -4952,10 +5786,11 @@ template struct wide_string_input_helper { // UTF-32 - static void fill_buffer(BaseInputAdapter& input, - std::array::int_type, 4>& utf8_bytes, - size_t& utf8_bytes_index, - size_t& utf8_bytes_filled) + static void fill_buffer( + BaseInputAdapter& input, + std::array::int_type, 4>& utf8_bytes, + size_t& utf8_bytes_index, + size_t& utf8_bytes_filled) { utf8_bytes_index = 0; @@ -4977,23 +5812,41 @@ struct wide_string_input_helper } else if (wc <= 0x7FF) { - utf8_bytes[0] = static_cast::int_type>(0xC0u | ((static_cast(wc) >> 6u) & 0x1Fu)); - utf8_bytes[1] = static_cast::int_type>(0x80u | (static_cast(wc) & 0x3Fu)); + utf8_bytes[0] = + static_cast::int_type>(0xC0u | + ((static_cast(wc) >> 6u) & 0x1Fu)); + utf8_bytes[1] = + static_cast::int_type>(0x80u | + (static_cast(wc) & 0x3Fu)); utf8_bytes_filled = 2; } else if (wc <= 0xFFFF) { - utf8_bytes[0] = static_cast::int_type>(0xE0u | ((static_cast(wc) >> 12u) & 0x0Fu)); - utf8_bytes[1] = static_cast::int_type>(0x80u | ((static_cast(wc) >> 6u) & 0x3Fu)); - utf8_bytes[2] = static_cast::int_type>(0x80u | (static_cast(wc) & 0x3Fu)); + utf8_bytes[0] = + static_cast::int_type>(0xE0u | + ((static_cast(wc) >> 12u) & 0x0Fu)); + utf8_bytes[1] = + static_cast::int_type>(0x80u | + ((static_cast(wc) >> 6u) & 0x3Fu)); + utf8_bytes[2] = + static_cast::int_type>(0x80u | + (static_cast(wc) & 0x3Fu)); utf8_bytes_filled = 3; } else if (wc <= 0x10FFFF) { - utf8_bytes[0] = static_cast::int_type>(0xF0u | ((static_cast(wc) >> 18u) & 0x07u)); - utf8_bytes[1] = static_cast::int_type>(0x80u | ((static_cast(wc) >> 12u) & 0x3Fu)); - utf8_bytes[2] = static_cast::int_type>(0x80u | ((static_cast(wc) >> 6u) & 0x3Fu)); - utf8_bytes[3] = static_cast::int_type>(0x80u | (static_cast(wc) & 0x3Fu)); + utf8_bytes[0] = + static_cast::int_type>(0xF0u | + ((static_cast(wc) >> 18u) & 0x07u)); + utf8_bytes[1] = + static_cast::int_type>(0x80u | + ((static_cast(wc) >> 12u) & 0x3Fu)); + utf8_bytes[2] = + static_cast::int_type>(0x80u | + ((static_cast(wc) >> 6u) & 0x3Fu)); + utf8_bytes[3] = + static_cast::int_type>(0x80u | + (static_cast(wc) & 0x3Fu)); utf8_bytes_filled = 4; } else @@ -5004,16 +5857,18 @@ struct wide_string_input_helper } } } + }; template struct wide_string_input_helper { // UTF-16 - static void fill_buffer(BaseInputAdapter& input, - std::array::int_type, 4>& utf8_bytes, - size_t& utf8_bytes_index, - size_t& utf8_bytes_filled) + static void fill_buffer( + BaseInputAdapter& input, + std::array::int_type, 4>& utf8_bytes, + size_t& utf8_bytes_index, + size_t& utf8_bytes_filled) { utf8_bytes_index = 0; @@ -5035,15 +5890,25 @@ struct wide_string_input_helper } else if (wc <= 0x7FF) { - utf8_bytes[0] = static_cast::int_type>(0xC0u | ((static_cast(wc) >> 6u))); - utf8_bytes[1] = static_cast::int_type>(0x80u | (static_cast(wc) & 0x3Fu)); + utf8_bytes[0] = + static_cast::int_type>(0xC0u | + ((static_cast(wc) >> 6u))); + utf8_bytes[1] = + static_cast::int_type>(0x80u | + (static_cast(wc) & 0x3Fu)); utf8_bytes_filled = 2; } else if (0xD800 > wc || wc >= 0xE000) { - utf8_bytes[0] = static_cast::int_type>(0xE0u | ((static_cast(wc) >> 12u))); - utf8_bytes[1] = static_cast::int_type>(0x80u | ((static_cast(wc) >> 6u) & 0x3Fu)); - utf8_bytes[2] = static_cast::int_type>(0x80u | (static_cast(wc) & 0x3Fu)); + utf8_bytes[0] = + static_cast::int_type>(0xE0u | + ((static_cast(wc) >> 12u))); + utf8_bytes[1] = + static_cast::int_type>(0x80u | + ((static_cast(wc) >> 6u) & 0x3Fu)); + utf8_bytes[2] = + static_cast::int_type>(0x80u | + (static_cast(wc) & 0x3Fu)); utf8_bytes_filled = 3; } else @@ -5051,7 +5916,8 @@ struct wide_string_input_helper if (JSON_HEDLEY_UNLIKELY(!input.empty())) { const auto wc2 = static_cast(input.get_character()); - const auto charcode = 0x10000u + (((static_cast(wc) & 0x3FFu) << 10u) | (wc2 & 0x3FFu)); + const auto charcode = 0x10000u + + (((static_cast(wc) & 0x3FFu) << 10u) | (wc2 & 0x3FFu)); utf8_bytes[0] = static_cast::int_type>(0xF0u | (charcode >> 18u)); utf8_bytes[1] = static_cast::int_type>(0x80u | ((charcode >> 12u) & 0x3Fu)); utf8_bytes[2] = static_cast::int_type>(0x80u | ((charcode >> 6u) & 0x3Fu)); @@ -5066,17 +5932,22 @@ struct wide_string_input_helper } } } + }; // Wraps another input apdater to convert wide character types into individual bytes. template class wide_string_input_adapter { - public: +public: + using char_type = char; - wide_string_input_adapter(BaseInputAdapter base) - : base_adapter(base) {} + wide_string_input_adapter( + BaseInputAdapter base) + : base_adapter(base) + { + } typename std::char_traits::int_type get_character() noexcept { @@ -5095,13 +5966,15 @@ class wide_string_input_adapter return utf8_bytes[utf8_bytes_index++]; } - private: +private: + BaseInputAdapter base_adapter; template void fill_buffer() { - wide_string_input_helper::fill_buffer(base_adapter, utf8_bytes, utf8_bytes_index, utf8_bytes_filled); + wide_string_input_helper::fill_buffer(base_adapter, utf8_bytes, utf8_bytes_index, + utf8_bytes_filled); } /// a buffer for UTF-8 bytes @@ -5121,10 +5994,13 @@ struct iterator_input_adapter_factory using char_type = typename std::iterator_traits::value_type; using adapter_type = iterator_input_adapter; - static adapter_type create(IteratorType first, IteratorType last) + static adapter_type create( + IteratorType first, + IteratorType last) { return adapter_type(std::move(first), std::move(last)); } + }; template @@ -5145,15 +6021,20 @@ struct iterator_input_adapter_factory; using adapter_type = wide_string_input_adapter; - static adapter_type create(IteratorType first, IteratorType last) + static adapter_type create( + IteratorType first, + IteratorType last) { return adapter_type(base_adapter_type(std::move(first), std::move(last))); } + }; // General purpose iterator-based input template -typename iterator_input_adapter_factory::adapter_type input_adapter(IteratorType first, IteratorType last) +typename iterator_input_adapter_factory::adapter_type input_adapter( + IteratorType first, + IteratorType last) { using factory_type = iterator_input_adapter_factory; return factory_type::create(first, last); @@ -5161,7 +6042,8 @@ typename iterator_input_adapter_factory::adapter_type input_adapte // Convenience shorthand from container to iterator template -auto input_adapter(const ContainerType& container) -> decltype(input_adapter(begin(container), end(container))) +auto input_adapter( + const ContainerType& container) -> decltype(input_adapter(begin(container), end(container))) { // Enable ADL using std::begin; @@ -5171,32 +6053,37 @@ auto input_adapter(const ContainerType& container) -> decltype(input_adapter(beg } // Special cases with fast paths -inline file_input_adapter input_adapter(std::FILE* file) +inline file_input_adapter input_adapter( + std::FILE* file) { return file_input_adapter(file); } -inline input_stream_adapter input_adapter(std::istream& stream) +inline input_stream_adapter input_adapter( + std::istream& stream) { return input_stream_adapter(stream); } -inline input_stream_adapter input_adapter(std::istream&& stream) +inline input_stream_adapter input_adapter( + std::istream&& stream) { return input_stream_adapter(stream); } -using contiguous_bytes_input_adapter = decltype(input_adapter(std::declval(), std::declval())); +using contiguous_bytes_input_adapter = + decltype(input_adapter(std::declval(), std::declval())); // Null-delimited strings, and the like. template < typename CharT, - typename std::enable_if < - std::is_pointer::value&& - !std::is_array::value&& - std::is_integral::type>::value&& - sizeof(typename std::remove_pointer::type) == 1, - int >::type = 0 > -contiguous_bytes_input_adapter input_adapter(CharT b) + typename std::enable_if < + std::is_pointer::value && + !std::is_array::value && + std::is_integral::type>::value && + sizeof(typename std::remove_pointer::type) == 1, + int >::type = 0 > +contiguous_bytes_input_adapter input_adapter( + CharT b) { auto length = std::strlen(reinterpret_cast(b)); const auto* ptr = reinterpret_cast(b); @@ -5204,7 +6091,8 @@ contiguous_bytes_input_adapter input_adapter(CharT b) } template -auto input_adapter(T (&array)[N]) -> decltype(input_adapter(array, array + N)) +auto input_adapter( + T (& array)[N]) -> decltype(input_adapter(array, array + N)) { return input_adapter(array, array + N); } @@ -5214,29 +6102,40 @@ auto input_adapter(T (&array)[N]) -> decltype(input_adapter(array, array + N)) // to the correct adapter. class span_input_adapter { - public: +public: + template < typename CharT, - typename std::enable_if < - std::is_pointer::value&& - std::is_integral::type>::value&& - sizeof(typename std::remove_pointer::type) == 1, - int >::type = 0 > - span_input_adapter(CharT b, std::size_t l) - : ia(reinterpret_cast(b), reinterpret_cast(b) + l) {} + typename std::enable_if < + std::is_pointer::value && + std::is_integral::type>::value && + sizeof(typename std::remove_pointer::type) == 1, + int >::type = 0 > + span_input_adapter( + CharT b, + std::size_t l) + : ia(reinterpret_cast(b), reinterpret_cast(b) + l) + { + } template::iterator_category, std::random_access_iterator_tag>::value, - int>::type = 0> - span_input_adapter(IteratorType first, IteratorType last) - : ia(input_adapter(first, last)) {} + typename std::enable_if< + std::is_same::iterator_category, + std::random_access_iterator_tag>::value, + int>::type = 0> + span_input_adapter( + IteratorType first, + IteratorType last) + : ia(input_adapter(first, last)) + { + } contiguous_bytes_input_adapter&& get() { return std::move(ia); } - private: +private: + contiguous_bytes_input_adapter ia; }; } // namespace detail @@ -5255,17 +6154,16 @@ class span_input_adapter // #include -namespace nlohmann -{ +namespace nlohmann { /*! -@brief SAX interface + @brief SAX interface -This class describes the SAX interface used by @ref nlohmann::json::sax_parse. -Each function is called in different situations while the input is parsed. The -boolean return value informs the parser whether to continue processing the -input. -*/ + This class describes the SAX interface used by @ref nlohmann::json::sax_parse. + Each function is called in different situations while the input is parsed. The + boolean return value informs the parser whether to continue processing the + input. + */ template struct json_sax { @@ -5276,126 +6174,137 @@ struct json_sax using binary_t = typename BasicJsonType::binary_t; /*! - @brief a null value was read - @return whether parsing should proceed - */ + @brief a null value was read + @return whether parsing should proceed + */ virtual bool null() = 0; /*! - @brief a boolean value was read - @param[in] val boolean value - @return whether parsing should proceed - */ - virtual bool boolean(bool val) = 0; + @brief a boolean value was read + @param[in] val boolean value + @return whether parsing should proceed + */ + virtual bool boolean( + bool val) = 0; /*! - @brief an integer number was read - @param[in] val integer value - @return whether parsing should proceed - */ - virtual bool number_integer(number_integer_t val) = 0; + @brief an integer number was read + @param[in] val integer value + @return whether parsing should proceed + */ + virtual bool number_integer( + number_integer_t val) = 0; /*! - @brief an unsigned integer number was read - @param[in] val unsigned integer value - @return whether parsing should proceed - */ - virtual bool number_unsigned(number_unsigned_t val) = 0; + @brief an unsigned integer number was read + @param[in] val unsigned integer value + @return whether parsing should proceed + */ + virtual bool number_unsigned( + number_unsigned_t val) = 0; /*! - @brief an floating-point number was read - @param[in] val floating-point value - @param[in] s raw token value - @return whether parsing should proceed - */ - virtual bool number_float(number_float_t val, const string_t& s) = 0; + @brief an floating-point number was read + @param[in] val floating-point value + @param[in] s raw token value + @return whether parsing should proceed + */ + virtual bool number_float( + number_float_t val, + const string_t& s) = 0; /*! - @brief a string was read - @param[in] val string value - @return whether parsing should proceed - @note It is safe to move the passed string. - */ - virtual bool string(string_t& val) = 0; + @brief a string was read + @param[in] val string value + @return whether parsing should proceed + @note It is safe to move the passed string. + */ + virtual bool string( + string_t& val) = 0; /*! - @brief a binary string was read - @param[in] val binary value - @return whether parsing should proceed - @note It is safe to move the passed binary. - */ - virtual bool binary(binary_t& val) = 0; + @brief a binary string was read + @param[in] val binary value + @return whether parsing should proceed + @note It is safe to move the passed binary. + */ + virtual bool binary( + binary_t& val) = 0; /*! - @brief the beginning of an object was read - @param[in] elements number of object elements or -1 if unknown - @return whether parsing should proceed - @note binary formats may report the number of elements - */ - virtual bool start_object(std::size_t elements) = 0; + @brief the beginning of an object was read + @param[in] elements number of object elements or -1 if unknown + @return whether parsing should proceed + @note binary formats may report the number of elements + */ + virtual bool start_object( + std::size_t elements) = 0; /*! - @brief an object key was read - @param[in] val object key - @return whether parsing should proceed - @note It is safe to move the passed string. - */ - virtual bool key(string_t& val) = 0; + @brief an object key was read + @param[in] val object key + @return whether parsing should proceed + @note It is safe to move the passed string. + */ + virtual bool key( + string_t& val) = 0; /*! - @brief the end of an object was read - @return whether parsing should proceed - */ + @brief the end of an object was read + @return whether parsing should proceed + */ virtual bool end_object() = 0; /*! - @brief the beginning of an array was read - @param[in] elements number of array elements or -1 if unknown - @return whether parsing should proceed - @note binary formats may report the number of elements - */ - virtual bool start_array(std::size_t elements) = 0; + @brief the beginning of an array was read + @param[in] elements number of array elements or -1 if unknown + @return whether parsing should proceed + @note binary formats may report the number of elements + */ + virtual bool start_array( + std::size_t elements) = 0; /*! - @brief the end of an array was read - @return whether parsing should proceed - */ + @brief the end of an array was read + @return whether parsing should proceed + */ virtual bool end_array() = 0; /*! - @brief a parse error occurred - @param[in] position the position in the input where the error occurs - @param[in] last_token the last read token - @param[in] ex an exception object describing the error - @return whether parsing should proceed (must return false) - */ - virtual bool parse_error(std::size_t position, - const std::string& last_token, - const detail::exception& ex) = 0; + @brief a parse error occurred + @param[in] position the position in the input where the error occurs + @param[in] last_token the last read token + @param[in] ex an exception object describing the error + @return whether parsing should proceed (must return false) + */ + virtual bool parse_error( + std::size_t position, + const std::string& last_token, + const detail::exception& ex) = 0; virtual ~json_sax() = default; }; -namespace detail -{ +namespace detail { /*! -@brief SAX implementation to create a JSON value from SAX events + @brief SAX implementation to create a JSON value from SAX events -This class implements the @ref json_sax interface and processes the SAX events -to create a JSON value which makes it basically a DOM parser. The structure or -hierarchy of the JSON value is managed by the stack `ref_stack` which contains -a pointer to the respective array or object for each recursion depth. + This class implements the @ref json_sax interface and processes the SAX events + to create a JSON value which makes it basically a DOM parser. The structure or + hierarchy of the JSON value is managed by the stack `ref_stack` which contains + a pointer to the respective array or object for each recursion depth. -After successful parsing, the value that is passed by reference to the -constructor contains the parsed value. + After successful parsing, the value that is passed by reference to the + constructor contains the parsed value. -@tparam BasicJsonType the JSON type -*/ + @tparam BasicJsonType the JSON type + */ template class json_sax_dom_parser { - public: +public: + using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; @@ -5403,19 +6312,27 @@ class json_sax_dom_parser using binary_t = typename BasicJsonType::binary_t; /*! - @param[in, out] r reference to a JSON value that is manipulated while + @param[in, out] r reference to a JSON value that is manipulated while parsing - @param[in] allow_exceptions_ whether parse errors yield exceptions - */ - explicit json_sax_dom_parser(BasicJsonType& r, const bool allow_exceptions_ = true) - : root(r), allow_exceptions(allow_exceptions_) - {} + @param[in] allow_exceptions_ whether parse errors yield exceptions + */ + explicit json_sax_dom_parser( + BasicJsonType& r, + const bool allow_exceptions_ = true) + : root(r) + , allow_exceptions(allow_exceptions_) + { + } // make class move-only - json_sax_dom_parser(const json_sax_dom_parser&) = delete; - json_sax_dom_parser(json_sax_dom_parser&&) = default; - json_sax_dom_parser& operator=(const json_sax_dom_parser&) = delete; - json_sax_dom_parser& operator=(json_sax_dom_parser&&) = default; + json_sax_dom_parser( + const json_sax_dom_parser&) = delete; + json_sax_dom_parser( + json_sax_dom_parser&&) = default; + json_sax_dom_parser& operator =( + const json_sax_dom_parser&) = delete; + json_sax_dom_parser& operator =( + json_sax_dom_parser&&) = default; ~json_sax_dom_parser() = default; bool null() @@ -5424,59 +6341,68 @@ class json_sax_dom_parser return true; } - bool boolean(bool val) + bool boolean( + bool val) { handle_value(val); return true; } - bool number_integer(number_integer_t val) + bool number_integer( + number_integer_t val) { handle_value(val); return true; } - bool number_unsigned(number_unsigned_t val) + bool number_unsigned( + number_unsigned_t val) { handle_value(val); return true; } - bool number_float(number_float_t val, const string_t& /*unused*/) + bool number_float( + number_float_t val, + const string_t& /*unused*/) { handle_value(val); return true; } - bool string(string_t& val) + bool string( + string_t& val) { handle_value(val); return true; } - bool binary(binary_t& val) + bool binary( + binary_t& val) { handle_value(std::move(val)); return true; } - bool start_object(std::size_t len) + bool start_object( + std::size_t len) { ref_stack.push_back(handle_value(BasicJsonType::value_t::object)); if (JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size())) { JSON_THROW(out_of_range::create(408, - "excessive object size: " + std::to_string(len))); + "excessive object size: " + std::to_string(len))); } return true; } - bool key(string_t& val) + bool key( + string_t& val) { // add null at given key and store the reference for later - object_element = &(ref_stack.back()->m_value.object->operator[](val)); + object_element = &(ref_stack.back()->m_value.object->operator [](val)); return true; } @@ -5486,14 +6412,15 @@ class json_sax_dom_parser return true; } - bool start_array(std::size_t len) + bool start_array( + std::size_t len) { ref_stack.push_back(handle_value(BasicJsonType::value_t::array)); if (JSON_HEDLEY_UNLIKELY(len != std::size_t(-1) && len > ref_stack.back()->max_size())) { JSON_THROW(out_of_range::create(408, - "excessive array size: " + std::to_string(len))); + "excessive array size: " + std::to_string(len))); } return true; @@ -5506,8 +6433,10 @@ class json_sax_dom_parser } template - bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, - const Exception& ex) + bool parse_error( + std::size_t /*unused*/, + const std::string& /*unused*/, + const Exception& ex) { errored = true; static_cast(ex); @@ -5523,16 +6452,18 @@ class json_sax_dom_parser return errored; } - private: +private: + /*! - @invariant If the ref stack is empty, then the passed value will be the new + @invariant If the ref stack is empty, then the passed value will be the new root. - @invariant If the ref stack contains a value, then it is an array or an + @invariant If the ref stack contains a value, then it is an array or an object to which we can add elements - */ + */ template JSON_HEDLEY_RETURNS_NON_NULL - BasicJsonType* handle_value(Value&& v) + BasicJsonType* handle_value( + Value&& v) { if (ref_stack.empty()) { @@ -5569,7 +6500,8 @@ class json_sax_dom_parser template class json_sax_dom_callback_parser { - public: +public: + using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; @@ -5578,19 +6510,26 @@ class json_sax_dom_callback_parser using parser_callback_t = typename BasicJsonType::parser_callback_t; using parse_event_t = typename BasicJsonType::parse_event_t; - json_sax_dom_callback_parser(BasicJsonType& r, - const parser_callback_t cb, - const bool allow_exceptions_ = true) - : root(r), callback(cb), allow_exceptions(allow_exceptions_) + json_sax_dom_callback_parser( + BasicJsonType& r, + const parser_callback_t cb, + const bool allow_exceptions_ = true) + : root(r) + , callback(cb) + , allow_exceptions(allow_exceptions_) { keep_stack.push_back(true); } // make class move-only - json_sax_dom_callback_parser(const json_sax_dom_callback_parser&) = delete; - json_sax_dom_callback_parser(json_sax_dom_callback_parser&&) = default; - json_sax_dom_callback_parser& operator=(const json_sax_dom_callback_parser&) = delete; - json_sax_dom_callback_parser& operator=(json_sax_dom_callback_parser&&) = default; + json_sax_dom_callback_parser( + const json_sax_dom_callback_parser&) = delete; + json_sax_dom_callback_parser( + json_sax_dom_callback_parser&&) = default; + json_sax_dom_callback_parser& operator =( + const json_sax_dom_callback_parser&) = delete; + json_sax_dom_callback_parser& operator =( + json_sax_dom_callback_parser&&) = default; ~json_sax_dom_callback_parser() = default; bool null() @@ -5599,43 +6538,51 @@ class json_sax_dom_callback_parser return true; } - bool boolean(bool val) + bool boolean( + bool val) { handle_value(val); return true; } - bool number_integer(number_integer_t val) + bool number_integer( + number_integer_t val) { handle_value(val); return true; } - bool number_unsigned(number_unsigned_t val) + bool number_unsigned( + number_unsigned_t val) { handle_value(val); return true; } - bool number_float(number_float_t val, const string_t& /*unused*/) + bool number_float( + number_float_t val, + const string_t& /*unused*/) { handle_value(val); return true; } - bool string(string_t& val) + bool string( + string_t& val) { handle_value(val); return true; } - bool binary(binary_t& val) + bool binary( + binary_t& val) { handle_value(std::move(val)); return true; } - bool start_object(std::size_t len) + bool start_object( + std::size_t len) { // check callback for object start const bool keep = callback(static_cast(ref_stack.size()), parse_event_t::object_start, discarded); @@ -5653,7 +6600,8 @@ class json_sax_dom_callback_parser return true; } - bool key(string_t& val) + bool key( + string_t& val) { BasicJsonType k = BasicJsonType(val); @@ -5664,7 +6612,7 @@ class json_sax_dom_callback_parser // add discarded value at given key and store the reference for later if (keep && ref_stack.back()) { - object_element = &(ref_stack.back()->m_value.object->operator[](val) = discarded); + object_element = &(ref_stack.back()->m_value.object->operator [](val) = discarded); } return true; @@ -5672,7 +6620,8 @@ class json_sax_dom_callback_parser bool end_object() { - if (ref_stack.back() && !callback(static_cast(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back())) + if (ref_stack.back() && + !callback(static_cast(ref_stack.size()) - 1, parse_event_t::object_end, *ref_stack.back())) { // discard object *ref_stack.back() = discarded; @@ -5699,7 +6648,8 @@ class json_sax_dom_callback_parser return true; } - bool start_array(std::size_t len) + bool start_array( + std::size_t len) { const bool keep = callback(static_cast(ref_stack.size()), parse_event_t::array_start, discarded); keep_stack.push_back(keep); @@ -5745,8 +6695,10 @@ class json_sax_dom_callback_parser } template - bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, - const Exception& ex) + bool parse_error( + std::size_t /*unused*/, + const std::string& /*unused*/, + const Exception& ex) { errored = true; static_cast(ex); @@ -5762,24 +6714,27 @@ class json_sax_dom_callback_parser return errored; } - private: +private: + /*! - @param[in] v value to add to the JSON value we build during parsing - @param[in] skip_callback whether we should skip calling the callback + @param[in] v value to add to the JSON value we build during parsing + @param[in] skip_callback whether we should skip calling the callback function; this is required after start_array() and start_object() SAX events, because otherwise we would call the callback function with an empty array or object, respectively. - @invariant If the ref stack is empty, then the passed value will be the new + @invariant If the ref stack is empty, then the passed value will be the new root. - @invariant If the ref stack contains a value, then it is an array or an + @invariant If the ref stack contains a value, then it is an array or an object to which we can add elements - @return pair of boolean (whether value should be kept) and pointer (to the + @return pair of boolean (whether value should be kept) and pointer (to the passed value in the ref_stack hierarchy; nullptr if not kept) - */ + */ template - std::pair handle_value(Value&& v, const bool skip_callback = false) + std::pair handle_value( + Value&& v, + const bool skip_callback = false) { JSON_ASSERT(!keep_stack.empty()); @@ -5865,7 +6820,8 @@ class json_sax_dom_callback_parser template class json_sax_acceptor { - public: +public: + using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; using number_float_t = typename BasicJsonType::number_float_t; @@ -5877,42 +6833,51 @@ class json_sax_acceptor return true; } - bool boolean(bool /*unused*/) + bool boolean( + bool /*unused*/) { return true; } - bool number_integer(number_integer_t /*unused*/) + bool number_integer( + number_integer_t /*unused*/) { return true; } - bool number_unsigned(number_unsigned_t /*unused*/) + bool number_unsigned( + number_unsigned_t /*unused*/) { return true; } - bool number_float(number_float_t /*unused*/, const string_t& /*unused*/) + bool number_float( + number_float_t /*unused*/, + const string_t& /*unused*/) { return true; } - bool string(string_t& /*unused*/) + bool string( + string_t& /*unused*/) { return true; } - bool binary(binary_t& /*unused*/) + bool binary( + binary_t& /*unused*/) { return true; } - bool start_object(std::size_t /*unused*/ = std::size_t(-1)) + bool start_object( + std::size_t /*unused*/ = std::size_t(-1)) { return true; } - bool key(string_t& /*unused*/) + bool key( + string_t& /*unused*/) { return true; } @@ -5922,7 +6887,8 @@ class json_sax_acceptor return true; } - bool start_array(std::size_t /*unused*/ = std::size_t(-1)) + bool start_array( + std::size_t /*unused*/ = std::size_t(-1)) { return true; } @@ -5932,10 +6898,14 @@ class json_sax_acceptor return true; } - bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, const detail::exception& /*unused*/) + bool parse_error( + std::size_t /*unused*/, + const std::string& /*unused*/, + const detail::exception& /*unused*/) { return false; } + }; } // namespace detail @@ -5961,10 +6931,8 @@ class json_sax_acceptor // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { /////////// // lexer // /////////// @@ -5972,7 +6940,8 @@ namespace detail template class lexer_base { - public: +public: + /// token types for the parser enum class token_type { @@ -5998,7 +6967,8 @@ class lexer_base /// return name of values of type token_type (only used for errors) JSON_HEDLEY_RETURNS_NON_NULL JSON_HEDLEY_CONST - static const char* token_type_name(const token_type t) noexcept + static const char* token_type_name( + const token_type t) noexcept { switch (t) { @@ -6040,12 +7010,13 @@ class lexer_base // LCOV_EXCL_STOP } } + }; /*! -@brief lexical analysis + @brief lexical analysis -This class organizes the lexical analysis during JSON deserialization. -*/ + This class organizes the lexical analysis during JSON deserialization. + */ template class lexer : public lexer_base { @@ -6056,23 +7027,32 @@ class lexer : public lexer_base using char_type = typename InputAdapterType::char_type; using char_int_type = typename std::char_traits::int_type; - public: +public: + using token_type = typename lexer_base::token_type; - explicit lexer(InputAdapterType&& adapter, bool ignore_comments_ = false) + explicit lexer( + InputAdapterType&& adapter, + bool ignore_comments_ = false) : ia(std::move(adapter)) , ignore_comments(ignore_comments_) , decimal_point_char(static_cast(get_decimal_point())) - {} + { + } // delete because of pointer members - lexer(const lexer&) = delete; - lexer(lexer&&) = default; - lexer& operator=(lexer&) = delete; - lexer& operator=(lexer&&) = default; + lexer( + const lexer&) = delete; + lexer( + lexer&&) = default; + lexer& operator =( + lexer&) = delete; + lexer& operator =( + lexer&&) = default; ~lexer() = default; - private: +private: + ///////////////////// // locales ///////////////////// @@ -6091,20 +7071,20 @@ class lexer : public lexer_base ///////////////////// /*! - @brief get codepoint from 4 hex characters following `\u` + @brief get codepoint from 4 hex characters following `\u` - For input "\u c1 c2 c3 c4" the codepoint is: - (c1 * 0x1000) + (c2 * 0x0100) + (c3 * 0x0010) + c4 - = (c1 << 12) + (c2 << 8) + (c3 << 4) + (c4 << 0) + For input "\u c1 c2 c3 c4" the codepoint is: + (c1 * 0x1000) + (c2 * 0x0100) + (c3 * 0x0010) + c4 + = (c1 << 12) + (c2 << 8) + (c3 << 4) + (c4 << 0) - Furthermore, the possible characters '0'..'9', 'A'..'F', and 'a'..'f' - must be converted to the integers 0x0..0x9, 0xA..0xF, 0xA..0xF, resp. The - conversion is done by subtracting the offset (0x30, 0x37, and 0x57) - between the ASCII value of the character and the desired integer value. + Furthermore, the possible characters '0'..'9', 'A'..'F', and 'a'..'f' + must be converted to the integers 0x0..0x9, 0xA..0xF, 0xA..0xF, resp. The + conversion is done by subtracting the offset (0x30, 0x37, and 0x57) + between the ASCII value of the character and the desired integer value. - @return codepoint (0x0000..0xFFFF) or -1 in case of an error (e.g. EOF or + @return codepoint (0x0000..0xFFFF) or -1 in case of an error (e.g. EOF or non-hex character) - */ + */ int get_codepoint() { // this function only makes sense after reading `\u` @@ -6139,21 +7119,22 @@ class lexer : public lexer_base } /*! - @brief check if the next byte(s) are inside a given range + @brief check if the next byte(s) are inside a given range - Adds the current byte and, for each passed range, reads a new byte and - checks if it is inside the range. If a violation was detected, set up an - error message and return false. Otherwise, return true. + Adds the current byte and, for each passed range, reads a new byte and + checks if it is inside the range. If a violation was detected, set up an + error message and return false. Otherwise, return true. - @param[in] ranges list of integers; interpreted as list of pairs of + @param[in] ranges list of integers; interpreted as list of pairs of inclusive lower and upper bound, respectively - @pre The passed list @a ranges must have 2, 4, or 6 elements; that is, + @pre The passed list @a ranges must have 2, 4, or 6 elements; that is, 1, 2, or 3 pairs. This precondition is enforced by an assertion. - @return true if and only if no range violation was detected - */ - bool next_byte_in_range(std::initializer_list ranges) + @return true if and only if no range violation was detected + */ + bool next_byte_in_range( + std::initializer_list ranges) { JSON_ASSERT(ranges.size() == 2 || ranges.size() == 4 || ranges.size() == 6); add(current); @@ -6176,20 +7157,20 @@ class lexer : public lexer_base } /*! - @brief scan a string literal + @brief scan a string literal - This function scans a string according to Sect. 7 of RFC 7159. While - scanning, bytes are escaped and copied into buffer token_buffer. Then the - function returns successfully, token_buffer is *not* null-terminated (as it - may contain \0 bytes), and token_buffer.size() is the number of bytes in the - string. + This function scans a string according to Sect. 7 of RFC 7159. While + scanning, bytes are escaped and copied into buffer token_buffer. Then the + function returns successfully, token_buffer is *not* null-terminated (as it + may contain \0 bytes), and token_buffer.size() is the number of bytes in the + string. - @return token_type::value_string if string could be successfully scanned, + @return token_type::value_string if string could be successfully scanned, token_type::parse_error otherwise - @note In case of errors, variable error_message contains a textual + @note In case of errors, variable error_message contains a textual description. - */ + */ token_type scan_string() { // reset token_buffer (ignore opening quote) @@ -6285,24 +7266,26 @@ class lexer : public lexer_base { // overwrite codepoint codepoint = static_cast( - // high surrogate occupies the most significant 22 bits - (static_cast(codepoint1) << 10u) - // low surrogate occupies the least significant 15 bits - + static_cast(codepoint2) - // there is still the 0xD800, 0xDC00 and 0x10000 noise - // in the result so we have to subtract with: - // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00 - - 0x35FDC00u); + // high surrogate occupies the most significant 22 bits + (static_cast(codepoint1) << 10u) + // low surrogate occupies the least significant 15 bits + + static_cast(codepoint2) + // there is still the 0xD800, 0xDC00 and 0x10000 noise + // in the result so we have to subtract with: + // (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00 + - 0x35FDC00u); } else { - error_message = "invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF"; + error_message = + "invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF"; return token_type::parse_error; } } else { - error_message = "invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF"; + error_message = + "invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF"; return token_type::parse_error; } } @@ -6310,7 +7293,8 @@ class lexer : public lexer_base { if (JSON_HEDLEY_UNLIKELY(0xDC00 <= codepoint1 && codepoint1 <= 0xDFFF)) { - error_message = "invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF"; + error_message = + "invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF"; return token_type::parse_error; } } @@ -6334,15 +7318,18 @@ class lexer : public lexer_base { // 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx add(static_cast(0xE0u | (static_cast(codepoint) >> 12u))); - add(static_cast(0x80u | ((static_cast(codepoint) >> 6u) & 0x3Fu))); + add(static_cast(0x80u | + ((static_cast(codepoint) >> 6u) & 0x3Fu))); add(static_cast(0x80u | (static_cast(codepoint) & 0x3Fu))); } else { // 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx add(static_cast(0xF0u | (static_cast(codepoint) >> 18u))); - add(static_cast(0x80u | ((static_cast(codepoint) >> 12u) & 0x3Fu))); - add(static_cast(0x80u | ((static_cast(codepoint) >> 6u) & 0x3Fu))); + add(static_cast(0x80u | + ((static_cast(codepoint) >> 12u) & 0x3Fu))); + add(static_cast(0x80u | + ((static_cast(codepoint) >> 6u) & 0x3Fu))); add(static_cast(0x80u | (static_cast(codepoint) & 0x3Fu))); } @@ -6848,63 +7835,72 @@ class lexer : public lexer_base } JSON_HEDLEY_NON_NULL(2) - static void strtof(float& f, const char* str, char** endptr) noexcept + static void strtof( + float& f, + const char* str, + char** endptr) noexcept { f = std::strtof(str, endptr); } JSON_HEDLEY_NON_NULL(2) - static void strtof(double& f, const char* str, char** endptr) noexcept + static void strtof( + double& f, + const char* str, + char** endptr) noexcept { f = std::strtod(str, endptr); } JSON_HEDLEY_NON_NULL(2) - static void strtof(long double& f, const char* str, char** endptr) noexcept + static void strtof( + long double& f, + const char* str, + char** endptr) noexcept { f = std::strtold(str, endptr); } /*! - @brief scan a number literal + @brief scan a number literal - This function scans a string according to Sect. 6 of RFC 7159. + This function scans a string according to Sect. 6 of RFC 7159. - The function is realized with a deterministic finite state machine derived - from the grammar described in RFC 7159. Starting in state "init", the - input is read and used to determined the next state. Only state "done" - accepts the number. State "error" is a trap state to model errors. In the - table below, "anything" means any character but the ones listed before. + The function is realized with a deterministic finite state machine derived + from the grammar described in RFC 7159. Starting in state "init", the + input is read and used to determined the next state. Only state "done" + accepts the number. State "error" is a trap state to model errors. In the + table below, "anything" means any character but the ones listed before. - state | 0 | 1-9 | e E | + | - | . | anything - ---------|----------|----------|----------|---------|---------|----------|----------- - init | zero | any1 | [error] | [error] | minus | [error] | [error] - minus | zero | any1 | [error] | [error] | [error] | [error] | [error] - zero | done | done | exponent | done | done | decimal1 | done - any1 | any1 | any1 | exponent | done | done | decimal1 | done - decimal1 | decimal2 | decimal2 | [error] | [error] | [error] | [error] | [error] - decimal2 | decimal2 | decimal2 | exponent | done | done | done | done - exponent | any2 | any2 | [error] | sign | sign | [error] | [error] - sign | any2 | any2 | [error] | [error] | [error] | [error] | [error] - any2 | any2 | any2 | done | done | done | done | done + state | 0 | 1-9 | e E | + | - | . | anything + ---------|----------|----------|----------|---------|---------|----------|----------- + init | zero | any1 | [error] | [error] | minus | [error] | [error] + minus | zero | any1 | [error] | [error] | [error] | [error] | [error] + zero | done | done | exponent | done | done | decimal1 | done + any1 | any1 | any1 | exponent | done | done | decimal1 | done + decimal1 | decimal2 | decimal2 | [error] | [error] | [error] | [error] | [error] + decimal2 | decimal2 | decimal2 | exponent | done | done | done | done + exponent | any2 | any2 | [error] | sign | sign | [error] | [error] + sign | any2 | any2 | [error] | [error] | [error] | [error] | [error] + any2 | any2 | any2 | done | done | done | done | done - The state machine is realized with one label per state (prefixed with - "scan_number_") and `goto` statements between them. The state machine - contains cycles, but any cycle can be left when EOF is read. Therefore, - the function is guaranteed to terminate. + The state machine is realized with one label per state (prefixed with + "scan_number_") and `goto` statements between them. The state machine + contains cycles, but any cycle can be left when EOF is read. Therefore, + the function is guaranteed to terminate. - During scanning, the read bytes are stored in token_buffer. This string is - then converted to a signed integer, an unsigned integer, or a - floating-point number. + During scanning, the read bytes are stored in token_buffer. This string is + then converted to a signed integer, an unsigned integer, or a + floating-point number. - @return token_type::value_unsigned, token_type::value_integer, or + @return token_type::value_unsigned, token_type::value_integer, or token_type::value_float if number could be successfully scanned, token_type::parse_error otherwise - @note The scanner is independent of the current locale. Internally, the + @note The scanner is independent of the current locale. Internally, the locale's decimal point is used instead of `.` to work with the locale-dependent converters. - */ + */ token_type scan_number() // lgtm [cpp/use-of-goto] { // reset token_buffer to store the number's bytes @@ -7124,7 +8120,7 @@ class lexer : public lexer_base default: { error_message = - "invalid number; expected '+', '-', or digit after exponent"; + "invalid number; expected '+', '-', or digit after exponent"; return token_type::parse_error; } } @@ -7231,13 +8227,15 @@ class lexer : public lexer_base } /*! - @param[in] literal_text the literal text to expect - @param[in] length the length of the passed literal text - @param[in] return_type the token type to return on success - */ + @param[in] literal_text the literal text to expect + @param[in] length the length of the passed literal text + @param[in] return_type the token type to return on success + */ JSON_HEDLEY_NON_NULL(2) - token_type scan_literal(const char_type* literal_text, const std::size_t length, - token_type return_type) + token_type scan_literal( + const char_type* literal_text, + const std::size_t length, + token_type return_type) { JSON_ASSERT(std::char_traits::to_char_type(current) == literal_text[0]); for (std::size_t i = 1; i < length; ++i) @@ -7264,15 +8262,15 @@ class lexer : public lexer_base } /* - @brief get next character from the input + @brief get next character from the input - This function provides the interface to the used input adapter. It does - not throw in case the input reached EOF, but returns a - `std::char_traits::eof()` in that case. Stores the scanned characters - for use in error messages. + This function provides the interface to the used input adapter. It does + not throw in case the input reached EOF, but returns a + `std::char_traits::eof()` in that case. Stores the scanned characters + for use in error messages. - @return character read from the input - */ + @return character read from the input + */ char_int_type get() { ++position.chars_read_total; @@ -7303,13 +8301,13 @@ class lexer : public lexer_base } /*! - @brief unget current character (read it again on next get) + @brief unget current character (read it again on next get) - We implement unget by setting variable next_unget to true. The input is not - changed - we just simulate ungetting by modifying chars_read_total, - chars_read_current_line, and token_string. The next call to get() will - behave as if the unget character is read again. - */ + We implement unget by setting variable next_unget to true. The input is not + changed - we just simulate ungetting by modifying chars_read_total, + chars_read_current_line, and token_string. The next call to get() will + behave as if the unget character is read again. + */ void unget() { next_unget = true; @@ -7337,12 +8335,14 @@ class lexer : public lexer_base } /// add a character to token_buffer - void add(char_int_type c) + void add( + char_int_type c) { token_buffer.push_back(static_cast(c)); } - public: +public: + ///////////////////// // value getters ///////////////////// @@ -7419,9 +8419,9 @@ class lexer : public lexer_base ///////////////////// /*! - @brief skip the UTF-8 byte order mark - @return true iff there is no BOM or the correct BOM has been skipped - */ + @brief skip the UTF-8 byte order mark + @return true iff there is no BOM or the correct BOM has been skipped + */ bool skip_bom() { if (get() == 0xEF) @@ -7533,7 +8533,8 @@ class lexer : public lexer_base } } - private: +private: + /// input adapter InputAdapterType ia; @@ -7583,66 +8584,65 @@ class lexer : public lexer_base // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { template using null_function_t = decltype(std::declval().null()); template using boolean_function_t = - decltype(std::declval().boolean(std::declval())); + decltype(std::declval().boolean(std::declval())); template using number_integer_function_t = - decltype(std::declval().number_integer(std::declval())); + decltype(std::declval().number_integer(std::declval())); template using number_unsigned_function_t = - decltype(std::declval().number_unsigned(std::declval())); + decltype(std::declval().number_unsigned(std::declval())); template using number_float_function_t = decltype(std::declval().number_float( - std::declval(), std::declval())); + std::declval(), std::declval())); template using string_function_t = - decltype(std::declval().string(std::declval())); + decltype(std::declval().string(std::declval())); template using binary_function_t = - decltype(std::declval().binary(std::declval())); + decltype(std::declval().binary(std::declval())); template using start_object_function_t = - decltype(std::declval().start_object(std::declval())); + decltype(std::declval().start_object(std::declval())); template using key_function_t = - decltype(std::declval().key(std::declval())); + decltype(std::declval().key(std::declval())); template using end_object_function_t = decltype(std::declval().end_object()); template using start_array_function_t = - decltype(std::declval().start_array(std::declval())); + decltype(std::declval().start_array(std::declval())); template using end_array_function_t = decltype(std::declval().end_array()); template using parse_error_function_t = decltype(std::declval().parse_error( - std::declval(), std::declval(), - std::declval())); + std::declval(), std::declval(), + std::declval())); template struct is_sax { - private: +private: + static_assert(is_basic_json::value, - "BasicJsonType must be of type basic_json<...>"); + "BasicJsonType must be of type basic_json<...>"); using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; @@ -7651,29 +8651,31 @@ struct is_sax using binary_t = typename BasicJsonType::binary_t; using exception_t = typename BasicJsonType::exception; - public: +public: + static constexpr bool value = - is_detected_exact::value && - is_detected_exact::value && - is_detected_exact::value && - is_detected_exact::value && - is_detected_exact::value && - is_detected_exact::value && - is_detected_exact::value && - is_detected_exact::value && - is_detected_exact::value && - is_detected_exact::value && - is_detected_exact::value && - is_detected_exact::value && - is_detected_exact::value; + is_detected_exact::value && + is_detected_exact::value && + is_detected_exact::value && + is_detected_exact::value && + is_detected_exact::value && + is_detected_exact::value && + is_detected_exact::value && + is_detected_exact::value && + is_detected_exact::value && + is_detected_exact::value && + is_detected_exact::value && + is_detected_exact::value && + is_detected_exact::value; }; template struct is_sax_static_asserts { - private: +private: + static_assert(is_basic_json::value, - "BasicJsonType must be of type basic_json<...>"); + "BasicJsonType must be of type basic_json<...>"); using number_integer_t = typename BasicJsonType::number_integer_t; using number_unsigned_t = typename BasicJsonType::number_unsigned_t; @@ -7682,13 +8684,14 @@ struct is_sax_static_asserts using binary_t = typename BasicJsonType::binary_t; using exception_t = typename BasicJsonType::exception; - public: +public: + static_assert(is_detected_exact::value, - "Missing/invalid function: bool null()"); + "Missing/invalid function: bool null()"); static_assert(is_detected_exact::value, - "Missing/invalid function: bool boolean(bool)"); + "Missing/invalid function: bool boolean(bool)"); static_assert(is_detected_exact::value, - "Missing/invalid function: bool boolean(bool)"); + "Missing/invalid function: bool boolean(bool)"); static_assert( is_detected_exact::value, @@ -7698,8 +8701,8 @@ struct is_sax_static_asserts number_unsigned_t>::value, "Missing/invalid function: bool number_unsigned(number_unsigned_t)"); static_assert(is_detected_exact::value, - "Missing/invalid function: bool number_float(number_float_t, const string_t&)"); + number_float_t, string_t>::value, + "Missing/invalid function: bool number_float(number_float_t, const string_t&)"); static_assert( is_detected_exact::value, "Missing/invalid function: bool string(string_t&)"); @@ -7707,15 +8710,15 @@ struct is_sax_static_asserts is_detected_exact::value, "Missing/invalid function: bool binary(binary_t&)"); static_assert(is_detected_exact::value, - "Missing/invalid function: bool start_object(std::size_t)"); + "Missing/invalid function: bool start_object(std::size_t)"); static_assert(is_detected_exact::value, - "Missing/invalid function: bool key(string_t&)"); + "Missing/invalid function: bool key(string_t&)"); static_assert(is_detected_exact::value, - "Missing/invalid function: bool end_object()"); + "Missing/invalid function: bool end_object()"); static_assert(is_detected_exact::value, - "Missing/invalid function: bool start_array(std::size_t)"); + "Missing/invalid function: bool start_array(std::size_t)"); static_assert(is_detected_exact::value, - "Missing/invalid function: bool end_array()"); + "Missing/invalid function: bool end_array()"); static_assert( is_detected_exact::value, "Missing/invalid function: bool parse_error(std::size_t, const " @@ -7727,10 +8730,8 @@ struct is_sax_static_asserts // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { /// how to treat CBOR tags enum class cbor_tag_handler_t @@ -7740,25 +8741,25 @@ enum class cbor_tag_handler_t }; /*! -@brief determine system byte order + @brief determine system byte order -@return true if and only if system's byte order is little endian + @return true if and only if system's byte order is little endian -@note from https://stackoverflow.com/a/1001328/266378 -*/ -static inline bool little_endianess(int num = 1) noexcept + @note from https://stackoverflow.com/a/1001328/266378 + */ +static inline bool little_endianess( + int num = 1) noexcept { return *reinterpret_cast(&num) == 1; } - /////////////////// // binary reader // /////////////////// /*! -@brief deserialization of CBOR, MessagePack, and UBJSON values -*/ + @brief deserialization of CBOR, MessagePack, and UBJSON values + */ template> class binary_reader { @@ -7771,37 +8772,45 @@ class binary_reader using char_type = typename InputAdapterType::char_type; using char_int_type = typename std::char_traits::int_type; - public: +public: + /*! - @brief create a binary reader + @brief create a binary reader - @param[in] adapter input adapter to read from - */ - explicit binary_reader(InputAdapterType&& adapter) : ia(std::move(adapter)) + @param[in] adapter input adapter to read from + */ + explicit binary_reader( + InputAdapterType&& adapter) + : ia(std::move(adapter)) { (void)detail::is_sax_static_asserts {}; } // make class move-only - binary_reader(const binary_reader&) = delete; - binary_reader(binary_reader&&) = default; - binary_reader& operator=(const binary_reader&) = delete; - binary_reader& operator=(binary_reader&&) = default; + binary_reader( + const binary_reader&) = delete; + binary_reader( + binary_reader&&) = default; + binary_reader& operator =( + const binary_reader&) = delete; + binary_reader& operator =( + binary_reader&&) = default; ~binary_reader() = default; /*! - @param[in] format the binary format to parse - @param[in] sax_ a SAX event processor - @param[in] strict whether to expect the input to be consumed completed - @param[in] tag_handler how to treat CBOR tags + @param[in] format the binary format to parse + @param[in] sax_ a SAX event processor + @param[in] strict whether to expect the input to be consumed completed + @param[in] tag_handler how to treat CBOR tags - @return - */ + @return + */ JSON_HEDLEY_NON_NULL(3) - bool sax_parse(const input_format_t format, - json_sax_t* sax_, - const bool strict = true, - const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) + bool sax_parse( + const input_format_t format, + json_sax_t* sax_, + const bool strict = true, + const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) { sax = sax_; bool result = false; @@ -7843,22 +8852,25 @@ class binary_reader if (JSON_HEDLEY_UNLIKELY(current != std::char_traits::eof())) { return sax->parse_error(chars_read, get_token_string(), - parse_error::create(110, chars_read, exception_message(format, "expected end of input; last byte: 0x" + get_token_string(), "value"))); + parse_error::create(110, chars_read, + exception_message(format, "expected end of input; last byte: 0x" + get_token_string(), + "value"))); } } return result; } - private: +private: + ////////// // BSON // ////////// /*! - @brief Reads in a BSON-object and passes it to the SAX-parser. - @return whether a valid BSON-value was passed to the SAX parser - */ + @brief Reads in a BSON-object and passes it to the SAX-parser. + @return whether a valid BSON-value was passed to the SAX parser + */ bool parse_bson_internal() { std::int32_t document_size{}; @@ -7869,7 +8881,7 @@ class binary_reader return false; } - if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_list(/*is_array*/false))) + if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_list(/*is_array*/ false))) { return false; } @@ -7878,13 +8890,14 @@ class binary_reader } /*! - @brief Parses a C-style string from the BSON input. - @param[in, out] result A reference to the string variable where the read + @brief Parses a C-style string from the BSON input. + @param[in, out] result A reference to the string variable where the read string is to be stored. - @return `true` if the \x00-byte indicating the end of the string was + @return `true` if the \x00-byte indicating the end of the string was encountered before the EOF; false` indicates an unexpected EOF. - */ - bool get_bson_cstr(string_t& result) + */ + bool get_bson_cstr( + string_t& result) { auto out = std::back_inserter(result); while (true) @@ -7903,44 +8916,55 @@ class binary_reader } /*! - @brief Parses a zero-terminated string of length @a len from the BSON + @brief Parses a zero-terminated string of length @a len from the BSON input. - @param[in] len The length (including the zero-byte at the end) of the + @param[in] len The length (including the zero-byte at the end) of the string to be read. - @param[in, out] result A reference to the string variable where the read + @param[in, out] result A reference to the string variable where the read string is to be stored. - @tparam NumberType The type of the length @a len - @pre len >= 1 - @return `true` if the string was successfully parsed - */ + @tparam NumberType The type of the length @a len + @pre len >= 1 + @return `true` if the string was successfully parsed + */ template - bool get_bson_string(const NumberType len, string_t& result) + bool get_bson_string( + const NumberType len, + string_t& result) { if (JSON_HEDLEY_UNLIKELY(len < 1)) { auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, "string length must be at least 1, is " + std::to_string(len), "string"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(112, chars_read, + exception_message(input_format_t::bson, + "string length must be at least 1, is " + std::to_string(len), "string"))); } - return get_string(input_format_t::bson, len - static_cast(1), result) && get() != std::char_traits::eof(); + return get_string(input_format_t::bson, len - static_cast(1), + result) && get() != std::char_traits::eof(); } /*! - @brief Parses a byte array input of length @a len from the BSON input. - @param[in] len The length of the byte array to be read. - @param[in, out] result A reference to the binary variable where the read + @brief Parses a byte array input of length @a len from the BSON input. + @param[in] len The length of the byte array to be read. + @param[in, out] result A reference to the binary variable where the read array is to be stored. - @tparam NumberType The type of the length @a len - @pre len >= 0 - @return `true` if the byte array was successfully parsed - */ + @tparam NumberType The type of the length @a len + @pre len >= 0 + @return `true` if the byte array was successfully parsed + */ template - bool get_bson_binary(const NumberType len, binary_t& result) + bool get_bson_binary( + const NumberType len, + binary_t& result) { if (JSON_HEDLEY_UNLIKELY(len < 0)) { auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::bson, "byte array length cannot be negative, is " + std::to_string(len), "binary"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(112, chars_read, + exception_message(input_format_t::bson, + "byte array length cannot be negative, is " + std::to_string(len), "binary"))); } // All BSON binary values have a subtype @@ -7952,31 +8976,34 @@ class binary_reader } /*! - @brief Read a BSON document element of the given @a element_type. - @param[in] element_type The BSON element type, c.f. http://bsonspec.org/spec.html - @param[in] element_type_parse_position The position in the input stream, + @brief Read a BSON document element of the given @a element_type. + @param[in] element_type The BSON element type, c.f. http://bsonspec.org/spec.html + @param[in] element_type_parse_position The position in the input stream, where the `element_type` was read. - @warning Not all BSON element types are supported yet. An unsupported + @warning Not all BSON element types are supported yet. An unsupported @a element_type will give rise to a parse_error.114: Unsupported BSON record type 0x... - @return whether a valid BSON-object/array was passed to the SAX parser - */ - bool parse_bson_element_internal(const char_int_type element_type, - const std::size_t element_type_parse_position) + @return whether a valid BSON-object/array was passed to the SAX parser + */ + bool parse_bson_element_internal( + const char_int_type element_type, + const std::size_t element_type_parse_position) { switch (element_type) { case 0x01: // double { double number{}; - return get_number(input_format_t::bson, number) && sax->number_float(static_cast(number), ""); + return get_number(input_format_t::bson, + number) && sax->number_float(static_cast(number), ""); } case 0x02: // string { std::int32_t len{}; string_t value; - return get_number(input_format_t::bson, len) && get_bson_string(len, value) && sax->string(value); + return get_number(input_format_t::bson, + len) && get_bson_string(len, value) && sax->string(value); } case 0x03: // object @@ -7993,7 +9020,8 @@ class binary_reader { std::int32_t len{}; binary_t value; - return get_number(input_format_t::bson, len) && get_bson_binary(len, value) && sax->binary(value); + return get_number(input_format_t::bson, + len) && get_bson_binary(len, value) && sax->binary(value); } case 0x08: // boolean @@ -8022,24 +9050,27 @@ class binary_reader { std::array cr{{}}; (std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast(element_type)); - return sax->parse_error(element_type_parse_position, std::string(cr.data()), parse_error::create(114, element_type_parse_position, "Unsupported BSON record type 0x" + std::string(cr.data()))); + return sax->parse_error(element_type_parse_position, std::string(cr.data()), + parse_error::create(114, element_type_parse_position, + "Unsupported BSON record type 0x" + std::string(cr.data()))); } } } /*! - @brief Read a BSON element list (as specified in the BSON-spec) + @brief Read a BSON element list (as specified in the BSON-spec) - The same binary layout is used for objects and arrays, hence it must be - indicated with the argument @a is_array which one is expected - (true --> array, false --> object). + The same binary layout is used for objects and arrays, hence it must be + indicated with the argument @a is_array which one is expected + (true --> array, false --> object). - @param[in] is_array Determines if the element list being read is to be + @param[in] is_array Determines if the element list being read is to be treated as an object (@a is_array == false), or as an array (@a is_array == true). - @return whether a valid BSON-object/array was passed to the SAX parser - */ - bool parse_bson_element_list(const bool is_array) + @return whether a valid BSON-object/array was passed to the SAX parser + */ + bool parse_bson_element_list( + const bool is_array) { string_t key; @@ -8074,9 +9105,9 @@ class binary_reader } /*! - @brief Reads an array from the BSON input and passes it to the SAX-parser. - @return whether a valid BSON-array was passed to the SAX parser - */ + @brief Reads an array from the BSON input and passes it to the SAX-parser. + @return whether a valid BSON-array was passed to the SAX parser + */ bool parse_bson_array() { std::int32_t document_size{}; @@ -8087,7 +9118,7 @@ class binary_reader return false; } - if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_list(/*is_array*/true))) + if (JSON_HEDLEY_UNLIKELY(!parse_bson_element_list(/*is_array*/ true))) { return false; } @@ -8100,15 +9131,16 @@ class binary_reader ////////// /*! - @param[in] get_char whether a new character should be retrieved from the + @param[in] get_char whether a new character should be retrieved from the input (true) or whether the last read character should be considered instead (false) - @param[in] tag_handler how CBOR tags should be treated + @param[in] tag_handler how CBOR tags should be treated - @return whether a valid CBOR value was passed to the SAX parser - */ - bool parse_cbor_internal(const bool get_char, - const cbor_tag_handler_t tag_handler) + @return whether a valid CBOR value was passed to the SAX parser + */ + bool parse_cbor_internal( + const bool get_char, + const cbor_tag_handler_t tag_handler) { switch (get_char ? get() : current) { @@ -8197,26 +9229,29 @@ class binary_reader case 0x38: // Negative integer (one-byte uint8_t follows) { std::uint8_t number{}; - return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast(-1) - number); + return get_number(input_format_t::cbor, number) && sax->number_integer( + static_cast(-1) - number); } case 0x39: // Negative integer -1-n (two-byte uint16_t follows) { std::uint16_t number{}; - return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast(-1) - number); + return get_number(input_format_t::cbor, number) && sax->number_integer( + static_cast(-1) - number); } case 0x3A: // Negative integer -1-n (four-byte uint32_t follows) { std::uint32_t number{}; - return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast(-1) - number); + return get_number(input_format_t::cbor, number) && sax->number_integer( + static_cast(-1) - number); } case 0x3B: // Negative integer -1-n (eight-byte uint64_t follows) { std::uint64_t number{}; return get_number(input_format_t::cbor, number) && sax->number_integer(static_cast(-1) - - static_cast(number)); + - static_cast(number)); } // Binary data (0x00..0x17 bytes follow) @@ -8314,30 +9349,35 @@ class binary_reader case 0x95: case 0x96: case 0x97: - return get_cbor_array(static_cast(static_cast(current) & 0x1Fu), tag_handler); + return get_cbor_array(static_cast(static_cast(current) & 0x1Fu), + tag_handler); case 0x98: // array (one-byte uint8_t for n follows) { std::uint8_t len{}; - return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast(len), tag_handler); + return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast(len), + tag_handler); } case 0x99: // array (two-byte uint16_t for n follow) { std::uint16_t len{}; - return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast(len), tag_handler); + return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast(len), + tag_handler); } case 0x9A: // array (four-byte uint32_t for n follow) { std::uint32_t len{}; - return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast(len), tag_handler); + return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast(len), + tag_handler); } case 0x9B: // array (eight-byte uint64_t for n follow) { std::uint64_t len{}; - return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast(len), tag_handler); + return get_number(input_format_t::cbor, len) && get_cbor_array(static_cast(len), + tag_handler); } case 0x9F: // array (indefinite length) @@ -8368,30 +9408,35 @@ class binary_reader case 0xB5: case 0xB6: case 0xB7: - return get_cbor_object(static_cast(static_cast(current) & 0x1Fu), tag_handler); + return get_cbor_object(static_cast(static_cast(current) & 0x1Fu), + tag_handler); case 0xB8: // map (one-byte uint8_t for n follows) { std::uint8_t len{}; - return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast(len), tag_handler); + return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast(len), + tag_handler); } case 0xB9: // map (two-byte uint16_t for n follow) { std::uint16_t len{}; - return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast(len), tag_handler); + return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast(len), + tag_handler); } case 0xBA: // map (four-byte uint32_t for n follow) { std::uint32_t len{}; - return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast(len), tag_handler); + return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast(len), + tag_handler); } case 0xBB: // map (eight-byte uint64_t for n follow) { std::uint64_t len{}; - return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast(len), tag_handler); + return get_number(input_format_t::cbor, len) && get_cbor_object(static_cast(len), + tag_handler); } case 0xBF: // map (indefinite length) @@ -8422,7 +9467,10 @@ class binary_reader case cbor_tag_handler_t::error: { auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::cbor, "invalid byte: 0x" + last_token, "value"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(112, chars_read, + exception_message(input_format_t::cbor, "invalid byte: 0x" + last_token, + "value"))); } case cbor_tag_handler_t::ignore: @@ -8500,23 +9548,24 @@ class binary_reader // is shown in Fig. 3. const auto half = static_cast((byte1 << 8u) + byte2); const double val = [&half] - { - const int exp = (half >> 10u) & 0x1Fu; - const unsigned int mant = half & 0x3FFu; - JSON_ASSERT(0 <= exp&& exp <= 32); - JSON_ASSERT(mant <= 1024); - switch (exp) - { - case 0: - return std::ldexp(mant, -24); - case 31: - return (mant == 0) + { + const int exp = (half >> 10u) & 0x1Fu; + const unsigned int mant = half & 0x3FFu; + JSON_ASSERT(0 <= exp && exp <= 32); + JSON_ASSERT(mant <= 1024); + switch (exp) + { + case 0: + return std::ldexp(mant, -24); + case 31: + return (mant == 0) ? std::numeric_limits::infinity() : std::numeric_limits::quiet_NaN(); - default: - return std::ldexp(mant + 1024, exp - 25); - } - }(); + default: + return std::ldexp(mant + 1024, exp - 25); + } + } + (); return sax->number_float((half & 0x8000u) != 0 ? static_cast(-val) : static_cast(val), ""); @@ -8525,35 +9574,40 @@ class binary_reader case 0xFA: // Single-Precision Float (four-byte IEEE 754) { float number{}; - return get_number(input_format_t::cbor, number) && sax->number_float(static_cast(number), ""); + return get_number(input_format_t::cbor, number) && sax->number_float( + static_cast(number), ""); } case 0xFB: // Double-Precision Float (eight-byte IEEE 754) { double number{}; - return get_number(input_format_t::cbor, number) && sax->number_float(static_cast(number), ""); + return get_number(input_format_t::cbor, number) && sax->number_float( + static_cast(number), ""); } default: // anything else (0xFF is handled inside the other types) { auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::cbor, "invalid byte: 0x" + last_token, "value"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(112, chars_read, + exception_message(input_format_t::cbor, "invalid byte: 0x" + last_token, "value"))); } } } /*! - @brief reads a CBOR string + @brief reads a CBOR string - This function first reads starting bytes to determine the expected - string length and then copies this number of bytes into a string. - Additionally, CBOR's strings with indefinite lengths are supported. + This function first reads starting bytes to determine the expected + string length and then copies this number of bytes into a string. + Additionally, CBOR's strings with indefinite lengths are supported. - @param[out] result created string + @param[out] result created string - @return whether string creation completed - */ - bool get_cbor_string(string_t& result) + @return whether string creation completed + */ + bool get_cbor_string( + string_t& result) { if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "string"))) { @@ -8632,23 +9686,29 @@ class binary_reader default: { auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::cbor, "expected length specification (0x60-0x7B) or indefinite string type (0x7F); last byte: 0x" + last_token, "string"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(113, chars_read, + exception_message(input_format_t::cbor, + "expected length specification (0x60-0x7B) or indefinite string type (0x7F); last byte: 0x" + + + last_token, "string"))); } } } /*! - @brief reads a CBOR byte array + @brief reads a CBOR byte array - This function first reads starting bytes to determine the expected - byte array length and then copies this number of bytes into the byte array. - Additionally, CBOR's byte arrays with indefinite lengths are supported. + This function first reads starting bytes to determine the expected + byte array length and then copies this number of bytes into the byte array. + Additionally, CBOR's byte arrays with indefinite lengths are supported. - @param[out] result created byte array + @param[out] result created byte array - @return whether byte array creation completed - */ - bool get_cbor_binary(binary_t& result) + @return whether byte array creation completed + */ + bool get_cbor_binary( + binary_t& result) { if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::cbor, "binary"))) { @@ -8731,19 +9791,25 @@ class binary_reader default: { auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::cbor, "expected length specification (0x40-0x5B) or indefinite binary array type (0x5F); last byte: 0x" + last_token, "binary"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(113, chars_read, + exception_message(input_format_t::cbor, + "expected length specification (0x40-0x5B) or indefinite binary array type (0x5F); last byte: 0x" + + + last_token, "binary"))); } } } /*! - @param[in] len the length of the array or std::size_t(-1) for an + @param[in] len the length of the array or std::size_t(-1) for an array of indefinite size - @param[in] tag_handler how CBOR tags should be treated - @return whether array creation completed - */ - bool get_cbor_array(const std::size_t len, - const cbor_tag_handler_t tag_handler) + @param[in] tag_handler how CBOR tags should be treated + @return whether array creation completed + */ + bool get_cbor_array( + const std::size_t len, + const cbor_tag_handler_t tag_handler) { if (JSON_HEDLEY_UNLIKELY(!sax->start_array(len))) { @@ -8775,13 +9841,14 @@ class binary_reader } /*! - @param[in] len the length of the object or std::size_t(-1) for an + @param[in] len the length of the object or std::size_t(-1) for an object of indefinite size - @param[in] tag_handler how CBOR tags should be treated - @return whether object creation completed - */ - bool get_cbor_object(const std::size_t len, - const cbor_tag_handler_t tag_handler) + @param[in] tag_handler how CBOR tags should be treated + @return whether object creation completed + */ + bool get_cbor_object( + const std::size_t len, + const cbor_tag_handler_t tag_handler) { if (JSON_HEDLEY_UNLIKELY(!sax->start_object(len))) { @@ -8831,8 +9898,8 @@ class binary_reader ///////////// /*! - @return whether a valid MessagePack value was passed to the SAX parser - */ + @return whether a valid MessagePack value was passed to the SAX parser + */ bool parse_msgpack_internal() { switch (get()) @@ -9079,13 +10146,15 @@ class binary_reader case 0xCA: // float 32 { float number{}; - return get_number(input_format_t::msgpack, number) && sax->number_float(static_cast(number), ""); + return get_number(input_format_t::msgpack, + number) && sax->number_float(static_cast(number), ""); } case 0xCB: // float 64 { double number{}; - return get_number(input_format_t::msgpack, number) && sax->number_float(static_cast(number), ""); + return get_number(input_format_t::msgpack, + number) && sax->number_float(static_cast(number), ""); } case 0xCC: // uint 8 @@ -9198,22 +10267,25 @@ class binary_reader default: // anything else { auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::msgpack, "invalid byte: 0x" + last_token, "value"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(112, chars_read, + exception_message(input_format_t::msgpack, "invalid byte: 0x" + last_token, "value"))); } } } /*! - @brief reads a MessagePack string + @brief reads a MessagePack string - This function first reads starting bytes to determine the expected - string length and then copies this number of bytes into a string. + This function first reads starting bytes to determine the expected + string length and then copies this number of bytes into a string. - @param[out] result created string + @param[out] result created string - @return whether string creation completed - */ - bool get_msgpack_string(string_t& result) + @return whether string creation completed + */ + bool get_msgpack_string( + string_t& result) { if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::msgpack, "string"))) { @@ -9280,29 +10352,34 @@ class binary_reader default: { auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::msgpack, "expected length specification (0xA0-0xBF, 0xD9-0xDB); last byte: 0x" + last_token, "string"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(113, chars_read, + exception_message(input_format_t::msgpack, + "expected length specification (0xA0-0xBF, 0xD9-0xDB); last byte: 0x" + last_token, + "string"))); } } } /*! - @brief reads a MessagePack byte array + @brief reads a MessagePack byte array - This function first reads starting bytes to determine the expected - byte array length and then copies this number of bytes into a byte array. + This function first reads starting bytes to determine the expected + byte array length and then copies this number of bytes into a byte array. - @param[out] result created byte array + @param[out] result created byte array - @return whether byte array creation completed - */ - bool get_msgpack_binary(binary_t& result) + @return whether byte array creation completed + */ + bool get_msgpack_binary( + binary_t& result) { // helper function to set the subtype auto assign_and_return_true = [&result](std::int8_t subtype) - { - result.set_subtype(static_cast(subtype)); - return true; - }; + { + result.set_subtype(static_cast(subtype)); + return true; + }; switch (current) { @@ -9403,10 +10480,11 @@ class binary_reader } /*! - @param[in] len the length of the array - @return whether array creation completed - */ - bool get_msgpack_array(const std::size_t len) + @param[in] len the length of the array + @return whether array creation completed + */ + bool get_msgpack_array( + const std::size_t len) { if (JSON_HEDLEY_UNLIKELY(!sax->start_array(len))) { @@ -9425,10 +10503,11 @@ class binary_reader } /*! - @param[in] len the length of the object - @return whether object creation completed - */ - bool get_msgpack_object(const std::size_t len) + @param[in] len the length of the object + @return whether object creation completed + */ + bool get_msgpack_object( + const std::size_t len) { if (JSON_HEDLEY_UNLIKELY(!sax->start_object(len))) { @@ -9459,32 +10538,35 @@ class binary_reader //////////// /*! - @param[in] get_char whether a new character should be retrieved from the + @param[in] get_char whether a new character should be retrieved from the input (true, default) or whether the last read character should be considered instead - @return whether a valid UBJSON value was passed to the SAX parser - */ - bool parse_ubjson_internal(const bool get_char = true) + @return whether a valid UBJSON value was passed to the SAX parser + */ + bool parse_ubjson_internal( + const bool get_char = true) { return get_ubjson_value(get_char ? get_ignore_noop() : current); } /*! - @brief reads a UBJSON string + @brief reads a UBJSON string - This function is either called after reading the 'S' byte explicitly - indicating a string, or in case of an object key where the 'S' byte can be - left out. + This function is either called after reading the 'S' byte explicitly + indicating a string, or in case of an object key where the 'S' byte can be + left out. - @param[out] result created string - @param[in] get_char whether a new character should be retrieved from the + @param[out] result created string + @param[in] get_char whether a new character should be retrieved from the input (true, default) or whether the last read character should be considered instead - @return whether string creation completed - */ - bool get_ubjson_string(string_t& result, const bool get_char = true) + @return whether string creation completed + */ + bool get_ubjson_string( + string_t& result, + const bool get_char = true) { if (get_char) { @@ -9530,15 +10612,20 @@ class binary_reader default: auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, "expected length type specification (U, i, I, l, L); last byte: 0x" + last_token, "string"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(113, chars_read, + exception_message(input_format_t::ubjson, + "expected length type specification (U, i, I, l, L); last byte: 0x" + last_token, + "string"))); } } /*! - @param[out] result determined size - @return whether size determination completed - */ - bool get_ubjson_size_value(std::size_t& result) + @param[out] result determined size + @return whether size determination completed + */ + bool get_ubjson_size_value( + std::size_t& result) { switch (get_ignore_noop()) { @@ -9600,22 +10687,27 @@ class binary_reader default: { auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, "expected length type specification (U, i, I, l, L) after '#'; last byte: 0x" + last_token, "size"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(113, chars_read, + exception_message(input_format_t::ubjson, + "expected length type specification (U, i, I, l, L) after '#'; last byte: 0x" + + last_token, "size"))); } } } /*! - @brief determine the type and size for a container + @brief determine the type and size for a container - In the optimized UBJSON format, a type and a size can be provided to allow - for a more compact representation. + In the optimized UBJSON format, a type and a size can be provided to allow + for a more compact representation. - @param[out] result pair of the size and the type + @param[out] result pair of the size and the type - @return whether pair creation completed - */ - bool get_ubjson_size_type(std::pair& result) + @return whether pair creation completed + */ + bool get_ubjson_size_type( + std::pair& result) { result.first = string_t::npos; // size result.second = 0; // type @@ -9638,7 +10730,10 @@ class binary_reader return false; } auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::ubjson, "expected '#' after type information; last byte: 0x" + last_token, "size"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(112, chars_read, + exception_message(input_format_t::ubjson, + "expected '#' after type information; last byte: 0x" + last_token, "size"))); } return get_ubjson_size_value(result.first); @@ -9653,10 +10748,11 @@ class binary_reader } /*! - @param prefix the previously read or set type prefix - @return whether value creation completed - */ - bool get_ubjson_value(const char_int_type prefix) + @param prefix the previously read or set type prefix + @return whether value creation completed + */ + bool get_ubjson_value( + const char_int_type prefix) { switch (prefix) { @@ -9704,13 +10800,15 @@ class binary_reader case 'd': { float number{}; - return get_number(input_format_t::ubjson, number) && sax->number_float(static_cast(number), ""); + return get_number(input_format_t::ubjson, + number) && sax->number_float(static_cast(number), ""); } case 'D': { double number{}; - return get_number(input_format_t::ubjson, number) && sax->number_float(static_cast(number), ""); + return get_number(input_format_t::ubjson, + number) && sax->number_float(static_cast(number), ""); } case 'H': @@ -9728,7 +10826,10 @@ class binary_reader if (JSON_HEDLEY_UNLIKELY(current > 127)) { auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(113, chars_read, exception_message(input_format_t::ubjson, "byte after 'C' must be in range 0x00..0x7F; last byte: 0x" + last_token, "char"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(113, chars_read, + exception_message(input_format_t::ubjson, + "byte after 'C' must be in range 0x00..0x7F; last byte: 0x" + last_token, "char"))); } string_t s(1, static_cast(current)); return sax->string(s); @@ -9749,14 +10850,16 @@ class binary_reader default: // anything else { auto last_token = get_token_string(); - return sax->parse_error(chars_read, last_token, parse_error::create(112, chars_read, exception_message(input_format_t::ubjson, "invalid byte: 0x" + last_token, "value"))); + return sax->parse_error(chars_read, last_token, + parse_error::create(112, chars_read, + exception_message(input_format_t::ubjson, "invalid byte: 0x" + last_token, "value"))); } } } /*! - @return whether array creation completed - */ + @return whether array creation completed + */ bool get_ubjson_array() { std::pair size_and_type; @@ -9817,8 +10920,8 @@ class binary_reader } /*! - @return whether object creation completed - */ + @return whether object creation completed + */ bool get_ubjson_object() { std::pair size_and_type; @@ -9927,7 +11030,10 @@ class binary_reader if (JSON_HEDLEY_UNLIKELY(result_remainder != token_type::end_of_input)) { - return sax->parse_error(chars_read, number_string, parse_error::create(115, chars_read, exception_message(input_format_t::ubjson, "invalid number text: " + number_lexer.get_token_string(), "high-precision number"))); + return sax->parse_error(chars_read, number_string, + parse_error::create(115, chars_read, + exception_message(input_format_t::ubjson, + "invalid number text: " + number_lexer.get_token_string(), "high-precision number"))); } switch (result_number) @@ -9939,7 +11045,10 @@ class binary_reader case token_type::value_float: return sax->number_float(number_lexer.get_number_float(), std::move(number_string)); default: - return sax->parse_error(chars_read, number_string, parse_error::create(115, chars_read, exception_message(input_format_t::ubjson, "invalid number text: " + number_lexer.get_token_string(), "high-precision number"))); + return sax->parse_error(chars_read, number_string, + parse_error::create(115, chars_read, + exception_message(input_format_t::ubjson, + "invalid number text: " + number_lexer.get_token_string(), "high-precision number"))); } } @@ -9948,14 +11057,14 @@ class binary_reader /////////////////////// /*! - @brief get next character from the input + @brief get next character from the input - This function provides the interface to the used input adapter. It does - not throw in case the input reached EOF, but returns a -'ve valued - `std::char_traits::eof()` in that case. + This function provides the interface to the used input adapter. It does + not throw in case the input reached EOF, but returns a -'ve valued + `std::char_traits::eof()` in that case. - @return character read from the input - */ + @return character read from the input + */ char_int_type get() { ++chars_read; @@ -9963,8 +11072,8 @@ class binary_reader } /*! - @return character read from the input after ignoring all 'N' entries - */ + @return character read from the input after ignoring all 'N' entries + */ char_int_type get_ignore_noop() { do @@ -9977,20 +11086,22 @@ class binary_reader } /* - @brief read a number from the input + @brief read a number from the input - @tparam NumberType the type of the number - @param[in] format the current format (for diagnostics) - @param[out] result number of type @a NumberType + @tparam NumberType the type of the number + @param[in] format the current format (for diagnostics) + @param[out] result number of type @a NumberType - @return whether conversion completed + @return whether conversion completed - @note This function needs to respect the system's endianess, because + @note This function needs to respect the system's endianess, because bytes in CBOR, MessagePack, and UBJSON are stored in network order (big endian) and therefore need reordering on little endian systems. - */ + */ template - bool get_number(const input_format_t format, NumberType& result) + bool get_number( + const input_format_t format, + NumberType& result) { // step 1: read input into array with system's byte order std::array vec; @@ -10019,23 +11130,24 @@ class binary_reader } /*! - @brief create a string by reading characters from the input + @brief create a string by reading characters from the input - @tparam NumberType the type of the number - @param[in] format the current format (for diagnostics) - @param[in] len number of characters to read - @param[out] result string created by reading @a len bytes + @tparam NumberType the type of the number + @param[in] format the current format (for diagnostics) + @param[in] len number of characters to read + @param[out] result string created by reading @a len bytes - @return whether string creation completed + @return whether string creation completed - @note We can not reserve @a len bytes for the result, because @a len + @note We can not reserve @a len bytes for the result, because @a len may be too large. Usually, @ref unexpect_eof() detects the end of the input before we run out of string memory. - */ + */ template - bool get_string(const input_format_t format, - const NumberType len, - string_t& result) + bool get_string( + const input_format_t format, + const NumberType len, + string_t& result) { bool success = true; for (NumberType i = 0; i < len; i++) @@ -10047,28 +11159,29 @@ class binary_reader break; } result.push_back(static_cast(current)); - }; + } return success; } /*! - @brief create a byte array by reading bytes from the input + @brief create a byte array by reading bytes from the input - @tparam NumberType the type of the number - @param[in] format the current format (for diagnostics) - @param[in] len number of bytes to read - @param[out] result byte array created by reading @a len bytes + @tparam NumberType the type of the number + @param[in] format the current format (for diagnostics) + @param[in] len number of bytes to read + @param[out] result byte array created by reading @a len bytes - @return whether byte array creation completed + @return whether byte array creation completed - @note We can not reserve @a len bytes for the result, because @a len + @note We can not reserve @a len bytes for the result, because @a len may be too large. Usually, @ref unexpect_eof() detects the end of the input before we run out of memory. - */ + */ template - bool get_binary(const input_format_t format, - const NumberType len, - binary_t& result) + bool get_binary( + const input_format_t format, + const NumberType len, + binary_t& result) { bool success = true; for (NumberType i = 0; i < len; i++) @@ -10085,24 +11198,27 @@ class binary_reader } /*! - @param[in] format the current format (for diagnostics) - @param[in] context further context information (for diagnostics) - @return whether the last read character is not EOF - */ + @param[in] format the current format (for diagnostics) + @param[in] context further context information (for diagnostics) + @return whether the last read character is not EOF + */ JSON_HEDLEY_NON_NULL(3) - bool unexpect_eof(const input_format_t format, const char* context) const + bool unexpect_eof( + const input_format_t format, + const char* context) const { if (JSON_HEDLEY_UNLIKELY(current == std::char_traits::eof())) { return sax->parse_error(chars_read, "", - parse_error::create(110, chars_read, exception_message(format, "unexpected end of input", context))); + parse_error::create(110, chars_read, + exception_message(format, "unexpected end of input", context))); } return true; } /*! - @return a string representation of the last read byte - */ + @return a string representation of the last read byte + */ std::string get_token_string() const { std::array cr{{}}; @@ -10111,14 +11227,15 @@ class binary_reader } /*! - @param[in] format the current format - @param[in] detail a detailed error message - @param[in] context further context information - @return a message string to use in the parse_error exceptions - */ - std::string exception_message(const input_format_t format, - const std::string& detail, - const std::string& context) const + @param[in] format the current format + @param[in] detail a detailed error message + @param[in] context further context information + @return a message string to use in the parse_error exceptions + */ + std::string exception_message( + const input_format_t format, + const std::string& detail, + const std::string& context) const { std::string error_msg = "syntax error while parsing "; @@ -10147,7 +11264,8 @@ class binary_reader return error_msg + " " + context + ": " + detail; } - private: +private: + /// input adapter InputAdapterType ia; @@ -10195,10 +11313,8 @@ class binary_reader // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { //////////// // parser // //////////// @@ -10221,13 +11337,13 @@ enum class parse_event_t : uint8_t template using parser_callback_t = - std::function; + std::function; /*! -@brief syntax analysis + @brief syntax analysis -This class implements a recursive descent parser. -*/ + This class implements a recursive descent parser. + */ template class parser { @@ -10238,12 +11354,14 @@ class parser using lexer_t = lexer; using token_type = typename lexer_t::token_type; - public: +public: + /// a parser reading from an input adapter - explicit parser(InputAdapterType&& adapter, - const parser_callback_t cb = nullptr, - const bool allow_exceptions_ = true, - const bool skip_comments = false) + explicit parser( + InputAdapterType&& adapter, + const parser_callback_t cb = nullptr, + const bool allow_exceptions_ = true, + const bool skip_comments = false) : callback(cb) , m_lexer(std::move(adapter), skip_comments) , allow_exceptions(allow_exceptions_) @@ -10253,16 +11371,18 @@ class parser } /*! - @brief public parser interface + @brief public parser interface - @param[in] strict whether to expect the last token to be EOF - @param[in,out] result parsed JSON value + @param[in] strict whether to expect the last token to be EOF + @param[in,out] result parsed JSON value - @throw parse_error.101 in case of an unexpected token - @throw parse_error.102 if to_unicode fails or surrogate error - @throw parse_error.103 if to_unicode fails - */ - void parse(const bool strict, BasicJsonType& result) + @throw parse_error.101 in case of an unexpected token + @throw parse_error.102 if to_unicode fails or surrogate error + @throw parse_error.103 if to_unicode fails + */ + void parse( + const bool strict, + BasicJsonType& result) { if (callback) { @@ -10274,9 +11394,9 @@ class parser if (strict && (get_token() != token_type::end_of_input)) { sdp.parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - parse_error::create(101, m_lexer.get_position(), - exception_message(token_type::end_of_input, "value"))); + m_lexer.get_token_string(), + parse_error::create(101, m_lexer.get_position(), + exception_message(token_type::end_of_input, "value"))); } // in case of an error, return discarded value @@ -10303,9 +11423,9 @@ class parser if (strict && (get_token() != token_type::end_of_input)) { sdp.parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - parse_error::create(101, m_lexer.get_position(), - exception_message(token_type::end_of_input, "value"))); + m_lexer.get_token_string(), + parse_error::create(101, m_lexer.get_position(), + exception_message(token_type::end_of_input, "value"))); } // in case of an error, return discarded value @@ -10318,12 +11438,13 @@ class parser } /*! - @brief public accept interface + @brief public accept interface - @param[in] strict whether to expect the last token to be EOF - @return whether the input is a proper JSON text - */ - bool accept(const bool strict = true) + @param[in] strict whether to expect the last token to be EOF + @return whether the input is a proper JSON text + */ + bool accept( + const bool strict = true) { json_sax_acceptor sax_acceptor; return sax_parse(&sax_acceptor, strict); @@ -10331,7 +11452,9 @@ class parser template JSON_HEDLEY_NON_NULL(2) - bool sax_parse(SAX* sax, const bool strict = true) + bool sax_parse( + SAX* sax, + const bool strict = true) { (void)detail::is_sax_static_asserts {}; const bool result = sax_parse_internal(sax); @@ -10340,18 +11463,20 @@ class parser if (result && strict && (get_token() != token_type::end_of_input)) { return sax->parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - parse_error::create(101, m_lexer.get_position(), - exception_message(token_type::end_of_input, "value"))); + m_lexer.get_token_string(), + parse_error::create(101, m_lexer.get_position(), + exception_message(token_type::end_of_input, "value"))); } return result; } - private: +private: + template JSON_HEDLEY_NON_NULL(2) - bool sax_parse_internal(SAX* sax) + bool sax_parse_internal( + SAX* sax) { // stack to remember the hierarchy of structured values we are parsing // true = array; false = object @@ -10387,9 +11512,9 @@ class parser if (JSON_HEDLEY_UNLIKELY(last_token != token_type::value_string)) { return sax->parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - parse_error::create(101, m_lexer.get_position(), - exception_message(token_type::value_string, "object key"))); + m_lexer.get_token_string(), + parse_error::create(101, m_lexer.get_position(), + exception_message(token_type::value_string, "object key"))); } if (JSON_HEDLEY_UNLIKELY(!sax->key(m_lexer.get_string()))) { @@ -10400,9 +11525,9 @@ class parser if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator)) { return sax->parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - parse_error::create(101, m_lexer.get_position(), - exception_message(token_type::name_separator, "object separator"))); + m_lexer.get_token_string(), + parse_error::create(101, m_lexer.get_position(), + exception_message(token_type::name_separator, "object separator"))); } // remember we are now inside an object @@ -10444,8 +11569,9 @@ class parser if (JSON_HEDLEY_UNLIKELY(!std::isfinite(res))) { return sax->parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - out_of_range::create(406, "number overflow parsing '" + m_lexer.get_token_string() + "'")); + m_lexer.get_token_string(), + out_of_range::create(406, + "number overflow parsing '" + m_lexer.get_token_string() + "'")); } if (JSON_HEDLEY_UNLIKELY(!sax->number_float(res, m_lexer.get_string()))) @@ -10514,17 +11640,17 @@ class parser { // using "uninitialized" to avoid "expected" message return sax->parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - parse_error::create(101, m_lexer.get_position(), - exception_message(token_type::uninitialized, "value"))); + m_lexer.get_token_string(), + parse_error::create(101, m_lexer.get_position(), + exception_message(token_type::uninitialized, "value"))); } default: // the last token was unexpected { return sax->parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - parse_error::create(101, m_lexer.get_position(), - exception_message(token_type::literal_or_value, "value"))); + m_lexer.get_token_string(), + parse_error::create(101, m_lexer.get_position(), + exception_message(token_type::literal_or_value, "value"))); } } } @@ -10569,9 +11695,9 @@ class parser } return sax->parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - parse_error::create(101, m_lexer.get_position(), - exception_message(token_type::end_array, "array"))); + m_lexer.get_token_string(), + parse_error::create(101, m_lexer.get_position(), + exception_message(token_type::end_array, "array"))); } else // object { @@ -10582,9 +11708,9 @@ class parser if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::value_string)) { return sax->parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - parse_error::create(101, m_lexer.get_position(), - exception_message(token_type::value_string, "object key"))); + m_lexer.get_token_string(), + parse_error::create(101, m_lexer.get_position(), + exception_message(token_type::value_string, "object key"))); } if (JSON_HEDLEY_UNLIKELY(!sax->key(m_lexer.get_string()))) @@ -10596,9 +11722,9 @@ class parser if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::name_separator)) { return sax->parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - parse_error::create(101, m_lexer.get_position(), - exception_message(token_type::name_separator, "object separator"))); + m_lexer.get_token_string(), + parse_error::create(101, m_lexer.get_position(), + exception_message(token_type::name_separator, "object separator"))); } // parse values @@ -10625,9 +11751,9 @@ class parser } return sax->parse_error(m_lexer.get_position(), - m_lexer.get_token_string(), - parse_error::create(101, m_lexer.get_position(), - exception_message(token_type::end_object, "object"))); + m_lexer.get_token_string(), + parse_error::create(101, m_lexer.get_position(), + exception_message(token_type::end_object, "object"))); } } } @@ -10638,7 +11764,9 @@ class parser return last_token = m_lexer.scan(); } - std::string exception_message(const token_type expected, const std::string& context) + std::string exception_message( + const token_type expected, + const std::string& context) { std::string error_msg = "syntax error "; @@ -10652,7 +11780,7 @@ class parser if (last_token == token_type::parse_error) { error_msg += std::string(m_lexer.get_error_message()) + "; last read: '" + - m_lexer.get_token_string() + "'"; + m_lexer.get_token_string() + "'"; } else { @@ -10667,7 +11795,8 @@ class parser return error_msg; } - private: +private: + /// callback function const parser_callback_t callback = nullptr; /// the type of the last read token @@ -10689,31 +11818,31 @@ class parser #include // ptrdiff_t #include // numeric_limits -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { /* -@brief an iterator for primitive JSON types - -This class models an iterator for primitive JSON types (boolean, number, -string). It's only purpose is to allow the iterator/const_iterator classes -to "iterate" over primitive values. Internally, the iterator is modeled by -a `difference_type` variable. Value begin_value (`0`) models the begin, -end_value (`1`) models past the end. -*/ + @brief an iterator for primitive JSON types + + This class models an iterator for primitive JSON types (boolean, number, + string). It's only purpose is to allow the iterator/const_iterator classes + to "iterate" over primitive values. Internally, the iterator is modeled by + a `difference_type` variable. Value begin_value (`0`) models the begin, + end_value (`1`) models past the end. + */ class primitive_iterator_t { - private: +private: + using difference_type = std::ptrdiff_t; static constexpr difference_type begin_value = 0; static constexpr difference_type end_value = begin_value + 1; - JSON_PRIVATE_UNLESS_TESTED: +JSON_PRIVATE_UNLESS_TESTED: /// iterator as signed integer type difference_type m_it = (std::numeric_limits::min)(); - public: +public: + constexpr difference_type get_value() const noexcept { return m_it; @@ -10743,80 +11872,90 @@ class primitive_iterator_t return m_it == end_value; } - friend constexpr bool operator==(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept + friend constexpr bool operator ==( + primitive_iterator_t lhs, + primitive_iterator_t rhs) noexcept { return lhs.m_it == rhs.m_it; } - friend constexpr bool operator<(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept + friend constexpr bool operator <( + primitive_iterator_t lhs, + primitive_iterator_t rhs) noexcept { return lhs.m_it < rhs.m_it; } - primitive_iterator_t operator+(difference_type n) noexcept + primitive_iterator_t operator +( + difference_type n) noexcept { auto result = *this; result += n; return result; } - friend constexpr difference_type operator-(primitive_iterator_t lhs, primitive_iterator_t rhs) noexcept + friend constexpr difference_type operator -( + primitive_iterator_t lhs, + primitive_iterator_t rhs) noexcept { return lhs.m_it - rhs.m_it; } - primitive_iterator_t& operator++() noexcept + primitive_iterator_t& operator ++() noexcept { ++m_it; return *this; } - primitive_iterator_t const operator++(int) noexcept + primitive_iterator_t const operator ++( + int) noexcept { auto result = *this; ++m_it; return result; } - primitive_iterator_t& operator--() noexcept + primitive_iterator_t& operator --() noexcept { --m_it; return *this; } - primitive_iterator_t const operator--(int) noexcept + primitive_iterator_t const operator --( + int) noexcept { auto result = *this; --m_it; return result; } - primitive_iterator_t& operator+=(difference_type n) noexcept + primitive_iterator_t& operator +=( + difference_type n) noexcept { m_it += n; return *this; } - primitive_iterator_t& operator-=(difference_type n) noexcept + primitive_iterator_t& operator -=( + difference_type n) noexcept { m_it -= n; return *this; } + }; } // namespace detail } // namespace nlohmann -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { /*! -@brief an iterator value + @brief an iterator value -@note This structure could easily be a union, but MSVC currently does not allow -unions members with complex constructors, see https://github.com/nlohmann/json/pull/105. -*/ + @note This structure could easily be a union, but MSVC currently does not allow + unions members with complex constructors, see https://github.com/nlohmann/json/pull/105. + */ template struct internal_iterator { /// iterator for JSON objects @@ -10850,35 +11989,34 @@ template struct internal_iterator // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { // forward declare, to be able to friend it later on template class iteration_proxy; template class iteration_proxy_value; /*! -@brief a template for a bidirectional iterator for the @ref basic_json class -This class implements a both iterators (iterator and const_iterator) for the -@ref basic_json class. -@note An iterator is called *initialized* when a pointer to a JSON value has + @brief a template for a bidirectional iterator for the @ref basic_json class + This class implements a both iterators (iterator and const_iterator) for the + @ref basic_json class. + @note An iterator is called *initialized* when a pointer to a JSON value has been set (e.g., by a constructor or a copy assignment). If the iterator is default-constructed, it is *uninitialized* and most methods are undefined. - **The library uses assertions to detect calls on uninitialized iterators.** -@requirement The class satisfies the following concept requirements: -- -[BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator): - The iterator that can be moved can be moved in both directions (i.e. - incremented and decremented). -@since version 1.0.0, simplified in version 2.0.9, change to bidirectional + **The library uses assertions to detect calls on uninitialized iterators.** + @requirement The class satisfies the following concept requirements: + - + [BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator): + The iterator that can be moved can be moved in both directions (i.e. + incremented and decremented). + @since version 1.0.0, simplified in version 2.0.9, change to bidirectional iterators in version 3.0.0 (see https://github.com/nlohmann/json/issues/593) -*/ + */ template class iter_impl { /// allow basic_json to access private members - friend iter_impl::value, typename std::remove_const::type, const BasicJsonType>::type>; + friend iter_impl::value, + typename std::remove_const::type, const BasicJsonType>::type>; friend BasicJsonType; friend iteration_proxy; friend iteration_proxy_value; @@ -10887,9 +12025,9 @@ class iter_impl using array_t = typename BasicJsonType::array_t; // make sure BasicJsonType is basic_json or const basic_json static_assert(is_basic_json::type>::value, - "iter_impl only accepts (const) basic_json"); + "iter_impl only accepts (const) basic_json"); - public: +public: /// The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. /// The C++ Standard has never required user-defined iterators to derive from std::iterator. @@ -10904,24 +12042,26 @@ class iter_impl using difference_type = typename BasicJsonType::difference_type; /// defines a pointer to the type iterated over (value_type) using pointer = typename std::conditional::value, - typename BasicJsonType::const_pointer, - typename BasicJsonType::pointer>::type; + typename BasicJsonType::const_pointer, + typename BasicJsonType::pointer>::type; /// defines a reference to the type iterated over (value_type) using reference = - typename std::conditional::value, - typename BasicJsonType::const_reference, - typename BasicJsonType::reference>::type; + typename std::conditional::value, + typename BasicJsonType::const_reference, + typename BasicJsonType::reference>::type; /// default constructor iter_impl() = default; /*! - @brief constructor for a given JSON instance - @param[in] object pointer to a JSON object for this iterator - @pre object != nullptr - @post The iterator is initialized; i.e. `m_object != nullptr`. - */ - explicit iter_impl(pointer object) noexcept : m_object(object) + @brief constructor for a given JSON instance + @param[in] object pointer to a JSON object for this iterator + @pre object != nullptr + @post The iterator is initialized; i.e. `m_object != nullptr`. + */ + explicit iter_impl( + pointer object) noexcept + : m_object(object) { JSON_ASSERT(m_object != nullptr); @@ -10948,32 +12088,36 @@ class iter_impl } /*! - @note The conventional copy constructor and copy assignment are implicitly + @note The conventional copy constructor and copy assignment are implicitly defined. Combined with the following converting constructor and assignment, they support: (1) copy from iterator to iterator, (2) copy from const iterator to const iterator, and (3) conversion from iterator to const iterator. However conversion from const iterator to iterator is not defined. - */ + */ /*! - @brief const copy constructor - @param[in] other const iterator to copy from - @note This copy constructor had to be defined explicitly to circumvent a bug + @brief const copy constructor + @param[in] other const iterator to copy from + @note This copy constructor had to be defined explicitly to circumvent a bug occurring on msvc v19.0 compiler (VS 2015) debug build. For more information refer to: https://github.com/nlohmann/json/issues/1608 - */ - iter_impl(const iter_impl& other) noexcept - : m_object(other.m_object), m_it(other.m_it) - {} + */ + iter_impl( + const iter_impl& other) noexcept + : m_object(other.m_object) + , m_it(other.m_it) + { + } /*! - @brief converting assignment - @param[in] other const iterator to copy from - @return const/non-const iterator - @note It is not checked whether @a other is initialized. - */ - iter_impl& operator=(const iter_impl& other) noexcept + @brief converting assignment + @param[in] other const iterator to copy from + @return const/non-const iterator + @note It is not checked whether @a other is initialized. + */ + iter_impl& operator =( + const iter_impl& other) noexcept { m_object = other.m_object; m_it = other.m_it; @@ -10981,32 +12125,36 @@ class iter_impl } /*! - @brief converting constructor - @param[in] other non-const iterator to copy from - @note It is not checked whether @a other is initialized. - */ - iter_impl(const iter_impl::type>& other) noexcept - : m_object(other.m_object), m_it(other.m_it) - {} + @brief converting constructor + @param[in] other non-const iterator to copy from + @note It is not checked whether @a other is initialized. + */ + iter_impl( + const iter_impl::type>& other) noexcept + : m_object(other.m_object) + , m_it(other.m_it) + { + } /*! - @brief converting assignment - @param[in] other non-const iterator to copy from - @return const/non-const iterator - @note It is not checked whether @a other is initialized. - */ - iter_impl& operator=(const iter_impl::type>& other) noexcept + @brief converting assignment + @param[in] other non-const iterator to copy from + @return const/non-const iterator + @note It is not checked whether @a other is initialized. + */ + iter_impl& operator =( + const iter_impl::type>& other) noexcept { m_object = other.m_object; m_it = other.m_it; return *this; } - JSON_PRIVATE_UNLESS_TESTED: +JSON_PRIVATE_UNLESS_TESTED: /*! - @brief set the iterator to the first value - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ + @brief set the iterator to the first value + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ void set_begin() noexcept { JSON_ASSERT(m_object != nullptr); @@ -11041,9 +12189,9 @@ class iter_impl } /*! - @brief set the iterator past the last value - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ + @brief set the iterator past the last value + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ void set_end() noexcept { JSON_ASSERT(m_object != nullptr); @@ -11070,12 +12218,13 @@ class iter_impl } } - public: +public: + /*! - @brief return a reference to the value pointed to by the iterator - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - reference operator*() const + @brief return a reference to the value pointed to by the iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + reference operator *() const { JSON_ASSERT(m_object != nullptr); @@ -11109,10 +12258,10 @@ class iter_impl } /*! - @brief dereference the iterator - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - pointer operator->() const + @brief dereference the iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + pointer operator ->() const { JSON_ASSERT(m_object != nullptr); @@ -11143,10 +12292,11 @@ class iter_impl } /*! - @brief post-increment (it++) - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - iter_impl const operator++(int) + @brief post-increment (it++) + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl const operator ++( + int) { auto result = *this; ++(*this); @@ -11154,10 +12304,10 @@ class iter_impl } /*! - @brief pre-increment (++it) - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - iter_impl& operator++() + @brief pre-increment (++it) + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl& operator ++() { JSON_ASSERT(m_object != nullptr); @@ -11186,10 +12336,11 @@ class iter_impl } /*! - @brief post-decrement (it--) - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - iter_impl const operator--(int) + @brief post-decrement (it--) + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl const operator --( + int) { auto result = *this; --(*this); @@ -11197,10 +12348,10 @@ class iter_impl } /*! - @brief pre-decrement (--it) - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - iter_impl& operator--() + @brief pre-decrement (--it) + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl& operator --() { JSON_ASSERT(m_object != nullptr); @@ -11229,10 +12380,11 @@ class iter_impl } /*! - @brief comparison: equal - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - bool operator==(const iter_impl& other) const + @brief comparison: equal + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator ==( + const iter_impl& other) const { // if objects are not the same, the comparison is undefined if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object)) @@ -11256,19 +12408,21 @@ class iter_impl } /*! - @brief comparison: not equal - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - bool operator!=(const iter_impl& other) const + @brief comparison: not equal + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator !=( + const iter_impl& other) const { - return !operator==(other); + return !operator ==(other); } /*! - @brief comparison: smaller - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - bool operator<(const iter_impl& other) const + @brief comparison: smaller + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator <( + const iter_impl& other) const { // if objects are not the same, the comparison is undefined if (JSON_HEDLEY_UNLIKELY(m_object != other.m_object)) @@ -11292,37 +12446,41 @@ class iter_impl } /*! - @brief comparison: less than or equal - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - bool operator<=(const iter_impl& other) const + @brief comparison: less than or equal + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator <=( + const iter_impl& other) const { return !other.operator < (*this); } /*! - @brief comparison: greater than - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - bool operator>(const iter_impl& other) const + @brief comparison: greater than + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator >( + const iter_impl& other) const { - return !operator<=(other); + return !operator <=(other); } /*! - @brief comparison: greater than or equal - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - bool operator>=(const iter_impl& other) const + @brief comparison: greater than or equal + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + bool operator >=( + const iter_impl& other) const { - return !operator<(other); + return !operator <(other); } /*! - @brief add to iterator - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - iter_impl& operator+=(difference_type i) + @brief add to iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl& operator +=( + difference_type i) { JSON_ASSERT(m_object != nullptr); @@ -11348,19 +12506,21 @@ class iter_impl } /*! - @brief subtract from iterator - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - iter_impl& operator-=(difference_type i) + @brief subtract from iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl& operator -=( + difference_type i) { - return operator+=(-i); + return operator +=(-i); } /*! - @brief add to iterator - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - iter_impl operator+(difference_type i) const + @brief add to iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl operator +( + difference_type i) const { auto result = *this; result += i; @@ -11368,10 +12528,12 @@ class iter_impl } /*! - @brief addition of distance and iterator - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - friend iter_impl operator+(difference_type i, const iter_impl& it) + @brief addition of distance and iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + friend iter_impl operator +( + difference_type i, + const iter_impl& it) { auto result = it; result += i; @@ -11379,10 +12541,11 @@ class iter_impl } /*! - @brief subtract from iterator - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - iter_impl operator-(difference_type i) const + @brief subtract from iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + iter_impl operator -( + difference_type i) const { auto result = *this; result -= i; @@ -11390,10 +12553,11 @@ class iter_impl } /*! - @brief return difference - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - difference_type operator-(const iter_impl& other) const + @brief return difference + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + difference_type operator -( + const iter_impl& other) const { JSON_ASSERT(m_object != nullptr); @@ -11411,10 +12575,11 @@ class iter_impl } /*! - @brief access to successor - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ - reference operator[](difference_type n) const + @brief access to successor + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ + reference operator []( + difference_type n) const { JSON_ASSERT(m_object != nullptr); @@ -11442,9 +12607,9 @@ class iter_impl } /*! - @brief return the key of an object iterator - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ + @brief return the key of an object iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ const typename object_t::key_type& key() const { JSON_ASSERT(m_object != nullptr); @@ -11458,15 +12623,15 @@ class iter_impl } /*! - @brief return the value of an iterator - @pre The iterator is initialized; i.e. `m_object != nullptr`. - */ + @brief return the value of an iterator + @pre The iterator is initialized; i.e. `m_object != nullptr`. + */ reference value() const { - return operator*(); + return operator *(); } - JSON_PRIVATE_UNLESS_TESTED: +JSON_PRIVATE_UNLESS_TESTED: /// associated JSON instance pointer m_object = nullptr; /// the actual iterator of the associated instance @@ -11484,36 +12649,35 @@ class iter_impl #include // reverse_iterator #include // declval -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { ////////////////////// // reverse_iterator // ////////////////////// /*! -@brief a template for a reverse iterator class - -@tparam Base the base iterator type to reverse. Valid types are @ref -iterator (to create @ref reverse_iterator) and @ref const_iterator (to -create @ref const_reverse_iterator). - -@requirement The class satisfies the following concept requirements: -- -[BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator): - The iterator that can be moved can be moved in both directions (i.e. - incremented and decremented). -- [OutputIterator](https://en.cppreference.com/w/cpp/named_req/OutputIterator): - It is possible to write to the pointed-to element (only if @a Base is - @ref iterator). - -@since version 1.0.0 -*/ + @brief a template for a reverse iterator class + + @tparam Base the base iterator type to reverse. Valid types are @ref + iterator (to create @ref reverse_iterator) and @ref const_iterator (to + create @ref const_reverse_iterator). + + @requirement The class satisfies the following concept requirements: + - + [BidirectionalIterator](https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator): + The iterator that can be moved can be moved in both directions (i.e. + incremented and decremented). + - [OutputIterator](https://en.cppreference.com/w/cpp/named_req/OutputIterator): + It is possible to write to the pointed-to element (only if @a Base is + @ref iterator). + + @since version 1.0.0 + */ template class json_reverse_iterator : public std::reverse_iterator { - public: +public: + using difference_type = std::ptrdiff_t; /// shortcut to the reverse iterator adapter using base_iterator = std::reverse_iterator; @@ -11521,64 +12685,78 @@ class json_reverse_iterator : public std::reverse_iterator using reference = typename Base::reference; /// create reverse iterator from iterator - explicit json_reverse_iterator(const typename base_iterator::iterator_type& it) noexcept - : base_iterator(it) {} + explicit json_reverse_iterator( + const typename base_iterator::iterator_type& it) noexcept + : base_iterator(it) + { + } /// create reverse iterator from base class - explicit json_reverse_iterator(const base_iterator& it) noexcept : base_iterator(it) {} + explicit json_reverse_iterator( + const base_iterator& it) noexcept + : base_iterator(it) + { + } /// post-increment (it++) - json_reverse_iterator const operator++(int) + json_reverse_iterator const operator ++( + int) { - return static_cast(base_iterator::operator++(1)); + return static_cast(base_iterator::operator ++(1)); } /// pre-increment (++it) - json_reverse_iterator& operator++() + json_reverse_iterator& operator ++() { - return static_cast(base_iterator::operator++()); + return static_cast(base_iterator::operator ++()); } /// post-decrement (it--) - json_reverse_iterator const operator--(int) + json_reverse_iterator const operator --( + int) { - return static_cast(base_iterator::operator--(1)); + return static_cast(base_iterator::operator --(1)); } /// pre-decrement (--it) - json_reverse_iterator& operator--() + json_reverse_iterator& operator --() { - return static_cast(base_iterator::operator--()); + return static_cast(base_iterator::operator --()); } /// add to iterator - json_reverse_iterator& operator+=(difference_type i) + json_reverse_iterator& operator +=( + difference_type i) { - return static_cast(base_iterator::operator+=(i)); + return static_cast(base_iterator::operator +=(i)); } /// add to iterator - json_reverse_iterator operator+(difference_type i) const + json_reverse_iterator operator +( + difference_type i) const { - return static_cast(base_iterator::operator+(i)); + return static_cast(base_iterator::operator +(i)); } /// subtract from iterator - json_reverse_iterator operator-(difference_type i) const + json_reverse_iterator operator -( + difference_type i) const { - return static_cast(base_iterator::operator-(i)); + return static_cast(base_iterator::operator -(i)); } /// return difference - difference_type operator-(const json_reverse_iterator& other) const + difference_type operator -( + const json_reverse_iterator& other) const { return base_iterator(*this) - base_iterator(other); } /// access to successor - reference operator[](difference_type n) const + reference operator []( + difference_type n) const { - return *(this->operator+(n)); + return *(this->operator +(n)); } /// return the key of an object iterator @@ -11594,6 +12772,7 @@ class json_reverse_iterator : public std::reverse_iterator auto it = --this->base(); return it.operator * (); } + }; } // namespace detail } // namespace nlohmann @@ -11618,8 +12797,7 @@ class json_reverse_iterator : public std::reverse_iterator // #include -namespace nlohmann -{ +namespace nlohmann { template class json_pointer { @@ -11627,54 +12805,57 @@ class json_pointer NLOHMANN_BASIC_JSON_TPL_DECLARATION friend class basic_json; - public: +public: + /*! - @brief create JSON pointer + @brief create JSON pointer - Create a JSON pointer according to the syntax described in - [Section 3 of RFC6901](https://tools.ietf.org/html/rfc6901#section-3). + Create a JSON pointer according to the syntax described in + [Section 3 of RFC6901](https://tools.ietf.org/html/rfc6901#section-3). - @param[in] s string representing the JSON pointer; if omitted, the empty + @param[in] s string representing the JSON pointer; if omitted, the empty string is assumed which references the whole JSON value - @throw parse_error.107 if the given JSON pointer @a s is nonempty and does + @throw parse_error.107 if the given JSON pointer @a s is nonempty and does not begin with a slash (`/`); see example below - @throw parse_error.108 if a tilde (`~`) in the given JSON pointer @a s is - not followed by `0` (representing `~`) or `1` (representing `/`); see - example below + @throw parse_error.108 if a tilde (`~`) in the given JSON pointer @a s is + not followed by `0` (representing `~`) or `1` (representing `/`); see + example below - @liveexample{The example shows the construction several valid JSON pointers - as well as the exceptional behavior.,json_pointer} + @liveexample{The example shows the construction several valid JSON pointers + as well as the exceptional behavior.,json_pointer} - @since version 2.0.0 - */ - explicit json_pointer(const std::string& s = "") + @since version 2.0.0 + */ + explicit json_pointer( + const std::string& s = "") : reference_tokens(split(s)) - {} + { + } /*! - @brief return a string representation of the JSON pointer + @brief return a string representation of the JSON pointer - @invariant For each JSON pointer `ptr`, it holds: - @code {.cpp} - ptr == json_pointer(ptr.to_string()); - @endcode + @invariant For each JSON pointer `ptr`, it holds: + @code {.cpp} + ptr == json_pointer(ptr.to_string()); + @endcode - @return a string representation of the JSON pointer + @return a string representation of the JSON pointer - @liveexample{The example shows the result of `to_string`.,json_pointer__to_string} + @liveexample{The example shows the result of `to_string`.,json_pointer__to_string} - @since version 2.0.0 - */ + @since version 2.0.0 + */ std::string to_string() const { return std::accumulate(reference_tokens.begin(), reference_tokens.end(), - std::string{}, - [](const std::string & a, const std::string & b) - { - return a + "/" + escape(b); - }); + std::string{}, + [](const std::string& a, const std::string& b) + { + return a + "/" + escape(b); + }); } /// @copydoc to_string() @@ -11684,146 +12865,154 @@ class json_pointer } /*! - @brief append another JSON pointer at the end of this JSON pointer + @brief append another JSON pointer at the end of this JSON pointer - @param[in] ptr JSON pointer to append - @return JSON pointer with @a ptr appended + @param[in] ptr JSON pointer to append + @return JSON pointer with @a ptr appended - @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add} + @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add} - @complexity Linear in the length of @a ptr. + @complexity Linear in the length of @a ptr. - @sa @ref operator/=(std::string) to append a reference token - @sa @ref operator/=(std::size_t) to append an array index - @sa @ref operator/(const json_pointer&, const json_pointer&) for a binary operator + @sa @ref operator/=(std::string) to append a reference token + @sa @ref operator/=(std::size_t) to append an array index + @sa @ref operator/(const json_pointer&, const json_pointer&) for a binary operator - @since version 3.6.0 - */ - json_pointer& operator/=(const json_pointer& ptr) + @since version 3.6.0 + */ + json_pointer& operator /=( + const json_pointer& ptr) { reference_tokens.insert(reference_tokens.end(), - ptr.reference_tokens.begin(), - ptr.reference_tokens.end()); + ptr.reference_tokens.begin(), + ptr.reference_tokens.end()); return *this; } /*! - @brief append an unescaped reference token at the end of this JSON pointer + @brief append an unescaped reference token at the end of this JSON pointer - @param[in] token reference token to append - @return JSON pointer with @a token appended without escaping @a token + @param[in] token reference token to append + @return JSON pointer with @a token appended without escaping @a token - @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add} + @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add} - @complexity Amortized constant. + @complexity Amortized constant. - @sa @ref operator/=(const json_pointer&) to append a JSON pointer - @sa @ref operator/=(std::size_t) to append an array index - @sa @ref operator/(const json_pointer&, std::size_t) for a binary operator + @sa @ref operator/=(const json_pointer&) to append a JSON pointer + @sa @ref operator/=(std::size_t) to append an array index + @sa @ref operator/(const json_pointer&, std::size_t) for a binary operator - @since version 3.6.0 - */ - json_pointer& operator/=(std::string token) + @since version 3.6.0 + */ + json_pointer& operator /=( + std::string token) { push_back(std::move(token)); return *this; } /*! - @brief append an array index at the end of this JSON pointer + @brief append an array index at the end of this JSON pointer - @param[in] array_idx array index to append - @return JSON pointer with @a array_idx appended + @param[in] array_idx array index to append + @return JSON pointer with @a array_idx appended - @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add} + @liveexample{The example shows the usage of `operator/=`.,json_pointer__operator_add} - @complexity Amortized constant. + @complexity Amortized constant. - @sa @ref operator/=(const json_pointer&) to append a JSON pointer - @sa @ref operator/=(std::string) to append a reference token - @sa @ref operator/(const json_pointer&, std::string) for a binary operator + @sa @ref operator/=(const json_pointer&) to append a JSON pointer + @sa @ref operator/=(std::string) to append a reference token + @sa @ref operator/(const json_pointer&, std::string) for a binary operator - @since version 3.6.0 - */ - json_pointer& operator/=(std::size_t array_idx) + @since version 3.6.0 + */ + json_pointer& operator /=( + std::size_t array_idx) { return *this /= std::to_string(array_idx); } /*! - @brief create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer + @brief create a new JSON pointer by appending the right JSON pointer at the end of the left JSON pointer - @param[in] lhs JSON pointer - @param[in] rhs JSON pointer - @return a new JSON pointer with @a rhs appended to @a lhs + @param[in] lhs JSON pointer + @param[in] rhs JSON pointer + @return a new JSON pointer with @a rhs appended to @a lhs - @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary} + @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary} - @complexity Linear in the length of @a lhs and @a rhs. + @complexity Linear in the length of @a lhs and @a rhs. - @sa @ref operator/=(const json_pointer&) to append a JSON pointer + @sa @ref operator/=(const json_pointer&) to append a JSON pointer - @since version 3.6.0 - */ - friend json_pointer operator/(const json_pointer& lhs, - const json_pointer& rhs) + @since version 3.6.0 + */ + friend json_pointer operator /( + const json_pointer& lhs, + const json_pointer& rhs) { return json_pointer(lhs) /= rhs; } /*! - @brief create a new JSON pointer by appending the unescaped token at the end of the JSON pointer + @brief create a new JSON pointer by appending the unescaped token at the end of the JSON pointer - @param[in] ptr JSON pointer - @param[in] token reference token - @return a new JSON pointer with unescaped @a token appended to @a ptr + @param[in] ptr JSON pointer + @param[in] token reference token + @return a new JSON pointer with unescaped @a token appended to @a ptr - @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary} + @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary} - @complexity Linear in the length of @a ptr. + @complexity Linear in the length of @a ptr. - @sa @ref operator/=(std::string) to append a reference token + @sa @ref operator/=(std::string) to append a reference token - @since version 3.6.0 - */ - friend json_pointer operator/(const json_pointer& ptr, std::string token) + @since version 3.6.0 + */ + friend json_pointer operator /( + const json_pointer& ptr, + std::string token) { return json_pointer(ptr) /= std::move(token); } /*! - @brief create a new JSON pointer by appending the array-index-token at the end of the JSON pointer + @brief create a new JSON pointer by appending the array-index-token at the end of the JSON pointer - @param[in] ptr JSON pointer - @param[in] array_idx array index - @return a new JSON pointer with @a array_idx appended to @a ptr + @param[in] ptr JSON pointer + @param[in] array_idx array index + @return a new JSON pointer with @a array_idx appended to @a ptr - @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary} + @liveexample{The example shows the usage of `operator/`.,json_pointer__operator_add_binary} - @complexity Linear in the length of @a ptr. + @complexity Linear in the length of @a ptr. - @sa @ref operator/=(std::size_t) to append an array index + @sa @ref operator/=(std::size_t) to append an array index - @since version 3.6.0 - */ - friend json_pointer operator/(const json_pointer& ptr, std::size_t array_idx) + @since version 3.6.0 + */ + friend json_pointer operator /( + const json_pointer& ptr, + std::size_t array_idx) { return json_pointer(ptr) /= array_idx; } /*! - @brief returns the parent of this JSON pointer + @brief returns the parent of this JSON pointer - @return parent of this JSON pointer; in case this JSON pointer is the root, + @return parent of this JSON pointer; in case this JSON pointer is the root, the root itself is returned - @complexity Linear in the length of the JSON pointer. + @complexity Linear in the length of the JSON pointer. - @liveexample{The example shows the result of `parent_pointer` for different - JSON Pointers.,json_pointer__parent_pointer} + @liveexample{The example shows the result of `parent_pointer` for different + JSON Pointers.,json_pointer__parent_pointer} - @since version 3.6.0 - */ + @since version 3.6.0 + */ json_pointer parent_pointer() const { if (empty()) @@ -11837,18 +13026,18 @@ class json_pointer } /*! - @brief remove last reference token + @brief remove last reference token - @pre not `empty()` + @pre not `empty()` - @liveexample{The example shows the usage of `pop_back`.,json_pointer__pop_back} + @liveexample{The example shows the usage of `pop_back`.,json_pointer__pop_back} - @complexity Constant. + @complexity Constant. - @throw out_of_range.405 if JSON pointer has no parent + @throw out_of_range.405 if JSON pointer has no parent - @since version 3.6.0 - */ + @since version 3.6.0 + */ void pop_back() { if (JSON_HEDLEY_UNLIKELY(empty())) @@ -11860,19 +13049,19 @@ class json_pointer } /*! - @brief return last reference token + @brief return last reference token - @pre not `empty()` - @return last reference token + @pre not `empty()` + @return last reference token - @liveexample{The example shows the usage of `back`.,json_pointer__back} + @liveexample{The example shows the usage of `back`.,json_pointer__back} - @complexity Constant. + @complexity Constant. - @throw out_of_range.405 if JSON pointer has no parent + @throw out_of_range.405 if JSON pointer has no parent - @since version 3.6.0 - */ + @since version 3.6.0 + */ const std::string& back() const { if (JSON_HEDLEY_UNLIKELY(empty())) @@ -11884,59 +13073,63 @@ class json_pointer } /*! - @brief append an unescaped token at the end of the reference pointer + @brief append an unescaped token at the end of the reference pointer - @param[in] token token to add + @param[in] token token to add - @complexity Amortized constant. + @complexity Amortized constant. - @liveexample{The example shows the result of `push_back` for different - JSON Pointers.,json_pointer__push_back} + @liveexample{The example shows the result of `push_back` for different + JSON Pointers.,json_pointer__push_back} - @since version 3.6.0 - */ - void push_back(const std::string& token) + @since version 3.6.0 + */ + void push_back( + const std::string& token) { reference_tokens.push_back(token); } /// @copydoc push_back(const std::string&) - void push_back(std::string&& token) + void push_back( + std::string&& token) { reference_tokens.push_back(std::move(token)); } /*! - @brief return whether pointer points to the root document + @brief return whether pointer points to the root document - @return true iff the JSON pointer points to the root document + @return true iff the JSON pointer points to the root document - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @liveexample{The example shows the result of `empty` for different JSON - Pointers.,json_pointer__empty} + @liveexample{The example shows the result of `empty` for different JSON + Pointers.,json_pointer__empty} - @since version 3.6.0 - */ + @since version 3.6.0 + */ bool empty() const noexcept { return reference_tokens.empty(); } - private: +private: + /*! - @param[in] s reference token to be converted into an array index + @param[in] s reference token to be converted into an array index - @return integer representation of @a s + @return integer representation of @a s - @throw parse_error.106 if an array index begins with '0' - @throw parse_error.109 if an array index begins not with a digit - @throw out_of_range.404 if string @a s could not be converted to an integer - @throw out_of_range.410 if an array index exceeds size_type - */ - static typename BasicJsonType::size_type array_index(const std::string& s) + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index begins not with a digit + @throw out_of_range.404 if string @a s could not be converted to an integer + @throw out_of_range.410 if an array index exceeds size_type + */ + static typename BasicJsonType::size_type array_index( + const std::string& s) { using size_type = typename BasicJsonType::size_type; @@ -11944,8 +13137,8 @@ class json_pointer if (JSON_HEDLEY_UNLIKELY(s.size() > 1 && s[0] == '0')) { JSON_THROW(detail::parse_error::create(106, 0, - "array index '" + s + - "' must not begin with '0'")); + "array index '" + s + + "' must not begin with '0'")); } // error condition (cf. RFC 6901, Sect. 4) @@ -11981,7 +13174,7 @@ class json_pointer return static_cast(res); } - JSON_PRIVATE_UNLESS_TESTED: +JSON_PRIVATE_UNLESS_TESTED: json_pointer top() const { if (JSON_HEDLEY_UNLIKELY(empty())) @@ -11994,16 +13187,18 @@ class json_pointer return result; } - private: +private: + /*! - @brief create and return a reference to the pointed to value + @brief create and return a reference to the pointed to value - @complexity Linear in the number of reference tokens. + @complexity Linear in the number of reference tokens. - @throw parse_error.109 if array index is not a number - @throw type_error.313 if value cannot be unflattened - */ - BasicJsonType& get_and_create(BasicJsonType& j) const + @throw parse_error.109 if array index is not a number + @throw type_error.313 if value cannot be unflattened + */ + BasicJsonType& get_and_create( + BasicJsonType& j) const { auto result = &j; @@ -12018,12 +13213,12 @@ class json_pointer if (reference_token == "0") { // start a new array if reference token is 0 - result = &result->operator[](0); + result = &result->operator [](0); } else { // start a new object otherwise - result = &result->operator[](reference_token); + result = &result->operator [](reference_token); } break; } @@ -12031,23 +13226,23 @@ class json_pointer case detail::value_t::object: { // create an entry in the object - result = &result->operator[](reference_token); + result = &result->operator [](reference_token); break; } case detail::value_t::array: { // create an entry in the array - result = &result->operator[](array_index(reference_token)); + result = &result->operator [](array_index(reference_token)); break; } /* - The following code is only reached if there exists a reference - token _and_ the current value is primitive. In this case, we have - an error situation, because primitive values may only occur as - single value; that is, with an empty list of reference tokens. - */ + The following code is only reached if there exists a reference + token _and_ the current value is primitive. In this case, we have + an error situation, because primitive values may only occur as + single value; that is, with an empty list of reference tokens. + */ default: JSON_THROW(detail::type_error::create(313, "invalid value to unflatten")); } @@ -12057,25 +13252,26 @@ class json_pointer } /*! - @brief return a reference to the pointed to value + @brief return a reference to the pointed to value - @note This version does not throw if a value is not present, but tries to + @note This version does not throw if a value is not present, but tries to create nested values instead. For instance, calling this function with pointer `"/this/that"` on a null value is equivalent to calling `operator[]("this").operator[]("that")` on that value, effectively changing the null value to an object. - @param[in] ptr a JSON value + @param[in] ptr a JSON value - @return reference to the JSON value pointed to by the JSON pointer + @return reference to the JSON value pointed to by the JSON pointer - @complexity Linear in the length of the JSON pointer. + @complexity Linear in the length of the JSON pointer. - @throw parse_error.106 if an array index begins with '0' - @throw parse_error.109 if an array index was not a number - @throw out_of_range.404 if the JSON pointer can not be resolved - */ - BasicJsonType& get_unchecked(BasicJsonType* ptr) const + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.404 if the JSON pointer can not be resolved + */ + BasicJsonType& get_unchecked( + BasicJsonType* ptr) const { for (const auto& reference_token : reference_tokens) { @@ -12084,11 +13280,11 @@ class json_pointer { // check if reference token is a number const bool nums = - std::all_of(reference_token.begin(), reference_token.end(), + std::all_of(reference_token.begin(), reference_token.end(), [](const unsigned char x) - { - return std::isdigit(x); - }); + { + return std::isdigit(x); + }); // change value to array for numbers or "-" or to object otherwise *ptr = (nums || reference_token == "-") @@ -12101,7 +13297,7 @@ class json_pointer case detail::value_t::object: { // use unchecked object access - ptr = &ptr->operator[](reference_token); + ptr = &ptr->operator [](reference_token); break; } @@ -12110,18 +13306,19 @@ class json_pointer if (reference_token == "-") { // explicitly treat "-" as index beyond the end - ptr = &ptr->operator[](ptr->m_value.array->size()); + ptr = &ptr->operator [](ptr->m_value.array->size()); } else { // convert array index to number; unchecked access - ptr = &ptr->operator[](array_index(reference_token)); + ptr = &ptr->operator [](array_index(reference_token)); } break; } default: - JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); + JSON_THROW(detail::out_of_range::create(404, + "unresolved reference token '" + reference_token + "'")); } } @@ -12129,12 +13326,13 @@ class json_pointer } /*! - @throw parse_error.106 if an array index begins with '0' - @throw parse_error.109 if an array index was not a number - @throw out_of_range.402 if the array index '-' is used - @throw out_of_range.404 if the JSON pointer can not be resolved - */ - BasicJsonType& get_checked(BasicJsonType* ptr) const + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.402 if the array index '-' is used + @throw out_of_range.404 if the JSON pointer can not be resolved + */ + BasicJsonType& get_checked( + BasicJsonType* ptr) const { for (const auto& reference_token : reference_tokens) { @@ -12153,8 +13351,8 @@ class json_pointer { // "-" always fails the range check JSON_THROW(detail::out_of_range::create(402, - "array index '-' (" + std::to_string(ptr->m_value.array->size()) + - ") is out of range")); + "array index '-' (" + std::to_string(ptr->m_value.array->size()) + + ") is out of range")); } // note: at performs range check @@ -12163,7 +13361,8 @@ class json_pointer } default: - JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); + JSON_THROW(detail::out_of_range::create(404, + "unresolved reference token '" + reference_token + "'")); } } @@ -12171,19 +13370,20 @@ class json_pointer } /*! - @brief return a const reference to the pointed to value + @brief return a const reference to the pointed to value - @param[in] ptr a JSON value + @param[in] ptr a JSON value - @return const reference to the JSON value pointed to by the JSON - pointer + @return const reference to the JSON value pointed to by the JSON + pointer - @throw parse_error.106 if an array index begins with '0' - @throw parse_error.109 if an array index was not a number - @throw out_of_range.402 if the array index '-' is used - @throw out_of_range.404 if the JSON pointer can not be resolved - */ - const BasicJsonType& get_unchecked(const BasicJsonType* ptr) const + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.402 if the array index '-' is used + @throw out_of_range.404 if the JSON pointer can not be resolved + */ + const BasicJsonType& get_unchecked( + const BasicJsonType* ptr) const { for (const auto& reference_token : reference_tokens) { @@ -12192,7 +13392,7 @@ class json_pointer case detail::value_t::object: { // use unchecked object access - ptr = &ptr->operator[](reference_token); + ptr = &ptr->operator [](reference_token); break; } @@ -12202,17 +13402,18 @@ class json_pointer { // "-" cannot be used for const access JSON_THROW(detail::out_of_range::create(402, - "array index '-' (" + std::to_string(ptr->m_value.array->size()) + - ") is out of range")); + "array index '-' (" + std::to_string(ptr->m_value.array->size()) + + ") is out of range")); } // use unchecked array access - ptr = &ptr->operator[](array_index(reference_token)); + ptr = &ptr->operator [](array_index(reference_token)); break; } default: - JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); + JSON_THROW(detail::out_of_range::create(404, + "unresolved reference token '" + reference_token + "'")); } } @@ -12220,12 +13421,13 @@ class json_pointer } /*! - @throw parse_error.106 if an array index begins with '0' - @throw parse_error.109 if an array index was not a number - @throw out_of_range.402 if the array index '-' is used - @throw out_of_range.404 if the JSON pointer can not be resolved - */ - const BasicJsonType& get_checked(const BasicJsonType* ptr) const + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.402 if the array index '-' is used + @throw out_of_range.404 if the JSON pointer can not be resolved + */ + const BasicJsonType& get_checked( + const BasicJsonType* ptr) const { for (const auto& reference_token : reference_tokens) { @@ -12244,8 +13446,8 @@ class json_pointer { // "-" always fails the range check JSON_THROW(detail::out_of_range::create(402, - "array index '-' (" + std::to_string(ptr->m_value.array->size()) + - ") is out of range")); + "array index '-' (" + std::to_string(ptr->m_value.array->size()) + + ") is out of range")); } // note: at performs range check @@ -12254,7 +13456,8 @@ class json_pointer } default: - JSON_THROW(detail::out_of_range::create(404, "unresolved reference token '" + reference_token + "'")); + JSON_THROW(detail::out_of_range::create(404, + "unresolved reference token '" + reference_token + "'")); } } @@ -12262,10 +13465,11 @@ class json_pointer } /*! - @throw parse_error.106 if an array index begins with '0' - @throw parse_error.109 if an array index was not a number - */ - bool contains(const BasicJsonType* ptr) const + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + */ + bool contains( + const BasicJsonType* ptr) const { for (const auto& reference_token : reference_tokens) { @@ -12279,7 +13483,7 @@ class json_pointer return false; } - ptr = &ptr->operator[](reference_token); + ptr = &ptr->operator [](reference_token); break; } @@ -12290,7 +13494,8 @@ class json_pointer // "-" always fails the range check return false; } - if (JSON_HEDLEY_UNLIKELY(reference_token.size() == 1 && !("0" <= reference_token && reference_token <= "9"))) + if (JSON_HEDLEY_UNLIKELY(reference_token.size() == 1 && + !("0" <= reference_token && reference_token <= "9"))) { // invalid char return false; @@ -12319,7 +13524,7 @@ class json_pointer return false; } - ptr = &ptr->operator[](idx); + ptr = &ptr->operator [](idx); break; } @@ -12337,15 +13542,16 @@ class json_pointer } /*! - @brief split the string input to reference tokens + @brief split the string input to reference tokens - @note This function is only called by the json_pointer constructor. + @note This function is only called by the json_pointer constructor. All exceptions below are documented there. - @throw parse_error.107 if the pointer is not empty or begins with '/' - @throw parse_error.108 if character '~' is not followed by '0' or '1' - */ - static std::vector split(const std::string& reference_string) + @throw parse_error.107 if the pointer is not empty or begins with '/' + @throw parse_error.108 if character '~' is not followed by '0' or '1' + */ + static std::vector split( + const std::string& reference_string) { std::vector result; @@ -12359,8 +13565,8 @@ class json_pointer if (JSON_HEDLEY_UNLIKELY(reference_string[0] != '/')) { JSON_THROW(detail::parse_error::create(107, 1, - "JSON pointer must be empty or begin with '/' - was: '" + - reference_string + "'")); + "JSON pointer must be empty or begin with '/' - was: '" + + reference_string + "'")); } // extract the reference tokens: @@ -12392,10 +13598,11 @@ class json_pointer // ~ must be followed by 0 or 1 if (JSON_HEDLEY_UNLIKELY(pos == reference_token.size() - 1 || - (reference_token[pos + 1] != '0' && - reference_token[pos + 1] != '1'))) + (reference_token[pos + 1] != '0' && + reference_token[pos + 1] != '1'))) { - JSON_THROW(detail::parse_error::create(108, 0, "escape character '~' must be followed with '0' or '1'")); + JSON_THROW(detail::parse_error::create(108, 0, + "escape character '~' must be followed with '0' or '1'")); } } @@ -12408,32 +13615,36 @@ class json_pointer } /*! - @brief replace all occurrences of a substring by another string + @brief replace all occurrences of a substring by another string - @param[in,out] s the string to manipulate; changed so that all + @param[in,out] s the string to manipulate; changed so that all occurrences of @a f are replaced with @a t - @param[in] f the substring to replace with @a t - @param[in] t the string to replace @a f + @param[in] f the substring to replace with @a t + @param[in] t the string to replace @a f - @pre The search string @a f must not be empty. **This precondition is - enforced with an assertion.** + @pre The search string @a f must not be empty. **This precondition is + enforced with an assertion.** - @since version 2.0.0 - */ - static void replace_substring(std::string& s, const std::string& f, - const std::string& t) + @since version 2.0.0 + */ + static void replace_substring( + std::string& s, + const std::string& f, + const std::string& t) { JSON_ASSERT(!f.empty()); for (auto pos = s.find(f); // find first occurrence of f pos != std::string::npos; // make sure f was found s.replace(pos, f.size(), t), // replace with t, and pos = s.find(f, pos + t.size())) // find next occurrence of f - {} + { + } } - JSON_PRIVATE_UNLESS_TESTED: +JSON_PRIVATE_UNLESS_TESTED: /// escape "~" to "~0" and "/" to "~1" - static std::string escape(std::string s) + static std::string escape( + std::string s) { replace_substring(s, "~", "~0"); replace_substring(s, "/", "~1"); @@ -12441,23 +13652,26 @@ class json_pointer } /// unescape "~1" to tilde and "~0" to slash (order is important!) - static void unescape(std::string& s) + static void unescape( + std::string& s) { replace_substring(s, "~1", "/"); replace_substring(s, "~0", "~"); } - private: +private: + /*! - @param[in] reference_string the reference string to the current value - @param[in] value the value to consider - @param[in,out] result the result object to insert values to + @param[in] reference_string the reference string to the current value + @param[in] value the value to consider + @param[in,out] result the result object to insert values to - @note Empty objects or arrays are flattened to `null`. - */ - static void flatten(const std::string& reference_string, - const BasicJsonType& value, - BasicJsonType& result) + @note Empty objects or arrays are flattened to `null`. + */ + static void flatten( + const std::string& reference_string, + const BasicJsonType& value, + BasicJsonType& result) { switch (value.type()) { @@ -12474,7 +13688,7 @@ class json_pointer for (std::size_t i = 0; i < value.m_value.array->size(); ++i) { flatten(reference_string + "/" + std::to_string(i), - value.m_value.array->operator[](i), result); + value.m_value.array->operator [](i), result); } } break; @@ -12508,17 +13722,18 @@ class json_pointer } /*! - @param[in] value flattened JSON + @param[in] value flattened JSON - @return unflattened JSON + @return unflattened JSON - @throw parse_error.109 if array index is not a number - @throw type_error.314 if value is not an object - @throw type_error.315 if object values are not primitive - @throw type_error.313 if value cannot be unflattened - */ + @throw parse_error.109 if array index is not a number + @throw type_error.314 if value is not an object + @throw type_error.315 if object values are not primitive + @throw type_error.313 if value cannot be unflattened + */ static BasicJsonType - unflatten(const BasicJsonType& value) + unflatten( + const BasicJsonType& value) { if (JSON_HEDLEY_UNLIKELY(!value.is_object())) { @@ -12546,35 +13761,37 @@ class json_pointer } /*! - @brief compares two JSON pointers for equality + @brief compares two JSON pointers for equality - @param[in] lhs JSON pointer to compare - @param[in] rhs JSON pointer to compare - @return whether @a lhs is equal to @a rhs + @param[in] lhs JSON pointer to compare + @param[in] rhs JSON pointer to compare + @return whether @a lhs is equal to @a rhs - @complexity Linear in the length of the JSON pointer + @complexity Linear in the length of the JSON pointer - @exceptionsafety No-throw guarantee: this function never throws exceptions. - */ - friend bool operator==(json_pointer const& lhs, - json_pointer const& rhs) noexcept + @exceptionsafety No-throw guarantee: this function never throws exceptions. + */ + friend bool operator ==( + json_pointer const& lhs, + json_pointer const& rhs) noexcept { return lhs.reference_tokens == rhs.reference_tokens; } /*! - @brief compares two JSON pointers for inequality + @brief compares two JSON pointers for inequality - @param[in] lhs JSON pointer to compare - @param[in] rhs JSON pointer to compare - @return whether @a lhs is not equal @a rhs + @param[in] lhs JSON pointer to compare + @param[in] rhs JSON pointer to compare + @return whether @a lhs is not equal @a rhs - @complexity Linear in the length of the JSON pointer + @complexity Linear in the length of the JSON pointer - @exceptionsafety No-throw guarantee: this function never throws exceptions. - */ - friend bool operator!=(json_pointer const& lhs, - json_pointer const& rhs) noexcept + @exceptionsafety No-throw guarantee: this function never throws exceptions. + */ + friend bool operator !=( + json_pointer const& lhs, + json_pointer const& rhs) noexcept { return !(lhs == rhs); } @@ -12593,47 +13810,58 @@ class json_pointer // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { template class json_ref { - public: +public: + using value_type = BasicJsonType; - json_ref(value_type&& value) + json_ref( + value_type&& value) : owned_value(std::move(value)) , value_ref(&owned_value) , is_rvalue(true) - {} + { + } - json_ref(const value_type& value) + json_ref( + const value_type& value) : value_ref(const_cast(&value)) , is_rvalue(false) - {} + { + } - json_ref(std::initializer_list init) + json_ref( + std::initializer_list init) : owned_value(init) , value_ref(&owned_value) , is_rvalue(true) - {} + { + } template < - class... Args, + class ... Args, enable_if_t::value, int> = 0 > - json_ref(Args && ... args) + json_ref( + Args&& ... args) : owned_value(std::forward(args)...) , value_ref(&owned_value) , is_rvalue(true) - {} + { + } // class should be movable only - json_ref(json_ref&&) = default; - json_ref(const json_ref&) = delete; - json_ref& operator=(const json_ref&) = delete; - json_ref& operator=(json_ref&&) = delete; + json_ref( + json_ref&&) = default; + json_ref( + const json_ref&) = delete; + json_ref& operator =( + const json_ref&) = delete; + json_ref& operator =( + json_ref&&) = delete; ~json_ref() = default; value_type moved_or_copied() const @@ -12645,17 +13873,18 @@ class json_ref return *value_ref; } - value_type const& operator*() const + value_type const& operator *() const { return *static_cast(value_ref); } - value_type const* operator->() const + value_type const* operator ->() const { return static_cast(value_ref); } - private: +private: + mutable value_type owned_value = nullptr; value_type* value_ref = nullptr; const bool is_rvalue = true; @@ -12698,15 +13927,16 @@ class json_ref // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { /// abstract output adapter interface template struct output_adapter_protocol { - virtual void write_character(CharType c) = 0; - virtual void write_characters(const CharType* s, std::size_t length) = 0; + virtual void write_character( + CharType c) = 0; + virtual void write_characters( + const CharType* s, + std::size_t length) = 0; virtual ~output_adapter_protocol() = default; }; @@ -12718,23 +13948,30 @@ using output_adapter_t = std::shared_ptr>; template class output_vector_adapter : public output_adapter_protocol { - public: - explicit output_vector_adapter(std::vector& vec) noexcept +public: + + explicit output_vector_adapter( + std::vector& vec) noexcept : v(vec) - {} + { + } - void write_character(CharType c) override + void write_character( + CharType c) override { v.push_back(c); } JSON_HEDLEY_NON_NULL(2) - void write_characters(const CharType* s, std::size_t length) override + void write_characters( + const CharType* s, + std::size_t length) override { std::copy(s, s + length, std::back_inserter(v)); } - private: +private: + std::vector& v; }; @@ -12742,23 +13979,30 @@ class output_vector_adapter : public output_adapter_protocol template class output_stream_adapter : public output_adapter_protocol { - public: - explicit output_stream_adapter(std::basic_ostream& s) noexcept +public: + + explicit output_stream_adapter( + std::basic_ostream& s) noexcept : stream(s) - {} + { + } - void write_character(CharType c) override + void write_character( + CharType c) override { stream.put(c); } JSON_HEDLEY_NON_NULL(2) - void write_characters(const CharType* s, std::size_t length) override + void write_characters( + const CharType* s, + std::size_t length) override { stream.write(s, static_cast(length)); } - private: +private: + std::basic_ostream& stream; }; @@ -12766,62 +14010,78 @@ class output_stream_adapter : public output_adapter_protocol template> class output_string_adapter : public output_adapter_protocol { - public: - explicit output_string_adapter(StringType& s) noexcept +public: + + explicit output_string_adapter( + StringType& s) noexcept : str(s) - {} + { + } - void write_character(CharType c) override + void write_character( + CharType c) override { str.push_back(c); } JSON_HEDLEY_NON_NULL(2) - void write_characters(const CharType* s, std::size_t length) override + void write_characters( + const CharType* s, + std::size_t length) override { str.append(s, length); } - private: +private: + StringType& str; }; template> class output_adapter { - public: - output_adapter(std::vector& vec) - : oa(std::make_shared>(vec)) {} +public: + + output_adapter( + std::vector& vec) + : oa(std::make_shared>(vec)) + { + } - output_adapter(std::basic_ostream& s) - : oa(std::make_shared>(s)) {} + output_adapter( + std::basic_ostream& s) + : oa(std::make_shared>(s)) + { + } - output_adapter(StringType& s) - : oa(std::make_shared>(s)) {} + output_adapter( + StringType& s) + : oa(std::make_shared>(s)) + { + } operator output_adapter_t() { return oa; } - private: +private: + output_adapter_t oa = nullptr; }; } // namespace detail } // namespace nlohmann -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { /////////////////// // binary writer // /////////////////// /*! -@brief serialization to CBOR and MessagePack values -*/ + @brief serialization to CBOR and MessagePack values + */ template class binary_writer { @@ -12829,22 +14089,26 @@ class binary_writer using binary_t = typename BasicJsonType::binary_t; using number_float_t = typename BasicJsonType::number_float_t; - public: +public: + /*! - @brief create a binary writer + @brief create a binary writer - @param[in] adapter output adapter to write to - */ - explicit binary_writer(output_adapter_t adapter) : oa(adapter) + @param[in] adapter output adapter to write to + */ + explicit binary_writer( + output_adapter_t adapter) + : oa(adapter) { JSON_ASSERT(oa); } /*! - @param[in] j JSON value to serialize - @pre j.type() == value_t::object - */ - void write_bson(const BasicJsonType& j) + @param[in] j JSON value to serialize + @pre j.type() == value_t::object + */ + void write_bson( + const BasicJsonType& j) { switch (j.type()) { @@ -12856,15 +14120,18 @@ class binary_writer default: { - JSON_THROW(type_error::create(317, "to serialize to BSON, top-level type must be object, but is " + std::string(j.type_name()))); + JSON_THROW(type_error::create(317, + "to serialize to BSON, top-level type must be object, but is " + + std::string(j.type_name()))); } } } /*! - @param[in] j JSON value to serialize - */ - void write_cbor(const BasicJsonType& j) + @param[in] j JSON value to serialize + */ + void write_cbor( + const BasicJsonType& j) { switch (j.type()) { @@ -13167,9 +14434,10 @@ class binary_writer } /*! - @param[in] j JSON value to serialize - */ - void write_msgpack(const BasicJsonType& j) + @param[in] j JSON value to serialize + */ + void write_msgpack( + const BasicJsonType& j) { switch (j.type()) { @@ -13232,28 +14500,28 @@ class binary_writer write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_integer >= (std::numeric_limits::min)() && - j.m_value.number_integer <= (std::numeric_limits::max)()) + j.m_value.number_integer <= (std::numeric_limits::max)()) { // int 8 oa->write_character(to_char_type(0xD0)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_integer >= (std::numeric_limits::min)() && - j.m_value.number_integer <= (std::numeric_limits::max)()) + j.m_value.number_integer <= (std::numeric_limits::max)()) { // int 16 oa->write_character(to_char_type(0xD1)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_integer >= (std::numeric_limits::min)() && - j.m_value.number_integer <= (std::numeric_limits::max)()) + j.m_value.number_integer <= (std::numeric_limits::max)()) { // int 32 oa->write_character(to_char_type(0xD2)); write_number(static_cast(j.m_value.number_integer)); } else if (j.m_value.number_integer >= (std::numeric_limits::min)() && - j.m_value.number_integer <= (std::numeric_limits::max)()) + j.m_value.number_integer <= (std::numeric_limits::max)()) { // int 64 oa->write_character(to_char_type(0xD3)); @@ -13488,13 +14756,16 @@ class binary_writer } /*! - @param[in] j JSON value to serialize - @param[in] use_count whether to use '#' prefixes (optimized format) - @param[in] use_type whether to use '$' prefixes (optimized format) - @param[in] add_prefix whether prefixes need to be used for this value - */ - void write_ubjson(const BasicJsonType& j, const bool use_count, - const bool use_type, const bool add_prefix = true) + @param[in] j JSON value to serialize + @param[in] use_count whether to use '#' prefixes (optimized format) + @param[in] use_type whether to use '$' prefixes (optimized format) + @param[in] add_prefix whether prefixes need to be used for this value + */ + void write_ubjson( + const BasicJsonType& j, + const bool use_count, + const bool use_type, + const bool add_prefix = true) { switch (j.type()) { @@ -13562,10 +14833,10 @@ class binary_writer JSON_ASSERT(use_count); const CharType first_prefix = ubjson_prefix(j.front()); const bool same_prefix = std::all_of(j.begin() + 1, j.end(), - [this, first_prefix](const BasicJsonType & v) - { - return ubjson_prefix(v) == first_prefix; - }); + [this, first_prefix](const BasicJsonType& v) + { + return ubjson_prefix(v) == first_prefix; + }); if (same_prefix) { @@ -13650,10 +14921,10 @@ class binary_writer JSON_ASSERT(use_count); const CharType first_prefix = ubjson_prefix(j.front()); const bool same_prefix = std::all_of(j.begin(), j.end(), - [this, first_prefix](const BasicJsonType & v) - { - return ubjson_prefix(v) == first_prefix; - }); + [this, first_prefix](const BasicJsonType& v) + { + return ubjson_prefix(v) == first_prefix; + }); if (same_prefix) { @@ -13691,32 +14962,35 @@ class binary_writer } } - private: +private: + ////////// // BSON // ////////// /*! - @return The size of a BSON document entry header, including the id marker + @return The size of a BSON document entry header, including the id marker and the entry name size (and its null-terminator). - */ - static std::size_t calc_bson_entry_header_size(const string_t& name) + */ + static std::size_t calc_bson_entry_header_size( + const string_t& name) { const auto it = name.find(static_cast(0)); if (JSON_HEDLEY_UNLIKELY(it != BasicJsonType::string_t::npos)) { JSON_THROW(out_of_range::create(409, - "BSON key cannot contain code point U+0000 (at byte " + std::to_string(it) + ")")); + "BSON key cannot contain code point U+0000 (at byte " + std::to_string(it) + ")")); } - return /*id*/ 1ul + name.size() + /*zero-terminator*/1u; + return /*id*/ 1ul + name.size() + /*zero-terminator*/ 1u; } /*! - @brief Writes the given @a element_type and @a name to the output adapter - */ - void write_bson_entry_header(const string_t& name, - const std::uint8_t element_type) + @brief Writes the given @a element_type and @a name to the output adapter + */ + void write_bson_entry_header( + const string_t& name, + const std::uint8_t element_type) { oa->write_character(to_char_type(element_type)); // boolean oa->write_characters( @@ -13725,38 +14999,42 @@ class binary_writer } /*! - @brief Writes a BSON element with key @a name and boolean value @a value - */ - void write_bson_boolean(const string_t& name, - const bool value) + @brief Writes a BSON element with key @a name and boolean value @a value + */ + void write_bson_boolean( + const string_t& name, + const bool value) { write_bson_entry_header(name, 0x08); oa->write_character(value ? to_char_type(0x01) : to_char_type(0x00)); } /*! - @brief Writes a BSON element with key @a name and double value @a value - */ - void write_bson_double(const string_t& name, - const double value) + @brief Writes a BSON element with key @a name and double value @a value + */ + void write_bson_double( + const string_t& name, + const double value) { write_bson_entry_header(name, 0x01); write_number(value); } /*! - @return The size of the BSON-encoded string in @a value - */ - static std::size_t calc_bson_string_size(const string_t& value) + @return The size of the BSON-encoded string in @a value + */ + static std::size_t calc_bson_string_size( + const string_t& value) { return sizeof(std::int32_t) + value.size() + 1ul; } /*! - @brief Writes a BSON element with key @a name and string value @a value - */ - void write_bson_string(const string_t& name, - const string_t& value) + @brief Writes a BSON element with key @a name and string value @a value + */ + void write_bson_string( + const string_t& name, + const string_t& value) { write_bson_entry_header(name, 0x02); @@ -13767,28 +15045,32 @@ class binary_writer } /*! - @brief Writes a BSON element with key @a name and null value - */ - void write_bson_null(const string_t& name) + @brief Writes a BSON element with key @a name and null value + */ + void write_bson_null( + const string_t& name) { write_bson_entry_header(name, 0x0A); } /*! - @return The size of the BSON-encoded integer @a value - */ - static std::size_t calc_bson_integer_size(const std::int64_t value) + @return The size of the BSON-encoded integer @a value + */ + static std::size_t calc_bson_integer_size( + const std::int64_t value) { - return (std::numeric_limits::min)() <= value && value <= (std::numeric_limits::max)() + return (std::numeric_limits::min)() <= value && + value <= (std::numeric_limits::max)() ? sizeof(std::int32_t) : sizeof(std::int64_t); } /*! - @brief Writes a BSON element with key @a name and integer @a value - */ - void write_bson_integer(const string_t& name, - const std::int64_t value) + @brief Writes a BSON element with key @a name and integer @a value + */ + void write_bson_integer( + const string_t& name, + const std::int64_t value) { if ((std::numeric_limits::min)() <= value && value <= (std::numeric_limits::max)()) { @@ -13803,9 +15085,10 @@ class binary_writer } /*! - @return The size of the BSON-encoded unsigned integer in @a j - */ - static constexpr std::size_t calc_bson_unsigned_size(const std::uint64_t value) noexcept + @return The size of the BSON-encoded unsigned integer in @a j + */ + static constexpr std::size_t calc_bson_unsigned_size( + const std::uint64_t value) noexcept { return (value <= static_cast((std::numeric_limits::max)())) ? sizeof(std::int32_t) @@ -13813,10 +15096,11 @@ class binary_writer } /*! - @brief Writes a BSON element with key @a name and unsigned @a value - */ - void write_bson_unsigned(const string_t& name, - const std::uint64_t value) + @brief Writes a BSON element with key @a name and unsigned @a value + */ + void write_bson_unsigned( + const string_t& name, + const std::uint64_t value) { if (value <= static_cast((std::numeric_limits::max)())) { @@ -13830,48 +15114,56 @@ class binary_writer } else { - JSON_THROW(out_of_range::create(407, "integer number " + std::to_string(value) + " cannot be represented by BSON as it does not fit int64")); + JSON_THROW(out_of_range::create(407, + "integer number " + std::to_string( + value) + " cannot be represented by BSON as it does not fit int64")); } } /*! - @brief Writes a BSON element with key @a name and object @a value - */ - void write_bson_object_entry(const string_t& name, - const typename BasicJsonType::object_t& value) + @brief Writes a BSON element with key @a name and object @a value + */ + void write_bson_object_entry( + const string_t& name, + const typename BasicJsonType::object_t& value) { write_bson_entry_header(name, 0x03); // object write_bson_object(value); } /*! - @return The size of the BSON-encoded array @a value - */ - static std::size_t calc_bson_array_size(const typename BasicJsonType::array_t& value) + @return The size of the BSON-encoded array @a value + */ + static std::size_t calc_bson_array_size( + const typename BasicJsonType::array_t& value) { std::size_t array_index = 0ul; - const std::size_t embedded_document_size = std::accumulate(std::begin(value), std::end(value), std::size_t(0), [&array_index](std::size_t result, const typename BasicJsonType::array_t::value_type & el) - { - return result + calc_bson_element_size(std::to_string(array_index++), el); - }); + const std::size_t embedded_document_size = + std::accumulate(std::begin(value), std::end(value), std::size_t(0), + [&array_index](std::size_t result, const typename BasicJsonType::array_t::value_type& el) + { + return result + calc_bson_element_size(std::to_string(array_index++), el); + }); return sizeof(std::int32_t) + embedded_document_size + 1ul; } /*! - @return The size of the BSON-encoded binary array @a value - */ - static std::size_t calc_bson_binary_size(const typename BasicJsonType::binary_t& value) + @return The size of the BSON-encoded binary array @a value + */ + static std::size_t calc_bson_binary_size( + const typename BasicJsonType::binary_t& value) { return sizeof(std::int32_t) + value.size() + 1ul; } /*! - @brief Writes a BSON element with key @a name and array @a value - */ - void write_bson_array(const string_t& name, - const typename BasicJsonType::array_t& value) + @brief Writes a BSON element with key @a name and array @a value + */ + void write_bson_array( + const string_t& name, + const typename BasicJsonType::array_t& value) { write_bson_entry_header(name, 0x04); // array write_number(static_cast(calc_bson_array_size(value))); @@ -13887,10 +15179,11 @@ class binary_writer } /*! - @brief Writes a BSON element with key @a name and binary value @a value - */ - void write_bson_binary(const string_t& name, - const binary_t& value) + @brief Writes a BSON element with key @a name and binary value @a value + */ + void write_bson_binary( + const string_t& name, + const binary_t& value) { write_bson_entry_header(name, 0x05); @@ -13901,10 +15194,11 @@ class binary_writer } /*! - @brief Calculates the size necessary to serialize the JSON value @a j with its @a name - @return The calculated size for the BSON document entry for @a j with the given @a name. - */ - static std::size_t calc_bson_element_size(const string_t& name, + @brief Calculates the size necessary to serialize the JSON value @a j with its @a name + @return The calculated size for the BSON document entry for @a j with the given @a name. + */ + static std::size_t calc_bson_element_size( + const string_t& name, const BasicJsonType& j) { const auto header_size = calc_bson_entry_header_size(name); @@ -13946,14 +15240,15 @@ class binary_writer } /*! - @brief Serializes the JSON value @a j to BSON and associates it with the + @brief Serializes the JSON value @a j to BSON and associates it with the key @a name. - @param name The name to associate with the JSON entity @a j within the + @param name The name to associate with the JSON entity @a j within the current BSON document - @return The size of the BSON entry - */ - void write_bson_element(const string_t& name, - const BasicJsonType& j) + @return The size of the BSON entry + */ + void write_bson_element( + const string_t& name, + const BasicJsonType& j) { switch (j.type()) { @@ -13993,27 +15288,29 @@ class binary_writer } /*! - @brief Calculates the size of the BSON serialization of the given + @brief Calculates the size of the BSON serialization of the given JSON-object @a j. - @param[in] j JSON value to serialize - @pre j.type() == value_t::object - */ - static std::size_t calc_bson_object_size(const typename BasicJsonType::object_t& value) + @param[in] j JSON value to serialize + @pre j.type() == value_t::object + */ + static std::size_t calc_bson_object_size( + const typename BasicJsonType::object_t& value) { std::size_t document_size = std::accumulate(value.begin(), value.end(), std::size_t(0), - [](size_t result, const typename BasicJsonType::object_t::value_type & el) - { - return result += calc_bson_element_size(el.first, el.second); - }); + [](size_t result, const typename BasicJsonType::object_t::value_type& el) + { + return result += calc_bson_element_size(el.first, el.second); + }); return sizeof(std::int32_t) + document_size + 1ul; } /*! - @param[in] j JSON value to serialize - @pre j.type() == value_t::object - */ - void write_bson_object(const typename BasicJsonType::object_t& value) + @param[in] j JSON value to serialize + @pre j.type() == value_t::object + */ + void write_bson_object( + const typename BasicJsonType::object_t& value) { write_number(static_cast(calc_bson_object_size(value))); @@ -14029,12 +15326,14 @@ class binary_writer // CBOR // ////////// - static constexpr CharType get_cbor_float_prefix(float /*unused*/) + static constexpr CharType get_cbor_float_prefix( + float /*unused*/) { return to_char_type(0xFA); // Single-Precision Float } - static constexpr CharType get_cbor_float_prefix(double /*unused*/) + static constexpr CharType get_cbor_float_prefix( + double /*unused*/) { return to_char_type(0xFB); // Double-Precision Float } @@ -14043,12 +15342,14 @@ class binary_writer // MsgPack // ///////////// - static constexpr CharType get_msgpack_float_prefix(float /*unused*/) + static constexpr CharType get_msgpack_float_prefix( + float /*unused*/) { return to_char_type(0xCA); // float 32 } - static constexpr CharType get_msgpack_float_prefix(double /*unused*/) + static constexpr CharType get_msgpack_float_prefix( + double /*unused*/) { return to_char_type(0xCB); // float 64 } @@ -14059,9 +15360,10 @@ class binary_writer // UBJSON: write number (floating point) template::value, int>::type = 0> - void write_number_with_ubjson_prefix(const NumberType n, - const bool add_prefix) + std::is_floating_point::value, int>::type = 0> + void write_number_with_ubjson_prefix( + const NumberType n, + const bool add_prefix) { if (add_prefix) { @@ -14072,9 +15374,10 @@ class binary_writer // UBJSON: write number (unsigned integer) template::value, int>::type = 0> - void write_number_with_ubjson_prefix(const NumberType n, - const bool add_prefix) + std::is_unsigned::value, int>::type = 0> + void write_number_with_ubjson_prefix( + const NumberType n, + const bool add_prefix) { if (n <= static_cast((std::numeric_limits::max)())) { @@ -14134,10 +15437,11 @@ class binary_writer // UBJSON: write number (signed integer) template < typename NumberType, typename std::enable_if < - std::is_signed::value&& - !std::is_floating_point::value, int >::type = 0 > - void write_number_with_ubjson_prefix(const NumberType n, - const bool add_prefix) + std::is_signed::value && + !std::is_floating_point::value, int >::type = 0 > + void write_number_with_ubjson_prefix( + const NumberType n, + const bool add_prefix) { if ((std::numeric_limits::min)() <= n && n <= (std::numeric_limits::max)()) { @@ -14147,7 +15451,8 @@ class binary_writer } write_number(static_cast(n)); } - else if (static_cast((std::numeric_limits::min)()) <= n && n <= static_cast((std::numeric_limits::max)())) + else if (static_cast((std::numeric_limits::min)()) <= n && + n <= static_cast((std::numeric_limits::max)())) { if (add_prefix) { @@ -14198,9 +15503,10 @@ class binary_writer } /*! - @brief determine the type prefix of container values - */ - CharType ubjson_prefix(const BasicJsonType& j) const noexcept + @brief determine the type prefix of container values + */ + CharType ubjson_prefix( + const BasicJsonType& j) const noexcept { switch (j.type()) { @@ -14212,23 +15518,28 @@ class binary_writer case value_t::number_integer: { - if ((std::numeric_limits::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits::max)()) + if ((std::numeric_limits::min)() <= j.m_value.number_integer && + j.m_value.number_integer <= (std::numeric_limits::max)()) { return 'i'; } - if ((std::numeric_limits::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits::max)()) + if ((std::numeric_limits::min)() <= j.m_value.number_integer && + j.m_value.number_integer <= (std::numeric_limits::max)()) { return 'U'; } - if ((std::numeric_limits::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits::max)()) + if ((std::numeric_limits::min)() <= j.m_value.number_integer && + j.m_value.number_integer <= (std::numeric_limits::max)()) { return 'I'; } - if ((std::numeric_limits::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits::max)()) + if ((std::numeric_limits::min)() <= j.m_value.number_integer && + j.m_value.number_integer <= (std::numeric_limits::max)()) { return 'l'; } - if ((std::numeric_limits::min)() <= j.m_value.number_integer && j.m_value.number_integer <= (std::numeric_limits::max)()) + if ((std::numeric_limits::min)() <= j.m_value.number_integer && + j.m_value.number_integer <= (std::numeric_limits::max)()) { return 'L'; } @@ -14280,12 +15591,14 @@ class binary_writer } } - static constexpr CharType get_ubjson_float_prefix(float /*unused*/) + static constexpr CharType get_ubjson_float_prefix( + float /*unused*/) { return 'd'; // float 32 } - static constexpr CharType get_ubjson_float_prefix(double /*unused*/) + static constexpr CharType get_ubjson_float_prefix( + double /*unused*/) { return 'D'; // float 64 } @@ -14295,18 +15608,19 @@ class binary_writer /////////////////////// /* - @brief write a number to output input - @param[in] n number of type @a NumberType - @tparam NumberType the type of the number - @tparam OutputIsLittleEndian Set to true if output data is + @brief write a number to output input + @param[in] n number of type @a NumberType + @tparam NumberType the type of the number + @tparam OutputIsLittleEndian Set to true if output data is required to be little endian - @note This function needs to respect the system's endianess, because bytes + @note This function needs to respect the system's endianess, because bytes in CBOR, MessagePack, and UBJSON are stored in network order (big endian) and therefore need reordering on little endian systems. - */ + */ template - void write_number(const NumberType n) + void write_number( + const NumberType n) { // step 1: write number to array of length NumberType std::array vec; @@ -14322,7 +15636,9 @@ class binary_writer oa->write_characters(vec.data(), sizeof(NumberType)); } - void write_compact_float(const number_float_t n, detail::input_format_t format) + void write_compact_float( + const number_float_t n, + detail::input_format_t format) { if (static_cast(n) >= static_cast(std::numeric_limits::lowest()) && static_cast(n) <= static_cast((std::numeric_limits::max)()) && @@ -14342,21 +15658,24 @@ class binary_writer } } - public: +public: + // The following to_char_type functions are implement the conversion // between uint8_t and CharType. In case CharType is not unsigned, // such a conversion is required to allow values greater than 128. // See for a discussion. template < typename C = CharType, - enable_if_t < std::is_signed::value && std::is_signed::value > * = nullptr > - static constexpr CharType to_char_type(std::uint8_t x) noexcept + enable_if_t < std::is_signed::value && std::is_signed::value >* = nullptr > + static constexpr CharType to_char_type( + std::uint8_t x) noexcept { return *reinterpret_cast(&x); } template < typename C = CharType, - enable_if_t < std::is_signed::value && std::is_unsigned::value > * = nullptr > - static CharType to_char_type(std::uint8_t x) noexcept + enable_if_t < std::is_signed::value && std::is_unsigned::value >* = nullptr > + static CharType to_char_type( + std::uint8_t x) noexcept { static_assert(sizeof(std::uint8_t) == sizeof(CharType), "size of CharType must be equal to std::uint8_t"); static_assert(std::is_trivial::value, "CharType must be trivial"); @@ -14366,24 +15685,27 @@ class binary_writer } template::value>* = nullptr> - static constexpr CharType to_char_type(std::uint8_t x) noexcept + enable_if_t::value>* = nullptr> + static constexpr CharType to_char_type( + std::uint8_t x) noexcept { return x; } template < typename InputCharType, typename C = CharType, - enable_if_t < - std::is_signed::value && - std::is_signed::value && - std::is_same::type>::value - > * = nullptr > - static constexpr CharType to_char_type(InputCharType x) noexcept + enable_if_t < + std::is_signed::value && + std::is_signed::value && + std::is_same::type>::value + >* = nullptr > + static constexpr CharType to_char_type( + InputCharType x) noexcept { return x; } - private: +private: + /// whether we can assume little endianess const bool is_little_endian = little_endianess(); @@ -14423,35 +15745,33 @@ class binary_writer // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { /*! -@brief implements the Grisu2 algorithm for binary to decimal floating-point -conversion. + @brief implements the Grisu2 algorithm for binary to decimal floating-point + conversion. -This implementation is a slightly modified version of the reference -implementation which may be obtained from -http://florian.loitsch.com/publications (bench.tar.gz). + This implementation is a slightly modified version of the reference + implementation which may be obtained from + http://florian.loitsch.com/publications (bench.tar.gz). -The code is distributed under the MIT license, Copyright (c) 2009 Florian Loitsch. + The code is distributed under the MIT license, Copyright (c) 2009 Florian Loitsch. -For a detailed description of the algorithm see: + For a detailed description of the algorithm see: -[1] Loitsch, "Printing Floating-Point Numbers Quickly and Accurately with + [1] Loitsch, "Printing Floating-Point Numbers Quickly and Accurately with Integers", Proceedings of the ACM SIGPLAN 2010 Conference on Programming Language Design and Implementation, PLDI 2010 -[2] Burger, Dybvig, "Printing Floating-Point Numbers Quickly and Accurately", + [2] Burger, Dybvig, "Printing Floating-Point Numbers Quickly and Accurately", Proceedings of the ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation, PLDI 1996 -*/ -namespace dtoa_impl -{ + */ +namespace dtoa_impl { template -Target reinterpret_bits(const Source source) +Target reinterpret_bits( + const Source source) { static_assert(sizeof(Target) == sizeof(Source), "size mismatch"); @@ -14467,13 +15787,21 @@ struct diyfp // f * 2^e std::uint64_t f = 0; int e = 0; - constexpr diyfp(std::uint64_t f_, int e_) noexcept : f(f_), e(e_) {} + constexpr diyfp( + std::uint64_t f_, + int e_) noexcept + : f(f_) + , e(e_) + { + } /*! - @brief returns x - y - @pre x.e == y.e and x.f >= y.f - */ - static diyfp sub(const diyfp& x, const diyfp& y) noexcept + @brief returns x - y + @pre x.e == y.e and x.f >= y.f + */ + static diyfp sub( + const diyfp& x, + const diyfp& y) noexcept { JSON_ASSERT(x.e == y.e); JSON_ASSERT(x.f >= y.f); @@ -14482,10 +15810,12 @@ struct diyfp // f * 2^e } /*! - @brief returns x * y - @note The result is rounded. (Only the upper q bits are returned.) - */ - static diyfp mul(const diyfp& x, const diyfp& y) noexcept + @brief returns x * y + @note The result is rounded. (Only the upper q bits are returned.) + */ + static diyfp mul( + const diyfp& x, + const diyfp& y) noexcept { static_assert(kPrecision == 64, "internal error"); @@ -14547,10 +15877,11 @@ struct diyfp // f * 2^e } /*! - @brief normalize x such that the significand is >= 2^(q-1) - @pre x.f != 0 - */ - static diyfp normalize(diyfp x) noexcept + @brief normalize x such that the significand is >= 2^(q-1) + @pre x.f != 0 + */ + static diyfp normalize( + diyfp x) noexcept { JSON_ASSERT(x.f != 0); @@ -14564,10 +15895,12 @@ struct diyfp // f * 2^e } /*! - @brief normalize x such that the result has the exponent E - @pre e >= x.e and the upper e - x.e bits of x.f must be zero. - */ - static diyfp normalize_to(const diyfp& x, const int target_exponent) noexcept + @brief normalize x such that the result has the exponent E + @pre e >= x.e and the upper e - x.e bits of x.f must be zero. + */ + static diyfp normalize_to( + const diyfp& x, + const int target_exponent) noexcept { const int delta = x.e - target_exponent; @@ -14576,6 +15909,7 @@ struct diyfp // f * 2^e return {x.f << delta, target_exponent}; } + }; struct boundaries @@ -14586,13 +15920,14 @@ struct boundaries }; /*! -Compute the (normalized) diyfp representing the input number 'value' and its -boundaries. + Compute the (normalized) diyfp representing the input number 'value' and its + boundaries. -@pre value must be finite and positive -*/ + @pre value must be finite and positive + */ template -boundaries compute_boundaries(FloatType value) +boundaries compute_boundaries( + FloatType value) { JSON_ASSERT(std::isfinite(value)); JSON_ASSERT(value > 0); @@ -14605,11 +15940,11 @@ boundaries compute_boundaries(FloatType value) // value = 1.F * 2^(E - bias) = (2^(p-1) + F) * 2^(E - bias - (p-1)) static_assert(std::numeric_limits::is_iec559, - "internal error: dtoa_short requires an IEEE-754 floating-point implementation"); + "internal error: dtoa_short requires an IEEE-754 floating-point implementation"); - constexpr int kPrecision = std::numeric_limits::digits; // = p (includes the hidden bit) - constexpr int kBias = std::numeric_limits::max_exponent - 1 + (kPrecision - 1); - constexpr int kMinExp = 1 - kBias; + constexpr int kPrecision = std::numeric_limits::digits; // = p (includes the hidden bit) + constexpr int kBias = std::numeric_limits::max_exponent - 1 + (kPrecision - 1); + constexpr int kMinExp = 1 - kBias; constexpr std::uint64_t kHiddenBit = std::uint64_t{1} << (kPrecision - 1); // = 2^(p-1) using bits_type = typename std::conditional::type; @@ -14725,13 +16060,14 @@ struct cached_power // c = f * 2^e ~= 10^k }; /*! -For a normalized diyfp w = f * 2^e, this function returns a (normalized) cached -power-of-ten c = f_c * 2^e_c, such that the exponent of the product w * c -satisfies (Definition 3.2 from [1]) + For a normalized diyfp w = f * 2^e, this function returns a (normalized) cached + power-of-ten c = f_c * 2^e_c, such that the exponent of the product w * c + satisfies (Definition 3.2 from [1]) alpha <= e_c + e + q <= gamma. -*/ -inline cached_power get_cached_power_for_binary_exponent(int e) + */ +inline cached_power get_cached_power_for_binary_exponent( + int e) { // Now // @@ -14892,10 +16228,12 @@ inline cached_power get_cached_power_for_binary_exponent(int e) } /*! -For n != 0, returns k, such that pow10 := 10^(k-1) <= n < 10^k. -For n == 0, returns 1 and sets pow10 := 1. -*/ -inline int find_largest_pow10(const std::uint32_t n, std::uint32_t& pow10) + For n != 0, returns k, such that pow10 := 10^(k-1) <= n < 10^k. + For n == 0, returns 1 and sets pow10 := 1. + */ +inline int find_largest_pow10( + const std::uint32_t n, + std::uint32_t& pow10) { // LCOV_EXCL_START if (n >= 1000000000) @@ -14907,42 +16245,42 @@ inline int find_largest_pow10(const std::uint32_t n, std::uint32_t& pow10) else if (n >= 100000000) { pow10 = 100000000; - return 9; + return 9; } else if (n >= 10000000) { pow10 = 10000000; - return 8; + return 8; } else if (n >= 1000000) { pow10 = 1000000; - return 7; + return 7; } else if (n >= 100000) { pow10 = 100000; - return 6; + return 6; } else if (n >= 10000) { pow10 = 10000; - return 5; + return 5; } else if (n >= 1000) { pow10 = 1000; - return 4; + return 4; } else if (n >= 100) { pow10 = 100; - return 3; + return 3; } else if (n >= 10) { pow10 = 10; - return 2; + return 2; } else { @@ -14951,8 +16289,13 @@ inline int find_largest_pow10(const std::uint32_t n, std::uint32_t& pow10) } } -inline void grisu2_round(char* buf, int len, std::uint64_t dist, std::uint64_t delta, - std::uint64_t rest, std::uint64_t ten_k) +inline void grisu2_round( + char* buf, + int len, + std::uint64_t dist, + std::uint64_t delta, + std::uint64_t rest, + std::uint64_t ten_k) { JSON_ASSERT(len >= 1); JSON_ASSERT(dist <= delta); @@ -14989,11 +16332,16 @@ inline void grisu2_round(char* buf, int len, std::uint64_t dist, std::uint64_t d } /*! -Generates V = buffer * 10^decimal_exponent, such that M- <= V <= M+. -M- and M+ must be normalized and share the same exponent -60 <= e <= -32. -*/ -inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent, - diyfp M_minus, diyfp w, diyfp M_plus) + Generates V = buffer * 10^decimal_exponent, such that M- <= V <= M+. + M- and M+ must be normalized and share the same exponent -60 <= e <= -32. + */ +inline void grisu2_digit_gen( + char* buffer, + int& length, + int& decimal_exponent, + diyfp M_minus, + diyfp w, + diyfp M_plus) { static_assert(kAlpha >= -60, "internal error"); static_assert(kGamma <= -32, "internal error"); @@ -15228,13 +16576,18 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent, } /*! -v = buf * 10^decimal_exponent -len is the length of the buffer (number of decimal digits) -The buffer must be large enough, i.e. >= max_digits10. -*/ + v = buf * 10^decimal_exponent + len is the length of the buffer (number of decimal digits) + The buffer must be large enough, i.e. >= max_digits10. + */ JSON_HEDLEY_NON_NULL(1) -inline void grisu2(char* buf, int& len, int& decimal_exponent, - diyfp m_minus, diyfp v, diyfp m_plus) +inline void grisu2( + char* buf, + int& len, + int& decimal_exponent, + diyfp m_minus, + diyfp v, + diyfp m_plus) { JSON_ASSERT(m_plus.e == m_minus.e); JSON_ASSERT(m_plus.e == v.e); @@ -15287,16 +16640,20 @@ inline void grisu2(char* buf, int& len, int& decimal_exponent, } /*! -v = buf * 10^decimal_exponent -len is the length of the buffer (number of decimal digits) -The buffer must be large enough, i.e. >= max_digits10. -*/ + v = buf * 10^decimal_exponent + len is the length of the buffer (number of decimal digits) + The buffer must be large enough, i.e. >= max_digits10. + */ template JSON_HEDLEY_NON_NULL(1) -void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value) +void grisu2( + char* buf, + int& len, + int& decimal_exponent, + FloatType value) { static_assert(diyfp::kPrecision >= std::numeric_limits::digits + 3, - "internal error: not enough precision"); + "internal error: not enough precision"); JSON_ASSERT(std::isfinite(value)); JSON_ASSERT(value > 0); @@ -15321,16 +16678,16 @@ void grisu2(char* buf, int& len, int& decimal_exponent, FloatType value) const boundaries w = compute_boundaries(static_cast(value)); #else const boundaries w = compute_boundaries(value); -#endif +#endif // if 0 grisu2(buf, len, decimal_exponent, w.minus, w.w, w.plus); } /*! -@brief appends a decimal representation of e to buf -@return a pointer to the element following the exponent. -@pre -1000 < e < 1000 -*/ + @brief appends a decimal representation of e to buf + @return a pointer to the element following the exponent. + @pre -1000 < e < 1000 + */ JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_RETURNS_NON_NULL inline char* append_exponent(char* buf, int e) @@ -15375,18 +16732,18 @@ inline char* append_exponent(char* buf, int e) } /*! -@brief prettify v = buf * 10^decimal_exponent + @brief prettify v = buf * 10^decimal_exponent -If v is in the range [10^min_exp, 10^max_exp) it will be printed in fixed-point -notation. Otherwise it will be printed in exponential notation. + If v is in the range [10^min_exp, 10^max_exp) it will be printed in fixed-point + notation. Otherwise it will be printed in exponential notation. -@pre min_exp < 0 -@pre max_exp > 0 -*/ + @pre min_exp < 0 + @pre max_exp > 0 + */ JSON_HEDLEY_NON_NULL(1) JSON_HEDLEY_RETURNS_NON_NULL inline char* format_buffer(char* buf, int len, int decimal_exponent, - int min_exp, int max_exp) + int min_exp, int max_exp) { JSON_ASSERT(min_exp < 0); JSON_ASSERT(max_exp > 0); @@ -15458,15 +16815,15 @@ inline char* format_buffer(char* buf, int len, int decimal_exponent, } // namespace dtoa_impl /*! -@brief generates a decimal representation of the floating-point number value in [first, last). + @brief generates a decimal representation of the floating-point number value in [first, last). -The format of the resulting decimal representation is similar to printf's %g -format. Returns an iterator pointing past-the-end of the decimal representation. + The format of the resulting decimal representation is similar to printf's %g + format. Returns an iterator pointing past-the-end of the decimal representation. -@note The input number must be finite, i.e. NaN's and Inf's are not supported. -@note The buffer must be large enough. -@note The result is NOT null-terminated. -*/ + @note The input number must be finite, i.e. NaN's and Inf's are not supported. + @note The buffer must be large enough. + @note The result is NOT null-terminated. + */ template JSON_HEDLEY_NON_NULL(1, 2) JSON_HEDLEY_RETURNS_NON_NULL @@ -15531,10 +16888,8 @@ char* to_chars(char* first, const char* last, FloatType value) // #include -namespace nlohmann -{ -namespace detail -{ +namespace nlohmann { +namespace detail { /////////////////// // serialization // /////////////////// @@ -15558,57 +16913,68 @@ class serializer static constexpr std::uint8_t UTF8_ACCEPT = 0; static constexpr std::uint8_t UTF8_REJECT = 1; - public: +public: + /*! - @param[in] s output stream to serialize to - @param[in] ichar indentation character to use - @param[in] error_handler_ how to react on decoding errors - */ - serializer(output_adapter_t s, const char ichar, - error_handler_t error_handler_ = error_handler_t::strict) + @param[in] s output stream to serialize to + @param[in] ichar indentation character to use + @param[in] error_handler_ how to react on decoding errors + */ + serializer( + output_adapter_t s, + const char ichar, + error_handler_t error_handler_ = error_handler_t::strict) : o(std::move(s)) , loc(std::localeconv()) - , thousands_sep(loc->thousands_sep == nullptr ? '\0' : std::char_traits::to_char_type(* (loc->thousands_sep))) - , decimal_point(loc->decimal_point == nullptr ? '\0' : std::char_traits::to_char_type(* (loc->decimal_point))) + , thousands_sep(loc->thousands_sep == + nullptr ? '\0' : std::char_traits::to_char_type(*(loc->thousands_sep))) + , decimal_point(loc->decimal_point == + nullptr ? '\0' : std::char_traits::to_char_type(*(loc->decimal_point))) , indent_char(ichar) , indent_string(512, indent_char) , error_handler(error_handler_) - {} + { + } // delete because of pointer members - serializer(const serializer&) = delete; - serializer& operator=(const serializer&) = delete; - serializer(serializer&&) = delete; - serializer& operator=(serializer&&) = delete; + serializer( + const serializer&) = delete; + serializer& operator =( + const serializer&) = delete; + serializer( + serializer&&) = delete; + serializer& operator =( + serializer&&) = delete; ~serializer() = default; /*! - @brief internal implementation of the serialization function - - This function is called by the public member function dump and organizes - the serialization internally. The indentation level is propagated as - additional parameter. In case of arrays and objects, the function is - called recursively. - - - strings and object keys are escaped using `escape_string()` - - integer numbers are converted implicitly via `operator<<` - - floating-point numbers are converted to a string using `"%g"` format - - binary values are serialized as objects containing the subtype and the - byte array - - @param[in] val value to serialize - @param[in] pretty_print whether the output shall be pretty-printed - @param[in] ensure_ascii If @a ensure_ascii is true, all non-ASCII characters - in the output are escaped with `\uXXXX` sequences, and the result consists - of ASCII characters only. - @param[in] indent_step the indent level - @param[in] current_indent the current indent level (only used internally) - */ - void dump(const BasicJsonType& val, - const bool pretty_print, - const bool ensure_ascii, - const unsigned int indent_step, - const unsigned int current_indent = 0) + @brief internal implementation of the serialization function + + This function is called by the public member function dump and organizes + the serialization internally. The indentation level is propagated as + additional parameter. In case of arrays and objects, the function is + called recursively. + + - strings and object keys are escaped using `escape_string()` + - integer numbers are converted implicitly via `operator<<` + - floating-point numbers are converted to a string using `"%g"` format + - binary values are serialized as objects containing the subtype and the + byte array + + @param[in] val value to serialize + @param[in] pretty_print whether the output shall be pretty-printed + @param[in] ensure_ascii If @a ensure_ascii is true, all non-ASCII characters + in the output are escaped with `\uXXXX` sequences, and the result consists + of ASCII characters only. + @param[in] indent_step the indent level + @param[in] current_indent the current indent level (only used internally) + */ + void dump( + const BasicJsonType& val, + const bool pretty_print, + const bool ensure_ascii, + const unsigned int indent_step, + const unsigned int current_indent = 0) { switch (val.m_type) { @@ -15873,22 +17239,24 @@ class serializer } } - JSON_PRIVATE_UNLESS_TESTED: +JSON_PRIVATE_UNLESS_TESTED: /*! - @brief dump escaped string + @brief dump escaped string - Escape a string by replacing certain special characters by a sequence of an - escape character (backslash) and another character and other control - characters by a sequence of "\u" followed by a four-digit hex - representation. The escaped string is written to output stream @a o. + Escape a string by replacing certain special characters by a sequence of an + escape character (backslash) and another character and other control + characters by a sequence of "\u" followed by a four-digit hex + representation. The escaped string is written to output stream @a o. - @param[in] s the string to escape - @param[in] ensure_ascii whether to escape non-ASCII characters with + @param[in] s the string to escape + @param[in] ensure_ascii whether to escape non-ASCII characters with \uXXXX sequences - @complexity Linear in the length of string @a s. - */ - void dump_escaped(const string_t& s, const bool ensure_ascii) + @complexity Linear in the length of string @a s. + */ + void dump_escaped( + const string_t& s, + const bool ensure_ascii) { std::uint32_t codepoint; std::uint8_t state = UTF8_ACCEPT; @@ -15966,14 +17334,14 @@ class serializer if (codepoint <= 0xFFFF) { (std::snprintf)(string_buffer.data() + bytes, 7, "\\u%04x", - static_cast(codepoint)); + static_cast(codepoint)); bytes += 6; } else { (std::snprintf)(string_buffer.data() + bytes, 13, "\\u%04x\\u%04x", - static_cast(0xD7C0u + (codepoint >> 10u)), - static_cast(0xDC00u + (codepoint & 0x3FFu))); + static_cast(0xD7C0u + (codepoint >> 10u)), + static_cast(0xDC00u + (codepoint & 0x3FFu))); bytes += 12; } } @@ -16010,7 +17378,8 @@ class serializer { std::string sn(3, '\0'); (std::snprintf)(&sn[0], sn.size(), "%.2X", byte); - JSON_THROW(type_error::create(316, "invalid UTF-8 byte at index " + std::to_string(i) + ": 0x" + sn)); + JSON_THROW(type_error::create(316, + "invalid UTF-8 byte at index " + std::to_string(i) + ": 0x" + sn)); } case error_handler_t::ignore: @@ -16043,9 +17412,12 @@ class serializer } else { - string_buffer[bytes++] = detail::binary_writer::to_char_type('\xEF'); - string_buffer[bytes++] = detail::binary_writer::to_char_type('\xBF'); - string_buffer[bytes++] = detail::binary_writer::to_char_type('\xBD'); + string_buffer[bytes++] = detail::binary_writer::to_char_type( + '\xEF'); + string_buffer[bytes++] = detail::binary_writer::to_char_type( + '\xBF'); + string_buffer[bytes++] = detail::binary_writer::to_char_type( + '\xBD'); } // write buffer and reset index; there must be 13 bytes @@ -16136,16 +17508,18 @@ class serializer } } - private: +private: + /*! - @brief count digits + @brief count digits - Count the number of decimal (base 10) digits for an input unsigned integer. + Count the number of decimal (base 10) digits for an input unsigned integer. - @param[in] x unsigned integer number to count its digits - @return number of decimal digits - */ - inline unsigned int count_digits(number_unsigned_t x) noexcept + @param[in] x unsigned integer number to count its digits + @return number of decimal digits + */ + inline unsigned int count_digits( + number_unsigned_t x) noexcept { unsigned int n_digits = 1; for (;;) @@ -16172,34 +17546,45 @@ class serializer } /*! - @brief dump an integer + @brief dump an integer - Dump a given integer to output stream @a o. Works internally with - @a number_buffer. + Dump a given integer to output stream @a o. Works internally with + @a number_buffer. - @param[in] x integer number (signed or unsigned) to dump - @tparam NumberType either @a number_integer_t or @a number_unsigned_t - */ + @param[in] x integer number (signed or unsigned) to dump + @tparam NumberType either @a number_integer_t or @a number_unsigned_t + */ template < typename NumberType, detail::enable_if_t < - std::is_same::value || - std::is_same::value || - std::is_same::value, - int > = 0 > - void dump_integer(NumberType x) + std::is_same::value || + std::is_same::value || + std::is_same::value, + int > = 0 > + void dump_integer( + NumberType x) { static constexpr std::array, 100> digits_to_99 { { - {{'0', '0'}}, {{'0', '1'}}, {{'0', '2'}}, {{'0', '3'}}, {{'0', '4'}}, {{'0', '5'}}, {{'0', '6'}}, {{'0', '7'}}, {{'0', '8'}}, {{'0', '9'}}, - {{'1', '0'}}, {{'1', '1'}}, {{'1', '2'}}, {{'1', '3'}}, {{'1', '4'}}, {{'1', '5'}}, {{'1', '6'}}, {{'1', '7'}}, {{'1', '8'}}, {{'1', '9'}}, - {{'2', '0'}}, {{'2', '1'}}, {{'2', '2'}}, {{'2', '3'}}, {{'2', '4'}}, {{'2', '5'}}, {{'2', '6'}}, {{'2', '7'}}, {{'2', '8'}}, {{'2', '9'}}, - {{'3', '0'}}, {{'3', '1'}}, {{'3', '2'}}, {{'3', '3'}}, {{'3', '4'}}, {{'3', '5'}}, {{'3', '6'}}, {{'3', '7'}}, {{'3', '8'}}, {{'3', '9'}}, - {{'4', '0'}}, {{'4', '1'}}, {{'4', '2'}}, {{'4', '3'}}, {{'4', '4'}}, {{'4', '5'}}, {{'4', '6'}}, {{'4', '7'}}, {{'4', '8'}}, {{'4', '9'}}, - {{'5', '0'}}, {{'5', '1'}}, {{'5', '2'}}, {{'5', '3'}}, {{'5', '4'}}, {{'5', '5'}}, {{'5', '6'}}, {{'5', '7'}}, {{'5', '8'}}, {{'5', '9'}}, - {{'6', '0'}}, {{'6', '1'}}, {{'6', '2'}}, {{'6', '3'}}, {{'6', '4'}}, {{'6', '5'}}, {{'6', '6'}}, {{'6', '7'}}, {{'6', '8'}}, {{'6', '9'}}, - {{'7', '0'}}, {{'7', '1'}}, {{'7', '2'}}, {{'7', '3'}}, {{'7', '4'}}, {{'7', '5'}}, {{'7', '6'}}, {{'7', '7'}}, {{'7', '8'}}, {{'7', '9'}}, - {{'8', '0'}}, {{'8', '1'}}, {{'8', '2'}}, {{'8', '3'}}, {{'8', '4'}}, {{'8', '5'}}, {{'8', '6'}}, {{'8', '7'}}, {{'8', '8'}}, {{'8', '9'}}, - {{'9', '0'}}, {{'9', '1'}}, {{'9', '2'}}, {{'9', '3'}}, {{'9', '4'}}, {{'9', '5'}}, {{'9', '6'}}, {{'9', '7'}}, {{'9', '8'}}, {{'9', '9'}}, + {{'0', '0'}}, {{'0', '1'}}, {{'0', '2'}}, {{'0', '3'}}, {{'0', '4'}}, {{'0', '5'}}, {{'0', '6'}}, + {{'0', '7'}}, {{'0', '8'}}, {{'0', '9'}}, + {{'1', '0'}}, {{'1', '1'}}, {{'1', '2'}}, {{'1', '3'}}, {{'1', '4'}}, {{'1', '5'}}, {{'1', '6'}}, + {{'1', '7'}}, {{'1', '8'}}, {{'1', '9'}}, + {{'2', '0'}}, {{'2', '1'}}, {{'2', '2'}}, {{'2', '3'}}, {{'2', '4'}}, {{'2', '5'}}, {{'2', '6'}}, + {{'2', '7'}}, {{'2', '8'}}, {{'2', '9'}}, + {{'3', '0'}}, {{'3', '1'}}, {{'3', '2'}}, {{'3', '3'}}, {{'3', '4'}}, {{'3', '5'}}, {{'3', '6'}}, + {{'3', '7'}}, {{'3', '8'}}, {{'3', '9'}}, + {{'4', '0'}}, {{'4', '1'}}, {{'4', '2'}}, {{'4', '3'}}, {{'4', '4'}}, {{'4', '5'}}, {{'4', '6'}}, + {{'4', '7'}}, {{'4', '8'}}, {{'4', '9'}}, + {{'5', '0'}}, {{'5', '1'}}, {{'5', '2'}}, {{'5', '3'}}, {{'5', '4'}}, {{'5', '5'}}, {{'5', '6'}}, + {{'5', '7'}}, {{'5', '8'}}, {{'5', '9'}}, + {{'6', '0'}}, {{'6', '1'}}, {{'6', '2'}}, {{'6', '3'}}, {{'6', '4'}}, {{'6', '5'}}, {{'6', '6'}}, + {{'6', '7'}}, {{'6', '8'}}, {{'6', '9'}}, + {{'7', '0'}}, {{'7', '1'}}, {{'7', '2'}}, {{'7', '3'}}, {{'7', '4'}}, {{'7', '5'}}, {{'7', '6'}}, + {{'7', '7'}}, {{'7', '8'}}, {{'7', '9'}}, + {{'8', '0'}}, {{'8', '1'}}, {{'8', '2'}}, {{'8', '3'}}, {{'8', '4'}}, {{'8', '5'}}, {{'8', '6'}}, + {{'8', '7'}}, {{'8', '8'}}, {{'8', '9'}}, + {{'9', '0'}}, {{'9', '1'}}, {{'9', '2'}}, {{'9', '3'}}, {{'9', '4'}}, {{'9', '5'}}, {{'9', '6'}}, + {{'9', '7'}}, {{'9', '8'}}, {{'9', '9'}}, } }; @@ -16264,14 +17649,15 @@ class serializer } /*! - @brief dump a floating-point number + @brief dump a floating-point number - Dump a given floating-point number to output stream @a o. Works internally - with @a number_buffer. + Dump a given floating-point number to output stream @a o. Works internally + with @a number_buffer. - @param[in] x floating-point number to dump - */ - void dump_float(number_float_t x) + @param[in] x floating-point number to dump + */ + void dump_float( + number_float_t x) { // NaN / inf if (!std::isfinite(x)) @@ -16286,13 +17672,17 @@ class serializer // // NB: The test below works if == . static constexpr bool is_ieee_single_or_double - = (std::numeric_limits::is_iec559 && std::numeric_limits::digits == 24 && std::numeric_limits::max_exponent == 128) || - (std::numeric_limits::is_iec559 && std::numeric_limits::digits == 53 && std::numeric_limits::max_exponent == 1024); + = (std::numeric_limits::is_iec559 && std::numeric_limits::digits == 24 && + std::numeric_limits::max_exponent == 128) || + (std::numeric_limits::is_iec559 && std::numeric_limits::digits == 53 && + std::numeric_limits::max_exponent == 1024); dump_float(x, std::integral_constant()); } - void dump_float(number_float_t x, std::true_type /*is_ieee_single_or_double*/) + void dump_float( + number_float_t x, + std::true_type /*is_ieee_single_or_double*/) { char* begin = number_buffer.data(); char* end = ::nlohmann::detail::to_chars(begin, begin + number_buffer.size(), x); @@ -16300,7 +17690,9 @@ class serializer o->write_characters(begin, static_cast(end - begin)); } - void dump_float(number_float_t x, std::false_type /*is_ieee_single_or_double*/) + void dump_float( + number_float_t x, + std::false_type /*is_ieee_single_or_double*/) { // get number of digits for a float -> text -> float round-trip static constexpr auto d = std::numeric_limits::max_digits10; @@ -16317,7 +17709,7 @@ class serializer if (thousands_sep != '\0') { const auto end = std::remove(number_buffer.begin(), - number_buffer.begin() + len, thousands_sep); + number_buffer.begin() + len, thousands_sep); std::fill(end, number_buffer.end(), '\0'); JSON_ASSERT((end - number_buffer.begin()) <= len); len = (end - number_buffer.begin()); @@ -16337,11 +17729,11 @@ class serializer // determine if need to append ".0" const bool value_is_int_like = - std::none_of(number_buffer.begin(), number_buffer.begin() + len + 1, - [](char c) - { - return c == '.' || c == 'e'; - }); + std::none_of(number_buffer.begin(), number_buffer.begin() + len + 1, + [](char c) + { + return c == '.' || c == 'e'; + }); if (value_is_int_like) { @@ -16350,27 +17742,30 @@ class serializer } /*! - @brief check whether a string is UTF-8 encoded + @brief check whether a string is UTF-8 encoded - The function checks each byte of a string whether it is UTF-8 encoded. The - result of the check is stored in the @a state parameter. The function must - be called initially with state 0 (accept). State 1 means the string must - be rejected, because the current byte is not allowed. If the string is - completely processed, but the state is non-zero, the string ended - prematurely; that is, the last byte indicated more bytes should have - followed. + The function checks each byte of a string whether it is UTF-8 encoded. The + result of the check is stored in the @a state parameter. The function must + be called initially with state 0 (accept). State 1 means the string must + be rejected, because the current byte is not allowed. If the string is + completely processed, but the state is non-zero, the string ended + prematurely; that is, the last byte indicated more bytes should have + followed. - @param[in,out] state the state of the decoding - @param[in,out] codep codepoint (valid only if resulting state is UTF8_ACCEPT) - @param[in] byte next byte to decode - @return new state + @param[in,out] state the state of the decoding + @param[in,out] codep codepoint (valid only if resulting state is UTF8_ACCEPT) + @param[in] byte next byte to decode + @return new state - @note The function has been edited: a std::array is used. + @note The function has been edited: a std::array is used. - @copyright Copyright (c) 2008-2009 Bjoern Hoehrmann - @sa http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ - */ - static std::uint8_t decode(std::uint8_t& state, std::uint32_t& codep, const std::uint8_t byte) noexcept + @copyright Copyright (c) 2008-2009 Bjoern Hoehrmann + @sa http://bjoern.hoehrmann.de/utf-8/decoder/dfa/ + */ + static std::uint8_t decode( + std::uint8_t& state, + std::uint32_t& codep, + const std::uint8_t byte) noexcept { static const std::array utf8d = { @@ -16409,7 +17804,8 @@ class serializer * dump_integer for number_unsigned_t. * Must never be called. */ - number_unsigned_t remove_sign(number_unsigned_t x) + number_unsigned_t remove_sign( + number_unsigned_t x) { JSON_ASSERT(false); // LCOV_EXCL_LINE return x; // LCOV_EXCL_LINE @@ -16424,13 +17820,15 @@ class serializer * absolute values of INT_MIN and INT_MAX are usually not the same. See * #1708 for details. */ - inline number_unsigned_t remove_sign(number_integer_t x) noexcept + inline number_unsigned_t remove_sign( + number_integer_t x) noexcept { JSON_ASSERT(x < 0 && x < (std::numeric_limits::max)()); return static_cast(-(x + 1)) + 1; } - private: +private: + /// the output of the serializer output_adapter_t o = nullptr; @@ -16473,14 +17871,13 @@ class serializer // #include -namespace nlohmann -{ +namespace nlohmann { /// ordered_map: a minimal map-like container that preserves insertion order /// for use within nlohmann::basic_json template , - class Allocator = std::allocator>> - struct ordered_map : std::vector, Allocator> + class Allocator = std::allocator>> +struct ordered_map : std::vector, Allocator> { using key_type = Key; using mapped_type = T; @@ -16492,14 +17889,31 @@ template , // Explicit constructors instead of `using Container::Container` // otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4) - ordered_map(const Allocator& alloc = Allocator()) : Container{alloc} {} + ordered_map( + const Allocator& alloc = Allocator()) + : Container{alloc} + { + } + template - ordered_map(It first, It last, const Allocator& alloc = Allocator()) - : Container{first, last, alloc} {} - ordered_map(std::initializer_list init, const Allocator& alloc = Allocator() ) - : Container{init, alloc} {} + ordered_map( + It first, + It last, + const Allocator& alloc = Allocator()) + : Container{first, last, alloc} + { + } - std::pair emplace(const key_type& key, T&& t) + ordered_map( + std::initializer_list init, + const Allocator& alloc = Allocator()) + : Container{init, alloc} + { + } + + std::pair emplace( + const key_type& key, + T&& t) { for (auto it = this->begin(); it != this->end(); ++it) { @@ -16512,17 +17926,20 @@ template , return {--this->end(), true}; } - T& operator[](const Key& key) + T& operator []( + const Key& key) { return emplace(key, T{}).first->second; } - const T& operator[](const Key& key) const + const T& operator []( + const Key& key) const { return at(key); } - T& at(const Key& key) + T& at( + const Key& key) { for (auto it = this->begin(); it != this->end(); ++it) { @@ -16535,7 +17952,8 @@ template , JSON_THROW(std::out_of_range("key not found")); } - const T& at(const Key& key) const + const T& at( + const Key& key) const { for (auto it = this->begin(); it != this->end(); ++it) { @@ -16548,7 +17966,8 @@ template , JSON_THROW(std::out_of_range("key not found")); } - size_type erase(const Key& key) + size_type erase( + const Key& key) { for (auto it = this->begin(); it != this->end(); ++it) { @@ -16567,7 +17986,8 @@ template , return 0; } - iterator erase(iterator pos) + iterator erase( + iterator pos) { auto it = pos; @@ -16581,7 +18001,8 @@ template , return pos; } - size_type count(const Key& key) const + size_type count( + const Key& key) const { for (auto it = this->begin(); it != this->end(); ++it) { @@ -16593,7 +18014,8 @@ template , return 0; } - iterator find(const Key& key) + iterator find( + const Key& key) { for (auto it = this->begin(); it != this->end(); ++it) { @@ -16605,7 +18027,8 @@ template , return Container::end(); } - const_iterator find(const Key& key) const + const_iterator find( + const Key& key) const { for (auto it = this->begin(); it != this->end(); ++it) { @@ -16617,12 +18040,14 @@ template , return Container::end(); } - std::pair insert( value_type&& value ) + std::pair insert( + value_type&& value ) { return emplace(value.first, std::move(value.second)); } - std::pair insert( const value_type& value ) + std::pair insert( + const value_type& value ) { for (auto it = this->begin(); it != this->end(); ++it) { @@ -16634,107 +18059,108 @@ template , Container::push_back(value); return {--this->end(), true}; } + }; } // namespace nlohmann /*! -@brief namespace for Niels Lohmann -@see https://github.com/nlohmann -@since version 1.0.0 -*/ -namespace nlohmann -{ + @brief namespace for Niels Lohmann + @see https://github.com/nlohmann + @since version 1.0.0 + */ +namespace nlohmann { /*! -@brief a class to store JSON values - -@tparam ObjectType type for JSON objects (`std::map` by default; will be used -in @ref object_t) -@tparam ArrayType type for JSON arrays (`std::vector` by default; will be used -in @ref array_t) -@tparam StringType type for JSON strings and object keys (`std::string` by -default; will be used in @ref string_t) -@tparam BooleanType type for JSON booleans (`bool` by default; will be used -in @ref boolean_t) -@tparam NumberIntegerType type for JSON integer numbers (`int64_t` by -default; will be used in @ref number_integer_t) -@tparam NumberUnsignedType type for JSON unsigned integer numbers (@c -`uint64_t` by default; will be used in @ref number_unsigned_t) -@tparam NumberFloatType type for JSON floating-point numbers (`double` by -default; will be used in @ref number_float_t) -@tparam BinaryType type for packed binary data for compatibility with binary -serialization formats (`std::vector` by default; will be used in -@ref binary_t) -@tparam AllocatorType type of the allocator to use (`std::allocator` by -default) -@tparam JSONSerializer the serializer to resolve internal calls to `to_json()` -and `from_json()` (@ref adl_serializer by default) - -@requirement The class satisfies the following concept requirements: -- Basic - - [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible): + @brief a class to store JSON values + + @tparam ObjectType type for JSON objects (`std::map` by default; will be used + in @ref object_t) + @tparam ArrayType type for JSON arrays (`std::vector` by default; will be used + in @ref array_t) + @tparam StringType type for JSON strings and object keys (`std::string` by + default; will be used in @ref string_t) + @tparam BooleanType type for JSON booleans (`bool` by default; will be used + in @ref boolean_t) + @tparam NumberIntegerType type for JSON integer numbers (`int64_t` by + default; will be used in @ref number_integer_t) + @tparam NumberUnsignedType type for JSON unsigned integer numbers (@c + `uint64_t` by default; will be used in @ref number_unsigned_t) + @tparam NumberFloatType type for JSON floating-point numbers (`double` by + default; will be used in @ref number_float_t) + @tparam BinaryType type for packed binary data for compatibility with binary + serialization formats (`std::vector` by default; will be used in + @ref binary_t) + @tparam AllocatorType type of the allocator to use (`std::allocator` by + default) + @tparam JSONSerializer the serializer to resolve internal calls to `to_json()` + and `from_json()` (@ref adl_serializer by default) + + @requirement The class satisfies the following concept requirements: + - Basic + - [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible): JSON values can be default constructed. The result will be a JSON null value. - - [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible): + - [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible): A JSON value can be constructed from an rvalue argument. - - [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible): + - [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible): A JSON value can be copy-constructed from an lvalue expression. - - [MoveAssignable](https://en.cppreference.com/w/cpp/named_req/MoveAssignable): + - [MoveAssignable](https://en.cppreference.com/w/cpp/named_req/MoveAssignable): A JSON value van be assigned from an rvalue argument. - - [CopyAssignable](https://en.cppreference.com/w/cpp/named_req/CopyAssignable): + - [CopyAssignable](https://en.cppreference.com/w/cpp/named_req/CopyAssignable): A JSON value can be copy-assigned from an lvalue expression. - - [Destructible](https://en.cppreference.com/w/cpp/named_req/Destructible): + - [Destructible](https://en.cppreference.com/w/cpp/named_req/Destructible): JSON values can be destructed. -- Layout - - [StandardLayoutType](https://en.cppreference.com/w/cpp/named_req/StandardLayoutType): + - Layout + - [StandardLayoutType](https://en.cppreference.com/w/cpp/named_req/StandardLayoutType): JSON values have [standard layout](https://en.cppreference.com/w/cpp/language/data_members#Standard_layout): All non-static data members are private and standard layout types, the class has no virtual functions or (virtual) base classes. -- Library-wide - - [EqualityComparable](https://en.cppreference.com/w/cpp/named_req/EqualityComparable): + - Library-wide + - [EqualityComparable](https://en.cppreference.com/w/cpp/named_req/EqualityComparable): JSON values can be compared with `==`, see @ref operator==(const_reference,const_reference). - - [LessThanComparable](https://en.cppreference.com/w/cpp/named_req/LessThanComparable): + - [LessThanComparable](https://en.cppreference.com/w/cpp/named_req/LessThanComparable): JSON values can be compared with `<`, see @ref operator<(const_reference,const_reference). - - [Swappable](https://en.cppreference.com/w/cpp/named_req/Swappable): + - [Swappable](https://en.cppreference.com/w/cpp/named_req/Swappable): Any JSON lvalue or rvalue of can be swapped with any lvalue or rvalue of other compatible types, using unqualified function call @ref swap(). - - [NullablePointer](https://en.cppreference.com/w/cpp/named_req/NullablePointer): + - [NullablePointer](https://en.cppreference.com/w/cpp/named_req/NullablePointer): JSON values can be compared against `std::nullptr_t` objects which are used to model the `null` value. -- Container - - [Container](https://en.cppreference.com/w/cpp/named_req/Container): + - Container + - [Container](https://en.cppreference.com/w/cpp/named_req/Container): JSON values can be used like STL containers and provide iterator access. - - [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer); + - [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer); JSON values can be used like STL containers and provide reverse iterator access. -@invariant The member variables @a m_value and @a m_type have the following -relationship: -- If `m_type == value_t::object`, then `m_value.object != nullptr`. -- If `m_type == value_t::array`, then `m_value.array != nullptr`. -- If `m_type == value_t::string`, then `m_value.string != nullptr`. -The invariants are checked by member function assert_invariant(). + @invariant The member variables @a m_value and @a m_type have the following + relationship: + - If `m_type == value_t::object`, then `m_value.object != nullptr`. + - If `m_type == value_t::array`, then `m_value.array != nullptr`. + - If `m_type == value_t::string`, then `m_value.string != nullptr`. + The invariants are checked by member function assert_invariant(). -@internal -@note ObjectType trick from https://stackoverflow.com/a/9860911 -@endinternal + @internal + @note ObjectType trick from https://stackoverflow.com/a/9860911 + @endinternal -@see [RFC 7159: The JavaScript Object Notation (JSON) Data Interchange -Format](http://rfc7159.net/rfc7159) + @see [RFC 7159: The JavaScript Object Notation (JSON) Data Interchange + Format](http://rfc7159.net/rfc7159) -@since version 1.0.0 + @since version 1.0.0 -@nosubgrouping -*/ + @nosubgrouping + */ NLOHMANN_BASIC_JSON_TPL_DECLARATION class basic_json { - private: +private: + template friend struct detail::external_constructor; friend ::nlohmann::json_pointer; @@ -16755,23 +18181,24 @@ class basic_json /// workaround type for MSVC using basic_json_t = NLOHMANN_BASIC_JSON_TPL; - JSON_PRIVATE_UNLESS_TESTED: +JSON_PRIVATE_UNLESS_TESTED: // convenience aliases for types residing in namespace detail; using lexer = ::nlohmann::detail::lexer_base; template static ::nlohmann::detail::parser parser( - InputAdapterType adapter, - detail::parser_callback_tcb = nullptr, - const bool allow_exceptions = true, - const bool ignore_comments = false - ) + InputAdapterType adapter, + detail::parser_callback_tcb = nullptr, + const bool allow_exceptions = true, + const bool ignore_comments = false + ) { return ::nlohmann::detail::parser(std::move(adapter), - std::move(cb), allow_exceptions, ignore_comments); + std::move(cb), allow_exceptions, ignore_comments); } - private: +private: + using primitive_iterator_t = ::nlohmann::detail::primitive_iterator_t; template using internal_iterator = ::nlohmann::detail::internal_iterator; @@ -16788,10 +18215,11 @@ class basic_json using binary_reader = ::nlohmann::detail::binary_reader; template using binary_writer = ::nlohmann::detail::binary_writer; - JSON_PRIVATE_UNLESS_TESTED: +JSON_PRIVATE_UNLESS_TESTED: using serializer = ::nlohmann::detail::serializer; - public: +public: + using value_t = detail::value_t; /// JSON Pointer, see @ref nlohmann::json_pointer using json_pointer = ::nlohmann::json_pointer; @@ -16875,39 +18303,39 @@ class basic_json /*! - @brief returns the allocator associated with the container - */ + @brief returns the allocator associated with the container + */ static allocator_type get_allocator() { return allocator_type(); } /*! - @brief returns version information on the library + @brief returns version information on the library - This function returns a JSON object with information about the library, - including the version number and information on the platform and compiler. + This function returns a JSON object with information about the library, + including the version number and information on the platform and compiler. - @return JSON object holding version information - key | description - ----------- | --------------- - `compiler` | Information on the used compiler. It is an object with the following keys: `c++` (the used C++ standard), `family` (the compiler family; possible values are `clang`, `icc`, `gcc`, `ilecpp`, `msvc`, `pgcpp`, `sunpro`, and `unknown`), and `version` (the compiler version). - `copyright` | The copyright line for the library as string. - `name` | The name of the library as string. - `platform` | The used platform as string. Possible values are `win32`, `linux`, `apple`, `unix`, and `unknown`. - `url` | The URL of the project as string. - `version` | The version of the library. It is an object with the following keys: `major`, `minor`, and `patch` as defined by [Semantic Versioning](http://semver.org), and `string` (the version string). + @return JSON object holding version information + key | description + ----------- | --------------- + `compiler` | Information on the used compiler. It is an object with the following keys: `c++` (the used C++ standard), `family` (the compiler family; possible values are `clang`, `icc`, `gcc`, `ilecpp`, `msvc`, `pgcpp`, `sunpro`, and `unknown`), and `version` (the compiler version). + `copyright` | The copyright line for the library as string. + `name` | The name of the library as string. + `platform` | The used platform as string. Possible values are `win32`, `linux`, `apple`, `unix`, and `unknown`. + `url` | The URL of the project as string. + `version` | The version of the library. It is an object with the following keys: `major`, `minor`, and `patch` as defined by [Semantic Versioning](http://semver.org), and `string` (the version string). - @liveexample{The following code shows an example output of the `meta()` - function.,meta} + @liveexample{The following code shows an example output of the `meta()` + function.,meta} - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes to any JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. - @complexity Constant. + @complexity Constant. - @since 2.1.0 - */ + @since 2.1.0 + */ JSON_HEDLEY_WARN_UNUSED_RESULT static basic_json meta() { @@ -16917,9 +18345,9 @@ class basic_json result["name"] = "JSON for Modern C++"; result["url"] = "https://github.com/nlohmann/json"; result["version"]["string"] = - std::to_string(NLOHMANN_JSON_VERSION_MAJOR) + "." + - std::to_string(NLOHMANN_JSON_VERSION_MINOR) + "." + - std::to_string(NLOHMANN_JSON_VERSION_PATCH); + std::to_string(NLOHMANN_JSON_VERSION_MAJOR) + "." + + std::to_string(NLOHMANN_JSON_VERSION_MINOR) + "." + + std::to_string(NLOHMANN_JSON_VERSION_PATCH); result["version"]["major"] = NLOHMANN_JSON_VERSION_MAJOR; result["version"]["minor"] = NLOHMANN_JSON_VERSION_MINOR; result["version"]["patch"] = NLOHMANN_JSON_VERSION_PATCH; @@ -16934,14 +18362,15 @@ class basic_json result["platform"] = "unix"; #else result["platform"] = "unknown"; -#endif +#endif // ifdef _WIN32 #if defined(__ICC) || defined(__INTEL_COMPILER) result["compiler"] = {{"family", "icc"}, {"version", __INTEL_COMPILER}}; #elif defined(__clang__) result["compiler"] = {{"family", "clang"}, {"version", __clang_version__}}; #elif defined(__GNUC__) || defined(__GNUG__) - result["compiler"] = {{"family", "gcc"}, {"version", std::to_string(__GNUC__) + "." + std::to_string(__GNUC_MINOR__) + "." + std::to_string(__GNUC_PATCHLEVEL__)}}; + result["compiler"] = {{"family", "gcc"}, {"version", std::to_string(__GNUC__) + "." + std::to_string( + __GNUC_MINOR__) + "." + std::to_string(__GNUC_PATCHLEVEL__)}}; #elif defined(__HP_cc) || defined(__HP_aCC) result["compiler"] = "hp" #elif defined(__IBMCPP__) @@ -16954,17 +18383,16 @@ class basic_json result["compiler"] = {{"family", "sunpro"}, {"version", __SUNPRO_CC}}; #else result["compiler"] = {{"family", "unknown"}, {"version", "unknown"}}; -#endif +#endif // if defined(__ICC) || defined(__INTEL_COMPILER) #ifdef __cplusplus result["compiler"]["c++"] = std::to_string(__cplusplus); #else result["compiler"]["c++"] = "unknown"; -#endif +#endif // ifdef __cplusplus return result; } - /////////////////////////// // JSON value data types // /////////////////////////// @@ -16980,519 +18408,520 @@ class basic_json using object_comparator_t = std::less<>; #else using object_comparator_t = std::less; -#endif - - /*! - @brief a type for an object - - [RFC 7159](http://rfc7159.net/rfc7159) describes JSON objects as follows: - > An object is an unordered collection of zero or more name/value pairs, - > where a name is a string and a value is a string, number, boolean, null, - > object, or array. - - To store objects in C++, a type is defined by the template parameters - described below. - - @tparam ObjectType the container to store objects (e.g., `std::map` or - `std::unordered_map`) - @tparam StringType the type of the keys or names (e.g., `std::string`). - The comparison function `std::less` is used to order elements - inside the container. - @tparam AllocatorType the allocator to use for objects (e.g., - `std::allocator`) - - #### Default type - - With the default values for @a ObjectType (`std::map`), @a StringType - (`std::string`), and @a AllocatorType (`std::allocator`), the default - value for @a object_t is: - - @code {.cpp} - std::map< - std::string, // key_type - basic_json, // value_type - std::less, // key_compare - std::allocator> // allocator_type - > - @endcode - - #### Behavior - - The choice of @a object_t influences the behavior of the JSON class. With - the default type, objects have the following behavior: - - - When all names are unique, objects will be interoperable in the sense - that all software implementations receiving that object will agree on - the name-value mappings. - - When the names within an object are not unique, it is unspecified which - one of the values for a given key will be chosen. For instance, - `{"key": 2, "key": 1}` could be equal to either `{"key": 1}` or - `{"key": 2}`. - - Internally, name/value pairs are stored in lexicographical order of the - names. Objects will also be serialized (see @ref dump) in this order. - For instance, `{"b": 1, "a": 2}` and `{"a": 2, "b": 1}` will be stored - and serialized as `{"a": 2, "b": 1}`. - - When comparing objects, the order of the name/value pairs is irrelevant. - This makes objects interoperable in the sense that they will not be - affected by these differences. For instance, `{"b": 1, "a": 2}` and - `{"a": 2, "b": 1}` will be treated as equal. - - #### Limits - - [RFC 7159](http://rfc7159.net/rfc7159) specifies: - > An implementation may set limits on the maximum depth of nesting. - - In this class, the object's limit of nesting is not explicitly constrained. - However, a maximum depth of nesting may be introduced by the compiler or - runtime environment. A theoretical limit can be queried by calling the - @ref max_size function of a JSON object. - - #### Storage - - Objects are stored as pointers in a @ref basic_json type. That is, for any - access to object values, a pointer of type `object_t*` must be - dereferenced. - - @sa @ref array_t -- type for an array value - - @since version 1.0.0 - - @note The order name/value pairs are added to the object is *not* - preserved by the library. Therefore, iterating an object may return - name/value pairs in a different order than they were originally stored. In - fact, keys will be traversed in alphabetical order as `std::map` with - `std::less` is used by default. Please note this behavior conforms to [RFC - 7159](http://rfc7159.net/rfc7159), because any order implements the - specified "unordered" nature of JSON objects. - */ +#endif // if defined(JSON_HAS_CPP_14) + + /*! + @brief a type for an object + + [RFC 7159](http://rfc7159.net/rfc7159) describes JSON objects as follows: + > An object is an unordered collection of zero or more name/value pairs, + > where a name is a string and a value is a string, number, boolean, null, + > object, or array. + + To store objects in C++, a type is defined by the template parameters + described below. + + @tparam ObjectType the container to store objects (e.g., `std::map` or + `std::unordered_map`) + @tparam StringType the type of the keys or names (e.g., `std::string`). + The comparison function `std::less` is used to order elements + inside the container. + @tparam AllocatorType the allocator to use for objects (e.g., + `std::allocator`) + + #### Default type + + With the default values for @a ObjectType (`std::map`), @a StringType + (`std::string`), and @a AllocatorType (`std::allocator`), the default + value for @a object_t is: + + @code {.cpp} + std::map< + std::string, // key_type + basic_json, // value_type + std::less, // key_compare + std::allocator> // allocator_type + > + @endcode + + #### Behavior + + The choice of @a object_t influences the behavior of the JSON class. With + the default type, objects have the following behavior: + + - When all names are unique, objects will be interoperable in the sense + that all software implementations receiving that object will agree on + the name-value mappings. + - When the names within an object are not unique, it is unspecified which + one of the values for a given key will be chosen. For instance, + `{"key": 2, "key": 1}` could be equal to either `{"key": 1}` or + `{"key": 2}`. + - Internally, name/value pairs are stored in lexicographical order of the + names. Objects will also be serialized (see @ref dump) in this order. + For instance, `{"b": 1, "a": 2}` and `{"a": 2, "b": 1}` will be stored + and serialized as `{"a": 2, "b": 1}`. + - When comparing objects, the order of the name/value pairs is irrelevant. + This makes objects interoperable in the sense that they will not be + affected by these differences. For instance, `{"b": 1, "a": 2}` and + `{"a": 2, "b": 1}` will be treated as equal. + + #### Limits + + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the maximum depth of nesting. + + In this class, the object's limit of nesting is not explicitly constrained. + However, a maximum depth of nesting may be introduced by the compiler or + runtime environment. A theoretical limit can be queried by calling the + @ref max_size function of a JSON object. + + #### Storage + + Objects are stored as pointers in a @ref basic_json type. That is, for any + access to object values, a pointer of type `object_t*` must be + dereferenced. + + @sa @ref array_t -- type for an array value + + @since version 1.0.0 + + @note The order name/value pairs are added to the object is *not* + preserved by the library. Therefore, iterating an object may return + name/value pairs in a different order than they were originally stored. In + fact, keys will be traversed in alphabetical order as `std::map` with + `std::less` is used by default. Please note this behavior conforms to [RFC + 7159](http://rfc7159.net/rfc7159), because any order implements the + specified "unordered" nature of JSON objects. + */ using object_t = ObjectType>>; + basic_json, + object_comparator_t, + AllocatorType>>; /*! - @brief a type for an array + @brief a type for an array - [RFC 7159](http://rfc7159.net/rfc7159) describes JSON arrays as follows: - > An array is an ordered sequence of zero or more values. + [RFC 7159](http://rfc7159.net/rfc7159) describes JSON arrays as follows: + > An array is an ordered sequence of zero or more values. - To store objects in C++, a type is defined by the template parameters - explained below. + To store objects in C++, a type is defined by the template parameters + explained below. - @tparam ArrayType container type to store arrays (e.g., `std::vector` or - `std::list`) - @tparam AllocatorType allocator to use for arrays (e.g., `std::allocator`) + @tparam ArrayType container type to store arrays (e.g., `std::vector` or + `std::list`) + @tparam AllocatorType allocator to use for arrays (e.g., `std::allocator`) - #### Default type + #### Default type - With the default values for @a ArrayType (`std::vector`) and @a - AllocatorType (`std::allocator`), the default value for @a array_t is: + With the default values for @a ArrayType (`std::vector`) and @a + AllocatorType (`std::allocator`), the default value for @a array_t is: - @code {.cpp} - std::vector< - basic_json, // value_type - std::allocator // allocator_type - > - @endcode + @code {.cpp} + std::vector< + basic_json, // value_type + std::allocator // allocator_type + > + @endcode - #### Limits + #### Limits - [RFC 7159](http://rfc7159.net/rfc7159) specifies: - > An implementation may set limits on the maximum depth of nesting. + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the maximum depth of nesting. - In this class, the array's limit of nesting is not explicitly constrained. - However, a maximum depth of nesting may be introduced by the compiler or - runtime environment. A theoretical limit can be queried by calling the - @ref max_size function of a JSON array. + In this class, the array's limit of nesting is not explicitly constrained. + However, a maximum depth of nesting may be introduced by the compiler or + runtime environment. A theoretical limit can be queried by calling the + @ref max_size function of a JSON array. - #### Storage + #### Storage - Arrays are stored as pointers in a @ref basic_json type. That is, for any - access to array values, a pointer of type `array_t*` must be dereferenced. + Arrays are stored as pointers in a @ref basic_json type. That is, for any + access to array values, a pointer of type `array_t*` must be dereferenced. - @sa @ref object_t -- type for an object value + @sa @ref object_t -- type for an object value - @since version 1.0.0 - */ + @since version 1.0.0 + */ using array_t = ArrayType>; /*! - @brief a type for a string + @brief a type for a string - [RFC 7159](http://rfc7159.net/rfc7159) describes JSON strings as follows: - > A string is a sequence of zero or more Unicode characters. + [RFC 7159](http://rfc7159.net/rfc7159) describes JSON strings as follows: + > A string is a sequence of zero or more Unicode characters. - To store objects in C++, a type is defined by the template parameter - described below. Unicode values are split by the JSON class into - byte-sized characters during deserialization. + To store objects in C++, a type is defined by the template parameter + described below. Unicode values are split by the JSON class into + byte-sized characters during deserialization. - @tparam StringType the container to store strings (e.g., `std::string`). - Note this container is used for keys/names in objects, see @ref object_t. + @tparam StringType the container to store strings (e.g., `std::string`). + Note this container is used for keys/names in objects, see @ref object_t. - #### Default type + #### Default type - With the default values for @a StringType (`std::string`), the default - value for @a string_t is: + With the default values for @a StringType (`std::string`), the default + value for @a string_t is: - @code {.cpp} - std::string - @endcode + @code {.cpp} + std::string + @endcode - #### Encoding + #### Encoding - Strings are stored in UTF-8 encoding. Therefore, functions like - `std::string::size()` or `std::string::length()` return the number of - bytes in the string rather than the number of characters or glyphs. + Strings are stored in UTF-8 encoding. Therefore, functions like + `std::string::size()` or `std::string::length()` return the number of + bytes in the string rather than the number of characters or glyphs. - #### String comparison + #### String comparison - [RFC 7159](http://rfc7159.net/rfc7159) states: - > Software implementations are typically required to test names of object - > members for equality. Implementations that transform the textual - > representation into sequences of Unicode code units and then perform the - > comparison numerically, code unit by code unit, are interoperable in the - > sense that implementations will agree in all cases on equality or - > inequality of two strings. For example, implementations that compare - > strings with escaped characters unconverted may incorrectly find that - > `"a\\b"` and `"a\u005Cb"` are not equal. + [RFC 7159](http://rfc7159.net/rfc7159) states: + > Software implementations are typically required to test names of object + > members for equality. Implementations that transform the textual + > representation into sequences of Unicode code units and then perform the + > comparison numerically, code unit by code unit, are interoperable in the + > sense that implementations will agree in all cases on equality or + > inequality of two strings. For example, implementations that compare + > strings with escaped characters unconverted may incorrectly find that + > `"a\\b"` and `"a\u005Cb"` are not equal. - This implementation is interoperable as it does compare strings code unit - by code unit. + This implementation is interoperable as it does compare strings code unit + by code unit. - #### Storage + #### Storage - String values are stored as pointers in a @ref basic_json type. That is, - for any access to string values, a pointer of type `string_t*` must be - dereferenced. + String values are stored as pointers in a @ref basic_json type. That is, + for any access to string values, a pointer of type `string_t*` must be + dereferenced. - @since version 1.0.0 - */ + @since version 1.0.0 + */ using string_t = StringType; /*! - @brief a type for a boolean + @brief a type for a boolean - [RFC 7159](http://rfc7159.net/rfc7159) implicitly describes a boolean as a - type which differentiates the two literals `true` and `false`. + [RFC 7159](http://rfc7159.net/rfc7159) implicitly describes a boolean as a + type which differentiates the two literals `true` and `false`. - To store objects in C++, a type is defined by the template parameter @a - BooleanType which chooses the type to use. + To store objects in C++, a type is defined by the template parameter @a + BooleanType which chooses the type to use. - #### Default type + #### Default type - With the default values for @a BooleanType (`bool`), the default value for - @a boolean_t is: + With the default values for @a BooleanType (`bool`), the default value for + @a boolean_t is: - @code {.cpp} - bool - @endcode + @code {.cpp} + bool + @endcode - #### Storage + #### Storage - Boolean values are stored directly inside a @ref basic_json type. + Boolean values are stored directly inside a @ref basic_json type. - @since version 1.0.0 - */ + @since version 1.0.0 + */ using boolean_t = BooleanType; /*! - @brief a type for a number (integer) + @brief a type for a number (integer) - [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: - > The representation of numbers is similar to that used in most - > programming languages. A number is represented in base 10 using decimal - > digits. It contains an integer component that may be prefixed with an - > optional minus sign, which may be followed by a fraction part and/or an - > exponent part. Leading zeros are not allowed. (...) Numeric values that - > cannot be represented in the grammar below (such as Infinity and NaN) - > are not permitted. + [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: + > The representation of numbers is similar to that used in most + > programming languages. A number is represented in base 10 using decimal + > digits. It contains an integer component that may be prefixed with an + > optional minus sign, which may be followed by a fraction part and/or an + > exponent part. Leading zeros are not allowed. (...) Numeric values that + > cannot be represented in the grammar below (such as Infinity and NaN) + > are not permitted. - This description includes both integer and floating-point numbers. - However, C++ allows more precise storage if it is known whether the number - is a signed integer, an unsigned integer or a floating-point number. - Therefore, three different types, @ref number_integer_t, @ref - number_unsigned_t and @ref number_float_t are used. + This description includes both integer and floating-point numbers. + However, C++ allows more precise storage if it is known whether the number + is a signed integer, an unsigned integer or a floating-point number. + Therefore, three different types, @ref number_integer_t, @ref + number_unsigned_t and @ref number_float_t are used. - To store integer numbers in C++, a type is defined by the template - parameter @a NumberIntegerType which chooses the type to use. + To store integer numbers in C++, a type is defined by the template + parameter @a NumberIntegerType which chooses the type to use. - #### Default type + #### Default type - With the default values for @a NumberIntegerType (`int64_t`), the default - value for @a number_integer_t is: + With the default values for @a NumberIntegerType (`int64_t`), the default + value for @a number_integer_t is: - @code {.cpp} - int64_t - @endcode + @code {.cpp} + int64_t + @endcode - #### Default behavior + #### Default behavior - - The restrictions about leading zeros is not enforced in C++. Instead, - leading zeros in integer literals lead to an interpretation as octal - number. Internally, the value will be stored as decimal number. For - instance, the C++ integer literal `010` will be serialized to `8`. - During deserialization, leading zeros yield an error. - - Not-a-number (NaN) values will be serialized to `null`. + - The restrictions about leading zeros is not enforced in C++. Instead, + leading zeros in integer literals lead to an interpretation as octal + number. Internally, the value will be stored as decimal number. For + instance, the C++ integer literal `010` will be serialized to `8`. + During deserialization, leading zeros yield an error. + - Not-a-number (NaN) values will be serialized to `null`. - #### Limits + #### Limits - [RFC 7159](http://rfc7159.net/rfc7159) specifies: - > An implementation may set limits on the range and precision of numbers. + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the range and precision of numbers. - When the default type is used, the maximal integer number that can be - stored is `9223372036854775807` (INT64_MAX) and the minimal integer number - that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers - that are out of range will yield over/underflow when used in a - constructor. During deserialization, too large or small integer numbers - will be automatically be stored as @ref number_unsigned_t or @ref - number_float_t. + When the default type is used, the maximal integer number that can be + stored is `9223372036854775807` (INT64_MAX) and the minimal integer number + that can be stored is `-9223372036854775808` (INT64_MIN). Integer numbers + that are out of range will yield over/underflow when used in a + constructor. During deserialization, too large or small integer numbers + will be automatically be stored as @ref number_unsigned_t or @ref + number_float_t. - [RFC 7159](http://rfc7159.net/rfc7159) further states: - > Note that when such software is used, numbers that are integers and are - > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense - > that implementations will agree exactly on their numeric values. + [RFC 7159](http://rfc7159.net/rfc7159) further states: + > Note that when such software is used, numbers that are integers and are + > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense + > that implementations will agree exactly on their numeric values. - As this range is a subrange of the exactly supported range [INT64_MIN, - INT64_MAX], this class's integer type is interoperable. + As this range is a subrange of the exactly supported range [INT64_MIN, + INT64_MAX], this class's integer type is interoperable. - #### Storage + #### Storage - Integer number values are stored directly inside a @ref basic_json type. + Integer number values are stored directly inside a @ref basic_json type. - @sa @ref number_float_t -- type for number values (floating-point) + @sa @ref number_float_t -- type for number values (floating-point) - @sa @ref number_unsigned_t -- type for number values (unsigned integer) + @sa @ref number_unsigned_t -- type for number values (unsigned integer) - @since version 1.0.0 - */ + @since version 1.0.0 + */ using number_integer_t = NumberIntegerType; /*! - @brief a type for a number (unsigned) + @brief a type for a number (unsigned) - [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: - > The representation of numbers is similar to that used in most - > programming languages. A number is represented in base 10 using decimal - > digits. It contains an integer component that may be prefixed with an - > optional minus sign, which may be followed by a fraction part and/or an - > exponent part. Leading zeros are not allowed. (...) Numeric values that - > cannot be represented in the grammar below (such as Infinity and NaN) - > are not permitted. + [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: + > The representation of numbers is similar to that used in most + > programming languages. A number is represented in base 10 using decimal + > digits. It contains an integer component that may be prefixed with an + > optional minus sign, which may be followed by a fraction part and/or an + > exponent part. Leading zeros are not allowed. (...) Numeric values that + > cannot be represented in the grammar below (such as Infinity and NaN) + > are not permitted. - This description includes both integer and floating-point numbers. - However, C++ allows more precise storage if it is known whether the number - is a signed integer, an unsigned integer or a floating-point number. - Therefore, three different types, @ref number_integer_t, @ref - number_unsigned_t and @ref number_float_t are used. + This description includes both integer and floating-point numbers. + However, C++ allows more precise storage if it is known whether the number + is a signed integer, an unsigned integer or a floating-point number. + Therefore, three different types, @ref number_integer_t, @ref + number_unsigned_t and @ref number_float_t are used. - To store unsigned integer numbers in C++, a type is defined by the - template parameter @a NumberUnsignedType which chooses the type to use. + To store unsigned integer numbers in C++, a type is defined by the + template parameter @a NumberUnsignedType which chooses the type to use. - #### Default type + #### Default type - With the default values for @a NumberUnsignedType (`uint64_t`), the - default value for @a number_unsigned_t is: + With the default values for @a NumberUnsignedType (`uint64_t`), the + default value for @a number_unsigned_t is: - @code {.cpp} - uint64_t - @endcode + @code {.cpp} + uint64_t + @endcode - #### Default behavior + #### Default behavior - - The restrictions about leading zeros is not enforced in C++. Instead, - leading zeros in integer literals lead to an interpretation as octal - number. Internally, the value will be stored as decimal number. For - instance, the C++ integer literal `010` will be serialized to `8`. - During deserialization, leading zeros yield an error. - - Not-a-number (NaN) values will be serialized to `null`. + - The restrictions about leading zeros is not enforced in C++. Instead, + leading zeros in integer literals lead to an interpretation as octal + number. Internally, the value will be stored as decimal number. For + instance, the C++ integer literal `010` will be serialized to `8`. + During deserialization, leading zeros yield an error. + - Not-a-number (NaN) values will be serialized to `null`. - #### Limits + #### Limits - [RFC 7159](http://rfc7159.net/rfc7159) specifies: - > An implementation may set limits on the range and precision of numbers. + [RFC 7159](http://rfc7159.net/rfc7159) specifies: + > An implementation may set limits on the range and precision of numbers. - When the default type is used, the maximal integer number that can be - stored is `18446744073709551615` (UINT64_MAX) and the minimal integer - number that can be stored is `0`. Integer numbers that are out of range - will yield over/underflow when used in a constructor. During - deserialization, too large or small integer numbers will be automatically - be stored as @ref number_integer_t or @ref number_float_t. + When the default type is used, the maximal integer number that can be + stored is `18446744073709551615` (UINT64_MAX) and the minimal integer + number that can be stored is `0`. Integer numbers that are out of range + will yield over/underflow when used in a constructor. During + deserialization, too large or small integer numbers will be automatically + be stored as @ref number_integer_t or @ref number_float_t. - [RFC 7159](http://rfc7159.net/rfc7159) further states: - > Note that when such software is used, numbers that are integers and are - > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense - > that implementations will agree exactly on their numeric values. + [RFC 7159](http://rfc7159.net/rfc7159) further states: + > Note that when such software is used, numbers that are integers and are + > in the range \f$[-2^{53}+1, 2^{53}-1]\f$ are interoperable in the sense + > that implementations will agree exactly on their numeric values. - As this range is a subrange (when considered in conjunction with the - number_integer_t type) of the exactly supported range [0, UINT64_MAX], - this class's integer type is interoperable. + As this range is a subrange (when considered in conjunction with the + number_integer_t type) of the exactly supported range [0, UINT64_MAX], + this class's integer type is interoperable. - #### Storage + #### Storage - Integer number values are stored directly inside a @ref basic_json type. + Integer number values are stored directly inside a @ref basic_json type. - @sa @ref number_float_t -- type for number values (floating-point) - @sa @ref number_integer_t -- type for number values (integer) + @sa @ref number_float_t -- type for number values (floating-point) + @sa @ref number_integer_t -- type for number values (integer) - @since version 2.0.0 - */ + @since version 2.0.0 + */ using number_unsigned_t = NumberUnsignedType; /*! - @brief a type for a number (floating-point) + @brief a type for a number (floating-point) - [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: - > The representation of numbers is similar to that used in most - > programming languages. A number is represented in base 10 using decimal - > digits. It contains an integer component that may be prefixed with an - > optional minus sign, which may be followed by a fraction part and/or an - > exponent part. Leading zeros are not allowed. (...) Numeric values that - > cannot be represented in the grammar below (such as Infinity and NaN) - > are not permitted. + [RFC 7159](http://rfc7159.net/rfc7159) describes numbers as follows: + > The representation of numbers is similar to that used in most + > programming languages. A number is represented in base 10 using decimal + > digits. It contains an integer component that may be prefixed with an + > optional minus sign, which may be followed by a fraction part and/or an + > exponent part. Leading zeros are not allowed. (...) Numeric values that + > cannot be represented in the grammar below (such as Infinity and NaN) + > are not permitted. - This description includes both integer and floating-point numbers. - However, C++ allows more precise storage if it is known whether the number - is a signed integer, an unsigned integer or a floating-point number. - Therefore, three different types, @ref number_integer_t, @ref - number_unsigned_t and @ref number_float_t are used. + This description includes both integer and floating-point numbers. + However, C++ allows more precise storage if it is known whether the number + is a signed integer, an unsigned integer or a floating-point number. + Therefore, three different types, @ref number_integer_t, @ref + number_unsigned_t and @ref number_float_t are used. - To store floating-point numbers in C++, a type is defined by the template - parameter @a NumberFloatType which chooses the type to use. + To store floating-point numbers in C++, a type is defined by the template + parameter @a NumberFloatType which chooses the type to use. - #### Default type + #### Default type - With the default values for @a NumberFloatType (`double`), the default - value for @a number_float_t is: + With the default values for @a NumberFloatType (`double`), the default + value for @a number_float_t is: - @code {.cpp} - double - @endcode + @code {.cpp} + double + @endcode - #### Default behavior + #### Default behavior - - The restrictions about leading zeros is not enforced in C++. Instead, - leading zeros in floating-point literals will be ignored. Internally, - the value will be stored as decimal number. For instance, the C++ - floating-point literal `01.2` will be serialized to `1.2`. During - deserialization, leading zeros yield an error. - - Not-a-number (NaN) values will be serialized to `null`. + - The restrictions about leading zeros is not enforced in C++. Instead, + leading zeros in floating-point literals will be ignored. Internally, + the value will be stored as decimal number. For instance, the C++ + floating-point literal `01.2` will be serialized to `1.2`. During + deserialization, leading zeros yield an error. + - Not-a-number (NaN) values will be serialized to `null`. - #### Limits + #### Limits - [RFC 7159](http://rfc7159.net/rfc7159) states: - > This specification allows implementations to set limits on the range and - > precision of numbers accepted. Since software that implements IEEE - > 754-2008 binary64 (double precision) numbers is generally available and - > widely used, good interoperability can be achieved by implementations - > that expect no more precision or range than these provide, in the sense - > that implementations will approximate JSON numbers within the expected - > precision. + [RFC 7159](http://rfc7159.net/rfc7159) states: + > This specification allows implementations to set limits on the range and + > precision of numbers accepted. Since software that implements IEEE + > 754-2008 binary64 (double precision) numbers is generally available and + > widely used, good interoperability can be achieved by implementations + > that expect no more precision or range than these provide, in the sense + > that implementations will approximate JSON numbers within the expected + > precision. - This implementation does exactly follow this approach, as it uses double - precision floating-point numbers. Note values smaller than - `-1.79769313486232e+308` and values greater than `1.79769313486232e+308` - will be stored as NaN internally and be serialized to `null`. + This implementation does exactly follow this approach, as it uses double + precision floating-point numbers. Note values smaller than + `-1.79769313486232e+308` and values greater than `1.79769313486232e+308` + will be stored as NaN internally and be serialized to `null`. - #### Storage + #### Storage - Floating-point number values are stored directly inside a @ref basic_json - type. + Floating-point number values are stored directly inside a @ref basic_json + type. - @sa @ref number_integer_t -- type for number values (integer) + @sa @ref number_integer_t -- type for number values (integer) - @sa @ref number_unsigned_t -- type for number values (unsigned integer) + @sa @ref number_unsigned_t -- type for number values (unsigned integer) - @since version 1.0.0 - */ + @since version 1.0.0 + */ using number_float_t = NumberFloatType; /*! - @brief a type for a packed binary type + @brief a type for a packed binary type - This type is a type designed to carry binary data that appears in various - serialized formats, such as CBOR's Major Type 2, MessagePack's bin, and - BSON's generic binary subtype. This type is NOT a part of standard JSON and - exists solely for compatibility with these binary types. As such, it is - simply defined as an ordered sequence of zero or more byte values. + This type is a type designed to carry binary data that appears in various + serialized formats, such as CBOR's Major Type 2, MessagePack's bin, and + BSON's generic binary subtype. This type is NOT a part of standard JSON and + exists solely for compatibility with these binary types. As such, it is + simply defined as an ordered sequence of zero or more byte values. - Additionally, as an implementation detail, the subtype of the binary data is - carried around as a `std::uint8_t`, which is compatible with both of the - binary data formats that use binary subtyping, (though the specific - numbering is incompatible with each other, and it is up to the user to - translate between them). + Additionally, as an implementation detail, the subtype of the binary data is + carried around as a `std::uint8_t`, which is compatible with both of the + binary data formats that use binary subtyping, (though the specific + numbering is incompatible with each other, and it is up to the user to + translate between them). - [CBOR's RFC 7049](https://tools.ietf.org/html/rfc7049) describes this type - as: - > Major type 2: a byte string. The string's length in bytes is represented - > following the rules for positive integers (major type 0). + [CBOR's RFC 7049](https://tools.ietf.org/html/rfc7049) describes this type + as: + > Major type 2: a byte string. The string's length in bytes is represented + > following the rules for positive integers (major type 0). - [MessagePack's documentation on the bin type - family](https://github.com/msgpack/msgpack/blob/master/spec.md#bin-format-family) - describes this type as: - > Bin format family stores an byte array in 2, 3, or 5 bytes of extra bytes - > in addition to the size of the byte array. + [MessagePack's documentation on the bin type + family](https://github.com/msgpack/msgpack/blob/master/spec.md#bin-format-family) + describes this type as: + > Bin format family stores an byte array in 2, 3, or 5 bytes of extra bytes + > in addition to the size of the byte array. - [BSON's specifications](http://bsonspec.org/spec.html) describe several - binary types; however, this type is intended to represent the generic binary - type which has the description: - > Generic binary subtype - This is the most commonly used binary subtype and - > should be the 'default' for drivers and tools. + [BSON's specifications](http://bsonspec.org/spec.html) describe several + binary types; however, this type is intended to represent the generic binary + type which has the description: + > Generic binary subtype - This is the most commonly used binary subtype and + > should be the 'default' for drivers and tools. - None of these impose any limitations on the internal representation other - than the basic unit of storage be some type of array whose parts are - decomposable into bytes. + None of these impose any limitations on the internal representation other + than the basic unit of storage be some type of array whose parts are + decomposable into bytes. - The default representation of this binary format is a - `std::vector`, which is a very common way to represent a byte - array in modern C++. + The default representation of this binary format is a + `std::vector`, which is a very common way to represent a byte + array in modern C++. - #### Default type + #### Default type - The default values for @a BinaryType is `std::vector` + The default values for @a BinaryType is `std::vector` - #### Storage + #### Storage - Binary Arrays are stored as pointers in a @ref basic_json type. That is, - for any access to array values, a pointer of the type `binary_t*` must be - dereferenced. + Binary Arrays are stored as pointers in a @ref basic_json type. That is, + for any access to array values, a pointer of the type `binary_t*` must be + dereferenced. - #### Notes on subtypes + #### Notes on subtypes - - CBOR + - CBOR - Binary values are represented as byte strings. No subtypes are supported and will be ignored when CBOR is written. - - MessagePack + - MessagePack - If a subtype is given and the binary array contains exactly 1, 2, 4, 8, or 16 elements, the fixext family (fixext1, fixext2, fixext4, fixext8) is used. For other sizes, the ext family (ext8, ext16, ext32) is used. The subtype is then added as singed 8-bit integer. - If no subtype is given, the bin family (bin8, bin16, bin32) is used. - - BSON + - BSON - If a subtype is given, it is used and added as unsigned 8-bit integer. - If no subtype is given, the generic binary subtype 0x00 is used. - @sa @ref binary -- create a binary array + @sa @ref binary -- create a binary array - @since version 3.8.0 - */ + @since version 3.8.0 + */ using binary_t = nlohmann::byte_container_with_subtype; /// @} - private: +private: /// helper for exception-safe object creation - template + template JSON_HEDLEY_RETURNS_NON_NULL - static T* create(Args&& ... args) + static T* create( + Args&& ... args) { AllocatorType alloc; using AllocatorTraits = std::allocator_traits>; - auto deleter = [&](T * object) - { - AllocatorTraits::deallocate(alloc, object, 1); - }; + auto deleter = [&](T* object) + { + AllocatorTraits::deallocate(alloc, object, 1); + }; std::unique_ptr object(AllocatorTraits::allocate(alloc, 1), deleter); AllocatorTraits::construct(alloc, object.get(), std::forward(args)...); JSON_ASSERT(object != nullptr); @@ -17503,32 +18932,32 @@ class basic_json // JSON value storage // //////////////////////// - JSON_PRIVATE_UNLESS_TESTED: +JSON_PRIVATE_UNLESS_TESTED: /*! - @brief a JSON value + @brief a JSON value - The actual storage for a JSON value of the @ref basic_json class. This - union combines the different storage types for the JSON value types - defined in @ref value_t. + The actual storage for a JSON value of the @ref basic_json class. This + union combines the different storage types for the JSON value types + defined in @ref value_t. - JSON type | value_t type | used type - --------- | --------------- | ------------------------ - object | object | pointer to @ref object_t - array | array | pointer to @ref array_t - string | string | pointer to @ref string_t - boolean | boolean | @ref boolean_t - number | number_integer | @ref number_integer_t - number | number_unsigned | @ref number_unsigned_t - number | number_float | @ref number_float_t - binary | binary | pointer to @ref binary_t - null | null | *no value is stored* + JSON type | value_t type | used type + --------- | --------------- | ------------------------ + object | object | pointer to @ref object_t + array | array | pointer to @ref array_t + string | string | pointer to @ref string_t + boolean | boolean | @ref boolean_t + number | number_integer | @ref number_integer_t + number | number_unsigned | @ref number_unsigned_t + number | number_float | @ref number_float_t + binary | binary | pointer to @ref binary_t + null | null | *no value is stored* - @note Variable-length types (objects, arrays, and strings) are stored as - pointers. The size of the union should not exceed 64 bits if the default - value types are used. + @note Variable-length types (objects, arrays, and strings) are stored as + pointers. The size of the union should not exceed 64 bits if the default + value types are used. - @since version 1.0.0 - */ + @since version 1.0.0 + */ union json_value { /// object (stored with pointer to save storage) @@ -17551,13 +18980,17 @@ class basic_json /// default constructor (for null values) json_value() = default; /// constructor for booleans - json_value(boolean_t v) noexcept : boolean(v) {} + json_value(boolean_t v) noexcept : boolean(v) { + } /// constructor for numbers (integer) - json_value(number_integer_t v) noexcept : number_integer(v) {} + json_value(number_integer_t v) noexcept : number_integer(v) { + } /// constructor for numbers (unsigned) - json_value(number_unsigned_t v) noexcept : number_unsigned(v) {} + json_value(number_unsigned_t v) noexcept : number_unsigned(v) { + } /// constructor for numbers (floating-point) - json_value(number_float_t v) noexcept : number_float(v) {} + json_value(number_float_t v) noexcept : number_float(v) { + } /// constructor for empty values of a given type json_value(value_t t) { @@ -17636,7 +19069,7 @@ class basic_json } /// constructor for rvalue strings - json_value(string_t&& value) + json_value(string_t && value) { string = create(std::move(value)); } @@ -17648,7 +19081,7 @@ class basic_json } /// constructor for rvalue objects - json_value(object_t&& value) + json_value(object_t && value) { object = create(std::move(value)); } @@ -17660,7 +19093,7 @@ class basic_json } /// constructor for rvalue arrays - json_value(array_t&& value) + json_value(array_t && value) { array = create(std::move(value)); } @@ -17672,7 +19105,7 @@ class basic_json } /// constructor for rvalue binary arrays - json_value(typename binary_t::container_type&& value) + json_value(typename binary_t::container_type && value) { binary = create(std::move(value)); } @@ -17684,12 +19117,13 @@ class basic_json } /// constructor for rvalue binary arrays (internal type) - json_value(binary_t&& value) + json_value(binary_t && value) { binary = create(std::move(value)); } - void destroy(value_t t) noexcept + void destroy( + value_t t) noexcept { // flatten the current json_value to a heap-allocated stack std::vector stack; @@ -17720,7 +19154,7 @@ class basic_json if (current_item.is_array()) { std::move(current_item.m_value.array->begin(), current_item.m_value.array->end(), - std::back_inserter(stack)); + std::back_inserter(stack)); current_item.m_value.array->clear(); } @@ -17778,18 +19212,20 @@ class basic_json } } } + }; - private: +private: + /*! - @brief checks the class invariants + @brief checks the class invariants - This function asserts the class invariants. It needs to be called at the - end of every constructor to make sure that created objects respect the - invariant. Furthermore, it has to be called each time the type of a JSON - value is changed, because the invariant expresses a relationship between - @a m_type and @a m_value. - */ + This function asserts the class invariants. It needs to be called at the + end of every constructor to make sure that created objects respect the + invariant. Furthermore, it has to be called each time the type of a JSON + value is changed, because the invariant expresses a relationship between + @a m_type and @a m_value. + */ void assert_invariant() const noexcept { JSON_ASSERT(m_type != value_t::object || m_value.object != nullptr); @@ -17798,77 +19234,78 @@ class basic_json JSON_ASSERT(m_type != value_t::binary || m_value.binary != nullptr); } - public: +public: + ////////////////////////// // JSON parser callback // ////////////////////////// /*! - @brief parser event types + @brief parser event types - The parser callback distinguishes the following events: - - `object_start`: the parser read `{` and started to process a JSON object - - `key`: the parser read a key of a value in an object - - `object_end`: the parser read `}` and finished processing a JSON object - - `array_start`: the parser read `[` and started to process a JSON array - - `array_end`: the parser read `]` and finished processing a JSON array - - `value`: the parser finished reading a JSON value + The parser callback distinguishes the following events: + - `object_start`: the parser read `{` and started to process a JSON object + - `key`: the parser read a key of a value in an object + - `object_end`: the parser read `}` and finished processing a JSON object + - `array_start`: the parser read `[` and started to process a JSON array + - `array_end`: the parser read `]` and finished processing a JSON array + - `value`: the parser finished reading a JSON value - @image html callback_events.png "Example when certain parse events are triggered" + @image html callback_events.png "Example when certain parse events are triggered" - @sa @ref parser_callback_t for more information and examples - */ + @sa @ref parser_callback_t for more information and examples + */ using parse_event_t = detail::parse_event_t; /*! - @brief per-element parser callback type + @brief per-element parser callback type - With a parser callback function, the result of parsing a JSON text can be - influenced. When passed to @ref parse, it is called on certain events - (passed as @ref parse_event_t via parameter @a event) with a set recursion - depth @a depth and context JSON value @a parsed. The return value of the - callback function is a boolean indicating whether the element that emitted - the callback shall be kept or not. + With a parser callback function, the result of parsing a JSON text can be + influenced. When passed to @ref parse, it is called on certain events + (passed as @ref parse_event_t via parameter @a event) with a set recursion + depth @a depth and context JSON value @a parsed. The return value of the + callback function is a boolean indicating whether the element that emitted + the callback shall be kept or not. - We distinguish six scenarios (determined by the event type) in which the - callback function can be called. The following table describes the values - of the parameters @a depth, @a event, and @a parsed. + We distinguish six scenarios (determined by the event type) in which the + callback function can be called. The following table describes the values + of the parameters @a depth, @a event, and @a parsed. - parameter @a event | description | parameter @a depth | parameter @a parsed - ------------------ | ----------- | ------------------ | ------------------- - parse_event_t::object_start | the parser read `{` and started to process a JSON object | depth of the parent of the JSON object | a JSON value with type discarded - parse_event_t::key | the parser read a key of a value in an object | depth of the currently parsed JSON object | a JSON string containing the key - parse_event_t::object_end | the parser read `}` and finished processing a JSON object | depth of the parent of the JSON object | the parsed JSON object - parse_event_t::array_start | the parser read `[` and started to process a JSON array | depth of the parent of the JSON array | a JSON value with type discarded - parse_event_t::array_end | the parser read `]` and finished processing a JSON array | depth of the parent of the JSON array | the parsed JSON array - parse_event_t::value | the parser finished reading a JSON value | depth of the value | the parsed JSON value + parameter @a event | description | parameter @a depth | parameter @a parsed + ------------------ | ----------- | ------------------ | ------------------- + parse_event_t::object_start | the parser read `{` and started to process a JSON object | depth of the parent of the JSON object | a JSON value with type discarded + parse_event_t::key | the parser read a key of a value in an object | depth of the currently parsed JSON object | a JSON string containing the key + parse_event_t::object_end | the parser read `}` and finished processing a JSON object | depth of the parent of the JSON object | the parsed JSON object + parse_event_t::array_start | the parser read `[` and started to process a JSON array | depth of the parent of the JSON array | a JSON value with type discarded + parse_event_t::array_end | the parser read `]` and finished processing a JSON array | depth of the parent of the JSON array | the parsed JSON array + parse_event_t::value | the parser finished reading a JSON value | depth of the value | the parsed JSON value - @image html callback_events.png "Example when certain parse events are triggered" + @image html callback_events.png "Example when certain parse events are triggered" - Discarding a value (i.e., returning `false`) has different effects - depending on the context in which function was called: + Discarding a value (i.e., returning `false`) has different effects + depending on the context in which function was called: - - Discarded values in structured types are skipped. That is, the parser - will behave as if the discarded value was never read. - - In case a value outside a structured type is skipped, it is replaced - with `null`. This case happens if the top-level element is skipped. + - Discarded values in structured types are skipped. That is, the parser + will behave as if the discarded value was never read. + - In case a value outside a structured type is skipped, it is replaced + with `null`. This case happens if the top-level element is skipped. - @param[in] depth the depth of the recursion during parsing + @param[in] depth the depth of the recursion during parsing - @param[in] event an event of type parse_event_t indicating the context in - the callback function has been called + @param[in] event an event of type parse_event_t indicating the context in + the callback function has been called - @param[in,out] parsed the current intermediate parse result; note that - writing to this value has no effect for parse_event_t::key events + @param[in,out] parsed the current intermediate parse result; note that + writing to this value has no effect for parse_event_t::key events - @return Whether the JSON value which called the function during parsing - should be kept (`true`) or not (`false`). In the latter case, it is either - skipped completely or replaced by an empty discarded object. + @return Whether the JSON value which called the function during parsing + should be kept (`true`) or not (`false`). In the latter case, it is either + skipped completely or replaced by an empty discarded object. - @sa @ref parse for examples + @sa @ref parse for examples - @since version 1.0.0 - */ + @since version 1.0.0 + */ using parser_callback_t = detail::parser_callback_t; ////////////////// @@ -17881,170 +19318,176 @@ class basic_json /// @{ /*! - @brief create an empty value with a given type + @brief create an empty value with a given type - Create an empty JSON value with a given type. The value will be default - initialized with an empty value which depends on the type: + Create an empty JSON value with a given type. The value will be default + initialized with an empty value which depends on the type: - Value type | initial value - ----------- | ------------- - null | `null` - boolean | `false` - string | `""` - number | `0` - object | `{}` - array | `[]` - binary | empty array + Value type | initial value + ----------- | ------------- + null | `null` + boolean | `false` + string | `""` + number | `0` + object | `{}` + array | `[]` + binary | empty array - @param[in] v the type of the value to create + @param[in] v the type of the value to create - @complexity Constant. + @complexity Constant. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes to any JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. - @liveexample{The following code shows the constructor for different @ref - value_t values,basic_json__value_t} + @liveexample{The following code shows the constructor for different @ref + value_t values,basic_json__value_t} - @sa @ref clear() -- restores the postcondition of this constructor + @sa @ref clear() -- restores the postcondition of this constructor - @since version 1.0.0 - */ - basic_json(const value_t v) - : m_type(v), m_value(v) + @since version 1.0.0 + */ + basic_json( + const value_t v) + : m_type(v) + , m_value(v) { assert_invariant(); } /*! - @brief create a null object + @brief create a null object - Create a `null` JSON value. It either takes a null pointer as parameter - (explicitly creating `null`) or no parameter (implicitly creating `null`). - The passed null pointer itself is not read -- it is only used to choose - the right constructor. + Create a `null` JSON value. It either takes a null pointer as parameter + (explicitly creating `null`) or no parameter (implicitly creating `null`). + The passed null pointer itself is not read -- it is only used to choose + the right constructor. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this constructor never throws - exceptions. + @exceptionsafety No-throw guarantee: this constructor never throws + exceptions. - @liveexample{The following code shows the constructor with and without a - null pointer parameter.,basic_json__nullptr_t} + @liveexample{The following code shows the constructor with and without a + null pointer parameter.,basic_json__nullptr_t} - @since version 1.0.0 - */ - basic_json(std::nullptr_t = nullptr) noexcept + @since version 1.0.0 + */ + basic_json( + std::nullptr_t = nullptr) noexcept : basic_json(value_t::null) { assert_invariant(); } /*! - @brief create a JSON value - - This is a "catch all" constructor for all compatible JSON types; that is, - types for which a `to_json()` method exists. The constructor forwards the - parameter @a val to that method (to `json_serializer::to_json` method - with `U = uncvref_t`, to be exact). - - Template type @a CompatibleType includes, but is not limited to, the - following types: - - **arrays**: @ref array_t and all kinds of compatible containers such as - `std::vector`, `std::deque`, `std::list`, `std::forward_list`, - `std::array`, `std::valarray`, `std::set`, `std::unordered_set`, - `std::multiset`, and `std::unordered_multiset` with a `value_type` from - which a @ref basic_json value can be constructed. - - **objects**: @ref object_t and all kinds of compatible associative - containers such as `std::map`, `std::unordered_map`, `std::multimap`, - and `std::unordered_multimap` with a `key_type` compatible to - @ref string_t and a `value_type` from which a @ref basic_json value can - be constructed. - - **strings**: @ref string_t, string literals, and all compatible string - containers can be used. - - **numbers**: @ref number_integer_t, @ref number_unsigned_t, - @ref number_float_t, and all convertible number types such as `int`, - `size_t`, `int64_t`, `float` or `double` can be used. - - **boolean**: @ref boolean_t / `bool` can be used. - - **binary**: @ref binary_t / `std::vector` may be used, - unfortunately because string literals cannot be distinguished from binary - character arrays by the C++ type system, all types compatible with `const - char*` will be directed to the string constructor instead. This is both - for backwards compatibility, and due to the fact that a binary type is not - a standard JSON type. - - See the examples below. - - @tparam CompatibleType a type such that: - - @a CompatibleType is not derived from `std::istream`, - - @a CompatibleType is not @ref basic_json (to avoid hijacking copy/move + @brief create a JSON value + + This is a "catch all" constructor for all compatible JSON types; that is, + types for which a `to_json()` method exists. The constructor forwards the + parameter @a val to that method (to `json_serializer::to_json` method + with `U = uncvref_t`, to be exact). + + Template type @a CompatibleType includes, but is not limited to, the + following types: + - **arrays**: @ref array_t and all kinds of compatible containers such as + `std::vector`, `std::deque`, `std::list`, `std::forward_list`, + `std::array`, `std::valarray`, `std::set`, `std::unordered_set`, + `std::multiset`, and `std::unordered_multiset` with a `value_type` from + which a @ref basic_json value can be constructed. + - **objects**: @ref object_t and all kinds of compatible associative + containers such as `std::map`, `std::unordered_map`, `std::multimap`, + and `std::unordered_multimap` with a `key_type` compatible to + @ref string_t and a `value_type` from which a @ref basic_json value can + be constructed. + - **strings**: @ref string_t, string literals, and all compatible string + containers can be used. + - **numbers**: @ref number_integer_t, @ref number_unsigned_t, + @ref number_float_t, and all convertible number types such as `int`, + `size_t`, `int64_t`, `float` or `double` can be used. + - **boolean**: @ref boolean_t / `bool` can be used. + - **binary**: @ref binary_t / `std::vector` may be used, + unfortunately because string literals cannot be distinguished from binary + character arrays by the C++ type system, all types compatible with `const + char*` will be directed to the string constructor instead. This is both + for backwards compatibility, and due to the fact that a binary type is not + a standard JSON type. + + See the examples below. + + @tparam CompatibleType a type such that: + - @a CompatibleType is not derived from `std::istream`, + - @a CompatibleType is not @ref basic_json (to avoid hijacking copy/move constructors), - - @a CompatibleType is not a different @ref basic_json type (i.e. with different template arguments) - - @a CompatibleType is not a @ref basic_json nested type (e.g., + - @a CompatibleType is not a different @ref basic_json type (i.e. with different template arguments) + - @a CompatibleType is not a @ref basic_json nested type (e.g., @ref json_pointer, @ref iterator, etc ...) - - @ref @ref json_serializer has a + - @ref @ref json_serializer has a `to_json(basic_json_t&, CompatibleType&&)` method - @tparam U = `uncvref_t` + @tparam U = `uncvref_t` - @param[in] val the value to be forwarded to the respective constructor + @param[in] val the value to be forwarded to the respective constructor - @complexity Usually linear in the size of the passed @a val, also + @complexity Usually linear in the size of the passed @a val, also depending on the implementation of the called `to_json()` method. - @exceptionsafety Depends on the called constructor. For types directly - supported by the library (i.e., all types for which no `to_json()` function - was provided), strong guarantee holds: if an exception is thrown, there are - no changes to any JSON value. + @exceptionsafety Depends on the called constructor. For types directly + supported by the library (i.e., all types for which no `to_json()` function + was provided), strong guarantee holds: if an exception is thrown, there are + no changes to any JSON value. - @liveexample{The following code shows the constructor with several - compatible types.,basic_json__CompatibleType} + @liveexample{The following code shows the constructor with several + compatible types.,basic_json__CompatibleType} - @since version 2.1.0 - */ + @since version 2.1.0 + */ template < typename CompatibleType, - typename U = detail::uncvref_t, - detail::enable_if_t < - !detail::is_basic_json::value && detail::is_compatible_type::value, int > = 0 > - basic_json(CompatibleType && val) noexcept(noexcept( - JSONSerializer::to_json(std::declval(), - std::forward(val)))) + typename U = detail::uncvref_t, + detail::enable_if_t < + !detail::is_basic_json::value && detail::is_compatible_type::value, int > = 0 > + basic_json( + CompatibleType&& val) noexcept(noexcept( + JSONSerializer::to_json(std::declval(), + std::forward(val)))) { JSONSerializer::to_json(*this, std::forward(val)); assert_invariant(); } /*! - @brief create a JSON value from an existing one + @brief create a JSON value from an existing one - This is a constructor for existing @ref basic_json types. - It does not hijack copy/move constructors, since the parameter has different - template arguments than the current ones. + This is a constructor for existing @ref basic_json types. + It does not hijack copy/move constructors, since the parameter has different + template arguments than the current ones. - The constructor tries to convert the internal @ref m_value of the parameter. + The constructor tries to convert the internal @ref m_value of the parameter. - @tparam BasicJsonType a type such that: - - @a BasicJsonType is a @ref basic_json type. - - @a BasicJsonType has different template arguments than @ref basic_json_t. + @tparam BasicJsonType a type such that: + - @a BasicJsonType is a @ref basic_json type. + - @a BasicJsonType has different template arguments than @ref basic_json_t. - @param[in] val the @ref basic_json value to be converted. + @param[in] val the @ref basic_json value to be converted. - @complexity Usually linear in the size of the passed @a val, also + @complexity Usually linear in the size of the passed @a val, also depending on the implementation of the called `to_json()` method. - @exceptionsafety Depends on the called constructor. For types directly - supported by the library (i.e., all types for which no `to_json()` function - was provided), strong guarantee holds: if an exception is thrown, there are - no changes to any JSON value. + @exceptionsafety Depends on the called constructor. For types directly + supported by the library (i.e., all types for which no `to_json()` function + was provided), strong guarantee holds: if an exception is thrown, there are + no changes to any JSON value. - @since version 3.2.0 - */ + @since version 3.2.0 + */ template < typename BasicJsonType, - detail::enable_if_t < - detail::is_basic_json::value&& !std::is_same::value, int > = 0 > - basic_json(const BasicJsonType& val) + detail::enable_if_t < + detail::is_basic_json::value && !std::is_same::value, + int > = 0 > + basic_json( + const BasicJsonType& val) { using other_boolean_t = typename BasicJsonType::boolean_t; using other_number_float_t = typename BasicJsonType::number_float_t; @@ -18094,90 +19537,91 @@ class basic_json } /*! - @brief create a container (array or object) from an initializer list + @brief create a container (array or object) from an initializer list - Creates a JSON value of type array or object from the passed initializer - list @a init. In case @a type_deduction is `true` (default), the type of - the JSON value to be created is deducted from the initializer list @a init - according to the following rules: + Creates a JSON value of type array or object from the passed initializer + list @a init. In case @a type_deduction is `true` (default), the type of + the JSON value to be created is deducted from the initializer list @a init + according to the following rules: - 1. If the list is empty, an empty JSON object value `{}` is created. - 2. If the list consists of pairs whose first element is a string, a JSON + 1. If the list is empty, an empty JSON object value `{}` is created. + 2. If the list consists of pairs whose first element is a string, a JSON object value is created where the first elements of the pairs are treated as keys and the second elements are as values. - 3. In all other cases, an array is created. + 3. In all other cases, an array is created. - The rules aim to create the best fit between a C++ initializer list and - JSON values. The rationale is as follows: + The rules aim to create the best fit between a C++ initializer list and + JSON values. The rationale is as follows: - 1. The empty initializer list is written as `{}` which is exactly an empty + 1. The empty initializer list is written as `{}` which is exactly an empty JSON object. - 2. C++ has no way of describing mapped types other than to list a list of + 2. C++ has no way of describing mapped types other than to list a list of pairs. As JSON requires that keys must be of type string, rule 2 is the weakest constraint one can pose on initializer lists to interpret them as an object. - 3. In all other cases, the initializer list could not be interpreted as + 3. In all other cases, the initializer list could not be interpreted as JSON object type, so interpreting it as JSON array type is safe. - With the rules described above, the following JSON values cannot be - expressed by an initializer list: + With the rules described above, the following JSON values cannot be + expressed by an initializer list: - - the empty array (`[]`): use @ref array(initializer_list_t) - with an empty initializer list in this case - - arrays whose elements satisfy rule 2: use @ref - array(initializer_list_t) with the same initializer list - in this case + - the empty array (`[]`): use @ref array(initializer_list_t) + with an empty initializer list in this case + - arrays whose elements satisfy rule 2: use @ref + array(initializer_list_t) with the same initializer list + in this case - @note When used without parentheses around an empty initializer list, @ref - basic_json() is called instead of this function, yielding the JSON null - value. + @note When used without parentheses around an empty initializer list, @ref + basic_json() is called instead of this function, yielding the JSON null + value. - @param[in] init initializer list with JSON values + @param[in] init initializer list with JSON values - @param[in] type_deduction internal parameter; when set to `true`, the type - of the JSON value is deducted from the initializer list @a init; when set - to `false`, the type provided via @a manual_type is forced. This mode is - used by the functions @ref array(initializer_list_t) and - @ref object(initializer_list_t). + @param[in] type_deduction internal parameter; when set to `true`, the type + of the JSON value is deducted from the initializer list @a init; when set + to `false`, the type provided via @a manual_type is forced. This mode is + used by the functions @ref array(initializer_list_t) and + @ref object(initializer_list_t). - @param[in] manual_type internal parameter; when @a type_deduction is set - to `false`, the created JSON value will use the provided type (only @ref - value_t::array and @ref value_t::object are valid); when @a type_deduction - is set to `true`, this parameter has no effect + @param[in] manual_type internal parameter; when @a type_deduction is set + to `false`, the created JSON value will use the provided type (only @ref + value_t::array and @ref value_t::object are valid); when @a type_deduction + is set to `true`, this parameter has no effect - @throw type_error.301 if @a type_deduction is `false`, @a manual_type is - `value_t::object`, but @a init contains an element which is not a pair - whose first element is a string. In this case, the constructor could not - create an object. If @a type_deduction would have be `true`, an array - would have been created. See @ref object(initializer_list_t) - for an example. + @throw type_error.301 if @a type_deduction is `false`, @a manual_type is + `value_t::object`, but @a init contains an element which is not a pair + whose first element is a string. In this case, the constructor could not + create an object. If @a type_deduction would have be `true`, an array + would have been created. See @ref object(initializer_list_t) + for an example. - @complexity Linear in the size of the initializer list @a init. + @complexity Linear in the size of the initializer list @a init. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes to any JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. - @liveexample{The example below shows how JSON values are created from - initializer lists.,basic_json__list_init_t} + @liveexample{The example below shows how JSON values are created from + initializer lists.,basic_json__list_init_t} - @sa @ref array(initializer_list_t) -- create a JSON array - value from an initializer list - @sa @ref object(initializer_list_t) -- create a JSON object - value from an initializer list + @sa @ref array(initializer_list_t) -- create a JSON array + value from an initializer list + @sa @ref object(initializer_list_t) -- create a JSON object + value from an initializer list - @since version 1.0.0 - */ - basic_json(initializer_list_t init, - bool type_deduction = true, - value_t manual_type = value_t::array) + @since version 1.0.0 + */ + basic_json( + initializer_list_t init, + bool type_deduction = true, + value_t manual_type = value_t::array) { // check if each element is an array with two elements whose first // element is a string bool is_an_object = std::all_of(init.begin(), init.end(), - [](const detail::json_ref& element_ref) - { - return element_ref->is_array() && element_ref->size() == 2 && (*element_ref)[0].is_string(); - }); + [](const detail::json_ref& element_ref) + { + return element_ref->is_array() && element_ref->size() == 2 && (*element_ref)[0].is_string(); + }); // adjust type if type deduction is not wanted if (!type_deduction) @@ -18202,12 +19646,12 @@ class basic_json m_value = value_t::object; std::for_each(init.begin(), init.end(), [this](const detail::json_ref& element_ref) - { - auto element = element_ref.moved_or_copied(); - m_value.object->emplace( - std::move(*((*element.m_value.array)[0].m_value.string)), - std::move((*element.m_value.array)[1])); - }); + { + auto element = element_ref.moved_or_copied(); + m_value.object->emplace( + std::move(*((*element.m_value.array)[0].m_value.string)), + std::move((*element.m_value.array)[1])); + }); } else { @@ -18220,34 +19664,35 @@ class basic_json } /*! - @brief explicitly create a binary array (without subtype) + @brief explicitly create a binary array (without subtype) - Creates a JSON binary array value from a given binary container. Binary - values are part of various binary formats, such as CBOR, MessagePack, and - BSON. This constructor is used to create a value for serialization to those - formats. + Creates a JSON binary array value from a given binary container. Binary + values are part of various binary formats, such as CBOR, MessagePack, and + BSON. This constructor is used to create a value for serialization to those + formats. - @note Note, this function exists because of the difficulty in correctly - specifying the correct template overload in the standard value ctor, as both - JSON arrays and JSON binary arrays are backed with some form of a - `std::vector`. Because JSON binary arrays are a non-standard extension it - was decided that it would be best to prevent automatic initialization of a - binary array type, for backwards compatibility and so it does not happen on - accident. + @note Note, this function exists because of the difficulty in correctly + specifying the correct template overload in the standard value ctor, as both + JSON arrays and JSON binary arrays are backed with some form of a + `std::vector`. Because JSON binary arrays are a non-standard extension it + was decided that it would be best to prevent automatic initialization of a + binary array type, for backwards compatibility and so it does not happen on + accident. - @param[in] init container containing bytes to use as binary type + @param[in] init container containing bytes to use as binary type - @return JSON binary array value + @return JSON binary array value - @complexity Linear in the size of @a init. + @complexity Linear in the size of @a init. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes to any JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. - @since version 3.8.0 - */ + @since version 3.8.0 + */ JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json binary(const typename binary_t::container_type& init) + static basic_json binary( + const typename binary_t::container_type& init) { auto res = basic_json(); res.m_type = value_t::binary; @@ -18256,35 +19701,37 @@ class basic_json } /*! - @brief explicitly create a binary array (with subtype) + @brief explicitly create a binary array (with subtype) - Creates a JSON binary array value from a given binary container. Binary - values are part of various binary formats, such as CBOR, MessagePack, and - BSON. This constructor is used to create a value for serialization to those - formats. + Creates a JSON binary array value from a given binary container. Binary + values are part of various binary formats, such as CBOR, MessagePack, and + BSON. This constructor is used to create a value for serialization to those + formats. - @note Note, this function exists because of the difficulty in correctly - specifying the correct template overload in the standard value ctor, as both - JSON arrays and JSON binary arrays are backed with some form of a - `std::vector`. Because JSON binary arrays are a non-standard extension it - was decided that it would be best to prevent automatic initialization of a - binary array type, for backwards compatibility and so it does not happen on - accident. + @note Note, this function exists because of the difficulty in correctly + specifying the correct template overload in the standard value ctor, as both + JSON arrays and JSON binary arrays are backed with some form of a + `std::vector`. Because JSON binary arrays are a non-standard extension it + was decided that it would be best to prevent automatic initialization of a + binary array type, for backwards compatibility and so it does not happen on + accident. - @param[in] init container containing bytes to use as binary type - @param[in] subtype subtype to use in MessagePack and BSON + @param[in] init container containing bytes to use as binary type + @param[in] subtype subtype to use in MessagePack and BSON - @return JSON binary array value + @return JSON binary array value - @complexity Linear in the size of @a init. + @complexity Linear in the size of @a init. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes to any JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. - @since version 3.8.0 - */ + @since version 3.8.0 + */ JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json binary(const typename binary_t::container_type& init, std::uint8_t subtype) + static basic_json binary( + const typename binary_t::container_type& init, + std::uint8_t subtype) { auto res = basic_json(); res.m_type = value_t::binary; @@ -18294,7 +19741,8 @@ class basic_json /// @copydoc binary(const typename binary_t::container_type&) JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json binary(typename binary_t::container_type&& init) + static basic_json binary( + typename binary_t::container_type&& init) { auto res = basic_json(); res.m_type = value_t::binary; @@ -18304,7 +19752,9 @@ class basic_json /// @copydoc binary(const typename binary_t::container_type&, std::uint8_t) JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json binary(typename binary_t::container_type&& init, std::uint8_t subtype) + static basic_json binary( + typename binary_t::container_type&& init, + std::uint8_t subtype) { auto res = basic_json(); res.m_type = value_t::binary; @@ -18313,115 +19763,119 @@ class basic_json } /*! - @brief explicitly create an array from an initializer list + @brief explicitly create an array from an initializer list - Creates a JSON array value from a given initializer list. That is, given a - list of values `a, b, c`, creates the JSON value `[a, b, c]`. If the - initializer list is empty, the empty array `[]` is created. + Creates a JSON array value from a given initializer list. That is, given a + list of values `a, b, c`, creates the JSON value `[a, b, c]`. If the + initializer list is empty, the empty array `[]` is created. - @note This function is only needed to express two edge cases that cannot - be realized with the initializer list constructor (@ref - basic_json(initializer_list_t, bool, value_t)). These cases - are: - 1. creating an array whose elements are all pairs whose first element is a - string -- in this case, the initializer list constructor would create an - object, taking the first elements as keys - 2. creating an empty array -- passing the empty initializer list to the - initializer list constructor yields an empty object + @note This function is only needed to express two edge cases that cannot + be realized with the initializer list constructor (@ref + basic_json(initializer_list_t, bool, value_t)). These cases + are: + 1. creating an array whose elements are all pairs whose first element is a + string -- in this case, the initializer list constructor would create an + object, taking the first elements as keys + 2. creating an empty array -- passing the empty initializer list to the + initializer list constructor yields an empty object - @param[in] init initializer list with JSON values to create an array from - (optional) + @param[in] init initializer list with JSON values to create an array from + (optional) - @return JSON array value + @return JSON array value - @complexity Linear in the size of @a init. + @complexity Linear in the size of @a init. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes to any JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. - @liveexample{The following code shows an example for the `array` - function.,array} + @liveexample{The following code shows an example for the `array` + function.,array} - @sa @ref basic_json(initializer_list_t, bool, value_t) -- - create a JSON value from an initializer list - @sa @ref object(initializer_list_t) -- create a JSON object - value from an initializer list + @sa @ref basic_json(initializer_list_t, bool, value_t) -- + create a JSON value from an initializer list + @sa @ref object(initializer_list_t) -- create a JSON object + value from an initializer list - @since version 1.0.0 - */ + @since version 1.0.0 + */ JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json array(initializer_list_t init = {}) + static basic_json array( + initializer_list_t init = {}) { return basic_json(init, false, value_t::array); } /*! - @brief explicitly create an object from an initializer list + @brief explicitly create an object from an initializer list - Creates a JSON object value from a given initializer list. The initializer - lists elements must be pairs, and their first elements must be strings. If - the initializer list is empty, the empty object `{}` is created. + Creates a JSON object value from a given initializer list. The initializer + lists elements must be pairs, and their first elements must be strings. If + the initializer list is empty, the empty object `{}` is created. - @note This function is only added for symmetry reasons. In contrast to the - related function @ref array(initializer_list_t), there are - no cases which can only be expressed by this function. That is, any - initializer list @a init can also be passed to the initializer list - constructor @ref basic_json(initializer_list_t, bool, value_t). + @note This function is only added for symmetry reasons. In contrast to the + related function @ref array(initializer_list_t), there are + no cases which can only be expressed by this function. That is, any + initializer list @a init can also be passed to the initializer list + constructor @ref basic_json(initializer_list_t, bool, value_t). - @param[in] init initializer list to create an object from (optional) + @param[in] init initializer list to create an object from (optional) - @return JSON object value + @return JSON object value - @throw type_error.301 if @a init is not a list of pairs whose first - elements are strings. In this case, no object can be created. When such a - value is passed to @ref basic_json(initializer_list_t, bool, value_t), - an array would have been created from the passed initializer list @a init. - See example below. + @throw type_error.301 if @a init is not a list of pairs whose first + elements are strings. In this case, no object can be created. When such a + value is passed to @ref basic_json(initializer_list_t, bool, value_t), + an array would have been created from the passed initializer list @a init. + See example below. - @complexity Linear in the size of @a init. + @complexity Linear in the size of @a init. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes to any JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. - @liveexample{The following code shows an example for the `object` - function.,object} + @liveexample{The following code shows an example for the `object` + function.,object} - @sa @ref basic_json(initializer_list_t, bool, value_t) -- - create a JSON value from an initializer list - @sa @ref array(initializer_list_t) -- create a JSON array - value from an initializer list + @sa @ref basic_json(initializer_list_t, bool, value_t) -- + create a JSON value from an initializer list + @sa @ref array(initializer_list_t) -- create a JSON array + value from an initializer list - @since version 1.0.0 - */ + @since version 1.0.0 + */ JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json object(initializer_list_t init = {}) + static basic_json object( + initializer_list_t init = {}) { return basic_json(init, false, value_t::object); } /*! - @brief construct an array with count copies of given value + @brief construct an array with count copies of given value - Constructs a JSON array value by creating @a cnt copies of a passed value. - In case @a cnt is `0`, an empty array is created. + Constructs a JSON array value by creating @a cnt copies of a passed value. + In case @a cnt is `0`, an empty array is created. - @param[in] cnt the number of JSON copies of @a val to create - @param[in] val the JSON value to copy + @param[in] cnt the number of JSON copies of @a val to create + @param[in] val the JSON value to copy - @post `std::distance(begin(),end()) == cnt` holds. + @post `std::distance(begin(),end()) == cnt` holds. - @complexity Linear in @a cnt. + @complexity Linear in @a cnt. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes to any JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. - @liveexample{The following code shows examples for the @ref - basic_json(size_type\, const basic_json&) - constructor.,basic_json__size_type_basic_json} + @liveexample{The following code shows examples for the @ref + basic_json(size_type\, const basic_json&) + constructor.,basic_json__size_type_basic_json} - @since version 1.0.0 - */ - basic_json(size_type cnt, const basic_json& val) + @since version 1.0.0 + */ + basic_json( + size_type cnt, + const basic_json& val) : m_type(value_t::array) { m_value.array = create(cnt, val); @@ -18429,64 +19883,66 @@ class basic_json } /*! - @brief construct a JSON container given an iterator range + @brief construct a JSON container given an iterator range - Constructs the JSON value with the contents of the range `[first, last)`. - The semantics depends on the different types a JSON value can have: - - In case of a null type, invalid_iterator.206 is thrown. - - In case of other primitive types (number, boolean, or string), @a first - must be `begin()` and @a last must be `end()`. In this case, the value is - copied. Otherwise, invalid_iterator.204 is thrown. - - In case of structured types (array, object), the constructor behaves as - similar versions for `std::vector` or `std::map`; that is, a JSON array - or object is constructed from the values in the range. + Constructs the JSON value with the contents of the range `[first, last)`. + The semantics depends on the different types a JSON value can have: + - In case of a null type, invalid_iterator.206 is thrown. + - In case of other primitive types (number, boolean, or string), @a first + must be `begin()` and @a last must be `end()`. In this case, the value is + copied. Otherwise, invalid_iterator.204 is thrown. + - In case of structured types (array, object), the constructor behaves as + similar versions for `std::vector` or `std::map`; that is, a JSON array + or object is constructed from the values in the range. - @tparam InputIT an input iterator type (@ref iterator or @ref - const_iterator) + @tparam InputIT an input iterator type (@ref iterator or @ref + const_iterator) - @param[in] first begin of the range to copy from (included) - @param[in] last end of the range to copy from (excluded) + @param[in] first begin of the range to copy from (included) + @param[in] last end of the range to copy from (excluded) - @pre Iterators @a first and @a last must be initialized. **This + @pre Iterators @a first and @a last must be initialized. **This precondition is enforced with an assertion (see warning).** If assertions are switched off, a violation of this precondition yields undefined behavior. - @pre Range `[first, last)` is valid. Usually, this precondition cannot be + @pre Range `[first, last)` is valid. Usually, this precondition cannot be checked efficiently. Only certain edge cases are detected; see the description of the exceptions below. A violation of this precondition yields undefined behavior. - @warning A precondition is enforced with a runtime assertion that will + @warning A precondition is enforced with a runtime assertion that will result in calling `std::abort` if this precondition is not met. Assertions can be disabled by defining `NDEBUG` at compile time. See https://en.cppreference.com/w/cpp/error/assert for more information. - @throw invalid_iterator.201 if iterators @a first and @a last are not - compatible (i.e., do not belong to the same JSON value). In this case, - the range `[first, last)` is undefined. - @throw invalid_iterator.204 if iterators @a first and @a last belong to a - primitive type (number, boolean, or string), but @a first does not point - to the first element any more. In this case, the range `[first, last)` is - undefined. See example code below. - @throw invalid_iterator.206 if iterators @a first and @a last belong to a - null value. In this case, the range `[first, last)` is undefined. + @throw invalid_iterator.201 if iterators @a first and @a last are not + compatible (i.e., do not belong to the same JSON value). In this case, + the range `[first, last)` is undefined. + @throw invalid_iterator.204 if iterators @a first and @a last belong to a + primitive type (number, boolean, or string), but @a first does not point + to the first element any more. In this case, the range `[first, last)` is + undefined. See example code below. + @throw invalid_iterator.206 if iterators @a first and @a last belong to a + null value. In this case, the range `[first, last)` is undefined. - @complexity Linear in distance between @a first and @a last. + @complexity Linear in distance between @a first and @a last. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes to any JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. - @liveexample{The example below shows several ways to create JSON values by - specifying a subrange with iterators.,basic_json__InputIt_InputIt} + @liveexample{The example below shows several ways to create JSON values by + specifying a subrange with iterators.,basic_json__InputIt_InputIt} - @since version 1.0.0 - */ + @since version 1.0.0 + */ template < class InputIT, typename std::enable_if < - std::is_same::value || - std::is_same::value, int >::type = 0 > - basic_json(InputIT first, InputIT last) + std::is_same::value || + std::is_same::value, int >::type = 0 > + basic_json( + InputIT first, + InputIT last) { JSON_ASSERT(first.m_object != nullptr); JSON_ASSERT(last.m_object != nullptr); @@ -18510,7 +19966,7 @@ class basic_json case value_t::string: { if (JSON_HEDLEY_UNLIKELY(!first.m_it.primitive_iterator.is_begin() - || !last.m_it.primitive_iterator.is_end())) + || !last.m_it.primitive_iterator.is_end())) { JSON_THROW(invalid_iterator::create(204, "iterators out of range")); } @@ -18556,14 +20012,14 @@ class basic_json case value_t::object: { m_value.object = create(first.m_it.object_iterator, - last.m_it.object_iterator); + last.m_it.object_iterator); break; } case value_t::array: { m_value.array = create(first.m_it.array_iterator, - last.m_it.array_iterator); + last.m_it.array_iterator); break; } @@ -18575,48 +20031,52 @@ class basic_json default: JSON_THROW(invalid_iterator::create(206, "cannot construct with iterators from " + - std::string(first.m_object->type_name()))); + std::string(first.m_object->type_name()))); } assert_invariant(); } - /////////////////////////////////////// // other constructors and destructor // /////////////////////////////////////// template, - std::is_same>::value, int> = 0 > - basic_json(const JsonRef& ref) : basic_json(ref.moved_or_copied()) {} + detail::enable_if_t, + std::is_same>::value, int> = 0 > + basic_json( + const JsonRef& ref) + : basic_json(ref.moved_or_copied()) + { + } /*! - @brief copy constructor + @brief copy constructor - Creates a copy of a given JSON value. + Creates a copy of a given JSON value. - @param[in] other the JSON value to copy + @param[in] other the JSON value to copy - @post `*this == other` + @post `*this == other` - @complexity Linear in the size of @a other. + @complexity Linear in the size of @a other. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes to any JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes to any JSON value. - @requirement This function helps `basic_json` satisfying the - [Container](https://en.cppreference.com/w/cpp/named_req/Container) - requirements: - - The complexity is linear. - - As postcondition, it holds: `other == basic_json(other)`. + @requirement This function helps `basic_json` satisfying the + [Container](https://en.cppreference.com/w/cpp/named_req/Container) + requirements: + - The complexity is linear. + - As postcondition, it holds: `other == basic_json(other)`. - @liveexample{The following code shows an example for the copy - constructor.,basic_json__basic_json} + @liveexample{The following code shows an example for the copy + constructor.,basic_json__basic_json} - @since version 1.0.0 - */ - basic_json(const basic_json& other) + @since version 1.0.0 + */ + basic_json( + const basic_json& other) : m_type(other.m_type) { // check of passed value is valid @@ -18680,34 +20140,35 @@ class basic_json } /*! - @brief move constructor + @brief move constructor - Move constructor. Constructs a JSON value with the contents of the given - value @a other using move semantics. It "steals" the resources from @a - other and leaves it as JSON null value. + Move constructor. Constructs a JSON value with the contents of the given + value @a other using move semantics. It "steals" the resources from @a + other and leaves it as JSON null value. - @param[in,out] other value to move to this object + @param[in,out] other value to move to this object - @post `*this` has the same value as @a other before the call. - @post @a other is a JSON null value. + @post `*this` has the same value as @a other before the call. + @post @a other is a JSON null value. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this constructor never throws - exceptions. + @exceptionsafety No-throw guarantee: this constructor never throws + exceptions. - @requirement This function helps `basic_json` satisfying the - [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible) - requirements. + @requirement This function helps `basic_json` satisfying the + [MoveConstructible](https://en.cppreference.com/w/cpp/named_req/MoveConstructible) + requirements. - @liveexample{The code below shows the move constructor explicitly called - via std::move.,basic_json__moveconstructor} + @liveexample{The code below shows the move constructor explicitly called + via std::move.,basic_json__moveconstructor} - @since version 1.0.0 - */ - basic_json(basic_json&& other) noexcept - : m_type(std::move(other.m_type)), - m_value(std::move(other.m_value)) + @since version 1.0.0 + */ + basic_json( + basic_json&& other) noexcept + : m_type(std::move(other.m_type)) + , m_value(std::move(other.m_value)) { // check that passed value is valid other.assert_invariant(); @@ -18720,34 +20181,35 @@ class basic_json } /*! - @brief copy assignment + @brief copy assignment - Copy assignment operator. Copies a JSON value via the "copy and swap" - strategy: It is expressed in terms of the copy constructor, destructor, - and the `swap()` member function. + Copy assignment operator. Copies a JSON value via the "copy and swap" + strategy: It is expressed in terms of the copy constructor, destructor, + and the `swap()` member function. - @param[in] other value to copy from + @param[in] other value to copy from - @complexity Linear. + @complexity Linear. - @requirement This function helps `basic_json` satisfying the - [Container](https://en.cppreference.com/w/cpp/named_req/Container) - requirements: - - The complexity is linear. + @requirement This function helps `basic_json` satisfying the + [Container](https://en.cppreference.com/w/cpp/named_req/Container) + requirements: + - The complexity is linear. - @liveexample{The code below shows and example for the copy assignment. It - creates a copy of value `a` which is then swapped with `b`. Finally\, the - copy of `a` (which is the null value after the swap) is - destroyed.,basic_json__copyassignment} + @liveexample{The code below shows and example for the copy assignment. It + creates a copy of value `a` which is then swapped with `b`. Finally\, the + copy of `a` (which is the null value after the swap) is + destroyed.,basic_json__copyassignment} - @since version 1.0.0 - */ - basic_json& operator=(basic_json other) noexcept ( - std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_assignable::value&& - std::is_nothrow_move_constructible::value&& + @since version 1.0.0 + */ + basic_json& operator =( + basic_json other) noexcept ( + std::is_nothrow_move_constructible::value && + std::is_nothrow_move_assignable::value && + std::is_nothrow_move_constructible::value && std::is_nothrow_move_assignable::value - ) + ) { // check that passed value is valid other.assert_invariant(); @@ -18761,20 +20223,20 @@ class basic_json } /*! - @brief destructor + @brief destructor - Destroys the JSON value and frees all allocated memory. + Destroys the JSON value and frees all allocated memory. - @complexity Linear. + @complexity Linear. - @requirement This function helps `basic_json` satisfying the - [Container](https://en.cppreference.com/w/cpp/named_req/Container) - requirements: - - The complexity is linear. - - All stored elements are destroyed and all memory is freed. + @requirement This function helps `basic_json` satisfying the + [Container](https://en.cppreference.com/w/cpp/named_req/Container) + requirements: + - The complexity is linear. + - All stored elements are destroyed and all memory is freed. - @since version 1.0.0 - */ + @since version 1.0.0 + */ ~basic_json() noexcept { assert_invariant(); @@ -18783,7 +20245,8 @@ class basic_json /// @} - public: +public: + /////////////////////// // object inspection // /////////////////////// @@ -18793,56 +20256,57 @@ class basic_json /// @{ /*! - @brief serialization + @brief serialization - Serialization function for JSON values. The function tries to mimic - Python's `json.dumps()` function, and currently supports its @a indent - and @a ensure_ascii parameters. + Serialization function for JSON values. The function tries to mimic + Python's `json.dumps()` function, and currently supports its @a indent + and @a ensure_ascii parameters. - @param[in] indent If indent is nonnegative, then array elements and object - members will be pretty-printed with that indent level. An indent level of - `0` will only insert newlines. `-1` (the default) selects the most compact - representation. - @param[in] indent_char The character to use for indentation if @a indent is - greater than `0`. The default is ` ` (space). - @param[in] ensure_ascii If @a ensure_ascii is true, all non-ASCII characters - in the output are escaped with `\uXXXX` sequences, and the result consists - of ASCII characters only. - @param[in] error_handler how to react on decoding errors; there are three - possible values: `strict` (throws and exception in case a decoding error - occurs; default), `replace` (replace invalid UTF-8 sequences with U+FFFD), - and `ignore` (ignore invalid UTF-8 sequences during serialization; all - bytes are copied to the output unchanged). + @param[in] indent If indent is nonnegative, then array elements and object + members will be pretty-printed with that indent level. An indent level of + `0` will only insert newlines. `-1` (the default) selects the most compact + representation. + @param[in] indent_char The character to use for indentation if @a indent is + greater than `0`. The default is ` ` (space). + @param[in] ensure_ascii If @a ensure_ascii is true, all non-ASCII characters + in the output are escaped with `\uXXXX` sequences, and the result consists + of ASCII characters only. + @param[in] error_handler how to react on decoding errors; there are three + possible values: `strict` (throws and exception in case a decoding error + occurs; default), `replace` (replace invalid UTF-8 sequences with U+FFFD), + and `ignore` (ignore invalid UTF-8 sequences during serialization; all + bytes are copied to the output unchanged). - @return string containing the serialization of the JSON value + @return string containing the serialization of the JSON value - @throw type_error.316 if a string stored inside the JSON value is not + @throw type_error.316 if a string stored inside the JSON value is not UTF-8 encoded and @a error_handler is set to strict - @note Binary values are serialized as object containing two keys: - - "bytes": an array of bytes as integers - - "subtype": the subtype as integer or "null" if the binary has no subtype + @note Binary values are serialized as object containing two keys: + - "bytes": an array of bytes as integers + - "subtype": the subtype as integer or "null" if the binary has no subtype - @complexity Linear. + @complexity Linear. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes in the JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. - @liveexample{The following example shows the effect of different @a indent\, - @a indent_char\, and @a ensure_ascii parameters to the result of the - serialization.,dump} + @liveexample{The following example shows the effect of different @a indent\, + @a indent_char\, and @a ensure_ascii parameters to the result of the + serialization.,dump} - @see https://docs.python.org/2/library/json.html#json.dump + @see https://docs.python.org/2/library/json.html#json.dump - @since version 1.0.0; indentation character @a indent_char, option + @since version 1.0.0; indentation character @a indent_char, option @a ensure_ascii and exceptions added in version 3.0.0; error handlers added in version 3.4.0; serialization of binary values added in version 3.8.0. - */ - string_t dump(const int indent = -1, - const char indent_char = ' ', - const bool ensure_ascii = false, - const error_handler_t error_handler = error_handler_t::strict) const + */ + string_t dump( + const int indent = -1, + const char indent_char = ' ', + const bool ensure_ascii = false, + const error_handler_t error_handler = error_handler_t::strict) const { string_t result; serializer s(detail::output_adapter(result), indent_char, error_handler); @@ -18860,12 +20324,12 @@ class basic_json } /*! - @brief return the type of the JSON value (explicit) + @brief return the type of the JSON value (explicit) - Return the type of the JSON value as a value from the @ref value_t - enumeration. + Return the type of the JSON value as a value from the @ref value_t + enumeration. - @return the type of the JSON value + @return the type of the JSON value Value type | return value ------------------------- | ------------------------- null | value_t::null @@ -18879,377 +20343,377 @@ class basic_json binary | value_t::binary discarded | value_t::discarded - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `type()` for all JSON - types.,type} + @liveexample{The following code exemplifies `type()` for all JSON + types.,type} - @sa @ref operator value_t() -- return the type of the JSON value (implicit) - @sa @ref type_name() -- return the type as string + @sa @ref operator value_t() -- return the type of the JSON value (implicit) + @sa @ref type_name() -- return the type as string - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr value_t type() const noexcept { return m_type; } /*! - @brief return whether type is primitive + @brief return whether type is primitive - This function returns true if and only if the JSON type is primitive - (string, number, boolean, or null). + This function returns true if and only if the JSON type is primitive + (string, number, boolean, or null). - @return `true` if type is primitive (string, number, boolean, or null), - `false` otherwise. + @return `true` if type is primitive (string, number, boolean, or null), + `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_primitive()` for all JSON - types.,is_primitive} + @liveexample{The following code exemplifies `is_primitive()` for all JSON + types.,is_primitive} - @sa @ref is_structured() -- returns whether JSON value is structured - @sa @ref is_null() -- returns whether JSON value is `null` - @sa @ref is_string() -- returns whether JSON value is a string - @sa @ref is_boolean() -- returns whether JSON value is a boolean - @sa @ref is_number() -- returns whether JSON value is a number - @sa @ref is_binary() -- returns whether JSON value is a binary array + @sa @ref is_structured() -- returns whether JSON value is structured + @sa @ref is_null() -- returns whether JSON value is `null` + @sa @ref is_string() -- returns whether JSON value is a string + @sa @ref is_boolean() -- returns whether JSON value is a boolean + @sa @ref is_number() -- returns whether JSON value is a number + @sa @ref is_binary() -- returns whether JSON value is a binary array - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr bool is_primitive() const noexcept { return is_null() || is_string() || is_boolean() || is_number() || is_binary(); } /*! - @brief return whether type is structured + @brief return whether type is structured - This function returns true if and only if the JSON type is structured - (array or object). + This function returns true if and only if the JSON type is structured + (array or object). - @return `true` if type is structured (array or object), `false` otherwise. + @return `true` if type is structured (array or object), `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_structured()` for all JSON - types.,is_structured} + @liveexample{The following code exemplifies `is_structured()` for all JSON + types.,is_structured} - @sa @ref is_primitive() -- returns whether value is primitive - @sa @ref is_array() -- returns whether value is an array - @sa @ref is_object() -- returns whether value is an object + @sa @ref is_primitive() -- returns whether value is primitive + @sa @ref is_array() -- returns whether value is an array + @sa @ref is_object() -- returns whether value is an object - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr bool is_structured() const noexcept { return is_array() || is_object(); } /*! - @brief return whether value is null + @brief return whether value is null - This function returns true if and only if the JSON value is null. + This function returns true if and only if the JSON value is null. - @return `true` if type is null, `false` otherwise. + @return `true` if type is null, `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_null()` for all JSON - types.,is_null} + @liveexample{The following code exemplifies `is_null()` for all JSON + types.,is_null} - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr bool is_null() const noexcept { return m_type == value_t::null; } /*! - @brief return whether value is a boolean + @brief return whether value is a boolean - This function returns true if and only if the JSON value is a boolean. + This function returns true if and only if the JSON value is a boolean. - @return `true` if type is boolean, `false` otherwise. + @return `true` if type is boolean, `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_boolean()` for all JSON - types.,is_boolean} + @liveexample{The following code exemplifies `is_boolean()` for all JSON + types.,is_boolean} - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr bool is_boolean() const noexcept { return m_type == value_t::boolean; } /*! - @brief return whether value is a number + @brief return whether value is a number - This function returns true if and only if the JSON value is a number. This - includes both integer (signed and unsigned) and floating-point values. + This function returns true if and only if the JSON value is a number. This + includes both integer (signed and unsigned) and floating-point values. - @return `true` if type is number (regardless whether integer, unsigned - integer or floating-type), `false` otherwise. + @return `true` if type is number (regardless whether integer, unsigned + integer or floating-type), `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_number()` for all JSON - types.,is_number} + @liveexample{The following code exemplifies `is_number()` for all JSON + types.,is_number} - @sa @ref is_number_integer() -- check if value is an integer or unsigned - integer number - @sa @ref is_number_unsigned() -- check if value is an unsigned integer - number - @sa @ref is_number_float() -- check if value is a floating-point number + @sa @ref is_number_integer() -- check if value is an integer or unsigned + integer number + @sa @ref is_number_unsigned() -- check if value is an unsigned integer + number + @sa @ref is_number_float() -- check if value is a floating-point number - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr bool is_number() const noexcept { return is_number_integer() || is_number_float(); } /*! - @brief return whether value is an integer number + @brief return whether value is an integer number - This function returns true if and only if the JSON value is a signed or - unsigned integer number. This excludes floating-point values. + This function returns true if and only if the JSON value is a signed or + unsigned integer number. This excludes floating-point values. - @return `true` if type is an integer or unsigned integer number, `false` - otherwise. + @return `true` if type is an integer or unsigned integer number, `false` + otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_number_integer()` for all - JSON types.,is_number_integer} + @liveexample{The following code exemplifies `is_number_integer()` for all + JSON types.,is_number_integer} - @sa @ref is_number() -- check if value is a number - @sa @ref is_number_unsigned() -- check if value is an unsigned integer - number - @sa @ref is_number_float() -- check if value is a floating-point number + @sa @ref is_number() -- check if value is a number + @sa @ref is_number_unsigned() -- check if value is an unsigned integer + number + @sa @ref is_number_float() -- check if value is a floating-point number - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr bool is_number_integer() const noexcept { return m_type == value_t::number_integer || m_type == value_t::number_unsigned; } /*! - @brief return whether value is an unsigned integer number + @brief return whether value is an unsigned integer number - This function returns true if and only if the JSON value is an unsigned - integer number. This excludes floating-point and signed integer values. + This function returns true if and only if the JSON value is an unsigned + integer number. This excludes floating-point and signed integer values. - @return `true` if type is an unsigned integer number, `false` otherwise. + @return `true` if type is an unsigned integer number, `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_number_unsigned()` for all - JSON types.,is_number_unsigned} + @liveexample{The following code exemplifies `is_number_unsigned()` for all + JSON types.,is_number_unsigned} - @sa @ref is_number() -- check if value is a number - @sa @ref is_number_integer() -- check if value is an integer or unsigned - integer number - @sa @ref is_number_float() -- check if value is a floating-point number + @sa @ref is_number() -- check if value is a number + @sa @ref is_number_integer() -- check if value is an integer or unsigned + integer number + @sa @ref is_number_float() -- check if value is a floating-point number - @since version 2.0.0 - */ + @since version 2.0.0 + */ constexpr bool is_number_unsigned() const noexcept { return m_type == value_t::number_unsigned; } /*! - @brief return whether value is a floating-point number + @brief return whether value is a floating-point number - This function returns true if and only if the JSON value is a - floating-point number. This excludes signed and unsigned integer values. + This function returns true if and only if the JSON value is a + floating-point number. This excludes signed and unsigned integer values. - @return `true` if type is a floating-point number, `false` otherwise. + @return `true` if type is a floating-point number, `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_number_float()` for all - JSON types.,is_number_float} + @liveexample{The following code exemplifies `is_number_float()` for all + JSON types.,is_number_float} - @sa @ref is_number() -- check if value is number - @sa @ref is_number_integer() -- check if value is an integer number - @sa @ref is_number_unsigned() -- check if value is an unsigned integer - number + @sa @ref is_number() -- check if value is number + @sa @ref is_number_integer() -- check if value is an integer number + @sa @ref is_number_unsigned() -- check if value is an unsigned integer + number - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr bool is_number_float() const noexcept { return m_type == value_t::number_float; } /*! - @brief return whether value is an object + @brief return whether value is an object - This function returns true if and only if the JSON value is an object. + This function returns true if and only if the JSON value is an object. - @return `true` if type is object, `false` otherwise. + @return `true` if type is object, `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_object()` for all JSON - types.,is_object} + @liveexample{The following code exemplifies `is_object()` for all JSON + types.,is_object} - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr bool is_object() const noexcept { return m_type == value_t::object; } /*! - @brief return whether value is an array + @brief return whether value is an array - This function returns true if and only if the JSON value is an array. + This function returns true if and only if the JSON value is an array. - @return `true` if type is array, `false` otherwise. + @return `true` if type is array, `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_array()` for all JSON - types.,is_array} + @liveexample{The following code exemplifies `is_array()` for all JSON + types.,is_array} - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr bool is_array() const noexcept { return m_type == value_t::array; } /*! - @brief return whether value is a string + @brief return whether value is a string - This function returns true if and only if the JSON value is a string. + This function returns true if and only if the JSON value is a string. - @return `true` if type is string, `false` otherwise. + @return `true` if type is string, `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_string()` for all JSON - types.,is_string} + @liveexample{The following code exemplifies `is_string()` for all JSON + types.,is_string} - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr bool is_string() const noexcept { return m_type == value_t::string; } /*! - @brief return whether value is a binary array + @brief return whether value is a binary array - This function returns true if and only if the JSON value is a binary array. + This function returns true if and only if the JSON value is a binary array. - @return `true` if type is binary array, `false` otherwise. + @return `true` if type is binary array, `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_binary()` for all JSON - types.,is_binary} + @liveexample{The following code exemplifies `is_binary()` for all JSON + types.,is_binary} - @since version 3.8.0 - */ + @since version 3.8.0 + */ constexpr bool is_binary() const noexcept { return m_type == value_t::binary; } /*! - @brief return whether value is discarded + @brief return whether value is discarded - This function returns true if and only if the JSON value was discarded - during parsing with a callback function (see @ref parser_callback_t). + This function returns true if and only if the JSON value was discarded + during parsing with a callback function (see @ref parser_callback_t). - @note This function will always be `false` for JSON values after parsing. - That is, discarded values can only occur during parsing, but will be - removed when inside a structured value or replaced by null in other cases. + @note This function will always be `false` for JSON values after parsing. + That is, discarded values can only occur during parsing, but will be + removed when inside a structured value or replaced by null in other cases. - @return `true` if type is discarded, `false` otherwise. + @return `true` if type is discarded, `false` otherwise. - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies `is_discarded()` for all JSON - types.,is_discarded} + @liveexample{The following code exemplifies `is_discarded()` for all JSON + types.,is_discarded} - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr bool is_discarded() const noexcept { return m_type == value_t::discarded; } /*! - @brief return the type of the JSON value (implicit) + @brief return the type of the JSON value (implicit) - Implicitly return the type of the JSON value as a value from the @ref - value_t enumeration. + Implicitly return the type of the JSON value as a value from the @ref + value_t enumeration. - @return the type of the JSON value + @return the type of the JSON value - @complexity Constant. + @complexity Constant. - @exceptionsafety No-throw guarantee: this member function never throws - exceptions. + @exceptionsafety No-throw guarantee: this member function never throws + exceptions. - @liveexample{The following code exemplifies the @ref value_t operator for - all JSON types.,operator__value_t} + @liveexample{The following code exemplifies the @ref value_t operator for + all JSON types.,operator__value_t} - @sa @ref type() -- return the type of the JSON value (explicit) - @sa @ref type_name() -- return the type as string + @sa @ref type() -- return the type of the JSON value (explicit) + @sa @ref type_name() -- return the type as string - @since version 1.0.0 - */ + @since version 1.0.0 + */ constexpr operator value_t() const noexcept { return m_type; @@ -19257,13 +20721,15 @@ class basic_json /// @} - private: +private: + ////////////////// // value access // ////////////////// /// get a boolean (explicit) - boolean_t get_impl(boolean_t* /*unused*/) const + boolean_t get_impl( + boolean_t* /*unused*/) const { if (JSON_HEDLEY_LIKELY(is_boolean())) { @@ -19274,114 +20740,131 @@ class basic_json } /// get a pointer to the value (object) - object_t* get_impl_ptr(object_t* /*unused*/) noexcept + object_t* get_impl_ptr( + object_t* /*unused*/) noexcept { return is_object() ? m_value.object : nullptr; } /// get a pointer to the value (object) - constexpr const object_t* get_impl_ptr(const object_t* /*unused*/) const noexcept + constexpr const object_t* get_impl_ptr( + const object_t* /*unused*/) const noexcept { return is_object() ? m_value.object : nullptr; } /// get a pointer to the value (array) - array_t* get_impl_ptr(array_t* /*unused*/) noexcept + array_t* get_impl_ptr( + array_t* /*unused*/) noexcept { return is_array() ? m_value.array : nullptr; } /// get a pointer to the value (array) - constexpr const array_t* get_impl_ptr(const array_t* /*unused*/) const noexcept + constexpr const array_t* get_impl_ptr( + const array_t* /*unused*/) const noexcept { return is_array() ? m_value.array : nullptr; } /// get a pointer to the value (string) - string_t* get_impl_ptr(string_t* /*unused*/) noexcept + string_t* get_impl_ptr( + string_t* /*unused*/) noexcept { return is_string() ? m_value.string : nullptr; } /// get a pointer to the value (string) - constexpr const string_t* get_impl_ptr(const string_t* /*unused*/) const noexcept + constexpr const string_t* get_impl_ptr( + const string_t* /*unused*/) const noexcept { return is_string() ? m_value.string : nullptr; } /// get a pointer to the value (boolean) - boolean_t* get_impl_ptr(boolean_t* /*unused*/) noexcept + boolean_t* get_impl_ptr( + boolean_t* /*unused*/) noexcept { return is_boolean() ? &m_value.boolean : nullptr; } /// get a pointer to the value (boolean) - constexpr const boolean_t* get_impl_ptr(const boolean_t* /*unused*/) const noexcept + constexpr const boolean_t* get_impl_ptr( + const boolean_t* /*unused*/) const noexcept { return is_boolean() ? &m_value.boolean : nullptr; } /// get a pointer to the value (integer number) - number_integer_t* get_impl_ptr(number_integer_t* /*unused*/) noexcept + number_integer_t* get_impl_ptr( + number_integer_t* /*unused*/) noexcept { return is_number_integer() ? &m_value.number_integer : nullptr; } /// get a pointer to the value (integer number) - constexpr const number_integer_t* get_impl_ptr(const number_integer_t* /*unused*/) const noexcept + constexpr const number_integer_t* get_impl_ptr( + const number_integer_t* /*unused*/) const noexcept { return is_number_integer() ? &m_value.number_integer : nullptr; } /// get a pointer to the value (unsigned number) - number_unsigned_t* get_impl_ptr(number_unsigned_t* /*unused*/) noexcept + number_unsigned_t* get_impl_ptr( + number_unsigned_t* /*unused*/) noexcept { return is_number_unsigned() ? &m_value.number_unsigned : nullptr; } /// get a pointer to the value (unsigned number) - constexpr const number_unsigned_t* get_impl_ptr(const number_unsigned_t* /*unused*/) const noexcept + constexpr const number_unsigned_t* get_impl_ptr( + const number_unsigned_t* /*unused*/) const noexcept { return is_number_unsigned() ? &m_value.number_unsigned : nullptr; } /// get a pointer to the value (floating-point number) - number_float_t* get_impl_ptr(number_float_t* /*unused*/) noexcept + number_float_t* get_impl_ptr( + number_float_t* /*unused*/) noexcept { return is_number_float() ? &m_value.number_float : nullptr; } /// get a pointer to the value (floating-point number) - constexpr const number_float_t* get_impl_ptr(const number_float_t* /*unused*/) const noexcept + constexpr const number_float_t* get_impl_ptr( + const number_float_t* /*unused*/) const noexcept { return is_number_float() ? &m_value.number_float : nullptr; } /// get a pointer to the value (binary) - binary_t* get_impl_ptr(binary_t* /*unused*/) noexcept + binary_t* get_impl_ptr( + binary_t* /*unused*/) noexcept { return is_binary() ? m_value.binary : nullptr; } /// get a pointer to the value (binary) - constexpr const binary_t* get_impl_ptr(const binary_t* /*unused*/) const noexcept + constexpr const binary_t* get_impl_ptr( + const binary_t* /*unused*/) const noexcept { return is_binary() ? m_value.binary : nullptr; } /*! - @brief helper function to implement get_ref() + @brief helper function to implement get_ref() - This function helps to implement get_ref() without code duplication for - const and non-const overloads + This function helps to implement get_ref() without code duplication for + const and non-const overloads - @tparam ThisType will be deduced as `basic_json` or `const basic_json` + @tparam ThisType will be deduced as `basic_json` or `const basic_json` - @throw type_error.303 if ReferenceType does not match underlying value - type of the current JSON - */ + @throw type_error.303 if ReferenceType does not match underlying value + type of the current JSON + */ template - static ReferenceType get_ref_impl(ThisType& obj) + static ReferenceType get_ref_impl( + ThisType& obj) { // delegate the call to get_ptr<>() auto ptr = obj.template get_ptr::type>(); @@ -19391,114 +20874,116 @@ class basic_json return *ptr; } - JSON_THROW(type_error::create(303, "incompatible ReferenceType for get_ref, actual type is " + std::string(obj.type_name()))); + JSON_THROW(type_error::create(303, + "incompatible ReferenceType for get_ref, actual type is " + std::string(obj.type_name()))); } - public: +public: + /// @name value access /// Direct access to the stored value of a JSON value. /// @{ /*! - @brief get special-case overload + @brief get special-case overload - This overloads avoids a lot of template boilerplate, it can be seen as the - identity method + This overloads avoids a lot of template boilerplate, it can be seen as the + identity method - @tparam BasicJsonType == @ref basic_json + @tparam BasicJsonType == @ref basic_json - @return a copy of *this + @return a copy of *this - @complexity Constant. + @complexity Constant. - @since version 2.1.0 - */ + @since version 2.1.0 + */ template::type, basic_json_t>::value, - int> = 0> + std::is_same::type, basic_json_t>::value, + int> = 0> basic_json get() const { return *this; } /*! - @brief get special-case overload + @brief get special-case overload - This overloads converts the current @ref basic_json in a different - @ref basic_json type + This overloads converts the current @ref basic_json in a different + @ref basic_json type - @tparam BasicJsonType == @ref basic_json + @tparam BasicJsonType == @ref basic_json - @return a copy of *this, converted into @tparam BasicJsonType + @return a copy of *this, converted into @tparam BasicJsonType - @complexity Depending on the implementation of the called `from_json()` + @complexity Depending on the implementation of the called `from_json()` method. - @since version 3.2.0 - */ + @since version 3.2.0 + */ template < typename BasicJsonType, detail::enable_if_t < - !std::is_same::value&& - detail::is_basic_json::value, int > = 0 > + !std::is_same::value && + detail::is_basic_json::value, int > = 0 > BasicJsonType get() const { return *this; } /*! - @brief get a value (explicit) + @brief get a value (explicit) - Explicit type conversion between the JSON value and a compatible value - which is [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible) - and [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible). - The value is converted by calling the @ref json_serializer - `from_json()` method. + Explicit type conversion between the JSON value and a compatible value + which is [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible) + and [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible). + The value is converted by calling the @ref json_serializer + `from_json()` method. - The function is equivalent to executing - @code {.cpp} - ValueType ret; - JSONSerializer::from_json(*this, ret); - return ret; - @endcode + The function is equivalent to executing + @code {.cpp} + ValueType ret; + JSONSerializer::from_json(*this, ret); + return ret; + @endcode - This overloads is chosen if: - - @a ValueType is not @ref basic_json, - - @ref json_serializer has a `from_json()` method of the form - `void from_json(const basic_json&, ValueType&)`, and - - @ref json_serializer does not have a `from_json()` method of - the form `ValueType from_json(const basic_json&)` + This overloads is chosen if: + - @a ValueType is not @ref basic_json, + - @ref json_serializer has a `from_json()` method of the form + `void from_json(const basic_json&, ValueType&)`, and + - @ref json_serializer does not have a `from_json()` method of + the form `ValueType from_json(const basic_json&)` - @tparam ValueTypeCV the provided value type - @tparam ValueType the returned value type + @tparam ValueTypeCV the provided value type + @tparam ValueType the returned value type - @return copy of the JSON value, converted to @a ValueType + @return copy of the JSON value, converted to @a ValueType - @throw what @ref json_serializer `from_json()` method throws + @throw what @ref json_serializer `from_json()` method throws - @liveexample{The example below shows several conversions from JSON values - to other types. There a few things to note: (1) Floating-point numbers can - be converted to integers\, (2) A JSON array can be converted to a standard - `std::vector`\, (3) A JSON object can be converted to C++ - associative containers such as `std::unordered_map`.,get__ValueType_const} + @liveexample{The example below shows several conversions from JSON values + to other types. There a few things to note: (1) Floating-point numbers can + be converted to integers\, (2) A JSON array can be converted to a standard + `std::vector`\, (3) A JSON object can be converted to C++ + associative containers such as `std::unordered_map`.,get__ValueType_const} - @since version 2.1.0 - */ + @since version 2.1.0 + */ template < typename ValueTypeCV, typename ValueType = detail::uncvref_t, - detail::enable_if_t < - !detail::is_basic_json::value && - detail::has_from_json::value && - !detail::has_non_default_from_json::value, - int > = 0 > + detail::enable_if_t < + !detail::is_basic_json::value && + detail::has_from_json::value && + !detail::has_non_default_from_json::value, + int > = 0 > ValueType get() const noexcept(noexcept( - JSONSerializer::from_json(std::declval(), std::declval()))) + JSONSerializer::from_json(std::declval(), std::declval()))) { // we cannot static_assert on ValueTypeCV being non-const, because // there is support for get(), which is why we // still need the uncvref static_assert(!std::is_reference::value, - "get() cannot be used with reference types, you might want to use get_ref()"); + "get() cannot be used with reference types, you might want to use get_ref()"); static_assert(std::is_default_constructible::value, - "types must be DefaultConstructible when used with get()"); + "types must be DefaultConstructible when used with get()"); ValueType ret; JSONSerializer::from_json(*this, ret); @@ -19506,88 +20991,89 @@ class basic_json } /*! - @brief get a value (explicit); special case + @brief get a value (explicit); special case - Explicit type conversion between the JSON value and a compatible value - which is **not** [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible) - and **not** [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible). - The value is converted by calling the @ref json_serializer - `from_json()` method. + Explicit type conversion between the JSON value and a compatible value + which is **not** [CopyConstructible](https://en.cppreference.com/w/cpp/named_req/CopyConstructible) + and **not** [DefaultConstructible](https://en.cppreference.com/w/cpp/named_req/DefaultConstructible). + The value is converted by calling the @ref json_serializer + `from_json()` method. - The function is equivalent to executing - @code {.cpp} - return JSONSerializer::from_json(*this); - @endcode + The function is equivalent to executing + @code {.cpp} + return JSONSerializer::from_json(*this); + @endcode - This overloads is chosen if: - - @a ValueType is not @ref basic_json and - - @ref json_serializer has a `from_json()` method of the form - `ValueType from_json(const basic_json&)` + This overloads is chosen if: + - @a ValueType is not @ref basic_json and + - @ref json_serializer has a `from_json()` method of the form + `ValueType from_json(const basic_json&)` - @note If @ref json_serializer has both overloads of - `from_json()`, this one is chosen. + @note If @ref json_serializer has both overloads of + `from_json()`, this one is chosen. - @tparam ValueTypeCV the provided value type - @tparam ValueType the returned value type + @tparam ValueTypeCV the provided value type + @tparam ValueType the returned value type - @return copy of the JSON value, converted to @a ValueType + @return copy of the JSON value, converted to @a ValueType - @throw what @ref json_serializer `from_json()` method throws + @throw what @ref json_serializer `from_json()` method throws - @since version 2.1.0 - */ + @since version 2.1.0 + */ template < typename ValueTypeCV, typename ValueType = detail::uncvref_t, - detail::enable_if_t < !std::is_same::value && - detail::has_non_default_from_json::value, - int > = 0 > + detail::enable_if_t < !std::is_same::value && + detail::has_non_default_from_json::value, + int > = 0 > ValueType get() const noexcept(noexcept( - JSONSerializer::from_json(std::declval()))) + JSONSerializer::from_json(std::declval()))) { static_assert(!std::is_reference::value, - "get() cannot be used with reference types, you might want to use get_ref()"); + "get() cannot be used with reference types, you might want to use get_ref()"); return JSONSerializer::from_json(*this); } /*! - @brief get a value (explicit) + @brief get a value (explicit) - Explicit type conversion between the JSON value and a compatible value. - The value is filled into the input parameter by calling the @ref json_serializer - `from_json()` method. + Explicit type conversion between the JSON value and a compatible value. + The value is filled into the input parameter by calling the @ref json_serializer + `from_json()` method. - The function is equivalent to executing - @code {.cpp} - ValueType v; - JSONSerializer::from_json(*this, v); - @endcode + The function is equivalent to executing + @code {.cpp} + ValueType v; + JSONSerializer::from_json(*this, v); + @endcode - This overloads is chosen if: - - @a ValueType is not @ref basic_json, - - @ref json_serializer has a `from_json()` method of the form - `void from_json(const basic_json&, ValueType&)`, and + This overloads is chosen if: + - @a ValueType is not @ref basic_json, + - @ref json_serializer has a `from_json()` method of the form + `void from_json(const basic_json&, ValueType&)`, and - @tparam ValueType the input parameter type. + @tparam ValueType the input parameter type. - @return the input parameter, allowing chaining calls. + @return the input parameter, allowing chaining calls. - @throw what @ref json_serializer `from_json()` method throws + @throw what @ref json_serializer `from_json()` method throws - @liveexample{The example below shows several conversions from JSON values - to other types. There a few things to note: (1) Floating-point numbers can - be converted to integers\, (2) A JSON array can be converted to a standard - `std::vector`\, (3) A JSON object can be converted to C++ - associative containers such as `std::unordered_map`.,get_to} + @liveexample{The example below shows several conversions from JSON values + to other types. There a few things to note: (1) Floating-point numbers can + be converted to integers\, (2) A JSON array can be converted to a standard + `std::vector`\, (3) A JSON object can be converted to C++ + associative containers such as `std::unordered_map`.,get_to} - @since version 3.3.0 - */ + @since version 3.3.0 + */ template < typename ValueType, - detail::enable_if_t < - !detail::is_basic_json::value&& - detail::has_from_json::value, - int > = 0 > - ValueType & get_to(ValueType& v) const noexcept(noexcept( - JSONSerializer::from_json(std::declval(), v))) + detail::enable_if_t < + !detail::is_basic_json::value && + detail::has_from_json::value, + int > = 0 > + ValueType& get_to( + ValueType& v) const noexcept(noexcept( + JSONSerializer::from_json(std::declval(), v))) { JSONSerializer::from_json(*this, v); return v; @@ -19596,10 +21082,11 @@ class basic_json // specialization to allow to call get_to with a basic_json value // see https://github.com/nlohmann/json/issues/2175 template::value, - int> = 0> - ValueType & get_to(ValueType& v) const + detail::enable_if_t < + detail::is_basic_json::value, + int> = 0> + ValueType& get_to( + ValueType& v) const { v = *this; return v; @@ -19610,43 +21097,43 @@ class basic_json typename Array = T (&)[N], detail::enable_if_t < detail::has_from_json::value, int > = 0 > - Array get_to(T (&v)[N]) const + Array get_to( + T (& v)[N]) const noexcept(noexcept(JSONSerializer::from_json( - std::declval(), v))) + std::declval(), v))) { JSONSerializer::from_json(*this, v); return v; } - /*! - @brief get a pointer value (implicit) + @brief get a pointer value (implicit) - Implicit pointer access to the internally stored JSON value. No copies are - made. + Implicit pointer access to the internally stored JSON value. No copies are + made. - @warning Writing data to the pointee of the result yields an undefined - state. + @warning Writing data to the pointee of the result yields an undefined + state. - @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref - object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, - @ref number_unsigned_t, or @ref number_float_t. Enforced by a static - assertion. + @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref + object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, + @ref number_unsigned_t, or @ref number_float_t. Enforced by a static + assertion. - @return pointer to the internally stored JSON value if the requested - pointer type @a PointerType fits to the JSON value; `nullptr` otherwise + @return pointer to the internally stored JSON value if the requested + pointer type @a PointerType fits to the JSON value; `nullptr` otherwise - @complexity Constant. + @complexity Constant. - @liveexample{The example below shows how pointers to internal values of a - JSON value can be requested. Note that no type conversions are made and a - `nullptr` is returned if the value and the requested pointer type does not - match.,get_ptr} + @liveexample{The example below shows how pointers to internal values of a + JSON value can be requested. Note that no type conversions are made and a + `nullptr` is returned if the value and the requested pointer type does not + match.,get_ptr} - @since version 1.0.0 - */ + @since version 1.0.0 + */ template::value, int>::type = 0> + std::is_pointer::value, int>::type = 0> auto get_ptr() noexcept -> decltype(std::declval().get_impl_ptr(std::declval())) { // delegate the call to get_impl_ptr<>() @@ -19654,47 +21141,48 @@ class basic_json } /*! - @brief get a pointer value (implicit) - @copydoc get_ptr() - */ + @brief get a pointer value (implicit) + @copydoc get_ptr() + */ template < typename PointerType, typename std::enable_if < - std::is_pointer::value&& - std::is_const::type>::value, int >::type = 0 > - constexpr auto get_ptr() const noexcept -> decltype(std::declval().get_impl_ptr(std::declval())) + std::is_pointer::value && + std::is_const::type>::value, int >::type = 0 > + constexpr auto get_ptr() const noexcept -> decltype(std::declval().get_impl_ptr( + std::declval())) { // delegate the call to get_impl_ptr<>() const return get_impl_ptr(static_cast(nullptr)); } /*! - @brief get a pointer value (explicit) + @brief get a pointer value (explicit) - Explicit pointer access to the internally stored JSON value. No copies are - made. + Explicit pointer access to the internally stored JSON value. No copies are + made. - @warning The pointer becomes invalid if the underlying JSON object - changes. + @warning The pointer becomes invalid if the underlying JSON object + changes. - @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref - object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, - @ref number_unsigned_t, or @ref number_float_t. + @tparam PointerType pointer type; must be a pointer to @ref array_t, @ref + object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, + @ref number_unsigned_t, or @ref number_float_t. - @return pointer to the internally stored JSON value if the requested - pointer type @a PointerType fits to the JSON value; `nullptr` otherwise + @return pointer to the internally stored JSON value if the requested + pointer type @a PointerType fits to the JSON value; `nullptr` otherwise - @complexity Constant. + @complexity Constant. - @liveexample{The example below shows how pointers to internal values of a - JSON value can be requested. Note that no type conversions are made and a - `nullptr` is returned if the value and the requested pointer type does not - match.,get__PointerType} + @liveexample{The example below shows how pointers to internal values of a + JSON value can be requested. Note that no type conversions are made and a + `nullptr` is returned if the value and the requested pointer type does not + match.,get__PointerType} - @sa @ref get_ptr() for explicit pointer-member access + @sa @ref get_ptr() for explicit pointer-member access - @since version 1.0.0 - */ + @since version 1.0.0 + */ template::value, int>::type = 0> + std::is_pointer::value, int>::type = 0> auto get() noexcept -> decltype(std::declval().template get_ptr()) { // delegate the call to get_ptr @@ -19702,11 +21190,11 @@ class basic_json } /*! - @brief get a pointer value (explicit) - @copydoc get() - */ + @brief get a pointer value (explicit) + @copydoc get() + */ template::value, int>::type = 0> + std::is_pointer::value, int>::type = 0> constexpr auto get() const noexcept -> decltype(std::declval().template get_ptr()) { // delegate the call to get_ptr @@ -19714,33 +21202,33 @@ class basic_json } /*! - @brief get a reference value (implicit) + @brief get a reference value (implicit) - Implicit reference access to the internally stored JSON value. No copies - are made. + Implicit reference access to the internally stored JSON value. No copies + are made. - @warning Writing data to the referee of the result yields an undefined - state. + @warning Writing data to the referee of the result yields an undefined + state. - @tparam ReferenceType reference type; must be a reference to @ref array_t, - @ref object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or - @ref number_float_t. Enforced by static assertion. + @tparam ReferenceType reference type; must be a reference to @ref array_t, + @ref object_t, @ref string_t, @ref boolean_t, @ref number_integer_t, or + @ref number_float_t. Enforced by static assertion. - @return reference to the internally stored JSON value if the requested - reference type @a ReferenceType fits to the JSON value; throws - type_error.303 otherwise + @return reference to the internally stored JSON value if the requested + reference type @a ReferenceType fits to the JSON value; throws + type_error.303 otherwise - @throw type_error.303 in case passed type @a ReferenceType is incompatible - with the stored JSON value; see example below + @throw type_error.303 in case passed type @a ReferenceType is incompatible + with the stored JSON value; see example below - @complexity Constant. + @complexity Constant. - @liveexample{The example shows several calls to `get_ref()`.,get_ref} + @liveexample{The example shows several calls to `get_ref()`.,get_ref} - @since version 1.1.0 - */ + @since version 1.1.0 + */ template::value, int>::type = 0> + std::is_reference::value, int>::type = 0> ReferenceType get_ref() { // delegate call to get_ref_impl @@ -19748,12 +21236,12 @@ class basic_json } /*! - @brief get a reference value (implicit) - @copydoc get_ref() - */ + @brief get a reference value (implicit) + @copydoc get_ref() + */ template < typename ReferenceType, typename std::enable_if < - std::is_reference::value&& - std::is_const::type>::value, int >::type = 0 > + std::is_reference::value && + std::is_const::type>::value, int >::type = 0 > ReferenceType get_ref() const { // delegate call to get_ref_impl @@ -19761,45 +21249,45 @@ class basic_json } /*! - @brief get a value (implicit) + @brief get a value (implicit) - Implicit type conversion between the JSON value and a compatible value. - The call is realized by calling @ref get() const. + Implicit type conversion between the JSON value and a compatible value. + The call is realized by calling @ref get() const. - @tparam ValueType non-pointer type compatible to the JSON value, for - instance `int` for JSON integer numbers, `bool` for JSON booleans, or - `std::vector` types for JSON arrays. The character type of @ref string_t - as well as an initializer list of this type is excluded to avoid - ambiguities as these types implicitly convert to `std::string`. + @tparam ValueType non-pointer type compatible to the JSON value, for + instance `int` for JSON integer numbers, `bool` for JSON booleans, or + `std::vector` types for JSON arrays. The character type of @ref string_t + as well as an initializer list of this type is excluded to avoid + ambiguities as these types implicitly convert to `std::string`. - @return copy of the JSON value, converted to type @a ValueType + @return copy of the JSON value, converted to type @a ValueType - @throw type_error.302 in case passed type @a ValueType is incompatible - to the JSON value type (e.g., the JSON value is of type boolean, but a - string is requested); see example below + @throw type_error.302 in case passed type @a ValueType is incompatible + to the JSON value type (e.g., the JSON value is of type boolean, but a + string is requested); see example below - @complexity Linear in the size of the JSON value. + @complexity Linear in the size of the JSON value. - @liveexample{The example below shows several conversions from JSON values - to other types. There a few things to note: (1) Floating-point numbers can - be converted to integers\, (2) A JSON array can be converted to a standard - `std::vector`\, (3) A JSON object can be converted to C++ - associative containers such as `std::unordered_map`.,operator__ValueType} + @liveexample{The example below shows several conversions from JSON values + to other types. There a few things to note: (1) Floating-point numbers can + be converted to integers\, (2) A JSON array can be converted to a standard + `std::vector`\, (3) A JSON object can be converted to C++ + associative containers such as `std::unordered_map`.,operator__ValueType} - @since version 1.0.0 - */ + @since version 1.0.0 + */ template < typename ValueType, typename std::enable_if < - !std::is_pointer::value&& - !std::is_same>::value&& - !std::is_same::value&& - !detail::is_basic_json::value - && !std::is_same>::value + !std::is_pointer::value && + !std::is_same>::value && + !std::is_same::value && + !detail::is_basic_json::value + && !std::is_same>::value #if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914)) - && !std::is_same::value -#endif - && detail::is_detected::value - , int >::type = 0 > + && !std::is_same::value +#endif // if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914)) + && detail::is_detected::value + , int >::type = 0 > JSON_EXPLICIT operator ValueType() const { // delegate the call to get<>() const @@ -19807,14 +21295,14 @@ class basic_json } /*! - @return reference to the binary value + @return reference to the binary value - @throw type_error.302 if the value is not binary + @throw type_error.302 if the value is not binary - @sa @ref is_binary() to check if the value is binary + @sa @ref is_binary() to check if the value is binary - @since version 3.8.0 - */ + @since version 3.8.0 + */ binary_t& get_binary() { if (!is_binary()) @@ -19848,32 +21336,33 @@ class basic_json /// @{ /*! - @brief access specified array element with bounds checking + @brief access specified array element with bounds checking - Returns a reference to the element at specified location @a idx, with - bounds checking. + Returns a reference to the element at specified location @a idx, with + bounds checking. - @param[in] idx index of the element to access + @param[in] idx index of the element to access - @return reference to the element at index @a idx + @return reference to the element at index @a idx - @throw type_error.304 if the JSON value is not an array; in this case, - calling `at` with an index makes no sense. See example below. - @throw out_of_range.401 if the index @a idx is out of range of the array; - that is, `idx >= size()`. See example below. + @throw type_error.304 if the JSON value is not an array; in this case, + calling `at` with an index makes no sense. See example below. + @throw out_of_range.401 if the index @a idx is out of range of the array; + that is, `idx >= size()`. See example below. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes in the JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. - @complexity Constant. + @complexity Constant. - @since version 1.0.0 + @since version 1.0.0 - @liveexample{The example below shows how array elements can be read and - written using `at()`. It also demonstrates the different exceptions that - can be thrown.,at__size_type} - */ - reference at(size_type idx) + @liveexample{The example below shows how array elements can be read and + written using `at()`. It also demonstrates the different exceptions that + can be thrown.,at__size_type} + */ + reference at( + size_type idx) { // at only works for arrays if (JSON_HEDLEY_LIKELY(is_array())) @@ -19895,32 +21384,33 @@ class basic_json } /*! - @brief access specified array element with bounds checking + @brief access specified array element with bounds checking - Returns a const reference to the element at specified location @a idx, - with bounds checking. + Returns a const reference to the element at specified location @a idx, + with bounds checking. - @param[in] idx index of the element to access + @param[in] idx index of the element to access - @return const reference to the element at index @a idx + @return const reference to the element at index @a idx - @throw type_error.304 if the JSON value is not an array; in this case, - calling `at` with an index makes no sense. See example below. - @throw out_of_range.401 if the index @a idx is out of range of the array; - that is, `idx >= size()`. See example below. + @throw type_error.304 if the JSON value is not an array; in this case, + calling `at` with an index makes no sense. See example below. + @throw out_of_range.401 if the index @a idx is out of range of the array; + that is, `idx >= size()`. See example below. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes in the JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. - @complexity Constant. + @complexity Constant. - @since version 1.0.0 + @since version 1.0.0 - @liveexample{The example below shows how array elements can be read using - `at()`. It also demonstrates the different exceptions that can be thrown., - at__size_type_const} - */ - const_reference at(size_type idx) const + @liveexample{The example below shows how array elements can be read using + `at()`. It also demonstrates the different exceptions that can be thrown., + at__size_type_const} + */ + const_reference at( + size_type idx) const { // at only works for arrays if (JSON_HEDLEY_LIKELY(is_array())) @@ -19942,36 +21432,37 @@ class basic_json } /*! - @brief access specified object element with bounds checking + @brief access specified object element with bounds checking - Returns a reference to the element at with specified key @a key, with - bounds checking. + Returns a reference to the element at with specified key @a key, with + bounds checking. - @param[in] key key of the element to access + @param[in] key key of the element to access - @return reference to the element at key @a key + @return reference to the element at key @a key - @throw type_error.304 if the JSON value is not an object; in this case, - calling `at` with a key makes no sense. See example below. - @throw out_of_range.403 if the key @a key is is not stored in the object; - that is, `find(key) == end()`. See example below. + @throw type_error.304 if the JSON value is not an object; in this case, + calling `at` with a key makes no sense. See example below. + @throw out_of_range.403 if the key @a key is is not stored in the object; + that is, `find(key) == end()`. See example below. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes in the JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. - @complexity Logarithmic in the size of the container. + @complexity Logarithmic in the size of the container. - @sa @ref operator[](const typename object_t::key_type&) for unchecked - access by reference - @sa @ref value() for access by value with a default value + @sa @ref operator[](const typename object_t::key_type&) for unchecked + access by reference + @sa @ref value() for access by value with a default value - @since version 1.0.0 + @since version 1.0.0 - @liveexample{The example below shows how object elements can be read and - written using `at()`. It also demonstrates the different exceptions that - can be thrown.,at__object_t_key_type} - */ - reference at(const typename object_t::key_type& key) + @liveexample{The example below shows how object elements can be read and + written using `at()`. It also demonstrates the different exceptions that + can be thrown.,at__object_t_key_type} + */ + reference at( + const typename object_t::key_type& key) { // at only works for objects if (JSON_HEDLEY_LIKELY(is_object())) @@ -19993,36 +21484,37 @@ class basic_json } /*! - @brief access specified object element with bounds checking + @brief access specified object element with bounds checking - Returns a const reference to the element at with specified key @a key, - with bounds checking. + Returns a const reference to the element at with specified key @a key, + with bounds checking. - @param[in] key key of the element to access + @param[in] key key of the element to access - @return const reference to the element at key @a key + @return const reference to the element at key @a key - @throw type_error.304 if the JSON value is not an object; in this case, - calling `at` with a key makes no sense. See example below. - @throw out_of_range.403 if the key @a key is is not stored in the object; - that is, `find(key) == end()`. See example below. + @throw type_error.304 if the JSON value is not an object; in this case, + calling `at` with a key makes no sense. See example below. + @throw out_of_range.403 if the key @a key is is not stored in the object; + that is, `find(key) == end()`. See example below. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes in the JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. - @complexity Logarithmic in the size of the container. + @complexity Logarithmic in the size of the container. - @sa @ref operator[](const typename object_t::key_type&) for unchecked - access by reference - @sa @ref value() for access by value with a default value + @sa @ref operator[](const typename object_t::key_type&) for unchecked + access by reference + @sa @ref value() for access by value with a default value - @since version 1.0.0 + @since version 1.0.0 - @liveexample{The example below shows how object elements can be read using - `at()`. It also demonstrates the different exceptions that can be thrown., - at__object_t_key_type_const} - */ - const_reference at(const typename object_t::key_type& key) const + @liveexample{The example below shows how object elements can be read using + `at()`. It also demonstrates the different exceptions that can be thrown., + at__object_t_key_type_const} + */ + const_reference at( + const typename object_t::key_type& key) const { // at only works for objects if (JSON_HEDLEY_LIKELY(is_object())) @@ -20044,31 +21536,32 @@ class basic_json } /*! - @brief access specified array element + @brief access specified array element - Returns a reference to the element at specified location @a idx. + Returns a reference to the element at specified location @a idx. - @note If @a idx is beyond the range of the array (i.e., `idx >= size()`), - then the array is silently filled up with `null` values to make `idx` a - valid reference to the last stored element. + @note If @a idx is beyond the range of the array (i.e., `idx >= size()`), + then the array is silently filled up with `null` values to make `idx` a + valid reference to the last stored element. - @param[in] idx index of the element to access + @param[in] idx index of the element to access - @return reference to the element at index @a idx + @return reference to the element at index @a idx - @throw type_error.305 if the JSON value is not an array or null; in that - cases, using the [] operator with an index makes no sense. + @throw type_error.305 if the JSON value is not an array or null; in that + cases, using the [] operator with an index makes no sense. - @complexity Constant if @a idx is in the range of the array. Otherwise - linear in `idx - size()`. + @complexity Constant if @a idx is in the range of the array. Otherwise + linear in `idx - size()`. - @liveexample{The example below shows how array elements can be read and - written using `[]` operator. Note the addition of `null` - values.,operatorarray__size_type} + @liveexample{The example below shows how array elements can be read and + written using `[]` operator. Note the addition of `null` + values.,operatorarray__size_type} - @since version 1.0.0 - */ - reference operator[](size_type idx) + @since version 1.0.0 + */ + reference operator []( + size_type idx) { // implicitly convert null value to an empty array if (is_null()) @@ -20085,74 +21578,78 @@ class basic_json if (idx >= m_value.array->size()) { m_value.array->insert(m_value.array->end(), - idx - m_value.array->size() + 1, - basic_json()); + idx - m_value.array->size() + 1, + basic_json()); } - return m_value.array->operator[](idx); + return m_value.array->operator [](idx); } - JSON_THROW(type_error::create(305, "cannot use operator[] with a numeric argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, + "cannot use operator[] with a numeric argument with " + std::string(type_name()))); } /*! - @brief access specified array element + @brief access specified array element - Returns a const reference to the element at specified location @a idx. + Returns a const reference to the element at specified location @a idx. - @param[in] idx index of the element to access + @param[in] idx index of the element to access - @return const reference to the element at index @a idx + @return const reference to the element at index @a idx - @throw type_error.305 if the JSON value is not an array; in that case, - using the [] operator with an index makes no sense. + @throw type_error.305 if the JSON value is not an array; in that case, + using the [] operator with an index makes no sense. - @complexity Constant. + @complexity Constant. - @liveexample{The example below shows how array elements can be read using - the `[]` operator.,operatorarray__size_type_const} + @liveexample{The example below shows how array elements can be read using + the `[]` operator.,operatorarray__size_type_const} - @since version 1.0.0 - */ - const_reference operator[](size_type idx) const + @since version 1.0.0 + */ + const_reference operator []( + size_type idx) const { // const operator[] only works for arrays if (JSON_HEDLEY_LIKELY(is_array())) { - return m_value.array->operator[](idx); + return m_value.array->operator [](idx); } - JSON_THROW(type_error::create(305, "cannot use operator[] with a numeric argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, + "cannot use operator[] with a numeric argument with " + std::string(type_name()))); } /*! - @brief access specified object element + @brief access specified object element - Returns a reference to the element at with specified key @a key. + Returns a reference to the element at with specified key @a key. - @note If @a key is not found in the object, then it is silently added to - the object and filled with a `null` value to make `key` a valid reference. - In case the value was `null` before, it is converted to an object. + @note If @a key is not found in the object, then it is silently added to + the object and filled with a `null` value to make `key` a valid reference. + In case the value was `null` before, it is converted to an object. - @param[in] key key of the element to access + @param[in] key key of the element to access - @return reference to the element at key @a key + @return reference to the element at key @a key - @throw type_error.305 if the JSON value is not an object or null; in that - cases, using the [] operator with a key makes no sense. + @throw type_error.305 if the JSON value is not an object or null; in that + cases, using the [] operator with a key makes no sense. - @complexity Logarithmic in the size of the container. + @complexity Logarithmic in the size of the container. - @liveexample{The example below shows how object elements can be read and - written using the `[]` operator.,operatorarray__key_type} + @liveexample{The example below shows how object elements can be read and + written using the `[]` operator.,operatorarray__key_type} - @sa @ref at(const typename object_t::key_type&) for access by reference - with range checking - @sa @ref value() for access by value with a default value + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value - @since version 1.0.0 - */ - reference operator[](const typename object_t::key_type& key) + @since version 1.0.0 + */ + reference operator []( + const typename object_t::key_type& key) { // implicitly convert null value to an empty object if (is_null()) @@ -20165,43 +21662,45 @@ class basic_json // operator[] only works for objects if (JSON_HEDLEY_LIKELY(is_object())) { - return m_value.object->operator[](key); + return m_value.object->operator [](key); } - JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, + "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! - @brief read-only access specified object element + @brief read-only access specified object element - Returns a const reference to the element at with specified key @a key. No - bounds checking is performed. + Returns a const reference to the element at with specified key @a key. No + bounds checking is performed. - @warning If the element with key @a key does not exist, the behavior is - undefined. + @warning If the element with key @a key does not exist, the behavior is + undefined. - @param[in] key key of the element to access + @param[in] key key of the element to access - @return const reference to the element at key @a key + @return const reference to the element at key @a key - @pre The element with key @a key must exist. **This precondition is + @pre The element with key @a key must exist. **This precondition is enforced with an assertion.** - @throw type_error.305 if the JSON value is not an object; in that case, - using the [] operator with a key makes no sense. + @throw type_error.305 if the JSON value is not an object; in that case, + using the [] operator with a key makes no sense. - @complexity Logarithmic in the size of the container. + @complexity Logarithmic in the size of the container. - @liveexample{The example below shows how object elements can be read using - the `[]` operator.,operatorarray__key_type_const} + @liveexample{The example below shows how object elements can be read using + the `[]` operator.,operatorarray__key_type_const} - @sa @ref at(const typename object_t::key_type&) for access by reference - with range checking - @sa @ref value() for access by value with a default value + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value - @since version 1.0.0 - */ - const_reference operator[](const typename object_t::key_type& key) const + @since version 1.0.0 + */ + const_reference operator []( + const typename object_t::key_type& key) const { // const operator[] only works for objects if (JSON_HEDLEY_LIKELY(is_object())) @@ -20210,39 +21709,41 @@ class basic_json return m_value.object->find(key)->second; } - JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, + "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! - @brief access specified object element + @brief access specified object element - Returns a reference to the element at with specified key @a key. + Returns a reference to the element at with specified key @a key. - @note If @a key is not found in the object, then it is silently added to - the object and filled with a `null` value to make `key` a valid reference. - In case the value was `null` before, it is converted to an object. + @note If @a key is not found in the object, then it is silently added to + the object and filled with a `null` value to make `key` a valid reference. + In case the value was `null` before, it is converted to an object. - @param[in] key key of the element to access + @param[in] key key of the element to access - @return reference to the element at key @a key + @return reference to the element at key @a key - @throw type_error.305 if the JSON value is not an object or null; in that - cases, using the [] operator with a key makes no sense. + @throw type_error.305 if the JSON value is not an object or null; in that + cases, using the [] operator with a key makes no sense. - @complexity Logarithmic in the size of the container. + @complexity Logarithmic in the size of the container. - @liveexample{The example below shows how object elements can be read and - written using the `[]` operator.,operatorarray__key_type} + @liveexample{The example below shows how object elements can be read and + written using the `[]` operator.,operatorarray__key_type} - @sa @ref at(const typename object_t::key_type&) for access by reference - with range checking - @sa @ref value() for access by value with a default value + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value - @since version 1.1.0 - */ + @since version 1.1.0 + */ template JSON_HEDLEY_NON_NULL(2) - reference operator[](T* key) + reference operator []( + T* key) { // implicitly convert null to object if (is_null()) @@ -20255,45 +21756,47 @@ class basic_json // at only works for objects if (JSON_HEDLEY_LIKELY(is_object())) { - return m_value.object->operator[](key); + return m_value.object->operator [](key); } - JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, + "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! - @brief read-only access specified object element + @brief read-only access specified object element - Returns a const reference to the element at with specified key @a key. No - bounds checking is performed. + Returns a const reference to the element at with specified key @a key. No + bounds checking is performed. - @warning If the element with key @a key does not exist, the behavior is - undefined. + @warning If the element with key @a key does not exist, the behavior is + undefined. - @param[in] key key of the element to access + @param[in] key key of the element to access - @return const reference to the element at key @a key + @return const reference to the element at key @a key - @pre The element with key @a key must exist. **This precondition is + @pre The element with key @a key must exist. **This precondition is enforced with an assertion.** - @throw type_error.305 if the JSON value is not an object; in that case, - using the [] operator with a key makes no sense. + @throw type_error.305 if the JSON value is not an object; in that case, + using the [] operator with a key makes no sense. - @complexity Logarithmic in the size of the container. + @complexity Logarithmic in the size of the container. - @liveexample{The example below shows how object elements can be read using - the `[]` operator.,operatorarray__key_type_const} + @liveexample{The example below shows how object elements can be read using + the `[]` operator.,operatorarray__key_type_const} - @sa @ref at(const typename object_t::key_type&) for access by reference - with range checking - @sa @ref value() for access by value with a default value + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref value() for access by value with a default value - @since version 1.1.0 - */ + @since version 1.1.0 + */ template JSON_HEDLEY_NON_NULL(2) - const_reference operator[](T* key) const + const_reference operator []( + T* key) const { // at only works for objects if (JSON_HEDLEY_LIKELY(is_object())) @@ -20302,64 +21805,67 @@ class basic_json return m_value.object->find(key)->second; } - JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name()))); + JSON_THROW(type_error::create(305, + "cannot use operator[] with a string argument with " + std::string(type_name()))); } /*! - @brief access specified object element with default value + @brief access specified object element with default value - Returns either a copy of an object's element at the specified key @a key - or a given default value if no element with key @a key exists. + Returns either a copy of an object's element at the specified key @a key + or a given default value if no element with key @a key exists. - The function is basically equivalent to executing - @code {.cpp} - try { + The function is basically equivalent to executing + @code {.cpp} + try { return at(key); - } catch(out_of_range) { + } catch(out_of_range) { return default_value; - } - @endcode + } + @endcode - @note Unlike @ref at(const typename object_t::key_type&), this function - does not throw if the given key @a key was not found. + @note Unlike @ref at(const typename object_t::key_type&), this function + does not throw if the given key @a key was not found. - @note Unlike @ref operator[](const typename object_t::key_type& key), this - function does not implicitly add an element to the position defined by @a - key. This function is furthermore also applicable to const objects. + @note Unlike @ref operator[](const typename object_t::key_type& key), this + function does not implicitly add an element to the position defined by @a + key. This function is furthermore also applicable to const objects. - @param[in] key key of the element to access - @param[in] default_value the value to return if @a key is not found + @param[in] key key of the element to access + @param[in] default_value the value to return if @a key is not found - @tparam ValueType type compatible to JSON values, for instance `int` for - JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for - JSON arrays. Note the type of the expected value at @a key and the default - value @a default_value must be compatible. + @tparam ValueType type compatible to JSON values, for instance `int` for + JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for + JSON arrays. Note the type of the expected value at @a key and the default + value @a default_value must be compatible. - @return copy of the element at key @a key or @a default_value if @a key - is not found + @return copy of the element at key @a key or @a default_value if @a key + is not found - @throw type_error.302 if @a default_value does not match the type of the - value at @a key - @throw type_error.306 if the JSON value is not an object; in that case, - using `value()` with a key makes no sense. + @throw type_error.302 if @a default_value does not match the type of the + value at @a key + @throw type_error.306 if the JSON value is not an object; in that case, + using `value()` with a key makes no sense. - @complexity Logarithmic in the size of the container. + @complexity Logarithmic in the size of the container. - @liveexample{The example below shows how object elements can be queried - with a default value.,basic_json__value} + @liveexample{The example below shows how object elements can be queried + with a default value.,basic_json__value} - @sa @ref at(const typename object_t::key_type&) for access by reference - with range checking - @sa @ref operator[](const typename object_t::key_type&) for unchecked - access by reference + @sa @ref at(const typename object_t::key_type&) for access by reference + with range checking + @sa @ref operator[](const typename object_t::key_type&) for unchecked + access by reference - @since version 1.0.0 - */ + @since version 1.0.0 + */ // using std::is_convertible in a std::enable_if will fail when using explicit conversions template < class ValueType, typename std::enable_if < - detail::is_getable::value - && !std::is_same::value, int >::type = 0 > - ValueType value(const typename object_t::key_type& key, const ValueType& default_value) const + detail::is_getable::value + && !std::is_same::value, int >::type = 0 > + ValueType value( + const typename object_t::key_type& key, + const ValueType& default_value) const { // at only works for objects if (JSON_HEDLEY_LIKELY(is_object())) @@ -20378,60 +21884,64 @@ class basic_json } /*! - @brief overload for a default value of type const char* - @copydoc basic_json::value(const typename object_t::key_type&, const ValueType&) const - */ - string_t value(const typename object_t::key_type& key, const char* default_value) const + @brief overload for a default value of type const char* + @copydoc basic_json::value(const typename object_t::key_type&, const ValueType&) const + */ + string_t value( + const typename object_t::key_type& key, + const char* default_value) const { return value(key, string_t(default_value)); } /*! - @brief access specified object element via JSON Pointer with default value + @brief access specified object element via JSON Pointer with default value - Returns either a copy of an object's element at the specified key @a key - or a given default value if no element with key @a key exists. + Returns either a copy of an object's element at the specified key @a key + or a given default value if no element with key @a key exists. - The function is basically equivalent to executing - @code {.cpp} - try { + The function is basically equivalent to executing + @code {.cpp} + try { return at(ptr); - } catch(out_of_range) { + } catch(out_of_range) { return default_value; - } - @endcode + } + @endcode - @note Unlike @ref at(const json_pointer&), this function does not throw - if the given key @a key was not found. + @note Unlike @ref at(const json_pointer&), this function does not throw + if the given key @a key was not found. - @param[in] ptr a JSON pointer to the element to access - @param[in] default_value the value to return if @a ptr found no value + @param[in] ptr a JSON pointer to the element to access + @param[in] default_value the value to return if @a ptr found no value - @tparam ValueType type compatible to JSON values, for instance `int` for - JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for - JSON arrays. Note the type of the expected value at @a key and the default - value @a default_value must be compatible. + @tparam ValueType type compatible to JSON values, for instance `int` for + JSON integer numbers, `bool` for JSON booleans, or `std::vector` types for + JSON arrays. Note the type of the expected value at @a key and the default + value @a default_value must be compatible. - @return copy of the element at key @a key or @a default_value if @a key - is not found + @return copy of the element at key @a key or @a default_value if @a key + is not found - @throw type_error.302 if @a default_value does not match the type of the - value at @a ptr - @throw type_error.306 if the JSON value is not an object; in that case, - using `value()` with a key makes no sense. + @throw type_error.302 if @a default_value does not match the type of the + value at @a ptr + @throw type_error.306 if the JSON value is not an object; in that case, + using `value()` with a key makes no sense. - @complexity Logarithmic in the size of the container. + @complexity Logarithmic in the size of the container. - @liveexample{The example below shows how object elements can be queried - with a default value.,basic_json__value_ptr} + @liveexample{The example below shows how object elements can be queried + with a default value.,basic_json__value_ptr} - @sa @ref operator[](const json_pointer&) for unchecked access by reference + @sa @ref operator[](const json_pointer&) for unchecked access by reference - @since version 2.0.2 - */ + @since version 2.0.2 + */ template::value, int>::type = 0> - ValueType value(const json_pointer& ptr, const ValueType& default_value) const + detail::is_getable::value, int>::type = 0> + ValueType value( + const json_pointer& ptr, + const ValueType& default_value) const { // at only works for objects if (JSON_HEDLEY_LIKELY(is_object())) @@ -20451,84 +21961,86 @@ class basic_json } /*! - @brief overload for a default value of type const char* - @copydoc basic_json::value(const json_pointer&, ValueType) const - */ + @brief overload for a default value of type const char* + @copydoc basic_json::value(const json_pointer&, ValueType) const + */ JSON_HEDLEY_NON_NULL(3) - string_t value(const json_pointer& ptr, const char* default_value) const + string_t value( + const json_pointer& ptr, + const char* default_value) const { return value(ptr, string_t(default_value)); } /*! - @brief access the first element + @brief access the first element - Returns a reference to the first element in the container. For a JSON - container `c`, the expression `c.front()` is equivalent to `*c.begin()`. + Returns a reference to the first element in the container. For a JSON + container `c`, the expression `c.front()` is equivalent to `*c.begin()`. - @return In case of a structured type (array or object), a reference to the - first element is returned. In case of number, string, boolean, or binary - values, a reference to the value is returned. + @return In case of a structured type (array or object), a reference to the + first element is returned. In case of number, string, boolean, or binary + values, a reference to the value is returned. - @complexity Constant. + @complexity Constant. - @pre The JSON value must not be `null` (would throw `std::out_of_range`) - or an empty array or object (undefined behavior, **guarded by - assertions**). - @post The JSON value remains unchanged. + @pre The JSON value must not be `null` (would throw `std::out_of_range`) + or an empty array or object (undefined behavior, **guarded by + assertions**). + @post The JSON value remains unchanged. - @throw invalid_iterator.214 when called on `null` value + @throw invalid_iterator.214 when called on `null` value - @liveexample{The following code shows an example for `front()`.,front} + @liveexample{The following code shows an example for `front()`.,front} - @sa @ref back() -- access the last element + @sa @ref back() -- access the last element - @since version 1.0.0 - */ + @since version 1.0.0 + */ reference front() { return *begin(); } /*! - @copydoc basic_json::front() - */ + @copydoc basic_json::front() + */ const_reference front() const { return *cbegin(); } /*! - @brief access the last element + @brief access the last element - Returns a reference to the last element in the container. For a JSON - container `c`, the expression `c.back()` is equivalent to - @code {.cpp} - auto tmp = c.end(); - --tmp; - return *tmp; - @endcode + Returns a reference to the last element in the container. For a JSON + container `c`, the expression `c.back()` is equivalent to + @code {.cpp} + auto tmp = c.end(); + --tmp; + return *tmp; + @endcode - @return In case of a structured type (array or object), a reference to the - last element is returned. In case of number, string, boolean, or binary - values, a reference to the value is returned. + @return In case of a structured type (array or object), a reference to the + last element is returned. In case of number, string, boolean, or binary + values, a reference to the value is returned. - @complexity Constant. + @complexity Constant. - @pre The JSON value must not be `null` (would throw `std::out_of_range`) - or an empty array or object (undefined behavior, **guarded by - assertions**). - @post The JSON value remains unchanged. + @pre The JSON value must not be `null` (would throw `std::out_of_range`) + or an empty array or object (undefined behavior, **guarded by + assertions**). + @post The JSON value remains unchanged. - @throw invalid_iterator.214 when called on a `null` value. See example - below. + @throw invalid_iterator.214 when called on a `null` value. See example + below. - @liveexample{The following code shows an example for `back()`.,back} + @liveexample{The following code shows an example for `back()`.,back} - @sa @ref front() -- access the first element + @sa @ref front() -- access the first element - @since version 1.0.0 - */ + @since version 1.0.0 + */ reference back() { auto tmp = end(); @@ -20537,8 +22049,8 @@ class basic_json } /*! - @copydoc basic_json::back() - */ + @copydoc basic_json::back() + */ const_reference back() const { auto tmp = cend(); @@ -20547,56 +22059,57 @@ class basic_json } /*! - @brief remove element given an iterator + @brief remove element given an iterator - Removes the element specified by iterator @a pos. The iterator @a pos must - be valid and dereferenceable. Thus the `end()` iterator (which is valid, - but is not dereferenceable) cannot be used as a value for @a pos. + Removes the element specified by iterator @a pos. The iterator @a pos must + be valid and dereferenceable. Thus the `end()` iterator (which is valid, + but is not dereferenceable) cannot be used as a value for @a pos. - If called on a primitive type other than `null`, the resulting JSON value - will be `null`. + If called on a primitive type other than `null`, the resulting JSON value + will be `null`. - @param[in] pos iterator to the element to remove - @return Iterator following the last removed element. If the iterator @a - pos refers to the last element, the `end()` iterator is returned. + @param[in] pos iterator to the element to remove + @return Iterator following the last removed element. If the iterator @a + pos refers to the last element, the `end()` iterator is returned. - @tparam IteratorType an @ref iterator or @ref const_iterator + @tparam IteratorType an @ref iterator or @ref const_iterator - @post Invalidates iterators and references at or after the point of the - erase, including the `end()` iterator. + @post Invalidates iterators and references at or after the point of the + erase, including the `end()` iterator. - @throw type_error.307 if called on a `null` value; example: `"cannot use - erase() with null"` - @throw invalid_iterator.202 if called on an iterator which does not belong - to the current JSON value; example: `"iterator does not fit current - value"` - @throw invalid_iterator.205 if called on a primitive type with invalid - iterator (i.e., any iterator which is not `begin()`); example: `"iterator - out of range"` + @throw type_error.307 if called on a `null` value; example: `"cannot use + erase() with null"` + @throw invalid_iterator.202 if called on an iterator which does not belong + to the current JSON value; example: `"iterator does not fit current + value"` + @throw invalid_iterator.205 if called on a primitive type with invalid + iterator (i.e., any iterator which is not `begin()`); example: `"iterator + out of range"` - @complexity The complexity depends on the type: - - objects: amortized constant - - arrays: linear in distance between @a pos and the end of the container - - strings and binary: linear in the length of the member - - other types: constant + @complexity The complexity depends on the type: + - objects: amortized constant + - arrays: linear in distance between @a pos and the end of the container + - strings and binary: linear in the length of the member + - other types: constant - @liveexample{The example shows the result of `erase()` for different JSON - types.,erase__IteratorType} + @liveexample{The example shows the result of `erase()` for different JSON + types.,erase__IteratorType} - @sa @ref erase(IteratorType, IteratorType) -- removes the elements in - the given range - @sa @ref erase(const typename object_t::key_type&) -- removes the element - from an object at the given key - @sa @ref erase(const size_type) -- removes the element from an array at - the given index + @sa @ref erase(IteratorType, IteratorType) -- removes the elements in + the given range + @sa @ref erase(const typename object_t::key_type&) -- removes the element + from an object at the given key + @sa @ref erase(const size_type) -- removes the element from an array at + the given index - @since version 1.0.0 - */ + @since version 1.0.0 + */ template < class IteratorType, typename std::enable_if < - std::is_same::value || - std::is_same::value, int >::type - = 0 > - IteratorType erase(IteratorType pos) + std::is_same::value || + std::is_same::value, int >::type + = 0 > + IteratorType erase( + IteratorType pos) { // make sure iterator fits the current value if (JSON_HEDLEY_UNLIKELY(this != pos.m_object)) @@ -20660,56 +22173,58 @@ class basic_json } /*! - @brief remove elements given an iterator range + @brief remove elements given an iterator range - Removes the element specified by the range `[first; last)`. The iterator - @a first does not need to be dereferenceable if `first == last`: erasing - an empty range is a no-op. + Removes the element specified by the range `[first; last)`. The iterator + @a first does not need to be dereferenceable if `first == last`: erasing + an empty range is a no-op. - If called on a primitive type other than `null`, the resulting JSON value - will be `null`. + If called on a primitive type other than `null`, the resulting JSON value + will be `null`. - @param[in] first iterator to the beginning of the range to remove - @param[in] last iterator past the end of the range to remove - @return Iterator following the last removed element. If the iterator @a - second refers to the last element, the `end()` iterator is returned. + @param[in] first iterator to the beginning of the range to remove + @param[in] last iterator past the end of the range to remove + @return Iterator following the last removed element. If the iterator @a + second refers to the last element, the `end()` iterator is returned. - @tparam IteratorType an @ref iterator or @ref const_iterator + @tparam IteratorType an @ref iterator or @ref const_iterator - @post Invalidates iterators and references at or after the point of the - erase, including the `end()` iterator. + @post Invalidates iterators and references at or after the point of the + erase, including the `end()` iterator. - @throw type_error.307 if called on a `null` value; example: `"cannot use - erase() with null"` - @throw invalid_iterator.203 if called on iterators which does not belong - to the current JSON value; example: `"iterators do not fit current value"` - @throw invalid_iterator.204 if called on a primitive type with invalid - iterators (i.e., if `first != begin()` and `last != end()`); example: - `"iterators out of range"` + @throw type_error.307 if called on a `null` value; example: `"cannot use + erase() with null"` + @throw invalid_iterator.203 if called on iterators which does not belong + to the current JSON value; example: `"iterators do not fit current value"` + @throw invalid_iterator.204 if called on a primitive type with invalid + iterators (i.e., if `first != begin()` and `last != end()`); example: + `"iterators out of range"` - @complexity The complexity depends on the type: - - objects: `log(size()) + std::distance(first, last)` - - arrays: linear in the distance between @a first and @a last, plus linear - in the distance between @a last and end of the container - - strings and binary: linear in the length of the member - - other types: constant + @complexity The complexity depends on the type: + - objects: `log(size()) + std::distance(first, last)` + - arrays: linear in the distance between @a first and @a last, plus linear + in the distance between @a last and end of the container + - strings and binary: linear in the length of the member + - other types: constant - @liveexample{The example shows the result of `erase()` for different JSON - types.,erase__IteratorType_IteratorType} + @liveexample{The example shows the result of `erase()` for different JSON + types.,erase__IteratorType_IteratorType} - @sa @ref erase(IteratorType) -- removes the element at a given position - @sa @ref erase(const typename object_t::key_type&) -- removes the element - from an object at the given key - @sa @ref erase(const size_type) -- removes the element from an array at - the given index + @sa @ref erase(IteratorType) -- removes the element at a given position + @sa @ref erase(const typename object_t::key_type&) -- removes the element + from an object at the given key + @sa @ref erase(const size_type) -- removes the element from an array at + the given index - @since version 1.0.0 - */ + @since version 1.0.0 + */ template < class IteratorType, typename std::enable_if < - std::is_same::value || - std::is_same::value, int >::type - = 0 > - IteratorType erase(IteratorType first, IteratorType last) + std::is_same::value || + std::is_same::value, int >::type + = 0 > + IteratorType erase( + IteratorType first, + IteratorType last) { // make sure iterator fits the current value if (JSON_HEDLEY_UNLIKELY(this != first.m_object || this != last.m_object)) @@ -20729,7 +22244,7 @@ class basic_json case value_t::binary: { if (JSON_HEDLEY_LIKELY(!first.m_it.primitive_iterator.is_begin() - || !last.m_it.primitive_iterator.is_end())) + || !last.m_it.primitive_iterator.is_end())) { JSON_THROW(invalid_iterator::create(204, "iterators out of range")); } @@ -20757,14 +22272,14 @@ class basic_json case value_t::object: { result.m_it.object_iterator = m_value.object->erase(first.m_it.object_iterator, - last.m_it.object_iterator); + last.m_it.object_iterator); break; } case value_t::array: { result.m_it.array_iterator = m_value.array->erase(first.m_it.array_iterator, - last.m_it.array_iterator); + last.m_it.array_iterator); break; } @@ -20776,35 +22291,36 @@ class basic_json } /*! - @brief remove element from a JSON object given a key + @brief remove element from a JSON object given a key - Removes elements from a JSON object with the key value @a key. + Removes elements from a JSON object with the key value @a key. - @param[in] key value of the elements to remove + @param[in] key value of the elements to remove - @return Number of elements removed. If @a ObjectType is the default - `std::map` type, the return value will always be `0` (@a key was not - found) or `1` (@a key was found). + @return Number of elements removed. If @a ObjectType is the default + `std::map` type, the return value will always be `0` (@a key was not + found) or `1` (@a key was found). - @post References and iterators to the erased elements are invalidated. - Other references and iterators are not affected. + @post References and iterators to the erased elements are invalidated. + Other references and iterators are not affected. - @throw type_error.307 when called on a type other than JSON object; - example: `"cannot use erase() with null"` + @throw type_error.307 when called on a type other than JSON object; + example: `"cannot use erase() with null"` - @complexity `log(size()) + count(key)` + @complexity `log(size()) + count(key)` - @liveexample{The example shows the effect of `erase()`.,erase__key_type} + @liveexample{The example shows the effect of `erase()`.,erase__key_type} - @sa @ref erase(IteratorType) -- removes the element at a given position - @sa @ref erase(IteratorType, IteratorType) -- removes the elements in - the given range - @sa @ref erase(const size_type) -- removes the element from an array at - the given index + @sa @ref erase(IteratorType) -- removes the element at a given position + @sa @ref erase(IteratorType, IteratorType) -- removes the elements in + the given range + @sa @ref erase(const size_type) -- removes the element from an array at + the given index - @since version 1.0.0 - */ - size_type erase(const typename object_t::key_type& key) + @since version 1.0.0 + */ + size_type erase( + const typename object_t::key_type& key) { // this erase only works for objects if (JSON_HEDLEY_LIKELY(is_object())) @@ -20816,30 +22332,31 @@ class basic_json } /*! - @brief remove element from a JSON array given an index + @brief remove element from a JSON array given an index - Removes element from a JSON array at the index @a idx. + Removes element from a JSON array at the index @a idx. - @param[in] idx index of the element to remove + @param[in] idx index of the element to remove - @throw type_error.307 when called on a type other than JSON object; - example: `"cannot use erase() with null"` - @throw out_of_range.401 when `idx >= size()`; example: `"array index 17 - is out of range"` + @throw type_error.307 when called on a type other than JSON object; + example: `"cannot use erase() with null"` + @throw out_of_range.401 when `idx >= size()`; example: `"array index 17 + is out of range"` - @complexity Linear in distance between @a idx and the end of the container. + @complexity Linear in distance between @a idx and the end of the container. - @liveexample{The example shows the effect of `erase()`.,erase__size_type} + @liveexample{The example shows the effect of `erase()`.,erase__size_type} - @sa @ref erase(IteratorType) -- removes the element at a given position - @sa @ref erase(IteratorType, IteratorType) -- removes the elements in - the given range - @sa @ref erase(const typename object_t::key_type&) -- removes the element - from an object at the given key + @sa @ref erase(IteratorType) -- removes the element at a given position + @sa @ref erase(IteratorType, IteratorType) -- removes the elements in + the given range + @sa @ref erase(const typename object_t::key_type&) -- removes the element + from an object at the given key - @since version 1.0.0 - */ - void erase(const size_type idx) + @since version 1.0.0 + */ + void erase( + const size_type idx) { // this erase only works for arrays if (JSON_HEDLEY_LIKELY(is_array())) @@ -20868,31 +22385,32 @@ class basic_json /// @{ /*! - @brief find an element in a JSON object + @brief find an element in a JSON object - Finds an element in a JSON object with key equivalent to @a key. If the - element is not found or the JSON value is not an object, end() is - returned. + Finds an element in a JSON object with key equivalent to @a key. If the + element is not found or the JSON value is not an object, end() is + returned. - @note This method always returns @ref end() when executed on a JSON type + @note This method always returns @ref end() when executed on a JSON type that is not an object. - @param[in] key key value of the element to search for. + @param[in] key key value of the element to search for. - @return Iterator to an element with key equivalent to @a key. If no such - element is found or the JSON value is not an object, past-the-end (see - @ref end()) iterator is returned. + @return Iterator to an element with key equivalent to @a key. If no such + element is found or the JSON value is not an object, past-the-end (see + @ref end()) iterator is returned. - @complexity Logarithmic in the size of the JSON object. + @complexity Logarithmic in the size of the JSON object. - @liveexample{The example shows how `find()` is used.,find__key_type} + @liveexample{The example shows how `find()` is used.,find__key_type} - @sa @ref contains(KeyT&&) const -- checks whether a key exists + @sa @ref contains(KeyT&&) const -- checks whether a key exists - @since version 1.0.0 - */ + @since version 1.0.0 + */ template - iterator find(KeyT&& key) + iterator find( + KeyT&& key) { auto result = end(); @@ -20905,11 +22423,12 @@ class basic_json } /*! - @brief find an element in a JSON object - @copydoc find(KeyT&&) - */ + @brief find an element in a JSON object + @copydoc find(KeyT&&) + */ template - const_iterator find(KeyT&& key) const + const_iterator find( + KeyT&& key) const { auto result = cend(); @@ -20922,92 +22441,95 @@ class basic_json } /*! - @brief returns the number of occurrences of a key in a JSON object + @brief returns the number of occurrences of a key in a JSON object - Returns the number of elements with key @a key. If ObjectType is the - default `std::map` type, the return value will always be `0` (@a key was - not found) or `1` (@a key was found). + Returns the number of elements with key @a key. If ObjectType is the + default `std::map` type, the return value will always be `0` (@a key was + not found) or `1` (@a key was found). - @note This method always returns `0` when executed on a JSON type that is + @note This method always returns `0` when executed on a JSON type that is not an object. - @param[in] key key value of the element to count + @param[in] key key value of the element to count - @return Number of elements with key @a key. If the JSON value is not an - object, the return value will be `0`. + @return Number of elements with key @a key. If the JSON value is not an + object, the return value will be `0`. - @complexity Logarithmic in the size of the JSON object. + @complexity Logarithmic in the size of the JSON object. - @liveexample{The example shows how `count()` is used.,count} + @liveexample{The example shows how `count()` is used.,count} - @since version 1.0.0 - */ + @since version 1.0.0 + */ template - size_type count(KeyT&& key) const + size_type count( + KeyT&& key) const { // return 0 for all nonobject types return is_object() ? m_value.object->count(std::forward(key)) : 0; } /*! - @brief check the existence of an element in a JSON object + @brief check the existence of an element in a JSON object - Check whether an element exists in a JSON object with key equivalent to - @a key. If the element is not found or the JSON value is not an object, - false is returned. + Check whether an element exists in a JSON object with key equivalent to + @a key. If the element is not found or the JSON value is not an object, + false is returned. - @note This method always returns false when executed on a JSON type + @note This method always returns false when executed on a JSON type that is not an object. - @param[in] key key value to check its existence. + @param[in] key key value to check its existence. - @return true if an element with specified @a key exists. If no such - element with such key is found or the JSON value is not an object, - false is returned. + @return true if an element with specified @a key exists. If no such + element with such key is found or the JSON value is not an object, + false is returned. - @complexity Logarithmic in the size of the JSON object. + @complexity Logarithmic in the size of the JSON object. - @liveexample{The following code shows an example for `contains()`.,contains} + @liveexample{The following code shows an example for `contains()`.,contains} - @sa @ref find(KeyT&&) -- returns an iterator to an object element - @sa @ref contains(const json_pointer&) const -- checks the existence for a JSON pointer + @sa @ref find(KeyT&&) -- returns an iterator to an object element + @sa @ref contains(const json_pointer&) const -- checks the existence for a JSON pointer - @since version 3.6.0 - */ + @since version 3.6.0 + */ template < typename KeyT, typename std::enable_if < - !std::is_same::type, json_pointer>::value, int >::type = 0 > - bool contains(KeyT && key) const + !std::is_same::type, json_pointer>::value, int >::type = 0 > + bool contains( + KeyT&& key) const { return is_object() && m_value.object->find(std::forward(key)) != m_value.object->end(); } /*! - @brief check the existence of an element in a JSON object given a JSON pointer + @brief check the existence of an element in a JSON object given a JSON pointer - Check whether the given JSON pointer @a ptr can be resolved in the current - JSON value. + Check whether the given JSON pointer @a ptr can be resolved in the current + JSON value. - @note This method can be executed on any JSON value type. + @note This method can be executed on any JSON value type. - @param[in] ptr JSON pointer to check its existence. + @param[in] ptr JSON pointer to check its existence. - @return true if the JSON pointer can be resolved to a stored value, false - otherwise. + @return true if the JSON pointer can be resolved to a stored value, false + otherwise. - @post If `j.contains(ptr)` returns true, it is safe to call `j[ptr]`. + @post If `j.contains(ptr)` returns true, it is safe to call `j[ptr]`. - @throw parse_error.106 if an array index begins with '0' - @throw parse_error.109 if an array index was not a number + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number - @complexity Logarithmic in the size of the JSON object. + @complexity Logarithmic in the size of the JSON object. - @liveexample{The following code shows an example for `contains()`.,contains_json_pointer} + @liveexample{The following code shows an example for `contains()`.,contains_json_pointer} - @sa @ref contains(KeyT &&) const -- checks the existence of a key + @sa @ref contains(KeyT &&) const -- checks the existence of a key - @since version 3.7.0 - */ - bool contains(const json_pointer& ptr) const + @since version 3.7.0 + */ + bool contains( + const json_pointer& ptr) const { return ptr.contains(this); } @@ -21023,29 +22545,29 @@ class basic_json /// @{ /*! - @brief returns an iterator to the first element + @brief returns an iterator to the first element - Returns an iterator to the first element. + Returns an iterator to the first element. - @image html range-begin-end.svg "Illustration from cppreference.com" + @image html range-begin-end.svg "Illustration from cppreference.com" - @return iterator to the first element + @return iterator to the first element - @complexity Constant. + @complexity Constant. - @requirement This function helps `basic_json` satisfying the - [Container](https://en.cppreference.com/w/cpp/named_req/Container) - requirements: - - The complexity is constant. + @requirement This function helps `basic_json` satisfying the + [Container](https://en.cppreference.com/w/cpp/named_req/Container) + requirements: + - The complexity is constant. - @liveexample{The following code shows an example for `begin()`.,begin} + @liveexample{The following code shows an example for `begin()`.,begin} - @sa @ref cbegin() -- returns a const iterator to the beginning - @sa @ref end() -- returns an iterator to the end - @sa @ref cend() -- returns a const iterator to the end + @sa @ref cbegin() -- returns a const iterator to the beginning + @sa @ref end() -- returns an iterator to the end + @sa @ref cend() -- returns a const iterator to the end - @since version 1.0.0 - */ + @since version 1.0.0 + */ iterator begin() noexcept { iterator result(this); @@ -21054,38 +22576,38 @@ class basic_json } /*! - @copydoc basic_json::cbegin() - */ + @copydoc basic_json::cbegin() + */ const_iterator begin() const noexcept { return cbegin(); } /*! - @brief returns a const iterator to the first element + @brief returns a const iterator to the first element - Returns a const iterator to the first element. + Returns a const iterator to the first element. - @image html range-begin-end.svg "Illustration from cppreference.com" + @image html range-begin-end.svg "Illustration from cppreference.com" - @return const iterator to the first element + @return const iterator to the first element - @complexity Constant. + @complexity Constant. - @requirement This function helps `basic_json` satisfying the - [Container](https://en.cppreference.com/w/cpp/named_req/Container) - requirements: - - The complexity is constant. - - Has the semantics of `const_cast(*this).begin()`. + @requirement This function helps `basic_json` satisfying the + [Container](https://en.cppreference.com/w/cpp/named_req/Container) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).begin()`. - @liveexample{The following code shows an example for `cbegin()`.,cbegin} + @liveexample{The following code shows an example for `cbegin()`.,cbegin} - @sa @ref begin() -- returns an iterator to the beginning - @sa @ref end() -- returns an iterator to the end - @sa @ref cend() -- returns a const iterator to the end + @sa @ref begin() -- returns an iterator to the beginning + @sa @ref end() -- returns an iterator to the end + @sa @ref cend() -- returns a const iterator to the end - @since version 1.0.0 - */ + @since version 1.0.0 + */ const_iterator cbegin() const noexcept { const_iterator result(this); @@ -21094,29 +22616,29 @@ class basic_json } /*! - @brief returns an iterator to one past the last element + @brief returns an iterator to one past the last element - Returns an iterator to one past the last element. + Returns an iterator to one past the last element. - @image html range-begin-end.svg "Illustration from cppreference.com" + @image html range-begin-end.svg "Illustration from cppreference.com" - @return iterator one past the last element + @return iterator one past the last element - @complexity Constant. + @complexity Constant. - @requirement This function helps `basic_json` satisfying the - [Container](https://en.cppreference.com/w/cpp/named_req/Container) - requirements: - - The complexity is constant. + @requirement This function helps `basic_json` satisfying the + [Container](https://en.cppreference.com/w/cpp/named_req/Container) + requirements: + - The complexity is constant. - @liveexample{The following code shows an example for `end()`.,end} + @liveexample{The following code shows an example for `end()`.,end} - @sa @ref cend() -- returns a const iterator to the end - @sa @ref begin() -- returns an iterator to the beginning - @sa @ref cbegin() -- returns a const iterator to the beginning + @sa @ref cend() -- returns a const iterator to the end + @sa @ref begin() -- returns an iterator to the beginning + @sa @ref cbegin() -- returns a const iterator to the beginning - @since version 1.0.0 - */ + @since version 1.0.0 + */ iterator end() noexcept { iterator result(this); @@ -21125,38 +22647,38 @@ class basic_json } /*! - @copydoc basic_json::cend() - */ + @copydoc basic_json::cend() + */ const_iterator end() const noexcept { return cend(); } /*! - @brief returns a const iterator to one past the last element + @brief returns a const iterator to one past the last element - Returns a const iterator to one past the last element. + Returns a const iterator to one past the last element. - @image html range-begin-end.svg "Illustration from cppreference.com" + @image html range-begin-end.svg "Illustration from cppreference.com" - @return const iterator one past the last element + @return const iterator one past the last element - @complexity Constant. + @complexity Constant. - @requirement This function helps `basic_json` satisfying the - [Container](https://en.cppreference.com/w/cpp/named_req/Container) - requirements: - - The complexity is constant. - - Has the semantics of `const_cast(*this).end()`. + @requirement This function helps `basic_json` satisfying the + [Container](https://en.cppreference.com/w/cpp/named_req/Container) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).end()`. - @liveexample{The following code shows an example for `cend()`.,cend} + @liveexample{The following code shows an example for `cend()`.,cend} - @sa @ref end() -- returns an iterator to the end - @sa @ref begin() -- returns an iterator to the beginning - @sa @ref cbegin() -- returns a const iterator to the beginning + @sa @ref end() -- returns an iterator to the end + @sa @ref begin() -- returns an iterator to the beginning + @sa @ref cbegin() -- returns a const iterator to the beginning - @since version 1.0.0 - */ + @since version 1.0.0 + */ const_iterator cend() const noexcept { const_iterator result(this); @@ -21165,285 +22687,288 @@ class basic_json } /*! - @brief returns an iterator to the reverse-beginning + @brief returns an iterator to the reverse-beginning - Returns an iterator to the reverse-beginning; that is, the last element. + Returns an iterator to the reverse-beginning; that is, the last element. - @image html range-rbegin-rend.svg "Illustration from cppreference.com" + @image html range-rbegin-rend.svg "Illustration from cppreference.com" - @complexity Constant. + @complexity Constant. - @requirement This function helps `basic_json` satisfying the - [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer) - requirements: - - The complexity is constant. - - Has the semantics of `reverse_iterator(end())`. + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `reverse_iterator(end())`. - @liveexample{The following code shows an example for `rbegin()`.,rbegin} + @liveexample{The following code shows an example for `rbegin()`.,rbegin} - @sa @ref crbegin() -- returns a const reverse iterator to the beginning - @sa @ref rend() -- returns a reverse iterator to the end - @sa @ref crend() -- returns a const reverse iterator to the end + @sa @ref crbegin() -- returns a const reverse iterator to the beginning + @sa @ref rend() -- returns a reverse iterator to the end + @sa @ref crend() -- returns a const reverse iterator to the end - @since version 1.0.0 - */ + @since version 1.0.0 + */ reverse_iterator rbegin() noexcept { return reverse_iterator(end()); } /*! - @copydoc basic_json::crbegin() - */ + @copydoc basic_json::crbegin() + */ const_reverse_iterator rbegin() const noexcept { return crbegin(); } /*! - @brief returns an iterator to the reverse-end + @brief returns an iterator to the reverse-end - Returns an iterator to the reverse-end; that is, one before the first - element. + Returns an iterator to the reverse-end; that is, one before the first + element. - @image html range-rbegin-rend.svg "Illustration from cppreference.com" + @image html range-rbegin-rend.svg "Illustration from cppreference.com" - @complexity Constant. + @complexity Constant. - @requirement This function helps `basic_json` satisfying the - [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer) - requirements: - - The complexity is constant. - - Has the semantics of `reverse_iterator(begin())`. + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `reverse_iterator(begin())`. - @liveexample{The following code shows an example for `rend()`.,rend} + @liveexample{The following code shows an example for `rend()`.,rend} - @sa @ref crend() -- returns a const reverse iterator to the end - @sa @ref rbegin() -- returns a reverse iterator to the beginning - @sa @ref crbegin() -- returns a const reverse iterator to the beginning + @sa @ref crend() -- returns a const reverse iterator to the end + @sa @ref rbegin() -- returns a reverse iterator to the beginning + @sa @ref crbegin() -- returns a const reverse iterator to the beginning - @since version 1.0.0 - */ + @since version 1.0.0 + */ reverse_iterator rend() noexcept { return reverse_iterator(begin()); } /*! - @copydoc basic_json::crend() - */ + @copydoc basic_json::crend() + */ const_reverse_iterator rend() const noexcept { return crend(); } /*! - @brief returns a const reverse iterator to the last element + @brief returns a const reverse iterator to the last element - Returns a const iterator to the reverse-beginning; that is, the last - element. + Returns a const iterator to the reverse-beginning; that is, the last + element. - @image html range-rbegin-rend.svg "Illustration from cppreference.com" + @image html range-rbegin-rend.svg "Illustration from cppreference.com" - @complexity Constant. + @complexity Constant. - @requirement This function helps `basic_json` satisfying the - [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer) - requirements: - - The complexity is constant. - - Has the semantics of `const_cast(*this).rbegin()`. + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).rbegin()`. - @liveexample{The following code shows an example for `crbegin()`.,crbegin} + @liveexample{The following code shows an example for `crbegin()`.,crbegin} - @sa @ref rbegin() -- returns a reverse iterator to the beginning - @sa @ref rend() -- returns a reverse iterator to the end - @sa @ref crend() -- returns a const reverse iterator to the end + @sa @ref rbegin() -- returns a reverse iterator to the beginning + @sa @ref rend() -- returns a reverse iterator to the end + @sa @ref crend() -- returns a const reverse iterator to the end - @since version 1.0.0 - */ + @since version 1.0.0 + */ const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(cend()); } /*! - @brief returns a const reverse iterator to one before the first + @brief returns a const reverse iterator to one before the first - Returns a const reverse iterator to the reverse-end; that is, one before - the first element. + Returns a const reverse iterator to the reverse-end; that is, one before + the first element. - @image html range-rbegin-rend.svg "Illustration from cppreference.com" + @image html range-rbegin-rend.svg "Illustration from cppreference.com" - @complexity Constant. + @complexity Constant. - @requirement This function helps `basic_json` satisfying the - [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer) - requirements: - - The complexity is constant. - - Has the semantics of `const_cast(*this).rend()`. + @requirement This function helps `basic_json` satisfying the + [ReversibleContainer](https://en.cppreference.com/w/cpp/named_req/ReversibleContainer) + requirements: + - The complexity is constant. + - Has the semantics of `const_cast(*this).rend()`. - @liveexample{The following code shows an example for `crend()`.,crend} + @liveexample{The following code shows an example for `crend()`.,crend} - @sa @ref rend() -- returns a reverse iterator to the end - @sa @ref rbegin() -- returns a reverse iterator to the beginning - @sa @ref crbegin() -- returns a const reverse iterator to the beginning + @sa @ref rend() -- returns a reverse iterator to the end + @sa @ref rbegin() -- returns a reverse iterator to the beginning + @sa @ref crbegin() -- returns a const reverse iterator to the beginning - @since version 1.0.0 - */ + @since version 1.0.0 + */ const_reverse_iterator crend() const noexcept { return const_reverse_iterator(cbegin()); } - public: +public: + /*! - @brief wrapper to access iterator member functions in range-based for + @brief wrapper to access iterator member functions in range-based for - This function allows to access @ref iterator::key() and @ref - iterator::value() during range-based for loops. In these loops, a - reference to the JSON values is returned, so there is no access to the - underlying iterator. + This function allows to access @ref iterator::key() and @ref + iterator::value() during range-based for loops. In these loops, a + reference to the JSON values is returned, so there is no access to the + underlying iterator. - For loop without iterator_wrapper: + For loop without iterator_wrapper: - @code{cpp} - for (auto it = j_object.begin(); it != j_object.end(); ++it) - { + @code{cpp} + for (auto it = j_object.begin(); it != j_object.end(); ++it) + { std::cout << "key: " << it.key() << ", value:" << it.value() << '\n'; - } - @endcode + } + @endcode - Range-based for loop without iterator proxy: + Range-based for loop without iterator proxy: - @code{cpp} - for (auto it : j_object) - { + @code{cpp} + for (auto it : j_object) + { // "it" is of type json::reference and has no key() member std::cout << "value: " << it << '\n'; - } - @endcode + } + @endcode - Range-based for loop with iterator proxy: + Range-based for loop with iterator proxy: - @code{cpp} - for (auto it : json::iterator_wrapper(j_object)) - { + @code{cpp} + for (auto it : json::iterator_wrapper(j_object)) + { std::cout << "key: " << it.key() << ", value:" << it.value() << '\n'; - } - @endcode + } + @endcode - @note When iterating over an array, `key()` will return the index of the + @note When iterating over an array, `key()` will return the index of the element as string (see example). - @param[in] ref reference to a JSON value - @return iteration proxy object wrapping @a ref with an interface to use in + @param[in] ref reference to a JSON value + @return iteration proxy object wrapping @a ref with an interface to use in range-based for loops - @liveexample{The following code shows how the wrapper is used,iterator_wrapper} + @liveexample{The following code shows how the wrapper is used,iterator_wrapper} - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes in the JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. - @complexity Constant. + @complexity Constant. - @note The name of this function is not yet final and may change in the - future. + @note The name of this function is not yet final and may change in the + future. - @deprecated This stream operator is deprecated and will be removed in + @deprecated This stream operator is deprecated and will be removed in future 4.0.0 of the library. Please use @ref items() instead; that is, replace `json::iterator_wrapper(j)` with `j.items()`. - */ - JSON_HEDLEY_DEPRECATED_FOR(3.1.0, items()) - static iteration_proxy iterator_wrapper(reference ref) noexcept + */ + JSON_HEDLEY_DEPRECATED_FOR(3.1 .0, items()) + static iteration_proxy iterator_wrapper( + reference ref) noexcept { return ref.items(); } /*! - @copydoc iterator_wrapper(reference) - */ - JSON_HEDLEY_DEPRECATED_FOR(3.1.0, items()) - static iteration_proxy iterator_wrapper(const_reference ref) noexcept + @copydoc iterator_wrapper(reference) + */ + JSON_HEDLEY_DEPRECATED_FOR(3.1 .0, items()) + static iteration_proxy iterator_wrapper( + const_reference ref) noexcept { return ref.items(); } /*! - @brief helper to access iterator member functions in range-based for + @brief helper to access iterator member functions in range-based for - This function allows to access @ref iterator::key() and @ref - iterator::value() during range-based for loops. In these loops, a - reference to the JSON values is returned, so there is no access to the - underlying iterator. + This function allows to access @ref iterator::key() and @ref + iterator::value() during range-based for loops. In these loops, a + reference to the JSON values is returned, so there is no access to the + underlying iterator. - For loop without `items()` function: + For loop without `items()` function: - @code{cpp} - for (auto it = j_object.begin(); it != j_object.end(); ++it) - { + @code{cpp} + for (auto it = j_object.begin(); it != j_object.end(); ++it) + { std::cout << "key: " << it.key() << ", value:" << it.value() << '\n'; - } - @endcode + } + @endcode - Range-based for loop without `items()` function: + Range-based for loop without `items()` function: - @code{cpp} - for (auto it : j_object) - { + @code{cpp} + for (auto it : j_object) + { // "it" is of type json::reference and has no key() member std::cout << "value: " << it << '\n'; - } - @endcode + } + @endcode - Range-based for loop with `items()` function: + Range-based for loop with `items()` function: - @code{cpp} - for (auto& el : j_object.items()) - { + @code{cpp} + for (auto& el : j_object.items()) + { std::cout << "key: " << el.key() << ", value:" << el.value() << '\n'; - } - @endcode + } + @endcode - The `items()` function also allows to use - [structured bindings](https://en.cppreference.com/w/cpp/language/structured_binding) - (C++17): + The `items()` function also allows to use + [structured bindings](https://en.cppreference.com/w/cpp/language/structured_binding) + (C++17): - @code{cpp} - for (auto& [key, val] : j_object.items()) - { + @code{cpp} + for (auto& [key, val] : j_object.items()) + { std::cout << "key: " << key << ", value:" << val << '\n'; - } - @endcode + } + @endcode - @note When iterating over an array, `key()` will return the index of the + @note When iterating over an array, `key()` will return the index of the element as string (see example). For primitive types (e.g., numbers), `key()` returns an empty string. - @warning Using `items()` on temporary objects is dangerous. Make sure the + @warning Using `items()` on temporary objects is dangerous. Make sure the object's lifetime exeeds the iteration. See for more information. - @return iteration proxy object wrapping @a ref with an interface to use in + @return iteration proxy object wrapping @a ref with an interface to use in range-based for loops - @liveexample{The following code shows how the function is used.,items} + @liveexample{The following code shows how the function is used.,items} - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes in the JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. - @complexity Constant. + @complexity Constant. - @since version 3.1.0, structured bindings support since 3.5.0. - */ + @since version 3.1.0, structured bindings support since 3.5.0. + */ iteration_proxy items() noexcept { return iteration_proxy(*this); } /*! - @copydoc items() - */ + @copydoc items() + */ iteration_proxy items() const noexcept { return iteration_proxy(*this); @@ -21460,11 +22985,11 @@ class basic_json /// @{ /*! - @brief checks whether the container is empty. + @brief checks whether the container is empty. - Checks if a JSON value has no elements (i.e. whether its @ref size is `0`). + Checks if a JSON value has no elements (i.e. whether its @ref size is `0`). - @return The return value depends on the different types and is + @return The return value depends on the different types and is defined as follows: Value type | return value ----------- | ------------- @@ -21476,31 +23001,31 @@ class basic_json object | result of function `object_t::empty()` array | result of function `array_t::empty()` - @liveexample{The following code uses `empty()` to check if a JSON - object contains any elements.,empty} + @liveexample{The following code uses `empty()` to check if a JSON + object contains any elements.,empty} - @complexity Constant, as long as @ref array_t and @ref object_t satisfy - the Container concept; that is, their `empty()` functions have constant - complexity. + @complexity Constant, as long as @ref array_t and @ref object_t satisfy + the Container concept; that is, their `empty()` functions have constant + complexity. - @iterators No changes. + @iterators No changes. - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @note This function does not return whether a string stored as JSON value - is empty - it returns whether the JSON container itself is empty which is - false in the case of a string. + @note This function does not return whether a string stored as JSON value + is empty - it returns whether the JSON container itself is empty which is + false in the case of a string. - @requirement This function helps `basic_json` satisfying the - [Container](https://en.cppreference.com/w/cpp/named_req/Container) - requirements: - - The complexity is constant. - - Has the semantics of `begin() == end()`. + @requirement This function helps `basic_json` satisfying the + [Container](https://en.cppreference.com/w/cpp/named_req/Container) + requirements: + - The complexity is constant. + - Has the semantics of `begin() == end()`. - @sa @ref size() -- returns the number of elements + @sa @ref size() -- returns the number of elements - @since version 1.0.0 - */ + @since version 1.0.0 + */ bool empty() const noexcept { switch (m_type) @@ -21532,11 +23057,11 @@ class basic_json } /*! - @brief returns the number of elements + @brief returns the number of elements - Returns the number of elements in a JSON value. + Returns the number of elements in a JSON value. - @return The return value depends on the different types and is + @return The return value depends on the different types and is defined as follows: Value type | return value ----------- | ------------- @@ -21548,32 +23073,32 @@ class basic_json object | result of function object_t::size() array | result of function array_t::size() - @liveexample{The following code calls `size()` on the different value - types.,size} + @liveexample{The following code calls `size()` on the different value + types.,size} - @complexity Constant, as long as @ref array_t and @ref object_t satisfy - the Container concept; that is, their size() functions have constant - complexity. + @complexity Constant, as long as @ref array_t and @ref object_t satisfy + the Container concept; that is, their size() functions have constant + complexity. - @iterators No changes. + @iterators No changes. - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @note This function does not return the length of a string stored as JSON - value - it returns the number of elements in the JSON value which is 1 in - the case of a string. + @note This function does not return the length of a string stored as JSON + value - it returns the number of elements in the JSON value which is 1 in + the case of a string. - @requirement This function helps `basic_json` satisfying the - [Container](https://en.cppreference.com/w/cpp/named_req/Container) - requirements: - - The complexity is constant. - - Has the semantics of `std::distance(begin(), end())`. + @requirement This function helps `basic_json` satisfying the + [Container](https://en.cppreference.com/w/cpp/named_req/Container) + requirements: + - The complexity is constant. + - Has the semantics of `std::distance(begin(), end())`. - @sa @ref empty() -- checks whether the container is empty - @sa @ref max_size() -- returns the maximal number of elements + @sa @ref empty() -- checks whether the container is empty + @sa @ref max_size() -- returns the maximal number of elements - @since version 1.0.0 - */ + @since version 1.0.0 + */ size_type size() const noexcept { switch (m_type) @@ -21605,13 +23130,13 @@ class basic_json } /*! - @brief returns the maximum possible number of elements + @brief returns the maximum possible number of elements - Returns the maximum number of elements a JSON value is able to hold due to - system or library implementation limitations, i.e. `std::distance(begin(), - end())` for the JSON value. + Returns the maximum number of elements a JSON value is able to hold due to + system or library implementation limitations, i.e. `std::distance(begin(), + end())` for the JSON value. - @return The return value depends on the different types and is + @return The return value depends on the different types and is defined as follows: Value type | return value ----------- | ------------- @@ -21623,28 +23148,28 @@ class basic_json object | result of function `object_t::max_size()` array | result of function `array_t::max_size()` - @liveexample{The following code calls `max_size()` on the different value - types. Note the output is implementation specific.,max_size} + @liveexample{The following code calls `max_size()` on the different value + types. Note the output is implementation specific.,max_size} - @complexity Constant, as long as @ref array_t and @ref object_t satisfy - the Container concept; that is, their `max_size()` functions have constant - complexity. + @complexity Constant, as long as @ref array_t and @ref object_t satisfy + the Container concept; that is, their `max_size()` functions have constant + complexity. - @iterators No changes. + @iterators No changes. - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @requirement This function helps `basic_json` satisfying the - [Container](https://en.cppreference.com/w/cpp/named_req/Container) - requirements: - - The complexity is constant. - - Has the semantics of returning `b.size()` where `b` is the largest - possible JSON value. + @requirement This function helps `basic_json` satisfying the + [Container](https://en.cppreference.com/w/cpp/named_req/Container) + requirements: + - The complexity is constant. + - Has the semantics of returning `b.size()` where `b` is the largest + possible JSON value. - @sa @ref size() -- returns the number of elements + @sa @ref size() -- returns the number of elements - @since version 1.0.0 - */ + @since version 1.0.0 + */ size_type max_size() const noexcept { switch (m_type) @@ -21680,42 +23205,42 @@ class basic_json /// @{ /*! - @brief clears the contents + @brief clears the contents - Clears the content of a JSON value and resets it to the default value as - if @ref basic_json(value_t) would have been called with the current value - type from @ref type(): + Clears the content of a JSON value and resets it to the default value as + if @ref basic_json(value_t) would have been called with the current value + type from @ref type(): - Value type | initial value - ----------- | ------------- - null | `null` - boolean | `false` - string | `""` - number | `0` - binary | An empty byte vector - object | `{}` - array | `[]` + Value type | initial value + ----------- | ------------- + null | `null` + boolean | `false` + string | `""` + number | `0` + binary | An empty byte vector + object | `{}` + array | `[]` - @post Has the same effect as calling - @code {.cpp} - *this = basic_json(type()); - @endcode + @post Has the same effect as calling + @code {.cpp} + * this = basic_json(type()); + @endcode - @liveexample{The example below shows the effect of `clear()` to different - JSON types.,clear} + @liveexample{The example below shows the effect of `clear()` to different + JSON types.,clear} - @complexity Linear in the size of the JSON value. + @complexity Linear in the size of the JSON value. - @iterators All iterators, pointers and references related to this container + @iterators All iterators, pointers and references related to this container are invalidated. - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @sa @ref basic_json(value_t) -- constructor that creates an object with the + @sa @ref basic_json(value_t) -- constructor that creates an object with the same value than calling `clear()` - @since version 1.0.0 - */ + @since version 1.0.0 + */ void clear() noexcept { switch (m_type) @@ -21774,26 +23299,27 @@ class basic_json } /*! - @brief add an object to an array + @brief add an object to an array - Appends the given element @a val to the end of the JSON value. If the - function is called on a JSON null value, an empty array is created before - appending @a val. + Appends the given element @a val to the end of the JSON value. If the + function is called on a JSON null value, an empty array is created before + appending @a val. - @param[in] val the value to add to the JSON array + @param[in] val the value to add to the JSON array - @throw type_error.308 when called on a type other than JSON array or - null; example: `"cannot use push_back() with number"` + @throw type_error.308 when called on a type other than JSON array or + null; example: `"cannot use push_back() with number"` - @complexity Amortized constant. + @complexity Amortized constant. - @liveexample{The example shows how `push_back()` and `+=` can be used to - add elements to a JSON array. Note how the `null` value was silently - converted to a JSON array.,push_back} + @liveexample{The example shows how `push_back()` and `+=` can be used to + add elements to a JSON array. Note how the `null` value was silently + converted to a JSON array.,push_back} - @since version 1.0.0 - */ - void push_back(basic_json&& val) + @since version 1.0.0 + */ + void push_back( + basic_json&& val) { // push_back only works for null objects or arrays if (JSON_HEDLEY_UNLIKELY(!(is_null() || is_array()))) @@ -21815,20 +23341,22 @@ class basic_json } /*! - @brief add an object to an array - @copydoc push_back(basic_json&&) - */ - reference operator+=(basic_json&& val) + @brief add an object to an array + @copydoc push_back(basic_json&&) + */ + reference operator +=( + basic_json&& val) { push_back(std::move(val)); return *this; } /*! - @brief add an object to an array - @copydoc push_back(basic_json&&) - */ - void push_back(const basic_json& val) + @brief add an object to an array + @copydoc push_back(basic_json&&) + */ + void push_back( + const basic_json& val) { // push_back only works for null objects or arrays if (JSON_HEDLEY_UNLIKELY(!(is_null() || is_array()))) @@ -21849,36 +23377,38 @@ class basic_json } /*! - @brief add an object to an array - @copydoc push_back(basic_json&&) - */ - reference operator+=(const basic_json& val) + @brief add an object to an array + @copydoc push_back(basic_json&&) + */ + reference operator +=( + const basic_json& val) { push_back(val); return *this; } /*! - @brief add an object to an object + @brief add an object to an object - Inserts the given element @a val to the JSON object. If the function is - called on a JSON null value, an empty object is created before inserting - @a val. + Inserts the given element @a val to the JSON object. If the function is + called on a JSON null value, an empty object is created before inserting + @a val. - @param[in] val the value to add to the JSON object + @param[in] val the value to add to the JSON object - @throw type_error.308 when called on a type other than JSON object or - null; example: `"cannot use push_back() with number"` + @throw type_error.308 when called on a type other than JSON object or + null; example: `"cannot use push_back() with number"` - @complexity Logarithmic in the size of the container, O(log(`size()`)). + @complexity Logarithmic in the size of the container, O(log(`size()`)). - @liveexample{The example shows how `push_back()` and `+=` can be used to - add elements to a JSON object. Note how the `null` value was silently - converted to a JSON object.,push_back__object_t__value} + @liveexample{The example shows how `push_back()` and `+=` can be used to + add elements to a JSON object. Note how the `null` value was silently + converted to a JSON object.,push_back__object_t__value} - @since version 1.0.0 - */ - void push_back(const typename object_t::value_type& val) + @since version 1.0.0 + */ + void push_back( + const typename object_t::value_type& val) { // push_back only works for null objects or objects if (JSON_HEDLEY_UNLIKELY(!(is_null() || is_object()))) @@ -21899,47 +23429,49 @@ class basic_json } /*! - @brief add an object to an object - @copydoc push_back(const typename object_t::value_type&) - */ - reference operator+=(const typename object_t::value_type& val) + @brief add an object to an object + @copydoc push_back(const typename object_t::value_type&) + */ + reference operator +=( + const typename object_t::value_type& val) { push_back(val); return *this; } /*! - @brief add an object to an object + @brief add an object to an object - This function allows to use `push_back` with an initializer list. In case + This function allows to use `push_back` with an initializer list. In case - 1. the current value is an object, - 2. the initializer list @a init contains only two elements, and - 3. the first element of @a init is a string, + 1. the current value is an object, + 2. the initializer list @a init contains only two elements, and + 3. the first element of @a init is a string, - @a init is converted into an object element and added using - @ref push_back(const typename object_t::value_type&). Otherwise, @a init - is converted to a JSON value and added using @ref push_back(basic_json&&). + @a init is converted into an object element and added using + @ref push_back(const typename object_t::value_type&). Otherwise, @a init + is converted to a JSON value and added using @ref push_back(basic_json&&). - @param[in] init an initializer list + @param[in] init an initializer list - @complexity Linear in the size of the initializer list @a init. + @complexity Linear in the size of the initializer list @a init. - @note This function is required to resolve an ambiguous overload error, + @note This function is required to resolve an ambiguous overload error, because pairs like `{"key", "value"}` can be both interpreted as `object_t::value_type` or `std::initializer_list`, see https://github.com/nlohmann/json/issues/235 for more information. - @liveexample{The example shows how initializer lists are treated as - objects when possible.,push_back__initializer_list} - */ - void push_back(initializer_list_t init) + @liveexample{The example shows how initializer lists are treated as + objects when possible.,push_back__initializer_list} + */ + void push_back( + initializer_list_t init) { if (is_object() && init.size() == 2 && (*init.begin())->is_string()) { basic_json&& key = init.begin()->moved_or_copied(); push_back(typename object_t::value_type( - std::move(key.get_ref()), (init.begin() + 1)->moved_or_copied())); + std::move(key.get_ref()), (init.begin() + 1)->moved_or_copied())); } else { @@ -21948,40 +23480,42 @@ class basic_json } /*! - @brief add an object to an object - @copydoc push_back(initializer_list_t) - */ - reference operator+=(initializer_list_t init) + @brief add an object to an object + @copydoc push_back(initializer_list_t) + */ + reference operator +=( + initializer_list_t init) { push_back(init); return *this; } /*! - @brief add an object to an array + @brief add an object to an array - Creates a JSON value from the passed parameters @a args to the end of the - JSON value. If the function is called on a JSON null value, an empty array - is created before appending the value created from @a args. + Creates a JSON value from the passed parameters @a args to the end of the + JSON value. If the function is called on a JSON null value, an empty array + is created before appending the value created from @a args. - @param[in] args arguments to forward to a constructor of @ref basic_json - @tparam Args compatible types to create a @ref basic_json object + @param[in] args arguments to forward to a constructor of @ref basic_json + @tparam Args compatible types to create a @ref basic_json object - @return reference to the inserted element + @return reference to the inserted element - @throw type_error.311 when called on a type other than JSON array or - null; example: `"cannot use emplace_back() with number"` + @throw type_error.311 when called on a type other than JSON array or + null; example: `"cannot use emplace_back() with number"` - @complexity Amortized constant. + @complexity Amortized constant. - @liveexample{The example shows how `push_back()` can be used to add - elements to a JSON array. Note how the `null` value was silently converted - to a JSON array.,emplace_back} + @liveexample{The example shows how `push_back()` can be used to add + elements to a JSON array. Note how the `null` value was silently converted + to a JSON array.,emplace_back} - @since version 2.0.8, returns reference since 3.7.0 - */ - template - reference emplace_back(Args&& ... args) + @since version 2.0.8, returns reference since 3.7.0 + */ + template + reference emplace_back( + Args&& ... args) { // emplace_back only works for null objects or arrays if (JSON_HEDLEY_UNLIKELY(!(is_null() || is_array()))) @@ -22003,38 +23537,39 @@ class basic_json #else m_value.array->emplace_back(std::forward(args)...); return m_value.array->back(); -#endif +#endif // ifdef JSON_HAS_CPP_17 } /*! - @brief add an object to an object if key does not exist + @brief add an object to an object if key does not exist - Inserts a new element into a JSON object constructed in-place with the - given @a args if there is no element with the key in the container. If the - function is called on a JSON null value, an empty object is created before - appending the value created from @a args. + Inserts a new element into a JSON object constructed in-place with the + given @a args if there is no element with the key in the container. If the + function is called on a JSON null value, an empty object is created before + appending the value created from @a args. - @param[in] args arguments to forward to a constructor of @ref basic_json - @tparam Args compatible types to create a @ref basic_json object + @param[in] args arguments to forward to a constructor of @ref basic_json + @tparam Args compatible types to create a @ref basic_json object - @return a pair consisting of an iterator to the inserted element, or the + @return a pair consisting of an iterator to the inserted element, or the already-existing element if no insertion happened, and a bool denoting whether the insertion took place. - @throw type_error.311 when called on a type other than JSON object or - null; example: `"cannot use emplace() with number"` + @throw type_error.311 when called on a type other than JSON object or + null; example: `"cannot use emplace() with number"` - @complexity Logarithmic in the size of the container, O(log(`size()`)). + @complexity Logarithmic in the size of the container, O(log(`size()`)). - @liveexample{The example shows how `emplace()` can be used to add elements - to a JSON object. Note how the `null` value was silently converted to a - JSON object. Further note how no value is added if there was already one - value stored with the same key.,emplace} + @liveexample{The example shows how `emplace()` can be used to add elements + to a JSON object. Note how the `null` value was silently converted to a + JSON object. Further note how no value is added if there was already one + value stored with the same key.,emplace} - @since version 2.0.8 - */ - template - std::pair emplace(Args&& ... args) + @since version 2.0.8 + */ + template + std::pair emplace( + Args&& ... args) { // emplace only works for null objects or arrays if (JSON_HEDLEY_UNLIKELY(!(is_null() || is_object()))) @@ -22063,8 +23598,10 @@ class basic_json /// Helper for insertion of an iterator /// @note: This uses std::distance to support GCC 4.8, /// see https://github.com/nlohmann/json/pull/1257 - template - iterator insert_iterator(const_iterator pos, Args&& ... args) + template + iterator insert_iterator( + const_iterator pos, + Args&& ... args) { iterator result(this); JSON_ASSERT(m_value.array != nullptr); @@ -22081,28 +23618,30 @@ class basic_json } /*! - @brief inserts element + @brief inserts element - Inserts element @a val before iterator @a pos. + Inserts element @a val before iterator @a pos. - @param[in] pos iterator before which the content will be inserted; may be - the end() iterator - @param[in] val element to insert - @return iterator pointing to the inserted @a val. + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] val element to insert + @return iterator pointing to the inserted @a val. - @throw type_error.309 if called on JSON values other than arrays; - example: `"cannot use insert() with string"` - @throw invalid_iterator.202 if @a pos is not an iterator of *this; - example: `"iterator does not fit current value"` + @throw type_error.309 if called on JSON values other than arrays; + example: `"cannot use insert() with string"` + @throw invalid_iterator.202 if @a pos is not an iterator of *this; + example: `"iterator does not fit current value"` - @complexity Constant plus linear in the distance between @a pos and end of - the container. + @complexity Constant plus linear in the distance between @a pos and end of + the container. - @liveexample{The example shows how `insert()` is used.,insert} + @liveexample{The example shows how `insert()` is used.,insert} - @since version 1.0.0 - */ - iterator insert(const_iterator pos, const basic_json& val) + @since version 1.0.0 + */ + iterator insert( + const_iterator pos, + const basic_json& val) { // insert only works for arrays if (JSON_HEDLEY_LIKELY(is_array())) @@ -22121,39 +23660,44 @@ class basic_json } /*! - @brief inserts element - @copydoc insert(const_iterator, const basic_json&) - */ - iterator insert(const_iterator pos, basic_json&& val) + @brief inserts element + @copydoc insert(const_iterator, const basic_json&) + */ + iterator insert( + const_iterator pos, + basic_json&& val) { return insert(pos, val); } /*! - @brief inserts elements + @brief inserts elements - Inserts @a cnt copies of @a val before iterator @a pos. + Inserts @a cnt copies of @a val before iterator @a pos. - @param[in] pos iterator before which the content will be inserted; may be - the end() iterator - @param[in] cnt number of copies of @a val to insert - @param[in] val element to insert - @return iterator pointing to the first element inserted, or @a pos if - `cnt==0` + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] cnt number of copies of @a val to insert + @param[in] val element to insert + @return iterator pointing to the first element inserted, or @a pos if + `cnt==0` - @throw type_error.309 if called on JSON values other than arrays; example: - `"cannot use insert() with string"` - @throw invalid_iterator.202 if @a pos is not an iterator of *this; - example: `"iterator does not fit current value"` + @throw type_error.309 if called on JSON values other than arrays; example: + `"cannot use insert() with string"` + @throw invalid_iterator.202 if @a pos is not an iterator of *this; + example: `"iterator does not fit current value"` - @complexity Linear in @a cnt plus linear in the distance between @a pos - and end of the container. + @complexity Linear in @a cnt plus linear in the distance between @a pos + and end of the container. - @liveexample{The example shows how `insert()` is used.,insert__count} + @liveexample{The example shows how `insert()` is used.,insert__count} - @since version 1.0.0 - */ - iterator insert(const_iterator pos, size_type cnt, const basic_json& val) + @since version 1.0.0 + */ + iterator insert( + const_iterator pos, + size_type cnt, + const basic_json& val) { // insert only works for arrays if (JSON_HEDLEY_LIKELY(is_array())) @@ -22172,36 +23716,39 @@ class basic_json } /*! - @brief inserts elements + @brief inserts elements - Inserts elements from range `[first, last)` before iterator @a pos. + Inserts elements from range `[first, last)` before iterator @a pos. - @param[in] pos iterator before which the content will be inserted; may be - the end() iterator - @param[in] first begin of the range of elements to insert - @param[in] last end of the range of elements to insert + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] first begin of the range of elements to insert + @param[in] last end of the range of elements to insert - @throw type_error.309 if called on JSON values other than arrays; example: - `"cannot use insert() with string"` - @throw invalid_iterator.202 if @a pos is not an iterator of *this; - example: `"iterator does not fit current value"` - @throw invalid_iterator.210 if @a first and @a last do not belong to the - same JSON value; example: `"iterators do not fit"` - @throw invalid_iterator.211 if @a first or @a last are iterators into - container for which insert is called; example: `"passed iterators may not - belong to container"` + @throw type_error.309 if called on JSON values other than arrays; example: + `"cannot use insert() with string"` + @throw invalid_iterator.202 if @a pos is not an iterator of *this; + example: `"iterator does not fit current value"` + @throw invalid_iterator.210 if @a first and @a last do not belong to the + same JSON value; example: `"iterators do not fit"` + @throw invalid_iterator.211 if @a first or @a last are iterators into + container for which insert is called; example: `"passed iterators may not + belong to container"` - @return iterator pointing to the first element inserted, or @a pos if - `first==last` + @return iterator pointing to the first element inserted, or @a pos if + `first==last` - @complexity Linear in `std::distance(first, last)` plus linear in the - distance between @a pos and end of the container. + @complexity Linear in `std::distance(first, last)` plus linear in the + distance between @a pos and end of the container. - @liveexample{The example shows how `insert()` is used.,insert__range} + @liveexample{The example shows how `insert()` is used.,insert__range} - @since version 1.0.0 - */ - iterator insert(const_iterator pos, const_iterator first, const_iterator last) + @since version 1.0.0 + */ + iterator insert( + const_iterator pos, + const_iterator first, + const_iterator last) { // insert only works for arrays if (JSON_HEDLEY_UNLIKELY(!is_array())) @@ -22231,30 +23778,32 @@ class basic_json } /*! - @brief inserts elements + @brief inserts elements - Inserts elements from initializer list @a ilist before iterator @a pos. + Inserts elements from initializer list @a ilist before iterator @a pos. - @param[in] pos iterator before which the content will be inserted; may be - the end() iterator - @param[in] ilist initializer list to insert the values from + @param[in] pos iterator before which the content will be inserted; may be + the end() iterator + @param[in] ilist initializer list to insert the values from - @throw type_error.309 if called on JSON values other than arrays; example: - `"cannot use insert() with string"` - @throw invalid_iterator.202 if @a pos is not an iterator of *this; - example: `"iterator does not fit current value"` + @throw type_error.309 if called on JSON values other than arrays; example: + `"cannot use insert() with string"` + @throw invalid_iterator.202 if @a pos is not an iterator of *this; + example: `"iterator does not fit current value"` - @return iterator pointing to the first element inserted, or @a pos if - `ilist` is empty + @return iterator pointing to the first element inserted, or @a pos if + `ilist` is empty - @complexity Linear in `ilist.size()` plus linear in the distance between - @a pos and end of the container. + @complexity Linear in `ilist.size()` plus linear in the distance between + @a pos and end of the container. - @liveexample{The example shows how `insert()` is used.,insert__ilist} + @liveexample{The example shows how `insert()` is used.,insert__ilist} - @since version 1.0.0 - */ - iterator insert(const_iterator pos, initializer_list_t ilist) + @since version 1.0.0 + */ + iterator insert( + const_iterator pos, + initializer_list_t ilist) { // insert only works for arrays if (JSON_HEDLEY_UNLIKELY(!is_array())) @@ -22273,29 +23822,31 @@ class basic_json } /*! - @brief inserts elements + @brief inserts elements - Inserts elements from range `[first, last)`. + Inserts elements from range `[first, last)`. - @param[in] first begin of the range of elements to insert - @param[in] last end of the range of elements to insert + @param[in] first begin of the range of elements to insert + @param[in] last end of the range of elements to insert - @throw type_error.309 if called on JSON values other than objects; example: - `"cannot use insert() with string"` - @throw invalid_iterator.202 if iterator @a first or @a last does does not - point to an object; example: `"iterators first and last must point to - objects"` - @throw invalid_iterator.210 if @a first and @a last do not belong to the - same JSON value; example: `"iterators do not fit"` + @throw type_error.309 if called on JSON values other than objects; example: + `"cannot use insert() with string"` + @throw invalid_iterator.202 if iterator @a first or @a last does does not + point to an object; example: `"iterators first and last must point to + objects"` + @throw invalid_iterator.210 if @a first and @a last do not belong to the + same JSON value; example: `"iterators do not fit"` - @complexity Logarithmic: `O(N*log(size() + N))`, where `N` is the number - of elements to insert. + @complexity Logarithmic: `O(N*log(size() + N))`, where `N` is the number + of elements to insert. - @liveexample{The example shows how `insert()` is used.,insert__range_object} + @liveexample{The example shows how `insert()` is used.,insert__range_object} - @since version 3.0.0 - */ - void insert(const_iterator first, const_iterator last) + @since version 3.0.0 + */ + void insert( + const_iterator first, + const_iterator last) { // insert only works for objects if (JSON_HEDLEY_UNLIKELY(!is_object())) @@ -22319,25 +23870,26 @@ class basic_json } /*! - @brief updates a JSON object from another object, overwriting existing keys + @brief updates a JSON object from another object, overwriting existing keys - Inserts all values from JSON object @a j and overwrites existing keys. + Inserts all values from JSON object @a j and overwrites existing keys. - @param[in] j JSON object to read values from + @param[in] j JSON object to read values from - @throw type_error.312 if called on JSON values other than objects; example: - `"cannot use update() with string"` + @throw type_error.312 if called on JSON values other than objects; example: + `"cannot use update() with string"` - @complexity O(N*log(size() + N)), where N is the number of elements to + @complexity O(N*log(size() + N)), where N is the number of elements to insert. - @liveexample{The example shows how `update()` is used.,update} + @liveexample{The example shows how `update()` is used.,update} - @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update + @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update - @since version 3.0.0 - */ - void update(const_reference j) + @since version 3.0.0 + */ + void update( + const_reference j) { // implicitly convert null value to an empty object if (is_null()) @@ -22358,37 +23910,39 @@ class basic_json for (auto it = j.cbegin(); it != j.cend(); ++it) { - m_value.object->operator[](it.key()) = it.value(); + m_value.object->operator [](it.key()) = it.value(); } } /*! - @brief updates a JSON object from another object, overwriting existing keys + @brief updates a JSON object from another object, overwriting existing keys - Inserts all values from from range `[first, last)` and overwrites existing - keys. + Inserts all values from from range `[first, last)` and overwrites existing + keys. - @param[in] first begin of the range of elements to insert - @param[in] last end of the range of elements to insert + @param[in] first begin of the range of elements to insert + @param[in] last end of the range of elements to insert - @throw type_error.312 if called on JSON values other than objects; example: - `"cannot use update() with string"` - @throw invalid_iterator.202 if iterator @a first or @a last does does not - point to an object; example: `"iterators first and last must point to - objects"` - @throw invalid_iterator.210 if @a first and @a last do not belong to the - same JSON value; example: `"iterators do not fit"` + @throw type_error.312 if called on JSON values other than objects; example: + `"cannot use update() with string"` + @throw invalid_iterator.202 if iterator @a first or @a last does does not + point to an object; example: `"iterators first and last must point to + objects"` + @throw invalid_iterator.210 if @a first and @a last do not belong to the + same JSON value; example: `"iterators do not fit"` - @complexity O(N*log(size() + N)), where N is the number of elements to + @complexity O(N*log(size() + N)), where N is the number of elements to insert. - @liveexample{The example shows how `update()` is used__range.,update} + @liveexample{The example shows how `update()` is used__range.,update} - @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update + @sa https://docs.python.org/3.6/library/stdtypes.html#dict.update - @since version 3.0.0 - */ - void update(const_iterator first, const_iterator last) + @since version 3.0.0 + */ + void update( + const_iterator first, + const_iterator last) { // implicitly convert null value to an empty object if (is_null()) @@ -22411,40 +23965,41 @@ class basic_json // passed iterators must belong to objects if (JSON_HEDLEY_UNLIKELY(!first.m_object->is_object() - || !last.m_object->is_object())) + || !last.m_object->is_object())) { JSON_THROW(invalid_iterator::create(202, "iterators first and last must point to objects")); } for (auto it = first; it != last; ++it) { - m_value.object->operator[](it.key()) = it.value(); + m_value.object->operator [](it.key()) = it.value(); } } /*! - @brief exchanges the values + @brief exchanges the values - Exchanges the contents of the JSON value with those of @a other. Does not - invoke any move, copy, or swap operations on individual elements. All - iterators and references remain valid. The past-the-end iterator is - invalidated. + Exchanges the contents of the JSON value with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. - @param[in,out] other JSON value to exchange the contents with + @param[in,out] other JSON value to exchange the contents with - @complexity Constant. + @complexity Constant. - @liveexample{The example below shows how JSON values can be swapped with - `swap()`.,swap__reference} + @liveexample{The example below shows how JSON values can be swapped with + `swap()`.,swap__reference} - @since version 1.0.0 - */ - void swap(reference other) noexcept ( - std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_assignable::value&& - std::is_nothrow_move_constructible::value&& + @since version 1.0.0 + */ + void swap( + reference other) noexcept ( + std::is_nothrow_move_constructible::value && + std::is_nothrow_move_assignable::value && + std::is_nothrow_move_constructible::value && std::is_nothrow_move_assignable::value - ) + ) { std::swap(m_type, other.m_type); std::swap(m_value, other.m_value); @@ -22452,54 +24007,57 @@ class basic_json } /*! - @brief exchanges the values + @brief exchanges the values - Exchanges the contents of the JSON value from @a left with those of @a right. Does not - invoke any move, copy, or swap operations on individual elements. All - iterators and references remain valid. The past-the-end iterator is - invalidated. implemented as a friend function callable via ADL. + Exchanges the contents of the JSON value from @a left with those of @a right. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. implemented as a friend function callable via ADL. - @param[in,out] left JSON value to exchange the contents with - @param[in,out] right JSON value to exchange the contents with + @param[in,out] left JSON value to exchange the contents with + @param[in,out] right JSON value to exchange the contents with - @complexity Constant. + @complexity Constant. - @liveexample{The example below shows how JSON values can be swapped with - `swap()`.,swap__reference} + @liveexample{The example below shows how JSON values can be swapped with + `swap()`.,swap__reference} - @since version 1.0.0 - */ - friend void swap(reference left, reference right) noexcept ( - std::is_nothrow_move_constructible::value&& - std::is_nothrow_move_assignable::value&& - std::is_nothrow_move_constructible::value&& + @since version 1.0.0 + */ + friend void swap( + reference left, + reference right) noexcept ( + std::is_nothrow_move_constructible::value && + std::is_nothrow_move_assignable::value && + std::is_nothrow_move_constructible::value && std::is_nothrow_move_assignable::value - ) + ) { left.swap(right); } /*! - @brief exchanges the values + @brief exchanges the values - Exchanges the contents of a JSON array with those of @a other. Does not - invoke any move, copy, or swap operations on individual elements. All - iterators and references remain valid. The past-the-end iterator is - invalidated. + Exchanges the contents of a JSON array with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. - @param[in,out] other array to exchange the contents with + @param[in,out] other array to exchange the contents with - @throw type_error.310 when JSON value is not an array; example: `"cannot - use swap() with string"` + @throw type_error.310 when JSON value is not an array; example: `"cannot + use swap() with string"` - @complexity Constant. + @complexity Constant. - @liveexample{The example below shows how arrays can be swapped with - `swap()`.,swap__array_t} + @liveexample{The example below shows how arrays can be swapped with + `swap()`.,swap__array_t} - @since version 1.0.0 - */ - void swap(array_t& other) + @since version 1.0.0 + */ + void swap( + array_t& other) { // swap only works for arrays if (JSON_HEDLEY_LIKELY(is_array())) @@ -22513,26 +24071,27 @@ class basic_json } /*! - @brief exchanges the values + @brief exchanges the values - Exchanges the contents of a JSON object with those of @a other. Does not - invoke any move, copy, or swap operations on individual elements. All - iterators and references remain valid. The past-the-end iterator is - invalidated. + Exchanges the contents of a JSON object with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. - @param[in,out] other object to exchange the contents with + @param[in,out] other object to exchange the contents with - @throw type_error.310 when JSON value is not an object; example: - `"cannot use swap() with string"` + @throw type_error.310 when JSON value is not an object; example: + `"cannot use swap() with string"` - @complexity Constant. + @complexity Constant. - @liveexample{The example below shows how objects can be swapped with - `swap()`.,swap__object_t} + @liveexample{The example below shows how objects can be swapped with + `swap()`.,swap__object_t} - @since version 1.0.0 - */ - void swap(object_t& other) + @since version 1.0.0 + */ + void swap( + object_t& other) { // swap only works for objects if (JSON_HEDLEY_LIKELY(is_object())) @@ -22546,26 +24105,27 @@ class basic_json } /*! - @brief exchanges the values + @brief exchanges the values - Exchanges the contents of a JSON string with those of @a other. Does not - invoke any move, copy, or swap operations on individual elements. All - iterators and references remain valid. The past-the-end iterator is - invalidated. + Exchanges the contents of a JSON string with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. - @param[in,out] other string to exchange the contents with + @param[in,out] other string to exchange the contents with - @throw type_error.310 when JSON value is not a string; example: `"cannot - use swap() with boolean"` + @throw type_error.310 when JSON value is not a string; example: `"cannot + use swap() with boolean"` - @complexity Constant. + @complexity Constant. - @liveexample{The example below shows how strings can be swapped with - `swap()`.,swap__string_t} + @liveexample{The example below shows how strings can be swapped with + `swap()`.,swap__string_t} - @since version 1.0.0 - */ - void swap(string_t& other) + @since version 1.0.0 + */ + void swap( + string_t& other) { // swap only works for strings if (JSON_HEDLEY_LIKELY(is_string())) @@ -22579,26 +24139,27 @@ class basic_json } /*! - @brief exchanges the values + @brief exchanges the values - Exchanges the contents of a JSON string with those of @a other. Does not - invoke any move, copy, or swap operations on individual elements. All - iterators and references remain valid. The past-the-end iterator is - invalidated. + Exchanges the contents of a JSON string with those of @a other. Does not + invoke any move, copy, or swap operations on individual elements. All + iterators and references remain valid. The past-the-end iterator is + invalidated. - @param[in,out] other binary to exchange the contents with + @param[in,out] other binary to exchange the contents with - @throw type_error.310 when JSON value is not a string; example: `"cannot - use swap() with boolean"` + @throw type_error.310 when JSON value is not a string; example: `"cannot + use swap() with boolean"` - @complexity Constant. + @complexity Constant. - @liveexample{The example below shows how strings can be swapped with - `swap()`.,swap__binary_t} + @liveexample{The example below shows how strings can be swapped with + `swap()`.,swap__binary_t} - @since version 3.8.0 - */ - void swap(binary_t& other) + @since version 3.8.0 + */ + void swap( + binary_t& other) { // swap only works for strings if (JSON_HEDLEY_LIKELY(is_binary())) @@ -22612,7 +24173,8 @@ class basic_json } /// @copydoc swap(binary_t) - void swap(typename binary_t::container_type& other) + void swap( + typename binary_t::container_type& other) { // swap only works for strings if (JSON_HEDLEY_LIKELY(is_binary())) @@ -22627,7 +24189,8 @@ class basic_json /// @} - public: +public: + ////////////////////////////////////////// // lexicographical comparison operators // ////////////////////////////////////////// @@ -22636,61 +24199,63 @@ class basic_json /// @{ /*! - @brief comparison: equal - - Compares two JSON values for equality according to the following rules: - - Two JSON values are equal if (1) they are from the same type and (2) - their stored values are the same according to their respective - `operator==`. - - Integer and floating-point numbers are automatically converted before - comparison. Note that two NaN values are always treated as unequal. - - Two JSON null values are equal. - - @note Floating-point inside JSON values numbers are compared with - `json::number_float_t::operator==` which is `double::operator==` by - default. To compare floating-point while respecting an epsilon, an alternative - [comparison function](https://github.com/mariokonrad/marnav/blob/master/include/marnav/math/floatingpoint.hpp#L34-#L39) - could be used, for instance - @code {.cpp} - template::value, T>::type> - inline bool is_same(T a, T b, T epsilon = std::numeric_limits::epsilon()) noexcept - { + @brief comparison: equal + + Compares two JSON values for equality according to the following rules: + - Two JSON values are equal if (1) they are from the same type and (2) + their stored values are the same according to their respective + `operator==`. + - Integer and floating-point numbers are automatically converted before + comparison. Note that two NaN values are always treated as unequal. + - Two JSON null values are equal. + + @note Floating-point inside JSON values numbers are compared with + `json::number_float_t::operator==` which is `double::operator==` by + default. To compare floating-point while respecting an epsilon, an alternative + [comparison function](https://github.com/mariokonrad/marnav/blob/master/include/marnav/math/floatingpoint.hpp#L34-#L39) + could be used, for instance + @code {.cpp} + template::value, T>::type> + inline bool is_same(T a, T b, T epsilon = std::numeric_limits::epsilon()) noexcept + { return std::abs(a - b) <= epsilon; - } - @endcode - Or you can self-defined operator equal function like this: - @code {.cpp} - bool my_equal(const_reference lhs, const_reference rhs) { - const auto lhs_type lhs.type(); - const auto rhs_type rhs.type(); - if (lhs_type == rhs_type) { + } + @endcode + Or you can self-defined operator equal function like this: + @code {.cpp} + bool my_equal(const_reference lhs, const_reference rhs) { + const auto lhs_type lhs.type(); + const auto rhs_type rhs.type(); + if (lhs_type == rhs_type) { switch(lhs_type) // self_defined case case value_t::number_float: return std::abs(lhs - rhs) <= std::numeric_limits::epsilon(); // other cases remain the same with the original ... - } - ... - } - @endcode + } + ... + } + @endcode - @note NaN values never compare equal to themselves or to other NaN values. + @note NaN values never compare equal to themselves or to other NaN values. - @param[in] lhs first JSON value to consider - @param[in] rhs second JSON value to consider - @return whether the values @a lhs and @a rhs are equal + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether the values @a lhs and @a rhs are equal - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @complexity Linear. + @complexity Linear. - @liveexample{The example demonstrates comparing several JSON - types.,operator__equal} + @liveexample{The example demonstrates comparing several JSON + types.,operator__equal} - @since version 1.0.0 - */ - friend bool operator==(const_reference lhs, const_reference rhs) noexcept + @since version 1.0.0 + */ + friend bool operator ==( + const_reference lhs, + const_reference rhs) noexcept { const auto lhs_type = lhs.type(); const auto rhs_type = rhs.type(); @@ -22759,99 +24324,111 @@ class basic_json } /*! - @brief comparison: equal - @copydoc operator==(const_reference, const_reference) - */ + @brief comparison: equal + @copydoc operator==(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator==(const_reference lhs, const ScalarType rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator ==( + const_reference lhs, + const ScalarType rhs) noexcept { return lhs == basic_json(rhs); } /*! - @brief comparison: equal - @copydoc operator==(const_reference, const_reference) - */ + @brief comparison: equal + @copydoc operator==(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator==(const ScalarType lhs, const_reference rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator ==( + const ScalarType lhs, + const_reference rhs) noexcept { return basic_json(lhs) == rhs; } /*! - @brief comparison: not equal + @brief comparison: not equal - Compares two JSON values for inequality by calculating `not (lhs == rhs)`. + Compares two JSON values for inequality by calculating `not (lhs == rhs)`. - @param[in] lhs first JSON value to consider - @param[in] rhs second JSON value to consider - @return whether the values @a lhs and @a rhs are not equal + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether the values @a lhs and @a rhs are not equal - @complexity Linear. + @complexity Linear. - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @liveexample{The example demonstrates comparing several JSON - types.,operator__notequal} + @liveexample{The example demonstrates comparing several JSON + types.,operator__notequal} - @since version 1.0.0 - */ - friend bool operator!=(const_reference lhs, const_reference rhs) noexcept + @since version 1.0.0 + */ + friend bool operator !=( + const_reference lhs, + const_reference rhs) noexcept { return !(lhs == rhs); } /*! - @brief comparison: not equal - @copydoc operator!=(const_reference, const_reference) - */ + @brief comparison: not equal + @copydoc operator!=(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator!=(const_reference lhs, const ScalarType rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator !=( + const_reference lhs, + const ScalarType rhs) noexcept { return lhs != basic_json(rhs); } /*! - @brief comparison: not equal - @copydoc operator!=(const_reference, const_reference) - */ + @brief comparison: not equal + @copydoc operator!=(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator!=(const ScalarType lhs, const_reference rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator !=( + const ScalarType lhs, + const_reference rhs) noexcept { return basic_json(lhs) != rhs; } /*! - @brief comparison: less than + @brief comparison: less than - Compares whether one JSON value @a lhs is less than another JSON value @a - rhs according to the following rules: - - If @a lhs and @a rhs have the same type, the values are compared using - the default `<` operator. - - Integer and floating-point numbers are automatically converted before - comparison - - In case @a lhs and @a rhs have different types, the values are ignored - and the order of the types is considered, see - @ref operator<(const value_t, const value_t). + Compares whether one JSON value @a lhs is less than another JSON value @a + rhs according to the following rules: + - If @a lhs and @a rhs have the same type, the values are compared using + the default `<` operator. + - Integer and floating-point numbers are automatically converted before + comparison + - In case @a lhs and @a rhs have different types, the values are ignored + and the order of the types is considered, see + @ref operator<(const value_t, const value_t). - @param[in] lhs first JSON value to consider - @param[in] rhs second JSON value to consider - @return whether @a lhs is less than @a rhs + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is less than @a rhs - @complexity Linear. + @complexity Linear. - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @liveexample{The example demonstrates comparing several JSON - types.,operator__less} + @liveexample{The example demonstrates comparing several JSON + types.,operator__less} - @since version 1.0.0 - */ - friend bool operator<(const_reference lhs, const_reference rhs) noexcept + @since version 1.0.0 + */ + friend bool operator <( + const_reference lhs, + const_reference rhs) noexcept { const auto lhs_type = lhs.type(); const auto rhs_type = rhs.type(); @@ -22921,165 +24498,187 @@ class basic_json // We only reach this line if we cannot compare values. In that case, // we compare types. Note we have to call the operator explicitly, // because MSVC has problems otherwise. - return operator<(lhs_type, rhs_type); + return operator <(lhs_type, rhs_type); } /*! - @brief comparison: less than - @copydoc operator<(const_reference, const_reference) - */ + @brief comparison: less than + @copydoc operator<(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator<(const_reference lhs, const ScalarType rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator <( + const_reference lhs, + const ScalarType rhs) noexcept { return lhs < basic_json(rhs); } /*! - @brief comparison: less than - @copydoc operator<(const_reference, const_reference) - */ + @brief comparison: less than + @copydoc operator<(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator<(const ScalarType lhs, const_reference rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator <( + const ScalarType lhs, + const_reference rhs) noexcept { return basic_json(lhs) < rhs; } /*! - @brief comparison: less than or equal + @brief comparison: less than or equal - Compares whether one JSON value @a lhs is less than or equal to another - JSON value by calculating `not (rhs < lhs)`. + Compares whether one JSON value @a lhs is less than or equal to another + JSON value by calculating `not (rhs < lhs)`. - @param[in] lhs first JSON value to consider - @param[in] rhs second JSON value to consider - @return whether @a lhs is less than or equal to @a rhs + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is less than or equal to @a rhs - @complexity Linear. + @complexity Linear. - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @liveexample{The example demonstrates comparing several JSON - types.,operator__greater} + @liveexample{The example demonstrates comparing several JSON + types.,operator__greater} - @since version 1.0.0 - */ - friend bool operator<=(const_reference lhs, const_reference rhs) noexcept + @since version 1.0.0 + */ + friend bool operator <=( + const_reference lhs, + const_reference rhs) noexcept { return !(rhs < lhs); } /*! - @brief comparison: less than or equal - @copydoc operator<=(const_reference, const_reference) - */ + @brief comparison: less than or equal + @copydoc operator<=(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator<=(const_reference lhs, const ScalarType rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator <=( + const_reference lhs, + const ScalarType rhs) noexcept { return lhs <= basic_json(rhs); } /*! - @brief comparison: less than or equal - @copydoc operator<=(const_reference, const_reference) - */ + @brief comparison: less than or equal + @copydoc operator<=(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator<=(const ScalarType lhs, const_reference rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator <=( + const ScalarType lhs, + const_reference rhs) noexcept { return basic_json(lhs) <= rhs; } /*! - @brief comparison: greater than + @brief comparison: greater than - Compares whether one JSON value @a lhs is greater than another - JSON value by calculating `not (lhs <= rhs)`. + Compares whether one JSON value @a lhs is greater than another + JSON value by calculating `not (lhs <= rhs)`. - @param[in] lhs first JSON value to consider - @param[in] rhs second JSON value to consider - @return whether @a lhs is greater than to @a rhs + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is greater than to @a rhs - @complexity Linear. + @complexity Linear. - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @liveexample{The example demonstrates comparing several JSON - types.,operator__lessequal} + @liveexample{The example demonstrates comparing several JSON + types.,operator__lessequal} - @since version 1.0.0 - */ - friend bool operator>(const_reference lhs, const_reference rhs) noexcept + @since version 1.0.0 + */ + friend bool operator >( + const_reference lhs, + const_reference rhs) noexcept { return !(lhs <= rhs); } /*! - @brief comparison: greater than - @copydoc operator>(const_reference, const_reference) - */ + @brief comparison: greater than + @copydoc operator>(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator>(const_reference lhs, const ScalarType rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator >( + const_reference lhs, + const ScalarType rhs) noexcept { return lhs > basic_json(rhs); } /*! - @brief comparison: greater than - @copydoc operator>(const_reference, const_reference) - */ + @brief comparison: greater than + @copydoc operator>(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator>(const ScalarType lhs, const_reference rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator >( + const ScalarType lhs, + const_reference rhs) noexcept { return basic_json(lhs) > rhs; } /*! - @brief comparison: greater than or equal + @brief comparison: greater than or equal - Compares whether one JSON value @a lhs is greater than or equal to another - JSON value by calculating `not (lhs < rhs)`. + Compares whether one JSON value @a lhs is greater than or equal to another + JSON value by calculating `not (lhs < rhs)`. - @param[in] lhs first JSON value to consider - @param[in] rhs second JSON value to consider - @return whether @a lhs is greater than or equal to @a rhs + @param[in] lhs first JSON value to consider + @param[in] rhs second JSON value to consider + @return whether @a lhs is greater than or equal to @a rhs - @complexity Linear. + @complexity Linear. - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @liveexample{The example demonstrates comparing several JSON - types.,operator__greaterequal} + @liveexample{The example demonstrates comparing several JSON + types.,operator__greaterequal} - @since version 1.0.0 - */ - friend bool operator>=(const_reference lhs, const_reference rhs) noexcept + @since version 1.0.0 + */ + friend bool operator >=( + const_reference lhs, + const_reference rhs) noexcept { return !(lhs < rhs); } /*! - @brief comparison: greater than or equal - @copydoc operator>=(const_reference, const_reference) - */ + @brief comparison: greater than or equal + @copydoc operator>=(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator>=(const_reference lhs, const ScalarType rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator >=( + const_reference lhs, + const ScalarType rhs) noexcept { return lhs >= basic_json(rhs); } /*! - @brief comparison: greater than or equal - @copydoc operator>=(const_reference, const_reference) - */ + @brief comparison: greater than or equal + @copydoc operator>=(const_reference, const_reference) + */ template::value, int>::type = 0> - friend bool operator>=(const ScalarType lhs, const_reference rhs) noexcept + std::is_scalar::value, int>::type = 0> + friend bool operator >=( + const ScalarType lhs, + const_reference rhs) noexcept { return basic_json(lhs) >= rhs; } @@ -23094,37 +24693,39 @@ class basic_json /// @{ /*! - @brief serialize to stream + @brief serialize to stream - Serialize the given JSON value @a j to the output stream @a o. The JSON - value will be serialized using the @ref dump member function. + Serialize the given JSON value @a j to the output stream @a o. The JSON + value will be serialized using the @ref dump member function. - - The indentation of the output can be controlled with the member variable - `width` of the output stream @a o. For instance, using the manipulator - `std::setw(4)` on @a o sets the indentation level to `4` and the - serialization result is the same as calling `dump(4)`. + - The indentation of the output can be controlled with the member variable + `width` of the output stream @a o. For instance, using the manipulator + `std::setw(4)` on @a o sets the indentation level to `4` and the + serialization result is the same as calling `dump(4)`. - - The indentation character can be controlled with the member variable - `fill` of the output stream @a o. For instance, the manipulator - `std::setfill('\\t')` sets indentation to use a tab character rather than - the default space character. + - The indentation character can be controlled with the member variable + `fill` of the output stream @a o. For instance, the manipulator + `std::setfill('\\t')` sets indentation to use a tab character rather than + the default space character. - @param[in,out] o stream to serialize to - @param[in] j JSON value to serialize + @param[in,out] o stream to serialize to + @param[in] j JSON value to serialize - @return the stream @a o + @return the stream @a o - @throw type_error.316 if a string stored inside the JSON value is not + @throw type_error.316 if a string stored inside the JSON value is not UTF-8 encoded - @complexity Linear. + @complexity Linear. - @liveexample{The example below shows the serialization with different - parameters to `width` to adjust the indentation level.,operator_serialize} + @liveexample{The example below shows the serialization with different + parameters to `width` to adjust the indentation level.,operator_serialize} - @since version 1.0.0; indentation character added in version 3.0.0 - */ - friend std::ostream& operator<<(std::ostream& o, const basic_json& j) + @since version 1.0.0; indentation character added in version 3.0.0 + */ + friend std::ostream& operator <<( + std::ostream& o, + const basic_json& j) { // read width member and use it as indentation parameter if nonzero const bool pretty_print = o.width() > 0; @@ -23140,15 +24741,17 @@ class basic_json } /*! - @brief serialize to stream - @deprecated This stream operator is deprecated and will be removed in + @brief serialize to stream + @deprecated This stream operator is deprecated and will be removed in future 4.0.0 of the library. Please use @ref operator<<(std::ostream&, const basic_json&) instead; that is, replace calls like `j >> o;` with `o << j;`. - @since version 1.0.0; deprecated since version 3.0.0 - */ - JSON_HEDLEY_DEPRECATED_FOR(3.0.0, operator<<(std::ostream&, const basic_json&)) - friend std::ostream& operator>>(const basic_json& j, std::ostream& o) + @since version 1.0.0; deprecated since version 3.0.0 + */ + JSON_HEDLEY_DEPRECATED_FOR(3.0 .0, operator <<(std::ostream&, const basic_json&)) + friend std::ostream& operator >>( + const basic_json& j, + std::ostream& o) { return o << j; } @@ -23164,113 +24767,120 @@ class basic_json /// @{ /*! - @brief deserialize from a compatible input + @brief deserialize from a compatible input - @tparam InputType A compatible input, for instance - - an std::istream object - - a FILE pointer - - a C-style array of characters - - a pointer to a null-terminated string of single byte characters - - an object obj for which begin(obj) and end(obj) produces a valid pair of - iterators. + @tparam InputType A compatible input, for instance + - an std::istream object + - a FILE pointer + - a C-style array of characters + - a pointer to a null-terminated string of single byte characters + - an object obj for which begin(obj) and end(obj) produces a valid pair of + iterators. - @param[in] i input to read from - @param[in] cb a parser callback function of type @ref parser_callback_t - which is used to control the deserialization by filtering unwanted values - (optional) - @param[in] allow_exceptions whether to throw exceptions in case of a - parse error (optional, true by default) - @param[in] ignore_comments whether comments should be ignored and treated - like whitespace (true) or yield a parse error (true); (optional, false by - default) + @param[in] i input to read from + @param[in] cb a parser callback function of type @ref parser_callback_t + which is used to control the deserialization by filtering unwanted values + (optional) + @param[in] allow_exceptions whether to throw exceptions in case of a + parse error (optional, true by default) + @param[in] ignore_comments whether comments should be ignored and treated + like whitespace (true) or yield a parse error (true); (optional, false by + default) - @return deserialized JSON value; in case of a parse error and + @return deserialized JSON value; in case of a parse error and @a allow_exceptions set to `false`, the return value will be value_t::discarded. - @throw parse_error.101 if a parse error occurs; example: `""unexpected end - of input; expected string literal""` - @throw parse_error.102 if to_unicode fails or surrogate error - @throw parse_error.103 if to_unicode fails + @throw parse_error.101 if a parse error occurs; example: `""unexpected end + of input; expected string literal""` + @throw parse_error.102 if to_unicode fails or surrogate error + @throw parse_error.103 if to_unicode fails - @complexity Linear in the length of the input. The parser is a predictive - LL(1) parser. The complexity can be higher if the parser callback function - @a cb or reading from the input @a i has a super-linear complexity. + @complexity Linear in the length of the input. The parser is a predictive + LL(1) parser. The complexity can be higher if the parser callback function + @a cb or reading from the input @a i has a super-linear complexity. - @note A UTF-8 byte order mark is silently ignored. + @note A UTF-8 byte order mark is silently ignored. - @liveexample{The example below demonstrates the `parse()` function reading - from an array.,parse__array__parser_callback_t} + @liveexample{The example below demonstrates the `parse()` function reading + from an array.,parse__array__parser_callback_t} - @liveexample{The example below demonstrates the `parse()` function with - and without callback function.,parse__string__parser_callback_t} + @liveexample{The example below demonstrates the `parse()` function with + and without callback function.,parse__string__parser_callback_t} - @liveexample{The example below demonstrates the `parse()` function with - and without callback function.,parse__istream__parser_callback_t} + @liveexample{The example below demonstrates the `parse()` function with + and without callback function.,parse__istream__parser_callback_t} - @liveexample{The example below demonstrates the `parse()` function reading - from a contiguous container.,parse__contiguouscontainer__parser_callback_t} + @liveexample{The example below demonstrates the `parse()` function reading + from a contiguous container.,parse__contiguouscontainer__parser_callback_t} - @since version 2.0.3 (contiguous containers); version 3.9.0 allowed to - ignore comments. - */ + @since version 2.0.3 (contiguous containers); version 3.9.0 allowed to + ignore comments. + */ template JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json parse(InputType&& i, - const parser_callback_t cb = nullptr, - const bool allow_exceptions = true, - const bool ignore_comments = false) + static basic_json parse( + InputType&& i, + const parser_callback_t cb = nullptr, + const bool allow_exceptions = true, + const bool ignore_comments = false) { basic_json result; - parser(detail::input_adapter(std::forward(i)), cb, allow_exceptions, ignore_comments).parse(true, result); + parser(detail::input_adapter(std::forward(i)), cb, allow_exceptions, ignore_comments).parse(true, + result); return result; } /*! - @brief deserialize from a pair of character iterators + @brief deserialize from a pair of character iterators - The value_type of the iterator must be a integral type with size of 1, 2 or - 4 bytes, which will be interpreted respectively as UTF-8, UTF-16 and UTF-32. + The value_type of the iterator must be a integral type with size of 1, 2 or + 4 bytes, which will be interpreted respectively as UTF-8, UTF-16 and UTF-32. - @param[in] first iterator to start of character range - @param[in] last iterator to end of character range - @param[in] cb a parser callback function of type @ref parser_callback_t - which is used to control the deserialization by filtering unwanted values - (optional) - @param[in] allow_exceptions whether to throw exceptions in case of a - parse error (optional, true by default) - @param[in] ignore_comments whether comments should be ignored and treated - like whitespace (true) or yield a parse error (true); (optional, false by - default) + @param[in] first iterator to start of character range + @param[in] last iterator to end of character range + @param[in] cb a parser callback function of type @ref parser_callback_t + which is used to control the deserialization by filtering unwanted values + (optional) + @param[in] allow_exceptions whether to throw exceptions in case of a + parse error (optional, true by default) + @param[in] ignore_comments whether comments should be ignored and treated + like whitespace (true) or yield a parse error (true); (optional, false by + default) - @return deserialized JSON value; in case of a parse error and + @return deserialized JSON value; in case of a parse error and @a allow_exceptions set to `false`, the return value will be value_t::discarded. - @throw parse_error.101 if a parse error occurs; example: `""unexpected end - of input; expected string literal""` - @throw parse_error.102 if to_unicode fails or surrogate error - @throw parse_error.103 if to_unicode fails - */ + @throw parse_error.101 if a parse error occurs; example: `""unexpected end + of input; expected string literal""` + @throw parse_error.102 if to_unicode fails or surrogate error + @throw parse_error.103 if to_unicode fails + */ template JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json parse(IteratorType first, - IteratorType last, - const parser_callback_t cb = nullptr, - const bool allow_exceptions = true, - const bool ignore_comments = false) + static basic_json parse( + IteratorType first, + IteratorType last, + const parser_callback_t cb = nullptr, + const bool allow_exceptions = true, + const bool ignore_comments = false) { basic_json result; - parser(detail::input_adapter(std::move(first), std::move(last)), cb, allow_exceptions, ignore_comments).parse(true, result); + parser(detail::input_adapter(std::move(first), std::move(last)), cb, allow_exceptions, ignore_comments).parse( + true, result); return result; } JSON_HEDLEY_WARN_UNUSED_RESULT - JSON_HEDLEY_DEPRECATED_FOR(3.8.0, parse(ptr, ptr + len)) - static basic_json parse(detail::span_input_adapter&& i, - const parser_callback_t cb = nullptr, - const bool allow_exceptions = true, - const bool ignore_comments = false) + JSON_HEDLEY_DEPRECATED_FOR( + 3.8 .0, + parse(ptr, ptr + len)) + static basic_json parse( + detail::span_input_adapter&& i, + const parser_callback_t cb = nullptr, + const bool allow_exceptions = true, + const bool ignore_comments = false) { basic_json result; parser(i.get(), cb, allow_exceptions, ignore_comments).parse(true, result); @@ -23278,103 +24888,112 @@ class basic_json } /*! - @brief check if the input is valid JSON + @brief check if the input is valid JSON - Unlike the @ref parse(InputType&&, const parser_callback_t,const bool) - function, this function neither throws an exception in case of invalid JSON - input (i.e., a parse error) nor creates diagnostic information. + Unlike the @ref parse(InputType&&, const parser_callback_t,const bool) + function, this function neither throws an exception in case of invalid JSON + input (i.e., a parse error) nor creates diagnostic information. - @tparam InputType A compatible input, for instance - - an std::istream object - - a FILE pointer - - a C-style array of characters - - a pointer to a null-terminated string of single byte characters - - an object obj for which begin(obj) and end(obj) produces a valid pair of - iterators. + @tparam InputType A compatible input, for instance + - an std::istream object + - a FILE pointer + - a C-style array of characters + - a pointer to a null-terminated string of single byte characters + - an object obj for which begin(obj) and end(obj) produces a valid pair of + iterators. - @param[in] i input to read from - @param[in] ignore_comments whether comments should be ignored and treated - like whitespace (true) or yield a parse error (true); (optional, false by - default) + @param[in] i input to read from + @param[in] ignore_comments whether comments should be ignored and treated + like whitespace (true) or yield a parse error (true); (optional, false by + default) - @return Whether the input read from @a i is valid JSON. + @return Whether the input read from @a i is valid JSON. - @complexity Linear in the length of the input. The parser is a predictive - LL(1) parser. + @complexity Linear in the length of the input. The parser is a predictive + LL(1) parser. - @note A UTF-8 byte order mark is silently ignored. + @note A UTF-8 byte order mark is silently ignored. - @liveexample{The example below demonstrates the `accept()` function reading - from a string.,accept__string} - */ + @liveexample{The example below demonstrates the `accept()` function reading + from a string.,accept__string} + */ template - static bool accept(InputType&& i, - const bool ignore_comments = false) + static bool accept( + InputType&& i, + const bool ignore_comments = false) { return parser(detail::input_adapter(std::forward(i)), nullptr, false, ignore_comments).accept(true); } template - static bool accept(IteratorType first, IteratorType last, - const bool ignore_comments = false) + static bool accept( + IteratorType first, + IteratorType last, + const bool ignore_comments = false) { - return parser(detail::input_adapter(std::move(first), std::move(last)), nullptr, false, ignore_comments).accept(true); + return parser(detail::input_adapter(std::move(first), std::move(last)), nullptr, false, ignore_comments).accept( + true); } JSON_HEDLEY_WARN_UNUSED_RESULT - JSON_HEDLEY_DEPRECATED_FOR(3.8.0, accept(ptr, ptr + len)) - static bool accept(detail::span_input_adapter&& i, - const bool ignore_comments = false) + JSON_HEDLEY_DEPRECATED_FOR( + 3.8 .0, + accept(ptr, ptr + len)) + static bool accept( + detail::span_input_adapter&& i, + const bool ignore_comments = false) { return parser(i.get(), nullptr, false, ignore_comments).accept(true); } /*! - @brief generate SAX events + @brief generate SAX events - The SAX event lister must follow the interface of @ref json_sax. + The SAX event lister must follow the interface of @ref json_sax. - This function reads from a compatible input. Examples are: - - an std::istream object - - a FILE pointer - - a C-style array of characters - - a pointer to a null-terminated string of single byte characters - - an object obj for which begin(obj) and end(obj) produces a valid pair of - iterators. + This function reads from a compatible input. Examples are: + - an std::istream object + - a FILE pointer + - a C-style array of characters + - a pointer to a null-terminated string of single byte characters + - an object obj for which begin(obj) and end(obj) produces a valid pair of + iterators. - @param[in] i input to read from - @param[in,out] sax SAX event listener - @param[in] format the format to parse (JSON, CBOR, MessagePack, or UBJSON) - @param[in] strict whether the input has to be consumed completely - @param[in] ignore_comments whether comments should be ignored and treated - like whitespace (true) or yield a parse error (true); (optional, false by - default); only applies to the JSON file format. + @param[in] i input to read from + @param[in,out] sax SAX event listener + @param[in] format the format to parse (JSON, CBOR, MessagePack, or UBJSON) + @param[in] strict whether the input has to be consumed completely + @param[in] ignore_comments whether comments should be ignored and treated + like whitespace (true) or yield a parse error (true); (optional, false by + default); only applies to the JSON file format. - @return return value of the last processed SAX event + @return return value of the last processed SAX event - @throw parse_error.101 if a parse error occurs; example: `""unexpected end - of input; expected string literal""` - @throw parse_error.102 if to_unicode fails or surrogate error - @throw parse_error.103 if to_unicode fails + @throw parse_error.101 if a parse error occurs; example: `""unexpected end + of input; expected string literal""` + @throw parse_error.102 if to_unicode fails or surrogate error + @throw parse_error.103 if to_unicode fails - @complexity Linear in the length of the input. The parser is a predictive - LL(1) parser. The complexity can be higher if the SAX consumer @a sax has - a super-linear complexity. + @complexity Linear in the length of the input. The parser is a predictive + LL(1) parser. The complexity can be higher if the SAX consumer @a sax has + a super-linear complexity. - @note A UTF-8 byte order mark is silently ignored. + @note A UTF-8 byte order mark is silently ignored. - @liveexample{The example below demonstrates the `sax_parse()` function - reading from string and processing the events with a user-defined SAX - event consumer.,sax_parse} + @liveexample{The example below demonstrates the `sax_parse()` function + reading from string and processing the events with a user-defined SAX + event consumer.,sax_parse} - @since version 3.2.0 - */ + @since version 3.2.0 + */ template JSON_HEDLEY_NON_NULL(2) - static bool sax_parse(InputType&& i, SAX* sax, - input_format_t format = input_format_t::json, - const bool strict = true, - const bool ignore_comments = false) + static bool sax_parse( + InputType&& i, + SAX* sax, + input_format_t format = input_format_t::json, + const bool strict = true, + const bool ignore_comments = false) { auto ia = detail::input_adapter(std::forward(i)); return format == input_format_t::json @@ -23384,10 +25003,13 @@ class basic_json template JSON_HEDLEY_NON_NULL(3) - static bool sax_parse(IteratorType first, IteratorType last, SAX* sax, - input_format_t format = input_format_t::json, - const bool strict = true, - const bool ignore_comments = false) + static bool sax_parse( + IteratorType first, + IteratorType last, + SAX* sax, + input_format_t format = input_format_t::json, + const bool strict = true, + const bool ignore_comments = false) { auto ia = detail::input_adapter(std::move(first), std::move(last)); return format == input_format_t::json @@ -23396,12 +25018,14 @@ class basic_json } template - JSON_HEDLEY_DEPRECATED_FOR(3.8.0, sax_parse(ptr, ptr + len, ...)) + JSON_HEDLEY_DEPRECATED_FOR(3.8 .0, sax_parse(ptr, ptr + len, ...)) JSON_HEDLEY_NON_NULL(2) - static bool sax_parse(detail::span_input_adapter&& i, SAX* sax, - input_format_t format = input_format_t::json, - const bool strict = true, - const bool ignore_comments = false) + static bool sax_parse( + detail::span_input_adapter&& i, + SAX* sax, + input_format_t format = input_format_t::json, + const bool strict = true, + const bool ignore_comments = false) { auto ia = i.get(); return format == input_format_t::json @@ -23410,45 +25034,49 @@ class basic_json } /*! - @brief deserialize from stream - @deprecated This stream operator is deprecated and will be removed in + @brief deserialize from stream + @deprecated This stream operator is deprecated and will be removed in version 4.0.0 of the library. Please use @ref operator>>(std::istream&, basic_json&) instead; that is, replace calls like `j << i;` with `i >> j;`. - @since version 1.0.0; deprecated since version 3.0.0 - */ - JSON_HEDLEY_DEPRECATED_FOR(3.0.0, operator>>(std::istream&, basic_json&)) - friend std::istream& operator<<(basic_json& j, std::istream& i) + @since version 1.0.0; deprecated since version 3.0.0 + */ + JSON_HEDLEY_DEPRECATED_FOR(3.0 .0, operator >>(std::istream&, basic_json&)) + friend std::istream& operator <<( + basic_json& j, + std::istream& i) { - return operator>>(i, j); + return operator >>(i, j); } /*! - @brief deserialize from stream + @brief deserialize from stream - Deserializes an input stream to a JSON value. + Deserializes an input stream to a JSON value. - @param[in,out] i input stream to read a serialized JSON value from - @param[in,out] j JSON value to write the deserialized input to + @param[in,out] i input stream to read a serialized JSON value from + @param[in,out] j JSON value to write the deserialized input to - @throw parse_error.101 in case of an unexpected token - @throw parse_error.102 if to_unicode fails or surrogate error - @throw parse_error.103 if to_unicode fails + @throw parse_error.101 in case of an unexpected token + @throw parse_error.102 if to_unicode fails or surrogate error + @throw parse_error.103 if to_unicode fails - @complexity Linear in the length of the input. The parser is a predictive - LL(1) parser. + @complexity Linear in the length of the input. The parser is a predictive + LL(1) parser. - @note A UTF-8 byte order mark is silently ignored. + @note A UTF-8 byte order mark is silently ignored. - @liveexample{The example below shows how a JSON value is constructed by - reading a serialization from a stream.,operator_deserialize} + @liveexample{The example below shows how a JSON value is constructed by + reading a serialization from a stream.,operator_deserialize} - @sa parse(std::istream&, const parser_callback_t) for a variant with a - parser callback function to filter values while parsing + @sa parse(std::istream&, const parser_callback_t) for a variant with a + parser callback function to filter values while parsing - @since version 1.0.0 - */ - friend std::istream& operator>>(std::istream& i, basic_json& j) + @since version 1.0.0 + */ + friend std::istream& operator >>( + std::istream& i, + basic_json& j) { parser(detail::input_adapter(i)).parse(false, j); return i; @@ -23461,12 +25089,12 @@ class basic_json /////////////////////////// /*! - @brief return the type as string + @brief return the type as string - Returns the type name as string to be used in error messages - usually to - indicate that a function was called on a wrong JSON type. + Returns the type name as string to be used in error messages - usually to + indicate that a function was called on a wrong JSON type. - @return a string representation of a the @a m_type member: + @return a string representation of a the @a m_type member: Value type | return value ----------- | ------------- null | `"null"` @@ -23478,19 +25106,19 @@ class basic_json binary | `"binary"` discarded | `"discarded"` - @exceptionsafety No-throw guarantee: this function never throws exceptions. + @exceptionsafety No-throw guarantee: this function never throws exceptions. - @complexity Constant. + @complexity Constant. - @liveexample{The following code exemplifies `type_name()` for all JSON - types.,type_name} + @liveexample{The following code exemplifies `type_name()` for all JSON + types.,type_name} - @sa @ref type() -- return the type of the JSON value - @sa @ref operator value_t() -- return the type of the JSON value (implicit) + @sa @ref type() -- return the type of the JSON value + @sa @ref operator value_t() -- return the type of the JSON value (implicit) - @since version 1.0.0, public since 2.1.0, `const char*` and `noexcept` - since 3.0.0 - */ + @since version 1.0.0, public since 2.1.0, `const char*` and `noexcept` + since 3.0.0 + */ JSON_HEDLEY_RETURNS_NON_NULL const char* type_name() const noexcept { @@ -23517,8 +25145,7 @@ class basic_json } } - - JSON_PRIVATE_UNLESS_TESTED: +JSON_PRIVATE_UNLESS_TESTED: ////////////////////// // member variables // ////////////////////// @@ -23536,69 +25163,70 @@ class basic_json /// @name binary serialization/deserialization support /// @{ - public: - /*! - @brief create a CBOR serialization of a given JSON value - - Serializes a given JSON value @a j to a byte vector using the CBOR (Concise - Binary Object Representation) serialization format. CBOR is a binary - serialization format which aims to be more compact than JSON itself, yet - more efficient to parse. - - The library uses the following mapping from JSON values types to - CBOR types according to the CBOR specification (RFC 7049): - - JSON value type | value/range | CBOR type | first byte - --------------- | ------------------------------------------ | ---------------------------------- | --------------- - null | `null` | Null | 0xF6 - boolean | `true` | True | 0xF5 - boolean | `false` | False | 0xF4 - number_integer | -9223372036854775808..-2147483649 | Negative integer (8 bytes follow) | 0x3B - number_integer | -2147483648..-32769 | Negative integer (4 bytes follow) | 0x3A - number_integer | -32768..-129 | Negative integer (2 bytes follow) | 0x39 - number_integer | -128..-25 | Negative integer (1 byte follow) | 0x38 - number_integer | -24..-1 | Negative integer | 0x20..0x37 - number_integer | 0..23 | Integer | 0x00..0x17 - number_integer | 24..255 | Unsigned integer (1 byte follow) | 0x18 - number_integer | 256..65535 | Unsigned integer (2 bytes follow) | 0x19 - number_integer | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A - number_integer | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B - number_unsigned | 0..23 | Integer | 0x00..0x17 - number_unsigned | 24..255 | Unsigned integer (1 byte follow) | 0x18 - number_unsigned | 256..65535 | Unsigned integer (2 bytes follow) | 0x19 - number_unsigned | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A - number_unsigned | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B - number_float | *any value representable by a float* | Single-Precision Float | 0xFA - number_float | *any value NOT representable by a float* | Double-Precision Float | 0xFB - string | *length*: 0..23 | UTF-8 string | 0x60..0x77 - string | *length*: 23..255 | UTF-8 string (1 byte follow) | 0x78 - string | *length*: 256..65535 | UTF-8 string (2 bytes follow) | 0x79 - string | *length*: 65536..4294967295 | UTF-8 string (4 bytes follow) | 0x7A - string | *length*: 4294967296..18446744073709551615 | UTF-8 string (8 bytes follow) | 0x7B - array | *size*: 0..23 | array | 0x80..0x97 - array | *size*: 23..255 | array (1 byte follow) | 0x98 - array | *size*: 256..65535 | array (2 bytes follow) | 0x99 - array | *size*: 65536..4294967295 | array (4 bytes follow) | 0x9A - array | *size*: 4294967296..18446744073709551615 | array (8 bytes follow) | 0x9B - object | *size*: 0..23 | map | 0xA0..0xB7 - object | *size*: 23..255 | map (1 byte follow) | 0xB8 - object | *size*: 256..65535 | map (2 bytes follow) | 0xB9 - object | *size*: 65536..4294967295 | map (4 bytes follow) | 0xBA - object | *size*: 4294967296..18446744073709551615 | map (8 bytes follow) | 0xBB - binary | *size*: 0..23 | byte string | 0x40..0x57 - binary | *size*: 23..255 | byte string (1 byte follow) | 0x58 - binary | *size*: 256..65535 | byte string (2 bytes follow) | 0x59 - binary | *size*: 65536..4294967295 | byte string (4 bytes follow) | 0x5A - binary | *size*: 4294967296..18446744073709551615 | byte string (8 bytes follow) | 0x5B - - @note The mapping is **complete** in the sense that any JSON value type +public: + + /*! + @brief create a CBOR serialization of a given JSON value + + Serializes a given JSON value @a j to a byte vector using the CBOR (Concise + Binary Object Representation) serialization format. CBOR is a binary + serialization format which aims to be more compact than JSON itself, yet + more efficient to parse. + + The library uses the following mapping from JSON values types to + CBOR types according to the CBOR specification (RFC 7049): + + JSON value type | value/range | CBOR type | first byte + --------------- | ------------------------------------------ | ---------------------------------- | --------------- + null | `null` | Null | 0xF6 + boolean | `true` | True | 0xF5 + boolean | `false` | False | 0xF4 + number_integer | -9223372036854775808..-2147483649 | Negative integer (8 bytes follow) | 0x3B + number_integer | -2147483648..-32769 | Negative integer (4 bytes follow) | 0x3A + number_integer | -32768..-129 | Negative integer (2 bytes follow) | 0x39 + number_integer | -128..-25 | Negative integer (1 byte follow) | 0x38 + number_integer | -24..-1 | Negative integer | 0x20..0x37 + number_integer | 0..23 | Integer | 0x00..0x17 + number_integer | 24..255 | Unsigned integer (1 byte follow) | 0x18 + number_integer | 256..65535 | Unsigned integer (2 bytes follow) | 0x19 + number_integer | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A + number_integer | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B + number_unsigned | 0..23 | Integer | 0x00..0x17 + number_unsigned | 24..255 | Unsigned integer (1 byte follow) | 0x18 + number_unsigned | 256..65535 | Unsigned integer (2 bytes follow) | 0x19 + number_unsigned | 65536..4294967295 | Unsigned integer (4 bytes follow) | 0x1A + number_unsigned | 4294967296..18446744073709551615 | Unsigned integer (8 bytes follow) | 0x1B + number_float | *any value representable by a float* | Single-Precision Float | 0xFA + number_float | *any value NOT representable by a float* | Double-Precision Float | 0xFB + string | *length*: 0..23 | UTF-8 string | 0x60..0x77 + string | *length*: 23..255 | UTF-8 string (1 byte follow) | 0x78 + string | *length*: 256..65535 | UTF-8 string (2 bytes follow) | 0x79 + string | *length*: 65536..4294967295 | UTF-8 string (4 bytes follow) | 0x7A + string | *length*: 4294967296..18446744073709551615 | UTF-8 string (8 bytes follow) | 0x7B + array | *size*: 0..23 | array | 0x80..0x97 + array | *size*: 23..255 | array (1 byte follow) | 0x98 + array | *size*: 256..65535 | array (2 bytes follow) | 0x99 + array | *size*: 65536..4294967295 | array (4 bytes follow) | 0x9A + array | *size*: 4294967296..18446744073709551615 | array (8 bytes follow) | 0x9B + object | *size*: 0..23 | map | 0xA0..0xB7 + object | *size*: 23..255 | map (1 byte follow) | 0xB8 + object | *size*: 256..65535 | map (2 bytes follow) | 0xB9 + object | *size*: 65536..4294967295 | map (4 bytes follow) | 0xBA + object | *size*: 4294967296..18446744073709551615 | map (8 bytes follow) | 0xBB + binary | *size*: 0..23 | byte string | 0x40..0x57 + binary | *size*: 23..255 | byte string (1 byte follow) | 0x58 + binary | *size*: 256..65535 | byte string (2 bytes follow) | 0x59 + binary | *size*: 65536..4294967295 | byte string (4 bytes follow) | 0x5A + binary | *size*: 4294967296..18446744073709551615 | byte string (8 bytes follow) | 0x5B + + @note The mapping is **complete** in the sense that any JSON value type can be converted to a CBOR value. - @note If NaN or Infinity are stored inside a JSON number, they are + @note If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the @ref dump() function which serializes NaN or Infinity to `null`. - @note The following CBOR types are not used in the conversion: + @note The following CBOR types are not used in the conversion: - UTF-8 strings terminated by "break" (0x7F) - arrays terminated by "break" (0x9F) - maps terminated by "break" (0xBF) @@ -23613,188 +25241,198 @@ class basic_json - half-precision floats (0xF9) - break (0xFF) - @param[in] j JSON value to serialize - @return CBOR serialization as byte vector + @param[in] j JSON value to serialize + @return CBOR serialization as byte vector - @complexity Linear in the size of the JSON value @a j. + @complexity Linear in the size of the JSON value @a j. - @liveexample{The example shows the serialization of a JSON value to a byte - vector in CBOR format.,to_cbor} + @liveexample{The example shows the serialization of a JSON value to a byte + vector in CBOR format.,to_cbor} - @sa http://cbor.io - @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the + @sa http://cbor.io + @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the analogous deserialization - @sa @ref to_msgpack(const basic_json&) for the related MessagePack format - @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the + @sa @ref to_msgpack(const basic_json&) for the related MessagePack format + @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the related UBJSON format - @since version 2.0.9; compact representation of floating-point numbers + @since version 2.0.9; compact representation of floating-point numbers since version 3.8.0 - */ - static std::vector to_cbor(const basic_json& j) + */ + static std::vector to_cbor( + const basic_json& j) { std::vector result; to_cbor(j, result); return result; } - static void to_cbor(const basic_json& j, detail::output_adapter o) + static void to_cbor( + const basic_json& j, + detail::output_adapter o) { binary_writer(o).write_cbor(j); } - static void to_cbor(const basic_json& j, detail::output_adapter o) + static void to_cbor( + const basic_json& j, + detail::output_adapter o) { binary_writer(o).write_cbor(j); } /*! - @brief create a MessagePack serialization of a given JSON value - - Serializes a given JSON value @a j to a byte vector using the MessagePack - serialization format. MessagePack is a binary serialization format which - aims to be more compact than JSON itself, yet more efficient to parse. - - The library uses the following mapping from JSON values types to - MessagePack types according to the MessagePack specification: - - JSON value type | value/range | MessagePack type | first byte - --------------- | --------------------------------- | ---------------- | ---------- - null | `null` | nil | 0xC0 - boolean | `true` | true | 0xC3 - boolean | `false` | false | 0xC2 - number_integer | -9223372036854775808..-2147483649 | int64 | 0xD3 - number_integer | -2147483648..-32769 | int32 | 0xD2 - number_integer | -32768..-129 | int16 | 0xD1 - number_integer | -128..-33 | int8 | 0xD0 - number_integer | -32..-1 | negative fixint | 0xE0..0xFF - number_integer | 0..127 | positive fixint | 0x00..0x7F - number_integer | 128..255 | uint 8 | 0xCC - number_integer | 256..65535 | uint 16 | 0xCD - number_integer | 65536..4294967295 | uint 32 | 0xCE - number_integer | 4294967296..18446744073709551615 | uint 64 | 0xCF - number_unsigned | 0..127 | positive fixint | 0x00..0x7F - number_unsigned | 128..255 | uint 8 | 0xCC - number_unsigned | 256..65535 | uint 16 | 0xCD - number_unsigned | 65536..4294967295 | uint 32 | 0xCE - number_unsigned | 4294967296..18446744073709551615 | uint 64 | 0xCF - number_float | *any value representable by a float* | float 32 | 0xCA - number_float | *any value NOT representable by a float* | float 64 | 0xCB - string | *length*: 0..31 | fixstr | 0xA0..0xBF - string | *length*: 32..255 | str 8 | 0xD9 - string | *length*: 256..65535 | str 16 | 0xDA - string | *length*: 65536..4294967295 | str 32 | 0xDB - array | *size*: 0..15 | fixarray | 0x90..0x9F - array | *size*: 16..65535 | array 16 | 0xDC - array | *size*: 65536..4294967295 | array 32 | 0xDD - object | *size*: 0..15 | fix map | 0x80..0x8F - object | *size*: 16..65535 | map 16 | 0xDE - object | *size*: 65536..4294967295 | map 32 | 0xDF - binary | *size*: 0..255 | bin 8 | 0xC4 - binary | *size*: 256..65535 | bin 16 | 0xC5 - binary | *size*: 65536..4294967295 | bin 32 | 0xC6 - - @note The mapping is **complete** in the sense that any JSON value type + @brief create a MessagePack serialization of a given JSON value + + Serializes a given JSON value @a j to a byte vector using the MessagePack + serialization format. MessagePack is a binary serialization format which + aims to be more compact than JSON itself, yet more efficient to parse. + + The library uses the following mapping from JSON values types to + MessagePack types according to the MessagePack specification: + + JSON value type | value/range | MessagePack type | first byte + --------------- | --------------------------------- | ---------------- | ---------- + null | `null` | nil | 0xC0 + boolean | `true` | true | 0xC3 + boolean | `false` | false | 0xC2 + number_integer | -9223372036854775808..-2147483649 | int64 | 0xD3 + number_integer | -2147483648..-32769 | int32 | 0xD2 + number_integer | -32768..-129 | int16 | 0xD1 + number_integer | -128..-33 | int8 | 0xD0 + number_integer | -32..-1 | negative fixint | 0xE0..0xFF + number_integer | 0..127 | positive fixint | 0x00..0x7F + number_integer | 128..255 | uint 8 | 0xCC + number_integer | 256..65535 | uint 16 | 0xCD + number_integer | 65536..4294967295 | uint 32 | 0xCE + number_integer | 4294967296..18446744073709551615 | uint 64 | 0xCF + number_unsigned | 0..127 | positive fixint | 0x00..0x7F + number_unsigned | 128..255 | uint 8 | 0xCC + number_unsigned | 256..65535 | uint 16 | 0xCD + number_unsigned | 65536..4294967295 | uint 32 | 0xCE + number_unsigned | 4294967296..18446744073709551615 | uint 64 | 0xCF + number_float | *any value representable by a float* | float 32 | 0xCA + number_float | *any value NOT representable by a float* | float 64 | 0xCB + string | *length*: 0..31 | fixstr | 0xA0..0xBF + string | *length*: 32..255 | str 8 | 0xD9 + string | *length*: 256..65535 | str 16 | 0xDA + string | *length*: 65536..4294967295 | str 32 | 0xDB + array | *size*: 0..15 | fixarray | 0x90..0x9F + array | *size*: 16..65535 | array 16 | 0xDC + array | *size*: 65536..4294967295 | array 32 | 0xDD + object | *size*: 0..15 | fix map | 0x80..0x8F + object | *size*: 16..65535 | map 16 | 0xDE + object | *size*: 65536..4294967295 | map 32 | 0xDF + binary | *size*: 0..255 | bin 8 | 0xC4 + binary | *size*: 256..65535 | bin 16 | 0xC5 + binary | *size*: 65536..4294967295 | bin 32 | 0xC6 + + @note The mapping is **complete** in the sense that any JSON value type can be converted to a MessagePack value. - @note The following values can **not** be converted to a MessagePack value: + @note The following values can **not** be converted to a MessagePack value: - strings with more than 4294967295 bytes - byte strings with more than 4294967295 bytes - arrays with more than 4294967295 elements - objects with more than 4294967295 elements - @note Any MessagePack output created @ref to_msgpack can be successfully + @note Any MessagePack output created @ref to_msgpack can be successfully parsed by @ref from_msgpack. - @note If NaN or Infinity are stored inside a JSON number, they are + @note If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the @ref dump() function which serializes NaN or Infinity to `null`. - @param[in] j JSON value to serialize - @return MessagePack serialization as byte vector + @param[in] j JSON value to serialize + @return MessagePack serialization as byte vector - @complexity Linear in the size of the JSON value @a j. + @complexity Linear in the size of the JSON value @a j. - @liveexample{The example shows the serialization of a JSON value to a byte - vector in MessagePack format.,to_msgpack} + @liveexample{The example shows the serialization of a JSON value to a byte + vector in MessagePack format.,to_msgpack} - @sa http://msgpack.org - @sa @ref from_msgpack for the analogous deserialization - @sa @ref to_cbor(const basic_json& for the related CBOR format - @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the + @sa http://msgpack.org + @sa @ref from_msgpack for the analogous deserialization + @sa @ref to_cbor(const basic_json& for the related CBOR format + @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the related UBJSON format - @since version 2.0.9 - */ - static std::vector to_msgpack(const basic_json& j) + @since version 2.0.9 + */ + static std::vector to_msgpack( + const basic_json& j) { std::vector result; to_msgpack(j, result); return result; } - static void to_msgpack(const basic_json& j, detail::output_adapter o) + static void to_msgpack( + const basic_json& j, + detail::output_adapter o) { binary_writer(o).write_msgpack(j); } - static void to_msgpack(const basic_json& j, detail::output_adapter o) + static void to_msgpack( + const basic_json& j, + detail::output_adapter o) { binary_writer(o).write_msgpack(j); } /*! - @brief create a UBJSON serialization of a given JSON value - - Serializes a given JSON value @a j to a byte vector using the UBJSON - (Universal Binary JSON) serialization format. UBJSON aims to be more compact - than JSON itself, yet more efficient to parse. - - The library uses the following mapping from JSON values types to - UBJSON types according to the UBJSON specification: - - JSON value type | value/range | UBJSON type | marker - --------------- | --------------------------------- | ----------- | ------ - null | `null` | null | `Z` - boolean | `true` | true | `T` - boolean | `false` | false | `F` - number_integer | -9223372036854775808..-2147483649 | int64 | `L` - number_integer | -2147483648..-32769 | int32 | `l` - number_integer | -32768..-129 | int16 | `I` - number_integer | -128..127 | int8 | `i` - number_integer | 128..255 | uint8 | `U` - number_integer | 256..32767 | int16 | `I` - number_integer | 32768..2147483647 | int32 | `l` - number_integer | 2147483648..9223372036854775807 | int64 | `L` - number_unsigned | 0..127 | int8 | `i` - number_unsigned | 128..255 | uint8 | `U` - number_unsigned | 256..32767 | int16 | `I` - number_unsigned | 32768..2147483647 | int32 | `l` - number_unsigned | 2147483648..9223372036854775807 | int64 | `L` - number_unsigned | 2147483649..18446744073709551615 | high-precision | `H` - number_float | *any value* | float64 | `D` - string | *with shortest length indicator* | string | `S` - array | *see notes on optimized format* | array | `[` - object | *see notes on optimized format* | map | `{` - - @note The mapping is **complete** in the sense that any JSON value type + @brief create a UBJSON serialization of a given JSON value + + Serializes a given JSON value @a j to a byte vector using the UBJSON + (Universal Binary JSON) serialization format. UBJSON aims to be more compact + than JSON itself, yet more efficient to parse. + + The library uses the following mapping from JSON values types to + UBJSON types according to the UBJSON specification: + + JSON value type | value/range | UBJSON type | marker + --------------- | --------------------------------- | ----------- | ------ + null | `null` | null | `Z` + boolean | `true` | true | `T` + boolean | `false` | false | `F` + number_integer | -9223372036854775808..-2147483649 | int64 | `L` + number_integer | -2147483648..-32769 | int32 | `l` + number_integer | -32768..-129 | int16 | `I` + number_integer | -128..127 | int8 | `i` + number_integer | 128..255 | uint8 | `U` + number_integer | 256..32767 | int16 | `I` + number_integer | 32768..2147483647 | int32 | `l` + number_integer | 2147483648..9223372036854775807 | int64 | `L` + number_unsigned | 0..127 | int8 | `i` + number_unsigned | 128..255 | uint8 | `U` + number_unsigned | 256..32767 | int16 | `I` + number_unsigned | 32768..2147483647 | int32 | `l` + number_unsigned | 2147483648..9223372036854775807 | int64 | `L` + number_unsigned | 2147483649..18446744073709551615 | high-precision | `H` + number_float | *any value* | float64 | `D` + string | *with shortest length indicator* | string | `S` + array | *see notes on optimized format* | array | `[` + object | *see notes on optimized format* | map | `{` + + @note The mapping is **complete** in the sense that any JSON value type can be converted to a UBJSON value. - @note The following values can **not** be converted to a UBJSON value: + @note The following values can **not** be converted to a UBJSON value: - strings with more than 9223372036854775807 bytes (theoretical) - @note The following markers are not used in the conversion: + @note The following markers are not used in the conversion: - `Z`: no-op values are not created. - `C`: single-byte strings are serialized with `S` markers. - @note Any UBJSON output created @ref to_ubjson can be successfully parsed + @note Any UBJSON output created @ref to_ubjson can be successfully parsed by @ref from_ubjson. - @note If NaN or Infinity are stored inside a JSON number, they are + @note If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the @ref dump() function which serializes NaN or Infinity to `null`. - @note The optimized formats for containers are supported: Parameter + @note The optimized formats for containers are supported: Parameter @a use_size adds size information to the beginning of a container and removes the closing marker. Parameter @a use_type further checks whether all elements of a container have the same type and adds the @@ -23804,110 +25442,117 @@ class basic_json the benefit of this parameter is that the receiving side is immediately informed on the number of elements of the container. - @note If the JSON data contains the binary type, the value stored is a list + @note If the JSON data contains the binary type, the value stored is a list of integers, as suggested by the UBJSON documentation. In particular, this means that serialization and the deserialization of a JSON containing binary values into UBJSON and back will result in a different JSON object. - @param[in] j JSON value to serialize - @param[in] use_size whether to add size annotations to container types - @param[in] use_type whether to add type annotations to container types + @param[in] j JSON value to serialize + @param[in] use_size whether to add size annotations to container types + @param[in] use_type whether to add type annotations to container types (must be combined with @a use_size = true) - @return UBJSON serialization as byte vector + @return UBJSON serialization as byte vector - @complexity Linear in the size of the JSON value @a j. + @complexity Linear in the size of the JSON value @a j. - @liveexample{The example shows the serialization of a JSON value to a byte - vector in UBJSON format.,to_ubjson} + @liveexample{The example shows the serialization of a JSON value to a byte + vector in UBJSON format.,to_ubjson} - @sa http://ubjson.org - @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the + @sa http://ubjson.org + @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the analogous deserialization - @sa @ref to_cbor(const basic_json& for the related CBOR format - @sa @ref to_msgpack(const basic_json&) for the related MessagePack format + @sa @ref to_cbor(const basic_json& for the related CBOR format + @sa @ref to_msgpack(const basic_json&) for the related MessagePack format - @since version 3.1.0 - */ - static std::vector to_ubjson(const basic_json& j, - const bool use_size = false, - const bool use_type = false) + @since version 3.1.0 + */ + static std::vector to_ubjson( + const basic_json& j, + const bool use_size = false, + const bool use_type = false) { std::vector result; to_ubjson(j, result, use_size, use_type); return result; } - static void to_ubjson(const basic_json& j, detail::output_adapter o, - const bool use_size = false, const bool use_type = false) + static void to_ubjson( + const basic_json& j, + detail::output_adapter o, + const bool use_size = false, + const bool use_type = false) { binary_writer(o).write_ubjson(j, use_size, use_type); } - static void to_ubjson(const basic_json& j, detail::output_adapter o, - const bool use_size = false, const bool use_type = false) + static void to_ubjson( + const basic_json& j, + detail::output_adapter o, + const bool use_size = false, + const bool use_type = false) { binary_writer(o).write_ubjson(j, use_size, use_type); } - /*! - @brief Serializes the given JSON object `j` to BSON and returns a vector + @brief Serializes the given JSON object `j` to BSON and returns a vector containing the corresponding BSON-representation. - BSON (Binary JSON) is a binary format in which zero or more ordered key/value pairs are - stored as a single entity (a so-called document). - - The library uses the following mapping from JSON values types to BSON types: - - JSON value type | value/range | BSON type | marker - --------------- | --------------------------------- | ----------- | ------ - null | `null` | null | 0x0A - boolean | `true`, `false` | boolean | 0x08 - number_integer | -9223372036854775808..-2147483649 | int64 | 0x12 - number_integer | -2147483648..2147483647 | int32 | 0x10 - number_integer | 2147483648..9223372036854775807 | int64 | 0x12 - number_unsigned | 0..2147483647 | int32 | 0x10 - number_unsigned | 2147483648..9223372036854775807 | int64 | 0x12 - number_unsigned | 9223372036854775808..18446744073709551615| -- | -- - number_float | *any value* | double | 0x01 - string | *any value* | string | 0x02 - array | *any value* | document | 0x04 - object | *any value* | document | 0x03 - binary | *any value* | binary | 0x05 - - @warning The mapping is **incomplete**, since only JSON-objects (and things - contained therein) can be serialized to BSON. - Also, integers larger than 9223372036854775807 cannot be serialized to BSON, - and the keys may not contain U+0000, since they are serialized a - zero-terminated c-strings. - - @throw out_of_range.407 if `j.is_number_unsigned() && j.get() > 9223372036854775807` - @throw out_of_range.409 if a key in `j` contains a NULL (U+0000) - @throw type_error.317 if `!j.is_object()` - - @pre The input `j` is required to be an object: `j.is_object() == true`. - - @note Any BSON output created via @ref to_bson can be successfully parsed + BSON (Binary JSON) is a binary format in which zero or more ordered key/value pairs are + stored as a single entity (a so-called document). + + The library uses the following mapping from JSON values types to BSON types: + + JSON value type | value/range | BSON type | marker + --------------- | --------------------------------- | ----------- | ------ + null | `null` | null | 0x0A + boolean | `true`, `false` | boolean | 0x08 + number_integer | -9223372036854775808..-2147483649 | int64 | 0x12 + number_integer | -2147483648..2147483647 | int32 | 0x10 + number_integer | 2147483648..9223372036854775807 | int64 | 0x12 + number_unsigned | 0..2147483647 | int32 | 0x10 + number_unsigned | 2147483648..9223372036854775807 | int64 | 0x12 + number_unsigned | 9223372036854775808..18446744073709551615| -- | -- + number_float | *any value* | double | 0x01 + string | *any value* | string | 0x02 + array | *any value* | document | 0x04 + object | *any value* | document | 0x03 + binary | *any value* | binary | 0x05 + + @warning The mapping is **incomplete**, since only JSON-objects (and things + contained therein) can be serialized to BSON. + Also, integers larger than 9223372036854775807 cannot be serialized to BSON, + and the keys may not contain U+0000, since they are serialized a + zero-terminated c-strings. + + @throw out_of_range.407 if `j.is_number_unsigned() && j.get() > 9223372036854775807` + @throw out_of_range.409 if a key in `j` contains a NULL (U+0000) + @throw type_error.317 if `!j.is_object()` + + @pre The input `j` is required to be an object: `j.is_object() == true`. + + @note Any BSON output created via @ref to_bson can be successfully parsed by @ref from_bson. - @param[in] j JSON value to serialize - @return BSON serialization as byte vector + @param[in] j JSON value to serialize + @return BSON serialization as byte vector - @complexity Linear in the size of the JSON value @a j. + @complexity Linear in the size of the JSON value @a j. - @liveexample{The example shows the serialization of a JSON value to a byte - vector in BSON format.,to_bson} + @liveexample{The example shows the serialization of a JSON value to a byte + vector in BSON format.,to_bson} - @sa http://bsonspec.org/spec.html - @sa @ref from_bson(detail::input_adapter&&, const bool strict) for the + @sa http://bsonspec.org/spec.html + @sa @ref from_bson(detail::input_adapter&&, const bool strict) for the analogous deserialization - @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the + @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the related UBJSON format - @sa @ref to_cbor(const basic_json&) for the related CBOR format - @sa @ref to_msgpack(const basic_json&) for the related MessagePack format - */ - static std::vector to_bson(const basic_json& j) + @sa @ref to_cbor(const basic_json&) for the related CBOR format + @sa @ref to_msgpack(const basic_json&) for the related MessagePack format + */ + static std::vector to_bson( + const basic_json& j) { std::vector result; to_bson(j, result); @@ -23915,78 +25560,81 @@ class basic_json } /*! - @brief Serializes the given JSON object `j` to BSON and forwards the + @brief Serializes the given JSON object `j` to BSON and forwards the corresponding BSON-representation to the given output_adapter `o`. - @param j The JSON object to convert to BSON. - @param o The output adapter that receives the binary BSON representation. - @pre The input `j` shall be an object: `j.is_object() == true` - @sa @ref to_bson(const basic_json&) - */ - static void to_bson(const basic_json& j, detail::output_adapter o) + @param j The JSON object to convert to BSON. + @param o The output adapter that receives the binary BSON representation. + @pre The input `j` shall be an object: `j.is_object() == true` + @sa @ref to_bson(const basic_json&) + */ + static void to_bson( + const basic_json& j, + detail::output_adapter o) { binary_writer(o).write_bson(j); } /*! - @copydoc to_bson(const basic_json&, detail::output_adapter) - */ - static void to_bson(const basic_json& j, detail::output_adapter o) + @copydoc to_bson(const basic_json&, detail::output_adapter) + */ + static void to_bson( + const basic_json& j, + detail::output_adapter o) { binary_writer(o).write_bson(j); } - /*! - @brief create a JSON value from an input in CBOR format - - Deserializes a given input @a i to a JSON value using the CBOR (Concise - Binary Object Representation) serialization format. - - The library maps CBOR types to JSON value types as follows: - - CBOR type | JSON value type | first byte - ---------------------- | --------------- | ---------- - Integer | number_unsigned | 0x00..0x17 - Unsigned integer | number_unsigned | 0x18 - Unsigned integer | number_unsigned | 0x19 - Unsigned integer | number_unsigned | 0x1A - Unsigned integer | number_unsigned | 0x1B - Negative integer | number_integer | 0x20..0x37 - Negative integer | number_integer | 0x38 - Negative integer | number_integer | 0x39 - Negative integer | number_integer | 0x3A - Negative integer | number_integer | 0x3B - Byte string | binary | 0x40..0x57 - Byte string | binary | 0x58 - Byte string | binary | 0x59 - Byte string | binary | 0x5A - Byte string | binary | 0x5B - UTF-8 string | string | 0x60..0x77 - UTF-8 string | string | 0x78 - UTF-8 string | string | 0x79 - UTF-8 string | string | 0x7A - UTF-8 string | string | 0x7B - UTF-8 string | string | 0x7F - array | array | 0x80..0x97 - array | array | 0x98 - array | array | 0x99 - array | array | 0x9A - array | array | 0x9B - array | array | 0x9F - map | object | 0xA0..0xB7 - map | object | 0xB8 - map | object | 0xB9 - map | object | 0xBA - map | object | 0xBB - map | object | 0xBF - False | `false` | 0xF4 - True | `true` | 0xF5 - Null | `null` | 0xF6 - Half-Precision Float | number_float | 0xF9 - Single-Precision Float | number_float | 0xFA - Double-Precision Float | number_float | 0xFB - - @warning The mapping is **incomplete** in the sense that not all CBOR + @brief create a JSON value from an input in CBOR format + + Deserializes a given input @a i to a JSON value using the CBOR (Concise + Binary Object Representation) serialization format. + + The library maps CBOR types to JSON value types as follows: + + CBOR type | JSON value type | first byte + ---------------------- | --------------- | ---------- + Integer | number_unsigned | 0x00..0x17 + Unsigned integer | number_unsigned | 0x18 + Unsigned integer | number_unsigned | 0x19 + Unsigned integer | number_unsigned | 0x1A + Unsigned integer | number_unsigned | 0x1B + Negative integer | number_integer | 0x20..0x37 + Negative integer | number_integer | 0x38 + Negative integer | number_integer | 0x39 + Negative integer | number_integer | 0x3A + Negative integer | number_integer | 0x3B + Byte string | binary | 0x40..0x57 + Byte string | binary | 0x58 + Byte string | binary | 0x59 + Byte string | binary | 0x5A + Byte string | binary | 0x5B + UTF-8 string | string | 0x60..0x77 + UTF-8 string | string | 0x78 + UTF-8 string | string | 0x79 + UTF-8 string | string | 0x7A + UTF-8 string | string | 0x7B + UTF-8 string | string | 0x7F + array | array | 0x80..0x97 + array | array | 0x98 + array | array | 0x99 + array | array | 0x9A + array | array | 0x9B + array | array | 0x9F + map | object | 0xA0..0xB7 + map | object | 0xB8 + map | object | 0xB9 + map | object | 0xBA + map | object | 0xBB + map | object | 0xBF + False | `false` | 0xF4 + True | `true` | 0xF5 + Null | `null` | 0xF6 + Half-Precision Float | number_float | 0xF9 + Single-Precision Float | number_float | 0xFA + Double-Precision Float | number_float | 0xFB + + @warning The mapping is **incomplete** in the sense that not all CBOR types can be converted to a JSON value. The following CBOR types are not supported and will yield parse errors (parse_error.112): - date/time (0xC0..0xC1) @@ -23997,195 +25645,208 @@ class basic_json - simple values (0xE0..0xF3, 0xF8) - undefined (0xF7) - @warning CBOR allows map keys of any type, whereas JSON only allows + @warning CBOR allows map keys of any type, whereas JSON only allows strings as keys in object values. Therefore, CBOR maps with keys other than UTF-8 strings are rejected (parse_error.113). - @note Any CBOR output created @ref to_cbor can be successfully parsed by + @note Any CBOR output created @ref to_cbor can be successfully parsed by @ref from_cbor. - @param[in] i an input in CBOR format convertible to an input adapter - @param[in] strict whether to expect the input to be consumed until EOF + @param[in] i an input in CBOR format convertible to an input adapter + @param[in] strict whether to expect the input to be consumed until EOF (true by default) - @param[in] allow_exceptions whether to throw exceptions in case of a - parse error (optional, true by default) - @param[in] tag_handler how to treat CBOR tags (optional, error by default) + @param[in] allow_exceptions whether to throw exceptions in case of a + parse error (optional, true by default) + @param[in] tag_handler how to treat CBOR tags (optional, error by default) - @return deserialized JSON value; in case of a parse error and + @return deserialized JSON value; in case of a parse error and @a allow_exceptions set to `false`, the return value will be value_t::discarded. - @throw parse_error.110 if the given input ends prematurely or the end of - file was not reached when @a strict was set to true - @throw parse_error.112 if unsupported features from CBOR were - used in the given input @a v or if the input is not valid CBOR - @throw parse_error.113 if a string was expected as map key, but not found + @throw parse_error.110 if the given input ends prematurely or the end of + file was not reached when @a strict was set to true + @throw parse_error.112 if unsupported features from CBOR were + used in the given input @a v or if the input is not valid CBOR + @throw parse_error.113 if a string was expected as map key, but not found - @complexity Linear in the size of the input @a i. + @complexity Linear in the size of the input @a i. - @liveexample{The example shows the deserialization of a byte vector in CBOR - format to a JSON value.,from_cbor} + @liveexample{The example shows the deserialization of a byte vector in CBOR + format to a JSON value.,from_cbor} - @sa http://cbor.io - @sa @ref to_cbor(const basic_json&) for the analogous serialization - @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for the + @sa http://cbor.io + @sa @ref to_cbor(const basic_json&) for the analogous serialization + @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for the related MessagePack format - @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the + @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the related UBJSON format - @since version 2.0.9; parameter @a start_index since 2.1.1; changed to + @since version 2.0.9; parameter @a start_index since 2.1.1; changed to consume input adapters, removed start_index parameter, and added @a strict parameter since 3.0.0; added @a allow_exceptions parameter since 3.2.0; added @a tag_handler parameter since 3.9.0. - */ + */ template JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json from_cbor(InputType&& i, - const bool strict = true, - const bool allow_exceptions = true, - const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) + static basic_json from_cbor( + InputType&& i, + const bool strict = true, + const bool allow_exceptions = true, + const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); auto ia = detail::input_adapter(std::forward(i)); - const bool res = binary_reader(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict, tag_handler); + const bool res = binary_reader(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict, + tag_handler); return res ? result : basic_json(value_t::discarded); } /*! - @copydoc from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) - */ + @copydoc from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) + */ template JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json from_cbor(IteratorType first, IteratorType last, - const bool strict = true, - const bool allow_exceptions = true, - const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) + static basic_json from_cbor( + IteratorType first, + IteratorType last, + const bool strict = true, + const bool allow_exceptions = true, + const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); auto ia = detail::input_adapter(std::move(first), std::move(last)); - const bool res = binary_reader(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict, tag_handler); + const bool res = binary_reader(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict, + tag_handler); return res ? result : basic_json(value_t::discarded); } template JSON_HEDLEY_WARN_UNUSED_RESULT - JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_cbor(ptr, ptr + len)) - static basic_json from_cbor(const T* ptr, std::size_t len, - const bool strict = true, - const bool allow_exceptions = true, - const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) + JSON_HEDLEY_DEPRECATED_FOR( + 3.8 .0, + from_cbor(ptr, ptr + len)) + static basic_json from_cbor( + const T* ptr, + std::size_t len, + const bool strict = true, + const bool allow_exceptions = true, + const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) { return from_cbor(ptr, ptr + len, strict, allow_exceptions, tag_handler); } - JSON_HEDLEY_WARN_UNUSED_RESULT - JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_cbor(ptr, ptr + len)) - static basic_json from_cbor(detail::span_input_adapter&& i, - const bool strict = true, - const bool allow_exceptions = true, - const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) + JSON_HEDLEY_DEPRECATED_FOR( + 3.8 .0, + from_cbor(ptr, ptr + len)) + static basic_json from_cbor( + detail::span_input_adapter&& i, + const bool strict = true, + const bool allow_exceptions = true, + const cbor_tag_handler_t tag_handler = cbor_tag_handler_t::error) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); auto ia = i.get(); - const bool res = binary_reader(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict, tag_handler); + const bool res = binary_reader(std::move(ia)).sax_parse(input_format_t::cbor, &sdp, strict, + tag_handler); return res ? result : basic_json(value_t::discarded); } /*! - @brief create a JSON value from an input in MessagePack format - - Deserializes a given input @a i to a JSON value using the MessagePack - serialization format. - - The library maps MessagePack types to JSON value types as follows: - - MessagePack type | JSON value type | first byte - ---------------- | --------------- | ---------- - positive fixint | number_unsigned | 0x00..0x7F - fixmap | object | 0x80..0x8F - fixarray | array | 0x90..0x9F - fixstr | string | 0xA0..0xBF - nil | `null` | 0xC0 - false | `false` | 0xC2 - true | `true` | 0xC3 - float 32 | number_float | 0xCA - float 64 | number_float | 0xCB - uint 8 | number_unsigned | 0xCC - uint 16 | number_unsigned | 0xCD - uint 32 | number_unsigned | 0xCE - uint 64 | number_unsigned | 0xCF - int 8 | number_integer | 0xD0 - int 16 | number_integer | 0xD1 - int 32 | number_integer | 0xD2 - int 64 | number_integer | 0xD3 - str 8 | string | 0xD9 - str 16 | string | 0xDA - str 32 | string | 0xDB - array 16 | array | 0xDC - array 32 | array | 0xDD - map 16 | object | 0xDE - map 32 | object | 0xDF - bin 8 | binary | 0xC4 - bin 16 | binary | 0xC5 - bin 32 | binary | 0xC6 - ext 8 | binary | 0xC7 - ext 16 | binary | 0xC8 - ext 32 | binary | 0xC9 - fixext 1 | binary | 0xD4 - fixext 2 | binary | 0xD5 - fixext 4 | binary | 0xD6 - fixext 8 | binary | 0xD7 - fixext 16 | binary | 0xD8 - negative fixint | number_integer | 0xE0-0xFF - - @note Any MessagePack output created @ref to_msgpack can be successfully + @brief create a JSON value from an input in MessagePack format + + Deserializes a given input @a i to a JSON value using the MessagePack + serialization format. + + The library maps MessagePack types to JSON value types as follows: + + MessagePack type | JSON value type | first byte + ---------------- | --------------- | ---------- + positive fixint | number_unsigned | 0x00..0x7F + fixmap | object | 0x80..0x8F + fixarray | array | 0x90..0x9F + fixstr | string | 0xA0..0xBF + nil | `null` | 0xC0 + false | `false` | 0xC2 + true | `true` | 0xC3 + float 32 | number_float | 0xCA + float 64 | number_float | 0xCB + uint 8 | number_unsigned | 0xCC + uint 16 | number_unsigned | 0xCD + uint 32 | number_unsigned | 0xCE + uint 64 | number_unsigned | 0xCF + int 8 | number_integer | 0xD0 + int 16 | number_integer | 0xD1 + int 32 | number_integer | 0xD2 + int 64 | number_integer | 0xD3 + str 8 | string | 0xD9 + str 16 | string | 0xDA + str 32 | string | 0xDB + array 16 | array | 0xDC + array 32 | array | 0xDD + map 16 | object | 0xDE + map 32 | object | 0xDF + bin 8 | binary | 0xC4 + bin 16 | binary | 0xC5 + bin 32 | binary | 0xC6 + ext 8 | binary | 0xC7 + ext 16 | binary | 0xC8 + ext 32 | binary | 0xC9 + fixext 1 | binary | 0xD4 + fixext 2 | binary | 0xD5 + fixext 4 | binary | 0xD6 + fixext 8 | binary | 0xD7 + fixext 16 | binary | 0xD8 + negative fixint | number_integer | 0xE0-0xFF + + @note Any MessagePack output created @ref to_msgpack can be successfully parsed by @ref from_msgpack. - @param[in] i an input in MessagePack format convertible to an input + @param[in] i an input in MessagePack format convertible to an input adapter - @param[in] strict whether to expect the input to be consumed until EOF + @param[in] strict whether to expect the input to be consumed until EOF (true by default) - @param[in] allow_exceptions whether to throw exceptions in case of a - parse error (optional, true by default) + @param[in] allow_exceptions whether to throw exceptions in case of a + parse error (optional, true by default) - @return deserialized JSON value; in case of a parse error and + @return deserialized JSON value; in case of a parse error and @a allow_exceptions set to `false`, the return value will be value_t::discarded. - @throw parse_error.110 if the given input ends prematurely or the end of - file was not reached when @a strict was set to true - @throw parse_error.112 if unsupported features from MessagePack were - used in the given input @a i or if the input is not valid MessagePack - @throw parse_error.113 if a string was expected as map key, but not found + @throw parse_error.110 if the given input ends prematurely or the end of + file was not reached when @a strict was set to true + @throw parse_error.112 if unsupported features from MessagePack were + used in the given input @a i or if the input is not valid MessagePack + @throw parse_error.113 if a string was expected as map key, but not found - @complexity Linear in the size of the input @a i. + @complexity Linear in the size of the input @a i. - @liveexample{The example shows the deserialization of a byte vector in - MessagePack format to a JSON value.,from_msgpack} + @liveexample{The example shows the deserialization of a byte vector in + MessagePack format to a JSON value.,from_msgpack} - @sa http://msgpack.org - @sa @ref to_msgpack(const basic_json&) for the analogous serialization - @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the + @sa http://msgpack.org + @sa @ref to_msgpack(const basic_json&) for the analogous serialization + @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the related CBOR format - @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for + @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the related UBJSON format - @sa @ref from_bson(detail::input_adapter&&, const bool, const bool) for + @sa @ref from_bson(detail::input_adapter&&, const bool, const bool) for the related BSON format - @since version 2.0.9; parameter @a start_index since 2.1.1; changed to + @since version 2.0.9; parameter @a start_index since 2.1.1; changed to consume input adapters, removed start_index parameter, and added @a strict parameter since 3.0.0; added @a allow_exceptions parameter since 3.2.0 - */ + */ template JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json from_msgpack(InputType&& i, - const bool strict = true, - const bool allow_exceptions = true) + static basic_json from_msgpack( + InputType&& i, + const bool strict = true, + const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); @@ -24195,13 +25856,15 @@ class basic_json } /*! - @copydoc from_msgpack(detail::input_adapter&&, const bool, const bool) - */ + @copydoc from_msgpack(detail::input_adapter&&, const bool, const bool) + */ template JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json from_msgpack(IteratorType first, IteratorType last, - const bool strict = true, - const bool allow_exceptions = true) + static basic_json from_msgpack( + IteratorType first, + IteratorType last, + const bool strict = true, + const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); @@ -24210,22 +25873,28 @@ class basic_json return res ? result : basic_json(value_t::discarded); } - template JSON_HEDLEY_WARN_UNUSED_RESULT - JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_msgpack(ptr, ptr + len)) - static basic_json from_msgpack(const T* ptr, std::size_t len, - const bool strict = true, - const bool allow_exceptions = true) + JSON_HEDLEY_DEPRECATED_FOR( + 3.8 .0, + from_msgpack(ptr, ptr + len)) + static basic_json from_msgpack( + const T* ptr, + std::size_t len, + const bool strict = true, + const bool allow_exceptions = true) { return from_msgpack(ptr, ptr + len, strict, allow_exceptions); } JSON_HEDLEY_WARN_UNUSED_RESULT - JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_msgpack(ptr, ptr + len)) - static basic_json from_msgpack(detail::span_input_adapter&& i, - const bool strict = true, - const bool allow_exceptions = true) + JSON_HEDLEY_DEPRECATED_FOR( + 3.8 .0, + from_msgpack(ptr, ptr + len)) + static basic_json from_msgpack( + detail::span_input_adapter&& i, + const bool strict = true, + const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); @@ -24234,74 +25903,74 @@ class basic_json return res ? result : basic_json(value_t::discarded); } - /*! - @brief create a JSON value from an input in UBJSON format + @brief create a JSON value from an input in UBJSON format - Deserializes a given input @a i to a JSON value using the UBJSON (Universal - Binary JSON) serialization format. + Deserializes a given input @a i to a JSON value using the UBJSON (Universal + Binary JSON) serialization format. - The library maps UBJSON types to JSON value types as follows: + The library maps UBJSON types to JSON value types as follows: - UBJSON type | JSON value type | marker - ----------- | --------------------------------------- | ------ - no-op | *no value, next value is read* | `N` - null | `null` | `Z` - false | `false` | `F` - true | `true` | `T` - float32 | number_float | `d` - float64 | number_float | `D` - uint8 | number_unsigned | `U` - int8 | number_integer | `i` - int16 | number_integer | `I` - int32 | number_integer | `l` - int64 | number_integer | `L` - high-precision number | number_integer, number_unsigned, or number_float - depends on number string | 'H' - string | string | `S` - char | string | `C` - array | array (optimized values are supported) | `[` - object | object (optimized values are supported) | `{` + UBJSON type | JSON value type | marker + ----------- | --------------------------------------- | ------ + no-op | *no value, next value is read* | `N` + null | `null` | `Z` + false | `false` | `F` + true | `true` | `T` + float32 | number_float | `d` + float64 | number_float | `D` + uint8 | number_unsigned | `U` + int8 | number_integer | `i` + int16 | number_integer | `I` + int32 | number_integer | `l` + int64 | number_integer | `L` + high-precision number | number_integer, number_unsigned, or number_float - depends on number string | 'H' + string | string | `S` + char | string | `C` + array | array (optimized values are supported) | `[` + object | object (optimized values are supported) | `{` - @note The mapping is **complete** in the sense that any UBJSON value can + @note The mapping is **complete** in the sense that any UBJSON value can be converted to a JSON value. - @param[in] i an input in UBJSON format convertible to an input adapter - @param[in] strict whether to expect the input to be consumed until EOF + @param[in] i an input in UBJSON format convertible to an input adapter + @param[in] strict whether to expect the input to be consumed until EOF (true by default) - @param[in] allow_exceptions whether to throw exceptions in case of a - parse error (optional, true by default) + @param[in] allow_exceptions whether to throw exceptions in case of a + parse error (optional, true by default) - @return deserialized JSON value; in case of a parse error and + @return deserialized JSON value; in case of a parse error and @a allow_exceptions set to `false`, the return value will be value_t::discarded. - @throw parse_error.110 if the given input ends prematurely or the end of - file was not reached when @a strict was set to true - @throw parse_error.112 if a parse error occurs - @throw parse_error.113 if a string could not be parsed successfully + @throw parse_error.110 if the given input ends prematurely or the end of + file was not reached when @a strict was set to true + @throw parse_error.112 if a parse error occurs + @throw parse_error.113 if a string could not be parsed successfully - @complexity Linear in the size of the input @a i. + @complexity Linear in the size of the input @a i. - @liveexample{The example shows the deserialization of a byte vector in - UBJSON format to a JSON value.,from_ubjson} + @liveexample{The example shows the deserialization of a byte vector in + UBJSON format to a JSON value.,from_ubjson} - @sa http://ubjson.org - @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the + @sa http://ubjson.org + @sa @ref to_ubjson(const basic_json&, const bool, const bool) for the analogous serialization - @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the + @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the related CBOR format - @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for + @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for the related MessagePack format - @sa @ref from_bson(detail::input_adapter&&, const bool, const bool) for + @sa @ref from_bson(detail::input_adapter&&, const bool, const bool) for the related BSON format - @since version 3.1.0; added @a allow_exceptions parameter since 3.2.0 - */ + @since version 3.1.0; added @a allow_exceptions parameter since 3.2.0 + */ template JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json from_ubjson(InputType&& i, - const bool strict = true, - const bool allow_exceptions = true) + static basic_json from_ubjson( + InputType&& i, + const bool strict = true, + const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); @@ -24311,13 +25980,15 @@ class basic_json } /*! - @copydoc from_ubjson(detail::input_adapter&&, const bool, const bool) - */ + @copydoc from_ubjson(detail::input_adapter&&, const bool, const bool) + */ template JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json from_ubjson(IteratorType first, IteratorType last, - const bool strict = true, - const bool allow_exceptions = true) + static basic_json from_ubjson( + IteratorType first, + IteratorType last, + const bool strict = true, + const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); @@ -24328,19 +25999,26 @@ class basic_json template JSON_HEDLEY_WARN_UNUSED_RESULT - JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_ubjson(ptr, ptr + len)) - static basic_json from_ubjson(const T* ptr, std::size_t len, - const bool strict = true, - const bool allow_exceptions = true) + JSON_HEDLEY_DEPRECATED_FOR( + 3.8 .0, + from_ubjson(ptr, ptr + len)) + static basic_json from_ubjson( + const T* ptr, + std::size_t len, + const bool strict = true, + const bool allow_exceptions = true) { return from_ubjson(ptr, ptr + len, strict, allow_exceptions); } JSON_HEDLEY_WARN_UNUSED_RESULT - JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_ubjson(ptr, ptr + len)) - static basic_json from_ubjson(detail::span_input_adapter&& i, - const bool strict = true, - const bool allow_exceptions = true) + JSON_HEDLEY_DEPRECATED_FOR( + 3.8 .0, + from_ubjson(ptr, ptr + len)) + static basic_json from_ubjson( + detail::span_input_adapter&& i, + const bool strict = true, + const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); @@ -24349,72 +26027,72 @@ class basic_json return res ? result : basic_json(value_t::discarded); } - /*! - @brief Create a JSON value from an input in BSON format - - Deserializes a given input @a i to a JSON value using the BSON (Binary JSON) - serialization format. - - The library maps BSON record types to JSON value types as follows: - - BSON type | BSON marker byte | JSON value type - --------------- | ---------------- | --------------------------- - double | 0x01 | number_float - string | 0x02 | string - document | 0x03 | object - array | 0x04 | array - binary | 0x05 | binary - undefined | 0x06 | still unsupported - ObjectId | 0x07 | still unsupported - boolean | 0x08 | boolean - UTC Date-Time | 0x09 | still unsupported - null | 0x0A | null - Regular Expr. | 0x0B | still unsupported - DB Pointer | 0x0C | still unsupported - JavaScript Code | 0x0D | still unsupported - Symbol | 0x0E | still unsupported - JavaScript Code | 0x0F | still unsupported - int32 | 0x10 | number_integer - Timestamp | 0x11 | still unsupported - 128-bit decimal float | 0x13 | still unsupported - Max Key | 0x7F | still unsupported - Min Key | 0xFF | still unsupported - - @warning The mapping is **incomplete**. The unsupported mappings + @brief Create a JSON value from an input in BSON format + + Deserializes a given input @a i to a JSON value using the BSON (Binary JSON) + serialization format. + + The library maps BSON record types to JSON value types as follows: + + BSON type | BSON marker byte | JSON value type + --------------- | ---------------- | --------------------------- + double | 0x01 | number_float + string | 0x02 | string + document | 0x03 | object + array | 0x04 | array + binary | 0x05 | binary + undefined | 0x06 | still unsupported + ObjectId | 0x07 | still unsupported + boolean | 0x08 | boolean + UTC Date-Time | 0x09 | still unsupported + null | 0x0A | null + Regular Expr. | 0x0B | still unsupported + DB Pointer | 0x0C | still unsupported + JavaScript Code | 0x0D | still unsupported + Symbol | 0x0E | still unsupported + JavaScript Code | 0x0F | still unsupported + int32 | 0x10 | number_integer + Timestamp | 0x11 | still unsupported + 128-bit decimal float | 0x13 | still unsupported + Max Key | 0x7F | still unsupported + Min Key | 0xFF | still unsupported + + @warning The mapping is **incomplete**. The unsupported mappings are indicated in the table above. - @param[in] i an input in BSON format convertible to an input adapter - @param[in] strict whether to expect the input to be consumed until EOF + @param[in] i an input in BSON format convertible to an input adapter + @param[in] strict whether to expect the input to be consumed until EOF (true by default) - @param[in] allow_exceptions whether to throw exceptions in case of a - parse error (optional, true by default) + @param[in] allow_exceptions whether to throw exceptions in case of a + parse error (optional, true by default) - @return deserialized JSON value; in case of a parse error and + @return deserialized JSON value; in case of a parse error and @a allow_exceptions set to `false`, the return value will be value_t::discarded. - @throw parse_error.114 if an unsupported BSON record type is encountered + @throw parse_error.114 if an unsupported BSON record type is encountered - @complexity Linear in the size of the input @a i. + @complexity Linear in the size of the input @a i. - @liveexample{The example shows the deserialization of a byte vector in - BSON format to a JSON value.,from_bson} + @liveexample{The example shows the deserialization of a byte vector in + BSON format to a JSON value.,from_bson} - @sa http://bsonspec.org/spec.html - @sa @ref to_bson(const basic_json&) for the analogous serialization - @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the + @sa http://bsonspec.org/spec.html + @sa @ref to_bson(const basic_json&) for the analogous serialization + @sa @ref from_cbor(detail::input_adapter&&, const bool, const bool, const cbor_tag_handler_t) for the related CBOR format - @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for + @sa @ref from_msgpack(detail::input_adapter&&, const bool, const bool) for the related MessagePack format - @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the + @sa @ref from_ubjson(detail::input_adapter&&, const bool, const bool) for the related UBJSON format - */ + */ template JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json from_bson(InputType&& i, - const bool strict = true, - const bool allow_exceptions = true) + static basic_json from_bson( + InputType&& i, + const bool strict = true, + const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); @@ -24424,13 +26102,15 @@ class basic_json } /*! - @copydoc from_bson(detail::input_adapter&&, const bool, const bool) - */ + @copydoc from_bson(detail::input_adapter&&, const bool, const bool) + */ template JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json from_bson(IteratorType first, IteratorType last, - const bool strict = true, - const bool allow_exceptions = true) + static basic_json from_bson( + IteratorType first, + IteratorType last, + const bool strict = true, + const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); @@ -24441,19 +26121,26 @@ class basic_json template JSON_HEDLEY_WARN_UNUSED_RESULT - JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_bson(ptr, ptr + len)) - static basic_json from_bson(const T* ptr, std::size_t len, - const bool strict = true, - const bool allow_exceptions = true) + JSON_HEDLEY_DEPRECATED_FOR( + 3.8 .0, + from_bson(ptr, ptr + len)) + static basic_json from_bson( + const T* ptr, + std::size_t len, + const bool strict = true, + const bool allow_exceptions = true) { return from_bson(ptr, ptr + len, strict, allow_exceptions); } JSON_HEDLEY_WARN_UNUSED_RESULT - JSON_HEDLEY_DEPRECATED_FOR(3.8.0, from_bson(ptr, ptr + len)) - static basic_json from_bson(detail::span_input_adapter&& i, - const bool strict = true, - const bool allow_exceptions = true) + JSON_HEDLEY_DEPRECATED_FOR( + 3.8 .0, + from_bson(ptr, ptr + len)) + static basic_json from_bson( + detail::span_input_adapter&& i, + const bool strict = true, + const bool allow_exceptions = true) { basic_json result; detail::json_sax_dom_parser sdp(result, allow_exceptions); @@ -24461,6 +26148,7 @@ class basic_json const bool res = binary_reader(std::move(ia)).sax_parse(input_format_t::bson, &sdp, strict); return res ? result : basic_json(value_t::discarded); } + /// @} ////////////////////////// @@ -24471,179 +26159,183 @@ class basic_json /// @{ /*! - @brief access specified element via JSON Pointer + @brief access specified element via JSON Pointer - Uses a JSON pointer to retrieve a reference to the respective JSON value. - No bound checking is performed. Similar to @ref operator[](const typename - object_t::key_type&), `null` values are created in arrays and objects if - necessary. + Uses a JSON pointer to retrieve a reference to the respective JSON value. + No bound checking is performed. Similar to @ref operator[](const typename + object_t::key_type&), `null` values are created in arrays and objects if + necessary. - In particular: - - If the JSON pointer points to an object key that does not exist, it - is created an filled with a `null` value before a reference to it - is returned. - - If the JSON pointer points to an array index that does not exist, it - is created an filled with a `null` value before a reference to it - is returned. All indices between the current maximum and the given - index are also filled with `null`. - - The special value `-` is treated as a synonym for the index past the - end. + In particular: + - If the JSON pointer points to an object key that does not exist, it + is created an filled with a `null` value before a reference to it + is returned. + - If the JSON pointer points to an array index that does not exist, it + is created an filled with a `null` value before a reference to it + is returned. All indices between the current maximum and the given + index are also filled with `null`. + - The special value `-` is treated as a synonym for the index past the + end. - @param[in] ptr a JSON pointer + @param[in] ptr a JSON pointer - @return reference to the element pointed to by @a ptr + @return reference to the element pointed to by @a ptr - @complexity Constant. + @complexity Constant. - @throw parse_error.106 if an array index begins with '0' - @throw parse_error.109 if an array index was not a number - @throw out_of_range.404 if the JSON pointer can not be resolved + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.404 if the JSON pointer can not be resolved - @liveexample{The behavior is shown in the example.,operatorjson_pointer} + @liveexample{The behavior is shown in the example.,operatorjson_pointer} - @since version 2.0.0 - */ - reference operator[](const json_pointer& ptr) + @since version 2.0.0 + */ + reference operator []( + const json_pointer& ptr) { return ptr.get_unchecked(this); } /*! - @brief access specified element via JSON Pointer + @brief access specified element via JSON Pointer - Uses a JSON pointer to retrieve a reference to the respective JSON value. - No bound checking is performed. The function does not change the JSON - value; no `null` values are created. In particular, the special value - `-` yields an exception. + Uses a JSON pointer to retrieve a reference to the respective JSON value. + No bound checking is performed. The function does not change the JSON + value; no `null` values are created. In particular, the special value + `-` yields an exception. - @param[in] ptr JSON pointer to the desired element + @param[in] ptr JSON pointer to the desired element - @return const reference to the element pointed to by @a ptr + @return const reference to the element pointed to by @a ptr - @complexity Constant. + @complexity Constant. - @throw parse_error.106 if an array index begins with '0' - @throw parse_error.109 if an array index was not a number - @throw out_of_range.402 if the array index '-' is used - @throw out_of_range.404 if the JSON pointer can not be resolved + @throw parse_error.106 if an array index begins with '0' + @throw parse_error.109 if an array index was not a number + @throw out_of_range.402 if the array index '-' is used + @throw out_of_range.404 if the JSON pointer can not be resolved - @liveexample{The behavior is shown in the example.,operatorjson_pointer_const} + @liveexample{The behavior is shown in the example.,operatorjson_pointer_const} - @since version 2.0.0 - */ - const_reference operator[](const json_pointer& ptr) const + @since version 2.0.0 + */ + const_reference operator []( + const json_pointer& ptr) const { return ptr.get_unchecked(this); } /*! - @brief access specified element via JSON Pointer + @brief access specified element via JSON Pointer - Returns a reference to the element at with specified JSON pointer @a ptr, - with bounds checking. + Returns a reference to the element at with specified JSON pointer @a ptr, + with bounds checking. - @param[in] ptr JSON pointer to the desired element + @param[in] ptr JSON pointer to the desired element - @return reference to the element pointed to by @a ptr + @return reference to the element pointed to by @a ptr - @throw parse_error.106 if an array index in the passed JSON pointer @a ptr - begins with '0'. See example below. + @throw parse_error.106 if an array index in the passed JSON pointer @a ptr + begins with '0'. See example below. - @throw parse_error.109 if an array index in the passed JSON pointer @a ptr - is not a number. See example below. + @throw parse_error.109 if an array index in the passed JSON pointer @a ptr + is not a number. See example below. - @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr - is out of range. See example below. + @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr + is out of range. See example below. - @throw out_of_range.402 if the array index '-' is used in the passed JSON - pointer @a ptr. As `at` provides checked access (and no elements are - implicitly inserted), the index '-' is always invalid. See example below. + @throw out_of_range.402 if the array index '-' is used in the passed JSON + pointer @a ptr. As `at` provides checked access (and no elements are + implicitly inserted), the index '-' is always invalid. See example below. - @throw out_of_range.403 if the JSON pointer describes a key of an object - which cannot be found. See example below. + @throw out_of_range.403 if the JSON pointer describes a key of an object + which cannot be found. See example below. - @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved. - See example below. + @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved. + See example below. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes in the JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. - @complexity Constant. + @complexity Constant. - @since version 2.0.0 + @since version 2.0.0 - @liveexample{The behavior is shown in the example.,at_json_pointer} - */ - reference at(const json_pointer& ptr) + @liveexample{The behavior is shown in the example.,at_json_pointer} + */ + reference at( + const json_pointer& ptr) { return ptr.get_checked(this); } /*! - @brief access specified element via JSON Pointer + @brief access specified element via JSON Pointer - Returns a const reference to the element at with specified JSON pointer @a - ptr, with bounds checking. + Returns a const reference to the element at with specified JSON pointer @a + ptr, with bounds checking. - @param[in] ptr JSON pointer to the desired element + @param[in] ptr JSON pointer to the desired element - @return reference to the element pointed to by @a ptr + @return reference to the element pointed to by @a ptr - @throw parse_error.106 if an array index in the passed JSON pointer @a ptr - begins with '0'. See example below. + @throw parse_error.106 if an array index in the passed JSON pointer @a ptr + begins with '0'. See example below. - @throw parse_error.109 if an array index in the passed JSON pointer @a ptr - is not a number. See example below. + @throw parse_error.109 if an array index in the passed JSON pointer @a ptr + is not a number. See example below. - @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr - is out of range. See example below. + @throw out_of_range.401 if an array index in the passed JSON pointer @a ptr + is out of range. See example below. - @throw out_of_range.402 if the array index '-' is used in the passed JSON - pointer @a ptr. As `at` provides checked access (and no elements are - implicitly inserted), the index '-' is always invalid. See example below. + @throw out_of_range.402 if the array index '-' is used in the passed JSON + pointer @a ptr. As `at` provides checked access (and no elements are + implicitly inserted), the index '-' is always invalid. See example below. - @throw out_of_range.403 if the JSON pointer describes a key of an object - which cannot be found. See example below. + @throw out_of_range.403 if the JSON pointer describes a key of an object + which cannot be found. See example below. - @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved. - See example below. + @throw out_of_range.404 if the JSON pointer @a ptr can not be resolved. + See example below. - @exceptionsafety Strong guarantee: if an exception is thrown, there are no - changes in the JSON value. + @exceptionsafety Strong guarantee: if an exception is thrown, there are no + changes in the JSON value. - @complexity Constant. + @complexity Constant. - @since version 2.0.0 + @since version 2.0.0 - @liveexample{The behavior is shown in the example.,at_json_pointer_const} - */ - const_reference at(const json_pointer& ptr) const + @liveexample{The behavior is shown in the example.,at_json_pointer_const} + */ + const_reference at( + const json_pointer& ptr) const { return ptr.get_checked(this); } /*! - @brief return flattened JSON value + @brief return flattened JSON value - The function creates a JSON object whose keys are JSON pointers (see [RFC - 6901](https://tools.ietf.org/html/rfc6901)) and whose values are all - primitive. The original JSON value can be restored using the @ref - unflatten() function. + The function creates a JSON object whose keys are JSON pointers (see [RFC + 6901](https://tools.ietf.org/html/rfc6901)) and whose values are all + primitive. The original JSON value can be restored using the @ref + unflatten() function. - @return an object that maps JSON pointers to primitive values + @return an object that maps JSON pointers to primitive values - @note Empty objects and arrays are flattened to `null` and will not be + @note Empty objects and arrays are flattened to `null` and will not be reconstructed correctly by the @ref unflatten() function. - @complexity Linear in the size the JSON value. + @complexity Linear in the size the JSON value. - @liveexample{The following code shows how a JSON object is flattened to an - object whose keys consist of JSON pointers.,flatten} + @liveexample{The following code shows how a JSON object is flattened to an + object whose keys consist of JSON pointers.,flatten} - @sa @ref unflatten() for the reverse function + @sa @ref unflatten() for the reverse function - @since version 2.0.0 - */ + @since version 2.0.0 + */ basic_json flatten() const { basic_json result(value_t::object); @@ -24652,35 +26344,35 @@ class basic_json } /*! - @brief unflatten a previously flattened JSON value + @brief unflatten a previously flattened JSON value - The function restores the arbitrary nesting of a JSON value that has been - flattened before using the @ref flatten() function. The JSON value must - meet certain constraints: - 1. The value must be an object. - 2. The keys must be JSON pointers (see + The function restores the arbitrary nesting of a JSON value that has been + flattened before using the @ref flatten() function. The JSON value must + meet certain constraints: + 1. The value must be an object. + 2. The keys must be JSON pointers (see [RFC 6901](https://tools.ietf.org/html/rfc6901)) - 3. The mapped values must be primitive JSON types. + 3. The mapped values must be primitive JSON types. - @return the original JSON from a flattened version + @return the original JSON from a flattened version - @note Empty objects and arrays are flattened by @ref flatten() to `null` + @note Empty objects and arrays are flattened by @ref flatten() to `null` values and can not unflattened to their original type. Apart from this example, for a JSON value `j`, the following is always true: `j == j.flatten().unflatten()`. - @complexity Linear in the size the JSON value. + @complexity Linear in the size the JSON value. - @throw type_error.314 if value is not an object - @throw type_error.315 if object values are not primitive + @throw type_error.314 if value is not an object + @throw type_error.315 if object values are not primitive - @liveexample{The following code shows how a flattened JSON object is - unflattened into the original nested JSON object.,unflatten} + @liveexample{The following code shows how a flattened JSON object is + unflattened into the original nested JSON object.,unflatten} - @sa @ref flatten() for the reverse function + @sa @ref flatten() for the reverse function - @since version 2.0.0 - */ + @since version 2.0.0 + */ basic_json unflatten() const { return json_pointer::unflatten(*this); @@ -24696,178 +26388,183 @@ class basic_json /// @{ /*! - @brief applies a JSON patch + @brief applies a JSON patch - [JSON Patch](http://jsonpatch.com) defines a JSON document structure for - expressing a sequence of operations to apply to a JSON) document. With - this function, a JSON Patch is applied to the current JSON value by - executing all operations from the patch. + [JSON Patch](http://jsonpatch.com) defines a JSON document structure for + expressing a sequence of operations to apply to a JSON) document. With + this function, a JSON Patch is applied to the current JSON value by + executing all operations from the patch. - @param[in] json_patch JSON patch document - @return patched document + @param[in] json_patch JSON patch document + @return patched document - @note The application of a patch is atomic: Either all operations succeed + @note The application of a patch is atomic: Either all operations succeed and the patched document is returned or an exception is thrown. In any case, the original value is not changed: the patch is applied to a copy of the value. - @throw parse_error.104 if the JSON patch does not consist of an array of - objects + @throw parse_error.104 if the JSON patch does not consist of an array of + objects - @throw parse_error.105 if the JSON patch is malformed (e.g., mandatory - attributes are missing); example: `"operation add must have member path"` + @throw parse_error.105 if the JSON patch is malformed (e.g., mandatory + attributes are missing); example: `"operation add must have member path"` - @throw out_of_range.401 if an array index is out of range. + @throw out_of_range.401 if an array index is out of range. - @throw out_of_range.403 if a JSON pointer inside the patch could not be - resolved successfully in the current JSON value; example: `"key baz not - found"` + @throw out_of_range.403 if a JSON pointer inside the patch could not be + resolved successfully in the current JSON value; example: `"key baz not + found"` - @throw out_of_range.405 if JSON pointer has no parent ("add", "remove", - "move") + @throw out_of_range.405 if JSON pointer has no parent ("add", "remove", + "move") - @throw other_error.501 if "test" operation was unsuccessful + @throw other_error.501 if "test" operation was unsuccessful - @complexity Linear in the size of the JSON value and the length of the - JSON patch. As usually only a fraction of the JSON value is affected by - the patch, the complexity can usually be neglected. + @complexity Linear in the size of the JSON value and the length of the + JSON patch. As usually only a fraction of the JSON value is affected by + the patch, the complexity can usually be neglected. - @liveexample{The following code shows how a JSON patch is applied to a - value.,patch} + @liveexample{The following code shows how a JSON patch is applied to a + value.,patch} - @sa @ref diff -- create a JSON patch by comparing two JSON values + @sa @ref diff -- create a JSON patch by comparing two JSON values - @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902) - @sa [RFC 6901 (JSON Pointer)](https://tools.ietf.org/html/rfc6901) + @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902) + @sa [RFC 6901 (JSON Pointer)](https://tools.ietf.org/html/rfc6901) - @since version 2.0.0 - */ - basic_json patch(const basic_json& json_patch) const + @since version 2.0.0 + */ + basic_json patch( + const basic_json& json_patch) const { // make a working copy to apply the patch to basic_json result = *this; // the valid JSON Patch operations - enum class patch_operations {add, remove, replace, move, copy, test, invalid}; - - const auto get_op = [](const std::string & op) + enum class patch_operations { - if (op == "add") - { - return patch_operations::add; - } - if (op == "remove") - { - return patch_operations::remove; - } - if (op == "replace") - { - return patch_operations::replace; - } - if (op == "move") - { - return patch_operations::move; - } - if (op == "copy") - { - return patch_operations::copy; - } - if (op == "test") - { - return patch_operations::test; - } - - return patch_operations::invalid; + add, remove, replace, move, copy, test, invalid }; - // wrapper for "add" operation; add value at ptr - const auto operation_add = [&result](json_pointer & ptr, basic_json val) - { - // adding to the root of the target document means replacing it - if (ptr.empty()) - { - result = val; - return; - } - - // make sure the top element of the pointer exists - json_pointer top_pointer = ptr.top(); - if (top_pointer != ptr) - { - result.at(top_pointer); - } + const auto get_op = [](const std::string& op) + { + if (op == "add") + { + return patch_operations::add; + } + if (op == "remove") + { + return patch_operations::remove; + } + if (op == "replace") + { + return patch_operations::replace; + } + if (op == "move") + { + return patch_operations::move; + } + if (op == "copy") + { + return patch_operations::copy; + } + if (op == "test") + { + return patch_operations::test; + } - // get reference to parent of JSON pointer ptr - const auto last_path = ptr.back(); - ptr.pop_back(); - basic_json& parent = result[ptr]; + return patch_operations::invalid; + }; - switch (parent.m_type) - { - case value_t::null: - case value_t::object: + // wrapper for "add" operation; add value at ptr + const auto operation_add = [&result](json_pointer& ptr, basic_json val) { - // use operator[] to add value - parent[last_path] = val; - break; - } + // adding to the root of the target document means replacing it + if (ptr.empty()) + { + result = val; + return; + } - case value_t::array: - { - if (last_path == "-") + // make sure the top element of the pointer exists + json_pointer top_pointer = ptr.top(); + if (top_pointer != ptr) { - // special case: append to back - parent.push_back(val); + result.at(top_pointer); } - else + + // get reference to parent of JSON pointer ptr + const auto last_path = ptr.back(); + ptr.pop_back(); + basic_json& parent = result[ptr]; + + switch (parent.m_type) { - const auto idx = json_pointer::array_index(last_path); - if (JSON_HEDLEY_UNLIKELY(idx > parent.size())) + case value_t::null: + case value_t::object: { - // avoid undefined behavior - JSON_THROW(out_of_range::create(401, "array index " + std::to_string(idx) + " is out of range")); + // use operator[] to add value + parent[last_path] = val; + break; } - // default case: insert add offset - parent.insert(parent.begin() + static_cast(idx), val); - } - break; - } + case value_t::array: + { + if (last_path == "-") + { + // special case: append to back + parent.push_back(val); + } + else + { + const auto idx = json_pointer::array_index(last_path); + if (JSON_HEDLEY_UNLIKELY(idx > parent.size())) + { + // avoid undefined behavior + JSON_THROW(out_of_range::create(401, + "array index " + std::to_string(idx) + " is out of range")); + } - // if there exists a parent it cannot be primitive - default: // LCOV_EXCL_LINE - JSON_ASSERT(false); // LCOV_EXCL_LINE - } - }; + // default case: insert add offset + parent.insert(parent.begin() + static_cast(idx), val); + } + break; + } - // wrapper for "remove" operation; remove value at ptr - const auto operation_remove = [&result](json_pointer & ptr) - { - // get reference to parent of JSON pointer ptr - const auto last_path = ptr.back(); - ptr.pop_back(); - basic_json& parent = result.at(ptr); + // if there exists a parent it cannot be primitive + default: // LCOV_EXCL_LINE + JSON_ASSERT(false); // LCOV_EXCL_LINE + } + }; - // remove child - if (parent.is_object()) - { - // perform range check - auto it = parent.find(last_path); - if (JSON_HEDLEY_LIKELY(it != parent.end())) - { - parent.erase(it); - } - else + // wrapper for "remove" operation; remove value at ptr + const auto operation_remove = [&result](json_pointer& ptr) { - JSON_THROW(out_of_range::create(403, "key '" + last_path + "' not found")); - } - } - else if (parent.is_array()) - { - // note erase performs range check - parent.erase(json_pointer::array_index(last_path)); - } - }; + // get reference to parent of JSON pointer ptr + const auto last_path = ptr.back(); + ptr.pop_back(); + basic_json& parent = result.at(ptr); + + // remove child + if (parent.is_object()) + { + // perform range check + auto it = parent.find(last_path); + if (JSON_HEDLEY_LIKELY(it != parent.end())) + { + parent.erase(it); + } + else + { + JSON_THROW(out_of_range::create(403, "key '" + last_path + "' not found")); + } + } + else if (parent.is_array()) + { + // note erase performs range check + parent.erase(json_pointer::array_index(last_path)); + } + }; // type check: top level value must be an array if (JSON_HEDLEY_UNLIKELY(!json_patch.is_array())) @@ -24879,31 +26576,32 @@ class basic_json for (const auto& val : json_patch) { // wrapper to get a value for an operation - const auto get_value = [&val](const std::string & op, - const std::string & member, - bool string_type) -> basic_json & - { - // find value - auto it = val.m_value.object->find(member); + const auto get_value = [&val](const std::string& op, + const std::string& member, + bool string_type) -> basic_json& + { + // find value + auto it = val.m_value.object->find(member); - // context-sensitive error message - const auto error_msg = (op == "op") ? "operation" : "operation '" + op + "'"; + // context-sensitive error message + const auto error_msg = (op == "op") ? "operation" : "operation '" + op + "'"; - // check if desired value is present - if (JSON_HEDLEY_UNLIKELY(it == val.m_value.object->end())) - { - JSON_THROW(parse_error::create(105, 0, error_msg + " must have member '" + member + "'")); - } + // check if desired value is present + if (JSON_HEDLEY_UNLIKELY(it == val.m_value.object->end())) + { + JSON_THROW(parse_error::create(105, 0, error_msg + " must have member '" + member + "'")); + } - // check if result is of type string - if (JSON_HEDLEY_UNLIKELY(string_type && !it->second.is_string())) - { - JSON_THROW(parse_error::create(105, 0, error_msg + " must have string member '" + member + "'")); - } + // check if result is of type string + if (JSON_HEDLEY_UNLIKELY(string_type && !it->second.is_string())) + { + JSON_THROW(parse_error::create(105, 0, + error_msg + " must have string member '" + member + "'")); + } - // no error: return value - return it->second; - }; + // no error: return value + return it->second; + }; // type check: every element of the array must be an object if (JSON_HEDLEY_UNLIKELY(!val.is_object())) @@ -25005,41 +26703,43 @@ class basic_json } /*! - @brief creates a diff as a JSON patch + @brief creates a diff as a JSON patch - Creates a [JSON Patch](http://jsonpatch.com) so that value @a source can - be changed into the value @a target by calling @ref patch function. + Creates a [JSON Patch](http://jsonpatch.com) so that value @a source can + be changed into the value @a target by calling @ref patch function. - @invariant For two JSON values @a source and @a target, the following code - yields always `true`: - @code {.cpp} - source.patch(diff(source, target)) == target; - @endcode + @invariant For two JSON values @a source and @a target, the following code + yields always `true`: + @code {.cpp} + source.patch(diff(source, target)) == target; + @endcode - @note Currently, only `remove`, `add`, and `replace` operations are + @note Currently, only `remove`, `add`, and `replace` operations are generated. - @param[in] source JSON value to compare from - @param[in] target JSON value to compare against - @param[in] path helper value to create JSON pointers + @param[in] source JSON value to compare from + @param[in] target JSON value to compare against + @param[in] path helper value to create JSON pointers - @return a JSON patch to convert the @a source to @a target + @return a JSON patch to convert the @a source to @a target - @complexity Linear in the lengths of @a source and @a target. + @complexity Linear in the lengths of @a source and @a target. - @liveexample{The following code shows how a JSON patch is created as a - diff for two JSON values.,diff} + @liveexample{The following code shows how a JSON patch is created as a + diff for two JSON values.,diff} - @sa @ref patch -- apply a JSON patch - @sa @ref merge_patch -- apply a JSON Merge Patch + @sa @ref patch -- apply a JSON patch + @sa @ref merge_patch -- apply a JSON Merge Patch - @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902) + @sa [RFC 6902 (JSON Patch)](https://tools.ietf.org/html/rfc6902) - @since version 2.0.0 - */ + @since version 2.0.0 + */ JSON_HEDLEY_WARN_UNUSED_RESULT - static basic_json diff(const basic_json& source, const basic_json& target, - const std::string& path = "") + static basic_json diff( + const basic_json& source, + const basic_json& target, + const std::string& path = "") { // the patch basic_json result(value_t::array); @@ -25054,9 +26754,9 @@ class basic_json { // different types: replace value result.push_back( - { - {"op", "replace"}, {"path", path}, {"value", target} - }); + { + {"op", "replace"}, {"path", path}, {"value", target} + }); return result; } @@ -25084,10 +26784,10 @@ class basic_json // add operations in reverse order to avoid invalid // indices result.insert(result.begin() + end_index, object( - { - {"op", "remove"}, - {"path", path + "/" + std::to_string(i)} - })); + { + {"op", "remove"}, + {"path", path + "/" + std::to_string(i)} + })); ++i; } @@ -25095,11 +26795,11 @@ class basic_json while (i < target.size()) { result.push_back( - { - {"op", "add"}, - {"path", path + "/-"}, - {"value", target[i]} - }); + { + {"op", "add"}, + {"path", path + "/-"}, + {"value", target[i]} + }); ++i; } @@ -25124,9 +26824,9 @@ class basic_json { // found a key that is not in o -> remove it result.push_back(object( - { - {"op", "remove"}, {"path", path + "/" + key} - })); + { + {"op", "remove"}, {"path", path + "/" + key} + })); } } @@ -25138,10 +26838,10 @@ class basic_json // found a key that is not in this -> add it const auto key = json_pointer::escape(it.key()); result.push_back( - { - {"op", "add"}, {"path", path + "/" + key}, - {"value", it.value()} - }); + { + {"op", "add"}, {"path", path + "/" + key}, + {"value", it.value()} + }); } } @@ -25152,9 +26852,9 @@ class basic_json { // both primitive type: replace value result.push_back( - { - {"op", "replace"}, {"path", path}, {"value", target} - }); + { + {"op", "replace"}, {"path", path}, {"value", target} + }); break; } } @@ -25172,19 +26872,19 @@ class basic_json /// @{ /*! - @brief applies a JSON Merge Patch + @brief applies a JSON Merge Patch - The merge patch format is primarily intended for use with the HTTP PATCH - method as a means of describing a set of modifications to a target - resource's content. This function applies a merge patch to the current - JSON value. + The merge patch format is primarily intended for use with the HTTP PATCH + method as a means of describing a set of modifications to a target + resource's content. This function applies a merge patch to the current + JSON value. - The function implements the following algorithm from Section 2 of - [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396): + The function implements the following algorithm from Section 2 of + [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396): - ``` - define MergePatch(Target, Patch): - if Patch is an Object: + ``` + define MergePatch(Target, Patch): + if Patch is an Object: if Target is not an Object: Target = {} // Ignore the contents and set it to an empty Object for each Name/Value pair in Patch: @@ -25194,26 +26894,27 @@ class basic_json else: Target[Name] = MergePatch(Target[Name], Value) return Target - else: + else: return Patch - ``` + ``` - Thereby, `Target` is the current object; that is, the patch is applied to - the current value. + Thereby, `Target` is the current object; that is, the patch is applied to + the current value. - @param[in] apply_patch the patch to apply + @param[in] apply_patch the patch to apply - @complexity Linear in the lengths of @a patch. + @complexity Linear in the lengths of @a patch. - @liveexample{The following code shows how a JSON Merge Patch is applied to - a JSON document.,merge_patch} + @liveexample{The following code shows how a JSON Merge Patch is applied to + a JSON document.,merge_patch} - @sa @ref patch -- apply a JSON patch - @sa [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396) + @sa @ref patch -- apply a JSON patch + @sa [RFC 7396 (JSON Merge Patch)](https://tools.ietf.org/html/rfc7396) - @since version 3.0.0 - */ - void merge_patch(const basic_json& apply_patch) + @since version 3.0.0 + */ + void merge_patch( + const basic_json& apply_patch) { if (apply_patch.is_object()) { @@ -25229,7 +26930,7 @@ class basic_json } else { - operator[](it.key()).merge_patch(it.value()); + operator [](it.key()).merge_patch(it.value()); } } } @@ -25243,19 +26944,21 @@ class basic_json }; /*! -@brief user-defined to_string function for JSON values + @brief user-defined to_string function for JSON values -This function implements a user-defined to_string for JSON objects. + This function implements a user-defined to_string for JSON objects. -@param[in] j a JSON object -@return a std::string object -*/ + @param[in] j a JSON object + @return a std::string object + */ NLOHMANN_BASIC_JSON_TPL_DECLARATION -std::string to_string(const NLOHMANN_BASIC_JSON_TPL& j) +std::string to_string( + const NLOHMANN_BASIC_JSON_TPL& j) { return j.dump(); } + } // namespace nlohmann /////////////////////// @@ -25263,22 +26966,23 @@ std::string to_string(const NLOHMANN_BASIC_JSON_TPL& j) /////////////////////// // specialization of std::swap, and std::hash -namespace std -{ +namespace std { /// hash value for JSON objects template<> struct hash { /*! - @brief return a hash value for a JSON object + @brief return a hash value for a JSON object - @since version 1.0.0 - */ - std::size_t operator()(const nlohmann::json& j) const + @since version 1.0.0 + */ + std::size_t operator ()( + const nlohmann::json& j) const { return nlohmann::detail::hash(j); } + }; /// specialization for std::less @@ -25288,71 +26992,81 @@ template<> struct less<::nlohmann::detail::value_t> { /*! - @brief compare two value_t enum values - @since version 3.0.0 - */ - bool operator()(nlohmann::detail::value_t lhs, - nlohmann::detail::value_t rhs) const noexcept + @brief compare two value_t enum values + @since version 3.0.0 + */ + bool operator ()( + nlohmann::detail::value_t lhs, + nlohmann::detail::value_t rhs) const noexcept { - return nlohmann::detail::operator<(lhs, rhs); + return nlohmann::detail::operator <( + lhs, + rhs); } + }; // C++20 prohibit function specialization in the std namespace. #ifndef JSON_HAS_CPP_20 /*! -@brief exchanges the values of two JSON objects + @brief exchanges the values of two JSON objects -@since version 1.0.0 -*/ + @since version 1.0.0 + */ template<> -inline void swap(nlohmann::json& j1, nlohmann::json& j2) noexcept( - is_nothrow_move_constructible::value&& +inline void swap( + nlohmann::json& j1, + nlohmann::json& j2) noexcept( + is_nothrow_move_constructible::value && is_nothrow_move_assignable::value - ) + ) { j1.swap(j2); } -#endif +#endif // ifndef JSON_HAS_CPP_20 } // namespace std /*! -@brief user-defined string literal for JSON values + @brief user-defined string literal for JSON values -This operator implements a user-defined string literal for JSON objects. It -can be used by adding `"_json"` to a string literal and returns a JSON object -if no parse error occurred. + This operator implements a user-defined string literal for JSON objects. It + can be used by adding `"_json"` to a string literal and returns a JSON object + if no parse error occurred. -@param[in] s a string representation of a JSON object -@param[in] n the length of string @a s -@return a JSON object + @param[in] s a string representation of a JSON object + @param[in] n the length of string @a s + @return a JSON object -@since version 1.0.0 -*/ + @since version 1.0.0 + */ JSON_HEDLEY_NON_NULL(1) -inline nlohmann::json operator "" _json(const char* s, std::size_t n) +inline nlohmann::json operator "" _json( + const char* s, + std::size_t n) { return nlohmann::json::parse(s, s + n); } /*! -@brief user-defined string literal for JSON pointer + @brief user-defined string literal for JSON pointer -This operator implements a user-defined string literal for JSON Pointers. It -can be used by adding `"_json_pointer"` to a string literal and returns a JSON pointer -object if no parse error occurred. + This operator implements a user-defined string literal for JSON Pointers. It + can be used by adding `"_json_pointer"` to a string literal and returns a JSON pointer + object if no parse error occurred. -@param[in] s a string representation of a JSON Pointer -@param[in] n the length of string @a s -@return a JSON pointer object + @param[in] s a string representation of a JSON Pointer + @param[in] n the length of string @a s + @return a JSON pointer object -@since version 2.0.0 -*/ + @since version 2.0.0 + */ JSON_HEDLEY_NON_NULL(1) -inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std::size_t n) +inline nlohmann::json::json_pointer operator "" _json_pointer( + const char* s, + std::size_t n) { return nlohmann::json::json_pointer(std::string(s, n)); } @@ -25363,10 +27077,10 @@ inline nlohmann::json::json_pointer operator "" _json_pointer(const char* s, std // restore GCC/clang diagnostic settings #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #pragma GCC diagnostic pop -#endif +#endif // if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #if defined(__clang__) #pragma GCC diagnostic pop -#endif +#endif // if defined(__clang__) // clean up #undef JSON_ASSERT diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_types.cxx b/include/fastdds_statistics_backend/topic_types/monitorservice_types.cxx deleted file mode 100644 index 2ea9407d9..000000000 --- a/include/fastdds_statistics_backend/topic_types/monitorservice_types.cxx +++ /dev/null @@ -1,2056 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file monitorservice_types.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "monitorservice_types.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - -namespace eprosima { - -namespace fastdds { - -namespace statistics { - - - - - -Connection::Connection() -{ -} - -Connection::~Connection() -{ -} - -Connection::Connection( - const Connection& x) -{ - m_mode = x.m_mode; - m_guid = x.m_guid; - m_announced_locators = x.m_announced_locators; - m_used_locators = x.m_used_locators; -} - -Connection::Connection( - Connection&& x) noexcept -{ - m_mode = x.m_mode; - m_guid = std::move(x.m_guid); - m_announced_locators = std::move(x.m_announced_locators); - m_used_locators = std::move(x.m_used_locators); -} - -Connection& Connection::operator =( - const Connection& x) -{ - - m_mode = x.m_mode; - m_guid = x.m_guid; - m_announced_locators = x.m_announced_locators; - m_used_locators = x.m_used_locators; - return *this; -} - -Connection& Connection::operator =( - Connection&& x) noexcept -{ - - m_mode = x.m_mode; - m_guid = std::move(x.m_guid); - m_announced_locators = std::move(x.m_announced_locators); - m_used_locators = std::move(x.m_used_locators); - return *this; -} - -bool Connection::operator ==( - const Connection& x) const -{ - return (m_mode == x.m_mode && - m_guid == x.m_guid && - m_announced_locators == x.m_announced_locators && - m_used_locators == x.m_used_locators); -} - -bool Connection::operator !=( - const Connection& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member mode - * @param _mode New value for member mode - */ -void Connection::mode( - eprosima::fastdds::statistics::ConnectionMode _mode) -{ - m_mode = _mode; -} - -/*! - * @brief This function returns the value of member mode - * @return Value of member mode - */ -eprosima::fastdds::statistics::ConnectionMode Connection::mode() const -{ - return m_mode; -} - -/*! - * @brief This function returns a reference to member mode - * @return Reference to member mode - */ -eprosima::fastdds::statistics::ConnectionMode& Connection::mode() -{ - return m_mode; -} - - -/*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ -void Connection::guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid) -{ - m_guid = _guid; -} - -/*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ -void Connection::guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid) -{ - m_guid = std::move(_guid); -} - -/*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& Connection::guid() const -{ - return m_guid; -} - -/*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ -eprosima::fastdds::statistics::detail::GUID_s& Connection::guid() -{ - return m_guid; -} - - -/*! - * @brief This function copies the value in member announced_locators - * @param _announced_locators New value to be copied in member announced_locators - */ -void Connection::announced_locators( - const std::vector& _announced_locators) -{ - m_announced_locators = _announced_locators; -} - -/*! - * @brief This function moves the value in member announced_locators - * @param _announced_locators New value to be moved in member announced_locators - */ -void Connection::announced_locators( - std::vector&& _announced_locators) -{ - m_announced_locators = std::move(_announced_locators); -} - -/*! - * @brief This function returns a constant reference to member announced_locators - * @return Constant reference to member announced_locators - */ -const std::vector& Connection::announced_locators() const -{ - return m_announced_locators; -} - -/*! - * @brief This function returns a reference to member announced_locators - * @return Reference to member announced_locators - */ -std::vector& Connection::announced_locators() -{ - return m_announced_locators; -} - - -/*! - * @brief This function copies the value in member used_locators - * @param _used_locators New value to be copied in member used_locators - */ -void Connection::used_locators( - const std::vector& _used_locators) -{ - m_used_locators = _used_locators; -} - -/*! - * @brief This function moves the value in member used_locators - * @param _used_locators New value to be moved in member used_locators - */ -void Connection::used_locators( - std::vector&& _used_locators) -{ - m_used_locators = std::move(_used_locators); -} - -/*! - * @brief This function returns a constant reference to member used_locators - * @return Constant reference to member used_locators - */ -const std::vector& Connection::used_locators() const -{ - return m_used_locators; -} - -/*! - * @brief This function returns a reference to member used_locators - * @return Reference to member used_locators - */ -std::vector& Connection::used_locators() -{ - return m_used_locators; -} - - - - -QosPolicyCount_s::QosPolicyCount_s() -{ -} - -QosPolicyCount_s::~QosPolicyCount_s() -{ -} - -QosPolicyCount_s::QosPolicyCount_s( - const QosPolicyCount_s& x) -{ - m_policy_id = x.m_policy_id; - m_count = x.m_count; -} - -QosPolicyCount_s::QosPolicyCount_s( - QosPolicyCount_s&& x) noexcept -{ - m_policy_id = x.m_policy_id; - m_count = x.m_count; -} - -QosPolicyCount_s& QosPolicyCount_s::operator =( - const QosPolicyCount_s& x) -{ - - m_policy_id = x.m_policy_id; - m_count = x.m_count; - return *this; -} - -QosPolicyCount_s& QosPolicyCount_s::operator =( - QosPolicyCount_s&& x) noexcept -{ - - m_policy_id = x.m_policy_id; - m_count = x.m_count; - return *this; -} - -bool QosPolicyCount_s::operator ==( - const QosPolicyCount_s& x) const -{ - return (m_policy_id == x.m_policy_id && - m_count == x.m_count); -} - -bool QosPolicyCount_s::operator !=( - const QosPolicyCount_s& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member policy_id - * @param _policy_id New value for member policy_id - */ -void QosPolicyCount_s::policy_id( - uint32_t _policy_id) -{ - m_policy_id = _policy_id; -} - -/*! - * @brief This function returns the value of member policy_id - * @return Value of member policy_id - */ -uint32_t QosPolicyCount_s::policy_id() const -{ - return m_policy_id; -} - -/*! - * @brief This function returns a reference to member policy_id - * @return Reference to member policy_id - */ -uint32_t& QosPolicyCount_s::policy_id() -{ - return m_policy_id; -} - - -/*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ -void QosPolicyCount_s::count( - uint32_t _count) -{ - m_count = _count; -} - -/*! - * @brief This function returns the value of member count - * @return Value of member count - */ -uint32_t QosPolicyCount_s::count() const -{ - return m_count; -} - -/*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ -uint32_t& QosPolicyCount_s::count() -{ - return m_count; -} - - - - -BaseStatus_s::BaseStatus_s() -{ -} - -BaseStatus_s::~BaseStatus_s() -{ -} - -BaseStatus_s::BaseStatus_s( - const BaseStatus_s& x) -{ - m_total_count = x.m_total_count; -} - -BaseStatus_s::BaseStatus_s( - BaseStatus_s&& x) noexcept -{ - m_total_count = x.m_total_count; -} - -BaseStatus_s& BaseStatus_s::operator =( - const BaseStatus_s& x) -{ - - m_total_count = x.m_total_count; - return *this; -} - -BaseStatus_s& BaseStatus_s::operator =( - BaseStatus_s&& x) noexcept -{ - - m_total_count = x.m_total_count; - return *this; -} - -bool BaseStatus_s::operator ==( - const BaseStatus_s& x) const -{ - return (m_total_count == x.m_total_count); -} - -bool BaseStatus_s::operator !=( - const BaseStatus_s& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ -void BaseStatus_s::total_count( - uint32_t _total_count) -{ - m_total_count = _total_count; -} - -/*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ -uint32_t BaseStatus_s::total_count() const -{ - return m_total_count; -} - -/*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ -uint32_t& BaseStatus_s::total_count() -{ - return m_total_count; -} - - - - - - - -IncompatibleQoSStatus_s::IncompatibleQoSStatus_s() -{ -} - -IncompatibleQoSStatus_s::~IncompatibleQoSStatus_s() -{ -} - -IncompatibleQoSStatus_s::IncompatibleQoSStatus_s( - const IncompatibleQoSStatus_s& x) -{ - m_total_count = x.m_total_count; - m_last_policy_id = x.m_last_policy_id; - m_policies = x.m_policies; -} - -IncompatibleQoSStatus_s::IncompatibleQoSStatus_s( - IncompatibleQoSStatus_s&& x) noexcept -{ - m_total_count = x.m_total_count; - m_last_policy_id = x.m_last_policy_id; - m_policies = std::move(x.m_policies); -} - -IncompatibleQoSStatus_s& IncompatibleQoSStatus_s::operator =( - const IncompatibleQoSStatus_s& x) -{ - - m_total_count = x.m_total_count; - m_last_policy_id = x.m_last_policy_id; - m_policies = x.m_policies; - return *this; -} - -IncompatibleQoSStatus_s& IncompatibleQoSStatus_s::operator =( - IncompatibleQoSStatus_s&& x) noexcept -{ - - m_total_count = x.m_total_count; - m_last_policy_id = x.m_last_policy_id; - m_policies = std::move(x.m_policies); - return *this; -} - -bool IncompatibleQoSStatus_s::operator ==( - const IncompatibleQoSStatus_s& x) const -{ - return (m_total_count == x.m_total_count && - m_last_policy_id == x.m_last_policy_id && - m_policies == x.m_policies); -} - -bool IncompatibleQoSStatus_s::operator !=( - const IncompatibleQoSStatus_s& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ -void IncompatibleQoSStatus_s::total_count( - uint32_t _total_count) -{ - m_total_count = _total_count; -} - -/*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ -uint32_t IncompatibleQoSStatus_s::total_count() const -{ - return m_total_count; -} - -/*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ -uint32_t& IncompatibleQoSStatus_s::total_count() -{ - return m_total_count; -} - - -/*! - * @brief This function sets a value in member last_policy_id - * @param _last_policy_id New value for member last_policy_id - */ -void IncompatibleQoSStatus_s::last_policy_id( - uint32_t _last_policy_id) -{ - m_last_policy_id = _last_policy_id; -} - -/*! - * @brief This function returns the value of member last_policy_id - * @return Value of member last_policy_id - */ -uint32_t IncompatibleQoSStatus_s::last_policy_id() const -{ - return m_last_policy_id; -} - -/*! - * @brief This function returns a reference to member last_policy_id - * @return Reference to member last_policy_id - */ -uint32_t& IncompatibleQoSStatus_s::last_policy_id() -{ - return m_last_policy_id; -} - - -/*! - * @brief This function copies the value in member policies - * @param _policies New value to be copied in member policies - */ -void IncompatibleQoSStatus_s::policies( - const eprosima::fastdds::statistics::QosPolicyCountSeq_s& _policies) -{ - m_policies = _policies; -} - -/*! - * @brief This function moves the value in member policies - * @param _policies New value to be moved in member policies - */ -void IncompatibleQoSStatus_s::policies( - eprosima::fastdds::statistics::QosPolicyCountSeq_s&& _policies) -{ - m_policies = std::move(_policies); -} - -/*! - * @brief This function returns a constant reference to member policies - * @return Constant reference to member policies - */ -const eprosima::fastdds::statistics::QosPolicyCountSeq_s& IncompatibleQoSStatus_s::policies() const -{ - return m_policies; -} - -/*! - * @brief This function returns a reference to member policies - * @return Reference to member policies - */ -eprosima::fastdds::statistics::QosPolicyCountSeq_s& IncompatibleQoSStatus_s::policies() -{ - return m_policies; -} - - - - -LivelinessChangedStatus_s::LivelinessChangedStatus_s() -{ -} - -LivelinessChangedStatus_s::~LivelinessChangedStatus_s() -{ -} - -LivelinessChangedStatus_s::LivelinessChangedStatus_s( - const LivelinessChangedStatus_s& x) -{ - m_alive_count = x.m_alive_count; - m_not_alive_count = x.m_not_alive_count; - m_last_publication_handle = x.m_last_publication_handle; -} - -LivelinessChangedStatus_s::LivelinessChangedStatus_s( - LivelinessChangedStatus_s&& x) noexcept -{ - m_alive_count = x.m_alive_count; - m_not_alive_count = x.m_not_alive_count; - m_last_publication_handle = std::move(x.m_last_publication_handle); -} - -LivelinessChangedStatus_s& LivelinessChangedStatus_s::operator =( - const LivelinessChangedStatus_s& x) -{ - - m_alive_count = x.m_alive_count; - m_not_alive_count = x.m_not_alive_count; - m_last_publication_handle = x.m_last_publication_handle; - return *this; -} - -LivelinessChangedStatus_s& LivelinessChangedStatus_s::operator =( - LivelinessChangedStatus_s&& x) noexcept -{ - - m_alive_count = x.m_alive_count; - m_not_alive_count = x.m_not_alive_count; - m_last_publication_handle = std::move(x.m_last_publication_handle); - return *this; -} - -bool LivelinessChangedStatus_s::operator ==( - const LivelinessChangedStatus_s& x) const -{ - return (m_alive_count == x.m_alive_count && - m_not_alive_count == x.m_not_alive_count && - m_last_publication_handle == x.m_last_publication_handle); -} - -bool LivelinessChangedStatus_s::operator !=( - const LivelinessChangedStatus_s& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member alive_count - * @param _alive_count New value for member alive_count - */ -void LivelinessChangedStatus_s::alive_count( - uint32_t _alive_count) -{ - m_alive_count = _alive_count; -} - -/*! - * @brief This function returns the value of member alive_count - * @return Value of member alive_count - */ -uint32_t LivelinessChangedStatus_s::alive_count() const -{ - return m_alive_count; -} - -/*! - * @brief This function returns a reference to member alive_count - * @return Reference to member alive_count - */ -uint32_t& LivelinessChangedStatus_s::alive_count() -{ - return m_alive_count; -} - - -/*! - * @brief This function sets a value in member not_alive_count - * @param _not_alive_count New value for member not_alive_count - */ -void LivelinessChangedStatus_s::not_alive_count( - uint32_t _not_alive_count) -{ - m_not_alive_count = _not_alive_count; -} - -/*! - * @brief This function returns the value of member not_alive_count - * @return Value of member not_alive_count - */ -uint32_t LivelinessChangedStatus_s::not_alive_count() const -{ - return m_not_alive_count; -} - -/*! - * @brief This function returns a reference to member not_alive_count - * @return Reference to member not_alive_count - */ -uint32_t& LivelinessChangedStatus_s::not_alive_count() -{ - return m_not_alive_count; -} - - -/*! - * @brief This function copies the value in member last_publication_handle - * @param _last_publication_handle New value to be copied in member last_publication_handle - */ -void LivelinessChangedStatus_s::last_publication_handle( - const std::array& _last_publication_handle) -{ - m_last_publication_handle = _last_publication_handle; -} - -/*! - * @brief This function moves the value in member last_publication_handle - * @param _last_publication_handle New value to be moved in member last_publication_handle - */ -void LivelinessChangedStatus_s::last_publication_handle( - std::array&& _last_publication_handle) -{ - m_last_publication_handle = std::move(_last_publication_handle); -} - -/*! - * @brief This function returns a constant reference to member last_publication_handle - * @return Constant reference to member last_publication_handle - */ -const std::array& LivelinessChangedStatus_s::last_publication_handle() const -{ - return m_last_publication_handle; -} - -/*! - * @brief This function returns a reference to member last_publication_handle - * @return Reference to member last_publication_handle - */ -std::array& LivelinessChangedStatus_s::last_publication_handle() -{ - return m_last_publication_handle; -} - - - - -DeadlineMissedStatus_s::DeadlineMissedStatus_s() -{ -} - -DeadlineMissedStatus_s::~DeadlineMissedStatus_s() -{ -} - -DeadlineMissedStatus_s::DeadlineMissedStatus_s( - const DeadlineMissedStatus_s& x) -{ - m_total_count = x.m_total_count; - m_last_instance_handle = x.m_last_instance_handle; -} - -DeadlineMissedStatus_s::DeadlineMissedStatus_s( - DeadlineMissedStatus_s&& x) noexcept -{ - m_total_count = x.m_total_count; - m_last_instance_handle = std::move(x.m_last_instance_handle); -} - -DeadlineMissedStatus_s& DeadlineMissedStatus_s::operator =( - const DeadlineMissedStatus_s& x) -{ - - m_total_count = x.m_total_count; - m_last_instance_handle = x.m_last_instance_handle; - return *this; -} - -DeadlineMissedStatus_s& DeadlineMissedStatus_s::operator =( - DeadlineMissedStatus_s&& x) noexcept -{ - - m_total_count = x.m_total_count; - m_last_instance_handle = std::move(x.m_last_instance_handle); - return *this; -} - -bool DeadlineMissedStatus_s::operator ==( - const DeadlineMissedStatus_s& x) const -{ - return (m_total_count == x.m_total_count && - m_last_instance_handle == x.m_last_instance_handle); -} - -bool DeadlineMissedStatus_s::operator !=( - const DeadlineMissedStatus_s& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ -void DeadlineMissedStatus_s::total_count( - uint32_t _total_count) -{ - m_total_count = _total_count; -} - -/*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ -uint32_t DeadlineMissedStatus_s::total_count() const -{ - return m_total_count; -} - -/*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ -uint32_t& DeadlineMissedStatus_s::total_count() -{ - return m_total_count; -} - - -/*! - * @brief This function copies the value in member last_instance_handle - * @param _last_instance_handle New value to be copied in member last_instance_handle - */ -void DeadlineMissedStatus_s::last_instance_handle( - const std::array& _last_instance_handle) -{ - m_last_instance_handle = _last_instance_handle; -} - -/*! - * @brief This function moves the value in member last_instance_handle - * @param _last_instance_handle New value to be moved in member last_instance_handle - */ -void DeadlineMissedStatus_s::last_instance_handle( - std::array&& _last_instance_handle) -{ - m_last_instance_handle = std::move(_last_instance_handle); -} - -/*! - * @brief This function returns a constant reference to member last_instance_handle - * @return Constant reference to member last_instance_handle - */ -const std::array& DeadlineMissedStatus_s::last_instance_handle() const -{ - return m_last_instance_handle; -} - -/*! - * @brief This function returns a reference to member last_instance_handle - * @return Reference to member last_instance_handle - */ -std::array& DeadlineMissedStatus_s::last_instance_handle() -{ - return m_last_instance_handle; -} - - - - - - - - -MonitorServiceData::MonitorServiceData() -{ - m__d = eprosima::fastdds::statistics::PROXY; -} - -MonitorServiceData::~MonitorServiceData() -{ -} - -MonitorServiceData::MonitorServiceData( - const MonitorServiceData& x) -{ - m__d = x.m__d; - - switch (m__d) - { - case eprosima::fastdds::statistics::PROXY: - m_entity_proxy = x.m_entity_proxy; - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - m_connection_list = x.m_connection_list; - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - m_incompatible_qos_status = x.m_incompatible_qos_status; - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - m_inconsistent_topic_status = x.m_inconsistent_topic_status; - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - m_liveliness_lost_status = x.m_liveliness_lost_status; - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - m_liveliness_changed_status = x.m_liveliness_changed_status; - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - m_deadline_missed_status = x.m_deadline_missed_status; - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - m_sample_lost_status = x.m_sample_lost_status; - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - m_statuses_size = x.m_statuses_size; - break; - - default: - break; - } -} - -MonitorServiceData::MonitorServiceData( - MonitorServiceData&& x) noexcept -{ - m__d = x.m__d; - - switch (m__d) - { - case eprosima::fastdds::statistics::PROXY: - m_entity_proxy = std::move(x.m_entity_proxy); - - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - m_connection_list = std::move(x.m_connection_list); - - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - m_incompatible_qos_status = std::move(x.m_incompatible_qos_status); - - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - m_inconsistent_topic_status = std::move(x.m_inconsistent_topic_status); - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - m_liveliness_lost_status = std::move(x.m_liveliness_lost_status); - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - m_liveliness_changed_status = std::move(x.m_liveliness_changed_status); - - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - m_deadline_missed_status = std::move(x.m_deadline_missed_status); - - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - m_sample_lost_status = std::move(x.m_sample_lost_status); - - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - m_statuses_size = x.m_statuses_size; - break; - - default: - break; - } -} - -MonitorServiceData& MonitorServiceData::operator =( - const MonitorServiceData& x) -{ - m__d = x.m__d; - - switch (m__d) - { - case eprosima::fastdds::statistics::PROXY: - m_entity_proxy = x.m_entity_proxy; - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - m_connection_list = x.m_connection_list; - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - m_incompatible_qos_status = x.m_incompatible_qos_status; - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - m_inconsistent_topic_status = x.m_inconsistent_topic_status; - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - m_liveliness_lost_status = x.m_liveliness_lost_status; - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - m_liveliness_changed_status = x.m_liveliness_changed_status; - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - m_deadline_missed_status = x.m_deadline_missed_status; - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - m_sample_lost_status = x.m_sample_lost_status; - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - m_statuses_size = x.m_statuses_size; - break; - - default: - break; - } - - return *this; -} - -MonitorServiceData& MonitorServiceData::operator =( - MonitorServiceData&& x) noexcept -{ - m__d = x.m__d; - - switch (m__d) - { - case eprosima::fastdds::statistics::PROXY: - m_entity_proxy = std::move(x.m_entity_proxy); - - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - m_connection_list = std::move(x.m_connection_list); - - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - m_incompatible_qos_status = std::move(x.m_incompatible_qos_status); - - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - m_inconsistent_topic_status = std::move(x.m_inconsistent_topic_status); - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - m_liveliness_lost_status = std::move(x.m_liveliness_lost_status); - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - m_liveliness_changed_status = std::move(x.m_liveliness_changed_status); - - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - m_deadline_missed_status = std::move(x.m_deadline_missed_status); - - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - m_sample_lost_status = std::move(x.m_sample_lost_status); - - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - m_statuses_size = x.m_statuses_size; - break; - - default: - break; - } - - return *this; -} - -bool MonitorServiceData::operator ==( - const MonitorServiceData& x) const -{ - if (m__d != x.m__d) - { - return false; - } - - switch (m__d) - { - case eprosima::fastdds::statistics::PROXY: - return (m_entity_proxy == x.m_entity_proxy); - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - return (m_connection_list == x.m_connection_list); - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - return (m_incompatible_qos_status == x.m_incompatible_qos_status); - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - return (m_inconsistent_topic_status == x.m_inconsistent_topic_status); - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - return (m_liveliness_lost_status == x.m_liveliness_lost_status); - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - return (m_liveliness_changed_status == x.m_liveliness_changed_status); - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - return (m_deadline_missed_status == x.m_deadline_missed_status); - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - return (m_sample_lost_status == x.m_sample_lost_status); - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - return (m_statuses_size == x.m_statuses_size); - break; - - default: - break; - } - return false; -} - -bool MonitorServiceData::operator !=( - const MonitorServiceData& x) const -{ - return !(*this == x); -} - -void MonitorServiceData::_d( - eprosima::fastdds::statistics::StatusKind __d) -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::PROXY: - switch (__d) - { - case eprosima::fastdds::statistics::PROXY: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - switch (__d) - { - case eprosima::fastdds::statistics::CONNECTION_LIST: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - switch (__d) - { - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - switch (__d) - { - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - switch (__d) - { - case eprosima::fastdds::statistics::LIVELINESS_LOST: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - switch (__d) - { - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - switch (__d) - { - case eprosima::fastdds::statistics::DEADLINE_MISSED: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - switch (__d) - { - case eprosima::fastdds::statistics::SAMPLE_LOST: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - switch (__d) - { - case eprosima::fastdds::statistics::STATUSES_SIZE: - b = true; - break; - default: - break; - } - break; - - default: - break; - } - - if (!b) - { - throw BadParamException("Discriminator doesn't correspond with the selected union member"); - } - - m__d = __d; -} - -eprosima::fastdds::statistics::StatusKind MonitorServiceData::_d() const -{ - return m__d; -} - -eprosima::fastdds::statistics::StatusKind& MonitorServiceData::_d() -{ - return m__d; -} - -void MonitorServiceData::entity_proxy( - const std::vector& _entity_proxy) -{ - m_entity_proxy = _entity_proxy; - m__d = eprosima::fastdds::statistics::PROXY; - -} - -void MonitorServiceData::entity_proxy( - std::vector&& _entity_proxy) -{ - m_entity_proxy = std::move(_entity_proxy); - m__d = eprosima::fastdds::statistics::PROXY; - -} - -const std::vector& MonitorServiceData::entity_proxy() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::PROXY: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_proxy; -} - -std::vector& MonitorServiceData::entity_proxy() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::PROXY: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_proxy; -} - - -void MonitorServiceData::connection_list( - const std::vector& _connection_list) -{ - m_connection_list = _connection_list; - m__d = eprosima::fastdds::statistics::CONNECTION_LIST; - -} - -void MonitorServiceData::connection_list( - std::vector&& _connection_list) -{ - m_connection_list = std::move(_connection_list); - m__d = eprosima::fastdds::statistics::CONNECTION_LIST; - -} - -const std::vector& MonitorServiceData::connection_list() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::CONNECTION_LIST: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_connection_list; -} - -std::vector& MonitorServiceData::connection_list() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::CONNECTION_LIST: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_connection_list; -} - - -void MonitorServiceData::incompatible_qos_status( - const eprosima::fastdds::statistics::IncompatibleQoSStatus_s& _incompatible_qos_status) -{ - m_incompatible_qos_status = _incompatible_qos_status; - m__d = eprosima::fastdds::statistics::INCOMPATIBLE_QOS; - -} - -void MonitorServiceData::incompatible_qos_status( - eprosima::fastdds::statistics::IncompatibleQoSStatus_s&& _incompatible_qos_status) -{ - m_incompatible_qos_status = std::move(_incompatible_qos_status); - m__d = eprosima::fastdds::statistics::INCOMPATIBLE_QOS; - -} - -const eprosima::fastdds::statistics::IncompatibleQoSStatus_s& MonitorServiceData::incompatible_qos_status() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_incompatible_qos_status; -} - -eprosima::fastdds::statistics::IncompatibleQoSStatus_s& MonitorServiceData::incompatible_qos_status() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_incompatible_qos_status; -} - - -void MonitorServiceData::inconsistent_topic_status( - const eprosima::fastdds::statistics::InconsistentTopicStatus_s& _inconsistent_topic_status) -{ - m_inconsistent_topic_status = _inconsistent_topic_status; - m__d = eprosima::fastdds::statistics::INCONSISTENT_TOPIC; - -} - -void MonitorServiceData::inconsistent_topic_status( - eprosima::fastdds::statistics::InconsistentTopicStatus_s&& _inconsistent_topic_status) -{ - m_inconsistent_topic_status = std::move(_inconsistent_topic_status); - m__d = eprosima::fastdds::statistics::INCONSISTENT_TOPIC; - -} - -const eprosima::fastdds::statistics::InconsistentTopicStatus_s& MonitorServiceData::inconsistent_topic_status() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_inconsistent_topic_status; -} - -eprosima::fastdds::statistics::InconsistentTopicStatus_s& MonitorServiceData::inconsistent_topic_status() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_inconsistent_topic_status; -} - - -void MonitorServiceData::liveliness_lost_status( - const eprosima::fastdds::statistics::LivelinessLostStatus_s& _liveliness_lost_status) -{ - m_liveliness_lost_status = _liveliness_lost_status; - m__d = eprosima::fastdds::statistics::LIVELINESS_LOST; - -} - -void MonitorServiceData::liveliness_lost_status( - eprosima::fastdds::statistics::LivelinessLostStatus_s&& _liveliness_lost_status) -{ - m_liveliness_lost_status = std::move(_liveliness_lost_status); - m__d = eprosima::fastdds::statistics::LIVELINESS_LOST; - -} - -const eprosima::fastdds::statistics::LivelinessLostStatus_s& MonitorServiceData::liveliness_lost_status() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::LIVELINESS_LOST: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_liveliness_lost_status; -} - -eprosima::fastdds::statistics::LivelinessLostStatus_s& MonitorServiceData::liveliness_lost_status() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::LIVELINESS_LOST: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_liveliness_lost_status; -} - - -void MonitorServiceData::liveliness_changed_status( - const eprosima::fastdds::statistics::LivelinessChangedStatus_s& _liveliness_changed_status) -{ - m_liveliness_changed_status = _liveliness_changed_status; - m__d = eprosima::fastdds::statistics::LIVELINESS_CHANGED; - -} - -void MonitorServiceData::liveliness_changed_status( - eprosima::fastdds::statistics::LivelinessChangedStatus_s&& _liveliness_changed_status) -{ - m_liveliness_changed_status = std::move(_liveliness_changed_status); - m__d = eprosima::fastdds::statistics::LIVELINESS_CHANGED; - -} - -const eprosima::fastdds::statistics::LivelinessChangedStatus_s& MonitorServiceData::liveliness_changed_status() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_liveliness_changed_status; -} - -eprosima::fastdds::statistics::LivelinessChangedStatus_s& MonitorServiceData::liveliness_changed_status() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_liveliness_changed_status; -} - - -void MonitorServiceData::deadline_missed_status( - const eprosima::fastdds::statistics::DeadlineMissedStatus_s& _deadline_missed_status) -{ - m_deadline_missed_status = _deadline_missed_status; - m__d = eprosima::fastdds::statistics::DEADLINE_MISSED; - -} - -void MonitorServiceData::deadline_missed_status( - eprosima::fastdds::statistics::DeadlineMissedStatus_s&& _deadline_missed_status) -{ - m_deadline_missed_status = std::move(_deadline_missed_status); - m__d = eprosima::fastdds::statistics::DEADLINE_MISSED; - -} - -const eprosima::fastdds::statistics::DeadlineMissedStatus_s& MonitorServiceData::deadline_missed_status() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::DEADLINE_MISSED: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_deadline_missed_status; -} - -eprosima::fastdds::statistics::DeadlineMissedStatus_s& MonitorServiceData::deadline_missed_status() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::DEADLINE_MISSED: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_deadline_missed_status; -} - - -void MonitorServiceData::sample_lost_status( - const eprosima::fastdds::statistics::SampleLostStatus_s& _sample_lost_status) -{ - m_sample_lost_status = _sample_lost_status; - m__d = eprosima::fastdds::statistics::SAMPLE_LOST; - -} - -void MonitorServiceData::sample_lost_status( - eprosima::fastdds::statistics::SampleLostStatus_s&& _sample_lost_status) -{ - m_sample_lost_status = std::move(_sample_lost_status); - m__d = eprosima::fastdds::statistics::SAMPLE_LOST; - -} - -const eprosima::fastdds::statistics::SampleLostStatus_s& MonitorServiceData::sample_lost_status() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::SAMPLE_LOST: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_sample_lost_status; -} - -eprosima::fastdds::statistics::SampleLostStatus_s& MonitorServiceData::sample_lost_status() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::SAMPLE_LOST: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_sample_lost_status; -} - - -void MonitorServiceData::statuses_size( - uint8_t _statuses_size) -{ - m_statuses_size = _statuses_size; - m__d = eprosima::fastdds::statistics::STATUSES_SIZE; - -} - -uint8_t MonitorServiceData::statuses_size() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::STATUSES_SIZE: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_statuses_size; -} - -uint8_t& MonitorServiceData::statuses_size() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::STATUSES_SIZE: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_statuses_size; -} - - - - -MonitorServiceStatusData::MonitorServiceStatusData() -{ -} - -MonitorServiceStatusData::~MonitorServiceStatusData() -{ -} - -MonitorServiceStatusData::MonitorServiceStatusData( - const MonitorServiceStatusData& x) -{ - m_local_entity = x.m_local_entity; - m_status_kind = x.m_status_kind; - m_value = x.m_value; -} - -MonitorServiceStatusData::MonitorServiceStatusData( - MonitorServiceStatusData&& x) noexcept -{ - m_local_entity = std::move(x.m_local_entity); - m_status_kind = x.m_status_kind; - m_value = std::move(x.m_value); -} - -MonitorServiceStatusData& MonitorServiceStatusData::operator =( - const MonitorServiceStatusData& x) -{ - - m_local_entity = x.m_local_entity; - m_status_kind = x.m_status_kind; - m_value = x.m_value; - return *this; -} - -MonitorServiceStatusData& MonitorServiceStatusData::operator =( - MonitorServiceStatusData&& x) noexcept -{ - - m_local_entity = std::move(x.m_local_entity); - m_status_kind = x.m_status_kind; - m_value = std::move(x.m_value); - return *this; -} - -bool MonitorServiceStatusData::operator ==( - const MonitorServiceStatusData& x) const -{ - return (m_local_entity == x.m_local_entity && - m_status_kind == x.m_status_kind && - m_value == x.m_value); -} - -bool MonitorServiceStatusData::operator !=( - const MonitorServiceStatusData& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member local_entity - * @param _local_entity New value to be copied in member local_entity - */ -void MonitorServiceStatusData::local_entity( - const eprosima::fastdds::statistics::detail::GUID_s& _local_entity) -{ - m_local_entity = _local_entity; -} - -/*! - * @brief This function moves the value in member local_entity - * @param _local_entity New value to be moved in member local_entity - */ -void MonitorServiceStatusData::local_entity( - eprosima::fastdds::statistics::detail::GUID_s&& _local_entity) -{ - m_local_entity = std::move(_local_entity); -} - -/*! - * @brief This function returns a constant reference to member local_entity - * @return Constant reference to member local_entity - */ -const eprosima::fastdds::statistics::detail::GUID_s& MonitorServiceStatusData::local_entity() const -{ - return m_local_entity; -} - -/*! - * @brief This function returns a reference to member local_entity - * @return Reference to member local_entity - */ -eprosima::fastdds::statistics::detail::GUID_s& MonitorServiceStatusData::local_entity() -{ - return m_local_entity; -} - - -/*! - * @brief This function sets a value in member status_kind - * @param _status_kind New value for member status_kind - */ -void MonitorServiceStatusData::status_kind( - eprosima::fastdds::statistics::StatusKind _status_kind) -{ - m_status_kind = _status_kind; -} - -/*! - * @brief This function returns the value of member status_kind - * @return Value of member status_kind - */ -eprosima::fastdds::statistics::StatusKind MonitorServiceStatusData::status_kind() const -{ - return m_status_kind; -} - -/*! - * @brief This function returns a reference to member status_kind - * @return Reference to member status_kind - */ -eprosima::fastdds::statistics::StatusKind& MonitorServiceStatusData::status_kind() -{ - return m_status_kind; -} - - -/*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ -void MonitorServiceStatusData::value( - const eprosima::fastdds::statistics::MonitorServiceData& _value) -{ - m_value = _value; -} - -/*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ -void MonitorServiceStatusData::value( - eprosima::fastdds::statistics::MonitorServiceData&& _value) -{ - m_value = std::move(_value); -} - -/*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ -const eprosima::fastdds::statistics::MonitorServiceData& MonitorServiceStatusData::value() const -{ - return m_value; -} - -/*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ -eprosima::fastdds::statistics::MonitorServiceData& MonitorServiceStatusData::value() -{ - return m_value; -} - - - - -} // namespace statistics - - -} // namespace fastdds - - -} // namespace eprosima -// Include auxiliary functions like for serializing/deserializing. -#include "monitorservice_typesCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_types.h b/include/fastdds_statistics_backend/topic_types/monitorservice_types.h deleted file mode 100644 index 08f713a0e..000000000 --- a/include/fastdds_statistics_backend/topic_types/monitorservice_types.h +++ /dev/null @@ -1,1370 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file monitorservice_types.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include -#include "monitorservice_typesv1.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_H_ -#define _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_H_ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "types.h" - - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MONITORSERVICE_TYPES_SOURCE) -#define MONITORSERVICE_TYPES_DllAPI __declspec( dllexport ) -#else -#define MONITORSERVICE_TYPES_DllAPI __declspec( dllimport ) -#endif // MONITORSERVICE_TYPES_SOURCE -#else -#define MONITORSERVICE_TYPES_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define MONITORSERVICE_TYPES_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - -namespace eprosima { - -namespace fastdds { - -namespace statistics { - -/*! - * @brief This class represents the enumeration ConnectionMode defined by the user in the IDL file. - * @ingroup monitorservice_types - */ -enum ConnectionMode : uint32_t -{ - DATA_SHARING, - INTRAPROCESS, - TRANSPORT -}; - - - - -/*! - * @brief This class represents the structure Connection defined by the user in the IDL file. - * @ingroup monitorservice_types - */ -class Connection -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport Connection(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~Connection(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Connection that will be copied. - */ - eProsima_user_DllExport Connection( - const Connection& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Connection that will be copied. - */ - eProsima_user_DllExport Connection( - Connection&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Connection that will be copied. - */ - eProsima_user_DllExport Connection& operator =( - const Connection& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Connection that will be copied. - */ - eProsima_user_DllExport Connection& operator =( - Connection&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Connection object to compare. - */ - eProsima_user_DllExport bool operator ==( - const Connection& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Connection object to compare. - */ - eProsima_user_DllExport bool operator !=( - const Connection& x) const; - - /*! - * @brief This function sets a value in member mode - * @param _mode New value for member mode - */ - eProsima_user_DllExport void mode( - eprosima::fastdds::statistics::ConnectionMode _mode); - - /*! - * @brief This function returns the value of member mode - * @return Value of member mode - */ - eProsima_user_DllExport eprosima::fastdds::statistics::ConnectionMode mode() const; - - /*! - * @brief This function returns a reference to member mode - * @return Reference to member mode - */ - eProsima_user_DllExport eprosima::fastdds::statistics::ConnectionMode& mode(); - - - /*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ - eProsima_user_DllExport void guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid); - - /*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ - eProsima_user_DllExport void guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid); - - /*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& guid() const; - - /*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& guid(); - - - /*! - * @brief This function copies the value in member announced_locators - * @param _announced_locators New value to be copied in member announced_locators - */ - eProsima_user_DllExport void announced_locators( - const std::vector& _announced_locators); - - /*! - * @brief This function moves the value in member announced_locators - * @param _announced_locators New value to be moved in member announced_locators - */ - eProsima_user_DllExport void announced_locators( - std::vector&& _announced_locators); - - /*! - * @brief This function returns a constant reference to member announced_locators - * @return Constant reference to member announced_locators - */ - eProsima_user_DllExport const std::vector& announced_locators() const; - - /*! - * @brief This function returns a reference to member announced_locators - * @return Reference to member announced_locators - */ - eProsima_user_DllExport std::vector& announced_locators(); - - - /*! - * @brief This function copies the value in member used_locators - * @param _used_locators New value to be copied in member used_locators - */ - eProsima_user_DllExport void used_locators( - const std::vector& _used_locators); - - /*! - * @brief This function moves the value in member used_locators - * @param _used_locators New value to be moved in member used_locators - */ - eProsima_user_DllExport void used_locators( - std::vector&& _used_locators); - - /*! - * @brief This function returns a constant reference to member used_locators - * @return Constant reference to member used_locators - */ - eProsima_user_DllExport const std::vector& used_locators() const; - - /*! - * @brief This function returns a reference to member used_locators - * @return Reference to member used_locators - */ - eProsima_user_DllExport std::vector& used_locators(); - -private: - - eprosima::fastdds::statistics::ConnectionMode m_mode{eprosima::fastdds::statistics::DATA_SHARING}; - eprosima::fastdds::statistics::detail::GUID_s m_guid; - std::vector m_announced_locators; - std::vector m_used_locators; - -}; - - -/*! - * @brief This class represents the structure QosPolicyCount_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ -class QosPolicyCount_s -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport QosPolicyCount_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~QosPolicyCount_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::QosPolicyCount_s that will be copied. - */ - eProsima_user_DllExport QosPolicyCount_s( - const QosPolicyCount_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::QosPolicyCount_s that will be copied. - */ - eProsima_user_DllExport QosPolicyCount_s( - QosPolicyCount_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::QosPolicyCount_s that will be copied. - */ - eProsima_user_DllExport QosPolicyCount_s& operator =( - const QosPolicyCount_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::QosPolicyCount_s that will be copied. - */ - eProsima_user_DllExport QosPolicyCount_s& operator =( - QosPolicyCount_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::QosPolicyCount_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const QosPolicyCount_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::QosPolicyCount_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const QosPolicyCount_s& x) const; - - /*! - * @brief This function sets a value in member policy_id - * @param _policy_id New value for member policy_id - */ - eProsima_user_DllExport void policy_id( - uint32_t _policy_id); - - /*! - * @brief This function returns the value of member policy_id - * @return Value of member policy_id - */ - eProsima_user_DllExport uint32_t policy_id() const; - - /*! - * @brief This function returns a reference to member policy_id - * @return Reference to member policy_id - */ - eProsima_user_DllExport uint32_t& policy_id(); - - - /*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ - eProsima_user_DllExport void count( - uint32_t _count); - - /*! - * @brief This function returns the value of member count - * @return Value of member count - */ - eProsima_user_DllExport uint32_t count() const; - - /*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ - eProsima_user_DllExport uint32_t& count(); - -private: - - uint32_t m_policy_id{0}; - uint32_t m_count{0}; - -}; - - -/*! - * @brief This class represents the structure BaseStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ -class BaseStatus_s -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport BaseStatus_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~BaseStatus_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::BaseStatus_s that will be copied. - */ - eProsima_user_DllExport BaseStatus_s( - const BaseStatus_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::BaseStatus_s that will be copied. - */ - eProsima_user_DllExport BaseStatus_s( - BaseStatus_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::BaseStatus_s that will be copied. - */ - eProsima_user_DllExport BaseStatus_s& operator =( - const BaseStatus_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::BaseStatus_s that will be copied. - */ - eProsima_user_DllExport BaseStatus_s& operator =( - BaseStatus_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::BaseStatus_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const BaseStatus_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::BaseStatus_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const BaseStatus_s& x) const; - - /*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ - eProsima_user_DllExport void total_count( - uint32_t _total_count); - - /*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ - eProsima_user_DllExport uint32_t total_count() const; - - /*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ - eProsima_user_DllExport uint32_t& total_count(); - -private: - - uint32_t m_total_count{0}; - -}; - - -typedef std::vector QosPolicyCountSeq_s; - - - -/*! - * @brief This class represents the structure IncompatibleQoSStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ -class IncompatibleQoSStatus_s -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport IncompatibleQoSStatus_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~IncompatibleQoSStatus_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::IncompatibleQoSStatus_s that will be copied. - */ - eProsima_user_DllExport IncompatibleQoSStatus_s( - const IncompatibleQoSStatus_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::IncompatibleQoSStatus_s that will be copied. - */ - eProsima_user_DllExport IncompatibleQoSStatus_s( - IncompatibleQoSStatus_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::IncompatibleQoSStatus_s that will be copied. - */ - eProsima_user_DllExport IncompatibleQoSStatus_s& operator =( - const IncompatibleQoSStatus_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::IncompatibleQoSStatus_s that will be copied. - */ - eProsima_user_DllExport IncompatibleQoSStatus_s& operator =( - IncompatibleQoSStatus_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::IncompatibleQoSStatus_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const IncompatibleQoSStatus_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::IncompatibleQoSStatus_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const IncompatibleQoSStatus_s& x) const; - - /*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ - eProsima_user_DllExport void total_count( - uint32_t _total_count); - - /*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ - eProsima_user_DllExport uint32_t total_count() const; - - /*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ - eProsima_user_DllExport uint32_t& total_count(); - - - /*! - * @brief This function sets a value in member last_policy_id - * @param _last_policy_id New value for member last_policy_id - */ - eProsima_user_DllExport void last_policy_id( - uint32_t _last_policy_id); - - /*! - * @brief This function returns the value of member last_policy_id - * @return Value of member last_policy_id - */ - eProsima_user_DllExport uint32_t last_policy_id() const; - - /*! - * @brief This function returns a reference to member last_policy_id - * @return Reference to member last_policy_id - */ - eProsima_user_DllExport uint32_t& last_policy_id(); - - - /*! - * @brief This function copies the value in member policies - * @param _policies New value to be copied in member policies - */ - eProsima_user_DllExport void policies( - const eprosima::fastdds::statistics::QosPolicyCountSeq_s& _policies); - - /*! - * @brief This function moves the value in member policies - * @param _policies New value to be moved in member policies - */ - eProsima_user_DllExport void policies( - eprosima::fastdds::statistics::QosPolicyCountSeq_s&& _policies); - - /*! - * @brief This function returns a constant reference to member policies - * @return Constant reference to member policies - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::QosPolicyCountSeq_s& policies() const; - - /*! - * @brief This function returns a reference to member policies - * @return Reference to member policies - */ - eProsima_user_DllExport eprosima::fastdds::statistics::QosPolicyCountSeq_s& policies(); - -private: - - uint32_t m_total_count{0}; - uint32_t m_last_policy_id{0}; - eprosima::fastdds::statistics::QosPolicyCountSeq_s m_policies; - -}; - - -/*! - * @brief This class represents the structure LivelinessChangedStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ -class LivelinessChangedStatus_s -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport LivelinessChangedStatus_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~LivelinessChangedStatus_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::LivelinessChangedStatus_s that will be copied. - */ - eProsima_user_DllExport LivelinessChangedStatus_s( - const LivelinessChangedStatus_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::LivelinessChangedStatus_s that will be copied. - */ - eProsima_user_DllExport LivelinessChangedStatus_s( - LivelinessChangedStatus_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::LivelinessChangedStatus_s that will be copied. - */ - eProsima_user_DllExport LivelinessChangedStatus_s& operator =( - const LivelinessChangedStatus_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::LivelinessChangedStatus_s that will be copied. - */ - eProsima_user_DllExport LivelinessChangedStatus_s& operator =( - LivelinessChangedStatus_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::LivelinessChangedStatus_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const LivelinessChangedStatus_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::LivelinessChangedStatus_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const LivelinessChangedStatus_s& x) const; - - /*! - * @brief This function sets a value in member alive_count - * @param _alive_count New value for member alive_count - */ - eProsima_user_DllExport void alive_count( - uint32_t _alive_count); - - /*! - * @brief This function returns the value of member alive_count - * @return Value of member alive_count - */ - eProsima_user_DllExport uint32_t alive_count() const; - - /*! - * @brief This function returns a reference to member alive_count - * @return Reference to member alive_count - */ - eProsima_user_DllExport uint32_t& alive_count(); - - - /*! - * @brief This function sets a value in member not_alive_count - * @param _not_alive_count New value for member not_alive_count - */ - eProsima_user_DllExport void not_alive_count( - uint32_t _not_alive_count); - - /*! - * @brief This function returns the value of member not_alive_count - * @return Value of member not_alive_count - */ - eProsima_user_DllExport uint32_t not_alive_count() const; - - /*! - * @brief This function returns a reference to member not_alive_count - * @return Reference to member not_alive_count - */ - eProsima_user_DllExport uint32_t& not_alive_count(); - - - /*! - * @brief This function copies the value in member last_publication_handle - * @param _last_publication_handle New value to be copied in member last_publication_handle - */ - eProsima_user_DllExport void last_publication_handle( - const std::array& _last_publication_handle); - - /*! - * @brief This function moves the value in member last_publication_handle - * @param _last_publication_handle New value to be moved in member last_publication_handle - */ - eProsima_user_DllExport void last_publication_handle( - std::array&& _last_publication_handle); - - /*! - * @brief This function returns a constant reference to member last_publication_handle - * @return Constant reference to member last_publication_handle - */ - eProsima_user_DllExport const std::array& last_publication_handle() const; - - /*! - * @brief This function returns a reference to member last_publication_handle - * @return Reference to member last_publication_handle - */ - eProsima_user_DllExport std::array& last_publication_handle(); - -private: - - uint32_t m_alive_count{0}; - uint32_t m_not_alive_count{0}; - std::array m_last_publication_handle{0}; - -}; - - -/*! - * @brief This class represents the structure DeadlineMissedStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ -class DeadlineMissedStatus_s -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport DeadlineMissedStatus_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~DeadlineMissedStatus_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::DeadlineMissedStatus_s that will be copied. - */ - eProsima_user_DllExport DeadlineMissedStatus_s( - const DeadlineMissedStatus_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::DeadlineMissedStatus_s that will be copied. - */ - eProsima_user_DllExport DeadlineMissedStatus_s( - DeadlineMissedStatus_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::DeadlineMissedStatus_s that will be copied. - */ - eProsima_user_DllExport DeadlineMissedStatus_s& operator =( - const DeadlineMissedStatus_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::DeadlineMissedStatus_s that will be copied. - */ - eProsima_user_DllExport DeadlineMissedStatus_s& operator =( - DeadlineMissedStatus_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::DeadlineMissedStatus_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const DeadlineMissedStatus_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::DeadlineMissedStatus_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const DeadlineMissedStatus_s& x) const; - - /*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ - eProsima_user_DllExport void total_count( - uint32_t _total_count); - - /*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ - eProsima_user_DllExport uint32_t total_count() const; - - /*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ - eProsima_user_DllExport uint32_t& total_count(); - - - /*! - * @brief This function copies the value in member last_instance_handle - * @param _last_instance_handle New value to be copied in member last_instance_handle - */ - eProsima_user_DllExport void last_instance_handle( - const std::array& _last_instance_handle); - - /*! - * @brief This function moves the value in member last_instance_handle - * @param _last_instance_handle New value to be moved in member last_instance_handle - */ - eProsima_user_DllExport void last_instance_handle( - std::array&& _last_instance_handle); - - /*! - * @brief This function returns a constant reference to member last_instance_handle - * @return Constant reference to member last_instance_handle - */ - eProsima_user_DllExport const std::array& last_instance_handle() const; - - /*! - * @brief This function returns a reference to member last_instance_handle - * @return Reference to member last_instance_handle - */ - eProsima_user_DllExport std::array& last_instance_handle(); - -private: - - uint32_t m_total_count{0}; - std::array m_last_instance_handle{0}; - -}; -typedef eprosima::fastdds::statistics::BaseStatus_s LivelinessLostStatus_s; - -typedef eprosima::fastdds::statistics::BaseStatus_s InconsistentTopicStatus_s; - -typedef eprosima::fastdds::statistics::BaseStatus_s SampleLostStatus_s; - -/*! - * @brief This class represents the enumeration StatusKind defined by the user in the IDL file. - * @ingroup monitorservice_types - */ -enum StatusKind : uint32_t -{ - PROXY, - CONNECTION_LIST, - INCOMPATIBLE_QOS, - INCONSISTENT_TOPIC, - LIVELINESS_LOST, - LIVELINESS_CHANGED, - DEADLINE_MISSED, - SAMPLE_LOST, - STATUSES_SIZE -}; - - -/*! - * @brief This class represents the union MonitorServiceData defined by the user in the IDL file. - * @ingroup monitorservice_types - */ -class MonitorServiceData -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MonitorServiceData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MonitorServiceData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceData that will be copied. - */ - eProsima_user_DllExport MonitorServiceData( - const MonitorServiceData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceData that will be copied. - */ - eProsima_user_DllExport MonitorServiceData( - MonitorServiceData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceData that will be copied. - */ - eProsima_user_DllExport MonitorServiceData& operator =( - const MonitorServiceData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceData that will be copied. - */ - eProsima_user_DllExport MonitorServiceData& operator =( - MonitorServiceData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::MonitorServiceData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MonitorServiceData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::MonitorServiceData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MonitorServiceData& x) const; - - /*! - * @brief This function sets the discriminator value. - * @param __d New value for the discriminator. - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member. - */ - eProsima_user_DllExport void _d( - eprosima::fastdds::statistics::StatusKind __d); - - /*! - * @brief This function returns the value of the discriminator. - * @return Value of the discriminator - */ - eProsima_user_DllExport eprosima::fastdds::statistics::StatusKind _d() const; - - /*! - * @brief This function returns a reference to the discriminator. - * @return Reference to the discriminator. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::StatusKind& _d(); - - /*! - * @brief This function copies the value in member entity_proxy - * @param _entity_proxy New value to be copied in member entity_proxy - */ - eProsima_user_DllExport void entity_proxy( - const std::vector& _entity_proxy); - - /*! - * @brief This function moves the value in member entity_proxy - * @param _entity_proxy New value to be moved in member entity_proxy - */ - eProsima_user_DllExport void entity_proxy( - std::vector&& _entity_proxy); - - /*! - * @brief This function returns a constant reference to member entity_proxy - * @return Constant reference to member entity_proxy - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const std::vector& entity_proxy() const; - - /*! - * @brief This function returns a reference to member entity_proxy - * @return Reference to member entity_proxy - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport std::vector& entity_proxy(); - - - /*! - * @brief This function copies the value in member connection_list - * @param _connection_list New value to be copied in member connection_list - */ - eProsima_user_DllExport void connection_list( - const std::vector& _connection_list); - - /*! - * @brief This function moves the value in member connection_list - * @param _connection_list New value to be moved in member connection_list - */ - eProsima_user_DllExport void connection_list( - std::vector&& _connection_list); - - /*! - * @brief This function returns a constant reference to member connection_list - * @return Constant reference to member connection_list - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const std::vector& connection_list() const; - - /*! - * @brief This function returns a reference to member connection_list - * @return Reference to member connection_list - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport std::vector& connection_list(); - - - /*! - * @brief This function copies the value in member incompatible_qos_status - * @param _incompatible_qos_status New value to be copied in member incompatible_qos_status - */ - eProsima_user_DllExport void incompatible_qos_status( - const eprosima::fastdds::statistics::IncompatibleQoSStatus_s& _incompatible_qos_status); - - /*! - * @brief This function moves the value in member incompatible_qos_status - * @param _incompatible_qos_status New value to be moved in member incompatible_qos_status - */ - eProsima_user_DllExport void incompatible_qos_status( - eprosima::fastdds::statistics::IncompatibleQoSStatus_s&& _incompatible_qos_status); - - /*! - * @brief This function returns a constant reference to member incompatible_qos_status - * @return Constant reference to member incompatible_qos_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::IncompatibleQoSStatus_s& incompatible_qos_status() const; - - /*! - * @brief This function returns a reference to member incompatible_qos_status - * @return Reference to member incompatible_qos_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::IncompatibleQoSStatus_s& incompatible_qos_status(); - - - /*! - * @brief This function copies the value in member inconsistent_topic_status - * @param _inconsistent_topic_status New value to be copied in member inconsistent_topic_status - */ - eProsima_user_DllExport void inconsistent_topic_status( - const eprosima::fastdds::statistics::InconsistentTopicStatus_s& _inconsistent_topic_status); - - /*! - * @brief This function moves the value in member inconsistent_topic_status - * @param _inconsistent_topic_status New value to be moved in member inconsistent_topic_status - */ - eProsima_user_DllExport void inconsistent_topic_status( - eprosima::fastdds::statistics::InconsistentTopicStatus_s&& _inconsistent_topic_status); - - /*! - * @brief This function returns a constant reference to member inconsistent_topic_status - * @return Constant reference to member inconsistent_topic_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::InconsistentTopicStatus_s& inconsistent_topic_status() const; - - /*! - * @brief This function returns a reference to member inconsistent_topic_status - * @return Reference to member inconsistent_topic_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::InconsistentTopicStatus_s& inconsistent_topic_status(); - - - /*! - * @brief This function copies the value in member liveliness_lost_status - * @param _liveliness_lost_status New value to be copied in member liveliness_lost_status - */ - eProsima_user_DllExport void liveliness_lost_status( - const eprosima::fastdds::statistics::LivelinessLostStatus_s& _liveliness_lost_status); - - /*! - * @brief This function moves the value in member liveliness_lost_status - * @param _liveliness_lost_status New value to be moved in member liveliness_lost_status - */ - eProsima_user_DllExport void liveliness_lost_status( - eprosima::fastdds::statistics::LivelinessLostStatus_s&& _liveliness_lost_status); - - /*! - * @brief This function returns a constant reference to member liveliness_lost_status - * @return Constant reference to member liveliness_lost_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::LivelinessLostStatus_s& liveliness_lost_status() const; - - /*! - * @brief This function returns a reference to member liveliness_lost_status - * @return Reference to member liveliness_lost_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::LivelinessLostStatus_s& liveliness_lost_status(); - - - /*! - * @brief This function copies the value in member liveliness_changed_status - * @param _liveliness_changed_status New value to be copied in member liveliness_changed_status - */ - eProsima_user_DllExport void liveliness_changed_status( - const eprosima::fastdds::statistics::LivelinessChangedStatus_s& _liveliness_changed_status); - - /*! - * @brief This function moves the value in member liveliness_changed_status - * @param _liveliness_changed_status New value to be moved in member liveliness_changed_status - */ - eProsima_user_DllExport void liveliness_changed_status( - eprosima::fastdds::statistics::LivelinessChangedStatus_s&& _liveliness_changed_status); - - /*! - * @brief This function returns a constant reference to member liveliness_changed_status - * @return Constant reference to member liveliness_changed_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::LivelinessChangedStatus_s& liveliness_changed_status() const; - - /*! - * @brief This function returns a reference to member liveliness_changed_status - * @return Reference to member liveliness_changed_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::LivelinessChangedStatus_s& liveliness_changed_status(); - - - /*! - * @brief This function copies the value in member deadline_missed_status - * @param _deadline_missed_status New value to be copied in member deadline_missed_status - */ - eProsima_user_DllExport void deadline_missed_status( - const eprosima::fastdds::statistics::DeadlineMissedStatus_s& _deadline_missed_status); - - /*! - * @brief This function moves the value in member deadline_missed_status - * @param _deadline_missed_status New value to be moved in member deadline_missed_status - */ - eProsima_user_DllExport void deadline_missed_status( - eprosima::fastdds::statistics::DeadlineMissedStatus_s&& _deadline_missed_status); - - /*! - * @brief This function returns a constant reference to member deadline_missed_status - * @return Constant reference to member deadline_missed_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::DeadlineMissedStatus_s& deadline_missed_status() const; - - /*! - * @brief This function returns a reference to member deadline_missed_status - * @return Reference to member deadline_missed_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::DeadlineMissedStatus_s& deadline_missed_status(); - - - /*! - * @brief This function copies the value in member sample_lost_status - * @param _sample_lost_status New value to be copied in member sample_lost_status - */ - eProsima_user_DllExport void sample_lost_status( - const eprosima::fastdds::statistics::SampleLostStatus_s& _sample_lost_status); - - /*! - * @brief This function moves the value in member sample_lost_status - * @param _sample_lost_status New value to be moved in member sample_lost_status - */ - eProsima_user_DllExport void sample_lost_status( - eprosima::fastdds::statistics::SampleLostStatus_s&& _sample_lost_status); - - /*! - * @brief This function returns a constant reference to member sample_lost_status - * @return Constant reference to member sample_lost_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::SampleLostStatus_s& sample_lost_status() const; - - /*! - * @brief This function returns a reference to member sample_lost_status - * @return Reference to member sample_lost_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::SampleLostStatus_s& sample_lost_status(); - - - /*! - * @brief This function sets a value in member statuses_size - * @param _statuses_size New value for member statuses_size - */ - eProsima_user_DllExport void statuses_size( - uint8_t _statuses_size); - - /*! - * @brief This function returns the value of member statuses_size - * @return Value of member statuses_size - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t statuses_size() const; - - /*! - * @brief This function returns a reference to member statuses_size - * @return Reference to member statuses_size - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t& statuses_size(); - -private: - - eprosima::fastdds::statistics::StatusKind m__d; - - std::vector m_entity_proxy; - std::vector m_connection_list; - eprosima::fastdds::statistics::IncompatibleQoSStatus_s m_incompatible_qos_status; - eprosima::fastdds::statistics::InconsistentTopicStatus_s m_inconsistent_topic_status; - eprosima::fastdds::statistics::LivelinessLostStatus_s m_liveliness_lost_status; - eprosima::fastdds::statistics::LivelinessChangedStatus_s m_liveliness_changed_status; - eprosima::fastdds::statistics::DeadlineMissedStatus_s m_deadline_missed_status; - eprosima::fastdds::statistics::SampleLostStatus_s m_sample_lost_status; - uint8_t m_statuses_size{0}; -}; - - -/*! - * @brief This class represents the structure MonitorServiceStatusData defined by the user in the IDL file. - * @ingroup monitorservice_types - */ -class MonitorServiceStatusData -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MonitorServiceStatusData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MonitorServiceStatusData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceStatusData that will be copied. - */ - eProsima_user_DllExport MonitorServiceStatusData( - const MonitorServiceStatusData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceStatusData that will be copied. - */ - eProsima_user_DllExport MonitorServiceStatusData( - MonitorServiceStatusData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceStatusData that will be copied. - */ - eProsima_user_DllExport MonitorServiceStatusData& operator =( - const MonitorServiceStatusData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceStatusData that will be copied. - */ - eProsima_user_DllExport MonitorServiceStatusData& operator =( - MonitorServiceStatusData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::MonitorServiceStatusData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MonitorServiceStatusData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::MonitorServiceStatusData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MonitorServiceStatusData& x) const; - - /*! - * @brief This function copies the value in member local_entity - * @param _local_entity New value to be copied in member local_entity - */ - eProsima_user_DllExport void local_entity( - const eprosima::fastdds::statistics::detail::GUID_s& _local_entity); - - /*! - * @brief This function moves the value in member local_entity - * @param _local_entity New value to be moved in member local_entity - */ - eProsima_user_DllExport void local_entity( - eprosima::fastdds::statistics::detail::GUID_s&& _local_entity); - - /*! - * @brief This function returns a constant reference to member local_entity - * @return Constant reference to member local_entity - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& local_entity() const; - - /*! - * @brief This function returns a reference to member local_entity - * @return Reference to member local_entity - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& local_entity(); - - - /*! - * @brief This function sets a value in member status_kind - * @param _status_kind New value for member status_kind - */ - eProsima_user_DllExport void status_kind( - eprosima::fastdds::statistics::StatusKind _status_kind); - - /*! - * @brief This function returns the value of member status_kind - * @return Value of member status_kind - */ - eProsima_user_DllExport eprosima::fastdds::statistics::StatusKind status_kind() const; - - /*! - * @brief This function returns a reference to member status_kind - * @return Reference to member status_kind - */ - eProsima_user_DllExport eprosima::fastdds::statistics::StatusKind& status_kind(); - - - /*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ - eProsima_user_DllExport void value( - const eprosima::fastdds::statistics::MonitorServiceData& _value); - - /*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ - eProsima_user_DllExport void value( - eprosima::fastdds::statistics::MonitorServiceData&& _value); - - /*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::MonitorServiceData& value() const; - - /*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ - eProsima_user_DllExport eprosima::fastdds::statistics::MonitorServiceData& value(); - -private: - - eprosima::fastdds::statistics::detail::GUID_s m_local_entity; - eprosima::fastdds::statistics::StatusKind m_status_kind{eprosima::fastdds::statistics::PROXY}; - eprosima::fastdds::statistics::MonitorServiceData m_value; - -}; - -} // namespace statistics - -} // namespace fastdds - -} // namespace eprosima - -#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_H_ - - - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_types.hpp b/include/fastdds_statistics_backend/topic_types/monitorservice_types.hpp new file mode 100644 index 000000000..4b4063023 --- /dev/null +++ b/include/fastdds_statistics_backend/topic_types/monitorservice_types.hpp @@ -0,0 +1,2486 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file monitorservice_types.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_HPP +#define FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_HPP + +#include +#include +#include +#include +#include + +#include + +#include "types.hpp" + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(MONITORSERVICE_TYPES_SOURCE) +#define MONITORSERVICE_TYPES_DllAPI __declspec( dllexport ) +#else +#define MONITORSERVICE_TYPES_DllAPI __declspec( dllimport ) +#endif // MONITORSERVICE_TYPES_SOURCE +#else +#define MONITORSERVICE_TYPES_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define MONITORSERVICE_TYPES_DllAPI +#endif // _WIN32 + +namespace eprosima { + +namespace fastdds { + +namespace statistics { + +/*! + * @brief This class represents the enumeration ConnectionMode defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +enum class ConnectionMode : int32_t +{ + DATA_SHARING, + INTRAPROCESS, + TRANSPORT +}; +/*! + * @brief This class represents the structure Connection defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class Connection +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport Connection() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~Connection() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object Connection that will be copied. + */ + eProsima_user_DllExport Connection( + const Connection& x) + { + m_mode = x.m_mode; + + m_guid = x.m_guid; + + m_announced_locators = x.m_announced_locators; + + m_used_locators = x.m_used_locators; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object Connection that will be copied. + */ + eProsima_user_DllExport Connection( + Connection&& x) noexcept + { + m_mode = x.m_mode; + m_guid = std::move(x.m_guid); + m_announced_locators = std::move(x.m_announced_locators); + m_used_locators = std::move(x.m_used_locators); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object Connection that will be copied. + */ + eProsima_user_DllExport Connection& operator =( + const Connection& x) + { + + m_mode = x.m_mode; + + m_guid = x.m_guid; + + m_announced_locators = x.m_announced_locators; + + m_used_locators = x.m_used_locators; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object Connection that will be copied. + */ + eProsima_user_DllExport Connection& operator =( + Connection&& x) noexcept + { + + m_mode = x.m_mode; + m_guid = std::move(x.m_guid); + m_announced_locators = std::move(x.m_announced_locators); + m_used_locators = std::move(x.m_used_locators); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x Connection object to compare. + */ + eProsima_user_DllExport bool operator ==( + const Connection& x) const + { + return (m_mode == x.m_mode && + m_guid == x.m_guid && + m_announced_locators == x.m_announced_locators && + m_used_locators == x.m_used_locators); + } + + /*! + * @brief Comparison operator. + * @param x Connection object to compare. + */ + eProsima_user_DllExport bool operator !=( + const Connection& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member mode + * @param _mode New value for member mode + */ + eProsima_user_DllExport void mode( + ConnectionMode _mode) + { + m_mode = _mode; + } + + /*! + * @brief This function returns the value of member mode + * @return Value of member mode + */ + eProsima_user_DllExport ConnectionMode mode() const + { + return m_mode; + } + + /*! + * @brief This function returns a reference to member mode + * @return Reference to member mode + */ + eProsima_user_DllExport ConnectionMode& mode() + { + return m_mode; + } + + /*! + * @brief This function copies the value in member guid + * @param _guid New value to be copied in member guid + */ + eProsima_user_DllExport void guid( + const detail::GUID_s& _guid) + { + m_guid = _guid; + } + + /*! + * @brief This function moves the value in member guid + * @param _guid New value to be moved in member guid + */ + eProsima_user_DllExport void guid( + detail::GUID_s&& _guid) + { + m_guid = std::move(_guid); + } + + /*! + * @brief This function returns a constant reference to member guid + * @return Constant reference to member guid + */ + eProsima_user_DllExport const detail::GUID_s& guid() const + { + return m_guid; + } + + /*! + * @brief This function returns a reference to member guid + * @return Reference to member guid + */ + eProsima_user_DllExport detail::GUID_s& guid() + { + return m_guid; + } + + /*! + * @brief This function copies the value in member announced_locators + * @param _announced_locators New value to be copied in member announced_locators + */ + eProsima_user_DllExport void announced_locators( + const std::vector& _announced_locators) + { + m_announced_locators = _announced_locators; + } + + /*! + * @brief This function moves the value in member announced_locators + * @param _announced_locators New value to be moved in member announced_locators + */ + eProsima_user_DllExport void announced_locators( + std::vector&& _announced_locators) + { + m_announced_locators = std::move(_announced_locators); + } + + /*! + * @brief This function returns a constant reference to member announced_locators + * @return Constant reference to member announced_locators + */ + eProsima_user_DllExport const std::vector& announced_locators() const + { + return m_announced_locators; + } + + /*! + * @brief This function returns a reference to member announced_locators + * @return Reference to member announced_locators + */ + eProsima_user_DllExport std::vector& announced_locators() + { + return m_announced_locators; + } + + /*! + * @brief This function copies the value in member used_locators + * @param _used_locators New value to be copied in member used_locators + */ + eProsima_user_DllExport void used_locators( + const std::vector& _used_locators) + { + m_used_locators = _used_locators; + } + + /*! + * @brief This function moves the value in member used_locators + * @param _used_locators New value to be moved in member used_locators + */ + eProsima_user_DllExport void used_locators( + std::vector&& _used_locators) + { + m_used_locators = std::move(_used_locators); + } + + /*! + * @brief This function returns a constant reference to member used_locators + * @return Constant reference to member used_locators + */ + eProsima_user_DllExport const std::vector& used_locators() const + { + return m_used_locators; + } + + /*! + * @brief This function returns a reference to member used_locators + * @return Reference to member used_locators + */ + eProsima_user_DllExport std::vector& used_locators() + { + return m_used_locators; + } + +private: + + ConnectionMode m_mode{ConnectionMode::DATA_SHARING}; + detail::GUID_s m_guid; + std::vector m_announced_locators; + std::vector m_used_locators; + +}; +/*! + * @brief This class represents the structure QosPolicyCount_s defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class QosPolicyCount_s +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport QosPolicyCount_s() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~QosPolicyCount_s() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object QosPolicyCount_s that will be copied. + */ + eProsima_user_DllExport QosPolicyCount_s( + const QosPolicyCount_s& x) + { + m_policy_id = x.m_policy_id; + + m_count = x.m_count; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object QosPolicyCount_s that will be copied. + */ + eProsima_user_DllExport QosPolicyCount_s( + QosPolicyCount_s&& x) noexcept + { + m_policy_id = x.m_policy_id; + m_count = x.m_count; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object QosPolicyCount_s that will be copied. + */ + eProsima_user_DllExport QosPolicyCount_s& operator =( + const QosPolicyCount_s& x) + { + + m_policy_id = x.m_policy_id; + + m_count = x.m_count; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object QosPolicyCount_s that will be copied. + */ + eProsima_user_DllExport QosPolicyCount_s& operator =( + QosPolicyCount_s&& x) noexcept + { + + m_policy_id = x.m_policy_id; + m_count = x.m_count; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x QosPolicyCount_s object to compare. + */ + eProsima_user_DllExport bool operator ==( + const QosPolicyCount_s& x) const + { + return (m_policy_id == x.m_policy_id && + m_count == x.m_count); + } + + /*! + * @brief Comparison operator. + * @param x QosPolicyCount_s object to compare. + */ + eProsima_user_DllExport bool operator !=( + const QosPolicyCount_s& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member policy_id + * @param _policy_id New value for member policy_id + */ + eProsima_user_DllExport void policy_id( + uint32_t _policy_id) + { + m_policy_id = _policy_id; + } + + /*! + * @brief This function returns the value of member policy_id + * @return Value of member policy_id + */ + eProsima_user_DllExport uint32_t policy_id() const + { + return m_policy_id; + } + + /*! + * @brief This function returns a reference to member policy_id + * @return Reference to member policy_id + */ + eProsima_user_DllExport uint32_t& policy_id() + { + return m_policy_id; + } + + /*! + * @brief This function sets a value in member count + * @param _count New value for member count + */ + eProsima_user_DllExport void count( + uint32_t _count) + { + m_count = _count; + } + + /*! + * @brief This function returns the value of member count + * @return Value of member count + */ + eProsima_user_DllExport uint32_t count() const + { + return m_count; + } + + /*! + * @brief This function returns a reference to member count + * @return Reference to member count + */ + eProsima_user_DllExport uint32_t& count() + { + return m_count; + } + +private: + + uint32_t m_policy_id{0}; + uint32_t m_count{0}; + +}; +/*! + * @brief This class represents the structure BaseStatus_s defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class BaseStatus_s +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport BaseStatus_s() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~BaseStatus_s() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object BaseStatus_s that will be copied. + */ + eProsima_user_DllExport BaseStatus_s( + const BaseStatus_s& x) + { + m_total_count = x.m_total_count; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object BaseStatus_s that will be copied. + */ + eProsima_user_DllExport BaseStatus_s( + BaseStatus_s&& x) noexcept + { + m_total_count = x.m_total_count; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object BaseStatus_s that will be copied. + */ + eProsima_user_DllExport BaseStatus_s& operator =( + const BaseStatus_s& x) + { + + m_total_count = x.m_total_count; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object BaseStatus_s that will be copied. + */ + eProsima_user_DllExport BaseStatus_s& operator =( + BaseStatus_s&& x) noexcept + { + + m_total_count = x.m_total_count; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x BaseStatus_s object to compare. + */ + eProsima_user_DllExport bool operator ==( + const BaseStatus_s& x) const + { + return (m_total_count == x.m_total_count); + } + + /*! + * @brief Comparison operator. + * @param x BaseStatus_s object to compare. + */ + eProsima_user_DllExport bool operator !=( + const BaseStatus_s& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member total_count + * @param _total_count New value for member total_count + */ + eProsima_user_DllExport void total_count( + uint32_t _total_count) + { + m_total_count = _total_count; + } + + /*! + * @brief This function returns the value of member total_count + * @return Value of member total_count + */ + eProsima_user_DllExport uint32_t total_count() const + { + return m_total_count; + } + + /*! + * @brief This function returns a reference to member total_count + * @return Reference to member total_count + */ + eProsima_user_DllExport uint32_t& total_count() + { + return m_total_count; + } + +private: + + uint32_t m_total_count{0}; + +}; +typedef std::vector QosPolicyCountSeq_s; + +/*! + * @brief This class represents the structure IncompatibleQoSStatus_s defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class IncompatibleQoSStatus_s +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport IncompatibleQoSStatus_s() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~IncompatibleQoSStatus_s() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object IncompatibleQoSStatus_s that will be copied. + */ + eProsima_user_DllExport IncompatibleQoSStatus_s( + const IncompatibleQoSStatus_s& x) + { + m_total_count = x.m_total_count; + + m_last_policy_id = x.m_last_policy_id; + + m_policies = x.m_policies; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object IncompatibleQoSStatus_s that will be copied. + */ + eProsima_user_DllExport IncompatibleQoSStatus_s( + IncompatibleQoSStatus_s&& x) noexcept + { + m_total_count = x.m_total_count; + m_last_policy_id = x.m_last_policy_id; + m_policies = std::move(x.m_policies); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object IncompatibleQoSStatus_s that will be copied. + */ + eProsima_user_DllExport IncompatibleQoSStatus_s& operator =( + const IncompatibleQoSStatus_s& x) + { + + m_total_count = x.m_total_count; + + m_last_policy_id = x.m_last_policy_id; + + m_policies = x.m_policies; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object IncompatibleQoSStatus_s that will be copied. + */ + eProsima_user_DllExport IncompatibleQoSStatus_s& operator =( + IncompatibleQoSStatus_s&& x) noexcept + { + + m_total_count = x.m_total_count; + m_last_policy_id = x.m_last_policy_id; + m_policies = std::move(x.m_policies); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x IncompatibleQoSStatus_s object to compare. + */ + eProsima_user_DllExport bool operator ==( + const IncompatibleQoSStatus_s& x) const + { + return (m_total_count == x.m_total_count && + m_last_policy_id == x.m_last_policy_id && + m_policies == x.m_policies); + } + + /*! + * @brief Comparison operator. + * @param x IncompatibleQoSStatus_s object to compare. + */ + eProsima_user_DllExport bool operator !=( + const IncompatibleQoSStatus_s& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member total_count + * @param _total_count New value for member total_count + */ + eProsima_user_DllExport void total_count( + uint32_t _total_count) + { + m_total_count = _total_count; + } + + /*! + * @brief This function returns the value of member total_count + * @return Value of member total_count + */ + eProsima_user_DllExport uint32_t total_count() const + { + return m_total_count; + } + + /*! + * @brief This function returns a reference to member total_count + * @return Reference to member total_count + */ + eProsima_user_DllExport uint32_t& total_count() + { + return m_total_count; + } + + /*! + * @brief This function sets a value in member last_policy_id + * @param _last_policy_id New value for member last_policy_id + */ + eProsima_user_DllExport void last_policy_id( + uint32_t _last_policy_id) + { + m_last_policy_id = _last_policy_id; + } + + /*! + * @brief This function returns the value of member last_policy_id + * @return Value of member last_policy_id + */ + eProsima_user_DllExport uint32_t last_policy_id() const + { + return m_last_policy_id; + } + + /*! + * @brief This function returns a reference to member last_policy_id + * @return Reference to member last_policy_id + */ + eProsima_user_DllExport uint32_t& last_policy_id() + { + return m_last_policy_id; + } + + /*! + * @brief This function copies the value in member policies + * @param _policies New value to be copied in member policies + */ + eProsima_user_DllExport void policies( + const QosPolicyCountSeq_s& _policies) + { + m_policies = _policies; + } + + /*! + * @brief This function moves the value in member policies + * @param _policies New value to be moved in member policies + */ + eProsima_user_DllExport void policies( + QosPolicyCountSeq_s&& _policies) + { + m_policies = std::move(_policies); + } + + /*! + * @brief This function returns a constant reference to member policies + * @return Constant reference to member policies + */ + eProsima_user_DllExport const QosPolicyCountSeq_s& policies() const + { + return m_policies; + } + + /*! + * @brief This function returns a reference to member policies + * @return Reference to member policies + */ + eProsima_user_DllExport QosPolicyCountSeq_s& policies() + { + return m_policies; + } + +private: + + uint32_t m_total_count{0}; + uint32_t m_last_policy_id{0}; + QosPolicyCountSeq_s m_policies; + +}; +/*! + * @brief This class represents the structure LivelinessChangedStatus_s defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class LivelinessChangedStatus_s +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport LivelinessChangedStatus_s() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~LivelinessChangedStatus_s() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object LivelinessChangedStatus_s that will be copied. + */ + eProsima_user_DllExport LivelinessChangedStatus_s( + const LivelinessChangedStatus_s& x) + { + m_alive_count = x.m_alive_count; + + m_not_alive_count = x.m_not_alive_count; + + m_last_publication_handle = x.m_last_publication_handle; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object LivelinessChangedStatus_s that will be copied. + */ + eProsima_user_DllExport LivelinessChangedStatus_s( + LivelinessChangedStatus_s&& x) noexcept + { + m_alive_count = x.m_alive_count; + m_not_alive_count = x.m_not_alive_count; + m_last_publication_handle = std::move(x.m_last_publication_handle); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object LivelinessChangedStatus_s that will be copied. + */ + eProsima_user_DllExport LivelinessChangedStatus_s& operator =( + const LivelinessChangedStatus_s& x) + { + + m_alive_count = x.m_alive_count; + + m_not_alive_count = x.m_not_alive_count; + + m_last_publication_handle = x.m_last_publication_handle; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object LivelinessChangedStatus_s that will be copied. + */ + eProsima_user_DllExport LivelinessChangedStatus_s& operator =( + LivelinessChangedStatus_s&& x) noexcept + { + + m_alive_count = x.m_alive_count; + m_not_alive_count = x.m_not_alive_count; + m_last_publication_handle = std::move(x.m_last_publication_handle); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x LivelinessChangedStatus_s object to compare. + */ + eProsima_user_DllExport bool operator ==( + const LivelinessChangedStatus_s& x) const + { + return (m_alive_count == x.m_alive_count && + m_not_alive_count == x.m_not_alive_count && + m_last_publication_handle == x.m_last_publication_handle); + } + + /*! + * @brief Comparison operator. + * @param x LivelinessChangedStatus_s object to compare. + */ + eProsima_user_DllExport bool operator !=( + const LivelinessChangedStatus_s& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member alive_count + * @param _alive_count New value for member alive_count + */ + eProsima_user_DllExport void alive_count( + uint32_t _alive_count) + { + m_alive_count = _alive_count; + } + + /*! + * @brief This function returns the value of member alive_count + * @return Value of member alive_count + */ + eProsima_user_DllExport uint32_t alive_count() const + { + return m_alive_count; + } + + /*! + * @brief This function returns a reference to member alive_count + * @return Reference to member alive_count + */ + eProsima_user_DllExport uint32_t& alive_count() + { + return m_alive_count; + } + + /*! + * @brief This function sets a value in member not_alive_count + * @param _not_alive_count New value for member not_alive_count + */ + eProsima_user_DllExport void not_alive_count( + uint32_t _not_alive_count) + { + m_not_alive_count = _not_alive_count; + } + + /*! + * @brief This function returns the value of member not_alive_count + * @return Value of member not_alive_count + */ + eProsima_user_DllExport uint32_t not_alive_count() const + { + return m_not_alive_count; + } + + /*! + * @brief This function returns a reference to member not_alive_count + * @return Reference to member not_alive_count + */ + eProsima_user_DllExport uint32_t& not_alive_count() + { + return m_not_alive_count; + } + + /*! + * @brief This function copies the value in member last_publication_handle + * @param _last_publication_handle New value to be copied in member last_publication_handle + */ + eProsima_user_DllExport void last_publication_handle( + const std::array& _last_publication_handle) + { + m_last_publication_handle = _last_publication_handle; + } + + /*! + * @brief This function moves the value in member last_publication_handle + * @param _last_publication_handle New value to be moved in member last_publication_handle + */ + eProsima_user_DllExport void last_publication_handle( + std::array&& _last_publication_handle) + { + m_last_publication_handle = std::move(_last_publication_handle); + } + + /*! + * @brief This function returns a constant reference to member last_publication_handle + * @return Constant reference to member last_publication_handle + */ + eProsima_user_DllExport const std::array& last_publication_handle() const + { + return m_last_publication_handle; + } + + /*! + * @brief This function returns a reference to member last_publication_handle + * @return Reference to member last_publication_handle + */ + eProsima_user_DllExport std::array& last_publication_handle() + { + return m_last_publication_handle; + } + +private: + + uint32_t m_alive_count{0}; + uint32_t m_not_alive_count{0}; + std::array m_last_publication_handle{0}; + +}; +/*! + * @brief This class represents the structure DeadlineMissedStatus_s defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class DeadlineMissedStatus_s +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport DeadlineMissedStatus_s() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~DeadlineMissedStatus_s() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object DeadlineMissedStatus_s that will be copied. + */ + eProsima_user_DllExport DeadlineMissedStatus_s( + const DeadlineMissedStatus_s& x) + { + m_total_count = x.m_total_count; + + m_last_instance_handle = x.m_last_instance_handle; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object DeadlineMissedStatus_s that will be copied. + */ + eProsima_user_DllExport DeadlineMissedStatus_s( + DeadlineMissedStatus_s&& x) noexcept + { + m_total_count = x.m_total_count; + m_last_instance_handle = std::move(x.m_last_instance_handle); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object DeadlineMissedStatus_s that will be copied. + */ + eProsima_user_DllExport DeadlineMissedStatus_s& operator =( + const DeadlineMissedStatus_s& x) + { + + m_total_count = x.m_total_count; + + m_last_instance_handle = x.m_last_instance_handle; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object DeadlineMissedStatus_s that will be copied. + */ + eProsima_user_DllExport DeadlineMissedStatus_s& operator =( + DeadlineMissedStatus_s&& x) noexcept + { + + m_total_count = x.m_total_count; + m_last_instance_handle = std::move(x.m_last_instance_handle); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x DeadlineMissedStatus_s object to compare. + */ + eProsima_user_DllExport bool operator ==( + const DeadlineMissedStatus_s& x) const + { + return (m_total_count == x.m_total_count && + m_last_instance_handle == x.m_last_instance_handle); + } + + /*! + * @brief Comparison operator. + * @param x DeadlineMissedStatus_s object to compare. + */ + eProsima_user_DllExport bool operator !=( + const DeadlineMissedStatus_s& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member total_count + * @param _total_count New value for member total_count + */ + eProsima_user_DllExport void total_count( + uint32_t _total_count) + { + m_total_count = _total_count; + } + + /*! + * @brief This function returns the value of member total_count + * @return Value of member total_count + */ + eProsima_user_DllExport uint32_t total_count() const + { + return m_total_count; + } + + /*! + * @brief This function returns a reference to member total_count + * @return Reference to member total_count + */ + eProsima_user_DllExport uint32_t& total_count() + { + return m_total_count; + } + + /*! + * @brief This function copies the value in member last_instance_handle + * @param _last_instance_handle New value to be copied in member last_instance_handle + */ + eProsima_user_DllExport void last_instance_handle( + const std::array& _last_instance_handle) + { + m_last_instance_handle = _last_instance_handle; + } + + /*! + * @brief This function moves the value in member last_instance_handle + * @param _last_instance_handle New value to be moved in member last_instance_handle + */ + eProsima_user_DllExport void last_instance_handle( + std::array&& _last_instance_handle) + { + m_last_instance_handle = std::move(_last_instance_handle); + } + + /*! + * @brief This function returns a constant reference to member last_instance_handle + * @return Constant reference to member last_instance_handle + */ + eProsima_user_DllExport const std::array& last_instance_handle() const + { + return m_last_instance_handle; + } + + /*! + * @brief This function returns a reference to member last_instance_handle + * @return Reference to member last_instance_handle + */ + eProsima_user_DllExport std::array& last_instance_handle() + { + return m_last_instance_handle; + } + +private: + + uint32_t m_total_count{0}; + std::array m_last_instance_handle{0}; + +}; +typedef BaseStatus_s LivelinessLostStatus_s; + +typedef BaseStatus_s InconsistentTopicStatus_s; + +typedef BaseStatus_s SampleLostStatus_s; + +namespace StatusKind { + +typedef uint32_t StatusKind; + +const StatusKind PROXY = 0; +const StatusKind CONNECTION_LIST = 1; +const StatusKind INCOMPATIBLE_QOS = 2; +const StatusKind INCONSISTENT_TOPIC = 3; +const StatusKind LIVELINESS_LOST = 4; +const StatusKind LIVELINESS_CHANGED = 5; +const StatusKind DEADLINE_MISSED = 6; +const StatusKind SAMPLE_LOST = 7; +const StatusKind STATUSES_SIZE = 8; + +} // namespace StatusKind +/*! + * @brief This class represents the union MonitorServiceData defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class MonitorServiceData +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport MonitorServiceData() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~MonitorServiceData() + { + if (member_destructor_) + { + member_destructor_(); + } + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object MonitorServiceData that will be copied. + */ + eProsima_user_DllExport MonitorServiceData( + const MonitorServiceData& x) + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + entity_proxy_() = x.m_entity_proxy; + break; + + case 0x00000002: + connection_list_() = x.m_connection_list; + break; + + case 0x00000003: + incompatible_qos_status_() = x.m_incompatible_qos_status; + break; + + case 0x00000004: + inconsistent_topic_status_() = x.m_inconsistent_topic_status; + break; + + case 0x00000005: + liveliness_lost_status_() = x.m_liveliness_lost_status; + break; + + case 0x00000006: + liveliness_changed_status_() = x.m_liveliness_changed_status; + break; + + case 0x00000007: + deadline_missed_status_() = x.m_deadline_missed_status; + break; + + case 0x00000008: + sample_lost_status_() = x.m_sample_lost_status; + break; + + case 0x00000009: + statuses_size_() = x.m_statuses_size; + break; + + } + } + + /*! + * @brief Move constructor. + * @param x Reference to the object MonitorServiceData that will be copied. + */ + eProsima_user_DllExport MonitorServiceData( + MonitorServiceData&& x) noexcept + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + entity_proxy_() = std::move(x.m_entity_proxy); + break; + + case 0x00000002: + connection_list_() = std::move(x.m_connection_list); + break; + + case 0x00000003: + incompatible_qos_status_() = std::move(x.m_incompatible_qos_status); + break; + + case 0x00000004: + inconsistent_topic_status_() = std::move(x.m_inconsistent_topic_status); + break; + + case 0x00000005: + liveliness_lost_status_() = std::move(x.m_liveliness_lost_status); + break; + + case 0x00000006: + liveliness_changed_status_() = std::move(x.m_liveliness_changed_status); + break; + + case 0x00000007: + deadline_missed_status_() = std::move(x.m_deadline_missed_status); + break; + + case 0x00000008: + sample_lost_status_() = std::move(x.m_sample_lost_status); + break; + + case 0x00000009: + statuses_size_() = std::move(x.m_statuses_size); + break; + + } + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object MonitorServiceData that will be copied. + */ + eProsima_user_DllExport MonitorServiceData& operator =( + const MonitorServiceData& x) + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + entity_proxy_() = x.m_entity_proxy; + break; + + case 0x00000002: + connection_list_() = x.m_connection_list; + break; + + case 0x00000003: + incompatible_qos_status_() = x.m_incompatible_qos_status; + break; + + case 0x00000004: + inconsistent_topic_status_() = x.m_inconsistent_topic_status; + break; + + case 0x00000005: + liveliness_lost_status_() = x.m_liveliness_lost_status; + break; + + case 0x00000006: + liveliness_changed_status_() = x.m_liveliness_changed_status; + break; + + case 0x00000007: + deadline_missed_status_() = x.m_deadline_missed_status; + break; + + case 0x00000008: + sample_lost_status_() = x.m_sample_lost_status; + break; + + case 0x00000009: + statuses_size_() = x.m_statuses_size; + break; + + } + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object MonitorServiceData that will be copied. + */ + eProsima_user_DllExport MonitorServiceData& operator =( + MonitorServiceData&& x) noexcept + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + entity_proxy_() = std::move(x.m_entity_proxy); + break; + + case 0x00000002: + connection_list_() = std::move(x.m_connection_list); + break; + + case 0x00000003: + incompatible_qos_status_() = std::move(x.m_incompatible_qos_status); + break; + + case 0x00000004: + inconsistent_topic_status_() = std::move(x.m_inconsistent_topic_status); + break; + + case 0x00000005: + liveliness_lost_status_() = std::move(x.m_liveliness_lost_status); + break; + + case 0x00000006: + liveliness_changed_status_() = std::move(x.m_liveliness_changed_status); + break; + + case 0x00000007: + deadline_missed_status_() = std::move(x.m_deadline_missed_status); + break; + + case 0x00000008: + sample_lost_status_() = std::move(x.m_sample_lost_status); + break; + + case 0x00000009: + statuses_size_() = std::move(x.m_statuses_size); + break; + + } + + return *this; + } + + /*! + * @brief Comparison operator. + * @param x MonitorServiceData object to compare. + */ + eProsima_user_DllExport bool operator ==( + const MonitorServiceData& x) const + { + bool ret_value {false}; + + if (m__d == x.m__d && + selected_member_ == x.selected_member_) + { + switch (selected_member_) + { + case 0x00000001: + ret_value = (m_entity_proxy == x.m_entity_proxy); + break; + + case 0x00000002: + ret_value = (m_connection_list == x.m_connection_list); + break; + + case 0x00000003: + ret_value = (m_incompatible_qos_status == x.m_incompatible_qos_status); + break; + + case 0x00000004: + ret_value = (m_inconsistent_topic_status == x.m_inconsistent_topic_status); + break; + + case 0x00000005: + ret_value = (m_liveliness_lost_status == x.m_liveliness_lost_status); + break; + + case 0x00000006: + ret_value = (m_liveliness_changed_status == x.m_liveliness_changed_status); + break; + + case 0x00000007: + ret_value = (m_deadline_missed_status == x.m_deadline_missed_status); + break; + + case 0x00000008: + ret_value = (m_sample_lost_status == x.m_sample_lost_status); + break; + + case 0x00000009: + ret_value = (m_statuses_size == x.m_statuses_size); + break; + + } + } + + return ret_value; + } + + /*! + * @brief Comparison operator. + * @param x MonitorServiceData object to compare. + */ + eProsima_user_DllExport bool operator !=( + const MonitorServiceData& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets the discriminator value. + * @param __d New value for the discriminator. + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member. + */ + eProsima_user_DllExport void _d( + StatusKind::StatusKind __d) + { + bool valid_discriminator = false; + + switch (__d) + { + case StatusKind::PROXY: + if (0x00000001 == selected_member_) + { + valid_discriminator = true; + } + break; + + case StatusKind::CONNECTION_LIST: + if (0x00000002 == selected_member_) + { + valid_discriminator = true; + } + break; + + case StatusKind::INCOMPATIBLE_QOS: + if (0x00000003 == selected_member_) + { + valid_discriminator = true; + } + break; + + case StatusKind::INCONSISTENT_TOPIC: + if (0x00000004 == selected_member_) + { + valid_discriminator = true; + } + break; + + case StatusKind::LIVELINESS_LOST: + if (0x00000005 == selected_member_) + { + valid_discriminator = true; + } + break; + + case StatusKind::LIVELINESS_CHANGED: + if (0x00000006 == selected_member_) + { + valid_discriminator = true; + } + break; + + case StatusKind::DEADLINE_MISSED: + if (0x00000007 == selected_member_) + { + valid_discriminator = true; + } + break; + + case StatusKind::SAMPLE_LOST: + if (0x00000008 == selected_member_) + { + valid_discriminator = true; + } + break; + + case StatusKind::STATUSES_SIZE: + if (0x00000009 == selected_member_) + { + valid_discriminator = true; + } + break; + + } + + if (!valid_discriminator) + { + throw eprosima::fastcdr::exception::BadParamException( + "Discriminator doesn't correspond with the selected union member"); + } + + m__d = __d; + } + + /*! + * @brief This function returns the value of the discriminator. + * @return Value of the discriminator + */ + eProsima_user_DllExport StatusKind::StatusKind _d() const + { + return m__d; + } + + /*! + * @brief This function copies the value in member entity_proxy + * @param _entity_proxy New value to be copied in member entity_proxy + */ + eProsima_user_DllExport void entity_proxy( + const std::vector& _entity_proxy) + { + entity_proxy_() = _entity_proxy; + m__d = StatusKind::PROXY; + } + + /*! + * @brief This function moves the value in member entity_proxy + * @param _entity_proxy New value to be moved in member entity_proxy + */ + eProsima_user_DllExport void entity_proxy( + std::vector&& _entity_proxy) + { + entity_proxy_() = _entity_proxy; + m__d = StatusKind::PROXY; + } + + /*! + * @brief This function returns a constant reference to member entity_proxy + * @return Constant reference to member entity_proxy + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const std::vector& entity_proxy() const + { + if (0x00000001 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_entity_proxy; + } + + /*! + * @brief This function returns a reference to member entity_proxy + * @return Reference to member entity_proxy + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport std::vector& entity_proxy() + { + if (0x00000001 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_entity_proxy; + } + + /*! + * @brief This function copies the value in member connection_list + * @param _connection_list New value to be copied in member connection_list + */ + eProsima_user_DllExport void connection_list( + const std::vector& _connection_list) + { + connection_list_() = _connection_list; + m__d = StatusKind::CONNECTION_LIST; + } + + /*! + * @brief This function moves the value in member connection_list + * @param _connection_list New value to be moved in member connection_list + */ + eProsima_user_DllExport void connection_list( + std::vector&& _connection_list) + { + connection_list_() = _connection_list; + m__d = StatusKind::CONNECTION_LIST; + } + + /*! + * @brief This function returns a constant reference to member connection_list + * @return Constant reference to member connection_list + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const std::vector& connection_list() const + { + if (0x00000002 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_connection_list; + } + + /*! + * @brief This function returns a reference to member connection_list + * @return Reference to member connection_list + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport std::vector& connection_list() + { + if (0x00000002 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_connection_list; + } + + /*! + * @brief This function copies the value in member incompatible_qos_status + * @param _incompatible_qos_status New value to be copied in member incompatible_qos_status + */ + eProsima_user_DllExport void incompatible_qos_status( + const IncompatibleQoSStatus_s& _incompatible_qos_status) + { + incompatible_qos_status_() = _incompatible_qos_status; + m__d = StatusKind::INCOMPATIBLE_QOS; + } + + /*! + * @brief This function moves the value in member incompatible_qos_status + * @param _incompatible_qos_status New value to be moved in member incompatible_qos_status + */ + eProsima_user_DllExport void incompatible_qos_status( + IncompatibleQoSStatus_s&& _incompatible_qos_status) + { + incompatible_qos_status_() = _incompatible_qos_status; + m__d = StatusKind::INCOMPATIBLE_QOS; + } + + /*! + * @brief This function returns a constant reference to member incompatible_qos_status + * @return Constant reference to member incompatible_qos_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const IncompatibleQoSStatus_s& incompatible_qos_status() const + { + if (0x00000003 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_incompatible_qos_status; + } + + /*! + * @brief This function returns a reference to member incompatible_qos_status + * @return Reference to member incompatible_qos_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport IncompatibleQoSStatus_s& incompatible_qos_status() + { + if (0x00000003 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_incompatible_qos_status; + } + + /*! + * @brief This function copies the value in member inconsistent_topic_status + * @param _inconsistent_topic_status New value to be copied in member inconsistent_topic_status + */ + eProsima_user_DllExport void inconsistent_topic_status( + const InconsistentTopicStatus_s& _inconsistent_topic_status) + { + inconsistent_topic_status_() = _inconsistent_topic_status; + m__d = StatusKind::INCONSISTENT_TOPIC; + } + + /*! + * @brief This function moves the value in member inconsistent_topic_status + * @param _inconsistent_topic_status New value to be moved in member inconsistent_topic_status + */ + eProsima_user_DllExport void inconsistent_topic_status( + InconsistentTopicStatus_s&& _inconsistent_topic_status) + { + inconsistent_topic_status_() = _inconsistent_topic_status; + m__d = StatusKind::INCONSISTENT_TOPIC; + } + + /*! + * @brief This function returns a constant reference to member inconsistent_topic_status + * @return Constant reference to member inconsistent_topic_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const InconsistentTopicStatus_s& inconsistent_topic_status() const + { + if (0x00000004 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_inconsistent_topic_status; + } + + /*! + * @brief This function returns a reference to member inconsistent_topic_status + * @return Reference to member inconsistent_topic_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport InconsistentTopicStatus_s& inconsistent_topic_status() + { + if (0x00000004 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_inconsistent_topic_status; + } + + /*! + * @brief This function copies the value in member liveliness_lost_status + * @param _liveliness_lost_status New value to be copied in member liveliness_lost_status + */ + eProsima_user_DllExport void liveliness_lost_status( + const LivelinessLostStatus_s& _liveliness_lost_status) + { + liveliness_lost_status_() = _liveliness_lost_status; + m__d = StatusKind::LIVELINESS_LOST; + } + + /*! + * @brief This function moves the value in member liveliness_lost_status + * @param _liveliness_lost_status New value to be moved in member liveliness_lost_status + */ + eProsima_user_DllExport void liveliness_lost_status( + LivelinessLostStatus_s&& _liveliness_lost_status) + { + liveliness_lost_status_() = _liveliness_lost_status; + m__d = StatusKind::LIVELINESS_LOST; + } + + /*! + * @brief This function returns a constant reference to member liveliness_lost_status + * @return Constant reference to member liveliness_lost_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const LivelinessLostStatus_s& liveliness_lost_status() const + { + if (0x00000005 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_liveliness_lost_status; + } + + /*! + * @brief This function returns a reference to member liveliness_lost_status + * @return Reference to member liveliness_lost_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport LivelinessLostStatus_s& liveliness_lost_status() + { + if (0x00000005 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_liveliness_lost_status; + } + + /*! + * @brief This function copies the value in member liveliness_changed_status + * @param _liveliness_changed_status New value to be copied in member liveliness_changed_status + */ + eProsima_user_DllExport void liveliness_changed_status( + const LivelinessChangedStatus_s& _liveliness_changed_status) + { + liveliness_changed_status_() = _liveliness_changed_status; + m__d = StatusKind::LIVELINESS_CHANGED; + } + + /*! + * @brief This function moves the value in member liveliness_changed_status + * @param _liveliness_changed_status New value to be moved in member liveliness_changed_status + */ + eProsima_user_DllExport void liveliness_changed_status( + LivelinessChangedStatus_s&& _liveliness_changed_status) + { + liveliness_changed_status_() = _liveliness_changed_status; + m__d = StatusKind::LIVELINESS_CHANGED; + } + + /*! + * @brief This function returns a constant reference to member liveliness_changed_status + * @return Constant reference to member liveliness_changed_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const LivelinessChangedStatus_s& liveliness_changed_status() const + { + if (0x00000006 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_liveliness_changed_status; + } + + /*! + * @brief This function returns a reference to member liveliness_changed_status + * @return Reference to member liveliness_changed_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport LivelinessChangedStatus_s& liveliness_changed_status() + { + if (0x00000006 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_liveliness_changed_status; + } + + /*! + * @brief This function copies the value in member deadline_missed_status + * @param _deadline_missed_status New value to be copied in member deadline_missed_status + */ + eProsima_user_DllExport void deadline_missed_status( + const DeadlineMissedStatus_s& _deadline_missed_status) + { + deadline_missed_status_() = _deadline_missed_status; + m__d = StatusKind::DEADLINE_MISSED; + } + + /*! + * @brief This function moves the value in member deadline_missed_status + * @param _deadline_missed_status New value to be moved in member deadline_missed_status + */ + eProsima_user_DllExport void deadline_missed_status( + DeadlineMissedStatus_s&& _deadline_missed_status) + { + deadline_missed_status_() = _deadline_missed_status; + m__d = StatusKind::DEADLINE_MISSED; + } + + /*! + * @brief This function returns a constant reference to member deadline_missed_status + * @return Constant reference to member deadline_missed_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const DeadlineMissedStatus_s& deadline_missed_status() const + { + if (0x00000007 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_deadline_missed_status; + } + + /*! + * @brief This function returns a reference to member deadline_missed_status + * @return Reference to member deadline_missed_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport DeadlineMissedStatus_s& deadline_missed_status() + { + if (0x00000007 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_deadline_missed_status; + } + + /*! + * @brief This function copies the value in member sample_lost_status + * @param _sample_lost_status New value to be copied in member sample_lost_status + */ + eProsima_user_DllExport void sample_lost_status( + const SampleLostStatus_s& _sample_lost_status) + { + sample_lost_status_() = _sample_lost_status; + m__d = StatusKind::SAMPLE_LOST; + } + + /*! + * @brief This function moves the value in member sample_lost_status + * @param _sample_lost_status New value to be moved in member sample_lost_status + */ + eProsima_user_DllExport void sample_lost_status( + SampleLostStatus_s&& _sample_lost_status) + { + sample_lost_status_() = _sample_lost_status; + m__d = StatusKind::SAMPLE_LOST; + } + + /*! + * @brief This function returns a constant reference to member sample_lost_status + * @return Constant reference to member sample_lost_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const SampleLostStatus_s& sample_lost_status() const + { + if (0x00000008 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_sample_lost_status; + } + + /*! + * @brief This function returns a reference to member sample_lost_status + * @return Reference to member sample_lost_status + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport SampleLostStatus_s& sample_lost_status() + { + if (0x00000008 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_sample_lost_status; + } + + /*! + * @brief This function sets a value in member statuses_size + * @param _statuses_size New value for member statuses_size + */ + eProsima_user_DllExport void statuses_size( + uint8_t _statuses_size) + { + statuses_size_() = _statuses_size; + m__d = StatusKind::STATUSES_SIZE; + } + + /*! + * @brief This function returns the value of member statuses_size + * @return Value of member statuses_size + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport uint8_t statuses_size() const + { + if (0x00000009 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_statuses_size; + } + + /*! + * @brief This function returns a reference to member statuses_size + * @return Reference to member statuses_size + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport uint8_t& statuses_size() + { + if (0x00000009 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_statuses_size; + } + + void _default() + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x0FFFFFFFu; + } + +private: + + std::vector& entity_proxy_() + { + if (0x00000001 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000001; + member_destructor_ = [&]() + { + m_entity_proxy.~vector(); + }; + new(&m_entity_proxy) std::vector(); + } + + return m_entity_proxy; + } + + std::vector& connection_list_() + { + if (0x00000002 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000002; + member_destructor_ = [&]() + { + m_connection_list.~vector(); + }; + new(&m_connection_list) std::vector(); + } + + return m_connection_list; + } + + IncompatibleQoSStatus_s& incompatible_qos_status_() + { + if (0x00000003 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000003; + member_destructor_ = [&]() + { + m_incompatible_qos_status.~IncompatibleQoSStatus_s(); + }; + new(&m_incompatible_qos_status) IncompatibleQoSStatus_s(); + } + + return m_incompatible_qos_status; + } + + InconsistentTopicStatus_s& inconsistent_topic_status_() + { + if (0x00000004 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000004; + member_destructor_ = [&]() + { + m_inconsistent_topic_status.~InconsistentTopicStatus_s(); + }; + new(&m_inconsistent_topic_status) InconsistentTopicStatus_s(); + } + + return m_inconsistent_topic_status; + } + + LivelinessLostStatus_s& liveliness_lost_status_() + { + if (0x00000005 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000005; + member_destructor_ = [&]() + { + m_liveliness_lost_status.~LivelinessLostStatus_s(); + }; + new(&m_liveliness_lost_status) LivelinessLostStatus_s(); + } + + return m_liveliness_lost_status; + } + + LivelinessChangedStatus_s& liveliness_changed_status_() + { + if (0x00000006 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000006; + member_destructor_ = [&]() + { + m_liveliness_changed_status.~LivelinessChangedStatus_s(); + }; + new(&m_liveliness_changed_status) LivelinessChangedStatus_s(); + } + + return m_liveliness_changed_status; + } + + DeadlineMissedStatus_s& deadline_missed_status_() + { + if (0x00000007 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000007; + member_destructor_ = [&]() + { + m_deadline_missed_status.~DeadlineMissedStatus_s(); + }; + new(&m_deadline_missed_status) DeadlineMissedStatus_s(); + } + + return m_deadline_missed_status; + } + + SampleLostStatus_s& sample_lost_status_() + { + if (0x00000008 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000008; + member_destructor_ = [&]() + { + m_sample_lost_status.~SampleLostStatus_s(); + }; + new(&m_sample_lost_status) SampleLostStatus_s(); + } + + return m_sample_lost_status; + } + + uint8_t& statuses_size_() + { + if (0x00000009 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000009; + member_destructor_ = nullptr; + m_statuses_size = {0}; + } + + return m_statuses_size; + } + + StatusKind::StatusKind m__d {2147483647}; + + union + { + std::vector m_entity_proxy; + std::vector m_connection_list; + IncompatibleQoSStatus_s m_incompatible_qos_status; + InconsistentTopicStatus_s m_inconsistent_topic_status; + LivelinessLostStatus_s m_liveliness_lost_status; + LivelinessChangedStatus_s m_liveliness_changed_status; + DeadlineMissedStatus_s m_deadline_missed_status; + SampleLostStatus_s m_sample_lost_status; + uint8_t m_statuses_size; + }; + + uint32_t selected_member_ {0x0FFFFFFFu}; + + std::function member_destructor_; +}; +/*! + * @brief This class represents the structure MonitorServiceStatusData defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class MonitorServiceStatusData +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport MonitorServiceStatusData() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~MonitorServiceStatusData() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object MonitorServiceStatusData that will be copied. + */ + eProsima_user_DllExport MonitorServiceStatusData( + const MonitorServiceStatusData& x) + { + m_local_entity = x.m_local_entity; + + m_status_kind = x.m_status_kind; + + m_value = x.m_value; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object MonitorServiceStatusData that will be copied. + */ + eProsima_user_DllExport MonitorServiceStatusData( + MonitorServiceStatusData&& x) noexcept + { + m_local_entity = std::move(x.m_local_entity); + m_status_kind = x.m_status_kind; + m_value = std::move(x.m_value); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object MonitorServiceStatusData that will be copied. + */ + eProsima_user_DllExport MonitorServiceStatusData& operator =( + const MonitorServiceStatusData& x) + { + + m_local_entity = x.m_local_entity; + + m_status_kind = x.m_status_kind; + + m_value = x.m_value; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object MonitorServiceStatusData that will be copied. + */ + eProsima_user_DllExport MonitorServiceStatusData& operator =( + MonitorServiceStatusData&& x) noexcept + { + + m_local_entity = std::move(x.m_local_entity); + m_status_kind = x.m_status_kind; + m_value = std::move(x.m_value); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x MonitorServiceStatusData object to compare. + */ + eProsima_user_DllExport bool operator ==( + const MonitorServiceStatusData& x) const + { + return (m_local_entity == x.m_local_entity && + m_status_kind == x.m_status_kind && + m_value == x.m_value); + } + + /*! + * @brief Comparison operator. + * @param x MonitorServiceStatusData object to compare. + */ + eProsima_user_DllExport bool operator !=( + const MonitorServiceStatusData& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member local_entity + * @param _local_entity New value to be copied in member local_entity + */ + eProsima_user_DllExport void local_entity( + const detail::GUID_s& _local_entity) + { + m_local_entity = _local_entity; + } + + /*! + * @brief This function moves the value in member local_entity + * @param _local_entity New value to be moved in member local_entity + */ + eProsima_user_DllExport void local_entity( + detail::GUID_s&& _local_entity) + { + m_local_entity = std::move(_local_entity); + } + + /*! + * @brief This function returns a constant reference to member local_entity + * @return Constant reference to member local_entity + */ + eProsima_user_DllExport const detail::GUID_s& local_entity() const + { + return m_local_entity; + } + + /*! + * @brief This function returns a reference to member local_entity + * @return Reference to member local_entity + */ + eProsima_user_DllExport detail::GUID_s& local_entity() + { + return m_local_entity; + } + + /*! + * @brief This function sets a value in member status_kind + * @param _status_kind New value for member status_kind + */ + eProsima_user_DllExport void status_kind( + StatusKind::StatusKind _status_kind) + { + m_status_kind = _status_kind; + } + + /*! + * @brief This function returns the value of member status_kind + * @return Value of member status_kind + */ + eProsima_user_DllExport StatusKind::StatusKind status_kind() const + { + return m_status_kind; + } + + /*! + * @brief This function returns a reference to member status_kind + * @return Reference to member status_kind + */ + eProsima_user_DllExport StatusKind::StatusKind& status_kind() + { + return m_status_kind; + } + + /*! + * @brief This function copies the value in member value + * @param _value New value to be copied in member value + */ + eProsima_user_DllExport void value( + const MonitorServiceData& _value) + { + m_value = _value; + } + + /*! + * @brief This function moves the value in member value + * @param _value New value to be moved in member value + */ + eProsima_user_DllExport void value( + MonitorServiceData&& _value) + { + m_value = std::move(_value); + } + + /*! + * @brief This function returns a constant reference to member value + * @return Constant reference to member value + */ + eProsima_user_DllExport const MonitorServiceData& value() const + { + return m_value; + } + + /*! + * @brief This function returns a reference to member value + * @return Reference to member value + */ + eProsima_user_DllExport MonitorServiceData& value() + { + return m_value; + } + +private: + + detail::GUID_s m_local_entity; + StatusKind::StatusKind m_status_kind{0}; + MonitorServiceData m_value; + +}; + +} // namespace statistics + +} // namespace fastdds + +} // namespace eprosima + +#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_HPP_ + + diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_types.idl b/include/fastdds_statistics_backend/topic_types/monitorservice_types.idl index e7940cc2d..5ae98a816 100644 --- a/include/fastdds_statistics_backend/topic_types/monitorservice_types.idl +++ b/include/fastdds_statistics_backend/topic_types/monitorservice_types.idl @@ -13,7 +13,7 @@ // limitations under the License. /** - * @file monitorservice_types.idl + * @file include/fastdds/statistics/monitorservice_types.idl */ #include "types.idl" @@ -22,99 +22,101 @@ module eprosima { module fastdds { module statistics { - enum ConnectionMode - { - DATA_SHARING, - INTRAPROCESS, - TRANSPORT - }; - - struct Connection - { - ConnectionMode mode; - detail::GUID_s guid; - sequence announced_locators; - sequence used_locators; - }; - - struct QosPolicyCount_s - { - unsigned long policy_id; - unsigned long count; - }; - - struct BaseStatus_s - { - unsigned long total_count; - }; - - typedef sequence QosPolicyCountSeq_s; - - struct IncompatibleQoSStatus_s - { - unsigned long total_count; - unsigned long last_policy_id; - QosPolicyCountSeq_s policies; - }; - - struct LivelinessChangedStatus_s - { - unsigned long alive_count; - unsigned long not_alive_count; - octet last_publication_handle[16]; - }; - - struct DeadlineMissedStatus_s - { - unsigned long total_count; - octet last_instance_handle[16]; - }; - - typedef BaseStatus_s LivelinessLostStatus_s; - typedef BaseStatus_s InconsistentTopicStatus_s; - typedef BaseStatus_s SampleLostStatus_s; - - enum StatusKind - { - PROXY, - CONNECTION_LIST, - INCOMPATIBLE_QOS, - INCONSISTENT_TOPIC, - LIVELINESS_LOST, - LIVELINESS_CHANGED, - DEADLINE_MISSED, - SAMPLE_LOST, - STATUSES_SIZE - }; - - union MonitorServiceData switch(StatusKind) - { - case PROXY: - sequence entity_proxy; - case CONNECTION_LIST: - sequence connection_list; - case INCOMPATIBLE_QOS: - IncompatibleQoSStatus_s incompatible_qos_status; - case INCONSISTENT_TOPIC: - InconsistentTopicStatus_s inconsistent_topic_status; - case LIVELINESS_LOST: - LivelinessLostStatus_s liveliness_lost_status; - case LIVELINESS_CHANGED: - LivelinessChangedStatus_s liveliness_changed_status; - case DEADLINE_MISSED: - DeadlineMissedStatus_s deadline_missed_status; - case SAMPLE_LOST: - SampleLostStatus_s sample_lost_status; - case STATUSES_SIZE: - octet statuses_size; - }; - - struct MonitorServiceStatusData - { - @Key detail::GUID_s local_entity; - @Key StatusKind status_kind; - MonitorServiceData value; - }; + enum ConnectionMode + { + DATA_SHARING, + INTRAPROCESS, + TRANSPORT + }; + + struct Connection + { + ConnectionMode mode; + detail::GUID_s guid; + sequence announced_locators; + sequence used_locators; + }; + + struct QosPolicyCount_s + { + unsigned long policy_id; + unsigned long count; + }; + + struct BaseStatus_s + { + unsigned long total_count; + }; + + typedef sequence QosPolicyCountSeq_s; + + struct IncompatibleQoSStatus_s + { + unsigned long total_count; + unsigned long last_policy_id; + QosPolicyCountSeq_s policies; + }; + + struct LivelinessChangedStatus_s + { + unsigned long alive_count; + unsigned long not_alive_count; + octet last_publication_handle[16]; + }; + + struct DeadlineMissedStatus_s + { + unsigned long total_count; + octet last_instance_handle[16]; + }; + + typedef BaseStatus_s LivelinessLostStatus_s; + typedef BaseStatus_s InconsistentTopicStatus_s; + typedef BaseStatus_s SampleLostStatus_s; + + module StatusKind + { + typedef unsigned long StatusKind; + + const StatusKind PROXY = 0; + const StatusKind CONNECTION_LIST = 1; + const StatusKind INCOMPATIBLE_QOS = 2; + const StatusKind INCONSISTENT_TOPIC = 3; + const StatusKind LIVELINESS_LOST = 4; + const StatusKind LIVELINESS_CHANGED = 5; + const StatusKind DEADLINE_MISSED = 6; + const StatusKind SAMPLE_LOST = 7; + const StatusKind STATUSES_SIZE = 8; + }; // module StatusKind + + union MonitorServiceData switch(StatusKind::StatusKind) + { + case StatusKind::PROXY: + sequence entity_proxy; + case StatusKind::CONNECTION_LIST: + sequence connection_list; + case StatusKind::INCOMPATIBLE_QOS: + IncompatibleQoSStatus_s incompatible_qos_status; + case StatusKind::INCONSISTENT_TOPIC: + InconsistentTopicStatus_s inconsistent_topic_status; + case StatusKind::LIVELINESS_LOST: + LivelinessLostStatus_s liveliness_lost_status; + case StatusKind::LIVELINESS_CHANGED: + LivelinessChangedStatus_s liveliness_changed_status; + case StatusKind::DEADLINE_MISSED: + DeadlineMissedStatus_s deadline_missed_status; + case StatusKind::SAMPLE_LOST: + SampleLostStatus_s sample_lost_status; + case StatusKind::STATUSES_SIZE: + octet statuses_size; + }; + + struct MonitorServiceStatusData + { + @Key detail::GUID_s local_entity; + @Key StatusKind::StatusKind status_kind; + MonitorServiceData value; + }; }; // namespace statisitcs }; // namespace fastdds diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_typesCdrAux.hpp b/include/fastdds_statistics_backend/topic_types/monitorservice_typesCdrAux.hpp index d021330f4..32c6ac80b 100644 --- a/include/fastdds_statistics_backend/topic_types/monitorservice_typesCdrAux.hpp +++ b/include/fastdds_statistics_backend/topic_types/monitorservice_typesCdrAux.hpp @@ -19,10 +19,10 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_HPP +#define FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_HPP -#include "monitorservice_types.h" +#include "monitorservice_types.hpp" constexpr uint32_t eprosima_fastdds_statistics_BaseStatus_s_max_cdr_typesize {8UL}; constexpr uint32_t eprosima_fastdds_statistics_BaseStatus_s_max_key_cdr_typesize {0UL}; @@ -37,24 +37,24 @@ constexpr uint32_t eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_cdr_ty constexpr uint32_t eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_key_cdr_typesize {0UL}; + constexpr uint32_t eprosima_fastdds_statistics_QosPolicyCount_s_max_cdr_typesize {12UL}; constexpr uint32_t eprosima_fastdds_statistics_QosPolicyCount_s_max_key_cdr_typesize {0UL}; - -constexpr uint32_t eprosima_fastdds_statistics_MonitorServiceStatusData_max_cdr_typesize {484040UL}; -constexpr uint32_t eprosima_fastdds_statistics_MonitorServiceStatusData_max_key_cdr_typesize {20UL}; +constexpr uint32_t eprosima_fastdds_statistics_MonitorServiceStatusData_max_cdr_typesize {72UL}; +constexpr uint32_t eprosima_fastdds_statistics_MonitorServiceStatusData_max_key_cdr_typesize {32UL}; -constexpr uint32_t eprosima_fastdds_statistics_Connection_max_cdr_typesize {4840UL}; +constexpr uint32_t eprosima_fastdds_statistics_Connection_max_cdr_typesize {52UL}; constexpr uint32_t eprosima_fastdds_statistics_Connection_max_key_cdr_typesize {0UL}; -constexpr uint32_t eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_cdr_typesize {1220UL}; +constexpr uint32_t eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_cdr_typesize {20UL}; constexpr uint32_t eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_key_cdr_typesize {0UL}; @@ -73,44 +73,27 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::Connection& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::QosPolicyCount_s& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::BaseStatus_s& data); - - - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::IncompatibleQoSStatus_s& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::LivelinessChangedStatus_s& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::DeadlineMissedStatus_s& data); @@ -120,24 +103,13 @@ eProsima_user_DllExport void serialize_key( - - - - - - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::MonitorServiceStatusData& data); - - - } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_HPP diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_typesCdrAux.ipp b/include/fastdds_statistics_backend/topic_types/monitorservice_typesCdrAux.ipp index 1a0877a68..1ab16df87 100644 --- a/include/fastdds_statistics_backend/topic_types/monitorservice_typesCdrAux.ipp +++ b/include/fastdds_statistics_backend/topic_types/monitorservice_typesCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_IPP +#define FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_IPP #include "monitorservice_typesCdrAux.hpp" @@ -34,10 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -140,12 +136,24 @@ void serialize_key( const eprosima::fastdds::statistics::Connection& data) { using namespace eprosima::fastdds::statistics; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GUID_s& data); + + + static_cast(scdr); static_cast(data); -} + scdr << data.mode(); + + serialize_key(scdr, data.guid()); + scdr << data.announced_locators(); + scdr << data.used_locators(); + +} template<> @@ -237,9 +245,11 @@ void serialize_key( static_cast(scdr); static_cast(data); -} + scdr << data.policy_id(); + scdr << data.count(); +} template<> @@ -323,12 +333,9 @@ void serialize_key( static_cast(scdr); static_cast(data); -} - - - - + scdr << data.total_count(); +} @@ -429,9 +436,13 @@ void serialize_key( static_cast(scdr); static_cast(data); -} + scdr << data.total_count(); + scdr << data.last_policy_id(); + scdr << data.policies(); + +} template<> @@ -531,9 +542,13 @@ void serialize_key( static_cast(scdr); static_cast(data); -} + scdr << data.alive_count(); + scdr << data.not_alive_count(); + scdr << data.last_publication_handle(); + +} template<> @@ -625,12 +640,11 @@ void serialize_key( static_cast(scdr); static_cast(data); -} - - - + scdr << data.total_count(); + scdr << data.last_instance_handle(); +} @@ -659,47 +673,47 @@ eProsima_user_DllExport size_t calculate_serialized_size( switch (data._d()) { - case eprosima::fastdds::statistics::PROXY: + case StatusKind::PROXY: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), data.entity_proxy(), current_alignment); break; - case eprosima::fastdds::statistics::CONNECTION_LIST: + case StatusKind::CONNECTION_LIST: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), data.connection_list(), current_alignment); break; - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: + case StatusKind::INCOMPATIBLE_QOS: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), data.incompatible_qos_status(), current_alignment); break; - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: + case StatusKind::INCONSISTENT_TOPIC: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(4), data.inconsistent_topic_status(), current_alignment); break; - case eprosima::fastdds::statistics::LIVELINESS_LOST: + case StatusKind::LIVELINESS_LOST: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(5), data.liveliness_lost_status(), current_alignment); break; - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: + case StatusKind::LIVELINESS_CHANGED: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(6), data.liveliness_changed_status(), current_alignment); break; - case eprosima::fastdds::statistics::DEADLINE_MISSED: + case StatusKind::DEADLINE_MISSED: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(7), data.deadline_missed_status(), current_alignment); break; - case eprosima::fastdds::statistics::SAMPLE_LOST: + case StatusKind::SAMPLE_LOST: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(8), data.sample_lost_status(), current_alignment); break; - case eprosima::fastdds::statistics::STATUSES_SIZE: + case StatusKind::STATUSES_SIZE: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(9), data.statuses_size(), current_alignment); break; @@ -731,39 +745,39 @@ eProsima_user_DllExport void serialize( switch (data._d()) { - case eprosima::fastdds::statistics::PROXY: + case StatusKind::PROXY: scdr << eprosima::fastcdr::MemberId(1) << data.entity_proxy(); break; - case eprosima::fastdds::statistics::CONNECTION_LIST: + case StatusKind::CONNECTION_LIST: scdr << eprosima::fastcdr::MemberId(2) << data.connection_list(); break; - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: + case StatusKind::INCOMPATIBLE_QOS: scdr << eprosima::fastcdr::MemberId(3) << data.incompatible_qos_status(); break; - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: + case StatusKind::INCONSISTENT_TOPIC: scdr << eprosima::fastcdr::MemberId(4) << data.inconsistent_topic_status(); break; - case eprosima::fastdds::statistics::LIVELINESS_LOST: + case StatusKind::LIVELINESS_LOST: scdr << eprosima::fastcdr::MemberId(5) << data.liveliness_lost_status(); break; - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: + case StatusKind::LIVELINESS_CHANGED: scdr << eprosima::fastcdr::MemberId(6) << data.liveliness_changed_status(); break; - case eprosima::fastdds::statistics::DEADLINE_MISSED: + case StatusKind::DEADLINE_MISSED: scdr << eprosima::fastcdr::MemberId(7) << data.deadline_missed_status(); break; - case eprosima::fastdds::statistics::SAMPLE_LOST: + case StatusKind::SAMPLE_LOST: scdr << eprosima::fastcdr::MemberId(8) << data.sample_lost_status(); break; - case eprosima::fastdds::statistics::STATUSES_SIZE: + case StatusKind::STATUSES_SIZE: scdr << eprosima::fastcdr::MemberId(9) << data.statuses_size(); break; @@ -787,62 +801,139 @@ eProsima_user_DllExport void deserialize( [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { bool ret_value = true; - switch (mid.id) + if (0 == mid.id) { - case 0: - dcdr >> data._d(); - break; - default: - switch (data._d()) - { - case eprosima::fastdds::statistics::PROXY: - dcdr >> data.entity_proxy(); - break; - - case eprosima::fastdds::statistics::CONNECTION_LIST: - dcdr >> data.connection_list(); - break; - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - dcdr >> data.incompatible_qos_status(); - break; - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - dcdr >> data.inconsistent_topic_status(); - break; - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - dcdr >> data.liveliness_lost_status(); - break; - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - dcdr >> data.liveliness_changed_status(); - break; - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - dcdr >> data.deadline_missed_status(); - break; - - case eprosima::fastdds::statistics::SAMPLE_LOST: - dcdr >> data.sample_lost_status(); - break; - - case eprosima::fastdds::statistics::STATUSES_SIZE: - dcdr >> data.statuses_size(); - break; - - default: - break; - } - ret_value = false; - break; + eprosima::fastdds::statistics::StatusKind::StatusKind discriminator; + dcdr >> discriminator; + + switch (discriminator) + { + case StatusKind::PROXY: + { + std::vector entity_proxy_value; + data.entity_proxy(std::move(entity_proxy_value)); + data._d(discriminator); + break; + } + + case StatusKind::CONNECTION_LIST: + { + std::vector connection_list_value; + data.connection_list(std::move(connection_list_value)); + data._d(discriminator); + break; + } + + case StatusKind::INCOMPATIBLE_QOS: + { + eprosima::fastdds::statistics::IncompatibleQoSStatus_s incompatible_qos_status_value; + data.incompatible_qos_status(std::move(incompatible_qos_status_value)); + data._d(discriminator); + break; + } + + case StatusKind::INCONSISTENT_TOPIC: + { + eprosima::fastdds::statistics::InconsistentTopicStatus_s inconsistent_topic_status_value; + data.inconsistent_topic_status(std::move(inconsistent_topic_status_value)); + data._d(discriminator); + break; + } + + case StatusKind::LIVELINESS_LOST: + { + eprosima::fastdds::statistics::LivelinessLostStatus_s liveliness_lost_status_value; + data.liveliness_lost_status(std::move(liveliness_lost_status_value)); + data._d(discriminator); + break; + } + + case StatusKind::LIVELINESS_CHANGED: + { + eprosima::fastdds::statistics::LivelinessChangedStatus_s liveliness_changed_status_value; + data.liveliness_changed_status(std::move(liveliness_changed_status_value)); + data._d(discriminator); + break; + } + + case StatusKind::DEADLINE_MISSED: + { + eprosima::fastdds::statistics::DeadlineMissedStatus_s deadline_missed_status_value; + data.deadline_missed_status(std::move(deadline_missed_status_value)); + data._d(discriminator); + break; + } + + case StatusKind::SAMPLE_LOST: + { + eprosima::fastdds::statistics::SampleLostStatus_s sample_lost_status_value; + data.sample_lost_status(std::move(sample_lost_status_value)); + data._d(discriminator); + break; + } + + case StatusKind::STATUSES_SIZE: + { + uint8_t statuses_size_value{0}; + data.statuses_size(std::move(statuses_size_value)); + data._d(discriminator); + break; + } + + default: + data._default(); + break; + } + } + else + { + switch (data._d()) + { + case StatusKind::PROXY: + dcdr >> data.entity_proxy(); + break; + + case StatusKind::CONNECTION_LIST: + dcdr >> data.connection_list(); + break; + + case StatusKind::INCOMPATIBLE_QOS: + dcdr >> data.incompatible_qos_status(); + break; + + case StatusKind::INCONSISTENT_TOPIC: + dcdr >> data.inconsistent_topic_status(); + break; + + case StatusKind::LIVELINESS_LOST: + dcdr >> data.liveliness_lost_status(); + break; + + case StatusKind::LIVELINESS_CHANGED: + dcdr >> data.liveliness_changed_status(); + break; + + case StatusKind::DEADLINE_MISSED: + dcdr >> data.deadline_missed_status(); + break; + + case StatusKind::SAMPLE_LOST: + dcdr >> data.sample_lost_status(); + break; + + case StatusKind::STATUSES_SIZE: + dcdr >> data.statuses_size(); + break; + + default: + break; + } + ret_value = false; } return ret_value; }); } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -937,23 +1028,26 @@ void serialize_key( const eprosima::fastdds::statistics::MonitorServiceStatusData& data) { using namespace eprosima::fastdds::statistics; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GUID_s& data); - static_cast(scdr); - static_cast(data); - scdr << data.local_entity(); - scdr << data.status_kind(); -} + static_cast(scdr); + static_cast(data); + serialize_key(scdr, data.local_entity()); + scdr << data.status_kind(); +} } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPESCDRAUX_IPP diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_typesPubSubTypes.cxx b/include/fastdds_statistics_backend/topic_types/monitorservice_typesPubSubTypes.cxx index f43bd3147..1351597f5 100644 --- a/include/fastdds_statistics_backend/topic_types/monitorservice_typesPubSubTypes.cxx +++ b/include/fastdds_statistics_backend/topic_types/monitorservice_typesPubSubTypes.cxx @@ -19,68 +19,59 @@ * This file was generated by the tool fastddsgen. */ +#include "monitorservice_typesPubSubTypes.hpp" +#include #include -#include "monitorservice_typesPubSubTypes.h" #include "monitorservice_typesCdrAux.hpp" +#include "monitorservice_typesTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; namespace eprosima { namespace fastdds { namespace statistics { - - - - ConnectionPubSubType::ConnectionPubSubType() { - setName("eprosima::fastdds::statistics::Connection"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(Connection::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_Connection_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::Connection"); + uint32_t type_size = eprosima_fastdds_statistics_Connection_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_Connection_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_Connection_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_Connection_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_Connection_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } ConnectionPubSubType::~ConnectionPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool ConnectionPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - Connection* p_type = static_cast(data); + const Connection* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -95,16 +86,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool ConnectionPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -113,18 +100,14 @@ namespace eprosima { Connection* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -137,140 +120,139 @@ namespace eprosima { return true; } - std::function ConnectionPubSubType::getSerializedSizeProvider( - void* data, + uint32_t ConnectionPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* ConnectionPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* ConnectionPubSubType::create_data() { return reinterpret_cast(new Connection()); } - void ConnectionPubSubType::deleteData( + void ConnectionPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool ConnectionPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool ConnectionPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + Connection data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool ConnectionPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - Connection* p_type = static_cast(data); + const Connection* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_Connection_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_Connection_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void ConnectionPubSubType::register_type_object_representation() + { + register_Connection_type_identifier(type_identifiers_); + } QosPolicyCount_sPubSubType::QosPolicyCount_sPubSubType() { - setName("eprosima::fastdds::statistics::QosPolicyCount_s"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(QosPolicyCount_s::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_QosPolicyCount_s_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::QosPolicyCount_s"); + uint32_t type_size = eprosima_fastdds_statistics_QosPolicyCount_s_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_QosPolicyCount_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_QosPolicyCount_s_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_QosPolicyCount_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_QosPolicyCount_s_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } QosPolicyCount_sPubSubType::~QosPolicyCount_sPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool QosPolicyCount_sPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - QosPolicyCount_s* p_type = static_cast(data); + const QosPolicyCount_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -285,16 +267,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool QosPolicyCount_sPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -303,18 +281,14 @@ namespace eprosima { QosPolicyCount_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -327,140 +301,139 @@ namespace eprosima { return true; } - std::function QosPolicyCount_sPubSubType::getSerializedSizeProvider( - void* data, + uint32_t QosPolicyCount_sPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* QosPolicyCount_sPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* QosPolicyCount_sPubSubType::create_data() { return reinterpret_cast(new QosPolicyCount_s()); } - void QosPolicyCount_sPubSubType::deleteData( + void QosPolicyCount_sPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool QosPolicyCount_sPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool QosPolicyCount_sPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - QosPolicyCount_s* p_type = static_cast(data); + QosPolicyCount_s data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool QosPolicyCount_sPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + const QosPolicyCount_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_QosPolicyCount_s_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_QosPolicyCount_s_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void QosPolicyCount_sPubSubType::register_type_object_representation() + { + register_QosPolicyCount_s_type_identifier(type_identifiers_); + } BaseStatus_sPubSubType::BaseStatus_sPubSubType() { - setName("eprosima::fastdds::statistics::BaseStatus_s"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(BaseStatus_s::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_BaseStatus_s_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::BaseStatus_s"); + uint32_t type_size = eprosima_fastdds_statistics_BaseStatus_s_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_BaseStatus_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_BaseStatus_s_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_BaseStatus_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_BaseStatus_s_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } BaseStatus_sPubSubType::~BaseStatus_sPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool BaseStatus_sPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - BaseStatus_s* p_type = static_cast(data); + const BaseStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -475,16 +448,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool BaseStatus_sPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -493,18 +462,14 @@ namespace eprosima { BaseStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -517,144 +482,140 @@ namespace eprosima { return true; } - std::function BaseStatus_sPubSubType::getSerializedSizeProvider( - void* data, + uint32_t BaseStatus_sPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* BaseStatus_sPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* BaseStatus_sPubSubType::create_data() { return reinterpret_cast(new BaseStatus_s()); } - void BaseStatus_sPubSubType::deleteData( + void BaseStatus_sPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool BaseStatus_sPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool BaseStatus_sPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - BaseStatus_s* p_type = static_cast(data); + BaseStatus_s data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool BaseStatus_sPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + const BaseStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_BaseStatus_s_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_BaseStatus_s_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - - - - + void BaseStatus_sPubSubType::register_type_object_representation() + { + register_BaseStatus_s_type_identifier(type_identifiers_); + } IncompatibleQoSStatus_sPubSubType::IncompatibleQoSStatus_sPubSubType() { - setName("eprosima::fastdds::statistics::IncompatibleQoSStatus_s"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(IncompatibleQoSStatus_s::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::IncompatibleQoSStatus_s"); + uint32_t type_size = eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } IncompatibleQoSStatus_sPubSubType::~IncompatibleQoSStatus_sPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool IncompatibleQoSStatus_sPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - IncompatibleQoSStatus_s* p_type = static_cast(data); + const IncompatibleQoSStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -669,16 +630,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool IncompatibleQoSStatus_sPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -687,18 +644,14 @@ namespace eprosima { IncompatibleQoSStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -711,140 +664,139 @@ namespace eprosima { return true; } - std::function IncompatibleQoSStatus_sPubSubType::getSerializedSizeProvider( - void* data, + uint32_t IncompatibleQoSStatus_sPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* IncompatibleQoSStatus_sPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* IncompatibleQoSStatus_sPubSubType::create_data() { return reinterpret_cast(new IncompatibleQoSStatus_s()); } - void IncompatibleQoSStatus_sPubSubType::deleteData( + void IncompatibleQoSStatus_sPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool IncompatibleQoSStatus_sPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool IncompatibleQoSStatus_sPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + IncompatibleQoSStatus_s data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool IncompatibleQoSStatus_sPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - IncompatibleQoSStatus_s* p_type = static_cast(data); + const IncompatibleQoSStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void IncompatibleQoSStatus_sPubSubType::register_type_object_representation() + { + register_IncompatibleQoSStatus_s_type_identifier(type_identifiers_); + } LivelinessChangedStatus_sPubSubType::LivelinessChangedStatus_sPubSubType() { - setName("eprosima::fastdds::statistics::LivelinessChangedStatus_s"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(LivelinessChangedStatus_s::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_LivelinessChangedStatus_s_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::LivelinessChangedStatus_s"); + uint32_t type_size = eprosima_fastdds_statistics_LivelinessChangedStatus_s_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_LivelinessChangedStatus_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_LivelinessChangedStatus_s_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_LivelinessChangedStatus_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_LivelinessChangedStatus_s_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } LivelinessChangedStatus_sPubSubType::~LivelinessChangedStatus_sPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool LivelinessChangedStatus_sPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - LivelinessChangedStatus_s* p_type = static_cast(data); + const LivelinessChangedStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -859,16 +811,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool LivelinessChangedStatus_sPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -877,18 +825,14 @@ namespace eprosima { LivelinessChangedStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -901,140 +845,139 @@ namespace eprosima { return true; } - std::function LivelinessChangedStatus_sPubSubType::getSerializedSizeProvider( - void* data, + uint32_t LivelinessChangedStatus_sPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* LivelinessChangedStatus_sPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* LivelinessChangedStatus_sPubSubType::create_data() { return reinterpret_cast(new LivelinessChangedStatus_s()); } - void LivelinessChangedStatus_sPubSubType::deleteData( + void LivelinessChangedStatus_sPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool LivelinessChangedStatus_sPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool LivelinessChangedStatus_sPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + LivelinessChangedStatus_s data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool LivelinessChangedStatus_sPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - LivelinessChangedStatus_s* p_type = static_cast(data); + const LivelinessChangedStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_LivelinessChangedStatus_s_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_LivelinessChangedStatus_s_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void LivelinessChangedStatus_sPubSubType::register_type_object_representation() + { + register_LivelinessChangedStatus_s_type_identifier(type_identifiers_); + } DeadlineMissedStatus_sPubSubType::DeadlineMissedStatus_sPubSubType() { - setName("eprosima::fastdds::statistics::DeadlineMissedStatus_s"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(DeadlineMissedStatus_s::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::DeadlineMissedStatus_s"); + uint32_t type_size = eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } DeadlineMissedStatus_sPubSubType::~DeadlineMissedStatus_sPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool DeadlineMissedStatus_sPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - DeadlineMissedStatus_s* p_type = static_cast(data); + const DeadlineMissedStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -1049,16 +992,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool DeadlineMissedStatus_sPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -1067,18 +1006,14 @@ namespace eprosima { DeadlineMissedStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -1091,151 +1026,146 @@ namespace eprosima { return true; } - std::function DeadlineMissedStatus_sPubSubType::getSerializedSizeProvider( - void* data, + uint32_t DeadlineMissedStatus_sPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* DeadlineMissedStatus_sPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* DeadlineMissedStatus_sPubSubType::create_data() { return reinterpret_cast(new DeadlineMissedStatus_s()); } - void DeadlineMissedStatus_sPubSubType::deleteData( + void DeadlineMissedStatus_sPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool DeadlineMissedStatus_sPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool DeadlineMissedStatus_sPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - DeadlineMissedStatus_s* p_type = static_cast(data); + DeadlineMissedStatus_s data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool DeadlineMissedStatus_sPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + const DeadlineMissedStatus_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } + void DeadlineMissedStatus_sPubSubType::register_type_object_representation() + { + register_DeadlineMissedStatus_s_type_identifier(type_identifiers_); + } - - - - - - - + namespace StatusKind { + } // namespace StatusKind MonitorServiceStatusDataPubSubType::MonitorServiceStatusDataPubSubType() { - setName("eprosima::fastdds::statistics::MonitorServiceStatusData"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(MonitorServiceStatusData::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_MonitorServiceStatusData_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::MonitorServiceStatusData"); + uint32_t type_size = eprosima_fastdds_statistics_MonitorServiceStatusData_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = true; - uint32_t keyLength = eprosima_fastdds_statistics_MonitorServiceStatusData_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_MonitorServiceStatusData_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = true; + uint32_t key_length = eprosima_fastdds_statistics_MonitorServiceStatusData_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_MonitorServiceStatusData_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } MonitorServiceStatusDataPubSubType::~MonitorServiceStatusDataPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool MonitorServiceStatusDataPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - MonitorServiceStatusData* p_type = static_cast(data); + const MonitorServiceStatusData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 try { @@ -1250,16 +1180,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool MonitorServiceStatusDataPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -1268,18 +1194,14 @@ namespace eprosima { MonitorServiceStatusData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -1292,99 +1214,107 @@ namespace eprosima { return true; } - std::function MonitorServiceStatusDataPubSubType::getSerializedSizeProvider( - void* data, + uint32_t MonitorServiceStatusDataPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* MonitorServiceStatusDataPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* MonitorServiceStatusDataPubSubType::create_data() { return reinterpret_cast(new MonitorServiceStatusData()); } - void MonitorServiceStatusDataPubSubType::deleteData( + void MonitorServiceStatusDataPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool MonitorServiceStatusDataPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool MonitorServiceStatusDataPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - MonitorServiceStatusData* p_type = static_cast(data); + MonitorServiceStatusData data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool MonitorServiceStatusDataPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + const MonitorServiceStatusData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_MonitorServiceStatusData_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_MonitorServiceStatusData_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } + void MonitorServiceStatusDataPubSubType::register_type_object_representation() + { + register_MonitorServiceStatusData_type_identifier(type_identifiers_); + } - } //End of namespace statistics - + } // namespace statistics - } //End of namespace fastdds + } // namespace fastdds +} // namespace eprosima -} //End of namespace eprosima +// Include auxiliary functions like for serializing/deserializing. +#include "monitorservice_typesCdrAux.ipp" diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_typesPubSubTypes.h b/include/fastdds_statistics_backend/topic_types/monitorservice_typesPubSubTypes.h deleted file mode 100644 index c5b04255e..000000000 --- a/include/fastdds_statistics_backend/topic_types/monitorservice_typesPubSubTypes.h +++ /dev/null @@ -1,695 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file monitorservice_typesPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_PUBSUBTYPES_H_ - -#include -#include -#include -#include -#include - -#include "monitorservice_types.h" - -#include "typesPubSubTypes.h" - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated monitorservice_types is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - -namespace eprosima -{ - namespace fastdds - { - namespace statistics - { - - - - - - /*! - * @brief This class represents the TopicDataType of the type Connection defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class ConnectionPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef Connection type; - - eProsima_user_DllExport ConnectionPubSubType(); - - eProsima_user_DllExport ~ConnectionPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - }; - - - - /*! - * @brief This class represents the TopicDataType of the type QosPolicyCount_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class QosPolicyCount_sPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef QosPolicyCount_s type; - - eProsima_user_DllExport QosPolicyCount_sPubSubType(); - - eProsima_user_DllExport ~QosPolicyCount_sPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - }; - - - - /*! - * @brief This class represents the TopicDataType of the type BaseStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class BaseStatus_sPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef BaseStatus_s type; - - eProsima_user_DllExport BaseStatus_sPubSubType(); - - eProsima_user_DllExport ~BaseStatus_sPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - }; - - - typedef std::vector QosPolicyCountSeq_s; - - - - /*! - * @brief This class represents the TopicDataType of the type IncompatibleQoSStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class IncompatibleQoSStatus_sPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef IncompatibleQoSStatus_s type; - - eProsima_user_DllExport IncompatibleQoSStatus_sPubSubType(); - - eProsima_user_DllExport ~IncompatibleQoSStatus_sPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - }; - - - - /*! - * @brief This class represents the TopicDataType of the type LivelinessChangedStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class LivelinessChangedStatus_sPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef LivelinessChangedStatus_s type; - - eProsima_user_DllExport LivelinessChangedStatus_sPubSubType(); - - eProsima_user_DllExport ~LivelinessChangedStatus_sPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - }; - - - - /*! - * @brief This class represents the TopicDataType of the type DeadlineMissedStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class DeadlineMissedStatus_sPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef DeadlineMissedStatus_s type; - - eProsima_user_DllExport DeadlineMissedStatus_sPubSubType(); - - eProsima_user_DllExport ~DeadlineMissedStatus_sPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - }; - typedef eprosima::fastdds::statistics::BaseStatus_s LivelinessLostStatus_s; - typedef eprosima::fastdds::statistics::BaseStatus_s InconsistentTopicStatus_s; - typedef eprosima::fastdds::statistics::BaseStatus_s SampleLostStatus_s; - - - - - - - - - /*! - * @brief This class represents the TopicDataType of the type MonitorServiceStatusData defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class MonitorServiceStatusDataPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef MonitorServiceStatusData type; - - eProsima_user_DllExport MonitorServiceStatusDataPubSubType(); - - eProsima_user_DllExport ~MonitorServiceStatusDataPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - }; - } - } -} - -#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_PUBSUBTYPES_H_ - diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_typesPubSubTypes.hpp b/include/fastdds_statistics_backend/topic_types/monitorservice_typesPubSubTypes.hpp new file mode 100644 index 000000000..a14453b5f --- /dev/null +++ b/include/fastdds_statistics_backend/topic_types/monitorservice_typesPubSubTypes.hpp @@ -0,0 +1,633 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file monitorservice_typesPubSubTypes.hpp + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_PUBSUBTYPES_HPP + +#include +#include +#include +#include +#include + +#include "monitorservice_types.hpp" + +#include "typesPubSubTypes.hpp" + +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) +#error \ + Generated monitorservice_types is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // FASTDDS_GEN_API_VER + +namespace eprosima { +namespace fastdds { +namespace statistics { + +/*! + * @brief This class represents the TopicDataType of the type Connection defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class ConnectionPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef Connection type; + + eProsima_user_DllExport ConnectionPubSubType(); + + eProsima_user_DllExport ~ConnectionPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type QosPolicyCount_s defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class QosPolicyCount_sPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef QosPolicyCount_s type; + + eProsima_user_DllExport QosPolicyCount_sPubSubType(); + + eProsima_user_DllExport ~QosPolicyCount_sPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type BaseStatus_s defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class BaseStatus_sPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef BaseStatus_s type; + + eProsima_user_DllExport BaseStatus_sPubSubType(); + + eProsima_user_DllExport ~BaseStatus_sPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; +typedef std::vector QosPolicyCountSeq_s; + +/*! + * @brief This class represents the TopicDataType of the type IncompatibleQoSStatus_s defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class IncompatibleQoSStatus_sPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef IncompatibleQoSStatus_s type; + + eProsima_user_DllExport IncompatibleQoSStatus_sPubSubType(); + + eProsima_user_DllExport ~IncompatibleQoSStatus_sPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type LivelinessChangedStatus_s defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class LivelinessChangedStatus_sPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef LivelinessChangedStatus_s type; + + eProsima_user_DllExport LivelinessChangedStatus_sPubSubType(); + + eProsima_user_DllExport ~LivelinessChangedStatus_sPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type DeadlineMissedStatus_s defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class DeadlineMissedStatus_sPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef DeadlineMissedStatus_s type; + + eProsima_user_DllExport DeadlineMissedStatus_sPubSubType(); + + eProsima_user_DllExport ~DeadlineMissedStatus_sPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; +typedef eprosima::fastdds::statistics::BaseStatus_s LivelinessLostStatus_s; +typedef eprosima::fastdds::statistics::BaseStatus_s InconsistentTopicStatus_s; +typedef eprosima::fastdds::statistics::BaseStatus_s SampleLostStatus_s; +namespace StatusKind { +typedef uint32_t StatusKind; + + + + + + + + + +} // namespace StatusKind + + +/*! + * @brief This class represents the TopicDataType of the type MonitorServiceStatusData defined by the user in the IDL file. + * @ingroup monitorservice_types + */ +class MonitorServiceStatusDataPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef MonitorServiceStatusData type; + + eProsima_user_DllExport MonitorServiceStatusDataPubSubType(); + + eProsima_user_DllExport ~MonitorServiceStatusDataPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; +} // namespace statistics +} // namespace fastdds +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_PUBSUBTYPES_HPP + diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_typesTypeObjectSupport.cxx b/include/fastdds_statistics_backend/topic_types/monitorservice_typesTypeObjectSupport.cxx new file mode 100644 index 000000000..268b97a64 --- /dev/null +++ b/include/fastdds_statistics_backend/topic_types/monitorservice_typesTypeObjectSupport.cxx @@ -0,0 +1,1665 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file monitorservice_typesTypeObjectSupport.cxx + * Source file containing the implementation to register the TypeObject representation of the described types in the IDL file + * + * This file was generated by the tool fastddsgen. + */ + +#include "monitorservice_typesTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "monitorservice_types.hpp" + +#include "types.hpp" + +using namespace eprosima::fastdds::dds::xtypes; + +namespace eprosima { +namespace fastdds { +namespace statistics { +void register_ConnectionMode_type_identifier( + TypeIdentifierPair& type_ids_ConnectionMode) +{ + ReturnCode_t return_code_ConnectionMode {eprosima::fastdds::dds::RETCODE_OK}; + return_code_ConnectionMode = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::ConnectionMode", type_ids_ConnectionMode); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_ConnectionMode) + { + EnumTypeFlag enum_flags_ConnectionMode = 0; + BitBound bit_bound_ConnectionMode = 32; + CommonEnumeratedHeader common_ConnectionMode = TypeObjectUtils::build_common_enumerated_header(bit_bound_ConnectionMode); + QualifiedTypeName type_name_ConnectionMode = "eprosima::fastdds::statistics::ConnectionMode"; + eprosima::fastcdr::optional type_ann_builtin_ConnectionMode; + eprosima::fastcdr::optional ann_custom_ConnectionMode; + CompleteTypeDetail detail_ConnectionMode = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_ConnectionMode, ann_custom_ConnectionMode, type_name_ConnectionMode.to_string()); + CompleteEnumeratedHeader header_ConnectionMode = TypeObjectUtils::build_complete_enumerated_header(common_ConnectionMode, detail_ConnectionMode); + CompleteEnumeratedLiteralSeq literal_seq_ConnectionMode; + { + EnumeratedLiteralFlag flags_DATA_SHARING = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_DATA_SHARING = TypeObjectUtils::build_common_enumerated_literal(0, flags_DATA_SHARING); + eprosima::fastcdr::optional member_ann_builtin_DATA_SHARING; + ann_custom_ConnectionMode.reset(); + MemberName name_DATA_SHARING = "DATA_SHARING"; + CompleteMemberDetail detail_DATA_SHARING = TypeObjectUtils::build_complete_member_detail(name_DATA_SHARING, member_ann_builtin_DATA_SHARING, ann_custom_ConnectionMode); + CompleteEnumeratedLiteral literal_DATA_SHARING = TypeObjectUtils::build_complete_enumerated_literal(common_DATA_SHARING, detail_DATA_SHARING); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ConnectionMode, literal_DATA_SHARING); + } + { + EnumeratedLiteralFlag flags_INTRAPROCESS = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_INTRAPROCESS = TypeObjectUtils::build_common_enumerated_literal(1, flags_INTRAPROCESS); + eprosima::fastcdr::optional member_ann_builtin_INTRAPROCESS; + ann_custom_ConnectionMode.reset(); + MemberName name_INTRAPROCESS = "INTRAPROCESS"; + CompleteMemberDetail detail_INTRAPROCESS = TypeObjectUtils::build_complete_member_detail(name_INTRAPROCESS, member_ann_builtin_INTRAPROCESS, ann_custom_ConnectionMode); + CompleteEnumeratedLiteral literal_INTRAPROCESS = TypeObjectUtils::build_complete_enumerated_literal(common_INTRAPROCESS, detail_INTRAPROCESS); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ConnectionMode, literal_INTRAPROCESS); + } + { + EnumeratedLiteralFlag flags_TRANSPORT = TypeObjectUtils::build_enumerated_literal_flag(false); + CommonEnumeratedLiteral common_TRANSPORT = TypeObjectUtils::build_common_enumerated_literal(2, flags_TRANSPORT); + eprosima::fastcdr::optional member_ann_builtin_TRANSPORT; + ann_custom_ConnectionMode.reset(); + MemberName name_TRANSPORT = "TRANSPORT"; + CompleteMemberDetail detail_TRANSPORT = TypeObjectUtils::build_complete_member_detail(name_TRANSPORT, member_ann_builtin_TRANSPORT, ann_custom_ConnectionMode); + CompleteEnumeratedLiteral literal_TRANSPORT = TypeObjectUtils::build_complete_enumerated_literal(common_TRANSPORT, detail_TRANSPORT); + TypeObjectUtils::add_complete_enumerated_literal(literal_seq_ConnectionMode, literal_TRANSPORT); + } + CompleteEnumeratedType enumerated_type_ConnectionMode = TypeObjectUtils::build_complete_enumerated_type(enum_flags_ConnectionMode, header_ConnectionMode, + literal_seq_ConnectionMode); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_enumerated_type_object(enumerated_type_ConnectionMode, type_name_ConnectionMode.to_string(), type_ids_ConnectionMode)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::ConnectionMode already registered in TypeObjectRegistry for a different type."); + } + } +}// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_Connection_type_identifier( + TypeIdentifierPair& type_ids_Connection) +{ + + ReturnCode_t return_code_Connection {eprosima::fastdds::dds::RETCODE_OK}; + return_code_Connection = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::Connection", type_ids_Connection); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Connection) + { + StructTypeFlag struct_flags_Connection = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_Connection = "eprosima::fastdds::statistics::Connection"; + eprosima::fastcdr::optional type_ann_builtin_Connection; + eprosima::fastcdr::optional ann_custom_Connection; + CompleteTypeDetail detail_Connection = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Connection, ann_custom_Connection, type_name_Connection.to_string()); + CompleteStructHeader header_Connection; + header_Connection = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Connection); + CompleteStructMemberSeq member_seq_Connection; + { + TypeIdentifierPair type_ids_mode; + ReturnCode_t return_code_mode {eprosima::fastdds::dds::RETCODE_OK}; + return_code_mode = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::ConnectionMode", type_ids_mode); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_mode) + { + eprosima::fastdds::statistics::register_ConnectionMode_type_identifier(type_ids_mode); + } + StructMemberFlag member_flags_mode = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_mode = 0x00000000; + bool common_mode_ec {false}; + CommonStructMember common_mode {TypeObjectUtils::build_common_struct_member(member_id_mode, member_flags_mode, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_mode, common_mode_ec))}; + if (!common_mode_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure mode member TypeIdentifier inconsistent."); + return; + } + MemberName name_mode = "mode"; + eprosima::fastcdr::optional member_ann_builtin_mode; + ann_custom_Connection.reset(); + CompleteMemberDetail detail_mode = TypeObjectUtils::build_complete_member_detail(name_mode, member_ann_builtin_mode, ann_custom_Connection); + CompleteStructMember member_mode = TypeObjectUtils::build_complete_struct_member(common_mode, detail_mode); + TypeObjectUtils::add_complete_struct_member(member_seq_Connection, member_mode); + } + { + TypeIdentifierPair type_ids_guid; + ReturnCode_t return_code_guid {eprosima::fastdds::dds::RETCODE_OK}; + return_code_guid = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_guid); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_guid) + { + eprosima::fastdds::statistics::detail::register_GUID_s_type_identifier(type_ids_guid); + } + StructMemberFlag member_flags_guid = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_guid = 0x00000001; + bool common_guid_ec {false}; + CommonStructMember common_guid {TypeObjectUtils::build_common_struct_member(member_id_guid, member_flags_guid, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_guid, common_guid_ec))}; + if (!common_guid_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure guid member TypeIdentifier inconsistent."); + return; + } + MemberName name_guid = "guid"; + eprosima::fastcdr::optional member_ann_builtin_guid; + ann_custom_Connection.reset(); + CompleteMemberDetail detail_guid = TypeObjectUtils::build_complete_member_detail(name_guid, member_ann_builtin_guid, ann_custom_Connection); + CompleteStructMember member_guid = TypeObjectUtils::build_complete_struct_member(common_guid, detail_guid); + TypeObjectUtils::add_complete_struct_member(member_seq_Connection, member_guid); + } + { + TypeIdentifierPair type_ids_announced_locators; + ReturnCode_t return_code_announced_locators {eprosima::fastdds::dds::RETCODE_OK}; + return_code_announced_locators = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded", type_ids_announced_locators); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_announced_locators) + { + return_code_announced_locators = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::Locator_s", type_ids_announced_locators); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_announced_locators) + { + eprosima::fastdds::statistics::detail::register_Locator_s_type_identifier(type_ids_announced_locators); + } + bool element_identifier_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_announced_locators, element_identifier_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_announced_locators.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded, element_flags_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded); + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded", type_ids_announced_locators)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_announced_locators = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_announced_locators = 0x00000002; + bool common_announced_locators_ec {false}; + CommonStructMember common_announced_locators {TypeObjectUtils::build_common_struct_member(member_id_announced_locators, member_flags_announced_locators, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_announced_locators, common_announced_locators_ec))}; + if (!common_announced_locators_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure announced_locators member TypeIdentifier inconsistent."); + return; + } + MemberName name_announced_locators = "announced_locators"; + eprosima::fastcdr::optional member_ann_builtin_announced_locators; + ann_custom_Connection.reset(); + CompleteMemberDetail detail_announced_locators = TypeObjectUtils::build_complete_member_detail(name_announced_locators, member_ann_builtin_announced_locators, ann_custom_Connection); + CompleteStructMember member_announced_locators = TypeObjectUtils::build_complete_struct_member(common_announced_locators, detail_announced_locators); + TypeObjectUtils::add_complete_struct_member(member_seq_Connection, member_announced_locators); + } + { + TypeIdentifierPair type_ids_used_locators; + ReturnCode_t return_code_used_locators {eprosima::fastdds::dds::RETCODE_OK}; + return_code_used_locators = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded", type_ids_used_locators); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_used_locators) + { + return_code_used_locators = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::Locator_s", type_ids_used_locators); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_used_locators) + { + eprosima::fastdds::statistics::detail::register_Locator_s_type_identifier(type_ids_used_locators); + } + bool element_identifier_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_used_locators, element_identifier_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_used_locators.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded, element_flags_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded); + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded", type_ids_used_locators)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_eprosima_fastdds_statistics_detail_Locator_s_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_used_locators = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_used_locators = 0x00000003; + bool common_used_locators_ec {false}; + CommonStructMember common_used_locators {TypeObjectUtils::build_common_struct_member(member_id_used_locators, member_flags_used_locators, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_used_locators, common_used_locators_ec))}; + if (!common_used_locators_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure used_locators member TypeIdentifier inconsistent."); + return; + } + MemberName name_used_locators = "used_locators"; + eprosima::fastcdr::optional member_ann_builtin_used_locators; + ann_custom_Connection.reset(); + CompleteMemberDetail detail_used_locators = TypeObjectUtils::build_complete_member_detail(name_used_locators, member_ann_builtin_used_locators, ann_custom_Connection); + CompleteStructMember member_used_locators = TypeObjectUtils::build_complete_struct_member(common_used_locators, detail_used_locators); + TypeObjectUtils::add_complete_struct_member(member_seq_Connection, member_used_locators); + } + CompleteStructType struct_type_Connection = TypeObjectUtils::build_complete_struct_type(struct_flags_Connection, header_Connection, member_seq_Connection); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_Connection, type_name_Connection.to_string(), type_ids_Connection)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::Connection already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_QosPolicyCount_s_type_identifier( + TypeIdentifierPair& type_ids_QosPolicyCount_s) +{ + + ReturnCode_t return_code_QosPolicyCount_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_QosPolicyCount_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::QosPolicyCount_s", type_ids_QosPolicyCount_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_QosPolicyCount_s) + { + StructTypeFlag struct_flags_QosPolicyCount_s = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_QosPolicyCount_s = "eprosima::fastdds::statistics::QosPolicyCount_s"; + eprosima::fastcdr::optional type_ann_builtin_QosPolicyCount_s; + eprosima::fastcdr::optional ann_custom_QosPolicyCount_s; + CompleteTypeDetail detail_QosPolicyCount_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_QosPolicyCount_s, ann_custom_QosPolicyCount_s, type_name_QosPolicyCount_s.to_string()); + CompleteStructHeader header_QosPolicyCount_s; + header_QosPolicyCount_s = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_QosPolicyCount_s); + CompleteStructMemberSeq member_seq_QosPolicyCount_s; + { + TypeIdentifierPair type_ids_policy_id; + ReturnCode_t return_code_policy_id {eprosima::fastdds::dds::RETCODE_OK}; + return_code_policy_id = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_policy_id); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_policy_id) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "policy_id Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_policy_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_policy_id = 0x00000000; + bool common_policy_id_ec {false}; + CommonStructMember common_policy_id {TypeObjectUtils::build_common_struct_member(member_id_policy_id, member_flags_policy_id, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_policy_id, common_policy_id_ec))}; + if (!common_policy_id_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure policy_id member TypeIdentifier inconsistent."); + return; + } + MemberName name_policy_id = "policy_id"; + eprosima::fastcdr::optional member_ann_builtin_policy_id; + ann_custom_QosPolicyCount_s.reset(); + CompleteMemberDetail detail_policy_id = TypeObjectUtils::build_complete_member_detail(name_policy_id, member_ann_builtin_policy_id, ann_custom_QosPolicyCount_s); + CompleteStructMember member_policy_id = TypeObjectUtils::build_complete_struct_member(common_policy_id, detail_policy_id); + TypeObjectUtils::add_complete_struct_member(member_seq_QosPolicyCount_s, member_policy_id); + } + { + TypeIdentifierPair type_ids_count; + ReturnCode_t return_code_count {eprosima::fastdds::dds::RETCODE_OK}; + return_code_count = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_count); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_count) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "count Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_count = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_count = 0x00000001; + bool common_count_ec {false}; + CommonStructMember common_count {TypeObjectUtils::build_common_struct_member(member_id_count, member_flags_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_count, common_count_ec))}; + if (!common_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure count member TypeIdentifier inconsistent."); + return; + } + MemberName name_count = "count"; + eprosima::fastcdr::optional member_ann_builtin_count; + ann_custom_QosPolicyCount_s.reset(); + CompleteMemberDetail detail_count = TypeObjectUtils::build_complete_member_detail(name_count, member_ann_builtin_count, ann_custom_QosPolicyCount_s); + CompleteStructMember member_count = TypeObjectUtils::build_complete_struct_member(common_count, detail_count); + TypeObjectUtils::add_complete_struct_member(member_seq_QosPolicyCount_s, member_count); + } + CompleteStructType struct_type_QosPolicyCount_s = TypeObjectUtils::build_complete_struct_type(struct_flags_QosPolicyCount_s, header_QosPolicyCount_s, member_seq_QosPolicyCount_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_QosPolicyCount_s, type_name_QosPolicyCount_s.to_string(), type_ids_QosPolicyCount_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::QosPolicyCount_s already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_BaseStatus_s_type_identifier( + TypeIdentifierPair& type_ids_BaseStatus_s) +{ + + ReturnCode_t return_code_BaseStatus_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_BaseStatus_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::BaseStatus_s", type_ids_BaseStatus_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_BaseStatus_s) + { + StructTypeFlag struct_flags_BaseStatus_s = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_BaseStatus_s = "eprosima::fastdds::statistics::BaseStatus_s"; + eprosima::fastcdr::optional type_ann_builtin_BaseStatus_s; + eprosima::fastcdr::optional ann_custom_BaseStatus_s; + CompleteTypeDetail detail_BaseStatus_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_BaseStatus_s, ann_custom_BaseStatus_s, type_name_BaseStatus_s.to_string()); + CompleteStructHeader header_BaseStatus_s; + header_BaseStatus_s = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_BaseStatus_s); + CompleteStructMemberSeq member_seq_BaseStatus_s; + { + TypeIdentifierPair type_ids_total_count; + ReturnCode_t return_code_total_count {eprosima::fastdds::dds::RETCODE_OK}; + return_code_total_count = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_total_count); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_total_count) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "total_count Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_total_count = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_total_count = 0x00000000; + bool common_total_count_ec {false}; + CommonStructMember common_total_count {TypeObjectUtils::build_common_struct_member(member_id_total_count, member_flags_total_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_total_count, common_total_count_ec))}; + if (!common_total_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure total_count member TypeIdentifier inconsistent."); + return; + } + MemberName name_total_count = "total_count"; + eprosima::fastcdr::optional member_ann_builtin_total_count; + ann_custom_BaseStatus_s.reset(); + CompleteMemberDetail detail_total_count = TypeObjectUtils::build_complete_member_detail(name_total_count, member_ann_builtin_total_count, ann_custom_BaseStatus_s); + CompleteStructMember member_total_count = TypeObjectUtils::build_complete_struct_member(common_total_count, detail_total_count); + TypeObjectUtils::add_complete_struct_member(member_seq_BaseStatus_s, member_total_count); + } + CompleteStructType struct_type_BaseStatus_s = TypeObjectUtils::build_complete_struct_type(struct_flags_BaseStatus_s, header_BaseStatus_s, member_seq_BaseStatus_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_BaseStatus_s, type_name_BaseStatus_s.to_string(), type_ids_BaseStatus_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::BaseStatus_s already registered in TypeObjectRegistry for a different type."); + } + } +} +void register_QosPolicyCountSeq_s_type_identifier( + TypeIdentifierPair& type_ids_QosPolicyCountSeq_s) +{ + ReturnCode_t return_code_QosPolicyCountSeq_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_QosPolicyCountSeq_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::QosPolicyCountSeq_s", type_ids_QosPolicyCountSeq_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_QosPolicyCountSeq_s) + { + AliasTypeFlag alias_flags_QosPolicyCountSeq_s = 0; + QualifiedTypeName type_name_QosPolicyCountSeq_s = "eprosima::fastdds::statistics::QosPolicyCountSeq_s"; + eprosima::fastcdr::optional type_ann_builtin_QosPolicyCountSeq_s; + eprosima::fastcdr::optional ann_custom_QosPolicyCountSeq_s; + CompleteTypeDetail detail_QosPolicyCountSeq_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_QosPolicyCountSeq_s, ann_custom_QosPolicyCountSeq_s, type_name_QosPolicyCountSeq_s.to_string()); + CompleteAliasHeader header_QosPolicyCountSeq_s = TypeObjectUtils::build_complete_alias_header(detail_QosPolicyCountSeq_s); + AliasMemberFlag related_flags_QosPolicyCountSeq_s = 0; + return_code_QosPolicyCountSeq_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded", type_ids_QosPolicyCountSeq_s); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_QosPolicyCountSeq_s) + { + return_code_QosPolicyCountSeq_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::QosPolicyCount_s", type_ids_QosPolicyCountSeq_s); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_QosPolicyCountSeq_s) + { + eprosima::fastdds::statistics::register_QosPolicyCount_s_type_identifier(type_ids_QosPolicyCountSeq_s); + } + bool element_identifier_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_QosPolicyCountSeq_s, element_identifier_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_QosPolicyCountSeq_s.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded, element_flags_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded); + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded", type_ids_QosPolicyCountSeq_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_eprosima_fastdds_statistics_QosPolicyCount_s_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + bool common_QosPolicyCountSeq_s_ec {false}; + CommonAliasBody common_QosPolicyCountSeq_s {TypeObjectUtils::build_common_alias_body(related_flags_QosPolicyCountSeq_s, + TypeObjectUtils::retrieve_complete_type_identifier(type_ids_QosPolicyCountSeq_s, common_QosPolicyCountSeq_s_ec))}; + if (!common_QosPolicyCountSeq_s_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "eprosima::fastdds::statistics::QosPolicyCountSeq_s related TypeIdentifier inconsistent."); + return; + } + eprosima::fastcdr::optional member_ann_builtin_QosPolicyCountSeq_s; + ann_custom_QosPolicyCountSeq_s.reset(); + CompleteAliasBody body_QosPolicyCountSeq_s = TypeObjectUtils::build_complete_alias_body(common_QosPolicyCountSeq_s, + member_ann_builtin_QosPolicyCountSeq_s, ann_custom_QosPolicyCountSeq_s); + CompleteAliasType alias_type_QosPolicyCountSeq_s = TypeObjectUtils::build_complete_alias_type(alias_flags_QosPolicyCountSeq_s, + header_QosPolicyCountSeq_s, body_QosPolicyCountSeq_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_alias_type_object(alias_type_QosPolicyCountSeq_s, + type_name_QosPolicyCountSeq_s.to_string(), type_ids_QosPolicyCountSeq_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::QosPolicyCountSeq_s already registered in TypeObjectRegistry for a different type."); + } + } +} + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_IncompatibleQoSStatus_s_type_identifier( + TypeIdentifierPair& type_ids_IncompatibleQoSStatus_s) +{ + + ReturnCode_t return_code_IncompatibleQoSStatus_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_IncompatibleQoSStatus_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::IncompatibleQoSStatus_s", type_ids_IncompatibleQoSStatus_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_IncompatibleQoSStatus_s) + { + StructTypeFlag struct_flags_IncompatibleQoSStatus_s = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_IncompatibleQoSStatus_s = "eprosima::fastdds::statistics::IncompatibleQoSStatus_s"; + eprosima::fastcdr::optional type_ann_builtin_IncompatibleQoSStatus_s; + eprosima::fastcdr::optional ann_custom_IncompatibleQoSStatus_s; + CompleteTypeDetail detail_IncompatibleQoSStatus_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_IncompatibleQoSStatus_s, ann_custom_IncompatibleQoSStatus_s, type_name_IncompatibleQoSStatus_s.to_string()); + CompleteStructHeader header_IncompatibleQoSStatus_s; + header_IncompatibleQoSStatus_s = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_IncompatibleQoSStatus_s); + CompleteStructMemberSeq member_seq_IncompatibleQoSStatus_s; + { + TypeIdentifierPair type_ids_total_count; + ReturnCode_t return_code_total_count {eprosima::fastdds::dds::RETCODE_OK}; + return_code_total_count = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_total_count); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_total_count) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "total_count Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_total_count = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_total_count = 0x00000000; + bool common_total_count_ec {false}; + CommonStructMember common_total_count {TypeObjectUtils::build_common_struct_member(member_id_total_count, member_flags_total_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_total_count, common_total_count_ec))}; + if (!common_total_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure total_count member TypeIdentifier inconsistent."); + return; + } + MemberName name_total_count = "total_count"; + eprosima::fastcdr::optional member_ann_builtin_total_count; + ann_custom_IncompatibleQoSStatus_s.reset(); + CompleteMemberDetail detail_total_count = TypeObjectUtils::build_complete_member_detail(name_total_count, member_ann_builtin_total_count, ann_custom_IncompatibleQoSStatus_s); + CompleteStructMember member_total_count = TypeObjectUtils::build_complete_struct_member(common_total_count, detail_total_count); + TypeObjectUtils::add_complete_struct_member(member_seq_IncompatibleQoSStatus_s, member_total_count); + } + { + TypeIdentifierPair type_ids_last_policy_id; + ReturnCode_t return_code_last_policy_id {eprosima::fastdds::dds::RETCODE_OK}; + return_code_last_policy_id = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_last_policy_id); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_last_policy_id) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "last_policy_id Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_last_policy_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_last_policy_id = 0x00000001; + bool common_last_policy_id_ec {false}; + CommonStructMember common_last_policy_id {TypeObjectUtils::build_common_struct_member(member_id_last_policy_id, member_flags_last_policy_id, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_last_policy_id, common_last_policy_id_ec))}; + if (!common_last_policy_id_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure last_policy_id member TypeIdentifier inconsistent."); + return; + } + MemberName name_last_policy_id = "last_policy_id"; + eprosima::fastcdr::optional member_ann_builtin_last_policy_id; + ann_custom_IncompatibleQoSStatus_s.reset(); + CompleteMemberDetail detail_last_policy_id = TypeObjectUtils::build_complete_member_detail(name_last_policy_id, member_ann_builtin_last_policy_id, ann_custom_IncompatibleQoSStatus_s); + CompleteStructMember member_last_policy_id = TypeObjectUtils::build_complete_struct_member(common_last_policy_id, detail_last_policy_id); + TypeObjectUtils::add_complete_struct_member(member_seq_IncompatibleQoSStatus_s, member_last_policy_id); + } + { + TypeIdentifierPair type_ids_policies; + ReturnCode_t return_code_policies {eprosima::fastdds::dds::RETCODE_OK}; + return_code_policies = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::QosPolicyCountSeq_s", type_ids_policies); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_policies) + { + eprosima::fastdds::statistics::register_QosPolicyCountSeq_s_type_identifier(type_ids_policies); + } + StructMemberFlag member_flags_policies = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_policies = 0x00000002; + bool common_policies_ec {false}; + CommonStructMember common_policies {TypeObjectUtils::build_common_struct_member(member_id_policies, member_flags_policies, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_policies, common_policies_ec))}; + if (!common_policies_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure policies member TypeIdentifier inconsistent."); + return; + } + MemberName name_policies = "policies"; + eprosima::fastcdr::optional member_ann_builtin_policies; + ann_custom_IncompatibleQoSStatus_s.reset(); + CompleteMemberDetail detail_policies = TypeObjectUtils::build_complete_member_detail(name_policies, member_ann_builtin_policies, ann_custom_IncompatibleQoSStatus_s); + CompleteStructMember member_policies = TypeObjectUtils::build_complete_struct_member(common_policies, detail_policies); + TypeObjectUtils::add_complete_struct_member(member_seq_IncompatibleQoSStatus_s, member_policies); + } + CompleteStructType struct_type_IncompatibleQoSStatus_s = TypeObjectUtils::build_complete_struct_type(struct_flags_IncompatibleQoSStatus_s, header_IncompatibleQoSStatus_s, member_seq_IncompatibleQoSStatus_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_IncompatibleQoSStatus_s, type_name_IncompatibleQoSStatus_s.to_string(), type_ids_IncompatibleQoSStatus_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::IncompatibleQoSStatus_s already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_LivelinessChangedStatus_s_type_identifier( + TypeIdentifierPair& type_ids_LivelinessChangedStatus_s) +{ + + ReturnCode_t return_code_LivelinessChangedStatus_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_LivelinessChangedStatus_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::LivelinessChangedStatus_s", type_ids_LivelinessChangedStatus_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_LivelinessChangedStatus_s) + { + StructTypeFlag struct_flags_LivelinessChangedStatus_s = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_LivelinessChangedStatus_s = "eprosima::fastdds::statistics::LivelinessChangedStatus_s"; + eprosima::fastcdr::optional type_ann_builtin_LivelinessChangedStatus_s; + eprosima::fastcdr::optional ann_custom_LivelinessChangedStatus_s; + CompleteTypeDetail detail_LivelinessChangedStatus_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_LivelinessChangedStatus_s, ann_custom_LivelinessChangedStatus_s, type_name_LivelinessChangedStatus_s.to_string()); + CompleteStructHeader header_LivelinessChangedStatus_s; + header_LivelinessChangedStatus_s = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_LivelinessChangedStatus_s); + CompleteStructMemberSeq member_seq_LivelinessChangedStatus_s; + { + TypeIdentifierPair type_ids_alive_count; + ReturnCode_t return_code_alive_count {eprosima::fastdds::dds::RETCODE_OK}; + return_code_alive_count = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_alive_count); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_alive_count) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "alive_count Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_alive_count = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_alive_count = 0x00000000; + bool common_alive_count_ec {false}; + CommonStructMember common_alive_count {TypeObjectUtils::build_common_struct_member(member_id_alive_count, member_flags_alive_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_alive_count, common_alive_count_ec))}; + if (!common_alive_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure alive_count member TypeIdentifier inconsistent."); + return; + } + MemberName name_alive_count = "alive_count"; + eprosima::fastcdr::optional member_ann_builtin_alive_count; + ann_custom_LivelinessChangedStatus_s.reset(); + CompleteMemberDetail detail_alive_count = TypeObjectUtils::build_complete_member_detail(name_alive_count, member_ann_builtin_alive_count, ann_custom_LivelinessChangedStatus_s); + CompleteStructMember member_alive_count = TypeObjectUtils::build_complete_struct_member(common_alive_count, detail_alive_count); + TypeObjectUtils::add_complete_struct_member(member_seq_LivelinessChangedStatus_s, member_alive_count); + } + { + TypeIdentifierPair type_ids_not_alive_count; + ReturnCode_t return_code_not_alive_count {eprosima::fastdds::dds::RETCODE_OK}; + return_code_not_alive_count = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_not_alive_count); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_not_alive_count) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "not_alive_count Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_not_alive_count = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_not_alive_count = 0x00000001; + bool common_not_alive_count_ec {false}; + CommonStructMember common_not_alive_count {TypeObjectUtils::build_common_struct_member(member_id_not_alive_count, member_flags_not_alive_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_not_alive_count, common_not_alive_count_ec))}; + if (!common_not_alive_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure not_alive_count member TypeIdentifier inconsistent."); + return; + } + MemberName name_not_alive_count = "not_alive_count"; + eprosima::fastcdr::optional member_ann_builtin_not_alive_count; + ann_custom_LivelinessChangedStatus_s.reset(); + CompleteMemberDetail detail_not_alive_count = TypeObjectUtils::build_complete_member_detail(name_not_alive_count, member_ann_builtin_not_alive_count, ann_custom_LivelinessChangedStatus_s); + CompleteStructMember member_not_alive_count = TypeObjectUtils::build_complete_struct_member(common_not_alive_count, detail_not_alive_count); + TypeObjectUtils::add_complete_struct_member(member_seq_LivelinessChangedStatus_s, member_not_alive_count); + } + { + TypeIdentifierPair type_ids_last_publication_handle; + ReturnCode_t return_code_last_publication_handle {eprosima::fastdds::dds::RETCODE_OK}; + return_code_last_publication_handle = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_uint8_t_16", type_ids_last_publication_handle); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_last_publication_handle) + { + return_code_last_publication_handle = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_byte", type_ids_last_publication_handle); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_last_publication_handle) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + bool element_identifier_anonymous_array_uint8_t_16_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_uint8_t_16 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_last_publication_handle, element_identifier_anonymous_array_uint8_t_16_ec))}; + if (!element_identifier_anonymous_array_uint8_t_16_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_uint8_t_16 = EK_COMPLETE; + if (TK_NONE == type_ids_last_publication_handle.type_identifier2()._d()) + { + equiv_kind_anonymous_array_uint8_t_16 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_uint8_t_16 = 0; + PlainCollectionHeader header_anonymous_array_uint8_t_16 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_uint8_t_16, element_flags_anonymous_array_uint8_t_16); + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(16)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_uint8_t_16, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_uint8_t_16)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_uint8_t_16", type_ids_last_publication_handle)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_uint8_t_16 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_last_publication_handle = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_last_publication_handle = 0x00000002; + bool common_last_publication_handle_ec {false}; + CommonStructMember common_last_publication_handle {TypeObjectUtils::build_common_struct_member(member_id_last_publication_handle, member_flags_last_publication_handle, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_last_publication_handle, common_last_publication_handle_ec))}; + if (!common_last_publication_handle_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure last_publication_handle member TypeIdentifier inconsistent."); + return; + } + MemberName name_last_publication_handle = "last_publication_handle"; + eprosima::fastcdr::optional member_ann_builtin_last_publication_handle; + ann_custom_LivelinessChangedStatus_s.reset(); + CompleteMemberDetail detail_last_publication_handle = TypeObjectUtils::build_complete_member_detail(name_last_publication_handle, member_ann_builtin_last_publication_handle, ann_custom_LivelinessChangedStatus_s); + CompleteStructMember member_last_publication_handle = TypeObjectUtils::build_complete_struct_member(common_last_publication_handle, detail_last_publication_handle); + TypeObjectUtils::add_complete_struct_member(member_seq_LivelinessChangedStatus_s, member_last_publication_handle); + } + CompleteStructType struct_type_LivelinessChangedStatus_s = TypeObjectUtils::build_complete_struct_type(struct_flags_LivelinessChangedStatus_s, header_LivelinessChangedStatus_s, member_seq_LivelinessChangedStatus_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_LivelinessChangedStatus_s, type_name_LivelinessChangedStatus_s.to_string(), type_ids_LivelinessChangedStatus_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::LivelinessChangedStatus_s already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_DeadlineMissedStatus_s_type_identifier( + TypeIdentifierPair& type_ids_DeadlineMissedStatus_s) +{ + + ReturnCode_t return_code_DeadlineMissedStatus_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_DeadlineMissedStatus_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::DeadlineMissedStatus_s", type_ids_DeadlineMissedStatus_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_DeadlineMissedStatus_s) + { + StructTypeFlag struct_flags_DeadlineMissedStatus_s = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_DeadlineMissedStatus_s = "eprosima::fastdds::statistics::DeadlineMissedStatus_s"; + eprosima::fastcdr::optional type_ann_builtin_DeadlineMissedStatus_s; + eprosima::fastcdr::optional ann_custom_DeadlineMissedStatus_s; + CompleteTypeDetail detail_DeadlineMissedStatus_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_DeadlineMissedStatus_s, ann_custom_DeadlineMissedStatus_s, type_name_DeadlineMissedStatus_s.to_string()); + CompleteStructHeader header_DeadlineMissedStatus_s; + header_DeadlineMissedStatus_s = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DeadlineMissedStatus_s); + CompleteStructMemberSeq member_seq_DeadlineMissedStatus_s; + { + TypeIdentifierPair type_ids_total_count; + ReturnCode_t return_code_total_count {eprosima::fastdds::dds::RETCODE_OK}; + return_code_total_count = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_total_count); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_total_count) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "total_count Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_total_count = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_total_count = 0x00000000; + bool common_total_count_ec {false}; + CommonStructMember common_total_count {TypeObjectUtils::build_common_struct_member(member_id_total_count, member_flags_total_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_total_count, common_total_count_ec))}; + if (!common_total_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure total_count member TypeIdentifier inconsistent."); + return; + } + MemberName name_total_count = "total_count"; + eprosima::fastcdr::optional member_ann_builtin_total_count; + ann_custom_DeadlineMissedStatus_s.reset(); + CompleteMemberDetail detail_total_count = TypeObjectUtils::build_complete_member_detail(name_total_count, member_ann_builtin_total_count, ann_custom_DeadlineMissedStatus_s); + CompleteStructMember member_total_count = TypeObjectUtils::build_complete_struct_member(common_total_count, detail_total_count); + TypeObjectUtils::add_complete_struct_member(member_seq_DeadlineMissedStatus_s, member_total_count); + } + { + TypeIdentifierPair type_ids_last_instance_handle; + ReturnCode_t return_code_last_instance_handle {eprosima::fastdds::dds::RETCODE_OK}; + return_code_last_instance_handle = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_uint8_t_16", type_ids_last_instance_handle); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_last_instance_handle) + { + return_code_last_instance_handle = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_byte", type_ids_last_instance_handle); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_last_instance_handle) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + bool element_identifier_anonymous_array_uint8_t_16_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_uint8_t_16 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_last_instance_handle, element_identifier_anonymous_array_uint8_t_16_ec))}; + if (!element_identifier_anonymous_array_uint8_t_16_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_uint8_t_16 = EK_COMPLETE; + if (TK_NONE == type_ids_last_instance_handle.type_identifier2()._d()) + { + equiv_kind_anonymous_array_uint8_t_16 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_uint8_t_16 = 0; + PlainCollectionHeader header_anonymous_array_uint8_t_16 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_uint8_t_16, element_flags_anonymous_array_uint8_t_16); + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(16)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_uint8_t_16, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_uint8_t_16)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_uint8_t_16", type_ids_last_instance_handle)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_uint8_t_16 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_last_instance_handle = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_last_instance_handle = 0x00000001; + bool common_last_instance_handle_ec {false}; + CommonStructMember common_last_instance_handle {TypeObjectUtils::build_common_struct_member(member_id_last_instance_handle, member_flags_last_instance_handle, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_last_instance_handle, common_last_instance_handle_ec))}; + if (!common_last_instance_handle_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure last_instance_handle member TypeIdentifier inconsistent."); + return; + } + MemberName name_last_instance_handle = "last_instance_handle"; + eprosima::fastcdr::optional member_ann_builtin_last_instance_handle; + ann_custom_DeadlineMissedStatus_s.reset(); + CompleteMemberDetail detail_last_instance_handle = TypeObjectUtils::build_complete_member_detail(name_last_instance_handle, member_ann_builtin_last_instance_handle, ann_custom_DeadlineMissedStatus_s); + CompleteStructMember member_last_instance_handle = TypeObjectUtils::build_complete_struct_member(common_last_instance_handle, detail_last_instance_handle); + TypeObjectUtils::add_complete_struct_member(member_seq_DeadlineMissedStatus_s, member_last_instance_handle); + } + CompleteStructType struct_type_DeadlineMissedStatus_s = TypeObjectUtils::build_complete_struct_type(struct_flags_DeadlineMissedStatus_s, header_DeadlineMissedStatus_s, member_seq_DeadlineMissedStatus_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_DeadlineMissedStatus_s, type_name_DeadlineMissedStatus_s.to_string(), type_ids_DeadlineMissedStatus_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::DeadlineMissedStatus_s already registered in TypeObjectRegistry for a different type."); + } + } +} +void register_LivelinessLostStatus_s_type_identifier( + TypeIdentifierPair& type_ids_LivelinessLostStatus_s) +{ + ReturnCode_t return_code_LivelinessLostStatus_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_LivelinessLostStatus_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::LivelinessLostStatus_s", type_ids_LivelinessLostStatus_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_LivelinessLostStatus_s) + { + AliasTypeFlag alias_flags_LivelinessLostStatus_s = 0; + QualifiedTypeName type_name_LivelinessLostStatus_s = "eprosima::fastdds::statistics::LivelinessLostStatus_s"; + eprosima::fastcdr::optional type_ann_builtin_LivelinessLostStatus_s; + eprosima::fastcdr::optional ann_custom_LivelinessLostStatus_s; + CompleteTypeDetail detail_LivelinessLostStatus_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_LivelinessLostStatus_s, ann_custom_LivelinessLostStatus_s, type_name_LivelinessLostStatus_s.to_string()); + CompleteAliasHeader header_LivelinessLostStatus_s = TypeObjectUtils::build_complete_alias_header(detail_LivelinessLostStatus_s); + AliasMemberFlag related_flags_LivelinessLostStatus_s = 0; + return_code_LivelinessLostStatus_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::BaseStatus_s", type_ids_LivelinessLostStatus_s); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_LivelinessLostStatus_s) + { + eprosima::fastdds::statistics::register_BaseStatus_s_type_identifier(type_ids_LivelinessLostStatus_s); + } + bool common_LivelinessLostStatus_s_ec {false}; + CommonAliasBody common_LivelinessLostStatus_s {TypeObjectUtils::build_common_alias_body(related_flags_LivelinessLostStatus_s, + TypeObjectUtils::retrieve_complete_type_identifier(type_ids_LivelinessLostStatus_s, common_LivelinessLostStatus_s_ec))}; + if (!common_LivelinessLostStatus_s_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "eprosima::fastdds::statistics::LivelinessLostStatus_s related TypeIdentifier inconsistent."); + return; + } + eprosima::fastcdr::optional member_ann_builtin_LivelinessLostStatus_s; + ann_custom_LivelinessLostStatus_s.reset(); + CompleteAliasBody body_LivelinessLostStatus_s = TypeObjectUtils::build_complete_alias_body(common_LivelinessLostStatus_s, + member_ann_builtin_LivelinessLostStatus_s, ann_custom_LivelinessLostStatus_s); + CompleteAliasType alias_type_LivelinessLostStatus_s = TypeObjectUtils::build_complete_alias_type(alias_flags_LivelinessLostStatus_s, + header_LivelinessLostStatus_s, body_LivelinessLostStatus_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_alias_type_object(alias_type_LivelinessLostStatus_s, + type_name_LivelinessLostStatus_s.to_string(), type_ids_LivelinessLostStatus_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::LivelinessLostStatus_s already registered in TypeObjectRegistry for a different type."); + } + } +} + +void register_InconsistentTopicStatus_s_type_identifier( + TypeIdentifierPair& type_ids_InconsistentTopicStatus_s) +{ + ReturnCode_t return_code_InconsistentTopicStatus_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_InconsistentTopicStatus_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::InconsistentTopicStatus_s", type_ids_InconsistentTopicStatus_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_InconsistentTopicStatus_s) + { + AliasTypeFlag alias_flags_InconsistentTopicStatus_s = 0; + QualifiedTypeName type_name_InconsistentTopicStatus_s = "eprosima::fastdds::statistics::InconsistentTopicStatus_s"; + eprosima::fastcdr::optional type_ann_builtin_InconsistentTopicStatus_s; + eprosima::fastcdr::optional ann_custom_InconsistentTopicStatus_s; + CompleteTypeDetail detail_InconsistentTopicStatus_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_InconsistentTopicStatus_s, ann_custom_InconsistentTopicStatus_s, type_name_InconsistentTopicStatus_s.to_string()); + CompleteAliasHeader header_InconsistentTopicStatus_s = TypeObjectUtils::build_complete_alias_header(detail_InconsistentTopicStatus_s); + AliasMemberFlag related_flags_InconsistentTopicStatus_s = 0; + return_code_InconsistentTopicStatus_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::BaseStatus_s", type_ids_InconsistentTopicStatus_s); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_InconsistentTopicStatus_s) + { + eprosima::fastdds::statistics::register_BaseStatus_s_type_identifier(type_ids_InconsistentTopicStatus_s); + } + bool common_InconsistentTopicStatus_s_ec {false}; + CommonAliasBody common_InconsistentTopicStatus_s {TypeObjectUtils::build_common_alias_body(related_flags_InconsistentTopicStatus_s, + TypeObjectUtils::retrieve_complete_type_identifier(type_ids_InconsistentTopicStatus_s, common_InconsistentTopicStatus_s_ec))}; + if (!common_InconsistentTopicStatus_s_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "eprosima::fastdds::statistics::InconsistentTopicStatus_s related TypeIdentifier inconsistent."); + return; + } + eprosima::fastcdr::optional member_ann_builtin_InconsistentTopicStatus_s; + ann_custom_InconsistentTopicStatus_s.reset(); + CompleteAliasBody body_InconsistentTopicStatus_s = TypeObjectUtils::build_complete_alias_body(common_InconsistentTopicStatus_s, + member_ann_builtin_InconsistentTopicStatus_s, ann_custom_InconsistentTopicStatus_s); + CompleteAliasType alias_type_InconsistentTopicStatus_s = TypeObjectUtils::build_complete_alias_type(alias_flags_InconsistentTopicStatus_s, + header_InconsistentTopicStatus_s, body_InconsistentTopicStatus_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_alias_type_object(alias_type_InconsistentTopicStatus_s, + type_name_InconsistentTopicStatus_s.to_string(), type_ids_InconsistentTopicStatus_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::InconsistentTopicStatus_s already registered in TypeObjectRegistry for a different type."); + } + } +} + +void register_SampleLostStatus_s_type_identifier( + TypeIdentifierPair& type_ids_SampleLostStatus_s) +{ + ReturnCode_t return_code_SampleLostStatus_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_SampleLostStatus_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::SampleLostStatus_s", type_ids_SampleLostStatus_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_SampleLostStatus_s) + { + AliasTypeFlag alias_flags_SampleLostStatus_s = 0; + QualifiedTypeName type_name_SampleLostStatus_s = "eprosima::fastdds::statistics::SampleLostStatus_s"; + eprosima::fastcdr::optional type_ann_builtin_SampleLostStatus_s; + eprosima::fastcdr::optional ann_custom_SampleLostStatus_s; + CompleteTypeDetail detail_SampleLostStatus_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_SampleLostStatus_s, ann_custom_SampleLostStatus_s, type_name_SampleLostStatus_s.to_string()); + CompleteAliasHeader header_SampleLostStatus_s = TypeObjectUtils::build_complete_alias_header(detail_SampleLostStatus_s); + AliasMemberFlag related_flags_SampleLostStatus_s = 0; + return_code_SampleLostStatus_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::BaseStatus_s", type_ids_SampleLostStatus_s); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_SampleLostStatus_s) + { + eprosima::fastdds::statistics::register_BaseStatus_s_type_identifier(type_ids_SampleLostStatus_s); + } + bool common_SampleLostStatus_s_ec {false}; + CommonAliasBody common_SampleLostStatus_s {TypeObjectUtils::build_common_alias_body(related_flags_SampleLostStatus_s, + TypeObjectUtils::retrieve_complete_type_identifier(type_ids_SampleLostStatus_s, common_SampleLostStatus_s_ec))}; + if (!common_SampleLostStatus_s_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "eprosima::fastdds::statistics::SampleLostStatus_s related TypeIdentifier inconsistent."); + return; + } + eprosima::fastcdr::optional member_ann_builtin_SampleLostStatus_s; + ann_custom_SampleLostStatus_s.reset(); + CompleteAliasBody body_SampleLostStatus_s = TypeObjectUtils::build_complete_alias_body(common_SampleLostStatus_s, + member_ann_builtin_SampleLostStatus_s, ann_custom_SampleLostStatus_s); + CompleteAliasType alias_type_SampleLostStatus_s = TypeObjectUtils::build_complete_alias_type(alias_flags_SampleLostStatus_s, + header_SampleLostStatus_s, body_SampleLostStatus_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_alias_type_object(alias_type_SampleLostStatus_s, + type_name_SampleLostStatus_s.to_string(), type_ids_SampleLostStatus_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::SampleLostStatus_s already registered in TypeObjectRegistry for a different type."); + } + } +} + +namespace StatusKind { +void register_StatusKind_type_identifier( + TypeIdentifierPair& type_ids_StatusKind) +{ + ReturnCode_t return_code_StatusKind {eprosima::fastdds::dds::RETCODE_OK}; + return_code_StatusKind = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::StatusKind::StatusKind", type_ids_StatusKind); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_StatusKind) + { + AliasTypeFlag alias_flags_StatusKind = 0; + QualifiedTypeName type_name_StatusKind = "eprosima::fastdds::statistics::StatusKind::StatusKind"; + eprosima::fastcdr::optional type_ann_builtin_StatusKind; + eprosima::fastcdr::optional ann_custom_StatusKind; + CompleteTypeDetail detail_StatusKind = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_StatusKind, ann_custom_StatusKind, type_name_StatusKind.to_string()); + CompleteAliasHeader header_StatusKind = TypeObjectUtils::build_complete_alias_header(detail_StatusKind); + AliasMemberFlag related_flags_StatusKind = 0; + return_code_StatusKind = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_StatusKind); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_StatusKind) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::StatusKind::StatusKind related TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + bool common_StatusKind_ec {false}; + CommonAliasBody common_StatusKind {TypeObjectUtils::build_common_alias_body(related_flags_StatusKind, + TypeObjectUtils::retrieve_complete_type_identifier(type_ids_StatusKind, common_StatusKind_ec))}; + if (!common_StatusKind_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "eprosima::fastdds::statistics::StatusKind::StatusKind related TypeIdentifier inconsistent."); + return; + } + eprosima::fastcdr::optional member_ann_builtin_StatusKind; + ann_custom_StatusKind.reset(); + CompleteAliasBody body_StatusKind = TypeObjectUtils::build_complete_alias_body(common_StatusKind, + member_ann_builtin_StatusKind, ann_custom_StatusKind); + CompleteAliasType alias_type_StatusKind = TypeObjectUtils::build_complete_alias_type(alias_flags_StatusKind, + header_StatusKind, body_StatusKind); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_alias_type_object(alias_type_StatusKind, + type_name_StatusKind.to_string(), type_ids_StatusKind)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::StatusKind::StatusKind already registered in TypeObjectRegistry for a different type."); + } + } +} + + +} // namespace StatusKind +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_MonitorServiceData_type_identifier( + TypeIdentifierPair& type_ids_MonitorServiceData) +{ + ReturnCode_t return_code_MonitorServiceData {eprosima::fastdds::dds::RETCODE_OK}; + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::MonitorServiceData", type_ids_MonitorServiceData); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + UnionTypeFlag union_flags_MonitorServiceData = TypeObjectUtils::build_union_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_MonitorServiceData = "eprosima::fastdds::statistics::MonitorServiceData"; + eprosima::fastcdr::optional type_ann_builtin_MonitorServiceData; + eprosima::fastcdr::optional ann_custom_MonitorServiceData; + CompleteTypeDetail detail_MonitorServiceData = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MonitorServiceData, ann_custom_MonitorServiceData, type_name_MonitorServiceData.to_string()); + CompleteUnionHeader header_MonitorServiceData = TypeObjectUtils::build_complete_union_header(detail_MonitorServiceData); + UnionDiscriminatorFlag member_flags_MonitorServiceData = TypeObjectUtils::build_union_discriminator_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false); + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::StatusKind::StatusKind", type_ids_MonitorServiceData); + + if (return_code_MonitorServiceData != eprosima::fastdds::dds::RETCODE_OK) + { + eprosima::fastdds::statistics::StatusKind::register_StatusKind_type_identifier(type_ids_MonitorServiceData); + } + CommonDiscriminatorMember common_MonitorServiceData; + if (EK_COMPLETE == type_ids_MonitorServiceData.type_identifier1()._d() || TK_NONE == type_ids_MonitorServiceData.type_identifier2()._d()) + { + common_MonitorServiceData = TypeObjectUtils::build_common_discriminator_member(member_flags_MonitorServiceData, type_ids_MonitorServiceData.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_MonitorServiceData.type_identifier2()._d()) + { + common_MonitorServiceData = TypeObjectUtils::build_common_discriminator_member(member_flags_MonitorServiceData, type_ids_MonitorServiceData.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::MonitorServiceData discriminator TypeIdentifier inconsistent."); + return; + } + type_ann_builtin_MonitorServiceData.reset(); + ann_custom_MonitorServiceData.reset(); + CompleteDiscriminatorMember discriminator_MonitorServiceData = TypeObjectUtils::build_complete_discriminator_member(common_MonitorServiceData, + type_ann_builtin_MonitorServiceData, ann_custom_MonitorServiceData); + CompleteUnionMemberSeq member_seq_MonitorServiceData; + { + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_uint8_t_unbounded", type_ids_MonitorServiceData); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_byte", type_ids_MonitorServiceData); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Sequence element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + bool element_identifier_anonymous_sequence_uint8_t_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_uint8_t_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MonitorServiceData, element_identifier_anonymous_sequence_uint8_t_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_uint8_t_unbounded_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_uint8_t_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_MonitorServiceData.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_uint8_t_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_uint8_t_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_uint8_t_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_uint8_t_unbounded, element_flags_anonymous_sequence_uint8_t_unbounded); + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_uint8_t_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_uint8_t_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_uint8_t_unbounded", type_ids_MonitorServiceData)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_uint8_t_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + UnionMemberFlag member_flags_entity_proxy = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_entity_proxy; + TypeObjectUtils::add_union_case_label(label_seq_entity_proxy, static_cast(StatusKind::PROXY)); + MemberId member_id_entity_proxy = 0x00000001; + bool common_entity_proxy_ec {false}; + CommonUnionMember common_entity_proxy {TypeObjectUtils::build_common_union_member(member_id_entity_proxy, + member_flags_entity_proxy, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MonitorServiceData, + common_entity_proxy_ec), label_seq_entity_proxy)}; + if (!common_entity_proxy_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union entity_proxy member TypeIdentifier inconsistent."); + return; + } + MemberName name_entity_proxy = "entity_proxy"; + eprosima::fastcdr::optional member_ann_builtin_entity_proxy; + ann_custom_MonitorServiceData.reset(); + CompleteMemberDetail detail_entity_proxy = TypeObjectUtils::build_complete_member_detail(name_entity_proxy, member_ann_builtin_entity_proxy, ann_custom_MonitorServiceData); + CompleteUnionMember member_entity_proxy = TypeObjectUtils::build_complete_union_member(common_entity_proxy, detail_entity_proxy); + TypeObjectUtils::add_complete_union_member(member_seq_MonitorServiceData, member_entity_proxy); + } + { + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded", type_ids_MonitorServiceData); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::Connection", type_ids_MonitorServiceData); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + eprosima::fastdds::statistics::register_Connection_type_identifier(type_ids_MonitorServiceData); + } + bool element_identifier_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded_ec {false}; + TypeIdentifier* element_identifier_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MonitorServiceData, element_identifier_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded_ec))}; + if (!element_identifier_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Sequence element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded = EK_COMPLETE; + if (TK_NONE == type_ids_MonitorServiceData.type_identifier2()._d()) + { + equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded = 0; + PlainCollectionHeader header_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded, element_flags_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded); + { + SBound bound = 0; + PlainSequenceSElemDefn seq_sdefn = TypeObjectUtils::build_plain_sequence_s_elem_defn(header_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded, bound, + eprosima::fastcdr::external(element_identifier_anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_sequence_type_identifier(seq_sdefn, "anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded", type_ids_MonitorServiceData)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_sequence_eprosima_fastdds_statistics_Connection_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + UnionMemberFlag member_flags_connection_list = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_connection_list; + TypeObjectUtils::add_union_case_label(label_seq_connection_list, static_cast(StatusKind::CONNECTION_LIST)); + MemberId member_id_connection_list = 0x00000002; + bool common_connection_list_ec {false}; + CommonUnionMember common_connection_list {TypeObjectUtils::build_common_union_member(member_id_connection_list, + member_flags_connection_list, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MonitorServiceData, + common_connection_list_ec), label_seq_connection_list)}; + if (!common_connection_list_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union connection_list member TypeIdentifier inconsistent."); + return; + } + MemberName name_connection_list = "connection_list"; + eprosima::fastcdr::optional member_ann_builtin_connection_list; + ann_custom_MonitorServiceData.reset(); + CompleteMemberDetail detail_connection_list = TypeObjectUtils::build_complete_member_detail(name_connection_list, member_ann_builtin_connection_list, ann_custom_MonitorServiceData); + CompleteUnionMember member_connection_list = TypeObjectUtils::build_complete_union_member(common_connection_list, detail_connection_list); + TypeObjectUtils::add_complete_union_member(member_seq_MonitorServiceData, member_connection_list); + } + { + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::IncompatibleQoSStatus_s", type_ids_MonitorServiceData); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + eprosima::fastdds::statistics::register_IncompatibleQoSStatus_s_type_identifier(type_ids_MonitorServiceData); + } + UnionMemberFlag member_flags_incompatible_qos_status = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_incompatible_qos_status; + TypeObjectUtils::add_union_case_label(label_seq_incompatible_qos_status, static_cast(StatusKind::INCOMPATIBLE_QOS)); + MemberId member_id_incompatible_qos_status = 0x00000003; + bool common_incompatible_qos_status_ec {false}; + CommonUnionMember common_incompatible_qos_status {TypeObjectUtils::build_common_union_member(member_id_incompatible_qos_status, + member_flags_incompatible_qos_status, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MonitorServiceData, + common_incompatible_qos_status_ec), label_seq_incompatible_qos_status)}; + if (!common_incompatible_qos_status_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union incompatible_qos_status member TypeIdentifier inconsistent."); + return; + } + MemberName name_incompatible_qos_status = "incompatible_qos_status"; + eprosima::fastcdr::optional member_ann_builtin_incompatible_qos_status; + ann_custom_MonitorServiceData.reset(); + CompleteMemberDetail detail_incompatible_qos_status = TypeObjectUtils::build_complete_member_detail(name_incompatible_qos_status, member_ann_builtin_incompatible_qos_status, ann_custom_MonitorServiceData); + CompleteUnionMember member_incompatible_qos_status = TypeObjectUtils::build_complete_union_member(common_incompatible_qos_status, detail_incompatible_qos_status); + TypeObjectUtils::add_complete_union_member(member_seq_MonitorServiceData, member_incompatible_qos_status); + } + { + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::InconsistentTopicStatus_s", type_ids_MonitorServiceData); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + eprosima::fastdds::statistics::register_InconsistentTopicStatus_s_type_identifier(type_ids_MonitorServiceData); + } + UnionMemberFlag member_flags_inconsistent_topic_status = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_inconsistent_topic_status; + TypeObjectUtils::add_union_case_label(label_seq_inconsistent_topic_status, static_cast(StatusKind::INCONSISTENT_TOPIC)); + MemberId member_id_inconsistent_topic_status = 0x00000004; + bool common_inconsistent_topic_status_ec {false}; + CommonUnionMember common_inconsistent_topic_status {TypeObjectUtils::build_common_union_member(member_id_inconsistent_topic_status, + member_flags_inconsistent_topic_status, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MonitorServiceData, + common_inconsistent_topic_status_ec), label_seq_inconsistent_topic_status)}; + if (!common_inconsistent_topic_status_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union inconsistent_topic_status member TypeIdentifier inconsistent."); + return; + } + MemberName name_inconsistent_topic_status = "inconsistent_topic_status"; + eprosima::fastcdr::optional member_ann_builtin_inconsistent_topic_status; + ann_custom_MonitorServiceData.reset(); + CompleteMemberDetail detail_inconsistent_topic_status = TypeObjectUtils::build_complete_member_detail(name_inconsistent_topic_status, member_ann_builtin_inconsistent_topic_status, ann_custom_MonitorServiceData); + CompleteUnionMember member_inconsistent_topic_status = TypeObjectUtils::build_complete_union_member(common_inconsistent_topic_status, detail_inconsistent_topic_status); + TypeObjectUtils::add_complete_union_member(member_seq_MonitorServiceData, member_inconsistent_topic_status); + } + { + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::LivelinessLostStatus_s", type_ids_MonitorServiceData); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + eprosima::fastdds::statistics::register_LivelinessLostStatus_s_type_identifier(type_ids_MonitorServiceData); + } + UnionMemberFlag member_flags_liveliness_lost_status = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_liveliness_lost_status; + TypeObjectUtils::add_union_case_label(label_seq_liveliness_lost_status, static_cast(StatusKind::LIVELINESS_LOST)); + MemberId member_id_liveliness_lost_status = 0x00000005; + bool common_liveliness_lost_status_ec {false}; + CommonUnionMember common_liveliness_lost_status {TypeObjectUtils::build_common_union_member(member_id_liveliness_lost_status, + member_flags_liveliness_lost_status, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MonitorServiceData, + common_liveliness_lost_status_ec), label_seq_liveliness_lost_status)}; + if (!common_liveliness_lost_status_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union liveliness_lost_status member TypeIdentifier inconsistent."); + return; + } + MemberName name_liveliness_lost_status = "liveliness_lost_status"; + eprosima::fastcdr::optional member_ann_builtin_liveliness_lost_status; + ann_custom_MonitorServiceData.reset(); + CompleteMemberDetail detail_liveliness_lost_status = TypeObjectUtils::build_complete_member_detail(name_liveliness_lost_status, member_ann_builtin_liveliness_lost_status, ann_custom_MonitorServiceData); + CompleteUnionMember member_liveliness_lost_status = TypeObjectUtils::build_complete_union_member(common_liveliness_lost_status, detail_liveliness_lost_status); + TypeObjectUtils::add_complete_union_member(member_seq_MonitorServiceData, member_liveliness_lost_status); + } + { + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::LivelinessChangedStatus_s", type_ids_MonitorServiceData); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + eprosima::fastdds::statistics::register_LivelinessChangedStatus_s_type_identifier(type_ids_MonitorServiceData); + } + UnionMemberFlag member_flags_liveliness_changed_status = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_liveliness_changed_status; + TypeObjectUtils::add_union_case_label(label_seq_liveliness_changed_status, static_cast(StatusKind::LIVELINESS_CHANGED)); + MemberId member_id_liveliness_changed_status = 0x00000006; + bool common_liveliness_changed_status_ec {false}; + CommonUnionMember common_liveliness_changed_status {TypeObjectUtils::build_common_union_member(member_id_liveliness_changed_status, + member_flags_liveliness_changed_status, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MonitorServiceData, + common_liveliness_changed_status_ec), label_seq_liveliness_changed_status)}; + if (!common_liveliness_changed_status_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union liveliness_changed_status member TypeIdentifier inconsistent."); + return; + } + MemberName name_liveliness_changed_status = "liveliness_changed_status"; + eprosima::fastcdr::optional member_ann_builtin_liveliness_changed_status; + ann_custom_MonitorServiceData.reset(); + CompleteMemberDetail detail_liveliness_changed_status = TypeObjectUtils::build_complete_member_detail(name_liveliness_changed_status, member_ann_builtin_liveliness_changed_status, ann_custom_MonitorServiceData); + CompleteUnionMember member_liveliness_changed_status = TypeObjectUtils::build_complete_union_member(common_liveliness_changed_status, detail_liveliness_changed_status); + TypeObjectUtils::add_complete_union_member(member_seq_MonitorServiceData, member_liveliness_changed_status); + } + { + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::DeadlineMissedStatus_s", type_ids_MonitorServiceData); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + eprosima::fastdds::statistics::register_DeadlineMissedStatus_s_type_identifier(type_ids_MonitorServiceData); + } + UnionMemberFlag member_flags_deadline_missed_status = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_deadline_missed_status; + TypeObjectUtils::add_union_case_label(label_seq_deadline_missed_status, static_cast(StatusKind::DEADLINE_MISSED)); + MemberId member_id_deadline_missed_status = 0x00000007; + bool common_deadline_missed_status_ec {false}; + CommonUnionMember common_deadline_missed_status {TypeObjectUtils::build_common_union_member(member_id_deadline_missed_status, + member_flags_deadline_missed_status, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MonitorServiceData, + common_deadline_missed_status_ec), label_seq_deadline_missed_status)}; + if (!common_deadline_missed_status_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union deadline_missed_status member TypeIdentifier inconsistent."); + return; + } + MemberName name_deadline_missed_status = "deadline_missed_status"; + eprosima::fastcdr::optional member_ann_builtin_deadline_missed_status; + ann_custom_MonitorServiceData.reset(); + CompleteMemberDetail detail_deadline_missed_status = TypeObjectUtils::build_complete_member_detail(name_deadline_missed_status, member_ann_builtin_deadline_missed_status, ann_custom_MonitorServiceData); + CompleteUnionMember member_deadline_missed_status = TypeObjectUtils::build_complete_union_member(common_deadline_missed_status, detail_deadline_missed_status); + TypeObjectUtils::add_complete_union_member(member_seq_MonitorServiceData, member_deadline_missed_status); + } + { + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::SampleLostStatus_s", type_ids_MonitorServiceData); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + eprosima::fastdds::statistics::register_SampleLostStatus_s_type_identifier(type_ids_MonitorServiceData); + } + UnionMemberFlag member_flags_sample_lost_status = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_sample_lost_status; + TypeObjectUtils::add_union_case_label(label_seq_sample_lost_status, static_cast(StatusKind::SAMPLE_LOST)); + MemberId member_id_sample_lost_status = 0x00000008; + bool common_sample_lost_status_ec {false}; + CommonUnionMember common_sample_lost_status {TypeObjectUtils::build_common_union_member(member_id_sample_lost_status, + member_flags_sample_lost_status, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MonitorServiceData, + common_sample_lost_status_ec), label_seq_sample_lost_status)}; + if (!common_sample_lost_status_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union sample_lost_status member TypeIdentifier inconsistent."); + return; + } + MemberName name_sample_lost_status = "sample_lost_status"; + eprosima::fastcdr::optional member_ann_builtin_sample_lost_status; + ann_custom_MonitorServiceData.reset(); + CompleteMemberDetail detail_sample_lost_status = TypeObjectUtils::build_complete_member_detail(name_sample_lost_status, member_ann_builtin_sample_lost_status, ann_custom_MonitorServiceData); + CompleteUnionMember member_sample_lost_status = TypeObjectUtils::build_complete_union_member(common_sample_lost_status, detail_sample_lost_status); + TypeObjectUtils::add_complete_union_member(member_seq_MonitorServiceData, member_sample_lost_status); + } + { + return_code_MonitorServiceData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_byte", type_ids_MonitorServiceData); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceData) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "statuses_size Union member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + UnionMemberFlag member_flags_statuses_size = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_statuses_size; + TypeObjectUtils::add_union_case_label(label_seq_statuses_size, static_cast(StatusKind::STATUSES_SIZE)); + MemberId member_id_statuses_size = 0x00000009; + bool common_statuses_size_ec {false}; + CommonUnionMember common_statuses_size {TypeObjectUtils::build_common_union_member(member_id_statuses_size, + member_flags_statuses_size, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_MonitorServiceData, + common_statuses_size_ec), label_seq_statuses_size)}; + if (!common_statuses_size_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union statuses_size member TypeIdentifier inconsistent."); + return; + } + MemberName name_statuses_size = "statuses_size"; + eprosima::fastcdr::optional member_ann_builtin_statuses_size; + ann_custom_MonitorServiceData.reset(); + CompleteMemberDetail detail_statuses_size = TypeObjectUtils::build_complete_member_detail(name_statuses_size, member_ann_builtin_statuses_size, ann_custom_MonitorServiceData); + CompleteUnionMember member_statuses_size = TypeObjectUtils::build_complete_union_member(common_statuses_size, detail_statuses_size); + TypeObjectUtils::add_complete_union_member(member_seq_MonitorServiceData, member_statuses_size); + } + CompleteUnionType union_type_MonitorServiceData = TypeObjectUtils::build_complete_union_type(union_flags_MonitorServiceData, header_MonitorServiceData, discriminator_MonitorServiceData, + member_seq_MonitorServiceData); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_union_type_object(union_type_MonitorServiceData, type_name_MonitorServiceData.to_string(), type_ids_MonitorServiceData)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::MonitorServiceData already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_MonitorServiceStatusData_type_identifier( + TypeIdentifierPair& type_ids_MonitorServiceStatusData) +{ + + ReturnCode_t return_code_MonitorServiceStatusData {eprosima::fastdds::dds::RETCODE_OK}; + return_code_MonitorServiceStatusData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::MonitorServiceStatusData", type_ids_MonitorServiceStatusData); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_MonitorServiceStatusData) + { + StructTypeFlag struct_flags_MonitorServiceStatusData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_MonitorServiceStatusData = "eprosima::fastdds::statistics::MonitorServiceStatusData"; + eprosima::fastcdr::optional type_ann_builtin_MonitorServiceStatusData; + eprosima::fastcdr::optional ann_custom_MonitorServiceStatusData; + CompleteTypeDetail detail_MonitorServiceStatusData = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_MonitorServiceStatusData, ann_custom_MonitorServiceStatusData, type_name_MonitorServiceStatusData.to_string()); + CompleteStructHeader header_MonitorServiceStatusData; + header_MonitorServiceStatusData = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_MonitorServiceStatusData); + CompleteStructMemberSeq member_seq_MonitorServiceStatusData; + { + TypeIdentifierPair type_ids_local_entity; + ReturnCode_t return_code_local_entity {eprosima::fastdds::dds::RETCODE_OK}; + return_code_local_entity = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_local_entity); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_local_entity) + { + eprosima::fastdds::statistics::detail::register_GUID_s_type_identifier(type_ids_local_entity); + } + StructMemberFlag member_flags_local_entity = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_local_entity = 0x00000000; + bool common_local_entity_ec {false}; + CommonStructMember common_local_entity {TypeObjectUtils::build_common_struct_member(member_id_local_entity, member_flags_local_entity, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_local_entity, common_local_entity_ec))}; + if (!common_local_entity_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure local_entity member TypeIdentifier inconsistent."); + return; + } + MemberName name_local_entity = "local_entity"; + eprosima::fastcdr::optional member_ann_builtin_local_entity; + ann_custom_MonitorServiceStatusData.reset(); + AppliedAnnotationSeq tmp_ann_custom_local_entity; + eprosima::fastcdr::optional unit_local_entity; + eprosima::fastcdr::optional min_local_entity; + eprosima::fastcdr::optional max_local_entity; + eprosima::fastcdr::optional hash_id_local_entity; + if (unit_local_entity.has_value() || min_local_entity.has_value() || max_local_entity.has_value() || hash_id_local_entity.has_value()) + { + member_ann_builtin_local_entity = TypeObjectUtils::build_applied_builtin_member_annotations(unit_local_entity, min_local_entity, max_local_entity, hash_id_local_entity); + } + if (!tmp_ann_custom_local_entity.empty()) + { + ann_custom_MonitorServiceStatusData = tmp_ann_custom_local_entity; + } + CompleteMemberDetail detail_local_entity = TypeObjectUtils::build_complete_member_detail(name_local_entity, member_ann_builtin_local_entity, ann_custom_MonitorServiceStatusData); + CompleteStructMember member_local_entity = TypeObjectUtils::build_complete_struct_member(common_local_entity, detail_local_entity); + TypeObjectUtils::add_complete_struct_member(member_seq_MonitorServiceStatusData, member_local_entity); + } + { + TypeIdentifierPair type_ids_status_kind; + ReturnCode_t return_code_status_kind {eprosima::fastdds::dds::RETCODE_OK}; + return_code_status_kind = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::StatusKind::StatusKind", type_ids_status_kind); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_status_kind) + { + eprosima::fastdds::statistics::StatusKind::register_StatusKind_type_identifier(type_ids_status_kind); + } + StructMemberFlag member_flags_status_kind = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_status_kind = 0x00000001; + bool common_status_kind_ec {false}; + CommonStructMember common_status_kind {TypeObjectUtils::build_common_struct_member(member_id_status_kind, member_flags_status_kind, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_status_kind, common_status_kind_ec))}; + if (!common_status_kind_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure status_kind member TypeIdentifier inconsistent."); + return; + } + MemberName name_status_kind = "status_kind"; + eprosima::fastcdr::optional member_ann_builtin_status_kind; + ann_custom_MonitorServiceStatusData.reset(); + AppliedAnnotationSeq tmp_ann_custom_status_kind; + eprosima::fastcdr::optional unit_status_kind; + eprosima::fastcdr::optional min_status_kind; + eprosima::fastcdr::optional max_status_kind; + eprosima::fastcdr::optional hash_id_status_kind; + if (unit_status_kind.has_value() || min_status_kind.has_value() || max_status_kind.has_value() || hash_id_status_kind.has_value()) + { + member_ann_builtin_status_kind = TypeObjectUtils::build_applied_builtin_member_annotations(unit_status_kind, min_status_kind, max_status_kind, hash_id_status_kind); + } + if (!tmp_ann_custom_status_kind.empty()) + { + ann_custom_MonitorServiceStatusData = tmp_ann_custom_status_kind; + } + CompleteMemberDetail detail_status_kind = TypeObjectUtils::build_complete_member_detail(name_status_kind, member_ann_builtin_status_kind, ann_custom_MonitorServiceStatusData); + CompleteStructMember member_status_kind = TypeObjectUtils::build_complete_struct_member(common_status_kind, detail_status_kind); + TypeObjectUtils::add_complete_struct_member(member_seq_MonitorServiceStatusData, member_status_kind); + } + { + TypeIdentifierPair type_ids_value; + ReturnCode_t return_code_value {eprosima::fastdds::dds::RETCODE_OK}; + return_code_value = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::MonitorServiceData", type_ids_value); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_value) + { + eprosima::fastdds::statistics::register_MonitorServiceData_type_identifier(type_ids_value); + } + StructMemberFlag member_flags_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_value = 0x00000002; + bool common_value_ec {false}; + CommonStructMember common_value {TypeObjectUtils::build_common_struct_member(member_id_value, member_flags_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_value, common_value_ec))}; + if (!common_value_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure value member TypeIdentifier inconsistent."); + return; + } + MemberName name_value = "value"; + eprosima::fastcdr::optional member_ann_builtin_value; + ann_custom_MonitorServiceStatusData.reset(); + CompleteMemberDetail detail_value = TypeObjectUtils::build_complete_member_detail(name_value, member_ann_builtin_value, ann_custom_MonitorServiceStatusData); + CompleteStructMember member_value = TypeObjectUtils::build_complete_struct_member(common_value, detail_value); + TypeObjectUtils::add_complete_struct_member(member_seq_MonitorServiceStatusData, member_value); + } + CompleteStructType struct_type_MonitorServiceStatusData = TypeObjectUtils::build_complete_struct_type(struct_flags_MonitorServiceStatusData, header_MonitorServiceStatusData, member_seq_MonitorServiceStatusData); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_MonitorServiceStatusData, type_name_MonitorServiceStatusData.to_string(), type_ids_MonitorServiceStatusData)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::MonitorServiceStatusData already registered in TypeObjectRegistry for a different type."); + } + } +} + +} // namespace statistics + +} // namespace fastdds + +} // namespace eprosima + diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_typesTypeObjectSupport.hpp b/include/fastdds_statistics_backend/topic_types/monitorservice_typesTypeObjectSupport.hpp new file mode 100644 index 000000000..9d4484ba0 --- /dev/null +++ b/include/fastdds_statistics_backend/topic_types/monitorservice_typesTypeObjectSupport.hpp @@ -0,0 +1,257 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file monitorservice_typesTypeObjectSupport.hpp + * Header file containing the API required to register the TypeObject representation of the described types in the IDL file + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_TYPE_OBJECT_SUPPORT_HPP + +#include + +#include "typesTypeObjectSupport.hpp" + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +namespace eprosima { +namespace fastdds { +namespace statistics { +/** + * @brief Register ConnectionMode related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_ConnectionMode_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register Connection related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_Connection_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register QosPolicyCount_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_QosPolicyCount_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register BaseStatus_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_BaseStatus_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register QosPolicyCountSeq_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_QosPolicyCountSeq_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + + +/** + * @brief Register IncompatibleQoSStatus_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_IncompatibleQoSStatus_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register LivelinessChangedStatus_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_LivelinessChangedStatus_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register DeadlineMissedStatus_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_DeadlineMissedStatus_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register LivelinessLostStatus_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_LivelinessLostStatus_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + + +/** + * @brief Register InconsistentTopicStatus_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_InconsistentTopicStatus_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + + +/** + * @brief Register SampleLostStatus_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_SampleLostStatus_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + + +namespace StatusKind { +/** + * @brief Register StatusKind related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_StatusKind_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + + + + + + + + + + + +} // namespace StatusKind + +/** + * @brief Register MonitorServiceData related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_MonitorServiceData_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register MonitorServiceStatusData related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_MonitorServiceStatusData_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +} // namespace statistics + +} // namespace fastdds + +} // namespace eprosima + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_TYPE_OBJECT_SUPPORT_HPP diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_typesv1.cxx b/include/fastdds_statistics_backend/topic_types/monitorservice_typesv1.cxx deleted file mode 100644 index 7341d2012..000000000 --- a/include/fastdds_statistics_backend/topic_types/monitorservice_typesv1.cxx +++ /dev/null @@ -1,3011 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file monitorservice_types.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "monitorservice_types.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define eprosima_fastdds_statistics_DiscoveryTime_max_cdr_typesize 820ULL; - -#define eprosima_fastdds_statistics_BaseStatus_s_max_cdr_typesize 8ULL; - - -#define eprosima_fastdds_statistics_detail_SampleIdentity_s_max_cdr_typesize 24ULL; - - - -#define eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_cdr_typesize 24ULL; -#define eprosima_fastdds_statistics_detail_EntityId_s_max_cdr_typesize 4ULL; -#define eprosima_fastdds_statistics_QosPolicyCount_s_max_cdr_typesize 12ULL; -#define eprosima_fastdds_statistics_detail_SequenceNumber_s_max_cdr_typesize 8ULL; - -#define eprosima_fastdds_statistics_MonitorServiceStatusData_max_cdr_typesize 484040ULL; -#define eprosima_fastdds_statistics_PhysicalData_max_cdr_typesize 796ULL; -#define eprosima_fastdds_statistics_detail_Locator_s_max_cdr_typesize 24ULL; -#define eprosima_fastdds_statistics_detail_GuidPrefix_s_max_cdr_typesize 12ULL; -#define eprosima_fastdds_statistics_EntityData_max_cdr_typesize 20ULL; -#define eprosima_fastdds_statistics_Connection_max_cdr_typesize 4840ULL; -#define eprosima_fastdds_statistics_Entity2LocatorTraffic_max_cdr_typesize 58ULL; -#define eprosima_fastdds_statistics_EntityCount_max_cdr_typesize 24ULL; -#define eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_cdr_typesize 1220ULL; - - -#define eprosima_fastdds_statistics_WriterReaderData_max_cdr_typesize 36ULL; -#define eprosima_fastdds_statistics_SampleIdentityCount_max_cdr_typesize 32ULL; -#define eprosima_fastdds_statistics_Locator2LocatorData_max_cdr_typesize 52ULL; -#define eprosima_fastdds_statistics_detail_GUID_s_max_cdr_typesize 16ULL; -#define eprosima_fastdds_statistics_LivelinessChangedStatus_s_max_cdr_typesize 28ULL; - - -namespace eprosima { - -namespace fastdds { - -namespace statistics { - - - - - -Connection::Connection() -{ - // eprosima::fastdds::statistics::ConnectionMode m_mode - m_mode = eprosima::fastdds::statistics::DATA_SHARING; - // eprosima::fastdds::statistics::detail::GUID_s m_guid - - // sequence m_announced_locators - - // sequence m_used_locators - - -} - -Connection::~Connection() -{ -} - -Connection::Connection( - const Connection& x) -{ - m_mode = x.m_mode; - - - m_guid = x.m_guid; - - - m_announced_locators = x.m_announced_locators; - - - m_used_locators = x.m_used_locators; - -} - -Connection::Connection( - Connection&& x) noexcept -{ - m_mode = x.m_mode; - - - m_guid = std::move(x.m_guid); - - - m_announced_locators = std::move(x.m_announced_locators); - - - m_used_locators = std::move(x.m_used_locators); - -} - -Connection& Connection::operator =( - const Connection& x) -{ - m_mode = x.m_mode; - - - m_guid = x.m_guid; - - - m_announced_locators = x.m_announced_locators; - - - m_used_locators = x.m_used_locators; - - return *this; -} - -Connection& Connection::operator =( - Connection&& x) noexcept -{ - m_mode = x.m_mode; - - - m_guid = std::move(x.m_guid); - - - m_announced_locators = std::move(x.m_announced_locators); - - - m_used_locators = std::move(x.m_used_locators); - - return *this; -} - -bool Connection::operator ==( - const Connection& x) const -{ - return (m_mode == x.m_mode && - m_guid == x.m_guid && - m_announced_locators == x.m_announced_locators && - m_used_locators == x.m_used_locators); -} - -bool Connection::operator !=( - const Connection& x) const -{ - return !(*this == x); -} - -size_t Connection::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_Connection_max_cdr_typesize; -} - -size_t Connection::getCdrSerializedSize( - const Connection& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += eprosima::fastdds::statistics::detail::GUID_s::getCdrSerializedSize(data.guid(), current_alignment); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.announced_locators().size(); ++a) - { - current_alignment += eprosima::fastdds::statistics::detail::Locator_s::getCdrSerializedSize(data.announced_locators().at(a), current_alignment); - } - - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.used_locators().size(); ++a) - { - current_alignment += eprosima::fastdds::statistics::detail::Locator_s::getCdrSerializedSize(data.used_locators().at(a), current_alignment); - } - - - - return current_alignment - initial_alignment; -} - - -void Connection::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << (uint32_t)m_mode; - - scdr << m_guid; - - scdr << m_announced_locators; - - - scdr << m_used_locators; - - -} - -void Connection::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - { - uint32_t enum_value = 0; - dcdr >> enum_value; - m_mode = (eprosima::fastdds::statistics::ConnectionMode)enum_value; - } - - - - dcdr >> m_guid; - - - - dcdr >> m_announced_locators; - - - - dcdr >> m_used_locators; - - -} - - -bool Connection::isKeyDefined() -{ - return false; -} - -void Connection::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member mode - * @param _mode New value for member mode - */ -void Connection::mode( - eprosima::fastdds::statistics::ConnectionMode _mode) -{ - m_mode = _mode; -} - -/*! - * @brief This function returns the value of member mode - * @return Value of member mode - */ -eprosima::fastdds::statistics::ConnectionMode Connection::mode() const -{ - return m_mode; -} - -/*! - * @brief This function returns a reference to member mode - * @return Reference to member mode - */ -eprosima::fastdds::statistics::ConnectionMode& Connection::mode() -{ - return m_mode; -} - - -/*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ -void Connection::guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid) -{ - m_guid = _guid; -} - -/*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ -void Connection::guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid) -{ - m_guid = std::move(_guid); -} - -/*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& Connection::guid() const -{ - return m_guid; -} - -/*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ -eprosima::fastdds::statistics::detail::GUID_s& Connection::guid() -{ - return m_guid; -} - - -/*! - * @brief This function copies the value in member announced_locators - * @param _announced_locators New value to be copied in member announced_locators - */ -void Connection::announced_locators( - const std::vector& _announced_locators) -{ - m_announced_locators = _announced_locators; -} - -/*! - * @brief This function moves the value in member announced_locators - * @param _announced_locators New value to be moved in member announced_locators - */ -void Connection::announced_locators( - std::vector&& _announced_locators) -{ - m_announced_locators = std::move(_announced_locators); -} - -/*! - * @brief This function returns a constant reference to member announced_locators - * @return Constant reference to member announced_locators - */ -const std::vector& Connection::announced_locators() const -{ - return m_announced_locators; -} - -/*! - * @brief This function returns a reference to member announced_locators - * @return Reference to member announced_locators - */ -std::vector& Connection::announced_locators() -{ - return m_announced_locators; -} - - -/*! - * @brief This function copies the value in member used_locators - * @param _used_locators New value to be copied in member used_locators - */ -void Connection::used_locators( - const std::vector& _used_locators) -{ - m_used_locators = _used_locators; -} - -/*! - * @brief This function moves the value in member used_locators - * @param _used_locators New value to be moved in member used_locators - */ -void Connection::used_locators( - std::vector&& _used_locators) -{ - m_used_locators = std::move(_used_locators); -} - -/*! - * @brief This function returns a constant reference to member used_locators - * @return Constant reference to member used_locators - */ -const std::vector& Connection::used_locators() const -{ - return m_used_locators; -} - -/*! - * @brief This function returns a reference to member used_locators - * @return Reference to member used_locators - */ -std::vector& Connection::used_locators() -{ - return m_used_locators; -} - - - - - -QosPolicyCount_s::QosPolicyCount_s() -{ - // unsigned long m_policy_id - m_policy_id = 0; - // unsigned long m_count - m_count = 0; - -} - -QosPolicyCount_s::~QosPolicyCount_s() -{ -} - -QosPolicyCount_s::QosPolicyCount_s( - const QosPolicyCount_s& x) -{ - m_policy_id = x.m_policy_id; - - - m_count = x.m_count; - -} - -QosPolicyCount_s::QosPolicyCount_s( - QosPolicyCount_s&& x) noexcept -{ - m_policy_id = x.m_policy_id; - - - m_count = x.m_count; - -} - -QosPolicyCount_s& QosPolicyCount_s::operator =( - const QosPolicyCount_s& x) -{ - m_policy_id = x.m_policy_id; - - - m_count = x.m_count; - - return *this; -} - -QosPolicyCount_s& QosPolicyCount_s::operator =( - QosPolicyCount_s&& x) noexcept -{ - m_policy_id = x.m_policy_id; - - - m_count = x.m_count; - - return *this; -} - -bool QosPolicyCount_s::operator ==( - const QosPolicyCount_s& x) const -{ - return (m_policy_id == x.m_policy_id && - m_count == x.m_count); -} - -bool QosPolicyCount_s::operator !=( - const QosPolicyCount_s& x) const -{ - return !(*this == x); -} - -size_t QosPolicyCount_s::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_QosPolicyCount_s_max_cdr_typesize; -} - -size_t QosPolicyCount_s::getCdrSerializedSize( - const QosPolicyCount_s& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - return current_alignment - initial_alignment; -} - - -void QosPolicyCount_s::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_policy_id; - - scdr << m_count; - -} - -void QosPolicyCount_s::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_policy_id; - - - - dcdr >> m_count; - - -} - - -bool QosPolicyCount_s::isKeyDefined() -{ - return false; -} - -void QosPolicyCount_s::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member policy_id - * @param _policy_id New value for member policy_id - */ -void QosPolicyCount_s::policy_id( - uint32_t _policy_id) -{ - m_policy_id = _policy_id; -} - -/*! - * @brief This function returns the value of member policy_id - * @return Value of member policy_id - */ -uint32_t QosPolicyCount_s::policy_id() const -{ - return m_policy_id; -} - -/*! - * @brief This function returns a reference to member policy_id - * @return Reference to member policy_id - */ -uint32_t& QosPolicyCount_s::policy_id() -{ - return m_policy_id; -} - - -/*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ -void QosPolicyCount_s::count( - uint32_t _count) -{ - m_count = _count; -} - -/*! - * @brief This function returns the value of member count - * @return Value of member count - */ -uint32_t QosPolicyCount_s::count() const -{ - return m_count; -} - -/*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ -uint32_t& QosPolicyCount_s::count() -{ - return m_count; -} - - - - - -BaseStatus_s::BaseStatus_s() -{ - // unsigned long m_total_count - m_total_count = 0; - -} - -BaseStatus_s::~BaseStatus_s() -{ -} - -BaseStatus_s::BaseStatus_s( - const BaseStatus_s& x) -{ - m_total_count = x.m_total_count; - -} - -BaseStatus_s::BaseStatus_s( - BaseStatus_s&& x) noexcept -{ - m_total_count = x.m_total_count; - -} - -BaseStatus_s& BaseStatus_s::operator =( - const BaseStatus_s& x) -{ - m_total_count = x.m_total_count; - - return *this; -} - -BaseStatus_s& BaseStatus_s::operator =( - BaseStatus_s&& x) noexcept -{ - m_total_count = x.m_total_count; - - return *this; -} - -bool BaseStatus_s::operator ==( - const BaseStatus_s& x) const -{ - return (m_total_count == x.m_total_count); -} - -bool BaseStatus_s::operator !=( - const BaseStatus_s& x) const -{ - return !(*this == x); -} - -size_t BaseStatus_s::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_BaseStatus_s_max_cdr_typesize; -} - -size_t BaseStatus_s::getCdrSerializedSize( - const BaseStatus_s& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - return current_alignment - initial_alignment; -} - - -void BaseStatus_s::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_total_count; - -} - -void BaseStatus_s::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_total_count; - - -} - - -bool BaseStatus_s::isKeyDefined() -{ - return false; -} - -void BaseStatus_s::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ -void BaseStatus_s::total_count( - uint32_t _total_count) -{ - m_total_count = _total_count; -} - -/*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ -uint32_t BaseStatus_s::total_count() const -{ - return m_total_count; -} - -/*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ -uint32_t& BaseStatus_s::total_count() -{ - return m_total_count; -} - - - - - - - - -IncompatibleQoSStatus_s::IncompatibleQoSStatus_s() -{ - // unsigned long m_total_count - m_total_count = 0; - // unsigned long m_last_policy_id - m_last_policy_id = 0; - // eprosima::fastdds::statistics::QosPolicyCountSeq_s m_policies - - -} - -IncompatibleQoSStatus_s::~IncompatibleQoSStatus_s() -{ -} - -IncompatibleQoSStatus_s::IncompatibleQoSStatus_s( - const IncompatibleQoSStatus_s& x) -{ - m_total_count = x.m_total_count; - - - m_last_policy_id = x.m_last_policy_id; - - - m_policies = x.m_policies; - -} - -IncompatibleQoSStatus_s::IncompatibleQoSStatus_s( - IncompatibleQoSStatus_s&& x) noexcept -{ - m_total_count = x.m_total_count; - - - m_last_policy_id = x.m_last_policy_id; - - - m_policies = std::move(x.m_policies); - -} - -IncompatibleQoSStatus_s& IncompatibleQoSStatus_s::operator =( - const IncompatibleQoSStatus_s& x) -{ - m_total_count = x.m_total_count; - - - m_last_policy_id = x.m_last_policy_id; - - - m_policies = x.m_policies; - - return *this; -} - -IncompatibleQoSStatus_s& IncompatibleQoSStatus_s::operator =( - IncompatibleQoSStatus_s&& x) noexcept -{ - m_total_count = x.m_total_count; - - - m_last_policy_id = x.m_last_policy_id; - - - m_policies = std::move(x.m_policies); - - return *this; -} - -bool IncompatibleQoSStatus_s::operator ==( - const IncompatibleQoSStatus_s& x) const -{ - return (m_total_count == x.m_total_count && - m_last_policy_id == x.m_last_policy_id && - m_policies == x.m_policies); -} - -bool IncompatibleQoSStatus_s::operator !=( - const IncompatibleQoSStatus_s& x) const -{ - return !(*this == x); -} - -size_t IncompatibleQoSStatus_s::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_IncompatibleQoSStatus_s_max_cdr_typesize; -} - -size_t IncompatibleQoSStatus_s::getCdrSerializedSize( - const IncompatibleQoSStatus_s& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.policies().size(); ++a) - { - current_alignment += eprosima::fastdds::statistics::QosPolicyCount_s::getCdrSerializedSize(data.policies().at(a), current_alignment); - } - - - - return current_alignment - initial_alignment; -} - - -void IncompatibleQoSStatus_s::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_total_count; - - scdr << m_last_policy_id; - - scdr << m_policies; - - -} - -void IncompatibleQoSStatus_s::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_total_count; - - - - dcdr >> m_last_policy_id; - - - - dcdr >> m_policies; - - -} - - -bool IncompatibleQoSStatus_s::isKeyDefined() -{ - return false; -} - -void IncompatibleQoSStatus_s::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ -void IncompatibleQoSStatus_s::total_count( - uint32_t _total_count) -{ - m_total_count = _total_count; -} - -/*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ -uint32_t IncompatibleQoSStatus_s::total_count() const -{ - return m_total_count; -} - -/*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ -uint32_t& IncompatibleQoSStatus_s::total_count() -{ - return m_total_count; -} - - -/*! - * @brief This function sets a value in member last_policy_id - * @param _last_policy_id New value for member last_policy_id - */ -void IncompatibleQoSStatus_s::last_policy_id( - uint32_t _last_policy_id) -{ - m_last_policy_id = _last_policy_id; -} - -/*! - * @brief This function returns the value of member last_policy_id - * @return Value of member last_policy_id - */ -uint32_t IncompatibleQoSStatus_s::last_policy_id() const -{ - return m_last_policy_id; -} - -/*! - * @brief This function returns a reference to member last_policy_id - * @return Reference to member last_policy_id - */ -uint32_t& IncompatibleQoSStatus_s::last_policy_id() -{ - return m_last_policy_id; -} - - -/*! - * @brief This function copies the value in member policies - * @param _policies New value to be copied in member policies - */ -void IncompatibleQoSStatus_s::policies( - const eprosima::fastdds::statistics::QosPolicyCountSeq_s& _policies) -{ - m_policies = _policies; -} - -/*! - * @brief This function moves the value in member policies - * @param _policies New value to be moved in member policies - */ -void IncompatibleQoSStatus_s::policies( - eprosima::fastdds::statistics::QosPolicyCountSeq_s&& _policies) -{ - m_policies = std::move(_policies); -} - -/*! - * @brief This function returns a constant reference to member policies - * @return Constant reference to member policies - */ -const eprosima::fastdds::statistics::QosPolicyCountSeq_s& IncompatibleQoSStatus_s::policies() const -{ - return m_policies; -} - -/*! - * @brief This function returns a reference to member policies - * @return Reference to member policies - */ -eprosima::fastdds::statistics::QosPolicyCountSeq_s& IncompatibleQoSStatus_s::policies() -{ - return m_policies; -} - - - - - -LivelinessChangedStatus_s::LivelinessChangedStatus_s() -{ - // unsigned long m_alive_count - m_alive_count = 0; - // unsigned long m_not_alive_count - m_not_alive_count = 0; - // octet m_last_publication_handle - memset(&m_last_publication_handle, 0, ((16)) * 1); - -} - -LivelinessChangedStatus_s::~LivelinessChangedStatus_s() -{ -} - -LivelinessChangedStatus_s::LivelinessChangedStatus_s( - const LivelinessChangedStatus_s& x) -{ - m_alive_count = x.m_alive_count; - - - m_not_alive_count = x.m_not_alive_count; - - - m_last_publication_handle = x.m_last_publication_handle; - -} - -LivelinessChangedStatus_s::LivelinessChangedStatus_s( - LivelinessChangedStatus_s&& x) noexcept -{ - m_alive_count = x.m_alive_count; - - - m_not_alive_count = x.m_not_alive_count; - - - m_last_publication_handle = std::move(x.m_last_publication_handle); - -} - -LivelinessChangedStatus_s& LivelinessChangedStatus_s::operator =( - const LivelinessChangedStatus_s& x) -{ - m_alive_count = x.m_alive_count; - - - m_not_alive_count = x.m_not_alive_count; - - - m_last_publication_handle = x.m_last_publication_handle; - - return *this; -} - -LivelinessChangedStatus_s& LivelinessChangedStatus_s::operator =( - LivelinessChangedStatus_s&& x) noexcept -{ - m_alive_count = x.m_alive_count; - - - m_not_alive_count = x.m_not_alive_count; - - - m_last_publication_handle = std::move(x.m_last_publication_handle); - - return *this; -} - -bool LivelinessChangedStatus_s::operator ==( - const LivelinessChangedStatus_s& x) const -{ - return (m_alive_count == x.m_alive_count && - m_not_alive_count == x.m_not_alive_count && - m_last_publication_handle == x.m_last_publication_handle); -} - -bool LivelinessChangedStatus_s::operator !=( - const LivelinessChangedStatus_s& x) const -{ - return !(*this == x); -} - -size_t LivelinessChangedStatus_s::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_LivelinessChangedStatus_s_max_cdr_typesize; -} - -size_t LivelinessChangedStatus_s::getCdrSerializedSize( - const LivelinessChangedStatus_s& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += (((16)) * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - - return current_alignment - initial_alignment; -} - - -void LivelinessChangedStatus_s::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_alive_count; - - scdr << m_not_alive_count; - - scdr << m_last_publication_handle; - - -} - -void LivelinessChangedStatus_s::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_alive_count; - - - - dcdr >> m_not_alive_count; - - - - dcdr >> m_last_publication_handle; - - -} - - -bool LivelinessChangedStatus_s::isKeyDefined() -{ - return false; -} - -void LivelinessChangedStatus_s::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member alive_count - * @param _alive_count New value for member alive_count - */ -void LivelinessChangedStatus_s::alive_count( - uint32_t _alive_count) -{ - m_alive_count = _alive_count; -} - -/*! - * @brief This function returns the value of member alive_count - * @return Value of member alive_count - */ -uint32_t LivelinessChangedStatus_s::alive_count() const -{ - return m_alive_count; -} - -/*! - * @brief This function returns a reference to member alive_count - * @return Reference to member alive_count - */ -uint32_t& LivelinessChangedStatus_s::alive_count() -{ - return m_alive_count; -} - - -/*! - * @brief This function sets a value in member not_alive_count - * @param _not_alive_count New value for member not_alive_count - */ -void LivelinessChangedStatus_s::not_alive_count( - uint32_t _not_alive_count) -{ - m_not_alive_count = _not_alive_count; -} - -/*! - * @brief This function returns the value of member not_alive_count - * @return Value of member not_alive_count - */ -uint32_t LivelinessChangedStatus_s::not_alive_count() const -{ - return m_not_alive_count; -} - -/*! - * @brief This function returns a reference to member not_alive_count - * @return Reference to member not_alive_count - */ -uint32_t& LivelinessChangedStatus_s::not_alive_count() -{ - return m_not_alive_count; -} - - -/*! - * @brief This function copies the value in member last_publication_handle - * @param _last_publication_handle New value to be copied in member last_publication_handle - */ -void LivelinessChangedStatus_s::last_publication_handle( - const std::array& _last_publication_handle) -{ - m_last_publication_handle = _last_publication_handle; -} - -/*! - * @brief This function moves the value in member last_publication_handle - * @param _last_publication_handle New value to be moved in member last_publication_handle - */ -void LivelinessChangedStatus_s::last_publication_handle( - std::array&& _last_publication_handle) -{ - m_last_publication_handle = std::move(_last_publication_handle); -} - -/*! - * @brief This function returns a constant reference to member last_publication_handle - * @return Constant reference to member last_publication_handle - */ -const std::array& LivelinessChangedStatus_s::last_publication_handle() const -{ - return m_last_publication_handle; -} - -/*! - * @brief This function returns a reference to member last_publication_handle - * @return Reference to member last_publication_handle - */ -std::array& LivelinessChangedStatus_s::last_publication_handle() -{ - return m_last_publication_handle; -} - - - - - -DeadlineMissedStatus_s::DeadlineMissedStatus_s() -{ - // unsigned long m_total_count - m_total_count = 0; - // octet m_last_instance_handle - memset(&m_last_instance_handle, 0, ((16)) * 1); - -} - -DeadlineMissedStatus_s::~DeadlineMissedStatus_s() -{ -} - -DeadlineMissedStatus_s::DeadlineMissedStatus_s( - const DeadlineMissedStatus_s& x) -{ - m_total_count = x.m_total_count; - - - m_last_instance_handle = x.m_last_instance_handle; - -} - -DeadlineMissedStatus_s::DeadlineMissedStatus_s( - DeadlineMissedStatus_s&& x) noexcept -{ - m_total_count = x.m_total_count; - - - m_last_instance_handle = std::move(x.m_last_instance_handle); - -} - -DeadlineMissedStatus_s& DeadlineMissedStatus_s::operator =( - const DeadlineMissedStatus_s& x) -{ - m_total_count = x.m_total_count; - - - m_last_instance_handle = x.m_last_instance_handle; - - return *this; -} - -DeadlineMissedStatus_s& DeadlineMissedStatus_s::operator =( - DeadlineMissedStatus_s&& x) noexcept -{ - m_total_count = x.m_total_count; - - - m_last_instance_handle = std::move(x.m_last_instance_handle); - - return *this; -} - -bool DeadlineMissedStatus_s::operator ==( - const DeadlineMissedStatus_s& x) const -{ - return (m_total_count == x.m_total_count && - m_last_instance_handle == x.m_last_instance_handle); -} - -bool DeadlineMissedStatus_s::operator !=( - const DeadlineMissedStatus_s& x) const -{ - return !(*this == x); -} - -size_t DeadlineMissedStatus_s::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_DeadlineMissedStatus_s_max_cdr_typesize; -} - -size_t DeadlineMissedStatus_s::getCdrSerializedSize( - const DeadlineMissedStatus_s& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += (((16)) * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - - return current_alignment - initial_alignment; -} - - -void DeadlineMissedStatus_s::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_total_count; - - scdr << m_last_instance_handle; - - -} - -void DeadlineMissedStatus_s::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_total_count; - - - - dcdr >> m_last_instance_handle; - - -} - - -bool DeadlineMissedStatus_s::isKeyDefined() -{ - return false; -} - -void DeadlineMissedStatus_s::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ -void DeadlineMissedStatus_s::total_count( - uint32_t _total_count) -{ - m_total_count = _total_count; -} - -/*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ -uint32_t DeadlineMissedStatus_s::total_count() const -{ - return m_total_count; -} - -/*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ -uint32_t& DeadlineMissedStatus_s::total_count() -{ - return m_total_count; -} - - -/*! - * @brief This function copies the value in member last_instance_handle - * @param _last_instance_handle New value to be copied in member last_instance_handle - */ -void DeadlineMissedStatus_s::last_instance_handle( - const std::array& _last_instance_handle) -{ - m_last_instance_handle = _last_instance_handle; -} - -/*! - * @brief This function moves the value in member last_instance_handle - * @param _last_instance_handle New value to be moved in member last_instance_handle - */ -void DeadlineMissedStatus_s::last_instance_handle( - std::array&& _last_instance_handle) -{ - m_last_instance_handle = std::move(_last_instance_handle); -} - -/*! - * @brief This function returns a constant reference to member last_instance_handle - * @return Constant reference to member last_instance_handle - */ -const std::array& DeadlineMissedStatus_s::last_instance_handle() const -{ - return m_last_instance_handle; -} - -/*! - * @brief This function returns a reference to member last_instance_handle - * @return Reference to member last_instance_handle - */ -std::array& DeadlineMissedStatus_s::last_instance_handle() -{ - return m_last_instance_handle; -} - - - - - - - - - -MonitorServiceData::MonitorServiceData() -{ - m__d = eprosima::fastdds::statistics::PROXY; - // sequence m_entity_proxy - - // sequence m_connection_list - - // eprosima::fastdds::statistics::IncompatibleQoSStatus_s m_incompatible_qos_status - - // eprosima::fastdds::statistics::InconsistentTopicStatus_s m_inconsistent_topic_status - - // eprosima::fastdds::statistics::LivelinessLostStatus_s m_liveliness_lost_status - - // eprosima::fastdds::statistics::LivelinessChangedStatus_s m_liveliness_changed_status - - // eprosima::fastdds::statistics::DeadlineMissedStatus_s m_deadline_missed_status - - // eprosima::fastdds::statistics::SampleLostStatus_s m_sample_lost_status - - // octet m_statuses_size - m_statuses_size = 0; -} - -MonitorServiceData::~MonitorServiceData() -{ -} - -MonitorServiceData::MonitorServiceData( - const MonitorServiceData& x) -{ - m__d = x.m__d; - - switch(m__d) - { - case eprosima::fastdds::statistics::PROXY: - m_entity_proxy = x.m_entity_proxy; - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - m_connection_list = x.m_connection_list; - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - m_incompatible_qos_status = x.m_incompatible_qos_status; - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - m_inconsistent_topic_status = x.m_inconsistent_topic_status; - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - m_liveliness_lost_status = x.m_liveliness_lost_status; - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - m_liveliness_changed_status = x.m_liveliness_changed_status; - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - m_deadline_missed_status = x.m_deadline_missed_status; - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - m_sample_lost_status = x.m_sample_lost_status; - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - m_statuses_size = x.m_statuses_size; - break; - - default: - break; - } -} - -MonitorServiceData::MonitorServiceData( - MonitorServiceData&& x) noexcept -{ - m__d = x.m__d; - - switch(m__d) - { - case eprosima::fastdds::statistics::PROXY: - m_entity_proxy = std::move(x.m_entity_proxy); - - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - m_connection_list = std::move(x.m_connection_list); - - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - m_incompatible_qos_status = std::move(x.m_incompatible_qos_status); - - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - m_inconsistent_topic_status = std::move(x.m_inconsistent_topic_status); - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - m_liveliness_lost_status = std::move(x.m_liveliness_lost_status); - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - m_liveliness_changed_status = std::move(x.m_liveliness_changed_status); - - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - m_deadline_missed_status = std::move(x.m_deadline_missed_status); - - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - m_sample_lost_status = std::move(x.m_sample_lost_status); - - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - m_statuses_size = x.m_statuses_size; - break; - - default: - break; - } -} - -MonitorServiceData& MonitorServiceData::operator =( - const MonitorServiceData& x) -{ - m__d = x.m__d; - - switch(m__d) - { - case eprosima::fastdds::statistics::PROXY: - m_entity_proxy = x.m_entity_proxy; - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - m_connection_list = x.m_connection_list; - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - m_incompatible_qos_status = x.m_incompatible_qos_status; - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - m_inconsistent_topic_status = x.m_inconsistent_topic_status; - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - m_liveliness_lost_status = x.m_liveliness_lost_status; - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - m_liveliness_changed_status = x.m_liveliness_changed_status; - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - m_deadline_missed_status = x.m_deadline_missed_status; - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - m_sample_lost_status = x.m_sample_lost_status; - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - m_statuses_size = x.m_statuses_size; - break; - - default: - break; - } - - return *this; -} - -MonitorServiceData& MonitorServiceData::operator =( - MonitorServiceData&& x) noexcept -{ - m__d = x.m__d; - - switch(m__d) - { - case eprosima::fastdds::statistics::PROXY: - m_entity_proxy = std::move(x.m_entity_proxy); - - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - m_connection_list = std::move(x.m_connection_list); - - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - m_incompatible_qos_status = std::move(x.m_incompatible_qos_status); - - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - m_inconsistent_topic_status = std::move(x.m_inconsistent_topic_status); - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - m_liveliness_lost_status = std::move(x.m_liveliness_lost_status); - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - m_liveliness_changed_status = std::move(x.m_liveliness_changed_status); - - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - m_deadline_missed_status = std::move(x.m_deadline_missed_status); - - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - m_sample_lost_status = std::move(x.m_sample_lost_status); - - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - m_statuses_size = x.m_statuses_size; - break; - - default: - break; - } - - return *this; -} - -bool MonitorServiceData::operator ==( - const MonitorServiceData& x) const -{ - if (m__d != x.m__d) - { - return false; - } - - switch(m__d) - { - case eprosima::fastdds::statistics::PROXY: - return (m_entity_proxy == x.m_entity_proxy); - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - return (m_connection_list == x.m_connection_list); - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - return (m_incompatible_qos_status == x.m_incompatible_qos_status); - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - return (m_inconsistent_topic_status == x.m_inconsistent_topic_status); - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - return (m_liveliness_lost_status == x.m_liveliness_lost_status); - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - return (m_liveliness_changed_status == x.m_liveliness_changed_status); - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - return (m_deadline_missed_status == x.m_deadline_missed_status); - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - return (m_sample_lost_status == x.m_sample_lost_status); - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - return (m_statuses_size == x.m_statuses_size); - break; - - default: - break; - } - return false; -} - -bool MonitorServiceData::operator !=( - const MonitorServiceData& x) const -{ - return !(*this == x); -} - -void MonitorServiceData::_d( - eprosima::fastdds::statistics::StatusKind __d) -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::PROXY: - switch(__d) - { - case eprosima::fastdds::statistics::PROXY: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - switch(__d) - { - case eprosima::fastdds::statistics::CONNECTION_LIST: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - switch(__d) - { - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - switch(__d) - { - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - switch(__d) - { - case eprosima::fastdds::statistics::LIVELINESS_LOST: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - switch(__d) - { - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - switch(__d) - { - case eprosima::fastdds::statistics::DEADLINE_MISSED: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - switch(__d) - { - case eprosima::fastdds::statistics::SAMPLE_LOST: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - switch(__d) - { - case eprosima::fastdds::statistics::STATUSES_SIZE: - b = true; - break; - default: - break; - } - break; - - } - - if(!b) - { - throw BadParamException("Discriminator doesn't correspond with the selected union member"); - } - - m__d = __d; -} - -eprosima::fastdds::statistics::StatusKind MonitorServiceData::_d() const -{ - return m__d; -} - -eprosima::fastdds::statistics::StatusKind& MonitorServiceData::_d() -{ - return m__d; -} - -void MonitorServiceData::entity_proxy( - const std::vector& _entity_proxy) -{ - m_entity_proxy = _entity_proxy; - m__d = eprosima::fastdds::statistics::PROXY; - -} - -void MonitorServiceData::entity_proxy( - std::vector&& _entity_proxy) -{ - m_entity_proxy = std::move(_entity_proxy); - m__d = eprosima::fastdds::statistics::PROXY; - -} - -const std::vector& MonitorServiceData::entity_proxy() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::PROXY: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_proxy; -} - -std::vector& MonitorServiceData::entity_proxy() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::PROXY: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_proxy; -} - - -void MonitorServiceData::connection_list( - const std::vector& _connection_list) -{ - m_connection_list = _connection_list; - m__d = eprosima::fastdds::statistics::CONNECTION_LIST; - -} - -void MonitorServiceData::connection_list( - std::vector&& _connection_list) -{ - m_connection_list = std::move(_connection_list); - m__d = eprosima::fastdds::statistics::CONNECTION_LIST; - -} - -const std::vector& MonitorServiceData::connection_list() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::CONNECTION_LIST: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_connection_list; -} - -std::vector& MonitorServiceData::connection_list() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::CONNECTION_LIST: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_connection_list; -} - - -void MonitorServiceData::incompatible_qos_status( - const eprosima::fastdds::statistics::IncompatibleQoSStatus_s& _incompatible_qos_status) -{ - m_incompatible_qos_status = _incompatible_qos_status; - m__d = eprosima::fastdds::statistics::INCOMPATIBLE_QOS; - -} - -void MonitorServiceData::incompatible_qos_status( - eprosima::fastdds::statistics::IncompatibleQoSStatus_s&& _incompatible_qos_status) -{ - m_incompatible_qos_status = std::move(_incompatible_qos_status); - m__d = eprosima::fastdds::statistics::INCOMPATIBLE_QOS; - -} - -const eprosima::fastdds::statistics::IncompatibleQoSStatus_s& MonitorServiceData::incompatible_qos_status() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_incompatible_qos_status; -} - -eprosima::fastdds::statistics::IncompatibleQoSStatus_s& MonitorServiceData::incompatible_qos_status() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_incompatible_qos_status; -} - - -void MonitorServiceData::inconsistent_topic_status( - const eprosima::fastdds::statistics::InconsistentTopicStatus_s& _inconsistent_topic_status) -{ - m_inconsistent_topic_status = _inconsistent_topic_status; - m__d = eprosima::fastdds::statistics::INCONSISTENT_TOPIC; - -} - -void MonitorServiceData::inconsistent_topic_status( - eprosima::fastdds::statistics::InconsistentTopicStatus_s&& _inconsistent_topic_status) -{ - m_inconsistent_topic_status = std::move(_inconsistent_topic_status); - m__d = eprosima::fastdds::statistics::INCONSISTENT_TOPIC; - -} - -const eprosima::fastdds::statistics::InconsistentTopicStatus_s& MonitorServiceData::inconsistent_topic_status() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_inconsistent_topic_status; -} - -eprosima::fastdds::statistics::InconsistentTopicStatus_s& MonitorServiceData::inconsistent_topic_status() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_inconsistent_topic_status; -} - - -void MonitorServiceData::liveliness_lost_status( - const eprosima::fastdds::statistics::LivelinessLostStatus_s& _liveliness_lost_status) -{ - m_liveliness_lost_status = _liveliness_lost_status; - m__d = eprosima::fastdds::statistics::LIVELINESS_LOST; - -} - -void MonitorServiceData::liveliness_lost_status( - eprosima::fastdds::statistics::LivelinessLostStatus_s&& _liveliness_lost_status) -{ - m_liveliness_lost_status = std::move(_liveliness_lost_status); - m__d = eprosima::fastdds::statistics::LIVELINESS_LOST; - -} - -const eprosima::fastdds::statistics::LivelinessLostStatus_s& MonitorServiceData::liveliness_lost_status() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::LIVELINESS_LOST: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_liveliness_lost_status; -} - -eprosima::fastdds::statistics::LivelinessLostStatus_s& MonitorServiceData::liveliness_lost_status() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::LIVELINESS_LOST: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_liveliness_lost_status; -} - - -void MonitorServiceData::liveliness_changed_status( - const eprosima::fastdds::statistics::LivelinessChangedStatus_s& _liveliness_changed_status) -{ - m_liveliness_changed_status = _liveliness_changed_status; - m__d = eprosima::fastdds::statistics::LIVELINESS_CHANGED; - -} - -void MonitorServiceData::liveliness_changed_status( - eprosima::fastdds::statistics::LivelinessChangedStatus_s&& _liveliness_changed_status) -{ - m_liveliness_changed_status = std::move(_liveliness_changed_status); - m__d = eprosima::fastdds::statistics::LIVELINESS_CHANGED; - -} - -const eprosima::fastdds::statistics::LivelinessChangedStatus_s& MonitorServiceData::liveliness_changed_status() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_liveliness_changed_status; -} - -eprosima::fastdds::statistics::LivelinessChangedStatus_s& MonitorServiceData::liveliness_changed_status() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_liveliness_changed_status; -} - - -void MonitorServiceData::deadline_missed_status( - const eprosima::fastdds::statistics::DeadlineMissedStatus_s& _deadline_missed_status) -{ - m_deadline_missed_status = _deadline_missed_status; - m__d = eprosima::fastdds::statistics::DEADLINE_MISSED; - -} - -void MonitorServiceData::deadline_missed_status( - eprosima::fastdds::statistics::DeadlineMissedStatus_s&& _deadline_missed_status) -{ - m_deadline_missed_status = std::move(_deadline_missed_status); - m__d = eprosima::fastdds::statistics::DEADLINE_MISSED; - -} - -const eprosima::fastdds::statistics::DeadlineMissedStatus_s& MonitorServiceData::deadline_missed_status() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::DEADLINE_MISSED: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_deadline_missed_status; -} - -eprosima::fastdds::statistics::DeadlineMissedStatus_s& MonitorServiceData::deadline_missed_status() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::DEADLINE_MISSED: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_deadline_missed_status; -} - - -void MonitorServiceData::sample_lost_status( - const eprosima::fastdds::statistics::SampleLostStatus_s& _sample_lost_status) -{ - m_sample_lost_status = _sample_lost_status; - m__d = eprosima::fastdds::statistics::SAMPLE_LOST; - -} - -void MonitorServiceData::sample_lost_status( - eprosima::fastdds::statistics::SampleLostStatus_s&& _sample_lost_status) -{ - m_sample_lost_status = std::move(_sample_lost_status); - m__d = eprosima::fastdds::statistics::SAMPLE_LOST; - -} - -const eprosima::fastdds::statistics::SampleLostStatus_s& MonitorServiceData::sample_lost_status() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::SAMPLE_LOST: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_sample_lost_status; -} - -eprosima::fastdds::statistics::SampleLostStatus_s& MonitorServiceData::sample_lost_status() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::SAMPLE_LOST: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_sample_lost_status; -} - - -void MonitorServiceData::statuses_size( - uint8_t _statuses_size) -{ - m_statuses_size = _statuses_size; - m__d = eprosima::fastdds::statistics::STATUSES_SIZE; - -} - -uint8_t MonitorServiceData::statuses_size() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::STATUSES_SIZE: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_statuses_size; -} - -uint8_t& MonitorServiceData::statuses_size() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::STATUSES_SIZE: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_statuses_size; -} - - -// TODO(Ricardo) Review -size_t MonitorServiceData::getCdrSerializedSize( - const MonitorServiceData& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - - switch(data.m__d) - { - case eprosima::fastdds::statistics::PROXY: - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - if (data.entity_proxy().size() > 0) - { - current_alignment += (data.entity_proxy().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - } - - - - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - for(size_t a = 0; a < data.connection_list().size(); ++a) - { - current_alignment += eprosima::fastdds::statistics::Connection::getCdrSerializedSize(data.connection_list().at(a), current_alignment); - } - - - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - current_alignment += eprosima::fastdds::statistics::IncompatibleQoSStatus_s::getCdrSerializedSize(data.incompatible_qos_status(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - current_alignment += eprosima::fastdds::statistics::InconsistentTopicStatus_s::getCdrSerializedSize(data.inconsistent_topic_status(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - current_alignment += eprosima::fastdds::statistics::LivelinessLostStatus_s::getCdrSerializedSize(data.liveliness_lost_status(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - current_alignment += eprosima::fastdds::statistics::LivelinessChangedStatus_s::getCdrSerializedSize(data.liveliness_changed_status(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - current_alignment += eprosima::fastdds::statistics::DeadlineMissedStatus_s::getCdrSerializedSize(data.deadline_missed_status(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - current_alignment += eprosima::fastdds::statistics::SampleLostStatus_s::getCdrSerializedSize(data.sample_lost_status(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - break; - - default: - break; - } - - return current_alignment - initial_alignment; -} - - -void MonitorServiceData::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << (uint32_t)m__d; - - switch(m__d) - { - case eprosima::fastdds::statistics::PROXY: - scdr << m_entity_proxy; - - - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - scdr << m_connection_list; - - - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - scdr << m_incompatible_qos_status; - - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - scdr << m_inconsistent_topic_status; - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - scdr << m_liveliness_lost_status; - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - scdr << m_liveliness_changed_status; - - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - scdr << m_deadline_missed_status; - - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - scdr << m_sample_lost_status; - - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - scdr << m_statuses_size; - - break; - - default: - break; - } -} - -void MonitorServiceData::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - { - uint32_t enum_value = 0; - dcdr >> enum_value; - m__d = (eprosima::fastdds::statistics::StatusKind)enum_value; - } - - - switch(m__d) - { - case eprosima::fastdds::statistics::PROXY: - dcdr >> m_entity_proxy; - - - break; - - - case eprosima::fastdds::statistics::CONNECTION_LIST: - dcdr >> m_connection_list; - - - break; - - - case eprosima::fastdds::statistics::INCOMPATIBLE_QOS: - dcdr >> m_incompatible_qos_status; - - - break; - - - case eprosima::fastdds::statistics::INCONSISTENT_TOPIC: - dcdr >> m_inconsistent_topic_status; - - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_LOST: - dcdr >> m_liveliness_lost_status; - - - break; - - - case eprosima::fastdds::statistics::LIVELINESS_CHANGED: - dcdr >> m_liveliness_changed_status; - - - break; - - - case eprosima::fastdds::statistics::DEADLINE_MISSED: - dcdr >> m_deadline_missed_status; - - - break; - - - case eprosima::fastdds::statistics::SAMPLE_LOST: - dcdr >> m_sample_lost_status; - - - break; - - - case eprosima::fastdds::statistics::STATUSES_SIZE: - dcdr >> m_statuses_size; - - - break; - - default: - break; - } -} - - - - - -MonitorServiceStatusData::MonitorServiceStatusData() -{ - // eprosima::fastdds::statistics::detail::GUID_s m_local_entity - - // eprosima::fastdds::statistics::StatusKind m_status_kind - m_status_kind = eprosima::fastdds::statistics::PROXY; - // eprosima::fastdds::statistics::MonitorServiceData m_value - - -} - -MonitorServiceStatusData::~MonitorServiceStatusData() -{ -} - -MonitorServiceStatusData::MonitorServiceStatusData( - const MonitorServiceStatusData& x) -{ - m_local_entity = x.m_local_entity; - - - m_status_kind = x.m_status_kind; - - - m_value = x.m_value; - -} - -MonitorServiceStatusData::MonitorServiceStatusData( - MonitorServiceStatusData&& x) noexcept -{ - m_local_entity = std::move(x.m_local_entity); - - - m_status_kind = x.m_status_kind; - - - m_value = std::move(x.m_value); - -} - -MonitorServiceStatusData& MonitorServiceStatusData::operator =( - const MonitorServiceStatusData& x) -{ - m_local_entity = x.m_local_entity; - - - m_status_kind = x.m_status_kind; - - - m_value = x.m_value; - - return *this; -} - -MonitorServiceStatusData& MonitorServiceStatusData::operator =( - MonitorServiceStatusData&& x) noexcept -{ - m_local_entity = std::move(x.m_local_entity); - - - m_status_kind = x.m_status_kind; - - - m_value = std::move(x.m_value); - - return *this; -} - -bool MonitorServiceStatusData::operator ==( - const MonitorServiceStatusData& x) const -{ - return (m_local_entity == x.m_local_entity && - m_status_kind == x.m_status_kind && - m_value == x.m_value); -} - -bool MonitorServiceStatusData::operator !=( - const MonitorServiceStatusData& x) const -{ - return !(*this == x); -} - -size_t MonitorServiceStatusData::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_MonitorServiceStatusData_max_cdr_typesize; -} - -size_t MonitorServiceStatusData::getCdrSerializedSize( - const MonitorServiceStatusData& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += eprosima::fastdds::statistics::detail::GUID_s::getCdrSerializedSize(data.local_entity(), current_alignment); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += eprosima::fastdds::statistics::MonitorServiceData::getCdrSerializedSize(data.value(), current_alignment); - - - return current_alignment - initial_alignment; -} - - -void MonitorServiceStatusData::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_local_entity; - - scdr << (uint32_t)m_status_kind; - - scdr << m_value; - -} - -void MonitorServiceStatusData::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_local_entity; - - - - { - uint32_t enum_value = 0; - dcdr >> enum_value; - m_status_kind = (eprosima::fastdds::statistics::StatusKind)enum_value; - } - - - - dcdr >> m_value; - - -} - - -bool MonitorServiceStatusData::isKeyDefined() -{ - return true; -} - -void MonitorServiceStatusData::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - m_local_entity.serialize(scdr); - - scdr << (uint32_t)m_status_kind; - - -} - -/*! - * @brief This function copies the value in member local_entity - * @param _local_entity New value to be copied in member local_entity - */ -void MonitorServiceStatusData::local_entity( - const eprosima::fastdds::statistics::detail::GUID_s& _local_entity) -{ - m_local_entity = _local_entity; -} - -/*! - * @brief This function moves the value in member local_entity - * @param _local_entity New value to be moved in member local_entity - */ -void MonitorServiceStatusData::local_entity( - eprosima::fastdds::statistics::detail::GUID_s&& _local_entity) -{ - m_local_entity = std::move(_local_entity); -} - -/*! - * @brief This function returns a constant reference to member local_entity - * @return Constant reference to member local_entity - */ -const eprosima::fastdds::statistics::detail::GUID_s& MonitorServiceStatusData::local_entity() const -{ - return m_local_entity; -} - -/*! - * @brief This function returns a reference to member local_entity - * @return Reference to member local_entity - */ -eprosima::fastdds::statistics::detail::GUID_s& MonitorServiceStatusData::local_entity() -{ - return m_local_entity; -} - - -/*! - * @brief This function sets a value in member status_kind - * @param _status_kind New value for member status_kind - */ -void MonitorServiceStatusData::status_kind( - eprosima::fastdds::statistics::StatusKind _status_kind) -{ - m_status_kind = _status_kind; -} - -/*! - * @brief This function returns the value of member status_kind - * @return Value of member status_kind - */ -eprosima::fastdds::statistics::StatusKind MonitorServiceStatusData::status_kind() const -{ - return m_status_kind; -} - -/*! - * @brief This function returns a reference to member status_kind - * @return Reference to member status_kind - */ -eprosima::fastdds::statistics::StatusKind& MonitorServiceStatusData::status_kind() -{ - return m_status_kind; -} - - -/*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ -void MonitorServiceStatusData::value( - const eprosima::fastdds::statistics::MonitorServiceData& _value) -{ - m_value = _value; -} - -/*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ -void MonitorServiceStatusData::value( - eprosima::fastdds::statistics::MonitorServiceData&& _value) -{ - m_value = std::move(_value); -} - -/*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ -const eprosima::fastdds::statistics::MonitorServiceData& MonitorServiceStatusData::value() const -{ - return m_value; -} - -/*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ -eprosima::fastdds::statistics::MonitorServiceData& MonitorServiceStatusData::value() -{ - return m_value; -} - - - - - -} // namespace statistics - - -} // namespace fastdds - - -} // namespace eprosima - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/include/fastdds_statistics_backend/topic_types/monitorservice_typesv1.h b/include/fastdds_statistics_backend/topic_types/monitorservice_typesv1.h deleted file mode 100644 index 21ef65f1c..000000000 --- a/include/fastdds_statistics_backend/topic_types/monitorservice_typesv1.h +++ /dev/null @@ -1,1763 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file monitorservice_types.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_H_ -#define _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_H_ - -#include "types.h" - -#include - -#include -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(MONITORSERVICE_TYPES_SOURCE) -#define MONITORSERVICE_TYPES_DllAPI __declspec( dllexport ) -#else -#define MONITORSERVICE_TYPES_DllAPI __declspec( dllimport ) -#endif // MONITORSERVICE_TYPES_SOURCE -#else -#define MONITORSERVICE_TYPES_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define MONITORSERVICE_TYPES_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - -namespace eprosima { - namespace fastdds { - namespace statistics { - /*! - * @brief This class represents the enumeration ConnectionMode defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - enum ConnectionMode : uint32_t - { - DATA_SHARING, - INTRAPROCESS, - TRANSPORT - }; - - - - - /*! - * @brief This class represents the structure Connection defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class Connection - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport Connection(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~Connection(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Connection that will be copied. - */ - eProsima_user_DllExport Connection( - const Connection& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Connection that will be copied. - */ - eProsima_user_DllExport Connection( - Connection&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Connection that will be copied. - */ - eProsima_user_DllExport Connection& operator =( - const Connection& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Connection that will be copied. - */ - eProsima_user_DllExport Connection& operator =( - Connection&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Connection object to compare. - */ - eProsima_user_DllExport bool operator ==( - const Connection& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Connection object to compare. - */ - eProsima_user_DllExport bool operator !=( - const Connection& x) const; - - /*! - * @brief This function sets a value in member mode - * @param _mode New value for member mode - */ - eProsima_user_DllExport void mode( - eprosima::fastdds::statistics::ConnectionMode _mode); - - /*! - * @brief This function returns the value of member mode - * @return Value of member mode - */ - eProsima_user_DllExport eprosima::fastdds::statistics::ConnectionMode mode() const; - - /*! - * @brief This function returns a reference to member mode - * @return Reference to member mode - */ - eProsima_user_DllExport eprosima::fastdds::statistics::ConnectionMode& mode(); - - - /*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ - eProsima_user_DllExport void guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid); - - /*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ - eProsima_user_DllExport void guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid); - - /*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& guid() const; - - /*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& guid(); - - - /*! - * @brief This function copies the value in member announced_locators - * @param _announced_locators New value to be copied in member announced_locators - */ - eProsima_user_DllExport void announced_locators( - const std::vector& _announced_locators); - - /*! - * @brief This function moves the value in member announced_locators - * @param _announced_locators New value to be moved in member announced_locators - */ - eProsima_user_DllExport void announced_locators( - std::vector&& _announced_locators); - - /*! - * @brief This function returns a constant reference to member announced_locators - * @return Constant reference to member announced_locators - */ - eProsima_user_DllExport const std::vector& announced_locators() const; - - /*! - * @brief This function returns a reference to member announced_locators - * @return Reference to member announced_locators - */ - eProsima_user_DllExport std::vector& announced_locators(); - - - /*! - * @brief This function copies the value in member used_locators - * @param _used_locators New value to be copied in member used_locators - */ - eProsima_user_DllExport void used_locators( - const std::vector& _used_locators); - - /*! - * @brief This function moves the value in member used_locators - * @param _used_locators New value to be moved in member used_locators - */ - eProsima_user_DllExport void used_locators( - std::vector&& _used_locators); - - /*! - * @brief This function returns a constant reference to member used_locators - * @return Constant reference to member used_locators - */ - eProsima_user_DllExport const std::vector& used_locators() const; - - /*! - * @brief This function returns a reference to member used_locators - * @return Reference to member used_locators - */ - eProsima_user_DllExport std::vector& used_locators(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::Connection& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::ConnectionMode m_mode; - eprosima::fastdds::statistics::detail::GUID_s m_guid; - std::vector m_announced_locators; - std::vector m_used_locators; - - }; - - - - /*! - * @brief This class represents the structure QosPolicyCount_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class QosPolicyCount_s - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport QosPolicyCount_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~QosPolicyCount_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::QosPolicyCount_s that will be copied. - */ - eProsima_user_DllExport QosPolicyCount_s( - const QosPolicyCount_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::QosPolicyCount_s that will be copied. - */ - eProsima_user_DllExport QosPolicyCount_s( - QosPolicyCount_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::QosPolicyCount_s that will be copied. - */ - eProsima_user_DllExport QosPolicyCount_s& operator =( - const QosPolicyCount_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::QosPolicyCount_s that will be copied. - */ - eProsima_user_DllExport QosPolicyCount_s& operator =( - QosPolicyCount_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::QosPolicyCount_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const QosPolicyCount_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::QosPolicyCount_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const QosPolicyCount_s& x) const; - - /*! - * @brief This function sets a value in member policy_id - * @param _policy_id New value for member policy_id - */ - eProsima_user_DllExport void policy_id( - uint32_t _policy_id); - - /*! - * @brief This function returns the value of member policy_id - * @return Value of member policy_id - */ - eProsima_user_DllExport uint32_t policy_id() const; - - /*! - * @brief This function returns a reference to member policy_id - * @return Reference to member policy_id - */ - eProsima_user_DllExport uint32_t& policy_id(); - - - /*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ - eProsima_user_DllExport void count( - uint32_t _count); - - /*! - * @brief This function returns the value of member count - * @return Value of member count - */ - eProsima_user_DllExport uint32_t count() const; - - /*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ - eProsima_user_DllExport uint32_t& count(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::QosPolicyCount_s& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - uint32_t m_policy_id; - uint32_t m_count; - - }; - - - - /*! - * @brief This class represents the structure BaseStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class BaseStatus_s - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport BaseStatus_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~BaseStatus_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::BaseStatus_s that will be copied. - */ - eProsima_user_DllExport BaseStatus_s( - const BaseStatus_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::BaseStatus_s that will be copied. - */ - eProsima_user_DllExport BaseStatus_s( - BaseStatus_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::BaseStatus_s that will be copied. - */ - eProsima_user_DllExport BaseStatus_s& operator =( - const BaseStatus_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::BaseStatus_s that will be copied. - */ - eProsima_user_DllExport BaseStatus_s& operator =( - BaseStatus_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::BaseStatus_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const BaseStatus_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::BaseStatus_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const BaseStatus_s& x) const; - - /*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ - eProsima_user_DllExport void total_count( - uint32_t _total_count); - - /*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ - eProsima_user_DllExport uint32_t total_count() const; - - /*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ - eProsima_user_DllExport uint32_t& total_count(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::BaseStatus_s& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - uint32_t m_total_count; - - }; - - - - typedef std::vector QosPolicyCountSeq_s; - - - - /*! - * @brief This class represents the structure IncompatibleQoSStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class IncompatibleQoSStatus_s - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport IncompatibleQoSStatus_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~IncompatibleQoSStatus_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::IncompatibleQoSStatus_s that will be copied. - */ - eProsima_user_DllExport IncompatibleQoSStatus_s( - const IncompatibleQoSStatus_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::IncompatibleQoSStatus_s that will be copied. - */ - eProsima_user_DllExport IncompatibleQoSStatus_s( - IncompatibleQoSStatus_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::IncompatibleQoSStatus_s that will be copied. - */ - eProsima_user_DllExport IncompatibleQoSStatus_s& operator =( - const IncompatibleQoSStatus_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::IncompatibleQoSStatus_s that will be copied. - */ - eProsima_user_DllExport IncompatibleQoSStatus_s& operator =( - IncompatibleQoSStatus_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::IncompatibleQoSStatus_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const IncompatibleQoSStatus_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::IncompatibleQoSStatus_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const IncompatibleQoSStatus_s& x) const; - - /*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ - eProsima_user_DllExport void total_count( - uint32_t _total_count); - - /*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ - eProsima_user_DllExport uint32_t total_count() const; - - /*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ - eProsima_user_DllExport uint32_t& total_count(); - - - /*! - * @brief This function sets a value in member last_policy_id - * @param _last_policy_id New value for member last_policy_id - */ - eProsima_user_DllExport void last_policy_id( - uint32_t _last_policy_id); - - /*! - * @brief This function returns the value of member last_policy_id - * @return Value of member last_policy_id - */ - eProsima_user_DllExport uint32_t last_policy_id() const; - - /*! - * @brief This function returns a reference to member last_policy_id - * @return Reference to member last_policy_id - */ - eProsima_user_DllExport uint32_t& last_policy_id(); - - - /*! - * @brief This function copies the value in member policies - * @param _policies New value to be copied in member policies - */ - eProsima_user_DllExport void policies( - const eprosima::fastdds::statistics::QosPolicyCountSeq_s& _policies); - - /*! - * @brief This function moves the value in member policies - * @param _policies New value to be moved in member policies - */ - eProsima_user_DllExport void policies( - eprosima::fastdds::statistics::QosPolicyCountSeq_s&& _policies); - - /*! - * @brief This function returns a constant reference to member policies - * @return Constant reference to member policies - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::QosPolicyCountSeq_s& policies() const; - - /*! - * @brief This function returns a reference to member policies - * @return Reference to member policies - */ - eProsima_user_DllExport eprosima::fastdds::statistics::QosPolicyCountSeq_s& policies(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::IncompatibleQoSStatus_s& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - uint32_t m_total_count; - uint32_t m_last_policy_id; - eprosima::fastdds::statistics::QosPolicyCountSeq_s m_policies; - - }; - - - - /*! - * @brief This class represents the structure LivelinessChangedStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class LivelinessChangedStatus_s - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport LivelinessChangedStatus_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~LivelinessChangedStatus_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::LivelinessChangedStatus_s that will be copied. - */ - eProsima_user_DllExport LivelinessChangedStatus_s( - const LivelinessChangedStatus_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::LivelinessChangedStatus_s that will be copied. - */ - eProsima_user_DllExport LivelinessChangedStatus_s( - LivelinessChangedStatus_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::LivelinessChangedStatus_s that will be copied. - */ - eProsima_user_DllExport LivelinessChangedStatus_s& operator =( - const LivelinessChangedStatus_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::LivelinessChangedStatus_s that will be copied. - */ - eProsima_user_DllExport LivelinessChangedStatus_s& operator =( - LivelinessChangedStatus_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::LivelinessChangedStatus_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const LivelinessChangedStatus_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::LivelinessChangedStatus_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const LivelinessChangedStatus_s& x) const; - - /*! - * @brief This function sets a value in member alive_count - * @param _alive_count New value for member alive_count - */ - eProsima_user_DllExport void alive_count( - uint32_t _alive_count); - - /*! - * @brief This function returns the value of member alive_count - * @return Value of member alive_count - */ - eProsima_user_DllExport uint32_t alive_count() const; - - /*! - * @brief This function returns a reference to member alive_count - * @return Reference to member alive_count - */ - eProsima_user_DllExport uint32_t& alive_count(); - - - /*! - * @brief This function sets a value in member not_alive_count - * @param _not_alive_count New value for member not_alive_count - */ - eProsima_user_DllExport void not_alive_count( - uint32_t _not_alive_count); - - /*! - * @brief This function returns the value of member not_alive_count - * @return Value of member not_alive_count - */ - eProsima_user_DllExport uint32_t not_alive_count() const; - - /*! - * @brief This function returns a reference to member not_alive_count - * @return Reference to member not_alive_count - */ - eProsima_user_DllExport uint32_t& not_alive_count(); - - - /*! - * @brief This function copies the value in member last_publication_handle - * @param _last_publication_handle New value to be copied in member last_publication_handle - */ - eProsima_user_DllExport void last_publication_handle( - const std::array& _last_publication_handle); - - /*! - * @brief This function moves the value in member last_publication_handle - * @param _last_publication_handle New value to be moved in member last_publication_handle - */ - eProsima_user_DllExport void last_publication_handle( - std::array&& _last_publication_handle); - - /*! - * @brief This function returns a constant reference to member last_publication_handle - * @return Constant reference to member last_publication_handle - */ - eProsima_user_DllExport const std::array& last_publication_handle() const; - - /*! - * @brief This function returns a reference to member last_publication_handle - * @return Reference to member last_publication_handle - */ - eProsima_user_DllExport std::array& last_publication_handle(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::LivelinessChangedStatus_s& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - uint32_t m_alive_count; - uint32_t m_not_alive_count; - std::array m_last_publication_handle; - - }; - - - - /*! - * @brief This class represents the structure DeadlineMissedStatus_s defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class DeadlineMissedStatus_s - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport DeadlineMissedStatus_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~DeadlineMissedStatus_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::DeadlineMissedStatus_s that will be copied. - */ - eProsima_user_DllExport DeadlineMissedStatus_s( - const DeadlineMissedStatus_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::DeadlineMissedStatus_s that will be copied. - */ - eProsima_user_DllExport DeadlineMissedStatus_s( - DeadlineMissedStatus_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::DeadlineMissedStatus_s that will be copied. - */ - eProsima_user_DllExport DeadlineMissedStatus_s& operator =( - const DeadlineMissedStatus_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::DeadlineMissedStatus_s that will be copied. - */ - eProsima_user_DllExport DeadlineMissedStatus_s& operator =( - DeadlineMissedStatus_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::DeadlineMissedStatus_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const DeadlineMissedStatus_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::DeadlineMissedStatus_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const DeadlineMissedStatus_s& x) const; - - /*! - * @brief This function sets a value in member total_count - * @param _total_count New value for member total_count - */ - eProsima_user_DllExport void total_count( - uint32_t _total_count); - - /*! - * @brief This function returns the value of member total_count - * @return Value of member total_count - */ - eProsima_user_DllExport uint32_t total_count() const; - - /*! - * @brief This function returns a reference to member total_count - * @return Reference to member total_count - */ - eProsima_user_DllExport uint32_t& total_count(); - - - /*! - * @brief This function copies the value in member last_instance_handle - * @param _last_instance_handle New value to be copied in member last_instance_handle - */ - eProsima_user_DllExport void last_instance_handle( - const std::array& _last_instance_handle); - - /*! - * @brief This function moves the value in member last_instance_handle - * @param _last_instance_handle New value to be moved in member last_instance_handle - */ - eProsima_user_DllExport void last_instance_handle( - std::array&& _last_instance_handle); - - /*! - * @brief This function returns a constant reference to member last_instance_handle - * @return Constant reference to member last_instance_handle - */ - eProsima_user_DllExport const std::array& last_instance_handle() const; - - /*! - * @brief This function returns a reference to member last_instance_handle - * @return Reference to member last_instance_handle - */ - eProsima_user_DllExport std::array& last_instance_handle(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::DeadlineMissedStatus_s& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - uint32_t m_total_count; - std::array m_last_instance_handle; - - }; - - typedef eprosima::fastdds::statistics::BaseStatus_s LivelinessLostStatus_s; - - typedef eprosima::fastdds::statistics::BaseStatus_s InconsistentTopicStatus_s; - - typedef eprosima::fastdds::statistics::BaseStatus_s SampleLostStatus_s; - - /*! - * @brief This class represents the enumeration StatusKind defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - enum StatusKind : uint32_t - { - PROXY, - CONNECTION_LIST, - INCOMPATIBLE_QOS, - INCONSISTENT_TOPIC, - LIVELINESS_LOST, - LIVELINESS_CHANGED, - DEADLINE_MISSED, - SAMPLE_LOST, - STATUSES_SIZE - }; - - - /*! - * @brief This class represents the union MonitorServiceData defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class MonitorServiceData - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MonitorServiceData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MonitorServiceData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceData that will be copied. - */ - eProsima_user_DllExport MonitorServiceData( - const MonitorServiceData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceData that will be copied. - */ - eProsima_user_DllExport MonitorServiceData( - MonitorServiceData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceData that will be copied. - */ - eProsima_user_DllExport MonitorServiceData& operator =( - const MonitorServiceData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceData that will be copied. - */ - eProsima_user_DllExport MonitorServiceData& operator =( - MonitorServiceData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::MonitorServiceData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MonitorServiceData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::MonitorServiceData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MonitorServiceData& x) const; - - /*! - * @brief This function sets the discriminator value. - * @param __d New value for the discriminator. - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member. - */ - eProsima_user_DllExport void _d( - eprosima::fastdds::statistics::StatusKind __d); - - /*! - * @brief This function returns the value of the discriminator. - * @return Value of the discriminator - */ - eProsima_user_DllExport eprosima::fastdds::statistics::StatusKind _d() const; - - /*! - * @brief This function returns a reference to the discriminator. - * @return Reference to the discriminator. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::StatusKind& _d(); - - /*! - * @brief This function copies the value in member entity_proxy - * @param _entity_proxy New value to be copied in member entity_proxy - */ - eProsima_user_DllExport void entity_proxy( - const std::vector& _entity_proxy); - - /*! - * @brief This function moves the value in member entity_proxy - * @param _entity_proxy New value to be moved in member entity_proxy - */ - eProsima_user_DllExport void entity_proxy( - std::vector&& _entity_proxy); - - /*! - * @brief This function returns a constant reference to member entity_proxy - * @return Constant reference to member entity_proxy - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const std::vector& entity_proxy() const; - - /*! - * @brief This function returns a reference to member entity_proxy - * @return Reference to member entity_proxy - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport std::vector& entity_proxy(); - - - /*! - * @brief This function copies the value in member connection_list - * @param _connection_list New value to be copied in member connection_list - */ - eProsima_user_DllExport void connection_list( - const std::vector& _connection_list); - - /*! - * @brief This function moves the value in member connection_list - * @param _connection_list New value to be moved in member connection_list - */ - eProsima_user_DllExport void connection_list( - std::vector&& _connection_list); - - /*! - * @brief This function returns a constant reference to member connection_list - * @return Constant reference to member connection_list - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const std::vector& connection_list() const; - - /*! - * @brief This function returns a reference to member connection_list - * @return Reference to member connection_list - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport std::vector& connection_list(); - - - /*! - * @brief This function copies the value in member incompatible_qos_status - * @param _incompatible_qos_status New value to be copied in member incompatible_qos_status - */ - eProsima_user_DllExport void incompatible_qos_status( - const eprosima::fastdds::statistics::IncompatibleQoSStatus_s& _incompatible_qos_status); - - /*! - * @brief This function moves the value in member incompatible_qos_status - * @param _incompatible_qos_status New value to be moved in member incompatible_qos_status - */ - eProsima_user_DllExport void incompatible_qos_status( - eprosima::fastdds::statistics::IncompatibleQoSStatus_s&& _incompatible_qos_status); - - /*! - * @brief This function returns a constant reference to member incompatible_qos_status - * @return Constant reference to member incompatible_qos_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::IncompatibleQoSStatus_s& incompatible_qos_status() const; - - /*! - * @brief This function returns a reference to member incompatible_qos_status - * @return Reference to member incompatible_qos_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::IncompatibleQoSStatus_s& incompatible_qos_status(); - - - /*! - * @brief This function copies the value in member inconsistent_topic_status - * @param _inconsistent_topic_status New value to be copied in member inconsistent_topic_status - */ - eProsima_user_DllExport void inconsistent_topic_status( - const eprosima::fastdds::statistics::InconsistentTopicStatus_s& _inconsistent_topic_status); - - /*! - * @brief This function moves the value in member inconsistent_topic_status - * @param _inconsistent_topic_status New value to be moved in member inconsistent_topic_status - */ - eProsima_user_DllExport void inconsistent_topic_status( - eprosima::fastdds::statistics::InconsistentTopicStatus_s&& _inconsistent_topic_status); - - /*! - * @brief This function returns a constant reference to member inconsistent_topic_status - * @return Constant reference to member inconsistent_topic_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::InconsistentTopicStatus_s& inconsistent_topic_status() const; - - /*! - * @brief This function returns a reference to member inconsistent_topic_status - * @return Reference to member inconsistent_topic_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::InconsistentTopicStatus_s& inconsistent_topic_status(); - - - /*! - * @brief This function copies the value in member liveliness_lost_status - * @param _liveliness_lost_status New value to be copied in member liveliness_lost_status - */ - eProsima_user_DllExport void liveliness_lost_status( - const eprosima::fastdds::statistics::LivelinessLostStatus_s& _liveliness_lost_status); - - /*! - * @brief This function moves the value in member liveliness_lost_status - * @param _liveliness_lost_status New value to be moved in member liveliness_lost_status - */ - eProsima_user_DllExport void liveliness_lost_status( - eprosima::fastdds::statistics::LivelinessLostStatus_s&& _liveliness_lost_status); - - /*! - * @brief This function returns a constant reference to member liveliness_lost_status - * @return Constant reference to member liveliness_lost_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::LivelinessLostStatus_s& liveliness_lost_status() const; - - /*! - * @brief This function returns a reference to member liveliness_lost_status - * @return Reference to member liveliness_lost_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::LivelinessLostStatus_s& liveliness_lost_status(); - - - /*! - * @brief This function copies the value in member liveliness_changed_status - * @param _liveliness_changed_status New value to be copied in member liveliness_changed_status - */ - eProsima_user_DllExport void liveliness_changed_status( - const eprosima::fastdds::statistics::LivelinessChangedStatus_s& _liveliness_changed_status); - - /*! - * @brief This function moves the value in member liveliness_changed_status - * @param _liveliness_changed_status New value to be moved in member liveliness_changed_status - */ - eProsima_user_DllExport void liveliness_changed_status( - eprosima::fastdds::statistics::LivelinessChangedStatus_s&& _liveliness_changed_status); - - /*! - * @brief This function returns a constant reference to member liveliness_changed_status - * @return Constant reference to member liveliness_changed_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::LivelinessChangedStatus_s& liveliness_changed_status() const; - - /*! - * @brief This function returns a reference to member liveliness_changed_status - * @return Reference to member liveliness_changed_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::LivelinessChangedStatus_s& liveliness_changed_status(); - - - /*! - * @brief This function copies the value in member deadline_missed_status - * @param _deadline_missed_status New value to be copied in member deadline_missed_status - */ - eProsima_user_DllExport void deadline_missed_status( - const eprosima::fastdds::statistics::DeadlineMissedStatus_s& _deadline_missed_status); - - /*! - * @brief This function moves the value in member deadline_missed_status - * @param _deadline_missed_status New value to be moved in member deadline_missed_status - */ - eProsima_user_DllExport void deadline_missed_status( - eprosima::fastdds::statistics::DeadlineMissedStatus_s&& _deadline_missed_status); - - /*! - * @brief This function returns a constant reference to member deadline_missed_status - * @return Constant reference to member deadline_missed_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::DeadlineMissedStatus_s& deadline_missed_status() const; - - /*! - * @brief This function returns a reference to member deadline_missed_status - * @return Reference to member deadline_missed_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::DeadlineMissedStatus_s& deadline_missed_status(); - - - /*! - * @brief This function copies the value in member sample_lost_status - * @param _sample_lost_status New value to be copied in member sample_lost_status - */ - eProsima_user_DllExport void sample_lost_status( - const eprosima::fastdds::statistics::SampleLostStatus_s& _sample_lost_status); - - /*! - * @brief This function moves the value in member sample_lost_status - * @param _sample_lost_status New value to be moved in member sample_lost_status - */ - eProsima_user_DllExport void sample_lost_status( - eprosima::fastdds::statistics::SampleLostStatus_s&& _sample_lost_status); - - /*! - * @brief This function returns a constant reference to member sample_lost_status - * @return Constant reference to member sample_lost_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::SampleLostStatus_s& sample_lost_status() const; - - /*! - * @brief This function returns a reference to member sample_lost_status - * @return Reference to member sample_lost_status - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::SampleLostStatus_s& sample_lost_status(); - - - /*! - * @brief This function sets a value in member statuses_size - * @param _statuses_size New value for member statuses_size - */ - eProsima_user_DllExport void statuses_size( - uint8_t _statuses_size); - - /*! - * @brief This function returns the value of member statuses_size - * @return Value of member statuses_size - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t statuses_size() const; - - /*! - * @brief This function returns a reference to member statuses_size - * @return Reference to member statuses_size - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport uint8_t& statuses_size(); - - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::MonitorServiceData& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - - private: - - eprosima::fastdds::statistics::StatusKind m__d; - - std::vector m_entity_proxy; - std::vector m_connection_list; - eprosima::fastdds::statistics::IncompatibleQoSStatus_s m_incompatible_qos_status; - eprosima::fastdds::statistics::InconsistentTopicStatus_s m_inconsistent_topic_status; - eprosima::fastdds::statistics::LivelinessLostStatus_s m_liveliness_lost_status; - eprosima::fastdds::statistics::LivelinessChangedStatus_s m_liveliness_changed_status; - eprosima::fastdds::statistics::DeadlineMissedStatus_s m_deadline_missed_status; - eprosima::fastdds::statistics::SampleLostStatus_s m_sample_lost_status; - uint8_t m_statuses_size; - }; - - - - /*! - * @brief This class represents the structure MonitorServiceStatusData defined by the user in the IDL file. - * @ingroup monitorservice_types - */ - class MonitorServiceStatusData - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport MonitorServiceStatusData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~MonitorServiceStatusData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceStatusData that will be copied. - */ - eProsima_user_DllExport MonitorServiceStatusData( - const MonitorServiceStatusData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceStatusData that will be copied. - */ - eProsima_user_DllExport MonitorServiceStatusData( - MonitorServiceStatusData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceStatusData that will be copied. - */ - eProsima_user_DllExport MonitorServiceStatusData& operator =( - const MonitorServiceStatusData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::MonitorServiceStatusData that will be copied. - */ - eProsima_user_DllExport MonitorServiceStatusData& operator =( - MonitorServiceStatusData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::MonitorServiceStatusData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const MonitorServiceStatusData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::MonitorServiceStatusData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const MonitorServiceStatusData& x) const; - - /*! - * @brief This function copies the value in member local_entity - * @param _local_entity New value to be copied in member local_entity - */ - eProsima_user_DllExport void local_entity( - const eprosima::fastdds::statistics::detail::GUID_s& _local_entity); - - /*! - * @brief This function moves the value in member local_entity - * @param _local_entity New value to be moved in member local_entity - */ - eProsima_user_DllExport void local_entity( - eprosima::fastdds::statistics::detail::GUID_s&& _local_entity); - - /*! - * @brief This function returns a constant reference to member local_entity - * @return Constant reference to member local_entity - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& local_entity() const; - - /*! - * @brief This function returns a reference to member local_entity - * @return Reference to member local_entity - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& local_entity(); - - - /*! - * @brief This function sets a value in member status_kind - * @param _status_kind New value for member status_kind - */ - eProsima_user_DllExport void status_kind( - eprosima::fastdds::statistics::StatusKind _status_kind); - - /*! - * @brief This function returns the value of member status_kind - * @return Value of member status_kind - */ - eProsima_user_DllExport eprosima::fastdds::statistics::StatusKind status_kind() const; - - /*! - * @brief This function returns a reference to member status_kind - * @return Reference to member status_kind - */ - eProsima_user_DllExport eprosima::fastdds::statistics::StatusKind& status_kind(); - - - /*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ - eProsima_user_DllExport void value( - const eprosima::fastdds::statistics::MonitorServiceData& _value); - - /*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ - eProsima_user_DllExport void value( - eprosima::fastdds::statistics::MonitorServiceData&& _value); - - /*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::MonitorServiceData& value() const; - - /*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ - eProsima_user_DllExport eprosima::fastdds::statistics::MonitorServiceData& value(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::MonitorServiceStatusData& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::detail::GUID_s m_local_entity; - eprosima::fastdds::statistics::StatusKind m_status_kind; - eprosima::fastdds::statistics::MonitorServiceData m_value; - - }; - - } // namespace statistics - } // namespace fastdds -} // namespace eprosima - -#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_MONITORSERVICE_TYPES_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/include/fastdds_statistics_backend/topic_types/types.cxx b/include/fastdds_statistics_backend/topic_types/types.cxx deleted file mode 100644 index 9dcb86ef6..000000000 --- a/include/fastdds_statistics_backend/topic_types/types.cxx +++ /dev/null @@ -1,3211 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file types.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "types.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - - -namespace eprosima { - -namespace fastdds { - -namespace statistics { - -namespace detail { - - - -EntityId_s::EntityId_s() -{ -} - -EntityId_s::~EntityId_s() -{ -} - -EntityId_s::EntityId_s( - const EntityId_s& x) -{ - m_value = x.m_value; -} - -EntityId_s::EntityId_s( - EntityId_s&& x) noexcept -{ - m_value = std::move(x.m_value); -} - -EntityId_s& EntityId_s::operator =( - const EntityId_s& x) -{ - - m_value = x.m_value; - return *this; -} - -EntityId_s& EntityId_s::operator =( - EntityId_s&& x) noexcept -{ - - m_value = std::move(x.m_value); - return *this; -} - -bool EntityId_s::operator ==( - const EntityId_s& x) const -{ - return (m_value == x.m_value); -} - -bool EntityId_s::operator !=( - const EntityId_s& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ -void EntityId_s::value( - const std::array& _value) -{ - m_value = _value; -} - -/*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ -void EntityId_s::value( - std::array&& _value) -{ - m_value = std::move(_value); -} - -/*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ -const std::array& EntityId_s::value() const -{ - return m_value; -} - -/*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ -std::array& EntityId_s::value() -{ - return m_value; -} - - - - -GuidPrefix_s::GuidPrefix_s() -{ -} - -GuidPrefix_s::~GuidPrefix_s() -{ -} - -GuidPrefix_s::GuidPrefix_s( - const GuidPrefix_s& x) -{ - m_value = x.m_value; -} - -GuidPrefix_s::GuidPrefix_s( - GuidPrefix_s&& x) noexcept -{ - m_value = std::move(x.m_value); -} - -GuidPrefix_s& GuidPrefix_s::operator =( - const GuidPrefix_s& x) -{ - - m_value = x.m_value; - return *this; -} - -GuidPrefix_s& GuidPrefix_s::operator =( - GuidPrefix_s&& x) noexcept -{ - - m_value = std::move(x.m_value); - return *this; -} - -bool GuidPrefix_s::operator ==( - const GuidPrefix_s& x) const -{ - return (m_value == x.m_value); -} - -bool GuidPrefix_s::operator !=( - const GuidPrefix_s& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ -void GuidPrefix_s::value( - const std::array& _value) -{ - m_value = _value; -} - -/*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ -void GuidPrefix_s::value( - std::array&& _value) -{ - m_value = std::move(_value); -} - -/*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ -const std::array& GuidPrefix_s::value() const -{ - return m_value; -} - -/*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ -std::array& GuidPrefix_s::value() -{ - return m_value; -} - - - - -GUID_s::GUID_s() -{ -} - -GUID_s::~GUID_s() -{ -} - -GUID_s::GUID_s( - const GUID_s& x) -{ - m_guidPrefix = x.m_guidPrefix; - m_entityId = x.m_entityId; -} - -GUID_s::GUID_s( - GUID_s&& x) noexcept -{ - m_guidPrefix = std::move(x.m_guidPrefix); - m_entityId = std::move(x.m_entityId); -} - -GUID_s& GUID_s::operator =( - const GUID_s& x) -{ - - m_guidPrefix = x.m_guidPrefix; - m_entityId = x.m_entityId; - return *this; -} - -GUID_s& GUID_s::operator =( - GUID_s&& x) noexcept -{ - - m_guidPrefix = std::move(x.m_guidPrefix); - m_entityId = std::move(x.m_entityId); - return *this; -} - -bool GUID_s::operator ==( - const GUID_s& x) const -{ - return (m_guidPrefix == x.m_guidPrefix && - m_entityId == x.m_entityId); -} - -bool GUID_s::operator !=( - const GUID_s& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member guidPrefix - * @param _guidPrefix New value to be copied in member guidPrefix - */ -void GUID_s::guidPrefix( - const eprosima::fastdds::statistics::detail::GuidPrefix_s& _guidPrefix) -{ - m_guidPrefix = _guidPrefix; -} - -/*! - * @brief This function moves the value in member guidPrefix - * @param _guidPrefix New value to be moved in member guidPrefix - */ -void GUID_s::guidPrefix( - eprosima::fastdds::statistics::detail::GuidPrefix_s&& _guidPrefix) -{ - m_guidPrefix = std::move(_guidPrefix); -} - -/*! - * @brief This function returns a constant reference to member guidPrefix - * @return Constant reference to member guidPrefix - */ -const eprosima::fastdds::statistics::detail::GuidPrefix_s& GUID_s::guidPrefix() const -{ - return m_guidPrefix; -} - -/*! - * @brief This function returns a reference to member guidPrefix - * @return Reference to member guidPrefix - */ -eprosima::fastdds::statistics::detail::GuidPrefix_s& GUID_s::guidPrefix() -{ - return m_guidPrefix; -} - - -/*! - * @brief This function copies the value in member entityId - * @param _entityId New value to be copied in member entityId - */ -void GUID_s::entityId( - const eprosima::fastdds::statistics::detail::EntityId_s& _entityId) -{ - m_entityId = _entityId; -} - -/*! - * @brief This function moves the value in member entityId - * @param _entityId New value to be moved in member entityId - */ -void GUID_s::entityId( - eprosima::fastdds::statistics::detail::EntityId_s&& _entityId) -{ - m_entityId = std::move(_entityId); -} - -/*! - * @brief This function returns a constant reference to member entityId - * @return Constant reference to member entityId - */ -const eprosima::fastdds::statistics::detail::EntityId_s& GUID_s::entityId() const -{ - return m_entityId; -} - -/*! - * @brief This function returns a reference to member entityId - * @return Reference to member entityId - */ -eprosima::fastdds::statistics::detail::EntityId_s& GUID_s::entityId() -{ - return m_entityId; -} - - - - -SequenceNumber_s::SequenceNumber_s() -{ -} - -SequenceNumber_s::~SequenceNumber_s() -{ -} - -SequenceNumber_s::SequenceNumber_s( - const SequenceNumber_s& x) -{ - m_high = x.m_high; - m_low = x.m_low; -} - -SequenceNumber_s::SequenceNumber_s( - SequenceNumber_s&& x) noexcept -{ - m_high = x.m_high; - m_low = x.m_low; -} - -SequenceNumber_s& SequenceNumber_s::operator =( - const SequenceNumber_s& x) -{ - - m_high = x.m_high; - m_low = x.m_low; - return *this; -} - -SequenceNumber_s& SequenceNumber_s::operator =( - SequenceNumber_s&& x) noexcept -{ - - m_high = x.m_high; - m_low = x.m_low; - return *this; -} - -bool SequenceNumber_s::operator ==( - const SequenceNumber_s& x) const -{ - return (m_high == x.m_high && - m_low == x.m_low); -} - -bool SequenceNumber_s::operator !=( - const SequenceNumber_s& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member high - * @param _high New value for member high - */ -void SequenceNumber_s::high( - int32_t _high) -{ - m_high = _high; -} - -/*! - * @brief This function returns the value of member high - * @return Value of member high - */ -int32_t SequenceNumber_s::high() const -{ - return m_high; -} - -/*! - * @brief This function returns a reference to member high - * @return Reference to member high - */ -int32_t& SequenceNumber_s::high() -{ - return m_high; -} - - -/*! - * @brief This function sets a value in member low - * @param _low New value for member low - */ -void SequenceNumber_s::low( - uint32_t _low) -{ - m_low = _low; -} - -/*! - * @brief This function returns the value of member low - * @return Value of member low - */ -uint32_t SequenceNumber_s::low() const -{ - return m_low; -} - -/*! - * @brief This function returns a reference to member low - * @return Reference to member low - */ -uint32_t& SequenceNumber_s::low() -{ - return m_low; -} - - - - -SampleIdentity_s::SampleIdentity_s() -{ -} - -SampleIdentity_s::~SampleIdentity_s() -{ -} - -SampleIdentity_s::SampleIdentity_s( - const SampleIdentity_s& x) -{ - m_writer_guid = x.m_writer_guid; - m_sequence_number = x.m_sequence_number; -} - -SampleIdentity_s::SampleIdentity_s( - SampleIdentity_s&& x) noexcept -{ - m_writer_guid = std::move(x.m_writer_guid); - m_sequence_number = std::move(x.m_sequence_number); -} - -SampleIdentity_s& SampleIdentity_s::operator =( - const SampleIdentity_s& x) -{ - - m_writer_guid = x.m_writer_guid; - m_sequence_number = x.m_sequence_number; - return *this; -} - -SampleIdentity_s& SampleIdentity_s::operator =( - SampleIdentity_s&& x) noexcept -{ - - m_writer_guid = std::move(x.m_writer_guid); - m_sequence_number = std::move(x.m_sequence_number); - return *this; -} - -bool SampleIdentity_s::operator ==( - const SampleIdentity_s& x) const -{ - return (m_writer_guid == x.m_writer_guid && - m_sequence_number == x.m_sequence_number); -} - -bool SampleIdentity_s::operator !=( - const SampleIdentity_s& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member writer_guid - * @param _writer_guid New value to be copied in member writer_guid - */ -void SampleIdentity_s::writer_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _writer_guid) -{ - m_writer_guid = _writer_guid; -} - -/*! - * @brief This function moves the value in member writer_guid - * @param _writer_guid New value to be moved in member writer_guid - */ -void SampleIdentity_s::writer_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _writer_guid) -{ - m_writer_guid = std::move(_writer_guid); -} - -/*! - * @brief This function returns a constant reference to member writer_guid - * @return Constant reference to member writer_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& SampleIdentity_s::writer_guid() const -{ - return m_writer_guid; -} - -/*! - * @brief This function returns a reference to member writer_guid - * @return Reference to member writer_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& SampleIdentity_s::writer_guid() -{ - return m_writer_guid; -} - - -/*! - * @brief This function copies the value in member sequence_number - * @param _sequence_number New value to be copied in member sequence_number - */ -void SampleIdentity_s::sequence_number( - const eprosima::fastdds::statistics::detail::SequenceNumber_s& _sequence_number) -{ - m_sequence_number = _sequence_number; -} - -/*! - * @brief This function moves the value in member sequence_number - * @param _sequence_number New value to be moved in member sequence_number - */ -void SampleIdentity_s::sequence_number( - eprosima::fastdds::statistics::detail::SequenceNumber_s&& _sequence_number) -{ - m_sequence_number = std::move(_sequence_number); -} - -/*! - * @brief This function returns a constant reference to member sequence_number - * @return Constant reference to member sequence_number - */ -const eprosima::fastdds::statistics::detail::SequenceNumber_s& SampleIdentity_s::sequence_number() const -{ - return m_sequence_number; -} - -/*! - * @brief This function returns a reference to member sequence_number - * @return Reference to member sequence_number - */ -eprosima::fastdds::statistics::detail::SequenceNumber_s& SampleIdentity_s::sequence_number() -{ - return m_sequence_number; -} - - - - -Locator_s::Locator_s() -{ -} - -Locator_s::~Locator_s() -{ -} - -Locator_s::Locator_s( - const Locator_s& x) -{ - m_kind = x.m_kind; - m_port = x.m_port; - m_address = x.m_address; -} - -Locator_s::Locator_s( - Locator_s&& x) noexcept -{ - m_kind = x.m_kind; - m_port = x.m_port; - m_address = std::move(x.m_address); -} - -Locator_s& Locator_s::operator =( - const Locator_s& x) -{ - - m_kind = x.m_kind; - m_port = x.m_port; - m_address = x.m_address; - return *this; -} - -Locator_s& Locator_s::operator =( - Locator_s&& x) noexcept -{ - - m_kind = x.m_kind; - m_port = x.m_port; - m_address = std::move(x.m_address); - return *this; -} - -bool Locator_s::operator ==( - const Locator_s& x) const -{ - return (m_kind == x.m_kind && - m_port == x.m_port && - m_address == x.m_address); -} - -bool Locator_s::operator !=( - const Locator_s& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function sets a value in member kind - * @param _kind New value for member kind - */ -void Locator_s::kind( - int32_t _kind) -{ - m_kind = _kind; -} - -/*! - * @brief This function returns the value of member kind - * @return Value of member kind - */ -int32_t Locator_s::kind() const -{ - return m_kind; -} - -/*! - * @brief This function returns a reference to member kind - * @return Reference to member kind - */ -int32_t& Locator_s::kind() -{ - return m_kind; -} - - -/*! - * @brief This function sets a value in member port - * @param _port New value for member port - */ -void Locator_s::port( - uint32_t _port) -{ - m_port = _port; -} - -/*! - * @brief This function returns the value of member port - * @return Value of member port - */ -uint32_t Locator_s::port() const -{ - return m_port; -} - -/*! - * @brief This function returns a reference to member port - * @return Reference to member port - */ -uint32_t& Locator_s::port() -{ - return m_port; -} - - -/*! - * @brief This function copies the value in member address - * @param _address New value to be copied in member address - */ -void Locator_s::address( - const std::array& _address) -{ - m_address = _address; -} - -/*! - * @brief This function moves the value in member address - * @param _address New value to be moved in member address - */ -void Locator_s::address( - std::array&& _address) -{ - m_address = std::move(_address); -} - -/*! - * @brief This function returns a constant reference to member address - * @return Constant reference to member address - */ -const std::array& Locator_s::address() const -{ - return m_address; -} - -/*! - * @brief This function returns a reference to member address - * @return Reference to member address - */ -std::array& Locator_s::address() -{ - return m_address; -} - - - - -} // namespace detail - - -DiscoveryTime::DiscoveryTime() -{ -} - -DiscoveryTime::~DiscoveryTime() -{ -} - -DiscoveryTime::DiscoveryTime( - const DiscoveryTime& x) -{ - m_local_participant_guid = x.m_local_participant_guid; - m_remote_entity_guid = x.m_remote_entity_guid; - m_time = x.m_time; - m_host = x.m_host; - m_user = x.m_user; - m_process = x.m_process; -} - -DiscoveryTime::DiscoveryTime( - DiscoveryTime&& x) noexcept -{ - m_local_participant_guid = std::move(x.m_local_participant_guid); - m_remote_entity_guid = std::move(x.m_remote_entity_guid); - m_time = x.m_time; - m_host = std::move(x.m_host); - m_user = std::move(x.m_user); - m_process = std::move(x.m_process); -} - -DiscoveryTime& DiscoveryTime::operator =( - const DiscoveryTime& x) -{ - - m_local_participant_guid = x.m_local_participant_guid; - m_remote_entity_guid = x.m_remote_entity_guid; - m_time = x.m_time; - m_host = x.m_host; - m_user = x.m_user; - m_process = x.m_process; - return *this; -} - -DiscoveryTime& DiscoveryTime::operator =( - DiscoveryTime&& x) noexcept -{ - - m_local_participant_guid = std::move(x.m_local_participant_guid); - m_remote_entity_guid = std::move(x.m_remote_entity_guid); - m_time = x.m_time; - m_host = std::move(x.m_host); - m_user = std::move(x.m_user); - m_process = std::move(x.m_process); - return *this; -} - -bool DiscoveryTime::operator ==( - const DiscoveryTime& x) const -{ - return (m_local_participant_guid == x.m_local_participant_guid && - m_remote_entity_guid == x.m_remote_entity_guid && - m_time == x.m_time && - m_host == x.m_host && - m_user == x.m_user && - m_process == x.m_process); -} - -bool DiscoveryTime::operator !=( - const DiscoveryTime& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member local_participant_guid - * @param _local_participant_guid New value to be copied in member local_participant_guid - */ -void DiscoveryTime::local_participant_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _local_participant_guid) -{ - m_local_participant_guid = _local_participant_guid; -} - -/*! - * @brief This function moves the value in member local_participant_guid - * @param _local_participant_guid New value to be moved in member local_participant_guid - */ -void DiscoveryTime::local_participant_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _local_participant_guid) -{ - m_local_participant_guid = std::move(_local_participant_guid); -} - -/*! - * @brief This function returns a constant reference to member local_participant_guid - * @return Constant reference to member local_participant_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& DiscoveryTime::local_participant_guid() const -{ - return m_local_participant_guid; -} - -/*! - * @brief This function returns a reference to member local_participant_guid - * @return Reference to member local_participant_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& DiscoveryTime::local_participant_guid() -{ - return m_local_participant_guid; -} - - -/*! - * @brief This function copies the value in member remote_entity_guid - * @param _remote_entity_guid New value to be copied in member remote_entity_guid - */ -void DiscoveryTime::remote_entity_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _remote_entity_guid) -{ - m_remote_entity_guid = _remote_entity_guid; -} - -/*! - * @brief This function moves the value in member remote_entity_guid - * @param _remote_entity_guid New value to be moved in member remote_entity_guid - */ -void DiscoveryTime::remote_entity_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _remote_entity_guid) -{ - m_remote_entity_guid = std::move(_remote_entity_guid); -} - -/*! - * @brief This function returns a constant reference to member remote_entity_guid - * @return Constant reference to member remote_entity_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& DiscoveryTime::remote_entity_guid() const -{ - return m_remote_entity_guid; -} - -/*! - * @brief This function returns a reference to member remote_entity_guid - * @return Reference to member remote_entity_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& DiscoveryTime::remote_entity_guid() -{ - return m_remote_entity_guid; -} - - -/*! - * @brief This function sets a value in member time - * @param _time New value for member time - */ -void DiscoveryTime::time( - uint64_t _time) -{ - m_time = _time; -} - -/*! - * @brief This function returns the value of member time - * @return Value of member time - */ -uint64_t DiscoveryTime::time() const -{ - return m_time; -} - -/*! - * @brief This function returns a reference to member time - * @return Reference to member time - */ -uint64_t& DiscoveryTime::time() -{ - return m_time; -} - - -/*! - * @brief This function copies the value in member host - * @param _host New value to be copied in member host - */ -void DiscoveryTime::host( - const std::string& _host) -{ - m_host = _host; -} - -/*! - * @brief This function moves the value in member host - * @param _host New value to be moved in member host - */ -void DiscoveryTime::host( - std::string&& _host) -{ - m_host = std::move(_host); -} - -/*! - * @brief This function returns a constant reference to member host - * @return Constant reference to member host - */ -const std::string& DiscoveryTime::host() const -{ - return m_host; -} - -/*! - * @brief This function returns a reference to member host - * @return Reference to member host - */ -std::string& DiscoveryTime::host() -{ - return m_host; -} - - -/*! - * @brief This function copies the value in member user - * @param _user New value to be copied in member user - */ -void DiscoveryTime::user( - const std::string& _user) -{ - m_user = _user; -} - -/*! - * @brief This function moves the value in member user - * @param _user New value to be moved in member user - */ -void DiscoveryTime::user( - std::string&& _user) -{ - m_user = std::move(_user); -} - -/*! - * @brief This function returns a constant reference to member user - * @return Constant reference to member user - */ -const std::string& DiscoveryTime::user() const -{ - return m_user; -} - -/*! - * @brief This function returns a reference to member user - * @return Reference to member user - */ -std::string& DiscoveryTime::user() -{ - return m_user; -} - - -/*! - * @brief This function copies the value in member process - * @param _process New value to be copied in member process - */ -void DiscoveryTime::process( - const std::string& _process) -{ - m_process = _process; -} - -/*! - * @brief This function moves the value in member process - * @param _process New value to be moved in member process - */ -void DiscoveryTime::process( - std::string&& _process) -{ - m_process = std::move(_process); -} - -/*! - * @brief This function returns a constant reference to member process - * @return Constant reference to member process - */ -const std::string& DiscoveryTime::process() const -{ - return m_process; -} - -/*! - * @brief This function returns a reference to member process - * @return Reference to member process - */ -std::string& DiscoveryTime::process() -{ - return m_process; -} - - - - -EntityCount::EntityCount() -{ -} - -EntityCount::~EntityCount() -{ -} - -EntityCount::EntityCount( - const EntityCount& x) -{ - m_guid = x.m_guid; - m_count = x.m_count; -} - -EntityCount::EntityCount( - EntityCount&& x) noexcept -{ - m_guid = std::move(x.m_guid); - m_count = x.m_count; -} - -EntityCount& EntityCount::operator =( - const EntityCount& x) -{ - - m_guid = x.m_guid; - m_count = x.m_count; - return *this; -} - -EntityCount& EntityCount::operator =( - EntityCount&& x) noexcept -{ - - m_guid = std::move(x.m_guid); - m_count = x.m_count; - return *this; -} - -bool EntityCount::operator ==( - const EntityCount& x) const -{ - return (m_guid == x.m_guid && - m_count == x.m_count); -} - -bool EntityCount::operator !=( - const EntityCount& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ -void EntityCount::guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid) -{ - m_guid = _guid; -} - -/*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ -void EntityCount::guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid) -{ - m_guid = std::move(_guid); -} - -/*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& EntityCount::guid() const -{ - return m_guid; -} - -/*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ -eprosima::fastdds::statistics::detail::GUID_s& EntityCount::guid() -{ - return m_guid; -} - - -/*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ -void EntityCount::count( - uint64_t _count) -{ - m_count = _count; -} - -/*! - * @brief This function returns the value of member count - * @return Value of member count - */ -uint64_t EntityCount::count() const -{ - return m_count; -} - -/*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ -uint64_t& EntityCount::count() -{ - return m_count; -} - - - - -SampleIdentityCount::SampleIdentityCount() -{ -} - -SampleIdentityCount::~SampleIdentityCount() -{ -} - -SampleIdentityCount::SampleIdentityCount( - const SampleIdentityCount& x) -{ - m_sample_id = x.m_sample_id; - m_count = x.m_count; -} - -SampleIdentityCount::SampleIdentityCount( - SampleIdentityCount&& x) noexcept -{ - m_sample_id = std::move(x.m_sample_id); - m_count = x.m_count; -} - -SampleIdentityCount& SampleIdentityCount::operator =( - const SampleIdentityCount& x) -{ - - m_sample_id = x.m_sample_id; - m_count = x.m_count; - return *this; -} - -SampleIdentityCount& SampleIdentityCount::operator =( - SampleIdentityCount&& x) noexcept -{ - - m_sample_id = std::move(x.m_sample_id); - m_count = x.m_count; - return *this; -} - -bool SampleIdentityCount::operator ==( - const SampleIdentityCount& x) const -{ - return (m_sample_id == x.m_sample_id && - m_count == x.m_count); -} - -bool SampleIdentityCount::operator !=( - const SampleIdentityCount& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member sample_id - * @param _sample_id New value to be copied in member sample_id - */ -void SampleIdentityCount::sample_id( - const eprosima::fastdds::statistics::detail::SampleIdentity_s& _sample_id) -{ - m_sample_id = _sample_id; -} - -/*! - * @brief This function moves the value in member sample_id - * @param _sample_id New value to be moved in member sample_id - */ -void SampleIdentityCount::sample_id( - eprosima::fastdds::statistics::detail::SampleIdentity_s&& _sample_id) -{ - m_sample_id = std::move(_sample_id); -} - -/*! - * @brief This function returns a constant reference to member sample_id - * @return Constant reference to member sample_id - */ -const eprosima::fastdds::statistics::detail::SampleIdentity_s& SampleIdentityCount::sample_id() const -{ - return m_sample_id; -} - -/*! - * @brief This function returns a reference to member sample_id - * @return Reference to member sample_id - */ -eprosima::fastdds::statistics::detail::SampleIdentity_s& SampleIdentityCount::sample_id() -{ - return m_sample_id; -} - - -/*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ -void SampleIdentityCount::count( - uint64_t _count) -{ - m_count = _count; -} - -/*! - * @brief This function returns the value of member count - * @return Value of member count - */ -uint64_t SampleIdentityCount::count() const -{ - return m_count; -} - -/*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ -uint64_t& SampleIdentityCount::count() -{ - return m_count; -} - - - - -Entity2LocatorTraffic::Entity2LocatorTraffic() -{ -} - -Entity2LocatorTraffic::~Entity2LocatorTraffic() -{ -} - -Entity2LocatorTraffic::Entity2LocatorTraffic( - const Entity2LocatorTraffic& x) -{ - m_src_guid = x.m_src_guid; - m_dst_locator = x.m_dst_locator; - m_packet_count = x.m_packet_count; - m_byte_count = x.m_byte_count; - m_byte_magnitude_order = x.m_byte_magnitude_order; -} - -Entity2LocatorTraffic::Entity2LocatorTraffic( - Entity2LocatorTraffic&& x) noexcept -{ - m_src_guid = std::move(x.m_src_guid); - m_dst_locator = std::move(x.m_dst_locator); - m_packet_count = x.m_packet_count; - m_byte_count = x.m_byte_count; - m_byte_magnitude_order = x.m_byte_magnitude_order; -} - -Entity2LocatorTraffic& Entity2LocatorTraffic::operator =( - const Entity2LocatorTraffic& x) -{ - - m_src_guid = x.m_src_guid; - m_dst_locator = x.m_dst_locator; - m_packet_count = x.m_packet_count; - m_byte_count = x.m_byte_count; - m_byte_magnitude_order = x.m_byte_magnitude_order; - return *this; -} - -Entity2LocatorTraffic& Entity2LocatorTraffic::operator =( - Entity2LocatorTraffic&& x) noexcept -{ - - m_src_guid = std::move(x.m_src_guid); - m_dst_locator = std::move(x.m_dst_locator); - m_packet_count = x.m_packet_count; - m_byte_count = x.m_byte_count; - m_byte_magnitude_order = x.m_byte_magnitude_order; - return *this; -} - -bool Entity2LocatorTraffic::operator ==( - const Entity2LocatorTraffic& x) const -{ - return (m_src_guid == x.m_src_guid && - m_dst_locator == x.m_dst_locator && - m_packet_count == x.m_packet_count && - m_byte_count == x.m_byte_count && - m_byte_magnitude_order == x.m_byte_magnitude_order); -} - -bool Entity2LocatorTraffic::operator !=( - const Entity2LocatorTraffic& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member src_guid - * @param _src_guid New value to be copied in member src_guid - */ -void Entity2LocatorTraffic::src_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _src_guid) -{ - m_src_guid = _src_guid; -} - -/*! - * @brief This function moves the value in member src_guid - * @param _src_guid New value to be moved in member src_guid - */ -void Entity2LocatorTraffic::src_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _src_guid) -{ - m_src_guid = std::move(_src_guid); -} - -/*! - * @brief This function returns a constant reference to member src_guid - * @return Constant reference to member src_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& Entity2LocatorTraffic::src_guid() const -{ - return m_src_guid; -} - -/*! - * @brief This function returns a reference to member src_guid - * @return Reference to member src_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& Entity2LocatorTraffic::src_guid() -{ - return m_src_guid; -} - - -/*! - * @brief This function copies the value in member dst_locator - * @param _dst_locator New value to be copied in member dst_locator - */ -void Entity2LocatorTraffic::dst_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _dst_locator) -{ - m_dst_locator = _dst_locator; -} - -/*! - * @brief This function moves the value in member dst_locator - * @param _dst_locator New value to be moved in member dst_locator - */ -void Entity2LocatorTraffic::dst_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _dst_locator) -{ - m_dst_locator = std::move(_dst_locator); -} - -/*! - * @brief This function returns a constant reference to member dst_locator - * @return Constant reference to member dst_locator - */ -const eprosima::fastdds::statistics::detail::Locator_s& Entity2LocatorTraffic::dst_locator() const -{ - return m_dst_locator; -} - -/*! - * @brief This function returns a reference to member dst_locator - * @return Reference to member dst_locator - */ -eprosima::fastdds::statistics::detail::Locator_s& Entity2LocatorTraffic::dst_locator() -{ - return m_dst_locator; -} - - -/*! - * @brief This function sets a value in member packet_count - * @param _packet_count New value for member packet_count - */ -void Entity2LocatorTraffic::packet_count( - uint64_t _packet_count) -{ - m_packet_count = _packet_count; -} - -/*! - * @brief This function returns the value of member packet_count - * @return Value of member packet_count - */ -uint64_t Entity2LocatorTraffic::packet_count() const -{ - return m_packet_count; -} - -/*! - * @brief This function returns a reference to member packet_count - * @return Reference to member packet_count - */ -uint64_t& Entity2LocatorTraffic::packet_count() -{ - return m_packet_count; -} - - -/*! - * @brief This function sets a value in member byte_count - * @param _byte_count New value for member byte_count - */ -void Entity2LocatorTraffic::byte_count( - uint64_t _byte_count) -{ - m_byte_count = _byte_count; -} - -/*! - * @brief This function returns the value of member byte_count - * @return Value of member byte_count - */ -uint64_t Entity2LocatorTraffic::byte_count() const -{ - return m_byte_count; -} - -/*! - * @brief This function returns a reference to member byte_count - * @return Reference to member byte_count - */ -uint64_t& Entity2LocatorTraffic::byte_count() -{ - return m_byte_count; -} - - -/*! - * @brief This function sets a value in member byte_magnitude_order - * @param _byte_magnitude_order New value for member byte_magnitude_order - */ -void Entity2LocatorTraffic::byte_magnitude_order( - int16_t _byte_magnitude_order) -{ - m_byte_magnitude_order = _byte_magnitude_order; -} - -/*! - * @brief This function returns the value of member byte_magnitude_order - * @return Value of member byte_magnitude_order - */ -int16_t Entity2LocatorTraffic::byte_magnitude_order() const -{ - return m_byte_magnitude_order; -} - -/*! - * @brief This function returns a reference to member byte_magnitude_order - * @return Reference to member byte_magnitude_order - */ -int16_t& Entity2LocatorTraffic::byte_magnitude_order() -{ - return m_byte_magnitude_order; -} - - - - -WriterReaderData::WriterReaderData() -{ -} - -WriterReaderData::~WriterReaderData() -{ -} - -WriterReaderData::WriterReaderData( - const WriterReaderData& x) -{ - m_writer_guid = x.m_writer_guid; - m_reader_guid = x.m_reader_guid; - m_data = x.m_data; -} - -WriterReaderData::WriterReaderData( - WriterReaderData&& x) noexcept -{ - m_writer_guid = std::move(x.m_writer_guid); - m_reader_guid = std::move(x.m_reader_guid); - m_data = x.m_data; -} - -WriterReaderData& WriterReaderData::operator =( - const WriterReaderData& x) -{ - - m_writer_guid = x.m_writer_guid; - m_reader_guid = x.m_reader_guid; - m_data = x.m_data; - return *this; -} - -WriterReaderData& WriterReaderData::operator =( - WriterReaderData&& x) noexcept -{ - - m_writer_guid = std::move(x.m_writer_guid); - m_reader_guid = std::move(x.m_reader_guid); - m_data = x.m_data; - return *this; -} - -bool WriterReaderData::operator ==( - const WriterReaderData& x) const -{ - return (m_writer_guid == x.m_writer_guid && - m_reader_guid == x.m_reader_guid && - m_data == x.m_data); -} - -bool WriterReaderData::operator !=( - const WriterReaderData& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member writer_guid - * @param _writer_guid New value to be copied in member writer_guid - */ -void WriterReaderData::writer_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _writer_guid) -{ - m_writer_guid = _writer_guid; -} - -/*! - * @brief This function moves the value in member writer_guid - * @param _writer_guid New value to be moved in member writer_guid - */ -void WriterReaderData::writer_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _writer_guid) -{ - m_writer_guid = std::move(_writer_guid); -} - -/*! - * @brief This function returns a constant reference to member writer_guid - * @return Constant reference to member writer_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& WriterReaderData::writer_guid() const -{ - return m_writer_guid; -} - -/*! - * @brief This function returns a reference to member writer_guid - * @return Reference to member writer_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& WriterReaderData::writer_guid() -{ - return m_writer_guid; -} - - -/*! - * @brief This function copies the value in member reader_guid - * @param _reader_guid New value to be copied in member reader_guid - */ -void WriterReaderData::reader_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _reader_guid) -{ - m_reader_guid = _reader_guid; -} - -/*! - * @brief This function moves the value in member reader_guid - * @param _reader_guid New value to be moved in member reader_guid - */ -void WriterReaderData::reader_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _reader_guid) -{ - m_reader_guid = std::move(_reader_guid); -} - -/*! - * @brief This function returns a constant reference to member reader_guid - * @return Constant reference to member reader_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& WriterReaderData::reader_guid() const -{ - return m_reader_guid; -} - -/*! - * @brief This function returns a reference to member reader_guid - * @return Reference to member reader_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& WriterReaderData::reader_guid() -{ - return m_reader_guid; -} - - -/*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ -void WriterReaderData::data( - float _data) -{ - m_data = _data; -} - -/*! - * @brief This function returns the value of member data - * @return Value of member data - */ -float WriterReaderData::data() const -{ - return m_data; -} - -/*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ -float& WriterReaderData::data() -{ - return m_data; -} - - - - -Locator2LocatorData::Locator2LocatorData() -{ -} - -Locator2LocatorData::~Locator2LocatorData() -{ -} - -Locator2LocatorData::Locator2LocatorData( - const Locator2LocatorData& x) -{ - m_src_locator = x.m_src_locator; - m_dst_locator = x.m_dst_locator; - m_data = x.m_data; -} - -Locator2LocatorData::Locator2LocatorData( - Locator2LocatorData&& x) noexcept -{ - m_src_locator = std::move(x.m_src_locator); - m_dst_locator = std::move(x.m_dst_locator); - m_data = x.m_data; -} - -Locator2LocatorData& Locator2LocatorData::operator =( - const Locator2LocatorData& x) -{ - - m_src_locator = x.m_src_locator; - m_dst_locator = x.m_dst_locator; - m_data = x.m_data; - return *this; -} - -Locator2LocatorData& Locator2LocatorData::operator =( - Locator2LocatorData&& x) noexcept -{ - - m_src_locator = std::move(x.m_src_locator); - m_dst_locator = std::move(x.m_dst_locator); - m_data = x.m_data; - return *this; -} - -bool Locator2LocatorData::operator ==( - const Locator2LocatorData& x) const -{ - return (m_src_locator == x.m_src_locator && - m_dst_locator == x.m_dst_locator && - m_data == x.m_data); -} - -bool Locator2LocatorData::operator !=( - const Locator2LocatorData& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member src_locator - * @param _src_locator New value to be copied in member src_locator - */ -void Locator2LocatorData::src_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _src_locator) -{ - m_src_locator = _src_locator; -} - -/*! - * @brief This function moves the value in member src_locator - * @param _src_locator New value to be moved in member src_locator - */ -void Locator2LocatorData::src_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _src_locator) -{ - m_src_locator = std::move(_src_locator); -} - -/*! - * @brief This function returns a constant reference to member src_locator - * @return Constant reference to member src_locator - */ -const eprosima::fastdds::statistics::detail::Locator_s& Locator2LocatorData::src_locator() const -{ - return m_src_locator; -} - -/*! - * @brief This function returns a reference to member src_locator - * @return Reference to member src_locator - */ -eprosima::fastdds::statistics::detail::Locator_s& Locator2LocatorData::src_locator() -{ - return m_src_locator; -} - - -/*! - * @brief This function copies the value in member dst_locator - * @param _dst_locator New value to be copied in member dst_locator - */ -void Locator2LocatorData::dst_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _dst_locator) -{ - m_dst_locator = _dst_locator; -} - -/*! - * @brief This function moves the value in member dst_locator - * @param _dst_locator New value to be moved in member dst_locator - */ -void Locator2LocatorData::dst_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _dst_locator) -{ - m_dst_locator = std::move(_dst_locator); -} - -/*! - * @brief This function returns a constant reference to member dst_locator - * @return Constant reference to member dst_locator - */ -const eprosima::fastdds::statistics::detail::Locator_s& Locator2LocatorData::dst_locator() const -{ - return m_dst_locator; -} - -/*! - * @brief This function returns a reference to member dst_locator - * @return Reference to member dst_locator - */ -eprosima::fastdds::statistics::detail::Locator_s& Locator2LocatorData::dst_locator() -{ - return m_dst_locator; -} - - -/*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ -void Locator2LocatorData::data( - float _data) -{ - m_data = _data; -} - -/*! - * @brief This function returns the value of member data - * @return Value of member data - */ -float Locator2LocatorData::data() const -{ - return m_data; -} - -/*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ -float& Locator2LocatorData::data() -{ - return m_data; -} - - - - -EntityData::EntityData() -{ -} - -EntityData::~EntityData() -{ -} - -EntityData::EntityData( - const EntityData& x) -{ - m_guid = x.m_guid; - m_data = x.m_data; -} - -EntityData::EntityData( - EntityData&& x) noexcept -{ - m_guid = std::move(x.m_guid); - m_data = x.m_data; -} - -EntityData& EntityData::operator =( - const EntityData& x) -{ - - m_guid = x.m_guid; - m_data = x.m_data; - return *this; -} - -EntityData& EntityData::operator =( - EntityData&& x) noexcept -{ - - m_guid = std::move(x.m_guid); - m_data = x.m_data; - return *this; -} - -bool EntityData::operator ==( - const EntityData& x) const -{ - return (m_guid == x.m_guid && - m_data == x.m_data); -} - -bool EntityData::operator !=( - const EntityData& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ -void EntityData::guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid) -{ - m_guid = _guid; -} - -/*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ -void EntityData::guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid) -{ - m_guid = std::move(_guid); -} - -/*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& EntityData::guid() const -{ - return m_guid; -} - -/*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ -eprosima::fastdds::statistics::detail::GUID_s& EntityData::guid() -{ - return m_guid; -} - - -/*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ -void EntityData::data( - float _data) -{ - m_data = _data; -} - -/*! - * @brief This function returns the value of member data - * @return Value of member data - */ -float EntityData::data() const -{ - return m_data; -} - -/*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ -float& EntityData::data() -{ - return m_data; -} - - - - -PhysicalData::PhysicalData() -{ -} - -PhysicalData::~PhysicalData() -{ -} - -PhysicalData::PhysicalData( - const PhysicalData& x) -{ - m_participant_guid = x.m_participant_guid; - m_host = x.m_host; - m_user = x.m_user; - m_process = x.m_process; -} - -PhysicalData::PhysicalData( - PhysicalData&& x) noexcept -{ - m_participant_guid = std::move(x.m_participant_guid); - m_host = std::move(x.m_host); - m_user = std::move(x.m_user); - m_process = std::move(x.m_process); -} - -PhysicalData& PhysicalData::operator =( - const PhysicalData& x) -{ - - m_participant_guid = x.m_participant_guid; - m_host = x.m_host; - m_user = x.m_user; - m_process = x.m_process; - return *this; -} - -PhysicalData& PhysicalData::operator =( - PhysicalData&& x) noexcept -{ - - m_participant_guid = std::move(x.m_participant_guid); - m_host = std::move(x.m_host); - m_user = std::move(x.m_user); - m_process = std::move(x.m_process); - return *this; -} - -bool PhysicalData::operator ==( - const PhysicalData& x) const -{ - return (m_participant_guid == x.m_participant_guid && - m_host == x.m_host && - m_user == x.m_user && - m_process == x.m_process); -} - -bool PhysicalData::operator !=( - const PhysicalData& x) const -{ - return !(*this == x); -} - -/*! - * @brief This function copies the value in member participant_guid - * @param _participant_guid New value to be copied in member participant_guid - */ -void PhysicalData::participant_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _participant_guid) -{ - m_participant_guid = _participant_guid; -} - -/*! - * @brief This function moves the value in member participant_guid - * @param _participant_guid New value to be moved in member participant_guid - */ -void PhysicalData::participant_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _participant_guid) -{ - m_participant_guid = std::move(_participant_guid); -} - -/*! - * @brief This function returns a constant reference to member participant_guid - * @return Constant reference to member participant_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& PhysicalData::participant_guid() const -{ - return m_participant_guid; -} - -/*! - * @brief This function returns a reference to member participant_guid - * @return Reference to member participant_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& PhysicalData::participant_guid() -{ - return m_participant_guid; -} - - -/*! - * @brief This function copies the value in member host - * @param _host New value to be copied in member host - */ -void PhysicalData::host( - const std::string& _host) -{ - m_host = _host; -} - -/*! - * @brief This function moves the value in member host - * @param _host New value to be moved in member host - */ -void PhysicalData::host( - std::string&& _host) -{ - m_host = std::move(_host); -} - -/*! - * @brief This function returns a constant reference to member host - * @return Constant reference to member host - */ -const std::string& PhysicalData::host() const -{ - return m_host; -} - -/*! - * @brief This function returns a reference to member host - * @return Reference to member host - */ -std::string& PhysicalData::host() -{ - return m_host; -} - - -/*! - * @brief This function copies the value in member user - * @param _user New value to be copied in member user - */ -void PhysicalData::user( - const std::string& _user) -{ - m_user = _user; -} - -/*! - * @brief This function moves the value in member user - * @param _user New value to be moved in member user - */ -void PhysicalData::user( - std::string&& _user) -{ - m_user = std::move(_user); -} - -/*! - * @brief This function returns a constant reference to member user - * @return Constant reference to member user - */ -const std::string& PhysicalData::user() const -{ - return m_user; -} - -/*! - * @brief This function returns a reference to member user - * @return Reference to member user - */ -std::string& PhysicalData::user() -{ - return m_user; -} - - -/*! - * @brief This function copies the value in member process - * @param _process New value to be copied in member process - */ -void PhysicalData::process( - const std::string& _process) -{ - m_process = _process; -} - -/*! - * @brief This function moves the value in member process - * @param _process New value to be moved in member process - */ -void PhysicalData::process( - std::string&& _process) -{ - m_process = std::move(_process); -} - -/*! - * @brief This function returns a constant reference to member process - * @return Constant reference to member process - */ -const std::string& PhysicalData::process() const -{ - return m_process; -} - -/*! - * @brief This function returns a reference to member process - * @return Reference to member process - */ -std::string& PhysicalData::process() -{ - return m_process; -} - - - - - -Data::Data() -{ - m__d = eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY; -} - -Data::~Data() -{ -} - -Data::Data( - const Data& x) -{ - m__d = x.m__d; - - switch (m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - m_writer_reader_data = x.m_writer_reader_data; - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - m_locator2locator_data = x.m_locator2locator_data; - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - m_entity_data = x.m_entity_data; - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - m_entity2locator_traffic = x.m_entity2locator_traffic; - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - m_entity_count = x.m_entity_count; - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - m_discovery_time = x.m_discovery_time; - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - m_sample_identity_count = x.m_sample_identity_count; - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - m_physical_data = x.m_physical_data; - break; - - default: - break; - } -} - -Data::Data( - Data&& x) noexcept -{ - m__d = x.m__d; - - switch (m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - m_writer_reader_data = std::move(x.m_writer_reader_data); - - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - m_locator2locator_data = std::move(x.m_locator2locator_data); - - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - m_entity_data = std::move(x.m_entity_data); - - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - m_entity2locator_traffic = std::move(x.m_entity2locator_traffic); - - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - m_entity_count = std::move(x.m_entity_count); - - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - m_discovery_time = std::move(x.m_discovery_time); - - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - m_sample_identity_count = std::move(x.m_sample_identity_count); - - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - m_physical_data = std::move(x.m_physical_data); - - break; - - default: - break; - } -} - -Data& Data::operator =( - const Data& x) -{ - m__d = x.m__d; - - switch (m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - m_writer_reader_data = x.m_writer_reader_data; - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - m_locator2locator_data = x.m_locator2locator_data; - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - m_entity_data = x.m_entity_data; - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - m_entity2locator_traffic = x.m_entity2locator_traffic; - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - m_entity_count = x.m_entity_count; - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - m_discovery_time = x.m_discovery_time; - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - m_sample_identity_count = x.m_sample_identity_count; - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - m_physical_data = x.m_physical_data; - break; - - default: - break; - } - - return *this; -} - -Data& Data::operator =( - Data&& x) noexcept -{ - m__d = x.m__d; - - switch (m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - m_writer_reader_data = std::move(x.m_writer_reader_data); - - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - m_locator2locator_data = std::move(x.m_locator2locator_data); - - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - m_entity_data = std::move(x.m_entity_data); - - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - m_entity2locator_traffic = std::move(x.m_entity2locator_traffic); - - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - m_entity_count = std::move(x.m_entity_count); - - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - m_discovery_time = std::move(x.m_discovery_time); - - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - m_sample_identity_count = std::move(x.m_sample_identity_count); - - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - m_physical_data = std::move(x.m_physical_data); - - break; - - default: - break; - } - - return *this; -} - -bool Data::operator ==( - const Data& x) const -{ - if (m__d != x.m__d) - { - return false; - } - - switch (m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - return (m_writer_reader_data == x.m_writer_reader_data); - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - return (m_locator2locator_data == x.m_locator2locator_data); - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - return (m_entity_data == x.m_entity_data); - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - return (m_entity2locator_traffic == x.m_entity2locator_traffic); - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - return (m_entity_count == x.m_entity_count); - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - return (m_discovery_time == x.m_discovery_time); - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - return (m_sample_identity_count == x.m_sample_identity_count); - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - return (m_physical_data == x.m_physical_data); - break; - - default: - break; - } - return false; -} - -bool Data::operator !=( - const Data& x) const -{ - return !(*this == x); -} - -void Data::_d( - eprosima::fastdds::statistics::EventKind __d) -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - switch (__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - switch (__d) - { - case eprosima::fastdds::statistics::NETWORK_LATENCY: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - switch (__d) - { - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - switch (__d) - { - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - switch (__d) - { - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - switch (__d) - { - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - switch (__d) - { - case eprosima::fastdds::statistics::SAMPLE_DATAS: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - switch (__d) - { - case eprosima::fastdds::statistics::PHYSICAL_DATA: - b = true; - break; - default: - break; - } - break; - - default: - break; - } - - if (!b) - { - throw BadParamException("Discriminator doesn't correspond with the selected union member"); - } - - m__d = __d; -} - -eprosima::fastdds::statistics::EventKind Data::_d() const -{ - return m__d; -} - -eprosima::fastdds::statistics::EventKind& Data::_d() -{ - return m__d; -} - -void Data::writer_reader_data( - const eprosima::fastdds::statistics::WriterReaderData& _writer_reader_data) -{ - m_writer_reader_data = _writer_reader_data; - m__d = eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY; - -} - -void Data::writer_reader_data( - eprosima::fastdds::statistics::WriterReaderData&& _writer_reader_data) -{ - m_writer_reader_data = std::move(_writer_reader_data); - m__d = eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY; - -} - -const eprosima::fastdds::statistics::WriterReaderData& Data::writer_reader_data() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_writer_reader_data; -} - -eprosima::fastdds::statistics::WriterReaderData& Data::writer_reader_data() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_writer_reader_data; -} - - -void Data::locator2locator_data( - const eprosima::fastdds::statistics::Locator2LocatorData& _locator2locator_data) -{ - m_locator2locator_data = _locator2locator_data; - m__d = eprosima::fastdds::statistics::NETWORK_LATENCY; - -} - -void Data::locator2locator_data( - eprosima::fastdds::statistics::Locator2LocatorData&& _locator2locator_data) -{ - m_locator2locator_data = std::move(_locator2locator_data); - m__d = eprosima::fastdds::statistics::NETWORK_LATENCY; - -} - -const eprosima::fastdds::statistics::Locator2LocatorData& Data::locator2locator_data() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::NETWORK_LATENCY: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_locator2locator_data; -} - -eprosima::fastdds::statistics::Locator2LocatorData& Data::locator2locator_data() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::NETWORK_LATENCY: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_locator2locator_data; -} - - -void Data::entity_data( - const eprosima::fastdds::statistics::EntityData& _entity_data) -{ - m_entity_data = _entity_data; - m__d = eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT; - -} - -void Data::entity_data( - eprosima::fastdds::statistics::EntityData&& _entity_data) -{ - m_entity_data = std::move(_entity_data); - m__d = eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT; - -} - -const eprosima::fastdds::statistics::EntityData& Data::entity_data() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_data; -} - -eprosima::fastdds::statistics::EntityData& Data::entity_data() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_data; -} - - -void Data::entity2locator_traffic( - const eprosima::fastdds::statistics::Entity2LocatorTraffic& _entity2locator_traffic) -{ - m_entity2locator_traffic = _entity2locator_traffic; - m__d = eprosima::fastdds::statistics::RTPS_SENT; - -} - -void Data::entity2locator_traffic( - eprosima::fastdds::statistics::Entity2LocatorTraffic&& _entity2locator_traffic) -{ - m_entity2locator_traffic = std::move(_entity2locator_traffic); - m__d = eprosima::fastdds::statistics::RTPS_SENT; - -} - -const eprosima::fastdds::statistics::Entity2LocatorTraffic& Data::entity2locator_traffic() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity2locator_traffic; -} - -eprosima::fastdds::statistics::Entity2LocatorTraffic& Data::entity2locator_traffic() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity2locator_traffic; -} - - -void Data::entity_count( - const eprosima::fastdds::statistics::EntityCount& _entity_count) -{ - m_entity_count = _entity_count; - m__d = eprosima::fastdds::statistics::RESENT_DATAS; - -} - -void Data::entity_count( - eprosima::fastdds::statistics::EntityCount&& _entity_count) -{ - m_entity_count = std::move(_entity_count); - m__d = eprosima::fastdds::statistics::RESENT_DATAS; - -} - -const eprosima::fastdds::statistics::EntityCount& Data::entity_count() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_count; -} - -eprosima::fastdds::statistics::EntityCount& Data::entity_count() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_count; -} - - -void Data::discovery_time( - const eprosima::fastdds::statistics::DiscoveryTime& _discovery_time) -{ - m_discovery_time = _discovery_time; - m__d = eprosima::fastdds::statistics::DISCOVERED_ENTITY; - -} - -void Data::discovery_time( - eprosima::fastdds::statistics::DiscoveryTime&& _discovery_time) -{ - m_discovery_time = std::move(_discovery_time); - m__d = eprosima::fastdds::statistics::DISCOVERED_ENTITY; - -} - -const eprosima::fastdds::statistics::DiscoveryTime& Data::discovery_time() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_discovery_time; -} - -eprosima::fastdds::statistics::DiscoveryTime& Data::discovery_time() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_discovery_time; -} - - -void Data::sample_identity_count( - const eprosima::fastdds::statistics::SampleIdentityCount& _sample_identity_count) -{ - m_sample_identity_count = _sample_identity_count; - m__d = eprosima::fastdds::statistics::SAMPLE_DATAS; - -} - -void Data::sample_identity_count( - eprosima::fastdds::statistics::SampleIdentityCount&& _sample_identity_count) -{ - m_sample_identity_count = std::move(_sample_identity_count); - m__d = eprosima::fastdds::statistics::SAMPLE_DATAS; - -} - -const eprosima::fastdds::statistics::SampleIdentityCount& Data::sample_identity_count() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::SAMPLE_DATAS: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_sample_identity_count; -} - -eprosima::fastdds::statistics::SampleIdentityCount& Data::sample_identity_count() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::SAMPLE_DATAS: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_sample_identity_count; -} - - -void Data::physical_data( - const eprosima::fastdds::statistics::PhysicalData& _physical_data) -{ - m_physical_data = _physical_data; - m__d = eprosima::fastdds::statistics::PHYSICAL_DATA; - -} - -void Data::physical_data( - eprosima::fastdds::statistics::PhysicalData&& _physical_data) -{ - m_physical_data = std::move(_physical_data); - m__d = eprosima::fastdds::statistics::PHYSICAL_DATA; - -} - -const eprosima::fastdds::statistics::PhysicalData& Data::physical_data() const -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::PHYSICAL_DATA: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_physical_data; -} - -eprosima::fastdds::statistics::PhysicalData& Data::physical_data() -{ - bool b = false; - - switch (m__d) - { - case eprosima::fastdds::statistics::PHYSICAL_DATA: - b = true; - break; - default: - break; - } - - if (!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_physical_data; -} - - - - -} // namespace statistics - - -} // namespace fastdds - - -} // namespace eprosima -// Include auxiliary functions like for serializing/deserializing. -#include "typesCdrAux.ipp" - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/include/fastdds_statistics_backend/topic_types/types.h b/include/fastdds_statistics_backend/topic_types/types.h deleted file mode 100644 index c51a79f20..000000000 --- a/include/fastdds_statistics_backend/topic_types/types.h +++ /dev/null @@ -1,2331 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file types.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include -#include "typesv1.h" - -#if FASTCDR_VERSION_MAJOR > 1 - -#ifndef _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPES_H_ -#define _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPES_H_ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(TYPES_SOURCE) -#define TYPES_DllAPI __declspec( dllexport ) -#else -#define TYPES_DllAPI __declspec( dllimport ) -#endif // TYPES_SOURCE -#else -#define TYPES_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define TYPES_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -class CdrSizeCalculator; -} // namespace fastcdr -} // namespace eprosima - - - -namespace eprosima { - -namespace fastdds { - -namespace statistics { - -namespace detail { - - - -/*! - * @brief This class represents the structure EntityId_s defined by the user in the IDL file. - * @ingroup types - */ -class EntityId_s -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport EntityId_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~EntityId_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::EntityId_s that will be copied. - */ - eProsima_user_DllExport EntityId_s( - const EntityId_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::EntityId_s that will be copied. - */ - eProsima_user_DllExport EntityId_s( - EntityId_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::EntityId_s that will be copied. - */ - eProsima_user_DllExport EntityId_s& operator =( - const EntityId_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::EntityId_s that will be copied. - */ - eProsima_user_DllExport EntityId_s& operator =( - EntityId_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::EntityId_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const EntityId_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::EntityId_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const EntityId_s& x) const; - - /*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ - eProsima_user_DllExport void value( - const std::array& _value); - - /*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ - eProsima_user_DllExport void value( - std::array&& _value); - - /*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ - eProsima_user_DllExport const std::array& value() const; - - /*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ - eProsima_user_DllExport std::array& value(); - -private: - - std::array m_value{0}; - -}; - - -/*! - * @brief This class represents the structure GuidPrefix_s defined by the user in the IDL file. - * @ingroup types - */ -class GuidPrefix_s -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport GuidPrefix_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~GuidPrefix_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GuidPrefix_s that will be copied. - */ - eProsima_user_DllExport GuidPrefix_s( - const GuidPrefix_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GuidPrefix_s that will be copied. - */ - eProsima_user_DllExport GuidPrefix_s( - GuidPrefix_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GuidPrefix_s that will be copied. - */ - eProsima_user_DllExport GuidPrefix_s& operator =( - const GuidPrefix_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GuidPrefix_s that will be copied. - */ - eProsima_user_DllExport GuidPrefix_s& operator =( - GuidPrefix_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::GuidPrefix_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const GuidPrefix_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::GuidPrefix_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const GuidPrefix_s& x) const; - - /*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ - eProsima_user_DllExport void value( - const std::array& _value); - - /*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ - eProsima_user_DllExport void value( - std::array&& _value); - - /*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ - eProsima_user_DllExport const std::array& value() const; - - /*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ - eProsima_user_DllExport std::array& value(); - -private: - - std::array m_value{0}; - -}; - - -/*! - * @brief This class represents the structure GUID_s defined by the user in the IDL file. - * @ingroup types - */ -class GUID_s -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport GUID_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~GUID_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GUID_s that will be copied. - */ - eProsima_user_DllExport GUID_s( - const GUID_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GUID_s that will be copied. - */ - eProsima_user_DllExport GUID_s( - GUID_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GUID_s that will be copied. - */ - eProsima_user_DllExport GUID_s& operator =( - const GUID_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GUID_s that will be copied. - */ - eProsima_user_DllExport GUID_s& operator =( - GUID_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::GUID_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const GUID_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::GUID_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const GUID_s& x) const; - - /*! - * @brief This function copies the value in member guidPrefix - * @param _guidPrefix New value to be copied in member guidPrefix - */ - eProsima_user_DllExport void guidPrefix( - const eprosima::fastdds::statistics::detail::GuidPrefix_s& _guidPrefix); - - /*! - * @brief This function moves the value in member guidPrefix - * @param _guidPrefix New value to be moved in member guidPrefix - */ - eProsima_user_DllExport void guidPrefix( - eprosima::fastdds::statistics::detail::GuidPrefix_s&& _guidPrefix); - - /*! - * @brief This function returns a constant reference to member guidPrefix - * @return Constant reference to member guidPrefix - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GuidPrefix_s& guidPrefix() const; - - /*! - * @brief This function returns a reference to member guidPrefix - * @return Reference to member guidPrefix - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GuidPrefix_s& guidPrefix(); - - - /*! - * @brief This function copies the value in member entityId - * @param _entityId New value to be copied in member entityId - */ - eProsima_user_DllExport void entityId( - const eprosima::fastdds::statistics::detail::EntityId_s& _entityId); - - /*! - * @brief This function moves the value in member entityId - * @param _entityId New value to be moved in member entityId - */ - eProsima_user_DllExport void entityId( - eprosima::fastdds::statistics::detail::EntityId_s&& _entityId); - - /*! - * @brief This function returns a constant reference to member entityId - * @return Constant reference to member entityId - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::EntityId_s& entityId() const; - - /*! - * @brief This function returns a reference to member entityId - * @return Reference to member entityId - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::EntityId_s& entityId(); - -private: - - eprosima::fastdds::statistics::detail::GuidPrefix_s m_guidPrefix; - eprosima::fastdds::statistics::detail::EntityId_s m_entityId; - -}; - - -/*! - * @brief This class represents the structure SequenceNumber_s defined by the user in the IDL file. - * @ingroup types - */ -class SequenceNumber_s -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport SequenceNumber_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~SequenceNumber_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SequenceNumber_s that will be copied. - */ - eProsima_user_DllExport SequenceNumber_s( - const SequenceNumber_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SequenceNumber_s that will be copied. - */ - eProsima_user_DllExport SequenceNumber_s( - SequenceNumber_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SequenceNumber_s that will be copied. - */ - eProsima_user_DllExport SequenceNumber_s& operator =( - const SequenceNumber_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SequenceNumber_s that will be copied. - */ - eProsima_user_DllExport SequenceNumber_s& operator =( - SequenceNumber_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::SequenceNumber_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const SequenceNumber_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::SequenceNumber_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const SequenceNumber_s& x) const; - - /*! - * @brief This function sets a value in member high - * @param _high New value for member high - */ - eProsima_user_DllExport void high( - int32_t _high); - - /*! - * @brief This function returns the value of member high - * @return Value of member high - */ - eProsima_user_DllExport int32_t high() const; - - /*! - * @brief This function returns a reference to member high - * @return Reference to member high - */ - eProsima_user_DllExport int32_t& high(); - - - /*! - * @brief This function sets a value in member low - * @param _low New value for member low - */ - eProsima_user_DllExport void low( - uint32_t _low); - - /*! - * @brief This function returns the value of member low - * @return Value of member low - */ - eProsima_user_DllExport uint32_t low() const; - - /*! - * @brief This function returns a reference to member low - * @return Reference to member low - */ - eProsima_user_DllExport uint32_t& low(); - -private: - - int32_t m_high{0}; - uint32_t m_low{0}; - -}; - - -/*! - * @brief This class represents the structure SampleIdentity_s defined by the user in the IDL file. - * @ingroup types - */ -class SampleIdentity_s -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport SampleIdentity_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~SampleIdentity_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SampleIdentity_s that will be copied. - */ - eProsima_user_DllExport SampleIdentity_s( - const SampleIdentity_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SampleIdentity_s that will be copied. - */ - eProsima_user_DllExport SampleIdentity_s( - SampleIdentity_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SampleIdentity_s that will be copied. - */ - eProsima_user_DllExport SampleIdentity_s& operator =( - const SampleIdentity_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SampleIdentity_s that will be copied. - */ - eProsima_user_DllExport SampleIdentity_s& operator =( - SampleIdentity_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::SampleIdentity_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const SampleIdentity_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::SampleIdentity_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const SampleIdentity_s& x) const; - - /*! - * @brief This function copies the value in member writer_guid - * @param _writer_guid New value to be copied in member writer_guid - */ - eProsima_user_DllExport void writer_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _writer_guid); - - /*! - * @brief This function moves the value in member writer_guid - * @param _writer_guid New value to be moved in member writer_guid - */ - eProsima_user_DllExport void writer_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _writer_guid); - - /*! - * @brief This function returns a constant reference to member writer_guid - * @return Constant reference to member writer_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& writer_guid() const; - - /*! - * @brief This function returns a reference to member writer_guid - * @return Reference to member writer_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& writer_guid(); - - - /*! - * @brief This function copies the value in member sequence_number - * @param _sequence_number New value to be copied in member sequence_number - */ - eProsima_user_DllExport void sequence_number( - const eprosima::fastdds::statistics::detail::SequenceNumber_s& _sequence_number); - - /*! - * @brief This function moves the value in member sequence_number - * @param _sequence_number New value to be moved in member sequence_number - */ - eProsima_user_DllExport void sequence_number( - eprosima::fastdds::statistics::detail::SequenceNumber_s&& _sequence_number); - - /*! - * @brief This function returns a constant reference to member sequence_number - * @return Constant reference to member sequence_number - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::SequenceNumber_s& sequence_number() const; - - /*! - * @brief This function returns a reference to member sequence_number - * @return Reference to member sequence_number - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::SequenceNumber_s& sequence_number(); - -private: - - eprosima::fastdds::statistics::detail::GUID_s m_writer_guid; - eprosima::fastdds::statistics::detail::SequenceNumber_s m_sequence_number; - -}; - - -/*! - * @brief This class represents the structure Locator_s defined by the user in the IDL file. - * @ingroup types - */ -class Locator_s -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport Locator_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~Locator_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::Locator_s that will be copied. - */ - eProsima_user_DllExport Locator_s( - const Locator_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::Locator_s that will be copied. - */ - eProsima_user_DllExport Locator_s( - Locator_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::Locator_s that will be copied. - */ - eProsima_user_DllExport Locator_s& operator =( - const Locator_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::Locator_s that will be copied. - */ - eProsima_user_DllExport Locator_s& operator =( - Locator_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::Locator_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const Locator_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::Locator_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const Locator_s& x) const; - - /*! - * @brief This function sets a value in member kind - * @param _kind New value for member kind - */ - eProsima_user_DllExport void kind( - int32_t _kind); - - /*! - * @brief This function returns the value of member kind - * @return Value of member kind - */ - eProsima_user_DllExport int32_t kind() const; - - /*! - * @brief This function returns a reference to member kind - * @return Reference to member kind - */ - eProsima_user_DllExport int32_t& kind(); - - - /*! - * @brief This function sets a value in member port - * @param _port New value for member port - */ - eProsima_user_DllExport void port( - uint32_t _port); - - /*! - * @brief This function returns the value of member port - * @return Value of member port - */ - eProsima_user_DllExport uint32_t port() const; - - /*! - * @brief This function returns a reference to member port - * @return Reference to member port - */ - eProsima_user_DllExport uint32_t& port(); - - - /*! - * @brief This function copies the value in member address - * @param _address New value to be copied in member address - */ - eProsima_user_DllExport void address( - const std::array& _address); - - /*! - * @brief This function moves the value in member address - * @param _address New value to be moved in member address - */ - eProsima_user_DllExport void address( - std::array&& _address); - - /*! - * @brief This function returns a constant reference to member address - * @return Constant reference to member address - */ - eProsima_user_DllExport const std::array& address() const; - - /*! - * @brief This function returns a reference to member address - * @return Reference to member address - */ - eProsima_user_DllExport std::array& address(); - -private: - - int32_t m_kind{0}; - uint32_t m_port{0}; - std::array m_address{0}; - -}; - -} // namespace detail - - -/*! - * @brief This class represents the structure DiscoveryTime defined by the user in the IDL file. - * @ingroup types - */ -class DiscoveryTime -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport DiscoveryTime(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~DiscoveryTime(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::DiscoveryTime that will be copied. - */ - eProsima_user_DllExport DiscoveryTime( - const DiscoveryTime& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::DiscoveryTime that will be copied. - */ - eProsima_user_DllExport DiscoveryTime( - DiscoveryTime&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::DiscoveryTime that will be copied. - */ - eProsima_user_DllExport DiscoveryTime& operator =( - const DiscoveryTime& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::DiscoveryTime that will be copied. - */ - eProsima_user_DllExport DiscoveryTime& operator =( - DiscoveryTime&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::DiscoveryTime object to compare. - */ - eProsima_user_DllExport bool operator ==( - const DiscoveryTime& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::DiscoveryTime object to compare. - */ - eProsima_user_DllExport bool operator !=( - const DiscoveryTime& x) const; - - /*! - * @brief This function copies the value in member local_participant_guid - * @param _local_participant_guid New value to be copied in member local_participant_guid - */ - eProsima_user_DllExport void local_participant_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _local_participant_guid); - - /*! - * @brief This function moves the value in member local_participant_guid - * @param _local_participant_guid New value to be moved in member local_participant_guid - */ - eProsima_user_DllExport void local_participant_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _local_participant_guid); - - /*! - * @brief This function returns a constant reference to member local_participant_guid - * @return Constant reference to member local_participant_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& local_participant_guid() const; - - /*! - * @brief This function returns a reference to member local_participant_guid - * @return Reference to member local_participant_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& local_participant_guid(); - - - /*! - * @brief This function copies the value in member remote_entity_guid - * @param _remote_entity_guid New value to be copied in member remote_entity_guid - */ - eProsima_user_DllExport void remote_entity_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _remote_entity_guid); - - /*! - * @brief This function moves the value in member remote_entity_guid - * @param _remote_entity_guid New value to be moved in member remote_entity_guid - */ - eProsima_user_DllExport void remote_entity_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _remote_entity_guid); - - /*! - * @brief This function returns a constant reference to member remote_entity_guid - * @return Constant reference to member remote_entity_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& remote_entity_guid() const; - - /*! - * @brief This function returns a reference to member remote_entity_guid - * @return Reference to member remote_entity_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& remote_entity_guid(); - - - /*! - * @brief This function sets a value in member time - * @param _time New value for member time - */ - eProsima_user_DllExport void time( - uint64_t _time); - - /*! - * @brief This function returns the value of member time - * @return Value of member time - */ - eProsima_user_DllExport uint64_t time() const; - - /*! - * @brief This function returns a reference to member time - * @return Reference to member time - */ - eProsima_user_DllExport uint64_t& time(); - - - /*! - * @brief This function copies the value in member host - * @param _host New value to be copied in member host - */ - eProsima_user_DllExport void host( - const std::string& _host); - - /*! - * @brief This function moves the value in member host - * @param _host New value to be moved in member host - */ - eProsima_user_DllExport void host( - std::string&& _host); - - /*! - * @brief This function returns a constant reference to member host - * @return Constant reference to member host - */ - eProsima_user_DllExport const std::string& host() const; - - /*! - * @brief This function returns a reference to member host - * @return Reference to member host - */ - eProsima_user_DllExport std::string& host(); - - - /*! - * @brief This function copies the value in member user - * @param _user New value to be copied in member user - */ - eProsima_user_DllExport void user( - const std::string& _user); - - /*! - * @brief This function moves the value in member user - * @param _user New value to be moved in member user - */ - eProsima_user_DllExport void user( - std::string&& _user); - - /*! - * @brief This function returns a constant reference to member user - * @return Constant reference to member user - */ - eProsima_user_DllExport const std::string& user() const; - - /*! - * @brief This function returns a reference to member user - * @return Reference to member user - */ - eProsima_user_DllExport std::string& user(); - - - /*! - * @brief This function copies the value in member process - * @param _process New value to be copied in member process - */ - eProsima_user_DllExport void process( - const std::string& _process); - - /*! - * @brief This function moves the value in member process - * @param _process New value to be moved in member process - */ - eProsima_user_DllExport void process( - std::string&& _process); - - /*! - * @brief This function returns a constant reference to member process - * @return Constant reference to member process - */ - eProsima_user_DllExport const std::string& process() const; - - /*! - * @brief This function returns a reference to member process - * @return Reference to member process - */ - eProsima_user_DllExport std::string& process(); - -private: - - eprosima::fastdds::statistics::detail::GUID_s m_local_participant_guid; - eprosima::fastdds::statistics::detail::GUID_s m_remote_entity_guid; - uint64_t m_time{0}; - std::string m_host; - std::string m_user; - std::string m_process; - -}; - - -/*! - * @brief This class represents the structure EntityCount defined by the user in the IDL file. - * @ingroup types - */ -class EntityCount -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport EntityCount(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~EntityCount(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::EntityCount that will be copied. - */ - eProsima_user_DllExport EntityCount( - const EntityCount& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::EntityCount that will be copied. - */ - eProsima_user_DllExport EntityCount( - EntityCount&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::EntityCount that will be copied. - */ - eProsima_user_DllExport EntityCount& operator =( - const EntityCount& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::EntityCount that will be copied. - */ - eProsima_user_DllExport EntityCount& operator =( - EntityCount&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::EntityCount object to compare. - */ - eProsima_user_DllExport bool operator ==( - const EntityCount& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::EntityCount object to compare. - */ - eProsima_user_DllExport bool operator !=( - const EntityCount& x) const; - - /*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ - eProsima_user_DllExport void guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid); - - /*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ - eProsima_user_DllExport void guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid); - - /*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& guid() const; - - /*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& guid(); - - - /*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ - eProsima_user_DllExport void count( - uint64_t _count); - - /*! - * @brief This function returns the value of member count - * @return Value of member count - */ - eProsima_user_DllExport uint64_t count() const; - - /*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ - eProsima_user_DllExport uint64_t& count(); - -private: - - eprosima::fastdds::statistics::detail::GUID_s m_guid; - uint64_t m_count{0}; - -}; - - -/*! - * @brief This class represents the structure SampleIdentityCount defined by the user in the IDL file. - * @ingroup types - */ -class SampleIdentityCount -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport SampleIdentityCount(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~SampleIdentityCount(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::SampleIdentityCount that will be copied. - */ - eProsima_user_DllExport SampleIdentityCount( - const SampleIdentityCount& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::SampleIdentityCount that will be copied. - */ - eProsima_user_DllExport SampleIdentityCount( - SampleIdentityCount&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::SampleIdentityCount that will be copied. - */ - eProsima_user_DllExport SampleIdentityCount& operator =( - const SampleIdentityCount& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::SampleIdentityCount that will be copied. - */ - eProsima_user_DllExport SampleIdentityCount& operator =( - SampleIdentityCount&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::SampleIdentityCount object to compare. - */ - eProsima_user_DllExport bool operator ==( - const SampleIdentityCount& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::SampleIdentityCount object to compare. - */ - eProsima_user_DllExport bool operator !=( - const SampleIdentityCount& x) const; - - /*! - * @brief This function copies the value in member sample_id - * @param _sample_id New value to be copied in member sample_id - */ - eProsima_user_DllExport void sample_id( - const eprosima::fastdds::statistics::detail::SampleIdentity_s& _sample_id); - - /*! - * @brief This function moves the value in member sample_id - * @param _sample_id New value to be moved in member sample_id - */ - eProsima_user_DllExport void sample_id( - eprosima::fastdds::statistics::detail::SampleIdentity_s&& _sample_id); - - /*! - * @brief This function returns a constant reference to member sample_id - * @return Constant reference to member sample_id - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::SampleIdentity_s& sample_id() const; - - /*! - * @brief This function returns a reference to member sample_id - * @return Reference to member sample_id - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::SampleIdentity_s& sample_id(); - - - /*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ - eProsima_user_DllExport void count( - uint64_t _count); - - /*! - * @brief This function returns the value of member count - * @return Value of member count - */ - eProsima_user_DllExport uint64_t count() const; - - /*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ - eProsima_user_DllExport uint64_t& count(); - -private: - - eprosima::fastdds::statistics::detail::SampleIdentity_s m_sample_id; - uint64_t m_count{0}; - -}; - - -/*! - * @brief This class represents the structure Entity2LocatorTraffic defined by the user in the IDL file. - * @ingroup types - */ -class Entity2LocatorTraffic -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport Entity2LocatorTraffic(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~Entity2LocatorTraffic(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Entity2LocatorTraffic that will be copied. - */ - eProsima_user_DllExport Entity2LocatorTraffic( - const Entity2LocatorTraffic& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Entity2LocatorTraffic that will be copied. - */ - eProsima_user_DllExport Entity2LocatorTraffic( - Entity2LocatorTraffic&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Entity2LocatorTraffic that will be copied. - */ - eProsima_user_DllExport Entity2LocatorTraffic& operator =( - const Entity2LocatorTraffic& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Entity2LocatorTraffic that will be copied. - */ - eProsima_user_DllExport Entity2LocatorTraffic& operator =( - Entity2LocatorTraffic&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Entity2LocatorTraffic object to compare. - */ - eProsima_user_DllExport bool operator ==( - const Entity2LocatorTraffic& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Entity2LocatorTraffic object to compare. - */ - eProsima_user_DllExport bool operator !=( - const Entity2LocatorTraffic& x) const; - - /*! - * @brief This function copies the value in member src_guid - * @param _src_guid New value to be copied in member src_guid - */ - eProsima_user_DllExport void src_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _src_guid); - - /*! - * @brief This function moves the value in member src_guid - * @param _src_guid New value to be moved in member src_guid - */ - eProsima_user_DllExport void src_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _src_guid); - - /*! - * @brief This function returns a constant reference to member src_guid - * @return Constant reference to member src_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& src_guid() const; - - /*! - * @brief This function returns a reference to member src_guid - * @return Reference to member src_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& src_guid(); - - - /*! - * @brief This function copies the value in member dst_locator - * @param _dst_locator New value to be copied in member dst_locator - */ - eProsima_user_DllExport void dst_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _dst_locator); - - /*! - * @brief This function moves the value in member dst_locator - * @param _dst_locator New value to be moved in member dst_locator - */ - eProsima_user_DllExport void dst_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _dst_locator); - - /*! - * @brief This function returns a constant reference to member dst_locator - * @return Constant reference to member dst_locator - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::Locator_s& dst_locator() const; - - /*! - * @brief This function returns a reference to member dst_locator - * @return Reference to member dst_locator - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::Locator_s& dst_locator(); - - - /*! - * @brief This function sets a value in member packet_count - * @param _packet_count New value for member packet_count - */ - eProsima_user_DllExport void packet_count( - uint64_t _packet_count); - - /*! - * @brief This function returns the value of member packet_count - * @return Value of member packet_count - */ - eProsima_user_DllExport uint64_t packet_count() const; - - /*! - * @brief This function returns a reference to member packet_count - * @return Reference to member packet_count - */ - eProsima_user_DllExport uint64_t& packet_count(); - - - /*! - * @brief This function sets a value in member byte_count - * @param _byte_count New value for member byte_count - */ - eProsima_user_DllExport void byte_count( - uint64_t _byte_count); - - /*! - * @brief This function returns the value of member byte_count - * @return Value of member byte_count - */ - eProsima_user_DllExport uint64_t byte_count() const; - - /*! - * @brief This function returns a reference to member byte_count - * @return Reference to member byte_count - */ - eProsima_user_DllExport uint64_t& byte_count(); - - - /*! - * @brief This function sets a value in member byte_magnitude_order - * @param _byte_magnitude_order New value for member byte_magnitude_order - */ - eProsima_user_DllExport void byte_magnitude_order( - int16_t _byte_magnitude_order); - - /*! - * @brief This function returns the value of member byte_magnitude_order - * @return Value of member byte_magnitude_order - */ - eProsima_user_DllExport int16_t byte_magnitude_order() const; - - /*! - * @brief This function returns a reference to member byte_magnitude_order - * @return Reference to member byte_magnitude_order - */ - eProsima_user_DllExport int16_t& byte_magnitude_order(); - -private: - - eprosima::fastdds::statistics::detail::GUID_s m_src_guid; - eprosima::fastdds::statistics::detail::Locator_s m_dst_locator; - uint64_t m_packet_count{0}; - uint64_t m_byte_count{0}; - int16_t m_byte_magnitude_order{0}; - -}; - - -/*! - * @brief This class represents the structure WriterReaderData defined by the user in the IDL file. - * @ingroup types - */ -class WriterReaderData -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport WriterReaderData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~WriterReaderData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::WriterReaderData that will be copied. - */ - eProsima_user_DllExport WriterReaderData( - const WriterReaderData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::WriterReaderData that will be copied. - */ - eProsima_user_DllExport WriterReaderData( - WriterReaderData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::WriterReaderData that will be copied. - */ - eProsima_user_DllExport WriterReaderData& operator =( - const WriterReaderData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::WriterReaderData that will be copied. - */ - eProsima_user_DllExport WriterReaderData& operator =( - WriterReaderData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::WriterReaderData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const WriterReaderData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::WriterReaderData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const WriterReaderData& x) const; - - /*! - * @brief This function copies the value in member writer_guid - * @param _writer_guid New value to be copied in member writer_guid - */ - eProsima_user_DllExport void writer_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _writer_guid); - - /*! - * @brief This function moves the value in member writer_guid - * @param _writer_guid New value to be moved in member writer_guid - */ - eProsima_user_DllExport void writer_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _writer_guid); - - /*! - * @brief This function returns a constant reference to member writer_guid - * @return Constant reference to member writer_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& writer_guid() const; - - /*! - * @brief This function returns a reference to member writer_guid - * @return Reference to member writer_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& writer_guid(); - - - /*! - * @brief This function copies the value in member reader_guid - * @param _reader_guid New value to be copied in member reader_guid - */ - eProsima_user_DllExport void reader_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _reader_guid); - - /*! - * @brief This function moves the value in member reader_guid - * @param _reader_guid New value to be moved in member reader_guid - */ - eProsima_user_DllExport void reader_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _reader_guid); - - /*! - * @brief This function returns a constant reference to member reader_guid - * @return Constant reference to member reader_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& reader_guid() const; - - /*! - * @brief This function returns a reference to member reader_guid - * @return Reference to member reader_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& reader_guid(); - - - /*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ - eProsima_user_DllExport void data( - float _data); - - /*! - * @brief This function returns the value of member data - * @return Value of member data - */ - eProsima_user_DllExport float data() const; - - /*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ - eProsima_user_DllExport float& data(); - -private: - - eprosima::fastdds::statistics::detail::GUID_s m_writer_guid; - eprosima::fastdds::statistics::detail::GUID_s m_reader_guid; - float m_data{0.0}; - -}; - - -/*! - * @brief This class represents the structure Locator2LocatorData defined by the user in the IDL file. - * @ingroup types - */ -class Locator2LocatorData -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport Locator2LocatorData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~Locator2LocatorData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Locator2LocatorData that will be copied. - */ - eProsima_user_DllExport Locator2LocatorData( - const Locator2LocatorData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Locator2LocatorData that will be copied. - */ - eProsima_user_DllExport Locator2LocatorData( - Locator2LocatorData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Locator2LocatorData that will be copied. - */ - eProsima_user_DllExport Locator2LocatorData& operator =( - const Locator2LocatorData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Locator2LocatorData that will be copied. - */ - eProsima_user_DllExport Locator2LocatorData& operator =( - Locator2LocatorData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Locator2LocatorData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const Locator2LocatorData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Locator2LocatorData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const Locator2LocatorData& x) const; - - /*! - * @brief This function copies the value in member src_locator - * @param _src_locator New value to be copied in member src_locator - */ - eProsima_user_DllExport void src_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _src_locator); - - /*! - * @brief This function moves the value in member src_locator - * @param _src_locator New value to be moved in member src_locator - */ - eProsima_user_DllExport void src_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _src_locator); - - /*! - * @brief This function returns a constant reference to member src_locator - * @return Constant reference to member src_locator - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::Locator_s& src_locator() const; - - /*! - * @brief This function returns a reference to member src_locator - * @return Reference to member src_locator - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::Locator_s& src_locator(); - - - /*! - * @brief This function copies the value in member dst_locator - * @param _dst_locator New value to be copied in member dst_locator - */ - eProsima_user_DllExport void dst_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _dst_locator); - - /*! - * @brief This function moves the value in member dst_locator - * @param _dst_locator New value to be moved in member dst_locator - */ - eProsima_user_DllExport void dst_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _dst_locator); - - /*! - * @brief This function returns a constant reference to member dst_locator - * @return Constant reference to member dst_locator - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::Locator_s& dst_locator() const; - - /*! - * @brief This function returns a reference to member dst_locator - * @return Reference to member dst_locator - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::Locator_s& dst_locator(); - - - /*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ - eProsima_user_DllExport void data( - float _data); - - /*! - * @brief This function returns the value of member data - * @return Value of member data - */ - eProsima_user_DllExport float data() const; - - /*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ - eProsima_user_DllExport float& data(); - -private: - - eprosima::fastdds::statistics::detail::Locator_s m_src_locator; - eprosima::fastdds::statistics::detail::Locator_s m_dst_locator; - float m_data{0.0}; - -}; - - -/*! - * @brief This class represents the structure EntityData defined by the user in the IDL file. - * @ingroup types - */ -class EntityData -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport EntityData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~EntityData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::EntityData that will be copied. - */ - eProsima_user_DllExport EntityData( - const EntityData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::EntityData that will be copied. - */ - eProsima_user_DllExport EntityData( - EntityData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::EntityData that will be copied. - */ - eProsima_user_DllExport EntityData& operator =( - const EntityData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::EntityData that will be copied. - */ - eProsima_user_DllExport EntityData& operator =( - EntityData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::EntityData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const EntityData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::EntityData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const EntityData& x) const; - - /*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ - eProsima_user_DllExport void guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid); - - /*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ - eProsima_user_DllExport void guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid); - - /*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& guid() const; - - /*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& guid(); - - - /*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ - eProsima_user_DllExport void data( - float _data); - - /*! - * @brief This function returns the value of member data - * @return Value of member data - */ - eProsima_user_DllExport float data() const; - - /*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ - eProsima_user_DllExport float& data(); - -private: - - eprosima::fastdds::statistics::detail::GUID_s m_guid; - float m_data{0.0}; - -}; - - -/*! - * @brief This class represents the structure PhysicalData defined by the user in the IDL file. - * @ingroup types - */ -class PhysicalData -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport PhysicalData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~PhysicalData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::PhysicalData that will be copied. - */ - eProsima_user_DllExport PhysicalData( - const PhysicalData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::PhysicalData that will be copied. - */ - eProsima_user_DllExport PhysicalData( - PhysicalData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::PhysicalData that will be copied. - */ - eProsima_user_DllExport PhysicalData& operator =( - const PhysicalData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::PhysicalData that will be copied. - */ - eProsima_user_DllExport PhysicalData& operator =( - PhysicalData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::PhysicalData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const PhysicalData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::PhysicalData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const PhysicalData& x) const; - - /*! - * @brief This function copies the value in member participant_guid - * @param _participant_guid New value to be copied in member participant_guid - */ - eProsima_user_DllExport void participant_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _participant_guid); - - /*! - * @brief This function moves the value in member participant_guid - * @param _participant_guid New value to be moved in member participant_guid - */ - eProsima_user_DllExport void participant_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _participant_guid); - - /*! - * @brief This function returns a constant reference to member participant_guid - * @return Constant reference to member participant_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& participant_guid() const; - - /*! - * @brief This function returns a reference to member participant_guid - * @return Reference to member participant_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& participant_guid(); - - - /*! - * @brief This function copies the value in member host - * @param _host New value to be copied in member host - */ - eProsima_user_DllExport void host( - const std::string& _host); - - /*! - * @brief This function moves the value in member host - * @param _host New value to be moved in member host - */ - eProsima_user_DllExport void host( - std::string&& _host); - - /*! - * @brief This function returns a constant reference to member host - * @return Constant reference to member host - */ - eProsima_user_DllExport const std::string& host() const; - - /*! - * @brief This function returns a reference to member host - * @return Reference to member host - */ - eProsima_user_DllExport std::string& host(); - - - /*! - * @brief This function copies the value in member user - * @param _user New value to be copied in member user - */ - eProsima_user_DllExport void user( - const std::string& _user); - - /*! - * @brief This function moves the value in member user - * @param _user New value to be moved in member user - */ - eProsima_user_DllExport void user( - std::string&& _user); - - /*! - * @brief This function returns a constant reference to member user - * @return Constant reference to member user - */ - eProsima_user_DllExport const std::string& user() const; - - /*! - * @brief This function returns a reference to member user - * @return Reference to member user - */ - eProsima_user_DllExport std::string& user(); - - - /*! - * @brief This function copies the value in member process - * @param _process New value to be copied in member process - */ - eProsima_user_DllExport void process( - const std::string& _process); - - /*! - * @brief This function moves the value in member process - * @param _process New value to be moved in member process - */ - eProsima_user_DllExport void process( - std::string&& _process); - - /*! - * @brief This function returns a constant reference to member process - * @return Constant reference to member process - */ - eProsima_user_DllExport const std::string& process() const; - - /*! - * @brief This function returns a reference to member process - * @return Reference to member process - */ - eProsima_user_DllExport std::string& process(); - -private: - - eprosima::fastdds::statistics::detail::GUID_s m_participant_guid; - std::string m_host; - std::string m_user; - std::string m_process; - -}; -/*! - * @brief This enumeration represents the EventKind bitflags defined by the user in the IDL file. - * @ingroup types - */ -enum EventKindBits : uint32_t -{ - HISTORY2HISTORY_LATENCY = 0x01ull << 0, - NETWORK_LATENCY = 0x01ull << 1, - PUBLICATION_THROUGHPUT = 0x01ull << 2, - SUBSCRIPTION_THROUGHPUT = 0x01ull << 3, - RTPS_SENT = 0x01ull << 4, - RTPS_LOST = 0x01ull << 5, - RESENT_DATAS = 0x01ull << 6, - HEARTBEAT_COUNT = 0x01ull << 7, - ACKNACK_COUNT = 0x01ull << 8, - NACKFRAG_COUNT = 0x01ull << 9, - GAP_COUNT = 0x01ull << 10, - DATA_COUNT = 0x01ull << 11, - PDP_PACKETS = 0x01ull << 12, - EDP_PACKETS = 0x01ull << 13, - DISCOVERED_ENTITY = 0x01ull << 14, - SAMPLE_DATAS = 0x01ull << 15, - PHYSICAL_DATA = 0x01ull << 16 -}; -typedef uint32_t EventKind; - - -/*! - * @brief This class represents the union Data defined by the user in the IDL file. - * @ingroup types - */ -class Data -{ -public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport Data(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~Data(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Data that will be copied. - */ - eProsima_user_DllExport Data( - const Data& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Data that will be copied. - */ - eProsima_user_DllExport Data( - Data&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Data that will be copied. - */ - eProsima_user_DllExport Data& operator =( - const Data& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Data that will be copied. - */ - eProsima_user_DllExport Data& operator =( - Data&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Data object to compare. - */ - eProsima_user_DllExport bool operator ==( - const Data& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Data object to compare. - */ - eProsima_user_DllExport bool operator !=( - const Data& x) const; - - /*! - * @brief This function sets the discriminator value. - * @param __d New value for the discriminator. - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member. - */ - eProsima_user_DllExport void _d( - eprosima::fastdds::statistics::EventKind __d); - - /*! - * @brief This function returns the value of the discriminator. - * @return Value of the discriminator - */ - eProsima_user_DllExport eprosima::fastdds::statistics::EventKind _d() const; - - /*! - * @brief This function returns a reference to the discriminator. - * @return Reference to the discriminator. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::EventKind& _d(); - - /*! - * @brief This function copies the value in member writer_reader_data - * @param _writer_reader_data New value to be copied in member writer_reader_data - */ - eProsima_user_DllExport void writer_reader_data( - const eprosima::fastdds::statistics::WriterReaderData& _writer_reader_data); - - /*! - * @brief This function moves the value in member writer_reader_data - * @param _writer_reader_data New value to be moved in member writer_reader_data - */ - eProsima_user_DllExport void writer_reader_data( - eprosima::fastdds::statistics::WriterReaderData&& _writer_reader_data); - - /*! - * @brief This function returns a constant reference to member writer_reader_data - * @return Constant reference to member writer_reader_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::WriterReaderData& writer_reader_data() const; - - /*! - * @brief This function returns a reference to member writer_reader_data - * @return Reference to member writer_reader_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::WriterReaderData& writer_reader_data(); - - - /*! - * @brief This function copies the value in member locator2locator_data - * @param _locator2locator_data New value to be copied in member locator2locator_data - */ - eProsima_user_DllExport void locator2locator_data( - const eprosima::fastdds::statistics::Locator2LocatorData& _locator2locator_data); - - /*! - * @brief This function moves the value in member locator2locator_data - * @param _locator2locator_data New value to be moved in member locator2locator_data - */ - eProsima_user_DllExport void locator2locator_data( - eprosima::fastdds::statistics::Locator2LocatorData&& _locator2locator_data); - - /*! - * @brief This function returns a constant reference to member locator2locator_data - * @return Constant reference to member locator2locator_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::Locator2LocatorData& locator2locator_data() const; - - /*! - * @brief This function returns a reference to member locator2locator_data - * @return Reference to member locator2locator_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::Locator2LocatorData& locator2locator_data(); - - - /*! - * @brief This function copies the value in member entity_data - * @param _entity_data New value to be copied in member entity_data - */ - eProsima_user_DllExport void entity_data( - const eprosima::fastdds::statistics::EntityData& _entity_data); - - /*! - * @brief This function moves the value in member entity_data - * @param _entity_data New value to be moved in member entity_data - */ - eProsima_user_DllExport void entity_data( - eprosima::fastdds::statistics::EntityData&& _entity_data); - - /*! - * @brief This function returns a constant reference to member entity_data - * @return Constant reference to member entity_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::EntityData& entity_data() const; - - /*! - * @brief This function returns a reference to member entity_data - * @return Reference to member entity_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::EntityData& entity_data(); - - - /*! - * @brief This function copies the value in member entity2locator_traffic - * @param _entity2locator_traffic New value to be copied in member entity2locator_traffic - */ - eProsima_user_DllExport void entity2locator_traffic( - const eprosima::fastdds::statistics::Entity2LocatorTraffic& _entity2locator_traffic); - - /*! - * @brief This function moves the value in member entity2locator_traffic - * @param _entity2locator_traffic New value to be moved in member entity2locator_traffic - */ - eProsima_user_DllExport void entity2locator_traffic( - eprosima::fastdds::statistics::Entity2LocatorTraffic&& _entity2locator_traffic); - - /*! - * @brief This function returns a constant reference to member entity2locator_traffic - * @return Constant reference to member entity2locator_traffic - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::Entity2LocatorTraffic& entity2locator_traffic() const; - - /*! - * @brief This function returns a reference to member entity2locator_traffic - * @return Reference to member entity2locator_traffic - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::Entity2LocatorTraffic& entity2locator_traffic(); - - - /*! - * @brief This function copies the value in member entity_count - * @param _entity_count New value to be copied in member entity_count - */ - eProsima_user_DllExport void entity_count( - const eprosima::fastdds::statistics::EntityCount& _entity_count); - - /*! - * @brief This function moves the value in member entity_count - * @param _entity_count New value to be moved in member entity_count - */ - eProsima_user_DllExport void entity_count( - eprosima::fastdds::statistics::EntityCount&& _entity_count); - - /*! - * @brief This function returns a constant reference to member entity_count - * @return Constant reference to member entity_count - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::EntityCount& entity_count() const; - - /*! - * @brief This function returns a reference to member entity_count - * @return Reference to member entity_count - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::EntityCount& entity_count(); - - - /*! - * @brief This function copies the value in member discovery_time - * @param _discovery_time New value to be copied in member discovery_time - */ - eProsima_user_DllExport void discovery_time( - const eprosima::fastdds::statistics::DiscoveryTime& _discovery_time); - - /*! - * @brief This function moves the value in member discovery_time - * @param _discovery_time New value to be moved in member discovery_time - */ - eProsima_user_DllExport void discovery_time( - eprosima::fastdds::statistics::DiscoveryTime&& _discovery_time); - - /*! - * @brief This function returns a constant reference to member discovery_time - * @return Constant reference to member discovery_time - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::DiscoveryTime& discovery_time() const; - - /*! - * @brief This function returns a reference to member discovery_time - * @return Reference to member discovery_time - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::DiscoveryTime& discovery_time(); - - - /*! - * @brief This function copies the value in member sample_identity_count - * @param _sample_identity_count New value to be copied in member sample_identity_count - */ - eProsima_user_DllExport void sample_identity_count( - const eprosima::fastdds::statistics::SampleIdentityCount& _sample_identity_count); - - /*! - * @brief This function moves the value in member sample_identity_count - * @param _sample_identity_count New value to be moved in member sample_identity_count - */ - eProsima_user_DllExport void sample_identity_count( - eprosima::fastdds::statistics::SampleIdentityCount&& _sample_identity_count); - - /*! - * @brief This function returns a constant reference to member sample_identity_count - * @return Constant reference to member sample_identity_count - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::SampleIdentityCount& sample_identity_count() const; - - /*! - * @brief This function returns a reference to member sample_identity_count - * @return Reference to member sample_identity_count - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::SampleIdentityCount& sample_identity_count(); - - - /*! - * @brief This function copies the value in member physical_data - * @param _physical_data New value to be copied in member physical_data - */ - eProsima_user_DllExport void physical_data( - const eprosima::fastdds::statistics::PhysicalData& _physical_data); - - /*! - * @brief This function moves the value in member physical_data - * @param _physical_data New value to be moved in member physical_data - */ - eProsima_user_DllExport void physical_data( - eprosima::fastdds::statistics::PhysicalData&& _physical_data); - - /*! - * @brief This function returns a constant reference to member physical_data - * @return Constant reference to member physical_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::PhysicalData& physical_data() const; - - /*! - * @brief This function returns a reference to member physical_data - * @return Reference to member physical_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::PhysicalData& physical_data(); - -private: - - eprosima::fastdds::statistics::EventKind m__d; - - eprosima::fastdds::statistics::WriterReaderData m_writer_reader_data; - eprosima::fastdds::statistics::Locator2LocatorData m_locator2locator_data; - eprosima::fastdds::statistics::EntityData m_entity_data; - eprosima::fastdds::statistics::Entity2LocatorTraffic m_entity2locator_traffic; - eprosima::fastdds::statistics::EntityCount m_entity_count; - eprosima::fastdds::statistics::DiscoveryTime m_discovery_time; - eprosima::fastdds::statistics::SampleIdentityCount m_sample_identity_count; - eprosima::fastdds::statistics::PhysicalData m_physical_data; -}; - -} // namespace statistics - -} // namespace fastdds - -} // namespace eprosima - -#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPES_H_ - - - -#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/include/fastdds_statistics_backend/topic_types/types.hpp b/include/fastdds_statistics_backend/topic_types/types.hpp new file mode 100644 index 000000000..70ad38bd5 --- /dev/null +++ b/include/fastdds_statistics_backend/topic_types/types.hpp @@ -0,0 +1,3885 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file types.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPES_HPP +#define FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPES_HPP + +#include +#include +#include +#include +#include +#include +#include + + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(TYPES_SOURCE) +#define TYPES_DllAPI __declspec( dllexport ) +#else +#define TYPES_DllAPI __declspec( dllimport ) +#endif // TYPES_SOURCE +#else +#define TYPES_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define TYPES_DllAPI +#endif // _WIN32 + +namespace eprosima { + +namespace fastdds { + +namespace statistics { + +namespace detail { + +/*! + * @brief This class represents the structure EntityId_s defined by the user in the IDL file. + * @ingroup types + */ +class EntityId_s +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport EntityId_s() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~EntityId_s() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object EntityId_s that will be copied. + */ + eProsima_user_DllExport EntityId_s( + const EntityId_s& x) + { + m_value = x.m_value; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object EntityId_s that will be copied. + */ + eProsima_user_DllExport EntityId_s( + EntityId_s&& x) noexcept + { + m_value = std::move(x.m_value); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object EntityId_s that will be copied. + */ + eProsima_user_DllExport EntityId_s& operator =( + const EntityId_s& x) + { + + m_value = x.m_value; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object EntityId_s that will be copied. + */ + eProsima_user_DllExport EntityId_s& operator =( + EntityId_s&& x) noexcept + { + + m_value = std::move(x.m_value); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x EntityId_s object to compare. + */ + eProsima_user_DllExport bool operator ==( + const EntityId_s& x) const + { + return (m_value == x.m_value); + } + + /*! + * @brief Comparison operator. + * @param x EntityId_s object to compare. + */ + eProsima_user_DllExport bool operator !=( + const EntityId_s& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member value + * @param _value New value to be copied in member value + */ + eProsima_user_DllExport void value( + const std::array& _value) + { + m_value = _value; + } + + /*! + * @brief This function moves the value in member value + * @param _value New value to be moved in member value + */ + eProsima_user_DllExport void value( + std::array&& _value) + { + m_value = std::move(_value); + } + + /*! + * @brief This function returns a constant reference to member value + * @return Constant reference to member value + */ + eProsima_user_DllExport const std::array& value() const + { + return m_value; + } + + /*! + * @brief This function returns a reference to member value + * @return Reference to member value + */ + eProsima_user_DllExport std::array& value() + { + return m_value; + } + +private: + + std::array m_value{0}; + +}; +/*! + * @brief This class represents the structure GuidPrefix_s defined by the user in the IDL file. + * @ingroup types + */ +class GuidPrefix_s +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport GuidPrefix_s() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~GuidPrefix_s() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object GuidPrefix_s that will be copied. + */ + eProsima_user_DllExport GuidPrefix_s( + const GuidPrefix_s& x) + { + m_value = x.m_value; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object GuidPrefix_s that will be copied. + */ + eProsima_user_DllExport GuidPrefix_s( + GuidPrefix_s&& x) noexcept + { + m_value = std::move(x.m_value); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object GuidPrefix_s that will be copied. + */ + eProsima_user_DllExport GuidPrefix_s& operator =( + const GuidPrefix_s& x) + { + + m_value = x.m_value; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object GuidPrefix_s that will be copied. + */ + eProsima_user_DllExport GuidPrefix_s& operator =( + GuidPrefix_s&& x) noexcept + { + + m_value = std::move(x.m_value); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x GuidPrefix_s object to compare. + */ + eProsima_user_DllExport bool operator ==( + const GuidPrefix_s& x) const + { + return (m_value == x.m_value); + } + + /*! + * @brief Comparison operator. + * @param x GuidPrefix_s object to compare. + */ + eProsima_user_DllExport bool operator !=( + const GuidPrefix_s& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member value + * @param _value New value to be copied in member value + */ + eProsima_user_DllExport void value( + const std::array& _value) + { + m_value = _value; + } + + /*! + * @brief This function moves the value in member value + * @param _value New value to be moved in member value + */ + eProsima_user_DllExport void value( + std::array&& _value) + { + m_value = std::move(_value); + } + + /*! + * @brief This function returns a constant reference to member value + * @return Constant reference to member value + */ + eProsima_user_DllExport const std::array& value() const + { + return m_value; + } + + /*! + * @brief This function returns a reference to member value + * @return Reference to member value + */ + eProsima_user_DllExport std::array& value() + { + return m_value; + } + +private: + + std::array m_value{0}; + +}; +/*! + * @brief This class represents the structure GUID_s defined by the user in the IDL file. + * @ingroup types + */ +class GUID_s +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport GUID_s() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~GUID_s() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object GUID_s that will be copied. + */ + eProsima_user_DllExport GUID_s( + const GUID_s& x) + { + m_guidPrefix = x.m_guidPrefix; + + m_entityId = x.m_entityId; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object GUID_s that will be copied. + */ + eProsima_user_DllExport GUID_s( + GUID_s&& x) noexcept + { + m_guidPrefix = std::move(x.m_guidPrefix); + m_entityId = std::move(x.m_entityId); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object GUID_s that will be copied. + */ + eProsima_user_DllExport GUID_s& operator =( + const GUID_s& x) + { + + m_guidPrefix = x.m_guidPrefix; + + m_entityId = x.m_entityId; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object GUID_s that will be copied. + */ + eProsima_user_DllExport GUID_s& operator =( + GUID_s&& x) noexcept + { + + m_guidPrefix = std::move(x.m_guidPrefix); + m_entityId = std::move(x.m_entityId); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x GUID_s object to compare. + */ + eProsima_user_DllExport bool operator ==( + const GUID_s& x) const + { + return (m_guidPrefix == x.m_guidPrefix && + m_entityId == x.m_entityId); + } + + /*! + * @brief Comparison operator. + * @param x GUID_s object to compare. + */ + eProsima_user_DllExport bool operator !=( + const GUID_s& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member guidPrefix + * @param _guidPrefix New value to be copied in member guidPrefix + */ + eProsima_user_DllExport void guidPrefix( + const GuidPrefix_s& _guidPrefix) + { + m_guidPrefix = _guidPrefix; + } + + /*! + * @brief This function moves the value in member guidPrefix + * @param _guidPrefix New value to be moved in member guidPrefix + */ + eProsima_user_DllExport void guidPrefix( + GuidPrefix_s&& _guidPrefix) + { + m_guidPrefix = std::move(_guidPrefix); + } + + /*! + * @brief This function returns a constant reference to member guidPrefix + * @return Constant reference to member guidPrefix + */ + eProsima_user_DllExport const GuidPrefix_s& guidPrefix() const + { + return m_guidPrefix; + } + + /*! + * @brief This function returns a reference to member guidPrefix + * @return Reference to member guidPrefix + */ + eProsima_user_DllExport GuidPrefix_s& guidPrefix() + { + return m_guidPrefix; + } + + /*! + * @brief This function copies the value in member entityId + * @param _entityId New value to be copied in member entityId + */ + eProsima_user_DllExport void entityId( + const EntityId_s& _entityId) + { + m_entityId = _entityId; + } + + /*! + * @brief This function moves the value in member entityId + * @param _entityId New value to be moved in member entityId + */ + eProsima_user_DllExport void entityId( + EntityId_s&& _entityId) + { + m_entityId = std::move(_entityId); + } + + /*! + * @brief This function returns a constant reference to member entityId + * @return Constant reference to member entityId + */ + eProsima_user_DllExport const EntityId_s& entityId() const + { + return m_entityId; + } + + /*! + * @brief This function returns a reference to member entityId + * @return Reference to member entityId + */ + eProsima_user_DllExport EntityId_s& entityId() + { + return m_entityId; + } + +private: + + GuidPrefix_s m_guidPrefix; + EntityId_s m_entityId; + +}; +/*! + * @brief This class represents the structure SequenceNumber_s defined by the user in the IDL file. + * @ingroup types + */ +class SequenceNumber_s +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport SequenceNumber_s() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~SequenceNumber_s() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object SequenceNumber_s that will be copied. + */ + eProsima_user_DllExport SequenceNumber_s( + const SequenceNumber_s& x) + { + m_high = x.m_high; + + m_low = x.m_low; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object SequenceNumber_s that will be copied. + */ + eProsima_user_DllExport SequenceNumber_s( + SequenceNumber_s&& x) noexcept + { + m_high = x.m_high; + m_low = x.m_low; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object SequenceNumber_s that will be copied. + */ + eProsima_user_DllExport SequenceNumber_s& operator =( + const SequenceNumber_s& x) + { + + m_high = x.m_high; + + m_low = x.m_low; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object SequenceNumber_s that will be copied. + */ + eProsima_user_DllExport SequenceNumber_s& operator =( + SequenceNumber_s&& x) noexcept + { + + m_high = x.m_high; + m_low = x.m_low; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x SequenceNumber_s object to compare. + */ + eProsima_user_DllExport bool operator ==( + const SequenceNumber_s& x) const + { + return (m_high == x.m_high && + m_low == x.m_low); + } + + /*! + * @brief Comparison operator. + * @param x SequenceNumber_s object to compare. + */ + eProsima_user_DllExport bool operator !=( + const SequenceNumber_s& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member high + * @param _high New value for member high + */ + eProsima_user_DllExport void high( + int32_t _high) + { + m_high = _high; + } + + /*! + * @brief This function returns the value of member high + * @return Value of member high + */ + eProsima_user_DllExport int32_t high() const + { + return m_high; + } + + /*! + * @brief This function returns a reference to member high + * @return Reference to member high + */ + eProsima_user_DllExport int32_t& high() + { + return m_high; + } + + /*! + * @brief This function sets a value in member low + * @param _low New value for member low + */ + eProsima_user_DllExport void low( + uint32_t _low) + { + m_low = _low; + } + + /*! + * @brief This function returns the value of member low + * @return Value of member low + */ + eProsima_user_DllExport uint32_t low() const + { + return m_low; + } + + /*! + * @brief This function returns a reference to member low + * @return Reference to member low + */ + eProsima_user_DllExport uint32_t& low() + { + return m_low; + } + +private: + + int32_t m_high{0}; + uint32_t m_low{0}; + +}; +/*! + * @brief This class represents the structure SampleIdentity_s defined by the user in the IDL file. + * @ingroup types + */ +class SampleIdentity_s +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport SampleIdentity_s() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~SampleIdentity_s() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object SampleIdentity_s that will be copied. + */ + eProsima_user_DllExport SampleIdentity_s( + const SampleIdentity_s& x) + { + m_writer_guid = x.m_writer_guid; + + m_sequence_number = x.m_sequence_number; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object SampleIdentity_s that will be copied. + */ + eProsima_user_DllExport SampleIdentity_s( + SampleIdentity_s&& x) noexcept + { + m_writer_guid = std::move(x.m_writer_guid); + m_sequence_number = std::move(x.m_sequence_number); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object SampleIdentity_s that will be copied. + */ + eProsima_user_DllExport SampleIdentity_s& operator =( + const SampleIdentity_s& x) + { + + m_writer_guid = x.m_writer_guid; + + m_sequence_number = x.m_sequence_number; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object SampleIdentity_s that will be copied. + */ + eProsima_user_DllExport SampleIdentity_s& operator =( + SampleIdentity_s&& x) noexcept + { + + m_writer_guid = std::move(x.m_writer_guid); + m_sequence_number = std::move(x.m_sequence_number); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x SampleIdentity_s object to compare. + */ + eProsima_user_DllExport bool operator ==( + const SampleIdentity_s& x) const + { + return (m_writer_guid == x.m_writer_guid && + m_sequence_number == x.m_sequence_number); + } + + /*! + * @brief Comparison operator. + * @param x SampleIdentity_s object to compare. + */ + eProsima_user_DllExport bool operator !=( + const SampleIdentity_s& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member writer_guid + * @param _writer_guid New value to be copied in member writer_guid + */ + eProsima_user_DllExport void writer_guid( + const GUID_s& _writer_guid) + { + m_writer_guid = _writer_guid; + } + + /*! + * @brief This function moves the value in member writer_guid + * @param _writer_guid New value to be moved in member writer_guid + */ + eProsima_user_DllExport void writer_guid( + GUID_s&& _writer_guid) + { + m_writer_guid = std::move(_writer_guid); + } + + /*! + * @brief This function returns a constant reference to member writer_guid + * @return Constant reference to member writer_guid + */ + eProsima_user_DllExport const GUID_s& writer_guid() const + { + return m_writer_guid; + } + + /*! + * @brief This function returns a reference to member writer_guid + * @return Reference to member writer_guid + */ + eProsima_user_DllExport GUID_s& writer_guid() + { + return m_writer_guid; + } + + /*! + * @brief This function copies the value in member sequence_number + * @param _sequence_number New value to be copied in member sequence_number + */ + eProsima_user_DllExport void sequence_number( + const SequenceNumber_s& _sequence_number) + { + m_sequence_number = _sequence_number; + } + + /*! + * @brief This function moves the value in member sequence_number + * @param _sequence_number New value to be moved in member sequence_number + */ + eProsima_user_DllExport void sequence_number( + SequenceNumber_s&& _sequence_number) + { + m_sequence_number = std::move(_sequence_number); + } + + /*! + * @brief This function returns a constant reference to member sequence_number + * @return Constant reference to member sequence_number + */ + eProsima_user_DllExport const SequenceNumber_s& sequence_number() const + { + return m_sequence_number; + } + + /*! + * @brief This function returns a reference to member sequence_number + * @return Reference to member sequence_number + */ + eProsima_user_DllExport SequenceNumber_s& sequence_number() + { + return m_sequence_number; + } + +private: + + GUID_s m_writer_guid; + SequenceNumber_s m_sequence_number; + +}; +/*! + * @brief This class represents the structure Locator_s defined by the user in the IDL file. + * @ingroup types + */ +class Locator_s +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport Locator_s() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~Locator_s() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object Locator_s that will be copied. + */ + eProsima_user_DllExport Locator_s( + const Locator_s& x) + { + m_kind = x.m_kind; + + m_port = x.m_port; + + m_address = x.m_address; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object Locator_s that will be copied. + */ + eProsima_user_DllExport Locator_s( + Locator_s&& x) noexcept + { + m_kind = x.m_kind; + m_port = x.m_port; + m_address = std::move(x.m_address); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object Locator_s that will be copied. + */ + eProsima_user_DllExport Locator_s& operator =( + const Locator_s& x) + { + + m_kind = x.m_kind; + + m_port = x.m_port; + + m_address = x.m_address; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object Locator_s that will be copied. + */ + eProsima_user_DllExport Locator_s& operator =( + Locator_s&& x) noexcept + { + + m_kind = x.m_kind; + m_port = x.m_port; + m_address = std::move(x.m_address); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x Locator_s object to compare. + */ + eProsima_user_DllExport bool operator ==( + const Locator_s& x) const + { + return (m_kind == x.m_kind && + m_port == x.m_port && + m_address == x.m_address); + } + + /*! + * @brief Comparison operator. + * @param x Locator_s object to compare. + */ + eProsima_user_DllExport bool operator !=( + const Locator_s& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member kind + * @param _kind New value for member kind + */ + eProsima_user_DllExport void kind( + int32_t _kind) + { + m_kind = _kind; + } + + /*! + * @brief This function returns the value of member kind + * @return Value of member kind + */ + eProsima_user_DllExport int32_t kind() const + { + return m_kind; + } + + /*! + * @brief This function returns a reference to member kind + * @return Reference to member kind + */ + eProsima_user_DllExport int32_t& kind() + { + return m_kind; + } + + /*! + * @brief This function sets a value in member port + * @param _port New value for member port + */ + eProsima_user_DllExport void port( + uint32_t _port) + { + m_port = _port; + } + + /*! + * @brief This function returns the value of member port + * @return Value of member port + */ + eProsima_user_DllExport uint32_t port() const + { + return m_port; + } + + /*! + * @brief This function returns a reference to member port + * @return Reference to member port + */ + eProsima_user_DllExport uint32_t& port() + { + return m_port; + } + + /*! + * @brief This function copies the value in member address + * @param _address New value to be copied in member address + */ + eProsima_user_DllExport void address( + const std::array& _address) + { + m_address = _address; + } + + /*! + * @brief This function moves the value in member address + * @param _address New value to be moved in member address + */ + eProsima_user_DllExport void address( + std::array&& _address) + { + m_address = std::move(_address); + } + + /*! + * @brief This function returns a constant reference to member address + * @return Constant reference to member address + */ + eProsima_user_DllExport const std::array& address() const + { + return m_address; + } + + /*! + * @brief This function returns a reference to member address + * @return Reference to member address + */ + eProsima_user_DllExport std::array& address() + { + return m_address; + } + +private: + + int32_t m_kind{0}; + uint32_t m_port{0}; + std::array m_address{0}; + +}; + +} // namespace detail +/*! + * @brief This class represents the structure DiscoveryTime defined by the user in the IDL file. + * @ingroup types + */ +class DiscoveryTime +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport DiscoveryTime() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~DiscoveryTime() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object DiscoveryTime that will be copied. + */ + eProsima_user_DllExport DiscoveryTime( + const DiscoveryTime& x) + { + m_local_participant_guid = x.m_local_participant_guid; + + m_remote_entity_guid = x.m_remote_entity_guid; + + m_time = x.m_time; + + m_host = x.m_host; + + m_user = x.m_user; + + m_process = x.m_process; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object DiscoveryTime that will be copied. + */ + eProsima_user_DllExport DiscoveryTime( + DiscoveryTime&& x) noexcept + { + m_local_participant_guid = std::move(x.m_local_participant_guid); + m_remote_entity_guid = std::move(x.m_remote_entity_guid); + m_time = x.m_time; + m_host = std::move(x.m_host); + m_user = std::move(x.m_user); + m_process = std::move(x.m_process); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object DiscoveryTime that will be copied. + */ + eProsima_user_DllExport DiscoveryTime& operator =( + const DiscoveryTime& x) + { + + m_local_participant_guid = x.m_local_participant_guid; + + m_remote_entity_guid = x.m_remote_entity_guid; + + m_time = x.m_time; + + m_host = x.m_host; + + m_user = x.m_user; + + m_process = x.m_process; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object DiscoveryTime that will be copied. + */ + eProsima_user_DllExport DiscoveryTime& operator =( + DiscoveryTime&& x) noexcept + { + + m_local_participant_guid = std::move(x.m_local_participant_guid); + m_remote_entity_guid = std::move(x.m_remote_entity_guid); + m_time = x.m_time; + m_host = std::move(x.m_host); + m_user = std::move(x.m_user); + m_process = std::move(x.m_process); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x DiscoveryTime object to compare. + */ + eProsima_user_DllExport bool operator ==( + const DiscoveryTime& x) const + { + return (m_local_participant_guid == x.m_local_participant_guid && + m_remote_entity_guid == x.m_remote_entity_guid && + m_time == x.m_time && + m_host == x.m_host && + m_user == x.m_user && + m_process == x.m_process); + } + + /*! + * @brief Comparison operator. + * @param x DiscoveryTime object to compare. + */ + eProsima_user_DllExport bool operator !=( + const DiscoveryTime& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member local_participant_guid + * @param _local_participant_guid New value to be copied in member local_participant_guid + */ + eProsima_user_DllExport void local_participant_guid( + const detail::GUID_s& _local_participant_guid) + { + m_local_participant_guid = _local_participant_guid; + } + + /*! + * @brief This function moves the value in member local_participant_guid + * @param _local_participant_guid New value to be moved in member local_participant_guid + */ + eProsima_user_DllExport void local_participant_guid( + detail::GUID_s&& _local_participant_guid) + { + m_local_participant_guid = std::move(_local_participant_guid); + } + + /*! + * @brief This function returns a constant reference to member local_participant_guid + * @return Constant reference to member local_participant_guid + */ + eProsima_user_DllExport const detail::GUID_s& local_participant_guid() const + { + return m_local_participant_guid; + } + + /*! + * @brief This function returns a reference to member local_participant_guid + * @return Reference to member local_participant_guid + */ + eProsima_user_DllExport detail::GUID_s& local_participant_guid() + { + return m_local_participant_guid; + } + + /*! + * @brief This function copies the value in member remote_entity_guid + * @param _remote_entity_guid New value to be copied in member remote_entity_guid + */ + eProsima_user_DllExport void remote_entity_guid( + const detail::GUID_s& _remote_entity_guid) + { + m_remote_entity_guid = _remote_entity_guid; + } + + /*! + * @brief This function moves the value in member remote_entity_guid + * @param _remote_entity_guid New value to be moved in member remote_entity_guid + */ + eProsima_user_DllExport void remote_entity_guid( + detail::GUID_s&& _remote_entity_guid) + { + m_remote_entity_guid = std::move(_remote_entity_guid); + } + + /*! + * @brief This function returns a constant reference to member remote_entity_guid + * @return Constant reference to member remote_entity_guid + */ + eProsima_user_DllExport const detail::GUID_s& remote_entity_guid() const + { + return m_remote_entity_guid; + } + + /*! + * @brief This function returns a reference to member remote_entity_guid + * @return Reference to member remote_entity_guid + */ + eProsima_user_DllExport detail::GUID_s& remote_entity_guid() + { + return m_remote_entity_guid; + } + + /*! + * @brief This function sets a value in member time + * @param _time New value for member time + */ + eProsima_user_DllExport void time( + uint64_t _time) + { + m_time = _time; + } + + /*! + * @brief This function returns the value of member time + * @return Value of member time + */ + eProsima_user_DllExport uint64_t time() const + { + return m_time; + } + + /*! + * @brief This function returns a reference to member time + * @return Reference to member time + */ + eProsima_user_DllExport uint64_t& time() + { + return m_time; + } + + /*! + * @brief This function copies the value in member host + * @param _host New value to be copied in member host + */ + eProsima_user_DllExport void host( + const std::string& _host) + { + m_host = _host; + } + + /*! + * @brief This function moves the value in member host + * @param _host New value to be moved in member host + */ + eProsima_user_DllExport void host( + std::string&& _host) + { + m_host = std::move(_host); + } + + /*! + * @brief This function returns a constant reference to member host + * @return Constant reference to member host + */ + eProsima_user_DllExport const std::string& host() const + { + return m_host; + } + + /*! + * @brief This function returns a reference to member host + * @return Reference to member host + */ + eProsima_user_DllExport std::string& host() + { + return m_host; + } + + /*! + * @brief This function copies the value in member user + * @param _user New value to be copied in member user + */ + eProsima_user_DllExport void user( + const std::string& _user) + { + m_user = _user; + } + + /*! + * @brief This function moves the value in member user + * @param _user New value to be moved in member user + */ + eProsima_user_DllExport void user( + std::string&& _user) + { + m_user = std::move(_user); + } + + /*! + * @brief This function returns a constant reference to member user + * @return Constant reference to member user + */ + eProsima_user_DllExport const std::string& user() const + { + return m_user; + } + + /*! + * @brief This function returns a reference to member user + * @return Reference to member user + */ + eProsima_user_DllExport std::string& user() + { + return m_user; + } + + /*! + * @brief This function copies the value in member process + * @param _process New value to be copied in member process + */ + eProsima_user_DllExport void process( + const std::string& _process) + { + m_process = _process; + } + + /*! + * @brief This function moves the value in member process + * @param _process New value to be moved in member process + */ + eProsima_user_DllExport void process( + std::string&& _process) + { + m_process = std::move(_process); + } + + /*! + * @brief This function returns a constant reference to member process + * @return Constant reference to member process + */ + eProsima_user_DllExport const std::string& process() const + { + return m_process; + } + + /*! + * @brief This function returns a reference to member process + * @return Reference to member process + */ + eProsima_user_DllExport std::string& process() + { + return m_process; + } + +private: + + detail::GUID_s m_local_participant_guid; + detail::GUID_s m_remote_entity_guid; + uint64_t m_time{0}; + std::string m_host; + std::string m_user; + std::string m_process; + +}; +/*! + * @brief This class represents the structure EntityCount defined by the user in the IDL file. + * @ingroup types + */ +class EntityCount +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport EntityCount() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~EntityCount() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object EntityCount that will be copied. + */ + eProsima_user_DllExport EntityCount( + const EntityCount& x) + { + m_guid = x.m_guid; + + m_count = x.m_count; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object EntityCount that will be copied. + */ + eProsima_user_DllExport EntityCount( + EntityCount&& x) noexcept + { + m_guid = std::move(x.m_guid); + m_count = x.m_count; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object EntityCount that will be copied. + */ + eProsima_user_DllExport EntityCount& operator =( + const EntityCount& x) + { + + m_guid = x.m_guid; + + m_count = x.m_count; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object EntityCount that will be copied. + */ + eProsima_user_DllExport EntityCount& operator =( + EntityCount&& x) noexcept + { + + m_guid = std::move(x.m_guid); + m_count = x.m_count; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x EntityCount object to compare. + */ + eProsima_user_DllExport bool operator ==( + const EntityCount& x) const + { + return (m_guid == x.m_guid && + m_count == x.m_count); + } + + /*! + * @brief Comparison operator. + * @param x EntityCount object to compare. + */ + eProsima_user_DllExport bool operator !=( + const EntityCount& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member guid + * @param _guid New value to be copied in member guid + */ + eProsima_user_DllExport void guid( + const detail::GUID_s& _guid) + { + m_guid = _guid; + } + + /*! + * @brief This function moves the value in member guid + * @param _guid New value to be moved in member guid + */ + eProsima_user_DllExport void guid( + detail::GUID_s&& _guid) + { + m_guid = std::move(_guid); + } + + /*! + * @brief This function returns a constant reference to member guid + * @return Constant reference to member guid + */ + eProsima_user_DllExport const detail::GUID_s& guid() const + { + return m_guid; + } + + /*! + * @brief This function returns a reference to member guid + * @return Reference to member guid + */ + eProsima_user_DllExport detail::GUID_s& guid() + { + return m_guid; + } + + /*! + * @brief This function sets a value in member count + * @param _count New value for member count + */ + eProsima_user_DllExport void count( + uint64_t _count) + { + m_count = _count; + } + + /*! + * @brief This function returns the value of member count + * @return Value of member count + */ + eProsima_user_DllExport uint64_t count() const + { + return m_count; + } + + /*! + * @brief This function returns a reference to member count + * @return Reference to member count + */ + eProsima_user_DllExport uint64_t& count() + { + return m_count; + } + +private: + + detail::GUID_s m_guid; + uint64_t m_count{0}; + +}; +/*! + * @brief This class represents the structure SampleIdentityCount defined by the user in the IDL file. + * @ingroup types + */ +class SampleIdentityCount +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport SampleIdentityCount() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~SampleIdentityCount() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object SampleIdentityCount that will be copied. + */ + eProsima_user_DllExport SampleIdentityCount( + const SampleIdentityCount& x) + { + m_sample_id = x.m_sample_id; + + m_count = x.m_count; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object SampleIdentityCount that will be copied. + */ + eProsima_user_DllExport SampleIdentityCount( + SampleIdentityCount&& x) noexcept + { + m_sample_id = std::move(x.m_sample_id); + m_count = x.m_count; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object SampleIdentityCount that will be copied. + */ + eProsima_user_DllExport SampleIdentityCount& operator =( + const SampleIdentityCount& x) + { + + m_sample_id = x.m_sample_id; + + m_count = x.m_count; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object SampleIdentityCount that will be copied. + */ + eProsima_user_DllExport SampleIdentityCount& operator =( + SampleIdentityCount&& x) noexcept + { + + m_sample_id = std::move(x.m_sample_id); + m_count = x.m_count; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x SampleIdentityCount object to compare. + */ + eProsima_user_DllExport bool operator ==( + const SampleIdentityCount& x) const + { + return (m_sample_id == x.m_sample_id && + m_count == x.m_count); + } + + /*! + * @brief Comparison operator. + * @param x SampleIdentityCount object to compare. + */ + eProsima_user_DllExport bool operator !=( + const SampleIdentityCount& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member sample_id + * @param _sample_id New value to be copied in member sample_id + */ + eProsima_user_DllExport void sample_id( + const detail::SampleIdentity_s& _sample_id) + { + m_sample_id = _sample_id; + } + + /*! + * @brief This function moves the value in member sample_id + * @param _sample_id New value to be moved in member sample_id + */ + eProsima_user_DllExport void sample_id( + detail::SampleIdentity_s&& _sample_id) + { + m_sample_id = std::move(_sample_id); + } + + /*! + * @brief This function returns a constant reference to member sample_id + * @return Constant reference to member sample_id + */ + eProsima_user_DllExport const detail::SampleIdentity_s& sample_id() const + { + return m_sample_id; + } + + /*! + * @brief This function returns a reference to member sample_id + * @return Reference to member sample_id + */ + eProsima_user_DllExport detail::SampleIdentity_s& sample_id() + { + return m_sample_id; + } + + /*! + * @brief This function sets a value in member count + * @param _count New value for member count + */ + eProsima_user_DllExport void count( + uint64_t _count) + { + m_count = _count; + } + + /*! + * @brief This function returns the value of member count + * @return Value of member count + */ + eProsima_user_DllExport uint64_t count() const + { + return m_count; + } + + /*! + * @brief This function returns a reference to member count + * @return Reference to member count + */ + eProsima_user_DllExport uint64_t& count() + { + return m_count; + } + +private: + + detail::SampleIdentity_s m_sample_id; + uint64_t m_count{0}; + +}; +/*! + * @brief This class represents the structure Entity2LocatorTraffic defined by the user in the IDL file. + * @ingroup types + */ +class Entity2LocatorTraffic +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport Entity2LocatorTraffic() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~Entity2LocatorTraffic() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object Entity2LocatorTraffic that will be copied. + */ + eProsima_user_DllExport Entity2LocatorTraffic( + const Entity2LocatorTraffic& x) + { + m_src_guid = x.m_src_guid; + + m_dst_locator = x.m_dst_locator; + + m_packet_count = x.m_packet_count; + + m_byte_count = x.m_byte_count; + + m_byte_magnitude_order = x.m_byte_magnitude_order; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object Entity2LocatorTraffic that will be copied. + */ + eProsima_user_DllExport Entity2LocatorTraffic( + Entity2LocatorTraffic&& x) noexcept + { + m_src_guid = std::move(x.m_src_guid); + m_dst_locator = std::move(x.m_dst_locator); + m_packet_count = x.m_packet_count; + m_byte_count = x.m_byte_count; + m_byte_magnitude_order = x.m_byte_magnitude_order; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object Entity2LocatorTraffic that will be copied. + */ + eProsima_user_DllExport Entity2LocatorTraffic& operator =( + const Entity2LocatorTraffic& x) + { + + m_src_guid = x.m_src_guid; + + m_dst_locator = x.m_dst_locator; + + m_packet_count = x.m_packet_count; + + m_byte_count = x.m_byte_count; + + m_byte_magnitude_order = x.m_byte_magnitude_order; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object Entity2LocatorTraffic that will be copied. + */ + eProsima_user_DllExport Entity2LocatorTraffic& operator =( + Entity2LocatorTraffic&& x) noexcept + { + + m_src_guid = std::move(x.m_src_guid); + m_dst_locator = std::move(x.m_dst_locator); + m_packet_count = x.m_packet_count; + m_byte_count = x.m_byte_count; + m_byte_magnitude_order = x.m_byte_magnitude_order; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x Entity2LocatorTraffic object to compare. + */ + eProsima_user_DllExport bool operator ==( + const Entity2LocatorTraffic& x) const + { + return (m_src_guid == x.m_src_guid && + m_dst_locator == x.m_dst_locator && + m_packet_count == x.m_packet_count && + m_byte_count == x.m_byte_count && + m_byte_magnitude_order == x.m_byte_magnitude_order); + } + + /*! + * @brief Comparison operator. + * @param x Entity2LocatorTraffic object to compare. + */ + eProsima_user_DllExport bool operator !=( + const Entity2LocatorTraffic& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member src_guid + * @param _src_guid New value to be copied in member src_guid + */ + eProsima_user_DllExport void src_guid( + const detail::GUID_s& _src_guid) + { + m_src_guid = _src_guid; + } + + /*! + * @brief This function moves the value in member src_guid + * @param _src_guid New value to be moved in member src_guid + */ + eProsima_user_DllExport void src_guid( + detail::GUID_s&& _src_guid) + { + m_src_guid = std::move(_src_guid); + } + + /*! + * @brief This function returns a constant reference to member src_guid + * @return Constant reference to member src_guid + */ + eProsima_user_DllExport const detail::GUID_s& src_guid() const + { + return m_src_guid; + } + + /*! + * @brief This function returns a reference to member src_guid + * @return Reference to member src_guid + */ + eProsima_user_DllExport detail::GUID_s& src_guid() + { + return m_src_guid; + } + + /*! + * @brief This function copies the value in member dst_locator + * @param _dst_locator New value to be copied in member dst_locator + */ + eProsima_user_DllExport void dst_locator( + const detail::Locator_s& _dst_locator) + { + m_dst_locator = _dst_locator; + } + + /*! + * @brief This function moves the value in member dst_locator + * @param _dst_locator New value to be moved in member dst_locator + */ + eProsima_user_DllExport void dst_locator( + detail::Locator_s&& _dst_locator) + { + m_dst_locator = std::move(_dst_locator); + } + + /*! + * @brief This function returns a constant reference to member dst_locator + * @return Constant reference to member dst_locator + */ + eProsima_user_DllExport const detail::Locator_s& dst_locator() const + { + return m_dst_locator; + } + + /*! + * @brief This function returns a reference to member dst_locator + * @return Reference to member dst_locator + */ + eProsima_user_DllExport detail::Locator_s& dst_locator() + { + return m_dst_locator; + } + + /*! + * @brief This function sets a value in member packet_count + * @param _packet_count New value for member packet_count + */ + eProsima_user_DllExport void packet_count( + uint64_t _packet_count) + { + m_packet_count = _packet_count; + } + + /*! + * @brief This function returns the value of member packet_count + * @return Value of member packet_count + */ + eProsima_user_DllExport uint64_t packet_count() const + { + return m_packet_count; + } + + /*! + * @brief This function returns a reference to member packet_count + * @return Reference to member packet_count + */ + eProsima_user_DllExport uint64_t& packet_count() + { + return m_packet_count; + } + + /*! + * @brief This function sets a value in member byte_count + * @param _byte_count New value for member byte_count + */ + eProsima_user_DllExport void byte_count( + uint64_t _byte_count) + { + m_byte_count = _byte_count; + } + + /*! + * @brief This function returns the value of member byte_count + * @return Value of member byte_count + */ + eProsima_user_DllExport uint64_t byte_count() const + { + return m_byte_count; + } + + /*! + * @brief This function returns a reference to member byte_count + * @return Reference to member byte_count + */ + eProsima_user_DllExport uint64_t& byte_count() + { + return m_byte_count; + } + + /*! + * @brief This function sets a value in member byte_magnitude_order + * @param _byte_magnitude_order New value for member byte_magnitude_order + */ + eProsima_user_DllExport void byte_magnitude_order( + int16_t _byte_magnitude_order) + { + m_byte_magnitude_order = _byte_magnitude_order; + } + + /*! + * @brief This function returns the value of member byte_magnitude_order + * @return Value of member byte_magnitude_order + */ + eProsima_user_DllExport int16_t byte_magnitude_order() const + { + return m_byte_magnitude_order; + } + + /*! + * @brief This function returns a reference to member byte_magnitude_order + * @return Reference to member byte_magnitude_order + */ + eProsima_user_DllExport int16_t& byte_magnitude_order() + { + return m_byte_magnitude_order; + } + +private: + + detail::GUID_s m_src_guid; + detail::Locator_s m_dst_locator; + uint64_t m_packet_count{0}; + uint64_t m_byte_count{0}; + int16_t m_byte_magnitude_order{0}; + +}; +/*! + * @brief This class represents the structure WriterReaderData defined by the user in the IDL file. + * @ingroup types + */ +class WriterReaderData +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport WriterReaderData() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~WriterReaderData() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object WriterReaderData that will be copied. + */ + eProsima_user_DllExport WriterReaderData( + const WriterReaderData& x) + { + m_writer_guid = x.m_writer_guid; + + m_reader_guid = x.m_reader_guid; + + m_data = x.m_data; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object WriterReaderData that will be copied. + */ + eProsima_user_DllExport WriterReaderData( + WriterReaderData&& x) noexcept + { + m_writer_guid = std::move(x.m_writer_guid); + m_reader_guid = std::move(x.m_reader_guid); + m_data = x.m_data; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object WriterReaderData that will be copied. + */ + eProsima_user_DllExport WriterReaderData& operator =( + const WriterReaderData& x) + { + + m_writer_guid = x.m_writer_guid; + + m_reader_guid = x.m_reader_guid; + + m_data = x.m_data; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object WriterReaderData that will be copied. + */ + eProsima_user_DllExport WriterReaderData& operator =( + WriterReaderData&& x) noexcept + { + + m_writer_guid = std::move(x.m_writer_guid); + m_reader_guid = std::move(x.m_reader_guid); + m_data = x.m_data; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x WriterReaderData object to compare. + */ + eProsima_user_DllExport bool operator ==( + const WriterReaderData& x) const + { + return (m_writer_guid == x.m_writer_guid && + m_reader_guid == x.m_reader_guid && + m_data == x.m_data); + } + + /*! + * @brief Comparison operator. + * @param x WriterReaderData object to compare. + */ + eProsima_user_DllExport bool operator !=( + const WriterReaderData& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member writer_guid + * @param _writer_guid New value to be copied in member writer_guid + */ + eProsima_user_DllExport void writer_guid( + const detail::GUID_s& _writer_guid) + { + m_writer_guid = _writer_guid; + } + + /*! + * @brief This function moves the value in member writer_guid + * @param _writer_guid New value to be moved in member writer_guid + */ + eProsima_user_DllExport void writer_guid( + detail::GUID_s&& _writer_guid) + { + m_writer_guid = std::move(_writer_guid); + } + + /*! + * @brief This function returns a constant reference to member writer_guid + * @return Constant reference to member writer_guid + */ + eProsima_user_DllExport const detail::GUID_s& writer_guid() const + { + return m_writer_guid; + } + + /*! + * @brief This function returns a reference to member writer_guid + * @return Reference to member writer_guid + */ + eProsima_user_DllExport detail::GUID_s& writer_guid() + { + return m_writer_guid; + } + + /*! + * @brief This function copies the value in member reader_guid + * @param _reader_guid New value to be copied in member reader_guid + */ + eProsima_user_DllExport void reader_guid( + const detail::GUID_s& _reader_guid) + { + m_reader_guid = _reader_guid; + } + + /*! + * @brief This function moves the value in member reader_guid + * @param _reader_guid New value to be moved in member reader_guid + */ + eProsima_user_DllExport void reader_guid( + detail::GUID_s&& _reader_guid) + { + m_reader_guid = std::move(_reader_guid); + } + + /*! + * @brief This function returns a constant reference to member reader_guid + * @return Constant reference to member reader_guid + */ + eProsima_user_DllExport const detail::GUID_s& reader_guid() const + { + return m_reader_guid; + } + + /*! + * @brief This function returns a reference to member reader_guid + * @return Reference to member reader_guid + */ + eProsima_user_DllExport detail::GUID_s& reader_guid() + { + return m_reader_guid; + } + + /*! + * @brief This function sets a value in member data + * @param _data New value for member data + */ + eProsima_user_DllExport void data( + float _data) + { + m_data = _data; + } + + /*! + * @brief This function returns the value of member data + * @return Value of member data + */ + eProsima_user_DllExport float data() const + { + return m_data; + } + + /*! + * @brief This function returns a reference to member data + * @return Reference to member data + */ + eProsima_user_DllExport float& data() + { + return m_data; + } + +private: + + detail::GUID_s m_writer_guid; + detail::GUID_s m_reader_guid; + float m_data{0.0}; + +}; +/*! + * @brief This class represents the structure Locator2LocatorData defined by the user in the IDL file. + * @ingroup types + */ +class Locator2LocatorData +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport Locator2LocatorData() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~Locator2LocatorData() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object Locator2LocatorData that will be copied. + */ + eProsima_user_DllExport Locator2LocatorData( + const Locator2LocatorData& x) + { + m_src_locator = x.m_src_locator; + + m_dst_locator = x.m_dst_locator; + + m_data = x.m_data; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object Locator2LocatorData that will be copied. + */ + eProsima_user_DllExport Locator2LocatorData( + Locator2LocatorData&& x) noexcept + { + m_src_locator = std::move(x.m_src_locator); + m_dst_locator = std::move(x.m_dst_locator); + m_data = x.m_data; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object Locator2LocatorData that will be copied. + */ + eProsima_user_DllExport Locator2LocatorData& operator =( + const Locator2LocatorData& x) + { + + m_src_locator = x.m_src_locator; + + m_dst_locator = x.m_dst_locator; + + m_data = x.m_data; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object Locator2LocatorData that will be copied. + */ + eProsima_user_DllExport Locator2LocatorData& operator =( + Locator2LocatorData&& x) noexcept + { + + m_src_locator = std::move(x.m_src_locator); + m_dst_locator = std::move(x.m_dst_locator); + m_data = x.m_data; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x Locator2LocatorData object to compare. + */ + eProsima_user_DllExport bool operator ==( + const Locator2LocatorData& x) const + { + return (m_src_locator == x.m_src_locator && + m_dst_locator == x.m_dst_locator && + m_data == x.m_data); + } + + /*! + * @brief Comparison operator. + * @param x Locator2LocatorData object to compare. + */ + eProsima_user_DllExport bool operator !=( + const Locator2LocatorData& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member src_locator + * @param _src_locator New value to be copied in member src_locator + */ + eProsima_user_DllExport void src_locator( + const detail::Locator_s& _src_locator) + { + m_src_locator = _src_locator; + } + + /*! + * @brief This function moves the value in member src_locator + * @param _src_locator New value to be moved in member src_locator + */ + eProsima_user_DllExport void src_locator( + detail::Locator_s&& _src_locator) + { + m_src_locator = std::move(_src_locator); + } + + /*! + * @brief This function returns a constant reference to member src_locator + * @return Constant reference to member src_locator + */ + eProsima_user_DllExport const detail::Locator_s& src_locator() const + { + return m_src_locator; + } + + /*! + * @brief This function returns a reference to member src_locator + * @return Reference to member src_locator + */ + eProsima_user_DllExport detail::Locator_s& src_locator() + { + return m_src_locator; + } + + /*! + * @brief This function copies the value in member dst_locator + * @param _dst_locator New value to be copied in member dst_locator + */ + eProsima_user_DllExport void dst_locator( + const detail::Locator_s& _dst_locator) + { + m_dst_locator = _dst_locator; + } + + /*! + * @brief This function moves the value in member dst_locator + * @param _dst_locator New value to be moved in member dst_locator + */ + eProsima_user_DllExport void dst_locator( + detail::Locator_s&& _dst_locator) + { + m_dst_locator = std::move(_dst_locator); + } + + /*! + * @brief This function returns a constant reference to member dst_locator + * @return Constant reference to member dst_locator + */ + eProsima_user_DllExport const detail::Locator_s& dst_locator() const + { + return m_dst_locator; + } + + /*! + * @brief This function returns a reference to member dst_locator + * @return Reference to member dst_locator + */ + eProsima_user_DllExport detail::Locator_s& dst_locator() + { + return m_dst_locator; + } + + /*! + * @brief This function sets a value in member data + * @param _data New value for member data + */ + eProsima_user_DllExport void data( + float _data) + { + m_data = _data; + } + + /*! + * @brief This function returns the value of member data + * @return Value of member data + */ + eProsima_user_DllExport float data() const + { + return m_data; + } + + /*! + * @brief This function returns a reference to member data + * @return Reference to member data + */ + eProsima_user_DllExport float& data() + { + return m_data; + } + +private: + + detail::Locator_s m_src_locator; + detail::Locator_s m_dst_locator; + float m_data{0.0}; + +}; +/*! + * @brief This class represents the structure EntityData defined by the user in the IDL file. + * @ingroup types + */ +class EntityData +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport EntityData() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~EntityData() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object EntityData that will be copied. + */ + eProsima_user_DllExport EntityData( + const EntityData& x) + { + m_guid = x.m_guid; + + m_data = x.m_data; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object EntityData that will be copied. + */ + eProsima_user_DllExport EntityData( + EntityData&& x) noexcept + { + m_guid = std::move(x.m_guid); + m_data = x.m_data; + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object EntityData that will be copied. + */ + eProsima_user_DllExport EntityData& operator =( + const EntityData& x) + { + + m_guid = x.m_guid; + + m_data = x.m_data; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object EntityData that will be copied. + */ + eProsima_user_DllExport EntityData& operator =( + EntityData&& x) noexcept + { + + m_guid = std::move(x.m_guid); + m_data = x.m_data; + return *this; + } + + /*! + * @brief Comparison operator. + * @param x EntityData object to compare. + */ + eProsima_user_DllExport bool operator ==( + const EntityData& x) const + { + return (m_guid == x.m_guid && + m_data == x.m_data); + } + + /*! + * @brief Comparison operator. + * @param x EntityData object to compare. + */ + eProsima_user_DllExport bool operator !=( + const EntityData& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member guid + * @param _guid New value to be copied in member guid + */ + eProsima_user_DllExport void guid( + const detail::GUID_s& _guid) + { + m_guid = _guid; + } + + /*! + * @brief This function moves the value in member guid + * @param _guid New value to be moved in member guid + */ + eProsima_user_DllExport void guid( + detail::GUID_s&& _guid) + { + m_guid = std::move(_guid); + } + + /*! + * @brief This function returns a constant reference to member guid + * @return Constant reference to member guid + */ + eProsima_user_DllExport const detail::GUID_s& guid() const + { + return m_guid; + } + + /*! + * @brief This function returns a reference to member guid + * @return Reference to member guid + */ + eProsima_user_DllExport detail::GUID_s& guid() + { + return m_guid; + } + + /*! + * @brief This function sets a value in member data + * @param _data New value for member data + */ + eProsima_user_DllExport void data( + float _data) + { + m_data = _data; + } + + /*! + * @brief This function returns the value of member data + * @return Value of member data + */ + eProsima_user_DllExport float data() const + { + return m_data; + } + + /*! + * @brief This function returns a reference to member data + * @return Reference to member data + */ + eProsima_user_DllExport float& data() + { + return m_data; + } + +private: + + detail::GUID_s m_guid; + float m_data{0.0}; + +}; +/*! + * @brief This class represents the structure PhysicalData defined by the user in the IDL file. + * @ingroup types + */ +class PhysicalData +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport PhysicalData() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~PhysicalData() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object PhysicalData that will be copied. + */ + eProsima_user_DllExport PhysicalData( + const PhysicalData& x) + { + m_participant_guid = x.m_participant_guid; + + m_host = x.m_host; + + m_user = x.m_user; + + m_process = x.m_process; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object PhysicalData that will be copied. + */ + eProsima_user_DllExport PhysicalData( + PhysicalData&& x) noexcept + { + m_participant_guid = std::move(x.m_participant_guid); + m_host = std::move(x.m_host); + m_user = std::move(x.m_user); + m_process = std::move(x.m_process); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object PhysicalData that will be copied. + */ + eProsima_user_DllExport PhysicalData& operator =( + const PhysicalData& x) + { + + m_participant_guid = x.m_participant_guid; + + m_host = x.m_host; + + m_user = x.m_user; + + m_process = x.m_process; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object PhysicalData that will be copied. + */ + eProsima_user_DllExport PhysicalData& operator =( + PhysicalData&& x) noexcept + { + + m_participant_guid = std::move(x.m_participant_guid); + m_host = std::move(x.m_host); + m_user = std::move(x.m_user); + m_process = std::move(x.m_process); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x PhysicalData object to compare. + */ + eProsima_user_DllExport bool operator ==( + const PhysicalData& x) const + { + return (m_participant_guid == x.m_participant_guid && + m_host == x.m_host && + m_user == x.m_user && + m_process == x.m_process); + } + + /*! + * @brief Comparison operator. + * @param x PhysicalData object to compare. + */ + eProsima_user_DllExport bool operator !=( + const PhysicalData& x) const + { + return !(*this == x); + } + + /*! + * @brief This function copies the value in member participant_guid + * @param _participant_guid New value to be copied in member participant_guid + */ + eProsima_user_DllExport void participant_guid( + const detail::GUID_s& _participant_guid) + { + m_participant_guid = _participant_guid; + } + + /*! + * @brief This function moves the value in member participant_guid + * @param _participant_guid New value to be moved in member participant_guid + */ + eProsima_user_DllExport void participant_guid( + detail::GUID_s&& _participant_guid) + { + m_participant_guid = std::move(_participant_guid); + } + + /*! + * @brief This function returns a constant reference to member participant_guid + * @return Constant reference to member participant_guid + */ + eProsima_user_DllExport const detail::GUID_s& participant_guid() const + { + return m_participant_guid; + } + + /*! + * @brief This function returns a reference to member participant_guid + * @return Reference to member participant_guid + */ + eProsima_user_DllExport detail::GUID_s& participant_guid() + { + return m_participant_guid; + } + + /*! + * @brief This function copies the value in member host + * @param _host New value to be copied in member host + */ + eProsima_user_DllExport void host( + const std::string& _host) + { + m_host = _host; + } + + /*! + * @brief This function moves the value in member host + * @param _host New value to be moved in member host + */ + eProsima_user_DllExport void host( + std::string&& _host) + { + m_host = std::move(_host); + } + + /*! + * @brief This function returns a constant reference to member host + * @return Constant reference to member host + */ + eProsima_user_DllExport const std::string& host() const + { + return m_host; + } + + /*! + * @brief This function returns a reference to member host + * @return Reference to member host + */ + eProsima_user_DllExport std::string& host() + { + return m_host; + } + + /*! + * @brief This function copies the value in member user + * @param _user New value to be copied in member user + */ + eProsima_user_DllExport void user( + const std::string& _user) + { + m_user = _user; + } + + /*! + * @brief This function moves the value in member user + * @param _user New value to be moved in member user + */ + eProsima_user_DllExport void user( + std::string&& _user) + { + m_user = std::move(_user); + } + + /*! + * @brief This function returns a constant reference to member user + * @return Constant reference to member user + */ + eProsima_user_DllExport const std::string& user() const + { + return m_user; + } + + /*! + * @brief This function returns a reference to member user + * @return Reference to member user + */ + eProsima_user_DllExport std::string& user() + { + return m_user; + } + + /*! + * @brief This function copies the value in member process + * @param _process New value to be copied in member process + */ + eProsima_user_DllExport void process( + const std::string& _process) + { + m_process = _process; + } + + /*! + * @brief This function moves the value in member process + * @param _process New value to be moved in member process + */ + eProsima_user_DllExport void process( + std::string&& _process) + { + m_process = std::move(_process); + } + + /*! + * @brief This function returns a constant reference to member process + * @return Constant reference to member process + */ + eProsima_user_DllExport const std::string& process() const + { + return m_process; + } + + /*! + * @brief This function returns a reference to member process + * @return Reference to member process + */ + eProsima_user_DllExport std::string& process() + { + return m_process; + } + +private: + + detail::GUID_s m_participant_guid; + std::string m_host; + std::string m_user; + std::string m_process; + +}; +namespace EventKind { + +const uint32_t HISTORY2HISTORY_LATENCY = 0x1; +const uint32_t NETWORK_LATENCY = 0x2; +const uint32_t PUBLICATION_THROUGHPUT = 0x4; +const uint32_t SUBSCRIPTION_THROUGHPUT = 0x8; +const uint32_t RTPS_SENT = 0x10; +const uint32_t RTPS_LOST = 0x20; +const uint32_t RESENT_DATAS = 0x40; +const uint32_t HEARTBEAT_COUNT = 0x80; +const uint32_t ACKNACK_COUNT = 0x100; +const uint32_t NACKFRAG_COUNT = 0x200; +const uint32_t GAP_COUNT = 0x400; +const uint32_t DATA_COUNT = 0x800; +const uint32_t PDP_PACKETS = 0x1000; +const uint32_t EDP_PACKETS = 0x2000; +const uint32_t DISCOVERED_ENTITY = 0x4000; +const uint32_t SAMPLE_DATAS = 0x8000; +const uint32_t PHYSICAL_DATA = 0x10000; + +} // namespace EventKind +/*! + * @brief This class represents the union Data defined by the user in the IDL file. + * @ingroup types + */ +class Data +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport Data() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~Data() + { + if (member_destructor_) + { + member_destructor_(); + } + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object Data that will be copied. + */ + eProsima_user_DllExport Data( + const Data& x) + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + writer_reader_data_() = x.m_writer_reader_data; + break; + + case 0x00000002: + locator2locator_data_() = x.m_locator2locator_data; + break; + + case 0x00000003: + entity_data_() = x.m_entity_data; + break; + + case 0x00000004: + entity2locator_traffic_() = x.m_entity2locator_traffic; + break; + + case 0x00000005: + entity_count_() = x.m_entity_count; + break; + + case 0x00000006: + discovery_time_() = x.m_discovery_time; + break; + + case 0x00000007: + sample_identity_count_() = x.m_sample_identity_count; + break; + + case 0x00000008: + physical_data_() = x.m_physical_data; + break; + + } + } + + /*! + * @brief Move constructor. + * @param x Reference to the object Data that will be copied. + */ + eProsima_user_DllExport Data( + Data&& x) noexcept + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + writer_reader_data_() = std::move(x.m_writer_reader_data); + break; + + case 0x00000002: + locator2locator_data_() = std::move(x.m_locator2locator_data); + break; + + case 0x00000003: + entity_data_() = std::move(x.m_entity_data); + break; + + case 0x00000004: + entity2locator_traffic_() = std::move(x.m_entity2locator_traffic); + break; + + case 0x00000005: + entity_count_() = std::move(x.m_entity_count); + break; + + case 0x00000006: + discovery_time_() = std::move(x.m_discovery_time); + break; + + case 0x00000007: + sample_identity_count_() = std::move(x.m_sample_identity_count); + break; + + case 0x00000008: + physical_data_() = std::move(x.m_physical_data); + break; + + } + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object Data that will be copied. + */ + eProsima_user_DllExport Data& operator =( + const Data& x) + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + writer_reader_data_() = x.m_writer_reader_data; + break; + + case 0x00000002: + locator2locator_data_() = x.m_locator2locator_data; + break; + + case 0x00000003: + entity_data_() = x.m_entity_data; + break; + + case 0x00000004: + entity2locator_traffic_() = x.m_entity2locator_traffic; + break; + + case 0x00000005: + entity_count_() = x.m_entity_count; + break; + + case 0x00000006: + discovery_time_() = x.m_discovery_time; + break; + + case 0x00000007: + sample_identity_count_() = x.m_sample_identity_count; + break; + + case 0x00000008: + physical_data_() = x.m_physical_data; + break; + + } + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object Data that will be copied. + */ + eProsima_user_DllExport Data& operator =( + Data&& x) noexcept + { + m__d = x.m__d; + + switch (x.selected_member_) + { + case 0x00000001: + writer_reader_data_() = std::move(x.m_writer_reader_data); + break; + + case 0x00000002: + locator2locator_data_() = std::move(x.m_locator2locator_data); + break; + + case 0x00000003: + entity_data_() = std::move(x.m_entity_data); + break; + + case 0x00000004: + entity2locator_traffic_() = std::move(x.m_entity2locator_traffic); + break; + + case 0x00000005: + entity_count_() = std::move(x.m_entity_count); + break; + + case 0x00000006: + discovery_time_() = std::move(x.m_discovery_time); + break; + + case 0x00000007: + sample_identity_count_() = std::move(x.m_sample_identity_count); + break; + + case 0x00000008: + physical_data_() = std::move(x.m_physical_data); + break; + + } + + return *this; + } + + /*! + * @brief Comparison operator. + * @param x Data object to compare. + */ + eProsima_user_DllExport bool operator ==( + const Data& x) const + { + bool ret_value {false}; + + if (m__d == x.m__d && + selected_member_ == x.selected_member_) + { + switch (selected_member_) + { + case 0x00000001: + ret_value = (m_writer_reader_data == x.m_writer_reader_data); + break; + + case 0x00000002: + ret_value = (m_locator2locator_data == x.m_locator2locator_data); + break; + + case 0x00000003: + ret_value = (m_entity_data == x.m_entity_data); + break; + + case 0x00000004: + ret_value = (m_entity2locator_traffic == x.m_entity2locator_traffic); + break; + + case 0x00000005: + ret_value = (m_entity_count == x.m_entity_count); + break; + + case 0x00000006: + ret_value = (m_discovery_time == x.m_discovery_time); + break; + + case 0x00000007: + ret_value = (m_sample_identity_count == x.m_sample_identity_count); + break; + + case 0x00000008: + ret_value = (m_physical_data == x.m_physical_data); + break; + + } + } + + return ret_value; + } + + /*! + * @brief Comparison operator. + * @param x Data object to compare. + */ + eProsima_user_DllExport bool operator !=( + const Data& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets the discriminator value. + * @param __d New value for the discriminator. + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member. + */ + eProsima_user_DllExport void _d( + uint32_t __d) + { + bool valid_discriminator = false; + + switch (__d) + { + case EventKind::HISTORY2HISTORY_LATENCY: + if (0x00000001 == selected_member_) + { + valid_discriminator = true; + } + break; + + case EventKind::NETWORK_LATENCY: + if (0x00000002 == selected_member_) + { + valid_discriminator = true; + } + break; + + case EventKind::PUBLICATION_THROUGHPUT: + case EventKind::SUBSCRIPTION_THROUGHPUT: + if (0x00000003 == selected_member_) + { + valid_discriminator = true; + } + break; + + case EventKind::RTPS_SENT: + case EventKind::RTPS_LOST: + if (0x00000004 == selected_member_) + { + valid_discriminator = true; + } + break; + + case EventKind::RESENT_DATAS: + case EventKind::HEARTBEAT_COUNT: + case EventKind::ACKNACK_COUNT: + case EventKind::NACKFRAG_COUNT: + case EventKind::GAP_COUNT: + case EventKind::DATA_COUNT: + case EventKind::PDP_PACKETS: + case EventKind::EDP_PACKETS: + if (0x00000005 == selected_member_) + { + valid_discriminator = true; + } + break; + + case EventKind::DISCOVERED_ENTITY: + if (0x00000006 == selected_member_) + { + valid_discriminator = true; + } + break; + + case EventKind::SAMPLE_DATAS: + if (0x00000007 == selected_member_) + { + valid_discriminator = true; + } + break; + + case EventKind::PHYSICAL_DATA: + if (0x00000008 == selected_member_) + { + valid_discriminator = true; + } + break; + + } + + if (!valid_discriminator) + { + throw eprosima::fastcdr::exception::BadParamException( + "Discriminator doesn't correspond with the selected union member"); + } + + m__d = __d; + } + + /*! + * @brief This function returns the value of the discriminator. + * @return Value of the discriminator + */ + eProsima_user_DllExport uint32_t _d() const + { + return m__d; + } + + /*! + * @brief This function copies the value in member writer_reader_data + * @param _writer_reader_data New value to be copied in member writer_reader_data + */ + eProsima_user_DllExport void writer_reader_data( + const WriterReaderData& _writer_reader_data) + { + writer_reader_data_() = _writer_reader_data; + m__d = EventKind::HISTORY2HISTORY_LATENCY; + } + + /*! + * @brief This function moves the value in member writer_reader_data + * @param _writer_reader_data New value to be moved in member writer_reader_data + */ + eProsima_user_DllExport void writer_reader_data( + WriterReaderData&& _writer_reader_data) + { + writer_reader_data_() = _writer_reader_data; + m__d = EventKind::HISTORY2HISTORY_LATENCY; + } + + /*! + * @brief This function returns a constant reference to member writer_reader_data + * @return Constant reference to member writer_reader_data + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const WriterReaderData& writer_reader_data() const + { + if (0x00000001 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_writer_reader_data; + } + + /*! + * @brief This function returns a reference to member writer_reader_data + * @return Reference to member writer_reader_data + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport WriterReaderData& writer_reader_data() + { + if (0x00000001 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_writer_reader_data; + } + + /*! + * @brief This function copies the value in member locator2locator_data + * @param _locator2locator_data New value to be copied in member locator2locator_data + */ + eProsima_user_DllExport void locator2locator_data( + const Locator2LocatorData& _locator2locator_data) + { + locator2locator_data_() = _locator2locator_data; + m__d = EventKind::NETWORK_LATENCY; + } + + /*! + * @brief This function moves the value in member locator2locator_data + * @param _locator2locator_data New value to be moved in member locator2locator_data + */ + eProsima_user_DllExport void locator2locator_data( + Locator2LocatorData&& _locator2locator_data) + { + locator2locator_data_() = _locator2locator_data; + m__d = EventKind::NETWORK_LATENCY; + } + + /*! + * @brief This function returns a constant reference to member locator2locator_data + * @return Constant reference to member locator2locator_data + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const Locator2LocatorData& locator2locator_data() const + { + if (0x00000002 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_locator2locator_data; + } + + /*! + * @brief This function returns a reference to member locator2locator_data + * @return Reference to member locator2locator_data + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport Locator2LocatorData& locator2locator_data() + { + if (0x00000002 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_locator2locator_data; + } + + /*! + * @brief This function copies the value in member entity_data + * @param _entity_data New value to be copied in member entity_data + */ + eProsima_user_DllExport void entity_data( + const EntityData& _entity_data) + { + entity_data_() = _entity_data; + m__d = EventKind::PUBLICATION_THROUGHPUT; + } + + /*! + * @brief This function moves the value in member entity_data + * @param _entity_data New value to be moved in member entity_data + */ + eProsima_user_DllExport void entity_data( + EntityData&& _entity_data) + { + entity_data_() = _entity_data; + m__d = EventKind::PUBLICATION_THROUGHPUT; + } + + /*! + * @brief This function returns a constant reference to member entity_data + * @return Constant reference to member entity_data + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const EntityData& entity_data() const + { + if (0x00000003 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_entity_data; + } + + /*! + * @brief This function returns a reference to member entity_data + * @return Reference to member entity_data + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport EntityData& entity_data() + { + if (0x00000003 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_entity_data; + } + + /*! + * @brief This function copies the value in member entity2locator_traffic + * @param _entity2locator_traffic New value to be copied in member entity2locator_traffic + */ + eProsima_user_DllExport void entity2locator_traffic( + const Entity2LocatorTraffic& _entity2locator_traffic) + { + entity2locator_traffic_() = _entity2locator_traffic; + m__d = EventKind::RTPS_SENT; + } + + /*! + * @brief This function moves the value in member entity2locator_traffic + * @param _entity2locator_traffic New value to be moved in member entity2locator_traffic + */ + eProsima_user_DllExport void entity2locator_traffic( + Entity2LocatorTraffic&& _entity2locator_traffic) + { + entity2locator_traffic_() = _entity2locator_traffic; + m__d = EventKind::RTPS_SENT; + } + + /*! + * @brief This function returns a constant reference to member entity2locator_traffic + * @return Constant reference to member entity2locator_traffic + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const Entity2LocatorTraffic& entity2locator_traffic() const + { + if (0x00000004 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_entity2locator_traffic; + } + + /*! + * @brief This function returns a reference to member entity2locator_traffic + * @return Reference to member entity2locator_traffic + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport Entity2LocatorTraffic& entity2locator_traffic() + { + if (0x00000004 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_entity2locator_traffic; + } + + /*! + * @brief This function copies the value in member entity_count + * @param _entity_count New value to be copied in member entity_count + */ + eProsima_user_DllExport void entity_count( + const EntityCount& _entity_count) + { + entity_count_() = _entity_count; + m__d = EventKind::RESENT_DATAS; + } + + /*! + * @brief This function moves the value in member entity_count + * @param _entity_count New value to be moved in member entity_count + */ + eProsima_user_DllExport void entity_count( + EntityCount&& _entity_count) + { + entity_count_() = _entity_count; + m__d = EventKind::RESENT_DATAS; + } + + /*! + * @brief This function returns a constant reference to member entity_count + * @return Constant reference to member entity_count + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const EntityCount& entity_count() const + { + if (0x00000005 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_entity_count; + } + + /*! + * @brief This function returns a reference to member entity_count + * @return Reference to member entity_count + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport EntityCount& entity_count() + { + if (0x00000005 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_entity_count; + } + + /*! + * @brief This function copies the value in member discovery_time + * @param _discovery_time New value to be copied in member discovery_time + */ + eProsima_user_DllExport void discovery_time( + const DiscoveryTime& _discovery_time) + { + discovery_time_() = _discovery_time; + m__d = EventKind::DISCOVERED_ENTITY; + } + + /*! + * @brief This function moves the value in member discovery_time + * @param _discovery_time New value to be moved in member discovery_time + */ + eProsima_user_DllExport void discovery_time( + DiscoveryTime&& _discovery_time) + { + discovery_time_() = _discovery_time; + m__d = EventKind::DISCOVERED_ENTITY; + } + + /*! + * @brief This function returns a constant reference to member discovery_time + * @return Constant reference to member discovery_time + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const DiscoveryTime& discovery_time() const + { + if (0x00000006 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_discovery_time; + } + + /*! + * @brief This function returns a reference to member discovery_time + * @return Reference to member discovery_time + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport DiscoveryTime& discovery_time() + { + if (0x00000006 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_discovery_time; + } + + /*! + * @brief This function copies the value in member sample_identity_count + * @param _sample_identity_count New value to be copied in member sample_identity_count + */ + eProsima_user_DllExport void sample_identity_count( + const SampleIdentityCount& _sample_identity_count) + { + sample_identity_count_() = _sample_identity_count; + m__d = EventKind::SAMPLE_DATAS; + } + + /*! + * @brief This function moves the value in member sample_identity_count + * @param _sample_identity_count New value to be moved in member sample_identity_count + */ + eProsima_user_DllExport void sample_identity_count( + SampleIdentityCount&& _sample_identity_count) + { + sample_identity_count_() = _sample_identity_count; + m__d = EventKind::SAMPLE_DATAS; + } + + /*! + * @brief This function returns a constant reference to member sample_identity_count + * @return Constant reference to member sample_identity_count + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const SampleIdentityCount& sample_identity_count() const + { + if (0x00000007 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_sample_identity_count; + } + + /*! + * @brief This function returns a reference to member sample_identity_count + * @return Reference to member sample_identity_count + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport SampleIdentityCount& sample_identity_count() + { + if (0x00000007 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_sample_identity_count; + } + + /*! + * @brief This function copies the value in member physical_data + * @param _physical_data New value to be copied in member physical_data + */ + eProsima_user_DllExport void physical_data( + const PhysicalData& _physical_data) + { + physical_data_() = _physical_data; + m__d = EventKind::PHYSICAL_DATA; + } + + /*! + * @brief This function moves the value in member physical_data + * @param _physical_data New value to be moved in member physical_data + */ + eProsima_user_DllExport void physical_data( + PhysicalData&& _physical_data) + { + physical_data_() = _physical_data; + m__d = EventKind::PHYSICAL_DATA; + } + + /*! + * @brief This function returns a constant reference to member physical_data + * @return Constant reference to member physical_data + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport const PhysicalData& physical_data() const + { + if (0x00000008 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_physical_data; + } + + /*! + * @brief This function returns a reference to member physical_data + * @return Reference to member physical_data + * @exception eprosima::fastcdr::exception::BadParamException This exception is thrown if the requested union member is not the current selection. + */ + eProsima_user_DllExport PhysicalData& physical_data() + { + if (0x00000008 != selected_member_) + { + throw eprosima::fastcdr::exception::BadParamException("This member has not been selected"); + } + + return m_physical_data; + } + + void _default() + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x0FFFFFFFu; + } + +private: + + WriterReaderData& writer_reader_data_() + { + if (0x00000001 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000001; + member_destructor_ = [&]() + { + m_writer_reader_data.~WriterReaderData(); + }; + new(&m_writer_reader_data) WriterReaderData(); + } + + return m_writer_reader_data; + } + + Locator2LocatorData& locator2locator_data_() + { + if (0x00000002 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000002; + member_destructor_ = [&]() + { + m_locator2locator_data.~Locator2LocatorData(); + }; + new(&m_locator2locator_data) Locator2LocatorData(); + } + + return m_locator2locator_data; + } + + EntityData& entity_data_() + { + if (0x00000003 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000003; + member_destructor_ = [&]() + { + m_entity_data.~EntityData(); + }; + new(&m_entity_data) EntityData(); + } + + return m_entity_data; + } + + Entity2LocatorTraffic& entity2locator_traffic_() + { + if (0x00000004 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000004; + member_destructor_ = [&]() + { + m_entity2locator_traffic.~Entity2LocatorTraffic(); + }; + new(&m_entity2locator_traffic) Entity2LocatorTraffic(); + } + + return m_entity2locator_traffic; + } + + EntityCount& entity_count_() + { + if (0x00000005 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000005; + member_destructor_ = [&]() + { + m_entity_count.~EntityCount(); + }; + new(&m_entity_count) EntityCount(); + } + + return m_entity_count; + } + + DiscoveryTime& discovery_time_() + { + if (0x00000006 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000006; + member_destructor_ = [&]() + { + m_discovery_time.~DiscoveryTime(); + }; + new(&m_discovery_time) DiscoveryTime(); + } + + return m_discovery_time; + } + + SampleIdentityCount& sample_identity_count_() + { + if (0x00000007 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000007; + member_destructor_ = [&]() + { + m_sample_identity_count.~SampleIdentityCount(); + }; + new(&m_sample_identity_count) SampleIdentityCount(); + } + + return m_sample_identity_count; + } + + PhysicalData& physical_data_() + { + if (0x00000008 != selected_member_) + { + if (member_destructor_) + { + member_destructor_(); + } + + selected_member_ = 0x00000008; + member_destructor_ = [&]() + { + m_physical_data.~PhysicalData(); + }; + new(&m_physical_data) PhysicalData(); + } + + return m_physical_data; + } + + uint32_t m__d {2147483647}; + + union + { + WriterReaderData m_writer_reader_data; + Locator2LocatorData m_locator2locator_data; + EntityData m_entity_data; + Entity2LocatorTraffic m_entity2locator_traffic; + EntityCount m_entity_count; + DiscoveryTime m_discovery_time; + SampleIdentityCount m_sample_identity_count; + PhysicalData m_physical_data; + }; + + uint32_t selected_member_ {0x0FFFFFFFu}; + + std::function member_destructor_; +}; + +} // namespace statistics + +} // namespace fastdds + +} // namespace eprosima + +#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPES_HPP_ + + diff --git a/include/fastdds_statistics_backend/topic_types/types.idl b/include/fastdds_statistics_backend/topic_types/types.idl index 007b9155c..96654a165 100644 --- a/include/fastdds_statistics_backend/topic_types/types.idl +++ b/include/fastdds_statistics_backend/topic_types/types.idl @@ -13,7 +13,7 @@ // limitations under the License. /** - * @file types.idl + * @file include/fastdds/statistics/types.idl */ module eprosima { @@ -23,40 +23,34 @@ module statistics { module detail { - @final struct EntityId_s { octet value[4]; }; - @final struct GuidPrefix_s { octet value[12]; }; - @final struct GUID_s { GuidPrefix_s guidPrefix; EntityId_s entityId; }; - @final struct SequenceNumber_s { long high; unsigned long low; }; - @final struct SampleIdentity_s { GUID_s writer_guid; SequenceNumber_s sequence_number; }; - @final struct Locator_s { long kind; @@ -66,7 +60,6 @@ module statistics { }; // namespace detail -@final struct DiscoveryTime { @Key detail::GUID_s local_participant_guid; @@ -77,21 +70,18 @@ struct DiscoveryTime string process; }; -@final struct EntityCount { @Key detail::GUID_s guid; unsigned long long count; }; -@final struct SampleIdentityCount { @Key detail::SampleIdentity_s sample_id; unsigned long long count; }; -@final struct Entity2LocatorTraffic { @Key detail::GUID_s src_guid; @@ -101,7 +91,6 @@ struct Entity2LocatorTraffic short byte_magnitude_order; }; -@final struct WriterReaderData { @Key detail::GUID_s writer_guid; @@ -109,7 +98,6 @@ struct WriterReaderData float data; }; -@final struct Locator2LocatorData { @Key detail::Locator_s src_locator; @@ -117,14 +105,12 @@ struct Locator2LocatorData float data; }; -@final struct EntityData { @Key detail::GUID_s guid; float data; }; -@final struct PhysicalData { @Key detail::GUID_s participant_guid; @@ -133,56 +119,53 @@ struct PhysicalData string process; }; -@final -@bit_bound(32) -bitmask EventKind +module EventKind { - @position(0) HISTORY2HISTORY_LATENCY, - @position(1) NETWORK_LATENCY, - @position(2) PUBLICATION_THROUGHPUT, - @position(3) SUBSCRIPTION_THROUGHPUT, - @position(4) RTPS_SENT, - @position(5) RTPS_LOST, - @position(6) RESENT_DATAS, - @position(7) HEARTBEAT_COUNT, - @position(8) ACKNACK_COUNT, - @position(9) NACKFRAG_COUNT, - @position(10) GAP_COUNT, - @position(11) DATA_COUNT, - @position(12) PDP_PACKETS, - @position(13) EDP_PACKETS, - @position(14) DISCOVERED_ENTITY, - @position(15) SAMPLE_DATAS, - @position(16) PHYSICAL_DATA + const unsigned long HISTORY2HISTORY_LATENCY = 0x1; + const unsigned long NETWORK_LATENCY = 0x2; + const unsigned long PUBLICATION_THROUGHPUT = 0x4; + const unsigned long SUBSCRIPTION_THROUGHPUT = 0x8; + const unsigned long RTPS_SENT = 0x10; + const unsigned long RTPS_LOST = 0x20; + const unsigned long RESENT_DATAS = 0x40; + const unsigned long HEARTBEAT_COUNT = 0x80; + const unsigned long ACKNACK_COUNT = 0x100; + const unsigned long NACKFRAG_COUNT = 0x200; + const unsigned long GAP_COUNT = 0x400; + const unsigned long DATA_COUNT = 0x800; + const unsigned long PDP_PACKETS = 0x1000; + const unsigned long EDP_PACKETS = 0x2000; + const unsigned long DISCOVERED_ENTITY = 0x4000; + const unsigned long SAMPLE_DATAS = 0x8000; + const unsigned long PHYSICAL_DATA = 0x10000; }; -@final -union Data switch(EventKind) +union Data switch(unsigned long) { - case HISTORY2HISTORY_LATENCY: + case EventKind::HISTORY2HISTORY_LATENCY: WriterReaderData writer_reader_data; - case NETWORK_LATENCY: + case EventKind::NETWORK_LATENCY: Locator2LocatorData locator2locator_data; - case PUBLICATION_THROUGHPUT: - case SUBSCRIPTION_THROUGHPUT: + case EventKind::PUBLICATION_THROUGHPUT: + case EventKind::SUBSCRIPTION_THROUGHPUT: EntityData entity_data; - case RTPS_SENT: - case RTPS_LOST: + case EventKind::RTPS_SENT: + case EventKind::RTPS_LOST: Entity2LocatorTraffic entity2locator_traffic; - case RESENT_DATAS: - case HEARTBEAT_COUNT: - case ACKNACK_COUNT: - case NACKFRAG_COUNT: - case GAP_COUNT: - case DATA_COUNT: - case PDP_PACKETS: - case EDP_PACKETS: + case EventKind::RESENT_DATAS: + case EventKind::HEARTBEAT_COUNT: + case EventKind::ACKNACK_COUNT: + case EventKind::NACKFRAG_COUNT: + case EventKind::GAP_COUNT: + case EventKind::DATA_COUNT: + case EventKind::PDP_PACKETS: + case EventKind::EDP_PACKETS: EntityCount entity_count; - case DISCOVERED_ENTITY: + case EventKind::DISCOVERED_ENTITY: DiscoveryTime discovery_time; - case SAMPLE_DATAS: + case EventKind::SAMPLE_DATAS: SampleIdentityCount sample_identity_count; - case PHYSICAL_DATA: + case EventKind::PHYSICAL_DATA: PhysicalData physical_data; }; diff --git a/include/fastdds_statistics_backend/topic_types/typesCdrAux.hpp b/include/fastdds_statistics_backend/topic_types/typesCdrAux.hpp index a71ccfb55..8f393b280 100644 --- a/include/fastdds_statistics_backend/topic_types/typesCdrAux.hpp +++ b/include/fastdds_statistics_backend/topic_types/typesCdrAux.hpp @@ -19,53 +19,52 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_HPP_ -#define _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_HPP_ +#ifndef FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_HPP +#define FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_HPP -#include "types.h" +#include "types.hpp" -constexpr uint32_t eprosima_fastdds_statistics_DiscoveryTime_max_cdr_typesize {820UL}; -constexpr uint32_t eprosima_fastdds_statistics_DiscoveryTime_max_key_cdr_typesize {32UL}; +constexpr uint32_t eprosima_fastdds_statistics_DiscoveryTime_max_cdr_typesize {852UL}; +constexpr uint32_t eprosima_fastdds_statistics_DiscoveryTime_max_key_cdr_typesize {56UL}; -constexpr uint32_t eprosima_fastdds_statistics_PhysicalData_max_cdr_typesize {796UL}; -constexpr uint32_t eprosima_fastdds_statistics_PhysicalData_max_key_cdr_typesize {16UL}; +constexpr uint32_t eprosima_fastdds_statistics_PhysicalData_max_cdr_typesize {812UL}; +constexpr uint32_t eprosima_fastdds_statistics_PhysicalData_max_key_cdr_typesize {28UL}; - -constexpr uint32_t eprosima_fastdds_statistics_detail_Locator_s_max_cdr_typesize {24UL}; +constexpr uint32_t eprosima_fastdds_statistics_detail_Locator_s_max_cdr_typesize {28UL}; constexpr uint32_t eprosima_fastdds_statistics_detail_Locator_s_max_key_cdr_typesize {0UL}; -constexpr uint32_t eprosima_fastdds_statistics_detail_GuidPrefix_s_max_cdr_typesize {12UL}; +constexpr uint32_t eprosima_fastdds_statistics_detail_GuidPrefix_s_max_cdr_typesize {16UL}; constexpr uint32_t eprosima_fastdds_statistics_detail_GuidPrefix_s_max_key_cdr_typesize {0UL}; -constexpr uint32_t eprosima_fastdds_statistics_detail_SampleIdentity_s_max_cdr_typesize {24UL}; +constexpr uint32_t eprosima_fastdds_statistics_detail_SampleIdentity_s_max_cdr_typesize {44UL}; constexpr uint32_t eprosima_fastdds_statistics_detail_SampleIdentity_s_max_key_cdr_typesize {0UL}; -constexpr uint32_t eprosima_fastdds_statistics_EntityData_max_cdr_typesize {20UL}; -constexpr uint32_t eprosima_fastdds_statistics_EntityData_max_key_cdr_typesize {16UL}; +constexpr uint32_t eprosima_fastdds_statistics_EntityData_max_cdr_typesize {36UL}; +constexpr uint32_t eprosima_fastdds_statistics_EntityData_max_key_cdr_typesize {28UL}; -constexpr uint32_t eprosima_fastdds_statistics_Entity2LocatorTraffic_max_cdr_typesize {58UL}; -constexpr uint32_t eprosima_fastdds_statistics_Entity2LocatorTraffic_max_key_cdr_typesize {40UL}; +constexpr uint32_t eprosima_fastdds_statistics_Entity2LocatorTraffic_max_cdr_typesize {82UL}; +constexpr uint32_t eprosima_fastdds_statistics_Entity2LocatorTraffic_max_key_cdr_typesize {56UL}; -constexpr uint32_t eprosima_fastdds_statistics_detail_EntityId_s_max_cdr_typesize {4UL}; +constexpr uint32_t eprosima_fastdds_statistics_detail_EntityId_s_max_cdr_typesize {8UL}; constexpr uint32_t eprosima_fastdds_statistics_detail_EntityId_s_max_key_cdr_typesize {0UL}; -constexpr uint32_t eprosima_fastdds_statistics_EntityCount_max_cdr_typesize {24UL}; -constexpr uint32_t eprosima_fastdds_statistics_EntityCount_max_key_cdr_typesize {16UL}; +constexpr uint32_t eprosima_fastdds_statistics_EntityCount_max_cdr_typesize {40UL}; +constexpr uint32_t eprosima_fastdds_statistics_EntityCount_max_key_cdr_typesize {28UL}; -constexpr uint32_t eprosima_fastdds_statistics_WriterReaderData_max_cdr_typesize {36UL}; -constexpr uint32_t eprosima_fastdds_statistics_WriterReaderData_max_key_cdr_typesize {32UL}; +constexpr uint32_t eprosima_fastdds_statistics_WriterReaderData_max_cdr_typesize {64UL}; +constexpr uint32_t eprosima_fastdds_statistics_WriterReaderData_max_key_cdr_typesize {56UL}; -constexpr uint32_t eprosima_fastdds_statistics_SampleIdentityCount_max_cdr_typesize {32UL}; -constexpr uint32_t eprosima_fastdds_statistics_SampleIdentityCount_max_key_cdr_typesize {24UL}; +constexpr uint32_t eprosima_fastdds_statistics_SampleIdentityCount_max_cdr_typesize {56UL}; +constexpr uint32_t eprosima_fastdds_statistics_SampleIdentityCount_max_key_cdr_typesize {44UL}; -constexpr uint32_t eprosima_fastdds_statistics_Locator2LocatorData_max_cdr_typesize {52UL}; -constexpr uint32_t eprosima_fastdds_statistics_Locator2LocatorData_max_key_cdr_typesize {48UL}; +constexpr uint32_t eprosima_fastdds_statistics_Locator2LocatorData_max_cdr_typesize {64UL}; +constexpr uint32_t eprosima_fastdds_statistics_Locator2LocatorData_max_key_cdr_typesize {56UL}; -constexpr uint32_t eprosima_fastdds_statistics_detail_GUID_s_max_cdr_typesize {16UL}; +constexpr uint32_t eprosima_fastdds_statistics_detail_GUID_s_max_cdr_typesize {28UL}; constexpr uint32_t eprosima_fastdds_statistics_detail_GUID_s_max_key_cdr_typesize {0UL}; -constexpr uint32_t eprosima_fastdds_statistics_detail_SequenceNumber_s_max_cdr_typesize {8UL}; +constexpr uint32_t eprosima_fastdds_statistics_detail_SequenceNumber_s_max_cdr_typesize {12UL}; constexpr uint32_t eprosima_fastdds_statistics_detail_SequenceNumber_s_max_key_cdr_typesize {0UL}; @@ -75,87 +74,58 @@ namespace fastcdr { class Cdr; class CdrSizeCalculator; - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::detail::EntityId_s& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::detail::GuidPrefix_s& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::detail::GUID_s& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::detail::SequenceNumber_s& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::detail::SampleIdentity_s& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::detail::Locator_s& data); - - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::DiscoveryTime& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::EntityCount& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::SampleIdentityCount& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::Entity2LocatorTraffic& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::WriterReaderData& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::Locator2LocatorData& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::EntityData& data); - - eProsima_user_DllExport void serialize_key( eprosima::fastcdr::Cdr& scdr, const eprosima::fastdds::statistics::PhysicalData& data); @@ -163,14 +133,8 @@ eProsima_user_DllExport void serialize_key( - - - - - - } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_HPP_ +#endif // FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_HPP diff --git a/include/fastdds_statistics_backend/topic_types/typesCdrAux.ipp b/include/fastdds_statistics_backend/topic_types/typesCdrAux.ipp index 06f185b0a..1a6336bda 100644 --- a/include/fastdds_statistics_backend/topic_types/typesCdrAux.ipp +++ b/include/fastdds_statistics_backend/topic_types/typesCdrAux.ipp @@ -19,8 +19,8 @@ * This file was generated by the tool fastddsgen. */ -#ifndef _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_IPP_ -#define _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_IPP_ +#ifndef FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_IPP +#define FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_IPP #include "typesCdrAux.hpp" @@ -34,8 +34,6 @@ using namespace eprosima::fastcdr::exception; namespace eprosima { namespace fastcdr { - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -49,7 +47,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -73,7 +71,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -90,7 +88,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics::detail; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -117,9 +115,9 @@ void serialize_key( static_cast(scdr); static_cast(data); -} - + scdr << data.value(); +} template<> @@ -135,7 +133,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -159,7 +157,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -176,7 +174,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics::detail; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -203,9 +201,9 @@ void serialize_key( static_cast(scdr); static_cast(data); -} - + scdr << data.value(); +} template<> @@ -221,7 +219,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -248,7 +246,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -266,7 +264,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics::detail; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -294,12 +292,22 @@ void serialize_key( const eprosima::fastdds::statistics::detail::GUID_s& data) { using namespace eprosima::fastdds::statistics::detail; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GuidPrefix_s& data); + + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::EntityId_s& data); + static_cast(scdr); static_cast(data); -} + serialize_key(scdr, data.guidPrefix()); + serialize_key(scdr, data.entityId()); +} template<> @@ -315,7 +323,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -342,7 +350,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -360,7 +368,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics::detail; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -391,9 +399,11 @@ void serialize_key( static_cast(scdr); static_cast(data); -} + scdr << data.high(); + scdr << data.low(); +} template<> @@ -409,7 +419,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -436,7 +446,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -454,7 +464,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics::detail; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -482,12 +492,22 @@ void serialize_key( const eprosima::fastdds::statistics::detail::SampleIdentity_s& data) { using namespace eprosima::fastdds::statistics::detail; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GUID_s& data); + + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::SequenceNumber_s& data); + static_cast(scdr); static_cast(data); -} + serialize_key(scdr, data.writer_guid()); + serialize_key(scdr, data.sequence_number()); +} template<> @@ -503,7 +523,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -533,7 +553,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -552,7 +572,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics::detail; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -587,10 +607,13 @@ void serialize_key( static_cast(scdr); static_cast(data); -} + scdr << data.kind(); + scdr << data.port(); + scdr << data.address(); +} template<> @@ -606,7 +629,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -645,7 +668,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -667,7 +690,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -711,12 +734,24 @@ void serialize_key( const eprosima::fastdds::statistics::DiscoveryTime& data) { using namespace eprosima::fastdds::statistics; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GUID_s& data); + + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GUID_s& data); + + + + + static_cast(scdr); static_cast(data); - scdr << data.local_participant_guid(); + serialize_key(scdr, data.local_participant_guid()); - scdr << data.remote_entity_guid(); + serialize_key(scdr, data.remote_entity_guid()); @@ -725,8 +760,6 @@ void serialize_key( } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -740,7 +773,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -767,7 +800,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -785,7 +818,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -813,17 +846,20 @@ void serialize_key( const eprosima::fastdds::statistics::EntityCount& data) { using namespace eprosima::fastdds::statistics; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GUID_s& data); + + static_cast(scdr); static_cast(data); - scdr << data.guid(); + serialize_key(scdr, data.guid()); } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -837,7 +873,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -864,7 +900,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -882,7 +918,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -910,17 +946,20 @@ void serialize_key( const eprosima::fastdds::statistics::SampleIdentityCount& data) { using namespace eprosima::fastdds::statistics; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::SampleIdentity_s& data); + + static_cast(scdr); static_cast(data); - scdr << data.sample_id(); + serialize_key(scdr, data.sample_id()); } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -934,7 +973,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -970,7 +1009,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -991,7 +1030,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -1031,12 +1070,23 @@ void serialize_key( const eprosima::fastdds::statistics::Entity2LocatorTraffic& data) { using namespace eprosima::fastdds::statistics; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GUID_s& data); + + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::Locator_s& data); + + + + static_cast(scdr); static_cast(data); - scdr << data.src_guid(); + serialize_key(scdr, data.src_guid()); - scdr << data.dst_locator(); + serialize_key(scdr, data.dst_locator()); @@ -1044,8 +1094,6 @@ void serialize_key( } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -1059,7 +1107,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -1089,7 +1137,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -1108,7 +1156,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -1140,19 +1188,26 @@ void serialize_key( const eprosima::fastdds::statistics::WriterReaderData& data) { using namespace eprosima::fastdds::statistics; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GUID_s& data); + + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GUID_s& data); + + static_cast(scdr); static_cast(data); - scdr << data.writer_guid(); + serialize_key(scdr, data.writer_guid()); - scdr << data.reader_guid(); + serialize_key(scdr, data.reader_guid()); } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -1166,7 +1221,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -1196,7 +1251,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -1215,7 +1270,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -1247,19 +1302,26 @@ void serialize_key( const eprosima::fastdds::statistics::Locator2LocatorData& data) { using namespace eprosima::fastdds::statistics; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::Locator_s& data); + + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::Locator_s& data); + + static_cast(scdr); static_cast(data); - scdr << data.src_locator(); + serialize_key(scdr, data.src_locator()); - scdr << data.dst_locator(); + serialize_key(scdr, data.dst_locator()); } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -1273,7 +1335,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -1300,7 +1362,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -1318,7 +1380,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -1346,17 +1408,20 @@ void serialize_key( const eprosima::fastdds::statistics::EntityData& data) { using namespace eprosima::fastdds::statistics; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GUID_s& data); + + static_cast(scdr); static_cast(data); - scdr << data.guid(); + serialize_key(scdr, data.guid()); } - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -1370,7 +1435,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -1403,7 +1468,7 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr @@ -1423,7 +1488,7 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { @@ -1459,10 +1524,17 @@ void serialize_key( const eprosima::fastdds::statistics::PhysicalData& data) { using namespace eprosima::fastdds::statistics; + extern void serialize_key( + Cdr& scdr, + const eprosima::fastdds::statistics::detail::GUID_s& data); + + + + static_cast(scdr); static_cast(data); - scdr << data.participant_guid(); + serialize_key(scdr, data.participant_guid()); @@ -1471,8 +1543,6 @@ void serialize_key( - - template<> eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::CdrSizeCalculator& calculator, @@ -1486,7 +1556,7 @@ eProsima_user_DllExport size_t calculate_serialized_size( eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); size_t calculated_size {calculator.begin_calculate_type_serialized_size( eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, current_alignment)}; @@ -1495,51 +1565,51 @@ eProsima_user_DllExport size_t calculate_serialized_size( switch (data._d()) { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: + case EventKind::HISTORY2HISTORY_LATENCY: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), data.writer_reader_data(), current_alignment); break; - case eprosima::fastdds::statistics::NETWORK_LATENCY: + case EventKind::NETWORK_LATENCY: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(2), data.locator2locator_data(), current_alignment); break; - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: + case EventKind::PUBLICATION_THROUGHPUT: + case EventKind::SUBSCRIPTION_THROUGHPUT: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(3), data.entity_data(), current_alignment); break; - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: + case EventKind::RTPS_SENT: + case EventKind::RTPS_LOST: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(4), data.entity2locator_traffic(), current_alignment); break; - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: + case EventKind::RESENT_DATAS: + case EventKind::HEARTBEAT_COUNT: + case EventKind::ACKNACK_COUNT: + case EventKind::NACKFRAG_COUNT: + case EventKind::GAP_COUNT: + case EventKind::DATA_COUNT: + case EventKind::PDP_PACKETS: + case EventKind::EDP_PACKETS: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(5), data.entity_count(), current_alignment); break; - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: + case EventKind::DISCOVERED_ENTITY: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(6), data.discovery_time(), current_alignment); break; - case eprosima::fastdds::statistics::SAMPLE_DATAS: + case EventKind::SAMPLE_DATAS: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(7), data.sample_identity_count(), current_alignment); break; - case eprosima::fastdds::statistics::PHYSICAL_DATA: + case EventKind::PHYSICAL_DATA: calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(8), data.physical_data(), current_alignment); break; @@ -1564,51 +1634,51 @@ eProsima_user_DllExport void serialize( eprosima::fastcdr::Cdr::state current_state(scdr); scdr.begin_serialize_type(current_state, eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); scdr << eprosima::fastcdr::MemberId(0) << data._d(); switch (data._d()) { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: + case EventKind::HISTORY2HISTORY_LATENCY: scdr << eprosima::fastcdr::MemberId(1) << data.writer_reader_data(); break; - case eprosima::fastdds::statistics::NETWORK_LATENCY: + case EventKind::NETWORK_LATENCY: scdr << eprosima::fastcdr::MemberId(2) << data.locator2locator_data(); break; - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: + case EventKind::PUBLICATION_THROUGHPUT: + case EventKind::SUBSCRIPTION_THROUGHPUT: scdr << eprosima::fastcdr::MemberId(3) << data.entity_data(); break; - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: + case EventKind::RTPS_SENT: + case EventKind::RTPS_LOST: scdr << eprosima::fastcdr::MemberId(4) << data.entity2locator_traffic(); break; - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: + case EventKind::RESENT_DATAS: + case EventKind::HEARTBEAT_COUNT: + case EventKind::ACKNACK_COUNT: + case EventKind::NACKFRAG_COUNT: + case EventKind::GAP_COUNT: + case EventKind::DATA_COUNT: + case EventKind::PDP_PACKETS: + case EventKind::EDP_PACKETS: scdr << eprosima::fastcdr::MemberId(5) << data.entity_count(); break; - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: + case EventKind::DISCOVERED_ENTITY: scdr << eprosima::fastcdr::MemberId(6) << data.discovery_time(); break; - case eprosima::fastdds::statistics::SAMPLE_DATAS: + case EventKind::SAMPLE_DATAS: scdr << eprosima::fastcdr::MemberId(7) << data.sample_identity_count(); break; - case eprosima::fastdds::statistics::PHYSICAL_DATA: + case EventKind::PHYSICAL_DATA: scdr << eprosima::fastcdr::MemberId(8) << data.physical_data(); break; @@ -1627,76 +1697,153 @@ eProsima_user_DllExport void deserialize( using namespace eprosima::fastdds::statistics; cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool { bool ret_value = true; - switch (mid.id) + if (0 == mid.id) { - case 0: - dcdr >> data._d(); - break; - default: - switch (data._d()) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - dcdr >> data.writer_reader_data(); - break; - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - dcdr >> data.locator2locator_data(); - break; - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - dcdr >> data.entity_data(); - break; - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - dcdr >> data.entity2locator_traffic(); - break; - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - dcdr >> data.entity_count(); - break; - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - dcdr >> data.discovery_time(); - break; - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - dcdr >> data.sample_identity_count(); - break; - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - dcdr >> data.physical_data(); - break; - - default: - break; - } - ret_value = false; - break; + uint32_t discriminator; + dcdr >> discriminator; + + switch (discriminator) + { + case EventKind::HISTORY2HISTORY_LATENCY: + { + eprosima::fastdds::statistics::WriterReaderData writer_reader_data_value; + data.writer_reader_data(std::move(writer_reader_data_value)); + data._d(discriminator); + break; + } + + case EventKind::NETWORK_LATENCY: + { + eprosima::fastdds::statistics::Locator2LocatorData locator2locator_data_value; + data.locator2locator_data(std::move(locator2locator_data_value)); + data._d(discriminator); + break; + } + + case EventKind::PUBLICATION_THROUGHPUT: + case EventKind::SUBSCRIPTION_THROUGHPUT: + { + eprosima::fastdds::statistics::EntityData entity_data_value; + data.entity_data(std::move(entity_data_value)); + data._d(discriminator); + break; + } + + case EventKind::RTPS_SENT: + case EventKind::RTPS_LOST: + { + eprosima::fastdds::statistics::Entity2LocatorTraffic entity2locator_traffic_value; + data.entity2locator_traffic(std::move(entity2locator_traffic_value)); + data._d(discriminator); + break; + } + + case EventKind::RESENT_DATAS: + case EventKind::HEARTBEAT_COUNT: + case EventKind::ACKNACK_COUNT: + case EventKind::NACKFRAG_COUNT: + case EventKind::GAP_COUNT: + case EventKind::DATA_COUNT: + case EventKind::PDP_PACKETS: + case EventKind::EDP_PACKETS: + { + eprosima::fastdds::statistics::EntityCount entity_count_value; + data.entity_count(std::move(entity_count_value)); + data._d(discriminator); + break; + } + + case EventKind::DISCOVERED_ENTITY: + { + eprosima::fastdds::statistics::DiscoveryTime discovery_time_value; + data.discovery_time(std::move(discovery_time_value)); + data._d(discriminator); + break; + } + + case EventKind::SAMPLE_DATAS: + { + eprosima::fastdds::statistics::SampleIdentityCount sample_identity_count_value; + data.sample_identity_count(std::move(sample_identity_count_value)); + data._d(discriminator); + break; + } + + case EventKind::PHYSICAL_DATA: + { + eprosima::fastdds::statistics::PhysicalData physical_data_value; + data.physical_data(std::move(physical_data_value)); + data._d(discriminator); + break; + } + + default: + data._default(); + break; + } + } + else + { + switch (data._d()) + { + case EventKind::HISTORY2HISTORY_LATENCY: + dcdr >> data.writer_reader_data(); + break; + + case EventKind::NETWORK_LATENCY: + dcdr >> data.locator2locator_data(); + break; + + case EventKind::PUBLICATION_THROUGHPUT: + case EventKind::SUBSCRIPTION_THROUGHPUT: + dcdr >> data.entity_data(); + break; + + case EventKind::RTPS_SENT: + case EventKind::RTPS_LOST: + dcdr >> data.entity2locator_traffic(); + break; + + case EventKind::RESENT_DATAS: + case EventKind::HEARTBEAT_COUNT: + case EventKind::ACKNACK_COUNT: + case EventKind::NACKFRAG_COUNT: + case EventKind::GAP_COUNT: + case EventKind::DATA_COUNT: + case EventKind::PDP_PACKETS: + case EventKind::EDP_PACKETS: + dcdr >> data.entity_count(); + break; + + case EventKind::DISCOVERED_ENTITY: + dcdr >> data.discovery_time(); + break; + + case EventKind::SAMPLE_DATAS: + dcdr >> data.sample_identity_count(); + break; + + case EventKind::PHYSICAL_DATA: + dcdr >> data.physical_data(); + break; + + default: + break; + } + ret_value = false; } return ret_value; }); } - - - } // namespace fastcdr } // namespace eprosima -#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_IPP_ +#endif // FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPESCDRAUX_IPP diff --git a/include/fastdds_statistics_backend/topic_types/typesPubSubTypes.cxx b/include/fastdds_statistics_backend/topic_types/typesPubSubTypes.cxx index c902c1688..0a285a735 100644 --- a/include/fastdds_statistics_backend/topic_types/typesPubSubTypes.cxx +++ b/include/fastdds_statistics_backend/topic_types/typesPubSubTypes.cxx @@ -19,67 +19,60 @@ * This file was generated by the tool fastddsgen. */ +#include "typesPubSubTypes.hpp" +#include #include -#include "typesPubSubTypes.h" #include "typesCdrAux.hpp" +#include "typesTypeObjectSupport.hpp" -using SerializedPayload_t = eprosima::fastrtps::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastrtps::rtps::InstanceHandle_t; +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; namespace eprosima { namespace fastdds { namespace statistics { namespace detail { - - EntityId_sPubSubType::EntityId_sPubSubType() { - setName("eprosima::fastdds::statistics::detail::EntityId_s"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(EntityId_s::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_detail_EntityId_s_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::detail::EntityId_s"); + uint32_t type_size = eprosima_fastdds_statistics_detail_EntityId_s_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_detail_EntityId_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_EntityId_s_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_detail_EntityId_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_EntityId_s_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } EntityId_sPubSubType::~EntityId_sPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool EntityId_sPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - EntityId_s* p_type = static_cast(data); + const EntityId_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -94,16 +87,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool EntityId_sPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -112,18 +101,14 @@ namespace eprosima { EntityId_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -136,140 +121,139 @@ namespace eprosima { return true; } - std::function EntityId_sPubSubType::getSerializedSizeProvider( - void* data, + uint32_t EntityId_sPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* EntityId_sPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* EntityId_sPubSubType::create_data() { return reinterpret_cast(new EntityId_s()); } - void EntityId_sPubSubType::deleteData( + void EntityId_sPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool EntityId_sPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool EntityId_sPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + EntityId_s data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool EntityId_sPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - EntityId_s* p_type = static_cast(data); + const EntityId_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_detail_EntityId_s_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_detail_EntityId_s_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void EntityId_sPubSubType::register_type_object_representation() + { + register_EntityId_s_type_identifier(type_identifiers_); + } GuidPrefix_sPubSubType::GuidPrefix_sPubSubType() { - setName("eprosima::fastdds::statistics::detail::GuidPrefix_s"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(GuidPrefix_s::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_detail_GuidPrefix_s_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::detail::GuidPrefix_s"); + uint32_t type_size = eprosima_fastdds_statistics_detail_GuidPrefix_s_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_detail_GuidPrefix_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_GuidPrefix_s_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_detail_GuidPrefix_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_GuidPrefix_s_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } GuidPrefix_sPubSubType::~GuidPrefix_sPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool GuidPrefix_sPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - GuidPrefix_s* p_type = static_cast(data); + const GuidPrefix_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -284,16 +268,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool GuidPrefix_sPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -302,18 +282,14 @@ namespace eprosima { GuidPrefix_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -326,140 +302,139 @@ namespace eprosima { return true; } - std::function GuidPrefix_sPubSubType::getSerializedSizeProvider( - void* data, + uint32_t GuidPrefix_sPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* GuidPrefix_sPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* GuidPrefix_sPubSubType::create_data() { return reinterpret_cast(new GuidPrefix_s()); } - void GuidPrefix_sPubSubType::deleteData( + void GuidPrefix_sPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool GuidPrefix_sPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool GuidPrefix_sPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + GuidPrefix_s data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool GuidPrefix_sPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - GuidPrefix_s* p_type = static_cast(data); + const GuidPrefix_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_detail_GuidPrefix_s_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_detail_GuidPrefix_s_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void GuidPrefix_sPubSubType::register_type_object_representation() + { + register_GuidPrefix_s_type_identifier(type_identifiers_); + } GUID_sPubSubType::GUID_sPubSubType() { - setName("eprosima::fastdds::statistics::detail::GUID_s"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(GUID_s::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_detail_GUID_s_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::detail::GUID_s"); + uint32_t type_size = eprosima_fastdds_statistics_detail_GUID_s_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_detail_GUID_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_GUID_s_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_detail_GUID_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_GUID_s_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } GUID_sPubSubType::~GUID_sPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool GUID_sPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - GUID_s* p_type = static_cast(data); + const GUID_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -474,16 +449,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool GUID_sPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -492,18 +463,14 @@ namespace eprosima { GUID_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -516,140 +483,139 @@ namespace eprosima { return true; } - std::function GUID_sPubSubType::getSerializedSizeProvider( - void* data, + uint32_t GUID_sPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* GUID_sPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* GUID_sPubSubType::create_data() { return reinterpret_cast(new GUID_s()); } - void GUID_sPubSubType::deleteData( + void GUID_sPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool GUID_sPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool GUID_sPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + GUID_s data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool GUID_sPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - GUID_s* p_type = static_cast(data); + const GUID_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_detail_GUID_s_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_detail_GUID_s_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void GUID_sPubSubType::register_type_object_representation() + { + register_GUID_s_type_identifier(type_identifiers_); + } SequenceNumber_sPubSubType::SequenceNumber_sPubSubType() { - setName("eprosima::fastdds::statistics::detail::SequenceNumber_s"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(SequenceNumber_s::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_detail_SequenceNumber_s_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::detail::SequenceNumber_s"); + uint32_t type_size = eprosima_fastdds_statistics_detail_SequenceNumber_s_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_detail_SequenceNumber_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_SequenceNumber_s_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_detail_SequenceNumber_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_SequenceNumber_s_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } SequenceNumber_sPubSubType::~SequenceNumber_sPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool SequenceNumber_sPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - SequenceNumber_s* p_type = static_cast(data); + const SequenceNumber_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -664,16 +630,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool SequenceNumber_sPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -682,18 +644,14 @@ namespace eprosima { SequenceNumber_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -706,140 +664,139 @@ namespace eprosima { return true; } - std::function SequenceNumber_sPubSubType::getSerializedSizeProvider( - void* data, + uint32_t SequenceNumber_sPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* SequenceNumber_sPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* SequenceNumber_sPubSubType::create_data() { return reinterpret_cast(new SequenceNumber_s()); } - void SequenceNumber_sPubSubType::deleteData( + void SequenceNumber_sPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool SequenceNumber_sPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool SequenceNumber_sPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - SequenceNumber_s* p_type = static_cast(data); + SequenceNumber_s data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool SequenceNumber_sPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + const SequenceNumber_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_detail_SequenceNumber_s_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_detail_SequenceNumber_s_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void SequenceNumber_sPubSubType::register_type_object_representation() + { + register_SequenceNumber_s_type_identifier(type_identifiers_); + } SampleIdentity_sPubSubType::SampleIdentity_sPubSubType() { - setName("eprosima::fastdds::statistics::detail::SampleIdentity_s"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(SampleIdentity_s::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_detail_SampleIdentity_s_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::detail::SampleIdentity_s"); + uint32_t type_size = eprosima_fastdds_statistics_detail_SampleIdentity_s_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_detail_SampleIdentity_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_SampleIdentity_s_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_detail_SampleIdentity_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_SampleIdentity_s_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } SampleIdentity_sPubSubType::~SampleIdentity_sPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool SampleIdentity_sPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - SampleIdentity_s* p_type = static_cast(data); + const SampleIdentity_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -854,16 +811,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool SampleIdentity_sPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -872,18 +825,14 @@ namespace eprosima { SampleIdentity_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -896,140 +845,139 @@ namespace eprosima { return true; } - std::function SampleIdentity_sPubSubType::getSerializedSizeProvider( - void* data, + uint32_t SampleIdentity_sPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* SampleIdentity_sPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* SampleIdentity_sPubSubType::create_data() { return reinterpret_cast(new SampleIdentity_s()); } - void SampleIdentity_sPubSubType::deleteData( + void SampleIdentity_sPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool SampleIdentity_sPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool SampleIdentity_sPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - SampleIdentity_s* p_type = static_cast(data); + SampleIdentity_s data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool SampleIdentity_sPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + const SampleIdentity_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_detail_SampleIdentity_s_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_detail_SampleIdentity_s_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void SampleIdentity_sPubSubType::register_type_object_representation() + { + register_SampleIdentity_s_type_identifier(type_identifiers_); + } Locator_sPubSubType::Locator_sPubSubType() { - setName("eprosima::fastdds::statistics::detail::Locator_s"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(Locator_s::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_detail_Locator_s_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::detail::Locator_s"); + uint32_t type_size = eprosima_fastdds_statistics_detail_Locator_s_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = false; - uint32_t keyLength = eprosima_fastdds_statistics_detail_Locator_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_Locator_s_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = eprosima_fastdds_statistics_detail_Locator_s_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_detail_Locator_s_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } Locator_sPubSubType::~Locator_sPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool Locator_sPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - Locator_s* p_type = static_cast(data); + const Locator_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -1044,16 +992,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool Locator_sPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -1062,18 +1006,14 @@ namespace eprosima { Locator_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -1086,143 +1026,141 @@ namespace eprosima { return true; } - std::function Locator_sPubSubType::getSerializedSizeProvider( - void* data, + uint32_t Locator_sPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* Locator_sPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* Locator_sPubSubType::create_data() { return reinterpret_cast(new Locator_s()); } - void Locator_sPubSubType::deleteData( + void Locator_sPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool Locator_sPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool Locator_sPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - Locator_s* p_type = static_cast(data); + Locator_s data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool Locator_sPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + const Locator_s* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_detail_Locator_s_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_detail_Locator_s_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } + void Locator_sPubSubType::register_type_object_representation() + { + register_Locator_s_type_identifier(type_identifiers_); + } - } //End of namespace detail - - + } // namespace detail DiscoveryTimePubSubType::DiscoveryTimePubSubType() { - setName("eprosima::fastdds::statistics::DiscoveryTime"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(DiscoveryTime::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_DiscoveryTime_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::DiscoveryTime"); + uint32_t type_size = eprosima_fastdds_statistics_DiscoveryTime_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = true; - uint32_t keyLength = eprosima_fastdds_statistics_DiscoveryTime_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_DiscoveryTime_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = true; + uint32_t key_length = eprosima_fastdds_statistics_DiscoveryTime_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_DiscoveryTime_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } DiscoveryTimePubSubType::~DiscoveryTimePubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool DiscoveryTimePubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - DiscoveryTime* p_type = static_cast(data); + const DiscoveryTime* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -1237,16 +1175,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool DiscoveryTimePubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -1255,18 +1189,14 @@ namespace eprosima { DiscoveryTime* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -1279,140 +1209,139 @@ namespace eprosima { return true; } - std::function DiscoveryTimePubSubType::getSerializedSizeProvider( - void* data, + uint32_t DiscoveryTimePubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* DiscoveryTimePubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* DiscoveryTimePubSubType::create_data() { return reinterpret_cast(new DiscoveryTime()); } - void DiscoveryTimePubSubType::deleteData( + void DiscoveryTimePubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool DiscoveryTimePubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool DiscoveryTimePubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + DiscoveryTime data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool DiscoveryTimePubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - DiscoveryTime* p_type = static_cast(data); + const DiscoveryTime* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_DiscoveryTime_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_DiscoveryTime_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void DiscoveryTimePubSubType::register_type_object_representation() + { + register_DiscoveryTime_type_identifier(type_identifiers_); + } EntityCountPubSubType::EntityCountPubSubType() { - setName("eprosima::fastdds::statistics::EntityCount"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(EntityCount::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_EntityCount_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::EntityCount"); + uint32_t type_size = eprosima_fastdds_statistics_EntityCount_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = true; - uint32_t keyLength = eprosima_fastdds_statistics_EntityCount_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_EntityCount_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = true; + uint32_t key_length = eprosima_fastdds_statistics_EntityCount_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_EntityCount_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } EntityCountPubSubType::~EntityCountPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool EntityCountPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - EntityCount* p_type = static_cast(data); + const EntityCount* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -1427,16 +1356,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool EntityCountPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -1445,18 +1370,14 @@ namespace eprosima { EntityCount* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -1469,140 +1390,139 @@ namespace eprosima { return true; } - std::function EntityCountPubSubType::getSerializedSizeProvider( - void* data, + uint32_t EntityCountPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* EntityCountPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* EntityCountPubSubType::create_data() { return reinterpret_cast(new EntityCount()); } - void EntityCountPubSubType::deleteData( + void EntityCountPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool EntityCountPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool EntityCountPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + EntityCount data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool EntityCountPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - EntityCount* p_type = static_cast(data); + const EntityCount* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_EntityCount_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_EntityCount_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void EntityCountPubSubType::register_type_object_representation() + { + register_EntityCount_type_identifier(type_identifiers_); + } SampleIdentityCountPubSubType::SampleIdentityCountPubSubType() { - setName("eprosima::fastdds::statistics::SampleIdentityCount"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(SampleIdentityCount::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_SampleIdentityCount_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::SampleIdentityCount"); + uint32_t type_size = eprosima_fastdds_statistics_SampleIdentityCount_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = true; - uint32_t keyLength = eprosima_fastdds_statistics_SampleIdentityCount_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_SampleIdentityCount_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = true; + uint32_t key_length = eprosima_fastdds_statistics_SampleIdentityCount_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_SampleIdentityCount_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } SampleIdentityCountPubSubType::~SampleIdentityCountPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool SampleIdentityCountPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - SampleIdentityCount* p_type = static_cast(data); + const SampleIdentityCount* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -1617,16 +1537,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool SampleIdentityCountPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -1635,18 +1551,14 @@ namespace eprosima { SampleIdentityCount* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -1659,140 +1571,139 @@ namespace eprosima { return true; } - std::function SampleIdentityCountPubSubType::getSerializedSizeProvider( - void* data, + uint32_t SampleIdentityCountPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* SampleIdentityCountPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* SampleIdentityCountPubSubType::create_data() { return reinterpret_cast(new SampleIdentityCount()); } - void SampleIdentityCountPubSubType::deleteData( + void SampleIdentityCountPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool SampleIdentityCountPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool SampleIdentityCountPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + SampleIdentityCount data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool SampleIdentityCountPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - SampleIdentityCount* p_type = static_cast(data); + const SampleIdentityCount* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_SampleIdentityCount_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_SampleIdentityCount_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void SampleIdentityCountPubSubType::register_type_object_representation() + { + register_SampleIdentityCount_type_identifier(type_identifiers_); + } Entity2LocatorTrafficPubSubType::Entity2LocatorTrafficPubSubType() { - setName("eprosima::fastdds::statistics::Entity2LocatorTraffic"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(Entity2LocatorTraffic::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_Entity2LocatorTraffic_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::Entity2LocatorTraffic"); + uint32_t type_size = eprosima_fastdds_statistics_Entity2LocatorTraffic_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = true; - uint32_t keyLength = eprosima_fastdds_statistics_Entity2LocatorTraffic_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_Entity2LocatorTraffic_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = true; + uint32_t key_length = eprosima_fastdds_statistics_Entity2LocatorTraffic_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_Entity2LocatorTraffic_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } Entity2LocatorTrafficPubSubType::~Entity2LocatorTrafficPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool Entity2LocatorTrafficPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - Entity2LocatorTraffic* p_type = static_cast(data); + const Entity2LocatorTraffic* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -1807,16 +1718,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool Entity2LocatorTrafficPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -1825,18 +1732,14 @@ namespace eprosima { Entity2LocatorTraffic* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -1849,140 +1752,139 @@ namespace eprosima { return true; } - std::function Entity2LocatorTrafficPubSubType::getSerializedSizeProvider( - void* data, + uint32_t Entity2LocatorTrafficPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* Entity2LocatorTrafficPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* Entity2LocatorTrafficPubSubType::create_data() { return reinterpret_cast(new Entity2LocatorTraffic()); } - void Entity2LocatorTrafficPubSubType::deleteData( + void Entity2LocatorTrafficPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool Entity2LocatorTrafficPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool Entity2LocatorTrafficPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + Entity2LocatorTraffic data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool Entity2LocatorTrafficPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - Entity2LocatorTraffic* p_type = static_cast(data); + const Entity2LocatorTraffic* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_Entity2LocatorTraffic_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_Entity2LocatorTraffic_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void Entity2LocatorTrafficPubSubType::register_type_object_representation() + { + register_Entity2LocatorTraffic_type_identifier(type_identifiers_); + } WriterReaderDataPubSubType::WriterReaderDataPubSubType() { - setName("eprosima::fastdds::statistics::WriterReaderData"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(WriterReaderData::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_WriterReaderData_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::WriterReaderData"); + uint32_t type_size = eprosima_fastdds_statistics_WriterReaderData_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = true; - uint32_t keyLength = eprosima_fastdds_statistics_WriterReaderData_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_WriterReaderData_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = true; + uint32_t key_length = eprosima_fastdds_statistics_WriterReaderData_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_WriterReaderData_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } WriterReaderDataPubSubType::~WriterReaderDataPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool WriterReaderDataPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - WriterReaderData* p_type = static_cast(data); + const WriterReaderData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -1997,16 +1899,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool WriterReaderDataPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -2015,18 +1913,14 @@ namespace eprosima { WriterReaderData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -2039,140 +1933,139 @@ namespace eprosima { return true; } - std::function WriterReaderDataPubSubType::getSerializedSizeProvider( - void* data, + uint32_t WriterReaderDataPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* WriterReaderDataPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* WriterReaderDataPubSubType::create_data() { return reinterpret_cast(new WriterReaderData()); } - void WriterReaderDataPubSubType::deleteData( + void WriterReaderDataPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool WriterReaderDataPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool WriterReaderDataPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - WriterReaderData* p_type = static_cast(data); + WriterReaderData data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool WriterReaderDataPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + const WriterReaderData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_WriterReaderData_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_WriterReaderData_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void WriterReaderDataPubSubType::register_type_object_representation() + { + register_WriterReaderData_type_identifier(type_identifiers_); + } Locator2LocatorDataPubSubType::Locator2LocatorDataPubSubType() { - setName("eprosima::fastdds::statistics::Locator2LocatorData"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(Locator2LocatorData::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_Locator2LocatorData_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::Locator2LocatorData"); + uint32_t type_size = eprosima_fastdds_statistics_Locator2LocatorData_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = true; - uint32_t keyLength = eprosima_fastdds_statistics_Locator2LocatorData_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_Locator2LocatorData_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = true; + uint32_t key_length = eprosima_fastdds_statistics_Locator2LocatorData_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_Locator2LocatorData_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } Locator2LocatorDataPubSubType::~Locator2LocatorDataPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool Locator2LocatorDataPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - Locator2LocatorData* p_type = static_cast(data); + const Locator2LocatorData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -2187,16 +2080,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool Locator2LocatorDataPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -2205,18 +2094,14 @@ namespace eprosima { Locator2LocatorData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -2229,140 +2114,139 @@ namespace eprosima { return true; } - std::function Locator2LocatorDataPubSubType::getSerializedSizeProvider( - void* data, + uint32_t Locator2LocatorDataPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* Locator2LocatorDataPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* Locator2LocatorDataPubSubType::create_data() { return reinterpret_cast(new Locator2LocatorData()); } - void Locator2LocatorDataPubSubType::deleteData( + void Locator2LocatorDataPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool Locator2LocatorDataPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool Locator2LocatorDataPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + Locator2LocatorData data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool Locator2LocatorDataPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - Locator2LocatorData* p_type = static_cast(data); + const Locator2LocatorData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_Locator2LocatorData_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_Locator2LocatorData_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void Locator2LocatorDataPubSubType::register_type_object_representation() + { + register_Locator2LocatorData_type_identifier(type_identifiers_); + } EntityDataPubSubType::EntityDataPubSubType() { - setName("eprosima::fastdds::statistics::EntityData"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(EntityData::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_EntityData_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::EntityData"); + uint32_t type_size = eprosima_fastdds_statistics_EntityData_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = true; - uint32_t keyLength = eprosima_fastdds_statistics_EntityData_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_EntityData_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = true; + uint32_t key_length = eprosima_fastdds_statistics_EntityData_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_EntityData_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } EntityDataPubSubType::~EntityDataPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool EntityDataPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - EntityData* p_type = static_cast(data); + const EntityData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -2377,16 +2261,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool EntityDataPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -2395,18 +2275,14 @@ namespace eprosima { EntityData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -2419,140 +2295,139 @@ namespace eprosima { return true; } - std::function EntityDataPubSubType::getSerializedSizeProvider( - void* data, + uint32_t EntityDataPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* EntityDataPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* EntityDataPubSubType::create_data() { return reinterpret_cast(new EntityData()); } - void EntityDataPubSubType::deleteData( + void EntityDataPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool EntityDataPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool EntityDataPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - EntityData* p_type = static_cast(data); + EntityData data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool EntityDataPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + const EntityData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_EntityData_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_EntityData_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } - + void EntityDataPubSubType::register_type_object_representation() + { + register_EntityData_type_identifier(type_identifiers_); + } PhysicalDataPubSubType::PhysicalDataPubSubType() { - setName("eprosima::fastdds::statistics::PhysicalData"); - uint32_t type_size = - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(PhysicalData::getMaxCdrSerializedSize()); - #else - eprosima_fastdds_statistics_PhysicalData_max_cdr_typesize; - #endif + set_name("eprosima::fastdds::statistics::PhysicalData"); + uint32_t type_size = eprosima_fastdds_statistics_PhysicalData_max_cdr_typesize; type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - m_typeSize = type_size + 4; /*encapsulation*/ - m_isGetKeyDefined = true; - uint32_t keyLength = eprosima_fastdds_statistics_PhysicalData_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_PhysicalData_max_key_cdr_typesize : 16; - m_keyBuffer = reinterpret_cast(malloc(keyLength)); - memset(m_keyBuffer, 0, keyLength); + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = true; + uint32_t key_length = eprosima_fastdds_statistics_PhysicalData_max_key_cdr_typesize > 16 ? eprosima_fastdds_statistics_PhysicalData_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); } PhysicalDataPubSubType::~PhysicalDataPubSubType() { - if (m_keyBuffer != nullptr) + if (key_buffer_ != nullptr) { - free(m_keyBuffer); + free(key_buffer_); } } bool PhysicalDataPubSubType::serialize( - void* data, - SerializedPayload_t* payload, + const void* const data, + SerializedPayload_t& payload, DataRepresentationId_t data_representation) { - PhysicalData* p_type = static_cast(data); + const PhysicalData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->max_size); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); // Object that serializes the data. eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload->encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - #if FASTCDR_VERSION_MAJOR > 1 + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; ser.set_encoding_flag( data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); - #endif // FASTCDR_VERSION_MAJOR > 1 + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); try { @@ -2567,16 +2442,12 @@ namespace eprosima { } // Get the serialized length - #if FASTCDR_VERSION_MAJOR == 1 - payload->length = static_cast(ser.getSerializedDataLength()); - #else - payload->length = static_cast(ser.get_serialized_data_length()); - #endif // FASTCDR_VERSION_MAJOR == 1 + payload.length = static_cast(ser.get_serialized_data_length()); return true; } bool PhysicalDataPubSubType::deserialize( - SerializedPayload_t* payload, + SerializedPayload_t& payload, void* data) { try @@ -2585,18 +2456,14 @@ namespace eprosima { PhysicalData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload->data), payload->length); + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN - #if FASTCDR_VERSION_MAJOR == 1 - , eprosima::fastcdr::Cdr::CdrType::DDS_CDR - #endif // FASTCDR_VERSION_MAJOR == 1 - ); + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); // Deserialize encapsulation. deser.read_encapsulation(); - payload->encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; // Deserialize the object. deser >> *p_type; @@ -2609,104 +2476,111 @@ namespace eprosima { return true; } - std::function PhysicalDataPubSubType::getSerializedSizeProvider( - void* data, + uint32_t PhysicalDataPubSubType::calculate_serialized_size( + const void* const data, DataRepresentationId_t data_representation) { - return [data, data_representation]() -> uint32_t - { - #if FASTCDR_VERSION_MAJOR == 1 - static_cast(data_representation); - return static_cast(type::getCdrSerializedSize(*static_cast(data))) + - 4u /*encapsulation*/; - #else - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - #endif // FASTCDR_VERSION_MAJOR == 1 - }; - } - - void* PhysicalDataPubSubType::createData() + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } + } + + void* PhysicalDataPubSubType::create_data() { return reinterpret_cast(new PhysicalData()); } - void PhysicalDataPubSubType::deleteData( + void PhysicalDataPubSubType::delete_data( void* data) { delete(reinterpret_cast(data)); } - bool PhysicalDataPubSubType::getKey( - void* data, - InstanceHandle_t* handle, + bool PhysicalDataPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) + { + if (!is_compute_key_provided) + { + return false; + } + + PhysicalData data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; + } + + bool PhysicalDataPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, bool force_md5) { - if (!m_isGetKeyDefined) + if (!is_compute_key_provided) { return false; } - PhysicalData* p_type = static_cast(data); + const PhysicalData* p_type = static_cast(data); // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(m_keyBuffer), + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), eprosima_fastdds_statistics_PhysicalData_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); - #if FASTCDR_VERSION_MAJOR == 1 - p_type->serializeKey(ser); - #else + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); - #endif // FASTCDR_VERSION_MAJOR == 1 if (force_md5 || eprosima_fastdds_statistics_PhysicalData_max_key_cdr_typesize > 16) { - m_md5.init(); - #if FASTCDR_VERSION_MAJOR == 1 - m_md5.update(m_keyBuffer, static_cast(ser.getSerializedDataLength())); - #else - m_md5.update(m_keyBuffer, static_cast(ser.get_serialized_data_length())); - #endif // FASTCDR_VERSION_MAJOR == 1 - m_md5.finalize(); + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_md5.digest[i]; + handle.value[i] = md5_.digest[i]; } } else { for (uint8_t i = 0; i < 16; ++i) { - handle->value[i] = m_keyBuffer[i]; + handle.value[i] = key_buffer_[i]; } } return true; } + void PhysicalDataPubSubType::register_type_object_representation() + { + register_PhysicalData_type_identifier(type_identifiers_); + } + namespace EventKind { + } // namespace EventKind + } // namespace statistics + } // namespace fastdds +} // namespace eprosima - } //End of namespace statistics - - - } //End of namespace fastdds - - -} //End of namespace eprosima +// Include auxiliary functions like for serializing/deserializing. +#include "typesCdrAux.ipp" diff --git a/include/fastdds_statistics_backend/topic_types/typesPubSubTypes.h b/include/fastdds_statistics_backend/topic_types/typesPubSubTypes.h deleted file mode 100644 index 44afc80a5..000000000 --- a/include/fastdds_statistics_backend/topic_types/typesPubSubTypes.h +++ /dev/null @@ -1,1979 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file typesPubSubTypes.h - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen. - */ - - -#ifndef _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPES_PUBSUBTYPES_H_ -#define _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPES_PUBSUBTYPES_H_ - -#include -#include -#include -#include -#include - -#include "types.h" - - -#if !defined(GEN_API_VER) || (GEN_API_VER != 2) -#error \ - Generated types is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // GEN_API_VER - -namespace eprosima -{ - namespace fastdds - { - namespace statistics - { - namespace detail - { - - - - #ifndef SWIG - namespace detail { - - template - struct EntityId_s_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct EntityId_s_f - { - typedef std::array EntityId_s::* type; - friend constexpr type get( - EntityId_s_f); - }; - - template struct EntityId_s_rob; - - template - inline size_t constexpr EntityId_s_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type EntityId_s defined by the user in the IDL file. - * @ingroup types - */ - class EntityId_sPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef EntityId_s type; - - eProsima_user_DllExport EntityId_sPubSubType(); - - eProsima_user_DllExport ~EntityId_sPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) EntityId_s(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 4ULL == - (detail::EntityId_s_offset_of() + - sizeof(std::array)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 4ULL == - (detail::EntityId_s_offset_of() + - sizeof(std::array)); - } - - }; - - - - #ifndef SWIG - namespace detail { - - template - struct GuidPrefix_s_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct GuidPrefix_s_f - { - typedef std::array GuidPrefix_s::* type; - friend constexpr type get( - GuidPrefix_s_f); - }; - - template struct GuidPrefix_s_rob; - - template - inline size_t constexpr GuidPrefix_s_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type GuidPrefix_s defined by the user in the IDL file. - * @ingroup types - */ - class GuidPrefix_sPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef GuidPrefix_s type; - - eProsima_user_DllExport GuidPrefix_sPubSubType(); - - eProsima_user_DllExport ~GuidPrefix_sPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) GuidPrefix_s(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 12ULL == - (detail::GuidPrefix_s_offset_of() + - sizeof(std::array)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 12ULL == - (detail::GuidPrefix_s_offset_of() + - sizeof(std::array)); - } - - }; - - - - #ifndef SWIG - namespace detail { - - template - struct GUID_s_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct GUID_s_f - { - typedef eprosima::fastdds::statistics::detail::EntityId_s GUID_s::* type; - friend constexpr type get( - GUID_s_f); - }; - - template struct GUID_s_rob; - - template - inline size_t constexpr GUID_s_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type GUID_s defined by the user in the IDL file. - * @ingroup types - */ - class GUID_sPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef GUID_s type; - - eProsima_user_DllExport GUID_sPubSubType(); - - eProsima_user_DllExport ~GUID_sPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) GUID_s(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 16ULL == - (detail::GUID_s_offset_of() + - sizeof(eprosima::fastdds::statistics::detail::EntityId_s)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 16ULL == - (detail::GUID_s_offset_of() + - sizeof(eprosima::fastdds::statistics::detail::EntityId_s)); - } - - }; - - - - #ifndef SWIG - namespace detail { - - template - struct SequenceNumber_s_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct SequenceNumber_s_f - { - typedef uint32_t SequenceNumber_s::* type; - friend constexpr type get( - SequenceNumber_s_f); - }; - - template struct SequenceNumber_s_rob; - - template - inline size_t constexpr SequenceNumber_s_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type SequenceNumber_s defined by the user in the IDL file. - * @ingroup types - */ - class SequenceNumber_sPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef SequenceNumber_s type; - - eProsima_user_DllExport SequenceNumber_sPubSubType(); - - eProsima_user_DllExport ~SequenceNumber_sPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) SequenceNumber_s(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 8ULL == - (detail::SequenceNumber_s_offset_of() + - sizeof(uint32_t)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 8ULL == - (detail::SequenceNumber_s_offset_of() + - sizeof(uint32_t)); - } - - }; - - - - #ifndef SWIG - namespace detail { - - template - struct SampleIdentity_s_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct SampleIdentity_s_f - { - typedef eprosima::fastdds::statistics::detail::SequenceNumber_s SampleIdentity_s::* type; - friend constexpr type get( - SampleIdentity_s_f); - }; - - template struct SampleIdentity_s_rob; - - template - inline size_t constexpr SampleIdentity_s_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type SampleIdentity_s defined by the user in the IDL file. - * @ingroup types - */ - class SampleIdentity_sPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef SampleIdentity_s type; - - eProsima_user_DllExport SampleIdentity_sPubSubType(); - - eProsima_user_DllExport ~SampleIdentity_sPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) SampleIdentity_s(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 24ULL == - (detail::SampleIdentity_s_offset_of() + - sizeof(eprosima::fastdds::statistics::detail::SequenceNumber_s)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 24ULL == - (detail::SampleIdentity_s_offset_of() + - sizeof(eprosima::fastdds::statistics::detail::SequenceNumber_s)); - } - - }; - - - - #ifndef SWIG - namespace detail { - - template - struct Locator_s_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct Locator_s_f - { - typedef std::array Locator_s::* type; - friend constexpr type get( - Locator_s_f); - }; - - template struct Locator_s_rob; - - template - inline size_t constexpr Locator_s_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type Locator_s defined by the user in the IDL file. - * @ingroup types - */ - class Locator_sPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef Locator_s type; - - eProsima_user_DllExport Locator_sPubSubType(); - - eProsima_user_DllExport ~Locator_sPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) Locator_s(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 24ULL == - (detail::Locator_s_offset_of() + - sizeof(std::array)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 24ULL == - (detail::Locator_s_offset_of() + - sizeof(std::array)); - } - - }; - } - - - - /*! - * @brief This class represents the TopicDataType of the type DiscoveryTime defined by the user in the IDL file. - * @ingroup types - */ - class DiscoveryTimePubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef DiscoveryTime type; - - eProsima_user_DllExport DiscoveryTimePubSubType(); - - eProsima_user_DllExport ~DiscoveryTimePubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - }; - - - - #ifndef SWIG - namespace detail { - - template - struct EntityCount_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct EntityCount_f - { - typedef uint64_t EntityCount::* type; - friend constexpr type get( - EntityCount_f); - }; - - template struct EntityCount_rob; - - template - inline size_t constexpr EntityCount_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type EntityCount defined by the user in the IDL file. - * @ingroup types - */ - class EntityCountPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef EntityCount type; - - eProsima_user_DllExport EntityCountPubSubType(); - - eProsima_user_DllExport ~EntityCountPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) EntityCount(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 24ULL == - (detail::EntityCount_offset_of() + - sizeof(uint64_t)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 24ULL == - (detail::EntityCount_offset_of() + - sizeof(uint64_t)); - } - - }; - - - - #ifndef SWIG - namespace detail { - - template - struct SampleIdentityCount_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct SampleIdentityCount_f - { - typedef uint64_t SampleIdentityCount::* type; - friend constexpr type get( - SampleIdentityCount_f); - }; - - template struct SampleIdentityCount_rob; - - template - inline size_t constexpr SampleIdentityCount_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type SampleIdentityCount defined by the user in the IDL file. - * @ingroup types - */ - class SampleIdentityCountPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef SampleIdentityCount type; - - eProsima_user_DllExport SampleIdentityCountPubSubType(); - - eProsima_user_DllExport ~SampleIdentityCountPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) SampleIdentityCount(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 32ULL == - (detail::SampleIdentityCount_offset_of() + - sizeof(uint64_t)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 32ULL == - (detail::SampleIdentityCount_offset_of() + - sizeof(uint64_t)); - } - - }; - - - - #ifndef SWIG - namespace detail { - - template - struct Entity2LocatorTraffic_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct Entity2LocatorTraffic_f - { - typedef int16_t Entity2LocatorTraffic::* type; - friend constexpr type get( - Entity2LocatorTraffic_f); - }; - - template struct Entity2LocatorTraffic_rob; - - template - inline size_t constexpr Entity2LocatorTraffic_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type Entity2LocatorTraffic defined by the user in the IDL file. - * @ingroup types - */ - class Entity2LocatorTrafficPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef Entity2LocatorTraffic type; - - eProsima_user_DllExport Entity2LocatorTrafficPubSubType(); - - eProsima_user_DllExport ~Entity2LocatorTrafficPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) Entity2LocatorTraffic(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 58ULL == - (detail::Entity2LocatorTraffic_offset_of() + - sizeof(int16_t)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 58ULL == - (detail::Entity2LocatorTraffic_offset_of() + - sizeof(int16_t)); - } - - }; - - - - #ifndef SWIG - namespace detail { - - template - struct WriterReaderData_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct WriterReaderData_f - { - typedef float WriterReaderData::* type; - friend constexpr type get( - WriterReaderData_f); - }; - - template struct WriterReaderData_rob; - - template - inline size_t constexpr WriterReaderData_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type WriterReaderData defined by the user in the IDL file. - * @ingroup types - */ - class WriterReaderDataPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef WriterReaderData type; - - eProsima_user_DllExport WriterReaderDataPubSubType(); - - eProsima_user_DllExport ~WriterReaderDataPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) WriterReaderData(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 36ULL == - (detail::WriterReaderData_offset_of() + - sizeof(float)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 36ULL == - (detail::WriterReaderData_offset_of() + - sizeof(float)); - } - - }; - - - - #ifndef SWIG - namespace detail { - - template - struct Locator2LocatorData_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct Locator2LocatorData_f - { - typedef float Locator2LocatorData::* type; - friend constexpr type get( - Locator2LocatorData_f); - }; - - template struct Locator2LocatorData_rob; - - template - inline size_t constexpr Locator2LocatorData_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type Locator2LocatorData defined by the user in the IDL file. - * @ingroup types - */ - class Locator2LocatorDataPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef Locator2LocatorData type; - - eProsima_user_DllExport Locator2LocatorDataPubSubType(); - - eProsima_user_DllExport ~Locator2LocatorDataPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) Locator2LocatorData(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 52ULL == - (detail::Locator2LocatorData_offset_of() + - sizeof(float)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 52ULL == - (detail::Locator2LocatorData_offset_of() + - sizeof(float)); - } - - }; - - - - #ifndef SWIG - namespace detail { - - template - struct EntityData_rob - { - friend constexpr typename Tag::type get( - Tag) - { - return M; - } - - }; - - struct EntityData_f - { - typedef float EntityData::* type; - friend constexpr type get( - EntityData_f); - }; - - template struct EntityData_rob; - - template - inline size_t constexpr EntityData_offset_of() - { - return ((::size_t) &reinterpret_cast((((T*)0)->*get(Tag())))); - } - - } // namespace detail - #endif // ifndef SWIG - - - /*! - * @brief This class represents the TopicDataType of the type EntityData defined by the user in the IDL file. - * @ingroup types - */ - class EntityDataPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef EntityData type; - - eProsima_user_DllExport EntityDataPubSubType(); - - eProsima_user_DllExport ~EntityDataPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return is_plain_xcdrv1_impl(); - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - if(data_representation == eprosima::fastdds::dds::DataRepresentationId_t::XCDR2_DATA_REPRESENTATION) - { - return is_plain_xcdrv2_impl(); - } - else - { - return is_plain_xcdrv1_impl(); - } - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - new (memory) EntityData(); - return true; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - private: - - static constexpr bool is_plain_xcdrv1_impl() - { - return 20ULL == - (detail::EntityData_offset_of() + - sizeof(float)); - } - - static constexpr bool is_plain_xcdrv2_impl() - { - return 20ULL == - (detail::EntityData_offset_of() + - sizeof(float)); - } - - }; - - - - /*! - * @brief This class represents the TopicDataType of the type PhysicalData defined by the user in the IDL file. - * @ingroup types - */ - class PhysicalDataPubSubType : public eprosima::fastdds::dds::TopicDataType - { - public: - - typedef PhysicalData type; - - eProsima_user_DllExport PhysicalDataPubSubType(); - - eProsima_user_DllExport ~PhysicalDataPubSubType() override; - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload) override - { - return serialize(data, payload, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport bool serialize( - void* data, - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool deserialize( - eprosima::fastrtps::rtps::SerializedPayload_t* payload, - void* data) override; - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data) override - { - return getSerializedSizeProvider(data, eprosima::fastdds::dds::DEFAULT_DATA_REPRESENTATION); - } - - eProsima_user_DllExport std::function getSerializedSizeProvider( - void* data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; - - eProsima_user_DllExport bool getKey( - void* data, - eprosima::fastrtps::rtps::InstanceHandle_t* ihandle, - bool force_md5 = false) override; - - eProsima_user_DllExport void* createData() override; - - eProsima_user_DllExport void deleteData( - void* data) override; - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - eProsima_user_DllExport inline bool is_bounded() const override - { - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED - - #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - eProsima_user_DllExport inline bool is_plain() const override - { - return false; - } - - eProsima_user_DllExport inline bool is_plain( - eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override - { - static_cast(data_representation); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN - - #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - eProsima_user_DllExport inline bool construct_sample( - void* memory) const override - { - static_cast(memory); - return false; - } - - #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE - - MD5 m_md5; - unsigned char* m_keyBuffer; - - }; - - - - - - } - } -} - -#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPES_PUBSUBTYPES_H_ - diff --git a/include/fastdds_statistics_backend/topic_types/typesPubSubTypes.hpp b/include/fastdds_statistics_backend/topic_types/typesPubSubTypes.hpp new file mode 100644 index 000000000..9e1dc6d78 --- /dev/null +++ b/include/fastdds_statistics_backend/topic_types/typesPubSubTypes.hpp @@ -0,0 +1,1187 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file typesPubSubTypes.hpp + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPES_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPES_PUBSUBTYPES_HPP + +#include +#include +#include +#include +#include + +#include "types.hpp" + + +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) +#error \ + Generated types is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // FASTDDS_GEN_API_VER + +namespace eprosima { +namespace fastdds { +namespace statistics { +namespace detail { + +/*! + * @brief This class represents the TopicDataType of the type EntityId_s defined by the user in the IDL file. + * @ingroup types + */ +class EntityId_sPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef EntityId_s type; + + eProsima_user_DllExport EntityId_sPubSubType(); + + eProsima_user_DllExport ~EntityId_sPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type GuidPrefix_s defined by the user in the IDL file. + * @ingroup types + */ +class GuidPrefix_sPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef GuidPrefix_s type; + + eProsima_user_DllExport GuidPrefix_sPubSubType(); + + eProsima_user_DllExport ~GuidPrefix_sPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type GUID_s defined by the user in the IDL file. + * @ingroup types + */ +class GUID_sPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef GUID_s type; + + eProsima_user_DllExport GUID_sPubSubType(); + + eProsima_user_DllExport ~GUID_sPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type SequenceNumber_s defined by the user in the IDL file. + * @ingroup types + */ +class SequenceNumber_sPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef SequenceNumber_s type; + + eProsima_user_DllExport SequenceNumber_sPubSubType(); + + eProsima_user_DllExport ~SequenceNumber_sPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type SampleIdentity_s defined by the user in the IDL file. + * @ingroup types + */ +class SampleIdentity_sPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef SampleIdentity_s type; + + eProsima_user_DllExport SampleIdentity_sPubSubType(); + + eProsima_user_DllExport ~SampleIdentity_sPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type Locator_s defined by the user in the IDL file. + * @ingroup types + */ +class Locator_sPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef Locator_s type; + + eProsima_user_DllExport Locator_sPubSubType(); + + eProsima_user_DllExport ~Locator_sPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; +} // namespace detail + +/*! + * @brief This class represents the TopicDataType of the type DiscoveryTime defined by the user in the IDL file. + * @ingroup types + */ +class DiscoveryTimePubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef DiscoveryTime type; + + eProsima_user_DllExport DiscoveryTimePubSubType(); + + eProsima_user_DllExport ~DiscoveryTimePubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type EntityCount defined by the user in the IDL file. + * @ingroup types + */ +class EntityCountPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef EntityCount type; + + eProsima_user_DllExport EntityCountPubSubType(); + + eProsima_user_DllExport ~EntityCountPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type SampleIdentityCount defined by the user in the IDL file. + * @ingroup types + */ +class SampleIdentityCountPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef SampleIdentityCount type; + + eProsima_user_DllExport SampleIdentityCountPubSubType(); + + eProsima_user_DllExport ~SampleIdentityCountPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type Entity2LocatorTraffic defined by the user in the IDL file. + * @ingroup types + */ +class Entity2LocatorTrafficPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef Entity2LocatorTraffic type; + + eProsima_user_DllExport Entity2LocatorTrafficPubSubType(); + + eProsima_user_DllExport ~Entity2LocatorTrafficPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type WriterReaderData defined by the user in the IDL file. + * @ingroup types + */ +class WriterReaderDataPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef WriterReaderData type; + + eProsima_user_DllExport WriterReaderDataPubSubType(); + + eProsima_user_DllExport ~WriterReaderDataPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type Locator2LocatorData defined by the user in the IDL file. + * @ingroup types + */ +class Locator2LocatorDataPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef Locator2LocatorData type; + + eProsima_user_DllExport Locator2LocatorDataPubSubType(); + + eProsima_user_DllExport ~Locator2LocatorDataPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type EntityData defined by the user in the IDL file. + * @ingroup types + */ +class EntityDataPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef EntityData type; + + eProsima_user_DllExport EntityDataPubSubType(); + + eProsima_user_DllExport ~EntityDataPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return true; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +/*! + * @brief This class represents the TopicDataType of the type PhysicalData defined by the user in the IDL file. + * @ingroup types + */ +class PhysicalDataPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef PhysicalData type; + + eProsima_user_DllExport PhysicalDataPubSubType(); + + eProsima_user_DllExport ~PhysicalDataPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + + #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + + #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; +namespace EventKind { +} // namespace EventKind + +} // namespace statistics +} // namespace fastdds +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPES_PUBSUBTYPES_HPP + diff --git a/include/fastdds_statistics_backend/topic_types/typesTypeObjectSupport.cxx b/include/fastdds_statistics_backend/topic_types/typesTypeObjectSupport.cxx new file mode 100644 index 000000000..d13827cf3 --- /dev/null +++ b/include/fastdds_statistics_backend/topic_types/typesTypeObjectSupport.cxx @@ -0,0 +1,2183 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file typesTypeObjectSupport.cxx + * Source file containing the implementation to register the TypeObject representation of the described types in the IDL file + * + * This file was generated by the tool fastddsgen. + */ + +#include "typesTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "types.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +namespace eprosima { +namespace fastdds { +namespace statistics { +namespace detail { +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_EntityId_s_type_identifier( + TypeIdentifierPair& type_ids_EntityId_s) +{ + + ReturnCode_t return_code_EntityId_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_EntityId_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::EntityId_s", type_ids_EntityId_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_EntityId_s) + { + StructTypeFlag struct_flags_EntityId_s = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_EntityId_s = "eprosima::fastdds::statistics::detail::EntityId_s"; + eprosima::fastcdr::optional type_ann_builtin_EntityId_s; + eprosima::fastcdr::optional ann_custom_EntityId_s; + CompleteTypeDetail detail_EntityId_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_EntityId_s, ann_custom_EntityId_s, type_name_EntityId_s.to_string()); + CompleteStructHeader header_EntityId_s; + header_EntityId_s = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_EntityId_s); + CompleteStructMemberSeq member_seq_EntityId_s; + { + TypeIdentifierPair type_ids_value; + ReturnCode_t return_code_value {eprosima::fastdds::dds::RETCODE_OK}; + return_code_value = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_uint8_t_4", type_ids_value); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_value) + { + return_code_value = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_byte", type_ids_value); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_value) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + bool element_identifier_anonymous_array_uint8_t_4_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_uint8_t_4 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_value, element_identifier_anonymous_array_uint8_t_4_ec))}; + if (!element_identifier_anonymous_array_uint8_t_4_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_uint8_t_4 = EK_COMPLETE; + if (TK_NONE == type_ids_value.type_identifier2()._d()) + { + equiv_kind_anonymous_array_uint8_t_4 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_uint8_t_4 = 0; + PlainCollectionHeader header_anonymous_array_uint8_t_4 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_uint8_t_4, element_flags_anonymous_array_uint8_t_4); + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(4)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_uint8_t_4, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_uint8_t_4)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_uint8_t_4", type_ids_value)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_uint8_t_4 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_value = 0x00000000; + bool common_value_ec {false}; + CommonStructMember common_value {TypeObjectUtils::build_common_struct_member(member_id_value, member_flags_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_value, common_value_ec))}; + if (!common_value_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure value member TypeIdentifier inconsistent."); + return; + } + MemberName name_value = "value"; + eprosima::fastcdr::optional member_ann_builtin_value; + ann_custom_EntityId_s.reset(); + CompleteMemberDetail detail_value = TypeObjectUtils::build_complete_member_detail(name_value, member_ann_builtin_value, ann_custom_EntityId_s); + CompleteStructMember member_value = TypeObjectUtils::build_complete_struct_member(common_value, detail_value); + TypeObjectUtils::add_complete_struct_member(member_seq_EntityId_s, member_value); + } + CompleteStructType struct_type_EntityId_s = TypeObjectUtils::build_complete_struct_type(struct_flags_EntityId_s, header_EntityId_s, member_seq_EntityId_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_EntityId_s, type_name_EntityId_s.to_string(), type_ids_EntityId_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::detail::EntityId_s already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_GuidPrefix_s_type_identifier( + TypeIdentifierPair& type_ids_GuidPrefix_s) +{ + + ReturnCode_t return_code_GuidPrefix_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_GuidPrefix_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GuidPrefix_s", type_ids_GuidPrefix_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_GuidPrefix_s) + { + StructTypeFlag struct_flags_GuidPrefix_s = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_GuidPrefix_s = "eprosima::fastdds::statistics::detail::GuidPrefix_s"; + eprosima::fastcdr::optional type_ann_builtin_GuidPrefix_s; + eprosima::fastcdr::optional ann_custom_GuidPrefix_s; + CompleteTypeDetail detail_GuidPrefix_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_GuidPrefix_s, ann_custom_GuidPrefix_s, type_name_GuidPrefix_s.to_string()); + CompleteStructHeader header_GuidPrefix_s; + header_GuidPrefix_s = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_GuidPrefix_s); + CompleteStructMemberSeq member_seq_GuidPrefix_s; + { + TypeIdentifierPair type_ids_value; + ReturnCode_t return_code_value {eprosima::fastdds::dds::RETCODE_OK}; + return_code_value = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_uint8_t_12", type_ids_value); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_value) + { + return_code_value = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_byte", type_ids_value); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_value) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + bool element_identifier_anonymous_array_uint8_t_12_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_uint8_t_12 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_value, element_identifier_anonymous_array_uint8_t_12_ec))}; + if (!element_identifier_anonymous_array_uint8_t_12_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_uint8_t_12 = EK_COMPLETE; + if (TK_NONE == type_ids_value.type_identifier2()._d()) + { + equiv_kind_anonymous_array_uint8_t_12 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_uint8_t_12 = 0; + PlainCollectionHeader header_anonymous_array_uint8_t_12 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_uint8_t_12, element_flags_anonymous_array_uint8_t_12); + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(12)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_uint8_t_12, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_uint8_t_12)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_uint8_t_12", type_ids_value)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_uint8_t_12 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_value = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_value = 0x00000000; + bool common_value_ec {false}; + CommonStructMember common_value {TypeObjectUtils::build_common_struct_member(member_id_value, member_flags_value, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_value, common_value_ec))}; + if (!common_value_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure value member TypeIdentifier inconsistent."); + return; + } + MemberName name_value = "value"; + eprosima::fastcdr::optional member_ann_builtin_value; + ann_custom_GuidPrefix_s.reset(); + CompleteMemberDetail detail_value = TypeObjectUtils::build_complete_member_detail(name_value, member_ann_builtin_value, ann_custom_GuidPrefix_s); + CompleteStructMember member_value = TypeObjectUtils::build_complete_struct_member(common_value, detail_value); + TypeObjectUtils::add_complete_struct_member(member_seq_GuidPrefix_s, member_value); + } + CompleteStructType struct_type_GuidPrefix_s = TypeObjectUtils::build_complete_struct_type(struct_flags_GuidPrefix_s, header_GuidPrefix_s, member_seq_GuidPrefix_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_GuidPrefix_s, type_name_GuidPrefix_s.to_string(), type_ids_GuidPrefix_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::detail::GuidPrefix_s already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_GUID_s_type_identifier( + TypeIdentifierPair& type_ids_GUID_s) +{ + + ReturnCode_t return_code_GUID_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_GUID_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_GUID_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_GUID_s) + { + StructTypeFlag struct_flags_GUID_s = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_GUID_s = "eprosima::fastdds::statistics::detail::GUID_s"; + eprosima::fastcdr::optional type_ann_builtin_GUID_s; + eprosima::fastcdr::optional ann_custom_GUID_s; + CompleteTypeDetail detail_GUID_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_GUID_s, ann_custom_GUID_s, type_name_GUID_s.to_string()); + CompleteStructHeader header_GUID_s; + header_GUID_s = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_GUID_s); + CompleteStructMemberSeq member_seq_GUID_s; + { + TypeIdentifierPair type_ids_guidPrefix; + ReturnCode_t return_code_guidPrefix {eprosima::fastdds::dds::RETCODE_OK}; + return_code_guidPrefix = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GuidPrefix_s", type_ids_guidPrefix); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_guidPrefix) + { + eprosima::fastdds::statistics::detail::register_GuidPrefix_s_type_identifier(type_ids_guidPrefix); + } + StructMemberFlag member_flags_guidPrefix = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_guidPrefix = 0x00000000; + bool common_guidPrefix_ec {false}; + CommonStructMember common_guidPrefix {TypeObjectUtils::build_common_struct_member(member_id_guidPrefix, member_flags_guidPrefix, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_guidPrefix, common_guidPrefix_ec))}; + if (!common_guidPrefix_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure guidPrefix member TypeIdentifier inconsistent."); + return; + } + MemberName name_guidPrefix = "guidPrefix"; + eprosima::fastcdr::optional member_ann_builtin_guidPrefix; + ann_custom_GUID_s.reset(); + CompleteMemberDetail detail_guidPrefix = TypeObjectUtils::build_complete_member_detail(name_guidPrefix, member_ann_builtin_guidPrefix, ann_custom_GUID_s); + CompleteStructMember member_guidPrefix = TypeObjectUtils::build_complete_struct_member(common_guidPrefix, detail_guidPrefix); + TypeObjectUtils::add_complete_struct_member(member_seq_GUID_s, member_guidPrefix); + } + { + TypeIdentifierPair type_ids_entityId; + ReturnCode_t return_code_entityId {eprosima::fastdds::dds::RETCODE_OK}; + return_code_entityId = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::EntityId_s", type_ids_entityId); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_entityId) + { + eprosima::fastdds::statistics::detail::register_EntityId_s_type_identifier(type_ids_entityId); + } + StructMemberFlag member_flags_entityId = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_entityId = 0x00000001; + bool common_entityId_ec {false}; + CommonStructMember common_entityId {TypeObjectUtils::build_common_struct_member(member_id_entityId, member_flags_entityId, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_entityId, common_entityId_ec))}; + if (!common_entityId_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure entityId member TypeIdentifier inconsistent."); + return; + } + MemberName name_entityId = "entityId"; + eprosima::fastcdr::optional member_ann_builtin_entityId; + ann_custom_GUID_s.reset(); + CompleteMemberDetail detail_entityId = TypeObjectUtils::build_complete_member_detail(name_entityId, member_ann_builtin_entityId, ann_custom_GUID_s); + CompleteStructMember member_entityId = TypeObjectUtils::build_complete_struct_member(common_entityId, detail_entityId); + TypeObjectUtils::add_complete_struct_member(member_seq_GUID_s, member_entityId); + } + CompleteStructType struct_type_GUID_s = TypeObjectUtils::build_complete_struct_type(struct_flags_GUID_s, header_GUID_s, member_seq_GUID_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_GUID_s, type_name_GUID_s.to_string(), type_ids_GUID_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::detail::GUID_s already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_SequenceNumber_s_type_identifier( + TypeIdentifierPair& type_ids_SequenceNumber_s) +{ + + ReturnCode_t return_code_SequenceNumber_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_SequenceNumber_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::SequenceNumber_s", type_ids_SequenceNumber_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_SequenceNumber_s) + { + StructTypeFlag struct_flags_SequenceNumber_s = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_SequenceNumber_s = "eprosima::fastdds::statistics::detail::SequenceNumber_s"; + eprosima::fastcdr::optional type_ann_builtin_SequenceNumber_s; + eprosima::fastcdr::optional ann_custom_SequenceNumber_s; + CompleteTypeDetail detail_SequenceNumber_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_SequenceNumber_s, ann_custom_SequenceNumber_s, type_name_SequenceNumber_s.to_string()); + CompleteStructHeader header_SequenceNumber_s; + header_SequenceNumber_s = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_SequenceNumber_s); + CompleteStructMemberSeq member_seq_SequenceNumber_s; + { + TypeIdentifierPair type_ids_high; + ReturnCode_t return_code_high {eprosima::fastdds::dds::RETCODE_OK}; + return_code_high = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_high); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_high) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "high Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_high = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_high = 0x00000000; + bool common_high_ec {false}; + CommonStructMember common_high {TypeObjectUtils::build_common_struct_member(member_id_high, member_flags_high, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_high, common_high_ec))}; + if (!common_high_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure high member TypeIdentifier inconsistent."); + return; + } + MemberName name_high = "high"; + eprosima::fastcdr::optional member_ann_builtin_high; + ann_custom_SequenceNumber_s.reset(); + CompleteMemberDetail detail_high = TypeObjectUtils::build_complete_member_detail(name_high, member_ann_builtin_high, ann_custom_SequenceNumber_s); + CompleteStructMember member_high = TypeObjectUtils::build_complete_struct_member(common_high, detail_high); + TypeObjectUtils::add_complete_struct_member(member_seq_SequenceNumber_s, member_high); + } + { + TypeIdentifierPair type_ids_low; + ReturnCode_t return_code_low {eprosima::fastdds::dds::RETCODE_OK}; + return_code_low = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_low); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_low) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "low Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_low = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_low = 0x00000001; + bool common_low_ec {false}; + CommonStructMember common_low {TypeObjectUtils::build_common_struct_member(member_id_low, member_flags_low, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_low, common_low_ec))}; + if (!common_low_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure low member TypeIdentifier inconsistent."); + return; + } + MemberName name_low = "low"; + eprosima::fastcdr::optional member_ann_builtin_low; + ann_custom_SequenceNumber_s.reset(); + CompleteMemberDetail detail_low = TypeObjectUtils::build_complete_member_detail(name_low, member_ann_builtin_low, ann_custom_SequenceNumber_s); + CompleteStructMember member_low = TypeObjectUtils::build_complete_struct_member(common_low, detail_low); + TypeObjectUtils::add_complete_struct_member(member_seq_SequenceNumber_s, member_low); + } + CompleteStructType struct_type_SequenceNumber_s = TypeObjectUtils::build_complete_struct_type(struct_flags_SequenceNumber_s, header_SequenceNumber_s, member_seq_SequenceNumber_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_SequenceNumber_s, type_name_SequenceNumber_s.to_string(), type_ids_SequenceNumber_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::detail::SequenceNumber_s already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_SampleIdentity_s_type_identifier( + TypeIdentifierPair& type_ids_SampleIdentity_s) +{ + + ReturnCode_t return_code_SampleIdentity_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_SampleIdentity_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::SampleIdentity_s", type_ids_SampleIdentity_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_SampleIdentity_s) + { + StructTypeFlag struct_flags_SampleIdentity_s = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_SampleIdentity_s = "eprosima::fastdds::statistics::detail::SampleIdentity_s"; + eprosima::fastcdr::optional type_ann_builtin_SampleIdentity_s; + eprosima::fastcdr::optional ann_custom_SampleIdentity_s; + CompleteTypeDetail detail_SampleIdentity_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_SampleIdentity_s, ann_custom_SampleIdentity_s, type_name_SampleIdentity_s.to_string()); + CompleteStructHeader header_SampleIdentity_s; + header_SampleIdentity_s = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_SampleIdentity_s); + CompleteStructMemberSeq member_seq_SampleIdentity_s; + { + TypeIdentifierPair type_ids_writer_guid; + ReturnCode_t return_code_writer_guid {eprosima::fastdds::dds::RETCODE_OK}; + return_code_writer_guid = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_writer_guid); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_writer_guid) + { + eprosima::fastdds::statistics::detail::register_GUID_s_type_identifier(type_ids_writer_guid); + } + StructMemberFlag member_flags_writer_guid = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_writer_guid = 0x00000000; + bool common_writer_guid_ec {false}; + CommonStructMember common_writer_guid {TypeObjectUtils::build_common_struct_member(member_id_writer_guid, member_flags_writer_guid, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_writer_guid, common_writer_guid_ec))}; + if (!common_writer_guid_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure writer_guid member TypeIdentifier inconsistent."); + return; + } + MemberName name_writer_guid = "writer_guid"; + eprosima::fastcdr::optional member_ann_builtin_writer_guid; + ann_custom_SampleIdentity_s.reset(); + CompleteMemberDetail detail_writer_guid = TypeObjectUtils::build_complete_member_detail(name_writer_guid, member_ann_builtin_writer_guid, ann_custom_SampleIdentity_s); + CompleteStructMember member_writer_guid = TypeObjectUtils::build_complete_struct_member(common_writer_guid, detail_writer_guid); + TypeObjectUtils::add_complete_struct_member(member_seq_SampleIdentity_s, member_writer_guid); + } + { + TypeIdentifierPair type_ids_sequence_number; + ReturnCode_t return_code_sequence_number {eprosima::fastdds::dds::RETCODE_OK}; + return_code_sequence_number = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::SequenceNumber_s", type_ids_sequence_number); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sequence_number) + { + eprosima::fastdds::statistics::detail::register_SequenceNumber_s_type_identifier(type_ids_sequence_number); + } + StructMemberFlag member_flags_sequence_number = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_sequence_number = 0x00000001; + bool common_sequence_number_ec {false}; + CommonStructMember common_sequence_number {TypeObjectUtils::build_common_struct_member(member_id_sequence_number, member_flags_sequence_number, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sequence_number, common_sequence_number_ec))}; + if (!common_sequence_number_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure sequence_number member TypeIdentifier inconsistent."); + return; + } + MemberName name_sequence_number = "sequence_number"; + eprosima::fastcdr::optional member_ann_builtin_sequence_number; + ann_custom_SampleIdentity_s.reset(); + CompleteMemberDetail detail_sequence_number = TypeObjectUtils::build_complete_member_detail(name_sequence_number, member_ann_builtin_sequence_number, ann_custom_SampleIdentity_s); + CompleteStructMember member_sequence_number = TypeObjectUtils::build_complete_struct_member(common_sequence_number, detail_sequence_number); + TypeObjectUtils::add_complete_struct_member(member_seq_SampleIdentity_s, member_sequence_number); + } + CompleteStructType struct_type_SampleIdentity_s = TypeObjectUtils::build_complete_struct_type(struct_flags_SampleIdentity_s, header_SampleIdentity_s, member_seq_SampleIdentity_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_SampleIdentity_s, type_name_SampleIdentity_s.to_string(), type_ids_SampleIdentity_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::detail::SampleIdentity_s already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_Locator_s_type_identifier( + TypeIdentifierPair& type_ids_Locator_s) +{ + + ReturnCode_t return_code_Locator_s {eprosima::fastdds::dds::RETCODE_OK}; + return_code_Locator_s = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::Locator_s", type_ids_Locator_s); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Locator_s) + { + StructTypeFlag struct_flags_Locator_s = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_Locator_s = "eprosima::fastdds::statistics::detail::Locator_s"; + eprosima::fastcdr::optional type_ann_builtin_Locator_s; + eprosima::fastcdr::optional ann_custom_Locator_s; + CompleteTypeDetail detail_Locator_s = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Locator_s, ann_custom_Locator_s, type_name_Locator_s.to_string()); + CompleteStructHeader header_Locator_s; + header_Locator_s = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Locator_s); + CompleteStructMemberSeq member_seq_Locator_s; + { + TypeIdentifierPair type_ids_kind; + ReturnCode_t return_code_kind {eprosima::fastdds::dds::RETCODE_OK}; + return_code_kind = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int32_t", type_ids_kind); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_kind) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "kind Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_kind = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_kind = 0x00000000; + bool common_kind_ec {false}; + CommonStructMember common_kind {TypeObjectUtils::build_common_struct_member(member_id_kind, member_flags_kind, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_kind, common_kind_ec))}; + if (!common_kind_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure kind member TypeIdentifier inconsistent."); + return; + } + MemberName name_kind = "kind"; + eprosima::fastcdr::optional member_ann_builtin_kind; + ann_custom_Locator_s.reset(); + CompleteMemberDetail detail_kind = TypeObjectUtils::build_complete_member_detail(name_kind, member_ann_builtin_kind, ann_custom_Locator_s); + CompleteStructMember member_kind = TypeObjectUtils::build_complete_struct_member(common_kind, detail_kind); + TypeObjectUtils::add_complete_struct_member(member_seq_Locator_s, member_kind); + } + { + TypeIdentifierPair type_ids_port; + ReturnCode_t return_code_port {eprosima::fastdds::dds::RETCODE_OK}; + return_code_port = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_port); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_port) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "port Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_port = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_port = 0x00000001; + bool common_port_ec {false}; + CommonStructMember common_port {TypeObjectUtils::build_common_struct_member(member_id_port, member_flags_port, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_port, common_port_ec))}; + if (!common_port_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure port member TypeIdentifier inconsistent."); + return; + } + MemberName name_port = "port"; + eprosima::fastcdr::optional member_ann_builtin_port; + ann_custom_Locator_s.reset(); + CompleteMemberDetail detail_port = TypeObjectUtils::build_complete_member_detail(name_port, member_ann_builtin_port, ann_custom_Locator_s); + CompleteStructMember member_port = TypeObjectUtils::build_complete_struct_member(common_port, detail_port); + TypeObjectUtils::add_complete_struct_member(member_seq_Locator_s, member_port); + } + { + TypeIdentifierPair type_ids_address; + ReturnCode_t return_code_address {eprosima::fastdds::dds::RETCODE_OK}; + return_code_address = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_array_uint8_t_16", type_ids_address); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_address) + { + return_code_address = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_byte", type_ids_address); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_address) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Array element TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + bool element_identifier_anonymous_array_uint8_t_16_ec {false}; + TypeIdentifier* element_identifier_anonymous_array_uint8_t_16 {new TypeIdentifier(TypeObjectUtils::retrieve_complete_type_identifier(type_ids_address, element_identifier_anonymous_array_uint8_t_16_ec))}; + if (!element_identifier_anonymous_array_uint8_t_16_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Array element TypeIdentifier inconsistent."); + return; + } + EquivalenceKind equiv_kind_anonymous_array_uint8_t_16 = EK_COMPLETE; + if (TK_NONE == type_ids_address.type_identifier2()._d()) + { + equiv_kind_anonymous_array_uint8_t_16 = EK_BOTH; + } + CollectionElementFlag element_flags_anonymous_array_uint8_t_16 = 0; + PlainCollectionHeader header_anonymous_array_uint8_t_16 = TypeObjectUtils::build_plain_collection_header(equiv_kind_anonymous_array_uint8_t_16, element_flags_anonymous_array_uint8_t_16); + { + SBoundSeq array_bound_seq; + TypeObjectUtils::add_array_dimension(array_bound_seq, static_cast(16)); + + PlainArraySElemDefn array_sdefn = TypeObjectUtils::build_plain_array_s_elem_defn(header_anonymous_array_uint8_t_16, array_bound_seq, + eprosima::fastcdr::external(element_identifier_anonymous_array_uint8_t_16)); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_array_type_identifier(array_sdefn, "anonymous_array_uint8_t_16", type_ids_address)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_array_uint8_t_16 already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_address = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_address = 0x00000002; + bool common_address_ec {false}; + CommonStructMember common_address {TypeObjectUtils::build_common_struct_member(member_id_address, member_flags_address, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_address, common_address_ec))}; + if (!common_address_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure address member TypeIdentifier inconsistent."); + return; + } + MemberName name_address = "address"; + eprosima::fastcdr::optional member_ann_builtin_address; + ann_custom_Locator_s.reset(); + CompleteMemberDetail detail_address = TypeObjectUtils::build_complete_member_detail(name_address, member_ann_builtin_address, ann_custom_Locator_s); + CompleteStructMember member_address = TypeObjectUtils::build_complete_struct_member(common_address, detail_address); + TypeObjectUtils::add_complete_struct_member(member_seq_Locator_s, member_address); + } + CompleteStructType struct_type_Locator_s = TypeObjectUtils::build_complete_struct_type(struct_flags_Locator_s, header_Locator_s, member_seq_Locator_s); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_Locator_s, type_name_Locator_s.to_string(), type_ids_Locator_s)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::detail::Locator_s already registered in TypeObjectRegistry for a different type."); + } + } +} + +} // namespace detail +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_DiscoveryTime_type_identifier( + TypeIdentifierPair& type_ids_DiscoveryTime) +{ + + ReturnCode_t return_code_DiscoveryTime {eprosima::fastdds::dds::RETCODE_OK}; + return_code_DiscoveryTime = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::DiscoveryTime", type_ids_DiscoveryTime); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_DiscoveryTime) + { + StructTypeFlag struct_flags_DiscoveryTime = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_DiscoveryTime = "eprosima::fastdds::statistics::DiscoveryTime"; + eprosima::fastcdr::optional type_ann_builtin_DiscoveryTime; + eprosima::fastcdr::optional ann_custom_DiscoveryTime; + CompleteTypeDetail detail_DiscoveryTime = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_DiscoveryTime, ann_custom_DiscoveryTime, type_name_DiscoveryTime.to_string()); + CompleteStructHeader header_DiscoveryTime; + header_DiscoveryTime = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_DiscoveryTime); + CompleteStructMemberSeq member_seq_DiscoveryTime; + { + TypeIdentifierPair type_ids_local_participant_guid; + ReturnCode_t return_code_local_participant_guid {eprosima::fastdds::dds::RETCODE_OK}; + return_code_local_participant_guid = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_local_participant_guid); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_local_participant_guid) + { + eprosima::fastdds::statistics::detail::register_GUID_s_type_identifier(type_ids_local_participant_guid); + } + StructMemberFlag member_flags_local_participant_guid = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_local_participant_guid = 0x00000000; + bool common_local_participant_guid_ec {false}; + CommonStructMember common_local_participant_guid {TypeObjectUtils::build_common_struct_member(member_id_local_participant_guid, member_flags_local_participant_guid, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_local_participant_guid, common_local_participant_guid_ec))}; + if (!common_local_participant_guid_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure local_participant_guid member TypeIdentifier inconsistent."); + return; + } + MemberName name_local_participant_guid = "local_participant_guid"; + eprosima::fastcdr::optional member_ann_builtin_local_participant_guid; + ann_custom_DiscoveryTime.reset(); + AppliedAnnotationSeq tmp_ann_custom_local_participant_guid; + eprosima::fastcdr::optional unit_local_participant_guid; + eprosima::fastcdr::optional min_local_participant_guid; + eprosima::fastcdr::optional max_local_participant_guid; + eprosima::fastcdr::optional hash_id_local_participant_guid; + if (unit_local_participant_guid.has_value() || min_local_participant_guid.has_value() || max_local_participant_guid.has_value() || hash_id_local_participant_guid.has_value()) + { + member_ann_builtin_local_participant_guid = TypeObjectUtils::build_applied_builtin_member_annotations(unit_local_participant_guid, min_local_participant_guid, max_local_participant_guid, hash_id_local_participant_guid); + } + if (!tmp_ann_custom_local_participant_guid.empty()) + { + ann_custom_DiscoveryTime = tmp_ann_custom_local_participant_guid; + } + CompleteMemberDetail detail_local_participant_guid = TypeObjectUtils::build_complete_member_detail(name_local_participant_guid, member_ann_builtin_local_participant_guid, ann_custom_DiscoveryTime); + CompleteStructMember member_local_participant_guid = TypeObjectUtils::build_complete_struct_member(common_local_participant_guid, detail_local_participant_guid); + TypeObjectUtils::add_complete_struct_member(member_seq_DiscoveryTime, member_local_participant_guid); + } + { + TypeIdentifierPair type_ids_remote_entity_guid; + ReturnCode_t return_code_remote_entity_guid {eprosima::fastdds::dds::RETCODE_OK}; + return_code_remote_entity_guid = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_remote_entity_guid); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_remote_entity_guid) + { + eprosima::fastdds::statistics::detail::register_GUID_s_type_identifier(type_ids_remote_entity_guid); + } + StructMemberFlag member_flags_remote_entity_guid = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_remote_entity_guid = 0x00000001; + bool common_remote_entity_guid_ec {false}; + CommonStructMember common_remote_entity_guid {TypeObjectUtils::build_common_struct_member(member_id_remote_entity_guid, member_flags_remote_entity_guid, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_remote_entity_guid, common_remote_entity_guid_ec))}; + if (!common_remote_entity_guid_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure remote_entity_guid member TypeIdentifier inconsistent."); + return; + } + MemberName name_remote_entity_guid = "remote_entity_guid"; + eprosima::fastcdr::optional member_ann_builtin_remote_entity_guid; + ann_custom_DiscoveryTime.reset(); + AppliedAnnotationSeq tmp_ann_custom_remote_entity_guid; + eprosima::fastcdr::optional unit_remote_entity_guid; + eprosima::fastcdr::optional min_remote_entity_guid; + eprosima::fastcdr::optional max_remote_entity_guid; + eprosima::fastcdr::optional hash_id_remote_entity_guid; + if (unit_remote_entity_guid.has_value() || min_remote_entity_guid.has_value() || max_remote_entity_guid.has_value() || hash_id_remote_entity_guid.has_value()) + { + member_ann_builtin_remote_entity_guid = TypeObjectUtils::build_applied_builtin_member_annotations(unit_remote_entity_guid, min_remote_entity_guid, max_remote_entity_guid, hash_id_remote_entity_guid); + } + if (!tmp_ann_custom_remote_entity_guid.empty()) + { + ann_custom_DiscoveryTime = tmp_ann_custom_remote_entity_guid; + } + CompleteMemberDetail detail_remote_entity_guid = TypeObjectUtils::build_complete_member_detail(name_remote_entity_guid, member_ann_builtin_remote_entity_guid, ann_custom_DiscoveryTime); + CompleteStructMember member_remote_entity_guid = TypeObjectUtils::build_complete_struct_member(common_remote_entity_guid, detail_remote_entity_guid); + TypeObjectUtils::add_complete_struct_member(member_seq_DiscoveryTime, member_remote_entity_guid); + } + { + TypeIdentifierPair type_ids_time; + ReturnCode_t return_code_time {eprosima::fastdds::dds::RETCODE_OK}; + return_code_time = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint64_t", type_ids_time); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_time) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "time Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_time = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_time = 0x00000002; + bool common_time_ec {false}; + CommonStructMember common_time {TypeObjectUtils::build_common_struct_member(member_id_time, member_flags_time, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_time, common_time_ec))}; + if (!common_time_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure time member TypeIdentifier inconsistent."); + return; + } + MemberName name_time = "time"; + eprosima::fastcdr::optional member_ann_builtin_time; + ann_custom_DiscoveryTime.reset(); + CompleteMemberDetail detail_time = TypeObjectUtils::build_complete_member_detail(name_time, member_ann_builtin_time, ann_custom_DiscoveryTime); + CompleteStructMember member_time = TypeObjectUtils::build_complete_struct_member(common_time, detail_time); + TypeObjectUtils::add_complete_struct_member(member_seq_DiscoveryTime, member_time); + } + { + TypeIdentifierPair type_ids_host; + ReturnCode_t return_code_host {eprosima::fastdds::dds::RETCODE_OK}; + return_code_host = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_host); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_host) + { + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded", type_ids_host)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_host = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_host = 0x00000003; + bool common_host_ec {false}; + CommonStructMember common_host {TypeObjectUtils::build_common_struct_member(member_id_host, member_flags_host, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_host, common_host_ec))}; + if (!common_host_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure host member TypeIdentifier inconsistent."); + return; + } + MemberName name_host = "host"; + eprosima::fastcdr::optional member_ann_builtin_host; + ann_custom_DiscoveryTime.reset(); + CompleteMemberDetail detail_host = TypeObjectUtils::build_complete_member_detail(name_host, member_ann_builtin_host, ann_custom_DiscoveryTime); + CompleteStructMember member_host = TypeObjectUtils::build_complete_struct_member(common_host, detail_host); + TypeObjectUtils::add_complete_struct_member(member_seq_DiscoveryTime, member_host); + } + { + TypeIdentifierPair type_ids_user; + ReturnCode_t return_code_user {eprosima::fastdds::dds::RETCODE_OK}; + return_code_user = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_user); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_user) + { + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded", type_ids_user)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_user = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_user = 0x00000004; + bool common_user_ec {false}; + CommonStructMember common_user {TypeObjectUtils::build_common_struct_member(member_id_user, member_flags_user, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_user, common_user_ec))}; + if (!common_user_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure user member TypeIdentifier inconsistent."); + return; + } + MemberName name_user = "user"; + eprosima::fastcdr::optional member_ann_builtin_user; + ann_custom_DiscoveryTime.reset(); + CompleteMemberDetail detail_user = TypeObjectUtils::build_complete_member_detail(name_user, member_ann_builtin_user, ann_custom_DiscoveryTime); + CompleteStructMember member_user = TypeObjectUtils::build_complete_struct_member(common_user, detail_user); + TypeObjectUtils::add_complete_struct_member(member_seq_DiscoveryTime, member_user); + } + { + TypeIdentifierPair type_ids_process; + ReturnCode_t return_code_process {eprosima::fastdds::dds::RETCODE_OK}; + return_code_process = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_process); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_process) + { + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded", type_ids_process)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_process = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_process = 0x00000005; + bool common_process_ec {false}; + CommonStructMember common_process {TypeObjectUtils::build_common_struct_member(member_id_process, member_flags_process, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_process, common_process_ec))}; + if (!common_process_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure process member TypeIdentifier inconsistent."); + return; + } + MemberName name_process = "process"; + eprosima::fastcdr::optional member_ann_builtin_process; + ann_custom_DiscoveryTime.reset(); + CompleteMemberDetail detail_process = TypeObjectUtils::build_complete_member_detail(name_process, member_ann_builtin_process, ann_custom_DiscoveryTime); + CompleteStructMember member_process = TypeObjectUtils::build_complete_struct_member(common_process, detail_process); + TypeObjectUtils::add_complete_struct_member(member_seq_DiscoveryTime, member_process); + } + CompleteStructType struct_type_DiscoveryTime = TypeObjectUtils::build_complete_struct_type(struct_flags_DiscoveryTime, header_DiscoveryTime, member_seq_DiscoveryTime); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_DiscoveryTime, type_name_DiscoveryTime.to_string(), type_ids_DiscoveryTime)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::DiscoveryTime already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_EntityCount_type_identifier( + TypeIdentifierPair& type_ids_EntityCount) +{ + + ReturnCode_t return_code_EntityCount {eprosima::fastdds::dds::RETCODE_OK}; + return_code_EntityCount = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::EntityCount", type_ids_EntityCount); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_EntityCount) + { + StructTypeFlag struct_flags_EntityCount = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_EntityCount = "eprosima::fastdds::statistics::EntityCount"; + eprosima::fastcdr::optional type_ann_builtin_EntityCount; + eprosima::fastcdr::optional ann_custom_EntityCount; + CompleteTypeDetail detail_EntityCount = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_EntityCount, ann_custom_EntityCount, type_name_EntityCount.to_string()); + CompleteStructHeader header_EntityCount; + header_EntityCount = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_EntityCount); + CompleteStructMemberSeq member_seq_EntityCount; + { + TypeIdentifierPair type_ids_guid; + ReturnCode_t return_code_guid {eprosima::fastdds::dds::RETCODE_OK}; + return_code_guid = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_guid); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_guid) + { + eprosima::fastdds::statistics::detail::register_GUID_s_type_identifier(type_ids_guid); + } + StructMemberFlag member_flags_guid = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_guid = 0x00000000; + bool common_guid_ec {false}; + CommonStructMember common_guid {TypeObjectUtils::build_common_struct_member(member_id_guid, member_flags_guid, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_guid, common_guid_ec))}; + if (!common_guid_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure guid member TypeIdentifier inconsistent."); + return; + } + MemberName name_guid = "guid"; + eprosima::fastcdr::optional member_ann_builtin_guid; + ann_custom_EntityCount.reset(); + AppliedAnnotationSeq tmp_ann_custom_guid; + eprosima::fastcdr::optional unit_guid; + eprosima::fastcdr::optional min_guid; + eprosima::fastcdr::optional max_guid; + eprosima::fastcdr::optional hash_id_guid; + if (unit_guid.has_value() || min_guid.has_value() || max_guid.has_value() || hash_id_guid.has_value()) + { + member_ann_builtin_guid = TypeObjectUtils::build_applied_builtin_member_annotations(unit_guid, min_guid, max_guid, hash_id_guid); + } + if (!tmp_ann_custom_guid.empty()) + { + ann_custom_EntityCount = tmp_ann_custom_guid; + } + CompleteMemberDetail detail_guid = TypeObjectUtils::build_complete_member_detail(name_guid, member_ann_builtin_guid, ann_custom_EntityCount); + CompleteStructMember member_guid = TypeObjectUtils::build_complete_struct_member(common_guid, detail_guid); + TypeObjectUtils::add_complete_struct_member(member_seq_EntityCount, member_guid); + } + { + TypeIdentifierPair type_ids_count; + ReturnCode_t return_code_count {eprosima::fastdds::dds::RETCODE_OK}; + return_code_count = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint64_t", type_ids_count); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_count) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "count Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_count = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_count = 0x00000001; + bool common_count_ec {false}; + CommonStructMember common_count {TypeObjectUtils::build_common_struct_member(member_id_count, member_flags_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_count, common_count_ec))}; + if (!common_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure count member TypeIdentifier inconsistent."); + return; + } + MemberName name_count = "count"; + eprosima::fastcdr::optional member_ann_builtin_count; + ann_custom_EntityCount.reset(); + CompleteMemberDetail detail_count = TypeObjectUtils::build_complete_member_detail(name_count, member_ann_builtin_count, ann_custom_EntityCount); + CompleteStructMember member_count = TypeObjectUtils::build_complete_struct_member(common_count, detail_count); + TypeObjectUtils::add_complete_struct_member(member_seq_EntityCount, member_count); + } + CompleteStructType struct_type_EntityCount = TypeObjectUtils::build_complete_struct_type(struct_flags_EntityCount, header_EntityCount, member_seq_EntityCount); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_EntityCount, type_name_EntityCount.to_string(), type_ids_EntityCount)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::EntityCount already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_SampleIdentityCount_type_identifier( + TypeIdentifierPair& type_ids_SampleIdentityCount) +{ + + ReturnCode_t return_code_SampleIdentityCount {eprosima::fastdds::dds::RETCODE_OK}; + return_code_SampleIdentityCount = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::SampleIdentityCount", type_ids_SampleIdentityCount); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_SampleIdentityCount) + { + StructTypeFlag struct_flags_SampleIdentityCount = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_SampleIdentityCount = "eprosima::fastdds::statistics::SampleIdentityCount"; + eprosima::fastcdr::optional type_ann_builtin_SampleIdentityCount; + eprosima::fastcdr::optional ann_custom_SampleIdentityCount; + CompleteTypeDetail detail_SampleIdentityCount = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_SampleIdentityCount, ann_custom_SampleIdentityCount, type_name_SampleIdentityCount.to_string()); + CompleteStructHeader header_SampleIdentityCount; + header_SampleIdentityCount = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_SampleIdentityCount); + CompleteStructMemberSeq member_seq_SampleIdentityCount; + { + TypeIdentifierPair type_ids_sample_id; + ReturnCode_t return_code_sample_id {eprosima::fastdds::dds::RETCODE_OK}; + return_code_sample_id = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::SampleIdentity_s", type_ids_sample_id); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_sample_id) + { + eprosima::fastdds::statistics::detail::register_SampleIdentity_s_type_identifier(type_ids_sample_id); + } + StructMemberFlag member_flags_sample_id = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_sample_id = 0x00000000; + bool common_sample_id_ec {false}; + CommonStructMember common_sample_id {TypeObjectUtils::build_common_struct_member(member_id_sample_id, member_flags_sample_id, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_sample_id, common_sample_id_ec))}; + if (!common_sample_id_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure sample_id member TypeIdentifier inconsistent."); + return; + } + MemberName name_sample_id = "sample_id"; + eprosima::fastcdr::optional member_ann_builtin_sample_id; + ann_custom_SampleIdentityCount.reset(); + AppliedAnnotationSeq tmp_ann_custom_sample_id; + eprosima::fastcdr::optional unit_sample_id; + eprosima::fastcdr::optional min_sample_id; + eprosima::fastcdr::optional max_sample_id; + eprosima::fastcdr::optional hash_id_sample_id; + if (unit_sample_id.has_value() || min_sample_id.has_value() || max_sample_id.has_value() || hash_id_sample_id.has_value()) + { + member_ann_builtin_sample_id = TypeObjectUtils::build_applied_builtin_member_annotations(unit_sample_id, min_sample_id, max_sample_id, hash_id_sample_id); + } + if (!tmp_ann_custom_sample_id.empty()) + { + ann_custom_SampleIdentityCount = tmp_ann_custom_sample_id; + } + CompleteMemberDetail detail_sample_id = TypeObjectUtils::build_complete_member_detail(name_sample_id, member_ann_builtin_sample_id, ann_custom_SampleIdentityCount); + CompleteStructMember member_sample_id = TypeObjectUtils::build_complete_struct_member(common_sample_id, detail_sample_id); + TypeObjectUtils::add_complete_struct_member(member_seq_SampleIdentityCount, member_sample_id); + } + { + TypeIdentifierPair type_ids_count; + ReturnCode_t return_code_count {eprosima::fastdds::dds::RETCODE_OK}; + return_code_count = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint64_t", type_ids_count); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_count) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "count Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_count = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_count = 0x00000001; + bool common_count_ec {false}; + CommonStructMember common_count {TypeObjectUtils::build_common_struct_member(member_id_count, member_flags_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_count, common_count_ec))}; + if (!common_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure count member TypeIdentifier inconsistent."); + return; + } + MemberName name_count = "count"; + eprosima::fastcdr::optional member_ann_builtin_count; + ann_custom_SampleIdentityCount.reset(); + CompleteMemberDetail detail_count = TypeObjectUtils::build_complete_member_detail(name_count, member_ann_builtin_count, ann_custom_SampleIdentityCount); + CompleteStructMember member_count = TypeObjectUtils::build_complete_struct_member(common_count, detail_count); + TypeObjectUtils::add_complete_struct_member(member_seq_SampleIdentityCount, member_count); + } + CompleteStructType struct_type_SampleIdentityCount = TypeObjectUtils::build_complete_struct_type(struct_flags_SampleIdentityCount, header_SampleIdentityCount, member_seq_SampleIdentityCount); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_SampleIdentityCount, type_name_SampleIdentityCount.to_string(), type_ids_SampleIdentityCount)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::SampleIdentityCount already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_Entity2LocatorTraffic_type_identifier( + TypeIdentifierPair& type_ids_Entity2LocatorTraffic) +{ + + ReturnCode_t return_code_Entity2LocatorTraffic {eprosima::fastdds::dds::RETCODE_OK}; + return_code_Entity2LocatorTraffic = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::Entity2LocatorTraffic", type_ids_Entity2LocatorTraffic); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Entity2LocatorTraffic) + { + StructTypeFlag struct_flags_Entity2LocatorTraffic = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_Entity2LocatorTraffic = "eprosima::fastdds::statistics::Entity2LocatorTraffic"; + eprosima::fastcdr::optional type_ann_builtin_Entity2LocatorTraffic; + eprosima::fastcdr::optional ann_custom_Entity2LocatorTraffic; + CompleteTypeDetail detail_Entity2LocatorTraffic = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Entity2LocatorTraffic, ann_custom_Entity2LocatorTraffic, type_name_Entity2LocatorTraffic.to_string()); + CompleteStructHeader header_Entity2LocatorTraffic; + header_Entity2LocatorTraffic = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Entity2LocatorTraffic); + CompleteStructMemberSeq member_seq_Entity2LocatorTraffic; + { + TypeIdentifierPair type_ids_src_guid; + ReturnCode_t return_code_src_guid {eprosima::fastdds::dds::RETCODE_OK}; + return_code_src_guid = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_src_guid); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_src_guid) + { + eprosima::fastdds::statistics::detail::register_GUID_s_type_identifier(type_ids_src_guid); + } + StructMemberFlag member_flags_src_guid = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_src_guid = 0x00000000; + bool common_src_guid_ec {false}; + CommonStructMember common_src_guid {TypeObjectUtils::build_common_struct_member(member_id_src_guid, member_flags_src_guid, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_src_guid, common_src_guid_ec))}; + if (!common_src_guid_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure src_guid member TypeIdentifier inconsistent."); + return; + } + MemberName name_src_guid = "src_guid"; + eprosima::fastcdr::optional member_ann_builtin_src_guid; + ann_custom_Entity2LocatorTraffic.reset(); + AppliedAnnotationSeq tmp_ann_custom_src_guid; + eprosima::fastcdr::optional unit_src_guid; + eprosima::fastcdr::optional min_src_guid; + eprosima::fastcdr::optional max_src_guid; + eprosima::fastcdr::optional hash_id_src_guid; + if (unit_src_guid.has_value() || min_src_guid.has_value() || max_src_guid.has_value() || hash_id_src_guid.has_value()) + { + member_ann_builtin_src_guid = TypeObjectUtils::build_applied_builtin_member_annotations(unit_src_guid, min_src_guid, max_src_guid, hash_id_src_guid); + } + if (!tmp_ann_custom_src_guid.empty()) + { + ann_custom_Entity2LocatorTraffic = tmp_ann_custom_src_guid; + } + CompleteMemberDetail detail_src_guid = TypeObjectUtils::build_complete_member_detail(name_src_guid, member_ann_builtin_src_guid, ann_custom_Entity2LocatorTraffic); + CompleteStructMember member_src_guid = TypeObjectUtils::build_complete_struct_member(common_src_guid, detail_src_guid); + TypeObjectUtils::add_complete_struct_member(member_seq_Entity2LocatorTraffic, member_src_guid); + } + { + TypeIdentifierPair type_ids_dst_locator; + ReturnCode_t return_code_dst_locator {eprosima::fastdds::dds::RETCODE_OK}; + return_code_dst_locator = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::Locator_s", type_ids_dst_locator); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_dst_locator) + { + eprosima::fastdds::statistics::detail::register_Locator_s_type_identifier(type_ids_dst_locator); + } + StructMemberFlag member_flags_dst_locator = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_dst_locator = 0x00000001; + bool common_dst_locator_ec {false}; + CommonStructMember common_dst_locator {TypeObjectUtils::build_common_struct_member(member_id_dst_locator, member_flags_dst_locator, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_dst_locator, common_dst_locator_ec))}; + if (!common_dst_locator_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure dst_locator member TypeIdentifier inconsistent."); + return; + } + MemberName name_dst_locator = "dst_locator"; + eprosima::fastcdr::optional member_ann_builtin_dst_locator; + ann_custom_Entity2LocatorTraffic.reset(); + AppliedAnnotationSeq tmp_ann_custom_dst_locator; + eprosima::fastcdr::optional unit_dst_locator; + eprosima::fastcdr::optional min_dst_locator; + eprosima::fastcdr::optional max_dst_locator; + eprosima::fastcdr::optional hash_id_dst_locator; + if (unit_dst_locator.has_value() || min_dst_locator.has_value() || max_dst_locator.has_value() || hash_id_dst_locator.has_value()) + { + member_ann_builtin_dst_locator = TypeObjectUtils::build_applied_builtin_member_annotations(unit_dst_locator, min_dst_locator, max_dst_locator, hash_id_dst_locator); + } + if (!tmp_ann_custom_dst_locator.empty()) + { + ann_custom_Entity2LocatorTraffic = tmp_ann_custom_dst_locator; + } + CompleteMemberDetail detail_dst_locator = TypeObjectUtils::build_complete_member_detail(name_dst_locator, member_ann_builtin_dst_locator, ann_custom_Entity2LocatorTraffic); + CompleteStructMember member_dst_locator = TypeObjectUtils::build_complete_struct_member(common_dst_locator, detail_dst_locator); + TypeObjectUtils::add_complete_struct_member(member_seq_Entity2LocatorTraffic, member_dst_locator); + } + { + TypeIdentifierPair type_ids_packet_count; + ReturnCode_t return_code_packet_count {eprosima::fastdds::dds::RETCODE_OK}; + return_code_packet_count = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint64_t", type_ids_packet_count); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_packet_count) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "packet_count Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_packet_count = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_packet_count = 0x00000002; + bool common_packet_count_ec {false}; + CommonStructMember common_packet_count {TypeObjectUtils::build_common_struct_member(member_id_packet_count, member_flags_packet_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_packet_count, common_packet_count_ec))}; + if (!common_packet_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure packet_count member TypeIdentifier inconsistent."); + return; + } + MemberName name_packet_count = "packet_count"; + eprosima::fastcdr::optional member_ann_builtin_packet_count; + ann_custom_Entity2LocatorTraffic.reset(); + CompleteMemberDetail detail_packet_count = TypeObjectUtils::build_complete_member_detail(name_packet_count, member_ann_builtin_packet_count, ann_custom_Entity2LocatorTraffic); + CompleteStructMember member_packet_count = TypeObjectUtils::build_complete_struct_member(common_packet_count, detail_packet_count); + TypeObjectUtils::add_complete_struct_member(member_seq_Entity2LocatorTraffic, member_packet_count); + } + { + TypeIdentifierPair type_ids_byte_count; + ReturnCode_t return_code_byte_count {eprosima::fastdds::dds::RETCODE_OK}; + return_code_byte_count = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint64_t", type_ids_byte_count); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_byte_count) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "byte_count Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_byte_count = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_byte_count = 0x00000003; + bool common_byte_count_ec {false}; + CommonStructMember common_byte_count {TypeObjectUtils::build_common_struct_member(member_id_byte_count, member_flags_byte_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_byte_count, common_byte_count_ec))}; + if (!common_byte_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure byte_count member TypeIdentifier inconsistent."); + return; + } + MemberName name_byte_count = "byte_count"; + eprosima::fastcdr::optional member_ann_builtin_byte_count; + ann_custom_Entity2LocatorTraffic.reset(); + CompleteMemberDetail detail_byte_count = TypeObjectUtils::build_complete_member_detail(name_byte_count, member_ann_builtin_byte_count, ann_custom_Entity2LocatorTraffic); + CompleteStructMember member_byte_count = TypeObjectUtils::build_complete_struct_member(common_byte_count, detail_byte_count); + TypeObjectUtils::add_complete_struct_member(member_seq_Entity2LocatorTraffic, member_byte_count); + } + { + TypeIdentifierPair type_ids_byte_magnitude_order; + ReturnCode_t return_code_byte_magnitude_order {eprosima::fastdds::dds::RETCODE_OK}; + return_code_byte_magnitude_order = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_int16_t", type_ids_byte_magnitude_order); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_byte_magnitude_order) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "byte_magnitude_order Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_byte_magnitude_order = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_byte_magnitude_order = 0x00000004; + bool common_byte_magnitude_order_ec {false}; + CommonStructMember common_byte_magnitude_order {TypeObjectUtils::build_common_struct_member(member_id_byte_magnitude_order, member_flags_byte_magnitude_order, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_byte_magnitude_order, common_byte_magnitude_order_ec))}; + if (!common_byte_magnitude_order_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure byte_magnitude_order member TypeIdentifier inconsistent."); + return; + } + MemberName name_byte_magnitude_order = "byte_magnitude_order"; + eprosima::fastcdr::optional member_ann_builtin_byte_magnitude_order; + ann_custom_Entity2LocatorTraffic.reset(); + CompleteMemberDetail detail_byte_magnitude_order = TypeObjectUtils::build_complete_member_detail(name_byte_magnitude_order, member_ann_builtin_byte_magnitude_order, ann_custom_Entity2LocatorTraffic); + CompleteStructMember member_byte_magnitude_order = TypeObjectUtils::build_complete_struct_member(common_byte_magnitude_order, detail_byte_magnitude_order); + TypeObjectUtils::add_complete_struct_member(member_seq_Entity2LocatorTraffic, member_byte_magnitude_order); + } + CompleteStructType struct_type_Entity2LocatorTraffic = TypeObjectUtils::build_complete_struct_type(struct_flags_Entity2LocatorTraffic, header_Entity2LocatorTraffic, member_seq_Entity2LocatorTraffic); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_Entity2LocatorTraffic, type_name_Entity2LocatorTraffic.to_string(), type_ids_Entity2LocatorTraffic)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::Entity2LocatorTraffic already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_WriterReaderData_type_identifier( + TypeIdentifierPair& type_ids_WriterReaderData) +{ + + ReturnCode_t return_code_WriterReaderData {eprosima::fastdds::dds::RETCODE_OK}; + return_code_WriterReaderData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::WriterReaderData", type_ids_WriterReaderData); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_WriterReaderData) + { + StructTypeFlag struct_flags_WriterReaderData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_WriterReaderData = "eprosima::fastdds::statistics::WriterReaderData"; + eprosima::fastcdr::optional type_ann_builtin_WriterReaderData; + eprosima::fastcdr::optional ann_custom_WriterReaderData; + CompleteTypeDetail detail_WriterReaderData = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_WriterReaderData, ann_custom_WriterReaderData, type_name_WriterReaderData.to_string()); + CompleteStructHeader header_WriterReaderData; + header_WriterReaderData = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_WriterReaderData); + CompleteStructMemberSeq member_seq_WriterReaderData; + { + TypeIdentifierPair type_ids_writer_guid; + ReturnCode_t return_code_writer_guid {eprosima::fastdds::dds::RETCODE_OK}; + return_code_writer_guid = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_writer_guid); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_writer_guid) + { + eprosima::fastdds::statistics::detail::register_GUID_s_type_identifier(type_ids_writer_guid); + } + StructMemberFlag member_flags_writer_guid = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_writer_guid = 0x00000000; + bool common_writer_guid_ec {false}; + CommonStructMember common_writer_guid {TypeObjectUtils::build_common_struct_member(member_id_writer_guid, member_flags_writer_guid, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_writer_guid, common_writer_guid_ec))}; + if (!common_writer_guid_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure writer_guid member TypeIdentifier inconsistent."); + return; + } + MemberName name_writer_guid = "writer_guid"; + eprosima::fastcdr::optional member_ann_builtin_writer_guid; + ann_custom_WriterReaderData.reset(); + AppliedAnnotationSeq tmp_ann_custom_writer_guid; + eprosima::fastcdr::optional unit_writer_guid; + eprosima::fastcdr::optional min_writer_guid; + eprosima::fastcdr::optional max_writer_guid; + eprosima::fastcdr::optional hash_id_writer_guid; + if (unit_writer_guid.has_value() || min_writer_guid.has_value() || max_writer_guid.has_value() || hash_id_writer_guid.has_value()) + { + member_ann_builtin_writer_guid = TypeObjectUtils::build_applied_builtin_member_annotations(unit_writer_guid, min_writer_guid, max_writer_guid, hash_id_writer_guid); + } + if (!tmp_ann_custom_writer_guid.empty()) + { + ann_custom_WriterReaderData = tmp_ann_custom_writer_guid; + } + CompleteMemberDetail detail_writer_guid = TypeObjectUtils::build_complete_member_detail(name_writer_guid, member_ann_builtin_writer_guid, ann_custom_WriterReaderData); + CompleteStructMember member_writer_guid = TypeObjectUtils::build_complete_struct_member(common_writer_guid, detail_writer_guid); + TypeObjectUtils::add_complete_struct_member(member_seq_WriterReaderData, member_writer_guid); + } + { + TypeIdentifierPair type_ids_reader_guid; + ReturnCode_t return_code_reader_guid {eprosima::fastdds::dds::RETCODE_OK}; + return_code_reader_guid = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_reader_guid); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_reader_guid) + { + eprosima::fastdds::statistics::detail::register_GUID_s_type_identifier(type_ids_reader_guid); + } + StructMemberFlag member_flags_reader_guid = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_reader_guid = 0x00000001; + bool common_reader_guid_ec {false}; + CommonStructMember common_reader_guid {TypeObjectUtils::build_common_struct_member(member_id_reader_guid, member_flags_reader_guid, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_reader_guid, common_reader_guid_ec))}; + if (!common_reader_guid_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure reader_guid member TypeIdentifier inconsistent."); + return; + } + MemberName name_reader_guid = "reader_guid"; + eprosima::fastcdr::optional member_ann_builtin_reader_guid; + ann_custom_WriterReaderData.reset(); + AppliedAnnotationSeq tmp_ann_custom_reader_guid; + eprosima::fastcdr::optional unit_reader_guid; + eprosima::fastcdr::optional min_reader_guid; + eprosima::fastcdr::optional max_reader_guid; + eprosima::fastcdr::optional hash_id_reader_guid; + if (unit_reader_guid.has_value() || min_reader_guid.has_value() || max_reader_guid.has_value() || hash_id_reader_guid.has_value()) + { + member_ann_builtin_reader_guid = TypeObjectUtils::build_applied_builtin_member_annotations(unit_reader_guid, min_reader_guid, max_reader_guid, hash_id_reader_guid); + } + if (!tmp_ann_custom_reader_guid.empty()) + { + ann_custom_WriterReaderData = tmp_ann_custom_reader_guid; + } + CompleteMemberDetail detail_reader_guid = TypeObjectUtils::build_complete_member_detail(name_reader_guid, member_ann_builtin_reader_guid, ann_custom_WriterReaderData); + CompleteStructMember member_reader_guid = TypeObjectUtils::build_complete_struct_member(common_reader_guid, detail_reader_guid); + TypeObjectUtils::add_complete_struct_member(member_seq_WriterReaderData, member_reader_guid); + } + { + TypeIdentifierPair type_ids_data; + ReturnCode_t return_code_data {eprosima::fastdds::dds::RETCODE_OK}; + return_code_data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_float", type_ids_data); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_data) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "data Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_data = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_data = 0x00000002; + bool common_data_ec {false}; + CommonStructMember common_data {TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_data, common_data_ec))}; + if (!common_data_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure data member TypeIdentifier inconsistent."); + return; + } + MemberName name_data = "data"; + eprosima::fastcdr::optional member_ann_builtin_data; + ann_custom_WriterReaderData.reset(); + CompleteMemberDetail detail_data = TypeObjectUtils::build_complete_member_detail(name_data, member_ann_builtin_data, ann_custom_WriterReaderData); + CompleteStructMember member_data = TypeObjectUtils::build_complete_struct_member(common_data, detail_data); + TypeObjectUtils::add_complete_struct_member(member_seq_WriterReaderData, member_data); + } + CompleteStructType struct_type_WriterReaderData = TypeObjectUtils::build_complete_struct_type(struct_flags_WriterReaderData, header_WriterReaderData, member_seq_WriterReaderData); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_WriterReaderData, type_name_WriterReaderData.to_string(), type_ids_WriterReaderData)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::WriterReaderData already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_Locator2LocatorData_type_identifier( + TypeIdentifierPair& type_ids_Locator2LocatorData) +{ + + ReturnCode_t return_code_Locator2LocatorData {eprosima::fastdds::dds::RETCODE_OK}; + return_code_Locator2LocatorData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::Locator2LocatorData", type_ids_Locator2LocatorData); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Locator2LocatorData) + { + StructTypeFlag struct_flags_Locator2LocatorData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_Locator2LocatorData = "eprosima::fastdds::statistics::Locator2LocatorData"; + eprosima::fastcdr::optional type_ann_builtin_Locator2LocatorData; + eprosima::fastcdr::optional ann_custom_Locator2LocatorData; + CompleteTypeDetail detail_Locator2LocatorData = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Locator2LocatorData, ann_custom_Locator2LocatorData, type_name_Locator2LocatorData.to_string()); + CompleteStructHeader header_Locator2LocatorData; + header_Locator2LocatorData = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Locator2LocatorData); + CompleteStructMemberSeq member_seq_Locator2LocatorData; + { + TypeIdentifierPair type_ids_src_locator; + ReturnCode_t return_code_src_locator {eprosima::fastdds::dds::RETCODE_OK}; + return_code_src_locator = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::Locator_s", type_ids_src_locator); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_src_locator) + { + eprosima::fastdds::statistics::detail::register_Locator_s_type_identifier(type_ids_src_locator); + } + StructMemberFlag member_flags_src_locator = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_src_locator = 0x00000000; + bool common_src_locator_ec {false}; + CommonStructMember common_src_locator {TypeObjectUtils::build_common_struct_member(member_id_src_locator, member_flags_src_locator, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_src_locator, common_src_locator_ec))}; + if (!common_src_locator_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure src_locator member TypeIdentifier inconsistent."); + return; + } + MemberName name_src_locator = "src_locator"; + eprosima::fastcdr::optional member_ann_builtin_src_locator; + ann_custom_Locator2LocatorData.reset(); + AppliedAnnotationSeq tmp_ann_custom_src_locator; + eprosima::fastcdr::optional unit_src_locator; + eprosima::fastcdr::optional min_src_locator; + eprosima::fastcdr::optional max_src_locator; + eprosima::fastcdr::optional hash_id_src_locator; + if (unit_src_locator.has_value() || min_src_locator.has_value() || max_src_locator.has_value() || hash_id_src_locator.has_value()) + { + member_ann_builtin_src_locator = TypeObjectUtils::build_applied_builtin_member_annotations(unit_src_locator, min_src_locator, max_src_locator, hash_id_src_locator); + } + if (!tmp_ann_custom_src_locator.empty()) + { + ann_custom_Locator2LocatorData = tmp_ann_custom_src_locator; + } + CompleteMemberDetail detail_src_locator = TypeObjectUtils::build_complete_member_detail(name_src_locator, member_ann_builtin_src_locator, ann_custom_Locator2LocatorData); + CompleteStructMember member_src_locator = TypeObjectUtils::build_complete_struct_member(common_src_locator, detail_src_locator); + TypeObjectUtils::add_complete_struct_member(member_seq_Locator2LocatorData, member_src_locator); + } + { + TypeIdentifierPair type_ids_dst_locator; + ReturnCode_t return_code_dst_locator {eprosima::fastdds::dds::RETCODE_OK}; + return_code_dst_locator = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::Locator_s", type_ids_dst_locator); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_dst_locator) + { + eprosima::fastdds::statistics::detail::register_Locator_s_type_identifier(type_ids_dst_locator); + } + StructMemberFlag member_flags_dst_locator = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_dst_locator = 0x00000001; + bool common_dst_locator_ec {false}; + CommonStructMember common_dst_locator {TypeObjectUtils::build_common_struct_member(member_id_dst_locator, member_flags_dst_locator, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_dst_locator, common_dst_locator_ec))}; + if (!common_dst_locator_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure dst_locator member TypeIdentifier inconsistent."); + return; + } + MemberName name_dst_locator = "dst_locator"; + eprosima::fastcdr::optional member_ann_builtin_dst_locator; + ann_custom_Locator2LocatorData.reset(); + AppliedAnnotationSeq tmp_ann_custom_dst_locator; + eprosima::fastcdr::optional unit_dst_locator; + eprosima::fastcdr::optional min_dst_locator; + eprosima::fastcdr::optional max_dst_locator; + eprosima::fastcdr::optional hash_id_dst_locator; + if (unit_dst_locator.has_value() || min_dst_locator.has_value() || max_dst_locator.has_value() || hash_id_dst_locator.has_value()) + { + member_ann_builtin_dst_locator = TypeObjectUtils::build_applied_builtin_member_annotations(unit_dst_locator, min_dst_locator, max_dst_locator, hash_id_dst_locator); + } + if (!tmp_ann_custom_dst_locator.empty()) + { + ann_custom_Locator2LocatorData = tmp_ann_custom_dst_locator; + } + CompleteMemberDetail detail_dst_locator = TypeObjectUtils::build_complete_member_detail(name_dst_locator, member_ann_builtin_dst_locator, ann_custom_Locator2LocatorData); + CompleteStructMember member_dst_locator = TypeObjectUtils::build_complete_struct_member(common_dst_locator, detail_dst_locator); + TypeObjectUtils::add_complete_struct_member(member_seq_Locator2LocatorData, member_dst_locator); + } + { + TypeIdentifierPair type_ids_data; + ReturnCode_t return_code_data {eprosima::fastdds::dds::RETCODE_OK}; + return_code_data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_float", type_ids_data); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_data) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "data Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_data = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_data = 0x00000002; + bool common_data_ec {false}; + CommonStructMember common_data {TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_data, common_data_ec))}; + if (!common_data_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure data member TypeIdentifier inconsistent."); + return; + } + MemberName name_data = "data"; + eprosima::fastcdr::optional member_ann_builtin_data; + ann_custom_Locator2LocatorData.reset(); + CompleteMemberDetail detail_data = TypeObjectUtils::build_complete_member_detail(name_data, member_ann_builtin_data, ann_custom_Locator2LocatorData); + CompleteStructMember member_data = TypeObjectUtils::build_complete_struct_member(common_data, detail_data); + TypeObjectUtils::add_complete_struct_member(member_seq_Locator2LocatorData, member_data); + } + CompleteStructType struct_type_Locator2LocatorData = TypeObjectUtils::build_complete_struct_type(struct_flags_Locator2LocatorData, header_Locator2LocatorData, member_seq_Locator2LocatorData); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_Locator2LocatorData, type_name_Locator2LocatorData.to_string(), type_ids_Locator2LocatorData)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::Locator2LocatorData already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_EntityData_type_identifier( + TypeIdentifierPair& type_ids_EntityData) +{ + + ReturnCode_t return_code_EntityData {eprosima::fastdds::dds::RETCODE_OK}; + return_code_EntityData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::EntityData", type_ids_EntityData); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_EntityData) + { + StructTypeFlag struct_flags_EntityData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_EntityData = "eprosima::fastdds::statistics::EntityData"; + eprosima::fastcdr::optional type_ann_builtin_EntityData; + eprosima::fastcdr::optional ann_custom_EntityData; + CompleteTypeDetail detail_EntityData = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_EntityData, ann_custom_EntityData, type_name_EntityData.to_string()); + CompleteStructHeader header_EntityData; + header_EntityData = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_EntityData); + CompleteStructMemberSeq member_seq_EntityData; + { + TypeIdentifierPair type_ids_guid; + ReturnCode_t return_code_guid {eprosima::fastdds::dds::RETCODE_OK}; + return_code_guid = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_guid); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_guid) + { + eprosima::fastdds::statistics::detail::register_GUID_s_type_identifier(type_ids_guid); + } + StructMemberFlag member_flags_guid = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_guid = 0x00000000; + bool common_guid_ec {false}; + CommonStructMember common_guid {TypeObjectUtils::build_common_struct_member(member_id_guid, member_flags_guid, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_guid, common_guid_ec))}; + if (!common_guid_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure guid member TypeIdentifier inconsistent."); + return; + } + MemberName name_guid = "guid"; + eprosima::fastcdr::optional member_ann_builtin_guid; + ann_custom_EntityData.reset(); + AppliedAnnotationSeq tmp_ann_custom_guid; + eprosima::fastcdr::optional unit_guid; + eprosima::fastcdr::optional min_guid; + eprosima::fastcdr::optional max_guid; + eprosima::fastcdr::optional hash_id_guid; + if (unit_guid.has_value() || min_guid.has_value() || max_guid.has_value() || hash_id_guid.has_value()) + { + member_ann_builtin_guid = TypeObjectUtils::build_applied_builtin_member_annotations(unit_guid, min_guid, max_guid, hash_id_guid); + } + if (!tmp_ann_custom_guid.empty()) + { + ann_custom_EntityData = tmp_ann_custom_guid; + } + CompleteMemberDetail detail_guid = TypeObjectUtils::build_complete_member_detail(name_guid, member_ann_builtin_guid, ann_custom_EntityData); + CompleteStructMember member_guid = TypeObjectUtils::build_complete_struct_member(common_guid, detail_guid); + TypeObjectUtils::add_complete_struct_member(member_seq_EntityData, member_guid); + } + { + TypeIdentifierPair type_ids_data; + ReturnCode_t return_code_data {eprosima::fastdds::dds::RETCODE_OK}; + return_code_data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_float", type_ids_data); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_data) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "data Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_data = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_data = 0x00000001; + bool common_data_ec {false}; + CommonStructMember common_data {TypeObjectUtils::build_common_struct_member(member_id_data, member_flags_data, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_data, common_data_ec))}; + if (!common_data_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure data member TypeIdentifier inconsistent."); + return; + } + MemberName name_data = "data"; + eprosima::fastcdr::optional member_ann_builtin_data; + ann_custom_EntityData.reset(); + CompleteMemberDetail detail_data = TypeObjectUtils::build_complete_member_detail(name_data, member_ann_builtin_data, ann_custom_EntityData); + CompleteStructMember member_data = TypeObjectUtils::build_complete_struct_member(common_data, detail_data); + TypeObjectUtils::add_complete_struct_member(member_seq_EntityData, member_data); + } + CompleteStructType struct_type_EntityData = TypeObjectUtils::build_complete_struct_type(struct_flags_EntityData, header_EntityData, member_seq_EntityData); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_EntityData, type_name_EntityData.to_string(), type_ids_EntityData)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::EntityData already registered in TypeObjectRegistry for a different type."); + } + } +} +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_PhysicalData_type_identifier( + TypeIdentifierPair& type_ids_PhysicalData) +{ + + ReturnCode_t return_code_PhysicalData {eprosima::fastdds::dds::RETCODE_OK}; + return_code_PhysicalData = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::PhysicalData", type_ids_PhysicalData); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_PhysicalData) + { + StructTypeFlag struct_flags_PhysicalData = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_PhysicalData = "eprosima::fastdds::statistics::PhysicalData"; + eprosima::fastcdr::optional type_ann_builtin_PhysicalData; + eprosima::fastcdr::optional ann_custom_PhysicalData; + CompleteTypeDetail detail_PhysicalData = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_PhysicalData, ann_custom_PhysicalData, type_name_PhysicalData.to_string()); + CompleteStructHeader header_PhysicalData; + header_PhysicalData = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_PhysicalData); + CompleteStructMemberSeq member_seq_PhysicalData; + { + TypeIdentifierPair type_ids_participant_guid; + ReturnCode_t return_code_participant_guid {eprosima::fastdds::dds::RETCODE_OK}; + return_code_participant_guid = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::detail::GUID_s", type_ids_participant_guid); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_participant_guid) + { + eprosima::fastdds::statistics::detail::register_GUID_s_type_identifier(type_ids_participant_guid); + } + StructMemberFlag member_flags_participant_guid = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, true, false); + MemberId member_id_participant_guid = 0x00000000; + bool common_participant_guid_ec {false}; + CommonStructMember common_participant_guid {TypeObjectUtils::build_common_struct_member(member_id_participant_guid, member_flags_participant_guid, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_participant_guid, common_participant_guid_ec))}; + if (!common_participant_guid_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure participant_guid member TypeIdentifier inconsistent."); + return; + } + MemberName name_participant_guid = "participant_guid"; + eprosima::fastcdr::optional member_ann_builtin_participant_guid; + ann_custom_PhysicalData.reset(); + AppliedAnnotationSeq tmp_ann_custom_participant_guid; + eprosima::fastcdr::optional unit_participant_guid; + eprosima::fastcdr::optional min_participant_guid; + eprosima::fastcdr::optional max_participant_guid; + eprosima::fastcdr::optional hash_id_participant_guid; + if (unit_participant_guid.has_value() || min_participant_guid.has_value() || max_participant_guid.has_value() || hash_id_participant_guid.has_value()) + { + member_ann_builtin_participant_guid = TypeObjectUtils::build_applied_builtin_member_annotations(unit_participant_guid, min_participant_guid, max_participant_guid, hash_id_participant_guid); + } + if (!tmp_ann_custom_participant_guid.empty()) + { + ann_custom_PhysicalData = tmp_ann_custom_participant_guid; + } + CompleteMemberDetail detail_participant_guid = TypeObjectUtils::build_complete_member_detail(name_participant_guid, member_ann_builtin_participant_guid, ann_custom_PhysicalData); + CompleteStructMember member_participant_guid = TypeObjectUtils::build_complete_struct_member(common_participant_guid, detail_participant_guid); + TypeObjectUtils::add_complete_struct_member(member_seq_PhysicalData, member_participant_guid); + } + { + TypeIdentifierPair type_ids_host; + ReturnCode_t return_code_host {eprosima::fastdds::dds::RETCODE_OK}; + return_code_host = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_host); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_host) + { + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded", type_ids_host)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_host = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_host = 0x00000001; + bool common_host_ec {false}; + CommonStructMember common_host {TypeObjectUtils::build_common_struct_member(member_id_host, member_flags_host, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_host, common_host_ec))}; + if (!common_host_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure host member TypeIdentifier inconsistent."); + return; + } + MemberName name_host = "host"; + eprosima::fastcdr::optional member_ann_builtin_host; + ann_custom_PhysicalData.reset(); + CompleteMemberDetail detail_host = TypeObjectUtils::build_complete_member_detail(name_host, member_ann_builtin_host, ann_custom_PhysicalData); + CompleteStructMember member_host = TypeObjectUtils::build_complete_struct_member(common_host, detail_host); + TypeObjectUtils::add_complete_struct_member(member_seq_PhysicalData, member_host); + } + { + TypeIdentifierPair type_ids_user; + ReturnCode_t return_code_user {eprosima::fastdds::dds::RETCODE_OK}; + return_code_user = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_user); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_user) + { + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded", type_ids_user)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_user = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_user = 0x00000002; + bool common_user_ec {false}; + CommonStructMember common_user {TypeObjectUtils::build_common_struct_member(member_id_user, member_flags_user, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_user, common_user_ec))}; + if (!common_user_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure user member TypeIdentifier inconsistent."); + return; + } + MemberName name_user = "user"; + eprosima::fastcdr::optional member_ann_builtin_user; + ann_custom_PhysicalData.reset(); + CompleteMemberDetail detail_user = TypeObjectUtils::build_complete_member_detail(name_user, member_ann_builtin_user, ann_custom_PhysicalData); + CompleteStructMember member_user = TypeObjectUtils::build_complete_struct_member(common_user, detail_user); + TypeObjectUtils::add_complete_struct_member(member_seq_PhysicalData, member_user); + } + { + TypeIdentifierPair type_ids_process; + ReturnCode_t return_code_process {eprosima::fastdds::dds::RETCODE_OK}; + return_code_process = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_process); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_process) + { + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded", type_ids_process)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_process = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_process = 0x00000003; + bool common_process_ec {false}; + CommonStructMember common_process {TypeObjectUtils::build_common_struct_member(member_id_process, member_flags_process, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_process, common_process_ec))}; + if (!common_process_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure process member TypeIdentifier inconsistent."); + return; + } + MemberName name_process = "process"; + eprosima::fastcdr::optional member_ann_builtin_process; + ann_custom_PhysicalData.reset(); + CompleteMemberDetail detail_process = TypeObjectUtils::build_complete_member_detail(name_process, member_ann_builtin_process, ann_custom_PhysicalData); + CompleteStructMember member_process = TypeObjectUtils::build_complete_struct_member(common_process, detail_process); + TypeObjectUtils::add_complete_struct_member(member_seq_PhysicalData, member_process); + } + CompleteStructType struct_type_PhysicalData = TypeObjectUtils::build_complete_struct_type(struct_flags_PhysicalData, header_PhysicalData, member_seq_PhysicalData); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_PhysicalData, type_name_PhysicalData.to_string(), type_ids_PhysicalData)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::PhysicalData already registered in TypeObjectRegistry for a different type."); + } + } +} +namespace EventKind { +} // namespace EventKind +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_Data_type_identifier( + TypeIdentifierPair& type_ids_Data) +{ + ReturnCode_t return_code_Data {eprosima::fastdds::dds::RETCODE_OK}; + return_code_Data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::Data", type_ids_Data); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Data) + { + UnionTypeFlag union_flags_Data = TypeObjectUtils::build_union_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_Data = "eprosima::fastdds::statistics::Data"; + eprosima::fastcdr::optional type_ann_builtin_Data; + eprosima::fastcdr::optional ann_custom_Data; + CompleteTypeDetail detail_Data = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Data, ann_custom_Data, type_name_Data.to_string()); + CompleteUnionHeader header_Data = TypeObjectUtils::build_complete_union_header(detail_Data); + UnionDiscriminatorFlag member_flags_Data = TypeObjectUtils::build_union_discriminator_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false); + return_code_Data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_Data); + + if (return_code_Data != eprosima::fastdds::dds::RETCODE_OK) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Union discriminator TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + CommonDiscriminatorMember common_Data; + if (EK_COMPLETE == type_ids_Data.type_identifier1()._d() || TK_NONE == type_ids_Data.type_identifier2()._d()) + { + common_Data = TypeObjectUtils::build_common_discriminator_member(member_flags_Data, type_ids_Data.type_identifier1()); + } + else if (EK_COMPLETE == type_ids_Data.type_identifier2()._d()) + { + common_Data = TypeObjectUtils::build_common_discriminator_member(member_flags_Data, type_ids_Data.type_identifier2()); + } + else + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::Data discriminator TypeIdentifier inconsistent."); + return; + } + type_ann_builtin_Data.reset(); + ann_custom_Data.reset(); + CompleteDiscriminatorMember discriminator_Data = TypeObjectUtils::build_complete_discriminator_member(common_Data, + type_ann_builtin_Data, ann_custom_Data); + CompleteUnionMemberSeq member_seq_Data; + { + return_code_Data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::WriterReaderData", type_ids_Data); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Data) + { + eprosima::fastdds::statistics::register_WriterReaderData_type_identifier(type_ids_Data); + } + UnionMemberFlag member_flags_writer_reader_data = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_writer_reader_data; + TypeObjectUtils::add_union_case_label(label_seq_writer_reader_data, static_cast(EventKind::HISTORY2HISTORY_LATENCY)); + MemberId member_id_writer_reader_data = 0x00000001; + bool common_writer_reader_data_ec {false}; + CommonUnionMember common_writer_reader_data {TypeObjectUtils::build_common_union_member(member_id_writer_reader_data, + member_flags_writer_reader_data, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_Data, + common_writer_reader_data_ec), label_seq_writer_reader_data)}; + if (!common_writer_reader_data_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union writer_reader_data member TypeIdentifier inconsistent."); + return; + } + MemberName name_writer_reader_data = "writer_reader_data"; + eprosima::fastcdr::optional member_ann_builtin_writer_reader_data; + ann_custom_Data.reset(); + CompleteMemberDetail detail_writer_reader_data = TypeObjectUtils::build_complete_member_detail(name_writer_reader_data, member_ann_builtin_writer_reader_data, ann_custom_Data); + CompleteUnionMember member_writer_reader_data = TypeObjectUtils::build_complete_union_member(common_writer_reader_data, detail_writer_reader_data); + TypeObjectUtils::add_complete_union_member(member_seq_Data, member_writer_reader_data); + } + { + return_code_Data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::Locator2LocatorData", type_ids_Data); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Data) + { + eprosima::fastdds::statistics::register_Locator2LocatorData_type_identifier(type_ids_Data); + } + UnionMemberFlag member_flags_locator2locator_data = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_locator2locator_data; + TypeObjectUtils::add_union_case_label(label_seq_locator2locator_data, static_cast(EventKind::NETWORK_LATENCY)); + MemberId member_id_locator2locator_data = 0x00000002; + bool common_locator2locator_data_ec {false}; + CommonUnionMember common_locator2locator_data {TypeObjectUtils::build_common_union_member(member_id_locator2locator_data, + member_flags_locator2locator_data, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_Data, + common_locator2locator_data_ec), label_seq_locator2locator_data)}; + if (!common_locator2locator_data_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union locator2locator_data member TypeIdentifier inconsistent."); + return; + } + MemberName name_locator2locator_data = "locator2locator_data"; + eprosima::fastcdr::optional member_ann_builtin_locator2locator_data; + ann_custom_Data.reset(); + CompleteMemberDetail detail_locator2locator_data = TypeObjectUtils::build_complete_member_detail(name_locator2locator_data, member_ann_builtin_locator2locator_data, ann_custom_Data); + CompleteUnionMember member_locator2locator_data = TypeObjectUtils::build_complete_union_member(common_locator2locator_data, detail_locator2locator_data); + TypeObjectUtils::add_complete_union_member(member_seq_Data, member_locator2locator_data); + } + { + return_code_Data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::EntityData", type_ids_Data); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Data) + { + eprosima::fastdds::statistics::register_EntityData_type_identifier(type_ids_Data); + } + UnionMemberFlag member_flags_entity_data = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_entity_data; + TypeObjectUtils::add_union_case_label(label_seq_entity_data, static_cast(EventKind::PUBLICATION_THROUGHPUT)); + TypeObjectUtils::add_union_case_label(label_seq_entity_data, static_cast(EventKind::SUBSCRIPTION_THROUGHPUT)); + MemberId member_id_entity_data = 0x00000003; + bool common_entity_data_ec {false}; + CommonUnionMember common_entity_data {TypeObjectUtils::build_common_union_member(member_id_entity_data, + member_flags_entity_data, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_Data, + common_entity_data_ec), label_seq_entity_data)}; + if (!common_entity_data_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union entity_data member TypeIdentifier inconsistent."); + return; + } + MemberName name_entity_data = "entity_data"; + eprosima::fastcdr::optional member_ann_builtin_entity_data; + ann_custom_Data.reset(); + CompleteMemberDetail detail_entity_data = TypeObjectUtils::build_complete_member_detail(name_entity_data, member_ann_builtin_entity_data, ann_custom_Data); + CompleteUnionMember member_entity_data = TypeObjectUtils::build_complete_union_member(common_entity_data, detail_entity_data); + TypeObjectUtils::add_complete_union_member(member_seq_Data, member_entity_data); + } + { + return_code_Data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::Entity2LocatorTraffic", type_ids_Data); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Data) + { + eprosima::fastdds::statistics::register_Entity2LocatorTraffic_type_identifier(type_ids_Data); + } + UnionMemberFlag member_flags_entity2locator_traffic = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_entity2locator_traffic; + TypeObjectUtils::add_union_case_label(label_seq_entity2locator_traffic, static_cast(EventKind::RTPS_SENT)); + TypeObjectUtils::add_union_case_label(label_seq_entity2locator_traffic, static_cast(EventKind::RTPS_LOST)); + MemberId member_id_entity2locator_traffic = 0x00000004; + bool common_entity2locator_traffic_ec {false}; + CommonUnionMember common_entity2locator_traffic {TypeObjectUtils::build_common_union_member(member_id_entity2locator_traffic, + member_flags_entity2locator_traffic, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_Data, + common_entity2locator_traffic_ec), label_seq_entity2locator_traffic)}; + if (!common_entity2locator_traffic_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union entity2locator_traffic member TypeIdentifier inconsistent."); + return; + } + MemberName name_entity2locator_traffic = "entity2locator_traffic"; + eprosima::fastcdr::optional member_ann_builtin_entity2locator_traffic; + ann_custom_Data.reset(); + CompleteMemberDetail detail_entity2locator_traffic = TypeObjectUtils::build_complete_member_detail(name_entity2locator_traffic, member_ann_builtin_entity2locator_traffic, ann_custom_Data); + CompleteUnionMember member_entity2locator_traffic = TypeObjectUtils::build_complete_union_member(common_entity2locator_traffic, detail_entity2locator_traffic); + TypeObjectUtils::add_complete_union_member(member_seq_Data, member_entity2locator_traffic); + } + { + return_code_Data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::EntityCount", type_ids_Data); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Data) + { + eprosima::fastdds::statistics::register_EntityCount_type_identifier(type_ids_Data); + } + UnionMemberFlag member_flags_entity_count = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_entity_count; + TypeObjectUtils::add_union_case_label(label_seq_entity_count, static_cast(EventKind::RESENT_DATAS)); + TypeObjectUtils::add_union_case_label(label_seq_entity_count, static_cast(EventKind::HEARTBEAT_COUNT)); + TypeObjectUtils::add_union_case_label(label_seq_entity_count, static_cast(EventKind::ACKNACK_COUNT)); + TypeObjectUtils::add_union_case_label(label_seq_entity_count, static_cast(EventKind::NACKFRAG_COUNT)); + TypeObjectUtils::add_union_case_label(label_seq_entity_count, static_cast(EventKind::GAP_COUNT)); + TypeObjectUtils::add_union_case_label(label_seq_entity_count, static_cast(EventKind::DATA_COUNT)); + TypeObjectUtils::add_union_case_label(label_seq_entity_count, static_cast(EventKind::PDP_PACKETS)); + TypeObjectUtils::add_union_case_label(label_seq_entity_count, static_cast(EventKind::EDP_PACKETS)); + MemberId member_id_entity_count = 0x00000005; + bool common_entity_count_ec {false}; + CommonUnionMember common_entity_count {TypeObjectUtils::build_common_union_member(member_id_entity_count, + member_flags_entity_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_Data, + common_entity_count_ec), label_seq_entity_count)}; + if (!common_entity_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union entity_count member TypeIdentifier inconsistent."); + return; + } + MemberName name_entity_count = "entity_count"; + eprosima::fastcdr::optional member_ann_builtin_entity_count; + ann_custom_Data.reset(); + CompleteMemberDetail detail_entity_count = TypeObjectUtils::build_complete_member_detail(name_entity_count, member_ann_builtin_entity_count, ann_custom_Data); + CompleteUnionMember member_entity_count = TypeObjectUtils::build_complete_union_member(common_entity_count, detail_entity_count); + TypeObjectUtils::add_complete_union_member(member_seq_Data, member_entity_count); + } + { + return_code_Data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::DiscoveryTime", type_ids_Data); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Data) + { + eprosima::fastdds::statistics::register_DiscoveryTime_type_identifier(type_ids_Data); + } + UnionMemberFlag member_flags_discovery_time = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_discovery_time; + TypeObjectUtils::add_union_case_label(label_seq_discovery_time, static_cast(EventKind::DISCOVERED_ENTITY)); + MemberId member_id_discovery_time = 0x00000006; + bool common_discovery_time_ec {false}; + CommonUnionMember common_discovery_time {TypeObjectUtils::build_common_union_member(member_id_discovery_time, + member_flags_discovery_time, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_Data, + common_discovery_time_ec), label_seq_discovery_time)}; + if (!common_discovery_time_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union discovery_time member TypeIdentifier inconsistent."); + return; + } + MemberName name_discovery_time = "discovery_time"; + eprosima::fastcdr::optional member_ann_builtin_discovery_time; + ann_custom_Data.reset(); + CompleteMemberDetail detail_discovery_time = TypeObjectUtils::build_complete_member_detail(name_discovery_time, member_ann_builtin_discovery_time, ann_custom_Data); + CompleteUnionMember member_discovery_time = TypeObjectUtils::build_complete_union_member(common_discovery_time, detail_discovery_time); + TypeObjectUtils::add_complete_union_member(member_seq_Data, member_discovery_time); + } + { + return_code_Data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::SampleIdentityCount", type_ids_Data); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Data) + { + eprosima::fastdds::statistics::register_SampleIdentityCount_type_identifier(type_ids_Data); + } + UnionMemberFlag member_flags_sample_identity_count = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_sample_identity_count; + TypeObjectUtils::add_union_case_label(label_seq_sample_identity_count, static_cast(EventKind::SAMPLE_DATAS)); + MemberId member_id_sample_identity_count = 0x00000007; + bool common_sample_identity_count_ec {false}; + CommonUnionMember common_sample_identity_count {TypeObjectUtils::build_common_union_member(member_id_sample_identity_count, + member_flags_sample_identity_count, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_Data, + common_sample_identity_count_ec), label_seq_sample_identity_count)}; + if (!common_sample_identity_count_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union sample_identity_count member TypeIdentifier inconsistent."); + return; + } + MemberName name_sample_identity_count = "sample_identity_count"; + eprosima::fastcdr::optional member_ann_builtin_sample_identity_count; + ann_custom_Data.reset(); + CompleteMemberDetail detail_sample_identity_count = TypeObjectUtils::build_complete_member_detail(name_sample_identity_count, member_ann_builtin_sample_identity_count, ann_custom_Data); + CompleteUnionMember member_sample_identity_count = TypeObjectUtils::build_complete_union_member(common_sample_identity_count, detail_sample_identity_count); + TypeObjectUtils::add_complete_union_member(member_seq_Data, member_sample_identity_count); + } + { + return_code_Data = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "eprosima::fastdds::statistics::PhysicalData", type_ids_Data); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Data) + { + eprosima::fastdds::statistics::register_PhysicalData_type_identifier(type_ids_Data); + } + UnionMemberFlag member_flags_physical_data = TypeObjectUtils::build_union_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false); + UnionCaseLabelSeq label_seq_physical_data; + TypeObjectUtils::add_union_case_label(label_seq_physical_data, static_cast(EventKind::PHYSICAL_DATA)); + MemberId member_id_physical_data = 0x00000008; + bool common_physical_data_ec {false}; + CommonUnionMember common_physical_data {TypeObjectUtils::build_common_union_member(member_id_physical_data, + member_flags_physical_data, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_Data, + common_physical_data_ec), label_seq_physical_data)}; + if (!common_physical_data_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Union physical_data member TypeIdentifier inconsistent."); + return; + } + MemberName name_physical_data = "physical_data"; + eprosima::fastcdr::optional member_ann_builtin_physical_data; + ann_custom_Data.reset(); + CompleteMemberDetail detail_physical_data = TypeObjectUtils::build_complete_member_detail(name_physical_data, member_ann_builtin_physical_data, ann_custom_Data); + CompleteUnionMember member_physical_data = TypeObjectUtils::build_complete_union_member(common_physical_data, detail_physical_data); + TypeObjectUtils::add_complete_union_member(member_seq_Data, member_physical_data); + } + CompleteUnionType union_type_Data = TypeObjectUtils::build_complete_union_type(union_flags_Data, header_Data, discriminator_Data, + member_seq_Data); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_union_type_object(union_type_Data, type_name_Data.to_string(), type_ids_Data)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "eprosima::fastdds::statistics::Data already registered in TypeObjectRegistry for a different type."); + } + } +} + +} // namespace statistics + +} // namespace fastdds + +} // namespace eprosima + diff --git a/include/fastdds_statistics_backend/topic_types/typesTypeObjectSupport.hpp b/include/fastdds_statistics_backend/topic_types/typesTypeObjectSupport.hpp new file mode 100644 index 000000000..f137234a5 --- /dev/null +++ b/include/fastdds_statistics_backend/topic_types/typesTypeObjectSupport.hpp @@ -0,0 +1,253 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file typesTypeObjectSupport.hpp + * Header file containing the API required to register the TypeObject representation of the described types in the IDL file + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPES_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPES_TYPE_OBJECT_SUPPORT_HPP + +#include + + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +namespace eprosima { +namespace fastdds { +namespace statistics { +namespace detail { +/** + * @brief Register EntityId_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_EntityId_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register GuidPrefix_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_GuidPrefix_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register GUID_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_GUID_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register SequenceNumber_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_SequenceNumber_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register SampleIdentity_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_SampleIdentity_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register Locator_s related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_Locator_s_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +} // namespace detail + +/** + * @brief Register DiscoveryTime related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_DiscoveryTime_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register EntityCount related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_EntityCount_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register SampleIdentityCount related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_SampleIdentityCount_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register Entity2LocatorTraffic related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_Entity2LocatorTraffic_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register WriterReaderData related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_WriterReaderData_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register Locator2LocatorData related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_Locator2LocatorData_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register EntityData related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_EntityData_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +/** + * @brief Register PhysicalData related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_PhysicalData_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +namespace EventKind { +} // namespace EventKind + +/** + * @brief Register Data related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_Data_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + +} // namespace statistics + +} // namespace fastdds + +} // namespace eprosima + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__EPROSIMA_FASTDDS_STATISTICS_TYPES_TYPE_OBJECT_SUPPORT_HPP diff --git a/include/fastdds_statistics_backend/topic_types/typesv1.cxx b/include/fastdds_statistics_backend/topic_types/typesv1.cxx deleted file mode 100644 index fe0ac29c7..000000000 --- a/include/fastdds_statistics_backend/topic_types/typesv1.cxx +++ /dev/null @@ -1,4757 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file types.cpp - * This source file contains the implementation of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#ifdef _WIN32 -// Remove linker warning LNK4221 on Visual Studio -namespace { -char dummy; -} // namespace -#endif // _WIN32 - -#include "types.h" - -#if FASTCDR_VERSION_MAJOR == 1 - -#include - - -#include -using namespace eprosima::fastcdr::exception; - -#include - -namespace helper { namespace internal { - -enum class Size { - UInt8, - UInt16, - UInt32, - UInt64, -}; - -constexpr Size get_size(int s) { - return (s <= 8 ) ? Size::UInt8: - (s <= 16) ? Size::UInt16: - (s <= 32) ? Size::UInt32: Size::UInt64; -} - -template -struct FindTypeH; - -template<> -struct FindTypeH { - using type = std::uint8_t; -}; - -template<> -struct FindTypeH { - using type = std::uint16_t; -}; - -template<> -struct FindTypeH { - using type = std::uint32_t; -}; - -template<> -struct FindTypeH { - using type = std::uint64_t; -}; -} - -template -struct FindType { - using type = typename internal::FindTypeH::type; -}; -} - -#define eprosima_fastdds_statistics_DiscoveryTime_max_cdr_typesize 820ULL; -#define eprosima_fastdds_statistics_PhysicalData_max_cdr_typesize 796ULL; - -#define eprosima_fastdds_statistics_detail_Locator_s_max_cdr_typesize 24ULL; - -#define eprosima_fastdds_statistics_detail_GuidPrefix_s_max_cdr_typesize 12ULL; -#define eprosima_fastdds_statistics_detail_SampleIdentity_s_max_cdr_typesize 24ULL; -#define eprosima_fastdds_statistics_EntityData_max_cdr_typesize 20ULL; -#define eprosima_fastdds_statistics_Entity2LocatorTraffic_max_cdr_typesize 58ULL; -#define eprosima_fastdds_statistics_detail_EntityId_s_max_cdr_typesize 4ULL; -#define eprosima_fastdds_statistics_EntityCount_max_cdr_typesize 24ULL; -#define eprosima_fastdds_statistics_WriterReaderData_max_cdr_typesize 36ULL; -#define eprosima_fastdds_statistics_SampleIdentityCount_max_cdr_typesize 32ULL; -#define eprosima_fastdds_statistics_Locator2LocatorData_max_cdr_typesize 52ULL; -#define eprosima_fastdds_statistics_detail_GUID_s_max_cdr_typesize 16ULL; -#define eprosima_fastdds_statistics_detail_SequenceNumber_s_max_cdr_typesize 8ULL; - - -namespace eprosima { - -namespace fastdds { - -namespace statistics { - -namespace detail { - - - -EntityId_s::EntityId_s() -{ - // octet m_value - memset(&m_value, 0, ((4)) * 1); - -} - -EntityId_s::~EntityId_s() -{ -} - -EntityId_s::EntityId_s( - const EntityId_s& x) -{ - m_value = x.m_value; - -} - -EntityId_s::EntityId_s( - EntityId_s&& x) noexcept -{ - m_value = std::move(x.m_value); - -} - -EntityId_s& EntityId_s::operator =( - const EntityId_s& x) -{ - m_value = x.m_value; - - return *this; -} - -EntityId_s& EntityId_s::operator =( - EntityId_s&& x) noexcept -{ - m_value = std::move(x.m_value); - - return *this; -} - -bool EntityId_s::operator ==( - const EntityId_s& x) const -{ - return (m_value == x.m_value); -} - -bool EntityId_s::operator !=( - const EntityId_s& x) const -{ - return !(*this == x); -} - -size_t EntityId_s::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_detail_EntityId_s_max_cdr_typesize; -} - -size_t EntityId_s::getCdrSerializedSize( - const EntityId_s& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += (((4)) * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - - return current_alignment - initial_alignment; -} - - -void EntityId_s::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_value; - - -} - -void EntityId_s::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_value; - - -} - - -bool EntityId_s::isKeyDefined() -{ - return false; -} - -void EntityId_s::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ -void EntityId_s::value( - const std::array& _value) -{ - m_value = _value; -} - -/*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ -void EntityId_s::value( - std::array&& _value) -{ - m_value = std::move(_value); -} - -/*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ -const std::array& EntityId_s::value() const -{ - return m_value; -} - -/*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ -std::array& EntityId_s::value() -{ - return m_value; -} - - - - - -GuidPrefix_s::GuidPrefix_s() -{ - // octet m_value - memset(&m_value, 0, ((12)) * 1); - -} - -GuidPrefix_s::~GuidPrefix_s() -{ -} - -GuidPrefix_s::GuidPrefix_s( - const GuidPrefix_s& x) -{ - m_value = x.m_value; - -} - -GuidPrefix_s::GuidPrefix_s( - GuidPrefix_s&& x) noexcept -{ - m_value = std::move(x.m_value); - -} - -GuidPrefix_s& GuidPrefix_s::operator =( - const GuidPrefix_s& x) -{ - m_value = x.m_value; - - return *this; -} - -GuidPrefix_s& GuidPrefix_s::operator =( - GuidPrefix_s&& x) noexcept -{ - m_value = std::move(x.m_value); - - return *this; -} - -bool GuidPrefix_s::operator ==( - const GuidPrefix_s& x) const -{ - return (m_value == x.m_value); -} - -bool GuidPrefix_s::operator !=( - const GuidPrefix_s& x) const -{ - return !(*this == x); -} - -size_t GuidPrefix_s::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_detail_GuidPrefix_s_max_cdr_typesize; -} - -size_t GuidPrefix_s::getCdrSerializedSize( - const GuidPrefix_s& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += (((12)) * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - - return current_alignment - initial_alignment; -} - - -void GuidPrefix_s::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_value; - - -} - -void GuidPrefix_s::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_value; - - -} - - -bool GuidPrefix_s::isKeyDefined() -{ - return false; -} - -void GuidPrefix_s::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ -void GuidPrefix_s::value( - const std::array& _value) -{ - m_value = _value; -} - -/*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ -void GuidPrefix_s::value( - std::array&& _value) -{ - m_value = std::move(_value); -} - -/*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ -const std::array& GuidPrefix_s::value() const -{ - return m_value; -} - -/*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ -std::array& GuidPrefix_s::value() -{ - return m_value; -} - - - - - -GUID_s::GUID_s() -{ - // eprosima::fastdds::statistics::detail::GuidPrefix_s m_guidPrefix - - // eprosima::fastdds::statistics::detail::EntityId_s m_entityId - - -} - -GUID_s::~GUID_s() -{ -} - -GUID_s::GUID_s( - const GUID_s& x) -{ - m_guidPrefix = x.m_guidPrefix; - - - m_entityId = x.m_entityId; - -} - -GUID_s::GUID_s( - GUID_s&& x) noexcept -{ - m_guidPrefix = std::move(x.m_guidPrefix); - - - m_entityId = std::move(x.m_entityId); - -} - -GUID_s& GUID_s::operator =( - const GUID_s& x) -{ - m_guidPrefix = x.m_guidPrefix; - - - m_entityId = x.m_entityId; - - return *this; -} - -GUID_s& GUID_s::operator =( - GUID_s&& x) noexcept -{ - m_guidPrefix = std::move(x.m_guidPrefix); - - - m_entityId = std::move(x.m_entityId); - - return *this; -} - -bool GUID_s::operator ==( - const GUID_s& x) const -{ - return (m_guidPrefix == x.m_guidPrefix && - m_entityId == x.m_entityId); -} - -bool GUID_s::operator !=( - const GUID_s& x) const -{ - return !(*this == x); -} - -size_t GUID_s::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_detail_GUID_s_max_cdr_typesize; -} - -size_t GUID_s::getCdrSerializedSize( - const GUID_s& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += eprosima::fastdds::statistics::detail::GuidPrefix_s::getCdrSerializedSize(data.guidPrefix(), current_alignment); - - - current_alignment += eprosima::fastdds::statistics::detail::EntityId_s::getCdrSerializedSize(data.entityId(), current_alignment); - - - return current_alignment - initial_alignment; -} - - -void GUID_s::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_guidPrefix; - - scdr << m_entityId; - -} - -void GUID_s::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_guidPrefix; - - - - dcdr >> m_entityId; - - -} - - -bool GUID_s::isKeyDefined() -{ - return false; -} - -void GUID_s::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member guidPrefix - * @param _guidPrefix New value to be copied in member guidPrefix - */ -void GUID_s::guidPrefix( - const eprosima::fastdds::statistics::detail::GuidPrefix_s& _guidPrefix) -{ - m_guidPrefix = _guidPrefix; -} - -/*! - * @brief This function moves the value in member guidPrefix - * @param _guidPrefix New value to be moved in member guidPrefix - */ -void GUID_s::guidPrefix( - eprosima::fastdds::statistics::detail::GuidPrefix_s&& _guidPrefix) -{ - m_guidPrefix = std::move(_guidPrefix); -} - -/*! - * @brief This function returns a constant reference to member guidPrefix - * @return Constant reference to member guidPrefix - */ -const eprosima::fastdds::statistics::detail::GuidPrefix_s& GUID_s::guidPrefix() const -{ - return m_guidPrefix; -} - -/*! - * @brief This function returns a reference to member guidPrefix - * @return Reference to member guidPrefix - */ -eprosima::fastdds::statistics::detail::GuidPrefix_s& GUID_s::guidPrefix() -{ - return m_guidPrefix; -} - - -/*! - * @brief This function copies the value in member entityId - * @param _entityId New value to be copied in member entityId - */ -void GUID_s::entityId( - const eprosima::fastdds::statistics::detail::EntityId_s& _entityId) -{ - m_entityId = _entityId; -} - -/*! - * @brief This function moves the value in member entityId - * @param _entityId New value to be moved in member entityId - */ -void GUID_s::entityId( - eprosima::fastdds::statistics::detail::EntityId_s&& _entityId) -{ - m_entityId = std::move(_entityId); -} - -/*! - * @brief This function returns a constant reference to member entityId - * @return Constant reference to member entityId - */ -const eprosima::fastdds::statistics::detail::EntityId_s& GUID_s::entityId() const -{ - return m_entityId; -} - -/*! - * @brief This function returns a reference to member entityId - * @return Reference to member entityId - */ -eprosima::fastdds::statistics::detail::EntityId_s& GUID_s::entityId() -{ - return m_entityId; -} - - - - - -SequenceNumber_s::SequenceNumber_s() -{ - // long m_high - m_high = 0; - // unsigned long m_low - m_low = 0; - -} - -SequenceNumber_s::~SequenceNumber_s() -{ -} - -SequenceNumber_s::SequenceNumber_s( - const SequenceNumber_s& x) -{ - m_high = x.m_high; - - - m_low = x.m_low; - -} - -SequenceNumber_s::SequenceNumber_s( - SequenceNumber_s&& x) noexcept -{ - m_high = x.m_high; - - - m_low = x.m_low; - -} - -SequenceNumber_s& SequenceNumber_s::operator =( - const SequenceNumber_s& x) -{ - m_high = x.m_high; - - - m_low = x.m_low; - - return *this; -} - -SequenceNumber_s& SequenceNumber_s::operator =( - SequenceNumber_s&& x) noexcept -{ - m_high = x.m_high; - - - m_low = x.m_low; - - return *this; -} - -bool SequenceNumber_s::operator ==( - const SequenceNumber_s& x) const -{ - return (m_high == x.m_high && - m_low == x.m_low); -} - -bool SequenceNumber_s::operator !=( - const SequenceNumber_s& x) const -{ - return !(*this == x); -} - -size_t SequenceNumber_s::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_detail_SequenceNumber_s_max_cdr_typesize; -} - -size_t SequenceNumber_s::getCdrSerializedSize( - const SequenceNumber_s& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - return current_alignment - initial_alignment; -} - - -void SequenceNumber_s::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_high; - - scdr << m_low; - -} - -void SequenceNumber_s::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_high; - - - - dcdr >> m_low; - - -} - - -bool SequenceNumber_s::isKeyDefined() -{ - return false; -} - -void SequenceNumber_s::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member high - * @param _high New value for member high - */ -void SequenceNumber_s::high( - int32_t _high) -{ - m_high = _high; -} - -/*! - * @brief This function returns the value of member high - * @return Value of member high - */ -int32_t SequenceNumber_s::high() const -{ - return m_high; -} - -/*! - * @brief This function returns a reference to member high - * @return Reference to member high - */ -int32_t& SequenceNumber_s::high() -{ - return m_high; -} - - -/*! - * @brief This function sets a value in member low - * @param _low New value for member low - */ -void SequenceNumber_s::low( - uint32_t _low) -{ - m_low = _low; -} - -/*! - * @brief This function returns the value of member low - * @return Value of member low - */ -uint32_t SequenceNumber_s::low() const -{ - return m_low; -} - -/*! - * @brief This function returns a reference to member low - * @return Reference to member low - */ -uint32_t& SequenceNumber_s::low() -{ - return m_low; -} - - - - - -SampleIdentity_s::SampleIdentity_s() -{ - // eprosima::fastdds::statistics::detail::GUID_s m_writer_guid - - // eprosima::fastdds::statistics::detail::SequenceNumber_s m_sequence_number - - -} - -SampleIdentity_s::~SampleIdentity_s() -{ -} - -SampleIdentity_s::SampleIdentity_s( - const SampleIdentity_s& x) -{ - m_writer_guid = x.m_writer_guid; - - - m_sequence_number = x.m_sequence_number; - -} - -SampleIdentity_s::SampleIdentity_s( - SampleIdentity_s&& x) noexcept -{ - m_writer_guid = std::move(x.m_writer_guid); - - - m_sequence_number = std::move(x.m_sequence_number); - -} - -SampleIdentity_s& SampleIdentity_s::operator =( - const SampleIdentity_s& x) -{ - m_writer_guid = x.m_writer_guid; - - - m_sequence_number = x.m_sequence_number; - - return *this; -} - -SampleIdentity_s& SampleIdentity_s::operator =( - SampleIdentity_s&& x) noexcept -{ - m_writer_guid = std::move(x.m_writer_guid); - - - m_sequence_number = std::move(x.m_sequence_number); - - return *this; -} - -bool SampleIdentity_s::operator ==( - const SampleIdentity_s& x) const -{ - return (m_writer_guid == x.m_writer_guid && - m_sequence_number == x.m_sequence_number); -} - -bool SampleIdentity_s::operator !=( - const SampleIdentity_s& x) const -{ - return !(*this == x); -} - -size_t SampleIdentity_s::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_detail_SampleIdentity_s_max_cdr_typesize; -} - -size_t SampleIdentity_s::getCdrSerializedSize( - const SampleIdentity_s& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += eprosima::fastdds::statistics::detail::GUID_s::getCdrSerializedSize(data.writer_guid(), current_alignment); - - - current_alignment += eprosima::fastdds::statistics::detail::SequenceNumber_s::getCdrSerializedSize(data.sequence_number(), current_alignment); - - - return current_alignment - initial_alignment; -} - - -void SampleIdentity_s::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_writer_guid; - - scdr << m_sequence_number; - -} - -void SampleIdentity_s::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_writer_guid; - - - - dcdr >> m_sequence_number; - - -} - - -bool SampleIdentity_s::isKeyDefined() -{ - return false; -} - -void SampleIdentity_s::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function copies the value in member writer_guid - * @param _writer_guid New value to be copied in member writer_guid - */ -void SampleIdentity_s::writer_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _writer_guid) -{ - m_writer_guid = _writer_guid; -} - -/*! - * @brief This function moves the value in member writer_guid - * @param _writer_guid New value to be moved in member writer_guid - */ -void SampleIdentity_s::writer_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _writer_guid) -{ - m_writer_guid = std::move(_writer_guid); -} - -/*! - * @brief This function returns a constant reference to member writer_guid - * @return Constant reference to member writer_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& SampleIdentity_s::writer_guid() const -{ - return m_writer_guid; -} - -/*! - * @brief This function returns a reference to member writer_guid - * @return Reference to member writer_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& SampleIdentity_s::writer_guid() -{ - return m_writer_guid; -} - - -/*! - * @brief This function copies the value in member sequence_number - * @param _sequence_number New value to be copied in member sequence_number - */ -void SampleIdentity_s::sequence_number( - const eprosima::fastdds::statistics::detail::SequenceNumber_s& _sequence_number) -{ - m_sequence_number = _sequence_number; -} - -/*! - * @brief This function moves the value in member sequence_number - * @param _sequence_number New value to be moved in member sequence_number - */ -void SampleIdentity_s::sequence_number( - eprosima::fastdds::statistics::detail::SequenceNumber_s&& _sequence_number) -{ - m_sequence_number = std::move(_sequence_number); -} - -/*! - * @brief This function returns a constant reference to member sequence_number - * @return Constant reference to member sequence_number - */ -const eprosima::fastdds::statistics::detail::SequenceNumber_s& SampleIdentity_s::sequence_number() const -{ - return m_sequence_number; -} - -/*! - * @brief This function returns a reference to member sequence_number - * @return Reference to member sequence_number - */ -eprosima::fastdds::statistics::detail::SequenceNumber_s& SampleIdentity_s::sequence_number() -{ - return m_sequence_number; -} - - - - - -Locator_s::Locator_s() -{ - // long m_kind - m_kind = 0; - // unsigned long m_port - m_port = 0; - // octet m_address - memset(&m_address, 0, ((16)) * 1); - -} - -Locator_s::~Locator_s() -{ -} - -Locator_s::Locator_s( - const Locator_s& x) -{ - m_kind = x.m_kind; - - - m_port = x.m_port; - - - m_address = x.m_address; - -} - -Locator_s::Locator_s( - Locator_s&& x) noexcept -{ - m_kind = x.m_kind; - - - m_port = x.m_port; - - - m_address = std::move(x.m_address); - -} - -Locator_s& Locator_s::operator =( - const Locator_s& x) -{ - m_kind = x.m_kind; - - - m_port = x.m_port; - - - m_address = x.m_address; - - return *this; -} - -Locator_s& Locator_s::operator =( - Locator_s&& x) noexcept -{ - m_kind = x.m_kind; - - - m_port = x.m_port; - - - m_address = std::move(x.m_address); - - return *this; -} - -bool Locator_s::operator ==( - const Locator_s& x) const -{ - return (m_kind == x.m_kind && - m_port == x.m_port && - m_address == x.m_address); -} - -bool Locator_s::operator !=( - const Locator_s& x) const -{ - return !(*this == x); -} - -size_t Locator_s::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_detail_Locator_s_max_cdr_typesize; -} - -size_t Locator_s::getCdrSerializedSize( - const Locator_s& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - current_alignment += (((16)) * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); - - - - return current_alignment - initial_alignment; -} - - -void Locator_s::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_kind; - - scdr << m_port; - - scdr << m_address; - - -} - -void Locator_s::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_kind; - - - - dcdr >> m_port; - - - - dcdr >> m_address; - - -} - - -bool Locator_s::isKeyDefined() -{ - return false; -} - -void Locator_s::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; -} - -/*! - * @brief This function sets a value in member kind - * @param _kind New value for member kind - */ -void Locator_s::kind( - int32_t _kind) -{ - m_kind = _kind; -} - -/*! - * @brief This function returns the value of member kind - * @return Value of member kind - */ -int32_t Locator_s::kind() const -{ - return m_kind; -} - -/*! - * @brief This function returns a reference to member kind - * @return Reference to member kind - */ -int32_t& Locator_s::kind() -{ - return m_kind; -} - - -/*! - * @brief This function sets a value in member port - * @param _port New value for member port - */ -void Locator_s::port( - uint32_t _port) -{ - m_port = _port; -} - -/*! - * @brief This function returns the value of member port - * @return Value of member port - */ -uint32_t Locator_s::port() const -{ - return m_port; -} - -/*! - * @brief This function returns a reference to member port - * @return Reference to member port - */ -uint32_t& Locator_s::port() -{ - return m_port; -} - - -/*! - * @brief This function copies the value in member address - * @param _address New value to be copied in member address - */ -void Locator_s::address( - const std::array& _address) -{ - m_address = _address; -} - -/*! - * @brief This function moves the value in member address - * @param _address New value to be moved in member address - */ -void Locator_s::address( - std::array&& _address) -{ - m_address = std::move(_address); -} - -/*! - * @brief This function returns a constant reference to member address - * @return Constant reference to member address - */ -const std::array& Locator_s::address() const -{ - return m_address; -} - -/*! - * @brief This function returns a reference to member address - * @return Reference to member address - */ -std::array& Locator_s::address() -{ - return m_address; -} - - - - - -} // namespace detail - - -DiscoveryTime::DiscoveryTime() -{ - // eprosima::fastdds::statistics::detail::GUID_s m_local_participant_guid - - // eprosima::fastdds::statistics::detail::GUID_s m_remote_entity_guid - - // unsigned long long m_time - m_time = 0; - // /type_d() m_host - - // /type_d() m_user - - // /type_d() m_process - - -} - -DiscoveryTime::~DiscoveryTime() -{ -} - -DiscoveryTime::DiscoveryTime( - const DiscoveryTime& x) -{ - m_local_participant_guid = x.m_local_participant_guid; - - - m_remote_entity_guid = x.m_remote_entity_guid; - - - m_time = x.m_time; - - - m_host = x.m_host; - - - m_user = x.m_user; - - - m_process = x.m_process; - -} - -DiscoveryTime::DiscoveryTime( - DiscoveryTime&& x) noexcept -{ - m_local_participant_guid = std::move(x.m_local_participant_guid); - - - m_remote_entity_guid = std::move(x.m_remote_entity_guid); - - - m_time = x.m_time; - - - m_host = std::move(x.m_host); - - - m_user = std::move(x.m_user); - - - m_process = std::move(x.m_process); - -} - -DiscoveryTime& DiscoveryTime::operator =( - const DiscoveryTime& x) -{ - m_local_participant_guid = x.m_local_participant_guid; - - - m_remote_entity_guid = x.m_remote_entity_guid; - - - m_time = x.m_time; - - - m_host = x.m_host; - - - m_user = x.m_user; - - - m_process = x.m_process; - - return *this; -} - -DiscoveryTime& DiscoveryTime::operator =( - DiscoveryTime&& x) noexcept -{ - m_local_participant_guid = std::move(x.m_local_participant_guid); - - - m_remote_entity_guid = std::move(x.m_remote_entity_guid); - - - m_time = x.m_time; - - - m_host = std::move(x.m_host); - - - m_user = std::move(x.m_user); - - - m_process = std::move(x.m_process); - - return *this; -} - -bool DiscoveryTime::operator ==( - const DiscoveryTime& x) const -{ - return (m_local_participant_guid == x.m_local_participant_guid && - m_remote_entity_guid == x.m_remote_entity_guid && - m_time == x.m_time && - m_host == x.m_host && - m_user == x.m_user && - m_process == x.m_process); -} - -bool DiscoveryTime::operator !=( - const DiscoveryTime& x) const -{ - return !(*this == x); -} - -size_t DiscoveryTime::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_DiscoveryTime_max_cdr_typesize; -} - -size_t DiscoveryTime::getCdrSerializedSize( - const DiscoveryTime& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += eprosima::fastdds::statistics::detail::GUID_s::getCdrSerializedSize(data.local_participant_guid(), current_alignment); - - - current_alignment += eprosima::fastdds::statistics::detail::GUID_s::getCdrSerializedSize(data.remote_entity_guid(), current_alignment); - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.host().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.user().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.process().size() + 1; - - - return current_alignment - initial_alignment; -} - - -void DiscoveryTime::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_local_participant_guid; - - scdr << m_remote_entity_guid; - - scdr << m_time; - - scdr << m_host.c_str(); - - scdr << m_user.c_str(); - - scdr << m_process.c_str(); - -} - -void DiscoveryTime::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_local_participant_guid; - - - - dcdr >> m_remote_entity_guid; - - - - dcdr >> m_time; - - - - dcdr >> m_host; - - - - dcdr >> m_user; - - - - dcdr >> m_process; - - -} - - -bool DiscoveryTime::isKeyDefined() -{ - return true; -} - -void DiscoveryTime::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - m_local_participant_guid.serialize(scdr); - m_remote_entity_guid.serialize(scdr); - - - - -} - -/*! - * @brief This function copies the value in member local_participant_guid - * @param _local_participant_guid New value to be copied in member local_participant_guid - */ -void DiscoveryTime::local_participant_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _local_participant_guid) -{ - m_local_participant_guid = _local_participant_guid; -} - -/*! - * @brief This function moves the value in member local_participant_guid - * @param _local_participant_guid New value to be moved in member local_participant_guid - */ -void DiscoveryTime::local_participant_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _local_participant_guid) -{ - m_local_participant_guid = std::move(_local_participant_guid); -} - -/*! - * @brief This function returns a constant reference to member local_participant_guid - * @return Constant reference to member local_participant_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& DiscoveryTime::local_participant_guid() const -{ - return m_local_participant_guid; -} - -/*! - * @brief This function returns a reference to member local_participant_guid - * @return Reference to member local_participant_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& DiscoveryTime::local_participant_guid() -{ - return m_local_participant_guid; -} - - -/*! - * @brief This function copies the value in member remote_entity_guid - * @param _remote_entity_guid New value to be copied in member remote_entity_guid - */ -void DiscoveryTime::remote_entity_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _remote_entity_guid) -{ - m_remote_entity_guid = _remote_entity_guid; -} - -/*! - * @brief This function moves the value in member remote_entity_guid - * @param _remote_entity_guid New value to be moved in member remote_entity_guid - */ -void DiscoveryTime::remote_entity_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _remote_entity_guid) -{ - m_remote_entity_guid = std::move(_remote_entity_guid); -} - -/*! - * @brief This function returns a constant reference to member remote_entity_guid - * @return Constant reference to member remote_entity_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& DiscoveryTime::remote_entity_guid() const -{ - return m_remote_entity_guid; -} - -/*! - * @brief This function returns a reference to member remote_entity_guid - * @return Reference to member remote_entity_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& DiscoveryTime::remote_entity_guid() -{ - return m_remote_entity_guid; -} - - -/*! - * @brief This function sets a value in member time - * @param _time New value for member time - */ -void DiscoveryTime::time( - uint64_t _time) -{ - m_time = _time; -} - -/*! - * @brief This function returns the value of member time - * @return Value of member time - */ -uint64_t DiscoveryTime::time() const -{ - return m_time; -} - -/*! - * @brief This function returns a reference to member time - * @return Reference to member time - */ -uint64_t& DiscoveryTime::time() -{ - return m_time; -} - - -/*! - * @brief This function copies the value in member host - * @param _host New value to be copied in member host - */ -void DiscoveryTime::host( - const std::string& _host) -{ - m_host = _host; -} - -/*! - * @brief This function moves the value in member host - * @param _host New value to be moved in member host - */ -void DiscoveryTime::host( - std::string&& _host) -{ - m_host = std::move(_host); -} - -/*! - * @brief This function returns a constant reference to member host - * @return Constant reference to member host - */ -const std::string& DiscoveryTime::host() const -{ - return m_host; -} - -/*! - * @brief This function returns a reference to member host - * @return Reference to member host - */ -std::string& DiscoveryTime::host() -{ - return m_host; -} - - -/*! - * @brief This function copies the value in member user - * @param _user New value to be copied in member user - */ -void DiscoveryTime::user( - const std::string& _user) -{ - m_user = _user; -} - -/*! - * @brief This function moves the value in member user - * @param _user New value to be moved in member user - */ -void DiscoveryTime::user( - std::string&& _user) -{ - m_user = std::move(_user); -} - -/*! - * @brief This function returns a constant reference to member user - * @return Constant reference to member user - */ -const std::string& DiscoveryTime::user() const -{ - return m_user; -} - -/*! - * @brief This function returns a reference to member user - * @return Reference to member user - */ -std::string& DiscoveryTime::user() -{ - return m_user; -} - - -/*! - * @brief This function copies the value in member process - * @param _process New value to be copied in member process - */ -void DiscoveryTime::process( - const std::string& _process) -{ - m_process = _process; -} - -/*! - * @brief This function moves the value in member process - * @param _process New value to be moved in member process - */ -void DiscoveryTime::process( - std::string&& _process) -{ - m_process = std::move(_process); -} - -/*! - * @brief This function returns a constant reference to member process - * @return Constant reference to member process - */ -const std::string& DiscoveryTime::process() const -{ - return m_process; -} - -/*! - * @brief This function returns a reference to member process - * @return Reference to member process - */ -std::string& DiscoveryTime::process() -{ - return m_process; -} - - - - - -EntityCount::EntityCount() -{ - // eprosima::fastdds::statistics::detail::GUID_s m_guid - - // unsigned long long m_count - m_count = 0; - -} - -EntityCount::~EntityCount() -{ -} - -EntityCount::EntityCount( - const EntityCount& x) -{ - m_guid = x.m_guid; - - - m_count = x.m_count; - -} - -EntityCount::EntityCount( - EntityCount&& x) noexcept -{ - m_guid = std::move(x.m_guid); - - - m_count = x.m_count; - -} - -EntityCount& EntityCount::operator =( - const EntityCount& x) -{ - m_guid = x.m_guid; - - - m_count = x.m_count; - - return *this; -} - -EntityCount& EntityCount::operator =( - EntityCount&& x) noexcept -{ - m_guid = std::move(x.m_guid); - - - m_count = x.m_count; - - return *this; -} - -bool EntityCount::operator ==( - const EntityCount& x) const -{ - return (m_guid == x.m_guid && - m_count == x.m_count); -} - -bool EntityCount::operator !=( - const EntityCount& x) const -{ - return !(*this == x); -} - -size_t EntityCount::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_EntityCount_max_cdr_typesize; -} - -size_t EntityCount::getCdrSerializedSize( - const EntityCount& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += eprosima::fastdds::statistics::detail::GUID_s::getCdrSerializedSize(data.guid(), current_alignment); - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - return current_alignment - initial_alignment; -} - - -void EntityCount::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_guid; - - scdr << m_count; - -} - -void EntityCount::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_guid; - - - - dcdr >> m_count; - - -} - - -bool EntityCount::isKeyDefined() -{ - return true; -} - -void EntityCount::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - m_guid.serialize(scdr); - -} - -/*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ -void EntityCount::guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid) -{ - m_guid = _guid; -} - -/*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ -void EntityCount::guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid) -{ - m_guid = std::move(_guid); -} - -/*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& EntityCount::guid() const -{ - return m_guid; -} - -/*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ -eprosima::fastdds::statistics::detail::GUID_s& EntityCount::guid() -{ - return m_guid; -} - - -/*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ -void EntityCount::count( - uint64_t _count) -{ - m_count = _count; -} - -/*! - * @brief This function returns the value of member count - * @return Value of member count - */ -uint64_t EntityCount::count() const -{ - return m_count; -} - -/*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ -uint64_t& EntityCount::count() -{ - return m_count; -} - - - - - -SampleIdentityCount::SampleIdentityCount() -{ - // eprosima::fastdds::statistics::detail::SampleIdentity_s m_sample_id - - // unsigned long long m_count - m_count = 0; - -} - -SampleIdentityCount::~SampleIdentityCount() -{ -} - -SampleIdentityCount::SampleIdentityCount( - const SampleIdentityCount& x) -{ - m_sample_id = x.m_sample_id; - - - m_count = x.m_count; - -} - -SampleIdentityCount::SampleIdentityCount( - SampleIdentityCount&& x) noexcept -{ - m_sample_id = std::move(x.m_sample_id); - - - m_count = x.m_count; - -} - -SampleIdentityCount& SampleIdentityCount::operator =( - const SampleIdentityCount& x) -{ - m_sample_id = x.m_sample_id; - - - m_count = x.m_count; - - return *this; -} - -SampleIdentityCount& SampleIdentityCount::operator =( - SampleIdentityCount&& x) noexcept -{ - m_sample_id = std::move(x.m_sample_id); - - - m_count = x.m_count; - - return *this; -} - -bool SampleIdentityCount::operator ==( - const SampleIdentityCount& x) const -{ - return (m_sample_id == x.m_sample_id && - m_count == x.m_count); -} - -bool SampleIdentityCount::operator !=( - const SampleIdentityCount& x) const -{ - return !(*this == x); -} - -size_t SampleIdentityCount::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_SampleIdentityCount_max_cdr_typesize; -} - -size_t SampleIdentityCount::getCdrSerializedSize( - const SampleIdentityCount& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += eprosima::fastdds::statistics::detail::SampleIdentity_s::getCdrSerializedSize(data.sample_id(), current_alignment); - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - return current_alignment - initial_alignment; -} - - -void SampleIdentityCount::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_sample_id; - - scdr << m_count; - -} - -void SampleIdentityCount::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_sample_id; - - - - dcdr >> m_count; - - -} - - -bool SampleIdentityCount::isKeyDefined() -{ - return true; -} - -void SampleIdentityCount::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - m_sample_id.serialize(scdr); - -} - -/*! - * @brief This function copies the value in member sample_id - * @param _sample_id New value to be copied in member sample_id - */ -void SampleIdentityCount::sample_id( - const eprosima::fastdds::statistics::detail::SampleIdentity_s& _sample_id) -{ - m_sample_id = _sample_id; -} - -/*! - * @brief This function moves the value in member sample_id - * @param _sample_id New value to be moved in member sample_id - */ -void SampleIdentityCount::sample_id( - eprosima::fastdds::statistics::detail::SampleIdentity_s&& _sample_id) -{ - m_sample_id = std::move(_sample_id); -} - -/*! - * @brief This function returns a constant reference to member sample_id - * @return Constant reference to member sample_id - */ -const eprosima::fastdds::statistics::detail::SampleIdentity_s& SampleIdentityCount::sample_id() const -{ - return m_sample_id; -} - -/*! - * @brief This function returns a reference to member sample_id - * @return Reference to member sample_id - */ -eprosima::fastdds::statistics::detail::SampleIdentity_s& SampleIdentityCount::sample_id() -{ - return m_sample_id; -} - - -/*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ -void SampleIdentityCount::count( - uint64_t _count) -{ - m_count = _count; -} - -/*! - * @brief This function returns the value of member count - * @return Value of member count - */ -uint64_t SampleIdentityCount::count() const -{ - return m_count; -} - -/*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ -uint64_t& SampleIdentityCount::count() -{ - return m_count; -} - - - - - -Entity2LocatorTraffic::Entity2LocatorTraffic() -{ - // eprosima::fastdds::statistics::detail::GUID_s m_src_guid - - // eprosima::fastdds::statistics::detail::Locator_s m_dst_locator - - // unsigned long long m_packet_count - m_packet_count = 0; - // unsigned long long m_byte_count - m_byte_count = 0; - // short m_byte_magnitude_order - m_byte_magnitude_order = 0; - -} - -Entity2LocatorTraffic::~Entity2LocatorTraffic() -{ -} - -Entity2LocatorTraffic::Entity2LocatorTraffic( - const Entity2LocatorTraffic& x) -{ - m_src_guid = x.m_src_guid; - - - m_dst_locator = x.m_dst_locator; - - - m_packet_count = x.m_packet_count; - - - m_byte_count = x.m_byte_count; - - - m_byte_magnitude_order = x.m_byte_magnitude_order; - -} - -Entity2LocatorTraffic::Entity2LocatorTraffic( - Entity2LocatorTraffic&& x) noexcept -{ - m_src_guid = std::move(x.m_src_guid); - - - m_dst_locator = std::move(x.m_dst_locator); - - - m_packet_count = x.m_packet_count; - - - m_byte_count = x.m_byte_count; - - - m_byte_magnitude_order = x.m_byte_magnitude_order; - -} - -Entity2LocatorTraffic& Entity2LocatorTraffic::operator =( - const Entity2LocatorTraffic& x) -{ - m_src_guid = x.m_src_guid; - - - m_dst_locator = x.m_dst_locator; - - - m_packet_count = x.m_packet_count; - - - m_byte_count = x.m_byte_count; - - - m_byte_magnitude_order = x.m_byte_magnitude_order; - - return *this; -} - -Entity2LocatorTraffic& Entity2LocatorTraffic::operator =( - Entity2LocatorTraffic&& x) noexcept -{ - m_src_guid = std::move(x.m_src_guid); - - - m_dst_locator = std::move(x.m_dst_locator); - - - m_packet_count = x.m_packet_count; - - - m_byte_count = x.m_byte_count; - - - m_byte_magnitude_order = x.m_byte_magnitude_order; - - return *this; -} - -bool Entity2LocatorTraffic::operator ==( - const Entity2LocatorTraffic& x) const -{ - return (m_src_guid == x.m_src_guid && - m_dst_locator == x.m_dst_locator && - m_packet_count == x.m_packet_count && - m_byte_count == x.m_byte_count && - m_byte_magnitude_order == x.m_byte_magnitude_order); -} - -bool Entity2LocatorTraffic::operator !=( - const Entity2LocatorTraffic& x) const -{ - return !(*this == x); -} - -size_t Entity2LocatorTraffic::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_Entity2LocatorTraffic_max_cdr_typesize; -} - -size_t Entity2LocatorTraffic::getCdrSerializedSize( - const Entity2LocatorTraffic& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += eprosima::fastdds::statistics::detail::GUID_s::getCdrSerializedSize(data.src_guid(), current_alignment); - - - current_alignment += eprosima::fastdds::statistics::detail::Locator_s::getCdrSerializedSize(data.dst_locator(), current_alignment); - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); - - - current_alignment += 2 + eprosima::fastcdr::Cdr::alignment(current_alignment, 2); - - - return current_alignment - initial_alignment; -} - - -void Entity2LocatorTraffic::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_src_guid; - - scdr << m_dst_locator; - - scdr << m_packet_count; - - scdr << m_byte_count; - - scdr << m_byte_magnitude_order; - -} - -void Entity2LocatorTraffic::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_src_guid; - - - - dcdr >> m_dst_locator; - - - - dcdr >> m_packet_count; - - - - dcdr >> m_byte_count; - - - - dcdr >> m_byte_magnitude_order; - - -} - - -bool Entity2LocatorTraffic::isKeyDefined() -{ - return true; -} - -void Entity2LocatorTraffic::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - m_src_guid.serialize(scdr); - m_dst_locator.serialize(scdr); - - - -} - -/*! - * @brief This function copies the value in member src_guid - * @param _src_guid New value to be copied in member src_guid - */ -void Entity2LocatorTraffic::src_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _src_guid) -{ - m_src_guid = _src_guid; -} - -/*! - * @brief This function moves the value in member src_guid - * @param _src_guid New value to be moved in member src_guid - */ -void Entity2LocatorTraffic::src_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _src_guid) -{ - m_src_guid = std::move(_src_guid); -} - -/*! - * @brief This function returns a constant reference to member src_guid - * @return Constant reference to member src_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& Entity2LocatorTraffic::src_guid() const -{ - return m_src_guid; -} - -/*! - * @brief This function returns a reference to member src_guid - * @return Reference to member src_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& Entity2LocatorTraffic::src_guid() -{ - return m_src_guid; -} - - -/*! - * @brief This function copies the value in member dst_locator - * @param _dst_locator New value to be copied in member dst_locator - */ -void Entity2LocatorTraffic::dst_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _dst_locator) -{ - m_dst_locator = _dst_locator; -} - -/*! - * @brief This function moves the value in member dst_locator - * @param _dst_locator New value to be moved in member dst_locator - */ -void Entity2LocatorTraffic::dst_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _dst_locator) -{ - m_dst_locator = std::move(_dst_locator); -} - -/*! - * @brief This function returns a constant reference to member dst_locator - * @return Constant reference to member dst_locator - */ -const eprosima::fastdds::statistics::detail::Locator_s& Entity2LocatorTraffic::dst_locator() const -{ - return m_dst_locator; -} - -/*! - * @brief This function returns a reference to member dst_locator - * @return Reference to member dst_locator - */ -eprosima::fastdds::statistics::detail::Locator_s& Entity2LocatorTraffic::dst_locator() -{ - return m_dst_locator; -} - - -/*! - * @brief This function sets a value in member packet_count - * @param _packet_count New value for member packet_count - */ -void Entity2LocatorTraffic::packet_count( - uint64_t _packet_count) -{ - m_packet_count = _packet_count; -} - -/*! - * @brief This function returns the value of member packet_count - * @return Value of member packet_count - */ -uint64_t Entity2LocatorTraffic::packet_count() const -{ - return m_packet_count; -} - -/*! - * @brief This function returns a reference to member packet_count - * @return Reference to member packet_count - */ -uint64_t& Entity2LocatorTraffic::packet_count() -{ - return m_packet_count; -} - - -/*! - * @brief This function sets a value in member byte_count - * @param _byte_count New value for member byte_count - */ -void Entity2LocatorTraffic::byte_count( - uint64_t _byte_count) -{ - m_byte_count = _byte_count; -} - -/*! - * @brief This function returns the value of member byte_count - * @return Value of member byte_count - */ -uint64_t Entity2LocatorTraffic::byte_count() const -{ - return m_byte_count; -} - -/*! - * @brief This function returns a reference to member byte_count - * @return Reference to member byte_count - */ -uint64_t& Entity2LocatorTraffic::byte_count() -{ - return m_byte_count; -} - - -/*! - * @brief This function sets a value in member byte_magnitude_order - * @param _byte_magnitude_order New value for member byte_magnitude_order - */ -void Entity2LocatorTraffic::byte_magnitude_order( - int16_t _byte_magnitude_order) -{ - m_byte_magnitude_order = _byte_magnitude_order; -} - -/*! - * @brief This function returns the value of member byte_magnitude_order - * @return Value of member byte_magnitude_order - */ -int16_t Entity2LocatorTraffic::byte_magnitude_order() const -{ - return m_byte_magnitude_order; -} - -/*! - * @brief This function returns a reference to member byte_magnitude_order - * @return Reference to member byte_magnitude_order - */ -int16_t& Entity2LocatorTraffic::byte_magnitude_order() -{ - return m_byte_magnitude_order; -} - - - - - -WriterReaderData::WriterReaderData() -{ - // eprosima::fastdds::statistics::detail::GUID_s m_writer_guid - - // eprosima::fastdds::statistics::detail::GUID_s m_reader_guid - - // float m_data - m_data = 0.0; - -} - -WriterReaderData::~WriterReaderData() -{ -} - -WriterReaderData::WriterReaderData( - const WriterReaderData& x) -{ - m_writer_guid = x.m_writer_guid; - - - m_reader_guid = x.m_reader_guid; - - - m_data = x.m_data; - -} - -WriterReaderData::WriterReaderData( - WriterReaderData&& x) noexcept -{ - m_writer_guid = std::move(x.m_writer_guid); - - - m_reader_guid = std::move(x.m_reader_guid); - - - m_data = x.m_data; - -} - -WriterReaderData& WriterReaderData::operator =( - const WriterReaderData& x) -{ - m_writer_guid = x.m_writer_guid; - - - m_reader_guid = x.m_reader_guid; - - - m_data = x.m_data; - - return *this; -} - -WriterReaderData& WriterReaderData::operator =( - WriterReaderData&& x) noexcept -{ - m_writer_guid = std::move(x.m_writer_guid); - - - m_reader_guid = std::move(x.m_reader_guid); - - - m_data = x.m_data; - - return *this; -} - -bool WriterReaderData::operator ==( - const WriterReaderData& x) const -{ - return (m_writer_guid == x.m_writer_guid && - m_reader_guid == x.m_reader_guid && - m_data == x.m_data); -} - -bool WriterReaderData::operator !=( - const WriterReaderData& x) const -{ - return !(*this == x); -} - -size_t WriterReaderData::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_WriterReaderData_max_cdr_typesize; -} - -size_t WriterReaderData::getCdrSerializedSize( - const WriterReaderData& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += eprosima::fastdds::statistics::detail::GUID_s::getCdrSerializedSize(data.writer_guid(), current_alignment); - - - current_alignment += eprosima::fastdds::statistics::detail::GUID_s::getCdrSerializedSize(data.reader_guid(), current_alignment); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - return current_alignment - initial_alignment; -} - - -void WriterReaderData::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_writer_guid; - - scdr << m_reader_guid; - - scdr << m_data; - -} - -void WriterReaderData::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_writer_guid; - - - - dcdr >> m_reader_guid; - - - - dcdr >> m_data; - - -} - - -bool WriterReaderData::isKeyDefined() -{ - return true; -} - -void WriterReaderData::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - m_writer_guid.serialize(scdr); - m_reader_guid.serialize(scdr); - -} - -/*! - * @brief This function copies the value in member writer_guid - * @param _writer_guid New value to be copied in member writer_guid - */ -void WriterReaderData::writer_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _writer_guid) -{ - m_writer_guid = _writer_guid; -} - -/*! - * @brief This function moves the value in member writer_guid - * @param _writer_guid New value to be moved in member writer_guid - */ -void WriterReaderData::writer_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _writer_guid) -{ - m_writer_guid = std::move(_writer_guid); -} - -/*! - * @brief This function returns a constant reference to member writer_guid - * @return Constant reference to member writer_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& WriterReaderData::writer_guid() const -{ - return m_writer_guid; -} - -/*! - * @brief This function returns a reference to member writer_guid - * @return Reference to member writer_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& WriterReaderData::writer_guid() -{ - return m_writer_guid; -} - - -/*! - * @brief This function copies the value in member reader_guid - * @param _reader_guid New value to be copied in member reader_guid - */ -void WriterReaderData::reader_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _reader_guid) -{ - m_reader_guid = _reader_guid; -} - -/*! - * @brief This function moves the value in member reader_guid - * @param _reader_guid New value to be moved in member reader_guid - */ -void WriterReaderData::reader_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _reader_guid) -{ - m_reader_guid = std::move(_reader_guid); -} - -/*! - * @brief This function returns a constant reference to member reader_guid - * @return Constant reference to member reader_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& WriterReaderData::reader_guid() const -{ - return m_reader_guid; -} - -/*! - * @brief This function returns a reference to member reader_guid - * @return Reference to member reader_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& WriterReaderData::reader_guid() -{ - return m_reader_guid; -} - - -/*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ -void WriterReaderData::data( - float _data) -{ - m_data = _data; -} - -/*! - * @brief This function returns the value of member data - * @return Value of member data - */ -float WriterReaderData::data() const -{ - return m_data; -} - -/*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ -float& WriterReaderData::data() -{ - return m_data; -} - - - - - -Locator2LocatorData::Locator2LocatorData() -{ - // eprosima::fastdds::statistics::detail::Locator_s m_src_locator - - // eprosima::fastdds::statistics::detail::Locator_s m_dst_locator - - // float m_data - m_data = 0.0; - -} - -Locator2LocatorData::~Locator2LocatorData() -{ -} - -Locator2LocatorData::Locator2LocatorData( - const Locator2LocatorData& x) -{ - m_src_locator = x.m_src_locator; - - - m_dst_locator = x.m_dst_locator; - - - m_data = x.m_data; - -} - -Locator2LocatorData::Locator2LocatorData( - Locator2LocatorData&& x) noexcept -{ - m_src_locator = std::move(x.m_src_locator); - - - m_dst_locator = std::move(x.m_dst_locator); - - - m_data = x.m_data; - -} - -Locator2LocatorData& Locator2LocatorData::operator =( - const Locator2LocatorData& x) -{ - m_src_locator = x.m_src_locator; - - - m_dst_locator = x.m_dst_locator; - - - m_data = x.m_data; - - return *this; -} - -Locator2LocatorData& Locator2LocatorData::operator =( - Locator2LocatorData&& x) noexcept -{ - m_src_locator = std::move(x.m_src_locator); - - - m_dst_locator = std::move(x.m_dst_locator); - - - m_data = x.m_data; - - return *this; -} - -bool Locator2LocatorData::operator ==( - const Locator2LocatorData& x) const -{ - return (m_src_locator == x.m_src_locator && - m_dst_locator == x.m_dst_locator && - m_data == x.m_data); -} - -bool Locator2LocatorData::operator !=( - const Locator2LocatorData& x) const -{ - return !(*this == x); -} - -size_t Locator2LocatorData::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_Locator2LocatorData_max_cdr_typesize; -} - -size_t Locator2LocatorData::getCdrSerializedSize( - const Locator2LocatorData& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += eprosima::fastdds::statistics::detail::Locator_s::getCdrSerializedSize(data.src_locator(), current_alignment); - - - current_alignment += eprosima::fastdds::statistics::detail::Locator_s::getCdrSerializedSize(data.dst_locator(), current_alignment); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - return current_alignment - initial_alignment; -} - - -void Locator2LocatorData::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_src_locator; - - scdr << m_dst_locator; - - scdr << m_data; - -} - -void Locator2LocatorData::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_src_locator; - - - - dcdr >> m_dst_locator; - - - - dcdr >> m_data; - - -} - - -bool Locator2LocatorData::isKeyDefined() -{ - return true; -} - -void Locator2LocatorData::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - m_src_locator.serialize(scdr); - m_dst_locator.serialize(scdr); - -} - -/*! - * @brief This function copies the value in member src_locator - * @param _src_locator New value to be copied in member src_locator - */ -void Locator2LocatorData::src_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _src_locator) -{ - m_src_locator = _src_locator; -} - -/*! - * @brief This function moves the value in member src_locator - * @param _src_locator New value to be moved in member src_locator - */ -void Locator2LocatorData::src_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _src_locator) -{ - m_src_locator = std::move(_src_locator); -} - -/*! - * @brief This function returns a constant reference to member src_locator - * @return Constant reference to member src_locator - */ -const eprosima::fastdds::statistics::detail::Locator_s& Locator2LocatorData::src_locator() const -{ - return m_src_locator; -} - -/*! - * @brief This function returns a reference to member src_locator - * @return Reference to member src_locator - */ -eprosima::fastdds::statistics::detail::Locator_s& Locator2LocatorData::src_locator() -{ - return m_src_locator; -} - - -/*! - * @brief This function copies the value in member dst_locator - * @param _dst_locator New value to be copied in member dst_locator - */ -void Locator2LocatorData::dst_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _dst_locator) -{ - m_dst_locator = _dst_locator; -} - -/*! - * @brief This function moves the value in member dst_locator - * @param _dst_locator New value to be moved in member dst_locator - */ -void Locator2LocatorData::dst_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _dst_locator) -{ - m_dst_locator = std::move(_dst_locator); -} - -/*! - * @brief This function returns a constant reference to member dst_locator - * @return Constant reference to member dst_locator - */ -const eprosima::fastdds::statistics::detail::Locator_s& Locator2LocatorData::dst_locator() const -{ - return m_dst_locator; -} - -/*! - * @brief This function returns a reference to member dst_locator - * @return Reference to member dst_locator - */ -eprosima::fastdds::statistics::detail::Locator_s& Locator2LocatorData::dst_locator() -{ - return m_dst_locator; -} - - -/*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ -void Locator2LocatorData::data( - float _data) -{ - m_data = _data; -} - -/*! - * @brief This function returns the value of member data - * @return Value of member data - */ -float Locator2LocatorData::data() const -{ - return m_data; -} - -/*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ -float& Locator2LocatorData::data() -{ - return m_data; -} - - - - - -EntityData::EntityData() -{ - // eprosima::fastdds::statistics::detail::GUID_s m_guid - - // float m_data - m_data = 0.0; - -} - -EntityData::~EntityData() -{ -} - -EntityData::EntityData( - const EntityData& x) -{ - m_guid = x.m_guid; - - - m_data = x.m_data; - -} - -EntityData::EntityData( - EntityData&& x) noexcept -{ - m_guid = std::move(x.m_guid); - - - m_data = x.m_data; - -} - -EntityData& EntityData::operator =( - const EntityData& x) -{ - m_guid = x.m_guid; - - - m_data = x.m_data; - - return *this; -} - -EntityData& EntityData::operator =( - EntityData&& x) noexcept -{ - m_guid = std::move(x.m_guid); - - - m_data = x.m_data; - - return *this; -} - -bool EntityData::operator ==( - const EntityData& x) const -{ - return (m_guid == x.m_guid && - m_data == x.m_data); -} - -bool EntityData::operator !=( - const EntityData& x) const -{ - return !(*this == x); -} - -size_t EntityData::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_EntityData_max_cdr_typesize; -} - -size_t EntityData::getCdrSerializedSize( - const EntityData& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += eprosima::fastdds::statistics::detail::GUID_s::getCdrSerializedSize(data.guid(), current_alignment); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); - - - return current_alignment - initial_alignment; -} - - -void EntityData::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_guid; - - scdr << m_data; - -} - -void EntityData::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_guid; - - - - dcdr >> m_data; - - -} - - -bool EntityData::isKeyDefined() -{ - return true; -} - -void EntityData::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - m_guid.serialize(scdr); - -} - -/*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ -void EntityData::guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid) -{ - m_guid = _guid; -} - -/*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ -void EntityData::guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid) -{ - m_guid = std::move(_guid); -} - -/*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& EntityData::guid() const -{ - return m_guid; -} - -/*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ -eprosima::fastdds::statistics::detail::GUID_s& EntityData::guid() -{ - return m_guid; -} - - -/*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ -void EntityData::data( - float _data) -{ - m_data = _data; -} - -/*! - * @brief This function returns the value of member data - * @return Value of member data - */ -float EntityData::data() const -{ - return m_data; -} - -/*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ -float& EntityData::data() -{ - return m_data; -} - - - - - -PhysicalData::PhysicalData() -{ - // eprosima::fastdds::statistics::detail::GUID_s m_participant_guid - - // /type_d() m_host - - // /type_d() m_user - - // /type_d() m_process - - -} - -PhysicalData::~PhysicalData() -{ -} - -PhysicalData::PhysicalData( - const PhysicalData& x) -{ - m_participant_guid = x.m_participant_guid; - - - m_host = x.m_host; - - - m_user = x.m_user; - - - m_process = x.m_process; - -} - -PhysicalData::PhysicalData( - PhysicalData&& x) noexcept -{ - m_participant_guid = std::move(x.m_participant_guid); - - - m_host = std::move(x.m_host); - - - m_user = std::move(x.m_user); - - - m_process = std::move(x.m_process); - -} - -PhysicalData& PhysicalData::operator =( - const PhysicalData& x) -{ - m_participant_guid = x.m_participant_guid; - - - m_host = x.m_host; - - - m_user = x.m_user; - - - m_process = x.m_process; - - return *this; -} - -PhysicalData& PhysicalData::operator =( - PhysicalData&& x) noexcept -{ - m_participant_guid = std::move(x.m_participant_guid); - - - m_host = std::move(x.m_host); - - - m_user = std::move(x.m_user); - - - m_process = std::move(x.m_process); - - return *this; -} - -bool PhysicalData::operator ==( - const PhysicalData& x) const -{ - return (m_participant_guid == x.m_participant_guid && - m_host == x.m_host && - m_user == x.m_user && - m_process == x.m_process); -} - -bool PhysicalData::operator !=( - const PhysicalData& x) const -{ - return !(*this == x); -} - -size_t PhysicalData::getMaxCdrSerializedSize( - size_t current_alignment) -{ - static_cast(current_alignment); - return eprosima_fastdds_statistics_PhysicalData_max_cdr_typesize; -} - -size_t PhysicalData::getCdrSerializedSize( - const PhysicalData& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - current_alignment += eprosima::fastdds::statistics::detail::GUID_s::getCdrSerializedSize(data.participant_guid(), current_alignment); - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.host().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.user().size() + 1; - - - current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.process().size() + 1; - - - return current_alignment - initial_alignment; -} - - -void PhysicalData::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << m_participant_guid; - - scdr << m_host.c_str(); - - scdr << m_user.c_str(); - - scdr << m_process.c_str(); - -} - -void PhysicalData::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - dcdr >> m_participant_guid; - - - - dcdr >> m_host; - - - - dcdr >> m_user; - - - - dcdr >> m_process; - - -} - - -bool PhysicalData::isKeyDefined() -{ - return true; -} - -void PhysicalData::serializeKey( - eprosima::fastcdr::Cdr& scdr) const -{ - (void) scdr; - m_participant_guid.serialize(scdr); - - - -} - -/*! - * @brief This function copies the value in member participant_guid - * @param _participant_guid New value to be copied in member participant_guid - */ -void PhysicalData::participant_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _participant_guid) -{ - m_participant_guid = _participant_guid; -} - -/*! - * @brief This function moves the value in member participant_guid - * @param _participant_guid New value to be moved in member participant_guid - */ -void PhysicalData::participant_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _participant_guid) -{ - m_participant_guid = std::move(_participant_guid); -} - -/*! - * @brief This function returns a constant reference to member participant_guid - * @return Constant reference to member participant_guid - */ -const eprosima::fastdds::statistics::detail::GUID_s& PhysicalData::participant_guid() const -{ - return m_participant_guid; -} - -/*! - * @brief This function returns a reference to member participant_guid - * @return Reference to member participant_guid - */ -eprosima::fastdds::statistics::detail::GUID_s& PhysicalData::participant_guid() -{ - return m_participant_guid; -} - - -/*! - * @brief This function copies the value in member host - * @param _host New value to be copied in member host - */ -void PhysicalData::host( - const std::string& _host) -{ - m_host = _host; -} - -/*! - * @brief This function moves the value in member host - * @param _host New value to be moved in member host - */ -void PhysicalData::host( - std::string&& _host) -{ - m_host = std::move(_host); -} - -/*! - * @brief This function returns a constant reference to member host - * @return Constant reference to member host - */ -const std::string& PhysicalData::host() const -{ - return m_host; -} - -/*! - * @brief This function returns a reference to member host - * @return Reference to member host - */ -std::string& PhysicalData::host() -{ - return m_host; -} - - -/*! - * @brief This function copies the value in member user - * @param _user New value to be copied in member user - */ -void PhysicalData::user( - const std::string& _user) -{ - m_user = _user; -} - -/*! - * @brief This function moves the value in member user - * @param _user New value to be moved in member user - */ -void PhysicalData::user( - std::string&& _user) -{ - m_user = std::move(_user); -} - -/*! - * @brief This function returns a constant reference to member user - * @return Constant reference to member user - */ -const std::string& PhysicalData::user() const -{ - return m_user; -} - -/*! - * @brief This function returns a reference to member user - * @return Reference to member user - */ -std::string& PhysicalData::user() -{ - return m_user; -} - - -/*! - * @brief This function copies the value in member process - * @param _process New value to be copied in member process - */ -void PhysicalData::process( - const std::string& _process) -{ - m_process = _process; -} - -/*! - * @brief This function moves the value in member process - * @param _process New value to be moved in member process - */ -void PhysicalData::process( - std::string&& _process) -{ - m_process = std::move(_process); -} - -/*! - * @brief This function returns a constant reference to member process - * @return Constant reference to member process - */ -const std::string& PhysicalData::process() const -{ - return m_process; -} - -/*! - * @brief This function returns a reference to member process - * @return Reference to member process - */ -std::string& PhysicalData::process() -{ - return m_process; -} - - - - - - -Data::Data() -{ - m__d = eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY; - // eprosima::fastdds::statistics::WriterReaderData m_writer_reader_data - - // eprosima::fastdds::statistics::Locator2LocatorData m_locator2locator_data - - // eprosima::fastdds::statistics::EntityData m_entity_data - - // eprosima::fastdds::statistics::Entity2LocatorTraffic m_entity2locator_traffic - - // eprosima::fastdds::statistics::EntityCount m_entity_count - - // eprosima::fastdds::statistics::DiscoveryTime m_discovery_time - - // eprosima::fastdds::statistics::SampleIdentityCount m_sample_identity_count - - // eprosima::fastdds::statistics::PhysicalData m_physical_data - -} - -Data::~Data() -{ -} - -Data::Data( - const Data& x) -{ - m__d = x.m__d; - - switch(m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - m_writer_reader_data = x.m_writer_reader_data; - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - m_locator2locator_data = x.m_locator2locator_data; - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - m_entity_data = x.m_entity_data; - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - m_entity2locator_traffic = x.m_entity2locator_traffic; - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - m_entity_count = x.m_entity_count; - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - m_discovery_time = x.m_discovery_time; - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - m_sample_identity_count = x.m_sample_identity_count; - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - m_physical_data = x.m_physical_data; - break; - - default: - break; - } -} - -Data::Data( - Data&& x) noexcept -{ - m__d = x.m__d; - - switch(m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - m_writer_reader_data = std::move(x.m_writer_reader_data); - - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - m_locator2locator_data = std::move(x.m_locator2locator_data); - - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - m_entity_data = std::move(x.m_entity_data); - - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - m_entity2locator_traffic = std::move(x.m_entity2locator_traffic); - - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - m_entity_count = std::move(x.m_entity_count); - - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - m_discovery_time = std::move(x.m_discovery_time); - - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - m_sample_identity_count = std::move(x.m_sample_identity_count); - - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - m_physical_data = std::move(x.m_physical_data); - - break; - - default: - break; - } -} - -Data& Data::operator =( - const Data& x) -{ - m__d = x.m__d; - - switch(m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - m_writer_reader_data = x.m_writer_reader_data; - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - m_locator2locator_data = x.m_locator2locator_data; - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - m_entity_data = x.m_entity_data; - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - m_entity2locator_traffic = x.m_entity2locator_traffic; - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - m_entity_count = x.m_entity_count; - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - m_discovery_time = x.m_discovery_time; - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - m_sample_identity_count = x.m_sample_identity_count; - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - m_physical_data = x.m_physical_data; - break; - - default: - break; - } - - return *this; -} - -Data& Data::operator =( - Data&& x) noexcept -{ - m__d = x.m__d; - - switch(m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - m_writer_reader_data = std::move(x.m_writer_reader_data); - - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - m_locator2locator_data = std::move(x.m_locator2locator_data); - - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - m_entity_data = std::move(x.m_entity_data); - - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - m_entity2locator_traffic = std::move(x.m_entity2locator_traffic); - - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - m_entity_count = std::move(x.m_entity_count); - - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - m_discovery_time = std::move(x.m_discovery_time); - - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - m_sample_identity_count = std::move(x.m_sample_identity_count); - - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - m_physical_data = std::move(x.m_physical_data); - - break; - - default: - break; - } - - return *this; -} - -bool Data::operator ==( - const Data& x) const -{ - if (m__d != x.m__d) - { - return false; - } - - switch(m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - return (m_writer_reader_data == x.m_writer_reader_data); - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - return (m_locator2locator_data == x.m_locator2locator_data); - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - return (m_entity_data == x.m_entity_data); - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - return (m_entity2locator_traffic == x.m_entity2locator_traffic); - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - return (m_entity_count == x.m_entity_count); - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - return (m_discovery_time == x.m_discovery_time); - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - return (m_sample_identity_count == x.m_sample_identity_count); - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - return (m_physical_data == x.m_physical_data); - break; - - default: - break; - } - return false; -} - -bool Data::operator !=( - const Data& x) const -{ - return !(*this == x); -} - -void Data::_d( - eprosima::fastdds::statistics::EventKind __d) -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - switch(__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - switch(__d) - { - case eprosima::fastdds::statistics::NETWORK_LATENCY: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - switch(__d) - { - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - switch(__d) - { - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - switch(__d) - { - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - switch(__d) - { - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - switch(__d) - { - case eprosima::fastdds::statistics::SAMPLE_DATAS: - b = true; - break; - default: - break; - } - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - switch(__d) - { - case eprosima::fastdds::statistics::PHYSICAL_DATA: - b = true; - break; - default: - break; - } - break; - - } - - if(!b) - { - throw BadParamException("Discriminator doesn't correspond with the selected union member"); - } - - m__d = __d; -} - -eprosima::fastdds::statistics::EventKind Data::_d() const -{ - return m__d; -} - -eprosima::fastdds::statistics::EventKind& Data::_d() -{ - return m__d; -} - -void Data::writer_reader_data( - const eprosima::fastdds::statistics::WriterReaderData& _writer_reader_data) -{ - m_writer_reader_data = _writer_reader_data; - m__d = eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY; - -} - -void Data::writer_reader_data( - eprosima::fastdds::statistics::WriterReaderData&& _writer_reader_data) -{ - m_writer_reader_data = std::move(_writer_reader_data); - m__d = eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY; - -} - -const eprosima::fastdds::statistics::WriterReaderData& Data::writer_reader_data() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_writer_reader_data; -} - -eprosima::fastdds::statistics::WriterReaderData& Data::writer_reader_data() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_writer_reader_data; -} - - -void Data::locator2locator_data( - const eprosima::fastdds::statistics::Locator2LocatorData& _locator2locator_data) -{ - m_locator2locator_data = _locator2locator_data; - m__d = eprosima::fastdds::statistics::NETWORK_LATENCY; - -} - -void Data::locator2locator_data( - eprosima::fastdds::statistics::Locator2LocatorData&& _locator2locator_data) -{ - m_locator2locator_data = std::move(_locator2locator_data); - m__d = eprosima::fastdds::statistics::NETWORK_LATENCY; - -} - -const eprosima::fastdds::statistics::Locator2LocatorData& Data::locator2locator_data() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::NETWORK_LATENCY: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_locator2locator_data; -} - -eprosima::fastdds::statistics::Locator2LocatorData& Data::locator2locator_data() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::NETWORK_LATENCY: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_locator2locator_data; -} - - -void Data::entity_data( - const eprosima::fastdds::statistics::EntityData& _entity_data) -{ - m_entity_data = _entity_data; - m__d = eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT; - -} - -void Data::entity_data( - eprosima::fastdds::statistics::EntityData&& _entity_data) -{ - m_entity_data = std::move(_entity_data); - m__d = eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT; - -} - -const eprosima::fastdds::statistics::EntityData& Data::entity_data() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_data; -} - -eprosima::fastdds::statistics::EntityData& Data::entity_data() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_data; -} - - -void Data::entity2locator_traffic( - const eprosima::fastdds::statistics::Entity2LocatorTraffic& _entity2locator_traffic) -{ - m_entity2locator_traffic = _entity2locator_traffic; - m__d = eprosima::fastdds::statistics::RTPS_SENT; - -} - -void Data::entity2locator_traffic( - eprosima::fastdds::statistics::Entity2LocatorTraffic&& _entity2locator_traffic) -{ - m_entity2locator_traffic = std::move(_entity2locator_traffic); - m__d = eprosima::fastdds::statistics::RTPS_SENT; - -} - -const eprosima::fastdds::statistics::Entity2LocatorTraffic& Data::entity2locator_traffic() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity2locator_traffic; -} - -eprosima::fastdds::statistics::Entity2LocatorTraffic& Data::entity2locator_traffic() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity2locator_traffic; -} - - -void Data::entity_count( - const eprosima::fastdds::statistics::EntityCount& _entity_count) -{ - m_entity_count = _entity_count; - m__d = eprosima::fastdds::statistics::RESENT_DATAS; - -} - -void Data::entity_count( - eprosima::fastdds::statistics::EntityCount&& _entity_count) -{ - m_entity_count = std::move(_entity_count); - m__d = eprosima::fastdds::statistics::RESENT_DATAS; - -} - -const eprosima::fastdds::statistics::EntityCount& Data::entity_count() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_count; -} - -eprosima::fastdds::statistics::EntityCount& Data::entity_count() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_entity_count; -} - - -void Data::discovery_time( - const eprosima::fastdds::statistics::DiscoveryTime& _discovery_time) -{ - m_discovery_time = _discovery_time; - m__d = eprosima::fastdds::statistics::DISCOVERED_ENTITY; - -} - -void Data::discovery_time( - eprosima::fastdds::statistics::DiscoveryTime&& _discovery_time) -{ - m_discovery_time = std::move(_discovery_time); - m__d = eprosima::fastdds::statistics::DISCOVERED_ENTITY; - -} - -const eprosima::fastdds::statistics::DiscoveryTime& Data::discovery_time() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_discovery_time; -} - -eprosima::fastdds::statistics::DiscoveryTime& Data::discovery_time() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_discovery_time; -} - - -void Data::sample_identity_count( - const eprosima::fastdds::statistics::SampleIdentityCount& _sample_identity_count) -{ - m_sample_identity_count = _sample_identity_count; - m__d = eprosima::fastdds::statistics::SAMPLE_DATAS; - -} - -void Data::sample_identity_count( - eprosima::fastdds::statistics::SampleIdentityCount&& _sample_identity_count) -{ - m_sample_identity_count = std::move(_sample_identity_count); - m__d = eprosima::fastdds::statistics::SAMPLE_DATAS; - -} - -const eprosima::fastdds::statistics::SampleIdentityCount& Data::sample_identity_count() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::SAMPLE_DATAS: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_sample_identity_count; -} - -eprosima::fastdds::statistics::SampleIdentityCount& Data::sample_identity_count() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::SAMPLE_DATAS: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_sample_identity_count; -} - - -void Data::physical_data( - const eprosima::fastdds::statistics::PhysicalData& _physical_data) -{ - m_physical_data = _physical_data; - m__d = eprosima::fastdds::statistics::PHYSICAL_DATA; - -} - -void Data::physical_data( - eprosima::fastdds::statistics::PhysicalData&& _physical_data) -{ - m_physical_data = std::move(_physical_data); - m__d = eprosima::fastdds::statistics::PHYSICAL_DATA; - -} - -const eprosima::fastdds::statistics::PhysicalData& Data::physical_data() const -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::PHYSICAL_DATA: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_physical_data; -} - -eprosima::fastdds::statistics::PhysicalData& Data::physical_data() -{ - bool b = false; - - switch(m__d) - { - case eprosima::fastdds::statistics::PHYSICAL_DATA: - b = true; - break; - default: - break; - } - - if(!b) - { - throw BadParamException("This member has not been selected"); - } - - return m_physical_data; -} - - -// TODO(Ricardo) Review -size_t Data::getCdrSerializedSize( - const Data& data, - size_t current_alignment) -{ - (void)data; - size_t initial_alignment = current_alignment; - - - switch(data.m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - current_alignment += eprosima::fastdds::statistics::WriterReaderData::getCdrSerializedSize(data.writer_reader_data(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - current_alignment += eprosima::fastdds::statistics::Locator2LocatorData::getCdrSerializedSize(data.locator2locator_data(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - current_alignment += eprosima::fastdds::statistics::EntityData::getCdrSerializedSize(data.entity_data(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - current_alignment += eprosima::fastdds::statistics::Entity2LocatorTraffic::getCdrSerializedSize(data.entity2locator_traffic(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - current_alignment += eprosima::fastdds::statistics::EntityCount::getCdrSerializedSize(data.entity_count(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - current_alignment += eprosima::fastdds::statistics::DiscoveryTime::getCdrSerializedSize(data.discovery_time(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - current_alignment += eprosima::fastdds::statistics::SampleIdentityCount::getCdrSerializedSize(data.sample_identity_count(), current_alignment); - - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - current_alignment += eprosima::fastdds::statistics::PhysicalData::getCdrSerializedSize(data.physical_data(), current_alignment); - - break; - - default: - break; - } - - return current_alignment - initial_alignment; -} - - -void Data::serialize( - eprosima::fastcdr::Cdr& scdr) const -{ - scdr << (uint32_t)m__d; - - switch(m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - scdr << m_writer_reader_data; - - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - scdr << m_locator2locator_data; - - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - scdr << m_entity_data; - - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - scdr << m_entity2locator_traffic; - - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - scdr << m_entity_count; - - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - scdr << m_discovery_time; - - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - scdr << m_sample_identity_count; - - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - scdr << m_physical_data; - - break; - - default: - break; - } -} - -void Data::deserialize( - eprosima::fastcdr::Cdr& dcdr) -{ - { - uint32_t bitmask_value = 0; - dcdr >> bitmask_value; - m__d = (eprosima::fastdds::statistics::EventKind)bitmask_value; - } - - - - switch(m__d) - { - case eprosima::fastdds::statistics::HISTORY2HISTORY_LATENCY: - dcdr >> m_writer_reader_data; - - - break; - - - case eprosima::fastdds::statistics::NETWORK_LATENCY: - dcdr >> m_locator2locator_data; - - - break; - - - case eprosima::fastdds::statistics::PUBLICATION_THROUGHPUT: - case eprosima::fastdds::statistics::SUBSCRIPTION_THROUGHPUT: - dcdr >> m_entity_data; - - - break; - - - case eprosima::fastdds::statistics::RTPS_SENT: - case eprosima::fastdds::statistics::RTPS_LOST: - dcdr >> m_entity2locator_traffic; - - - break; - - - case eprosima::fastdds::statistics::RESENT_DATAS: - case eprosima::fastdds::statistics::HEARTBEAT_COUNT: - case eprosima::fastdds::statistics::ACKNACK_COUNT: - case eprosima::fastdds::statistics::NACKFRAG_COUNT: - case eprosima::fastdds::statistics::GAP_COUNT: - case eprosima::fastdds::statistics::DATA_COUNT: - case eprosima::fastdds::statistics::PDP_PACKETS: - case eprosima::fastdds::statistics::EDP_PACKETS: - dcdr >> m_entity_count; - - - break; - - - case eprosima::fastdds::statistics::DISCOVERED_ENTITY: - dcdr >> m_discovery_time; - - - break; - - - case eprosima::fastdds::statistics::SAMPLE_DATAS: - dcdr >> m_sample_identity_count; - - - break; - - - case eprosima::fastdds::statistics::PHYSICAL_DATA: - dcdr >> m_physical_data; - - - break; - - default: - break; - } -} - - - - - -} // namespace statistics - - -} // namespace fastdds - - -} // namespace eprosima - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/include/fastdds_statistics_backend/topic_types/typesv1.h b/include/fastdds_statistics_backend/topic_types/typesv1.h deleted file mode 100644 index 4790ebcb4..000000000 --- a/include/fastdds_statistics_backend/topic_types/typesv1.h +++ /dev/null @@ -1,3093 +0,0 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/*! - * @file types.h - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen. - */ - -#include - -#if FASTCDR_VERSION_MAJOR == 1 - -#ifndef _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPES_H_ -#define _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPES_H_ - - -#include - -#include -#include -#include -#include -#include -#include -#include - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#define eProsima_user_DllExport __declspec( dllexport ) -#else -#define eProsima_user_DllExport -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define eProsima_user_DllExport -#endif // _WIN32 - -#if defined(_WIN32) -#if defined(EPROSIMA_USER_DLL_EXPORT) -#if defined(TYPES_SOURCE) -#define TYPES_DllAPI __declspec( dllexport ) -#else -#define TYPES_DllAPI __declspec( dllimport ) -#endif // TYPES_SOURCE -#else -#define TYPES_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define TYPES_DllAPI -#endif // _WIN32 - -namespace eprosima { -namespace fastcdr { -class Cdr; -} // namespace fastcdr -} // namespace eprosima - - - -namespace eprosima { - namespace fastdds { - namespace statistics { - namespace detail { - - - /*! - * @brief This class represents the structure EntityId_s defined by the user in the IDL file. - * @ingroup types - */ - class EntityId_s - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport EntityId_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~EntityId_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::EntityId_s that will be copied. - */ - eProsima_user_DllExport EntityId_s( - const EntityId_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::EntityId_s that will be copied. - */ - eProsima_user_DllExport EntityId_s( - EntityId_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::EntityId_s that will be copied. - */ - eProsima_user_DllExport EntityId_s& operator =( - const EntityId_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::EntityId_s that will be copied. - */ - eProsima_user_DllExport EntityId_s& operator =( - EntityId_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::EntityId_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const EntityId_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::EntityId_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const EntityId_s& x) const; - - /*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ - eProsima_user_DllExport void value( - const std::array& _value); - - /*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ - eProsima_user_DllExport void value( - std::array&& _value); - - /*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ - eProsima_user_DllExport const std::array& value() const; - - /*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ - eProsima_user_DllExport std::array& value(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::detail::EntityId_s& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - std::array m_value; - - }; - - - - /*! - * @brief This class represents the structure GuidPrefix_s defined by the user in the IDL file. - * @ingroup types - */ - class GuidPrefix_s - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport GuidPrefix_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~GuidPrefix_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GuidPrefix_s that will be copied. - */ - eProsima_user_DllExport GuidPrefix_s( - const GuidPrefix_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GuidPrefix_s that will be copied. - */ - eProsima_user_DllExport GuidPrefix_s( - GuidPrefix_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GuidPrefix_s that will be copied. - */ - eProsima_user_DllExport GuidPrefix_s& operator =( - const GuidPrefix_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GuidPrefix_s that will be copied. - */ - eProsima_user_DllExport GuidPrefix_s& operator =( - GuidPrefix_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::GuidPrefix_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const GuidPrefix_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::GuidPrefix_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const GuidPrefix_s& x) const; - - /*! - * @brief This function copies the value in member value - * @param _value New value to be copied in member value - */ - eProsima_user_DllExport void value( - const std::array& _value); - - /*! - * @brief This function moves the value in member value - * @param _value New value to be moved in member value - */ - eProsima_user_DllExport void value( - std::array&& _value); - - /*! - * @brief This function returns a constant reference to member value - * @return Constant reference to member value - */ - eProsima_user_DllExport const std::array& value() const; - - /*! - * @brief This function returns a reference to member value - * @return Reference to member value - */ - eProsima_user_DllExport std::array& value(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::detail::GuidPrefix_s& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - std::array m_value; - - }; - - - - /*! - * @brief This class represents the structure GUID_s defined by the user in the IDL file. - * @ingroup types - */ - class GUID_s - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport GUID_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~GUID_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GUID_s that will be copied. - */ - eProsima_user_DllExport GUID_s( - const GUID_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GUID_s that will be copied. - */ - eProsima_user_DllExport GUID_s( - GUID_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GUID_s that will be copied. - */ - eProsima_user_DllExport GUID_s& operator =( - const GUID_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::GUID_s that will be copied. - */ - eProsima_user_DllExport GUID_s& operator =( - GUID_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::GUID_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const GUID_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::GUID_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const GUID_s& x) const; - - /*! - * @brief This function copies the value in member guidPrefix - * @param _guidPrefix New value to be copied in member guidPrefix - */ - eProsima_user_DllExport void guidPrefix( - const eprosima::fastdds::statistics::detail::GuidPrefix_s& _guidPrefix); - - /*! - * @brief This function moves the value in member guidPrefix - * @param _guidPrefix New value to be moved in member guidPrefix - */ - eProsima_user_DllExport void guidPrefix( - eprosima::fastdds::statistics::detail::GuidPrefix_s&& _guidPrefix); - - /*! - * @brief This function returns a constant reference to member guidPrefix - * @return Constant reference to member guidPrefix - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GuidPrefix_s& guidPrefix() const; - - /*! - * @brief This function returns a reference to member guidPrefix - * @return Reference to member guidPrefix - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GuidPrefix_s& guidPrefix(); - - - /*! - * @brief This function copies the value in member entityId - * @param _entityId New value to be copied in member entityId - */ - eProsima_user_DllExport void entityId( - const eprosima::fastdds::statistics::detail::EntityId_s& _entityId); - - /*! - * @brief This function moves the value in member entityId - * @param _entityId New value to be moved in member entityId - */ - eProsima_user_DllExport void entityId( - eprosima::fastdds::statistics::detail::EntityId_s&& _entityId); - - /*! - * @brief This function returns a constant reference to member entityId - * @return Constant reference to member entityId - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::EntityId_s& entityId() const; - - /*! - * @brief This function returns a reference to member entityId - * @return Reference to member entityId - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::EntityId_s& entityId(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::detail::GUID_s& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::detail::GuidPrefix_s m_guidPrefix; - eprosima::fastdds::statistics::detail::EntityId_s m_entityId; - - }; - - - - /*! - * @brief This class represents the structure SequenceNumber_s defined by the user in the IDL file. - * @ingroup types - */ - class SequenceNumber_s - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport SequenceNumber_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~SequenceNumber_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SequenceNumber_s that will be copied. - */ - eProsima_user_DllExport SequenceNumber_s( - const SequenceNumber_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SequenceNumber_s that will be copied. - */ - eProsima_user_DllExport SequenceNumber_s( - SequenceNumber_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SequenceNumber_s that will be copied. - */ - eProsima_user_DllExport SequenceNumber_s& operator =( - const SequenceNumber_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SequenceNumber_s that will be copied. - */ - eProsima_user_DllExport SequenceNumber_s& operator =( - SequenceNumber_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::SequenceNumber_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const SequenceNumber_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::SequenceNumber_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const SequenceNumber_s& x) const; - - /*! - * @brief This function sets a value in member high - * @param _high New value for member high - */ - eProsima_user_DllExport void high( - int32_t _high); - - /*! - * @brief This function returns the value of member high - * @return Value of member high - */ - eProsima_user_DllExport int32_t high() const; - - /*! - * @brief This function returns a reference to member high - * @return Reference to member high - */ - eProsima_user_DllExport int32_t& high(); - - - /*! - * @brief This function sets a value in member low - * @param _low New value for member low - */ - eProsima_user_DllExport void low( - uint32_t _low); - - /*! - * @brief This function returns the value of member low - * @return Value of member low - */ - eProsima_user_DllExport uint32_t low() const; - - /*! - * @brief This function returns a reference to member low - * @return Reference to member low - */ - eProsima_user_DllExport uint32_t& low(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::detail::SequenceNumber_s& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - int32_t m_high; - uint32_t m_low; - - }; - - - - /*! - * @brief This class represents the structure SampleIdentity_s defined by the user in the IDL file. - * @ingroup types - */ - class SampleIdentity_s - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport SampleIdentity_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~SampleIdentity_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SampleIdentity_s that will be copied. - */ - eProsima_user_DllExport SampleIdentity_s( - const SampleIdentity_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SampleIdentity_s that will be copied. - */ - eProsima_user_DllExport SampleIdentity_s( - SampleIdentity_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SampleIdentity_s that will be copied. - */ - eProsima_user_DllExport SampleIdentity_s& operator =( - const SampleIdentity_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::SampleIdentity_s that will be copied. - */ - eProsima_user_DllExport SampleIdentity_s& operator =( - SampleIdentity_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::SampleIdentity_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const SampleIdentity_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::SampleIdentity_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const SampleIdentity_s& x) const; - - /*! - * @brief This function copies the value in member writer_guid - * @param _writer_guid New value to be copied in member writer_guid - */ - eProsima_user_DllExport void writer_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _writer_guid); - - /*! - * @brief This function moves the value in member writer_guid - * @param _writer_guid New value to be moved in member writer_guid - */ - eProsima_user_DllExport void writer_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _writer_guid); - - /*! - * @brief This function returns a constant reference to member writer_guid - * @return Constant reference to member writer_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& writer_guid() const; - - /*! - * @brief This function returns a reference to member writer_guid - * @return Reference to member writer_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& writer_guid(); - - - /*! - * @brief This function copies the value in member sequence_number - * @param _sequence_number New value to be copied in member sequence_number - */ - eProsima_user_DllExport void sequence_number( - const eprosima::fastdds::statistics::detail::SequenceNumber_s& _sequence_number); - - /*! - * @brief This function moves the value in member sequence_number - * @param _sequence_number New value to be moved in member sequence_number - */ - eProsima_user_DllExport void sequence_number( - eprosima::fastdds::statistics::detail::SequenceNumber_s&& _sequence_number); - - /*! - * @brief This function returns a constant reference to member sequence_number - * @return Constant reference to member sequence_number - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::SequenceNumber_s& sequence_number() const; - - /*! - * @brief This function returns a reference to member sequence_number - * @return Reference to member sequence_number - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::SequenceNumber_s& sequence_number(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::detail::SampleIdentity_s& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::detail::GUID_s m_writer_guid; - eprosima::fastdds::statistics::detail::SequenceNumber_s m_sequence_number; - - }; - - - - /*! - * @brief This class represents the structure Locator_s defined by the user in the IDL file. - * @ingroup types - */ - class Locator_s - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport Locator_s(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~Locator_s(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::Locator_s that will be copied. - */ - eProsima_user_DllExport Locator_s( - const Locator_s& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::detail::Locator_s that will be copied. - */ - eProsima_user_DllExport Locator_s( - Locator_s&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::Locator_s that will be copied. - */ - eProsima_user_DllExport Locator_s& operator =( - const Locator_s& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::detail::Locator_s that will be copied. - */ - eProsima_user_DllExport Locator_s& operator =( - Locator_s&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::Locator_s object to compare. - */ - eProsima_user_DllExport bool operator ==( - const Locator_s& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::detail::Locator_s object to compare. - */ - eProsima_user_DllExport bool operator !=( - const Locator_s& x) const; - - /*! - * @brief This function sets a value in member kind - * @param _kind New value for member kind - */ - eProsima_user_DllExport void kind( - int32_t _kind); - - /*! - * @brief This function returns the value of member kind - * @return Value of member kind - */ - eProsima_user_DllExport int32_t kind() const; - - /*! - * @brief This function returns a reference to member kind - * @return Reference to member kind - */ - eProsima_user_DllExport int32_t& kind(); - - - /*! - * @brief This function sets a value in member port - * @param _port New value for member port - */ - eProsima_user_DllExport void port( - uint32_t _port); - - /*! - * @brief This function returns the value of member port - * @return Value of member port - */ - eProsima_user_DllExport uint32_t port() const; - - /*! - * @brief This function returns a reference to member port - * @return Reference to member port - */ - eProsima_user_DllExport uint32_t& port(); - - - /*! - * @brief This function copies the value in member address - * @param _address New value to be copied in member address - */ - eProsima_user_DllExport void address( - const std::array& _address); - - /*! - * @brief This function moves the value in member address - * @param _address New value to be moved in member address - */ - eProsima_user_DllExport void address( - std::array&& _address); - - /*! - * @brief This function returns a constant reference to member address - * @return Constant reference to member address - */ - eProsima_user_DllExport const std::array& address() const; - - /*! - * @brief This function returns a reference to member address - * @return Reference to member address - */ - eProsima_user_DllExport std::array& address(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::detail::Locator_s& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - int32_t m_kind; - uint32_t m_port; - std::array m_address; - - }; - - } // namespace detail - - - /*! - * @brief This class represents the structure DiscoveryTime defined by the user in the IDL file. - * @ingroup types - */ - class DiscoveryTime - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport DiscoveryTime(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~DiscoveryTime(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::DiscoveryTime that will be copied. - */ - eProsima_user_DllExport DiscoveryTime( - const DiscoveryTime& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::DiscoveryTime that will be copied. - */ - eProsima_user_DllExport DiscoveryTime( - DiscoveryTime&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::DiscoveryTime that will be copied. - */ - eProsima_user_DllExport DiscoveryTime& operator =( - const DiscoveryTime& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::DiscoveryTime that will be copied. - */ - eProsima_user_DllExport DiscoveryTime& operator =( - DiscoveryTime&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::DiscoveryTime object to compare. - */ - eProsima_user_DllExport bool operator ==( - const DiscoveryTime& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::DiscoveryTime object to compare. - */ - eProsima_user_DllExport bool operator !=( - const DiscoveryTime& x) const; - - /*! - * @brief This function copies the value in member local_participant_guid - * @param _local_participant_guid New value to be copied in member local_participant_guid - */ - eProsima_user_DllExport void local_participant_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _local_participant_guid); - - /*! - * @brief This function moves the value in member local_participant_guid - * @param _local_participant_guid New value to be moved in member local_participant_guid - */ - eProsima_user_DllExport void local_participant_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _local_participant_guid); - - /*! - * @brief This function returns a constant reference to member local_participant_guid - * @return Constant reference to member local_participant_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& local_participant_guid() const; - - /*! - * @brief This function returns a reference to member local_participant_guid - * @return Reference to member local_participant_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& local_participant_guid(); - - - /*! - * @brief This function copies the value in member remote_entity_guid - * @param _remote_entity_guid New value to be copied in member remote_entity_guid - */ - eProsima_user_DllExport void remote_entity_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _remote_entity_guid); - - /*! - * @brief This function moves the value in member remote_entity_guid - * @param _remote_entity_guid New value to be moved in member remote_entity_guid - */ - eProsima_user_DllExport void remote_entity_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _remote_entity_guid); - - /*! - * @brief This function returns a constant reference to member remote_entity_guid - * @return Constant reference to member remote_entity_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& remote_entity_guid() const; - - /*! - * @brief This function returns a reference to member remote_entity_guid - * @return Reference to member remote_entity_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& remote_entity_guid(); - - - /*! - * @brief This function sets a value in member time - * @param _time New value for member time - */ - eProsima_user_DllExport void time( - uint64_t _time); - - /*! - * @brief This function returns the value of member time - * @return Value of member time - */ - eProsima_user_DllExport uint64_t time() const; - - /*! - * @brief This function returns a reference to member time - * @return Reference to member time - */ - eProsima_user_DllExport uint64_t& time(); - - - /*! - * @brief This function copies the value in member host - * @param _host New value to be copied in member host - */ - eProsima_user_DllExport void host( - const std::string& _host); - - /*! - * @brief This function moves the value in member host - * @param _host New value to be moved in member host - */ - eProsima_user_DllExport void host( - std::string&& _host); - - /*! - * @brief This function returns a constant reference to member host - * @return Constant reference to member host - */ - eProsima_user_DllExport const std::string& host() const; - - /*! - * @brief This function returns a reference to member host - * @return Reference to member host - */ - eProsima_user_DllExport std::string& host(); - - - /*! - * @brief This function copies the value in member user - * @param _user New value to be copied in member user - */ - eProsima_user_DllExport void user( - const std::string& _user); - - /*! - * @brief This function moves the value in member user - * @param _user New value to be moved in member user - */ - eProsima_user_DllExport void user( - std::string&& _user); - - /*! - * @brief This function returns a constant reference to member user - * @return Constant reference to member user - */ - eProsima_user_DllExport const std::string& user() const; - - /*! - * @brief This function returns a reference to member user - * @return Reference to member user - */ - eProsima_user_DllExport std::string& user(); - - - /*! - * @brief This function copies the value in member process - * @param _process New value to be copied in member process - */ - eProsima_user_DllExport void process( - const std::string& _process); - - /*! - * @brief This function moves the value in member process - * @param _process New value to be moved in member process - */ - eProsima_user_DllExport void process( - std::string&& _process); - - /*! - * @brief This function returns a constant reference to member process - * @return Constant reference to member process - */ - eProsima_user_DllExport const std::string& process() const; - - /*! - * @brief This function returns a reference to member process - * @return Reference to member process - */ - eProsima_user_DllExport std::string& process(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::DiscoveryTime& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::detail::GUID_s m_local_participant_guid; - eprosima::fastdds::statistics::detail::GUID_s m_remote_entity_guid; - uint64_t m_time; - std::string m_host; - std::string m_user; - std::string m_process; - - }; - - - - /*! - * @brief This class represents the structure EntityCount defined by the user in the IDL file. - * @ingroup types - */ - class EntityCount - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport EntityCount(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~EntityCount(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::EntityCount that will be copied. - */ - eProsima_user_DllExport EntityCount( - const EntityCount& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::EntityCount that will be copied. - */ - eProsima_user_DllExport EntityCount( - EntityCount&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::EntityCount that will be copied. - */ - eProsima_user_DllExport EntityCount& operator =( - const EntityCount& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::EntityCount that will be copied. - */ - eProsima_user_DllExport EntityCount& operator =( - EntityCount&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::EntityCount object to compare. - */ - eProsima_user_DllExport bool operator ==( - const EntityCount& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::EntityCount object to compare. - */ - eProsima_user_DllExport bool operator !=( - const EntityCount& x) const; - - /*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ - eProsima_user_DllExport void guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid); - - /*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ - eProsima_user_DllExport void guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid); - - /*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& guid() const; - - /*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& guid(); - - - /*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ - eProsima_user_DllExport void count( - uint64_t _count); - - /*! - * @brief This function returns the value of member count - * @return Value of member count - */ - eProsima_user_DllExport uint64_t count() const; - - /*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ - eProsima_user_DllExport uint64_t& count(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::EntityCount& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::detail::GUID_s m_guid; - uint64_t m_count; - - }; - - - - /*! - * @brief This class represents the structure SampleIdentityCount defined by the user in the IDL file. - * @ingroup types - */ - class SampleIdentityCount - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport SampleIdentityCount(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~SampleIdentityCount(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::SampleIdentityCount that will be copied. - */ - eProsima_user_DllExport SampleIdentityCount( - const SampleIdentityCount& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::SampleIdentityCount that will be copied. - */ - eProsima_user_DllExport SampleIdentityCount( - SampleIdentityCount&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::SampleIdentityCount that will be copied. - */ - eProsima_user_DllExport SampleIdentityCount& operator =( - const SampleIdentityCount& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::SampleIdentityCount that will be copied. - */ - eProsima_user_DllExport SampleIdentityCount& operator =( - SampleIdentityCount&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::SampleIdentityCount object to compare. - */ - eProsima_user_DllExport bool operator ==( - const SampleIdentityCount& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::SampleIdentityCount object to compare. - */ - eProsima_user_DllExport bool operator !=( - const SampleIdentityCount& x) const; - - /*! - * @brief This function copies the value in member sample_id - * @param _sample_id New value to be copied in member sample_id - */ - eProsima_user_DllExport void sample_id( - const eprosima::fastdds::statistics::detail::SampleIdentity_s& _sample_id); - - /*! - * @brief This function moves the value in member sample_id - * @param _sample_id New value to be moved in member sample_id - */ - eProsima_user_DllExport void sample_id( - eprosima::fastdds::statistics::detail::SampleIdentity_s&& _sample_id); - - /*! - * @brief This function returns a constant reference to member sample_id - * @return Constant reference to member sample_id - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::SampleIdentity_s& sample_id() const; - - /*! - * @brief This function returns a reference to member sample_id - * @return Reference to member sample_id - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::SampleIdentity_s& sample_id(); - - - /*! - * @brief This function sets a value in member count - * @param _count New value for member count - */ - eProsima_user_DllExport void count( - uint64_t _count); - - /*! - * @brief This function returns the value of member count - * @return Value of member count - */ - eProsima_user_DllExport uint64_t count() const; - - /*! - * @brief This function returns a reference to member count - * @return Reference to member count - */ - eProsima_user_DllExport uint64_t& count(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::SampleIdentityCount& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::detail::SampleIdentity_s m_sample_id; - uint64_t m_count; - - }; - - - - /*! - * @brief This class represents the structure Entity2LocatorTraffic defined by the user in the IDL file. - * @ingroup types - */ - class Entity2LocatorTraffic - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport Entity2LocatorTraffic(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~Entity2LocatorTraffic(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Entity2LocatorTraffic that will be copied. - */ - eProsima_user_DllExport Entity2LocatorTraffic( - const Entity2LocatorTraffic& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Entity2LocatorTraffic that will be copied. - */ - eProsima_user_DllExport Entity2LocatorTraffic( - Entity2LocatorTraffic&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Entity2LocatorTraffic that will be copied. - */ - eProsima_user_DllExport Entity2LocatorTraffic& operator =( - const Entity2LocatorTraffic& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Entity2LocatorTraffic that will be copied. - */ - eProsima_user_DllExport Entity2LocatorTraffic& operator =( - Entity2LocatorTraffic&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Entity2LocatorTraffic object to compare. - */ - eProsima_user_DllExport bool operator ==( - const Entity2LocatorTraffic& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Entity2LocatorTraffic object to compare. - */ - eProsima_user_DllExport bool operator !=( - const Entity2LocatorTraffic& x) const; - - /*! - * @brief This function copies the value in member src_guid - * @param _src_guid New value to be copied in member src_guid - */ - eProsima_user_DllExport void src_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _src_guid); - - /*! - * @brief This function moves the value in member src_guid - * @param _src_guid New value to be moved in member src_guid - */ - eProsima_user_DllExport void src_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _src_guid); - - /*! - * @brief This function returns a constant reference to member src_guid - * @return Constant reference to member src_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& src_guid() const; - - /*! - * @brief This function returns a reference to member src_guid - * @return Reference to member src_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& src_guid(); - - - /*! - * @brief This function copies the value in member dst_locator - * @param _dst_locator New value to be copied in member dst_locator - */ - eProsima_user_DllExport void dst_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _dst_locator); - - /*! - * @brief This function moves the value in member dst_locator - * @param _dst_locator New value to be moved in member dst_locator - */ - eProsima_user_DllExport void dst_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _dst_locator); - - /*! - * @brief This function returns a constant reference to member dst_locator - * @return Constant reference to member dst_locator - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::Locator_s& dst_locator() const; - - /*! - * @brief This function returns a reference to member dst_locator - * @return Reference to member dst_locator - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::Locator_s& dst_locator(); - - - /*! - * @brief This function sets a value in member packet_count - * @param _packet_count New value for member packet_count - */ - eProsima_user_DllExport void packet_count( - uint64_t _packet_count); - - /*! - * @brief This function returns the value of member packet_count - * @return Value of member packet_count - */ - eProsima_user_DllExport uint64_t packet_count() const; - - /*! - * @brief This function returns a reference to member packet_count - * @return Reference to member packet_count - */ - eProsima_user_DllExport uint64_t& packet_count(); - - - /*! - * @brief This function sets a value in member byte_count - * @param _byte_count New value for member byte_count - */ - eProsima_user_DllExport void byte_count( - uint64_t _byte_count); - - /*! - * @brief This function returns the value of member byte_count - * @return Value of member byte_count - */ - eProsima_user_DllExport uint64_t byte_count() const; - - /*! - * @brief This function returns a reference to member byte_count - * @return Reference to member byte_count - */ - eProsima_user_DllExport uint64_t& byte_count(); - - - /*! - * @brief This function sets a value in member byte_magnitude_order - * @param _byte_magnitude_order New value for member byte_magnitude_order - */ - eProsima_user_DllExport void byte_magnitude_order( - int16_t _byte_magnitude_order); - - /*! - * @brief This function returns the value of member byte_magnitude_order - * @return Value of member byte_magnitude_order - */ - eProsima_user_DllExport int16_t byte_magnitude_order() const; - - /*! - * @brief This function returns a reference to member byte_magnitude_order - * @return Reference to member byte_magnitude_order - */ - eProsima_user_DllExport int16_t& byte_magnitude_order(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::Entity2LocatorTraffic& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::detail::GUID_s m_src_guid; - eprosima::fastdds::statistics::detail::Locator_s m_dst_locator; - uint64_t m_packet_count; - uint64_t m_byte_count; - int16_t m_byte_magnitude_order; - - }; - - - - /*! - * @brief This class represents the structure WriterReaderData defined by the user in the IDL file. - * @ingroup types - */ - class WriterReaderData - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport WriterReaderData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~WriterReaderData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::WriterReaderData that will be copied. - */ - eProsima_user_DllExport WriterReaderData( - const WriterReaderData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::WriterReaderData that will be copied. - */ - eProsima_user_DllExport WriterReaderData( - WriterReaderData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::WriterReaderData that will be copied. - */ - eProsima_user_DllExport WriterReaderData& operator =( - const WriterReaderData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::WriterReaderData that will be copied. - */ - eProsima_user_DllExport WriterReaderData& operator =( - WriterReaderData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::WriterReaderData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const WriterReaderData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::WriterReaderData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const WriterReaderData& x) const; - - /*! - * @brief This function copies the value in member writer_guid - * @param _writer_guid New value to be copied in member writer_guid - */ - eProsima_user_DllExport void writer_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _writer_guid); - - /*! - * @brief This function moves the value in member writer_guid - * @param _writer_guid New value to be moved in member writer_guid - */ - eProsima_user_DllExport void writer_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _writer_guid); - - /*! - * @brief This function returns a constant reference to member writer_guid - * @return Constant reference to member writer_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& writer_guid() const; - - /*! - * @brief This function returns a reference to member writer_guid - * @return Reference to member writer_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& writer_guid(); - - - /*! - * @brief This function copies the value in member reader_guid - * @param _reader_guid New value to be copied in member reader_guid - */ - eProsima_user_DllExport void reader_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _reader_guid); - - /*! - * @brief This function moves the value in member reader_guid - * @param _reader_guid New value to be moved in member reader_guid - */ - eProsima_user_DllExport void reader_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _reader_guid); - - /*! - * @brief This function returns a constant reference to member reader_guid - * @return Constant reference to member reader_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& reader_guid() const; - - /*! - * @brief This function returns a reference to member reader_guid - * @return Reference to member reader_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& reader_guid(); - - - /*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ - eProsima_user_DllExport void data( - float _data); - - /*! - * @brief This function returns the value of member data - * @return Value of member data - */ - eProsima_user_DllExport float data() const; - - /*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ - eProsima_user_DllExport float& data(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::WriterReaderData& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::detail::GUID_s m_writer_guid; - eprosima::fastdds::statistics::detail::GUID_s m_reader_guid; - float m_data; - - }; - - - - /*! - * @brief This class represents the structure Locator2LocatorData defined by the user in the IDL file. - * @ingroup types - */ - class Locator2LocatorData - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport Locator2LocatorData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~Locator2LocatorData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Locator2LocatorData that will be copied. - */ - eProsima_user_DllExport Locator2LocatorData( - const Locator2LocatorData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Locator2LocatorData that will be copied. - */ - eProsima_user_DllExport Locator2LocatorData( - Locator2LocatorData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Locator2LocatorData that will be copied. - */ - eProsima_user_DllExport Locator2LocatorData& operator =( - const Locator2LocatorData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Locator2LocatorData that will be copied. - */ - eProsima_user_DllExport Locator2LocatorData& operator =( - Locator2LocatorData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Locator2LocatorData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const Locator2LocatorData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Locator2LocatorData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const Locator2LocatorData& x) const; - - /*! - * @brief This function copies the value in member src_locator - * @param _src_locator New value to be copied in member src_locator - */ - eProsima_user_DllExport void src_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _src_locator); - - /*! - * @brief This function moves the value in member src_locator - * @param _src_locator New value to be moved in member src_locator - */ - eProsima_user_DllExport void src_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _src_locator); - - /*! - * @brief This function returns a constant reference to member src_locator - * @return Constant reference to member src_locator - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::Locator_s& src_locator() const; - - /*! - * @brief This function returns a reference to member src_locator - * @return Reference to member src_locator - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::Locator_s& src_locator(); - - - /*! - * @brief This function copies the value in member dst_locator - * @param _dst_locator New value to be copied in member dst_locator - */ - eProsima_user_DllExport void dst_locator( - const eprosima::fastdds::statistics::detail::Locator_s& _dst_locator); - - /*! - * @brief This function moves the value in member dst_locator - * @param _dst_locator New value to be moved in member dst_locator - */ - eProsima_user_DllExport void dst_locator( - eprosima::fastdds::statistics::detail::Locator_s&& _dst_locator); - - /*! - * @brief This function returns a constant reference to member dst_locator - * @return Constant reference to member dst_locator - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::Locator_s& dst_locator() const; - - /*! - * @brief This function returns a reference to member dst_locator - * @return Reference to member dst_locator - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::Locator_s& dst_locator(); - - - /*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ - eProsima_user_DllExport void data( - float _data); - - /*! - * @brief This function returns the value of member data - * @return Value of member data - */ - eProsima_user_DllExport float data() const; - - /*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ - eProsima_user_DllExport float& data(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::Locator2LocatorData& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::detail::Locator_s m_src_locator; - eprosima::fastdds::statistics::detail::Locator_s m_dst_locator; - float m_data; - - }; - - - - /*! - * @brief This class represents the structure EntityData defined by the user in the IDL file. - * @ingroup types - */ - class EntityData - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport EntityData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~EntityData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::EntityData that will be copied. - */ - eProsima_user_DllExport EntityData( - const EntityData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::EntityData that will be copied. - */ - eProsima_user_DllExport EntityData( - EntityData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::EntityData that will be copied. - */ - eProsima_user_DllExport EntityData& operator =( - const EntityData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::EntityData that will be copied. - */ - eProsima_user_DllExport EntityData& operator =( - EntityData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::EntityData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const EntityData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::EntityData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const EntityData& x) const; - - /*! - * @brief This function copies the value in member guid - * @param _guid New value to be copied in member guid - */ - eProsima_user_DllExport void guid( - const eprosima::fastdds::statistics::detail::GUID_s& _guid); - - /*! - * @brief This function moves the value in member guid - * @param _guid New value to be moved in member guid - */ - eProsima_user_DllExport void guid( - eprosima::fastdds::statistics::detail::GUID_s&& _guid); - - /*! - * @brief This function returns a constant reference to member guid - * @return Constant reference to member guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& guid() const; - - /*! - * @brief This function returns a reference to member guid - * @return Reference to member guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& guid(); - - - /*! - * @brief This function sets a value in member data - * @param _data New value for member data - */ - eProsima_user_DllExport void data( - float _data); - - /*! - * @brief This function returns the value of member data - * @return Value of member data - */ - eProsima_user_DllExport float data() const; - - /*! - * @brief This function returns a reference to member data - * @return Reference to member data - */ - eProsima_user_DllExport float& data(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::EntityData& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::detail::GUID_s m_guid; - float m_data; - - }; - - - - /*! - * @brief This class represents the structure PhysicalData defined by the user in the IDL file. - * @ingroup types - */ - class PhysicalData - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport PhysicalData(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~PhysicalData(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::PhysicalData that will be copied. - */ - eProsima_user_DllExport PhysicalData( - const PhysicalData& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::PhysicalData that will be copied. - */ - eProsima_user_DllExport PhysicalData( - PhysicalData&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::PhysicalData that will be copied. - */ - eProsima_user_DllExport PhysicalData& operator =( - const PhysicalData& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::PhysicalData that will be copied. - */ - eProsima_user_DllExport PhysicalData& operator =( - PhysicalData&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::PhysicalData object to compare. - */ - eProsima_user_DllExport bool operator ==( - const PhysicalData& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::PhysicalData object to compare. - */ - eProsima_user_DllExport bool operator !=( - const PhysicalData& x) const; - - /*! - * @brief This function copies the value in member participant_guid - * @param _participant_guid New value to be copied in member participant_guid - */ - eProsima_user_DllExport void participant_guid( - const eprosima::fastdds::statistics::detail::GUID_s& _participant_guid); - - /*! - * @brief This function moves the value in member participant_guid - * @param _participant_guid New value to be moved in member participant_guid - */ - eProsima_user_DllExport void participant_guid( - eprosima::fastdds::statistics::detail::GUID_s&& _participant_guid); - - /*! - * @brief This function returns a constant reference to member participant_guid - * @return Constant reference to member participant_guid - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::detail::GUID_s& participant_guid() const; - - /*! - * @brief This function returns a reference to member participant_guid - * @return Reference to member participant_guid - */ - eProsima_user_DllExport eprosima::fastdds::statistics::detail::GUID_s& participant_guid(); - - - /*! - * @brief This function copies the value in member host - * @param _host New value to be copied in member host - */ - eProsima_user_DllExport void host( - const std::string& _host); - - /*! - * @brief This function moves the value in member host - * @param _host New value to be moved in member host - */ - eProsima_user_DllExport void host( - std::string&& _host); - - /*! - * @brief This function returns a constant reference to member host - * @return Constant reference to member host - */ - eProsima_user_DllExport const std::string& host() const; - - /*! - * @brief This function returns a reference to member host - * @return Reference to member host - */ - eProsima_user_DllExport std::string& host(); - - - /*! - * @brief This function copies the value in member user - * @param _user New value to be copied in member user - */ - eProsima_user_DllExport void user( - const std::string& _user); - - /*! - * @brief This function moves the value in member user - * @param _user New value to be moved in member user - */ - eProsima_user_DllExport void user( - std::string&& _user); - - /*! - * @brief This function returns a constant reference to member user - * @return Constant reference to member user - */ - eProsima_user_DllExport const std::string& user() const; - - /*! - * @brief This function returns a reference to member user - * @return Reference to member user - */ - eProsima_user_DllExport std::string& user(); - - - /*! - * @brief This function copies the value in member process - * @param _process New value to be copied in member process - */ - eProsima_user_DllExport void process( - const std::string& _process); - - /*! - * @brief This function moves the value in member process - * @param _process New value to be moved in member process - */ - eProsima_user_DllExport void process( - std::string&& _process); - - /*! - * @brief This function returns a constant reference to member process - * @return Constant reference to member process - */ - eProsima_user_DllExport const std::string& process() const; - - /*! - * @brief This function returns a reference to member process - * @return Reference to member process - */ - eProsima_user_DllExport std::string& process(); - - - /*! - * @brief This function returns the maximum serialized size of an object - * depending on the buffer alignment. - * @param current_alignment Buffer alignment. - * @return Maximum serialized size. - */ - eProsima_user_DllExport static size_t getMaxCdrSerializedSize( - size_t current_alignment = 0); - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::PhysicalData& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - /*! - * @brief This function tells you if the Key has been defined for this type - */ - eProsima_user_DllExport static bool isKeyDefined(); - - /*! - * @brief This function serializes the key members of an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serializeKey( - eprosima::fastcdr::Cdr& cdr) const; - - - private: - - eprosima::fastdds::statistics::detail::GUID_s m_participant_guid; - std::string m_host; - std::string m_user; - std::string m_process; - - }; - - /*! - * @brief This class represents the bitmask EventKind defined by the user in the IDL file. - * @ingroup types - */ - enum EventKindBits : uint32_t - { - HISTORY2HISTORY_LATENCY = 0x01ull << 0, - NETWORK_LATENCY = 0x01ull << 1, - PUBLICATION_THROUGHPUT = 0x01ull << 2, - SUBSCRIPTION_THROUGHPUT = 0x01ull << 3, - RTPS_SENT = 0x01ull << 4, - RTPS_LOST = 0x01ull << 5, - RESENT_DATAS = 0x01ull << 6, - HEARTBEAT_COUNT = 0x01ull << 7, - ACKNACK_COUNT = 0x01ull << 8, - NACKFRAG_COUNT = 0x01ull << 9, - GAP_COUNT = 0x01ull << 10, - DATA_COUNT = 0x01ull << 11, - PDP_PACKETS = 0x01ull << 12, - EDP_PACKETS = 0x01ull << 13, - DISCOVERED_ENTITY = 0x01ull << 14, - SAMPLE_DATAS = 0x01ull << 15, - PHYSICAL_DATA = 0x01ull << 16 - }; - typedef uint32_t EventKind; - - - /*! - * @brief This class represents the union Data defined by the user in the IDL file. - * @ingroup types - */ - class Data - { - public: - - /*! - * @brief Default constructor. - */ - eProsima_user_DllExport Data(); - - /*! - * @brief Default destructor. - */ - eProsima_user_DllExport ~Data(); - - /*! - * @brief Copy constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Data that will be copied. - */ - eProsima_user_DllExport Data( - const Data& x); - - /*! - * @brief Move constructor. - * @param x Reference to the object eprosima::fastdds::statistics::Data that will be copied. - */ - eProsima_user_DllExport Data( - Data&& x) noexcept; - - /*! - * @brief Copy assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Data that will be copied. - */ - eProsima_user_DllExport Data& operator =( - const Data& x); - - /*! - * @brief Move assignment. - * @param x Reference to the object eprosima::fastdds::statistics::Data that will be copied. - */ - eProsima_user_DllExport Data& operator =( - Data&& x) noexcept; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Data object to compare. - */ - eProsima_user_DllExport bool operator ==( - const Data& x) const; - - /*! - * @brief Comparison operator. - * @param x eprosima::fastdds::statistics::Data object to compare. - */ - eProsima_user_DllExport bool operator !=( - const Data& x) const; - - /*! - * @brief This function sets the discriminator value. - * @param __d New value for the discriminator. - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member. - */ - eProsima_user_DllExport void _d( - eprosima::fastdds::statistics::EventKind __d); - - /*! - * @brief This function returns the value of the discriminator. - * @return Value of the discriminator - */ - eProsima_user_DllExport eprosima::fastdds::statistics::EventKind _d() const; - - /*! - * @brief This function returns a reference to the discriminator. - * @return Reference to the discriminator. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::EventKind& _d(); - - /*! - * @brief This function copies the value in member writer_reader_data - * @param _writer_reader_data New value to be copied in member writer_reader_data - */ - eProsima_user_DllExport void writer_reader_data( - const eprosima::fastdds::statistics::WriterReaderData& _writer_reader_data); - - /*! - * @brief This function moves the value in member writer_reader_data - * @param _writer_reader_data New value to be moved in member writer_reader_data - */ - eProsima_user_DllExport void writer_reader_data( - eprosima::fastdds::statistics::WriterReaderData&& _writer_reader_data); - - /*! - * @brief This function returns a constant reference to member writer_reader_data - * @return Constant reference to member writer_reader_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::WriterReaderData& writer_reader_data() const; - - /*! - * @brief This function returns a reference to member writer_reader_data - * @return Reference to member writer_reader_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::WriterReaderData& writer_reader_data(); - - - /*! - * @brief This function copies the value in member locator2locator_data - * @param _locator2locator_data New value to be copied in member locator2locator_data - */ - eProsima_user_DllExport void locator2locator_data( - const eprosima::fastdds::statistics::Locator2LocatorData& _locator2locator_data); - - /*! - * @brief This function moves the value in member locator2locator_data - * @param _locator2locator_data New value to be moved in member locator2locator_data - */ - eProsima_user_DllExport void locator2locator_data( - eprosima::fastdds::statistics::Locator2LocatorData&& _locator2locator_data); - - /*! - * @brief This function returns a constant reference to member locator2locator_data - * @return Constant reference to member locator2locator_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::Locator2LocatorData& locator2locator_data() const; - - /*! - * @brief This function returns a reference to member locator2locator_data - * @return Reference to member locator2locator_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::Locator2LocatorData& locator2locator_data(); - - - /*! - * @brief This function copies the value in member entity_data - * @param _entity_data New value to be copied in member entity_data - */ - eProsima_user_DllExport void entity_data( - const eprosima::fastdds::statistics::EntityData& _entity_data); - - /*! - * @brief This function moves the value in member entity_data - * @param _entity_data New value to be moved in member entity_data - */ - eProsima_user_DllExport void entity_data( - eprosima::fastdds::statistics::EntityData&& _entity_data); - - /*! - * @brief This function returns a constant reference to member entity_data - * @return Constant reference to member entity_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::EntityData& entity_data() const; - - /*! - * @brief This function returns a reference to member entity_data - * @return Reference to member entity_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::EntityData& entity_data(); - - - /*! - * @brief This function copies the value in member entity2locator_traffic - * @param _entity2locator_traffic New value to be copied in member entity2locator_traffic - */ - eProsima_user_DllExport void entity2locator_traffic( - const eprosima::fastdds::statistics::Entity2LocatorTraffic& _entity2locator_traffic); - - /*! - * @brief This function moves the value in member entity2locator_traffic - * @param _entity2locator_traffic New value to be moved in member entity2locator_traffic - */ - eProsima_user_DllExport void entity2locator_traffic( - eprosima::fastdds::statistics::Entity2LocatorTraffic&& _entity2locator_traffic); - - /*! - * @brief This function returns a constant reference to member entity2locator_traffic - * @return Constant reference to member entity2locator_traffic - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::Entity2LocatorTraffic& entity2locator_traffic() const; - - /*! - * @brief This function returns a reference to member entity2locator_traffic - * @return Reference to member entity2locator_traffic - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::Entity2LocatorTraffic& entity2locator_traffic(); - - - /*! - * @brief This function copies the value in member entity_count - * @param _entity_count New value to be copied in member entity_count - */ - eProsima_user_DllExport void entity_count( - const eprosima::fastdds::statistics::EntityCount& _entity_count); - - /*! - * @brief This function moves the value in member entity_count - * @param _entity_count New value to be moved in member entity_count - */ - eProsima_user_DllExport void entity_count( - eprosima::fastdds::statistics::EntityCount&& _entity_count); - - /*! - * @brief This function returns a constant reference to member entity_count - * @return Constant reference to member entity_count - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::EntityCount& entity_count() const; - - /*! - * @brief This function returns a reference to member entity_count - * @return Reference to member entity_count - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::EntityCount& entity_count(); - - - /*! - * @brief This function copies the value in member discovery_time - * @param _discovery_time New value to be copied in member discovery_time - */ - eProsima_user_DllExport void discovery_time( - const eprosima::fastdds::statistics::DiscoveryTime& _discovery_time); - - /*! - * @brief This function moves the value in member discovery_time - * @param _discovery_time New value to be moved in member discovery_time - */ - eProsima_user_DllExport void discovery_time( - eprosima::fastdds::statistics::DiscoveryTime&& _discovery_time); - - /*! - * @brief This function returns a constant reference to member discovery_time - * @return Constant reference to member discovery_time - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::DiscoveryTime& discovery_time() const; - - /*! - * @brief This function returns a reference to member discovery_time - * @return Reference to member discovery_time - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::DiscoveryTime& discovery_time(); - - - /*! - * @brief This function copies the value in member sample_identity_count - * @param _sample_identity_count New value to be copied in member sample_identity_count - */ - eProsima_user_DllExport void sample_identity_count( - const eprosima::fastdds::statistics::SampleIdentityCount& _sample_identity_count); - - /*! - * @brief This function moves the value in member sample_identity_count - * @param _sample_identity_count New value to be moved in member sample_identity_count - */ - eProsima_user_DllExport void sample_identity_count( - eprosima::fastdds::statistics::SampleIdentityCount&& _sample_identity_count); - - /*! - * @brief This function returns a constant reference to member sample_identity_count - * @return Constant reference to member sample_identity_count - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::SampleIdentityCount& sample_identity_count() const; - - /*! - * @brief This function returns a reference to member sample_identity_count - * @return Reference to member sample_identity_count - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::SampleIdentityCount& sample_identity_count(); - - - /*! - * @brief This function copies the value in member physical_data - * @param _physical_data New value to be copied in member physical_data - */ - eProsima_user_DllExport void physical_data( - const eprosima::fastdds::statistics::PhysicalData& _physical_data); - - /*! - * @brief This function moves the value in member physical_data - * @param _physical_data New value to be moved in member physical_data - */ - eProsima_user_DllExport void physical_data( - eprosima::fastdds::statistics::PhysicalData&& _physical_data); - - /*! - * @brief This function returns a constant reference to member physical_data - * @return Constant reference to member physical_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport const eprosima::fastdds::statistics::PhysicalData& physical_data() const; - - /*! - * @brief This function returns a reference to member physical_data - * @return Reference to member physical_data - * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection. - */ - eProsima_user_DllExport eprosima::fastdds::statistics::PhysicalData& physical_data(); - - - /*! - * @brief This function returns the serialized size of a data depending on the buffer alignment. - * @param data Data which is calculated its serialized size. - * @param current_alignment Buffer alignment. - * @return Serialized size. - */ - eProsima_user_DllExport static size_t getCdrSerializedSize( - const eprosima::fastdds::statistics::Data& data, - size_t current_alignment = 0); - - - - /*! - * @brief This function serializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& cdr) const; - - /*! - * @brief This function deserializes an object using CDR serialization. - * @param cdr CDR serialization object. - */ - eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr); - - - - - - private: - - eprosima::fastdds::statistics::EventKind m__d; - - eprosima::fastdds::statistics::WriterReaderData m_writer_reader_data; - eprosima::fastdds::statistics::Locator2LocatorData m_locator2locator_data; - eprosima::fastdds::statistics::EntityData m_entity_data; - eprosima::fastdds::statistics::Entity2LocatorTraffic m_entity2locator_traffic; - eprosima::fastdds::statistics::EntityCount m_entity_count; - eprosima::fastdds::statistics::DiscoveryTime m_discovery_time; - eprosima::fastdds::statistics::SampleIdentityCount m_sample_identity_count; - eprosima::fastdds::statistics::PhysicalData m_physical_data; - }; - - } // namespace statistics - } // namespace fastdds -} // namespace eprosima - -#endif // _FAST_DDS_GENERATED_EPROSIMA_FASTDDS_STATISTICS_TYPES_H_ - - - -#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/include/fastdds_statistics_backend/types/Bitmask.hpp b/include/fastdds_statistics_backend/types/Bitmask.hpp index 6147ffe65..2b1bd9b82 100644 --- a/include/fastdds_statistics_backend/types/Bitmask.hpp +++ b/include/fastdds_statistics_backend/types/Bitmask.hpp @@ -17,8 +17,8 @@ * @file Bitmask.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_BITMASK_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_BITMASK_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_TYPES__BITMASK_HPP +#define FASTDDS_STATISTICS_BACKEND_TYPES__BITMASK_HPP #include @@ -85,20 +85,23 @@ class Bitmask Bitmask( const Bitmask& other) = default; - Bitmask& operator=( + Bitmask& operator =( const Bitmask& other) = default; - void set (const E& value) + void set ( + const E& value) { mask_ |= static_cast(value); } - void clear (const E& value) + void clear ( + const E& value) { mask_ &= ~static_cast(value); } - bool is_set(const E& value) const + bool is_set( + const E& value) const { underlying_type v = static_cast(value); return (mask_ & v) == v; @@ -114,73 +117,84 @@ class Bitmask return Bitmask(static_cast(-1)); } - Bitmask& operator&= (const Bitmask& other) + Bitmask& operator &= ( + const Bitmask& other) { mask_ &= other.mask_; return *this; } - Bitmask& operator&= (const E& value) + Bitmask& operator &= ( + const E& value) { mask_ &= static_cast(value); return *this; } - Bitmask operator& (const Bitmask& other) const + Bitmask operator & ( + const Bitmask& other) const { Bitmask result = *this; return result &= other; } - Bitmask operator& (const E& value) const + Bitmask operator & ( + const E& value) const { Bitmask result = *this; return result &= value; } - Bitmask& operator|= (const Bitmask& other) + Bitmask& operator |= ( + const Bitmask& other) { mask_ |= other.mask_; return *this; } - Bitmask& operator|= (const E& value) + Bitmask& operator |= ( + const E& value) { mask_ |= static_cast(value); return *this; } - Bitmask operator| (const Bitmask& other) const + Bitmask operator | ( + const Bitmask& other) const { Bitmask result = *this; return result |= other; } - Bitmask operator| (const E& value) const + Bitmask operator | ( + const E& value) const { Bitmask result = *this; return result |= value; } - Bitmask& operator^= (const Bitmask& other) + Bitmask& operator ^= ( + const Bitmask& other) { mask_ ^= other.mask_; return *this; } - Bitmask& operator^= (const E& value) + Bitmask& operator ^= ( + const E& value) { mask_ ^= static_cast(value); return *this; } - Bitmask operator^ (const Bitmask& other) const + Bitmask operator ^ ( + const Bitmask& other) const { Bitmask result = *this; return result ^= other; } - Bitmask operator~ () const + Bitmask operator ~ () const { Bitmask result(~mask_); return result; @@ -198,28 +212,33 @@ class Bitmask }; template -Bitmask operator& (const E& lhs, const E& rhs) +Bitmask operator & ( + const E& lhs, + const E& rhs) { Bitmask result (lhs); return result &= rhs; } template -Bitmask operator| (const E& lhs, const E& rhs) +Bitmask operator | ( + const E& lhs, + const E& rhs) { Bitmask result (lhs); return result |= rhs; } template -Bitmask operator^ (const E& lhs, const E& rhs) +Bitmask operator ^ ( + const E& lhs, + const E& rhs) { Bitmask result (lhs); return result ^= rhs; } - } //namespace statistics_backend } //namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_BITMASK_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_TYPES__BITMASK_HPP diff --git a/include/fastdds_statistics_backend/types/EntityId.hpp b/include/fastdds_statistics_backend/types/EntityId.hpp index 1e1c7a466..3c4fa4102 100644 --- a/include/fastdds_statistics_backend/types/EntityId.hpp +++ b/include/fastdds_statistics_backend/types/EntityId.hpp @@ -16,8 +16,8 @@ * @file EntityId.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_ENTITYID_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_ENTITYID_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_TYPES__ENTITY_ID_HPP +#define FASTDDS_STATISTICS_BACKEND_TYPES__ENTITY_ID_HPP #include @@ -213,4 +213,4 @@ FASTDDS_STATISTICS_BACKEND_DllAPI inline bool operator !=( } // namespace statistics_backend } // namespace eprosima -#endif //_EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_ENTITYID_HPP_ +#endif //FASTDDS_STATISTICS_BACKEND_TYPES__ENTITY_ID_HPP diff --git a/include/fastdds_statistics_backend/types/JSONTags.h b/include/fastdds_statistics_backend/types/JSONTags.h index f6178f608..3f450acb6 100644 --- a/include/fastdds_statistics_backend/types/JSONTags.h +++ b/include/fastdds_statistics_backend/types/JSONTags.h @@ -16,8 +16,8 @@ * @file JSONTags.h */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_JSONTAGS_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_JSONTAGS_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_TYPES__JSON_TAGS_H +#define FASTDDS_STATISTICS_BACKEND_TYPES__JSON_TAGS_H namespace eprosima { namespace statistics_backend { @@ -226,4 +226,4 @@ constexpr const char* DATA_VALUE_DISCOVERED_TAG = "discovered"; } //namespace statistics_backend } //namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_JSONTAGS_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_TYPES__JSON_TAGS_H diff --git a/include/fastdds_statistics_backend/types/app_names.h b/include/fastdds_statistics_backend/types/app_names.h index 9cf5d1957..02e9c1c3d 100644 --- a/include/fastdds_statistics_backend/types/app_names.h +++ b/include/fastdds_statistics_backend/types/app_names.h @@ -16,8 +16,8 @@ * @file app_names.h */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_APP_NAMES_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_APP_NAMES_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_TYPES__APP_NAMES_H +#define FASTDDS_STATISTICS_BACKEND_TYPES__APP_NAMES_H #include @@ -74,4 +74,4 @@ const std::map app_id_enum = { } //namespace statistics_backend } //namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_APP_NAMES_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_TYPES__APP_NAMES_H diff --git a/include/fastdds_statistics_backend/types/types.hpp b/include/fastdds_statistics_backend/types/types.hpp index fccac5e5a..8195552bd 100644 --- a/include/fastdds_statistics_backend/types/types.hpp +++ b/include/fastdds_statistics_backend/types/types.hpp @@ -17,13 +17,13 @@ * @file types.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_TYPES_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_TYPES_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_TYPES__TYPES_HPP +#define FASTDDS_STATISTICS_BACKEND_TYPES__TYPES_HPP #include #include #include -#include +#include #include @@ -646,4 +646,4 @@ struct SampleLostSample : MonitorServiceSample } //namespace statistics_backend } //namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_TYPES_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_TYPES__TYPES_HPP diff --git a/include/fastdds_statistics_backend/types/utils.hpp b/include/fastdds_statistics_backend/types/utils.hpp index 5c0a159a0..ae803e282 100644 --- a/include/fastdds_statistics_backend/types/utils.hpp +++ b/include/fastdds_statistics_backend/types/utils.hpp @@ -17,8 +17,8 @@ * @file utils.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_UTILS_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_UTILS_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_TYPES__UTILS_HPP +#define FASTDDS_STATISTICS_BACKEND_TYPES__UTILS_HPP #include @@ -54,4 +54,4 @@ inline Timestamp the_initial_time() noexcept } //namespace statistics_backend } //namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_UTILS_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_TYPES__UTILS_HPP diff --git a/package.xml b/package.xml index c0839bb99..29b30b20b 100644 --- a/package.xml +++ b/package.xml @@ -18,7 +18,7 @@ https://github.com/eProsima/Fast-DDS-statistics-backend fastcdr - fastrtps + fastdds cmake diff --git a/readthedocs.yaml b/readthedocs.yaml index d462c5988..dde46c0c6 100644 --- a/readthedocs.yaml +++ b/readthedocs.yaml @@ -11,9 +11,9 @@ sphinx: # Set OS specifically for version compatibility build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: - python: "3.11" + python: "3.12" # Build documentation with MkDocs #mkdocs: diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 90a218bce..2e7002ea1 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -34,12 +34,10 @@ set(${PROJECT_NAME}_SOURCES subscriber/QosSerializer.cpp subscriber/StatisticsParticipantListener.cpp subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx types/EntityId.cpp types/types.cpp ) @@ -86,7 +84,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC target_link_libraries(${PROJECT_NAME} fastcdr - fastrtps + fastdds ) if(MSVC OR MSVC_IDE) diff --git a/src/cpp/Monitor.hpp b/src/cpp/Monitor.hpp index 23aa69d6b..74e5650f6 100644 --- a/src/cpp/Monitor.hpp +++ b/src/cpp/Monitor.hpp @@ -16,14 +16,14 @@ * @file Monitor.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_MONITOR_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_MONITOR_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP__MONITOR_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP__MONITOR_HPP #include #include -#include #include +#include #include namespace eprosima { @@ -100,4 +100,4 @@ struct Monitor } // namespace statistics_backend } // namespace eprosima -#endif //_EPROSIMA_FASTDDS_STATISTICS_BACKEND_MONITOR_HPP_ +#endif //FASTDDS_STATISTICS_BACKEND_SRC_CPP__MONITOR_HPP diff --git a/src/cpp/StatisticsBackend.cpp b/src/cpp/StatisticsBackend.cpp index 26029ea47..a05858a3f 100644 --- a/src/cpp/StatisticsBackend.cpp +++ b/src/cpp/StatisticsBackend.cpp @@ -34,13 +34,12 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include #include #include -#include +#include #include #include @@ -49,13 +48,15 @@ #include #include #include -#include -#include -#include "Monitor.hpp" -#include "StatisticsBackendData.hpp" -#include "detail/data_getters.hpp" +#include + +#include + #include "detail/data_aggregation.hpp" +#include "detail/data_getters.hpp" #include "detail/ScopeExit.hpp" +#include "Monitor.hpp" +#include "StatisticsBackendData.hpp" using namespace eprosima::fastdds::dds; using namespace eprosima::fastdds::rtps; @@ -65,7 +66,6 @@ using namespace eprosima::statistics_backend::details; namespace eprosima { namespace statistics_backend { - static const char* topics[] = { HISTORY_LATENCY_TOPIC, @@ -97,9 +97,9 @@ void find_or_create_topic_and_type( TopicDescription* topic_desc = monitor.participant->lookup_topicdescription(topic_name); if (nullptr != topic_desc) { - if (topic_desc->get_type_name() != type->getName()) + if (topic_desc->get_type_name() != type->get_name()) { - throw Error(topic_name + " is not using expected type " + type->getName() + + throw Error(topic_name + " is not using expected type " + type->get_name() + " and is using instead type " + topic_desc->get_type_name()); } @@ -116,13 +116,13 @@ void find_or_create_topic_and_type( } else { - if (ReturnCode_t::RETCODE_PRECONDITION_NOT_MET == monitor.participant->register_type(type, type->getName())) + if (RETCODE_PRECONDITION_NOT_MET == monitor.participant->register_type(type, type->get_name())) { // Name already in use - throw Error(std::string("Type name ") + type->getName() + " is already in use"); + throw Error(std::string("Type name ") + type->get_name() + " is already in use"); } monitor.topics[topic_name] = - monitor.participant->create_topic(topic_name, type->getName(), TOPIC_QOS_DEFAULT); + monitor.participant->create_topic(topic_name, type->get_name(), TOPIC_QOS_DEFAULT); } } @@ -414,19 +414,6 @@ EntityId StatisticsBackend::init_monitor( DataKindMask data_mask, std::string app_id, std::string app_metadata) -{ - return init_monitor(DEFAULT_ROS2_SERVER_GUIDPREFIX, discovery_server_locators, domain_listener, callback_mask, - data_mask, app_id, app_metadata); -} - -EntityId StatisticsBackend::init_monitor( - std::string discovery_server_guid_prefix, - std::string discovery_server_locators, - DomainListener* domain_listener, - CallbackMask callback_mask, - DataKindMask data_mask, - std::string app_id, - std::string app_metadata) { /* Deactivate statistics in case they were set */ #ifdef _WIN32 @@ -439,8 +426,6 @@ EntityId StatisticsBackend::init_monitor( /* Since configuring the default Qos from an XML is a posibility, we need to load the XML profiles just in case */ DomainParticipantFactory::get_instance()->load_profiles(); DomainParticipantQos participant_qos = DomainParticipantFactory::get_instance()->get_default_participant_qos(); - participant_qos.name("monitor_discovery_server_" + discovery_server_guid_prefix); - /* Avoid using SHM transport by default */ std::shared_ptr udp_transport = std::make_shared(); @@ -456,18 +441,19 @@ EntityId StatisticsBackend::init_monitor( app_metadata, "true"); + // Set monitor as SUPER CLIENT participant_qos.wire_protocol().builtin.discovery_config.discoveryProtocol = - eprosima::fastrtps::rtps::DiscoveryProtocol_t::SUPER_CLIENT; - RemoteServerAttributes server; - // Set the server guidPrefix - server.ReadguidPrefix(discovery_server_guid_prefix.c_str()); + eprosima::fastdds::rtps::DiscoveryProtocol::SUPER_CLIENT; + // Add locators std::stringstream locators(discovery_server_locators); std::string locator_str; + bool set_locator = false; + std::string participant_name; while (std::getline(locators, locator_str, ';')) { std::stringstream ss(locator_str); - eprosima::fastrtps::rtps::Locator_t locator; + eprosima::fastdds::rtps::Locator_t locator; ss >> locator; if (!IsLocatorValid(locator) || !IsAddressDefined(locator) || ss.rdbuf()->in_avail() != 0) { @@ -479,18 +465,26 @@ EntityId StatisticsBackend::init_monitor( } // Check unicast/multicast address - if (eprosima::fastrtps::rtps::IPLocator::isMulticast(locator)) + if (eprosima::fastdds::rtps::IPLocator::isMulticast(locator)) { - server.metatrafficMulticastLocatorList.push_back(locator); + participant_qos.wire_protocol().builtin.metatrafficMulticastLocatorList.push_back(locator); } else { - server.metatrafficUnicastLocatorList.push_back(locator); + participant_qos.wire_protocol().builtin.metatrafficUnicastLocatorList.push_back(locator); + } + + // Add remote SERVER to Monitor's list of SERVERs + participant_qos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(locator); + + if (!set_locator) + { + participant_name = "DiscoveryServer_" + locator_str; + set_locator = true; } } - participant_qos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.push_back(server); - return create_and_register_monitor(discovery_server_guid_prefix, domain_listener, callback_mask, data_mask, + return create_and_register_monitor(participant_name, domain_listener, callback_mask, data_mask, participant_qos); } diff --git a/src/cpp/StatisticsBackendData.hpp b/src/cpp/StatisticsBackendData.hpp index 206e553d3..f359e939b 100644 --- a/src/cpp/StatisticsBackendData.hpp +++ b/src/cpp/StatisticsBackendData.hpp @@ -16,8 +16,8 @@ * @file StatisticsBackendData.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATA_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATA_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP__STATISTICS_BACKEND_DATA_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP__STATISTICS_BACKEND_DATA_HPP #include #include @@ -331,4 +331,4 @@ class StatisticsBackendData } // namespace statistics_backend } // namespace eprosima -#endif //_EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATA_HPP_ +#endif //FASTDDS_STATISTICS_BACKEND_SRC_CPP__STATISTICS_BACKEND_DATA_HPP diff --git a/src/cpp/database/data.hpp b/src/cpp/database/data.hpp index 4f9dc0761..64fc48f09 100644 --- a/src/cpp/database/data.hpp +++ b/src/cpp/database/data.hpp @@ -17,8 +17,8 @@ * @file data.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_DATA_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_DATA_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__DATA_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__DATA_HPP #include #include @@ -447,4 +447,4 @@ struct DomainParticipantMonitorServiceData : public Data } //namespace statistics_backend } //namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_DATA_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__DATA_HPP diff --git a/src/cpp/database/database.cpp b/src/cpp/database/database.cpp index e63b1673d..3bf404c8a 100644 --- a/src/cpp/database/database.cpp +++ b/src/cpp/database/database.cpp @@ -285,7 +285,7 @@ EntityId Database::insert_new_endpoint( const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const fastrtps::rtps::RemoteLocatorList& locators, + const fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -339,7 +339,7 @@ EntityId Database::insert_new_endpoint( /* Start processing the locator info */ // Routine to process one locator from the locator list of the endpoint - auto process_locators = [&](const eprosima::fastrtps::rtps::Locator_t& dds_locator) + auto process_locators = [&](const eprosima::fastdds::rtps::Locator_t& dds_locator) { std::shared_ptr locator; @@ -2980,13 +2980,13 @@ EntityKind Database::get_entity_kind_by_guid( const eprosima::fastdds::statistics::detail::GUID_s& guid_s) const { - eprosima::fastrtps::rtps::EntityId_t entity_id_t; + eprosima::fastdds::rtps::EntityId_t entity_id_t; for (size_t i = 0; i < entity_id_t.size; ++i) { entity_id_t.value[i] = guid_s.entityId().value()[i]; } - if (entity_id_t == eprosima::fastrtps::rtps::c_EntityId_RTPSParticipant) + if (entity_id_t == eprosima::fastdds::rtps::c_EntityId_RTPSParticipant) { return EntityKind::PARTICIPANT; } @@ -3372,7 +3372,7 @@ bool Database::regenerate_domain_graph_nts( } else { - logWarning(BACKEND_DATABASE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE, "Error regenerating graph. No previous graph was found"); return false; } diff --git a/src/cpp/database/database.hpp b/src/cpp/database/database.hpp index a9b0315b2..f6b25a253 100644 --- a/src/cpp/database/database.hpp +++ b/src/cpp/database/database.hpp @@ -17,8 +17,8 @@ * @file database.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_DATABASE_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_DATABASE_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__DATABASE_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__DATABASE_HPP #include #include @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include @@ -177,7 +177,7 @@ class Database const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const fastrtps::rtps::RemoteLocatorList& locators, + const fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -1518,4 +1518,4 @@ void Database::get_status_data( } //namespace statistics_backend } //namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_DATABASE_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__DATABASE_HPP diff --git a/src/cpp/database/database_queue.cpp b/src/cpp/database/database_queue.cpp index a1316a040..e94f11f3b 100644 --- a/src/cpp/database/database_queue.cpp +++ b/src/cpp/database/database_queue.cpp @@ -26,7 +26,7 @@ namespace statistics_backend { namespace database { using namespace eprosima::fastdds::dds; -using namespace eprosima::fastrtps::rtps; +using namespace eprosima::fastdds::rtps; template std::string to_string( @@ -71,9 +71,7 @@ EntityId DatabaseEntityQueue::process_participant( { // See if the participant is already in the database // This will throw if the participant is unknown - participant_id = database_->get_entity_by_guid( - EntityKind::PARTICIPANT, to_string(info.guid)) - .second; + participant_id = database_->get_entity_by_guid(EntityKind::PARTICIPANT, to_string(info.guid)).second; // Update the entity status and check if its references must also change it status database_->change_entity_status(participant_id, @@ -129,7 +127,7 @@ EntityId DatabaseEntityQueue::process_participant( { process_name = info.process; process_pid = info.process; - logInfo(BACKEND_DATABASE, + EPROSIMA_LOG_INFO(BACKEND_DATABASE, "Process name " + process_name + " does not follow the [command]:[PID] pattern"); } else @@ -150,7 +148,7 @@ EntityId DatabaseEntityQueue::process_participant( } catch (const std::exception& e) { - logError(BACKEND_DATABASE_QUEUE, e.what()); + EPROSIMA_LOG_ERROR(BACKEND_DATABASE_QUEUE, e.what()); } graph_updated = database_->update_participant_in_graph( @@ -174,9 +172,7 @@ EntityId DatabaseEntityQueue::process_datareader( { // See if the reader is already in the database // This will throw if the reader is unknown - datareader_id = - database_->get_entity_by_guid( - EntityKind::DATAREADER, to_string(info.guid)).second; + datareader_id = database_->get_entity_by_guid(EntityKind::DATAREADER, to_string(info.guid)).second; // Update the entity status and check if its references must also change it status database_->change_entity_status(datareader_id, @@ -247,9 +243,7 @@ EntityId DatabaseEntityQueue::process_datawriter( { // See if the writer is already in the database // This will throw if the writer is unknown - datawriter_id = - database_->get_entity_by_guid( - EntityKind::DATAWRITER, to_string(info.guid)).second; + datawriter_id = database_->get_entity_by_guid(EntityKind::DATAWRITER, to_string(info.guid)).second; // Update the entity status and check if its references must also change it status database_->change_entity_status(datawriter_id, @@ -829,7 +823,7 @@ void DatabaseDataQueue: sample.kind = StatusKind::INCONSISTENT_TOPIC; // Appropriate behavior not yet implemented - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Warning processing INCONSISTENT_TOPIC status data. Status behavior not yet defined"); sample.status = StatusLevel::OK_STATUS; @@ -1000,7 +994,7 @@ void DatabaseDataQueue::process_sample() { switch (front().second->_d()) { - case StatisticsEventKind::HISTORY2HISTORY_LATENCY: + case fastdds::statistics::EventKind::HISTORY2HISTORY_LATENCY: { HistoryLatencySample sample; EntityId domain; @@ -1016,14 +1010,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, - "Error processing HISTORY2HISTORY_LATENCY event. Data was not added to the statistics collection: " - + std::string( + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, + "Error processing HISTORY2HISTORY_LATENCY event. Data was not added to the statistics collection: " + std::string( e.what())); } break; } - case StatisticsEventKind::NETWORK_LATENCY: + case fastdds::statistics::EventKind::NETWORK_LATENCY: { NetworkLatencySample sample; EntityId domain; @@ -1040,13 +1033,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing NETWORK_LATENCY event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::PUBLICATION_THROUGHPUT: + case fastdds::statistics::EventKind::PUBLICATION_THROUGHPUT: { PublicationThroughputSample sample; EntityId domain; @@ -1063,14 +1056,14 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing PUBLICATION_THROUGHPUT event. Data was not added to the statistics collection: " + std::string( e.what())); } break; } - case StatisticsEventKind::SUBSCRIPTION_THROUGHPUT: + case fastdds::statistics::EventKind::SUBSCRIPTION_THROUGHPUT: { SubscriptionThroughputSample sample; EntityId domain; @@ -1087,14 +1080,14 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing SUBSCRIPTION_THROUGHPUT event. Data was not added to the statistics collection: " + std::string( e.what())); } break; } - case StatisticsEventKind::RTPS_SENT: + case fastdds::statistics::EventKind::RTPS_SENT: { RtpsPacketsSentSample packet_sample; RtpsBytesSentSample byte_sample; @@ -1113,7 +1106,7 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing RTPS_SENT event. Data was not added to the statistics collection: " + std::string(e.what())); } @@ -1130,13 +1123,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing RTPS_SENT event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::RTPS_LOST: + case fastdds::statistics::EventKind::RTPS_LOST: { RtpsPacketsLostSample packet_sample; @@ -1155,7 +1148,7 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing RTPS_LOST event. Data was not added to the statistics collection: " + std::string(e.what())); } @@ -1172,13 +1165,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing RTPS_LOST event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::RESENT_DATAS: + case fastdds::statistics::EventKind::RESENT_DATAS: { ResentDataSample sample; EntityId domain; @@ -1195,13 +1188,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing RESENT_DATAS event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::HEARTBEAT_COUNT: + case fastdds::statistics::EventKind::HEARTBEAT_COUNT: { HeartbeatCountSample sample; EntityId domain; @@ -1218,13 +1211,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing HEARTBEAT_COUNT event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::ACKNACK_COUNT: + case fastdds::statistics::EventKind::ACKNACK_COUNT: { AcknackCountSample sample; EntityId domain; @@ -1241,13 +1234,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing ACKNACK_COUNT event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::NACKFRAG_COUNT: + case fastdds::statistics::EventKind::NACKFRAG_COUNT: { NackfragCountSample sample; EntityId domain; @@ -1264,13 +1257,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing NACKFRAG_COUNT event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::GAP_COUNT: + case fastdds::statistics::EventKind::GAP_COUNT: { GapCountSample sample; EntityId domain; @@ -1286,13 +1279,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing GAP_COUNT event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::DATA_COUNT: + case fastdds::statistics::EventKind::DATA_COUNT: { DataCountSample sample; EntityId domain; @@ -1308,13 +1301,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing DATA_COUNT event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::PDP_PACKETS: + case fastdds::statistics::EventKind::PDP_PACKETS: { PdpCountSample sample; EntityId domain; @@ -1331,13 +1324,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing PDP_PACKETS event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::EDP_PACKETS: + case fastdds::statistics::EventKind::EDP_PACKETS: { EdpCountSample sample; EntityId domain; @@ -1354,13 +1347,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing EDP_PACKETS event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::DISCOVERED_ENTITY: + case fastdds::statistics::EventKind::DISCOVERED_ENTITY: { DiscoveryTimeSample sample; EntityId domain; @@ -1376,13 +1369,13 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing DISCOVERED_ENTITY event. Data was not added to the statistics collection: " + std::string(e.what())); } break; } - case StatisticsEventKind::SAMPLE_DATAS: + case fastdds::statistics::EventKind::SAMPLE_DATAS: { SampleDatasCountSample sample; EntityId domain; @@ -1399,7 +1392,7 @@ void DatabaseDataQueue::process_sample() } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing SAMPLE_DATAS event. Data was not added to the statistics collection: " + std::string(e.what())); } @@ -1422,7 +1415,7 @@ void DatabaseDataQueue: switch (front().second->status_kind()) { - case StatisticsStatusKind::PROXY: + case fastdds::statistics::StatusKind::PROXY: { ProxySample sample; queue_item_type item = front(); @@ -1437,14 +1430,14 @@ void DatabaseDataQueue: } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing PROXY status data. Data was not added to the statistics collection: " + std::string( e.what())); } break; } - case StatisticsStatusKind::CONNECTION_LIST: + case fastdds::statistics::StatusKind::CONNECTION_LIST: { ConnectionListSample sample; queue_item_type item = front(); @@ -1460,14 +1453,14 @@ void DatabaseDataQueue: } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing CONNECTION_LIST status data. Data was not added to the statistics collection: " + std::string( e.what())); } break; } - case StatisticsStatusKind::INCOMPATIBLE_QOS: + case fastdds::statistics::StatusKind::INCOMPATIBLE_QOS: { IncompatibleQosSample sample; queue_item_type item = front(); @@ -1483,14 +1476,14 @@ void DatabaseDataQueue: } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing INCOMPATIBLE_QOS status data. Data was not added to the statistics collection: " + std::string( e.what())); } break; } - case StatisticsStatusKind::INCONSISTENT_TOPIC: + case fastdds::statistics::StatusKind::INCONSISTENT_TOPIC: { InconsistentTopicSample sample; queue_item_type item = front(); @@ -1506,14 +1499,14 @@ void DatabaseDataQueue: } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing INCONSISTENT_TOPIC status data. Data was not added to the statistics collection: " + std::string( e.what())); } break; } - case StatisticsStatusKind::LIVELINESS_LOST: + case fastdds::statistics::StatusKind::LIVELINESS_LOST: { LivelinessLostSample sample; queue_item_type item = front(); @@ -1529,14 +1522,14 @@ void DatabaseDataQueue: } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing LIVELINESS_LOST status data. Data was not added to the statistics collection: " + std::string( e.what())); } break; } - case StatisticsStatusKind::LIVELINESS_CHANGED: + case fastdds::statistics::StatusKind::LIVELINESS_CHANGED: { LivelinessChangedSample sample; queue_item_type item = front(); @@ -1552,14 +1545,14 @@ void DatabaseDataQueue: } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing LIVELINESS_CHANGED status data. Data was not added to the statistics collection: " + std::string( e.what())); } break; } - case StatisticsStatusKind::DEADLINE_MISSED: + case fastdds::statistics::StatusKind::DEADLINE_MISSED: { DeadlineMissedSample sample; queue_item_type item = front(); @@ -1575,14 +1568,14 @@ void DatabaseDataQueue: } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing DEADLINE_MISSED status data. Data was not added to the statistics collection: " + std::string( e.what())); } break; } - case StatisticsStatusKind::SAMPLE_LOST: + case fastdds::statistics::StatusKind::SAMPLE_LOST: { SampleLostSample sample; queue_item_type item = front(); @@ -1598,17 +1591,16 @@ void DatabaseDataQueue: } catch (const eprosima::statistics_backend::Exception& e) { - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Error processing SAMPLE_LOST status data. Data was not added to the statistics collection: " - + std::string( - e.what())); + + std::string(e.what())); } break; } - case StatisticsStatusKind::STATUSES_SIZE: + case fastdds::statistics::StatusKind::STATUSES_SIZE: { //Not yet implemented - logWarning(BACKEND_DATABASE_QUEUE, + EPROSIMA_LOG_WARNING(BACKEND_DATABASE_QUEUE, "Warning processing STATUSES_SIZE status data. Not yet implemented"); break; } diff --git a/src/cpp/database/database_queue.hpp b/src/cpp/database/database_queue.hpp index 0ff12add7..6c2ac7b7b 100644 --- a/src/cpp/database/database_queue.hpp +++ b/src/cpp/database/database_queue.hpp @@ -17,8 +17,8 @@ * @file database_queue.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_DATABASE_QUEUE_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_DATABASE_QUEUE_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__DATABASE_QUEUE_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__DATABASE_QUEUE_HPP #include #include @@ -27,9 +27,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -55,9 +55,6 @@ class DatabaseQueue public: - using StatisticsEventKind = eprosima::fastdds::statistics::EventKindBits; - using StatisticsStatusKind = eprosima::fastdds::statistics::StatusKind; - using StatisticsWriterReaderData = eprosima::fastdds::statistics::WriterReaderData; using StatisticsLocator2LocatorData = eprosima::fastdds::statistics::Locator2LocatorData; using StatisticsEntityData = eprosima::fastdds::statistics::EntityData; @@ -361,7 +358,7 @@ struct EntityDiscoveryInfo details::StatisticsBackendData::DiscoveryStatus discovery_status; EntityId domain_id; - fastrtps::rtps::GUID_t guid; + fastdds::rtps::GUID_t guid; database::Qos qos; // Participant data @@ -378,7 +375,7 @@ struct EntityDiscoveryInfo // Enpoint data std::string topic_name; std::string type_name; - fastrtps::rtps::RemoteLocatorList locators; + fastdds::rtps::RemoteLocatorList locators; // Alias std::string alias; @@ -466,7 +463,7 @@ class DatabaseEntityQueue : public DatabaseQueue } catch (const eprosima::statistics_backend::Exception& e) { - logError(BACKEND_DATABASE_QUEUE, e.what()); + EPROSIMA_LOG_ERROR(BACKEND_DATABASE_QUEUE, e.what()); } } @@ -575,9 +572,9 @@ class DatabaseDataQueue : public DatabaseQueue> std::string deserialize_guid( StatisticsGuid data) const { - eprosima::fastrtps::rtps::GUID_t guid; - memcpy(guid.guidPrefix.value, data.guidPrefix().value().data(), eprosima::fastrtps::rtps::GuidPrefix_t::size); - memcpy(guid.entityId.value, data.entityId().value().data(), eprosima::fastrtps::rtps::EntityId_t::size); + eprosima::fastdds::rtps::GUID_t guid; + memcpy(guid.guidPrefix.value, data.guidPrefix().value().data(), eprosima::fastdds::rtps::GuidPrefix_t::size); + memcpy(guid.entityId.value, data.entityId().value().data(), eprosima::fastdds::rtps::EntityId_t::size); std::stringstream ss; ss << guid; return ss.str(); @@ -590,10 +587,11 @@ class DatabaseDataQueue : public DatabaseQueue> { throw Error("Wrong format: src_locator.port must be 0"); } - eprosima::fastrtps::rtps::GUID_t guid; - memcpy(guid.guidPrefix.value, data.address().data(), eprosima::fastrtps::rtps::GuidPrefix_t::size); - memcpy(guid.entityId.value, data.address().data() + eprosima::fastrtps::rtps::GuidPrefix_t::size, - eprosima::fastrtps::rtps::EntityId_t::size); + eprosima::fastdds::rtps::GUID_t guid; + memcpy(guid.guidPrefix.value, data.address().data(), eprosima::fastdds::rtps::GuidPrefix_t::size); + memcpy(guid.entityId.value, + data.address().data() + eprosima::fastdds::rtps::GuidPrefix_t::size, + eprosima::fastdds::rtps::EntityId_t::size); std::stringstream ss; ss << guid; return ss.str(); @@ -606,7 +604,7 @@ class DatabaseDataQueue : public DatabaseQueue> uint32_t port = data.port(); std::array address = data.address(); - eprosima::fastrtps::rtps::Locator_t locator(kind, port); + eprosima::fastdds::rtps::Locator_t locator(kind, port); memcpy(locator.address, address.data(), address.size()); std::stringstream ss; ss << locator; @@ -619,7 +617,7 @@ class DatabaseDataQueue : public DatabaseQueue> int32_t high = data.high(); uint32_t low = data.low(); - return eprosima::fastrtps::rtps::SequenceNumber_t(high, low).to64long(); + return eprosima::fastdds::rtps::SequenceNumber_t(high, low).to64long(); } std::pair deserialize_sample_identity( @@ -824,4 +822,4 @@ void DatabaseDataQueue: } //namespace statistics_backend } //namespace eprosima -#endif //_EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_DATABASE_QUEUE_HPP_ +#endif //FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__DATABASE_QUEUE_HPP diff --git a/src/cpp/database/entities.hpp b/src/cpp/database/entities.hpp index dd68c77f0..c787695ef 100644 --- a/src/cpp/database/entities.hpp +++ b/src/cpp/database/entities.hpp @@ -17,8 +17,8 @@ * @file entities.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_ENTITIES_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_ENTITIES_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__ENTITIES_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__ENTITIES_HPP #include @@ -486,4 +486,4 @@ struct Locator : Entity } //namespace statistics_backend } //namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_ENTITIES_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__ENTITIES_HPP diff --git a/src/cpp/database/samples.hpp b/src/cpp/database/samples.hpp index 2504ae9af..26ce48c7a 100644 --- a/src/cpp/database/samples.hpp +++ b/src/cpp/database/samples.hpp @@ -17,8 +17,8 @@ * @file samples.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_SAMPLES_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_SAMPLES_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__SAMPLES_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__SAMPLES_HPP #include @@ -738,4 +738,4 @@ struct SampleDatasCountSample : EntityCountSample } //namespace statistics_backend } //namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DATABASE_SAMPLES_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_SRC_CPP_DATABASE__SAMPLES_HPP diff --git a/src/cpp/detail/ScopeExit.hpp b/src/cpp/detail/ScopeExit.hpp index e8564d03a..fe8a41a19 100644 --- a/src/cpp/detail/ScopeExit.hpp +++ b/src/cpp/detail/ScopeExit.hpp @@ -26,8 +26,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DETAIL_SCOPE_EXIT_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DETAIL_SCOPE_EXIT_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_DETAIL__SCOPE_EXIT_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_DETAIL__SCOPE_EXIT_HPP #include @@ -90,4 +90,4 @@ make_scope_exit( #define EPROSIMA_BACKEND_MAKE_SCOPE_EXIT(code) \ eprosima::statistics_backend::details::make_scope_exit([&]() {code;}) -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DETAIL_SCOPE_EXIT_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_SRC_CPP_DETAIL__SCOPE_EXIT_HPP diff --git a/src/cpp/detail/data_aggregation.hpp b/src/cpp/detail/data_aggregation.hpp index 14c63362a..45f37d6b2 100644 --- a/src/cpp/detail/data_aggregation.hpp +++ b/src/cpp/detail/data_aggregation.hpp @@ -16,8 +16,8 @@ * @file data_aggregation.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DETAIL_DATA_AGGREGATION_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DETAIL_DATA_AGGREGATION_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_DETAIL__DATA_AGGREGATION_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_DETAIL__DATA_AGGREGATION_HPP #include // std::min, std::max, std::nth_element #include // assert @@ -233,4 +233,4 @@ std::unique_ptr get_data_aggregator( } // namespace statistics_backend } // namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DETAIL_DATA_AGGREGATION_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_SRC_CPP_DETAIL__DATA_AGGREGATION_HPP diff --git a/src/cpp/detail/data_getters.hpp b/src/cpp/detail/data_getters.hpp index 58dfec457..66d44a323 100644 --- a/src/cpp/detail/data_getters.hpp +++ b/src/cpp/detail/data_getters.hpp @@ -16,8 +16,8 @@ * @file data_getters.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DETAIL_DATA_GETTERS_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DETAIL_DATA_GETTERS_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_DETAIL__DATA_GETTERS_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_DETAIL__DATA_GETTERS_HPP #include // std::max #include // std::unique_ptr @@ -251,4 +251,4 @@ detail::IteratorPair get_iterators( } // namespace statistics_backend } // namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_DETAIL_DATA_GETTERS_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_SRC_CPP_DETAIL__DATA_GETTERS_HPP diff --git a/src/cpp/subscriber/QosSerializer.cpp b/src/cpp/subscriber/QosSerializer.cpp index 64d1f6c8d..27ffb789b 100644 --- a/src/cpp/subscriber/QosSerializer.cpp +++ b/src/cpp/subscriber/QosSerializer.cpp @@ -54,8 +54,8 @@ void serialize ( } template <> -void serialize ( - const fastrtps::Duration_t& qos, +void serialize ( + const fastdds::dds::Duration_t& qos, const std::string& fieldname, database::Qos& serialized) { @@ -449,72 +449,68 @@ void serialize ( } database::Qos reader_proxy_data_to_backend_qos( - const fastrtps::rtps::ReaderProxyData& reader_data) + const fastdds::rtps::SubscriptionBuiltinTopicData& reader_data) { database::Qos reader; - serialize(reader_data.m_qos.m_durability, durability_tag, reader); - serialize(reader_data.m_qos.m_deadline, deadline_tag, reader); - serialize(reader_data.m_qos.m_latencyBudget, latency_budget_tag, reader); - serialize(reader_data.m_qos.m_liveliness, liveliness_tag, reader); - serialize(reader_data.m_qos.m_reliability, reliability_tag, reader); - serialize(reader_data.m_qos.m_ownership, ownership_tag, reader); - serialize(reader_data.m_qos.m_destinationOrder, destination_order_tag, reader); - serialize(reader_data.m_qos.m_userData, user_data_tag, reader); - serialize(reader_data.m_qos.m_timeBasedFilter, time_based_filter_tag, reader); - serialize(reader_data.m_qos.m_presentation, presentation_tag, reader); - serialize(reader_data.m_qos.m_partition, partition_tag, reader); - serialize(reader_data.m_qos.m_topicData, topic_data_tag, reader); - serialize(reader_data.m_qos.m_groupData, group_data_tag, reader); - serialize(reader_data.m_qos.m_durabilityService, durability_service_tag, reader); - serialize(reader_data.m_qos.m_lifespan, lifespan_tag, reader); - serialize(reader_data.m_qos.representation, representation_tag, reader); - serialize(reader_data.m_qos.type_consistency, type_consistency_tag, reader); - serialize(reader_data.m_qos.m_disablePositiveACKs, disable_positive_acks_tag, reader); - serialize(reader_data.m_qos.data_sharing, data_sharing_tag, reader); + serialize(reader_data.durability, durability_tag, reader); + serialize(reader_data.deadline, deadline_tag, reader); + serialize(reader_data.latency_budget, latency_budget_tag, reader); + serialize(reader_data.lifespan, lifespan_tag, reader); + serialize(reader_data.liveliness, liveliness_tag, reader); + serialize(reader_data.reliability, reliability_tag, reader); + serialize(reader_data.ownership, ownership_tag, reader); + serialize(reader_data.destination_order, destination_order_tag, reader); + serialize(reader_data.user_data, user_data_tag, reader); + serialize(reader_data.time_based_filter, time_based_filter_tag, reader); + serialize(reader_data.presentation, presentation_tag, reader); + serialize(reader_data.partition, partition_tag, reader); + serialize(reader_data.topic_data, topic_data_tag, reader); + serialize(reader_data.group_data, group_data_tag, reader); + serialize(reader_data.representation, representation_tag, reader); + serialize(reader_data.type_consistency, type_consistency_tag, reader); + serialize(reader_data.disable_positive_acks, disable_positive_acks_tag, reader); + serialize(reader_data.data_sharing, data_sharing_tag, reader); return reader; } database::Qos writer_proxy_data_to_backend_qos( - const fastrtps::rtps::WriterProxyData& writer_data) + const fastdds::rtps::PublicationBuiltinTopicData& info) { database::Qos writer; - serialize(writer_data.m_qos.m_durability, durability_tag, writer); - serialize(writer_data.m_qos.m_durabilityService, durability_service_tag, writer); - serialize(writer_data.m_qos.m_deadline, deadline_tag, writer); - serialize(writer_data.m_qos.m_latencyBudget, latency_budget_tag, writer); - serialize(writer_data.m_qos.m_liveliness, liveliness_tag, writer); - serialize(writer_data.m_qos.m_reliability, reliability_tag, writer); - serialize(writer_data.m_qos.m_lifespan, lifespan_tag, writer); - serialize(writer_data.m_qos.m_userData, user_data_tag, writer); - serialize(writer_data.m_qos.m_timeBasedFilter, time_based_filter_tag, writer); - serialize(writer_data.m_qos.m_ownership, ownership_tag, writer); - serialize(writer_data.m_qos.m_ownershipStrength, ownership_strength_tag, writer); - serialize(writer_data.m_qos.m_destinationOrder, destination_order_tag, writer); - serialize(writer_data.m_qos.m_presentation, presentation_tag, writer); - serialize(writer_data.m_qos.m_partition, partition_tag, writer); - serialize(writer_data.m_qos.m_topicData, topic_data_tag, writer); - serialize(writer_data.m_qos.m_groupData, group_data_tag, writer); - serialize(writer_data.m_qos.m_publishMode, publish_mode_tag, writer); - serialize(writer_data.m_qos.representation, representation_tag, writer); - serialize(writer_data.m_qos.m_disablePositiveACKs, disable_positive_acks_tag, writer); - serialize(writer_data.m_qos.data_sharing, data_sharing_tag, writer); + serialize(info.durability, durability_tag, writer); + serialize(info.durability_service, durability_service_tag, writer); + serialize(info.deadline, deadline_tag, writer); + serialize(info.latency_budget, latency_budget_tag, writer); + serialize(info.liveliness, liveliness_tag, writer); + serialize(info.reliability, reliability_tag, writer); + serialize(info.lifespan, lifespan_tag, writer); + serialize(info.user_data, user_data_tag, writer); + serialize(info.ownership, ownership_tag, writer); + serialize(info.ownership_strength, ownership_strength_tag, writer); + serialize(info.destination_order, destination_order_tag, writer); + serialize(info.presentation, presentation_tag, writer); + serialize(info.partition, partition_tag, writer); + serialize(info.topic_data, topic_data_tag, writer); + serialize(info.group_data, group_data_tag, writer); + serialize(info.representation, representation_tag, writer); + serialize(info.disable_positive_acks, disable_positive_acks_tag, writer); + serialize(info.data_sharing, data_sharing_tag, writer); return writer; } database::Qos participant_proxy_data_to_backend_qos( - const fastrtps::rtps::ParticipantProxyData& participant_data) + const fastdds::rtps::ParticipantBuiltinTopicData& participant_data) { database::Qos participant; - participant[available_builtin_endpoints_tag] = participant_data.m_availableBuiltinEndpoints; - serialize(participant_data.m_leaseDuration, lease_duration_tag, participant); - serialize(participant_data.m_properties, properties_tag, participant); - serialize(participant_data.m_userData, user_data_tag, participant); - participant[vendor_id_tag] = participant_data.m_VendorId; + serialize(participant_data.lease_duration, lease_duration_tag, participant); + serialize(participant_data.properties, properties_tag, participant); + serialize(participant_data.user_data, user_data_tag, participant); + participant[vendor_id_tag] = participant_data.vendor_id; return participant; } diff --git a/src/cpp/subscriber/QosSerializer.hpp b/src/cpp/subscriber/QosSerializer.hpp index 0168aab8f..2177fe630 100644 --- a/src/cpp/subscriber/QosSerializer.hpp +++ b/src/cpp/subscriber/QosSerializer.hpp @@ -16,14 +16,15 @@ * @file QosSerializer.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_QOSSERIALIZER_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_QOSSERIALIZER_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__QUOS_SERIALIZER_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__QUOS_SERIALIZER_HPP #include -#include -#include -#include +#include +#include +#include +#include #include @@ -44,8 +45,8 @@ void serialize ( database::Qos& serialized); template <> -void serialize ( - const fastrtps::Duration_t& qos, +void serialize ( + const fastdds::dds::Duration_t& qos, const std::string& fieldname, database::Qos& serialized); @@ -164,17 +165,17 @@ void serialize ( database::Qos& serialized); database::Qos reader_proxy_data_to_backend_qos( - const fastrtps::rtps::ReaderProxyData& reader_data); + const fastdds::rtps::SubscriptionBuiltinTopicData& reader_data); database::Qos writer_proxy_data_to_backend_qos( - const fastrtps::rtps::WriterProxyData& writer_data); + const fastdds::rtps::PublicationBuiltinTopicData& info); database::Qos participant_proxy_data_to_backend_qos( - const fastrtps::rtps::ParticipantProxyData& participant_data); + const fastdds::rtps::ParticipantBuiltinTopicData& participant_data); } // namespace subscriber } // namespace statistics_backend } // namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_QOSSERIALIZER_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__QUOS_SERIALIZER_HPP diff --git a/src/cpp/subscriber/QosSerializerTags.hpp b/src/cpp/subscriber/QosSerializerTags.hpp index d86c2553e..01f5a7b41 100644 --- a/src/cpp/subscriber/QosSerializerTags.hpp +++ b/src/cpp/subscriber/QosSerializerTags.hpp @@ -16,8 +16,8 @@ * @file QosSerializerTags.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_QOSSERIALIZERTAGS_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_QOSSERIALIZERTAGS_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__QUOS_SERIALIZER_TAGS_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__QUOS_SERIALIZER_TAGS_HPP namespace eprosima { namespace statistics_backend { @@ -58,4 +58,4 @@ static constexpr const char* available_builtin_endpoints_tag = "available_builti } // namespace statistics_backend } // namespace eprosima -#endif //_EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_QOSSERIALIZERTAGS_HPP_ +#endif //FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__QUOS_SERIALIZER_TAGS_HPP diff --git a/src/cpp/subscriber/StatisticsParticipantListener.cpp b/src/cpp/subscriber/StatisticsParticipantListener.cpp index 89232e5aa..f0d3ed6f2 100644 --- a/src/cpp/subscriber/StatisticsParticipantListener.cpp +++ b/src/cpp/subscriber/StatisticsParticipantListener.cpp @@ -16,6 +16,7 @@ /** * @file StatisticsParticipantListener.cpp */ +#include #include "subscriber/StatisticsParticipantListener.hpp" @@ -23,6 +24,7 @@ #include #include #include +#include #include #include "database/database_queue.hpp" @@ -34,7 +36,7 @@ namespace statistics_backend { namespace subscriber { using namespace eprosima::fastdds::dds; -using namespace eprosima::fastrtps::rtps; +using namespace eprosima::fastdds::rtps; template std::string to_string( @@ -51,7 +53,7 @@ std::string to_string( * @return true when the entity id corresponds to a builtin statistics writer. */ inline bool is_statistics_builtin( - const fastrtps::rtps::EntityId_t& entity_id) + const EntityId_t& entity_id) { return 0x60 == (0xE0 & entity_id.value[3]); } @@ -74,7 +76,7 @@ noexcept // Search for an address different from localhost in the locator list bool search_address_in_locators( - const eprosima::fastrtps::ResourceLimitedVector& locators, + const eprosima::fastdds::ResourceLimitedVector& locators, std::string& address) { for (auto locator : locators) @@ -92,7 +94,7 @@ bool search_address_in_locators( // Return a IP obtained from participant locators std::string get_address( - const ParticipantProxyData& info) + const ParticipantBuiltinTopicData& info) { // The IP is obtained from the announced locators // Search for a locator with an IP different from localhost @@ -128,7 +130,9 @@ std::string get_address( void StatisticsParticipantListener::on_participant_discovery( DomainParticipant* /*participant*/, - ParticipantDiscoveryInfo&& info) + ParticipantDiscoveryStatus reason, + const ParticipantBuiltinTopicData& info, + bool& /*should_be_ignored*/) { // First stop the data queues until the new entity is created data_queue_->stop_consumer(); @@ -137,38 +141,41 @@ void StatisticsParticipantListener::on_participant_discovery( std::chrono::system_clock::time_point timestamp = now(); // Meaningful prefix for metatraffic entities - const std::string metatraffic_prefix = "___EPROSIMA___METATRAFFIC___DOMAIN_" + - std::to_string(domain_id_.value()) + "___"; + const std::string metatraffic_prefix = "___EPROSIMA___METATRAFFIC___DOMAIN_" + std::to_string(domain_id_.value()) + + "___"; const std::string metatraffic_alias = "_metatraffic_"; // Build the discovery info for the queue database::EntityDiscoveryInfo discovery_info(EntityKind::PARTICIPANT); discovery_info.domain_id = domain_id_; - discovery_info.guid = info.info.m_guid; - discovery_info.qos = subscriber::participant_proxy_data_to_backend_qos(info.info); + discovery_info.guid = info.guid; + discovery_info.qos = subscriber::participant_proxy_data_to_backend_qos(info); - discovery_info.address = get_address(info.info); - discovery_info.participant_name = info.info.m_participantName.to_string(); + discovery_info.address = get_address(info); + discovery_info.participant_name = info.participant_name.to_string(); discovery_info.entity_status = StatusLevel::OK_STATUS; - switch (info.status) + switch (reason) { - case ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT: + case ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT: { + std::cout << "DomainParticipant discovered: " << info.guid << std::endl; discovery_info.discovery_status = details::StatisticsBackendData::DiscoveryStatus::DISCOVERY; break; } - case ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT: + case ParticipantDiscoveryStatus::CHANGED_QOS_PARTICIPANT: { // TODO [ILG] : Process these messages and save the updated QoS + std::cout << "DomainParticipant udated: " << info.guid << std::endl; discovery_info.discovery_status = details::StatisticsBackendData::DiscoveryStatus::UPDATE; break; } - case ParticipantDiscoveryInfo::REMOVED_PARTICIPANT: - case ParticipantDiscoveryInfo::DROPPED_PARTICIPANT: - case ParticipantDiscoveryInfo::IGNORED_PARTICIPANT: + case ParticipantDiscoveryStatus::REMOVED_PARTICIPANT: + case ParticipantDiscoveryStatus::DROPPED_PARTICIPANT: + case ParticipantDiscoveryStatus::IGNORED_PARTICIPANT: { + std::cout << "DomainParticipant removed: " << info.guid << std::endl; discovery_info.discovery_status = details::StatisticsBackendData::DiscoveryStatus::UNDISCOVERY; break; } @@ -192,23 +199,23 @@ void StatisticsParticipantListener::on_participant_discovery( return std::string(""); }; - discovery_info.host = get_property_value(info.info.m_properties, + discovery_info.host = get_property_value(info.properties, eprosima::fastdds::dds::parameter_policy_physical_data_host); discovery_info.host = discovery_info.host.empty()? "Unknown" : discovery_info.host; - discovery_info.user = get_property_value(info.info.m_properties, + discovery_info.user = get_property_value(info.properties, eprosima::fastdds::dds::parameter_policy_physical_data_user); discovery_info.user = discovery_info.user.empty()? "Unknown" : discovery_info.user; - discovery_info.process = get_property_value(info.info.m_properties, + discovery_info.process = get_property_value(info.properties, eprosima::fastdds::dds::parameter_policy_physical_data_process); discovery_info.process = discovery_info.process.empty()? "Unknown" : discovery_info.process; - std::string app_id = get_property_value(info.info.m_properties, "fastdds.application.id"); + std::string app_id = get_property_value(info.properties, "fastdds.application.id"); auto it = app_id_enum.find(app_id); discovery_info.app_id = it != app_id_enum.end()? it->second : AppId::UNKNOWN; - discovery_info.app_metadata = get_property_value(info.info.m_properties, "fastdds.application.metadata"); + discovery_info.app_metadata = get_property_value(info.properties, "fastdds.application.metadata"); entity_queue_->push(timestamp, discovery_info); @@ -223,19 +230,19 @@ void StatisticsParticipantListener::on_participant_discovery( // Push it to the queue database::EntityDiscoveryInfo datawriter_discovery_info(EntityKind::DATAWRITER); - for (auto dds_locator : info.info.metatraffic_locators.unicast) + for (auto dds_locator : info.metatraffic_locators.unicast) { datawriter_discovery_info.locators.add_unicast_locator(dds_locator); } - for (auto dds_locator : info.info.metatraffic_locators.multicast) + for (auto dds_locator : info.metatraffic_locators.multicast) { datawriter_discovery_info.locators.add_multicast_locator(dds_locator); } - for (auto dds_locator : info.info.default_locators.unicast) + for (auto dds_locator : info.default_locators.unicast) { datawriter_discovery_info.locators.add_unicast_locator(dds_locator); } - for (auto dds_locator : info.info.default_locators.multicast) + for (auto dds_locator : info.default_locators.multicast) { datawriter_discovery_info.locators.add_multicast_locator(dds_locator); } @@ -243,7 +250,7 @@ void StatisticsParticipantListener::on_participant_discovery( datawriter_discovery_info.domain_id = domain_id_; datawriter_discovery_info.topic_name = metatraffic_prefix + "TOPIC"; datawriter_discovery_info.type_name = metatraffic_prefix + "TYPE"; - datawriter_discovery_info.guid = info.info.m_guid; + datawriter_discovery_info.guid = info.guid; datawriter_discovery_info.qos = meta_traffic_qos; datawriter_discovery_info.alias = metatraffic_alias; datawriter_discovery_info.is_virtual_metatraffic = true; @@ -259,12 +266,14 @@ void StatisticsParticipantListener::on_participant_discovery( monitor_service_status_data_queue_->start_consumer(); } -void StatisticsParticipantListener::on_subscriber_discovery( +void StatisticsParticipantListener::on_data_reader_discovery( DomainParticipant* participant, - ReaderDiscoveryInfo&& info) + ReaderDiscoveryStatus reason, + const SubscriptionBuiltinTopicData& info, + bool& /*should_be_ignored*/) { // Filter out our own statistics readers - if (participant->guid().guidPrefix == info.info.guid().guidPrefix) + if (participant->guid().guidPrefix == info.guid.guidPrefix) { return; } @@ -278,29 +287,32 @@ void StatisticsParticipantListener::on_subscriber_discovery( // Build the discovery info for the queue database::EntityDiscoveryInfo discovery_info(EntityKind::DATAREADER); discovery_info.domain_id = domain_id_; - discovery_info.guid = info.info.guid(); - discovery_info.qos = subscriber::reader_proxy_data_to_backend_qos(info.info); + discovery_info.guid = info.guid; + discovery_info.qos = subscriber::reader_proxy_data_to_backend_qos(info); - discovery_info.topic_name = info.info.topicName().to_string(); - discovery_info.type_name = info.info.typeName().to_string(); - discovery_info.locators = info.info.remote_locators(); + discovery_info.topic_name = info.topic_name.to_string(); + discovery_info.type_name = info.type_name.to_string(); + discovery_info.locators = info.remote_locators; - switch (info.status) + switch (reason) { - case ReaderDiscoveryInfo::DISCOVERED_READER: + case ReaderDiscoveryStatus::DISCOVERED_READER: { + std::cout << "DataReader discovered: " << info.guid << std::endl; discovery_info.discovery_status = details::StatisticsBackendData::DiscoveryStatus::DISCOVERY; break; } - case ReaderDiscoveryInfo::CHANGED_QOS_READER: + case ReaderDiscoveryStatus::CHANGED_QOS_READER: { // TODO [ILG] : Process these messages and save the updated QoS + std::cout << "DataReader updated: " << info.guid << std::endl; discovery_info.discovery_status = details::StatisticsBackendData::DiscoveryStatus::UPDATE; break; } - case ReaderDiscoveryInfo::REMOVED_READER: - case ReaderDiscoveryInfo::IGNORED_READER: + case ReaderDiscoveryStatus::REMOVED_READER: + case ReaderDiscoveryStatus::IGNORED_READER: { + std::cout << "DataReader removed: " << info.guid << std::endl; discovery_info.discovery_status = details::StatisticsBackendData::DiscoveryStatus::UNDISCOVERY; break; } @@ -314,9 +326,11 @@ void StatisticsParticipantListener::on_subscriber_discovery( monitor_service_status_data_queue_->start_consumer(); } -void StatisticsParticipantListener::on_publisher_discovery( +void StatisticsParticipantListener::on_data_writer_discovery( DomainParticipant* participant, - WriterDiscoveryInfo&& info) + WriterDiscoveryStatus reason, + const PublicationBuiltinTopicData& info, + bool& /*should_be_ignored*/) { // Contrary to what it's done in on_subscriber_discovery, here we do not filter our own datawritters, as // deactivation of fastdds statistics module is enforced for the statistics backend, and hence none is ever created @@ -331,29 +345,32 @@ void StatisticsParticipantListener::on_publisher_discovery( // Build the discovery info for the queue database::EntityDiscoveryInfo discovery_info(EntityKind::DATAWRITER); discovery_info.domain_id = domain_id_; - discovery_info.guid = info.info.guid(); - discovery_info.qos = subscriber::writer_proxy_data_to_backend_qos(info.info); + discovery_info.guid = info.guid; + discovery_info.qos = subscriber::writer_proxy_data_to_backend_qos(info); - discovery_info.topic_name = info.info.topicName().to_string(); - discovery_info.type_name = info.info.typeName().to_string(); - discovery_info.locators = info.info.remote_locators(); + discovery_info.topic_name = info.topic_name.to_string(); + discovery_info.type_name = info.type_name.to_string(); + discovery_info.locators = info.remote_locators; - switch (info.status) + switch (reason) { - case WriterDiscoveryInfo::DISCOVERED_WRITER: + case WriterDiscoveryStatus::DISCOVERED_WRITER: { + std::cout << "DataWriter discovered: " << info.guid << std::endl; discovery_info.discovery_status = details::StatisticsBackendData::DiscoveryStatus::DISCOVERY; break; } - case WriterDiscoveryInfo::CHANGED_QOS_WRITER: + case WriterDiscoveryStatus::CHANGED_QOS_WRITER: { // TODO [ILG] : Process these messages and save the updated QoS + std::cout << "DataWriter updated: " << info.guid << std::endl; discovery_info.discovery_status = details::StatisticsBackendData::DiscoveryStatus::UPDATE; break; } - case WriterDiscoveryInfo::REMOVED_WRITER: - case WriterDiscoveryInfo::IGNORED_WRITER: + case WriterDiscoveryStatus::REMOVED_WRITER: + case WriterDiscoveryStatus::IGNORED_WRITER: { + std::cout << "DataWriter removed: " << info.guid << std::endl; discovery_info.discovery_status = details::StatisticsBackendData::DiscoveryStatus::UNDISCOVERY; break; } diff --git a/src/cpp/subscriber/StatisticsParticipantListener.hpp b/src/cpp/subscriber/StatisticsParticipantListener.hpp index 90836ee3a..3a62ea8d4 100644 --- a/src/cpp/subscriber/StatisticsParticipantListener.hpp +++ b/src/cpp/subscriber/StatisticsParticipantListener.hpp @@ -17,17 +17,18 @@ * @file StatisticsParticipantListener.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_STATISTICSPARTICIPANTLISTENER_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_STATISTICSPARTICIPANTLISTENER_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__STATISTICS_PARTICIPANT_LISTENER_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__STATISTICS_PARTICIPANT_LISTENER_HPP #include #include -#include -#include +#include +#include #include -#include +#include + #include namespace eprosima { @@ -68,9 +69,11 @@ class StatisticsParticipantListener : public eprosima::fastdds::dds::DomainParti * @param participant Pointer to the Participant which discovered the remote participant. * @param info Remote participant information. User can take ownership of the object. */ - virtual void on_participant_discovery( - eprosima::fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ParticipantDiscoveryInfo&& info) override; + void on_participant_discovery( + fastdds::dds::DomainParticipant* participant, + fastdds::rtps::ParticipantDiscoveryStatus reason, + const fastdds::dds::ParticipantBuiltinTopicData& info, + bool& should_be_ignored) override; /*! * This method is called when a new Subscriber is discovered, or a previously discovered subscriber changes @@ -78,19 +81,26 @@ class StatisticsParticipantListener : public eprosima::fastdds::dds::DomainParti * @param participant Pointer to the Participant which discovered the remote subscriber. * @param info Remote subscriber information. User can take ownership of the object. */ - virtual void on_subscriber_discovery( - eprosima::fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::ReaderDiscoveryInfo&& info) override; + void on_data_reader_discovery( + fastdds::dds::DomainParticipant* participant, + fastdds::rtps::ReaderDiscoveryStatus reason, + const fastdds::rtps::SubscriptionBuiltinTopicData& info, + bool& should_be_ignored) override; /*! - * This method is called when a new Publisher is discovered, or a previously discovered publisher changes + * This method is called when a new DataWriter is discovered, or a previously discovered DataWriter changes * its QOS or is removed. - * @param participant Pointer to the Participant which discovered the remote publisher. - * @param info Remote publisher information. User can take ownership of the object. + * + * @param [in] participant Pointer to the Participant which discovered the remote writer. + * @param [in] reason The reason motivating this method to be called. + * @param [in] info Remote writer information. + * @param [out] should_be_ignored Flag to indicate the library to automatically ignore the discovered writer. */ - virtual void on_publisher_discovery( - eprosima::fastdds::dds::DomainParticipant* participant, - fastrtps::rtps::WriterDiscoveryInfo&& info) override; + void on_data_writer_discovery( + fastdds::dds::DomainParticipant* participant, + fastdds::rtps::WriterDiscoveryStatus reason, + const fastdds::rtps::PublicationBuiltinTopicData& info, + bool& should_be_ignored) override; protected: @@ -107,4 +117,4 @@ class StatisticsParticipantListener : public eprosima::fastdds::dds::DomainParti } //namespace statistics_backend } //namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_STATISTICSPARTICIPANTLISTENER_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__STATISTICS_PARTICIPANT_LISTENER_HPP diff --git a/src/cpp/subscriber/StatisticsReaderListener.cpp b/src/cpp/subscriber/StatisticsReaderListener.cpp index 2b9124699..9b1ca0c1a 100644 --- a/src/cpp/subscriber/StatisticsReaderListener.cpp +++ b/src/cpp/subscriber/StatisticsReaderListener.cpp @@ -23,16 +23,14 @@ #include #include #include -#include - #include namespace eprosima { namespace statistics_backend { namespace subscriber { -using namespace eprosima::fastrtps::types; using namespace eprosima::fastdds::statistics; +using namespace eprosima::fastdds::statistics::EventKind; using namespace eprosima::fastdds::dds; StatisticsReaderListener::StatisticsReaderListener( @@ -52,7 +50,7 @@ bool StatisticsReaderListener::get_available_data( std::chrono::system_clock::time_point& timestamp) { SampleInfo info; - if (reader->take_next_sample(&inner_data, &info) == ReturnCode_t::RETCODE_OK) + if (reader->take_next_sample(&inner_data, &info) == RETCODE_OK) { if (!info.valid_data) { @@ -68,7 +66,7 @@ bool StatisticsReaderListener::get_available_data( void StatisticsReaderListener::on_data_available( eprosima::fastdds::dds::DataReader* reader) { - static const std::map statistics_topics = + static const std::map statistics_topics = { {HISTORY_LATENCY_TOPIC, HISTORY2HISTORY_LATENCY}, {NETWORK_LATENCY_TOPIC, NETWORK_LATENCY}, diff --git a/src/cpp/subscriber/StatisticsReaderListener.hpp b/src/cpp/subscriber/StatisticsReaderListener.hpp index 1cb3352be..c7f303e3c 100644 --- a/src/cpp/subscriber/StatisticsReaderListener.hpp +++ b/src/cpp/subscriber/StatisticsReaderListener.hpp @@ -17,14 +17,15 @@ * @file StatisticsReaderListener.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_STATISTICSDATALISTENER_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_STATISTICSDATALISTENER_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__STATISTICS_READER_LISTENER_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__STATISTICS_READER_LISTENER_HPP #include "fastdds/dds/subscriber/DataReaderListener.hpp" #include "fastdds/dds/core/status/StatusMask.hpp" -#include -#include +#include +#include + namespace eprosima { @@ -88,4 +89,4 @@ class StatisticsReaderListener : public eprosima::fastdds::dds::DataReaderListen } //namespace statistics_backend } //namespace eprosima -#endif // _EPROSIMA_FASTDDS_STATISTICS_BACKEND_SUBSCRIBER_STATISTICSDATALISTENER_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_SRC_CPP_SUBSCRIBER__STATISTICS_READER_LISTENER_HPP diff --git a/src/cpp/types/DataContainer.hpp b/src/cpp/types/DataContainer.hpp index b6f651084..1a5458e77 100644 --- a/src/cpp/types/DataContainer.hpp +++ b/src/cpp/types/DataContainer.hpp @@ -16,8 +16,8 @@ * @file DataContainer.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_DATACONTAINER_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_DATACONTAINER_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_TYPES__DATA_CONTAINER_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_TYPES__DATA_CONTAINER_HPP #include @@ -176,4 +176,4 @@ class DataContainer : public std::list } // namespace statistics_backend } // namespace eprosima -#endif //_EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_DATACONTAINER_HPP_ +#endif //FASTDDS_STATISTICS_BACKEND_SRC_CPP_TYPES__DATA_CONTAINER_HPP diff --git a/src/cpp/types/MapDataContainer.hpp b/src/cpp/types/MapDataContainer.hpp index 4055189e1..0f0fddd5d 100644 --- a/src/cpp/types/MapDataContainer.hpp +++ b/src/cpp/types/MapDataContainer.hpp @@ -16,8 +16,8 @@ * @file MapDataContainer.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_MAPDATACONTAINER_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_MAPDATACONTAINER_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_TYPES__MAP_DATA_CONTAINER_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_TYPES__MAP_DATA_CONTAINER_HPP #include @@ -92,4 +92,4 @@ class MapDataContainer : public std::map> } // namespace statistics_backend } // namespace eprosima -#endif //_EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_MAPDATACONTAINER_HPP_ +#endif //FASTDDS_STATISTICS_BACKEND_SRC_CPP_TYPES__MAP_DATA_CONTAINER_HPP diff --git a/src/cpp/types/fragile_ptr.hpp b/src/cpp/types/fragile_ptr.hpp index 49c710ddf..386cad717 100644 --- a/src/cpp/types/fragile_ptr.hpp +++ b/src/cpp/types/fragile_ptr.hpp @@ -16,8 +16,8 @@ * @file fragile_ptr.hpp */ -#ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_FRAGILEPTR_HPP_ -#define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_FRAGILEPTR_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_SRC_CPP_TYPES__FRAGILE_PTR_HPP +#define FASTDDS_STATISTICS_BACKEND_SRC_CPP_TYPES__FRAGILE_PTR_HPP #include #include @@ -308,4 +308,4 @@ std::ostream& operator <<( } // namespace statistics_backend } // namespace eprosima -#endif //_EPROSIMA_FASTDDS_STATISTICS_BACKEND_TYPES_FRAGILEPTR_HPP_ +#endif //FASTDDS_STATISTICS_BACKEND_SRC_CPP_TYPES__FRAGILE_PTR_HPP diff --git a/test/TrafficInjector/MessageSerializer.h b/test/TrafficInjector/MessageSerializer.h index 351cb461e..cd6574c42 100644 --- a/test/TrafficInjector/MessageSerializer.h +++ b/test/TrafficInjector/MessageSerializer.h @@ -19,13 +19,13 @@ #ifndef _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TEST_MESSAGE_SERIALIZER_HPP_ #define _EPROSIMA_FASTDDS_STATISTICS_BACKEND_TEST_MESSAGE_SERIALIZER_HPP_ -#include -#include +#include +#include #include -#include #include +#include namespace eprosima { namespace statistics_backend { diff --git a/test/TrafficInjector/TrafficInjector.h b/test/TrafficInjector/TrafficInjector.h index 817e4988f..67b29fe9c 100644 --- a/test/TrafficInjector/TrafficInjector.h +++ b/test/TrafficInjector/TrafficInjector.h @@ -34,10 +34,12 @@ #include #include -#include -#include -#include -#include + +#include +#include +#include +#include + #include @@ -49,7 +51,6 @@ using Traffic = nlohmann::ordered_json; class TrafficInjector { - using StatisticsEventKind = eprosima::fastdds::statistics::EventKindBits; using StatisticsData = eprosima::fastdds::statistics::Data; class StatisticsWriterListener : public eprosima::fastdds::dds::DataWriterListener @@ -166,12 +167,12 @@ class TrafficInjector continue; } - StatisticsEventKind kind; + uint32_t kind; std::string topic_name; if (str == "HISTORY2HISTORY_LATENCY") { - kind = StatisticsEventKind::HISTORY2HISTORY_LATENCY; + kind = fastdds::statistics::EventKind::HISTORY2HISTORY_LATENCY; topic_name = "_fastdds_statistics_history2history_latency"; // The data type can be initialized from other event kind @@ -190,7 +191,7 @@ class TrafficInjector } else if (str == "NETWORK_LATENCY") { - kind = StatisticsEventKind::NETWORK_LATENCY; + kind = fastdds::statistics::EventKind::NETWORK_LATENCY; topic_name = "_fastdds_statistics_network_latency"; // The data type can be initialized from other event kind @@ -209,7 +210,7 @@ class TrafficInjector } else if (str == "PUBLICATION_THROUGHPUT") { - kind = StatisticsEventKind::PUBLICATION_THROUGHPUT; + kind = fastdds::statistics::EventKind::PUBLICATION_THROUGHPUT; topic_name = "_fastdds_statistics_publication_throughput"; // The data type can be initialized from other event kind @@ -223,13 +224,13 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::SUBSCRIPTION_THROUGHPUT] = type; - serializers_[StatisticsEventKind::SUBSCRIPTION_THROUGHPUT] = serializer; + data_types_[fastdds::statistics::EventKind::SUBSCRIPTION_THROUGHPUT] = type; + serializers_[fastdds::statistics::EventKind::SUBSCRIPTION_THROUGHPUT] = serializer; } } else if (str == "SUBSCRIPTION_THROUGHPUT") { - kind = StatisticsEventKind::SUBSCRIPTION_THROUGHPUT; + kind = fastdds::statistics::EventKind::SUBSCRIPTION_THROUGHPUT; topic_name = "_fastdds_statistics_subscription_throughput"; // The data type can be initialized from other event kind @@ -243,13 +244,13 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::PUBLICATION_THROUGHPUT] = type; - serializers_[StatisticsEventKind::PUBLICATION_THROUGHPUT] = serializer; + data_types_[fastdds::statistics::EventKind::PUBLICATION_THROUGHPUT] = type; + serializers_[fastdds::statistics::EventKind::PUBLICATION_THROUGHPUT] = serializer; } } else if (str == "RTPS_SENT") { - kind = StatisticsEventKind::RTPS_SENT; + kind = fastdds::statistics::EventKind::RTPS_SENT; topic_name = "_fastdds_statistics_rtps_sent"; // The data type can be initialized from other event kind @@ -264,13 +265,13 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::RTPS_LOST] = type; - serializers_[StatisticsEventKind::RTPS_LOST] = serializer; + data_types_[fastdds::statistics::EventKind::RTPS_LOST] = type; + serializers_[fastdds::statistics::EventKind::RTPS_LOST] = serializer; } } else if (str == "RTPS_LOST") { - kind = StatisticsEventKind::RTPS_LOST; + kind = fastdds::statistics::EventKind::RTPS_LOST; topic_name = "_fastdds_statistics_rtps_lost"; // The data type can be initialized from other event kind @@ -285,13 +286,13 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::RTPS_SENT] = type; - serializers_[StatisticsEventKind::RTPS_SENT] = serializer; + data_types_[fastdds::statistics::EventKind::RTPS_SENT] = type; + serializers_[fastdds::statistics::EventKind::RTPS_SENT] = serializer; } } else if (str == "RESENT_DATAS") { - kind = StatisticsEventKind::RESENT_DATAS; + kind = fastdds::statistics::EventKind::RESENT_DATAS; topic_name = "_fastdds_statistics_resent_datas"; // The data type can be initialized from other event kind @@ -305,25 +306,25 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::HEARTBEAT_COUNT] = type; - serializers_[StatisticsEventKind::HEARTBEAT_COUNT] = serializer; - data_types_[StatisticsEventKind::ACKNACK_COUNT] = type; - serializers_[StatisticsEventKind::ACKNACK_COUNT] = serializer; - data_types_[StatisticsEventKind::NACKFRAG_COUNT] = type; - serializers_[StatisticsEventKind::NACKFRAG_COUNT] = serializer; - data_types_[StatisticsEventKind::GAP_COUNT] = type; - serializers_[StatisticsEventKind::GAP_COUNT] = serializer; - data_types_[StatisticsEventKind::DATA_COUNT] = type; - serializers_[StatisticsEventKind::DATA_COUNT] = serializer; - data_types_[StatisticsEventKind::PDP_PACKETS] = type; - serializers_[StatisticsEventKind::PDP_PACKETS] = serializer; - data_types_[StatisticsEventKind::EDP_PACKETS] = type; - serializers_[StatisticsEventKind::EDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = type; + serializers_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::ACKNACK_COUNT] = type; + serializers_[fastdds::statistics::EventKind::ACKNACK_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = type; + serializers_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::GAP_COUNT] = type; + serializers_[fastdds::statistics::EventKind::GAP_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::DATA_COUNT] = type; + serializers_[fastdds::statistics::EventKind::DATA_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::PDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::PDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::EDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::EDP_PACKETS] = serializer; } } else if (str == "HEARTBEAT_COUNT") { - kind = StatisticsEventKind::HEARTBEAT_COUNT; + kind = fastdds::statistics::EventKind::HEARTBEAT_COUNT; topic_name = "_fastdds_statistics_heartbeat_count"; // The data type can be initialized from other event kind @@ -337,25 +338,25 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::RESENT_DATAS] = type; - serializers_[StatisticsEventKind::RESENT_DATAS] = serializer; - data_types_[StatisticsEventKind::ACKNACK_COUNT] = type; - serializers_[StatisticsEventKind::ACKNACK_COUNT] = serializer; - data_types_[StatisticsEventKind::NACKFRAG_COUNT] = type; - serializers_[StatisticsEventKind::NACKFRAG_COUNT] = serializer; - data_types_[StatisticsEventKind::GAP_COUNT] = type; - serializers_[StatisticsEventKind::GAP_COUNT] = serializer; - data_types_[StatisticsEventKind::DATA_COUNT] = type; - serializers_[StatisticsEventKind::DATA_COUNT] = serializer; - data_types_[StatisticsEventKind::PDP_PACKETS] = type; - serializers_[StatisticsEventKind::PDP_PACKETS] = serializer; - data_types_[StatisticsEventKind::EDP_PACKETS] = type; - serializers_[StatisticsEventKind::EDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::RESENT_DATAS] = type; + serializers_[fastdds::statistics::EventKind::RESENT_DATAS] = serializer; + data_types_[fastdds::statistics::EventKind::ACKNACK_COUNT] = type; + serializers_[fastdds::statistics::EventKind::ACKNACK_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = type; + serializers_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::GAP_COUNT] = type; + serializers_[fastdds::statistics::EventKind::GAP_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::DATA_COUNT] = type; + serializers_[fastdds::statistics::EventKind::DATA_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::PDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::PDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::EDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::EDP_PACKETS] = serializer; } } else if (str == "ACKNACK_COUNT") { - kind = StatisticsEventKind::ACKNACK_COUNT; + kind = fastdds::statistics::EventKind::ACKNACK_COUNT; topic_name = "_fastdds_statistics_acknack_count"; // The data type can be initialized from other event kind @@ -369,25 +370,25 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::RESENT_DATAS] = type; - serializers_[StatisticsEventKind::RESENT_DATAS] = serializer; - data_types_[StatisticsEventKind::HEARTBEAT_COUNT] = type; - serializers_[StatisticsEventKind::HEARTBEAT_COUNT] = serializer; - data_types_[StatisticsEventKind::NACKFRAG_COUNT] = type; - serializers_[StatisticsEventKind::NACKFRAG_COUNT] = serializer; - data_types_[StatisticsEventKind::GAP_COUNT] = type; - serializers_[StatisticsEventKind::GAP_COUNT] = serializer; - data_types_[StatisticsEventKind::DATA_COUNT] = type; - serializers_[StatisticsEventKind::DATA_COUNT] = serializer; - data_types_[StatisticsEventKind::PDP_PACKETS] = type; - serializers_[StatisticsEventKind::PDP_PACKETS] = serializer; - data_types_[StatisticsEventKind::EDP_PACKETS] = type; - serializers_[StatisticsEventKind::EDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::RESENT_DATAS] = type; + serializers_[fastdds::statistics::EventKind::RESENT_DATAS] = serializer; + data_types_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = type; + serializers_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = type; + serializers_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::GAP_COUNT] = type; + serializers_[fastdds::statistics::EventKind::GAP_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::DATA_COUNT] = type; + serializers_[fastdds::statistics::EventKind::DATA_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::PDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::PDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::EDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::EDP_PACKETS] = serializer; } } else if (str == "NACKFRAG_COUNT") { - kind = StatisticsEventKind::NACKFRAG_COUNT; + kind = fastdds::statistics::EventKind::NACKFRAG_COUNT; topic_name = "_fastdds_statistics_nackfrag_count"; // The data type can be initialized from other event kind @@ -401,25 +402,25 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::RESENT_DATAS] = type; - serializers_[StatisticsEventKind::RESENT_DATAS] = serializer; - data_types_[StatisticsEventKind::HEARTBEAT_COUNT] = type; - serializers_[StatisticsEventKind::HEARTBEAT_COUNT] = serializer; - data_types_[StatisticsEventKind::ACKNACK_COUNT] = type; - serializers_[StatisticsEventKind::ACKNACK_COUNT] = serializer; - data_types_[StatisticsEventKind::GAP_COUNT] = type; - serializers_[StatisticsEventKind::GAP_COUNT] = serializer; - data_types_[StatisticsEventKind::DATA_COUNT] = type; - serializers_[StatisticsEventKind::DATA_COUNT] = serializer; - data_types_[StatisticsEventKind::PDP_PACKETS] = type; - serializers_[StatisticsEventKind::PDP_PACKETS] = serializer; - data_types_[StatisticsEventKind::EDP_PACKETS] = type; - serializers_[StatisticsEventKind::EDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::RESENT_DATAS] = type; + serializers_[fastdds::statistics::EventKind::RESENT_DATAS] = serializer; + data_types_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = type; + serializers_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::ACKNACK_COUNT] = type; + serializers_[fastdds::statistics::EventKind::ACKNACK_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::GAP_COUNT] = type; + serializers_[fastdds::statistics::EventKind::GAP_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::DATA_COUNT] = type; + serializers_[fastdds::statistics::EventKind::DATA_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::PDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::PDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::EDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::EDP_PACKETS] = serializer; } } else if (str == "GAP_COUNT") { - kind = StatisticsEventKind::GAP_COUNT; + kind = fastdds::statistics::EventKind::GAP_COUNT; topic_name = "_fastdds_statistics_gap_count"; // The data type can be initialized from other event kind @@ -433,25 +434,25 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::RESENT_DATAS] = type; - serializers_[StatisticsEventKind::RESENT_DATAS] = serializer; - data_types_[StatisticsEventKind::HEARTBEAT_COUNT] = type; - serializers_[StatisticsEventKind::HEARTBEAT_COUNT] = serializer; - data_types_[StatisticsEventKind::ACKNACK_COUNT] = type; - serializers_[StatisticsEventKind::ACKNACK_COUNT] = serializer; - data_types_[StatisticsEventKind::NACKFRAG_COUNT] = type; - serializers_[StatisticsEventKind::NACKFRAG_COUNT] = serializer; - data_types_[StatisticsEventKind::DATA_COUNT] = type; - serializers_[StatisticsEventKind::DATA_COUNT] = serializer; - data_types_[StatisticsEventKind::PDP_PACKETS] = type; - serializers_[StatisticsEventKind::PDP_PACKETS] = serializer; - data_types_[StatisticsEventKind::EDP_PACKETS] = type; - serializers_[StatisticsEventKind::EDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::RESENT_DATAS] = type; + serializers_[fastdds::statistics::EventKind::RESENT_DATAS] = serializer; + data_types_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = type; + serializers_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::ACKNACK_COUNT] = type; + serializers_[fastdds::statistics::EventKind::ACKNACK_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = type; + serializers_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::DATA_COUNT] = type; + serializers_[fastdds::statistics::EventKind::DATA_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::PDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::PDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::EDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::EDP_PACKETS] = serializer; } } else if (str == "DATA_COUNT") { - kind = StatisticsEventKind::DATA_COUNT; + kind = fastdds::statistics::EventKind::DATA_COUNT; topic_name = "_fastdds_statistics_data_count"; // The data type can be initialized from other event kind @@ -465,25 +466,25 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::RESENT_DATAS] = type; - serializers_[StatisticsEventKind::RESENT_DATAS] = serializer; - data_types_[StatisticsEventKind::HEARTBEAT_COUNT] = type; - serializers_[StatisticsEventKind::HEARTBEAT_COUNT] = serializer; - data_types_[StatisticsEventKind::ACKNACK_COUNT] = type; - serializers_[StatisticsEventKind::ACKNACK_COUNT] = serializer; - data_types_[StatisticsEventKind::NACKFRAG_COUNT] = type; - serializers_[StatisticsEventKind::NACKFRAG_COUNT] = serializer; - data_types_[StatisticsEventKind::GAP_COUNT] = type; - serializers_[StatisticsEventKind::GAP_COUNT] = serializer; - data_types_[StatisticsEventKind::PDP_PACKETS] = type; - serializers_[StatisticsEventKind::PDP_PACKETS] = serializer; - data_types_[StatisticsEventKind::EDP_PACKETS] = type; - serializers_[StatisticsEventKind::EDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::RESENT_DATAS] = type; + serializers_[fastdds::statistics::EventKind::RESENT_DATAS] = serializer; + data_types_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = type; + serializers_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::ACKNACK_COUNT] = type; + serializers_[fastdds::statistics::EventKind::ACKNACK_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = type; + serializers_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::GAP_COUNT] = type; + serializers_[fastdds::statistics::EventKind::GAP_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::PDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::PDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::EDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::EDP_PACKETS] = serializer; } } else if (str == "PDP_PACKETS") { - kind = StatisticsEventKind::PDP_PACKETS; + kind = fastdds::statistics::EventKind::PDP_PACKETS; topic_name = "_fastdds_statistics_pdp_packets"; // The data type can be initialized from other event kind @@ -497,25 +498,25 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::RESENT_DATAS] = type; - serializers_[StatisticsEventKind::RESENT_DATAS] = serializer; - data_types_[StatisticsEventKind::HEARTBEAT_COUNT] = type; - serializers_[StatisticsEventKind::HEARTBEAT_COUNT] = serializer; - data_types_[StatisticsEventKind::ACKNACK_COUNT] = type; - serializers_[StatisticsEventKind::ACKNACK_COUNT] = serializer; - data_types_[StatisticsEventKind::NACKFRAG_COUNT] = type; - serializers_[StatisticsEventKind::NACKFRAG_COUNT] = serializer; - data_types_[StatisticsEventKind::GAP_COUNT] = type; - serializers_[StatisticsEventKind::GAP_COUNT] = serializer; - data_types_[StatisticsEventKind::DATA_COUNT] = type; - serializers_[StatisticsEventKind::DATA_COUNT] = serializer; - data_types_[StatisticsEventKind::EDP_PACKETS] = type; - serializers_[StatisticsEventKind::EDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::RESENT_DATAS] = type; + serializers_[fastdds::statistics::EventKind::RESENT_DATAS] = serializer; + data_types_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = type; + serializers_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::ACKNACK_COUNT] = type; + serializers_[fastdds::statistics::EventKind::ACKNACK_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = type; + serializers_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::GAP_COUNT] = type; + serializers_[fastdds::statistics::EventKind::GAP_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::DATA_COUNT] = type; + serializers_[fastdds::statistics::EventKind::DATA_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::EDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::EDP_PACKETS] = serializer; } } else if (str == "EDP_PACKETS") { - kind = StatisticsEventKind::EDP_PACKETS; + kind = fastdds::statistics::EventKind::EDP_PACKETS; topic_name = "_fastdds_statistics_edp_packets"; // The data type can be initialized from other event kind @@ -529,25 +530,25 @@ class TrafficInjector serializers_[kind] = serializer; // Add the type to all other event kinds that use it - data_types_[StatisticsEventKind::RESENT_DATAS] = type; - serializers_[StatisticsEventKind::RESENT_DATAS] = serializer; - data_types_[StatisticsEventKind::HEARTBEAT_COUNT] = type; - serializers_[StatisticsEventKind::HEARTBEAT_COUNT] = serializer; - data_types_[StatisticsEventKind::ACKNACK_COUNT] = type; - serializers_[StatisticsEventKind::ACKNACK_COUNT] = serializer; - data_types_[StatisticsEventKind::NACKFRAG_COUNT] = type; - serializers_[StatisticsEventKind::NACKFRAG_COUNT] = serializer; - data_types_[StatisticsEventKind::GAP_COUNT] = type; - serializers_[StatisticsEventKind::GAP_COUNT] = serializer; - data_types_[StatisticsEventKind::DATA_COUNT] = type; - serializers_[StatisticsEventKind::DATA_COUNT] = serializer; - data_types_[StatisticsEventKind::PDP_PACKETS] = type; - serializers_[StatisticsEventKind::PDP_PACKETS] = serializer; + data_types_[fastdds::statistics::EventKind::RESENT_DATAS] = type; + serializers_[fastdds::statistics::EventKind::RESENT_DATAS] = serializer; + data_types_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = type; + serializers_[fastdds::statistics::EventKind::HEARTBEAT_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::ACKNACK_COUNT] = type; + serializers_[fastdds::statistics::EventKind::ACKNACK_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = type; + serializers_[fastdds::statistics::EventKind::NACKFRAG_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::GAP_COUNT] = type; + serializers_[fastdds::statistics::EventKind::GAP_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::DATA_COUNT] = type; + serializers_[fastdds::statistics::EventKind::DATA_COUNT] = serializer; + data_types_[fastdds::statistics::EventKind::PDP_PACKETS] = type; + serializers_[fastdds::statistics::EventKind::PDP_PACKETS] = serializer; } } else if (str == "DISCOVERED_ENTITY") { - kind = StatisticsEventKind::DISCOVERED_ENTITY; + kind = fastdds::statistics::EventKind::DISCOVERED_ENTITY; topic_name = "_fastdds_statistics_discovered_entity"; // The data type can be initialized from other event kind @@ -565,7 +566,7 @@ class TrafficInjector } else if (str == "SAMPLE_DATAS") { - kind = StatisticsEventKind::SAMPLE_DATAS; + kind = fastdds::statistics::EventKind::SAMPLE_DATAS; topic_name = "_fastdds_statistics_sample_datas"; // The data type can be initialized from other event kind @@ -584,7 +585,7 @@ class TrafficInjector } else if (str == "PHYSICAL_DATA") { - kind = StatisticsEventKind::PHYSICAL_DATA; + kind = fastdds::statistics::EventKind::PHYSICAL_DATA; topic_name = "_fastdds_statistics_physical_data"; // The data type can be initialized from other event kind @@ -607,7 +608,7 @@ class TrafficInjector event_kinds_[str] = kind; Topic* topic = participant_->create_topic(topic_name, - data_types_[kind]->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + data_types_[kind]->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); if (!topic) { throw std::runtime_error("Error creating topic"); @@ -636,77 +637,77 @@ class TrafficInjector void send_message( const MessageSerializer::Message& msg) { - StatisticsEventKind kind = event_kinds_[msg.at("event_kind").get()]; + uint32_t kind = event_kinds_[msg.at("event_kind").get()]; StatisticsData data; std::cout << "Simulating statistics message [" << msg << "]" << std::endl; switch (kind) { - case StatisticsEventKind::HISTORY2HISTORY_LATENCY: + case fastdds::statistics::EventKind::HISTORY2HISTORY_LATENCY: serializers_[kind]->deserialize(&data, msg.at("WriterReaderData")); data_writers_[kind]->write(&data.writer_reader_data()); break; - case StatisticsEventKind::NETWORK_LATENCY: + case fastdds::statistics::EventKind::NETWORK_LATENCY: serializers_[kind]->deserialize(&data, msg.at("locator2locator_data")); data_writers_[kind]->write(&data.locator2locator_data()); break; - case StatisticsEventKind::PUBLICATION_THROUGHPUT: + case fastdds::statistics::EventKind::PUBLICATION_THROUGHPUT: serializers_[kind]->deserialize(&data, msg.at("entity_data")); data_writers_[kind]->write(&data.entity_data()); break; - case StatisticsEventKind::SUBSCRIPTION_THROUGHPUT: + case fastdds::statistics::EventKind::SUBSCRIPTION_THROUGHPUT: serializers_[kind]->deserialize(&data, msg.at("entity_data")); data_writers_[kind]->write(&data.entity_data()); break; - case StatisticsEventKind::RTPS_SENT: + case fastdds::statistics::EventKind::RTPS_SENT: serializers_[kind]->deserialize(&data, msg.at("entity2locator_traffic")); data_writers_[kind]->write(&data.entity2locator_traffic()); break; - case StatisticsEventKind::RTPS_LOST: + case fastdds::statistics::EventKind::RTPS_LOST: serializers_[kind]->deserialize(&data, msg.at("entity2locator_traffic")); data_writers_[kind]->write(&data.entity2locator_traffic()); break; - case StatisticsEventKind::RESENT_DATAS: + case fastdds::statistics::EventKind::RESENT_DATAS: serializers_[kind]->deserialize(&data, msg.at("entity_count")); data_writers_[kind]->write(&data.entity_count()); break; - case StatisticsEventKind::HEARTBEAT_COUNT: + case fastdds::statistics::EventKind::HEARTBEAT_COUNT: serializers_[kind]->deserialize(&data, msg.at("entity_count")); data_writers_[kind]->write(&data.entity_count()); break; - case StatisticsEventKind::ACKNACK_COUNT: + case fastdds::statistics::EventKind::ACKNACK_COUNT: serializers_[kind]->deserialize(&data, msg.at("entity_count")); data_writers_[kind]->write(&data.entity_count()); break; - case StatisticsEventKind::NACKFRAG_COUNT: + case fastdds::statistics::EventKind::NACKFRAG_COUNT: serializers_[kind]->deserialize(&data, msg.at("entity_count")); data_writers_[kind]->write(&data.entity_count()); break; - case StatisticsEventKind::GAP_COUNT: + case fastdds::statistics::EventKind::GAP_COUNT: serializers_[kind]->deserialize(&data, msg.at("entity_count")); data_writers_[kind]->write(&data.entity_count()); break; - case StatisticsEventKind::DATA_COUNT: + case fastdds::statistics::EventKind::DATA_COUNT: serializers_[kind]->deserialize(&data, msg.at("entity_count")); data_writers_[kind]->write(&data.entity_count()); break; - case StatisticsEventKind::PDP_PACKETS: + case fastdds::statistics::EventKind::PDP_PACKETS: serializers_[kind]->deserialize(&data, msg.at("entity_count")); data_writers_[kind]->write(&data.entity_count()); break; - case StatisticsEventKind::EDP_PACKETS: + case fastdds::statistics::EventKind::EDP_PACKETS: serializers_[kind]->deserialize(&data, msg.at("entity_count")); data_writers_[kind]->write(&data.entity_count()); break; - case StatisticsEventKind::DISCOVERED_ENTITY: + case fastdds::statistics::EventKind::DISCOVERED_ENTITY: serializers_[kind]->deserialize(&data, msg.at("discovery_time")); data_writers_[kind]->write(&data.discovery_time()); break; - case StatisticsEventKind::SAMPLE_DATAS: + case fastdds::statistics::EventKind::SAMPLE_DATAS: serializers_[kind]->deserialize(&data, msg.at("sample_identity_count")); data_writers_[kind]->write(&data.sample_identity_count()); break; - case StatisticsEventKind::PHYSICAL_DATA: + case fastdds::statistics::EventKind::PHYSICAL_DATA: serializers_[kind]->deserialize(&data, msg.at("physical_data")); data_writers_[kind]->write(&data.physical_data()); break; @@ -718,13 +719,13 @@ class TrafficInjector DomainParticipant* participant_; Publisher* publisher_; - std::map data_writers_; - std::map topics_; - std::map data_types_; + std::map data_writers_; + std::map topics_; + std::map data_types_; - std::map> serializers_; - std::map event_names_; - std::map event_kinds_; + std::map> serializers_; + std::map event_names_; + std::map event_kinds_; std::string last_matched_topic_; std::mutex matching_mutex_; diff --git a/test/dds/communication/CMakeLists.txt b/test/dds/communication/CMakeLists.txt index 400a768ab..0d428fa52 100644 --- a/test/dds/communication/CMakeLists.txt +++ b/test/dds/communication/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima). +# Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,10 +19,11 @@ find_package(PythonInterp 3) ############################################################################### # types test +file(GLOB COMMUNICATION_SOURCES_CXX "*.cxx") set(DDS_PUBLISHER_SOURCE Publisher.cpp ) -add_executable(DDSSimpleCommunicationPublisher ${DDS_PUBLISHER_SOURCE}) +add_executable(DDSSimpleCommunicationPublisher ${DDS_PUBLISHER_SOURCE} ${COMMUNICATION_SOURCES_CXX}) if(MSVC) target_compile_definitions(DDSSimpleCommunicationPublisher PRIVATE @@ -36,14 +37,14 @@ target_compile_definitions(DDSSimpleCommunicationPublisher PRIVATE $<$>,$>:__DEBUG> $<$:__INTERNALDEBUG> # Internal debug activated. ) -target_link_libraries(DDSSimpleCommunicationPublisher fastrtps fastcdr foonathan_memory ${CMAKE_DL_LIBS}) +target_link_libraries(DDSSimpleCommunicationPublisher fastdds fastcdr foonathan_memory ${CMAKE_DL_LIBS}) get_win32_path_dependencies(DDSSimpleCommunicationPublisher TEST_FRIENDLY_PATH) set(DDS_SUBSCRIBER_SOURCE Subscriber.cpp ) -add_executable(DDSSimpleCommunicationSubscriber ${DDS_SUBSCRIBER_SOURCE}) +add_executable(DDSSimpleCommunicationSubscriber ${DDS_SUBSCRIBER_SOURCE} ${COMMUNICATION_SOURCES_CXX}) if(MSVC) target_compile_definitions(DDSSimpleCommunicationSubscriber PRIVATE @@ -57,7 +58,7 @@ target_compile_definitions(DDSSimpleCommunicationSubscriber PRIVATE $<$>,$>:__DEBUG> $<$:__INTERNALDEBUG> # Internal debug activated. ) -target_link_libraries(DDSSimpleCommunicationSubscriber fastrtps fastcdr foonathan_memory ${CMAKE_DL_LIBS}) +target_link_libraries(DDSSimpleCommunicationSubscriber fastdds fastcdr foonathan_memory ${CMAKE_DL_LIBS}) get_win32_path_dependencies(DDSSimpleCommunicationSubscriber TEST_FRIENDLY_PATH) @@ -79,7 +80,7 @@ target_compile_definitions(DDSSimpleCommunicationMonitor PRIVATE $<$>,$>:__DEBUG> $<$:__INTERNALDEBUG> # Internal debug activated. ) -target_link_libraries(DDSSimpleCommunicationMonitor ${PROJECT_NAME} fastrtps fastcdr foonathan_memory ${CMAKE_DL_LIBS}) +target_link_libraries(DDSSimpleCommunicationMonitor ${PROJECT_NAME} fastdds fastcdr foonathan_memory ${CMAKE_DL_LIBS}) get_win32_path_dependencies(DDSSimpleCommunicationMonitor TEST_FRIENDLY_PATH) @@ -89,8 +90,6 @@ get_win32_path_dependencies(DDSSimpleCommunicationMonitor TEST_FRIENDLY_PATH) # types test configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_communication.py ${CMAKE_CURRENT_BINARY_DIR}/simple_communication.py COPYONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/example_type.xml - ${CMAKE_CURRENT_BINARY_DIR}/example_type.xml COPYONLY) ############################################################################### # Tests specification diff --git a/test/dds/communication/Communication.hpp b/test/dds/communication/Communication.hpp new file mode 100644 index 000000000..b998a4ade --- /dev/null +++ b/test/dds/communication/Communication.hpp @@ -0,0 +1,224 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file Communication.hpp + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__COMMUNICATION_HPP +#define FAST_DDS_GENERATED__COMMUNICATION_HPP + +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(COMMUNICATION_SOURCE) +#define COMMUNICATION_DllAPI __declspec( dllexport ) +#else +#define COMMUNICATION_DllAPI __declspec( dllimport ) +#endif // COMMUNICATION_SOURCE +#else +#define COMMUNICATION_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define COMMUNICATION_DllAPI +#endif // _WIN32 + +/*! + * @brief This class represents the structure Communication defined by the user in the IDL file. + * @ingroup Communication + */ +class Communication +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport Communication() + { + } + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~Communication() + { + } + + /*! + * @brief Copy constructor. + * @param x Reference to the object Communication that will be copied. + */ + eProsima_user_DllExport Communication( + const Communication& x) + { + m_index = x.m_index; + + m_message = x.m_message; + + } + + /*! + * @brief Move constructor. + * @param x Reference to the object Communication that will be copied. + */ + eProsima_user_DllExport Communication( + Communication&& x) noexcept + { + m_index = x.m_index; + m_message = std::move(x.m_message); + } + + /*! + * @brief Copy assignment. + * @param x Reference to the object Communication that will be copied. + */ + eProsima_user_DllExport Communication& operator =( + const Communication& x) + { + + m_index = x.m_index; + + m_message = x.m_message; + + return *this; + } + + /*! + * @brief Move assignment. + * @param x Reference to the object Communication that will be copied. + */ + eProsima_user_DllExport Communication& operator =( + Communication&& x) noexcept + { + + m_index = x.m_index; + m_message = std::move(x.m_message); + return *this; + } + + /*! + * @brief Comparison operator. + * @param x Communication object to compare. + */ + eProsima_user_DllExport bool operator ==( + const Communication& x) const + { + return (m_index == x.m_index && + m_message == x.m_message); + } + + /*! + * @brief Comparison operator. + * @param x Communication object to compare. + */ + eProsima_user_DllExport bool operator !=( + const Communication& x) const + { + return !(*this == x); + } + + /*! + * @brief This function sets a value in member index + * @param _index New value for member index + */ + eProsima_user_DllExport void index( + uint32_t _index) + { + m_index = _index; + } + + /*! + * @brief This function returns the value of member index + * @return Value of member index + */ + eProsima_user_DllExport uint32_t index() const + { + return m_index; + } + + /*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ + eProsima_user_DllExport uint32_t& index() + { + return m_index; + } + + /*! + * @brief This function copies the value in member message + * @param _message New value to be copied in member message + */ + eProsima_user_DllExport void message( + const std::string& _message) + { + m_message = _message; + } + + /*! + * @brief This function moves the value in member message + * @param _message New value to be moved in member message + */ + eProsima_user_DllExport void message( + std::string&& _message) + { + m_message = std::move(_message); + } + + /*! + * @brief This function returns a constant reference to member message + * @return Constant reference to member message + */ + eProsima_user_DllExport const std::string& message() const + { + return m_message; + } + + /*! + * @brief This function returns a reference to member message + * @return Reference to member message + */ + eProsima_user_DllExport std::string& message() + { + return m_message; + } + +private: + + uint32_t m_index{0}; + std::string m_message; + +}; + +#endif // _FAST_DDS_GENERATED_COMMUNICATION_HPP_ + + diff --git a/test/dds/communication/Communication.idl b/test/dds/communication/Communication.idl new file mode 100644 index 000000000..7837410ab --- /dev/null +++ b/test/dds/communication/Communication.idl @@ -0,0 +1,6 @@ +@extensibility(APPENDABLE) +struct Communication +{ + unsigned long index; + string message; +}; diff --git a/test/dds/communication/CommunicationCdrAux.hpp b/test/dds/communication/CommunicationCdrAux.hpp new file mode 100644 index 000000000..fc56e32bb --- /dev/null +++ b/test/dds/communication/CommunicationCdrAux.hpp @@ -0,0 +1,46 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file CommunicationCdrAux.hpp + * This source file contains some definitions of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__COMMUNICATIONCDRAUX_HPP +#define FAST_DDS_GENERATED__COMMUNICATIONCDRAUX_HPP + +#include "Communication.hpp" + +constexpr uint32_t Communication_max_cdr_typesize {268UL}; +constexpr uint32_t Communication_max_key_cdr_typesize {0UL}; + + +namespace eprosima { +namespace fastcdr { + +class Cdr; +class CdrSizeCalculator; + +eProsima_user_DllExport void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const Communication& data); + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__COMMUNICATIONCDRAUX_HPP + diff --git a/test/dds/communication/CommunicationCdrAux.ipp b/test/dds/communication/CommunicationCdrAux.ipp new file mode 100644 index 000000000..ab40b65a6 --- /dev/null +++ b/test/dds/communication/CommunicationCdrAux.ipp @@ -0,0 +1,126 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file CommunicationCdrAux.ipp + * This source file contains some declarations of CDR related functions. + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__COMMUNICATIONCDRAUX_IPP +#define FAST_DDS_GENERATED__COMMUNICATIONCDRAUX_IPP + +#include "CommunicationCdrAux.hpp" + +#include +#include + + +#include +using namespace eprosima::fastcdr::exception; + +namespace eprosima { +namespace fastcdr { + +template<> +eProsima_user_DllExport size_t calculate_serialized_size( + eprosima::fastcdr::CdrSizeCalculator& calculator, + const Communication& data, + size_t& current_alignment) +{ + static_cast(data); + + eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); + size_t calculated_size {calculator.begin_calculate_type_serialized_size( + eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + current_alignment)}; + + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), + data.index(), current_alignment); + + calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), + data.message(), current_alignment); + + + calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); + + return calculated_size; +} + +template<> +eProsima_user_DllExport void serialize( + eprosima::fastcdr::Cdr& scdr, + const Communication& data) +{ + eprosima::fastcdr::Cdr::state current_state(scdr); + scdr.begin_serialize_type(current_state, + eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); + + scdr + << eprosima::fastcdr::MemberId(0) << data.index() + << eprosima::fastcdr::MemberId(1) << data.message() +; + scdr.end_serialize_type(current_state); +} + +template<> +eProsima_user_DllExport void deserialize( + eprosima::fastcdr::Cdr& cdr, + Communication& data) +{ + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, + [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool + { + bool ret_value = true; + switch (mid.id) + { + case 0: + dcdr >> data.index(); + break; + + case 1: + dcdr >> data.message(); + break; + + default: + ret_value = false; + break; + } + return ret_value; + }); +} + +void serialize_key( + eprosima::fastcdr::Cdr& scdr, + const Communication& data) +{ + static_cast(scdr); + static_cast(data); +} + + + +} // namespace fastcdr +} // namespace eprosima + +#endif // FAST_DDS_GENERATED__COMMUNICATIONCDRAUX_IPP + diff --git a/test/dds/communication/CommunicationPubSubTypes.cxx b/test/dds/communication/CommunicationPubSubTypes.cxx new file mode 100644 index 000000000..862b4dbf2 --- /dev/null +++ b/test/dds/communication/CommunicationPubSubTypes.cxx @@ -0,0 +1,216 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file CommunicationPubSubTypes.cpp + * This header file contains the implementation of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + +#include "CommunicationPubSubTypes.hpp" + +#include +#include + +#include "CommunicationCdrAux.hpp" +#include "CommunicationTypeObjectSupport.hpp" + +using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; +using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; +using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; + +CommunicationPubSubType::CommunicationPubSubType() +{ + set_name("Communication"); + uint32_t type_size = Communication_max_cdr_typesize; + type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ + max_serialized_type_size = type_size + 4; /*encapsulation*/ + is_compute_key_provided = false; + uint32_t key_length = Communication_max_key_cdr_typesize > 16 ? Communication_max_key_cdr_typesize : 16; + key_buffer_ = reinterpret_cast(malloc(key_length)); + memset(key_buffer_, 0, key_length); +} + +CommunicationPubSubType::~CommunicationPubSubType() +{ + if (key_buffer_ != nullptr) + { + free(key_buffer_); + } +} + +bool CommunicationPubSubType::serialize( + const void* const data, + SerializedPayload_t& payload, + DataRepresentationId_t data_representation) +{ + const Communication* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); + payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + ser.set_encoding_flag( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR : + eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2); + + try + { + // Serialize encapsulation + ser.serialize_encapsulation(); + // Serialize the object. + ser << *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + // Get the serialized length + payload.length = static_cast(ser.get_serialized_data_length()); + return true; +} + +bool CommunicationPubSubType::deserialize( + SerializedPayload_t& payload, + void* data) +{ + try + { + // Convert DATA to pointer of your type + Communication* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); + + // Object that deserializes the data. + eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); + + // Deserialize encapsulation. + deser.read_encapsulation(); + payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; + + // Deserialize the object. + deser >> *p_type; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return false; + } + + return true; +} + +uint32_t CommunicationPubSubType::calculate_serialized_size( + const void* const data, + DataRepresentationId_t data_representation) +{ + try + { + eprosima::fastcdr::CdrSizeCalculator calculator( + data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? + eprosima::fastcdr::CdrVersion::XCDRv1 :eprosima::fastcdr::CdrVersion::XCDRv2); + size_t current_alignment {0}; + return static_cast(calculator.calculate_serialized_size( + *static_cast(data), current_alignment)) + + 4u /*encapsulation*/; + } + catch (eprosima::fastcdr::exception::Exception& /*exception*/) + { + return 0; + } +} + +void* CommunicationPubSubType::create_data() +{ + return reinterpret_cast(new Communication()); +} + +void CommunicationPubSubType::delete_data( + void* data) +{ + delete(reinterpret_cast(data)); +} + +bool CommunicationPubSubType::compute_key( + SerializedPayload_t& payload, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + Communication data; + if (deserialize(payload, static_cast(&data))) + { + return compute_key(static_cast(&data), handle, force_md5); + } + + return false; +} + +bool CommunicationPubSubType::compute_key( + const void* const data, + InstanceHandle_t& handle, + bool force_md5) +{ + if (!is_compute_key_provided) + { + return false; + } + + const Communication* p_type = static_cast(data); + + // Object that manages the raw buffer. + eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(key_buffer_), + Communication_max_key_cdr_typesize); + + // Object that serializes the data. + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); + eprosima::fastcdr::serialize_key(ser, *p_type); + if (force_md5 || Communication_max_key_cdr_typesize > 16) + { + md5_.init(); + md5_.update(key_buffer_, static_cast(ser.get_serialized_data_length())); + md5_.finalize(); + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = md5_.digest[i]; + } + } + else + { + for (uint8_t i = 0; i < 16; ++i) + { + handle.value[i] = key_buffer_[i]; + } + } + return true; +} + +void CommunicationPubSubType::register_type_object_representation() +{ + register_Communication_type_identifier(type_identifiers_); +} + + +// Include auxiliary functions like for serializing/deserializing. +#include "CommunicationCdrAux.ipp" diff --git a/test/dds/communication/CommunicationPubSubTypes.hpp b/test/dds/communication/CommunicationPubSubTypes.hpp new file mode 100644 index 000000000..829a912db --- /dev/null +++ b/test/dds/communication/CommunicationPubSubTypes.hpp @@ -0,0 +1,123 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file CommunicationPubSubTypes.hpp + * This header file contains the declaration of the serialization functions. + * + * This file was generated by the tool fastddsgen. + */ + + +#ifndef FAST_DDS_GENERATED__COMMUNICATION_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__COMMUNICATION_PUBSUBTYPES_HPP + +#include +#include +#include +#include +#include + +#include "Communication.hpp" + + +#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) +#error \ + Generated Communication is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. +#endif // FASTDDS_GEN_API_VER + + +/*! + * @brief This class represents the TopicDataType of the type Communication defined by the user in the IDL file. + * @ingroup Communication + */ +class CommunicationPubSubType : public eprosima::fastdds::dds::TopicDataType +{ +public: + + typedef Communication type; + + eProsima_user_DllExport CommunicationPubSubType(); + + eProsima_user_DllExport ~CommunicationPubSubType() override; + + eProsima_user_DllExport bool serialize( + const void* const data, + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool deserialize( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + void* data) override; + + eProsima_user_DllExport uint32_t calculate_serialized_size( + const void* const data, + eprosima::fastdds::dds::DataRepresentationId_t data_representation) override; + + eProsima_user_DllExport bool compute_key( + eprosima::fastdds::rtps::SerializedPayload_t& payload, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport bool compute_key( + const void* const data, + eprosima::fastdds::rtps::InstanceHandle_t& ihandle, + bool force_md5 = false) override; + + eProsima_user_DllExport void* create_data() override; + + eProsima_user_DllExport void delete_data( + void* data) override; + + //Register TypeObject representation in Fast DDS TypeObjectRegistry + eProsima_user_DllExport void register_type_object_representation() override; + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + eProsima_user_DllExport inline bool is_bounded() const override + { + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED + +#ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + + eProsima_user_DllExport inline bool is_plain( + eprosima::fastdds::dds::DataRepresentationId_t data_representation) const override + { + static_cast(data_representation); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN + +#ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + eProsima_user_DllExport inline bool construct_sample( + void* memory) const override + { + static_cast(memory); + return false; + } + +#endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE + +private: + + eprosima::fastdds::MD5 md5_; + unsigned char* key_buffer_; + +}; + +#endif // FAST_DDS_GENERATED__COMMUNICATION_PUBSUBTYPES_HPP + diff --git a/test/dds/communication/CommunicationTypeObjectSupport.cxx b/test/dds/communication/CommunicationTypeObjectSupport.cxx new file mode 100644 index 000000000..d6d9117b6 --- /dev/null +++ b/test/dds/communication/CommunicationTypeObjectSupport.cxx @@ -0,0 +1,145 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file CommunicationTypeObjectSupport.cxx + * Source file containing the implementation to register the TypeObject representation of the described types in the IDL file + * + * This file was generated by the tool fastddsgen. + */ + +#include "CommunicationTypeObjectSupport.hpp" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Communication.hpp" + + +using namespace eprosima::fastdds::dds::xtypes; + +// TypeIdentifier is returned by reference: dependent structures/unions are registered in this same method +void register_Communication_type_identifier( + TypeIdentifierPair& type_ids_Communication) +{ + + ReturnCode_t return_code_Communication {eprosima::fastdds::dds::RETCODE_OK}; + return_code_Communication = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "Communication", type_ids_Communication); + if (eprosima::fastdds::dds::RETCODE_OK != return_code_Communication) + { + StructTypeFlag struct_flags_Communication = TypeObjectUtils::build_struct_type_flag(eprosima::fastdds::dds::xtypes::ExtensibilityKind::APPENDABLE, + false, false); + QualifiedTypeName type_name_Communication = "Communication"; + eprosima::fastcdr::optional type_ann_builtin_Communication; + eprosima::fastcdr::optional ann_custom_Communication; + AppliedAnnotationSeq tmp_ann_custom_Communication; + eprosima::fastcdr::optional verbatim_Communication; + if (!tmp_ann_custom_Communication.empty()) + { + ann_custom_Communication = tmp_ann_custom_Communication; + } + + CompleteTypeDetail detail_Communication = TypeObjectUtils::build_complete_type_detail(type_ann_builtin_Communication, ann_custom_Communication, type_name_Communication.to_string()); + CompleteStructHeader header_Communication; + header_Communication = TypeObjectUtils::build_complete_struct_header(TypeIdentifier(), detail_Communication); + CompleteStructMemberSeq member_seq_Communication; + { + TypeIdentifierPair type_ids_index; + ReturnCode_t return_code_index {eprosima::fastdds::dds::RETCODE_OK}; + return_code_index = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "_uint32_t", type_ids_index); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_index) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "index Structure member TypeIdentifier unknown to TypeObjectRegistry."); + return; + } + StructMemberFlag member_flags_index = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_index = 0x00000000; + bool common_index_ec {false}; + CommonStructMember common_index {TypeObjectUtils::build_common_struct_member(member_id_index, member_flags_index, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_index, common_index_ec))}; + if (!common_index_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure index member TypeIdentifier inconsistent."); + return; + } + MemberName name_index = "index"; + eprosima::fastcdr::optional member_ann_builtin_index; + ann_custom_Communication.reset(); + CompleteMemberDetail detail_index = TypeObjectUtils::build_complete_member_detail(name_index, member_ann_builtin_index, ann_custom_Communication); + CompleteStructMember member_index = TypeObjectUtils::build_complete_struct_member(common_index, detail_index); + TypeObjectUtils::add_complete_struct_member(member_seq_Communication, member_index); + } + { + TypeIdentifierPair type_ids_message; + ReturnCode_t return_code_message {eprosima::fastdds::dds::RETCODE_OK}; + return_code_message = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_identifiers( + "anonymous_string_unbounded", type_ids_message); + + if (eprosima::fastdds::dds::RETCODE_OK != return_code_message) + { + { + SBound bound = 0; + StringSTypeDefn string_sdefn = TypeObjectUtils::build_string_s_type_defn(bound); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_s_string_type_identifier(string_sdefn, + "anonymous_string_unbounded", type_ids_message)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "anonymous_string_unbounded already registered in TypeObjectRegistry for a different type."); + } + } + } + StructMemberFlag member_flags_message = TypeObjectUtils::build_struct_member_flag(eprosima::fastdds::dds::xtypes::TryConstructFailAction::DISCARD, + false, false, false, false); + MemberId member_id_message = 0x00000001; + bool common_message_ec {false}; + CommonStructMember common_message {TypeObjectUtils::build_common_struct_member(member_id_message, member_flags_message, TypeObjectUtils::retrieve_complete_type_identifier(type_ids_message, common_message_ec))}; + if (!common_message_ec) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, "Structure message member TypeIdentifier inconsistent."); + return; + } + MemberName name_message = "message"; + eprosima::fastcdr::optional member_ann_builtin_message; + ann_custom_Communication.reset(); + CompleteMemberDetail detail_message = TypeObjectUtils::build_complete_member_detail(name_message, member_ann_builtin_message, ann_custom_Communication); + CompleteStructMember member_message = TypeObjectUtils::build_complete_struct_member(common_message, detail_message); + TypeObjectUtils::add_complete_struct_member(member_seq_Communication, member_message); + } + CompleteStructType struct_type_Communication = TypeObjectUtils::build_complete_struct_type(struct_flags_Communication, header_Communication, member_seq_Communication); + if (eprosima::fastdds::dds::RETCODE_BAD_PARAMETER == + TypeObjectUtils::build_and_register_struct_type_object(struct_type_Communication, type_name_Communication.to_string(), type_ids_Communication)) + { + EPROSIMA_LOG_ERROR(XTYPES_TYPE_REPRESENTATION, + "Communication already registered in TypeObjectRegistry for a different type."); + } + } +} + diff --git a/test/dds/communication/CommunicationTypeObjectSupport.hpp b/test/dds/communication/CommunicationTypeObjectSupport.hpp new file mode 100644 index 000000000..3d72ca530 --- /dev/null +++ b/test/dds/communication/CommunicationTypeObjectSupport.hpp @@ -0,0 +1,56 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file CommunicationTypeObjectSupport.hpp + * Header file containing the API required to register the TypeObject representation of the described types in the IDL file + * + * This file was generated by the tool fastddsgen. + */ + +#ifndef FAST_DDS_GENERATED__COMMUNICATION_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__COMMUNICATION_TYPE_OBJECT_SUPPORT_HPP + +#include + + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +/** + * @brief Register Communication related TypeIdentifier. + * Fully-descriptive TypeIdentifiers are directly registered. + * Hash TypeIdentifiers require to fill the TypeObject information and hash it, consequently, the TypeObject is + * indirectly registered as well. + * + * @param[out] TypeIdentifier of the registered type. + * The returned TypeIdentifier corresponds to the complete TypeIdentifier in case of hashed TypeIdentifiers. + * Invalid TypeIdentifier is returned in case of error. + */ +eProsima_user_DllExport void register_Communication_type_identifier( + eprosima::fastdds::dds::xtypes::TypeIdentifierPair& type_ids); + + +#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC + +#endif // FAST_DDS_GENERATED__COMMUNICATION_TYPE_OBJECT_SUPPORT_HPP diff --git a/test/dds/communication/Host.hpp b/test/dds/communication/Host.hpp index 2f767a678..c346d616d 100644 --- a/test/dds/communication/Host.hpp +++ b/test/dds/communication/Host.hpp @@ -1,4 +1,4 @@ -// Copyright 2020 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,13 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#ifndef UTILS_HOST_HPP_ -#define UTILS_HOST_HPP_ +#ifndef FASTDDS_STATISTICS_BACKEND_TEST_DDS_COMMUNICATION__HOST_HPP +#define FASTDDS_STATISTICS_BACKEND_TEST_DDS_COMMUNICATION__HOST_HPP -#include +#include -#include -#include +#include +#include #include @@ -66,12 +66,12 @@ class Host { // Compute the host id fastdds::rtps::LocatorList loc; - fastrtps::rtps::IPFinder::getIP4Address(&loc); + fastdds::rtps::IPFinder::getIP4Address(&loc); { if (loc.size() > 0) { - MD5 md5; + fastdds::MD5 md5; for (auto& l : loc) { md5.update(l.address, sizeof(l.address)); @@ -91,11 +91,10 @@ class Host } // Compute the MAC id - std::vector macs; - if (fastrtps::rtps::IPFinder::getAllMACAddress(&macs) && - macs.size() > 0) + std::vector macs; + if (fastdds::rtps::IPFinder::getAllMACAddress(&macs) && macs.size() > 0) { - MD5 md5; + fastdds::MD5 md5; for (auto& m : macs) { md5.update(m.address, sizeof(m.address)); @@ -112,7 +111,7 @@ class Host } else { - logWarning(UTILS, "Cannot get MAC addresses. Failing back to IP based ID"); + EPROSIMA_LOG_WARNING(UTILS, "Cannot get MAC addresses. Failing back to IP based ID"); for (size_t i = 0; i < mac_id_length; i += 2) { mac_id_.value[i] = (id_ >> 8); @@ -127,4 +126,4 @@ class Host } // eprosima -#endif // UTILS_HOST_HPP_ +#endif // FASTDDS_STATISTICS_BACKEND_TEST_DDS_COMMUNICATION__HOST_HPP diff --git a/test/dds/communication/Monitor.cpp b/test/dds/communication/Monitor.cpp index 2221018a7..cd4588093 100644 --- a/test/dds/communication/Monitor.cpp +++ b/test/dds/communication/Monitor.cpp @@ -1,4 +1,4 @@ -// Copyright 2021 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -34,7 +33,7 @@ #include #include #include -#include +#include using namespace eprosima::statistics_backend; using namespace eprosima::fastdds::dds; @@ -151,17 +150,20 @@ int main( { int arg_count = 1; uint32_t seed = 7800; + unsigned int num_statistics = 18; unsigned int num_participants = 2; unsigned int num_hosts = 1; unsigned int num_users = 1; unsigned int num_processes = 2; unsigned int num_readers = 1; // Each participant creates a meta traffic endpoint - unsigned int num_writers = num_participants + 1; + unsigned int num_writers = num_statistics * num_participants + 1 + 2; // Additionally, we need a meta traffic topic per domain - unsigned int num_topics = 2; + unsigned int num_topics = num_statistics + 2; unsigned int num_entities = num_participants + num_topics + num_readers + num_writers; - unsigned int num_locators = num_readers + num_writers + num_participants; + // Each participant has 2 locators by default, one for each builtin transport (UDP + SHM) + // Additionally, each participant has a different UDP locator for metatraffic + unsigned int num_locators = 3 * num_participants; // Process arguments while (arg_count < argc) @@ -180,7 +182,7 @@ int main( ++arg_count; } - DomainId domain_id = seed % 230; + DomainId domain_id; MonitorListener listener; EntityId monitor_id; @@ -213,6 +215,10 @@ int main( { // Init the monitor domain_id = seed % 230; + DataKindMask data_mask = DataKind::INVALID; + std::string app_id = ""; + std::string app_metadata = ""; + monitor_id = StatisticsBackend::init_monitor(domain_id, &listener); if (!monitor_id.is_valid()) { @@ -265,7 +271,6 @@ int main( return listener.num_entities_discovered_ >= num_entities; }); } - // Check that the database contains all entities related to subscriber and publisher entities // and check that all entities are active try @@ -310,9 +315,8 @@ int main( { throw Error("Error: database contains unexpected DATAREADER"); } - else if (StatisticsBackend::get_entities(EntityKind::LOCATOR).size() != num_locators || - StatisticsBackend::get_entities(EntityKind::LOCATOR, - monitor_id).size() != num_locators) + // Some locators are beyond the monitor domain + else if (StatisticsBackend::get_entities(EntityKind::LOCATOR, monitor_id).size() != num_locators) { throw Error("Error: database contains unexpected LOCATOR"); } @@ -443,9 +447,8 @@ int main( { throw Error("Error: database contains unexpected DATAREADER"); } - else if (StatisticsBackend::get_entities(EntityKind::LOCATOR).size() != num_locators || - StatisticsBackend::get_entities(EntityKind::LOCATOR, - monitor_id).size() != num_locators) + // Some locators are beyond the monitor domain + else if (StatisticsBackend::get_entities(EntityKind::LOCATOR, monitor_id).size() != num_locators) { throw Error("Error: database contains unexpected LOCATOR"); } @@ -578,9 +581,8 @@ int main( { throw Error("Error: database contains unexpected DATAREADER"); } - else if (StatisticsBackend::get_entities(EntityKind::LOCATOR).size() != num_locators || - StatisticsBackend::get_entities(EntityKind::LOCATOR, - monitor_id).size() != num_locators) + // Some locators are beyond the monitor domain + else if (StatisticsBackend::get_entities(EntityKind::LOCATOR, monitor_id).size() != num_locators) { throw Error("Error: database contains unexpected LOCATOR"); } diff --git a/test/dds/communication/Publisher.cpp b/test/dds/communication/Publisher.cpp index de4aa840d..247d26add 100644 --- a/test/dds/communication/Publisher.cpp +++ b/test/dds/communication/Publisher.cpp @@ -1,4 +1,4 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -14,150 +14,220 @@ /** * @file Publisher.cpp + * */ +#include +#include + #include -#include -#include -#include -#include -#include #include +#include #include +#include +#include + +#include "Publisher.hpp" +#include "CommunicationPubSubTypes.hpp" +#include "Host.hpp" + +std::mutex mutex; +std::condition_variable cv; + +std::atomic Publisher::stop_(false); +Publisher::Publisher() + : participant_(nullptr) + , publisher_(nullptr) + , topic_(nullptr) + , writer_(nullptr) + , type_(new CommunicationPubSubType()) +{ +} -#include -#include -#include -#include +bool Publisher::is_stopped() +{ + return stop_; +} -#include -#include -#include -#include -#include +void Publisher::stop() +{ + stop_ = true; +} -#include +bool Publisher::init( + uint32_t domain) +{ + comm_.index(0); + comm_.message("HelloWorld"); + eprosima::fastdds::dds::DomainParticipantQos pqos; + pqos.name("Participant_pub"); + + // Activate Fast DDS Statistics module + pqos.properties().properties().emplace_back("fastdds.statistics", + "HISTORY_LATENCY_TOPIC;" \ + "NETWORK_LATENCY_TOPIC;" \ + "PUBLICATION_THROUGHPUT_TOPIC;" \ + "SUBSCRIPTION_THROUGHPUT_TOPIC;" \ + "RTPS_SENT_TOPIC;" \ + "RTPS_LOST_TOPIC;" \ + "HEARTBEAT_COUNT_TOPIC;" \ + "ACKNACK_COUNT_TOPIC;" \ + "NACKFRAG_COUNT_TOPIC;" \ + "GAP_COUNT_TOPIC;" \ + "DATA_COUNT_TOPIC;" \ + "RESENT_DATAS_TOPIC;" \ + "SAMPLE_DATAS_TOPIC;" \ + "PDP_PACKETS_TOPIC;" \ + "EDP_PACKETS_TOPIC;" \ + "DISCOVERY_TOPIC;" \ + "PHYSICAL_DATA_TOPIC;" \ + "MONITOR_SERVICE_TOPIC"); + + // CREATE THE PARTICIPANT + participant_ = eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->create_participant(domain, pqos); + + if (participant_ == nullptr) + { + std::cout << "Error creating publisher participant" << std::endl; + return 1; + } -using namespace eprosima::fastdds::dds; -using namespace eprosima::fastrtps; -using namespace eprosima::fastrtps::rtps; + std::cout << "Participant " << pqos.name() << " created with GUID " << participant_->guid() << std::endl; -static bool run = true; + // REGISTER THE TYPE + type_.register_type(participant_); -class ParListener : public DomainParticipantListener -{ -public: + // CREATE THE PUBLISHER + publisher_ = participant_->create_publisher(eprosima::fastdds::dds::PUBLISHER_QOS_DEFAULT, nullptr); - ParListener( - bool exit_on_lost_liveliness) - : exit_on_lost_liveliness_(exit_on_lost_liveliness) + if (publisher_ == nullptr) { + std::cerr << "Error creating publisher" << std::endl; + return 1; } - virtual ~ParListener() override + // CREATE THE TOPIC + // Generate topic name + std::ostringstream topic_name; + topic_name << "HelloWorldTopic_" << (eprosima::Host::instance().id()) << "_" << domain; + topic_ = participant_->create_topic(topic_name.str(), + type_.get_type_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + + if (topic_ == nullptr) { + std::cerr << "Error creating publisher topic" << std::endl; + return 1; } - /** - * This method is called when a new Participant is discovered, or a previously discovered participant - * changes its QOS or is removed. - * @param p Pointer to the Participant - * @param info DiscoveryInfo. - */ - void on_participant_discovery( - DomainParticipant* /*participant*/, - rtps::ParticipantDiscoveryInfo&& info) override + // CREATE THE WRITER + // Set DataWriter Qos + eprosima::fastdds::dds::DataWriterQos wqos; + wqos.liveliness().lease_duration = 3; + wqos.liveliness().announcement_period = 1; + wqos.liveliness().kind = eprosima::fastdds::dds::AUTOMATIC_LIVELINESS_QOS; + + writer_ = publisher_->create_datawriter(topic_, wqos, &listener); + + if (writer_ == nullptr) { - if (info.status == rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT) - { - std::cout << "Publisher participant " << //participant->getGuid() << - " discovered participant " << info.info.m_guid << std::endl; - } - else if (info.status == rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT) - { - std::cout << "Publisher participant " << //participant->getGuid() << - " detected changes on participant " << info.info.m_guid << std::endl; - } - else if (info.status == rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT) - { - std::cout << "Publisher participant " << //participant->getGuid() << - " removed participant " << info.info.m_guid << std::endl; - } - else if (info.status == rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT) - { - std::cout << "Publisher participant " << //participant->getGuid() << - " dropped participant " << info.info.m_guid << std::endl; - if (exit_on_lost_liveliness_) - { - run = false; - } - } + std::cerr << "Error creating publisher writer" << std::endl; + return false; } -#if HAVE_SECURITY - void onParticipantAuthentication( - DomainParticipant* participant, - rtps::ParticipantAuthenticationInfo&& info) override + std::cout << "DataWriter created with GUID " << writer_->guid() << std::endl; + + + + return true; +} + +Publisher::~Publisher() +{ + if (participant_ != nullptr) { - if (rtps::ParticipantAuthenticationInfo::AUTHORIZED_PARTICIPANT == info.status) + if (publisher_ != nullptr) { - std::cout << "Publisher participant " << participant->guid() << - " authorized participant " << info.guid << std::endl; + if (writer_ != nullptr) + { + publisher_->delete_datawriter(writer_); + } + participant_->delete_publisher(publisher_); } - else + if (topic_ != nullptr) { - std::cout << "Publisher participant " << participant->guid() << - " unauthorized participant " << info.guid << std::endl; + participant_->delete_topic(topic_); } + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->delete_participant(participant_); } +} -#endif // if HAVE_SECURITY - -private: - - bool exit_on_lost_liveliness_; -}; - -class PubListener : public PublisherListener +void Publisher::PubListener::on_publication_matched( + eprosima::fastdds::dds::DataWriter*, + const eprosima::fastdds::dds::PublicationMatchedStatus& info) { -public: - - PubListener() - : matched_(0) + std::unique_lock lock(mutex); + if (info.current_count_change == 1) + { + matched_ = info.current_count; + std::cout << "Publisher matched." << std::endl; + cv.notify_all(); + } + else if (info.current_count_change == -1) { + matched_ = info.current_count; + std::cout << "Publisher unmatched." << std::endl; + cv.notify_all(); } + else + { + std::cout << info.current_count_change + << " is not a valid value for PublicationMatchedStatus current count change" << std::endl; + } +} - ~PubListener() override +void Publisher::runThread( + uint32_t samples, + uint32_t sleep) +{ + while (!is_stopped() && (samples == 0 || comm_.index() < samples)) { + publish(); + std::cout << "Message: " << comm_.message() << " with index: " << comm_.index() + << " SENT" << std::endl; + std::this_thread::sleep_for(std::chrono::milliseconds(sleep)); } +} - void on_publication_matched( - DataWriter* /*publisher*/, - const PublicationMatchedStatus& info) override +void Publisher::run( + uint32_t samples, + uint32_t sleep) +{ + stop_ = false; + std::thread thread(&Publisher::runThread, this, samples, sleep); + if (samples == 0) { - std::unique_lock lock(mutex_); - if (info.current_count_change == 1) - { - std::cout << "Publisher matched with subscriber " << info.last_subscription_handle - << ": " << ++matched_ << std::endl; - } - else if (info.current_count_change == -1) - { - std::cout << "Publisher unmatched with subscriber " << info.last_subscription_handle - << ": " << --matched_ << std::endl; - } - else - { - std::cout << info.current_count_change - << " is not a valid value for PublicationMatchedStatus current count change" << std::endl; - } - cv_.notify_all(); + std::cout << "Publisher running. Please press CTRL+C to stop the Publisher at any time." << std::endl; } + else + { + std::cout << "Publisher running " << samples << + " samples. Please press CTRL+C to stop the Publisher at any time." << std::endl; + } + signal(SIGINT, [](int signum) + { + std::cout << "SIGINT received, stopping Publisher execution." << std::endl; + static_cast(signum); Publisher::stop(); + }); + + thread.join(); + Publisher::stop(); +} - std::mutex mutex_; - std::condition_variable cv_; - unsigned int matched_; -}; +void Publisher::publish() +{ + comm_.index(comm_.index() + 1); + writer_->write(&comm_); +} int main( int argc, @@ -166,9 +236,9 @@ int main( int arg_count = 1; bool exit_on_lost_liveliness = false; uint32_t seed = 7800, wait = 0; - //char* xml_file = nullptr; - uint32_t samples = 4; + uint32_t samples = 10; std::string magic; + Publisher pub; while (arg_count < argc) { @@ -238,126 +308,29 @@ int main( } */ - xmlparser::XMLProfileManager::loadXMLFile("example_type.xml"); - - DomainParticipantQos participant_qos; - participant_qos.wire_protocol().builtin.typelookup_config.use_server = true; - ParListener participant_listener(exit_on_lost_liveliness); - DomainParticipant* participant = - DomainParticipantFactory::get_instance()->create_participant(seed % 230, participant_qos, - &participant_listener); - - if (participant == nullptr) - { - std::cerr << "Error creating publisher participant" << std::endl; - return 1; - } - - types::DynamicType_ptr dyn_type = xmlparser::XMLProfileManager::getDynamicTypeByName("TypeLookup")->build(); - TypeSupport type(new types::DynamicPubSubType(dyn_type)); - type.register_type(participant); - - PubListener listener; - StatusMask mask = StatusMask::publication_matched(); - - // Generate topic name - std::ostringstream topic_name; - topic_name << "HelloWorldTopic_" << (eprosima::Host::instance().id()) << "_" << seed; - - //CREATE THE PUBLISHER - DataWriterQos wqos; - wqos.liveliness().lease_duration = 3; - wqos.liveliness().announcement_period = 1; - wqos.liveliness().kind = eprosima::fastdds::dds::AUTOMATIC_LIVELINESS_QOS; - - Publisher* publisher = participant->create_publisher(PUBLISHER_QOS_DEFAULT, &listener, mask); - if (publisher == nullptr) - { - std::cout << "Error creating publisher" << std::endl; - DomainParticipantFactory::get_instance()->delete_participant(participant); - return 1; - } - Topic* topic = participant->create_topic(topic_name.str(), type.get_type_name(), TOPIC_QOS_DEFAULT); - if (topic == nullptr) - { - std::cout << "Error creating publisher topic" << std::endl; - participant->delete_publisher(publisher); - DomainParticipantFactory::get_instance()->delete_participant(participant); - return 1; - } - - DataWriter* writer = publisher->create_datawriter(topic, wqos, nullptr); - if (writer == nullptr) - { - participant->delete_publisher(publisher); - participant->delete_topic(topic); - DomainParticipantFactory::get_instance()->delete_participant(participant); - return 1; - } + // Initialize the publisher + pub.init(seed % 230); + // Wait until all DataReaders are matched if (wait > 0) { - std::unique_lock lock(listener.mutex_); - listener.cv_.wait(lock, [&] + std::unique_lock lock(mutex); + cv.wait(lock, [&] { - return listener.matched_ >= wait; + return pub.listener.get_matched() >= wait; }); + std::this_thread::sleep_for(std::chrono::seconds(1)); } - types::DynamicData_ptr data(types::DynamicDataFactory::get_instance()->create_data(dyn_type)); - data->set_string_value("Hello DDS Dynamic World", 0); - data->set_uint32_value(1, 1); - types::DynamicData* inner = data->loan_value(2); - inner->set_byte_value(10, 0); - data->return_loaned_value(inner); - - for (int i = 0; i < 5; i++) - { - writer->write(data.get()); - - uint32_t index; - data->get_uint32_value(index, 1); - - if (index == samples) - { - data->set_uint32_value(1, 1); - } - else - { - data->set_uint32_value(index + 1, 1); - } - - inner = data->loan_value(2); - octet inner_count; - inner->get_byte_value(inner_count, 0); - inner->set_byte_value(inner_count + 1, 0); - data->return_loaned_value(inner); - - std::this_thread::sleep_for(std::chrono::milliseconds(250)); - } - - if (wait > 0) - { - std::unique_lock lock(listener.mutex_); - listener.cv_.wait(lock, [&] - { - return listener.matched_ == 0; - }); - } + pub.run(samples, 10); - if (writer != nullptr) - { - publisher->delete_datawriter(writer); - } - if (publisher != nullptr) - { - participant->delete_publisher(publisher); - } - if (topic != nullptr) - { - participant->delete_topic(topic); - } - DomainParticipantFactory::get_instance()->delete_participant(participant); + // Stop the thread until publisher execution is finished + std::unique_lock lock(mutex); + cv.wait(lock, [&] + { + return pub.is_stopped(); + }); return 0; + } diff --git a/test/dds/communication/Publisher.hpp b/test/dds/communication/Publisher.hpp new file mode 100644 index 000000000..a3e2c28c6 --- /dev/null +++ b/test/dds/communication/Publisher.hpp @@ -0,0 +1,124 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file Publisher.hpp + * + */ + +#ifndef FASTDDS_STATISTICS_BACKEND_TEST_DDS_COMMUNICATION__PUBLISHER_HPP +#define FASTDDS_STATISTICS_BACKEND_TEST_DDS_COMMUNICATION__PUBLISHER_HPP + +#include +#include +#include + +#include +#include +#include + +#include "Communication.hpp" + +/** + * Class used to group into a single working unit a Publisher with a DataWriter, its listener, and a TypeSupport member + * corresponding to the datatype + */ +class Publisher +{ +public: + + Publisher(); + + virtual ~Publisher(); + + //! Initialize the publisher + bool init( + uint32_t domain); + + //! Publish a sample + void publish(); + + //! Run for number samples, publish every sleep seconds + void run( + uint32_t number, + uint32_t sleep); + + //! Return the current state of execution + static bool is_stopped(); + + //! Trigger the end of execution + static void stop(); + + class PubListener : public eprosima::fastdds::dds::DataWriterListener + { + public: + + PubListener() + : matched_(0) + { + } + + ~PubListener() override + { + } + + //! Callback executed when a DataReader is matched or unmatched + void on_publication_matched( + eprosima::fastdds::dds::DataWriter* writer, + const eprosima::fastdds::dds::PublicationMatchedStatus& info) override; + + //! Getter function for matched_ + std::uint32_t get_matched() + { + return matched_; + } + + private: + + //! Number of DataReaders matched to the associated DataWriter + std::atomic matched_; + + } + listener; + +private: + + Communication comm_; + + eprosima::fastdds::dds::DomainParticipant* participant_; + + eprosima::fastdds::dds::Publisher* publisher_; + + eprosima::fastdds::dds::Topic* topic_; + + eprosima::fastdds::dds::DataWriter* writer_; + + eprosima::fastdds::dds::TypeSupport type_; + + /** + * Class handling discovery events and dataflow + */ + + //! Run thread for number samples, publish every sleep seconds + void runThread( + uint32_t number, + uint32_t sleep); + + //! Members used for control flow purposes + static std::atomic stop_; +}; + + + +#endif /* FASTDDS_STATISTICS_BACKEND_TEST_DDS_COMMUNICATION__PUBLISHER_HPP */ diff --git a/test/dds/communication/Subscriber.cpp b/test/dds/communication/Subscriber.cpp index 2bca27299..c5a7b1c73 100644 --- a/test/dds/communication/Subscriber.cpp +++ b/test/dds/communication/Subscriber.cpp @@ -1,4 +1,4 @@ -// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -17,42 +17,27 @@ * */ +#include +#include + #include -#include #include -#include -#include #include -#include #include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include +#include +#include -using namespace eprosima::fastdds::dds; -using namespace eprosima::fastrtps; -using namespace eprosima::fastrtps::rtps; +#include "CommunicationPubSubTypes.hpp" +#include "Host.hpp" +#include "Subscriber.hpp" -static bool g_run = true; -static types::DynamicType_ptr g_type; -static Topic* g_topic = nullptr; -static DataReaderQos g_qos; -static Subscriber* g_subscriber = nullptr; -static DataReader* g_reader = nullptr; -static DomainParticipant* g_participant = nullptr; +using namespace eprosima; +std::atomic Subscriber::stop_(false); +std::mutex Subscriber::terminate_cv_mtx_; +std::condition_variable Subscriber::terminate_cv_; -class ParListener : public DomainParticipantListener +class ParListener : public fastdds::dds::DomainParticipantListener { public: @@ -70,212 +55,246 @@ class ParListener : public DomainParticipantListener * @param info DiscoveryInfo. */ void on_participant_discovery( - DomainParticipant* /*participant*/, - rtps::ParticipantDiscoveryInfo&& info) override + fastdds::dds::DomainParticipant* /*participant*/, + fastdds::rtps::ParticipantDiscoveryStatus reason, + const fastdds::dds::ParticipantBuiltinTopicData& info, + bool& /*should_be_ignored*/) override { - if (info.status == rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT) + if (reason == fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT) { std::cout << "Subscriber participant " << //participant->getGuid() << - " discovered participant " << info.info.m_guid << std::endl; + " discovered participant " << info.guid << std::endl; } - else if (info.status == rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT) + else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::CHANGED_QOS_PARTICIPANT) { std::cout << "Subscriber participant " << //participant->getGuid() << - " detected changes on participant " << info.info.m_guid << std::endl; + " detected changes on participant " << info.guid << std::endl; } - else if (info.status == rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT) + else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::REMOVED_PARTICIPANT) { std::cout << "Subscriber participant " << //participant->getGuid() << - " removed participant " << info.info.m_guid << std::endl; + " removed participant " << info.guid << std::endl; } - else if (info.status == rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT) + else if (reason == fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT) { std::cout << "Subscriber participant " << //participant->getGuid() << - " dropped participant " << info.info.m_guid << std::endl; + " dropped participant " << info.guid << std::endl; } } - void on_type_information_received( - eprosima::fastdds::dds::DomainParticipant* participant, - const eprosima::fastrtps::string_255 topic_name, - const eprosima::fastrtps::string_255 type_name, - const eprosima::fastrtps::types::TypeInformation& type_information) override +} +participant_listener; + +Subscriber::Subscriber() + : participant_(nullptr) + , subscriber_(nullptr) + , topic_(nullptr) + , reader_(nullptr) + , type_(new CommunicationPubSubType()) +{ +} + +bool Subscriber::is_stopped() +{ + return stop_; +} + +void Subscriber::stop() +{ + stop_ = true; + terminate_cv_.notify_all(); +} + +bool Subscriber::init( + uint32_t max_messages, + uint32_t domain) +{ + // Do not enable entities on creation + eprosima::fastdds::dds::DomainParticipantFactoryQos factory_qos; + factory_qos.entity_factory().autoenable_created_entities = false; + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->set_qos(factory_qos); + eprosima::fastdds::dds::DomainParticipantQos pqos; + pqos.name("Participant_sub"); + + // Activate Fast DDS Statistics module + pqos.properties().properties().emplace_back("fastdds.statistics", + "HISTORY_LATENCY_TOPIC;" \ + "NETWORK_LATENCY_TOPIC;" \ + "PUBLICATION_THROUGHPUT_TOPIC;" \ + "SUBSCRIPTION_THROUGHPUT_TOPIC;" \ + "RTPS_SENT_TOPIC;" \ + "RTPS_LOST_TOPIC;" \ + "HEARTBEAT_COUNT_TOPIC;" \ + "ACKNACK_COUNT_TOPIC;" \ + "NACKFRAG_COUNT_TOPIC;" \ + "GAP_COUNT_TOPIC;" \ + "DATA_COUNT_TOPIC;" \ + "RESENT_DATAS_TOPIC;" \ + "SAMPLE_DATAS_TOPIC;" \ + "PDP_PACKETS_TOPIC;" \ + "EDP_PACKETS_TOPIC;" \ + "DISCOVERY_TOPIC;" \ + "PHYSICAL_DATA_TOPIC;" \ + "MONITOR_SERVICE_TOPIC"); + + // CREATE THE PARTICIPANT + participant_ = + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->create_participant( + domain, pqos, &participant_listener, eprosima::fastdds::dds::StatusMask::none()); + + if (participant_ == nullptr) { - std::function callback = - [topic_name, type_name](const std::string& name, const types::DynamicType_ptr type) - { - if (nullptr != g_subscriber) - { - if (g_participant->lookup_topicdescription(topic_name.to_string()) != nullptr) - { - std::cout << "ERROR: Cannot create Topic with name " << topic_name - << " - Topic already exists" << std::endl; - return; - } - std::cout << "Discovered type: " << name << " from topic " << topic_name << std::endl; - g_topic = g_participant->create_topic( - topic_name.to_string(), - type_name.to_string(), - TOPIC_QOS_DEFAULT); - if (g_topic == nullptr) - { - std::cout << "ERROR: Could not create topic " << topic_name << std::endl; - return; - } - - g_reader = g_subscriber->create_datareader( - g_topic, - g_qos, - nullptr); - if (g_reader == nullptr) - { - std::cout << "ERROR: Could not create reader for topic " << topic_name << std::endl; - return; - } - - if (type == nullptr) - { - const types::TypeIdentifier* ident = - types::TypeObjectFactory::get_instance()->get_type_identifier_trying_complete(name); - - if (nullptr != ident) - { - const types::TypeObject* obj = - types::TypeObjectFactory::get_instance()->get_type_object(ident); - - types::DynamicType_ptr dyn_type = - types::TypeObjectFactory::get_instance()->build_dynamic_type(name, ident, obj); - - if (nullptr != dyn_type) - { - g_type = dyn_type; - } - else - { - std::cout << "ERROR: DynamicType cannot be created for type: " << name << std::endl; - } - } - else - { - std::cout << "ERROR: TypeIdentifier cannot be retrieved for type: " - << name << std::endl; - } - } - else - { - g_type = type; - } - } - }; - - participant->register_remote_type( - type_information, - type_name.to_string(), - callback); + std::cout << "Error creating subscriber participant" << std::endl; + return 1; } -#if HAVE_SECURITY - void onParticipantAuthentication( - DomainParticipant* /*participant*/, - rtps::ParticipantAuthenticationInfo&& info) override + std::cout << "Participant " << pqos.name() << " created with GUID " << participant_->guid() << std::endl; + + // REGISTER THE TYPE + type_.register_type(participant_); + + // CREATE THE SUBSCRIBER + fastdds::dds::StatusMask mask = fastdds::dds::StatusMask::subscription_matched() + << fastdds::dds::StatusMask::data_available() + << fastdds::dds::StatusMask::liveliness_changed(); + + subscriber_ = participant_->create_subscriber(eprosima::fastdds::dds::SUBSCRIBER_QOS_DEFAULT, nullptr, mask); + + if (subscriber_ == nullptr) { - if (rtps::ParticipantAuthenticationInfo::AUTHORIZED_PARTICIPANT == info.status) - { - std::cout << "Subscriber participant " << //participant->guid() << - " authorized participant " << info.guid << std::endl; - } - else - { - std::cout << "Subscriber participant " << //participant->guid() << - " unauthorized participant " << info.guid << std::endl; - } + std::cout << "Error creating subscriber" << std::endl; + return 1; } -#endif // if HAVE_SECURITY -}; + // CREATE THE TOPIC -class SubListener : public SubscriberListener -{ -public: + // Generate topic name + std::ostringstream topic; + topic << "HelloWorldTopic_" << (eprosima::Host::instance().id()) << "_" << domain; - SubListener() - : number_samples_(0) + topic_ = participant_->create_topic( + topic.str(), + type_.get_type_name(), + eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + + if (topic_ == nullptr) { + std::cout << "Error creating subscriber topic" << std::endl; + return 1; } - ~SubListener() override + // CREATE THE READER + if (max_messages > 0) { + listener.set_max_messages(max_messages); } + eprosima::fastdds::dds::DataReaderQos rqos = eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT; + reader_ = subscriber_->create_datareader(topic_, rqos, &listener); - void on_subscription_matched( - DataReader* /*reader*/, - const SubscriptionMatchedStatus& info) override + if (reader_ == nullptr) { - if (info.current_count_change == 1) - { - std::cout << "Subscriber matched with publisher " << info.last_publication_handle << std::endl; - } - else if (info.current_count_change == -1) + std::cout << "Error creating subscriber DataReader" << std::endl; + return 1; + } + + std::cout << "DataReader created with GUID " << reader_->guid() << std::endl; + + // Now that everything is created we can enable the protocols + participant_->enable(); + + return true; +} + +Subscriber::~Subscriber() +{ + if (participant_ != nullptr) + { + if (topic_ != nullptr) { - std::cout << "Subscriber unmatched with publisher " << info.last_publication_handle << std::endl; + participant_->delete_topic(topic_); } - else + if (subscriber_ != nullptr) { - std::cout << info.current_count_change - << " is not a valid value for SubscriptionMatchedStatus current count change" << std::endl; + if (reader_ != nullptr) + { + subscriber_->delete_datareader(reader_); + } + participant_->delete_subscriber(subscriber_); } + eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->delete_participant(participant_); + } +} + +void Subscriber::SubListener::set_max_messages( + uint32_t max_messages) +{ + max_messages_ = max_messages; +} + +void Subscriber::SubListener::on_subscription_matched( + eprosima::fastdds::dds::DataReader*, + const eprosima::fastdds::dds::SubscriptionMatchedStatus& info) +{ + if (info.current_count_change == 1) + { + matched_ = info.current_count; + std::cout << "Subscriber matched." << std::endl; + } + else if (info.current_count_change == -1) + { + matched_ = info.current_count; + std::cout << "Subscriber unmatched." << std::endl; } + else + { + std::cout << info.current_count_change + << " is not a valid value for SubscriptionMatchedStatus current count change" << std::endl; + } +} - void on_data_available( - DataReader* reader) override +void Subscriber::SubListener::on_data_available( + eprosima::fastdds::dds::DataReader* reader) +{ + eprosima::fastdds::dds::SampleInfo info; + while ((reader->take_next_sample(&comm_, &info) == eprosima::fastdds::dds::RETCODE_OK) && !is_stopped()) { - if (nullptr != g_type) + if (info.instance_state == eprosima::fastdds::dds::ALIVE_INSTANCE_STATE) { - types::DynamicPubSubType pst(g_type); - types::DynamicData_ptr sample(static_cast(pst.createData())); - eprosima::fastdds::dds::SampleInfo info; - - if (nullptr != reader && !!reader->take_next_sample(sample.get(), &info)) + samples_++; + // Print your structure data here. + std::cout << "Message " << comm_.message() << " " << comm_.index() << " RECEIVED" << std::endl; + if (max_messages_ > 0 && (samples_ >= max_messages_)) { - if (info.valid_data) - { - std::unique_lock lock(mutex_); - ++number_samples_; - std::string message; - uint32_t index; - octet count; - sample->get_string_value(message, 0); - sample->get_uint32_value(index, 1); - types::DynamicData* inner = sample->loan_value(2); - inner->get_byte_value(count, 0); - sample->return_loaned_value(inner); - std::cout << "Received sample: index(" << index << "), message(" - << message << "), inner_count(" << std::hex << (uint32_t)count << ")" << std::endl; - cv_.notify_all(); - } + stop(); } } } +} - void on_liveliness_changed( - DataReader* /*reader*/, - const eprosima::fastdds::dds::LivelinessChangedStatus& status) override +void Subscriber::run( + uint32_t samples) +{ + stop_ = false; + if (samples > 0) { - if (status.alive_count_change == 1) - { - std::cout << "Publisher recovered liveliness" << std::endl; - } - else if (status.not_alive_count_change == 1) - { - std::cout << "Publisher lost liveliness" << std::endl; - g_run = false; - } + std::cout << "Subscriber running until " << samples << + " samples have been received. Please press CTRL+C to stop the Subscriber at any time." << std::endl; } - - std::mutex mutex_; - std::condition_variable cv_; - unsigned int number_samples_; -}; + else + { + std::cout << "Subscriber running. Please press CTRL+C to stop the Subscriber." << std::endl; + } + signal(SIGINT, [](int signum) + { + std::cout << "SIGINT received, stopping Subscriber execution." << std::endl; + static_cast(signum); Subscriber::stop(); + }); + std::unique_lock lck(terminate_cv_mtx_); + terminate_cv_.wait(lck, [] + { + return is_stopped(); + }); +} int main( int argc, @@ -284,9 +303,10 @@ int main( int arg_count = 1; bool notexit = false; uint32_t seed = 7800; - uint32_t samples = 4; + uint32_t samples = 10; //char* xml_file = nullptr; std::string magic; + Subscriber sub; while (arg_count < argc) { @@ -339,81 +359,15 @@ int main( ++arg_count; } - /* TODO - XMLProfileManager doesn't support DDS yet - if(xml_file) - { - DomainParticipantFactory::get_instance()->load_XML_profiles_file(xml_file); - } - */ - - //Do not enable entities on creation - DomainParticipantFactoryQos factory_qos; - factory_qos.entity_factory().autoenable_created_entities = false; - DomainParticipantFactory::get_instance()->set_qos(factory_qos); - - DomainParticipantQos participant_qos; - participant_qos.wire_protocol().builtin.typelookup_config.use_client = true; - ParListener participant_listener; - StatusMask participant_mask = StatusMask::none(); - g_participant = - DomainParticipantFactory::get_instance()->create_participant(seed % 230, participant_qos, - &participant_listener, participant_mask); - - if (g_participant == nullptr) - { - std::cout << "Error creating subscriber participant" << std::endl; - return 1; - } - - // Generate topic name - std::ostringstream topic; - topic << "HelloWorldTopic_" << (eprosima::Host::instance().id()) << "_" << seed; - - SubListener listener; - StatusMask mask = StatusMask::subscription_matched() - << StatusMask::data_available() - << StatusMask::liveliness_changed(); - - //CREATE THE SUBSCRIBER - g_subscriber = g_participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT, &listener, mask); + // Initialize subscriber + sub.init(samples, seed % 230); + sub.run(samples); - if (g_subscriber == nullptr) - { - std::cout << "Error creating subscriber" << std::endl; - DomainParticipantFactory::get_instance()->delete_participant(g_participant); - return 1; - } - - //Now that everything is created we can enable the protocols - g_participant->enable(); - - while (notexit && g_run) - { - std::this_thread::sleep_for(std::chrono::milliseconds(250)); - } - - if (g_run) - { - std::unique_lock lock(listener.mutex_); - listener.cv_.wait(lock, [&] - { - return listener.number_samples_ >= samples; - }); - } - - if (g_reader != nullptr) - { - g_subscriber->delete_datareader(g_reader); - } - if (g_subscriber != nullptr) - { - g_participant->delete_subscriber(g_subscriber); - } - if (g_topic != nullptr) + // Wait until all datawriters are unmatched + while (sub.listener.get_matched() > 0) { - g_participant->delete_topic(g_topic); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); } - DomainParticipantFactory::get_instance()->delete_participant(g_participant); return 0; } diff --git a/test/dds/communication/Subscriber.hpp b/test/dds/communication/Subscriber.hpp new file mode 100644 index 000000000..feab07ec7 --- /dev/null +++ b/test/dds/communication/Subscriber.hpp @@ -0,0 +1,137 @@ +// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @file Subscriber.hpp + * + */ + +#ifndef FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__HELLO_WORLD_SUBSCRIBER_H +#define FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__HELLO_WORLD_SUBSCRIBER_H + +#include +#include +#include + +#include +#include +#include + +#include "Communication.hpp" + +/** + * Class used to group into a single working unit a Subscriber with a DataReader, its listener, and a TypeSupport member + * corresponding to the HelloWorld datatype + */ +class Subscriber +{ +public: + + Subscriber(); + + virtual ~Subscriber(); + + //! Initialize the subscriber + bool init( + uint32_t max_messages, + uint32_t domain); + + //! RUN the subscriber until number samples are received + void run( + uint32_t number); + + //! Return the current state of execution + static bool is_stopped(); + + //! Trigger the end of execution + static void stop(); + class SubListener : public eprosima::fastdds::dds::DataReaderListener + { + public: + + SubListener() + : matched_(0) + , samples_(0) + , max_messages_(0) + { + } + + ~SubListener() override + { + } + + //! Set the maximum number of messages to receive before exiting + void set_max_messages( + uint32_t max_messages); + + //! Callback executed when a new sample is received + void on_data_available( + eprosima::fastdds::dds::DataReader* reader) override; + + //! Callback executed when a DataWriter is matched or unmatched + void on_subscription_matched( + eprosima::fastdds::dds::DataReader* reader, + const eprosima::fastdds::dds::SubscriptionMatchedStatus& info) override; + + uint32_t get_matched() + { + return matched_; + } + + private: + + Communication comm_; + + //! Number of DataWriters matched to the associated DataReader + int matched_; + + //! Number of samples received + uint32_t samples_; + + //! Number of messages to be received before triggering termination of execution + uint32_t max_messages_; + + //! Avoids race conditions in callback execution + std::mutex mutex_; + std::condition_variable cv_; + } + listener; + +private: + + eprosima::fastdds::dds::DomainParticipant* participant_; + + eprosima::fastdds::dds::Subscriber* subscriber_; + + eprosima::fastdds::dds::Topic* topic_; + + eprosima::fastdds::dds::DataReader* reader_; + + eprosima::fastdds::dds::TypeSupport type_; + + /** + * Class handling discovery and dataflow events + */ + + //! Member used for control flow purposes + static std::atomic stop_; + + //! Protects terminate condition variable + static std::mutex terminate_cv_mtx_; + + //! Waits during execution until SIGINT or max_messages_ samples are received + static std::condition_variable terminate_cv_; +}; + +#endif /* FASTDDS_STATISTICS_BACKEND_EXAMPLES_CPP_HELLOWORLD_EXAMPLE__HELLO_WORLD_SUBSCRIBER_H */ \ No newline at end of file diff --git a/test/dds/communication/example_type.xml b/test/dds/communication/example_type.xml deleted file mode 100644 index ccbdb8956..000000000 --- a/test/dds/communication/example_type.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/test/dds/communication/simple_communication.py b/test/dds/communication/simple_communication.py index 8f10a1647..39a994cac 100644 --- a/test/dds/communication/simple_communication.py +++ b/test/dds/communication/simple_communication.py @@ -1,4 +1,4 @@ -# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +# Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -100,14 +100,15 @@ def communication(monitor_proc, pid): + (["--xmlfile", real_xml_file_pub] if real_xml_file_pub else []) + extra_pub_args) - print("___" + pid + "___subscriber1 communicate...___") + print("___" + pid + "___publisher1 communicate...___") sys.stdout.flush() publisher_proc1.communicate() - print("___" + pid + "___publisher1 communicate...___") + print("___" + pid + "___subscriber1 communicate...___") sys.stdout.flush() subscriber1_proc.communicate() + elif (line == ("Stop Monitor_" + pid)): print("___" + pid + "___Stop Monitor___") sys.stdout.flush() @@ -122,6 +123,7 @@ def communication(monitor_proc, pid): sys.stdout.flush() time.sleep(0.1) + finally: monitor_proc.terminate() try: diff --git a/test/mock/database/database/database/database.hpp b/test/mock/database/database/database/database.hpp index c90767adb..95ead6b37 100644 --- a/test/mock/database/database/database/database.hpp +++ b/test/mock/database/database/database/database.hpp @@ -19,8 +19,8 @@ #include #include -#include "fastdds/rtps/common/Guid.h" -#include "fastdds/rtps/common/Locator.h" +#include "fastdds/rtps/common/Guid.hpp" +#include "fastdds/rtps/common/Locator.hpp" #include #include "database/entities.hpp" @@ -91,7 +91,7 @@ class Database const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const fastrtps::rtps::RemoteLocatorList& locators, + const fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, diff --git a/test/mock/dds/DataReader/fastdds/dds/subscriber/DataReader.hpp b/test/mock/dds/DataReader/fastdds/dds/subscriber/DataReader.hpp index 25474e3fd..a841bacc6 100644 --- a/test/mock/dds/DataReader/fastdds/dds/subscriber/DataReader.hpp +++ b/test/mock/dds/DataReader/fastdds/dds/subscriber/DataReader.hpp @@ -23,13 +23,11 @@ #include #include -#include -#include +#include +#include -#include -#include +#include -using eprosima::fastrtps::types::ReturnCode_t; namespace eprosima { namespace fastdds { @@ -40,7 +38,6 @@ class DataReader { protected: - using StatisticsEventKind = eprosima::fastdds::statistics::EventKindBits; using StatisticsData = eprosima::fastdds::statistics::Data; using MonitorData = eprosima::fastdds::statistics::MonitorServiceStatusData; using StatisticsSample = std::pair, std::shared_ptr>; @@ -85,39 +82,39 @@ class DataReader { switch (history_.front().first.get()->_d()) { - case StatisticsEventKind::HISTORY2HISTORY_LATENCY: + case statistics::EventKind::HISTORY2HISTORY_LATENCY: *static_cast(data) = history_.front().first->writer_reader_data(); break; - case StatisticsEventKind::NETWORK_LATENCY: + case statistics::EventKind::NETWORK_LATENCY: *static_cast(data) = history_.front().first->locator2locator_data(); break; - case StatisticsEventKind::PUBLICATION_THROUGHPUT: - case StatisticsEventKind::SUBSCRIPTION_THROUGHPUT: + case statistics::EventKind::PUBLICATION_THROUGHPUT: + case statistics::EventKind::SUBSCRIPTION_THROUGHPUT: *static_cast(data) = history_.front().first->entity_data(); break; - case StatisticsEventKind::RTPS_SENT: - case StatisticsEventKind::RTPS_LOST: + case statistics::EventKind::RTPS_SENT: + case statistics::EventKind::RTPS_LOST: *static_cast(data) = history_.front().first->entity2locator_traffic(); break; - case StatisticsEventKind::RESENT_DATAS: - case StatisticsEventKind::HEARTBEAT_COUNT: - case StatisticsEventKind::ACKNACK_COUNT: - case StatisticsEventKind::NACKFRAG_COUNT: - case StatisticsEventKind::GAP_COUNT: - case StatisticsEventKind::DATA_COUNT: - case StatisticsEventKind::PDP_PACKETS: - case StatisticsEventKind::EDP_PACKETS: + case statistics::EventKind::RESENT_DATAS: + case statistics::EventKind::HEARTBEAT_COUNT: + case statistics::EventKind::ACKNACK_COUNT: + case statistics::EventKind::NACKFRAG_COUNT: + case statistics::EventKind::GAP_COUNT: + case statistics::EventKind::DATA_COUNT: + case statistics::EventKind::PDP_PACKETS: + case statistics::EventKind::EDP_PACKETS: *static_cast(data) = history_.front().first->entity_count(); break; - case StatisticsEventKind::DISCOVERED_ENTITY: + case statistics::EventKind::DISCOVERED_ENTITY: *static_cast(data) = history_.front().first->discovery_time(); break; - case StatisticsEventKind::SAMPLE_DATAS: + case statistics::EventKind::SAMPLE_DATAS: *static_cast(data) = history_.front().first->sample_identity_count(); break; - case StatisticsEventKind::PHYSICAL_DATA: + case statistics::EventKind::PHYSICAL_DATA: *static_cast(data) = history_.front().first->physical_data(); break; } @@ -133,13 +130,13 @@ class DataReader } else { - return ReturnCode_t::RETCODE_NO_DATA; + return RETCODE_NO_DATA; } - return ReturnCode_t::RETCODE_OK; + return RETCODE_OK; } - const fastrtps::rtps::GUID_t& guid() + const fastdds::rtps::GUID_t& guid() { return guid_; } @@ -166,7 +163,7 @@ class DataReader } void set_guid( - fastrtps::rtps::GUID_t guid) + fastdds::rtps::GUID_t guid) { guid_ = guid; } @@ -184,7 +181,7 @@ class DataReader protected: - fastrtps::rtps::GUID_t guid_; + fastdds::rtps::GUID_t guid_; std::queue history_; std::queue monitor_history_; TopicDescription topic_description_; diff --git a/test/mock/dds/DataWriter/fastdds/dds/publisher/DataWriter.hpp b/test/mock/dds/DataWriter/fastdds/dds/publisher/DataWriter.hpp index 751a908ef..e92a3e0f0 100644 --- a/test/mock/dds/DataWriter/fastdds/dds/publisher/DataWriter.hpp +++ b/test/mock/dds/DataWriter/fastdds/dds/publisher/DataWriter.hpp @@ -20,10 +20,9 @@ #ifndef _FASTDDS_DDS_PUBLISHER_DATAWRITER_HPP_ #define _FASTDDS_DDS_PUBLISHER_DATAWRITER_HPP_ -#include +#include +#include -#include -#include namespace eprosima { diff --git a/test/mock/dds/DomainParticipant/fastdds/dds/domain/DomainParticipant.hpp b/test/mock/dds/DomainParticipant/fastdds/dds/domain/DomainParticipant.hpp index 9b6d9e53e..f9f276985 100644 --- a/test/mock/dds/DomainParticipant/fastdds/dds/domain/DomainParticipant.hpp +++ b/test/mock/dds/DomainParticipant/fastdds/dds/domain/DomainParticipant.hpp @@ -30,10 +30,7 @@ #include #include #include -#include -#include - -using eprosima::fastrtps::types::ReturnCode_t; +#include namespace eprosima { namespace fastdds { @@ -64,7 +61,7 @@ class DomainParticipant DomainParticipantQos& qos) const { qos = qos_; - return ReturnCode_t::RETCODE_OK; + return RETCODE_OK; } /** @@ -86,7 +83,7 @@ class DomainParticipant return domain_id_; } - const fastrtps::rtps::GUID_t& guid() + const fastdds::rtps::GUID_t& guid() { return guid_; } @@ -194,7 +191,7 @@ class DomainParticipant DomainParticipantQos qos_; DomainId_t domain_id_; - eprosima::fastrtps::rtps::GUID_t guid_; + eprosima::fastdds::rtps::GUID_t guid_; }; } // namespace dds diff --git a/test/mock/dds/DomainParticipantFactory/fastdds/dds/domain/DomainParticipantFactory.hpp b/test/mock/dds/DomainParticipantFactory/fastdds/dds/domain/DomainParticipantFactory.hpp index dc2c2dadc..e5cd15bff 100644 --- a/test/mock/dds/DomainParticipantFactory/fastdds/dds/domain/DomainParticipantFactory.hpp +++ b/test/mock/dds/DomainParticipantFactory/fastdds/dds/domain/DomainParticipantFactory.hpp @@ -28,8 +28,7 @@ #include #include #include -#include - +#include "TypeObjectRegistry.hpp" namespace eprosima { namespace fastdds { namespace dds { @@ -51,6 +50,7 @@ class DomainParticipant; * Use \c domain_participant variable to force the returnment of \c create_participant() . * \c domain_participant variable is never set neither deleted from this class. */ + class DomainParticipantFactory { @@ -72,10 +72,10 @@ class DomainParticipantFactory // Do nothing } - fastrtps::types::ReturnCode_t load_profiles() + ReturnCode_t load_profiles() { load_profiles_count++; - return fastrtps::types::ReturnCode_t::RETCODE_OK; + return RETCODE_OK; } DomainParticipant* create_participant( @@ -105,7 +105,7 @@ class DomainParticipantFactory { get_qos_count++; qos = factory_qos; - return fastrtps::types::ReturnCode_t::RETCODE_OK; + return RETCODE_OK; } ReturnCode_t set_qos( @@ -113,9 +113,16 @@ class DomainParticipantFactory { set_qos_count++; factory_qos = qos; - return fastrtps::types::ReturnCode_t::RETCODE_OK; + return RETCODE_OK; + } + + xtypes::ITypeObjectRegistry& type_object_registry() + { + return type_registry; } + xtypes::TypeObjectRegistry type_registry; + DomainParticipantFactoryQos factory_qos{}; DomainParticipantQos participant_qos{}; DomainParticipant* domain_participant = nullptr; diff --git a/test/mock/dds/DomainParticipantFactory/fastdds/dds/domain/TypeObjectRegistry.hpp b/test/mock/dds/DomainParticipantFactory/fastdds/dds/domain/TypeObjectRegistry.hpp new file mode 100644 index 000000000..8db392c46 --- /dev/null +++ b/test/mock/dds/DomainParticipantFactory/fastdds/dds/domain/TypeObjectRegistry.hpp @@ -0,0 +1,117 @@ +// Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*! + * @file + * This file contains the required classes to keep a TypeObject/TypeIdentifier registry. + */ + +#ifndef FASTDDS_DDS_XTYPES_TYPE_REPRESENTATION__TYPEOBJECTREGISTRY_HPP +#define FASTDDS_DDS_XTYPES_TYPE_REPRESENTATION__TYPEOBJECTREGISTRY_HPP + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +namespace eprosima { +namespace fastdds { +namespace dds { + +namespace xtypes { + +using ReturnCode_t = eprosima::fastdds::dds::ReturnCode_t; + +// Class which holds the TypeObject registry, including every TypeIdentifier (plain and non-plain types), every +// non-plain TypeObject and the non-plain TypeObject serialized sizes. +class TypeObjectRegistry : public ITypeObjectRegistry +{ + +public: + + ReturnCode_t register_type_object( + const std::string&, + const CompleteTypeObject&, + TypeIdentifierPair&) override + { + return eprosima::fastdds::dds::RETCODE_OK; + } + + ReturnCode_t register_type_object( + const TypeObject&, + TypeIdentifierPair&) override + { + return eprosima::fastdds::dds::RETCODE_OK; + } + + ReturnCode_t register_type_identifier( + const std::string&, + TypeIdentifierPair&) override + { + return eprosima::fastdds::dds::RETCODE_OK; + } + + ReturnCode_t get_type_objects( + const std::string&, + TypeObjectPair&) override + { + return eprosima::fastdds::dds::RETCODE_OK; + } + + ReturnCode_t get_type_identifiers( + const std::string&, + TypeIdentifierPair&) override + { + return eprosima::fastdds::dds::RETCODE_OK; + } + + ReturnCode_t get_type_object( + const TypeIdentifier&, + TypeObject&) override + { + return eprosima::fastdds::dds::RETCODE_OK; + } + + ReturnCode_t get_type_information( + const TypeIdentifierPair&, + TypeInformation&, + bool) override + { + return eprosima::fastdds::dds::RETCODE_OK; + } + + ReturnCode_t register_typeobject_w_dynamic_type( + const DynamicType::_ref_type&, + TypeIdentifierPair&) override + { + return eprosima::fastdds::dds::RETCODE_OK; + } + +}; + +} // namespace xtypes +} // namespace dds +} // namespace fastdds +} // namespace eprosima + +#endif // FASTDDS_DDS_XTYPES_TYPE_REPRESENTATION__TYPEOBJECTREGISTRY_HPP diff --git a/test/mock/dds/Publisher/fastdds/dds/publisher/Publisher.hpp b/test/mock/dds/Publisher/fastdds/dds/publisher/Publisher.hpp index f4051f114..be85e0551 100644 --- a/test/mock/dds/Publisher/fastdds/dds/publisher/Publisher.hpp +++ b/test/mock/dds/Publisher/fastdds/dds/publisher/Publisher.hpp @@ -26,7 +26,6 @@ #include #include -#include namespace eprosima { namespace fastdds { diff --git a/test/mock/dds/Subscriber/fastdds/dds/subscriber/Subscriber.hpp b/test/mock/dds/Subscriber/fastdds/dds/subscriber/Subscriber.hpp index 13279db79..cc3153ca2 100644 --- a/test/mock/dds/Subscriber/fastdds/dds/subscriber/Subscriber.hpp +++ b/test/mock/dds/Subscriber/fastdds/dds/subscriber/Subscriber.hpp @@ -26,8 +26,6 @@ #include #include -#include - namespace eprosima { namespace fastdds { namespace dds { diff --git a/test/mock/dds/Topic/fastdds/dds/topic/Topic.hpp b/test/mock/dds/Topic/fastdds/dds/topic/Topic.hpp index b57760ae5..7fbad4787 100644 --- a/test/mock/dds/Topic/fastdds/dds/topic/Topic.hpp +++ b/test/mock/dds/Topic/fastdds/dds/topic/Topic.hpp @@ -23,11 +23,9 @@ #include #include -#include - -#include -#include +#include +#include namespace eprosima { namespace fastdds { diff --git a/test/unittest/Container/CMakeLists.txt b/test/unittest/Container/CMakeLists.txt index ec6b239f2..931cca8f6 100644 --- a/test/unittest/Container/CMakeLists.txt +++ b/test/unittest/Container/CMakeLists.txt @@ -40,7 +40,7 @@ if(GTEST_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(parametrized_DataContainer_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(parametrized_DataContainer_tests TEST_FRIENDLY_PATH) @@ -85,7 +85,7 @@ if(GTEST_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(parametrized_MapDataContainer_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(parametrized_MapDataContainer_tests TEST_FRIENDLY_PATH) diff --git a/test/unittest/Database/CMakeLists.txt b/test/unittest/Database/CMakeLists.txt index 1d6b8b944..f2e95a82c 100644 --- a/test/unittest/Database/CMakeLists.txt +++ b/test/unittest/Database/CMakeLists.txt @@ -25,12 +25,10 @@ set(LIBRARY_SOURCES ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -53,7 +51,7 @@ target_include_directories(sample_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(sample_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr + ${GTEST_LIBRARIES} fastdds fastcdr ) get_win32_path_dependencies(sample_tests TEST_FRIENDLY_PATH) @@ -125,7 +123,7 @@ target_include_directories(data_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(data_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr + ${GTEST_LIBRARIES} fastdds fastcdr ) get_win32_path_dependencies(data_tests TEST_FRIENDLY_PATH) @@ -168,7 +166,7 @@ target_include_directories(database_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(database_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr + ${GTEST_LIBRARIES} fastdds fastcdr ) get_win32_path_dependencies(database_tests TEST_FRIENDLY_PATH) @@ -422,7 +420,7 @@ target_include_directories(database_process_entities_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(database_process_entities_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr + ${GTEST_LIBRARIES} fastdds fastcdr ) get_win32_path_dependencies(database_process_entities_tests TEST_FRIENDLY_PATH) @@ -482,7 +480,7 @@ target_include_directories(database_dump_tests PRIVATE target_link_libraries(database_dump_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr + ${GTEST_LIBRARIES} fastdds fastcdr ) get_win32_path_dependencies(database_dump_tests TEST_FRIENDLY_PATH) @@ -529,10 +527,10 @@ set(LIBRARY_SOURCES_CLEAR_TEST ${PROJECT_SOURCE_DIR}/src/cpp/database/samples.cpp ${PROJECT_SOURCE_DIR}/src/cpp/exception/Exception.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -553,7 +551,7 @@ target_include_directories(database_clear_tests PRIVATE ) target_link_libraries(database_clear_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr ) get_win32_path_dependencies(database_clear_tests TEST_FRIENDLY_PATH) @@ -591,7 +589,7 @@ target_include_directories(database_get_entities_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(database_get_entities_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr + ${GTEST_LIBRARIES} fastdds fastcdr ) get_win32_path_dependencies(database_get_entities_tests TEST_FRIENDLY_PATH) @@ -632,7 +630,7 @@ target_include_directories(database_load_tests PRIVATE ${PROJECT_SOURCE_DIR}/test/unittest/TestUtils) target_link_libraries(database_load_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr + ${GTEST_LIBRARIES} fastdds fastcdr ) get_win32_path_dependencies(database_load_tests TEST_FRIENDLY_PATH) @@ -684,7 +682,7 @@ target_include_directories(database_load_insert_tests PRIVATE ${PROJECT_SOURCE_DIR}/test/unittest/TestUtils) target_link_libraries(database_load_insert_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr + ${GTEST_LIBRARIES} fastdds fastcdr ) get_win32_path_dependencies(database_load_insert_tests TEST_FRIENDLY_PATH) @@ -724,7 +722,7 @@ target_include_directories(database_status_tests PRIVATE ${PROJECT_SOURCE_DIR}/test/unittest/TestUtils) target_link_libraries(database_status_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(database_status_tests TEST_FRIENDLY_PATH) @@ -774,7 +772,7 @@ target_include_directories(database_erase_tests PRIVATE ${PROJECT_SOURCE_DIR}/test/unittest/TestUtils) target_link_libraries(database_erase_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr + ${GTEST_LIBRARIES} fastdds fastcdr ) get_win32_path_dependencies(database_erase_tests TEST_FRIENDLY_PATH) @@ -808,10 +806,10 @@ ${PROJECT_SOURCE_DIR}/src/cpp/database/entities.cpp ${PROJECT_SOURCE_DIR}/src/cpp/database/samples.cpp ${PROJECT_SOURCE_DIR}/src/cpp/exception/Exception.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp -${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx -${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx -${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx -${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx +${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx +${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx +${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx +${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -831,7 +829,7 @@ target_include_directories(database_domain_view_graph_tests PRIVATE ${PROJECT_SOURCE_DIR}/test/TestUtils) target_link_libraries(database_domain_view_graph_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(database_domain_view_graph_tests TEST_FRIENDLY_PATH) diff --git a/test/unittest/Database/DatabaseDomainViewGraphTests.cpp b/test/unittest/Database/DatabaseDomainViewGraphTests.cpp index 980dfbc0a..e77418857 100644 --- a/test/unittest/Database/DatabaseDomainViewGraphTests.cpp +++ b/test/unittest/Database/DatabaseDomainViewGraphTests.cpp @@ -21,14 +21,16 @@ #include #include -#include -#include + +#include +#include + #include using namespace eprosima::fastdds::statistics; using namespace eprosima::statistics_backend; using namespace eprosima::statistics_backend::database; -using namespace eprosima::fastrtps::rtps; +using namespace eprosima::fastdds::rtps; using ::testing::_; using ::testing::Invoke; diff --git a/test/unittest/Database/DatabaseProcessEntitiesTests.cpp b/test/unittest/Database/DatabaseProcessEntitiesTests.cpp index 201b739e1..845823573 100644 --- a/test/unittest/Database/DatabaseProcessEntitiesTests.cpp +++ b/test/unittest/Database/DatabaseProcessEntitiesTests.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include @@ -32,8 +32,7 @@ #include using namespace eprosima::statistics_backend; -using namespace eprosima::statistics_backend::database; -using namespace eprosima::fastrtps::rtps; +using namespace eprosima::fastdds::rtps; class database_process_entities_tests : public ::testing::Test { @@ -819,14 +818,13 @@ TEST_F(database_process_entities_tests, insert_new_endpoint_datawriter) /* Create a DataWriter*/ Locator_t unicast_locator; std::stringstream(unicast_locator_str) >> unicast_locator; - std::shared_ptr ulocator = std::make_shared(unicast_locator_str); + std::shared_ptr ulocator = std::make_shared(unicast_locator_str); EntityId ulocator_id = db.insert(ulocator); Locator_t multicast_locator; std::stringstream(multicast_locator_str) >> multicast_locator; - std::shared_ptr mlocator = std::make_shared(multicast_locator_str); + std::shared_ptr mlocator = std::make_shared(multicast_locator_str); EntityId mlocator_id = db.insert(mlocator); - RemoteLocatorList locators; locators.add_unicast_locator(unicast_locator); locators.add_multicast_locator(multicast_locator); @@ -868,7 +866,7 @@ TEST_F(database_process_entities_tests, insert_new_endpoint_datawriter) ASSERT_EQ(topics[domain_id][topic_id].get(), datawriters[domain_id][endpoint_id]->topic.get()); ASSERT_EQ(topics[domain_id][topic_id]->data_writers[endpoint_id].get(), datawriters[domain_id][endpoint_id].get()); - std::map> locators_db = db.locators(); + std::map> locators_db = db.locators(); ASSERT_EQ(locators_db[ulocator_id].get(), datawriters[domain_id][endpoint_id]->locators[ulocator_id].get()); ASSERT_EQ(locators_db[ulocator_id]->data_writers[endpoint_id].get(), datawriters[domain_id][endpoint_id].get()); ASSERT_EQ(locators_db[mlocator_id].get(), datawriters[domain_id][endpoint_id]->locators[mlocator_id].get()); @@ -903,12 +901,12 @@ TEST_F(database_process_entities_tests, insert_new_endpoint_datareader) /* Create a DataWriter*/ Locator_t unicast_locator; std::stringstream(unicast_locator_str) >> unicast_locator; - std::shared_ptr ulocator = std::make_shared(unicast_locator_str); + std::shared_ptr ulocator = std::make_shared(unicast_locator_str); EntityId ulocator_id = db.insert(ulocator); Locator_t multicast_locator; std::stringstream(multicast_locator_str) >> multicast_locator; - std::shared_ptr mlocator = std::make_shared(multicast_locator_str); + std::shared_ptr mlocator = std::make_shared(multicast_locator_str); EntityId mlocator_id = db.insert(mlocator); RemoteLocatorList locators; @@ -952,7 +950,7 @@ TEST_F(database_process_entities_tests, insert_new_endpoint_datareader) ASSERT_EQ(topics[domain_id][topic_id].get(), datareaders[domain_id][endpoint_id]->topic.get()); ASSERT_EQ(topics[domain_id][topic_id]->data_readers[endpoint_id].get(), datareaders[domain_id][endpoint_id].get()); - std::map> locators_db = db.locators(); + std::map> locators_db = db.locators(); ASSERT_EQ(locators_db[ulocator_id].get(), datareaders[domain_id][endpoint_id]->locators[ulocator_id].get()); ASSERT_EQ(locators_db[ulocator_id]->data_readers[endpoint_id].get(), datareaders[domain_id][endpoint_id].get()); ASSERT_EQ(locators_db[mlocator_id].get(), datareaders[domain_id][endpoint_id]->locators[mlocator_id].get()); @@ -987,12 +985,12 @@ TEST_F(database_process_entities_tests, insert_new_endpoint_already_exists) /* Insert a DataReader*/ Locator_t unicast_locator; std::stringstream(unicast_locator_str) >> unicast_locator; - std::shared_ptr ulocator = std::make_shared(unicast_locator_str); + std::shared_ptr ulocator = std::make_shared(unicast_locator_str); EntityId ulocator_id = db.insert(ulocator); Locator_t multicast_locator; std::stringstream(multicast_locator_str) >> multicast_locator; - std::shared_ptr mlocator = std::make_shared(multicast_locator_str); + std::shared_ptr mlocator = std::make_shared(multicast_locator_str); EntityId mlocator_id = db.insert(mlocator); RemoteLocatorList locators; @@ -1045,12 +1043,12 @@ TEST_F(database_process_entities_tests, insert_new_endpoint_no_topic) /* Insert a DataReader*/ Locator_t unicast_locator; std::stringstream(unicast_locator_str) >> unicast_locator; - std::shared_ptr ulocator = std::make_shared(unicast_locator_str); + std::shared_ptr ulocator = std::make_shared(unicast_locator_str); db.insert(ulocator); Locator_t multicast_locator; std::stringstream(multicast_locator_str) >> multicast_locator; - std::shared_ptr mlocator = std::make_shared(multicast_locator_str); + std::shared_ptr mlocator = std::make_shared(multicast_locator_str); db.insert(mlocator); RemoteLocatorList locators; @@ -1089,12 +1087,12 @@ TEST_F(database_process_entities_tests, insert_new_endpoint_no_participant) /* Insert a DataReader*/ Locator_t unicast_locator; std::stringstream(unicast_locator_str) >> unicast_locator; - std::shared_ptr ulocator = std::make_shared(unicast_locator_str); + std::shared_ptr ulocator = std::make_shared(unicast_locator_str); db.insert(ulocator); Locator_t multicast_locator; std::stringstream(multicast_locator_str) >> multicast_locator; - std::shared_ptr mlocator = std::make_shared(multicast_locator_str); + std::shared_ptr mlocator = std::make_shared(multicast_locator_str); db.insert(mlocator); RemoteLocatorList locators; @@ -1190,7 +1188,7 @@ TEST_F(database_process_entities_tests, insert_new_endpoint_no_locators) ASSERT_EQ(topics[domain_id][topic_id].get(), datareaders[domain_id][endpoint_id]->topic.get()); ASSERT_EQ(topics[domain_id][topic_id]->data_readers[endpoint_id].get(), datareaders[domain_id][endpoint_id].get()); - std::map> locators_db = db.locators(); + std::map> locators_db = db.locators(); ASSERT_EQ(2u, datareaders[domain_id][endpoint_id]->locators.size()); ASSERT_EQ(2u, locators_db.size()); } diff --git a/test/unittest/Database/DatabaseTests.cpp b/test/unittest/Database/DatabaseTests.cpp index fd2df4dbb..4114d27a7 100644 --- a/test/unittest/Database/DatabaseTests.cpp +++ b/test/unittest/Database/DatabaseTests.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -2467,13 +2468,16 @@ TEST_F(database_tests, insert_monitor_service_sample_connection_list) { ConnectionListSample sample; eprosima::fastdds::statistics::Connection connection_sample; - connection_sample.mode(eprosima::fastdds::statistics::DATA_SHARING); + connection_sample.mode(eprosima::fastdds::statistics::ConnectionMode::DATA_SHARING); eprosima::fastdds::statistics::detail::GUID_s guid_s; - eprosima::fastrtps::rtps::GUID_t guid_t; + eprosima::fastdds:: + rtps::GUID_t guid_t; std::stringstream guid_str("01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.1.c1"); guid_str >> guid_t; - memcpy(guid_s.guidPrefix().value().data(), guid_t.guidPrefix.value, eprosima::fastrtps::rtps::GuidPrefix_t::size); - memcpy(guid_s.entityId().value().data(), guid_t.entityId.value, eprosima::fastrtps::rtps::EntityId_t::size); + memcpy(guid_s.guidPrefix().value().data(), guid_t.guidPrefix.value, eprosima::fastdds:: + rtps::GuidPrefix_t::size); + memcpy(guid_s.entityId().value().data(), guid_t.entityId.value, eprosima::fastdds:: + rtps::EntityId_t::size); connection_sample.guid(guid_s); eprosima::fastdds::statistics::detail::Locator_s locator; locator.kind(1); @@ -2494,14 +2498,17 @@ TEST_F(database_tests, insert_monitor_service_sample_connection_list) ConnectionListSample sample_2; eprosima::fastdds::statistics::Connection connection_sample_2; - connection_sample_2.mode(eprosima::fastdds::statistics::INTRAPROCESS); + connection_sample_2.mode(eprosima::fastdds::statistics::ConnectionMode::INTRAPROCESS); eprosima::fastdds::statistics::detail::GUID_s guid_s_2; - eprosima::fastrtps::rtps::GUID_t guid_t_2; + eprosima::fastdds:: + rtps::GUID_t guid_t_2; std::stringstream guid_str_2("01.02.03.04.05.06.07.08.09.0a.0b.1c|0.0.1.c1"); guid_str_2 >> guid_t_2; memcpy(guid_s_2.guidPrefix().value().data(), guid_t_2.guidPrefix.value, - eprosima::fastrtps::rtps::GuidPrefix_t::size); - memcpy(guid_s_2.entityId().value().data(), guid_t_2.entityId.value, eprosima::fastrtps::rtps::EntityId_t::size); + eprosima::fastdds:: + rtps::GuidPrefix_t::size); + memcpy(guid_s_2.entityId().value().data(), guid_t_2.entityId.value, eprosima::fastdds:: + rtps::EntityId_t::size); connection_sample_2.guid(guid_s_2); eprosima::fastdds::statistics::detail::Locator_s locator_2; locator_2.kind(2); @@ -2529,13 +2536,16 @@ TEST_F(database_tests, insert_monitor_service_sample_connection_list_wrong_entit { ConnectionListSample sample; eprosima::fastdds::statistics::Connection connection_sample; - connection_sample.mode(eprosima::fastdds::statistics::DATA_SHARING); + connection_sample.mode(eprosima::fastdds::statistics::ConnectionMode::DATA_SHARING); eprosima::fastdds::statistics::detail::GUID_s guid_s; - eprosima::fastrtps::rtps::GUID_t guid_t; + eprosima::fastdds:: + rtps::GUID_t guid_t; std::stringstream guid_str("01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.1.c1"); guid_str >> guid_t; - memcpy(guid_s.guidPrefix().value().data(), guid_t.guidPrefix.value, eprosima::fastrtps::rtps::GuidPrefix_t::size); - memcpy(guid_s.entityId().value().data(), guid_t.entityId.value, eprosima::fastrtps::rtps::EntityId_t::size); + memcpy(guid_s.guidPrefix().value().data(), guid_t.guidPrefix.value, eprosima::fastdds:: + rtps::GuidPrefix_t::size); + memcpy(guid_s.entityId().value().data(), guid_t.entityId.value, eprosima::fastdds:: + rtps::EntityId_t::size); connection_sample.guid(guid_s); eprosima::fastdds::statistics::detail::Locator_s locator; locator.kind(1); @@ -3223,10 +3233,10 @@ TEST_F(database_tests, get_entity_kind_by_guid) eprosima::fastdds::statistics::detail::GUID_s reader_guid_s; eprosima::fastdds::statistics::detail::GUID_s writer_guid_s; eprosima::fastdds::statistics::detail::GUID_s other_guid_s; - eprosima::fastrtps::rtps::GUID_t participant_guid_t; - eprosima::fastrtps::rtps::GUID_t reader_guid_t; - eprosima::fastrtps::rtps::GUID_t writer_guid_t; - eprosima::fastrtps::rtps::GUID_t other_guid_t; + eprosima::fastdds::rtps::GUID_t participant_guid_t; + eprosima::fastdds::rtps::GUID_t reader_guid_t; + eprosima::fastdds::rtps::GUID_t writer_guid_t; + eprosima::fastdds::rtps::GUID_t other_guid_t; std::stringstream participant_guid_str("01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.1.c1"); std::stringstream reader_guid_str("01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.1.4"); std::stringstream writer_guid_str("01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.1.3"); @@ -3235,34 +3245,34 @@ TEST_F(database_tests, get_entity_kind_by_guid) participant_guid_str >> participant_guid_t; memcpy( participant_guid_s.guidPrefix().value().data(), participant_guid_t.guidPrefix.value, - eprosima::fastrtps::rtps::GuidPrefix_t::size); + eprosima::fastdds::rtps::GuidPrefix_t::size); memcpy( participant_guid_s.entityId().value().data(), participant_guid_t.entityId.value, - eprosima::fastrtps::rtps::EntityId_t::size); + eprosima::fastdds::rtps::EntityId_t::size); reader_guid_str >> reader_guid_t; memcpy( reader_guid_s.guidPrefix().value().data(), reader_guid_t.guidPrefix.value, - eprosima::fastrtps::rtps::GuidPrefix_t::size); + eprosima::fastdds::rtps::GuidPrefix_t::size); memcpy( reader_guid_s.entityId().value().data(), reader_guid_t.entityId.value, - eprosima::fastrtps::rtps::EntityId_t::size); + eprosima::fastdds::rtps::EntityId_t::size); writer_guid_str >> writer_guid_t; memcpy( writer_guid_s.guidPrefix().value().data(), writer_guid_t.guidPrefix.value, - eprosima::fastrtps::rtps::GuidPrefix_t::size); + eprosima::fastdds::rtps::GuidPrefix_t::size); memcpy( writer_guid_s.entityId().value().data(), writer_guid_t.entityId.value, - eprosima::fastrtps::rtps::EntityId_t::size); + eprosima::fastdds::rtps::EntityId_t::size); other_guid_str >> other_guid_t; memcpy( other_guid_s.guidPrefix().value().data(), other_guid_t.guidPrefix.value, - eprosima::fastrtps::rtps::GuidPrefix_t::size); + eprosima::fastdds::rtps::GuidPrefix_t::size); memcpy( other_guid_s.entityId().value().data(), other_guid_t.entityId.value, - eprosima::fastrtps::rtps::EntityId_t::size); + eprosima::fastdds::rtps::EntityId_t::size); EXPECT_EQ(EntityKind::PARTICIPANT, db.get_entity_kind_by_guid(participant_guid_s)); EXPECT_EQ(EntityKind::DATAREADER, db.get_entity_kind_by_guid(reader_guid_s)); diff --git a/test/unittest/DatabaseQueue/CMakeLists.txt b/test/unittest/DatabaseQueue/CMakeLists.txt index 1670b8e13..75f600fec 100644 --- a/test/unittest/DatabaseQueue/CMakeLists.txt +++ b/test/unittest/DatabaseQueue/CMakeLists.txt @@ -21,10 +21,10 @@ if(GTEST_FOUND AND GMOCK_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp/exception/Exception.cpp ${PROJECT_SOURCE_DIR}/src/cpp/exception/Exception.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp ${PROJECT_SOURCE_DIR}/src/cpp/database/data.cpp @@ -48,7 +48,7 @@ if(GTEST_FOUND AND GMOCK_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(database_queue_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(database_queue_tests TEST_FRIENDLY_PATH) diff --git a/test/unittest/DatabaseQueue/DatabaseQueueTests.cpp b/test/unittest/DatabaseQueue/DatabaseQueueTests.cpp index 3cf69ba5f..c0a3c1bea 100644 --- a/test/unittest/DatabaseQueue/DatabaseQueueTests.cpp +++ b/test/unittest/DatabaseQueue/DatabaseQueueTests.cpp @@ -19,17 +19,18 @@ #include #include -#include +#include #include #include -#include -#include + +#include +#include using namespace eprosima::fastdds::statistics; using namespace eprosima::statistics_backend; using namespace eprosima::statistics_backend::database; -using namespace eprosima::fastrtps::rtps; +using namespace eprosima::fastdds::rtps; using ::testing::_; using ::testing::Invoke; @@ -416,7 +417,8 @@ struct InsertEndpointArgs const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds:: + rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -431,7 +433,8 @@ struct InsertEndpointArgs const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds:: + rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -457,7 +460,7 @@ struct InsertEndpointArgs const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -468,7 +471,7 @@ struct InsertEndpointArgs std::string alias_; Qos qos_; bool is_virtual_metatraffic_; - eprosima::fastrtps::rtps::RemoteLocatorList locators_; + eprosima::fastdds::rtps::RemoteLocatorList locators_; EntityKind kind_; EntityId participant_id_; EntityId topic_id_; @@ -1438,7 +1441,8 @@ TEST_F(database_queue_tests, push_datawriter) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds:: + rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -1474,8 +1478,7 @@ TEST_F(database_queue_tests, push_datawriter) // Expectations: Request the backend to notify user (if needed) EXPECT_CALL(*details::StatisticsBackendData::get_instance(), on_domain_entity_discovery(EntityId(0), EntityId(3), EntityKind::DATAWRITER, - details::StatisticsBackendData::DISCOVERY)) - .Times(1); + details::StatisticsBackendData::DISCOVERY)).Times(1); // Add to the queue and wait to be processed info.discovery_status = details::StatisticsBackendData::DiscoveryStatus::DISCOVERY; @@ -1545,7 +1548,7 @@ TEST_F(database_queue_tests, push_datawriter) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -1558,7 +1561,6 @@ TEST_F(database_queue_tests, push_datawriter) EXPECT_EQ(is_virtual_metatraffic, false); EXPECT_EQ(locators.unicast[0], info.locators.unicast[0]); EXPECT_EQ(locators.multicast[0], info.locators.multicast[0]); - EXPECT_EQ(kind, EntityKind::DATAWRITER); EXPECT_EQ(participant_id, EntityId(1)); EXPECT_EQ(topic_id, EntityId(2)); @@ -1654,7 +1656,7 @@ TEST_F(database_queue_tests, push_datawriter_topic_does_not_exist) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -1667,7 +1669,6 @@ TEST_F(database_queue_tests, push_datawriter_topic_does_not_exist) EXPECT_EQ(is_virtual_metatraffic, false); EXPECT_EQ(locators.unicast[0], info.locators.unicast[0]); EXPECT_EQ(locators.multicast[0], info.locators.multicast[0]); - EXPECT_EQ(kind, EntityKind::DATAWRITER); EXPECT_EQ(participant_id, EntityId(1)); EXPECT_EQ(topic_id, EntityId(2)); @@ -1796,7 +1797,7 @@ TEST_F(database_queue_tests, push_datareader) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -1809,7 +1810,6 @@ TEST_F(database_queue_tests, push_datareader) EXPECT_EQ(is_virtual_metatraffic, false); EXPECT_EQ(locators.unicast[0], info.locators.unicast[0]); EXPECT_EQ(locators.multicast[0], info.locators.multicast[0]); - EXPECT_EQ(kind, EntityKind::DATAREADER); EXPECT_EQ(participant_id, EntityId(1)); EXPECT_EQ(topic_id, EntityId(2)); @@ -1903,7 +1903,7 @@ TEST_F(database_queue_tests, push_datareader) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -1916,7 +1916,6 @@ TEST_F(database_queue_tests, push_datareader) EXPECT_EQ(is_virtual_metatraffic, false); EXPECT_EQ(locators.unicast[0], info.locators.unicast[0]); EXPECT_EQ(locators.multicast[0], info.locators.multicast[0]); - EXPECT_EQ(kind, EntityKind::DATAREADER); EXPECT_EQ(participant_id, EntityId(1)); EXPECT_EQ(topic_id, EntityId(2)); @@ -2012,7 +2011,7 @@ TEST_F(database_queue_tests, push_datareader_topic_does_not_exist) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -2025,7 +2024,6 @@ TEST_F(database_queue_tests, push_datareader_topic_does_not_exist) EXPECT_EQ(is_virtual_metatraffic, false); EXPECT_EQ(locators.unicast[0], info.locators.unicast[0]); EXPECT_EQ(locators.multicast[0], info.locators.multicast[0]); - EXPECT_EQ(kind, EntityKind::DATAREADER); EXPECT_EQ(participant_id, EntityId(1)); EXPECT_EQ(topic_id, EntityId(2)); @@ -2099,7 +2097,7 @@ TEST_F(database_queue_tests, push_history_latency) std::shared_ptr data = std::make_shared(); data->writer_reader_data(inner_data); - data->_d(EventKindBits::HISTORY2HISTORY_LATENCY); + data->_d(EventKind::HISTORY2HISTORY_LATENCY); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(1) @@ -2171,7 +2169,7 @@ TEST_F(database_queue_tests, push_history_latency_no_reader) std::shared_ptr data = std::make_shared(); data->writer_reader_data(inner_data); - data->_d(EventKindBits::HISTORY2HISTORY_LATENCY); + data->_d(EventKind::HISTORY2HISTORY_LATENCY); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -2228,7 +2226,7 @@ TEST_F(database_queue_tests, push_history_latency_no_writer) std::shared_ptr data = std::make_shared(); data->writer_reader_data(inner_data); - data->_d(EventKindBits::HISTORY2HISTORY_LATENCY); + data->_d(EventKind::HISTORY2HISTORY_LATENCY); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -2254,7 +2252,7 @@ TEST_F(database_queue_tests, push_network_latency) std::chrono::system_clock::time_point timestamp = std::chrono::system_clock::now(); std::array src_locator_address = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - eprosima::fastrtps::rtps::Locator_t src_locator_t; + eprosima::fastdds::rtps::Locator_t src_locator_t; uint16_t src_locator_t_physical_port = 0; uint16_t src_locator_t_logical_port = 0; IPLocator::setPhysicalPort(src_locator_t, src_locator_t_physical_port); @@ -2263,7 +2261,7 @@ TEST_F(database_queue_tests, push_network_latency) std::string src_locator_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|d.e.f.10"; std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 2048; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -2292,7 +2290,7 @@ TEST_F(database_queue_tests, push_network_latency) std::shared_ptr data = std::make_shared(); data->locator2locator_data(inner_data); - data->_d(EventKindBits::NETWORK_LATENCY); + data->_d(EventKind::NETWORK_LATENCY); // Precondition: The participant exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::PARTICIPANT, src_locator_str)).Times(1) @@ -2332,7 +2330,7 @@ TEST_F(database_queue_tests, push_network_latency_no_participant) std::chrono::system_clock::time_point timestamp = std::chrono::system_clock::now(); std::array src_locator_address = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - eprosima::fastrtps::rtps::Locator_t src_locator_t; + eprosima::fastdds::rtps::Locator_t src_locator_t; uint16_t src_locator_t_physical_port = 0; uint16_t src_locator_t_logical_port = 0; IPLocator::setPhysicalPort(src_locator_t, src_locator_t_physical_port); @@ -2341,7 +2339,7 @@ TEST_F(database_queue_tests, push_network_latency_no_participant) std::string src_locator_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|d.e.f.10"; std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -2370,7 +2368,7 @@ TEST_F(database_queue_tests, push_network_latency_no_participant) std::shared_ptr data = std::make_shared(); data->locator2locator_data(inner_data); - data->_d(EventKindBits::NETWORK_LATENCY); + data->_d(EventKind::NETWORK_LATENCY); // Precondition: The participant does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::PARTICIPANT, src_locator_str)).Times(AnyNumber()) @@ -2396,7 +2394,7 @@ TEST_F(database_queue_tests, push_network_latency_wrong_participant_format) std::chrono::system_clock::time_point timestamp = std::chrono::system_clock::now(); std::array src_locator_address = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - eprosima::fastrtps::rtps::Locator_t src_locator_t; + eprosima::fastdds::rtps::Locator_t src_locator_t; uint16_t src_locator_t_physical_port = 1; uint16_t src_locator_t_logical_port = 0; IPLocator::setPhysicalPort(src_locator_t, src_locator_t_physical_port); @@ -2405,7 +2403,7 @@ TEST_F(database_queue_tests, push_network_latency_wrong_participant_format) std::string src_locator_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|d.e.f.10"; std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -2434,7 +2432,7 @@ TEST_F(database_queue_tests, push_network_latency_wrong_participant_format) std::shared_ptr data = std::make_shared(); data->locator2locator_data(inner_data); - data->_d(EventKindBits::NETWORK_LATENCY); + data->_d(EventKind::NETWORK_LATENCY); // Precondition: The participant is not searched EXPECT_CALL(database, get_entity_by_guid(EntityKind::PARTICIPANT, src_locator_str)).Times(0); @@ -2459,7 +2457,7 @@ TEST_F(database_queue_tests, push_network_latency_no_destination_locator) std::chrono::system_clock::time_point timestamp = std::chrono::system_clock::now(); std::array src_locator_address = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - eprosima::fastrtps::rtps::Locator_t src_locator_t; + eprosima::fastdds::rtps::Locator_t src_locator_t; uint16_t src_locator_t_physical_port = 0; uint16_t src_locator_t_logical_port = 0; IPLocator::setPhysicalPort(src_locator_t, src_locator_t_physical_port); @@ -2468,7 +2466,7 @@ TEST_F(database_queue_tests, push_network_latency_no_destination_locator) std::string src_locator_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|d.e.f.10"; std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -2497,7 +2495,7 @@ TEST_F(database_queue_tests, push_network_latency_no_destination_locator) std::shared_ptr data = std::make_shared(); data->locator2locator_data(inner_data); - data->_d(EventKindBits::NETWORK_LATENCY); + data->_d(EventKind::NETWORK_LATENCY); // Precondition: The participant exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::PARTICIPANT, src_locator_str)).Times(AnyNumber()) @@ -2572,7 +2570,7 @@ TEST_F(database_queue_tests, push_publication_throughput) std::shared_ptr data = std::make_shared(); data->entity_data(inner_data); - data->_d(EventKindBits::PUBLICATION_THROUGHPUT); + data->_d(EventKind::PUBLICATION_THROUGHPUT); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(1) @@ -2627,7 +2625,7 @@ TEST_F(database_queue_tests, push_publication_throughput_no_writer) std::shared_ptr data = std::make_shared(); data->entity_data(inner_data); - data->_d(EventKindBits::PUBLICATION_THROUGHPUT); + data->_d(EventKind::PUBLICATION_THROUGHPUT); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -2668,7 +2666,7 @@ TEST_F(database_queue_tests, push_subscription_throughput) std::shared_ptr data = std::make_shared(); data->entity_data(inner_data); - data->_d(EventKindBits::SUBSCRIPTION_THROUGHPUT); + data->_d(EventKind::SUBSCRIPTION_THROUGHPUT); // Precondition: The reader exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str)).Times(1) @@ -2723,7 +2721,7 @@ TEST_F(database_queue_tests, push_subscription_throughput_no_reader) std::shared_ptr data = std::make_shared(); data->entity_data(inner_data); - data->_d(EventKindBits::SUBSCRIPTION_THROUGHPUT); + data->_d(EventKind::SUBSCRIPTION_THROUGHPUT); // Precondition: The reader does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str)).Times(AnyNumber()) @@ -2749,7 +2747,7 @@ TEST_F(database_queue_tests, push_rtps_sent) std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -2783,7 +2781,7 @@ TEST_F(database_queue_tests, push_rtps_sent) std::shared_ptr data = std::make_shared(); data->entity2locator_traffic(inner_data); - data->_d(EventKindBits::RTPS_SENT); + data->_d(EventKind::RTPS_SENT); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(2) @@ -2846,7 +2844,7 @@ TEST_F(database_queue_tests, push_rtps_sent_no_writer) std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -2880,7 +2878,7 @@ TEST_F(database_queue_tests, push_rtps_sent_no_writer) std::shared_ptr data = std::make_shared(); data->entity2locator_traffic(inner_data); - data->_d(EventKindBits::RTPS_SENT); + data->_d(EventKind::RTPS_SENT); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -2911,7 +2909,7 @@ TEST_F(database_queue_tests, push_rtps_sent_no_locator) std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -2945,7 +2943,7 @@ TEST_F(database_queue_tests, push_rtps_sent_no_locator) std::shared_ptr data = std::make_shared(); data->entity2locator_traffic(inner_data); - data->_d(EventKindBits::RTPS_SENT); + data->_d(EventKind::RTPS_SENT); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -3023,7 +3021,7 @@ TEST_F(database_queue_tests, push_rtps_lost) std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -3057,7 +3055,7 @@ TEST_F(database_queue_tests, push_rtps_lost) std::shared_ptr data = std::make_shared(); data->entity2locator_traffic(inner_data); - data->_d(EventKindBits::RTPS_LOST); + data->_d(EventKind::RTPS_LOST); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(2) @@ -3120,7 +3118,7 @@ TEST_F(database_queue_tests, push_rtps_lost_no_writer) std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -3154,7 +3152,7 @@ TEST_F(database_queue_tests, push_rtps_lost_no_writer) std::shared_ptr data = std::make_shared(); data->entity2locator_traffic(inner_data); - data->_d(EventKindBits::RTPS_LOST); + data->_d(EventKind::RTPS_LOST); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -3185,7 +3183,7 @@ TEST_F(database_queue_tests, push_rtps_lost_no_locator) std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -3219,7 +3217,7 @@ TEST_F(database_queue_tests, push_rtps_lost_no_locator) std::shared_ptr data = std::make_shared(); data->entity2locator_traffic(inner_data); - data->_d(EventKindBits::RTPS_LOST); + data->_d(EventKind::RTPS_LOST); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -3296,7 +3294,7 @@ TEST_F(database_queue_tests, push_rtps_bytes_no_writer) std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -3344,8 +3342,7 @@ TEST_F(database_queue_tests, push_rtps_bytes_no_writer) ByteToLocatorCountSample sample; EntityId domain; EntityId entity; - EXPECT_THROW(data_queue.do_process_sample_type(domain, entity, EntityKind::DATAWRITER, sample, - inner_data), Error); + EXPECT_THROW(data_queue.do_process_sample_type(domain, entity, EntityKind::DATAWRITER, sample, inner_data), Error); } //TODO(jepemi) Test currently not executed as it is not supported by the monitor yet. It fails. @@ -3356,7 +3353,7 @@ TEST_F(database_queue_tests, push_rtps_bytes_no_locator) std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); @@ -3403,8 +3400,7 @@ TEST_F(database_queue_tests, push_rtps_bytes_no_locator) ByteToLocatorCountSample sample; EntityId domain; EntityId entity; - EXPECT_THROW(data_queue.do_process_sample_type(domain, entity, EntityKind::DATAWRITER, sample, - inner_data), Error); + EXPECT_THROW(data_queue.do_process_sample_type(domain, entity, EntityKind::DATAWRITER, sample, inner_data), Error); } TEST_F(database_queue_tests, push_resent_datas) @@ -3431,7 +3427,7 @@ TEST_F(database_queue_tests, push_resent_datas) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::RESENT_DATAS); + data->_d(EventKind::RESENT_DATAS); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(1) @@ -3486,7 +3482,7 @@ TEST_F(database_queue_tests, push_resent_datas_no_writer) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::RESENT_DATAS); + data->_d(EventKind::RESENT_DATAS); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -3527,7 +3523,7 @@ TEST_F(database_queue_tests, push_heartbeat_count) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::HEARTBEAT_COUNT); + data->_d(EventKind::HEARTBEAT_COUNT); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(1) @@ -3582,7 +3578,7 @@ TEST_F(database_queue_tests, push_heartbeat_count_no_writer) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::HEARTBEAT_COUNT); + data->_d(EventKind::HEARTBEAT_COUNT); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -3623,7 +3619,7 @@ TEST_F(database_queue_tests, push_acknack_count) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::ACKNACK_COUNT); + data->_d(EventKind::ACKNACK_COUNT); // Precondition: The reader exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str)).Times(1) @@ -3678,7 +3674,7 @@ TEST_F(database_queue_tests, push_acknack_count_no_reader) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::ACKNACK_COUNT); + data->_d(EventKind::ACKNACK_COUNT); // Precondition: The reader does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str)).Times(AnyNumber()) @@ -3719,7 +3715,7 @@ TEST_F(database_queue_tests, push_nackfrag_count) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::NACKFRAG_COUNT); + data->_d(EventKind::NACKFRAG_COUNT); // Precondition: The reader exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str)).Times(1) @@ -3774,7 +3770,7 @@ TEST_F(database_queue_tests, push_nackfrag_count_no_reader) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::NACKFRAG_COUNT); + data->_d(EventKind::NACKFRAG_COUNT); // Precondition: The reader does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str)).Times(AnyNumber()) @@ -3815,7 +3811,7 @@ TEST_F(database_queue_tests, push_gap_count) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::GAP_COUNT); + data->_d(EventKind::GAP_COUNT); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(1) @@ -3870,7 +3866,7 @@ TEST_F(database_queue_tests, push_gap_count_no_writer) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::GAP_COUNT); + data->_d(EventKind::GAP_COUNT); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -3911,7 +3907,7 @@ TEST_F(database_queue_tests, push_data_count) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::DATA_COUNT); + data->_d(EventKind::DATA_COUNT); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(1) @@ -3966,7 +3962,7 @@ TEST_F(database_queue_tests, push_data_count_no_writer) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::DATA_COUNT); + data->_d(EventKind::DATA_COUNT); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -4007,7 +4003,7 @@ TEST_F(database_queue_tests, push_pdp_count) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::PDP_PACKETS); + data->_d(EventKind::PDP_PACKETS); // Precondition: The participant exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::PARTICIPANT, participant_guid_str)).Times(1) @@ -4062,7 +4058,7 @@ TEST_F(database_queue_tests, push_pdp_count_no_participant) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::PDP_PACKETS); + data->_d(EventKind::PDP_PACKETS); // Precondition: The participant does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::PARTICIPANT, participant_guid_str)).Times(AnyNumber()) @@ -4103,7 +4099,7 @@ TEST_F(database_queue_tests, push_edp_count) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::EDP_PACKETS); + data->_d(EventKind::EDP_PACKETS); // Precondition: The participant exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::PARTICIPANT, participant_guid_str)).Times(1) @@ -4158,7 +4154,7 @@ TEST_F(database_queue_tests, push_edp_count_no_participant) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::EDP_PACKETS); + data->_d(EventKind::EDP_PACKETS); // Precondition: The participant does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::PARTICIPANT, participant_guid_str)).Times(AnyNumber()) @@ -4216,7 +4212,7 @@ TEST_F(database_queue_tests, push_discovery_times) std::shared_ptr data = std::make_shared(); data->discovery_time(inner_data); - data->_d(EventKindBits::DISCOVERED_ENTITY); + data->_d(EventKind::DISCOVERED_ENTITY); // Precondition: The participant exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::PARTICIPANT, participant_guid_str)).Times(1) @@ -4289,7 +4285,7 @@ TEST_F(database_queue_tests, push_discovery_times_no_participant) std::shared_ptr data = std::make_shared(); data->discovery_time(inner_data); - data->_d(EventKindBits::DISCOVERED_ENTITY); + data->_d(EventKind::DISCOVERED_ENTITY); // Precondition: The participant does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::PARTICIPANT, participant_guid_str)).Times(AnyNumber()) @@ -4347,7 +4343,7 @@ TEST_F(database_queue_tests, push_discovery_times_no_entity) std::shared_ptr data = std::make_shared(); data->discovery_time(inner_data); - data->_d(EventKindBits::DISCOVERED_ENTITY); + data->_d(EventKind::DISCOVERED_ENTITY); // Precondition: The participant exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::PARTICIPANT, participant_guid_str)).Times(AnyNumber()) @@ -4377,7 +4373,8 @@ TEST_F(database_queue_tests, push_sample_datas) int32_t sn_high = 2048; uint32_t sn_low = 4096; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::SequenceNumber_t sn (sn_high, sn_low); + eprosima::fastdds:: + rtps::SequenceNumber_t sn (sn_high, sn_low); // Build the writer GUID DatabaseDataQueueWrapper::StatisticsGuidPrefix writer_prefix; @@ -4403,7 +4400,7 @@ TEST_F(database_queue_tests, push_sample_datas) std::shared_ptr data = std::make_shared(); data->sample_identity_count(inner_data); - data->_d(EventKindBits::SAMPLE_DATAS); + data->_d(EventKind::SAMPLE_DATAS); // Precondition: The writer exists and has ID 1 EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(1) @@ -4443,7 +4440,7 @@ TEST_F(database_queue_tests, push_sample_datas_no_writer) int32_t sn_high = 2048; uint32_t sn_low = 4096; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::SequenceNumber_t sn (sn_high, sn_low); + eprosima::fastdds::rtps::SequenceNumber_t sn (sn_high, sn_low); // Build the writer GUID DatabaseDataQueueWrapper::StatisticsGuidPrefix writer_prefix; @@ -4469,7 +4466,7 @@ TEST_F(database_queue_tests, push_sample_datas_no_writer) std::shared_ptr data = std::make_shared(); data->sample_identity_count(inner_data); - data->_d(EventKindBits::SAMPLE_DATAS); + data->_d(EventKind::SAMPLE_DATAS); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str)).Times(AnyNumber()) @@ -4504,7 +4501,7 @@ TEST_F(database_queue_tests, push_monitor_proxy) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::PROXY; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = eprosima::fastdds::statistics::StatusKind::PROXY; MonitorServiceData value; std::vector entity_proxy = {1, 2, 3, 4, 5}; value.entity_proxy(entity_proxy); @@ -4567,7 +4564,7 @@ TEST_F(database_queue_tests, push_monitor_proxy_no_entity) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::PROXY; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = eprosima::fastdds::statistics::StatusKind::PROXY; MonitorServiceData value; std::vector entity_proxy = {1, 2, 3, 4, 5}; value.entity_proxy(entity_proxy); @@ -4612,7 +4609,7 @@ TEST_F(database_queue_tests, push_monitor_connection_list) // Build connection list sequence std::vector connection_list; Connection connection; - connection.mode(eprosima::fastdds::statistics::DATA_SHARING); + connection.mode(eprosima::fastdds::statistics::ConnectionMode::DATA_SHARING); std::array other_entity_id = {0, 0, 0, 1}; std::string entity_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.1"; DatabaseDataQueueWrapper::StatisticsEntityId entity_id; @@ -4631,7 +4628,8 @@ TEST_F(database_queue_tests, push_monitor_connection_list) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::CONNECTION_LIST; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::CONNECTION_LIST; MonitorServiceData value; value.connection_list(connection_list); data->local_entity(participant_guid); @@ -4690,7 +4688,7 @@ TEST_F(database_queue_tests, push_monitor_connection_list_no_entity) // Build connection list sequence std::vector connection_list; Connection connection; - connection.mode(eprosima::fastdds::statistics::DATA_SHARING); + connection.mode(eprosima::fastdds::statistics::ConnectionMode::DATA_SHARING); std::array other_entity_id = {0, 0, 0, 1}; std::string entity_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.1"; DatabaseDataQueueWrapper::StatisticsEntityId entity_id; @@ -4709,7 +4707,8 @@ TEST_F(database_queue_tests, push_monitor_connection_list_no_entity) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::CONNECTION_LIST; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::CONNECTION_LIST; MonitorServiceData value; value.connection_list(connection_list); data->local_entity(participant_guid); @@ -4744,7 +4743,7 @@ TEST_F(database_queue_tests, push_monitor_incompatible_qos) int32_t sn_high = 2048; uint32_t sn_low = 4096; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::SequenceNumber_t sn (sn_high, sn_low); + eprosima::fastdds::rtps::SequenceNumber_t sn (sn_high, sn_low); DatabaseDataQueueWrapper::StatisticsGuidPrefix writer_prefix; writer_prefix.value(prefix); DatabaseDataQueueWrapper::StatisticsEntityId writer_entity_id; @@ -4766,7 +4765,8 @@ TEST_F(database_queue_tests, push_monitor_incompatible_qos) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::INCOMPATIBLE_QOS; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::INCOMPATIBLE_QOS; MonitorServiceData value; value.incompatible_qos_status(incompatible_qos_status); data->local_entity(writer_guid); @@ -4817,7 +4817,7 @@ TEST_F(database_queue_tests, push_monitor_incompatible_qos_no_entity) int32_t sn_high = 2048; uint32_t sn_low = 4096; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::SequenceNumber_t sn (sn_high, sn_low); + eprosima::fastdds::rtps::SequenceNumber_t sn (sn_high, sn_low); DatabaseDataQueueWrapper::StatisticsGuidPrefix writer_prefix; writer_prefix.value(prefix); DatabaseDataQueueWrapper::StatisticsEntityId writer_entity_id; @@ -4839,7 +4839,8 @@ TEST_F(database_queue_tests, push_monitor_incompatible_qos_no_entity) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::INCOMPATIBLE_QOS; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::INCOMPATIBLE_QOS; MonitorServiceData value; value.incompatible_qos_status(incompatible_qos_status); data->local_entity(writer_guid); @@ -4874,7 +4875,7 @@ TEST_F(database_queue_tests, push_monitor_inconsistent_topic) int32_t sn_high = 2048; uint32_t sn_low = 4096; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::SequenceNumber_t sn (sn_high, sn_low); + eprosima::fastdds::rtps::SequenceNumber_t sn (sn_high, sn_low); DatabaseDataQueueWrapper::StatisticsGuidPrefix writer_prefix; writer_prefix.value(prefix); DatabaseDataQueueWrapper::StatisticsEntityId writer_entity_id; @@ -4889,7 +4890,8 @@ TEST_F(database_queue_tests, push_monitor_inconsistent_topic) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::INCONSISTENT_TOPIC; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::INCONSISTENT_TOPIC; MonitorServiceData value; value.inconsistent_topic_status(inconsistent_topic_status); data->local_entity(writer_guid); @@ -4940,7 +4942,7 @@ TEST_F(database_queue_tests, push_monitor_inconsistent_topic_no_entity) int32_t sn_high = 2048; uint32_t sn_low = 4096; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::SequenceNumber_t sn (sn_high, sn_low); + eprosima::fastdds::rtps::SequenceNumber_t sn (sn_high, sn_low); DatabaseDataQueueWrapper::StatisticsGuidPrefix writer_prefix; writer_prefix.value(prefix); DatabaseDataQueueWrapper::StatisticsEntityId writer_entity_id; @@ -4955,7 +4957,8 @@ TEST_F(database_queue_tests, push_monitor_inconsistent_topic_no_entity) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::INCONSISTENT_TOPIC; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::INCONSISTENT_TOPIC; MonitorServiceData value; value.inconsistent_topic_status(inconsistent_topic_status); data->local_entity(writer_guid); @@ -4990,7 +4993,7 @@ TEST_F(database_queue_tests, push_monitor_liveliness_lost) int32_t sn_high = 2048; uint32_t sn_low = 4096; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::SequenceNumber_t sn (sn_high, sn_low); + eprosima::fastdds::rtps::SequenceNumber_t sn (sn_high, sn_low); DatabaseDataQueueWrapper::StatisticsGuidPrefix writer_prefix; writer_prefix.value(prefix); DatabaseDataQueueWrapper::StatisticsEntityId writer_entity_id; @@ -5005,7 +5008,8 @@ TEST_F(database_queue_tests, push_monitor_liveliness_lost) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::LIVELINESS_LOST; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::LIVELINESS_LOST; MonitorServiceData value; value.liveliness_lost_status(liveliness_lost_status); data->local_entity(writer_guid); @@ -5056,7 +5060,7 @@ TEST_F(database_queue_tests, push_monitor_liveliness_lost_no_entity) int32_t sn_high = 2048; uint32_t sn_low = 4096; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::SequenceNumber_t sn (sn_high, sn_low); + eprosima::fastdds::rtps::SequenceNumber_t sn (sn_high, sn_low); DatabaseDataQueueWrapper::StatisticsGuidPrefix writer_prefix; writer_prefix.value(prefix); DatabaseDataQueueWrapper::StatisticsEntityId writer_entity_id; @@ -5071,7 +5075,8 @@ TEST_F(database_queue_tests, push_monitor_liveliness_lost_no_entity) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::LIVELINESS_LOST; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::LIVELINESS_LOST; MonitorServiceData value; value.liveliness_lost_status(liveliness_lost_status); data->local_entity(writer_guid); @@ -5120,7 +5125,8 @@ TEST_F(database_queue_tests, push_monitor_liveliness_changed) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::LIVELINESS_CHANGED; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::LIVELINESS_CHANGED; MonitorServiceData value; value.liveliness_changed_status(liveliness_changed_status); data->local_entity(reader_guid); @@ -5185,7 +5191,8 @@ TEST_F(database_queue_tests, push_monitor_liveliness_changed_no_entity) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::LIVELINESS_CHANGED; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::LIVELINESS_CHANGED; MonitorServiceData value; value.liveliness_changed_status(liveliness_changed_status); data->local_entity(reader_guid); @@ -5234,7 +5241,8 @@ TEST_F(database_queue_tests, push_monitor_deadline_missed) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::DEADLINE_MISSED; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::DEADLINE_MISSED; MonitorServiceData value; value.deadline_missed_status(deadline_missed_status); data->local_entity(reader_guid); @@ -5298,7 +5306,8 @@ TEST_F(database_queue_tests, push_monitor_deadline_missed_no_entity) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::DEADLINE_MISSED; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::DEADLINE_MISSED; MonitorServiceData value; value.deadline_missed_status(deadline_missed_status); data->local_entity(reader_guid); @@ -5345,7 +5354,7 @@ TEST_F(database_queue_tests, push_monitor_sample_lost) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::SAMPLE_LOST; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = eprosima::fastdds::statistics::StatusKind::SAMPLE_LOST; MonitorServiceData value; value.sample_lost_status(sample_lost_status); data->local_entity(reader_guid); @@ -5407,7 +5416,7 @@ TEST_F(database_queue_tests, push_monitor_sample_lost_no_entity) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::SAMPLE_LOST; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = eprosima::fastdds::statistics::StatusKind::SAMPLE_LOST; MonitorServiceData value; value.sample_lost_status(sample_lost_status); data->local_entity(reader_guid); @@ -5450,7 +5459,8 @@ TEST_F(database_queue_tests, push_monitor_statuses_size) // Build the Monitor Service data std::shared_ptr data = std::make_shared(); - eprosima::fastdds::statistics::StatusKind kind = eprosima::fastdds::statistics::StatusKind::STATUSES_SIZE; + eprosima::fastdds::statistics::StatusKind::StatusKind kind = + eprosima::fastdds::statistics::StatusKind::STATUSES_SIZE; MonitorServiceData value; uint8_t octet = 1; value.statuses_size(octet); diff --git a/test/unittest/EntityMetatraffic/CMakeLists.txt b/test/unittest/EntityMetatraffic/CMakeLists.txt index de72f88e7..896b6248e 100644 --- a/test/unittest/EntityMetatraffic/CMakeLists.txt +++ b/test/unittest/EntityMetatraffic/CMakeLists.txt @@ -25,12 +25,10 @@ set(LIBRARY_SOURCES ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -48,7 +46,7 @@ target_include_directories(entitymetatraffic_tests PRIVATE ${PROJECT_BINARY_DIR}/include/${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/src/cpp) -target_link_libraries(entitymetatraffic_tests PUBLIC ${GTEST_LIBRARIES} fastrtps fastcdr) +target_link_libraries(entitymetatraffic_tests PUBLIC ${GTEST_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(entitymetatraffic_tests TEST_FRIENDLY_PATH) diff --git a/test/unittest/QosSerializer/CMakeLists.txt b/test/unittest/QosSerializer/CMakeLists.txt index d01d369b1..d957e0558 100644 --- a/test/unittest/QosSerializer/CMakeLists.txt +++ b/test/unittest/QosSerializer/CMakeLists.txt @@ -35,7 +35,7 @@ if(GTEST_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(qos_serializer_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(qos_serializer_tests TEST_FRIENDLY_PATH) diff --git a/test/unittest/QosSerializer/QosSerializerTests.cpp b/test/unittest/QosSerializer/QosSerializerTests.cpp index ccafe6a40..9fed619db 100644 --- a/test/unittest/QosSerializer/QosSerializerTests.cpp +++ b/test/unittest/QosSerializer/QosSerializerTests.cpp @@ -20,8 +20,8 @@ #include #include #include -#include -#include +#include +#include using namespace eprosima::fastdds::dds; using namespace eprosima::statistics_backend::subscriber; @@ -62,12 +62,12 @@ TEST(qos_serializer_tests, durability_qos_policy) TEST(qos_serializer_tests, duration) { - eprosima::fastrtps::Duration_t qos; + eprosima::fastdds::dds::Duration_t qos; Qos serialized; Qos expected; std::string field("field"); - qos = eprosima::fastrtps::Duration_t(5, 10); + qos = eprosima::fastdds::dds::Duration_t(5, 10); eprosima::statistics_backend::subscriber::serialize(qos, field, serialized); expected[field.c_str()][duration_seconds_tag] = 5; @@ -82,7 +82,7 @@ TEST(qos_serializer_tests, deadline_qos_policy) Qos expected; std::string field("field"); - qos.period = eprosima::fastrtps::Duration_t (5, 0); + qos.period = eprosima::fastdds::dds::Duration_t (5, 0); eprosima::statistics_backend::subscriber::serialize(qos, field, serialized); Qos serialized_period; @@ -99,7 +99,7 @@ TEST(qos_serializer_tests, latency_budget_qos_policy) Qos expected; std::string field("field"); - qos.duration = eprosima::fastrtps::Duration_t (0, 5); + qos.duration = eprosima::fastdds::dds::Duration_t (0, 5); eprosima::statistics_backend::subscriber::serialize(qos, field, serialized); Qos serialized_duration; @@ -117,8 +117,8 @@ TEST(qos_serializer_tests, liveliness_qos_policy) std::string field("field"); qos.kind = AUTOMATIC_LIVELINESS_QOS; - qos.announcement_period = eprosima::fastrtps::Duration_t (10, 10); - qos.lease_duration = eprosima::fastrtps::Duration_t (10, 10); + qos.announcement_period = eprosima::fastdds::dds::Duration_t (10, 10); + qos.lease_duration = eprosima::fastdds::dds::Duration_t (10, 10); eprosima::statistics_backend::subscriber::serialize(qos, field, serialized); Qos serialized_duration; @@ -153,7 +153,7 @@ TEST(qos_serializer_tests, reliability_qos_policy) std::string field("field"); qos.kind = BEST_EFFORT_RELIABILITY_QOS; - qos.max_blocking_time = eprosima::fastrtps::Duration_t (10, 10); + qos.max_blocking_time = eprosima::fastdds::dds::Duration_t (10, 10); eprosima::statistics_backend::subscriber::serialize(qos, field, serialized); Qos serialized_blocking_time; @@ -309,7 +309,7 @@ TEST(qos_serializer_tests, time_based_filter_qos_policy) Qos expected; std::string field("field"); - qos.minimum_separation = eprosima::fastrtps::Duration_t (10, 10); + qos.minimum_separation = eprosima::fastdds::dds::Duration_t (10, 10); eprosima::statistics_backend::subscriber::serialize(qos, field, serialized); Qos serialized_minimum_separation; @@ -381,7 +381,7 @@ TEST(qos_serializer_tests, durability_service_qos_policy) std::string field("field"); qos.history_kind = KEEP_LAST_HISTORY_QOS; - qos.service_cleanup_delay = eprosima::fastrtps::Duration_t (10, 10); + qos.service_cleanup_delay = eprosima::fastdds::dds::Duration_t (10, 10); qos.max_instances = 20; qos.max_samples = 30; qos.max_samples_per_instance = 40; @@ -414,7 +414,7 @@ TEST(qos_serializer_tests, lifespan_qos_policy) Qos expected; std::string field("field"); - qos.duration = eprosima::fastrtps::Duration_t (10, 10); + qos.duration = eprosima::fastdds::dds::Duration_t (10, 10); eprosima::statistics_backend::subscriber::serialize(qos, field, serialized); Qos serialized_duration; @@ -487,7 +487,7 @@ TEST(qos_serializer_tests, disable_positive_ack_qos_policy) std::string field("field"); qos.enabled = true; - qos.duration = eprosima::fastrtps::Duration_t (10, 10); + qos.duration = eprosima::fastdds::dds::Duration_t (10, 10); eprosima::statistics_backend::subscriber::serialize(qos, field, serialized); Qos serialized_duration; @@ -558,13 +558,13 @@ TEST(qos_serializer_tests, publish_mode_qos_policy) Qos expected; std::string field("field"); - qos.kind = SYNCHRONOUS_PUBLISH_MODE; + qos.kind = SYNCHRONOUS_PUBLISH_MODE; eprosima::statistics_backend::subscriber::serialize(qos, field, serialized); expected[field.c_str()][kind_tag] = publish_mode_sync_tag; EXPECT_EQ(expected, serialized); - qos.kind = ASYNCHRONOUS_PUBLISH_MODE; + qos.kind = ASYNCHRONOUS_PUBLISH_MODE; eprosima::statistics_backend::subscriber::serialize(qos, field, serialized); expected[field.c_str()][kind_tag] = publish_mode_async_tag; @@ -597,7 +597,7 @@ TEST(qos_serializer_tests, parameter_property_list_qos_policy) TEST(qos_serializer_tests, writer_info_serializer) { - eprosima::fastrtps::rtps::WriterProxyData info(10, 10); + eprosima::fastdds::rtps::PublicationBuiltinTopicData info; Qos serialized; Qos expected; @@ -606,80 +606,72 @@ TEST(qos_serializer_tests, writer_info_serializer) serialized = eprosima::statistics_backend::subscriber::writer_proxy_data_to_backend_qos(info); Qos serialized_durability; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_durability, durability_tag, + eprosima::statistics_backend::subscriber::serialize(info.durability, durability_tag, serialized_durability); expected[durability_tag] = serialized_durability[durability_tag]; - Qos serialized_durabilityService; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_durabilityService, durability_service_tag, - serialized_durabilityService); - expected[durability_service_tag] = serialized_durabilityService[durability_service_tag]; + Qos serialized_durability_service; + eprosima::statistics_backend::subscriber::serialize(info.durability_service, durability_service_tag, + serialized_durability_service); + expected[durability_service_tag] = serialized_durability_service[durability_service_tag]; Qos serialized_deadline; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_deadline, deadline_tag, serialized_deadline); + eprosima::statistics_backend::subscriber::serialize(info.deadline, deadline_tag, serialized_deadline); expected[deadline_tag] = serialized_deadline[deadline_tag]; - Qos serialized_latencyBudget; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_latencyBudget, latency_budget_tag, - serialized_latencyBudget); - expected[latency_budget_tag] = serialized_latencyBudget[latency_budget_tag]; + Qos serialized_latency_budget; + eprosima::statistics_backend::subscriber::serialize(info.latency_budget, latency_budget_tag, + serialized_latency_budget); + expected[latency_budget_tag] = serialized_latency_budget[latency_budget_tag]; Qos serialized_liveliness; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_liveliness, liveliness_tag, + eprosima::statistics_backend::subscriber::serialize(info.liveliness, liveliness_tag, serialized_liveliness); expected[liveliness_tag] = serialized_liveliness[liveliness_tag]; Qos serialized_reliability; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_reliability, reliability_tag, + eprosima::statistics_backend::subscriber::serialize(info.reliability, reliability_tag, serialized_reliability); expected[reliability_tag] = serialized_reliability[reliability_tag]; Qos serialized_lifespan; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_lifespan, lifespan_tag, serialized_lifespan); + eprosima::statistics_backend::subscriber::serialize(info.lifespan, lifespan_tag, serialized_lifespan); expected[lifespan_tag] = serialized_lifespan[lifespan_tag]; - Qos serialized_userData; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_userData, user_data_tag, serialized_userData); - expected[user_data_tag] = serialized_userData[user_data_tag]; - Qos serialized_timeBasedFilter; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_timeBasedFilter, time_based_filter_tag, - serialized_timeBasedFilter); - expected[time_based_filter_tag] = serialized_timeBasedFilter[time_based_filter_tag]; + Qos serialized_user_data; + eprosima::statistics_backend::subscriber::serialize(info.user_data, user_data_tag, serialized_user_data); + expected[user_data_tag] = serialized_user_data[user_data_tag]; Qos serialized_ownership; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_ownership, ownership_tag, + eprosima::statistics_backend::subscriber::serialize(info.ownership, ownership_tag, serialized_ownership); expected[ownership_tag] = serialized_ownership[ownership_tag]; - Qos serialized_ownershipStrength; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_ownershipStrength, ownership_strength_tag, - serialized_ownershipStrength); - expected[ownership_strength_tag] = serialized_ownershipStrength[ownership_strength_tag]; - Qos serialized_destinationOrder; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_destinationOrder, destination_order_tag, - serialized_destinationOrder); - expected[destination_order_tag] = serialized_destinationOrder[destination_order_tag]; + Qos serialized_ownership_strength; + eprosima::statistics_backend::subscriber::serialize(info.ownership_strength, ownership_strength_tag, + serialized_ownership_strength); + expected[ownership_strength_tag] = serialized_ownership_strength[ownership_strength_tag]; + Qos serialized_destination_order; + eprosima::statistics_backend::subscriber::serialize(info.destination_order, destination_order_tag, + serialized_destination_order); + expected[destination_order_tag] = serialized_destination_order[destination_order_tag]; Qos serialized_presentation; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_presentation, presentation_tag, + eprosima::statistics_backend::subscriber::serialize(info.presentation, presentation_tag, serialized_presentation); expected[presentation_tag] = serialized_presentation[presentation_tag]; Qos serialized_partition; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_partition, partition_tag, + eprosima::statistics_backend::subscriber::serialize(info.partition, partition_tag, serialized_partition); expected[partition_tag] = serialized_partition[partition_tag]; - Qos serialized_topicData; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_topicData, topic_data_tag, - serialized_topicData); - expected[topic_data_tag] = serialized_topicData[topic_data_tag]; - Qos serialized_groupData; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_groupData, group_data_tag, - serialized_groupData); - expected[group_data_tag] = serialized_groupData[group_data_tag]; - Qos serialized_publishMode; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_publishMode, publish_mode_tag, - serialized_publishMode); - expected[publish_mode_tag] = serialized_publishMode[publish_mode_tag]; + Qos serialized_topic_data; + eprosima::statistics_backend::subscriber::serialize(info.topic_data, topic_data_tag, + serialized_topic_data); + expected[topic_data_tag] = serialized_topic_data[topic_data_tag]; + Qos serialized_group_data; + eprosima::statistics_backend::subscriber::serialize(info.group_data, group_data_tag, + serialized_group_data); + expected[group_data_tag] = serialized_group_data[group_data_tag]; Qos serialized_representation; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.representation, representation_tag, + eprosima::statistics_backend::subscriber::serialize(info.representation, representation_tag, serialized_representation); expected[representation_tag] = serialized_representation[representation_tag]; - Qos serialized_m_disablePositiveACKs; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_disablePositiveACKs, - disable_positive_acks_tag, serialized_m_disablePositiveACKs); - expected[disable_positive_acks_tag] = serialized_m_disablePositiveACKs[disable_positive_acks_tag]; + Qos serialized_disable_positive_acks; + eprosima::statistics_backend::subscriber::serialize(info.disable_positive_acks, + disable_positive_acks_tag, serialized_disable_positive_acks); + expected[disable_positive_acks_tag] = serialized_disable_positive_acks[disable_positive_acks_tag]; Qos serialized_data_sharing; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.data_sharing, data_sharing_tag, + eprosima::statistics_backend::subscriber::serialize(info.data_sharing, data_sharing_tag, serialized_data_sharing); expected[data_sharing_tag] = serialized_data_sharing[data_sharing_tag]; @@ -688,7 +680,7 @@ TEST(qos_serializer_tests, writer_info_serializer) TEST(qos_serializer_tests, reader_info_serializer) { - eprosima::fastrtps::rtps::ReaderProxyData info(10, 10); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData info; Qos serialized; Qos expected; @@ -697,90 +689,85 @@ TEST(qos_serializer_tests, reader_info_serializer) serialized = eprosima::statistics_backend::subscriber::reader_proxy_data_to_backend_qos(info); Qos serialized_durability; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_durability, durability_tag, + eprosima::statistics_backend::subscriber::serialize(info.durability, durability_tag, serialized_durability); expected[durability_tag] = serialized_durability[durability_tag]; Qos serialized_durabilityService; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_durabilityService, durability_service_tag, - serialized_durabilityService); - expected[durability_service_tag] = serialized_durabilityService[durability_service_tag]; Qos serialized_deadline; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_deadline, deadline_tag, serialized_deadline); + eprosima::statistics_backend::subscriber::serialize(info.deadline, deadline_tag, serialized_deadline); expected[deadline_tag] = serialized_deadline[deadline_tag]; - Qos serialized_latencyBudget; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_latencyBudget, latency_budget_tag, - serialized_latencyBudget); - expected[latency_budget_tag] = serialized_latencyBudget[latency_budget_tag]; + Qos serialized_latency_budget; + eprosima::statistics_backend::subscriber::serialize(info.latency_budget, latency_budget_tag, + serialized_latency_budget); + expected[latency_budget_tag] = serialized_latency_budget[latency_budget_tag]; Qos serialized_liveliness; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_liveliness, liveliness_tag, + eprosima::statistics_backend::subscriber::serialize(info.liveliness, liveliness_tag, serialized_liveliness); expected[liveliness_tag] = serialized_liveliness[liveliness_tag]; Qos serialized_reliability; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_reliability, reliability_tag, + eprosima::statistics_backend::subscriber::serialize(info.reliability, reliability_tag, serialized_reliability); expected[reliability_tag] = serialized_reliability[reliability_tag]; Qos serialized_lifespan; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_lifespan, lifespan_tag, serialized_lifespan); + eprosima::statistics_backend::subscriber::serialize(info.lifespan, lifespan_tag, serialized_lifespan); expected[lifespan_tag] = serialized_lifespan[lifespan_tag]; - Qos serialized_userData; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_userData, user_data_tag, serialized_userData); - expected[user_data_tag] = serialized_userData[user_data_tag]; - Qos serialized_timeBasedFilter; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_timeBasedFilter, time_based_filter_tag, - serialized_timeBasedFilter); - expected[time_based_filter_tag] = serialized_timeBasedFilter[time_based_filter_tag]; + Qos serialized_user_data; + eprosima::statistics_backend::subscriber::serialize(info.user_data, user_data_tag, serialized_user_data); + expected[user_data_tag] = serialized_user_data[user_data_tag]; + Qos serialized_time_based_filter; + eprosima::statistics_backend::subscriber::serialize(info.time_based_filter, time_based_filter_tag, + serialized_time_based_filter); + expected[time_based_filter_tag] = serialized_time_based_filter[time_based_filter_tag]; Qos serialized_ownership; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_ownership, ownership_tag, + eprosima::statistics_backend::subscriber::serialize(info.ownership, ownership_tag, serialized_ownership); expected[ownership_tag] = serialized_ownership[ownership_tag]; - Qos serialized_destinationOrder; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_destinationOrder, destination_order_tag, - serialized_destinationOrder); - expected[destination_order_tag] = serialized_destinationOrder[destination_order_tag]; + Qos serialized_destination_order; + eprosima::statistics_backend::subscriber::serialize(info.destination_order, destination_order_tag, + serialized_destination_order); + expected[destination_order_tag] = serialized_destination_order[destination_order_tag]; Qos serialized_presentation; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_presentation, presentation_tag, + eprosima::statistics_backend::subscriber::serialize(info.presentation, presentation_tag, serialized_presentation); expected[presentation_tag] = serialized_presentation[presentation_tag]; Qos serialized_partition; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_partition, partition_tag, + eprosima::statistics_backend::subscriber::serialize(info.partition, partition_tag, serialized_partition); expected[partition_tag] = serialized_partition[partition_tag]; - Qos serialized_topicData; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_topicData, topic_data_tag, - serialized_topicData); - expected[topic_data_tag] = serialized_topicData[topic_data_tag]; - Qos serialized_groupData; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_groupData, group_data_tag, - serialized_groupData); - expected[group_data_tag] = serialized_groupData[group_data_tag]; + Qos serialized_topic_data; + eprosima::statistics_backend::subscriber::serialize(info.topic_data, topic_data_tag, + serialized_topic_data); + expected[topic_data_tag] = serialized_topic_data[topic_data_tag]; + Qos serialized_group_data; + eprosima::statistics_backend::subscriber::serialize(info.group_data, group_data_tag, + serialized_group_data); + expected[group_data_tag] = serialized_group_data[group_data_tag]; Qos serialized_representation; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.representation, representation_tag, + eprosima::statistics_backend::subscriber::serialize(info.representation, representation_tag, serialized_representation); expected[representation_tag] = serialized_representation[representation_tag]; - Qos serialized_m_disablePositiveACKs; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.m_disablePositiveACKs, - disable_positive_acks_tag, serialized_m_disablePositiveACKs); - expected[disable_positive_acks_tag] = serialized_m_disablePositiveACKs[disable_positive_acks_tag]; + Qos serialized_disable_positive_acks; + eprosima::statistics_backend::subscriber::serialize(info.disable_positive_acks, + disable_positive_acks_tag, serialized_disable_positive_acks); + expected[disable_positive_acks_tag] = serialized_disable_positive_acks[disable_positive_acks_tag]; Qos serialized_data_sharing; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.data_sharing, data_sharing_tag, + eprosima::statistics_backend::subscriber::serialize(info.data_sharing, data_sharing_tag, serialized_data_sharing); expected[data_sharing_tag] = serialized_data_sharing[data_sharing_tag]; Qos serialized_type_consistency; - eprosima::statistics_backend::subscriber::serialize(info.m_qos.type_consistency, type_consistency_tag, + eprosima::statistics_backend::subscriber::serialize(info.type_consistency, type_consistency_tag, serialized_type_consistency); expected[type_consistency_tag] = serialized_type_consistency[type_consistency_tag]; EXPECT_EQ(expected, serialized); } -// Windows dll do not export ParticipantProxyData class members (private APIs) +// Windows dll do not export ParticipantBuiltinTopicData class members (private APIs) #if !defined(_WIN32) TEST(qos_serializer_tests, participant_info_serializer) { - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes attributes; - eprosima::fastrtps::rtps::ParticipantProxyData data(attributes); - data.m_VendorId = eprosima::fastrtps::rtps::c_VendorId_eProsima; - data.m_availableBuiltinEndpoints = 101; + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; + data.vendor_id = eprosima::fastdds::rtps::c_VendorId_eProsima; Qos serialized; Qos expected; @@ -789,17 +776,15 @@ TEST(qos_serializer_tests, participant_info_serializer) serialized = eprosima::statistics_backend::subscriber::participant_proxy_data_to_backend_qos(data); Qos serialized_leaseDuration; - eprosima::statistics_backend::subscriber::serialize(data.m_leaseDuration, lease_duration_tag, + eprosima::statistics_backend::subscriber::serialize(data.lease_duration, lease_duration_tag, serialized_leaseDuration); expected[lease_duration_tag] = serialized_leaseDuration[lease_duration_tag]; Qos serialized_properties; - eprosima::statistics_backend::subscriber::serialize(data.m_properties, properties_tag, serialized_properties); + eprosima::statistics_backend::subscriber::serialize(data.properties, properties_tag, serialized_properties); expected[properties_tag] = serialized_properties[properties_tag]; Qos serialized_userData; - eprosima::statistics_backend::subscriber::serialize(data.m_userData, user_data_tag, serialized_userData); + eprosima::statistics_backend::subscriber::serialize(data.user_data, user_data_tag, serialized_userData); expected[user_data_tag] = serialized_userData[user_data_tag]; - - expected[available_builtin_endpoints_tag] = 101; expected[vendor_id_tag] = Qos::array(); expected[vendor_id_tag].push_back(0x01); expected[vendor_id_tag].push_back(0x0F); diff --git a/test/unittest/StatisticsBackend/CMakeLists.txt b/test/unittest/StatisticsBackend/CMakeLists.txt index cdaa170cf..8382531d1 100644 --- a/test/unittest/StatisticsBackend/CMakeLists.txt +++ b/test/unittest/StatisticsBackend/CMakeLists.txt @@ -38,12 +38,10 @@ add_executable(statistics_backend_tests StatisticsBackendTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -61,7 +59,7 @@ target_include_directories(statistics_backend_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(statistics_backend_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(statistics_backend_tests TEST_FRIENDLY_PATH) @@ -104,12 +102,10 @@ add_executable(calling_user_listeners_tests CallingUserListenersTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -122,7 +118,7 @@ target_include_directories(calling_user_listeners_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(calling_user_listeners_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) if(MSVC) target_compile_definitions(calling_user_listeners_tests @@ -313,12 +309,10 @@ add_executable(init_monitor_tests InitMonitorTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -337,7 +331,7 @@ target_include_directories(init_monitor_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(init_monitor_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(init_monitor_tests TEST_FRIENDLY_PATH) @@ -380,12 +374,10 @@ add_executable(init_monitor_factory_fails_tests InitMonitorFactoryFailsTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -410,7 +402,7 @@ target_include_directories(init_monitor_factory_fails_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(init_monitor_factory_fails_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(init_monitor_factory_fails_tests TEST_FRIENDLY_PATH) @@ -463,12 +455,10 @@ add_executable(get_data_tests GetDataTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -486,7 +476,7 @@ target_include_directories(get_data_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(get_data_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(get_data_tests TEST_FRIENDLY_PATH) @@ -559,12 +549,10 @@ if(GTEST_FOUND AND GMOCK_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -584,7 +572,7 @@ if(GTEST_FOUND AND GMOCK_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(is_active_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(is_active_tests TEST_FRIENDLY_PATH) @@ -626,12 +614,10 @@ if(GTEST_FOUND AND GMOCK_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -649,7 +635,7 @@ if(GTEST_FOUND AND GMOCK_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(is_metatraffic_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(is_metatraffic_tests TEST_FRIENDLY_PATH) @@ -687,12 +673,10 @@ add_executable(backend_dump_tests BackendDumpTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -710,7 +694,7 @@ target_include_directories(backend_dump_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(backend_dump_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(backend_dump_tests TEST_FRIENDLY_PATH) @@ -746,12 +730,10 @@ add_executable(clear_statistics_data_tests ClearDataTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -769,7 +751,7 @@ target_include_directories(clear_statistics_data_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(clear_statistics_data_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(clear_statistics_data_tests TEST_FRIENDLY_PATH) @@ -804,12 +786,10 @@ add_executable(get_status_data_tests GetStatusDataTests.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -827,7 +807,7 @@ target_include_directories(get_status_data_tests PRIVATE ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(get_status_data_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(get_status_data_tests TEST_FRIENDLY_PATH) @@ -870,12 +850,10 @@ if(GTEST_FOUND AND GMOCK_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -895,7 +873,7 @@ if(GTEST_FOUND AND GMOCK_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(clear_inactive_entities_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(clear_inactive_entities_tests TEST_FRIENDLY_PATH) diff --git a/test/unittest/StatisticsBackend/CallingUserListenersTests.cpp b/test/unittest/StatisticsBackend/CallingUserListenersTests.cpp index d9e075ebc..4bdc14273 100644 --- a/test/unittest/StatisticsBackend/CallingUserListenersTests.cpp +++ b/test/unittest/StatisticsBackend/CallingUserListenersTests.cpp @@ -19,8 +19,6 @@ #include #include #include -#include - #include #include #include @@ -28,11 +26,13 @@ #include #include #include +#include #include #include #include #include +#include using ::testing::_; using ::testing::Invoke; @@ -1736,13 +1736,13 @@ class calling_user_listeners_tests_end_to_end : public ::testing::Test eprosima::fastdds::dds::DataReaderListener* reader_listener_; eprosima::fastdds::dds::DomainParticipant* participant_; - eprosima::fastrtps::rtps::GUID_t participant_guid_; + eprosima::fastdds::rtps::GUID_t participant_guid_; std::string participant_guid_str_ = "01.0f.00.00.00.00.00.00.00.00.00.00|0.0.1.c1"; std::string participant_name_ = "Participant"; - eprosima::fastrtps::rtps::GUID_t datareader_guid_; + eprosima::fastdds::rtps::GUID_t datareader_guid_; std::string datareader_guid_str_ = "01.0f.00.00.00.00.00.00.00.00.00.00|0.0.0.1"; - eprosima::fastrtps::rtps::GUID_t datawriter_guid_; + eprosima::fastdds::rtps::GUID_t datawriter_guid_; std::string datawriter_guid_str_ = "01.0f.00.00.00.00.00.00.00.00.00.00|0.0.0.2"; std::string topic_name_ = "Topic"; @@ -1750,7 +1750,7 @@ class calling_user_listeners_tests_end_to_end : public ::testing::Test }; -// Windows dll does not export ParticipantProxyData class members (private APIs) +// Windows dll does not export ParticipantBuiltinTopicData class members (private APIs) #if !defined(_WIN32) /* * This test is a pseudo-blackbox that checks that user listeners are called @@ -1826,23 +1826,23 @@ TEST_F(calling_user_listeners_tests_end_to_end, entity_discovery_end_to_end) .WillOnce(Invoke(&participant_locator_discovery_args, &PhysicalEntityDiscoveryArgs::on_discovery)); // Simulate the discovery of a participant - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes attributes; - eprosima::fastrtps::rtps::ParticipantProxyData participant_data(attributes); - participant_data.m_guid = participant_guid_; - participant_data.m_participantName = participant_name_; + eprosima::fastdds::rtps::ParticipantBuiltinTopicData participant_data; + participant_data.guid = participant_guid_; + participant_data.participant_name = participant_name_; // The participant locator - eprosima::fastrtps::rtps::Locator_t participant_locator(LOCATOR_KIND_UDPv4, 2049); + eprosima::fastdds::rtps::Locator_t participant_locator(LOCATOR_KIND_UDPv4, 2049); participant_locator.address[12] = 127; participant_locator.address[15] = 1; participant_data.default_locators.add_unicast_locator(participant_locator); // Finish building the discovered participant info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo participant_info(participant_data); - participant_info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; // Execution: Call the listener - participant_listener_->on_participant_discovery(participant_, std::move(participant_info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the participant + participant_listener_->on_participant_discovery(participant_, status, participant_data, should_be_ignored); details::StatisticsBackendData::get_instance()->entity_queue_->flush(); // Check that the participant was created OK @@ -1908,27 +1908,27 @@ TEST_F(calling_user_listeners_tests_end_to_end, entity_discovery_end_to_end) .WillOnce(Invoke(&writer_locator_discovery_args, &PhysicalEntityDiscoveryArgs::on_discovery)); // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData writer_data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData writer_info; // The discovered writer is in the participant - writer_data.guid(datawriter_guid_); + writer_info.guid = datawriter_guid_; // The discovered writer is in the topic - writer_data.topicName(topic_name_); - writer_data.typeName(topic_type_); + writer_info.topic_name = topic_name_; + writer_info.type_name = topic_type_; // The discovered writer contains the locator - eprosima::fastrtps::rtps::Locator_t writer_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t writer_locator(LOCATOR_KIND_UDPv4, 1024); writer_locator.address[12] = 127; writer_locator.address[15] = 1; - writer_data.add_unicast_locator(writer_locator); + writer_info.remote_locators.add_unicast_locator(writer_locator); // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo writer_info(writer_data); - writer_info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER; + eprosima::fastdds::rtps::WriterDiscoveryStatus writer_status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; // Execution: Call the listener - participant_listener_->on_publisher_discovery(participant_, std::move(writer_info)); + participant_listener_->on_data_writer_discovery(participant_, writer_status, writer_info, should_be_ignored); details::StatisticsBackendData::get_instance()->entity_queue_->flush(); // Check that the writer was created OK @@ -1992,27 +1992,33 @@ TEST_F(calling_user_listeners_tests_end_to_end, entity_discovery_end_to_end) .WillOnce(Invoke(&reader_locator_discovery_args, &PhysicalEntityDiscoveryArgs::on_discovery)); // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData reader_data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData reader_data; + + // Set max number of unicast/multicast locators + reader_data.remote_locators.unicast = + eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + reader_data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration( + 1); // The discovered reader is in the participant - reader_data.guid(datareader_guid_); + reader_data.guid = datareader_guid_; // The discovered reader is in the topic - reader_data.topicName(topic_name_); - reader_data.typeName(topic_type_); + reader_data.topic_name = topic_name_; + reader_data.type_name = topic_type_; // The discovered reader contains the locator - eprosima::fastrtps::rtps::Locator_t reader_locator(LOCATOR_KIND_UDPv4, 2048); + eprosima::fastdds::rtps::Locator_t reader_locator(LOCATOR_KIND_UDPv4, 2048); reader_locator.address[12] = 127; reader_locator.address[15] = 1; - reader_data.add_unicast_locator(reader_locator); + reader_data.remote_locators.add_unicast_locator(reader_locator); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo reader_info(reader_data); - reader_info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERED_READER; + eprosima::fastdds::rtps::ReaderDiscoveryStatus reader_status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; // Execution: Call the listener - participant_listener_->on_subscriber_discovery(participant_, std::move(reader_info)); + participant_listener_->on_data_reader_discovery(participant_, reader_status, reader_data, should_be_ignored); details::StatisticsBackendData::get_instance()->entity_queue_->flush(); // Check that the reader was created OK @@ -2080,27 +2086,33 @@ TEST_F(calling_user_listeners_tests_end_to_end, entity_discovery_end_to_end) .WillOnce(Invoke(&datareader2_discovery_args, &DomainEntityDiscoveryArgs::on_discovery)); // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData reader2_data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData reader2_data; + + // Set max number of unicast/multicast locators + reader2_data.remote_locators.unicast = + eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + reader2_data.remote_locators.multicast = + eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // The discovered reader is in the participant - eprosima::fastrtps::rtps::GUID_t datareader2_guid_; + eprosima::fastdds::rtps::GUID_t datareader2_guid_; std::stringstream("01.0f.00.00.00.00.00.00.00.00.00.00|0.0.0.3") >> datareader2_guid_; - reader2_data.guid(datareader2_guid_); + reader2_data.guid = datareader2_guid_; // The discovered reader is in the topic std::string topic2_name = "Topic2"; - reader2_data.topicName(topic2_name); - reader2_data.typeName(topic_type_); + reader2_data.topic_name = topic2_name; + reader2_data.type_name = topic_type_; // The discovered reader contains the locator - reader2_data.add_unicast_locator(writer_locator); + reader2_data.remote_locators.add_unicast_locator(writer_locator); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo reader2_info(reader2_data); - reader2_info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERED_READER; + eprosima::fastdds::rtps::ReaderDiscoveryStatus reader2_status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; // Execution: Call the listener - participant_listener_->on_subscriber_discovery(participant_, std::move(reader2_info)); + participant_listener_->on_data_reader_discovery(participant_, reader2_status, reader2_data, should_be_ignored); details::StatisticsBackendData::get_instance()->entity_queue_->flush(); // Check that the reader was created OK @@ -2149,26 +2161,26 @@ TEST_F(calling_user_listeners_tests_end_to_end, entity_discovery_end_to_end) .WillOnce(Invoke(&datawriter2_discovery_args, &DomainEntityDiscoveryArgs::on_discovery)); // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData writer2_data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData writer2_info; // The discovered writer is in the participant - eprosima::fastrtps::rtps::GUID_t datawriter2_guid_; + eprosima::fastdds::rtps::GUID_t datawriter2_guid_; std::stringstream("01.0f.00.00.00.00.00.00.00.00.00.00|0.0.0.4") >> datawriter2_guid_; - writer2_data.guid(datawriter2_guid_); + writer2_info.guid = datawriter2_guid_; // The discovered writer contains the locator - writer2_data.add_unicast_locator(reader_locator); + writer2_info.remote_locators.add_unicast_locator(reader_locator); // The discovered writer is in the topic - writer2_data.topicName(topic2_name); - writer2_data.typeName(topic_type_); + writer2_info.topic_name = topic2_name; + writer2_info.type_name = topic_type_; // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo writer2_info(writer2_data); - writer2_info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER; + eprosima::fastdds::rtps::WriterDiscoveryStatus writer2_status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; // Execution: Call the listener - participant_listener_->on_publisher_discovery(participant_, std::move(writer2_info)); + participant_listener_->on_data_writer_discovery(participant_, writer2_status, writer2_info, should_be_ignored); details::StatisticsBackendData::get_instance()->entity_queue_->flush(); // Check that the writer was created OK @@ -2214,11 +2226,13 @@ TEST_F(calling_user_listeners_tests_end_to_end, entity_discovery_end_to_end) EXPECT_CALL(domain_listener_, on_datawriter_discovery(monitor_id_, _, _)).Times(1) .WillOnce(Invoke(&datawriter_undiscovery_args, &DomainEntityDiscoveryArgs::on_discovery)); - eprosima::fastrtps::rtps::WriterDiscoveryInfo writer_undiscovery_info (writer_data); - writer_undiscovery_info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER; + eprosima::fastdds::rtps::PublicationBuiltinTopicData writer_undiscovery_info = writer_info; + eprosima::fastdds::rtps::WriterDiscoveryStatus writer_undiscovery_status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER; // Execution: Call the listener - participant_listener_->on_publisher_discovery(participant_, std::move(writer_undiscovery_info)); + participant_listener_->on_data_writer_discovery(participant_, writer_undiscovery_status, writer_undiscovery_info, + should_be_ignored); details::StatisticsBackendData::get_instance()->entity_queue_->flush(); EXPECT_FALSE(writer->active); @@ -2266,11 +2280,13 @@ TEST_F(calling_user_listeners_tests_end_to_end, entity_discovery_end_to_end) EXPECT_CALL(domain_listener_, on_topic_discovery(monitor_id_, _, _)).Times(1) .WillOnce(Invoke(&topic_undiscovery_args, &DomainEntityDiscoveryArgs::on_discovery)); - eprosima::fastrtps::rtps::ReaderDiscoveryInfo reader_undiscovery_info(reader_data); - reader_undiscovery_info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER; + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData reader_undiscovery_info = reader_data; + eprosima::fastdds::rtps::ReaderDiscoveryStatus reader_undiscovery_status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER; // Execution: Call the listener - participant_listener_->on_subscriber_discovery(participant_, std::move(reader_undiscovery_info)); + participant_listener_->on_data_reader_discovery(participant_, reader_undiscovery_status, reader_undiscovery_info, + should_be_ignored); details::StatisticsBackendData::get_instance()->entity_queue_->flush(); EXPECT_FALSE(writer->active); @@ -2304,11 +2320,13 @@ TEST_F(calling_user_listeners_tests_end_to_end, entity_discovery_end_to_end) EXPECT_CALL(domain_listener_, on_datawriter_discovery(monitor_id_, _, _)).Times(1) .WillOnce(Invoke(&datawriter2_undiscovery_args, &DomainEntityDiscoveryArgs::on_discovery)); - eprosima::fastrtps::rtps::WriterDiscoveryInfo writer2_undiscovery_info (writer2_data); - writer2_undiscovery_info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER; + eprosima::fastdds::rtps::PublicationBuiltinTopicData writer2_undiscovery_info = writer2_info; + eprosima::fastdds::rtps::WriterDiscoveryStatus writer2_undiscovery_status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER; // Execution: Call the listener - participant_listener_->on_publisher_discovery(participant_, std::move(writer2_undiscovery_info)); + participant_listener_->on_data_writer_discovery(participant_, writer2_undiscovery_status, writer2_undiscovery_info, + should_be_ignored); details::StatisticsBackendData::get_instance()->entity_queue_->flush(); EXPECT_FALSE(writer2->active); @@ -2356,11 +2374,13 @@ TEST_F(calling_user_listeners_tests_end_to_end, entity_discovery_end_to_end) EXPECT_CALL(domain_listener_, on_topic_discovery(monitor_id_, _, _)).Times(1) .WillOnce(Invoke(&topic2_undiscovery_args, &DomainEntityDiscoveryArgs::on_discovery)); - eprosima::fastrtps::rtps::ReaderDiscoveryInfo reader2_undiscovery_info(reader2_data); - reader2_undiscovery_info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER; + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData reader2_undiscovery_info = reader2_data; + eprosima::fastdds::rtps::ReaderDiscoveryStatus reader2_undiscovery_info_status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER; // Execution: Call the listener - participant_listener_->on_subscriber_discovery(participant_, std::move(reader2_undiscovery_info)); + participant_listener_->on_data_reader_discovery(participant_, reader2_undiscovery_info_status, + reader2_undiscovery_info, should_be_ignored); details::StatisticsBackendData::get_instance()->entity_queue_->flush(); EXPECT_FALSE(writer2->active); @@ -2424,11 +2444,10 @@ TEST_F(calling_user_listeners_tests_end_to_end, entity_discovery_end_to_end) EXPECT_CALL(domain_listener_, on_datawriter_discovery(monitor_id_, _, _)).Times(1) .WillOnce(Invoke(&metatraffic_endpoint_undiscovery_args, &DomainEntityDiscoveryArgs::on_discovery)); - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo participant_undiscovery_info(participant_data); - participant_undiscovery_info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT; + status = eprosima::fastdds::rtps::ParticipantDiscoveryStatus::REMOVED_PARTICIPANT; // Execution: Call the listener - participant_listener_->on_participant_discovery(participant_, std::move(participant_undiscovery_info)); + participant_listener_->on_participant_discovery(participant_, status, participant_data, should_be_ignored); details::StatisticsBackendData::get_instance()->entity_queue_->flush(); EXPECT_FALSE(writer2->active); @@ -2511,34 +2530,35 @@ TEST_F(calling_user_listeners_tests_end_to_end, participant_proxy_data_end_to_en std::string participant_guid_str = participant_guid_str_prefix + "|" + participant_guid_str_suffix; - eprosima::fastrtps::rtps::GUID_t participant_guid_; + eprosima::fastdds::rtps::GUID_t participant_guid_; std::stringstream(participant_guid_str) >> participant_guid_; // Simulate the discovery of a participant - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes attributes; - eprosima::fastrtps::rtps::ParticipantProxyData participant_data(attributes); - participant_data.m_guid = participant_guid_; - participant_data.m_participantName = participant_name_; - - participant_data.m_properties.push_back("fastdds.application.id", app_id_str[int(app_id)]); - participant_data.m_properties.push_back("fastdds.application.metadata", metadata_); - participant_data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name); - participant_data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name); - participant_data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, + eprosima::fastdds::rtps::RTPSParticipantAllocationAttributes attributes; + eprosima::fastdds::rtps::ParticipantBuiltinTopicData participant_data; + participant_data.guid = participant_guid_; + participant_data.participant_name = participant_name_; + + participant_data.properties.push_back("fastdds.application.id", app_id_str[int(app_id)]); + participant_data.properties.push_back("fastdds.application.metadata", metadata_); + participant_data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name); + participant_data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name); + participant_data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_name); // The participant locator - eprosima::fastrtps::rtps::Locator_t participant_locator(LOCATOR_KIND_UDPv4, 2049); + eprosima::fastdds::rtps::Locator_t participant_locator(LOCATOR_KIND_UDPv4, 2049); participant_locator.address[12] = 127; participant_locator.address[15] = 1; participant_data.default_locators.add_unicast_locator(participant_locator); // Finish building the discovered participant info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo participant_info(participant_data); - participant_info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; // Execution: Call the listener - participant_listener_->on_participant_discovery(participant_, std::move(participant_info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener_->on_participant_discovery(participant_, status, participant_data, should_be_ignored); details::StatisticsBackendData::get_instance()->entity_queue_->flush(); // Check that the participant was created OK diff --git a/test/unittest/StatisticsBackend/ClearEntitiesTests.cpp b/test/unittest/StatisticsBackend/ClearEntitiesTests.cpp index 80256b488..448169e2b 100644 --- a/test/unittest/StatisticsBackend/ClearEntitiesTests.cpp +++ b/test/unittest/StatisticsBackend/ClearEntitiesTests.cpp @@ -23,6 +23,8 @@ #include #include +#include + using namespace eprosima::statistics_backend::subscriber; bool StatisticsBackendTest::has_database_been_set_ = false; @@ -157,29 +159,33 @@ TEST_F(clear_inactive_entities_tests, clear_inactive_entities_endpoint) // Simulate a DATA(Uw) for DataWriter { // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max unicast and multicast locators + data.remote_locators = eprosima::fastdds::rtps::RemoteLocatorList(1, 1); // The discovered writer is in the participant - eprosima::fastrtps::rtps::GUID_t writer_guid_; + eprosima::fastdds::rtps::GUID_t writer_guid_; std::stringstream(datawriter->guid) >> writer_guid_; - data.guid(writer_guid_); + data.guid = writer_guid_; // The discovered writer is in the topic - data.topicName(topic->name); - data.typeName(topic->data_type); + data.topic_name = topic->name; + data.type_name = topic->data_type; // The discovered writer contains the locator - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; - data.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER; + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER; // Execution: Call the listener - participant_listener->on_publisher_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); } // Check that DataWriter is inactive @@ -201,29 +207,34 @@ TEST_F(clear_inactive_entities_tests, clear_inactive_entities_endpoint) // Simulate a DATA(Ur) for DataReader { // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max unicast and multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // The discovered reader is in the participant - eprosima::fastrtps::rtps::GUID_t reader_guid_; + eprosima::fastdds::rtps::GUID_t reader_guid_; std::stringstream(datareader->guid) >> reader_guid_; - data.guid(reader_guid_); + data.guid = reader_guid_; // The discovered reader is in the topic - data.topicName(topic->name); - data.typeName(topic->data_type); + data.topic_name = topic->name; + data.type_name = topic->data_type; // The discovered reader contains the locator - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; - data.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER; + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER; // Execution: Call the listener - participant_listener->on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); } // Check that DataReader is inactive, and thus topic @@ -251,21 +262,22 @@ TEST_F(clear_inactive_entities_tests, clear_inactive_entities_participant) // Simulate a DATA(Up) for Participant // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - eprosima::fastrtps::rtps::GUID_t participant_guid_; + eprosima::fastdds::rtps::GUID_t participant_guid_; std::stringstream(participant->guid) >> participant_guid_; - data.m_guid = participant_guid_; - data.m_participantName = participant->name; + data.guid = participant_guid_; + data.participant_name = participant->name; // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT; + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT; // Execution: Call the listener - participant_listener->on_participant_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_participant_discovery(&statistics_participant, status, data, should_be_ignored); // Check that entities are not alive ASSERT_FALSE(StatisticsBackendTest::is_active(participant->id)); diff --git a/test/unittest/StatisticsBackend/GetStatusDataTests.cpp b/test/unittest/StatisticsBackend/GetStatusDataTests.cpp index f39b488cb..13d88f126 100644 --- a/test/unittest/StatisticsBackend/GetStatusDataTests.cpp +++ b/test/unittest/StatisticsBackend/GetStatusDataTests.cpp @@ -69,14 +69,14 @@ class get_status_data_tests : public ::testing::Test db_->insert(domain_->id, datareader_->id, proxy_sample_); eprosima::fastdds::statistics::Connection connection_sample; - connection_sample.mode(eprosima::fastdds::statistics::DATA_SHARING); + connection_sample.mode(eprosima::fastdds::statistics::ConnectionMode::DATA_SHARING); eprosima::fastdds::statistics::detail::GUID_s guid_s; - eprosima::fastrtps::rtps::GUID_t guid_t; + eprosima::fastdds::rtps::GUID_t guid_t; std::stringstream guid_str("01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.1.c1"); guid_str >> guid_t; memcpy(guid_s.guidPrefix().value().data(), guid_t.guidPrefix.value, - eprosima::fastrtps::rtps::GuidPrefix_t::size); - memcpy(guid_s.entityId().value().data(), guid_t.entityId.value, eprosima::fastrtps::rtps::EntityId_t::size); + eprosima::fastdds::rtps::GuidPrefix_t::size); + memcpy(guid_s.entityId().value().data(), guid_t.entityId.value, eprosima::fastdds::rtps::EntityId_t::size); connection_sample.guid(guid_s); eprosima::fastdds::statistics::detail::Locator_s locator; locator.kind(1); diff --git a/test/unittest/StatisticsBackend/InitMonitorFactoryFailsTests.cpp b/test/unittest/StatisticsBackend/InitMonitorFactoryFailsTests.cpp index bf6ed7466..0a9a6d453 100644 --- a/test/unittest/StatisticsBackend/InitMonitorFactoryFailsTests.cpp +++ b/test/unittest/StatisticsBackend/InitMonitorFactoryFailsTests.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -40,9 +41,11 @@ #include #include #include + +#include +#include + #include -#include -#include using namespace eprosima::statistics_backend; using namespace eprosima::fastdds::dds; @@ -167,16 +170,16 @@ class init_monitor_factory_fails_tests : public ::testing::Test .WillByDefault(ReturnRef(datareader_qos_)); ON_CALL(domain_participant_, register_type(_, _)) - .WillByDefault(Return(eprosima::fastrtps::types::ReturnCode_t::RETCODE_OK)); + .WillByDefault(Return(eprosima::fastdds::dds::RETCODE_OK)); for (auto topic_type : topic_types_) { - topics_[topic_type.first] = Topic(topic_type.first, topic_type.second->getName()); - ON_CALL(domain_participant_, create_topic(topic_type.first, topic_type.second->getName(), _, _, _)) + topics_[topic_type.first] = Topic(topic_type.first, topic_type.second->get_name()); + ON_CALL(domain_participant_, create_topic(topic_type.first, topic_type.second->get_name(), _, _, _)) .WillByDefault(Return(&topics_[topic_type.first])); - ON_CALL(domain_participant_, create_topic(topic_type.first, topic_type.second->getName(), _, _)) + ON_CALL(domain_participant_, create_topic(topic_type.first, topic_type.second->get_name(), _, _)) .WillByDefault(Return(&topics_[topic_type.first])); - ON_CALL(domain_participant_, create_topic(topic_type.first, topic_type.second->getName(), _)) + ON_CALL(domain_participant_, create_topic(topic_type.first, topic_type.second->get_name(), _)) .WillByDefault(Return(&topics_[topic_type.first])); ON_CALL(domain_participant_, lookup_topicdescription(topic_type.first)) @@ -205,7 +208,6 @@ class init_monitor_factory_fails_tests : public ::testing::Test { DomainId domain_id = 0; DomainListener domain_listener; - std::string server_guid_prefix = "44.53.01.5f.45.50.52.4f.53.49.4d.41"; std::string server_locators = "UDPv4:[127.0.0.1]:11811"; EXPECT_THROW(StatisticsBackend::init_monitor( @@ -218,19 +220,12 @@ class init_monitor_factory_fails_tests : public ::testing::Test &domain_listener, all_callback_mask_, all_datakind_mask_), Error); - EXPECT_THROW(StatisticsBackend::init_monitor( - server_guid_prefix, - server_locators, - &domain_listener, - all_callback_mask_, - all_datakind_mask_), Error); } void check_init_monitor_discovery_server_failure( const std::string& server_locators) { DomainListener domain_listener; - std::string server_guid_prefix = "44.53.01.5f.45.50.52.4f.53.49.4d.41"; EXPECT_THROW(StatisticsBackend::init_monitor( server_locators, @@ -238,7 +233,6 @@ class init_monitor_factory_fails_tests : public ::testing::Test all_callback_mask_, all_datakind_mask_), BadParameter); EXPECT_THROW(StatisticsBackend::init_monitor( - server_guid_prefix, server_locators, &domain_listener, all_callback_mask_, @@ -271,13 +265,13 @@ TEST_F(init_monitor_factory_fails_tests, init_monitor_participant_creation_fails check_init_monitor_failure(); // 3 calls expected to create_participant - ASSERT_EQ(domain_participant_factory_->create_participant_count, 3u); + ASSERT_EQ(domain_participant_factory_->create_participant_count, 2u); } TEST_F(init_monitor_factory_fails_tests, init_monitor_subscriber_creation_fails) { // Expect failure on the subscriber creation - EXPECT_CALL(domain_participant_, create_subscriber(_, _, _)).Times(3) + EXPECT_CALL(domain_participant_, create_subscriber(_, _, _)).Times(2) .WillRepeatedly(Return(nullptr)); check_init_monitor_failure(); @@ -286,7 +280,7 @@ TEST_F(init_monitor_factory_fails_tests, init_monitor_subscriber_creation_fails) TEST_F(init_monitor_factory_fails_tests, init_monitor_datareader_creation_fails) { // Expect failure on the datareader creation - EXPECT_CALL(subscriber_, create_datareader(_, _, _, _)).Times(3) + EXPECT_CALL(subscriber_, create_datareader(_, _, _, _)).Times(2) .WillRepeatedly(Return(nullptr)); check_init_monitor_failure(); @@ -310,7 +304,7 @@ TEST_F(init_monitor_factory_fails_tests, init_monitor_register_type_fails) { // Expect failure on the type registration ON_CALL(domain_participant_, register_type(_, _)) - .WillByDefault(Return(eprosima::fastrtps::types::ReturnCode_t::RETCODE_PRECONDITION_NOT_MET)); + .WillByDefault(Return(eprosima::fastdds::dds::RETCODE_PRECONDITION_NOT_MET)); check_init_monitor_failure(); } @@ -348,20 +342,11 @@ TEST_F(init_monitor_factory_fails_tests, init_monitor_topic_exists) all_callback_mask_, all_datakind_mask_)); - EntityId monitor3; - EXPECT_NO_THROW(monitor3 = StatisticsBackend::init_monitor( - server_guid_prefix, - server_locators, - &domain_listener, - all_callback_mask_, - all_datakind_mask_)); - // IMPORTANT: It is required to stop monitors. // Otherwise, they will be stopped in Singleton destruction, what implies that are destructed after test // destruction, and thus the mock instances does not longer exist, so SEGFAULT served. StatisticsBackend::stop_monitor(monitor1); StatisticsBackend::stop_monitor(monitor2); - StatisticsBackend::stop_monitor(monitor3); } TEST_F(init_monitor_factory_fails_tests, init_monitor_topic_exists_with_another_type) diff --git a/test/unittest/StatisticsBackend/InitMonitorTests.cpp b/test/unittest/StatisticsBackend/InitMonitorTests.cpp index e91fddbf8..1e81eb6d3 100644 --- a/test/unittest/StatisticsBackend/InitMonitorTests.cpp +++ b/test/unittest/StatisticsBackend/InitMonitorTests.cpp @@ -23,13 +23,11 @@ #include #include #include -#include #include -#include -#include -#include +#include +#include +#include #include -#include #include #include @@ -42,13 +40,14 @@ #include #include #include -#include +#include + using namespace eprosima::statistics_backend; using namespace eprosima::fastdds::dds; using namespace eprosima::fastdds::rtps; using namespace eprosima::fastdds::statistics; -using namespace eprosima::fastrtps::rtps; +using namespace eprosima::fastdds::rtps; namespace test { @@ -168,7 +167,6 @@ class init_monitor_tests : public ::testing::Test std::map init_monitors( DomainId domain_id, DomainListener* domain_listener, - const std::string& server_guid_prefix, const std::string& server_locators, const CallbackMask& callback_mask, const DataKindMask& datakind_mask, @@ -189,30 +187,21 @@ class init_monitor_tests : public ::testing::Test datakind_mask, app_id, app_metadata); - EntityId monitor_id_2 = StatisticsBackend::init_monitor( - server_guid_prefix, - server_locators, - domain_listener, - callback_mask, - datakind_mask, - app_id, - app_metadata); EXPECT_TRUE(monitor_id.is_valid()); EXPECT_TRUE(monitor_id_1.is_valid()); - EXPECT_TRUE(monitor_id_2.is_valid()); std::map domain_monitors = test::get_monitors_from_database(); - /* Check that three monitors are created */ - EXPECT_EQ(domain_monitors.size(), 3u); + /* Check that two monitors are created */ + EXPECT_EQ(domain_monitors.size(), 2u); return domain_monitors; } void check_locator( - const RemoteServerAttributes& server_qos, + const DomainParticipantQos& server_qos, int32_t kind, const std::string& address, uint32_t port, @@ -236,42 +225,35 @@ class init_monitor_tests : public ::testing::Test // Look for it if (is_unicast) { - EXPECT_NE(std::find(server_qos.metatrafficUnicastLocatorList.begin(), - server_qos.metatrafficUnicastLocatorList.end(), locator), - server_qos.metatrafficUnicastLocatorList.end()); + EXPECT_NE(std::find(server_qos.wire_protocol().builtin.metatrafficUnicastLocatorList.begin(), + server_qos.wire_protocol().builtin.metatrafficUnicastLocatorList.end(), locator), + server_qos.wire_protocol().builtin.metatrafficUnicastLocatorList.end()); } else { - EXPECT_NE(std::find(server_qos.metatrafficMulticastLocatorList.begin(), - server_qos.metatrafficMulticastLocatorList.end(), locator), - server_qos.metatrafficMulticastLocatorList.end()); + EXPECT_NE(std::find(server_qos.wire_protocol().builtin.metatrafficMulticastLocatorList.begin(), + server_qos.wire_protocol().builtin.metatrafficMulticastLocatorList.end(), locator), + server_qos.wire_protocol().builtin.metatrafficMulticastLocatorList.end()); } } void check_participant_qos( const DomainParticipantQos& participant_qos, - const std::string& server_guid_prefix, const std::string& app_id = "", const std::string& app_metadata = "") { EXPECT_EQ(participant_qos.wire_protocol().builtin.discovery_config.discoveryProtocol, - eprosima::fastrtps::rtps::DiscoveryProtocol_t::SUPER_CLIENT); - - RemoteServerAttributes server_qos = - participant_qos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.front(); - GuidPrefix_t guid_prefix; - std::istringstream(server_guid_prefix) >> guid_prefix; - EXPECT_EQ(server_qos.guidPrefix, guid_prefix); + eprosima::fastdds::rtps::DiscoveryProtocol::SUPER_CLIENT); //Get data from participant discovery info auto get_property_value = - [](const eprosima::fastrtps::rtps::PropertySeq& properties, + [](const eprosima::fastdds::rtps::PropertySeq& properties, const std::string& property_name) -> std::string { auto property = std::find_if( properties.begin(), properties.end(), - [&](const eprosima::fastrtps::rtps::Property& property) + [&](const eprosima::fastdds::rtps::Property& property) { return property.name() == property_name; }); @@ -288,24 +270,13 @@ class init_monitor_tests : public ::testing::Test EXPECT_EQ(app_id_, app_id); EXPECT_EQ(app_metadata_, app_metadata); - check_locator(server_qos, LOCATOR_KIND_UDPv4, "127.0.0.1", 11811); + check_locator(participant_qos, LOCATOR_KIND_UDPv4, "127.0.0.1", 11811); } void check_dds_entities( - eprosima::statistics_backend::details::Monitor* monitor, - const std::string& server_guid_prefix = "", - const std::string& app_id = "", - const std::string& app_metadata = "") + eprosima::statistics_backend::details::Monitor* monitor) { EXPECT_NE(nullptr, monitor->participant); - - if (!server_guid_prefix.empty()) - { - DomainParticipantQos participant_qos; - monitor->participant->get_qos(participant_qos); - check_participant_qos(participant_qos, server_guid_prefix, app_id, app_metadata); - } - EXPECT_NE(nullptr, monitor->subscriber); for (auto topic : topic_types_) @@ -325,10 +296,9 @@ TEST_F(init_monitor_tests, init_monitor_domain_id_all_callback_all_data) { DomainId domain_id = 0; DomainListener domain_listener; - std::string server_guid_prefix = "44.53.01.5f.45.50.52.4f.53.49.4d.41"; std::string server_locators = "UDPv4:[127.0.0.1]:11811"; - auto domain_monitors = init_monitors(domain_id, &domain_listener, server_guid_prefix, server_locators, + auto domain_monitors = init_monitors(domain_id, &domain_listener, server_locators, all_callback_mask_, all_datakind_mask_); std::vector monitor_ids; @@ -354,8 +324,6 @@ TEST_F(init_monitor_tests, init_monitor_domain_id_all_callback_all_data) /* Check the created DDS entities */ check_dds_entities(domain_monitors[monitor_ids[0]]); - check_dds_entities(domain_monitors[monitor_ids[1]], DEFAULT_ROS2_SERVER_GUIDPREFIX); - check_dds_entities(domain_monitors[monitor_ids[2]], server_guid_prefix); // Stop the monitor to avoid interfering on the next test for (const auto& monitor : domain_monitors) @@ -368,12 +336,11 @@ TEST_F(init_monitor_tests, init_monitor_domain_id_all_callback_all_data_known_ap { DomainId domain_id = 0; DomainListener domain_listener; - std::string server_guid_prefix = "44.53.01.5f.45.50.52.4f.53.49.4d.41"; std::string server_locators = "UDPv4:[127.0.0.1]:11811"; std::string app_id = app_id_str[(int)AppId::FASTDDS_MONITOR]; std::string app_metadata = "metadata"; - auto domain_monitors = init_monitors(domain_id, &domain_listener, server_guid_prefix, server_locators, + auto domain_monitors = init_monitors(domain_id, &domain_listener, server_locators, all_callback_mask_, all_datakind_mask_, app_id, app_metadata); std::vector monitor_ids; @@ -398,9 +365,7 @@ TEST_F(init_monitor_tests, init_monitor_domain_id_all_callback_all_data_known_ap } /* Check the created DDS entities */ - check_dds_entities(domain_monitors[monitor_ids[0]], "", app_id, app_metadata); - check_dds_entities(domain_monitors[monitor_ids[1]], DEFAULT_ROS2_SERVER_GUIDPREFIX, app_id, app_metadata); - check_dds_entities(domain_monitors[monitor_ids[2]], server_guid_prefix, app_id, app_metadata); + check_dds_entities(domain_monitors[monitor_ids[0]]); // Stop the monitor to avoid interfering on the next test for (const auto& monitor : domain_monitors) @@ -413,10 +378,9 @@ TEST_F(init_monitor_tests, init_monitor_domain_id_no_callback_all_data) { DomainId domain_id = 0; DomainListener domain_listener; - std::string server_guid_prefix = "44.53.01.5f.45.50.52.4f.53.49.4d.41"; std::string server_locators = "UDPv4:[localhost]:11811"; - auto domain_monitors = init_monitors(domain_id, &domain_listener, server_guid_prefix, server_locators, + auto domain_monitors = init_monitors(domain_id, &domain_listener, server_locators, CallbackMask::none(), all_datakind_mask_); std::vector monitor_ids; @@ -442,8 +406,6 @@ TEST_F(init_monitor_tests, init_monitor_domain_id_no_callback_all_data) /* Check the created DDS entities */ check_dds_entities(domain_monitors[monitor_ids[0]]); - check_dds_entities(domain_monitors[monitor_ids[1]], DEFAULT_ROS2_SERVER_GUIDPREFIX); - check_dds_entities(domain_monitors[monitor_ids[2]], server_guid_prefix); // Stop the monitor to avoid interfering on the next test for (const auto& monitor : domain_monitors) @@ -456,10 +418,9 @@ TEST_F(init_monitor_tests, init_monitor_domain_id_all_callback_no_data) { DomainId domain_id = 0; DomainListener domain_listener; - std::string server_guid_prefix = "44.53.01.5f.45.50.52.4f.53.49.4d.41"; std::string server_locators = "UDPv4:[127.0.0.1]:11811"; - auto domain_monitors = init_monitors(domain_id, &domain_listener, server_guid_prefix, server_locators, + auto domain_monitors = init_monitors(domain_id, &domain_listener, server_locators, all_callback_mask_, DataKindMask::none()); std::vector monitor_ids; @@ -485,8 +446,6 @@ TEST_F(init_monitor_tests, init_monitor_domain_id_all_callback_no_data) /* Check the created DDS entities */ check_dds_entities(domain_monitors[monitor_ids[0]]); - check_dds_entities(domain_monitors[monitor_ids[1]], DEFAULT_ROS2_SERVER_GUIDPREFIX); - check_dds_entities(domain_monitors[monitor_ids[2]], server_guid_prefix); // Stop the monitor to avoid interfering on the next test for (const auto& monitor : domain_monitors) @@ -498,10 +457,9 @@ TEST_F(init_monitor_tests, init_monitor_domain_id_all_callback_no_data) TEST_F(init_monitor_tests, init_monitor_domain_id_null_listener_all_data) { DomainId domain_id = 0; - std::string server_guid_prefix = "44.53.01.5f.45.50.52.4f.53.49.4d.41"; std::string server_locators = "UDPv4:[localhost]:11811"; - auto domain_monitors = init_monitors(domain_id, nullptr, server_guid_prefix, server_locators, + auto domain_monitors = init_monitors(domain_id, nullptr, server_locators, all_callback_mask_, all_datakind_mask_); std::vector monitor_ids; @@ -527,8 +485,6 @@ TEST_F(init_monitor_tests, init_monitor_domain_id_null_listener_all_data) /* Check the created DDS entities */ check_dds_entities(domain_monitors[monitor_ids[0]]); - check_dds_entities(domain_monitors[monitor_ids[1]], DEFAULT_ROS2_SERVER_GUIDPREFIX); - check_dds_entities(domain_monitors[monitor_ids[2]], server_guid_prefix); // Stop the monitor to avoid interfering on the next test for (const auto& monitor : domain_monitors) @@ -594,10 +550,9 @@ TEST_F(init_monitor_tests, init_monitor_twice) { DomainId domain_id = 0; DomainListener domain_listener; - std::string server_guid_prefix = "44.53.01.5f.45.50.52.4f.53.49.4d.41"; std::string server_locators = "UDPv4:[127.0.0.1]:11811"; - init_monitors(domain_id, &domain_listener, server_guid_prefix, server_locators, + init_monitors(domain_id, &domain_listener, server_locators, all_callback_mask_, all_datakind_mask_); EXPECT_THROW(StatisticsBackend::init_monitor( @@ -610,17 +565,11 @@ TEST_F(init_monitor_tests, init_monitor_twice) nullptr, CallbackMask::none(), DataKindMask::none()), BadParameter); - EXPECT_THROW(StatisticsBackend::init_monitor( - server_guid_prefix, - server_locators, - nullptr, - CallbackMask::none(), - DataKindMask::none()), BadParameter); auto domain_monitors = test::get_monitors_from_database(); - /* Check that three monitors are created */ - EXPECT_EQ(domain_monitors.size(), 3u); + /* Check that two monitors are created */ + EXPECT_EQ(domain_monitors.size(), 2u); std::vector monitor_ids; for (const auto& monitor : domain_monitors) @@ -645,8 +594,6 @@ TEST_F(init_monitor_tests, init_monitor_twice) /* Check the created DDS entities */ check_dds_entities(domain_monitors[monitor_ids[0]]); - check_dds_entities(domain_monitors[monitor_ids[1]], DEFAULT_ROS2_SERVER_GUIDPREFIX); - check_dds_entities(domain_monitors[monitor_ids[2]], server_guid_prefix); // Stop the monitor to avoid interfering on the next test for (const auto& monitor : domain_monitors) @@ -675,18 +622,15 @@ TEST_F(init_monitor_tests, init_server_monitor_several_locators) domain_monitors[monitor_id]->participant->get_qos(participant_qos); EXPECT_EQ(participant_qos.wire_protocol().builtin.discovery_config.discoveryProtocol, - eprosima::fastrtps::rtps::DiscoveryProtocol_t::SUPER_CLIENT); - - const RemoteServerAttributes& server_qos = - participant_qos.wire_protocol().builtin.discovery_config.m_DiscoveryServers.front(); + eprosima::fastdds::rtps::DiscoveryProtocol::SUPER_CLIENT); - check_locator(server_qos, LOCATOR_KIND_UDPv4, "127.0.0.1", 11811); - check_locator(server_qos, LOCATOR_KIND_TCPv4, "127.0.0.1", 11812); - check_locator(server_qos, LOCATOR_KIND_UDPv6, "::1", 11813); - check_locator(server_qos, LOCATOR_KIND_TCPv6, "::1", 11814); + check_locator(participant_qos, LOCATOR_KIND_UDPv4, "127.0.0.1", 11811); + check_locator(participant_qos, LOCATOR_KIND_TCPv4, "127.0.0.1", 11812); + check_locator(participant_qos, LOCATOR_KIND_UDPv6, "::1", 11813); + check_locator(participant_qos, LOCATOR_KIND_TCPv6, "::1", 11814); - check_locator(server_qos, LOCATOR_KIND_UDPv4, "239.255.0.1", 11821, false); - check_locator(server_qos, LOCATOR_KIND_UDPv6, "ff1e::ffff:efff:1", 11823, false); + check_locator(participant_qos, LOCATOR_KIND_UDPv4, "239.255.0.1", 11821, false); + check_locator(participant_qos, LOCATOR_KIND_UDPv6, "ff1e::ffff:efff:1", 11823, false); // Stop the monitor to avoid interfering on the next test StatisticsBackend::stop_monitor(monitor_id); diff --git a/test/unittest/StatisticsBackend/IsActiveTests.cpp b/test/unittest/StatisticsBackend/IsActiveTests.cpp index 7b24c830d..f080e50ff 100644 --- a/test/unittest/StatisticsBackend/IsActiveTests.cpp +++ b/test/unittest/StatisticsBackend/IsActiveTests.cpp @@ -18,11 +18,14 @@ #include "fastdds/dds/domain/DomainParticipant.hpp" +#include "fastdds/utils/collections/ResourceLimitedContainerConfig.hpp" #include #include #include #include +#include + using namespace eprosima::statistics_backend::subscriber; bool StatisticsBackendTest::has_database_been_set_ = false; @@ -159,21 +162,21 @@ TEST_F(is_active_tests, participant) ASSERT_TRUE(StatisticsBackendTest::is_active(locator->id)); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - eprosima::fastrtps::rtps::GUID_t participant_guid_; + eprosima::fastdds::rtps::GUID_t participant_guid_; std::stringstream(participant->guid) >> participant_guid_; - data.m_guid = participant_guid_; - data.m_participantName = participant->name; + data.guid = participant_guid_; + data.participant_name = participant->name; // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT; + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT; // Execution: Call the listener - participant_listener->on_participant_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_participant_discovery(&statistics_participant, status, data, should_be_ignored); ASSERT_FALSE(StatisticsBackendTest::is_active(host->id)); ASSERT_FALSE(StatisticsBackendTest::is_active(user->id)); @@ -186,11 +189,10 @@ TEST_F(is_active_tests, participant) ASSERT_TRUE(StatisticsBackendTest::is_active(locator->id)); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo discover_info(data); - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; + status = eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; // Execution: Call the listener - participant_listener->on_participant_discovery(&statistics_participant, std::move(discover_info)); + participant_listener->on_participant_discovery(&statistics_participant, status, data, should_be_ignored); ASSERT_TRUE(StatisticsBackendTest::is_active(host->id)); ASSERT_TRUE(StatisticsBackendTest::is_active(user->id)); @@ -218,29 +220,33 @@ TEST_F(is_active_tests, datawriter) ASSERT_TRUE(StatisticsBackendTest::is_active(locator->id)); // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multiucast locators + data.remote_locators = eprosima::fastdds::rtps::RemoteLocatorList(1, 1); // The discovered writer is in the participant - eprosima::fastrtps::rtps::GUID_t writer_guid_; + eprosima::fastdds::rtps::GUID_t writer_guid_; std::stringstream(datawriter->guid) >> writer_guid_; - data.guid(writer_guid_); + data.guid = writer_guid_; // The discovered writer is in the topic - data.topicName(topic->name); - data.typeName(topic->data_type); + data.topic_name = topic->name; + data.type_name = topic->data_type; // The discovered writer contains the locator - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; - data.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER; + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER; // Execution: Call the listener - participant_listener->on_publisher_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); ASSERT_TRUE(StatisticsBackendTest::is_active(host->id)); ASSERT_TRUE(StatisticsBackendTest::is_active(user->id)); @@ -253,11 +259,13 @@ TEST_F(is_active_tests, datawriter) ASSERT_TRUE(StatisticsBackendTest::is_active(locator->id)); // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo discover_info(data); - discover_info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER; + eprosima::fastdds::rtps::PublicationBuiltinTopicData discover_info = data; + eprosima::fastdds::rtps::WriterDiscoveryStatus discover_info_status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; // Execution: Call the listener - participant_listener->on_publisher_discovery(&statistics_participant, std::move(discover_info)); + participant_listener->on_data_writer_discovery(&statistics_participant, discover_info_status, discover_info, + should_be_ignored); ASSERT_TRUE(StatisticsBackendTest::is_active(host->id)); ASSERT_TRUE(StatisticsBackendTest::is_active(user->id)); @@ -284,29 +292,35 @@ TEST_F(is_active_tests, datareader) ASSERT_TRUE(StatisticsBackendTest::is_active(locator->id)); // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + // Set max unicast and multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // The discovered reader is in the participant - eprosima::fastrtps::rtps::GUID_t reader_guid_; + eprosima::fastdds::rtps::GUID_t reader_guid_; std::stringstream(datareader->guid) >> reader_guid_; - data.guid(reader_guid_); + data.guid = reader_guid_; // The discovered reader is in the topic - data.topicName(topic->name); - data.typeName(topic->data_type); + data.topic_name = topic->name; + data.type_name = topic->data_type; // The discovered reader contains the locator - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; - data.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER; + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER; // Execution: Call the listener - participant_listener->on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); ASSERT_TRUE(StatisticsBackendTest::is_active(host->id)); ASSERT_TRUE(StatisticsBackendTest::is_active(user->id)); @@ -319,11 +333,13 @@ TEST_F(is_active_tests, datareader) ASSERT_TRUE(StatisticsBackendTest::is_active(locator->id)); // Finish building the discovered writer info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo discover_info(data); - discover_info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERED_READER; + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData discover_info = data; + eprosima::fastdds::rtps::ReaderDiscoveryStatus discover_info_status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; // Execution: Call the listener - participant_listener->on_subscriber_discovery(&statistics_participant, std::move(discover_info)); + participant_listener->on_data_reader_discovery(&statistics_participant, discover_info_status, discover_info, + should_be_ignored); ASSERT_TRUE(StatisticsBackendTest::is_active(host->id)); ASSERT_TRUE(StatisticsBackendTest::is_active(user->id)); @@ -349,53 +365,68 @@ TEST_F(is_active_tests, endpoints) ASSERT_TRUE(StatisticsBackendTest::is_active(datareader->id)); ASSERT_TRUE(StatisticsBackendTest::is_active(locator->id)); - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData writer_data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData writer_data; + + // Set max number of unicast/multiucast locators + writer_data.remote_locators.unicast = + eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + writer_data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration( + 1); // The discovered writer is in the participant - eprosima::fastrtps::rtps::GUID_t writer_guid_; + eprosima::fastdds::rtps::GUID_t writer_guid_; std::stringstream(datawriter->guid) >> writer_guid_; - writer_data.guid(writer_guid_); + writer_data.guid = writer_guid_; // The discovered writer is in the topic - writer_data.topicName(topic->name); - writer_data.typeName(topic->data_type); + writer_data.topic_name = topic->name; + writer_data.type_name = topic->data_type; // The discovered writer contains the locator - writer_data.add_unicast_locator(dds_existing_unicast_locator); + writer_data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo writer_info(writer_data); - writer_info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER; + eprosima::fastdds::rtps::WriterDiscoveryStatus writer_status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER; // Execution: Call the listener - participant_listener->on_publisher_discovery(&statistics_participant, std::move(writer_info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_data_writer_discovery(&statistics_participant, writer_status, writer_data, + should_be_ignored); // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData reader_data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData reader_data; + + // Set max number of unicast/multicast locators + reader_data.remote_locators.unicast = + eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + reader_data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration( + 1); // The discovered reader is in the participant - eprosima::fastrtps::rtps::GUID_t reader_guid_; + eprosima::fastdds::rtps::GUID_t reader_guid_; std::stringstream(datareader->guid) >> reader_guid_; - reader_data.guid(reader_guid_); + reader_data.guid = reader_guid_; // The discovered reader is in the topic - reader_data.topicName(topic->name); - reader_data.typeName(topic->data_type); + reader_data.topic_name = topic->name; + reader_data.type_name = topic->data_type; // The discovered reader contains the locator - reader_data.add_unicast_locator(dds_existing_unicast_locator); + reader_data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo reader_info(reader_data); - reader_info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER; + eprosima::fastdds::rtps::ReaderDiscoveryStatus reader_status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER; // Execution: Call the listener - participant_listener->on_subscriber_discovery(&statistics_participant, std::move(reader_info)); + participant_listener->on_data_reader_discovery(&statistics_participant, reader_status, reader_data, + should_be_ignored); ASSERT_TRUE(StatisticsBackendTest::is_active(host->id)); ASSERT_TRUE(StatisticsBackendTest::is_active(user->id)); @@ -408,18 +439,22 @@ TEST_F(is_active_tests, endpoints) ASSERT_TRUE(StatisticsBackendTest::is_active(locator->id)); // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo writer_discover_info(writer_data); - writer_discover_info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER; + eprosima::fastdds::rtps::PublicationBuiltinTopicData writer_discover_info = writer_data; + eprosima::fastdds::rtps::WriterDiscoveryStatus writer_discover_info_status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo reader_discover_info(reader_data); - reader_discover_info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERED_READER; + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData reader_discover_info = reader_data; + eprosima::fastdds::rtps::ReaderDiscoveryStatus reader_discover_info_status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; // Execution: Call the listener - participant_listener->on_publisher_discovery(&statistics_participant, std::move(writer_discover_info)); + participant_listener->on_data_writer_discovery(&statistics_participant, writer_discover_info_status, + writer_discover_info, should_be_ignored); // Execution: Call the listener - participant_listener->on_subscriber_discovery(&statistics_participant, std::move(reader_discover_info)); + participant_listener->on_data_reader_discovery(&statistics_participant, reader_discover_info_status, + reader_discover_info, should_be_ignored); ASSERT_TRUE(StatisticsBackendTest::is_active(host->id)); ASSERT_TRUE(StatisticsBackendTest::is_active(user->id)); @@ -441,79 +476,88 @@ TEST_F(is_active_tests, discover_datawriter_on_inactive_domain) // Participant undiscovered { // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - eprosima::fastrtps::rtps::GUID_t participant_guid_; + eprosima::fastdds::rtps::GUID_t participant_guid_; std::stringstream(participant->guid) >> participant_guid_; - data.m_guid = participant_guid_; - data.m_participantName = participant->name; + data.guid = participant_guid_; + data.participant_name = participant->name; - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host->name); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user->name); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process->name); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host->name); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user->name); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process->name); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT; + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT; // Execution: Call the listener - participant_listener->on_participant_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_participant_discovery(&statistics_participant, status, data, should_be_ignored); } // Datawriter undiscovered { // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multiucast locators + data.remote_locators = eprosima::fastdds::rtps::RemoteLocatorList(1, 1); // The discovered writer is in the participant - eprosima::fastrtps::rtps::GUID_t writer_guid_; + eprosima::fastdds::rtps::GUID_t writer_guid_; std::stringstream(datawriter->guid) >> writer_guid_; - data.guid(writer_guid_); + data.guid = writer_guid_; // The discovered writer is in the topic - data.topicName(topic->name); - data.typeName(topic->data_type); + data.topic_name = topic->name; + data.type_name = topic->data_type; // The discovered writer contains the locator - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; - data.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER; + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER; // Execution: Call the listener - participant_listener->on_publisher_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); } // Datareader undiscovered { // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // The discovered reader is in the participant - eprosima::fastrtps::rtps::GUID_t reader_guid_; + eprosima::fastdds::rtps::GUID_t reader_guid_; std::stringstream(datareader->guid) >> reader_guid_; - data.guid(reader_guid_); + data.guid = reader_guid_; // The discovered reader is in the topic - data.topicName(topic->name); - data.typeName(topic->data_type); + data.topic_name = topic->name; + data.type_name = topic->data_type; // The discovered reader contains the locator - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; - data.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER; + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER; // Execution: Call the listener - participant_listener->on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); } ASSERT_FALSE(StatisticsBackendTest::is_active(host->id)); @@ -533,25 +577,25 @@ TEST_F(is_active_tests, discover_datawriter_on_inactive_domain) // Discover new participant { // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - eprosima::fastrtps::rtps::GUID_t participant_guid_; + eprosima::fastdds::rtps::GUID_t participant_guid_; std::stringstream("01.0f.00.00.00.00.00.00.00.00.00.01|0.0.1.c1") >> participant_guid_; - data.m_guid = participant_guid_; - data.m_participantName = participant->name + "_1"; + data.guid = participant_guid_; + data.participant_name = participant->name + "_1"; - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host->name); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user->name); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, "process1"); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host->name); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user->name); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, "process1"); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; // Execution: Call the listener - participant_listener->on_participant_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_participant_discovery(&statistics_participant, status, data, should_be_ignored); } // Link participant - process @@ -573,29 +617,33 @@ TEST_F(is_active_tests, discover_datawriter_on_inactive_domain) // Discover new datawriter { // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multiucast locators + data.remote_locators = eprosima::fastdds::rtps::RemoteLocatorList(1, 1); // The discovered writer is in the participant - eprosima::fastrtps::rtps::GUID_t writer_guid_; + eprosima::fastdds::rtps::GUID_t writer_guid_; std::stringstream("01.0f.00.00.00.00.00.00.00.00.00.01|0.0.0.0") >> writer_guid_; - data.guid(writer_guid_); + data.guid = writer_guid_; // The discovered writer is in the topic - data.topicName(topic->name); - data.typeName(topic->data_type); + data.topic_name = topic->name; + data.type_name = topic->data_type; // The discovered writer contains the locator - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; - data.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::DISCOVERED_WRITER; + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; // Execution: Call the listener - participant_listener->on_publisher_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); } auto datawriter_id = @@ -621,79 +669,89 @@ TEST_F(is_active_tests, discover_datareader_on_inactive_domain) // Participant undiscovered { // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - eprosima::fastrtps::rtps::GUID_t participant_guid_; + eprosima::fastdds::rtps::GUID_t participant_guid_; std::stringstream(participant->guid) >> participant_guid_; - data.m_guid = participant_guid_; - data.m_participantName = participant->name; + data.guid = participant_guid_; + data.participant_name = participant->name; - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host->name); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user->name); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process->name); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host->name); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user->name); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process->name); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT; + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT; // Execution: Call the listener - participant_listener->on_participant_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_participant_discovery(&statistics_participant, status, data, should_be_ignored); } // Datareader undiscovered { // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // The discovered reader is in the participant - eprosima::fastrtps::rtps::GUID_t reader_guid_; + eprosima::fastdds::rtps::GUID_t reader_guid_; std::stringstream(datareader->guid) >> reader_guid_; - data.guid(reader_guid_); + data.guid = reader_guid_; // The discovered reader is in the topic - data.topicName(topic->name); - data.typeName(topic->data_type); + data.topic_name = topic->name; + data.type_name = topic->data_type; // The discovered reader contains the locator - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; - data.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER; + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER; // Execution: Call the listener - participant_listener->on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); } // Datawriter undiscovered { // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // The discovered writer is in the participant - eprosima::fastrtps::rtps::GUID_t writer_guid_; + eprosima::fastdds::rtps::GUID_t writer_guid_; std::stringstream(datawriter->guid) >> writer_guid_; - data.guid(writer_guid_); + data.guid = writer_guid_; // The discovered writer is in the topic - data.topicName(topic->name); - data.typeName(topic->data_type); + data.topic_name = topic->name; + data.type_name = topic->data_type; // The discovered writer contains the locator - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; - data.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER; + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER; // Execution: Call the listener - participant_listener->on_publisher_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); } ASSERT_FALSE(StatisticsBackendTest::is_active(host->id)); @@ -713,25 +771,25 @@ TEST_F(is_active_tests, discover_datareader_on_inactive_domain) // Discover new participant { // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - eprosima::fastrtps::rtps::GUID_t participant_guid_; + eprosima::fastdds::rtps::GUID_t participant_guid_; std::stringstream("01.0f.00.00.00.00.00.00.00.00.00.01|0.0.1.c1") >> participant_guid_; - data.m_guid = participant_guid_; - data.m_participantName = participant->name + "_1"; + data.guid = participant_guid_; + data.participant_name = participant->name + "_1"; - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host->name); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user->name); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, "process1"); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host->name); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user->name); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, "process1"); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; // Execution: Call the listener - participant_listener->on_participant_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_participant_discovery(&statistics_participant, status, data, should_be_ignored); } // Link participant - process @@ -753,29 +811,34 @@ TEST_F(is_active_tests, discover_datareader_on_inactive_domain) // Discover new datareader { // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // The discovered reader is in the participant - eprosima::fastrtps::rtps::GUID_t reader_guid_; + eprosima::fastdds::rtps::GUID_t reader_guid_; std::stringstream("01.0f.00.00.00.00.00.00.00.00.00.01|0.0.0.0") >> reader_guid_; - data.guid(reader_guid_); + data.guid = reader_guid_; // The discovered reader is in the topic - data.topicName(topic->name); - data.typeName(topic->data_type); + data.topic_name = topic->name; + data.type_name = topic->data_type; // The discovered reader contains the locator - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; - data.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); - info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERED_READER; + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; // Execution: Call the listener - participant_listener->on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener->on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); } auto datareader_id = diff --git a/test/unittest/StatisticsBackend/StatisticsBackendTests.cpp b/test/unittest/StatisticsBackend/StatisticsBackendTests.cpp index 59d01ebaa..67cd77ed8 100644 --- a/test/unittest/StatisticsBackend/StatisticsBackendTests.cpp +++ b/test/unittest/StatisticsBackend/StatisticsBackendTests.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include diff --git a/test/unittest/StatisticsParticipantListener/CMakeLists.txt b/test/unittest/StatisticsParticipantListener/CMakeLists.txt index 1b1867cd8..5d95c7966 100644 --- a/test/unittest/StatisticsParticipantListener/CMakeLists.txt +++ b/test/unittest/StatisticsParticipantListener/CMakeLists.txt @@ -27,12 +27,10 @@ if(GTEST_FOUND AND GMOCK_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp/exception/Exception.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/QosSerializer.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsParticipantListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -53,7 +51,7 @@ if(GTEST_FOUND AND GMOCK_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(statistics_participant_listener_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(statistics_participant_listener_tests TEST_FRIENDLY_PATH) diff --git a/test/unittest/StatisticsParticipantListener/StatisticsParticipantListenerTests.cpp b/test/unittest/StatisticsParticipantListener/StatisticsParticipantListenerTests.cpp index cde7e1f23..9299708b5 100644 --- a/test/unittest/StatisticsParticipantListener/StatisticsParticipantListenerTests.cpp +++ b/test/unittest/StatisticsParticipantListener/StatisticsParticipantListenerTests.cpp @@ -15,17 +15,21 @@ #include "fastdds/dds/domain/DomainParticipant.hpp" #include "subscriber/QosSerializer.hpp" -#include #include +#include #include -#include -#include + +#include +#include + +#include "fastdds/rtps/common/Locator.hpp" #include -#include "fastdds/rtps/common/Locator.h" +#include #include #include -#include + +#include using ::testing::_; using ::testing::Invoke; @@ -194,7 +198,7 @@ struct InsertEndpointArgs const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -209,7 +213,7 @@ struct InsertEndpointArgs const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -235,7 +239,7 @@ struct InsertEndpointArgs const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -246,7 +250,7 @@ struct InsertEndpointArgs std::string alias_; Qos qos_; bool is_virtual_metatraffic_; - eprosima::fastrtps::rtps::RemoteLocatorList locators_; + eprosima::fastdds::rtps::RemoteLocatorList locators_; EntityKind kind_; EntityId participant_id_; EntityId topic_id_; @@ -317,9 +321,9 @@ class statistics_participant_listener_tests : public ::testing::Test std::string participant_name_; Qos participant_qos_; std::string participant_prefix_str_; - eprosima::fastrtps::rtps::GuidPrefix_t guid_prefix_; + eprosima::fastdds::rtps::GuidPrefix_t guid_prefix_; std::string participant_guid_str_; - eprosima::fastrtps::rtps::GUID_t participant_guid_; + eprosima::fastdds::rtps::GUID_t participant_guid_; std::shared_ptr participant_; // Topic entity @@ -330,12 +334,12 @@ class statistics_participant_listener_tests : public ::testing::Test // Reader entity std::string reader_guid_str_; std::string reader_entity_id_str_; - eprosima::fastrtps::rtps::GUID_t reader_guid_; + eprosima::fastdds::rtps::GUID_t reader_guid_; // Writer entity std::string writer_guid_str_; std::string writer_entity_id_str_; - eprosima::fastrtps::rtps::GUID_t writer_guid_; + eprosima::fastdds::rtps::GUID_t writer_guid_; // Meaningful prefix for metatraffic entities const std::string metatraffic_prefix = "___EPROSIMA___METATRAFFIC___DOMAIN_0___"; @@ -426,18 +430,6 @@ class statistics_participant_listener_tests : public ::testing::Test default_multicast_locator = std::make_shared("UDPv4:[0.0.0.0]:4"); } - // Build the participant discovered info with participant_guid_ and participant_name_ - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo build_participant_discovered_info( - eprosima::fastrtps::rtps::ParticipantProxyData& data) - { - // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; - - // Finish building the discovered reader info - return eprosima::fastrtps::rtps::ParticipantDiscoveryInfo(data); - } - }; // Windows dll do not export ParticipantProxyData class members (private APIs) @@ -461,16 +453,16 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered) .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; + data.guid = participant_guid_; + data.participant_name = participant_name_; - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); // Precondition: The discovered participant has unicast and multicast locators associated data.metatraffic_locators.unicast.push_back(1); @@ -478,9 +470,6 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered) data.default_locators.unicast.push_back(3); data.default_locators.multicast.push_back(4); - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); - // Expectation: The Participant is added to the database. We do not care about the given ID InsertParticipantArgs insert_args([&]( const std::string& name, @@ -492,7 +481,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered) const std::string& app_metadata) { EXPECT_EQ(name, participant_name_); - EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(data)); EXPECT_EQ(guid, participant_guid_str_); EXPECT_EQ(domain_id, EntityId(0)); EXPECT_EQ(status, StatusLevel::OK_STATUS); @@ -556,7 +545,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -620,8 +609,10 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered) eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -631,10 +622,10 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_not_fir std::string participant_2_name = "participant_ name"; Qos participant_2_qos; std::string participant_2_prefix_str = "01.02.03.04.05.06.07.08.09.0a.0b.1c"; - eprosima::fastrtps::rtps::GuidPrefix_t guid_2_prefix; + eprosima::fastdds::rtps::GuidPrefix_t guid_2_prefix; std::stringstream(participant_2_prefix_str) >> guid_2_prefix; std::string participant_2_guid_str = participant_2_prefix_str + "|0.0.1.c1"; - eprosima::fastrtps::rtps::GUID_t participant_2_guid; + eprosima::fastdds::rtps::GUID_t participant_2_guid; std::stringstream(participant_2_guid_str) >> participant_2_guid; std::shared_ptr participant_2 = std::make_shared(participant_2_name, participant_2_qos, participant_2_guid_str, @@ -669,16 +660,15 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_not_fir .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_2_guid; - data.m_participantName = participant_2_name; + data.guid = participant_2_guid; + data.participant_name = participant_2_name; - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); // Precondition: The discovered participant has unicast and multicast locators associated data.metatraffic_locators.unicast.push_back(1); @@ -686,9 +676,6 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_not_fir data.default_locators.unicast.push_back(3); data.default_locators.multicast.push_back(4); - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); - // Expectation: The Participant_2 is added to the database. We do not care about the given ID InsertParticipantArgs insert_args([&]( const std::string& name, @@ -700,7 +687,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_not_fir const std::string& app_metadata) { EXPECT_EQ(name, participant_2_name); - EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(data)); EXPECT_EQ(guid, participant_2_guid_str); EXPECT_EQ(domain_id, EntityId(0)); EXPECT_EQ(status, StatusLevel::OK_STATUS); @@ -746,7 +733,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_not_fir const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -805,8 +792,10 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_not_fir eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -821,15 +810,11 @@ TEST_F(statistics_participant_listener_tests, new_participant_undiscovered) .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); + data.guid = participant_guid_; + data.participant_name = participant_name_; // Expectation: The Participant is not added to the database. EXPECT_CALL(database, insert_new_participant(_, _, _, _, _, _, _)).Times(0); @@ -838,11 +823,14 @@ TEST_F(statistics_participant_listener_tests, new_participant_undiscovered) EXPECT_CALL(database, change_entity_status(_, _)).Times(0); // Execution: Call the listener - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::REMOVED_PARTICIPANT; + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + status = eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT; + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); } // Test that discovers a participant without locators associated and an empty name. @@ -869,19 +857,15 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; + data.guid = participant_guid_; + data.participant_name = participant_name_; - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); // Expectation: The Participant is added to the database. We do not care about the given ID InsertParticipantArgs insert_args([&]( @@ -894,7 +878,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& app_metadata) { EXPECT_EQ(name, "localhost:09.0a.0b.0c"); - EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(data)); EXPECT_EQ(guid, participant_guid_str_); EXPECT_EQ(domain_id, EntityId(0)); EXPECT_EQ(status, StatusLevel::OK_STATUS); @@ -958,7 +942,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -1019,8 +1003,10 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -1047,22 +1033,18 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; - - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); + data.guid = participant_guid_; + data.participant_name = participant_name_; - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); // Precondition: The Unicast Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 37; dds_existing_unicast_locator.address[13] = 11; dds_existing_unicast_locator.address[14] = 18; @@ -1076,7 +1058,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n data.default_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The Unicast Metatraffic Locator exists and has ID 4 - eprosima::fastrtps::rtps::Locator_t dds_existing_metatraffic_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_metatraffic_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_metatraffic_unicast_locator.address[12] = 38; dds_existing_metatraffic_unicast_locator.address[13] = 12; dds_existing_metatraffic_unicast_locator.address[14] = 19; @@ -1090,7 +1072,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n data.metatraffic_locators.add_unicast_locator(dds_existing_metatraffic_unicast_locator); // Precondition: The Multicast Locator exists and has ID 5 - eprosima::fastrtps::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_multicast_locator.address[12] = 36; dds_existing_multicast_locator.address[13] = 10; dds_existing_multicast_locator.address[14] = 17; @@ -1104,7 +1086,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n data.default_locators.add_multicast_locator(dds_existing_multicast_locator); // Precondition: The Multicast Metatraffic Locator exists and has ID 6 - eprosima::fastrtps::rtps::Locator_t dds_existing_metatraffic_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_metatraffic_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_metatraffic_multicast_locator.address[12] = 47; dds_existing_metatraffic_multicast_locator.address[13] = 21; dds_existing_metatraffic_multicast_locator.address[14] = 28; @@ -1128,7 +1110,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& app_metadata) { EXPECT_EQ(name, "37.11.18.30:09.0a.0b.0c"); - EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(data)); EXPECT_EQ(guid, participant_guid_str_); EXPECT_EQ(domain_id, EntityId(0)); EXPECT_EQ(status, StatusLevel::OK_STATUS); @@ -1192,7 +1174,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -1256,8 +1238,10 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -1284,22 +1268,18 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; + data.guid = participant_guid_; + data.participant_name = participant_name_; - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); // Precondition: The Unicast Metatraffic Locator exists and has ID 4 - eprosima::fastrtps::rtps::Locator_t dds_existing_metatraffic_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_metatraffic_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_metatraffic_unicast_locator.address[12] = 37; dds_existing_metatraffic_unicast_locator.address[13] = 11; dds_existing_metatraffic_unicast_locator.address[14] = 18; @@ -1313,7 +1293,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n data.metatraffic_locators.add_unicast_locator(dds_existing_metatraffic_unicast_locator); // Precondition: The Multicast Locator exists and has ID 5 - eprosima::fastrtps::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_multicast_locator.address[12] = 36; dds_existing_multicast_locator.address[13] = 10; dds_existing_multicast_locator.address[14] = 17; @@ -1327,7 +1307,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n data.default_locators.add_multicast_locator(dds_existing_multicast_locator); // Precondition: The Multicast Metatraffic Locator exists and has ID 6 - eprosima::fastrtps::rtps::Locator_t dds_existing_metatraffic_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_metatraffic_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_metatraffic_multicast_locator.address[12] = 47; dds_existing_metatraffic_multicast_locator.address[13] = 21; dds_existing_metatraffic_multicast_locator.address[14] = 28; @@ -1351,7 +1331,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& app_metadata) { EXPECT_EQ(name, "37.11.18.30:09.0a.0b.0c"); - EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(data)); EXPECT_EQ(guid, participant_guid_str_); EXPECT_EQ(domain_id, EntityId(0)); EXPECT_EQ(status, StatusLevel::OK_STATUS); @@ -1415,7 +1395,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -1479,8 +1459,10 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -1524,22 +1506,19 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; - - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); + data.guid = participant_guid_; + data.participant_name = participant_name_; - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); // Precondition: The Multicast Locator exists and has ID 5 - eprosima::fastrtps::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds:: + rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_multicast_locator.address[12] = 37; dds_existing_multicast_locator.address[13] = 11; dds_existing_multicast_locator.address[14] = 18; @@ -1553,7 +1532,8 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n data.default_locators.add_multicast_locator(dds_existing_multicast_locator); // Precondition: The Multicast Metatraffic Locator exists and has ID 6 - eprosima::fastrtps::rtps::Locator_t dds_existing_metatraffic_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds:: + rtps::Locator_t dds_existing_metatraffic_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_metatraffic_multicast_locator.address[12] = 47; dds_existing_metatraffic_multicast_locator.address[13] = 21; dds_existing_metatraffic_multicast_locator.address[14] = 28; @@ -1577,7 +1557,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& app_metadata) { EXPECT_EQ(name, "37.11.18.30:09.0a.0b.0c"); - EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(data)); EXPECT_EQ(guid, participant_guid_str_); EXPECT_EQ(domain_id, EntityId(0)); EXPECT_EQ(status, StatusLevel::OK_STATUS); @@ -1641,7 +1621,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -1704,8 +1684,10 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -1732,22 +1714,18 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; + data.guid = participant_guid_; + data.participant_name = participant_name_; - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); // Precondition: The Multicast Metatraffic Locator exists and has ID 6 - eprosima::fastrtps::rtps::Locator_t dds_existing_metatraffic_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_metatraffic_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_metatraffic_multicast_locator.address[12] = 37; dds_existing_metatraffic_multicast_locator.address[13] = 11; dds_existing_metatraffic_multicast_locator.address[14] = 18; @@ -1771,7 +1749,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& app_metadata) { EXPECT_EQ(name, "37.11.18.30:09.0a.0b.0c"); - EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(data)); EXPECT_EQ(guid, participant_guid_str_); EXPECT_EQ(domain_id, EntityId(0)); EXPECT_EQ(status, StatusLevel::OK_STATUS); @@ -1835,7 +1813,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -1897,8 +1875,10 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -1925,22 +1905,18 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; - - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); + data.guid = participant_guid_; + data.participant_name = participant_name_; - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); // Precondition: The Unicast Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -1952,7 +1928,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n data.default_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The Unicast Metatraffic Locator exists and has ID 4 - eprosima::fastrtps::rtps::Locator_t dds_existing_metatraffic_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_metatraffic_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_metatraffic_unicast_locator.address[12] = 127; dds_existing_metatraffic_unicast_locator.address[15] = 1; std::string existing_metatraffic_unicast_locator_name = to_string(dds_existing_metatraffic_unicast_locator); @@ -1964,7 +1940,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n data.metatraffic_locators.add_unicast_locator(dds_existing_metatraffic_unicast_locator); // Precondition: The Multicast Locator exists and has ID 5 - eprosima::fastrtps::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_multicast_locator.address[12] = 127; dds_existing_multicast_locator.address[15] = 1; std::string existing_multicast_locator_name = to_string(dds_existing_multicast_locator); @@ -1976,7 +1952,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n data.default_locators.add_multicast_locator(dds_existing_multicast_locator); // Precondition: The Multicast Metatraffic Locator exists and has ID 6 - eprosima::fastrtps::rtps::Locator_t dds_existing_metatraffic_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_metatraffic_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_metatraffic_multicast_locator.address[12] = 127; dds_existing_metatraffic_multicast_locator.address[15] = 1; std::string existing_metatraffic_multicast_locator_name = to_string(dds_existing_metatraffic_multicast_locator); @@ -1998,7 +1974,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& app_metadata) { EXPECT_EQ(name, "localhost:09.0a.0b.0c"); - EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, participant_proxy_data_to_backend_qos(data)); EXPECT_EQ(guid, participant_guid_str_); EXPECT_EQ(domain_id, EntityId(0)); EXPECT_EQ(status, StatusLevel::OK_STATUS); @@ -2062,7 +2038,7 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -2127,8 +2103,10 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_empty_n eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -2148,21 +2126,20 @@ TEST_F(statistics_participant_listener_tests, new_participant_no_domain) .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); + data.guid = participant_guid_; + data.participant_name = participant_name_; // Expectation: No entity is added to the database EXPECT_CALL(database, insert_new_participant(_, _, _, _, _, _, _)).Times(1) .WillOnce(Throw(eprosima::statistics_backend::BadParameter("Error"))); - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); } TEST_F(statistics_participant_listener_tests, new_participant_discovered_participant_already_exists) @@ -2186,16 +2163,15 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_partici .WillOnce(Return(true)); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; + data.guid = participant_guid_; + data.participant_name = participant_name_; - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); // Precondition: The discovered participant has unicast and multicast locators associated data.metatraffic_locators.unicast.push_back(1); @@ -2203,9 +2179,6 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_partici data.default_locators.unicast.push_back(3); data.default_locators.multicast.push_back(4); - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); - // Expectation: The host already exists with ID 13, the user already exists with ID 14 and the process already exists with ID 15 ProcessPhysicalArgs process_physical_args([&]( @@ -2260,8 +2233,10 @@ TEST_F(statistics_participant_listener_tests, new_participant_discovered_partici eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener. - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -2277,19 +2252,15 @@ TEST_F(statistics_participant_listener_tests, new_participant_undiscovered_parti .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Start building the discovered reader info - eprosima::fastrtps::rtps::RTPSParticipantAllocationAttributes allocation; - eprosima::fastrtps::rtps::ParticipantProxyData data(allocation); + eprosima::fastdds::rtps::ParticipantBuiltinTopicData data; // Precondition: The discovered participant has the given GUID and name - data.m_guid = participant_guid_; - data.m_participantName = participant_name_; + data.guid = participant_guid_; + data.participant_name = participant_name_; - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); - data.m_properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ParticipantDiscoveryInfo info(data); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_host, host_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_user, user_name_); + data.properties.push_back(eprosima::fastdds::dds::parameter_policy_physical_data_process, process_pid_); // Expectation: The Participant is not inserted in the database. EXPECT_CALL(database, insert_new_participant(_, _, _, _, _, _, _)).Times(0); @@ -2339,11 +2310,13 @@ TEST_F(statistics_participant_listener_tests, new_participant_undiscovered_parti eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::UNDISCOVERY)).Times(2); // Execution: Call the listener. - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::REMOVED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + eprosima::fastdds::rtps::ParticipantDiscoveryStatus status = + eprosima::fastdds::rtps::ParticipantDiscoveryStatus::REMOVED_PARTICIPANT; + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); - info.status = eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DROPPED_PARTICIPANT; - participant_listener.on_participant_discovery(&statistics_participant, std::move(info)); + status = eprosima::fastdds::rtps::ParticipantDiscoveryStatus::DROPPED_PARTICIPANT; + participant_listener.on_participant_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -2364,7 +2337,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_discovered) .WillOnce(Return(true)); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -2373,20 +2346,21 @@ TEST_F(statistics_participant_listener_tests, new_reader_discovered) existing_unicast_locator->id = 3; // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered reader is in the participant - data.guid(reader_guid_); + data.guid = reader_guid_; // Precondition: The discovered reader is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered reader contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The Reader does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str_)).Times(AnyNumber()) @@ -2399,7 +2373,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_discovered) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -2408,9 +2382,9 @@ TEST_F(statistics_participant_listener_tests, new_reader_discovered) EXPECT_EQ(endpoint_guid, reader_guid_str_); EXPECT_EQ(name, std::string("DataReader_") + topic_->name + "_" + reader_entity_id_str_); EXPECT_EQ(alias, ""); - EXPECT_EQ(qos, reader_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, reader_proxy_data_to_backend_qos(data)); EXPECT_EQ(is_virtual_metatraffic, false); - EXPECT_EQ(locators.unicast[0], data.remote_locators().unicast[0]); + EXPECT_EQ(locators.unicast[0], data.remote_locators.unicast[0]); EXPECT_EQ(kind, EntityKind::DATAREADER); EXPECT_EQ(participant_id, EntityId(1)); @@ -2443,7 +2417,10 @@ TEST_F(statistics_participant_listener_tests, new_reader_discovered) eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - participant_listener.on_subscriber_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); } TEST_F(statistics_participant_listener_tests, new_reader_undiscovered) @@ -2458,7 +2435,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_undiscovered) std::make_pair(EntityId(0), EntityId(2))))); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -2467,20 +2444,21 @@ TEST_F(statistics_participant_listener_tests, new_reader_undiscovered) existing_unicast_locator->id = 3; // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered reader is in the participant - data.guid(reader_guid_); + data.guid = reader_guid_; // Precondition: The discovered reader is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered reader contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The Reader does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str_)).Times(AnyNumber()) @@ -2493,8 +2471,10 @@ TEST_F(statistics_participant_listener_tests, new_reader_undiscovered) EXPECT_CALL(database, change_entity_status(_, _)).Times(0); // Execution: Call the listener - info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER; - participant_listener.on_subscriber_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); } TEST_F(statistics_participant_listener_tests, new_reader_no_topic) @@ -2508,7 +2488,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_no_topic) .WillRepeatedly(Return(std::vector>())); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -2517,20 +2497,21 @@ TEST_F(statistics_participant_listener_tests, new_reader_no_topic) existing_unicast_locator->id = 3; // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered reader is in the participant - data.guid(reader_guid_); + data.guid = reader_guid_; // Precondition: The discovered reader is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered reader contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The Reader does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str_)).Times(AnyNumber()) @@ -2561,7 +2542,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_no_topic) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -2570,10 +2551,10 @@ TEST_F(statistics_participant_listener_tests, new_reader_no_topic) EXPECT_EQ(endpoint_guid, reader_guid_str_); EXPECT_EQ(name, std::string("DataReader_") + topic_->name + "_" + reader_entity_id_str_); EXPECT_EQ(alias, ""); - EXPECT_EQ(qos, reader_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, reader_proxy_data_to_backend_qos(data)); EXPECT_EQ(is_virtual_metatraffic, false); - EXPECT_EQ(locators.unicast[0], data.remote_locators().unicast[0]); + EXPECT_EQ(locators.unicast[0], data.remote_locators.unicast[0]); EXPECT_EQ(kind, EntityKind::DATAREADER); EXPECT_EQ(participant_id, EntityId(1)); @@ -2611,7 +2592,10 @@ TEST_F(statistics_participant_listener_tests, new_reader_no_topic) eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - participant_listener.on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; + participant_listener.on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); } TEST_F(statistics_participant_listener_tests, new_reader_several_topics) @@ -2650,7 +2634,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_topics) .WillOnce(Return(true)); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -2659,20 +2643,23 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_topics) existing_unicast_locator->id = 3; // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered reader is in the participant - data.guid(reader_guid_); + data.guid = reader_guid_; // Precondition: The discovered reader is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered reader contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); + - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); // Precondition: The Reader does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str_)).Times(AnyNumber()) @@ -2685,7 +2672,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_topics) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -2694,10 +2681,10 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_topics) EXPECT_EQ(endpoint_guid, reader_guid_str_); EXPECT_EQ(name, std::string("DataReader_") + topic_->name + "_" + reader_entity_id_str_); EXPECT_EQ(alias, ""); - EXPECT_EQ(qos, reader_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, reader_proxy_data_to_backend_qos(data)); EXPECT_EQ(is_virtual_metatraffic, false); - EXPECT_EQ(locators.unicast[0], data.remote_locators().unicast[0]); + EXPECT_EQ(locators.unicast[0], data.remote_locators.unicast[0]); EXPECT_EQ(kind, EntityKind::DATAREADER); EXPECT_EQ(participant_id, EntityId(1)); @@ -2730,7 +2717,10 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_topics) eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - participant_listener.on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; + participant_listener.on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); } TEST_F(statistics_participant_listener_tests, new_reader_several_locators) @@ -2750,7 +2740,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators) .WillOnce(Return(true)); // Precondition: One unicast Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -2759,7 +2749,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators) existing_unicast_locator->id = 3; // Precondition: One multicast Locator exists and has ID 4 - eprosima::fastrtps::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_multicast_locator.address[12] = 127; dds_existing_multicast_locator.address[15] = 2; std::string existing_multicast_locator_name = to_string(dds_existing_multicast_locator); @@ -2768,7 +2758,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators) existing_multicast_locator->id = 4; // Precondition: One unicast Locator does not exist - eprosima::fastrtps::rtps::Locator_t dds_new_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_new_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_new_unicast_locator.address[12] = 127; dds_new_unicast_locator.address[15] = 3; std::string new_unicast_locator_name = to_string(dds_new_unicast_locator); @@ -2776,7 +2766,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators) std::make_shared(new_unicast_locator_name); // Precondition: One multicast Locator does not exist - eprosima::fastrtps::rtps::Locator_t dds_new_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_new_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_new_multicast_locator.address[12] = 127; dds_new_multicast_locator.address[15] = 4; std::string new_multicast_locator_name = to_string(dds_new_multicast_locator); @@ -2787,23 +2777,26 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators) database.set_next_entity_id(next_entity_id); // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(2, 2); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(2); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(2); // Precondition: The discovered reader is in the participant - data.guid(reader_guid_); + data.guid = reader_guid_; // Precondition: The discovered reader is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered reader contains the locators - data.add_unicast_locator(dds_existing_unicast_locator); - data.add_unicast_locator(dds_new_unicast_locator); - data.add_multicast_locator(dds_existing_multicast_locator); - data.add_multicast_locator(dds_new_multicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_new_unicast_locator); + data.remote_locators.add_multicast_locator(dds_existing_multicast_locator); + data.remote_locators.add_multicast_locator(dds_new_multicast_locator); + - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); // Precondition: The Reader does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str_)).Times(AnyNumber()) @@ -2820,7 +2813,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -2829,13 +2822,13 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators) EXPECT_EQ(endpoint_guid, reader_guid_str_); EXPECT_EQ(name, std::string("DataReader_") + topic_->name + "_" + reader_entity_id_str_); EXPECT_EQ(alias, ""); - EXPECT_EQ(qos, reader_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, reader_proxy_data_to_backend_qos(data)); EXPECT_EQ(is_virtual_metatraffic, false); - EXPECT_EQ(locators.unicast[0], data.remote_locators().unicast[0]); - EXPECT_EQ(locators.multicast[0], data.remote_locators().multicast[0]); - EXPECT_EQ(locators.unicast[1], data.remote_locators().unicast[1]); - EXPECT_EQ(locators.multicast[1], data.remote_locators().multicast[1]); + EXPECT_EQ(locators.unicast[0], data.remote_locators.unicast[0]); + EXPECT_EQ(locators.multicast[0], data.remote_locators.multicast[0]); + EXPECT_EQ(locators.unicast[1], data.remote_locators.unicast[1]); + EXPECT_EQ(locators.multicast[1], data.remote_locators.multicast[1]); EXPECT_EQ(kind, EntityKind::DATAREADER); EXPECT_EQ(participant_id, EntityId(1)); @@ -2868,7 +2861,10 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators) eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - participant_listener.on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; + participant_listener.on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -2890,7 +2886,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators_no_hos .WillOnce(Return(true)); // Precondition: One unicast Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -2900,7 +2896,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators_no_hos existing_locators.push_back(existing_unicast_locator); // Precondition: One multicast Locator exists and has ID 4 - eprosima::fastrtps::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_multicast_locator.address[12] = 127; dds_existing_multicast_locator.address[15] = 2; std::string existing_multicast_locator_name = to_string(dds_existing_multicast_locator); @@ -2910,7 +2906,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators_no_hos existing_locators.push_back(existing_multicast_locator); // Precondition: One unicast Locator does not exist - eprosima::fastrtps::rtps::Locator_t dds_new_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_new_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_new_unicast_locator.address[12] = 127; dds_new_unicast_locator.address[15] = 3; std::string new_unicast_locator_name = to_string(dds_new_unicast_locator); @@ -2918,7 +2914,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators_no_hos std::make_shared(new_unicast_locator_name); // Precondition: One multicast Locator does not exist - eprosima::fastrtps::rtps::Locator_t dds_new_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_new_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_new_multicast_locator.address[12] = 127; dds_new_multicast_locator.address[15] = 4; std::string new_multicast_locator_name = to_string(dds_new_multicast_locator); @@ -2929,23 +2925,26 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators_no_hos database.set_next_entity_id(next_entity_id); // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(2, 2); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(2); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(2); // Precondition: The discovered reader is in the participant - data.guid(reader_guid_); + data.guid = reader_guid_; // Precondition: The discovered reader is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered reader contains the locators - data.add_unicast_locator(dds_existing_unicast_locator); - data.add_unicast_locator(dds_new_unicast_locator); - data.add_multicast_locator(dds_existing_multicast_locator); - data.add_multicast_locator(dds_new_multicast_locator); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_new_unicast_locator); + data.remote_locators.add_multicast_locator(dds_existing_multicast_locator); + data.remote_locators.add_multicast_locator(dds_new_multicast_locator); + - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); // Precondition: The Reader does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str_)).Times(AnyNumber()) @@ -2962,7 +2961,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators_no_hos const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -2971,13 +2970,13 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators_no_hos EXPECT_EQ(endpoint_guid, reader_guid_str_); EXPECT_EQ(name, std::string("DataReader_") + topic_->name + "_" + reader_entity_id_str_); EXPECT_EQ(alias, ""); - EXPECT_EQ(qos, reader_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, reader_proxy_data_to_backend_qos(data)); EXPECT_EQ(is_virtual_metatraffic, false); - EXPECT_EQ(locators.unicast[0], data.remote_locators().unicast[0]); - EXPECT_EQ(locators.multicast[0], data.remote_locators().multicast[0]); - EXPECT_EQ(locators.unicast[1], data.remote_locators().unicast[1]); - EXPECT_EQ(locators.multicast[1], data.remote_locators().multicast[1]); + EXPECT_EQ(locators.unicast[0], data.remote_locators.unicast[0]); + EXPECT_EQ(locators.multicast[0], data.remote_locators.multicast[0]); + EXPECT_EQ(locators.unicast[1], data.remote_locators.unicast[1]); + EXPECT_EQ(locators.multicast[1], data.remote_locators.multicast[1]); EXPECT_EQ(kind, EntityKind::DATAREADER); EXPECT_EQ(participant_id, EntityId(1)); @@ -3010,7 +3009,10 @@ TEST_F(statistics_participant_listener_tests, new_reader_several_locators_no_hos eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - participant_listener.on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; + participant_listener.on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -3026,7 +3028,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_no_participant) std::make_pair(EntityId(0), EntityId(2))))); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3035,20 +3037,21 @@ TEST_F(statistics_participant_listener_tests, new_reader_no_participant) existing_unicast_locator->id = 3; // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered reader is in the participant - data.guid(reader_guid_); + data.guid = reader_guid_; // Precondition: The discovered reader is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered reader contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The Reader does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str_)).Times(AnyNumber()) @@ -3058,7 +3061,10 @@ TEST_F(statistics_participant_listener_tests, new_reader_no_participant) EXPECT_CALL(database, insert_new_endpoint(_, _, _, _, _, _, _, _, _, _)).Times(0); // Expectation: Nothing is inserted - participant_listener.on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; + participant_listener.on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); } TEST_F(statistics_participant_listener_tests, new_reader_no_domain) @@ -3072,7 +3078,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_no_domain) .WillRepeatedly(Return(std::vector>())); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3081,30 +3087,34 @@ TEST_F(statistics_participant_listener_tests, new_reader_no_domain) existing_unicast_locator->id = 3; // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered reader is in the participant - data.guid(reader_guid_); + data.guid = reader_guid_; // Precondition: The discovered reader is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The Reader does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str_)).Times(AnyNumber()) .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Precondition: The discovered reader contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Expectation: No entity is added to the database EXPECT_CALL(database, insert_new_endpoint(_, _, _, _, _, _, _, _, _, _)).Times(0); // Expectation: Exception thrown - participant_listener.on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; + participant_listener.on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); } TEST_F(statistics_participant_listener_tests, new_reader_discovered_reader_already_exists) @@ -3121,7 +3131,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_discovered_reader_alrea .WillOnce(Return(true)); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3130,25 +3140,26 @@ TEST_F(statistics_participant_listener_tests, new_reader_discovered_reader_alrea existing_unicast_locator->id = 3; // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered reader is in the participant - data.guid(reader_guid_); + data.guid = reader_guid_; // Precondition: The discovered reader is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered reader contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The Reader exists and has ID 10 std::shared_ptr reader = std::make_shared(reader_guid_str_, reader_proxy_data_to_backend_qos( - info.info), reader_guid_str_, participant_, topic_); + data), reader_guid_str_, participant_, topic_); reader->id = 10; EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str_)).Times(AnyNumber()) .WillRepeatedly(Return(std::make_pair(EntityId(0), EntityId(10)))); @@ -3171,7 +3182,10 @@ TEST_F(statistics_participant_listener_tests, new_reader_discovered_reader_alrea eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener. - participant_listener.on_subscriber_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::DISCOVERED_READER; + participant_listener.on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -3189,7 +3203,7 @@ TEST_F(statistics_participant_listener_tests, new_reader_undiscovered_reader_alr .WillOnce(Return(true)); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3198,25 +3212,26 @@ TEST_F(statistics_participant_listener_tests, new_reader_undiscovered_reader_alr existing_unicast_locator->id = 3; // Start building the discovered reader info - eprosima::fastrtps::rtps::ReaderProxyData data(1, 1); + eprosima::fastdds::rtps::SubscriptionBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered reader is in the participant - data.guid(reader_guid_); + data.guid = reader_guid_; // Precondition: The discovered reader is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered reader contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered reader info - eprosima::fastrtps::rtps::ReaderDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The Reader exists and has ID 10 std::shared_ptr reader = std::make_shared(reader_guid_str_, reader_proxy_data_to_backend_qos( - info.info), reader_guid_str_, participant_, topic_); + data), reader_guid_str_, participant_, topic_); reader->id = 10; EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAREADER, reader_guid_str_)).Times(AnyNumber()) .WillRepeatedly(Return(std::make_pair(EntityId(0), EntityId(10)))); @@ -3239,8 +3254,10 @@ TEST_F(statistics_participant_listener_tests, new_reader_undiscovered_reader_alr eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::UNDISCOVERY)).Times(1); // Execution: Call the listener. - info.status = eprosima::fastrtps::rtps::ReaderDiscoveryInfo::REMOVED_READER; - participant_listener.on_subscriber_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::ReaderDiscoveryStatus status = + eprosima::fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_data_reader_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -3259,7 +3276,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_discovered) .WillOnce(Return(true)); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3268,20 +3285,21 @@ TEST_F(statistics_participant_listener_tests, new_writer_discovered) existing_unicast_locator->id = 3; // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered writer is in the participant - data.guid(writer_guid_); + data.guid = writer_guid_; // Precondition: The discovered writer is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered writer contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str_)).Times(AnyNumber()) @@ -3294,7 +3312,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_discovered) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -3303,9 +3321,9 @@ TEST_F(statistics_participant_listener_tests, new_writer_discovered) EXPECT_EQ(endpoint_guid, writer_guid_str_); EXPECT_EQ(name, std::string("DataWriter_") + topic_->name + "_" + writer_entity_id_str_); EXPECT_EQ(alias, ""); - EXPECT_EQ(qos, writer_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, writer_proxy_data_to_backend_qos(data)); EXPECT_EQ(is_virtual_metatraffic, false); - EXPECT_EQ(locators.unicast[0], data.remote_locators().unicast[0]); + EXPECT_EQ(locators.unicast[0], data.remote_locators.unicast[0]); EXPECT_EQ(kind, EntityKind::DATAWRITER); EXPECT_EQ(participant_id, EntityId(1)); @@ -3338,7 +3356,10 @@ TEST_F(statistics_participant_listener_tests, new_writer_discovered) eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - participant_listener.on_publisher_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); } TEST_F(statistics_participant_listener_tests, new_writer_undiscovered) @@ -3353,7 +3374,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_undiscovered) std::make_pair(EntityId(0), EntityId(2))))); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3362,20 +3383,21 @@ TEST_F(statistics_participant_listener_tests, new_writer_undiscovered) existing_unicast_locator->id = 3; // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered writer is in the participant - data.guid(writer_guid_); + data.guid = writer_guid_; // Precondition: The discovered writer is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered writer contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str_)).Times(AnyNumber()) @@ -3388,8 +3410,10 @@ TEST_F(statistics_participant_listener_tests, new_writer_undiscovered) EXPECT_CALL(database, change_entity_status(_, _)).Times(0); // Execution: Call the listener - info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER; - participant_listener.on_publisher_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); } TEST_F(statistics_participant_listener_tests, new_writer_no_topic) @@ -3403,7 +3427,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_no_topic) .WillRepeatedly(Return(std::vector>())); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3412,20 +3436,21 @@ TEST_F(statistics_participant_listener_tests, new_writer_no_topic) existing_unicast_locator->id = 3; // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered writer is in the participant - data.guid(writer_guid_); + data.guid = writer_guid_; // Precondition: The discovered writer is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered writer contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str_)).Times(AnyNumber()) @@ -3456,7 +3481,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_no_topic) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -3465,10 +3490,10 @@ TEST_F(statistics_participant_listener_tests, new_writer_no_topic) EXPECT_EQ(endpoint_guid, writer_guid_str_); EXPECT_EQ(name, std::string("DataWriter_") + topic_->name + "_" + writer_entity_id_str_); EXPECT_EQ(alias, ""); - EXPECT_EQ(qos, writer_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, writer_proxy_data_to_backend_qos(data)); EXPECT_EQ(is_virtual_metatraffic, false); - EXPECT_EQ(locators.unicast[0], data.remote_locators().unicast[0]); + EXPECT_EQ(locators.unicast[0], data.remote_locators.unicast[0]); EXPECT_EQ(kind, EntityKind::DATAWRITER); EXPECT_EQ(participant_id, EntityId(1)); @@ -3506,7 +3531,10 @@ TEST_F(statistics_participant_listener_tests, new_writer_no_topic) eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - participant_listener.on_publisher_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); } TEST_F(statistics_participant_listener_tests, new_writer_several_locators) @@ -3526,7 +3554,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators) .WillOnce(Return(true)); // Precondition: One unicast Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3536,7 +3564,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators) existing_locators.push_back(existing_unicast_locator); // Precondition: One multicast Locator exists and has ID 4 - eprosima::fastrtps::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_multicast_locator.address[12] = 127; dds_existing_multicast_locator.address[15] = 2; std::string existing_multicast_locator_name = to_string(dds_existing_multicast_locator); @@ -3546,7 +3574,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators) existing_locators.push_back(existing_multicast_locator); // Precondition: One unicast Locator does not exist - eprosima::fastrtps::rtps::Locator_t dds_new_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_new_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_new_unicast_locator.address[12] = 127; dds_new_unicast_locator.address[15] = 3; std::string new_unicast_locator_name = to_string(dds_new_unicast_locator); @@ -3554,7 +3582,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators) std::make_shared(new_unicast_locator_name); // Precondition: One multicast Locator does not exist - eprosima::fastrtps::rtps::Locator_t dds_new_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_new_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_new_multicast_locator.address[12] = 127; dds_new_multicast_locator.address[15] = 4; std::string new_multicast_locator_name = to_string(dds_new_multicast_locator); @@ -3565,23 +3593,24 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators) database.set_next_entity_id(next_entity_id); // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(2, 2); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(2); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(2); // Precondition: The discovered writer is in the participant - data.guid(writer_guid_); + data.guid = writer_guid_; // Precondition: The discovered writer is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered writer contains the locators - data.add_unicast_locator(dds_existing_unicast_locator); - data.add_unicast_locator(dds_new_unicast_locator); - data.add_multicast_locator(dds_existing_multicast_locator); - data.add_multicast_locator(dds_new_multicast_locator); - - // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_new_unicast_locator); + data.remote_locators.add_multicast_locator(dds_existing_multicast_locator); + data.remote_locators.add_multicast_locator(dds_new_multicast_locator); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str_)).Times(AnyNumber()) @@ -3599,7 +3628,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators) const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -3608,13 +3637,13 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators) EXPECT_EQ(endpoint_guid, writer_guid_str_); EXPECT_EQ(name, std::string("DataWriter_") + topic_->name + "_" + writer_entity_id_str_); EXPECT_EQ(alias, ""); - EXPECT_EQ(qos, writer_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, writer_proxy_data_to_backend_qos(data)); EXPECT_EQ(is_virtual_metatraffic, false); - EXPECT_EQ(locators.unicast[0], data.remote_locators().unicast[0]); - EXPECT_EQ(locators.multicast[0], data.remote_locators().multicast[0]); - EXPECT_EQ(locators.unicast[1], data.remote_locators().unicast[1]); - EXPECT_EQ(locators.multicast[1], data.remote_locators().multicast[1]); + EXPECT_EQ(locators.unicast[0], data.remote_locators.unicast[0]); + EXPECT_EQ(locators.multicast[0], data.remote_locators.multicast[0]); + EXPECT_EQ(locators.unicast[1], data.remote_locators.unicast[1]); + EXPECT_EQ(locators.multicast[1], data.remote_locators.multicast[1]); EXPECT_EQ(kind, EntityKind::DATAWRITER); EXPECT_EQ(participant_id, EntityId(1)); @@ -3647,7 +3676,10 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators) eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - participant_listener.on_publisher_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -3669,7 +3701,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators_no_hos .WillOnce(Return(true)); // Precondition: One unicast Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3679,7 +3711,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators_no_hos existing_locators.push_back(existing_unicast_locator); // Precondition: One multicast Locator exists and has ID 4 - eprosima::fastrtps::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_multicast_locator.address[12] = 127; dds_existing_multicast_locator.address[15] = 2; std::string existing_multicast_locator_name = to_string(dds_existing_multicast_locator); @@ -3689,7 +3721,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators_no_hos existing_locators.push_back(existing_multicast_locator); // Precondition: One unicast Locator does not exist - eprosima::fastrtps::rtps::Locator_t dds_new_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_new_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_new_unicast_locator.address[12] = 127; dds_new_unicast_locator.address[15] = 3; std::string new_unicast_locator_name = to_string(dds_new_unicast_locator); @@ -3697,7 +3729,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators_no_hos std::make_shared(new_unicast_locator_name); // Precondition: One multicast Locator does not exist - eprosima::fastrtps::rtps::Locator_t dds_new_multicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_new_multicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_new_multicast_locator.address[12] = 127; dds_new_multicast_locator.address[15] = 4; std::string new_multicast_locator_name = to_string(dds_new_multicast_locator); @@ -3708,23 +3740,24 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators_no_hos database.set_next_entity_id(next_entity_id); // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(2, 2); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(2); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(2); // Precondition: The discovered writer is in the participant - data.guid(writer_guid_); + data.guid = writer_guid_; // Precondition: The discovered writer is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered writer contains the locators - data.add_unicast_locator(dds_existing_unicast_locator); - data.add_unicast_locator(dds_new_unicast_locator); - data.add_multicast_locator(dds_existing_multicast_locator); - data.add_multicast_locator(dds_new_multicast_locator); - - // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); + data.remote_locators.add_unicast_locator(dds_new_unicast_locator); + data.remote_locators.add_multicast_locator(dds_existing_multicast_locator); + data.remote_locators.add_multicast_locator(dds_new_multicast_locator); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str_)).Times(AnyNumber()) @@ -3737,7 +3770,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators_no_hos const std::string& alias, const Qos& qos, const bool& is_virtual_metatraffic, - const eprosima::fastrtps::rtps::RemoteLocatorList& locators, + const eprosima::fastdds::rtps::RemoteLocatorList& locators, const EntityKind& kind, const EntityId& participant_id, const EntityId& topic_id, @@ -3746,13 +3779,13 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators_no_hos EXPECT_EQ(endpoint_guid, writer_guid_str_); EXPECT_EQ(name, std::string("DataWriter_") + topic_->name + "_" + writer_entity_id_str_); EXPECT_EQ(alias, ""); - EXPECT_EQ(qos, writer_proxy_data_to_backend_qos(info.info)); + EXPECT_EQ(qos, writer_proxy_data_to_backend_qos(data)); EXPECT_EQ(is_virtual_metatraffic, false); - EXPECT_EQ(locators.unicast[0], data.remote_locators().unicast[0]); - EXPECT_EQ(locators.multicast[0], data.remote_locators().multicast[0]); - EXPECT_EQ(locators.unicast[1], data.remote_locators().unicast[1]); - EXPECT_EQ(locators.multicast[1], data.remote_locators().multicast[1]); + EXPECT_EQ(locators.unicast[0], data.remote_locators.unicast[0]); + EXPECT_EQ(locators.multicast[0], data.remote_locators.multicast[0]); + EXPECT_EQ(locators.unicast[1], data.remote_locators.unicast[1]); + EXPECT_EQ(locators.multicast[1], data.remote_locators.multicast[1]); EXPECT_EQ(kind, EntityKind::DATAWRITER); EXPECT_EQ(participant_id, EntityId(1)); @@ -3785,7 +3818,10 @@ TEST_F(statistics_participant_listener_tests, new_writer_several_locators_no_hos eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener - participant_listener.on_publisher_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -3801,7 +3837,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_no_participant) std::make_pair(EntityId(0), EntityId(2))))); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3810,20 +3846,21 @@ TEST_F(statistics_participant_listener_tests, new_writer_no_participant) existing_unicast_locator->id = 3; // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered writer is in the participant - data.guid(writer_guid_); + data.guid = writer_guid_; // Precondition: The discovered writer is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered writer contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str_)).Times(AnyNumber()) @@ -3833,7 +3870,10 @@ TEST_F(statistics_participant_listener_tests, new_writer_no_participant) EXPECT_CALL(database, insert_new_endpoint(_, _, _, _, _, _, _, _, _, _)).Times(0); // Expectation: Nothing is inserted - participant_listener.on_publisher_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; + participant_listener.on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); } @@ -3848,7 +3888,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_no_domain) .WillRepeatedly(Return(std::vector>())); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3857,30 +3897,34 @@ TEST_F(statistics_participant_listener_tests, new_writer_no_domain) existing_unicast_locator->id = 3; // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered writer is in the participant - data.guid(writer_guid_); + data.guid = writer_guid_; // Precondition: The discovered writer is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The writer does not exist EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str_)).Times(AnyNumber()) .WillRepeatedly(Throw(eprosima::statistics_backend::BadParameter("Error"))); // Precondition: The discovered writer contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Expectation: No entity is added to the database EXPECT_CALL(database, insert_new_endpoint(_, _, _, _, _, _, _, _, _, _)).Times(0); // Expectation: Exception thrown - participant_listener.on_publisher_discovery(&statistics_participant, std::move(info)); + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; + participant_listener.on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); } TEST_F(statistics_participant_listener_tests, new_writer_discovered_writer_already_exists) @@ -3897,7 +3941,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_discovered_writer_alrea .WillOnce(Return(true)); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3906,25 +3950,26 @@ TEST_F(statistics_participant_listener_tests, new_writer_discovered_writer_alrea existing_unicast_locator->id = 3; // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered writer is in the participant - data.guid(writer_guid_); + data.guid = writer_guid_; // Precondition: The discovered writer is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered writer contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The writer exists and has ID 10 std::shared_ptr writer = std::make_shared(writer_guid_str_, writer_proxy_data_to_backend_qos( - info.info), writer_guid_str_, participant_, topic_); + data), writer_guid_str_, participant_, topic_); writer->id = EntityId(10); EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str_)).Times(AnyNumber()) .WillRepeatedly(Return(std::make_pair(EntityId(0), EntityId(10)))); @@ -3947,7 +3992,10 @@ TEST_F(statistics_participant_listener_tests, new_writer_discovered_writer_alrea eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::DISCOVERY)).Times(1); // Execution: Call the listener. - participant_listener.on_publisher_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::DISCOVERED_WRITER; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } @@ -3965,7 +4013,7 @@ TEST_F(statistics_participant_listener_tests, new_writer_undiscovered_writer_alr .WillOnce(Return(true)); // Precondition: The Locator exists and has ID 3 - eprosima::fastrtps::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); + eprosima::fastdds::rtps::Locator_t dds_existing_unicast_locator(LOCATOR_KIND_UDPv4, 1024); dds_existing_unicast_locator.address[12] = 127; dds_existing_unicast_locator.address[15] = 1; std::string existing_unicast_locator_name = to_string(dds_existing_unicast_locator); @@ -3974,25 +4022,26 @@ TEST_F(statistics_participant_listener_tests, new_writer_undiscovered_writer_alr existing_unicast_locator->id = 3; // Start building the discovered writer info - eprosima::fastrtps::rtps::WriterProxyData data(1, 1); + eprosima::fastdds::rtps::PublicationBuiltinTopicData data; + + // Set max number of unicast/multicast locators + data.remote_locators.unicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); + data.remote_locators.multicast = eprosima::fastdds::ResourceLimitedContainerConfig::fixed_size_configuration(1); // Precondition: The discovered writer is in the participant - data.guid(writer_guid_); + data.guid = writer_guid_; // Precondition: The discovered writer is in the topic - data.topicName(topic_name_); - data.typeName(type_name_); + data.topic_name = topic_name_; + data.type_name = type_name_; // Precondition: The discovered writer contains the locator - data.add_unicast_locator(dds_existing_unicast_locator); - - // Finish building the discovered writer info - eprosima::fastrtps::rtps::WriterDiscoveryInfo info(data); + data.remote_locators.add_unicast_locator(dds_existing_unicast_locator); // Precondition: The writer exists and has ID 10 std::shared_ptr writer = std::make_shared(writer_guid_str_, writer_proxy_data_to_backend_qos( - info.info), writer_guid_str_, participant_, topic_); + data), writer_guid_str_, participant_, topic_); writer->id = EntityId(10); EXPECT_CALL(database, get_entity_by_guid(EntityKind::DATAWRITER, writer_guid_str_)).Times(AnyNumber()) .WillRepeatedly(Return(std::make_pair(EntityId(0), EntityId(10)))); @@ -4015,8 +4064,10 @@ TEST_F(statistics_participant_listener_tests, new_writer_undiscovered_writer_alr eprosima::statistics_backend::details::StatisticsBackendData::DiscoveryStatus::UNDISCOVERY)).Times(1); // Execution: Call the listener. - info.status = eprosima::fastrtps::rtps::WriterDiscoveryInfo::REMOVED_WRITER; - participant_listener.on_publisher_discovery(&statistics_participant, std::move(info)); + eprosima::fastdds::rtps::WriterDiscoveryStatus status = + eprosima::fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER; + bool should_be_ignored = false; // Set to false to avoid ignoring the entity + participant_listener.on_data_writer_discovery(&statistics_participant, status, data, should_be_ignored); entity_queue.flush(); } diff --git a/test/unittest/StatisticsReaderListener/CMakeLists.txt b/test/unittest/StatisticsReaderListener/CMakeLists.txt index a31175f1a..d7ef93401 100644 --- a/test/unittest/StatisticsReaderListener/CMakeLists.txt +++ b/test/unittest/StatisticsReaderListener/CMakeLists.txt @@ -26,12 +26,10 @@ if(GTEST_FOUND AND GMOCK_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp/database/samples.cpp ${PROJECT_SOURCE_DIR}/src/cpp/exception/Exception.cpp ${PROJECT_SOURCE_DIR}/src/cpp/subscriber/StatisticsReaderListener.cpp - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesv1.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/monitorservice_typesPubSubTypes.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/types.cxx - ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesv1.cxx ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesPubSubTypes.cxx + ${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/topic_types/typesTypeObjectSupport.cxx ${PROJECT_SOURCE_DIR}/src/cpp/types/EntityId.cpp ${PROJECT_SOURCE_DIR}/src/cpp/types/types.cpp) @@ -52,7 +50,7 @@ if(GTEST_FOUND AND GMOCK_FOUND) endif(MSVC) target_link_libraries(statistics_reader_listener_tests PUBLIC - ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(statistics_reader_listener_tests TEST_FRIENDLY_PATH) diff --git a/test/unittest/StatisticsReaderListener/StatisticsReaderListenerTests.cpp b/test/unittest/StatisticsReaderListener/StatisticsReaderListenerTests.cpp index 9e64ed089..3f1bae125 100644 --- a/test/unittest/StatisticsReaderListener/StatisticsReaderListenerTests.cpp +++ b/test/unittest/StatisticsReaderListener/StatisticsReaderListenerTests.cpp @@ -16,13 +16,14 @@ #include #include -#include +#include #include #include #include -#include -#include +#include + +#include #include #include @@ -346,7 +347,7 @@ TEST_F(statistics_reader_listener_tests, new_history_latency_received) std::shared_ptr data = std::make_shared(); data->writer_reader_data(inner_data); - data->_d(EventKindBits::HISTORY2HISTORY_LATENCY); + data->_d(EventKind::HISTORY2HISTORY_LATENCY); add_sample_to_reader_history(data, get_default_info()); @@ -388,20 +389,20 @@ TEST_F(statistics_reader_listener_tests, new_history_latency_received) TEST_F(statistics_reader_listener_tests, new_network_latency_received) { std::array src_locator_address = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; - eprosima::fastrtps::rtps::Locator_t src_locator_t; + eprosima::fastdds::rtps::Locator_t src_locator_t; uint16_t src_locator_t_physical_port = 0; uint16_t src_locator_t_logical_port = 0; - eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(src_locator_t, src_locator_t_physical_port); - eprosima::fastrtps::rtps::IPLocator::setLogicalPort(src_locator_t, src_locator_t_logical_port); + eprosima::fastdds::rtps::IPLocator::setPhysicalPort(src_locator_t, src_locator_t_physical_port); + eprosima::fastdds::rtps::IPLocator::setLogicalPort(src_locator_t, src_locator_t_logical_port); uint32_t src_locator_port = src_locator_t.port; std::string src_locator_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|d.e.f.10"; std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; - eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); - eprosima::fastrtps::rtps::IPLocator::setLogicalPort(dst_locator_t, dst_locator_t_logical_port); + eprosima::fastdds::rtps::IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); + eprosima::fastdds::rtps::IPLocator::setLogicalPort(dst_locator_t, dst_locator_t_logical_port); uint32_t dst_locator_port = dst_locator_t.port; std::string dst_locator_str = "TCPv4:[4.3.2.1]:" + std::to_string(dst_locator_t_physical_port) + "-" + std::to_string(dst_locator_t_logical_port); @@ -426,7 +427,7 @@ TEST_F(statistics_reader_listener_tests, new_network_latency_received) std::shared_ptr data = std::make_shared(); data->locator2locator_data(inner_data); - data->_d(EventKindBits::NETWORK_LATENCY); + data->_d(EventKind::NETWORK_LATENCY); add_sample_to_reader_history(data, get_default_info()); @@ -487,7 +488,7 @@ TEST_F(statistics_reader_listener_tests, new_publication_throughput_received) std::shared_ptr data = std::make_shared(); data->entity_data(inner_data); - data->_d(EventKindBits::PUBLICATION_THROUGHPUT); + data->_d(EventKind::PUBLICATION_THROUGHPUT); add_sample_to_reader_history(data, get_default_info()); @@ -543,7 +544,7 @@ TEST_F(statistics_reader_listener_tests, new_subscription_throughput_received) std::shared_ptr data = std::make_shared(); data->entity_data(inner_data); - data->_d(EventKindBits::SUBSCRIPTION_THROUGHPUT); + data->_d(EventKind::SUBSCRIPTION_THROUGHPUT); add_sample_to_reader_history(data, get_default_info()); @@ -584,11 +585,11 @@ TEST_F(statistics_reader_listener_tests, new_rtps_sent_received) std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; - eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); - eprosima::fastrtps::rtps::IPLocator::setLogicalPort(dst_locator_t, dst_locator_t_logical_port); + eprosima::fastdds::rtps::IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); + eprosima::fastdds::rtps::IPLocator::setLogicalPort(dst_locator_t, dst_locator_t_logical_port); uint32_t dst_locator_port = dst_locator_t.port; std::string dst_locator_str = "TCPv4:[4.3.2.1]:" + std::to_string(dst_locator_t_physical_port) + "-" + std::to_string(dst_locator_t_logical_port); @@ -618,7 +619,7 @@ TEST_F(statistics_reader_listener_tests, new_rtps_sent_received) std::shared_ptr data = std::make_shared(); data->entity2locator_traffic(inner_data); - data->_d(EventKindBits::RTPS_SENT); + data->_d(EventKind::RTPS_SENT); add_sample_to_reader_history(data, get_default_info()); @@ -679,11 +680,11 @@ TEST_F(statistics_reader_listener_tests, new_rtps_lost_received) std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; std::array dst_locator_address = {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; - eprosima::fastrtps::rtps::Locator_t dst_locator_t; + eprosima::fastdds::rtps::Locator_t dst_locator_t; uint16_t dst_locator_t_physical_port = 2048; uint16_t dst_locator_t_logical_port = 0; - eprosima::fastrtps::rtps::IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); - eprosima::fastrtps::rtps::IPLocator::setLogicalPort(dst_locator_t, dst_locator_t_logical_port); + eprosima::fastdds::rtps::IPLocator::setPhysicalPort(dst_locator_t, dst_locator_t_physical_port); + eprosima::fastdds::rtps::IPLocator::setLogicalPort(dst_locator_t, dst_locator_t_logical_port); uint32_t dst_locator_port = dst_locator_t.port; std::string dst_locator_str = "TCPv4:[4.3.2.1]:" + std::to_string(dst_locator_t_physical_port) + "-" + std::to_string(dst_locator_t_logical_port); @@ -713,7 +714,7 @@ TEST_F(statistics_reader_listener_tests, new_rtps_lost_received) std::shared_ptr data = std::make_shared(); data->entity2locator_traffic(inner_data); - data->_d(EventKindBits::RTPS_LOST); + data->_d(EventKind::RTPS_LOST); add_sample_to_reader_history(data, get_default_info()); @@ -789,7 +790,7 @@ TEST_F(statistics_reader_listener_tests, new_resent_datas_received) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::RESENT_DATAS); + data->_d(EventKind::RESENT_DATAS); add_sample_to_reader_history(data, get_default_info()); @@ -845,7 +846,7 @@ TEST_F(statistics_reader_listener_tests, new_heartbeat_count_received) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::HEARTBEAT_COUNT); + data->_d(EventKind::HEARTBEAT_COUNT); add_sample_to_reader_history(data, get_default_info()); @@ -901,7 +902,7 @@ TEST_F(statistics_reader_listener_tests, new_acknack_count_received) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::ACKNACK_COUNT); + data->_d(EventKind::ACKNACK_COUNT); add_sample_to_reader_history(data, get_default_info()); @@ -957,7 +958,7 @@ TEST_F(statistics_reader_listener_tests, new_nackfrag_count_received) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::NACKFRAG_COUNT); + data->_d(EventKind::NACKFRAG_COUNT); add_sample_to_reader_history(data, get_default_info()); @@ -1013,7 +1014,7 @@ TEST_F(statistics_reader_listener_tests, new_gap_count_received) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::GAP_COUNT); + data->_d(EventKind::GAP_COUNT); add_sample_to_reader_history(data, get_default_info()); @@ -1069,7 +1070,7 @@ TEST_F(statistics_reader_listener_tests, new_data_count_received) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::DATA_COUNT); + data->_d(EventKind::DATA_COUNT); add_sample_to_reader_history(data, get_default_info()); @@ -1125,7 +1126,7 @@ TEST_F(statistics_reader_listener_tests, new_pdp_count_received) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::PDP_PACKETS); + data->_d(EventKind::PDP_PACKETS); add_sample_to_reader_history(data, get_default_info()); @@ -1181,7 +1182,7 @@ TEST_F(statistics_reader_listener_tests, new_edp_count_received) std::shared_ptr data = std::make_shared(); data->entity_count(inner_data); - data->_d(EventKindBits::EDP_PACKETS); + data->_d(EventKind::EDP_PACKETS); add_sample_to_reader_history(data, get_default_info()); @@ -1252,7 +1253,7 @@ TEST_F(statistics_reader_listener_tests, new_discovery_times_received) std::shared_ptr data = std::make_shared(); data->discovery_time(inner_data); - data->_d(EventKindBits::DISCOVERED_ENTITY); + data->_d(EventKind::DISCOVERED_ENTITY); add_sample_to_reader_history(data, get_default_info()); @@ -1298,7 +1299,7 @@ TEST_F(statistics_reader_listener_tests, new_sample_datas_received) int32_t sn_high = 2048; uint32_t sn_low = 4096; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::SequenceNumber_t sn (sn_high, sn_low); + eprosima::fastdds::rtps::SequenceNumber_t sn (sn_high, sn_low); // Build the writer GUID DatabaseDataQueue::StatisticsGuidPrefix writer_prefix; @@ -1324,7 +1325,7 @@ TEST_F(statistics_reader_listener_tests, new_sample_datas_received) std::shared_ptr data = std::make_shared(); data->sample_identity_count(inner_data); - data->_d(EventKindBits::SAMPLE_DATAS); + data->_d(EventKind::SAMPLE_DATAS); add_sample_to_reader_history(data, get_default_info()); @@ -1366,7 +1367,7 @@ TEST_F(statistics_reader_listener_tests, new_monitor_service_sample_received) int32_t sn_high = 2048; uint32_t sn_low = 4096; std::string writer_guid_str = "01.02.03.04.05.06.07.08.09.0a.0b.0c|0.0.0.2"; - eprosima::fastrtps::rtps::SequenceNumber_t sn (sn_high, sn_low); + eprosima::fastdds::rtps::SequenceNumber_t sn (sn_high, sn_low); // Build the writer GUID DatabaseDataQueue::StatisticsGuidPrefix writer_prefix; @@ -1376,7 +1377,7 @@ TEST_F(statistics_reader_listener_tests, new_monitor_service_sample_received) DatabaseDataQueue::StatisticsGuid writer_guid; writer_guid.guidPrefix(writer_prefix); writer_guid.entityId(writer_entity_id); - StatusKind kind = StatusKind::PROXY; + StatusKind::StatusKind kind = StatusKind::PROXY; MonitorServiceData value; std::vector entity_proxy = {1, 2, 3, 4, 5}; value.entity_proxy(entity_proxy); diff --git a/test/unittest/TrafficInjector/TrafficInjectorTests.cpp b/test/unittest/TrafficInjector/TrafficInjectorTests.cpp index 4d21dca73..8d75c3a2a 100644 --- a/test/unittest/TrafficInjector/TrafficInjectorTests.cpp +++ b/test/unittest/TrafficInjector/TrafficInjectorTests.cpp @@ -94,7 +94,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -107,7 +107,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -120,7 +120,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -133,7 +133,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -146,7 +146,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -159,7 +159,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -172,7 +172,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -185,7 +185,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -198,7 +198,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -211,7 +211,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -224,7 +224,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -237,7 +237,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -250,7 +250,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -263,7 +263,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -276,7 +276,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -289,7 +289,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, @@ -302,7 +302,7 @@ class TrafficInjectorTests : public ::testing::Test type.register_type(participant_); Topic* topic = participant_->create_topic(topic_name, - type->getName(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); + type->get_name(), eprosima::fastdds::dds::TOPIC_QOS_DEFAULT); topics_.insert(topic); listener_.register_topic(topic_name); readers_.insert(subscriber_->create_datareader(topic, eprosima::fastdds::dds::DATAREADER_QOS_DEFAULT, diff --git a/test/unittest/fragile_ptr/CMakeLists.txt b/test/unittest/fragile_ptr/CMakeLists.txt index 0e914ba18..73b4e2010 100644 --- a/test/unittest/fragile_ptr/CMakeLists.txt +++ b/test/unittest/fragile_ptr/CMakeLists.txt @@ -35,7 +35,7 @@ if(GTEST_FOUND) ${PROJECT_SOURCE_DIR}/src/cpp) target_link_libraries(parametrized_fragile_ptr_tests PUBLIC - ${GTEST_LIBRARIES} fastrtps fastcdr) + ${GTEST_LIBRARIES} fastdds fastcdr) get_win32_path_dependencies(parametrized_fragile_ptr_tests TEST_FRIENDLY_PATH)