commit f8e4df77fb87518ce846e9bc48c2b7f0c1609ae7 Author: Quella <2892744389@qq.com> Date: Wed Sep 24 10:53:28 2025 +0800 init diff --git a/arm/CMakeLists.txt b/arm/CMakeLists.txt new file mode 100644 index 0000000..49941d1 --- /dev/null +++ b/arm/CMakeLists.txt @@ -0,0 +1,13 @@ +project(marm_code) +cmake_minimum_required(VERSION 3.5) + +SET(CMAKE_CXX_STANDARD 17) + +include_directories(/usr/local/include/ddscxx /usr/local/include/iceoryx/v2.0.2) +link_libraries(unitree_sdk2 ddsc ddscxx rt pthread) + +add_executable(joint_angle_control src/joint_angle_control.cpp src/msg/ArmString_.cpp) +add_executable(multiple_joint_angle_control src/multiple_joint_angle_control.cpp src/msg/ArmString_.cpp) +add_executable(joint_enable_control src/joint_enable_control.cpp src/msg/ArmString_.cpp) +add_executable(arm_zero_control src/arm_zero_control.cpp src/msg/ArmString_.cpp) +add_executable(get_arm_joint_angle src/get_arm_joint_angle.cpp src/msg/ArmString_.cpp src/msg/PubServoInfo_.cpp) \ No newline at end of file diff --git a/arm/build/.cmake/api/v1/query/client-vscode/query.json b/arm/build/.cmake/api/v1/query/client-vscode/query.json new file mode 100644 index 0000000..82bb964 --- /dev/null +++ b/arm/build/.cmake/api/v1/query/client-vscode/query.json @@ -0,0 +1 @@ +{"requests":[{"kind":"cache","version":2},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1},{"kind":"cmakeFiles","version":1}]} \ No newline at end of file diff --git a/arm/build/.cmake/api/v1/reply/cache-v2-8c2eca33d12ae3d806d4.json b/arm/build/.cmake/api/v1/reply/cache-v2-8c2eca33d12ae3d806d4.json new file mode 100644 index 0000000..ee39263 --- /dev/null +++ b/arm/build/.cmake/api/v1/reply/cache-v2-8c2eca33d12ae3d806d4.json @@ -0,0 +1,1167 @@ +{ + "entries" : + [ + { + "name" : "CMAKE_ADDR2LINE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/addr2line" + }, + { + "name" : "CMAKE_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/ar" + }, + { + "name" : "CMAKE_BUILD_TYPE", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ..." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_CACHEFILE_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "This is the directory where this CMakeCache.txt was created" + } + ], + "type" : "INTERNAL", + "value" : "/home/unitree/unitreeApp/arm/build" + }, + { + "name" : "CMAKE_CACHE_MAJOR_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Major version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "3" + }, + { + "name" : "CMAKE_CACHE_MINOR_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Minor version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "16" + }, + { + "name" : "CMAKE_CACHE_PATCH_VERSION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Patch version of cmake used to create the current loaded cache" + } + ], + "type" : "INTERNAL", + "value" : "3" + }, + { + "name" : "CMAKE_COLOR_MAKEFILE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Enable/Disable color output during build." + } + ], + "type" : "BOOL", + "value" : "ON" + }, + { + "name" : "CMAKE_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to CMake executable." + } + ], + "type" : "INTERNAL", + "value" : "/usr/bin/cmake" + }, + { + "name" : "CMAKE_CPACK_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to cpack program executable." + } + ], + "type" : "INTERNAL", + "value" : "/usr/bin/cpack" + }, + { + "name" : "CMAKE_CTEST_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to ctest program executable." + } + ], + "type" : "INTERNAL", + "value" : "/usr/bin/ctest" + }, + { + "name" : "CMAKE_CXX_COMPILER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "CXX compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/c++" + }, + { + "name" : "CMAKE_CXX_COMPILER_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ar-9" + }, + { + "name" : "CMAKE_CXX_COMPILER_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ranlib-9" + }, + { + "name" : "CMAKE_CXX_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_CXX_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "-g" + }, + { + "name" : "CMAKE_CXX_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "-Os -DNDEBUG" + }, + { + "name" : "CMAKE_CXX_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "-O3 -DNDEBUG" + }, + { + "name" : "CMAKE_CXX_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the CXX compiler during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "-O2 -g -DNDEBUG" + }, + { + "name" : "CMAKE_C_COMPILER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "C compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/cc" + }, + { + "name" : "CMAKE_C_COMPILER_AR", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ar' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ar-9" + }, + { + "name" : "CMAKE_C_COMPILER_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "A wrapper around 'ranlib' adding the appropriate '--plugin' option for the GCC compiler" + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/gcc-ranlib-9" + }, + { + "name" : "CMAKE_C_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_C_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "-g" + }, + { + "name" : "CMAKE_C_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "-Os -DNDEBUG" + }, + { + "name" : "CMAKE_C_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "-O3 -DNDEBUG" + }, + { + "name" : "CMAKE_C_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the C compiler during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "-O2 -g -DNDEBUG" + }, + { + "name" : "CMAKE_DLLTOOL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "CMAKE_DLLTOOL-NOTFOUND" + }, + { + "name" : "CMAKE_EDIT_COMMAND", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to cache edit program executable." + } + ], + "type" : "INTERNAL", + "value" : "/usr/bin/cmake-gui" + }, + { + "name" : "CMAKE_EXECUTABLE_FORMAT", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Executable file format" + } + ], + "type" : "INTERNAL", + "value" : "ELF" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_EXPORT_COMPILE_COMMANDS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Enable/Disable output of compile commands during generation." + } + ], + "type" : "BOOL", + "value" : "OFF" + }, + { + "name" : "CMAKE_EXTRA_GENERATOR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of external makefile project generator." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_GENERATOR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator." + } + ], + "type" : "INTERNAL", + "value" : "Unix Makefiles" + }, + { + "name" : "CMAKE_GENERATOR_INSTANCE", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Generator instance identifier." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_GENERATOR_PLATFORM", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator platform." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_GENERATOR_TOOLSET", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Name of generator toolset." + } + ], + "type" : "INTERNAL", + "value" : "" + }, + { + "name" : "CMAKE_HOME_DIRECTORY", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Source directory with the top level CMakeLists.txt file for this project" + } + ], + "type" : "INTERNAL", + "value" : "/home/unitree/unitreeApp/arm" + }, + { + "name" : "CMAKE_INSTALL_PREFIX", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Install path prefix, prepended onto install directories." + } + ], + "type" : "PATH", + "value" : "/usr/local" + }, + { + "name" : "CMAKE_INSTALL_SO_NO_EXE", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Install .so files without execute permission." + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_LINKER", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/ld" + }, + { + "name" : "CMAKE_MAKE_PROGRAM", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/make" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of modules during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_NM", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/nm" + }, + { + "name" : "CMAKE_NUMBER_OF_MAKEFILES", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "number of local generators" + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_OBJCOPY", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/objcopy" + }, + { + "name" : "CMAKE_OBJDUMP", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/objdump" + }, + { + "name" : "CMAKE_PLATFORM_INFO_INITIALIZED", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Platform information initialized" + } + ], + "type" : "INTERNAL", + "value" : "1" + }, + { + "name" : "CMAKE_PROJECT_DESCRIPTION", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "" + }, + { + "name" : "CMAKE_PROJECT_HOMEPAGE_URL", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "" + }, + { + "name" : "CMAKE_PROJECT_NAME", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "marm_code" + }, + { + "name" : "CMAKE_RANLIB", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/ranlib" + }, + { + "name" : "CMAKE_READELF", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/readelf" + }, + { + "name" : "CMAKE_ROOT", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Path to CMake installation." + } + ], + "type" : "INTERNAL", + "value" : "/usr/share/cmake-3.16" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of shared libraries during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_SKIP_INSTALL_RPATH", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If set, runtime paths are not added when installing shared libraries, but are added when building." + } + ], + "type" : "BOOL", + "value" : "NO" + }, + { + "name" : "CMAKE_SKIP_RPATH", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If set, runtime paths are not added when using shared libraries." + } + ], + "type" : "BOOL", + "value" : "NO" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during all build types." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_DEBUG", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during DEBUG builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during MINSIZEREL builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_RELEASE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during RELEASE builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Flags used by the linker during the creation of static libraries during RELWITHDEBINFO builds." + } + ], + "type" : "STRING", + "value" : "" + }, + { + "name" : "CMAKE_STRIP", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "Path to a program." + } + ], + "type" : "FILEPATH", + "value" : "/usr/bin/strip" + }, + { + "name" : "CMAKE_UNAME", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "uname command" + } + ], + "type" : "INTERNAL", + "value" : "/usr/bin/uname" + }, + { + "name" : "CMAKE_VERBOSE_MAKEFILE", + "properties" : + [ + { + "name" : "ADVANCED", + "value" : "1" + }, + { + "name" : "HELPSTRING", + "value" : "If this value is on, makefiles will be generated without the .SILENT directive, and all commands will be echoed to the console during the make. This is useful for debugging only. With Visual Studio IDE projects all commands are done without /nologo." + } + ], + "type" : "BOOL", + "value" : "FALSE" + }, + { + "name" : "marm_code_BINARY_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "/home/unitree/unitreeApp/arm/build" + }, + { + "name" : "marm_code_SOURCE_DIR", + "properties" : + [ + { + "name" : "HELPSTRING", + "value" : "Value Computed by CMake" + } + ], + "type" : "STATIC", + "value" : "/home/unitree/unitreeApp/arm" + } + ], + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } +} diff --git a/arm/build/.cmake/api/v1/reply/cmakeFiles-v1-c1b32c2e3bc8539f3269.json b/arm/build/.cmake/api/v1/reply/cmakeFiles-v1-c1b32c2e3bc8539f3269.json new file mode 100644 index 0000000..41083c4 --- /dev/null +++ b/arm/build/.cmake/api/v1/reply/cmakeFiles-v1-c1b32c2e3bc8539f3269.json @@ -0,0 +1,146 @@ +{ + "inputs" : + [ + { + "path" : "CMakeLists.txt" + }, + { + "isGenerated" : true, + "path" : "build/CMakeFiles/3.16.3/CMakeSystem.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/CMakeSystemSpecificInitialize.cmake" + }, + { + "isGenerated" : true, + "path" : "build/CMakeFiles/3.16.3/CMakeCCompiler.cmake" + }, + { + "isGenerated" : true, + "path" : "build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/CMakeSystemSpecificInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/CMakeGenericSystem.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/CMakeInitializeConfigs.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Platform/Linux.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Platform/UnixPaths.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/CMakeCInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/CMakeLanguageInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Compiler/GNU-C.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Compiler/GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Internal/CMakeCheckCompilerFlag.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU-C.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/CMakeCommonLanguageInclude.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/CMakeCXXInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/CMakeLanguageInformation.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Compiler/GNU-CXX.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Compiler/GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU-CXX.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU.cmake" + }, + { + "isCMake" : true, + "isExternal" : true, + "path" : "/usr/share/cmake-3.16/Modules/CMakeCommonLanguageInclude.cmake" + } + ], + "kind" : "cmakeFiles", + "paths" : + { + "build" : "/home/unitree/unitreeApp/arm/build", + "source" : "/home/unitree/unitreeApp/arm" + }, + "version" : + { + "major" : 1, + "minor" : 0 + } +} diff --git a/arm/build/.cmake/api/v1/reply/codemodel-v2-4d5f84ad27d2df39d1ed.json b/arm/build/.cmake/api/v1/reply/codemodel-v2-4d5f84ad27d2df39d1ed.json new file mode 100644 index 0000000..2e1c129 --- /dev/null +++ b/arm/build/.cmake/api/v1/reply/codemodel-v2-4d5f84ad27d2df39d1ed.json @@ -0,0 +1,95 @@ +{ + "configurations" : + [ + { + "directories" : + [ + { + "build" : ".", + "minimumCMakeVersion" : + { + "string" : "3.5" + }, + "projectIndex" : 0, + "source" : ".", + "targetIndexes" : + [ + 0, + 1, + 2, + 3, + 4 + ] + } + ], + "name" : "", + "projects" : + [ + { + "directoryIndexes" : + [ + 0 + ], + "name" : "marm_code", + "targetIndexes" : + [ + 0, + 1, + 2, + 3, + 4 + ] + } + ], + "targets" : + [ + { + "directoryIndex" : 0, + "id" : "arm_zero_control::@6890427a1f51a3e7e1df", + "jsonFile" : "target-arm_zero_control-a4364fced5944e829d1a.json", + "name" : "arm_zero_control", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "get_arm_joint_angle::@6890427a1f51a3e7e1df", + "jsonFile" : "target-get_arm_joint_angle-ac055adb4bda3cf3fbb7.json", + "name" : "get_arm_joint_angle", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "joint_angle_control::@6890427a1f51a3e7e1df", + "jsonFile" : "target-joint_angle_control-f430453c3a563753e50a.json", + "name" : "joint_angle_control", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "joint_enable_control::@6890427a1f51a3e7e1df", + "jsonFile" : "target-joint_enable_control-9db4c70752692f36a555.json", + "name" : "joint_enable_control", + "projectIndex" : 0 + }, + { + "directoryIndex" : 0, + "id" : "multiple_joint_angle_control::@6890427a1f51a3e7e1df", + "jsonFile" : "target-multiple_joint_angle_control-c8360938bbb6b9a6904d.json", + "name" : "multiple_joint_angle_control", + "projectIndex" : 0 + } + ] + } + ], + "kind" : "codemodel", + "paths" : + { + "build" : "/home/unitree/unitreeApp/arm/build", + "source" : "/home/unitree/unitreeApp/arm" + }, + "version" : + { + "major" : 2, + "minor" : 0 + } +} diff --git a/arm/build/.cmake/api/v1/reply/index-2025-09-23T01-22-04-0518.json b/arm/build/.cmake/api/v1/reply/index-2025-09-23T01-22-04-0518.json new file mode 100644 index 0000000..55dac8d --- /dev/null +++ b/arm/build/.cmake/api/v1/reply/index-2025-09-23T01-22-04-0518.json @@ -0,0 +1,116 @@ +{ + "cmake" : + { + "generator" : + { + "name" : "Unix Makefiles" + }, + "paths" : + { + "cmake" : "/usr/bin/cmake", + "cpack" : "/usr/bin/cpack", + "ctest" : "/usr/bin/ctest", + "root" : "/usr/share/cmake-3.16" + }, + "version" : + { + "isDirty" : false, + "major" : 3, + "minor" : 16, + "patch" : 3, + "string" : "3.16.3", + "suffix" : "" + } + }, + "objects" : + [ + { + "jsonFile" : "codemodel-v2-4d5f84ad27d2df39d1ed.json", + "kind" : "codemodel", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + { + "jsonFile" : "cache-v2-8c2eca33d12ae3d806d4.json", + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + { + "jsonFile" : "cmakeFiles-v1-c1b32c2e3bc8539f3269.json", + "kind" : "cmakeFiles", + "version" : + { + "major" : 1, + "minor" : 0 + } + } + ], + "reply" : + { + "client-vscode" : + { + "query.json" : + { + "requests" : + [ + { + "kind" : "cache", + "version" : 2 + }, + { + "kind" : "codemodel", + "version" : 2 + }, + { + "kind" : "toolchains", + "version" : 1 + }, + { + "kind" : "cmakeFiles", + "version" : 1 + } + ], + "responses" : + [ + { + "jsonFile" : "cache-v2-8c2eca33d12ae3d806d4.json", + "kind" : "cache", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + { + "jsonFile" : "codemodel-v2-4d5f84ad27d2df39d1ed.json", + "kind" : "codemodel", + "version" : + { + "major" : 2, + "minor" : 0 + } + }, + { + "error" : "unknown request kind 'toolchains'" + }, + { + "jsonFile" : "cmakeFiles-v1-c1b32c2e3bc8539f3269.json", + "kind" : "cmakeFiles", + "version" : + { + "major" : 1, + "minor" : 0 + } + } + ] + } + } + } +} diff --git a/arm/build/.cmake/api/v1/reply/target-arm_zero_control-a4364fced5944e829d1a.json b/arm/build/.cmake/api/v1/reply/target-arm_zero_control-a4364fced5944e829d1a.json new file mode 100644 index 0000000..062b63f --- /dev/null +++ b/arm/build/.cmake/api/v1/reply/target-arm_zero_control-a4364fced5944e829d1a.json @@ -0,0 +1,136 @@ +{ + "artifacts" : + [ + { + "path" : "arm_zero_control" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "include_directories" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 12, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 6, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : " " + }, + { + "fragment" : "-std=gnu++17" + } + ], + "includes" : + [ + { + "backtrace" : 2, + "path" : "/usr/local/include/ddscxx" + }, + { + "backtrace" : 2, + "path" : "/usr/local/include/iceoryx/v2.0.2" + } + ], + "language" : "CXX", + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "id" : "arm_zero_control::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "", + "role" : "flags" + }, + { + "fragment" : "-lunitree_sdk2", + "role" : "libraries" + }, + { + "fragment" : "-lddsc", + "role" : "libraries" + }, + { + "fragment" : "-lddscxx", + "role" : "libraries" + }, + { + "fragment" : "-lrt", + "role" : "libraries" + }, + { + "fragment" : "-lpthread", + "role" : "libraries" + } + ], + "language" : "CXX" + }, + "name" : "arm_zero_control", + "nameOnDisk" : "arm_zero_control", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/arm_zero_control.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/msg/ArmString_.cpp", + "sourceGroupIndex" : 0 + } + ], + "type" : "EXECUTABLE" +} diff --git a/arm/build/.cmake/api/v1/reply/target-get_arm_joint_angle-ac055adb4bda3cf3fbb7.json b/arm/build/.cmake/api/v1/reply/target-get_arm_joint_angle-ac055adb4bda3cf3fbb7.json new file mode 100644 index 0000000..0d832b8 --- /dev/null +++ b/arm/build/.cmake/api/v1/reply/target-get_arm_joint_angle-ac055adb4bda3cf3fbb7.json @@ -0,0 +1,144 @@ +{ + "artifacts" : + [ + { + "path" : "get_arm_joint_angle" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "include_directories" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 13, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 6, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : " " + }, + { + "fragment" : "-std=gnu++17" + } + ], + "includes" : + [ + { + "backtrace" : 2, + "path" : "/usr/local/include/ddscxx" + }, + { + "backtrace" : 2, + "path" : "/usr/local/include/iceoryx/v2.0.2" + } + ], + "language" : "CXX", + "sourceIndexes" : + [ + 0, + 1, + 2 + ] + } + ], + "id" : "get_arm_joint_angle::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "", + "role" : "flags" + }, + { + "fragment" : "-lunitree_sdk2", + "role" : "libraries" + }, + { + "fragment" : "-lddsc", + "role" : "libraries" + }, + { + "fragment" : "-lddscxx", + "role" : "libraries" + }, + { + "fragment" : "-lrt", + "role" : "libraries" + }, + { + "fragment" : "-lpthread", + "role" : "libraries" + } + ], + "language" : "CXX" + }, + "name" : "get_arm_joint_angle", + "nameOnDisk" : "get_arm_joint_angle", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0, + 1, + 2 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/get_arm_joint_angle.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/msg/ArmString_.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/msg/PubServoInfo_.cpp", + "sourceGroupIndex" : 0 + } + ], + "type" : "EXECUTABLE" +} diff --git a/arm/build/.cmake/api/v1/reply/target-joint_angle_control-f430453c3a563753e50a.json b/arm/build/.cmake/api/v1/reply/target-joint_angle_control-f430453c3a563753e50a.json new file mode 100644 index 0000000..09b5d20 --- /dev/null +++ b/arm/build/.cmake/api/v1/reply/target-joint_angle_control-f430453c3a563753e50a.json @@ -0,0 +1,136 @@ +{ + "artifacts" : + [ + { + "path" : "joint_angle_control" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "include_directories" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 9, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 6, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : " " + }, + { + "fragment" : "-std=gnu++17" + } + ], + "includes" : + [ + { + "backtrace" : 2, + "path" : "/usr/local/include/ddscxx" + }, + { + "backtrace" : 2, + "path" : "/usr/local/include/iceoryx/v2.0.2" + } + ], + "language" : "CXX", + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "id" : "joint_angle_control::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "", + "role" : "flags" + }, + { + "fragment" : "-lunitree_sdk2", + "role" : "libraries" + }, + { + "fragment" : "-lddsc", + "role" : "libraries" + }, + { + "fragment" : "-lddscxx", + "role" : "libraries" + }, + { + "fragment" : "-lrt", + "role" : "libraries" + }, + { + "fragment" : "-lpthread", + "role" : "libraries" + } + ], + "language" : "CXX" + }, + "name" : "joint_angle_control", + "nameOnDisk" : "joint_angle_control", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/joint_angle_control.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/msg/ArmString_.cpp", + "sourceGroupIndex" : 0 + } + ], + "type" : "EXECUTABLE" +} diff --git a/arm/build/.cmake/api/v1/reply/target-joint_enable_control-9db4c70752692f36a555.json b/arm/build/.cmake/api/v1/reply/target-joint_enable_control-9db4c70752692f36a555.json new file mode 100644 index 0000000..1db8fa8 --- /dev/null +++ b/arm/build/.cmake/api/v1/reply/target-joint_enable_control-9db4c70752692f36a555.json @@ -0,0 +1,136 @@ +{ + "artifacts" : + [ + { + "path" : "joint_enable_control" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "include_directories" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 11, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 6, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : " " + }, + { + "fragment" : "-std=gnu++17" + } + ], + "includes" : + [ + { + "backtrace" : 2, + "path" : "/usr/local/include/ddscxx" + }, + { + "backtrace" : 2, + "path" : "/usr/local/include/iceoryx/v2.0.2" + } + ], + "language" : "CXX", + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "id" : "joint_enable_control::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "", + "role" : "flags" + }, + { + "fragment" : "-lunitree_sdk2", + "role" : "libraries" + }, + { + "fragment" : "-lddsc", + "role" : "libraries" + }, + { + "fragment" : "-lddscxx", + "role" : "libraries" + }, + { + "fragment" : "-lrt", + "role" : "libraries" + }, + { + "fragment" : "-lpthread", + "role" : "libraries" + } + ], + "language" : "CXX" + }, + "name" : "joint_enable_control", + "nameOnDisk" : "joint_enable_control", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/joint_enable_control.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/msg/ArmString_.cpp", + "sourceGroupIndex" : 0 + } + ], + "type" : "EXECUTABLE" +} diff --git a/arm/build/.cmake/api/v1/reply/target-multiple_joint_angle_control-c8360938bbb6b9a6904d.json b/arm/build/.cmake/api/v1/reply/target-multiple_joint_angle_control-c8360938bbb6b9a6904d.json new file mode 100644 index 0000000..eda98a5 --- /dev/null +++ b/arm/build/.cmake/api/v1/reply/target-multiple_joint_angle_control-c8360938bbb6b9a6904d.json @@ -0,0 +1,136 @@ +{ + "artifacts" : + [ + { + "path" : "multiple_joint_angle_control" + } + ], + "backtrace" : 1, + "backtraceGraph" : + { + "commands" : + [ + "add_executable", + "include_directories" + ], + "files" : + [ + "CMakeLists.txt" + ], + "nodes" : + [ + { + "file" : 0 + }, + { + "command" : 0, + "file" : 0, + "line" : 10, + "parent" : 0 + }, + { + "command" : 1, + "file" : 0, + "line" : 6, + "parent" : 0 + } + ] + }, + "compileGroups" : + [ + { + "compileCommandFragments" : + [ + { + "fragment" : " " + }, + { + "fragment" : "-std=gnu++17" + } + ], + "includes" : + [ + { + "backtrace" : 2, + "path" : "/usr/local/include/ddscxx" + }, + { + "backtrace" : 2, + "path" : "/usr/local/include/iceoryx/v2.0.2" + } + ], + "language" : "CXX", + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "id" : "multiple_joint_angle_control::@6890427a1f51a3e7e1df", + "link" : + { + "commandFragments" : + [ + { + "fragment" : "", + "role" : "flags" + }, + { + "fragment" : "-lunitree_sdk2", + "role" : "libraries" + }, + { + "fragment" : "-lddsc", + "role" : "libraries" + }, + { + "fragment" : "-lddscxx", + "role" : "libraries" + }, + { + "fragment" : "-lrt", + "role" : "libraries" + }, + { + "fragment" : "-lpthread", + "role" : "libraries" + } + ], + "language" : "CXX" + }, + "name" : "multiple_joint_angle_control", + "nameOnDisk" : "multiple_joint_angle_control", + "paths" : + { + "build" : ".", + "source" : "." + }, + "sourceGroups" : + [ + { + "name" : "Source Files", + "sourceIndexes" : + [ + 0, + 1 + ] + } + ], + "sources" : + [ + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/multiple_joint_angle_control.cpp", + "sourceGroupIndex" : 0 + }, + { + "backtrace" : 1, + "compileGroupIndex" : 0, + "path" : "src/msg/ArmString_.cpp", + "sourceGroupIndex" : 0 + } + ], + "type" : "EXECUTABLE" +} diff --git a/arm/build/CMakeCache.txt b/arm/build/CMakeCache.txt new file mode 100644 index 0000000..f6e1e15 --- /dev/null +++ b/arm/build/CMakeCache.txt @@ -0,0 +1,368 @@ +# This is the CMakeCache file. +# For build in directory: /home/unitree/unitreeApp/arm/build +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING= + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//CXX compiler +CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-9 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-9 + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-9 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-9 + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=marm_code + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Value Computed by CMake +marm_code_BINARY_DIR:STATIC=/home/unitree/unitreeApp/arm/build + +//Value Computed by CMake +marm_code_SOURCE_DIR:STATIC=/home/unitree/unitreeApp/arm + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/home/unitree/unitreeApp/arm/build +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=16 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=3 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Path to cache edit program executable. +CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/cmake-gui +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/home/unitree/unitreeApp/arm +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.16 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 + diff --git a/arm/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake b/arm/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake new file mode 100644 index 0000000..92d859a --- /dev/null +++ b/arm/build/CMakeFiles/3.16.3/CMakeCCompiler.cmake @@ -0,0 +1,76 @@ +set(CMAKE_C_COMPILER "/usr/bin/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "9.4.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_C_SIMULATE_VERSION "") + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-9") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-9") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_LIBRARY_ARCHITECTURE "aarch64-linux-gnu") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "aarch64-linux-gnu") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/aarch64-linux-gnu/9/include;/usr/local/include;/usr/include/aarch64-linux-gnu;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/aarch64-linux-gnu/9;/usr/lib/aarch64-linux-gnu;/usr/lib;/lib/aarch64-linux-gnu;/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/arm/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake b/arm/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..add9542 --- /dev/null +++ b/arm/build/CMakeFiles/3.16.3/CMakeCXXCompiler.cmake @@ -0,0 +1,88 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "9.4.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-9") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-9") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) +set(CMAKE_COMPILER_IS_MINGW ) +set(CMAKE_COMPILER_IS_CYGWIN ) +if(CMAKE_COMPILER_IS_CYGWIN) + set(CYGWIN 1) + set(UNIX 1) +endif() + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +if(CMAKE_COMPILER_IS_MINGW) + set(MINGW 1) +endif() +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "aarch64-linux-gnu") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "aarch64-linux-gnu") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/9;/usr/include/aarch64-linux-gnu/c++/9;/usr/include/c++/9/backward;/usr/lib/gcc/aarch64-linux-gnu/9/include;/usr/local/include;/usr/include/aarch64-linux-gnu;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/aarch64-linux-gnu/9;/usr/lib/aarch64-linux-gnu;/usr/lib;/lib/aarch64-linux-gnu;/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/arm/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin b/arm/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin new file mode 100755 index 0000000..f116311 Binary files /dev/null and b/arm/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_C.bin differ diff --git a/arm/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin b/arm/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin new file mode 100755 index 0000000..15a3aef Binary files /dev/null and b/arm/build/CMakeFiles/3.16.3/CMakeDetermineCompilerABI_CXX.bin differ diff --git a/arm/build/CMakeFiles/3.16.3/CMakeSystem.cmake b/arm/build/CMakeFiles/3.16.3/CMakeSystem.cmake new file mode 100644 index 0000000..5c95633 --- /dev/null +++ b/arm/build/CMakeFiles/3.16.3/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Linux-5.10.104-tegra") +set(CMAKE_HOST_SYSTEM_NAME "Linux") +set(CMAKE_HOST_SYSTEM_VERSION "5.10.104-tegra") +set(CMAKE_HOST_SYSTEM_PROCESSOR "aarch64") + + + +set(CMAKE_SYSTEM "Linux-5.10.104-tegra") +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_VERSION "5.10.104-tegra") +set(CMAKE_SYSTEM_PROCESSOR "aarch64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/arm/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c b/arm/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 0000000..d884b50 --- /dev/null +++ b/arm/build/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,671 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif +#if defined(__CLASSIC_C__) +/* cv-qualifiers did not exist in K&R C */ +# define const +# define volatile +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) +# define COMPILER_ID "Fujitsu" + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number components. */ +#ifdef COMPILER_VERSION_MAJOR +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + + +#if !defined(__STDC__) +# if (defined(_MSC_VER) && !defined(__clang__)) \ + || (defined(__ibmxl__) || defined(__IBMC__)) +# define C_DIALECT "90" +# else +# define C_DIALECT +# endif +#elif __STDC_VERSION__ >= 201000L +# define C_DIALECT "11" +#elif __STDC_VERSION__ >= 199901L +# define C_DIALECT "99" +#else +# define C_DIALECT "90" +#endif +const char* info_language_dialect_default = + "INFO" ":" "dialect_default[" C_DIALECT "]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; +#endif + require += info_language_dialect_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/arm/build/CMakeFiles/3.16.3/CompilerIdC/a.out b/arm/build/CMakeFiles/3.16.3/CompilerIdC/a.out new file mode 100755 index 0000000..08c93d6 Binary files /dev/null and b/arm/build/CMakeFiles/3.16.3/CompilerIdC/a.out differ diff --git a/arm/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp b/arm/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000..69cfdba --- /dev/null +++ b/arm/build/CMakeFiles/3.16.3/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,660 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version) +# define COMPILER_ID "Fujitsu" + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION % 10000) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) +# define COMPILER_ID "ADSP" +#if defined(__VISUALDSPVERSION__) + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXE) || defined(__CRAYXC) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number components. */ +#ifdef COMPILER_VERSION_MAJOR +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# define CXX_STD _MSVC_LANG +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_dialect_default = "INFO" ":" "dialect_default[" +#if CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L + "17" +#elif CXX_STD >= 201402L + "14" +#elif CXX_STD >= 201103L + "11" +#else + "98" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXE) || defined(__CRAYXC) + require += info_cray[argc]; +#endif + require += info_language_dialect_default[argc]; + (void)argv; + return require; +} diff --git a/arm/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out b/arm/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out new file mode 100755 index 0000000..fc43640 Binary files /dev/null and b/arm/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out differ diff --git a/arm/build/CMakeFiles/CMakeDirectoryInformation.cmake b/arm/build/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..0bff018 --- /dev/null +++ b/arm/build/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/unitree/unitreeApp/arm") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/unitree/unitreeApp/arm/build") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/arm/build/CMakeFiles/CMakeOutput.log b/arm/build/CMakeFiles/CMakeOutput.log new file mode 100644 index 0000000..37729f5 --- /dev/null +++ b/arm/build/CMakeFiles/CMakeOutput.log @@ -0,0 +1,451 @@ +The system is: Linux - 5.10.104-tegra - aarch64 +Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. +Compiler: /usr/bin/cc +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" + +The C compiler identification is GNU, found in "/home/unitree/unitreeApp/arm/build/CMakeFiles/3.16.3/CompilerIdC/a.out" + +Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. +Compiler: /usr/bin/c++ +Build flags: +Id flags: + +The output was: +0 + + +Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" + +The CXX compiler identification is GNU, found in "/home/unitree/unitreeApp/arm/build/CMakeFiles/3.16.3/CompilerIdCXX/a.out" + +Determining if the C compiler works passed with the following output: +Change Dir: /home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_01eef/fast && /usr/bin/make -f CMakeFiles/cmTC_01eef.dir/build.make CMakeFiles/cmTC_01eef.dir/build +make[1]: Entering directory '/home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_01eef.dir/testCCompiler.c.o +/usr/bin/cc -o CMakeFiles/cmTC_01eef.dir/testCCompiler.c.o -c /home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp/testCCompiler.c +Linking C executable cmTC_01eef +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_01eef.dir/link.txt --verbose=1 +/usr/bin/cc -rdynamic CMakeFiles/cmTC_01eef.dir/testCCompiler.c.o -o cmTC_01eef +make[1]: Leaving directory '/home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp' + + + +Detecting C compiler ABI info compiled with the following output: +Change Dir: /home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_d57fb/fast && /usr/bin/make -f CMakeFiles/cmTC_d57fb.dir/build.make CMakeFiles/cmTC_d57fb.dir/build +make[1]: Entering directory '/home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp' +Building C object CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o +/usr/bin/cc -v -o CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +Target: aarch64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o' '-c' '-mlittle-endian' '-mabi=lp64' + /usr/lib/gcc/aarch64-linux-gnu/9/cc1 -quiet -v -imultiarch aarch64-linux-gnu /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mlittle-endian -mabi=lp64 -auxbase-strip CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -o /tmp/cch2KMcj.s +GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (aarch64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring nonexistent directory "/usr/local/include/aarch64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/9/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/lib/gcc/aarch64-linux-gnu/9/include + /usr/local/include + /usr/include/aarch64-linux-gnu + /usr/include +End of search list. +GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (aarch64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: bae83efe2e4e7b8eac1a6149e340cc5c +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o' '-c' '-mlittle-endian' '-mabi=lp64' + as -v -EL -mabi=lp64 -o CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o /tmp/cch2KMcj.s +GNU assembler version 2.34 (aarch64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34 +COMPILER_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/:/lib/aarch64-linux-gnu/:/lib/../lib/:/usr/lib/aarch64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o' '-c' '-mlittle-endian' '-mabi=lp64' +Linking C executable cmTC_d57fb +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d57fb.dir/link.txt --verbose=1 +/usr/bin/cc -v -rdynamic CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o -o cmTC_d57fb +Using built-in specs. +COLLECT_GCC=/usr/bin/cc +COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper +Target: aarch64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COMPILER_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/:/lib/aarch64-linux-gnu/:/lib/../lib/:/usr/lib/aarch64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_d57fb' '-mlittle-endian' '-mabi=lp64' + /usr/lib/gcc/aarch64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/aarch64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccaxxPnN.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib/ld-linux-aarch64.so.1 -X -EL -maarch64linux --fix-cortex-a53-843419 -pie -z now -z relro -o cmTC_d57fb /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/Scrt1.o /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crti.o /usr/lib/gcc/aarch64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/aarch64-linux-gnu/9 -L/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu -L/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib -L/lib/aarch64-linux-gnu -L/lib/../lib -L/usr/lib/aarch64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/aarch64-linux-gnu/9/../../.. CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/aarch64-linux-gnu/9/crtendS.o /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_d57fb' '-mlittle-endian' '-mabi=lp64' +make[1]: Leaving directory '/home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp' + + + +Parsed C implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/aarch64-linux-gnu/9/include] + add: [/usr/local/include] + add: [/usr/include/aarch64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/aarch64-linux-gnu/9/include] ==> [/usr/lib/gcc/aarch64-linux-gnu/9/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/aarch64-linux-gnu] ==> [/usr/include/aarch64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/lib/gcc/aarch64-linux-gnu/9/include;/usr/local/include;/usr/include/aarch64-linux-gnu;/usr/include] + + +Parsed C implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/usr/bin/make cmTC_d57fb/fast && /usr/bin/make -f CMakeFiles/cmTC_d57fb.dir/build.make CMakeFiles/cmTC_d57fb.dir/build] + ignore line: [make[1]: Entering directory '/home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp'] + ignore line: [Building C object CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o] + ignore line: [/usr/bin/cc -v -o CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [Target: aarch64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o' '-c' '-mlittle-endian' '-mabi=lp64'] + ignore line: [ /usr/lib/gcc/aarch64-linux-gnu/9/cc1 -quiet -v -imultiarch aarch64-linux-gnu /usr/share/cmake-3.16/Modules/CMakeCCompilerABI.c -quiet -dumpbase CMakeCCompilerABI.c -mlittle-endian -mabi=lp64 -auxbase-strip CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -o /tmp/cch2KMcj.s] + ignore line: [GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (aarch64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/local/include/aarch64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/9/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/aarch64-linux-gnu/9/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/aarch64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C17 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (aarch64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: bae83efe2e4e7b8eac1a6149e340cc5c] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o' '-c' '-mlittle-endian' '-mabi=lp64'] + ignore line: [ as -v -EL -mabi=lp64 -o CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o /tmp/cch2KMcj.s] + ignore line: [GNU assembler version 2.34 (aarch64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34] + ignore line: [COMPILER_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/:/lib/aarch64-linux-gnu/:/lib/../lib/:/usr/lib/aarch64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o' '-c' '-mlittle-endian' '-mabi=lp64'] + ignore line: [Linking C executable cmTC_d57fb] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d57fb.dir/link.txt --verbose=1] + ignore line: [/usr/bin/cc -v -rdynamic CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o -o cmTC_d57fb ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper] + ignore line: [Target: aarch64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/:/lib/aarch64-linux-gnu/:/lib/../lib/:/usr/lib/aarch64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_d57fb' '-mlittle-endian' '-mabi=lp64'] + link line: [ /usr/lib/gcc/aarch64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/aarch64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccaxxPnN.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib/ld-linux-aarch64.so.1 -X -EL -maarch64linux --fix-cortex-a53-843419 -pie -z now -z relro -o cmTC_d57fb /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/Scrt1.o /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crti.o /usr/lib/gcc/aarch64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/aarch64-linux-gnu/9 -L/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu -L/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib -L/lib/aarch64-linux-gnu -L/lib/../lib -L/usr/lib/aarch64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/aarch64-linux-gnu/9/../../.. CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/aarch64-linux-gnu/9/crtendS.o /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/aarch64-linux-gnu/9/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/aarch64-linux-gnu/9/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccaxxPnN.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib/ld-linux-aarch64.so.1] ==> ignore + arg [-X] ==> ignore + arg [-EL] ==> ignore + arg [-maarch64linux] ==> ignore + arg [--fix-cortex-a53-843419] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_d57fb] ==> ignore + arg [/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/Scrt1.o] ==> ignore + arg [/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crti.o] ==> ignore + arg [/usr/lib/gcc/aarch64-linux-gnu/9/crtbeginS.o] ==> ignore + arg [-L/usr/lib/gcc/aarch64-linux-gnu/9] ==> dir [/usr/lib/gcc/aarch64-linux-gnu/9] + arg [-L/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu] ==> dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu] + arg [-L/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib] ==> dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib] + arg [-L/lib/aarch64-linux-gnu] ==> dir [/lib/aarch64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/aarch64-linux-gnu] ==> dir [/usr/lib/aarch64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/aarch64-linux-gnu/9/../../..] ==> dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../..] + arg [CMakeFiles/cmTC_d57fb.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [-lc] ==> lib [c] + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [/usr/lib/gcc/aarch64-linux-gnu/9/crtendS.o] ==> ignore + arg [/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crtn.o] ==> ignore + collapse library dir [/usr/lib/gcc/aarch64-linux-gnu/9] ==> [/usr/lib/gcc/aarch64-linux-gnu/9] + collapse library dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu] ==> [/usr/lib/aarch64-linux-gnu] + collapse library dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/aarch64-linux-gnu] ==> [/lib/aarch64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/aarch64-linux-gnu] ==> [/usr/lib/aarch64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../..] ==> [/usr/lib] + implicit libs: [gcc;gcc_s;c;gcc;gcc_s] + implicit dirs: [/usr/lib/gcc/aarch64-linux-gnu/9;/usr/lib/aarch64-linux-gnu;/usr/lib;/lib/aarch64-linux-gnu;/lib] + implicit fwks: [] + + +Determining if the CXX compiler works passed with the following output: +Change Dir: /home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_837ee/fast && /usr/bin/make -f CMakeFiles/cmTC_837ee.dir/build.make CMakeFiles/cmTC_837ee.dir/build +make[1]: Entering directory '/home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_837ee.dir/testCXXCompiler.cxx.o +/usr/bin/c++ -o CMakeFiles/cmTC_837ee.dir/testCXXCompiler.cxx.o -c /home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx +Linking CXX executable cmTC_837ee +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_837ee.dir/link.txt --verbose=1 +/usr/bin/c++ -rdynamic CMakeFiles/cmTC_837ee.dir/testCXXCompiler.cxx.o -o cmTC_837ee +make[1]: Leaving directory '/home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp' + + + +Detecting CXX compiler ABI info compiled with the following output: +Change Dir: /home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp + +Run Build Command(s):/usr/bin/make cmTC_56136/fast && /usr/bin/make -f CMakeFiles/cmTC_56136.dir/build.make CMakeFiles/cmTC_56136.dir/build +make[1]: Entering directory '/home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp' +Building CXX object CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o +/usr/bin/c++ -v -o CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +Target: aarch64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mlittle-endian' '-mabi=lp64' + /usr/lib/gcc/aarch64-linux-gnu/9/cc1plus -quiet -v -imultiarch aarch64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mlittle-endian -mabi=lp64 -auxbase-strip CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -o /tmp/ccrL3qji.s +GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (aarch64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +ignoring duplicate directory "/usr/include/aarch64-linux-gnu/c++/9" +ignoring nonexistent directory "/usr/local/include/aarch64-linux-gnu" +ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/9/include-fixed" +ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/include" +#include "..." search starts here: +#include <...> search starts here: + /usr/include/c++/9 + /usr/include/aarch64-linux-gnu/c++/9 + /usr/include/c++/9/backward + /usr/lib/gcc/aarch64-linux-gnu/9/include + /usr/local/include + /usr/include/aarch64-linux-gnu + /usr/include +End of search list. +GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (aarch64-linux-gnu) + compiled by GNU C version 9.4.0, GMP version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP + +GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 +Compiler executable checksum: 76f300a9566415b293c4e87b0a05621d +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mlittle-endian' '-mabi=lp64' + as -v -EL -mabi=lp64 -o CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccrL3qji.s +GNU assembler version 2.34 (aarch64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34 +COMPILER_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/:/lib/aarch64-linux-gnu/:/lib/../lib/:/usr/lib/aarch64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mlittle-endian' '-mabi=lp64' +Linking CXX executable cmTC_56136 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_56136.dir/link.txt --verbose=1 +/usr/bin/c++ -v -rdynamic CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_56136 +Using built-in specs. +COLLECT_GCC=/usr/bin/c++ +COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper +Target: aarch64-linux-gnu +Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu +Thread model: posix +gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) +COMPILER_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/ +LIBRARY_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/:/lib/aarch64-linux-gnu/:/lib/../lib/:/usr/lib/aarch64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../:/lib/:/usr/lib/ +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_56136' '-shared-libgcc' '-mlittle-endian' '-mabi=lp64' + /usr/lib/gcc/aarch64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/aarch64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccHF29RJ.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib/ld-linux-aarch64.so.1 -X -EL -maarch64linux --fix-cortex-a53-843419 -pie -z now -z relro -o cmTC_56136 /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/Scrt1.o /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crti.o /usr/lib/gcc/aarch64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/aarch64-linux-gnu/9 -L/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu -L/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib -L/lib/aarch64-linux-gnu -L/lib/../lib -L/usr/lib/aarch64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/aarch64-linux-gnu/9/../../.. CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/aarch64-linux-gnu/9/crtendS.o /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crtn.o +COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_56136' '-shared-libgcc' '-mlittle-endian' '-mabi=lp64' +make[1]: Leaving directory '/home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp' + + + +Parsed CXX implicit include dir info from above output: rv=done + found start of include info + found start of implicit include info + add: [/usr/include/c++/9] + add: [/usr/include/aarch64-linux-gnu/c++/9] + add: [/usr/include/c++/9/backward] + add: [/usr/lib/gcc/aarch64-linux-gnu/9/include] + add: [/usr/local/include] + add: [/usr/include/aarch64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/include/c++/9] ==> [/usr/include/c++/9] + collapse include dir [/usr/include/aarch64-linux-gnu/c++/9] ==> [/usr/include/aarch64-linux-gnu/c++/9] + collapse include dir [/usr/include/c++/9/backward] ==> [/usr/include/c++/9/backward] + collapse include dir [/usr/lib/gcc/aarch64-linux-gnu/9/include] ==> [/usr/lib/gcc/aarch64-linux-gnu/9/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/aarch64-linux-gnu] ==> [/usr/include/aarch64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/include/c++/9;/usr/include/aarch64-linux-gnu/c++/9;/usr/include/c++/9/backward;/usr/lib/gcc/aarch64-linux-gnu/9/include;/usr/local/include;/usr/include/aarch64-linux-gnu;/usr/include] + + +Parsed CXX implicit link information from above output: + link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] + ignore line: [Change Dir: /home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp] + ignore line: [] + ignore line: [Run Build Command(s):/usr/bin/make cmTC_56136/fast && /usr/bin/make -f CMakeFiles/cmTC_56136.dir/build.make CMakeFiles/cmTC_56136.dir/build] + ignore line: [make[1]: Entering directory '/home/unitree/unitreeApp/arm/build/CMakeFiles/CMakeTmp'] + ignore line: [Building CXX object CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o] + ignore line: [/usr/bin/c++ -v -o CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [Target: aarch64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mlittle-endian' '-mabi=lp64'] + ignore line: [ /usr/lib/gcc/aarch64-linux-gnu/9/cc1plus -quiet -v -imultiarch aarch64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.16/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpbase CMakeCXXCompilerABI.cpp -mlittle-endian -mabi=lp64 -auxbase-strip CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -o /tmp/ccrL3qji.s] + ignore line: [GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (aarch64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring duplicate directory "/usr/include/aarch64-linux-gnu/c++/9"] + ignore line: [ignoring nonexistent directory "/usr/local/include/aarch64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/9/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/include/c++/9] + ignore line: [ /usr/include/aarch64-linux-gnu/c++/9] + ignore line: [ /usr/include/c++/9/backward] + ignore line: [ /usr/lib/gcc/aarch64-linux-gnu/9/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/aarch64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [GNU C++14 (Ubuntu 9.4.0-1ubuntu1~20.04.2) version 9.4.0 (aarch64-linux-gnu)] + ignore line: [ compiled by GNU C version 9.4.0 GMP version 6.2.0 MPFR version 4.0.2 MPC version 1.1.0 isl version isl-0.22.1-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [Compiler executable checksum: 76f300a9566415b293c4e87b0a05621d] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mlittle-endian' '-mabi=lp64'] + ignore line: [ as -v -EL -mabi=lp64 -o CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccrL3qji.s] + ignore line: [GNU assembler version 2.34 (aarch64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34] + ignore line: [COMPILER_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/:/lib/aarch64-linux-gnu/:/lib/../lib/:/usr/lib/aarch64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mlittle-endian' '-mabi=lp64'] + ignore line: [Linking CXX executable cmTC_56136] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_56136.dir/link.txt --verbose=1] + ignore line: [/usr/bin/c++ -v -rdynamic CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_56136 ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper] + ignore line: [Target: aarch64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu] + ignore line: [Thread model: posix] + ignore line: [gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.2) ] + ignore line: [COMPILER_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/aarch64-linux-gnu/9/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib/:/lib/aarch64-linux-gnu/:/lib/../lib/:/usr/lib/aarch64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/aarch64-linux-gnu/9/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_56136' '-shared-libgcc' '-mlittle-endian' '-mabi=lp64'] + link line: [ /usr/lib/gcc/aarch64-linux-gnu/9/collect2 -plugin /usr/lib/gcc/aarch64-linux-gnu/9/liblto_plugin.so -plugin-opt=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper -plugin-opt=-fresolution=/tmp/ccHF29RJ.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib/ld-linux-aarch64.so.1 -X -EL -maarch64linux --fix-cortex-a53-843419 -pie -z now -z relro -o cmTC_56136 /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/Scrt1.o /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crti.o /usr/lib/gcc/aarch64-linux-gnu/9/crtbeginS.o -L/usr/lib/gcc/aarch64-linux-gnu/9 -L/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu -L/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib -L/lib/aarch64-linux-gnu -L/lib/../lib -L/usr/lib/aarch64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/aarch64-linux-gnu/9/../../.. CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/aarch64-linux-gnu/9/crtendS.o /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crtn.o] + arg [/usr/lib/gcc/aarch64-linux-gnu/9/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/lib/gcc/aarch64-linux-gnu/9/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/lib/gcc/aarch64-linux-gnu/9/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccHF29RJ.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib/ld-linux-aarch64.so.1] ==> ignore + arg [-X] ==> ignore + arg [-EL] ==> ignore + arg [-maarch64linux] ==> ignore + arg [--fix-cortex-a53-843419] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_56136] ==> ignore + arg [/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/Scrt1.o] ==> ignore + arg [/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crti.o] ==> ignore + arg [/usr/lib/gcc/aarch64-linux-gnu/9/crtbeginS.o] ==> ignore + arg [-L/usr/lib/gcc/aarch64-linux-gnu/9] ==> dir [/usr/lib/gcc/aarch64-linux-gnu/9] + arg [-L/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu] ==> dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu] + arg [-L/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib] ==> dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib] + arg [-L/lib/aarch64-linux-gnu] ==> dir [/lib/aarch64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/aarch64-linux-gnu] ==> dir [/usr/lib/aarch64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/aarch64-linux-gnu/9/../../..] ==> dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../..] + arg [CMakeFiles/cmTC_56136.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/aarch64-linux-gnu/9/crtendS.o] ==> ignore + arg [/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/crtn.o] ==> ignore + collapse library dir [/usr/lib/gcc/aarch64-linux-gnu/9] ==> [/usr/lib/gcc/aarch64-linux-gnu/9] + collapse library dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu] ==> [/usr/lib/aarch64-linux-gnu] + collapse library dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/aarch64-linux-gnu] ==> [/lib/aarch64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/aarch64-linux-gnu] ==> [/usr/lib/aarch64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/aarch64-linux-gnu/9/../../..] ==> [/usr/lib] + implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc] + implicit dirs: [/usr/lib/gcc/aarch64-linux-gnu/9;/usr/lib/aarch64-linux-gnu;/usr/lib;/lib/aarch64-linux-gnu;/lib] + implicit fwks: [] + + diff --git a/arm/build/CMakeFiles/Makefile.cmake b/arm/build/CMakeFiles/Makefile.cmake new file mode 100644 index 0000000..100be67 --- /dev/null +++ b/arm/build/CMakeFiles/Makefile.cmake @@ -0,0 +1,53 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# The generator used is: +set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") + +# The top level Makefile was generated from the following files: +set(CMAKE_MAKEFILE_DEPENDS + "CMakeCache.txt" + "../CMakeLists.txt" + "CMakeFiles/3.16.3/CMakeCCompiler.cmake" + "CMakeFiles/3.16.3/CMakeCXXCompiler.cmake" + "CMakeFiles/3.16.3/CMakeSystem.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCXXInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake" + "/usr/share/cmake-3.16/Modules/CMakeCommonLanguageInclude.cmake" + "/usr/share/cmake-3.16/Modules/CMakeGenericSystem.cmake" + "/usr/share/cmake-3.16/Modules/CMakeInitializeConfigs.cmake" + "/usr/share/cmake-3.16/Modules/CMakeLanguageInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeSystemSpecificInformation.cmake" + "/usr/share/cmake-3.16/Modules/CMakeSystemSpecificInitialize.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/GNU-C.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/GNU-CXX.cmake" + "/usr/share/cmake-3.16/Modules/Compiler/GNU.cmake" + "/usr/share/cmake-3.16/Modules/Internal/CMakeCheckCompilerFlag.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU-C.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU-CXX.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux-GNU.cmake" + "/usr/share/cmake-3.16/Modules/Platform/Linux.cmake" + "/usr/share/cmake-3.16/Modules/Platform/UnixPaths.cmake" + ) + +# The corresponding makefile is: +set(CMAKE_MAKEFILE_OUTPUTS + "Makefile" + "CMakeFiles/cmake.check_cache" + ) + +# Byproducts of CMake generate step: +set(CMAKE_MAKEFILE_PRODUCTS + "CMakeFiles/CMakeDirectoryInformation.cmake" + ) + +# Dependency information for all targets: +set(CMAKE_DEPEND_INFO_FILES + "CMakeFiles/get_arm_joint_angle.dir/DependInfo.cmake" + "CMakeFiles/arm_zero_control.dir/DependInfo.cmake" + "CMakeFiles/joint_enable_control.dir/DependInfo.cmake" + "CMakeFiles/multiple_joint_angle_control.dir/DependInfo.cmake" + "CMakeFiles/joint_angle_control.dir/DependInfo.cmake" + ) diff --git a/arm/build/CMakeFiles/Makefile2 b/arm/build/CMakeFiles/Makefile2 new file mode 100644 index 0000000..ab8e37c --- /dev/null +++ b/arm/build/CMakeFiles/Makefile2 @@ -0,0 +1,222 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Default target executed when no arguments are given to make. +default_target: all + +.PHONY : default_target + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/unitree/unitreeApp/arm + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/unitree/unitreeApp/arm/build + +#============================================================================= +# Directory level rules for the build root directory + +# The main recursive "all" target. +all: CMakeFiles/get_arm_joint_angle.dir/all +all: CMakeFiles/arm_zero_control.dir/all +all: CMakeFiles/joint_enable_control.dir/all +all: CMakeFiles/multiple_joint_angle_control.dir/all +all: CMakeFiles/joint_angle_control.dir/all + +.PHONY : all + +# The main recursive "preinstall" target. +preinstall: + +.PHONY : preinstall + +# The main recursive "clean" target. +clean: CMakeFiles/get_arm_joint_angle.dir/clean +clean: CMakeFiles/arm_zero_control.dir/clean +clean: CMakeFiles/joint_enable_control.dir/clean +clean: CMakeFiles/multiple_joint_angle_control.dir/clean +clean: CMakeFiles/joint_angle_control.dir/clean + +.PHONY : clean + +#============================================================================= +# Target rules for target CMakeFiles/get_arm_joint_angle.dir + +# All Build rule for target. +CMakeFiles/get_arm_joint_angle.dir/all: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/depend + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=4,5,6,7 "Built target get_arm_joint_angle" +.PHONY : CMakeFiles/get_arm_joint_angle.dir/all + +# Build rule for subdir invocation for target. +CMakeFiles/get_arm_joint_angle.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles 4 + $(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/get_arm_joint_angle.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles 0 +.PHONY : CMakeFiles/get_arm_joint_angle.dir/rule + +# Convenience name for target. +get_arm_joint_angle: CMakeFiles/get_arm_joint_angle.dir/rule + +.PHONY : get_arm_joint_angle + +# clean rule for target. +CMakeFiles/get_arm_joint_angle.dir/clean: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/clean +.PHONY : CMakeFiles/get_arm_joint_angle.dir/clean + +#============================================================================= +# Target rules for target CMakeFiles/arm_zero_control.dir + +# All Build rule for target. +CMakeFiles/arm_zero_control.dir/all: + $(MAKE) -f CMakeFiles/arm_zero_control.dir/build.make CMakeFiles/arm_zero_control.dir/depend + $(MAKE) -f CMakeFiles/arm_zero_control.dir/build.make CMakeFiles/arm_zero_control.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=1,2,3 "Built target arm_zero_control" +.PHONY : CMakeFiles/arm_zero_control.dir/all + +# Build rule for subdir invocation for target. +CMakeFiles/arm_zero_control.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles 3 + $(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/arm_zero_control.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles 0 +.PHONY : CMakeFiles/arm_zero_control.dir/rule + +# Convenience name for target. +arm_zero_control: CMakeFiles/arm_zero_control.dir/rule + +.PHONY : arm_zero_control + +# clean rule for target. +CMakeFiles/arm_zero_control.dir/clean: + $(MAKE) -f CMakeFiles/arm_zero_control.dir/build.make CMakeFiles/arm_zero_control.dir/clean +.PHONY : CMakeFiles/arm_zero_control.dir/clean + +#============================================================================= +# Target rules for target CMakeFiles/joint_enable_control.dir + +# All Build rule for target. +CMakeFiles/joint_enable_control.dir/all: + $(MAKE) -f CMakeFiles/joint_enable_control.dir/build.make CMakeFiles/joint_enable_control.dir/depend + $(MAKE) -f CMakeFiles/joint_enable_control.dir/build.make CMakeFiles/joint_enable_control.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=11,12,13 "Built target joint_enable_control" +.PHONY : CMakeFiles/joint_enable_control.dir/all + +# Build rule for subdir invocation for target. +CMakeFiles/joint_enable_control.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles 3 + $(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/joint_enable_control.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles 0 +.PHONY : CMakeFiles/joint_enable_control.dir/rule + +# Convenience name for target. +joint_enable_control: CMakeFiles/joint_enable_control.dir/rule + +.PHONY : joint_enable_control + +# clean rule for target. +CMakeFiles/joint_enable_control.dir/clean: + $(MAKE) -f CMakeFiles/joint_enable_control.dir/build.make CMakeFiles/joint_enable_control.dir/clean +.PHONY : CMakeFiles/joint_enable_control.dir/clean + +#============================================================================= +# Target rules for target CMakeFiles/multiple_joint_angle_control.dir + +# All Build rule for target. +CMakeFiles/multiple_joint_angle_control.dir/all: + $(MAKE) -f CMakeFiles/multiple_joint_angle_control.dir/build.make CMakeFiles/multiple_joint_angle_control.dir/depend + $(MAKE) -f CMakeFiles/multiple_joint_angle_control.dir/build.make CMakeFiles/multiple_joint_angle_control.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=14,15,16 "Built target multiple_joint_angle_control" +.PHONY : CMakeFiles/multiple_joint_angle_control.dir/all + +# Build rule for subdir invocation for target. +CMakeFiles/multiple_joint_angle_control.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles 3 + $(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/multiple_joint_angle_control.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles 0 +.PHONY : CMakeFiles/multiple_joint_angle_control.dir/rule + +# Convenience name for target. +multiple_joint_angle_control: CMakeFiles/multiple_joint_angle_control.dir/rule + +.PHONY : multiple_joint_angle_control + +# clean rule for target. +CMakeFiles/multiple_joint_angle_control.dir/clean: + $(MAKE) -f CMakeFiles/multiple_joint_angle_control.dir/build.make CMakeFiles/multiple_joint_angle_control.dir/clean +.PHONY : CMakeFiles/multiple_joint_angle_control.dir/clean + +#============================================================================= +# Target rules for target CMakeFiles/joint_angle_control.dir + +# All Build rule for target. +CMakeFiles/joint_angle_control.dir/all: + $(MAKE) -f CMakeFiles/joint_angle_control.dir/build.make CMakeFiles/joint_angle_control.dir/depend + $(MAKE) -f CMakeFiles/joint_angle_control.dir/build.make CMakeFiles/joint_angle_control.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=8,9,10 "Built target joint_angle_control" +.PHONY : CMakeFiles/joint_angle_control.dir/all + +# Build rule for subdir invocation for target. +CMakeFiles/joint_angle_control.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles 3 + $(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/joint_angle_control.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles 0 +.PHONY : CMakeFiles/joint_angle_control.dir/rule + +# Convenience name for target. +joint_angle_control: CMakeFiles/joint_angle_control.dir/rule + +.PHONY : joint_angle_control + +# clean rule for target. +CMakeFiles/joint_angle_control.dir/clean: + $(MAKE) -f CMakeFiles/joint_angle_control.dir/build.make CMakeFiles/joint_angle_control.dir/clean +.PHONY : CMakeFiles/joint_angle_control.dir/clean + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/arm/build/CMakeFiles/TargetDirectories.txt b/arm/build/CMakeFiles/TargetDirectories.txt new file mode 100644 index 0000000..47758ff --- /dev/null +++ b/arm/build/CMakeFiles/TargetDirectories.txt @@ -0,0 +1,7 @@ +/home/unitree/unitreeApp/arm/build/CMakeFiles/rebuild_cache.dir +/home/unitree/unitreeApp/arm/build/CMakeFiles/edit_cache.dir +/home/unitree/unitreeApp/arm/build/CMakeFiles/get_arm_joint_angle.dir +/home/unitree/unitreeApp/arm/build/CMakeFiles/arm_zero_control.dir +/home/unitree/unitreeApp/arm/build/CMakeFiles/joint_enable_control.dir +/home/unitree/unitreeApp/arm/build/CMakeFiles/multiple_joint_angle_control.dir +/home/unitree/unitreeApp/arm/build/CMakeFiles/joint_angle_control.dir diff --git a/arm/build/CMakeFiles/arm_zero_control.dir/CXX.includecache b/arm/build/CMakeFiles/arm_zero_control.dir/CXX.includecache new file mode 100644 index 0000000..bbf349b --- /dev/null +++ b/arm/build/CMakeFiles/arm_zero_control.dir/CXX.includecache @@ -0,0 +1,168 @@ +#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) + +#IncludeRegexScan: ^.*$ + +#IncludeRegexComplain: ^$ + +#IncludeRegexTransform: + +/home/unitree/unitreeApp/arm/src/arm_zero_control.cpp +unitree/robot/channel/channel_publisher.hpp +- +unitree/common/time/time_tool.hpp +- +msg/ArmString_.hpp +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + +/home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp +ArmString_.hpp +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp +string +- +dds/topic/TopicTraits.hpp +/home/unitree/unitreeApp/arm/src/msg/dds/topic/TopicTraits.hpp +org/eclipse/cyclonedds/topic/datatopic.hpp +/home/unitree/unitreeApp/arm/src/msg/org/eclipse/cyclonedds/topic/datatopic.hpp + +/usr/local/include/ddscxx/dds/core/detail/export.hpp + +/usr/local/include/ddscxx/dds/core/detail/macros.hpp +iostream +- +string.h +- +dds/core/detail/export.hpp +/usr/local/include/ddscxx/dds/core/detail/dds/core/detail/export.hpp +dds/core/detail/maplog.hpp +- +cstring +- + +/usr/local/include/ddscxx/dds/core/macros.hpp +dds/core/detail/macros.hpp +- + +/usr/local/include/ddscxx/dds/features.hpp + +/usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +string +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +dds/ddsrt/endian.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/dds/ddsrt/endian.h +org/eclipse/cyclonedds/core/type_helpers.hpp +- +org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +- +stdint.h +- +string +- +stdexcept +- +stack +- +cassert +- +dds/core/macros.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +dds/core/macros.hpp +- +cstdint +- +list +- +vector +- +map +- +atomic +- +mutex +- +boost/type_traits.hpp +- +type_traits +- +cdr_enums.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +cstddef +- +dds/core/macros.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +type_traits +- +org/eclipse/cyclonedds/core/Missing.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +dds/ddsrt/heap.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsrt/heap.h +dds/ddsi/ddsi_serdata.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_serdata.h +org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +dds/features.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/features.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +memory +- +string +- +cstring +- +vector +- +atomic +- +dds/ddsrt/md5.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsrt/md5.h +org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +org/eclipse/cyclonedds/core/cdr/fragchain.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +org/eclipse/cyclonedds/topic/TopicTraits.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/topic/TopicTraits.hpp +org/eclipse/cyclonedds/topic/hash.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/topic/hash.hpp +dds/ddsi/ddsi_shm_transport.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_shm_transport.h + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp +dds/core/macros.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/core/macros.hpp +dds/ddsi/ddsi_keyhash.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_keyhash.h +vector +- + diff --git a/arm/build/CMakeFiles/arm_zero_control.dir/DependInfo.cmake b/arm/build/CMakeFiles/arm_zero_control.dir/DependInfo.cmake new file mode 100644 index 0000000..26ab7ca --- /dev/null +++ b/arm/build/CMakeFiles/arm_zero_control.dir/DependInfo.cmake @@ -0,0 +1,23 @@ +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + "CXX" + ) +# The set of files for implicit dependencies of each language: +set(CMAKE_DEPENDS_CHECK_CXX + "/home/unitree/unitreeApp/arm/src/arm_zero_control.cpp" "/home/unitree/unitreeApp/arm/build/CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o" + "/home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp" "/home/unitree/unitreeApp/arm/build/CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o" + ) +set(CMAKE_CXX_COMPILER_ID "GNU") + +# The include file search paths: +set(CMAKE_CXX_TARGET_INCLUDE_PATH + "/usr/local/include/ddscxx" + "/usr/local/include/iceoryx/v2.0.2" + ) + +# Targets to which this target links. +set(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/arm/build/CMakeFiles/arm_zero_control.dir/build.make b/arm/build/CMakeFiles/arm_zero_control.dir/build.make new file mode 100644 index 0000000..d6cfae7 --- /dev/null +++ b/arm/build/CMakeFiles/arm_zero_control.dir/build.make @@ -0,0 +1,113 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/unitree/unitreeApp/arm + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/unitree/unitreeApp/arm/build + +# Include any dependencies generated for this target. +include CMakeFiles/arm_zero_control.dir/depend.make + +# Include the progress variables for this target. +include CMakeFiles/arm_zero_control.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/arm_zero_control.dir/flags.make + +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: CMakeFiles/arm_zero_control.dir/flags.make +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: ../src/arm_zero_control.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o -c /home/unitree/unitreeApp/arm/src/arm_zero_control.cpp + +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/unitree/unitreeApp/arm/src/arm_zero_control.cpp > CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.i + +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/unitree/unitreeApp/arm/src/arm_zero_control.cpp -o CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.s + +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: CMakeFiles/arm_zero_control.dir/flags.make +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building CXX object CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o -c /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp + +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp > CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.i + +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp -o CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.s + +# Object files for target arm_zero_control +arm_zero_control_OBJECTS = \ +"CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o" \ +"CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o" + +# External object files for target arm_zero_control +arm_zero_control_EXTERNAL_OBJECTS = + +arm_zero_control: CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o +arm_zero_control: CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o +arm_zero_control: CMakeFiles/arm_zero_control.dir/build.make +arm_zero_control: CMakeFiles/arm_zero_control.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Linking CXX executable arm_zero_control" + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/arm_zero_control.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/arm_zero_control.dir/build: arm_zero_control + +.PHONY : CMakeFiles/arm_zero_control.dir/build + +CMakeFiles/arm_zero_control.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles/arm_zero_control.dir/cmake_clean.cmake +.PHONY : CMakeFiles/arm_zero_control.dir/clean + +CMakeFiles/arm_zero_control.dir/depend: + cd /home/unitree/unitreeApp/arm/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/unitree/unitreeApp/arm /home/unitree/unitreeApp/arm /home/unitree/unitreeApp/arm/build /home/unitree/unitreeApp/arm/build /home/unitree/unitreeApp/arm/build/CMakeFiles/arm_zero_control.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : CMakeFiles/arm_zero_control.dir/depend + diff --git a/arm/build/CMakeFiles/arm_zero_control.dir/cmake_clean.cmake b/arm/build/CMakeFiles/arm_zero_control.dir/cmake_clean.cmake new file mode 100644 index 0000000..ce1af63 --- /dev/null +++ b/arm/build/CMakeFiles/arm_zero_control.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o" + "CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o" + "arm_zero_control" + "arm_zero_control.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/arm_zero_control.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/arm/build/CMakeFiles/arm_zero_control.dir/depend.internal b/arm/build/CMakeFiles/arm_zero_control.dir/depend.internal new file mode 100644 index 0000000..fc8ba69 --- /dev/null +++ b/arm/build/CMakeFiles/arm_zero_control.dir/depend.internal @@ -0,0 +1,43 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o + /home/unitree/unitreeApp/arm/src/arm_zero_control.cpp + /home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + /usr/local/include/ddscxx/dds/core/detail/export.hpp + /usr/local/include/ddscxx/dds/core/detail/macros.hpp + /usr/local/include/ddscxx/dds/core/macros.hpp + /usr/local/include/ddscxx/dds/features.hpp + /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o + /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp + /home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + /usr/local/include/ddscxx/dds/core/detail/export.hpp + /usr/local/include/ddscxx/dds/core/detail/macros.hpp + /usr/local/include/ddscxx/dds/core/macros.hpp + /usr/local/include/ddscxx/dds/features.hpp + /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp diff --git a/arm/build/CMakeFiles/arm_zero_control.dir/depend.make b/arm/build/CMakeFiles/arm_zero_control.dir/depend.make new file mode 100644 index 0000000..350afd8 --- /dev/null +++ b/arm/build/CMakeFiles/arm_zero_control.dir/depend.make @@ -0,0 +1,43 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: ../src/arm_zero_control.cpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: ../src/msg/ArmString_.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/dds/core/detail/export.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/dds/core/detail/macros.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/dds/core/macros.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/dds/features.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp + +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.cpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/export.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/macros.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/macros.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/features.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp + diff --git a/arm/build/CMakeFiles/arm_zero_control.dir/flags.make b/arm/build/CMakeFiles/arm_zero_control.dir/flags.make new file mode 100644 index 0000000..7b67727 --- /dev/null +++ b/arm/build/CMakeFiles/arm_zero_control.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# compile CXX with /usr/bin/c++ +CXX_FLAGS = -std=gnu++17 + +CXX_DEFINES = + +CXX_INCLUDES = -I/usr/local/include/ddscxx -I/usr/local/include/iceoryx/v2.0.2 + diff --git a/arm/build/CMakeFiles/arm_zero_control.dir/link.txt b/arm/build/CMakeFiles/arm_zero_control.dir/link.txt new file mode 100644 index 0000000..3a37372 --- /dev/null +++ b/arm/build/CMakeFiles/arm_zero_control.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o -o arm_zero_control -lunitree_sdk2 -lddsc -lddscxx -lrt -lpthread diff --git a/arm/build/CMakeFiles/arm_zero_control.dir/progress.make b/arm/build/CMakeFiles/arm_zero_control.dir/progress.make new file mode 100644 index 0000000..6a9dc74 --- /dev/null +++ b/arm/build/CMakeFiles/arm_zero_control.dir/progress.make @@ -0,0 +1,4 @@ +CMAKE_PROGRESS_1 = 1 +CMAKE_PROGRESS_2 = 2 +CMAKE_PROGRESS_3 = 3 + diff --git a/arm/build/CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o b/arm/build/CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o new file mode 100644 index 0000000..29866ec Binary files /dev/null and b/arm/build/CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o differ diff --git a/arm/build/CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o b/arm/build/CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o new file mode 100644 index 0000000..7ef238d Binary files /dev/null and b/arm/build/CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o differ diff --git a/arm/build/CMakeFiles/cmake.check_cache b/arm/build/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/arm/build/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/CXX.includecache b/arm/build/CMakeFiles/get_arm_joint_angle.dir/CXX.includecache new file mode 100644 index 0000000..3e49ff7 --- /dev/null +++ b/arm/build/CMakeFiles/get_arm_joint_angle.dir/CXX.includecache @@ -0,0 +1,180 @@ +#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) + +#IncludeRegexScan: ^.*$ + +#IncludeRegexComplain: ^$ + +#IncludeRegexTransform: + +/home/unitree/unitreeApp/arm/src/get_arm_joint_angle.cpp +unitree/robot/channel/channel_subscriber.hpp +- +unitree/common/time/time_tool.hpp +- +msg/PubServoInfo_.hpp +/home/unitree/unitreeApp/arm/src/msg/PubServoInfo_.hpp +msg/ArmString_.hpp +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + +/home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp +ArmString_.hpp +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp +string +- +dds/topic/TopicTraits.hpp +/home/unitree/unitreeApp/arm/src/msg/dds/topic/TopicTraits.hpp +org/eclipse/cyclonedds/topic/datatopic.hpp +/home/unitree/unitreeApp/arm/src/msg/org/eclipse/cyclonedds/topic/datatopic.hpp + +/home/unitree/unitreeApp/arm/src/msg/PubServoInfo_.cpp +PubServoInfo_.hpp +/home/unitree/unitreeApp/arm/src/msg/PubServoInfo_.hpp + +/home/unitree/unitreeApp/arm/src/msg/PubServoInfo_.hpp +dds/topic/TopicTraits.hpp +/home/unitree/unitreeApp/arm/src/msg/dds/topic/TopicTraits.hpp +org/eclipse/cyclonedds/topic/datatopic.hpp +/home/unitree/unitreeApp/arm/src/msg/org/eclipse/cyclonedds/topic/datatopic.hpp + +/usr/local/include/ddscxx/dds/core/detail/export.hpp + +/usr/local/include/ddscxx/dds/core/detail/macros.hpp +iostream +- +string.h +- +dds/core/detail/export.hpp +/usr/local/include/ddscxx/dds/core/detail/dds/core/detail/export.hpp +dds/core/detail/maplog.hpp +- +cstring +- + +/usr/local/include/ddscxx/dds/core/macros.hpp +dds/core/detail/macros.hpp +- + +/usr/local/include/ddscxx/dds/features.hpp + +/usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +string +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +dds/ddsrt/endian.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/dds/ddsrt/endian.h +org/eclipse/cyclonedds/core/type_helpers.hpp +- +org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +- +stdint.h +- +string +- +stdexcept +- +stack +- +cassert +- +dds/core/macros.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +dds/core/macros.hpp +- +cstdint +- +list +- +vector +- +map +- +atomic +- +mutex +- +boost/type_traits.hpp +- +type_traits +- +cdr_enums.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +cstddef +- +dds/core/macros.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +type_traits +- +org/eclipse/cyclonedds/core/Missing.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +dds/ddsrt/heap.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsrt/heap.h +dds/ddsi/ddsi_serdata.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_serdata.h +org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +dds/features.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/features.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +memory +- +string +- +cstring +- +vector +- +atomic +- +dds/ddsrt/md5.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsrt/md5.h +org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +org/eclipse/cyclonedds/core/cdr/fragchain.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +org/eclipse/cyclonedds/topic/TopicTraits.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/topic/TopicTraits.hpp +org/eclipse/cyclonedds/topic/hash.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/topic/hash.hpp +dds/ddsi/ddsi_shm_transport.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_shm_transport.h + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp +dds/core/macros.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/core/macros.hpp +dds/ddsi/ddsi_keyhash.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_keyhash.h +vector +- + diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/DependInfo.cmake b/arm/build/CMakeFiles/get_arm_joint_angle.dir/DependInfo.cmake new file mode 100644 index 0000000..c1d1eb1 --- /dev/null +++ b/arm/build/CMakeFiles/get_arm_joint_angle.dir/DependInfo.cmake @@ -0,0 +1,24 @@ +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + "CXX" + ) +# The set of files for implicit dependencies of each language: +set(CMAKE_DEPENDS_CHECK_CXX + "/home/unitree/unitreeApp/arm/src/get_arm_joint_angle.cpp" "/home/unitree/unitreeApp/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o" + "/home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp" "/home/unitree/unitreeApp/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o" + "/home/unitree/unitreeApp/arm/src/msg/PubServoInfo_.cpp" "/home/unitree/unitreeApp/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o" + ) +set(CMAKE_CXX_COMPILER_ID "GNU") + +# The include file search paths: +set(CMAKE_CXX_TARGET_INCLUDE_PATH + "/usr/local/include/ddscxx" + "/usr/local/include/iceoryx/v2.0.2" + ) + +# Targets to which this target links. +set(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/build.make b/arm/build/CMakeFiles/get_arm_joint_angle.dir/build.make new file mode 100644 index 0000000..38eaa14 --- /dev/null +++ b/arm/build/CMakeFiles/get_arm_joint_angle.dir/build.make @@ -0,0 +1,128 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/unitree/unitreeApp/arm + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/unitree/unitreeApp/arm/build + +# Include any dependencies generated for this target. +include CMakeFiles/get_arm_joint_angle.dir/depend.make + +# Include the progress variables for this target. +include CMakeFiles/get_arm_joint_angle.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/get_arm_joint_angle.dir/flags.make + +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: CMakeFiles/get_arm_joint_angle.dir/flags.make +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: ../src/get_arm_joint_angle.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o -c /home/unitree/unitreeApp/arm/src/get_arm_joint_angle.cpp + +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/unitree/unitreeApp/arm/src/get_arm_joint_angle.cpp > CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.i + +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/unitree/unitreeApp/arm/src/get_arm_joint_angle.cpp -o CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.s + +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: CMakeFiles/get_arm_joint_angle.dir/flags.make +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building CXX object CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o -c /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp + +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp > CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.i + +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp -o CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.s + +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: CMakeFiles/get_arm_joint_angle.dir/flags.make +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: ../src/msg/PubServoInfo_.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Building CXX object CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o -c /home/unitree/unitreeApp/arm/src/msg/PubServoInfo_.cpp + +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/unitree/unitreeApp/arm/src/msg/PubServoInfo_.cpp > CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.i + +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/unitree/unitreeApp/arm/src/msg/PubServoInfo_.cpp -o CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.s + +# Object files for target get_arm_joint_angle +get_arm_joint_angle_OBJECTS = \ +"CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o" \ +"CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o" \ +"CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o" + +# External object files for target get_arm_joint_angle +get_arm_joint_angle_EXTERNAL_OBJECTS = + +get_arm_joint_angle: CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o +get_arm_joint_angle: CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o +get_arm_joint_angle: CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o +get_arm_joint_angle: CMakeFiles/get_arm_joint_angle.dir/build.make +get_arm_joint_angle: CMakeFiles/get_arm_joint_angle.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_4) "Linking CXX executable get_arm_joint_angle" + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/get_arm_joint_angle.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/get_arm_joint_angle.dir/build: get_arm_joint_angle + +.PHONY : CMakeFiles/get_arm_joint_angle.dir/build + +CMakeFiles/get_arm_joint_angle.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles/get_arm_joint_angle.dir/cmake_clean.cmake +.PHONY : CMakeFiles/get_arm_joint_angle.dir/clean + +CMakeFiles/get_arm_joint_angle.dir/depend: + cd /home/unitree/unitreeApp/arm/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/unitree/unitreeApp/arm /home/unitree/unitreeApp/arm /home/unitree/unitreeApp/arm/build /home/unitree/unitreeApp/arm/build /home/unitree/unitreeApp/arm/build/CMakeFiles/get_arm_joint_angle.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : CMakeFiles/get_arm_joint_angle.dir/depend + diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/cmake_clean.cmake b/arm/build/CMakeFiles/get_arm_joint_angle.dir/cmake_clean.cmake new file mode 100644 index 0000000..f59ad7f --- /dev/null +++ b/arm/build/CMakeFiles/get_arm_joint_angle.dir/cmake_clean.cmake @@ -0,0 +1,12 @@ +file(REMOVE_RECURSE + "CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o" + "CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o" + "CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o" + "get_arm_joint_angle" + "get_arm_joint_angle.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/get_arm_joint_angle.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/depend.internal b/arm/build/CMakeFiles/get_arm_joint_angle.dir/depend.internal new file mode 100644 index 0000000..cb7af1f --- /dev/null +++ b/arm/build/CMakeFiles/get_arm_joint_angle.dir/depend.internal @@ -0,0 +1,64 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o + /home/unitree/unitreeApp/arm/src/get_arm_joint_angle.cpp + /home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + /home/unitree/unitreeApp/arm/src/msg/PubServoInfo_.hpp + /usr/local/include/ddscxx/dds/core/detail/export.hpp + /usr/local/include/ddscxx/dds/core/detail/macros.hpp + /usr/local/include/ddscxx/dds/core/macros.hpp + /usr/local/include/ddscxx/dds/features.hpp + /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o + /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp + /home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + /usr/local/include/ddscxx/dds/core/detail/export.hpp + /usr/local/include/ddscxx/dds/core/detail/macros.hpp + /usr/local/include/ddscxx/dds/core/macros.hpp + /usr/local/include/ddscxx/dds/features.hpp + /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o + /home/unitree/unitreeApp/arm/src/msg/PubServoInfo_.cpp + /home/unitree/unitreeApp/arm/src/msg/PubServoInfo_.hpp + /usr/local/include/ddscxx/dds/core/detail/export.hpp + /usr/local/include/ddscxx/dds/core/detail/macros.hpp + /usr/local/include/ddscxx/dds/core/macros.hpp + /usr/local/include/ddscxx/dds/features.hpp + /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/depend.make b/arm/build/CMakeFiles/get_arm_joint_angle.dir/depend.make new file mode 100644 index 0000000..9bffff8 --- /dev/null +++ b/arm/build/CMakeFiles/get_arm_joint_angle.dir/depend.make @@ -0,0 +1,64 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: ../src/get_arm_joint_angle.cpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: ../src/msg/ArmString_.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: ../src/msg/PubServoInfo_.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/dds/core/detail/export.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/dds/core/detail/macros.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/dds/core/macros.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/dds/features.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp + +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.cpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/export.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/macros.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/macros.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/features.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp + +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: ../src/msg/PubServoInfo_.cpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: ../src/msg/PubServoInfo_.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/export.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/macros.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/dds/core/macros.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/dds/features.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp + diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/flags.make b/arm/build/CMakeFiles/get_arm_joint_angle.dir/flags.make new file mode 100644 index 0000000..7b67727 --- /dev/null +++ b/arm/build/CMakeFiles/get_arm_joint_angle.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# compile CXX with /usr/bin/c++ +CXX_FLAGS = -std=gnu++17 + +CXX_DEFINES = + +CXX_INCLUDES = -I/usr/local/include/ddscxx -I/usr/local/include/iceoryx/v2.0.2 + diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/link.txt b/arm/build/CMakeFiles/get_arm_joint_angle.dir/link.txt new file mode 100644 index 0000000..8b53d1d --- /dev/null +++ b/arm/build/CMakeFiles/get_arm_joint_angle.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o -o get_arm_joint_angle -lunitree_sdk2 -lddsc -lddscxx -lrt -lpthread diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/progress.make b/arm/build/CMakeFiles/get_arm_joint_angle.dir/progress.make new file mode 100644 index 0000000..b78c197 --- /dev/null +++ b/arm/build/CMakeFiles/get_arm_joint_angle.dir/progress.make @@ -0,0 +1,5 @@ +CMAKE_PROGRESS_1 = 4 +CMAKE_PROGRESS_2 = 5 +CMAKE_PROGRESS_3 = 6 +CMAKE_PROGRESS_4 = 7 + diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o b/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o new file mode 100644 index 0000000..b3d1cb6 Binary files /dev/null and b/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o differ diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o b/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o new file mode 100644 index 0000000..7ef238d Binary files /dev/null and b/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o differ diff --git a/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o b/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o new file mode 100644 index 0000000..42ee44f Binary files /dev/null and b/arm/build/CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o differ diff --git a/arm/build/CMakeFiles/joint_angle_control.dir/CXX.includecache b/arm/build/CMakeFiles/joint_angle_control.dir/CXX.includecache new file mode 100644 index 0000000..33ce001 --- /dev/null +++ b/arm/build/CMakeFiles/joint_angle_control.dir/CXX.includecache @@ -0,0 +1,168 @@ +#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) + +#IncludeRegexScan: ^.*$ + +#IncludeRegexComplain: ^$ + +#IncludeRegexTransform: + +/home/unitree/unitreeApp/arm/src/joint_angle_control.cpp +unitree/robot/channel/channel_publisher.hpp +- +unitree/common/time/time_tool.hpp +- +msg/ArmString_.hpp +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + +/home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp +ArmString_.hpp +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp +string +- +dds/topic/TopicTraits.hpp +/home/unitree/unitreeApp/arm/src/msg/dds/topic/TopicTraits.hpp +org/eclipse/cyclonedds/topic/datatopic.hpp +/home/unitree/unitreeApp/arm/src/msg/org/eclipse/cyclonedds/topic/datatopic.hpp + +/usr/local/include/ddscxx/dds/core/detail/export.hpp + +/usr/local/include/ddscxx/dds/core/detail/macros.hpp +iostream +- +string.h +- +dds/core/detail/export.hpp +/usr/local/include/ddscxx/dds/core/detail/dds/core/detail/export.hpp +dds/core/detail/maplog.hpp +- +cstring +- + +/usr/local/include/ddscxx/dds/core/macros.hpp +dds/core/detail/macros.hpp +- + +/usr/local/include/ddscxx/dds/features.hpp + +/usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +string +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +dds/ddsrt/endian.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/dds/ddsrt/endian.h +org/eclipse/cyclonedds/core/type_helpers.hpp +- +org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +- +stdint.h +- +string +- +stdexcept +- +stack +- +cassert +- +dds/core/macros.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +dds/core/macros.hpp +- +cstdint +- +list +- +vector +- +map +- +atomic +- +mutex +- +boost/type_traits.hpp +- +type_traits +- +cdr_enums.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +cstddef +- +dds/core/macros.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +type_traits +- +org/eclipse/cyclonedds/core/Missing.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +dds/ddsrt/heap.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsrt/heap.h +dds/ddsi/ddsi_serdata.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_serdata.h +org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +dds/features.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/features.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +memory +- +string +- +cstring +- +vector +- +atomic +- +dds/ddsrt/md5.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsrt/md5.h +org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +org/eclipse/cyclonedds/core/cdr/fragchain.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +org/eclipse/cyclonedds/topic/TopicTraits.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/topic/TopicTraits.hpp +org/eclipse/cyclonedds/topic/hash.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/topic/hash.hpp +dds/ddsi/ddsi_shm_transport.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_shm_transport.h + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp +dds/core/macros.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/core/macros.hpp +dds/ddsi/ddsi_keyhash.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_keyhash.h +vector +- + diff --git a/arm/build/CMakeFiles/joint_angle_control.dir/DependInfo.cmake b/arm/build/CMakeFiles/joint_angle_control.dir/DependInfo.cmake new file mode 100644 index 0000000..f051ca9 --- /dev/null +++ b/arm/build/CMakeFiles/joint_angle_control.dir/DependInfo.cmake @@ -0,0 +1,23 @@ +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + "CXX" + ) +# The set of files for implicit dependencies of each language: +set(CMAKE_DEPENDS_CHECK_CXX + "/home/unitree/unitreeApp/arm/src/joint_angle_control.cpp" "/home/unitree/unitreeApp/arm/build/CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o" + "/home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp" "/home/unitree/unitreeApp/arm/build/CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o" + ) +set(CMAKE_CXX_COMPILER_ID "GNU") + +# The include file search paths: +set(CMAKE_CXX_TARGET_INCLUDE_PATH + "/usr/local/include/ddscxx" + "/usr/local/include/iceoryx/v2.0.2" + ) + +# Targets to which this target links. +set(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/arm/build/CMakeFiles/joint_angle_control.dir/build.make b/arm/build/CMakeFiles/joint_angle_control.dir/build.make new file mode 100644 index 0000000..fb2cf6a --- /dev/null +++ b/arm/build/CMakeFiles/joint_angle_control.dir/build.make @@ -0,0 +1,113 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/unitree/unitreeApp/arm + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/unitree/unitreeApp/arm/build + +# Include any dependencies generated for this target. +include CMakeFiles/joint_angle_control.dir/depend.make + +# Include the progress variables for this target. +include CMakeFiles/joint_angle_control.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/joint_angle_control.dir/flags.make + +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: CMakeFiles/joint_angle_control.dir/flags.make +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: ../src/joint_angle_control.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o -c /home/unitree/unitreeApp/arm/src/joint_angle_control.cpp + +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/unitree/unitreeApp/arm/src/joint_angle_control.cpp > CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.i + +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/unitree/unitreeApp/arm/src/joint_angle_control.cpp -o CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.s + +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: CMakeFiles/joint_angle_control.dir/flags.make +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building CXX object CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o -c /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp + +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp > CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.i + +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp -o CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.s + +# Object files for target joint_angle_control +joint_angle_control_OBJECTS = \ +"CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o" \ +"CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o" + +# External object files for target joint_angle_control +joint_angle_control_EXTERNAL_OBJECTS = + +joint_angle_control: CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o +joint_angle_control: CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o +joint_angle_control: CMakeFiles/joint_angle_control.dir/build.make +joint_angle_control: CMakeFiles/joint_angle_control.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Linking CXX executable joint_angle_control" + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/joint_angle_control.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/joint_angle_control.dir/build: joint_angle_control + +.PHONY : CMakeFiles/joint_angle_control.dir/build + +CMakeFiles/joint_angle_control.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles/joint_angle_control.dir/cmake_clean.cmake +.PHONY : CMakeFiles/joint_angle_control.dir/clean + +CMakeFiles/joint_angle_control.dir/depend: + cd /home/unitree/unitreeApp/arm/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/unitree/unitreeApp/arm /home/unitree/unitreeApp/arm /home/unitree/unitreeApp/arm/build /home/unitree/unitreeApp/arm/build /home/unitree/unitreeApp/arm/build/CMakeFiles/joint_angle_control.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : CMakeFiles/joint_angle_control.dir/depend + diff --git a/arm/build/CMakeFiles/joint_angle_control.dir/cmake_clean.cmake b/arm/build/CMakeFiles/joint_angle_control.dir/cmake_clean.cmake new file mode 100644 index 0000000..6fc6a0c --- /dev/null +++ b/arm/build/CMakeFiles/joint_angle_control.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o" + "CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o" + "joint_angle_control" + "joint_angle_control.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/joint_angle_control.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/arm/build/CMakeFiles/joint_angle_control.dir/depend.internal b/arm/build/CMakeFiles/joint_angle_control.dir/depend.internal new file mode 100644 index 0000000..d819a97 --- /dev/null +++ b/arm/build/CMakeFiles/joint_angle_control.dir/depend.internal @@ -0,0 +1,43 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o + /home/unitree/unitreeApp/arm/src/joint_angle_control.cpp + /home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + /usr/local/include/ddscxx/dds/core/detail/export.hpp + /usr/local/include/ddscxx/dds/core/detail/macros.hpp + /usr/local/include/ddscxx/dds/core/macros.hpp + /usr/local/include/ddscxx/dds/features.hpp + /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o + /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp + /home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + /usr/local/include/ddscxx/dds/core/detail/export.hpp + /usr/local/include/ddscxx/dds/core/detail/macros.hpp + /usr/local/include/ddscxx/dds/core/macros.hpp + /usr/local/include/ddscxx/dds/features.hpp + /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp diff --git a/arm/build/CMakeFiles/joint_angle_control.dir/depend.make b/arm/build/CMakeFiles/joint_angle_control.dir/depend.make new file mode 100644 index 0000000..1723fe0 --- /dev/null +++ b/arm/build/CMakeFiles/joint_angle_control.dir/depend.make @@ -0,0 +1,43 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: ../src/joint_angle_control.cpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: ../src/msg/ArmString_.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/dds/core/detail/export.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/dds/core/detail/macros.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/dds/core/macros.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/dds/features.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp + +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.cpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/export.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/macros.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/macros.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/features.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp + diff --git a/arm/build/CMakeFiles/joint_angle_control.dir/flags.make b/arm/build/CMakeFiles/joint_angle_control.dir/flags.make new file mode 100644 index 0000000..7b67727 --- /dev/null +++ b/arm/build/CMakeFiles/joint_angle_control.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# compile CXX with /usr/bin/c++ +CXX_FLAGS = -std=gnu++17 + +CXX_DEFINES = + +CXX_INCLUDES = -I/usr/local/include/ddscxx -I/usr/local/include/iceoryx/v2.0.2 + diff --git a/arm/build/CMakeFiles/joint_angle_control.dir/link.txt b/arm/build/CMakeFiles/joint_angle_control.dir/link.txt new file mode 100644 index 0000000..0c043d1 --- /dev/null +++ b/arm/build/CMakeFiles/joint_angle_control.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o -o joint_angle_control -lunitree_sdk2 -lddsc -lddscxx -lrt -lpthread diff --git a/arm/build/CMakeFiles/joint_angle_control.dir/progress.make b/arm/build/CMakeFiles/joint_angle_control.dir/progress.make new file mode 100644 index 0000000..07d1136 --- /dev/null +++ b/arm/build/CMakeFiles/joint_angle_control.dir/progress.make @@ -0,0 +1,4 @@ +CMAKE_PROGRESS_1 = 8 +CMAKE_PROGRESS_2 = 9 +CMAKE_PROGRESS_3 = 10 + diff --git a/arm/build/CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o b/arm/build/CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o new file mode 100644 index 0000000..053bb6e Binary files /dev/null and b/arm/build/CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o differ diff --git a/arm/build/CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o b/arm/build/CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o new file mode 100644 index 0000000..7ef238d Binary files /dev/null and b/arm/build/CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o differ diff --git a/arm/build/CMakeFiles/joint_enable_control.dir/CXX.includecache b/arm/build/CMakeFiles/joint_enable_control.dir/CXX.includecache new file mode 100644 index 0000000..5c72faf --- /dev/null +++ b/arm/build/CMakeFiles/joint_enable_control.dir/CXX.includecache @@ -0,0 +1,168 @@ +#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) + +#IncludeRegexScan: ^.*$ + +#IncludeRegexComplain: ^$ + +#IncludeRegexTransform: + +/home/unitree/unitreeApp/arm/src/joint_enable_control.cpp +unitree/robot/channel/channel_publisher.hpp +- +unitree/common/time/time_tool.hpp +- +msg/ArmString_.hpp +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + +/home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp +ArmString_.hpp +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp +string +- +dds/topic/TopicTraits.hpp +/home/unitree/unitreeApp/arm/src/msg/dds/topic/TopicTraits.hpp +org/eclipse/cyclonedds/topic/datatopic.hpp +/home/unitree/unitreeApp/arm/src/msg/org/eclipse/cyclonedds/topic/datatopic.hpp + +/usr/local/include/ddscxx/dds/core/detail/export.hpp + +/usr/local/include/ddscxx/dds/core/detail/macros.hpp +iostream +- +string.h +- +dds/core/detail/export.hpp +/usr/local/include/ddscxx/dds/core/detail/dds/core/detail/export.hpp +dds/core/detail/maplog.hpp +- +cstring +- + +/usr/local/include/ddscxx/dds/core/macros.hpp +dds/core/detail/macros.hpp +- + +/usr/local/include/ddscxx/dds/features.hpp + +/usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +string +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +dds/ddsrt/endian.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/dds/ddsrt/endian.h +org/eclipse/cyclonedds/core/type_helpers.hpp +- +org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +- +stdint.h +- +string +- +stdexcept +- +stack +- +cassert +- +dds/core/macros.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +dds/core/macros.hpp +- +cstdint +- +list +- +vector +- +map +- +atomic +- +mutex +- +boost/type_traits.hpp +- +type_traits +- +cdr_enums.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +cstddef +- +dds/core/macros.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +type_traits +- +org/eclipse/cyclonedds/core/Missing.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +dds/ddsrt/heap.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsrt/heap.h +dds/ddsi/ddsi_serdata.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_serdata.h +org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +dds/features.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/features.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +memory +- +string +- +cstring +- +vector +- +atomic +- +dds/ddsrt/md5.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsrt/md5.h +org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +org/eclipse/cyclonedds/core/cdr/fragchain.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +org/eclipse/cyclonedds/topic/TopicTraits.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/topic/TopicTraits.hpp +org/eclipse/cyclonedds/topic/hash.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/topic/hash.hpp +dds/ddsi/ddsi_shm_transport.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_shm_transport.h + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp +dds/core/macros.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/core/macros.hpp +dds/ddsi/ddsi_keyhash.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_keyhash.h +vector +- + diff --git a/arm/build/CMakeFiles/joint_enable_control.dir/DependInfo.cmake b/arm/build/CMakeFiles/joint_enable_control.dir/DependInfo.cmake new file mode 100644 index 0000000..0182817 --- /dev/null +++ b/arm/build/CMakeFiles/joint_enable_control.dir/DependInfo.cmake @@ -0,0 +1,23 @@ +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + "CXX" + ) +# The set of files for implicit dependencies of each language: +set(CMAKE_DEPENDS_CHECK_CXX + "/home/unitree/unitreeApp/arm/src/joint_enable_control.cpp" "/home/unitree/unitreeApp/arm/build/CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o" + "/home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp" "/home/unitree/unitreeApp/arm/build/CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o" + ) +set(CMAKE_CXX_COMPILER_ID "GNU") + +# The include file search paths: +set(CMAKE_CXX_TARGET_INCLUDE_PATH + "/usr/local/include/ddscxx" + "/usr/local/include/iceoryx/v2.0.2" + ) + +# Targets to which this target links. +set(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/arm/build/CMakeFiles/joint_enable_control.dir/build.make b/arm/build/CMakeFiles/joint_enable_control.dir/build.make new file mode 100644 index 0000000..41d9181 --- /dev/null +++ b/arm/build/CMakeFiles/joint_enable_control.dir/build.make @@ -0,0 +1,113 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/unitree/unitreeApp/arm + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/unitree/unitreeApp/arm/build + +# Include any dependencies generated for this target. +include CMakeFiles/joint_enable_control.dir/depend.make + +# Include the progress variables for this target. +include CMakeFiles/joint_enable_control.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/joint_enable_control.dir/flags.make + +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: CMakeFiles/joint_enable_control.dir/flags.make +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: ../src/joint_enable_control.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o -c /home/unitree/unitreeApp/arm/src/joint_enable_control.cpp + +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/unitree/unitreeApp/arm/src/joint_enable_control.cpp > CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.i + +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/unitree/unitreeApp/arm/src/joint_enable_control.cpp -o CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.s + +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: CMakeFiles/joint_enable_control.dir/flags.make +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building CXX object CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o -c /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp + +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp > CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.i + +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp -o CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.s + +# Object files for target joint_enable_control +joint_enable_control_OBJECTS = \ +"CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o" \ +"CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o" + +# External object files for target joint_enable_control +joint_enable_control_EXTERNAL_OBJECTS = + +joint_enable_control: CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o +joint_enable_control: CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o +joint_enable_control: CMakeFiles/joint_enable_control.dir/build.make +joint_enable_control: CMakeFiles/joint_enable_control.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Linking CXX executable joint_enable_control" + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/joint_enable_control.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/joint_enable_control.dir/build: joint_enable_control + +.PHONY : CMakeFiles/joint_enable_control.dir/build + +CMakeFiles/joint_enable_control.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles/joint_enable_control.dir/cmake_clean.cmake +.PHONY : CMakeFiles/joint_enable_control.dir/clean + +CMakeFiles/joint_enable_control.dir/depend: + cd /home/unitree/unitreeApp/arm/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/unitree/unitreeApp/arm /home/unitree/unitreeApp/arm /home/unitree/unitreeApp/arm/build /home/unitree/unitreeApp/arm/build /home/unitree/unitreeApp/arm/build/CMakeFiles/joint_enable_control.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : CMakeFiles/joint_enable_control.dir/depend + diff --git a/arm/build/CMakeFiles/joint_enable_control.dir/cmake_clean.cmake b/arm/build/CMakeFiles/joint_enable_control.dir/cmake_clean.cmake new file mode 100644 index 0000000..8caeb4a --- /dev/null +++ b/arm/build/CMakeFiles/joint_enable_control.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o" + "CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o" + "joint_enable_control" + "joint_enable_control.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/joint_enable_control.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/arm/build/CMakeFiles/joint_enable_control.dir/depend.internal b/arm/build/CMakeFiles/joint_enable_control.dir/depend.internal new file mode 100644 index 0000000..7efdb38 --- /dev/null +++ b/arm/build/CMakeFiles/joint_enable_control.dir/depend.internal @@ -0,0 +1,43 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o + /home/unitree/unitreeApp/arm/src/joint_enable_control.cpp + /home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + /usr/local/include/ddscxx/dds/core/detail/export.hpp + /usr/local/include/ddscxx/dds/core/detail/macros.hpp + /usr/local/include/ddscxx/dds/core/macros.hpp + /usr/local/include/ddscxx/dds/features.hpp + /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o + /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp + /home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + /usr/local/include/ddscxx/dds/core/detail/export.hpp + /usr/local/include/ddscxx/dds/core/detail/macros.hpp + /usr/local/include/ddscxx/dds/core/macros.hpp + /usr/local/include/ddscxx/dds/features.hpp + /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp diff --git a/arm/build/CMakeFiles/joint_enable_control.dir/depend.make b/arm/build/CMakeFiles/joint_enable_control.dir/depend.make new file mode 100644 index 0000000..369a5ba --- /dev/null +++ b/arm/build/CMakeFiles/joint_enable_control.dir/depend.make @@ -0,0 +1,43 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: ../src/joint_enable_control.cpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: ../src/msg/ArmString_.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/dds/core/detail/export.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/dds/core/detail/macros.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/dds/core/macros.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/dds/features.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp + +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.cpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/export.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/macros.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/macros.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/features.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp + diff --git a/arm/build/CMakeFiles/joint_enable_control.dir/flags.make b/arm/build/CMakeFiles/joint_enable_control.dir/flags.make new file mode 100644 index 0000000..7b67727 --- /dev/null +++ b/arm/build/CMakeFiles/joint_enable_control.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# compile CXX with /usr/bin/c++ +CXX_FLAGS = -std=gnu++17 + +CXX_DEFINES = + +CXX_INCLUDES = -I/usr/local/include/ddscxx -I/usr/local/include/iceoryx/v2.0.2 + diff --git a/arm/build/CMakeFiles/joint_enable_control.dir/link.txt b/arm/build/CMakeFiles/joint_enable_control.dir/link.txt new file mode 100644 index 0000000..bc3f3aa --- /dev/null +++ b/arm/build/CMakeFiles/joint_enable_control.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o -o joint_enable_control -lunitree_sdk2 -lddsc -lddscxx -lrt -lpthread diff --git a/arm/build/CMakeFiles/joint_enable_control.dir/progress.make b/arm/build/CMakeFiles/joint_enable_control.dir/progress.make new file mode 100644 index 0000000..ce3e115 --- /dev/null +++ b/arm/build/CMakeFiles/joint_enable_control.dir/progress.make @@ -0,0 +1,4 @@ +CMAKE_PROGRESS_1 = 11 +CMAKE_PROGRESS_2 = 12 +CMAKE_PROGRESS_3 = 13 + diff --git a/arm/build/CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o b/arm/build/CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o new file mode 100644 index 0000000..7a7030f Binary files /dev/null and b/arm/build/CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o differ diff --git a/arm/build/CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o b/arm/build/CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o new file mode 100644 index 0000000..7ef238d Binary files /dev/null and b/arm/build/CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o differ diff --git a/arm/build/CMakeFiles/multiple_joint_angle_control.dir/CXX.includecache b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/CXX.includecache new file mode 100644 index 0000000..ec4f733 --- /dev/null +++ b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/CXX.includecache @@ -0,0 +1,168 @@ +#IncludeRegexLine: ^[ ]*[#%][ ]*(include|import)[ ]*[<"]([^">]+)([">]) + +#IncludeRegexScan: ^.*$ + +#IncludeRegexComplain: ^$ + +#IncludeRegexTransform: + +/home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp +ArmString_.hpp +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp +string +- +dds/topic/TopicTraits.hpp +/home/unitree/unitreeApp/arm/src/msg/dds/topic/TopicTraits.hpp +org/eclipse/cyclonedds/topic/datatopic.hpp +/home/unitree/unitreeApp/arm/src/msg/org/eclipse/cyclonedds/topic/datatopic.hpp + +/home/unitree/unitreeApp/arm/src/multiple_joint_angle_control.cpp +unitree/robot/channel/channel_publisher.hpp +- +unitree/common/time/time_tool.hpp +- +msg/ArmString_.hpp +/home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + +/usr/local/include/ddscxx/dds/core/detail/export.hpp + +/usr/local/include/ddscxx/dds/core/detail/macros.hpp +iostream +- +string.h +- +dds/core/detail/export.hpp +/usr/local/include/ddscxx/dds/core/detail/dds/core/detail/export.hpp +dds/core/detail/maplog.hpp +- +cstring +- + +/usr/local/include/ddscxx/dds/core/macros.hpp +dds/core/detail/macros.hpp +- + +/usr/local/include/ddscxx/dds/features.hpp + +/usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +string +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +dds/ddsrt/endian.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/dds/ddsrt/endian.h +org/eclipse/cyclonedds/core/type_helpers.hpp +- +org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +- +stdint.h +- +string +- +stdexcept +- +stack +- +cassert +- +dds/core/macros.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +dds/core/macros.hpp +- +cstdint +- +list +- +vector +- +map +- +atomic +- +mutex +- +boost/type_traits.hpp +- +type_traits +- +cdr_enums.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +cdr_stream.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +cstddef +- +dds/core/macros.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +type_traits +- +org/eclipse/cyclonedds/core/Missing.hpp +- + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +dds/ddsrt/heap.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsrt/heap.h +dds/ddsi/ddsi_serdata.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_serdata.h +org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +dds/features.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/features.hpp + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +memory +- +string +- +cstring +- +vector +- +atomic +- +dds/ddsrt/md5.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsrt/md5.h +org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +org/eclipse/cyclonedds/core/cdr/fragchain.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +org/eclipse/cyclonedds/topic/TopicTraits.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/topic/TopicTraits.hpp +org/eclipse/cyclonedds/topic/hash.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/org/eclipse/cyclonedds/topic/hash.hpp +dds/ddsi/ddsi_shm_transport.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_shm_transport.h + +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp +dds/core/macros.hpp +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/core/macros.hpp +dds/ddsi/ddsi_keyhash.h +/usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/dds/ddsi/ddsi_keyhash.h +vector +- + diff --git a/arm/build/CMakeFiles/multiple_joint_angle_control.dir/DependInfo.cmake b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/DependInfo.cmake new file mode 100644 index 0000000..e63873e --- /dev/null +++ b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/DependInfo.cmake @@ -0,0 +1,23 @@ +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + "CXX" + ) +# The set of files for implicit dependencies of each language: +set(CMAKE_DEPENDS_CHECK_CXX + "/home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp" "/home/unitree/unitreeApp/arm/build/CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o" + "/home/unitree/unitreeApp/arm/src/multiple_joint_angle_control.cpp" "/home/unitree/unitreeApp/arm/build/CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o" + ) +set(CMAKE_CXX_COMPILER_ID "GNU") + +# The include file search paths: +set(CMAKE_CXX_TARGET_INCLUDE_PATH + "/usr/local/include/ddscxx" + "/usr/local/include/iceoryx/v2.0.2" + ) + +# Targets to which this target links. +set(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/arm/build/CMakeFiles/multiple_joint_angle_control.dir/build.make b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/build.make new file mode 100644 index 0000000..ae4c415 --- /dev/null +++ b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/build.make @@ -0,0 +1,113 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/unitree/unitreeApp/arm + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/unitree/unitreeApp/arm/build + +# Include any dependencies generated for this target. +include CMakeFiles/multiple_joint_angle_control.dir/depend.make + +# Include the progress variables for this target. +include CMakeFiles/multiple_joint_angle_control.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/multiple_joint_angle_control.dir/flags.make + +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: CMakeFiles/multiple_joint_angle_control.dir/flags.make +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: ../src/multiple_joint_angle_control.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o -c /home/unitree/unitreeApp/arm/src/multiple_joint_angle_control.cpp + +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/unitree/unitreeApp/arm/src/multiple_joint_angle_control.cpp > CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.i + +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/unitree/unitreeApp/arm/src/multiple_joint_angle_control.cpp -o CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.s + +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: CMakeFiles/multiple_joint_angle_control.dir/flags.make +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.cpp + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building CXX object CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o -c /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp + +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing CXX source to CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.i" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp > CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.i + +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling CXX source to assembly CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.s" + /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp -o CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.s + +# Object files for target multiple_joint_angle_control +multiple_joint_angle_control_OBJECTS = \ +"CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o" \ +"CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o" + +# External object files for target multiple_joint_angle_control +multiple_joint_angle_control_EXTERNAL_OBJECTS = + +multiple_joint_angle_control: CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o +multiple_joint_angle_control: CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o +multiple_joint_angle_control: CMakeFiles/multiple_joint_angle_control.dir/build.make +multiple_joint_angle_control: CMakeFiles/multiple_joint_angle_control.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=/home/unitree/unitreeApp/arm/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Linking CXX executable multiple_joint_angle_control" + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/multiple_joint_angle_control.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/multiple_joint_angle_control.dir/build: multiple_joint_angle_control + +.PHONY : CMakeFiles/multiple_joint_angle_control.dir/build + +CMakeFiles/multiple_joint_angle_control.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles/multiple_joint_angle_control.dir/cmake_clean.cmake +.PHONY : CMakeFiles/multiple_joint_angle_control.dir/clean + +CMakeFiles/multiple_joint_angle_control.dir/depend: + cd /home/unitree/unitreeApp/arm/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/unitree/unitreeApp/arm /home/unitree/unitreeApp/arm /home/unitree/unitreeApp/arm/build /home/unitree/unitreeApp/arm/build /home/unitree/unitreeApp/arm/build/CMakeFiles/multiple_joint_angle_control.dir/DependInfo.cmake --color=$(COLOR) +.PHONY : CMakeFiles/multiple_joint_angle_control.dir/depend + diff --git a/arm/build/CMakeFiles/multiple_joint_angle_control.dir/cmake_clean.cmake b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/cmake_clean.cmake new file mode 100644 index 0000000..115578b --- /dev/null +++ b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o" + "CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o" + "multiple_joint_angle_control" + "multiple_joint_angle_control.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/multiple_joint_angle_control.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/arm/build/CMakeFiles/multiple_joint_angle_control.dir/depend.internal b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/depend.internal new file mode 100644 index 0000000..687d90d --- /dev/null +++ b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/depend.internal @@ -0,0 +1,43 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o + /home/unitree/unitreeApp/arm/src/msg/ArmString_.cpp + /home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + /usr/local/include/ddscxx/dds/core/detail/export.hpp + /usr/local/include/ddscxx/dds/core/detail/macros.hpp + /usr/local/include/ddscxx/dds/core/macros.hpp + /usr/local/include/ddscxx/dds/features.hpp + /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o + /home/unitree/unitreeApp/arm/src/msg/ArmString_.hpp + /home/unitree/unitreeApp/arm/src/multiple_joint_angle_control.cpp + /usr/local/include/ddscxx/dds/core/detail/export.hpp + /usr/local/include/ddscxx/dds/core/detail/macros.hpp + /usr/local/include/ddscxx/dds/core/macros.hpp + /usr/local/include/ddscxx/dds/features.hpp + /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp + /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp diff --git a/arm/build/CMakeFiles/multiple_joint_angle_control.dir/depend.make b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/depend.make new file mode 100644 index 0000000..4b9e323 --- /dev/null +++ b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/depend.make @@ -0,0 +1,43 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.cpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: ../src/msg/ArmString_.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/export.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/detail/macros.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/core/macros.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/features.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp + +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: ../src/msg/ArmString_.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: ../src/multiple_joint_angle_control.cpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/dds/core/detail/export.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/dds/core/detail/macros.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/dds/core/macros.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/dds/features.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/dds/topic/TopicTraits.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp +CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o: /usr/local/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp + diff --git a/arm/build/CMakeFiles/multiple_joint_angle_control.dir/flags.make b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/flags.make new file mode 100644 index 0000000..7b67727 --- /dev/null +++ b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# compile CXX with /usr/bin/c++ +CXX_FLAGS = -std=gnu++17 + +CXX_DEFINES = + +CXX_INCLUDES = -I/usr/local/include/ddscxx -I/usr/local/include/iceoryx/v2.0.2 + diff --git a/arm/build/CMakeFiles/multiple_joint_angle_control.dir/link.txt b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/link.txt new file mode 100644 index 0000000..13c55a7 --- /dev/null +++ b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o -o multiple_joint_angle_control -lunitree_sdk2 -lddsc -lddscxx -lrt -lpthread diff --git a/arm/build/CMakeFiles/multiple_joint_angle_control.dir/progress.make b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/progress.make new file mode 100644 index 0000000..41ebb37 --- /dev/null +++ b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/progress.make @@ -0,0 +1,4 @@ +CMAKE_PROGRESS_1 = 14 +CMAKE_PROGRESS_2 = 15 +CMAKE_PROGRESS_3 = 16 + diff --git a/arm/build/CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o new file mode 100644 index 0000000..7ef238d Binary files /dev/null and b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o differ diff --git a/arm/build/CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o new file mode 100644 index 0000000..2a69335 Binary files /dev/null and b/arm/build/CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o differ diff --git a/arm/build/CMakeFiles/progress.marks b/arm/build/CMakeFiles/progress.marks new file mode 100644 index 0000000..b6a7d89 --- /dev/null +++ b/arm/build/CMakeFiles/progress.marks @@ -0,0 +1 @@ +16 diff --git a/arm/build/Makefile b/arm/build/Makefile new file mode 100644 index 0000000..103580c --- /dev/null +++ b/arm/build/Makefile @@ -0,0 +1,426 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.16 + +# Default target executed when no arguments are given to make. +default_target: all + +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + + +# Remove some rules from gmake that .SUFFIXES does not remove. +SUFFIXES = + +.SUFFIXES: .hpux_make_needs_suffix_list + + +# Suppress display of executed commands. +$(VERBOSE).SILENT: + + +# A target that is always out of date. +cmake_force: + +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E remove -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/unitree/unitreeApp/arm + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/unitree/unitreeApp/arm/build + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache + +.PHONY : rebuild_cache/fast + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." + /usr/bin/cmake-gui -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache + +.PHONY : edit_cache/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles /home/unitree/unitreeApp/arm/build/CMakeFiles/progress.marks + $(MAKE) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /home/unitree/unitreeApp/arm/build/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + $(MAKE) -f CMakeFiles/Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean + +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +#============================================================================= +# Target rules for targets named get_arm_joint_angle + +# Build rule for target. +get_arm_joint_angle: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 get_arm_joint_angle +.PHONY : get_arm_joint_angle + +# fast build rule for target. +get_arm_joint_angle/fast: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/build +.PHONY : get_arm_joint_angle/fast + +#============================================================================= +# Target rules for targets named arm_zero_control + +# Build rule for target. +arm_zero_control: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 arm_zero_control +.PHONY : arm_zero_control + +# fast build rule for target. +arm_zero_control/fast: + $(MAKE) -f CMakeFiles/arm_zero_control.dir/build.make CMakeFiles/arm_zero_control.dir/build +.PHONY : arm_zero_control/fast + +#============================================================================= +# Target rules for targets named joint_enable_control + +# Build rule for target. +joint_enable_control: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 joint_enable_control +.PHONY : joint_enable_control + +# fast build rule for target. +joint_enable_control/fast: + $(MAKE) -f CMakeFiles/joint_enable_control.dir/build.make CMakeFiles/joint_enable_control.dir/build +.PHONY : joint_enable_control/fast + +#============================================================================= +# Target rules for targets named multiple_joint_angle_control + +# Build rule for target. +multiple_joint_angle_control: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 multiple_joint_angle_control +.PHONY : multiple_joint_angle_control + +# fast build rule for target. +multiple_joint_angle_control/fast: + $(MAKE) -f CMakeFiles/multiple_joint_angle_control.dir/build.make CMakeFiles/multiple_joint_angle_control.dir/build +.PHONY : multiple_joint_angle_control/fast + +#============================================================================= +# Target rules for targets named joint_angle_control + +# Build rule for target. +joint_angle_control: cmake_check_build_system + $(MAKE) -f CMakeFiles/Makefile2 joint_angle_control +.PHONY : joint_angle_control + +# fast build rule for target. +joint_angle_control/fast: + $(MAKE) -f CMakeFiles/joint_angle_control.dir/build.make CMakeFiles/joint_angle_control.dir/build +.PHONY : joint_angle_control/fast + +src/arm_zero_control.o: src/arm_zero_control.cpp.o + +.PHONY : src/arm_zero_control.o + +# target to build an object file +src/arm_zero_control.cpp.o: + $(MAKE) -f CMakeFiles/arm_zero_control.dir/build.make CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.o +.PHONY : src/arm_zero_control.cpp.o + +src/arm_zero_control.i: src/arm_zero_control.cpp.i + +.PHONY : src/arm_zero_control.i + +# target to preprocess a source file +src/arm_zero_control.cpp.i: + $(MAKE) -f CMakeFiles/arm_zero_control.dir/build.make CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.i +.PHONY : src/arm_zero_control.cpp.i + +src/arm_zero_control.s: src/arm_zero_control.cpp.s + +.PHONY : src/arm_zero_control.s + +# target to generate assembly for a file +src/arm_zero_control.cpp.s: + $(MAKE) -f CMakeFiles/arm_zero_control.dir/build.make CMakeFiles/arm_zero_control.dir/src/arm_zero_control.cpp.s +.PHONY : src/arm_zero_control.cpp.s + +src/get_arm_joint_angle.o: src/get_arm_joint_angle.cpp.o + +.PHONY : src/get_arm_joint_angle.o + +# target to build an object file +src/get_arm_joint_angle.cpp.o: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.o +.PHONY : src/get_arm_joint_angle.cpp.o + +src/get_arm_joint_angle.i: src/get_arm_joint_angle.cpp.i + +.PHONY : src/get_arm_joint_angle.i + +# target to preprocess a source file +src/get_arm_joint_angle.cpp.i: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.i +.PHONY : src/get_arm_joint_angle.cpp.i + +src/get_arm_joint_angle.s: src/get_arm_joint_angle.cpp.s + +.PHONY : src/get_arm_joint_angle.s + +# target to generate assembly for a file +src/get_arm_joint_angle.cpp.s: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/src/get_arm_joint_angle.cpp.s +.PHONY : src/get_arm_joint_angle.cpp.s + +src/joint_angle_control.o: src/joint_angle_control.cpp.o + +.PHONY : src/joint_angle_control.o + +# target to build an object file +src/joint_angle_control.cpp.o: + $(MAKE) -f CMakeFiles/joint_angle_control.dir/build.make CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.o +.PHONY : src/joint_angle_control.cpp.o + +src/joint_angle_control.i: src/joint_angle_control.cpp.i + +.PHONY : src/joint_angle_control.i + +# target to preprocess a source file +src/joint_angle_control.cpp.i: + $(MAKE) -f CMakeFiles/joint_angle_control.dir/build.make CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.i +.PHONY : src/joint_angle_control.cpp.i + +src/joint_angle_control.s: src/joint_angle_control.cpp.s + +.PHONY : src/joint_angle_control.s + +# target to generate assembly for a file +src/joint_angle_control.cpp.s: + $(MAKE) -f CMakeFiles/joint_angle_control.dir/build.make CMakeFiles/joint_angle_control.dir/src/joint_angle_control.cpp.s +.PHONY : src/joint_angle_control.cpp.s + +src/joint_enable_control.o: src/joint_enable_control.cpp.o + +.PHONY : src/joint_enable_control.o + +# target to build an object file +src/joint_enable_control.cpp.o: + $(MAKE) -f CMakeFiles/joint_enable_control.dir/build.make CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.o +.PHONY : src/joint_enable_control.cpp.o + +src/joint_enable_control.i: src/joint_enable_control.cpp.i + +.PHONY : src/joint_enable_control.i + +# target to preprocess a source file +src/joint_enable_control.cpp.i: + $(MAKE) -f CMakeFiles/joint_enable_control.dir/build.make CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.i +.PHONY : src/joint_enable_control.cpp.i + +src/joint_enable_control.s: src/joint_enable_control.cpp.s + +.PHONY : src/joint_enable_control.s + +# target to generate assembly for a file +src/joint_enable_control.cpp.s: + $(MAKE) -f CMakeFiles/joint_enable_control.dir/build.make CMakeFiles/joint_enable_control.dir/src/joint_enable_control.cpp.s +.PHONY : src/joint_enable_control.cpp.s + +src/msg/ArmString_.o: src/msg/ArmString_.cpp.o + +.PHONY : src/msg/ArmString_.o + +# target to build an object file +src/msg/ArmString_.cpp.o: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.o + $(MAKE) -f CMakeFiles/arm_zero_control.dir/build.make CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.o + $(MAKE) -f CMakeFiles/joint_enable_control.dir/build.make CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.o + $(MAKE) -f CMakeFiles/multiple_joint_angle_control.dir/build.make CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.o + $(MAKE) -f CMakeFiles/joint_angle_control.dir/build.make CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.o +.PHONY : src/msg/ArmString_.cpp.o + +src/msg/ArmString_.i: src/msg/ArmString_.cpp.i + +.PHONY : src/msg/ArmString_.i + +# target to preprocess a source file +src/msg/ArmString_.cpp.i: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.i + $(MAKE) -f CMakeFiles/arm_zero_control.dir/build.make CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.i + $(MAKE) -f CMakeFiles/joint_enable_control.dir/build.make CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.i + $(MAKE) -f CMakeFiles/multiple_joint_angle_control.dir/build.make CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.i + $(MAKE) -f CMakeFiles/joint_angle_control.dir/build.make CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.i +.PHONY : src/msg/ArmString_.cpp.i + +src/msg/ArmString_.s: src/msg/ArmString_.cpp.s + +.PHONY : src/msg/ArmString_.s + +# target to generate assembly for a file +src/msg/ArmString_.cpp.s: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/src/msg/ArmString_.cpp.s + $(MAKE) -f CMakeFiles/arm_zero_control.dir/build.make CMakeFiles/arm_zero_control.dir/src/msg/ArmString_.cpp.s + $(MAKE) -f CMakeFiles/joint_enable_control.dir/build.make CMakeFiles/joint_enable_control.dir/src/msg/ArmString_.cpp.s + $(MAKE) -f CMakeFiles/multiple_joint_angle_control.dir/build.make CMakeFiles/multiple_joint_angle_control.dir/src/msg/ArmString_.cpp.s + $(MAKE) -f CMakeFiles/joint_angle_control.dir/build.make CMakeFiles/joint_angle_control.dir/src/msg/ArmString_.cpp.s +.PHONY : src/msg/ArmString_.cpp.s + +src/msg/PubServoInfo_.o: src/msg/PubServoInfo_.cpp.o + +.PHONY : src/msg/PubServoInfo_.o + +# target to build an object file +src/msg/PubServoInfo_.cpp.o: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.o +.PHONY : src/msg/PubServoInfo_.cpp.o + +src/msg/PubServoInfo_.i: src/msg/PubServoInfo_.cpp.i + +.PHONY : src/msg/PubServoInfo_.i + +# target to preprocess a source file +src/msg/PubServoInfo_.cpp.i: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.i +.PHONY : src/msg/PubServoInfo_.cpp.i + +src/msg/PubServoInfo_.s: src/msg/PubServoInfo_.cpp.s + +.PHONY : src/msg/PubServoInfo_.s + +# target to generate assembly for a file +src/msg/PubServoInfo_.cpp.s: + $(MAKE) -f CMakeFiles/get_arm_joint_angle.dir/build.make CMakeFiles/get_arm_joint_angle.dir/src/msg/PubServoInfo_.cpp.s +.PHONY : src/msg/PubServoInfo_.cpp.s + +src/multiple_joint_angle_control.o: src/multiple_joint_angle_control.cpp.o + +.PHONY : src/multiple_joint_angle_control.o + +# target to build an object file +src/multiple_joint_angle_control.cpp.o: + $(MAKE) -f CMakeFiles/multiple_joint_angle_control.dir/build.make CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.o +.PHONY : src/multiple_joint_angle_control.cpp.o + +src/multiple_joint_angle_control.i: src/multiple_joint_angle_control.cpp.i + +.PHONY : src/multiple_joint_angle_control.i + +# target to preprocess a source file +src/multiple_joint_angle_control.cpp.i: + $(MAKE) -f CMakeFiles/multiple_joint_angle_control.dir/build.make CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.i +.PHONY : src/multiple_joint_angle_control.cpp.i + +src/multiple_joint_angle_control.s: src/multiple_joint_angle_control.cpp.s + +.PHONY : src/multiple_joint_angle_control.s + +# target to generate assembly for a file +src/multiple_joint_angle_control.cpp.s: + $(MAKE) -f CMakeFiles/multiple_joint_angle_control.dir/build.make CMakeFiles/multiple_joint_angle_control.dir/src/multiple_joint_angle_control.cpp.s +.PHONY : src/multiple_joint_angle_control.cpp.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... rebuild_cache" + @echo "... edit_cache" + @echo "... get_arm_joint_angle" + @echo "... arm_zero_control" + @echo "... joint_enable_control" + @echo "... multiple_joint_angle_control" + @echo "... joint_angle_control" + @echo "... src/arm_zero_control.o" + @echo "... src/arm_zero_control.i" + @echo "... src/arm_zero_control.s" + @echo "... src/get_arm_joint_angle.o" + @echo "... src/get_arm_joint_angle.i" + @echo "... src/get_arm_joint_angle.s" + @echo "... src/joint_angle_control.o" + @echo "... src/joint_angle_control.i" + @echo "... src/joint_angle_control.s" + @echo "... src/joint_enable_control.o" + @echo "... src/joint_enable_control.i" + @echo "... src/joint_enable_control.s" + @echo "... src/msg/ArmString_.o" + @echo "... src/msg/ArmString_.i" + @echo "... src/msg/ArmString_.s" + @echo "... src/msg/PubServoInfo_.o" + @echo "... src/msg/PubServoInfo_.i" + @echo "... src/msg/PubServoInfo_.s" + @echo "... src/multiple_joint_angle_control.o" + @echo "... src/multiple_joint_angle_control.i" + @echo "... src/multiple_joint_angle_control.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/arm/build/arm_zero_control b/arm/build/arm_zero_control new file mode 100755 index 0000000..7b0eb0a Binary files /dev/null and b/arm/build/arm_zero_control differ diff --git a/arm/build/cmake_install.cmake b/arm/build/cmake_install.cmake new file mode 100644 index 0000000..1f1c3c1 --- /dev/null +++ b/arm/build/cmake_install.cmake @@ -0,0 +1,49 @@ +# Install script for directory: /home/unitree/unitreeApp/arm + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +if(CMAKE_INSTALL_COMPONENT) + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") +file(WRITE "/home/unitree/unitreeApp/arm/build/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") diff --git a/arm/build/get_arm_joint_angle b/arm/build/get_arm_joint_angle new file mode 100755 index 0000000..a9d4f90 Binary files /dev/null and b/arm/build/get_arm_joint_angle differ diff --git a/arm/build/joint_angle_control b/arm/build/joint_angle_control new file mode 100755 index 0000000..3888a73 Binary files /dev/null and b/arm/build/joint_angle_control differ diff --git a/arm/build/joint_enable_control b/arm/build/joint_enable_control new file mode 100755 index 0000000..b456d26 Binary files /dev/null and b/arm/build/joint_enable_control differ diff --git a/arm/build/multiple_joint_angle_control b/arm/build/multiple_joint_angle_control new file mode 100755 index 0000000..7cdfbde Binary files /dev/null and b/arm/build/multiple_joint_angle_control differ diff --git a/arm/src/arm_zero_control.cpp b/arm/src/arm_zero_control.cpp new file mode 100644 index 0000000..c252157 --- /dev/null +++ b/arm/src/arm_zero_control.cpp @@ -0,0 +1,21 @@ +#include +#include +#include "msg/ArmString_.hpp" + +#define TOPIC "rt/arm_Command" + +using namespace unitree::robot; +using namespace unitree::common; + +int main() +{ + ChannelFactory::Instance()->Init(0); + ChannelPublisher publisher(TOPIC); + publisher.InitChannel(); + + unitree_arm::msg::dds_::ArmString_ msg{}; + msg.data_() = "{\"seq\":4,\"address\":1,\"funcode\":7}"; + publisher.Write(msg); + + return 0; +} diff --git a/arm/src/get_arm_joint_angle.cpp b/arm/src/get_arm_joint_angle.cpp new file mode 100644 index 0000000..477df13 --- /dev/null +++ b/arm/src/get_arm_joint_angle.cpp @@ -0,0 +1,41 @@ +#include +#include +#include "msg/PubServoInfo_.hpp" +#include "msg/ArmString_.hpp" + +#define TOPIC "current_servo_angle" +#define TOPIC1 "rt/arm_Feedback" + +using namespace unitree::robot; +using namespace unitree::common; + +void Handler(const void* msg) +{ + const unitree_arm::msg::dds_::PubServoInfo_* pm = (const unitree_arm::msg::dds_::PubServoInfo_*)msg; + + std::cout << "servo0_data:" << pm->servo0_data_() << ", servo1_data:" << pm->servo1_data_() << ", servo2_data:" << pm->servo2_data_()<< ", servo3_data:" << pm->servo3_data_()<< ", servo4_data:" << pm->servo4_data_()<< ", servo5_data:" << pm->servo5_data_()<< ", servo6_data:" << pm->servo6_data_() << std::endl; +} + +void Handler1(const void* msg) +{ + const unitree_arm::msg::dds_::ArmString_* pm = (const unitree_arm::msg::dds_::ArmString_*)msg; + + std::cout << "armFeedback_data:" << pm->data_() << std::endl; +} + +int main() +{ + ChannelFactory::Instance()->Init(0); + ChannelSubscriber subscriber(TOPIC); + subscriber.InitChannel(Handler); + + ChannelSubscriber subscriber1(TOPIC1); + subscriber1.InitChannel(Handler1); + + while (true) + { + sleep(10); + } + + return 0; +} diff --git a/arm/src/joint_angle_control.cpp b/arm/src/joint_angle_control.cpp new file mode 100644 index 0000000..166fa3e --- /dev/null +++ b/arm/src/joint_angle_control.cpp @@ -0,0 +1,21 @@ +#include +#include +#include "msg/ArmString_.hpp" + +#define TOPIC "rt/arm_Command" + +using namespace unitree::robot; +using namespace unitree::common; + +int main() +{ + ChannelFactory::Instance()->Init(0); + ChannelPublisher publisher(TOPIC); + publisher.InitChannel(); + + unitree_arm::msg::dds_::ArmString_ msg{}; + msg.data_() = "{\"seq\":4,\"address\":1,\"funcode\":1,\"data\":{\"id\":5,\"angle\":60,\"delay_ms\":0}}"; + publisher.Write(msg); + + return 0; +} diff --git a/arm/src/joint_enable_control.cpp b/arm/src/joint_enable_control.cpp new file mode 100644 index 0000000..5371219 --- /dev/null +++ b/arm/src/joint_enable_control.cpp @@ -0,0 +1,21 @@ +#include +#include +#include "msg/ArmString_.hpp" + +#define TOPIC "rt/arm_Command" + +using namespace unitree::robot; +using namespace unitree::common; + +int main() +{ + ChannelFactory::Instance()->Init(0); + ChannelPublisher publisher(TOPIC); + publisher.InitChannel(); + + unitree_arm::msg::dds_::ArmString_ msg{}; + msg.data_() = "{\"seq\":4,\"address\":1,\"funcode\":5,\"data\":{\"mode\":0}}"; + publisher.Write(msg); + + return 0; +} \ No newline at end of file diff --git a/arm/src/msg/ArmString_.cpp b/arm/src/msg/ArmString_.cpp new file mode 100644 index 0000000..6512d62 --- /dev/null +++ b/arm/src/msg/ArmString_.cpp @@ -0,0 +1,53 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: ArmString_.idl + Source: ArmString_.cpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#include "ArmString_.hpp" + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_arm::msg::dds_::ArmString_>() { + static thread_local std::mutex mtx; + static thread_local propvec props; + static thread_local entity_properties_t *props_end = nullptr; + static thread_local std::atomic_bool initialized {false}; + key_endpoint keylist; + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + std::lock_guard lock(mtx); + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + props.clear(); + + props.push_back(entity_properties_t(0, 0, false, bb_unset, extensibility::ext_final)); //root + props.push_back(entity_properties_t(1, 0, false, bb_unset, extensibility::ext_final, false)); //::data_ + + entity_properties_t::finish(props, keylist); + props_end = props.data() + props.size(); + initialized.store(true, std::memory_order_release); + return props; +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + diff --git a/arm/src/msg/ArmString_.hpp b/arm/src/msg/ArmString_.hpp new file mode 100644 index 0000000..2f15094 --- /dev/null +++ b/arm/src/msg/ArmString_.hpp @@ -0,0 +1,232 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: ArmString_.idl + Source: ArmString_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_ARMSTRING__HPP +#define DDSCXX_ARMSTRING__HPP + +#include + +namespace unitree_arm +{ +namespace msg +{ +namespace dds_ +{ +class ArmString_ +{ +private: + std::string data__; + +public: + ArmString_() = default; + + explicit ArmString_( + const std::string& data_) : + data__(data_) { } + + const std::string& data_() const { return this->data__; } + std::string& data_() { return this->data__; } + void data_(const std::string& _val_) { this->data__ = _val_; } + void data_(std::string&& _val_) { this->data__ = _val_; } + + bool operator==(const ArmString_& _other) const + { + (void) _other; + return data__ == _other.data__; + } + + bool operator!=(const ArmString_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_arm::msg::dds_::ArmString_>::getTypeName() +{ + return "unitree_arm::msg::dds_::ArmString_"; +} + +template <> constexpr bool TopicTraits<::unitree_arm::msg::dds_::ArmString_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_arm::msg::dds_::ArmString_>::isKeyless() +{ + return true; +} + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_arm::msg::dds_::ArmString_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_arm::msg::dds_::ArmString_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_arm::msg::dds_::ArmString_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_arm::msg::dds_::ArmString_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_arm::msg::dds_::ArmString_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.data_(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_arm::msg::dds_::ArmString_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::ArmString_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_arm::msg::dds_::ArmString_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.data_(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_arm::msg::dds_::ArmString_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::ArmString_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_arm::msg::dds_::ArmString_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.data_(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_arm::msg::dds_::ArmString_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::ArmString_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_arm::msg::dds_::ArmString_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.data_(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_arm::msg::dds_::ArmString_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::ArmString_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_ARMSTRING__HPP diff --git a/arm/src/msg/PubServoInfo_.cpp b/arm/src/msg/PubServoInfo_.cpp new file mode 100644 index 0000000..1b7fc80 --- /dev/null +++ b/arm/src/msg/PubServoInfo_.cpp @@ -0,0 +1,59 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: PubServoInfo_.idl + Source: PubServoInfo_.cpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#include "PubServoInfo_.hpp" + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_arm::msg::dds_::PubServoInfo_>() { + static thread_local std::mutex mtx; + static thread_local propvec props; + static thread_local entity_properties_t *props_end = nullptr; + static thread_local std::atomic_bool initialized {false}; + key_endpoint keylist; + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + std::lock_guard lock(mtx); + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + props.clear(); + + props.push_back(entity_properties_t(0, 0, false, bb_unset, extensibility::ext_final)); //root + props.push_back(entity_properties_t(1, 0, false, get_bit_bound(), extensibility::ext_final, false)); //::servo0_data_ + props.push_back(entity_properties_t(1, 1, false, get_bit_bound(), extensibility::ext_final, false)); //::servo1_data_ + props.push_back(entity_properties_t(1, 2, false, get_bit_bound(), extensibility::ext_final, false)); //::servo2_data_ + props.push_back(entity_properties_t(1, 3, false, get_bit_bound(), extensibility::ext_final, false)); //::servo3_data_ + props.push_back(entity_properties_t(1, 4, false, get_bit_bound(), extensibility::ext_final, false)); //::servo4_data_ + props.push_back(entity_properties_t(1, 5, false, get_bit_bound(), extensibility::ext_final, false)); //::servo5_data_ + props.push_back(entity_properties_t(1, 6, false, get_bit_bound(), extensibility::ext_final, false)); //::servo6_data_ + + entity_properties_t::finish(props, keylist); + props_end = props.data() + props.size(); + initialized.store(true, std::memory_order_release); + return props; +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + diff --git a/arm/src/msg/PubServoInfo_.hpp b/arm/src/msg/PubServoInfo_.hpp new file mode 100644 index 0000000..43e90d9 --- /dev/null +++ b/arm/src/msg/PubServoInfo_.hpp @@ -0,0 +1,459 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: PubServoInfo_.idl + Source: PubServoInfo_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_PUBSERVOINFO__HPP +#define DDSCXX_PUBSERVOINFO__HPP + + +namespace unitree_arm +{ +namespace msg +{ +namespace dds_ +{ +class PubServoInfo_ +{ +private: + float servo0_data__ = 0.0f; + float servo1_data__ = 0.0f; + float servo2_data__ = 0.0f; + float servo3_data__ = 0.0f; + float servo4_data__ = 0.0f; + float servo5_data__ = 0.0f; + float servo6_data__ = 0.0f; + +public: + PubServoInfo_() = default; + + explicit PubServoInfo_( + float servo0_data_, + float servo1_data_, + float servo2_data_, + float servo3_data_, + float servo4_data_, + float servo5_data_, + float servo6_data_) : + servo0_data__(servo0_data_), + servo1_data__(servo1_data_), + servo2_data__(servo2_data_), + servo3_data__(servo3_data_), + servo4_data__(servo4_data_), + servo5_data__(servo5_data_), + servo6_data__(servo6_data_) { } + + float servo0_data_() const { return this->servo0_data__; } + float& servo0_data_() { return this->servo0_data__; } + void servo0_data_(float _val_) { this->servo0_data__ = _val_; } + float servo1_data_() const { return this->servo1_data__; } + float& servo1_data_() { return this->servo1_data__; } + void servo1_data_(float _val_) { this->servo1_data__ = _val_; } + float servo2_data_() const { return this->servo2_data__; } + float& servo2_data_() { return this->servo2_data__; } + void servo2_data_(float _val_) { this->servo2_data__ = _val_; } + float servo3_data_() const { return this->servo3_data__; } + float& servo3_data_() { return this->servo3_data__; } + void servo3_data_(float _val_) { this->servo3_data__ = _val_; } + float servo4_data_() const { return this->servo4_data__; } + float& servo4_data_() { return this->servo4_data__; } + void servo4_data_(float _val_) { this->servo4_data__ = _val_; } + float servo5_data_() const { return this->servo5_data__; } + float& servo5_data_() { return this->servo5_data__; } + void servo5_data_(float _val_) { this->servo5_data__ = _val_; } + float servo6_data_() const { return this->servo6_data__; } + float& servo6_data_() { return this->servo6_data__; } + void servo6_data_(float _val_) { this->servo6_data__ = _val_; } + + bool operator==(const PubServoInfo_& _other) const + { + (void) _other; + return servo0_data__ == _other.servo0_data__ && + servo1_data__ == _other.servo1_data__ && + servo2_data__ == _other.servo2_data__ && + servo3_data__ == _other.servo3_data__ && + servo4_data__ == _other.servo4_data__ && + servo5_data__ == _other.servo5_data__ && + servo6_data__ == _other.servo6_data__; + } + + bool operator!=(const PubServoInfo_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_arm::msg::dds_::PubServoInfo_>::getTypeName() +{ + return "unitree_arm::msg::dds_::PubServoInfo_"; +} + +template <> constexpr bool TopicTraits<::unitree_arm::msg::dds_::PubServoInfo_>::isKeyless() +{ + return true; +} + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_arm::msg::dds_::PubServoInfo_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_arm::msg::dds_::PubServoInfo_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_arm::msg::dds_::PubServoInfo_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_arm::msg::dds_::PubServoInfo_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_arm::msg::dds_::PubServoInfo_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.servo0_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.servo1_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.servo2_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.servo3_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.servo4_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.servo5_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.servo6_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_arm::msg::dds_::PubServoInfo_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::PubServoInfo_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_arm::msg::dds_::PubServoInfo_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.servo0_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.servo1_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.servo2_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.servo3_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.servo4_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.servo5_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.servo6_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_arm::msg::dds_::PubServoInfo_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::PubServoInfo_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_arm::msg::dds_::PubServoInfo_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.servo0_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.servo1_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.servo2_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.servo3_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.servo4_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.servo5_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.servo6_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_arm::msg::dds_::PubServoInfo_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::PubServoInfo_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_arm::msg::dds_::PubServoInfo_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.servo0_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.servo1_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.servo2_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.servo3_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.servo4_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.servo5_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.servo6_data_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_arm::msg::dds_::PubServoInfo_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::PubServoInfo_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_PUBSERVOINFO__HPP diff --git a/arm/src/msg/SetServoAngle_.cpp b/arm/src/msg/SetServoAngle_.cpp new file mode 100644 index 0000000..37d22d9 --- /dev/null +++ b/arm/src/msg/SetServoAngle_.cpp @@ -0,0 +1,56 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: SetServoAngle_.idl + Source: SetServoAngle_.cpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#include "SetServoAngle_.hpp" + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_arm::msg::dds_::SetServoAngle_>() { + static thread_local std::mutex mtx; + static thread_local propvec props; + static thread_local entity_properties_t *props_end = nullptr; + static thread_local std::atomic_bool initialized {false}; + key_endpoint keylist; + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + std::lock_guard lock(mtx); + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + props.clear(); + + props.push_back(entity_properties_t(0, 0, false, bb_unset, extensibility::ext_final)); //root + props.push_back(entity_properties_t(1, 0, false, get_bit_bound(), extensibility::ext_final, false)); //::seq_ + props.push_back(entity_properties_t(1, 1, false, get_bit_bound(), extensibility::ext_final, false)); //::id_ + props.push_back(entity_properties_t(1, 2, false, get_bit_bound(), extensibility::ext_final, false)); //::angle_ + props.push_back(entity_properties_t(1, 3, false, get_bit_bound(), extensibility::ext_final, false)); //::delay_ms_ + + entity_properties_t::finish(props, keylist); + props_end = props.data() + props.size(); + initialized.store(true, std::memory_order_release); + return props; +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + diff --git a/arm/src/msg/SetServoAngle_.hpp b/arm/src/msg/SetServoAngle_.hpp new file mode 100644 index 0000000..618270c --- /dev/null +++ b/arm/src/msg/SetServoAngle_.hpp @@ -0,0 +1,343 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: SetServoAngle_.idl + Source: SetServoAngle_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_SETSERVOANGLE__HPP +#define DDSCXX_SETSERVOANGLE__HPP + +#include + +namespace unitree_arm +{ +namespace msg +{ +namespace dds_ +{ +class SetServoAngle_ +{ +private: + int32_t seq__ = 0; + uint8_t id__ = 0; + float angle__ = 0.0f; + int16_t delay_ms__ = 0; + +public: + SetServoAngle_() = default; + + explicit SetServoAngle_( + int32_t seq_, + uint8_t id_, + float angle_, + int16_t delay_ms_) : + seq__(seq_), + id__(id_), + angle__(angle_), + delay_ms__(delay_ms_) { } + + int32_t seq_() const { return this->seq__; } + int32_t& seq_() { return this->seq__; } + void seq_(int32_t _val_) { this->seq__ = _val_; } + uint8_t id_() const { return this->id__; } + uint8_t& id_() { return this->id__; } + void id_(uint8_t _val_) { this->id__ = _val_; } + float angle_() const { return this->angle__; } + float& angle_() { return this->angle__; } + void angle_(float _val_) { this->angle__ = _val_; } + int16_t delay_ms_() const { return this->delay_ms__; } + int16_t& delay_ms_() { return this->delay_ms__; } + void delay_ms_(int16_t _val_) { this->delay_ms__ = _val_; } + + bool operator==(const SetServoAngle_& _other) const + { + (void) _other; + return seq__ == _other.seq__ && + id__ == _other.id__ && + angle__ == _other.angle__ && + delay_ms__ == _other.delay_ms__; + } + + bool operator!=(const SetServoAngle_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_arm::msg::dds_::SetServoAngle_>::getTypeName() +{ + return "unitree_arm::msg::dds_::SetServoAngle_"; +} + +template <> constexpr bool TopicTraits<::unitree_arm::msg::dds_::SetServoAngle_>::isKeyless() +{ + return true; +} + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_arm::msg::dds_::SetServoAngle_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_arm::msg::dds_::SetServoAngle_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_arm::msg::dds_::SetServoAngle_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_arm::msg::dds_::SetServoAngle_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_arm::msg::dds_::SetServoAngle_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.seq_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.id_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.angle_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.delay_ms_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_arm::msg::dds_::SetServoAngle_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::SetServoAngle_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_arm::msg::dds_::SetServoAngle_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.seq_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.id_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.angle_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.delay_ms_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_arm::msg::dds_::SetServoAngle_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::SetServoAngle_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_arm::msg::dds_::SetServoAngle_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.seq_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.id_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.angle_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.delay_ms_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_arm::msg::dds_::SetServoAngle_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::SetServoAngle_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_arm::msg::dds_::SetServoAngle_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.seq_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.id_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.angle_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.delay_ms_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_arm::msg::dds_::SetServoAngle_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::SetServoAngle_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_SETSERVOANGLE__HPP diff --git a/arm/src/msg/SetServoDumping_.cpp b/arm/src/msg/SetServoDumping_.cpp new file mode 100644 index 0000000..bb904c3 --- /dev/null +++ b/arm/src/msg/SetServoDumping_.cpp @@ -0,0 +1,55 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: SetServoDumping_.idl + Source: SetServoDumping_.cpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#include "SetServoDumping_.hpp" + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_arm::msg::dds_::SetServoDumping_>() { + static thread_local std::mutex mtx; + static thread_local propvec props; + static thread_local entity_properties_t *props_end = nullptr; + static thread_local std::atomic_bool initialized {false}; + key_endpoint keylist; + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + std::lock_guard lock(mtx); + if (initialized.load(std::memory_order_relaxed)) { + auto ptr = props.data(); + while (ptr < props_end) + (ptr++)->is_present = false; + return props; + } + props.clear(); + + props.push_back(entity_properties_t(0, 0, false, bb_unset, extensibility::ext_final)); //root + props.push_back(entity_properties_t(1, 0, false, get_bit_bound(), extensibility::ext_final, false)); //::seq_ + props.push_back(entity_properties_t(1, 1, false, get_bit_bound(), extensibility::ext_final, false)); //::id_ + props.push_back(entity_properties_t(1, 2, false, get_bit_bound(), extensibility::ext_final, false)); //::power_ + + entity_properties_t::finish(props, keylist); + props_end = props.data() + props.size(); + initialized.store(true, std::memory_order_release); + return props; +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + diff --git a/arm/src/msg/SetServoDumping_.hpp b/arm/src/msg/SetServoDumping_.hpp new file mode 100644 index 0000000..31d8104 --- /dev/null +++ b/arm/src/msg/SetServoDumping_.hpp @@ -0,0 +1,304 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: SetServoDumping_.idl + Source: SetServoDumping_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_SETSERVODUMPING__HPP +#define DDSCXX_SETSERVODUMPING__HPP + +#include + +namespace unitree_arm +{ +namespace msg +{ +namespace dds_ +{ +class SetServoDumping_ +{ +private: + int32_t seq__ = 0; + uint8_t id__ = 0; + uint16_t power__ = 0; + +public: + SetServoDumping_() = default; + + explicit SetServoDumping_( + int32_t seq_, + uint8_t id_, + uint16_t power_) : + seq__(seq_), + id__(id_), + power__(power_) { } + + int32_t seq_() const { return this->seq__; } + int32_t& seq_() { return this->seq__; } + void seq_(int32_t _val_) { this->seq__ = _val_; } + uint8_t id_() const { return this->id__; } + uint8_t& id_() { return this->id__; } + void id_(uint8_t _val_) { this->id__ = _val_; } + uint16_t power_() const { return this->power__; } + uint16_t& power_() { return this->power__; } + void power_(uint16_t _val_) { this->power__ = _val_; } + + bool operator==(const SetServoDumping_& _other) const + { + (void) _other; + return seq__ == _other.seq__ && + id__ == _other.id__ && + power__ == _other.power__; + } + + bool operator!=(const SetServoDumping_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_arm::msg::dds_::SetServoDumping_>::getTypeName() +{ + return "unitree_arm::msg::dds_::SetServoDumping_"; +} + +template <> constexpr bool TopicTraits<::unitree_arm::msg::dds_::SetServoDumping_>::isKeyless() +{ + return true; +} + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_arm::msg::dds_::SetServoDumping_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_arm::msg::dds_::SetServoDumping_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_arm::msg::dds_::SetServoDumping_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_arm::msg::dds_::SetServoDumping_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_arm::msg::dds_::SetServoDumping_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.seq_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.id_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.power_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_arm::msg::dds_::SetServoDumping_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::SetServoDumping_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_arm::msg::dds_::SetServoDumping_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.seq_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.id_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.power_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_arm::msg::dds_::SetServoDumping_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::SetServoDumping_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_arm::msg::dds_::SetServoDumping_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.seq_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.id_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.power_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_arm::msg::dds_::SetServoDumping_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::SetServoDumping_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_arm::msg::dds_::SetServoDumping_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.seq_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.id_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.power_())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_arm::msg::dds_::SetServoDumping_& instance, bool as_key) { + auto &props = get_type_props<::unitree_arm::msg::dds_::SetServoDumping_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_SETSERVODUMPING__HPP diff --git a/arm/src/multiple_joint_angle_control.cpp b/arm/src/multiple_joint_angle_control.cpp new file mode 100644 index 0000000..a3a9bef --- /dev/null +++ b/arm/src/multiple_joint_angle_control.cpp @@ -0,0 +1,21 @@ +#include +#include +#include "msg/ArmString_.hpp" + +#define TOPIC "rt/arm_Command" + +using namespace unitree::robot; +using namespace unitree::common; + +int main() +{ + ChannelFactory::Instance()->Init(0); + ChannelPublisher publisher(TOPIC); + publisher.InitChannel(); + + unitree_arm::msg::dds_::ArmString_ msg{}; + msg.data_() = "{\"seq\":4,\"address\":1,\"funcode\":2,\"data\":{\"mode\":1,\"angle0\":0,\"angle1\":-60,\"angle2\":60,\"angle3\":0,\"angle4\":30,\"angle5\":0,\"angle6\":0}}"; + publisher.Write(msg); + + return 0; +} diff --git a/backup/demo.cpp b/backup/demo.cpp new file mode 100644 index 0000000..e68c4d2 --- /dev/null +++ b/backup/demo.cpp @@ -0,0 +1,81 @@ +// #include "armcontroller.hpp" +// #include +// #include + +// #include +// #include +// #include +// #include + +// string urdfPath = "/home/unitree/unitreeApp/urdf/d1_description/urdf/d1_description.urdf"; + +// int main() +// { +// armController *arm = new armController(); + +// double x, y, z, row, pitch, yaw; + +// std::this_thread::sleep_for(std::chrono::seconds(1)); + +// arm->trashActionDefault(); +// arm->getCurrentPoseFromMsg(x, y, z, row, pitch, yaw); +// // arm->ikPoseRPY(x, y, z, row, pitch, yaw); +// // arm->getCurrentPoseFromMsg(x, y, z, row, pitch, yaw); + +// // return 0; +// std::this_thread::sleep_for(std::chrono::seconds(3)); + +// arm->goHome(); +// arm->getCurrentPoseFromMsg(x, y, z, row, pitch, yaw); + +// std::this_thread::sleep_for(std::chrono::seconds(3)); + +// // arm->ikPoseRPY(x, y, z, row, pitch, yaw); + +// std::this_thread::sleep_for(std::chrono::seconds(5)); + +// bool flag = true; +// while (flag) +// { +// char ch; +// cin >> ch; +// switch (ch) +// { +// case 'w': +// x += 0.05; +// arm->ikPoseRPY(x, y, z, row, pitch, yaw); +// break; +// case 'a': +// y += 0.05; +// arm->ikPoseRPY(x, y, z, row, pitch, yaw); +// break; +// case 's': +// x -= 0.05; +// arm->ikPoseRPY(x, y, z, row, pitch, yaw); +// break; +// case 'd': +// y -= 0.05; +// arm->ikPoseRPY(x, y, z, row, pitch, yaw); +// break; +// case 'i': +// z += 0.05; +// arm->ikPoseRPY(x, y, z, row, pitch, yaw); +// break; +// case 'k': +// z -= 0.05; +// arm->ikPoseRPY(x, y, z, row, pitch, yaw); +// break; +// case 'c': +// arm->goHome(); +// arm->getCurrentPoseFromMsg(x, y, z, row, pitch, yaw); +// break; +// case 'p': +// arm->ikPoseRPY(0.462213, -0.00559882, -0.0217322, 3.1036, 0.151366, 3.04644); +// arm->getCurrentPoseFromMsg(x, y, z, row, pitch, yaw); +// break; +// case 'q': +// flag = false; +// } +// } +// return 0; +// } \ No newline at end of file diff --git a/bin/Cam b/bin/Cam new file mode 100755 index 0000000..dd9ffdd Binary files /dev/null and b/bin/Cam differ diff --git a/bin/KeybordControl b/bin/KeybordControl new file mode 100755 index 0000000..6f2fd38 Binary files /dev/null and b/bin/KeybordControl differ diff --git a/bin/armController b/bin/armController new file mode 100755 index 0000000..da70793 Binary files /dev/null and b/bin/armController differ diff --git a/include/MySerial.h b/include/MySerial.h new file mode 100644 index 0000000..cc6e1a1 --- /dev/null +++ b/include/MySerial.h @@ -0,0 +1,42 @@ +#ifndef SERIALPORT_H +#define SERIALPORT_H + +#include +#include +#include +#include +#include +#include +#include + +class SerialPort +{ +private: + std::string m_portName; // 串口名称(如/dev/ttyUSB0) + speed_t m_baudRate; // 串口波特率 + int m_fd; // 文件描述符,用于表示串口文件 + struct termios m_tty; // 用于保存串口配置的结构体 +public: + // 构造函数,初始化串口路径和波特率 + SerialPort(const std::string &portName, speed_t baudRate); + + // 析构函数,确保在对象销毁时关闭串口 + ~SerialPort(); + + // 打开串口 + int openPort(); + + // 关闭串口 + void closePort(); + + // 写数据到串口 + int writeData(const char *data, size_t size); + + // 从串口读取数据 + int readData(char *buffer, size_t bufferSize); + + // 判断串口是否已打开 + bool isOpen() const; +}; + +#endif // SERIALPORT_H diff --git a/include/MySocket.h b/include/MySocket.h new file mode 100644 index 0000000..c6a0ab8 --- /dev/null +++ b/include/MySocket.h @@ -0,0 +1,56 @@ +// 本文件主要用于接受发送端的连接,数据的收发以及处理等等功能 +#pragma once + +#include +#include +#include +#include +#include +#include + +using namespace std; + +// TCP +class MySocket +{ +private: + int m_server_fd; // 服务端套接字文件描述符 + int m_client_fd; // 客户端套接字文件描述符 + struct sockaddr_in m_server_addr; // 服务端地址结构体 + struct sockaddr_in m_client_addr; // 客户端地址结构体 + +public: + // 构造与析构函数 + MySocket(); + ~MySocket(); + + bool InitServer(int port); // 初始化服务端 + bool AcceptClient(); // 接受客户端连接 + bool SendData(const std::string &data); // 发送数据 + bool SendData(const char *data, size_t size); // 发送数据 + bool SendLargeData(const string &data, size_t chunkSize); + string ReceiveData(); // 接收数据 + string ReceiveLargeData(size_t expectedSize, size_t chunkSize);// 接收大数据 + void CloseSocket(); // 关闭套接字 + void CloseClientSocket(); // 关闭客户端套接字 + void CloseServerSocket(); // 关闭服务端套接字 + string GetClientIP() { return inet_ntoa(m_client_addr.sin_addr); } // 获取客户端IP地址 + int GetClientPort() { return ntohs(m_client_addr.sin_port); } // 获取客户端端口号 +}; + +// UDP +class MyUDP +{ +private: + int m_sockfd; // UDP套接字文件描述符 + struct sockaddr_in m_server_addr; // 对端地址结构体 + +public: + MyUDP(); // 构造函数 + ~MyUDP(); // 析构函数 + + bool InitServer(const string &ip, int port); // 初始化UDP服务端 + bool SendData(const std::string &data); // 发送数据 + string ReceiveData(); // 接收数据 + void CloseSocket(); // 关闭套接字 +}; diff --git a/include/armcontroller.hpp b/include/armcontroller.hpp new file mode 100644 index 0000000..907208c --- /dev/null +++ b/include/armcontroller.hpp @@ -0,0 +1,124 @@ +/* +本程序用于机械臂的基本控制 +*/ +#include +#include +#include +#include "msg/ArmString_.hpp" + +#include // 解析 URDF文本/文件 +#include //URDF -> KDL::Tree +#include //结构树 +#include //让solver可识别 +#include //数据容器 +#include //位姿工具提供 +#include //前向运动学 +#include //逆向运动学 + +#define TOPIC "rt/arm_Command" +#define TOPICSTATUS "current_servo_angle" +#define TOPICSTATUS1 "rt/arm_Feedback" + +using namespace std; +using namespace unitree::robot; +using namespace unitree::common; + +// 弧度互转工具,角度转弧度 +static inline double rad2deg(double r) { return r * 180.0 / M_PI; } +static inline double deg2rad(double d) { return d * M_PI / 180.0; } + +// 消息结构体 +struct msg_data +{ + // 电机编号 + double angle0; // 底座 + double angle1; + double angle2; + double angle3; + double angle4; + double angle5; + double angle6; // 夹爪 +}; + +// struct anglePos +// { +// double x; +// double y; +// double z; +// double roll; +// double pitch; +// double yaw; +// }; + +// 机械臂控制对象 +class armController +{ +public: + armController(); + ~armController(); + void Init(); + + // 从urdf构建base->tip的kdl::chain,并返回关节顺序(后续角度填写顺序) + bool buildChainFromUrdf(const string &urdfPath, const string &baseLink, const string &tipLink, KDL::Chain &outChain, vector &outJointNames); + bool ikPoseRPY(double x,double y,double z,double roll,double pitch,double yaw); + + // 根据角度求坐标 + bool getCurrentPoseFromMsg(double &x, double &y, double &z, double &roll, double &pitch, double &yaw); + + // 填充至JntArray + void fillToJntArray(const msg_data &msgdata_, KDL::JntArray &qSol); + + // 填充至结构体中 + void fillToMsgData(const KDL::JntArray &qSol, msg_data &msgdata); + + ///////基本控制/////// + // 夹爪前进 + void goForward(); + + // 夹爪后退 + void goBack(); + + // 夹爪向上 + void goUp(); + + // 夹爪向下 + void goDown(); + + // 夹爪左转 + void goLeft(); + + // 夹爪右转 + void goRight(); + + // 夹爪放开 + void jawRelease(); + + // 夹爪夹住 + void jawClaming(); + + ///////预设位置/////// + // 回原点 + void goHome(); + + // 捡垃圾预设位置 + void trashActionDefault(); + + // 设置电机参数 + void setAngle(msg_data msgData_); + +private: + // 发送消息 + msg_data msgData_{}; + uint seq = 0; // 唯一识别码 + uint funcdoe = 0; // 指令功能码 + uint address = 0; // 指令地址码 + uint mode = 0; // 控制模式 + unitree_arm::msg::dds_::ArmString_ msg_{}; // 传送消息 + unitree::robot::ChannelFactory *arminit_ = ChannelFactory::Instance(); // 初始化句柄 + ChannelPublisher publisher_{TOPIC}; // 机械臂dds控制句柄 + KDL::Chain outchain_; // 保存机械臂结构 + KDL::JntArray qSeed_; // 当前位姿 + KDL::JntArray qLast_; // 保存上次的位姿 + KDL::JntArray qSol_; // 输出位姿 + vector outJoinName_; // 保存关节顺序 +}; \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..79dc030 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,61 @@ +cmake_minimum_required(VERSION 3.16) +project(keybord_control_app CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# 项目根目录(本 CMakeLists 在 unitreeApp/src 下) +get_filename_component(PROJ_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/.. ABSOLUTE) + +# OpenCV(用于 GStreamer/VideoCapture) +find_package(OpenCV REQUIRED) + +# Cyclone DDS C/C++(通常安装在 /usr/local 或系统库路径) +find_library(DDSCXX_LIB NAMES ddscxx HINTS /usr/local/lib /usr/lib /usr/lib/aarch64-linux-gnu) +find_library(DDSC_LIB NAMES ddsc HINTS /usr/local/lib /usr/lib /usr/lib/aarch64-linux-gnu) +if(NOT DDSCXX_LIB OR NOT DDSC_LIB) + message(FATAL_ERROR "Could not find Cyclone DDS libraries ddscxx and ddsc. Please install or set CMAKE_LIBRARY_PATH.") +endif() + +# 头文件目录 +include_directories( + ${PROJ_ROOT}/unitree_SDK/include + ${PROJ_ROOT}/include + ${PROJ_ROOT}/arm/src + /usr/local/include/ddscxx + /usr/local/include/iceoryx/v2.0.2 + /usr/include/eigen3 +) + +# 运行时 rpath(便于直接运行) +set(CMAKE_BUILD_RPATH "/usr/local/lib;/usr/lib;/usr/lib/aarch64-linux-gnu") +set(CMAKE_INSTALL_RPATH "/usr/local/lib;/usr/lib;/usr/lib/aarch64-linux-gnu") + +# 源文件 +set(SRC_COMMON + MySocket.cpp + MySerial.cpp + OpenCv.cpp +) + +# 可执行程序:keybordControl(入口 main.cpp) +add_executable(keybordControl + main.cpp + ${SRC_COMMON} +) + +target_link_libraries(keybordControl + ${OpenCV_LIBS} + ${DDSCXX_LIB} + ${DDSC_LIB} + unitree_sdk2 + pthread +) + +# 构建信息 +message(STATUS "OpenCV libs: ${OpenCV_LIBS}") +message(STATUS "Linked ddscxx: ${DDSCXX_LIB}") +message(STATUS "Linked ddsc: ${DDSC_LIB}") + diff --git a/src/MySerial.cpp b/src/MySerial.cpp new file mode 100644 index 0000000..f384fb2 --- /dev/null +++ b/src/MySerial.cpp @@ -0,0 +1,117 @@ +#include "MySerial.h" + +// 构造函数,初始化串口路径和波特率 +SerialPort::SerialPort(const std::string &portName, speed_t baudRate) : m_portName(portName), m_baudRate(baudRate), m_fd(-1) +{ + // 初始化tty结构体,确保没有残留的设置 + memset(&m_tty, 0, sizeof(m_tty)); +} + +// 析构函数,确保关闭串口 +SerialPort::~SerialPort() +{ + if (m_fd != -1) + { + close(m_fd); // 关闭串口 + } +} + +// 打开串口 +int SerialPort::openPort() +{ + // 打开串口设备文件,O_RDWR表示可读写,O_NOCTTY表示不将串口设置为控制终端 + m_fd = open(m_portName.c_str(), O_RDWR | O_NOCTTY); + if (m_fd == -1) + { + perror("Open"); + return -1; + } + + // 获取当前串口的配置 + if (tcgetattr(m_fd, &m_tty) != 0) + { + perror("tcgetattr"); + return -1; + } + + // 设置波特率 + cfsetospeed(&m_tty, m_baudRate); // 设置输出波特率 + cfsetispeed(&m_tty, m_baudRate); // 设置输入波特率 + + // 配置串口控制模式 + m_tty.c_cflag &= ~PARENB; // 禁用校验位 + m_tty.c_cflag &= ~CSTOPB; // 使用1个停止位 + m_tty.c_cflag &= ~CSIZE; // 清除数据位设置 + m_tty.c_cflag |= CS8; // 设置为8个数据位 + m_tty.c_cflag &= ~CRTSCTS; // 禁用硬件流控制 + m_tty.c_cflag |= CREAD | CLOCAL; // 启用接收并忽略控制线路 + + // 配置串口模式 + m_tty.c_lflag &= ~ICANON; // 禁用规范模式 + m_tty.c_lflag &= ~ECHO; // 禁用回显 + m_tty.c_lflag &= ~ECHOE; // 禁用删除字符的回显 + m_tty.c_lflag &= ~ISIG; // 禁用信号字符(如Ctrl+C) + m_tty.c_iflag &= ~(IXON | IXOFF | IXANY); // 禁用软件流控制 + m_tty.c_iflag &= ~(ICRNL | IGNCR); // 禁用CR(回车)转换 + + // 禁用输出处理(如换行符转换为回车换行) + m_tty.c_oflag &= ~OPOST; + + // 设置串口读取配置 + m_tty.c_cc[VMIN] = 1; // 至少读取1个字符 + m_tty.c_cc[VTIME] = 0; // 不设置超时 + + // 清理串口缓存 + tcflush(m_fd, TCIFLUSH); // 清空输入缓存 + tcflush(m_fd, TCOFLUSH); // 清空输出缓存 + + // 应用新的串口配置 + if (tcsetattr(m_fd, TCSANOW, &m_tty) != 0) + { + perror("tcsetattr"); + return -1; + } + + return 0; +} + + +// 关闭串口 +void SerialPort::closePort() +{ + if (m_fd != -1) + { + close(m_fd); // 关闭文件描述符 + m_fd = -1; // 将文件描述符置为无效 + } +} + +// 写数据到串口 +int SerialPort::writeData(const char *data, size_t size) +{ + if (m_fd == -1) + { + throw std::runtime_error("Serial port is not open"); + } + + // 使用write系统调用将数据写入串口 + return write(m_fd, data, size); +} + +// 从串口读取数据 +int SerialPort::readData(char *buffer, size_t bufferSize) +{ + if (m_fd == -1) + { + throw std::runtime_error("Serial port is not open"); + } + + // 使用read系统调用从串口读取数据 + return read(m_fd, buffer, bufferSize); +} + +// 判断串口是否已打开 +bool SerialPort::isOpen() const +{ + return m_fd != -1; +} diff --git a/src/MySocket.cpp b/src/MySocket.cpp new file mode 100644 index 0000000..d42ea07 --- /dev/null +++ b/src/MySocket.cpp @@ -0,0 +1,286 @@ +#include "MySocket.h" + +// TCP +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +MySocket::MySocket() : m_client_fd(-1), m_server_fd(-1) {} + +MySocket::~MySocket() +{ + this->CloseSocket(); +} + +void MySocket::CloseClientSocket() // 关闭客户端套接字 +{ + if (m_client_fd != -1) + { + close(m_client_fd); + m_client_fd = -1; + } + // cout << "Client socket closed successfully." << endl; +} + +void MySocket::CloseServerSocket() // 关闭服务端套接字 +{ + if (m_server_fd != -1) + { + close(m_server_fd); + m_server_fd = -1; + } + // cout << "Server socket closed successfully." << endl; +} + +// 关闭Socket连接 +void MySocket::CloseSocket() +{ + if (m_client_fd != -1) + { + close(m_client_fd); + m_client_fd = -1; + } + if (m_server_fd != -1) + { + close(m_server_fd); + m_server_fd = -1; + } + + cout << "Sockets closed successfully." << endl; +} + +// 初始化Socket +bool MySocket::InitServer(int port) +{ + // 创建Socket + this->m_server_fd = socket(AF_INET, SOCK_STREAM, 0); + if (m_server_fd < 0) + { + perror("socket"); + return false; + } + + int opt = 1; + setsockopt(m_server_fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); + + this->m_server_addr.sin_family = AF_INET; // 设置协议族 + // this->m_server_addr.sin_addr.s_addr = INADDR_ANY; // 监听所有IP地址 + this->m_server_addr.sin_addr.s_addr = inet_addr("192.168.123.18"); // 监听指定IP地址 + this->m_server_addr.sin_port = htons(port); // 设置端口号 + + // 绑定Socket + if (bind(m_server_fd, (struct sockaddr *)&m_server_addr, sizeof(m_server_addr)) < 0) + { + perror("bind"); + CloseSocket(); + return false; + } + + // 开始监听 + if (listen(m_server_fd, 5) < 0) + { + perror("listen"); + CloseSocket(); + return false; + } + + cout << "Server initialized on port " << port << endl; + return true; +} + +// 接收客户端的连接 +bool MySocket::AcceptClient() +{ + socklen_t addr_len = sizeof(m_client_addr); + m_client_fd = accept(m_server_fd, (struct sockaddr *)&m_client_addr, &addr_len); + if (m_client_fd < 0) + { + perror("accept"); + return false; + } + + cout << "Client connected: " << inet_ntoa(m_client_addr.sin_addr) << ":" << ntohs(m_client_addr.sin_port) << endl; + + return true; +} + +// 接受客户端信息 +string MySocket::ReceiveData() +{ + char buffer[1024]; + memset(buffer, 0, sizeof(buffer)); + + ssize_t bytes_received = recv(m_client_fd, buffer, sizeof(buffer) - 1, 0); + if (bytes_received <= 0) + { + if (bytes_received == 0) + { + cout << "Client disconnected." << endl; + } + // else + // { + // cout << bytes_received << endl; + // perror("recv"); + // } + return ""; // 返回空字符串表示客户端断开连接 + } + + return string(buffer, bytes_received); +} +// 接受大数据 +string MySocket::ReceiveLargeData(size_t expectedSize, size_t chunkSize) +{ + string receivedData; + size_t totalBytesReceived = 0; + + while (totalBytesReceived < expectedSize) + { + char buffer[1024]; + memset(buffer, 0, sizeof(buffer)); + + ssize_t bytesReceived = recv(m_client_fd, buffer, min(chunkSize, sizeof(buffer)), 0); + if (bytesReceived <= 0) + { + if (bytesReceived == 0) + { + cout << "Client disconnected." << endl; + } + else + { + perror("recv"); + } + break; + } + + receivedData.append(buffer, bytesReceived); + totalBytesReceived += bytesReceived; + } + + return receivedData; +} + +// 向客户端发送消息 +bool MySocket::SendData(const string &data) +{ + ssize_t bytes_sent = send(m_client_fd, data.c_str(), data.size(), 0); + if (bytes_sent < 0) + { + perror("send"); + return false; + } + return true; +} + +bool MySocket::SendData(const char *data, size_t size) +{ + ssize_t bytes_sent = send(m_client_fd, data, size, 0); + if (bytes_sent < 0) + { + perror("send"); + return false; + } + return true; +} + +//发送大数据 +bool MySocket::SendLargeData(const string &data, size_t chunkSize) +{ + size_t totalBytesSent = 0; + while (totalBytesSent < data.size()) + { + size_t bytesToSend = min(chunkSize, data.size() - totalBytesSent); + string chunk = data.substr(totalBytesSent, bytesToSend); + + if (!SendData(chunk)) + { + cerr << "Failed to send data chunk at offset: " << totalBytesSent << endl; + return false; + } + totalBytesSent += bytesToSend; + } + return true; +} + + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// UDP +MyUDP::MyUDP() // 构造函数 +{ + m_sockfd = -1; // 初始化套接字描述符为-1 +} +MyUDP::~MyUDP() // 析构函数 +{ + CloseSocket(); // 关闭套接字 +} + +bool MyUDP::InitServer(const string &ip, int port) // 初始化UDP服务端 +{ + m_sockfd = socket(AF_INET, SOCK_DGRAM, 0); // 创建UDP套接字 + if (m_sockfd < 0) + { + perror("socket"); + return false; + } + + // 设置目标地址 + memset(&m_server_addr, 0, sizeof(m_server_addr)); + m_server_addr.sin_family = AF_INET; + m_server_addr.sin_port = htons(port); + if (inet_pton(AF_INET, ip.c_str(), &m_server_addr.sin_addr) <= 0) + { + cerr << "IP地址设置失败" << endl; + return false; + } + + cout << "UDP server initialized on " << ip << ":" << port << endl; + return true; +} + +bool MyUDP::SendData(const std::string &data) // 发送数据 +{ + if (m_sockfd < 0) + { + cerr << "套接字未初始化" << endl; + return false; + } + + ssize_t sentBytes = sendto(m_sockfd, data.c_str(), data.size(), 0, + (struct sockaddr *)&m_server_addr, sizeof(m_server_addr)); + if (sentBytes < 0) + { + cerr << "发送数据失败" << endl; + return false; + } + + // cout << "发送数据成功: " << data << endl; + return true; +} +string MyUDP::ReceiveData() // 接收数据 +{ + if (m_sockfd < 0) + { + cerr << "套接字未初始化" << endl; + return ""; + } + + char buffer[1024] = {0}; + socklen_t addrLen = sizeof(m_server_addr); + ssize_t receivedBytes = recvfrom(m_sockfd, buffer, sizeof(buffer) - 1, 0, + (struct sockaddr *)&m_server_addr, &addrLen); + if (receivedBytes < 0) + { + cerr << "接收数据失败" << endl; + return ""; + } + + buffer[receivedBytes] = '\0'; + // cout << "接收到数据: " << buffer << endl; + return string(buffer); +} + +void MyUDP::CloseSocket() // 关闭套接字 +{ + if (m_sockfd != -1) + { + close(m_sockfd); + m_sockfd = -1; + } + cout << "UDP socket closed successfully." << endl; +} diff --git a/src/OpenCv.cpp b/src/OpenCv.cpp new file mode 100644 index 0000000..2b5f9df --- /dev/null +++ b/src/OpenCv.cpp @@ -0,0 +1,32 @@ +#include +using namespace cv; + +#include +using namespace std; + +int main() +{ + + VideoCapture cap("udpsrc address=230.1.1.1 port=1720 multicast-iface= ! application/x-rtp, media=video, encoding-name=H264 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! video/x-raw,width=1280,height=720,format=BGR ! appsink drop=1", + CAP_GSTREAMER); + + if (!cap.isOpened()) { + cerr <<"VideoCapture not opened"<Init(); +} + +void armController::Init() +{ + // 初始化话题 + this->arminit_->Init(0); + this->publisher_.InitChannel(); + + string urdfPath = "/home/unitree/unitreeApp/urdf/d1_description/urdf/d1_description.urdf"; + + bool ok = this->buildChainFromUrdf(urdfPath, "base_link", "Link6", this->outchain_, this->outJoinName_); + if (!ok) + { + cerr << "构建 KDL 链失败(检查 base/tip 名称与 URDF 路径)" << endl; + return; + } + // 机械臂复归原位 + this->goHome(); + // fillToJntArray(this->msgData_, qLast_); +} + +// 从urdf构建base->tip的kdl::chain,并返回关节顺序(后续角度填写顺序) +bool armController::buildChainFromUrdf(const string &urdfPath, const string &baseLink, const string &tipLink, KDL::Chain &outChain, vector &outJointNames) +{ + // 准备KDL::tree容器,接受解析得到的树形拓扑结构 + KDL::Tree tree; + + // 解析文件urdf文件到tree + if (!kdl_parser::treeFromFile(urdfPath, tree)) + { + return false; + } + + // 从 Tree 中抽取baseLink -> tipLink 到outPutName + if (!tree.getChain(baseLink, tipLink, outChain)) + { + return false; + } + + // 提取该链中的运动关节顺序 + outJointNames.clear(); + unsigned i; + for (i = 0; i < outChain.getNrOfSegments(); ++i) + { + const auto &j = outChain.getSegment(i).getJoint(); + if (j.getType() != KDL::Joint::None) + { + outJointNames.push_back(j.getName()); + } + } + + this->qSol_.resize(outchain_.getNrOfJoints()); + this->qSeed_.resize(this->qSol_.rows()); + this->qLast_.resize(this->qSol_.rows()); + fillToJntArray(this->msgData_, this->qLast_); + + return true; +} + +bool armController::ikPoseRPY(double x, double y, double z, double roll, double pitch, double yaw) +{ + // 种子 = 上一帧关节解 + this->qSeed_ = this->qLast_; + // 构建目标位姿 + KDL::Rotation R = KDL::Rotation::RPY(roll, pitch, yaw); + KDL::Frame target(R, KDL::Vector(x, y, z)); + + // 逆解:获取关节数组长度 + this->qSol_.resize(this->outchain_.getNrOfJoints()); + KDL::ChainIkSolverPos_LMA ik(this->outchain_); + int ret = ik.CartToJnt(this->qSeed_, target, this->qSol_); + if (ret < 0) + { + cerr << "求解失败,编码:" << ret << endl; + return false; + } + + this->qLast_ = this->qSol_; + this->fillToMsgData(this->qLast_, this->msgData_); + setAngle(this->msgData_); + return true; +} + +// 根据角度求坐标 +bool armController::getCurrentPoseFromMsg(double &x, double &y, double &z, double &roll, double &pitch, double &yaw) +{ + // 获取电机角度 + unsigned nj = outchain_.getNrOfJoints(); + KDL::JntArray q(nj); + if (nj >= 1) + q(0) = deg2rad(msgData_.angle0); + if (nj >= 2) + q(1) = deg2rad(msgData_.angle1); + if (nj >= 3) + q(2) = deg2rad(msgData_.angle2); + if (nj >= 4) + q(3) = deg2rad(msgData_.angle3); + if (nj >= 5) + q(4) = deg2rad(msgData_.angle4); + if (nj >= 6) + q(5) = deg2rad(msgData_.angle5); + + KDL::ChainFkSolverPos_recursive fk(outchain_); + KDL::Frame tip; + if (fk.JntToCart(q, tip) < 0) + return false; + + x = tip.p.x(); + y = tip.p.y(); + z = tip.p.z(); + tip.M.GetRPY(roll, pitch, yaw); + + cout << "x = " << x << "\t" + << "y = " << y << "\t" + << "z = " << z << "\t" + << "roll = " << roll << "\t" + << "pitch = " << pitch << "\t" + << "yaw = " << yaw << endl; + + return true; +} + +// 填充至JntArray +void armController::fillToJntArray(const msg_data &msgdata_, KDL::JntArray &qSol) +{ + qSol(0) = deg2rad(msgdata_.angle0); + qSol(1) = deg2rad(msgdata_.angle1); + qSol(2) = deg2rad(msgdata_.angle2); + qSol(3) = deg2rad(msgdata_.angle3); + qSol(4) = deg2rad(msgdata_.angle4); + qSol(5) = deg2rad(msgdata_.angle5); +} + +void armController::fillToMsgData(const KDL::JntArray &qSol, msg_data &msgdata) +{ + msgdata.angle0 = rad2deg(qSol(0)); + msgdata.angle1 = rad2deg(qSol(1)); + msgdata.angle2 = rad2deg(qSol(2)); + msgdata.angle3 = rad2deg(qSol(3)); + msgdata.angle4 = rad2deg(qSol(4)); + msgdata.angle5 = rad2deg(qSol(5)); +} + +// 设置电机参数 +void armController::setAngle(msg_data msgData_) +{ + char buf[256]; + int n = std::snprintf(buf, sizeof(buf), + "{\"seq\":%u,\"address\":%u,\"funcode\":%u,\"data\":{" + "\"mode\":%u," + "\"angle0\":%.3f,\"angle1\":%.3f,\"angle2\":%.3f," + "\"angle3\":%.3f,\"angle4\":%.3f,\"angle5\":%.3f,\"angle6\":%.3f}}", + ++this->seq, this->address, this->funcdoe, this->mode, this->msgData_.angle0, this->msgData_.angle1, this->msgData_.angle2, + this->msgData_.angle3, this->msgData_.angle4, this->msgData_.angle5, this->msgData_.angle6); + std::string payload(buf, (n > 0 && n < (int)sizeof(buf)) ? n : (int)sizeof(buf) - 1); + cout << payload << endl; + this->msg_.data_() = payload; + // 发送数据 + this->publisher_.Write(this->msg_); +} + +// 回原点 +void armController::goHome() +{ + this->msgData_.angle0 = 4.0; + this->msgData_.angle1 = -90.0; + this->msgData_.angle2 = 90.3; + this->msgData_.angle3 = 1.1; + this->msgData_.angle4 = 8.3; + this->msgData_.angle5 = -0.89; + this->msgData_.angle6 = -19.9; + + this->address = 1; + this->funcdoe = 2; + this->mode = 0; + + this->setAngle(this->msgData_); + // fillToJntArray(this->msgData_, this->qLast_); +} + +// 捡垃圾预设动作 +void armController::trashActionDefault() +{ + this->msgData_.angle0 = -0.8; + this->msgData_.angle1 = 82.5; + this->msgData_.angle2 = -45.7; + this->msgData_.angle3 = 2.099; + this->msgData_.angle4 = 44.4; + this->msgData_.angle5 = -3.099; + this->msgData_.angle6 = 68; + + this->address = 1; + this->mode = 0; + this->funcdoe = 2; + + this->setAngle(this->msgData_); + + // fillToJntArray(this->msgData_, this->qSeed_); + fillToJntArray(this->msgData_, this->qLast_); +} + +// 销毁 +armController::~armController() +{ + if (arminit_ != nullptr) + delete this->arminit_; +} \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..0258211 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,311 @@ +#include "MySocket.h" +#include "unitree/robot/client/client.hpp" +#include "unitree/robot/go2/sport/sport_client.hpp" +#include "armcontroller.hpp" + +#include +#include +#include +#include +#include +#include +// #include //串口操作 +#include + +using namespace std; +using namespace cv; + +// 全局变量定义 +MySocket *Socket = new MySocket(); // TCP 套接字对象 + +std::mutex socketMutexDOG; // 用于线程同步的互斥锁 +std::mutex socketMutexARM; // 用于线程同步的互斥锁 +std::mutex serialMutex; // +std::condition_variable socketCondition; // 条件变量,用于通知线程 +bool DOGClientConnected = false; // 标志机械狗客户端是否连接 +bool ARMClientConnected = false; // 标志机械臂客户端是否连接 + +// 函数声明 +// void Go2Control(unitree::robot::go2::SportClient sport_client, MySocket *Socket); +void Go2Control(unitree::robot::go2::SportClient sport_client, MySocket *Socket); // 机器人控制函数 +// 视频发送函数 +void SendVideo(MySocket *tcpSocket); // 狗 +void SendVideoArm(MySocket *tcpSocket); // 机械臂 +void Myclose(int sig); +void GetControl(); +void SendMergedVideo(MySocket *tcpSocket); + +int main(int argc, char *argv[]) +{ + // 禁用所有信号,防止程序被意外中断 + for (int i = 1; i <= 64; i++) + { + signal(i, SIG_IGN); // 忽略所有信号 + } + + signal(SIGPIPE, SIG_IGN); // 忽略 SIGPIPE 信号 + signal(SIGINT, Myclose); // 捕捉 Ctrl+C 信号,调用 Myclose 函数进行清理 + + // 打开串口 + // if (serial->openPort() < 0) + // { + // return -1; + // } + + // 初始化 TCP 套接字服务器并等待客户端连接 + Socket->InitServer(8088); // 监听端口 8088 + while (true) + { + Socket->AcceptClient(); // 接受客户端连接 + // while(1); + pid_t pid = fork(); // 创建子进程 + + if (pid < 0) + { + // 系统资源不足 + perror("fork"); + return -1; + } + if (pid > 0) + { + // 父进程 + Socket->CloseClientSocket(); // 父进程关闭客户端套接字 + continue; + } + + Socket->CloseServerSocket(); // 子进程关闭服务器套接字 + + string index = Socket->ReceiveData(); // 接收客户端发送的索引数据 + + cout << "Received index: " << index << endl; + + if (index == "MERGED") + { + unitree::robot::ChannelFactory::Instance()->Init(0, "eth0"); // 初始化通信通道 + unitree::robot::go2::SportClient sport_client; // 创建运动控制客户端 + sport_client.SetTimeout(10.0f); // 设置超时时间 + sport_client.Init(); // 初始化客户端 + sport_client.WaitLeaseApplied(); // 等待租约申请完成 + + // 开启视频线程进行视频传输 + thread videoThread(SendMergedVideo, Socket); + + // 进入机器人控制循环 + Go2Control(sport_client, Socket); + + videoThread.join(); + } + + return 0; // 子进程结束 + } + return 0; +} + +// 信号处理函数,用于清理资源并安全退出程序 +void Myclose(int sig) +{ + cout << "Received signal " << sig << ", closing application..." << endl; + + // 关闭并释放 TCP 套接字资源 + if (Socket) + { + Socket->CloseClientSocket(); + delete Socket; + Socket = nullptr; + } + + cout << "Application closed." << endl; + exit(0); // 退出程序 +} + +// 机器人控制逻辑 +void Go2Control(unitree::robot::go2::SportClient sport_client, MySocket *Socket) +{ + char key = '\0'; // 当前按键 + char lastKey = '\0'; // 上一次按键 + bool isMoving = false; // 是否正在移动 + int sit = 0; // 坐下状态:1-坐下,2-趴下 + + unitree::robot::ChannelFactory::Instance()->Init(0, "eth0"); // enx00e04c36141b为网口号,用户根据自身情况修改 + unitree::robot::go2::ObstaclesAvoidClient sc; + sc.SetTimeout(5.0f); + sc.Init(); + if (sc.SwitchSet(false) == 0) // 关闭避障 + { + cout << "避障已关闭" << endl; + } + usleep(1000000); + + string recvData; // 接收的数据 + sport_client.FreeAvoid(false); // 开启自由避障 + + while (true) + { + // 接收客户端发送的数据 + recvData = Socket->ReceiveData(); + if (recvData.empty()) + { + cout << "DOGClient disconnected. Waiting for new connection..." << endl; + break; // 如果接收数据为空,可能是客户端断开连接,退出循环 + } + + // 根据接收到的指令控制机器人 + switch (static_cast(recvData[0])) + { + case 'P': // 按 'p' 键退出 + // cout << "You pressed 'p'" << endl; + sport_client.StopMove(); // 停止运动 + return; + + case 'W': // 按 'w' 键向前移动 + // cout << "You pressed 'w'" << endl; + sport_client.Move(0.5f, 0, 0); + isMoving = true; + break; + + case 'S': // 按 's' 键向后移动 + // cout << "You pressed 's'" << endl; + sport_client.Move(-0.5f, 0, 0); + isMoving = true; + break; + + case 'A': // 按 'a' 键向左移动 + // cout << "You pressed 'a'" << endl; + sport_client.Move(0, 0.5f, 0); + isMoving = true; + break; + + case 'D': // 按 'd' 键向右移动 + // cout << "You pressed 'd'" << endl; + sport_client.Move(0, -0.5f, 0); + isMoving = true; + break; + + case 'Q': // 按 'q' 键左转 + // cout << "You pressed 'q'" << endl; + sport_client.Move(0, 0, 1.2f); + isMoving = true; + break; + + case 'E': // 按 'e' 键右转 + // cout << "You pressed 'e'" << endl; + sport_client.Move(0, 0, -1.2f); + isMoving = true; + break; + + case 'Z': // 按 'z' 键趴下 + // cout << "You pressed 'z'" << endl; + sport_client.StandDown(); + isMoving = false; + sit = 2; + break; + + case 'T': // 按 't' 键恢复站立 + // cout << "You pressed 't'" << endl; + if (sit == 2) + { + sport_client.StandUp(); + sit = 0; + } + else if (sit == 1) + { + sport_client.RiseSit(); + sit = 0; + } + sport_client.StandUp(); + isMoving = false; + break; + + case 'F': // 按 'f' 键平衡站立 + sport_client.BalanceStand(); + break; + + default: // 未知指令,停止运动 + if (isMoving) + { + sport_client.StopMove(); + isMoving = false; + } + break; + } + } +} + +void SendMergedVideo(MySocket *tcpSocket) +{ + // 使用 GStreamer 管道读取狗的视频流,加入 H.264 编码器 + VideoCapture dogCap("udpsrc address=230.1.1.1 port=1720 multicast-iface=eth0 ! application/x-rtp, media=video, encoding-name=H264 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! video/x-raw,width=1280,height=720,format=BGR ! appsink drop=1", CAP_GSTREAMER); + + // 使用默认摄像头读取机械臂的视频流 + VideoCapture armCap(0); + + if (!dogCap.isOpened() || !armCap.isOpened()) + { + cerr << "Failed to open video streams." << endl; + return; + } + + dogCap.set(CAP_PROP_FPS, 30); + armCap.set(CAP_PROP_FPS, 30); + + Mat dogFrame, armFrame; + + // 创建一个 GStreamer 的 H.264 编码器(x264enc) + // 使用 GStreamer 的 x264enc 编码器来进行视频压缩 + string gstPipeline = "appsrc ! videoconvert ! video/x-raw,format=I420,width=1280,height=720 ! x264enc speed-preset=ultrafast tune=zerolatency ! rtph264pay ! appsink"; + VideoWriter writer(gstPipeline, CAP_GSTREAMER, 0, 30, Size(1280, 720), true); // 写入 H.264 编码的视频 + + if (!writer.isOpened()) + { + cerr << "Failed to open video writer." << endl; + return; + } + + while (true) + { + dogCap.read(dogFrame); + armCap.read(armFrame); + + if (dogFrame.empty() || armFrame.empty()) + { + continue; + } + + // 调整机械臂图像大小,使其与狗的图像大小一致 + if (armFrame.size() != dogFrame.size()) + { + resize(armFrame, armFrame, dogFrame.size()); + } + + Mat mergedFrame; + hconcat(dogFrame, armFrame, mergedFrame); + + // 使用 GStreamer VideoWriter 写入编码后的 H.264 流 + writer.write(mergedFrame); + + // 将 H.264 编码后的数据传输到 TCP 套接字 + vector buffer; + vector compression_params = {IMWRITE_JPEG_QUALITY, 10}; + imencode(".jpg", mergedFrame, buffer, compression_params); + + int imageSize = static_cast(buffer.size()); + + // 发送4字节大小 + if (!tcpSocket->SendData(reinterpret_cast(&imageSize), sizeof(int))) + { + cerr << "Failed to send image size." << endl; + break; + } + + // 发送图像数据 + if (!tcpSocket->SendData(reinterpret_cast(buffer.data()), buffer.size())) + { + cerr << "Failed to send image data." << endl; + continue; + } + } + + // 关闭摄像头 + dogCap.release(); + armCap.release(); +} \ No newline at end of file diff --git a/src/makefile b/src/makefile new file mode 100644 index 0000000..fd9b29e --- /dev/null +++ b/src/makefile @@ -0,0 +1,21 @@ +all: KeybordControl armController + +KeybordControl: main.cpp MySocket.cpp MySerial.cpp + g++ -g -o KeybordControl main.cpp MySocket.cpp MySerial.cpp \ + -I/home/unitree/unitreeApp/unitree_SDK/include \ + -I/home/unitree/unitreeApp/include \ + -I/usr/local/include/ddscxx \ + -I/home/unitree/unitreeApp/unitree_SDK/include/unitree/robot/go2/obstacles_avoid \ + -I/usr/local/include/iceoryx/v2.0.2 \ + $(shell pkg-config --cflags opencv4) \ + -L/usr/local/lib \ + $(shell pkg-config --libs opencv4) \ + -lunitree_sdk2 \ + -lddscxx \ + -lddsc \ + -lpthread + + mv KeybordControl ../bin + +clean: + # rm -rf KeybordControl \ No newline at end of file diff --git a/src/serialtest.cpp b/src/serialtest.cpp new file mode 100644 index 0000000..b66b55a --- /dev/null +++ b/src/serialtest.cpp @@ -0,0 +1,55 @@ +#include +#include +#include +#include "MySerial.h" + +int main() +{ + try + { + // 创建串口工具类对象 + SerialPort serial("/dev/ttyUSB0", B57600); + serial.openPort(); + + // // 向串口写数据 + // char* message = "Hello, Serial Port!"; + // serial.writeData(message, strlen(message)); + + // 从串口读取数据 + char buffer[1024]; + while (true) + { + int bytesRead = serial.readData(buffer, sizeof(buffer)); + if (bytesRead < 0) + { + if (errno == EAGAIN) + { + // 没有数据,稍等一下再试 + usleep(100000); // 延迟 100 毫秒 + } + else + { + std::cerr << "Error reading from serial port: " << strerror(errno) << std::endl; + break; + } + } + else if (bytesRead == 0) + { + std::cout << "No data available." << std::endl; + } + else + { + buffer[bytesRead] = '\0'; + std::string data(buffer); + std::cout << "Received: " << data << std::endl; + break; + } + } + } + catch (const std::exception &e) + { + std::cerr << "Error: " << e.what() << std::endl; + } + + return 0; +} \ No newline at end of file diff --git a/unitree_SDK/include/dds/config.h b/unitree_SDK/include/dds/config.h new file mode 100644 index 0000000..6654560 --- /dev/null +++ b/unitree_SDK/include/dds/config.h @@ -0,0 +1,31 @@ +/* + * Copyright(c) 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDS_CONFIG_H +#define DDS_CONFIG_H + +/* #undef DDSRT_WITH_LWIP */ +/* #undef DDSRT_WITH_FREERTOS */ + +#define DDSRT_HAVE_DYNLIB 1 +#define DDSRT_HAVE_FILESYSTEM 1 +#define DDSRT_HAVE_NETSTAT 1 +#define DDSRT_HAVE_RUSAGE 1 + +#define DDSRT_HAVE_IPV6 1 +#define DDSRT_HAVE_DNS 1 +#define DDSRT_HAVE_GETADDRINFO 1 +#define DDSRT_HAVE_GETHOSTBYNAME_R 1 +#define DDSRT_HAVE_GETHOSTNAME 1 +#define DDSRT_HAVE_INET_NTOP 1 +#define DDSRT_HAVE_INET_PTON 1 + +#endif diff --git a/unitree_SDK/include/dds/dds.h b/unitree_SDK/include/dds/dds.h new file mode 100644 index 0000000..89f8953 --- /dev/null +++ b/unitree_SDK/include/dds/dds.h @@ -0,0 +1,4744 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDS_H +#define DDS_H + +/** + * @file + * @brief Eclipse Cyclone DDS C header + * Main header of the Cyclone DDS C library, containing everything you need + * for your DDS application. + */ + +/** + * @defgroup dds (DDS Functionality) + */ +/** + * @defgroup deprecated (Deprecated functionality) + */ + +#if defined (__cplusplus) +#define restrict +#endif + +#include "dds/export.h" +#include "dds/features.h" + +#include "dds/ddsc/dds_basic_types.h" + +/* Sub components */ + +#include "dds/ddsrt/time.h" +#include "dds/ddsrt/retcode.h" +#include "dds/ddsrt/log.h" +#include "dds/ddsc/dds_public_impl.h" +#include "dds/ddsc/dds_public_alloc.h" +#include "dds/ddsc/dds_public_qos.h" +#include "dds/ddsc/dds_public_error.h" +#include "dds/ddsc/dds_public_status.h" +#include "dds/ddsc/dds_public_listener.h" + +#if defined (__cplusplus) +extern "C" { +#endif + + +/** + * @brief DDS Type Identifier (XTypes) + * @ingroup dds + * DOC_TODO + */ +typedef struct ddsi_typeid dds_typeid_t; + +/** + * @brief DDS Type Information (XTypes) + * @ingroup dds + * DOC_TODO + */ +typedef struct ddsi_typeinfo dds_typeinfo_t; + +/** + * @brief DDS Type Object (XTypes) + * @ingroup dds + * DOC_TODO + */ +typedef struct ddsi_typeobj dds_typeobj_t; + +/** + * @brief Reader History Cache + * @ingroup dds + * DOC_TODO + */ +struct dds_rhc; + +/** + * @brief DDSI parameter list + * @ingroup dds + * DOC_TODO + */ +struct ddsi_plist; + +/** + * @anchor ddsi_sertype + * @brief DDSI sertype + * @ingroup dds + * DOC_TODO + */ +struct ddsi_sertype; + +/** + * @anchor ddsi_serdata + * @brief DDSI Serdata + * @ingroup dds + * DOC_TODO + */ +struct ddsi_serdata; + +/** + * @ingroup deprecated + * @warning The DDSI sertopic functionality was moved to ddsi_sertype. + * It has been retained as a symbol to ensure binary compatibility. + */ +struct ddsi_sertopic; + +/** + * @brief DDSI Config + * @ingroup dds + * DOC_TODO + */ +struct ddsi_config; + +/** + * @brief Indicates that the library uses ddsi_sertype instead of ddsi_sertopic + * @ingroup dds + * If sertype is used, the function dds_create_topic_sertype requires a topic name parameter, + * as this field is not included in ddsi_sertype. + */ +#define DDS_HAS_DDSI_SERTYPE 1 + +/** + * @defgroup builtintopic (Builtin Topic Support) + * @ingroup dds + */ +/** + * @defgroup builtintopic_constants (Constants) + * @ingroup builtintopic + * @brief Convenience constants for referring to builtin topics + * These constants can be used in place of an actual dds_topic_t, when creating + * readers or writers for builtin-topics. + */ +/** + * @def DDS_BUILTIN_TOPIC_DCPSPARTICIPANT + * @ingroup builtintopic_constants + * Pseudo dds_topic_t for the builtin topic DcpsParticipant. Samples from this topic are + * @ref dds_builtintopic_participant structs. + */ +/** + * @def DDS_BUILTIN_TOPIC_DCPSTOPIC + * @ingroup builtintopic_constants + * Pseudo dds_topic_t for the builtin topic DcpsTopic. Samples from this topic are + * @ref dds_builtintopic_topic structs. Note that this only works if you have specified + * ENABLE_TOPIC_DISCOVERY in your cmake build. + */ +/** + * @def DDS_BUILTIN_TOPIC_DCPSPUBLICATION + * @ingroup builtintopic_constants + * Pseudo dds_topic_t for the builtin topic DcpsPublication. Samples from this topic are + * @ref dds_builtintopic_endpoint structs. + */ +/** + * @def DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION + * @ingroup builtintopic_constants + * Pseudo dds_topic_t for the builtin topic DcpsSubscription. Samples from this topic are + * @ref dds_builtintopic_endpoint structs. + */ + +#define DDS_BUILTIN_TOPIC_DCPSPARTICIPANT ((dds_entity_t) (DDS_MIN_PSEUDO_HANDLE + 1)) +#define DDS_BUILTIN_TOPIC_DCPSTOPIC ((dds_entity_t) (DDS_MIN_PSEUDO_HANDLE + 2)) +#define DDS_BUILTIN_TOPIC_DCPSPUBLICATION ((dds_entity_t) (DDS_MIN_PSEUDO_HANDLE + 3)) +#define DDS_BUILTIN_TOPIC_DCPSSUBSCRIPTION ((dds_entity_t) (DDS_MIN_PSEUDO_HANDLE + 4)) + + +/** + * @ingroup DOC_TODO + * Special handle representing the entity which forces the dds_data_allocator to allocate on heap + */ +#define DDS_DATA_ALLOCATOR_ALLOC_ON_HEAP ((dds_entity_t) (DDS_MIN_PSEUDO_HANDLE + 257)) + +/** + * @defgroup entity_status (Entity Status) + * @ingroup entity + * All entities have a set of "status conditions" + * (following the DCPS spec), read peeks, take reads & resets (analogously to read & + * take operations on reader). The "mask" allows operating only on a subset of the statuses. + * Enabled status analogously to DCPS spec. + * @{ + */ +/** + * @brief These identifiers are used to generate the bitshifted identifiers. + * By using bitflags instead of these IDs the process of building status masks is + * simplified to using simple binary OR operations. + * DOC_TODO fix the refs + */ +typedef enum dds_status_id { + DDS_INCONSISTENT_TOPIC_STATUS_ID, /**< See @ref DDS_INCONSISTENT_TOPIC_STATUS */ + DDS_OFFERED_DEADLINE_MISSED_STATUS_ID, /**< See @ref DDS_OFFERED_DEADLINE_MISSED_STATUS */ + DDS_REQUESTED_DEADLINE_MISSED_STATUS_ID, /**< See @ref DDS_REQUESTED_DEADLINE_MISSED_STATUS */ + DDS_OFFERED_INCOMPATIBLE_QOS_STATUS_ID, /**< See @ref DDS_OFFERED_INCOMPATIBLE_QOS_STATUS */ + DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS_ID, /**< See @ref DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS */ + DDS_SAMPLE_LOST_STATUS_ID, /**< See @ref DDS_SAMPLE_LOST_STATUS */ + DDS_SAMPLE_REJECTED_STATUS_ID, /**< See @ref DDS_SAMPLE_REJECTED_STATUS */ + DDS_DATA_ON_READERS_STATUS_ID, /**< See @ref DDS_DATA_ON_READERS_STATUS */ + DDS_DATA_AVAILABLE_STATUS_ID, /**< See @ref DDS_DATA_AVAILABLE_STATUS */ + DDS_LIVELINESS_LOST_STATUS_ID, /**< See @ref DDS_LIVELINESS_LOST_STATUS */ + DDS_LIVELINESS_CHANGED_STATUS_ID, /**< See @ref DDS_LIVELINESS_CHANGED_STATUS */ + DDS_PUBLICATION_MATCHED_STATUS_ID, /**< See @ref DDS_PUBLICATION_MATCHED_STATUS */ + DDS_SUBSCRIPTION_MATCHED_STATUS_ID /**< See @ref DDS_SUBSCRIPTION_MATCHED_STATUS */ +} dds_status_id_t; + +/** Helper value to indicate the highest bit that can be set in a status mask. */ +#define DDS_STATUS_ID_MAX (DDS_SUBSCRIPTION_MATCHED_STATUS_ID) + +/** + * @anchor DDS_INCONSISTENT_TOPIC_STATUS + * Another topic exists with the same name but with different characteristics. + */ +#define DDS_INCONSISTENT_TOPIC_STATUS (1u << DDS_INCONSISTENT_TOPIC_STATUS_ID) +/** + * @anchor DDS_OFFERED_DEADLINE_MISSED_STATUS + * The deadline that the writer has committed through its deadline QoS policy was not respected for a specific instance. */ +#define DDS_OFFERED_DEADLINE_MISSED_STATUS (1u << DDS_OFFERED_DEADLINE_MISSED_STATUS_ID) +/** + * @anchor DDS_REQUESTED_DEADLINE_MISSED_STATUS + * The deadline that the reader was expecting through its deadline QoS policy was not respected for a specific instance. */ +#define DDS_REQUESTED_DEADLINE_MISSED_STATUS (1u << DDS_REQUESTED_DEADLINE_MISSED_STATUS_ID) +/** + * @anchor DDS_OFFERED_INCOMPATIBLE_QOS_STATUS + * A QoS policy setting was incompatible with what was requested. */ +#define DDS_OFFERED_INCOMPATIBLE_QOS_STATUS (1u << DDS_OFFERED_INCOMPATIBLE_QOS_STATUS_ID) +/** + * @anchor DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS + * A QoS policy setting was incompatible with what is offered. */ +#define DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS (1u << DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS_ID) +/** + * @anchor DDS_SAMPLE_LOST_STATUS + * A sample has been lost (never received). */ +#define DDS_SAMPLE_LOST_STATUS (1u << DDS_SAMPLE_LOST_STATUS_ID) +/** + * @anchor DDS_SAMPLE_REJECTED_STATUS + * A (received) sample has been rejected. */ +#define DDS_SAMPLE_REJECTED_STATUS (1u << DDS_SAMPLE_REJECTED_STATUS_ID) +/** + * @anchor DDS_DATA_ON_READERS_STATUS + * New information is available in some of the data readers of a subscriber. */ +#define DDS_DATA_ON_READERS_STATUS (1u << DDS_DATA_ON_READERS_STATUS_ID) +/** + * @anchor DDS_DATA_AVAILABLE_STATUS + * New information is available in a data reader. */ +#define DDS_DATA_AVAILABLE_STATUS (1u << DDS_DATA_AVAILABLE_STATUS_ID) +/** + * @anchor DDS_LIVELINESS_LOST_STATUS + * The liveliness that the DDS_DataWriter has committed through its liveliness QoS policy was not respected; thus readers will consider the writer as no longer "alive". */ +#define DDS_LIVELINESS_LOST_STATUS (1u << DDS_LIVELINESS_LOST_STATUS_ID) +/** + * @anchor DDS_LIVELINESS_CHANGED_STATUS + * The liveliness of one or more writers, that were writing instances read through the readers has changed. Some writers have become "alive" or "not alive". */ +#define DDS_LIVELINESS_CHANGED_STATUS (1u << DDS_LIVELINESS_CHANGED_STATUS_ID) +/** + * @anchor DDS_PUBLICATION_MATCHED_STATUS + * The writer has found a reader that matches the topic and has a compatible QoS. */ +#define DDS_PUBLICATION_MATCHED_STATUS (1u << DDS_PUBLICATION_MATCHED_STATUS_ID) +/** + * @anchor DDS_SUBSCRIPTION_MATCHED_STATUS + * The reader has found a writer that matches the topic and has a compatible QoS. */ +#define DDS_SUBSCRIPTION_MATCHED_STATUS (1u << DDS_SUBSCRIPTION_MATCHED_STATUS_ID) +/** @}*/ // end group entity_status + +/** + * @defgroup subscription (Subscription) + * @ingroup dds + * DOC_TODO This contains the definitions regarding subscribing to data. + */ + +/** + * @defgroup subdata (Data access) + * @ingroup subscription + * Every sample you read from DDS comes with some metadata, which you can inspect and filter on. + * @{ + */ + +/** Read state for a data value */ +typedef enum dds_sample_state +{ + DDS_SST_READ = DDS_READ_SAMPLE_STATE, /**0 + * A valid publisher handle. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_entity_t +dds_get_publisher(dds_entity_t writer); + +/** + * @brief Get entity subscriber. + * @ingroup entity + * + * This operation returns the subscriber to which the given entity belongs. + * For instance, it will return the Subscriber that was used when + * creating a DataReader (when that DataReader was provided here). + * + * @param[in] entity Entity from which to get its subscriber. + * + * @returns A valid subscriber handle or an error code. + * + * @retval >0 + * A valid subscriber handle. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * DOC_TODO: Link to generic dds entity relations documentation. + */ +DDS_EXPORT dds_entity_t +dds_get_subscriber(dds_entity_t entity); + +/** + * @brief Get entity datareader. + * @ingroup entity + * + * This operation returns the datareader to which the given entity belongs. + * For instance, it will return the DataReader that was used when + * creating a ReadCondition (when that ReadCondition was provided here). + * + * @param[in] entity Entity from which to get its datareader. + * + * @returns A valid reader handle or an error code. + * + * @retval >0 + * A valid reader handle. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * DOC_TODO: Link to generic dds entity relations documentation. + */ +DDS_EXPORT dds_entity_t +dds_get_datareader(dds_entity_t entity); + +/** + * @defgroup condition (Conditions) + * @ingroup dds + * @brief Conditions allow you to express conditional interest in samples, + * to be used in read/take operations or attach to Waitsets. + */ + +/** + * @brief Get the mask of a condition. + * @ingroup condition + * + * This operation returns the mask that was used to create the given + * condition. + * + * @param[in] condition Read or Query condition that has a mask. + * @param[out] mask Where to store the mask of the condition. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Success (given mask is set). + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The mask arg is NULL. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_mask(dds_entity_t condition, uint32_t *mask); + +/** + * @brief Returns the instance handle that represents the entity. + * @ingroup entity + * + * @param[in] entity Entity of which to get the instance handle. + * @param[out] ihdl Pointer to dds_instance_handle_t. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Success. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * DOC_TODO: Check list of return codes is complete. + * */ +DDS_EXPORT dds_return_t +dds_get_instance_handle(dds_entity_t entity, dds_instance_handle_t *ihdl); + +/** + * @brief Returns the GUID that represents the entity in the network, + * and therefore only supports participants, readers and writers. + * @ingroup entity + * + * @param[in] entity Entity of which to get the instance handle. + * @param[out] guid Where to store the GUID. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Success. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * + * DOC_TODO: Check list of return codes is complete. + */ +DDS_EXPORT dds_return_t +dds_get_guid (dds_entity_t entity, dds_guid_t *guid); + +/** + * @brief Read the status set for the entity + * @ingroup entity_status + * + * This operation reads the status(es) set for the entity based on + * the enabled status and mask set. It does not clear the read status(es). + * + * @param[in] entity Entity on which the status has to be read. + * @param[out] status Returns the status set on the entity, based on the enabled status. + * @param[in] mask Filter the status condition to be read, 0 means all statuses + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Success. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter, status is a null pointer or + * mask has bits set outside the status range. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object or mask has status + * bits set that are undefined for the type of entity. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_read_status(dds_entity_t entity, uint32_t *status, uint32_t mask); + +/** + * @brief Read the status set for the entity + * @ingroup entity_status + * + * This operation reads the status(es) set for the entity based on the enabled + * status and mask set. It clears the status set after reading. + * + * @param[in] entity Entity on which the status has to be read. + * @param[out] status Returns the status set on the entity, based on the enabled status. + * @param[in] mask Filter the status condition to be read, 0 means all statuses + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Success. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter, status is a null pointer or + * mask has bits set outside the status range. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object or mask has status + * bits set that are undefined for the type of entity. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_take_status(dds_entity_t entity, uint32_t *status, uint32_t mask); + +/** + * @brief Get changed status(es) + * @ingroup entity_status + * + * This operation returns the status changes since they were last read. + * + * @param[in] entity Entity on which the statuses are read. + * @param[out] status Returns the current set of triggered statuses. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Success. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_status_changes(dds_entity_t entity, uint32_t *status); + +/** + * @anchor dds_get_status_mask + * @brief Get enabled status on entity + * @ingroup entity_status + * + * This operation returns the status enabled on the entity + * + * @param[in] entity Entity to get the status. + * @param[out] mask Mask of enabled statuses set on the entity. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Success. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_status_mask(dds_entity_t entity, uint32_t *mask); + +/** + * @deprecated Get enabled status on entity. Use \ref dds_get_status_mask instead. + * @ingroup deprecated + * + * @param[in] entity Entity to get the status. + * @param[out] mask Mask of enabled statuses set on the entity. + * @returns A dds_return_t indicating success of failure. + */ +DDS_DEPRECATED_EXPORT dds_return_t +dds_get_enabled_status(dds_entity_t entity, uint32_t *mask); + +/** + * @anchor dds_set_status_mask + * @brief Set status enabled on entity + * @ingroup entity_status + * + * This operation enables the status(es) based on the mask set + * + * @param[in] entity Entity to enable the status. + * @param[in] mask Status value that indicates the status to be enabled. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Success. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_set_status_mask(dds_entity_t entity, uint32_t mask); + +/** + * @deprecated Set enabled status on entity. Use \ref dds_set_status_mask instead. + * @ingroup deprecated + * + * @param[in] entity Entity to enable the status. + * @param[out] mask Status value that indicates the status to be enabled. + * @returns A dds_return_t indicating success of failure. + */ +DDS_DEPRECATED_EXPORT dds_return_t +dds_set_enabled_status(dds_entity_t entity, uint32_t mask); + +/** + * @defgroup entity_qos (Entity QoS) + * @ingroup entity + * @brief Almost all entities have get/set qos operations defined on them, + * again following the DCPS spec. But unlike the DCPS spec, the + * "present" field in qos_t allows one to initialize just the one QoS + * one wants to set & pass it to set_qos. + */ + +/** + * @brief Get entity QoS policies. + * @ingroup entity_qos + * + * This operation allows access to the existing set of QoS policies + * for the entity. + * + * @param[in] entity Entity on which to get qos. + * @param[out] qos Pointer to the qos structure that returns the set policies. + * + * @returns A dds_return_t indicating success or failure. The QoS object will have + * at least all QoS relevant for the entity present and the corresponding dds_qget_... + * will return true. + * + * @retval DDS_RETCODE_OK + * The existing set of QoS policy values applied to the entity + * has successfully been copied into the specified qos parameter. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The qos parameter is NULL. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * + * DOC_TODO: Link to generic QoS information documentation. + */ +DDS_EXPORT dds_return_t +dds_get_qos(dds_entity_t entity, dds_qos_t *qos); + +/** + * @brief Set entity QoS policies. + * @ingroup entity_qos + * + * This operation replaces the existing set of Qos Policy settings for an + * entity. The parameter qos must contain the struct with the QosPolicy + * settings which is checked for self-consistency. + * + * The set of QosPolicy settings specified by the qos parameter are applied on + * top of the existing QoS, replacing the values of any policies previously set + * (provided, the operation returned DDS_RETCODE_OK). + * + * Not all policies are changeable when the entity is enabled. + * + * @note Currently only Latency Budget and Ownership Strength are changeable QoS + * that can be set. + * + * @param[in] entity Entity from which to get qos. + * @param[in] qos Pointer to the qos structure that provides the policies. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The new QoS policies are set. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The qos parameter is NULL. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_IMMUTABLE_POLICY + * The entity is enabled and one or more of the policies of the QoS + * are immutable. + * @retval DDS_RETCODE_INCONSISTENT_POLICY + * A few policies within the QoS are not consistent with each other. + * + * DOC_TODO: Link to generic QoS information documentation. + */ +DDS_EXPORT dds_return_t +dds_set_qos(dds_entity_t entity, const dds_qos_t * qos); + +/** + * @defgroup entity_listener (Entity Listener) + * @ingroup entity + * @brief Get or set listener associated with an entity, + * type of listener provided much match type of entity. + */ + +/** + * @brief Get entity listeners. + * @ingroup entity_listener + * + * This operation allows access to the existing listeners attached to + * the entity. + * + * @param[in] entity Entity on which to get the listeners. + * @param[out] listener Pointer to the listener structure that returns the + * set of listener callbacks. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The listeners of to the entity have been successfully been + * copied into the specified listener parameter. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The listener parameter is NULL. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * + * DOC_TODO: Link to (generic) Listener and status information. + */ +DDS_EXPORT dds_return_t +dds_get_listener(dds_entity_t entity, dds_listener_t * listener); + +/** + * @brief Set entity listeners. + * @ingroup entity_listener + * + * This operation attaches a dds_listener_t to the dds_entity_t. Only one + * Listener can be attached to each Entity. If a Listener was already + * attached, this operation will replace it with the new one. In other + * words, all related callbacks are replaced (possibly with NULL). + * + * When listener parameter is NULL, all listener callbacks that were possibly + * set on the Entity will be removed. + * + * @note Not all listener callbacks are related to all entities. + * + * ## Communication Status + * For each communication status, the StatusChangedFlag flag is initially set to + * FALSE. It becomes TRUE whenever that plain communication status changes. For + * each plain communication status activated in the mask, the associated + * Listener callback is invoked and the communication status is reset + * to FALSE, as the listener implicitly accesses the status which is passed as a + * parameter to that operation. + * The status is reset prior to calling the listener, so if the application calls + * the get_ from inside the listener it will see the + * status already reset. + * + * ## Status Propagation + * In case a related callback within the Listener is not set, the Listener of + * the Parent entity is called recursively, until a Listener with the appropriate + * callback set has been found and called. This allows the application to set + * (for instance) a default behaviour in the Listener of the containing Publisher + * and a DataWriter specific behaviour when needed. In case the callback is not + * set in the Publishers' Listener either, the communication status will be + * propagated to the Listener of the DomainParticipant of the containing + * DomainParticipant. In case the callback is not set in the DomainParticipants' + * Listener either, the Communication Status flag will be set, resulting in a + * possible WaitSet trigger. + * + * @param[in] entity Entity on which to get the listeners. + * @param[in] listener Pointer to the listener structure that contains the + * set of listener callbacks (maybe NULL). + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The listeners of to the entity have been successfully been + * copied into the specified listener parameter. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * DOC_TODO: Link to (generic) Listener and status information. + */ +DDS_EXPORT dds_return_t +dds_set_listener(dds_entity_t entity, const dds_listener_t * listener); + +/* + Creation functions for various entities. Creating a subscriber or + publisher is optional: if one creates a reader as a descendant of a + participant, it is as if a subscriber is created specially for + that reader. + + QoS default values are those of the DDS specification, but the + inheritance rules are different: + + * publishers and subscribers inherit from the participant QoS + * readers and writers always inherit from the topic QoS + * the QoS's present in the "qos" parameter override the inherited values +*/ + +/** + * @defgroup domain (Domain) + * @ingroup DDS + */ + +/** + * @defgroup domain_participant (DomainParticipant) + * @ingroup domain + */ + +/** + * @brief Creates a new instance of a DDS participant in a domain + * @ingroup domain_participant + * + * If domain is set (not DDS_DOMAIN_DEFAULT) then it must match if the domain has also + * been configured or an error status will be returned. + * Currently only a single domain can be configured by providing configuration file. + * If no configuration file exists, the default domain is configured as 0. + * + * + * @param[in] domain The domain in which to create the participant (can be DDS_DOMAIN_DEFAULT). DDS_DOMAIN_DEFAULT is for using the domain in the configuration. + * @param[in] qos The QoS to set on the new participant (can be NULL). + * @param[in] listener Any listener functions associated with the new participant (can be NULL). + + * @returns A valid participant handle or an error code. + * + * @retval >0 + * A valid participant handle. + * @retval DDS_RETCODE_NOT_ALLOWED_BY_SECURITY + * An invalid DDS Security configuration was specified (whether + * that be missing or incorrect entries, expired certificates, + * or anything else related to the security settings and + * implementation). + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * Some security properties specified in the QoS, but the Cyclone + * build does not include support for DDS Security. + * @retval DDS_RETCODE_OUT_OF_RESOURCES + * Some resource limit (maximum participants, memory, handles, + * &c.) prevented creation of the participant. + * @retval DDS_RETCODE_ERROR + * The "CYCLONEDDS_URI" environment variable lists non-existent + * or invalid configuration files, or contains invalid embedded + * configuration items; or an unspecified internal error has + * occurred. + */ +DDS_EXPORT dds_entity_t +dds_create_participant( + const dds_domainid_t domain, + const dds_qos_t *qos, + const dds_listener_t *listener); + +/** + * @brief Creates a domain with a given configuration + * @ingroup domain + * + * To explicitly create a domain based on a configuration passed as a string. + * + * It will not be created if a domain with the given domain id already exists. + * This could have been created implicitly by a dds_create_participant(). + * + * Please be aware that the given domain_id always takes precedence over the + * configuration. + * + * | domain_id | domain id in config | result | + * |:----------|:--------------------|:------------------------------| + * | n | any (or absent) | n, config is used | + * | n | m == n | n, config is used | + * | n | m != n | n, config is ignored: default | + * + * Config models: + * -# @code{xml} + * + * ... + * + * + * @endcode + * where ... is all that can today be set in children of CycloneDDS + * with the exception of the id + * -# @code{xml} + * + * X + * + * + * @endcode + * Legacy form, domain id must be the first element in the file with + * a value (if nothing has been set previously, it a warning is good + * enough) + * + * Using NULL or "" as config will create a domain with default settings. + * + * + * @param[in] domain The domain to be created. DEFAULT_DOMAIN is not allowed. + * @param[in] config A configuration string containing file names and/or XML fragments representing the configuration. + * + * @returns A valid entity handle or an error code. + * + * @retval DDS_RETCODE_BAD_PARAMETER + * Illegal value for domain id or the configfile parameter is NULL. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The domain already existed and cannot be created again. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + */ +DDS_EXPORT dds_entity_t +dds_create_domain(const dds_domainid_t domain, const char *config); + +/** + * @brief Creates a domain with a given configuration, specified as an + * initializer (unstable interface) + * @ingroup domain + * + * To explicitly create a domain based on a configuration passed as a raw + * initializer rather than as an XML string. This allows bypassing the XML + * parsing, but tightly couples the initializing to implementation. See + * dds/ddsi/ddsi_config.h:ddsi_config_init_default for a way to initialize + * the default configuration. + * + * It will not be created if a domain with the given domain id already exists. + * This could have been created implicitly by a dds_create_participant(). + * + * Please be aware that the given domain_id always takes precedence over the + * configuration. + * + * @param[in] domain The domain to be created. DEFAULT_DOMAIN is not allowed. + * @param[in] config A configuration initializer. The lifetime of any pointers + * in config must be at least that of the lifetime of the domain. + * + * @returns A valid entity handle or an error code. + * + * @retval DDS_RETCODE_BAD_PARAMETER + * Illegal value for domain id or the config parameter is NULL. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The domain already existed and cannot be created again. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + */ +DDS_EXPORT dds_entity_t +dds_create_domain_with_rawconfig(const dds_domainid_t domain, const struct ddsi_config *config); + +/** + * @brief Get entity parent. + * @ingroup entity + * + * This operation returns the parent to which the given entity belongs. + * For instance, it will return the Participant that was used when + * creating a Publisher (when that Publisher was provided here). + * + * When a reader or a writer are created with a participant, then a + * subscriber or publisher are created implicitly. + * This function will return the implicit parent and not the used + * participant. + * + * @param[in] entity Entity from which to get its parent. + * + * @returns A valid entity handle or an error code. + * + * @retval >0 + * A valid entity handle. + * @retval DDS_ENTITY_NIL + * Called with a participant. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * DOC_TODO: Link to generic dds entity relations documentation. + */ +DDS_EXPORT dds_entity_t +dds_get_parent(dds_entity_t entity); + +/** + * @brief Get entity participant. + * @ingroup entity + * + * This operation returns the participant to which the given entity belongs. + * For instance, it will return the Participant that was used when + * creating a Publisher that was used to create a DataWriter (when that + * DataWriter was provided here). + * + * DOC_TODO: Link to generic dds entity relations documentation. + * + * @param[in] entity Entity from which to get its participant. + * + * @returns A valid entity or an error code. + * + * @retval >0 + * A valid participant handle. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_entity_t +dds_get_participant(dds_entity_t entity); + +/** + * @brief Get entity children. + * @ingroup entity + * + * This operation returns the children that the entity contains. + * For instance, it will return all the Topics, Publishers and Subscribers + * of the Participant that was used to create those entities (when that + * Participant is provided here). + * + * This functions takes a pre-allocated list to put the children in and + * will return the number of found children. It is possible that the given + * size of the list is not the same as the number of found children. If + * less children are found, then the last few entries in the list are + * untouched. When more children are found, then only 'size' number of + * entries are inserted into the list, but still complete count of the + * found children is returned. Which children are returned in the latter + * case is undefined. + * + * When supplying NULL as list and 0 as size, you can use this to acquire + * the number of children without having to pre-allocate a list. + * + * When a reader or a writer are created with a participant, then a + * subscriber or publisher are created implicitly. + * When used on the participant, this function will return the implicit + * subscriber and/or publisher and not the related reader/writer. + * + * @param[in] entity Entity from which to get its children. + * @param[out] children Pre-allocated array to contain the found children. + * @param[in] size Size of the pre-allocated children's list. + * + * @returns Number of children or an error code. + * + * @retval >=0 + * Number of found children (can be larger than 'size'). + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The children parameter is NULL, while a size is provided. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +/* TODO: Link to generic dds entity relations documentation. */ +DDS_EXPORT dds_return_t +dds_get_children(dds_entity_t entity, dds_entity_t *children, size_t size); + +/** + * @brief Get the domain id to which this entity is attached. + * @ingroup entity + * + * When creating a participant entity, it is attached to a certain domain. + * All the children (like Publishers) and childrens' children (like + * DataReaders), etc are also attached to that domain. + * + * This function will return the original domain ID when called on + * any of the entities within that hierarchy. For entities not associated + * with a domain, the id is set to DDS_DOMAIN_DEFAULT. + * + * @param[in] entity Entity from which to get its children. + * @param[out] id Pointer to put the domain ID in. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Domain ID was returned. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The id parameter is NULL. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_domainid(dds_entity_t entity, dds_domainid_t *id); + +/** + * @brief Get participants of a domain. + * @ingroup domain + * + * This operation acquires the participants created on a domain and returns + * the number of found participants. + * + * This function takes a domain id with the size of pre-allocated participant's + * list in and will return the number of found participants. It is possible that + * the given size of the list is not the same as the number of found participants. + * If less participants are found, then the last few entries in an array stay + * untouched. If more participants are found and the array is too small, then the + * participants returned are undefined. + * + * @param[in] domain_id The domain id. + * @param[out] participants The participant for domain. + * @param[in] size Size of the pre-allocated participant's list. + * + * @returns Number of participants found or and error code. + * + * @retval >0 + * Number of participants found. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The participant parameter is NULL, while a size is provided. + */ +DDS_EXPORT dds_return_t +dds_lookup_participant( + dds_domainid_t domain_id, + dds_entity_t *participants, + size_t size); + +/** + * @defgroup topic (Topic) + * @ingroup dds + */ + +/** + * @brief Creates a new topic with default type handling. + * @ingroup topic + * + * The type name for the topic is taken from the generated descriptor. Topic + * matching is done on a combination of topic name and type name. Each successful + * call to dds_create_topic creates a new topic entity sharing the same QoS + * settings with all other topics of the same name. + * + * @param[in] participant Participant on which to create the topic. + * @param[in] descriptor An IDL generated topic descriptor. + * @param[in] name Name of the topic. + * @param[in] qos QoS to set on the new topic (can be NULL). + * @param[in] listener Any listener functions associated with the new topic (can be NULL). + * + * @returns A valid, unique topic handle or an error code. + * + * @retval >=0 + * A valid unique topic handle. + * @retval DDS_RETCODE_BAD_PARAMETER + * Either participant, descriptor, name or qos is invalid. + * @retval DDS_RETCODE_INCONSISTENT_POLICY + * QoS mismatch between qos and an existing topic's QoS. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * Mismatch between type name in descriptor and pre-existing + * topic's type name. + */ +DDS_EXPORT dds_entity_t +dds_create_topic( + dds_entity_t participant, + const dds_topic_descriptor_t *descriptor, + const char *name, + const dds_qos_t *qos, + const dds_listener_t *listener); + + +/** + * @brief Indicates that the library defines the dds_create_topic_sertype function + * @ingroup topic + * Introduced to help with the change from sertopic to sertype. If you are using + * a modern CycloneDDS version you will not need this. + */ +#define DDS_HAS_CREATE_TOPIC_SERTYPE 1 + +/** + * @brief Creates a new topic with provided type handling. + * @ingroup topic + * + * The name for the type is taken from the provided "sertype" object. Type + * matching is done on a combination of topic name and type name. Each successful + * call to dds_create_topic creates a new topic entity sharing the same QoS + * settings with all other topics of the same name. + * + * In case this function returns a valid handle, the ownership of the provided + * sertype is handed over to Cyclone. On return, the caller gets in the sertype parameter a + * pointer to the sertype that is actually used by the topic. This can be the provided sertype + * (if this sertype was not yet known in the domain), or a sertype thas was + * already known in the domain. + * + * @param[in] participant Participant on which to create the topic. + * @param[in] name Topic name + * @param[in,out] sertype Internal description of the type . On return, the sertype parameter is set to the actual sertype that is used by the topic. + * @param[in] qos QoS to set on the new topic (can be NULL). + * @param[in] listener Any listener functions associated with the new topic (can be NULL). + * @param[in] sedp_plist Topic description to be published as part of discovery (if NULL, not published). + * + * @returns A valid, unique topic handle or an error code. Iff a valid handle, the domain takes ownership of provided serdata. + * + * @retval >=0 + * A valid unique topic handle. + * @retval DDS_RETCODE_BAD_PARAMETER + * Either participant, descriptor, name or qos is invalid. + * @retval DDS_RETCODE_INCONSISTENT_POLICY + * QoS mismatch between qos and an existing topic's QoS. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * Mismatch between type name in sertype and pre-existing + * topic's type name. + */ +DDS_EXPORT dds_entity_t +dds_create_topic_sertype ( + dds_entity_t participant, + const char *name, + struct ddsi_sertype **sertype, + const dds_qos_t *qos, + const dds_listener_t *listener, + const struct ddsi_plist *sedp_plist); + +/** + * @brief Indicates that the library defines the dds_create_topic_generic function + * @ingroup topic + * Introduced to help with the change from sertopic to sertype. You should probably + * move to using sertype instead of sertopic and ignore this. + */ +#define DDS_HAS_CREATE_TOPIC_GENERIC 1 + +/** + * @anchor dds_create_topic_generic + * @brief Creates a new topic with provided type handling. + * @ingroup topic + * + * DOC_TODO: this description does not make any sense, this is for the legacy sertopic? + * deprecate? + * + * The name for the type is taken from the provided "sertype" object. Type + * matching is done on a combination of topic name and type name. Each successful + * call to dds_create_topic creates a new topic entity sharing the same QoS + * settings with all other topics of the same name. + * + * In case this function returns a valid handle, the ownership of the provided + * sertype is handed over to Cyclone. On return, the caller gets in the sertype parameter a + * pointer to the sertype that is actually used by the topic. This can be the provided sertype + * (if this sertype was not yet known in the domain), or a sertype thas was + * already known in the domain. + * + * @param[in] participant Participant on which to create the topic. + * @param[in,out] sertopic Legacy internal description of the type. On return, the sertype parameter is set to the actual sertype that is used by the topic. + * @param[in] qos QoS to set on the new topic (can be NULL). + * @param[in] listener Any listener functions associated with the new topic (can be NULL). + * @param[in] sedp_plist Topic description to be published as part of discovery (if NULL, not published). + * + * @returns A valid, unique topic handle or an error code. Iff a valid handle, the domain takes ownership of provided serdata. + * + * @retval >=0 + * A valid unique topic handle. + * @retval DDS_RETCODE_BAD_PARAMETER + * Either participant, descriptor, name or qos is invalid. + * @retval DDS_RETCODE_INCONSISTENT_POLICY + * QoS mismatch between qos and an existing topic's QoS. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * Mismatch between type name in sertype and pre-existing + * topic's type name. + */ +DDS_EXPORT dds_entity_t +dds_create_topic_generic ( + dds_entity_t participant, + struct ddsi_sertopic **sertopic, + const dds_qos_t *qos, + const dds_listener_t *listener, + const struct ddsi_plist *sedp_plist); + +/** + * @deprecated Creates a new topic with provided type handling. + * @ingroup deprecated + * Use @ref dds_create_topic_sertype instead. + * + * @param[in] participant Participant on which to create the topic. + * @param[in,out] sertopic Legacy internal description of the type. On return, the sertype parameter is set to the actual sertype that is used by the topic. + * @param[in] qos QoS to set on the new topic (can be NULL). + * @param[in] listener Any listener functions associated with the new topic (can be NULL). + * @param[in] sedp_plist Topic description to be published as part of discovery (if NULL, not published). + * + * @returns A valid, unique topic handle or an error code. + */ +DDS_DEPRECATED_EXPORT dds_entity_t +dds_create_topic_arbitrary ( + dds_entity_t participant, + struct ddsi_sertopic *sertopic, + const dds_qos_t *qos, + const dds_listener_t *listener, + const struct ddsi_plist *sedp_plist); + +/** + * @brief Finds a locally created or discovered remote topic by topic name and type information + * @ingroup topic + * + * Finds a locally created topic or a discovered remote topic based on the topic + * name and type. In case the topic is not found, this function will wait for + * the topic to become available until the provided time out. + * + * When using the scope DDS_FIND_SCOPE_LOCAL_DOMAIN, there will be no requests sent + * over the network for resolving the type in case it is unresolved. This also applies + * to dependent types: in case a dependency of the provided type is unresolved, no + * requests will be sent for resolving the type when using LOCAL_DOMAIN scope. + * + * In case the scope is DDS_FIND_SCOPE_GLOBAL, for unresolved types (or dependencies) + * a type lookup request will be sent. + * + * In case no type information is provided and multiple (discovered) topics exist + * with the provided name, an arbitrary topic with that name will be returned. + * In this scenario, it would be better to read DCPSTopic data and use that to + * get the required topic meta-data. + * + * The returned topic should be released with dds_delete. + * + * @param[in] scope The scope used to find the topic. In case topic discovery is not enabled in the build, SCOPE_GLOBAL cannot be used. + * @param[in] participant The handle of the participant the found topic will be created in + * @param[in] name The name of the topic to find. + * @param[in] type_info The type information of the topic to find. Optional, and should not be provided in case topic discovery is not enabled in the build. + * @param[in] timeout The timeout for waiting for the topic to become available + * + * @returns A valid topic handle or an error code. + * + * @retval >0 + * A valid topic handle. + * @retval 0 + * No topic of this name exists + * @retval DDS_RETCODE_BAD_PARAMETER + * Participant or type information was invalid. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The provided type could not be found. + */ +DDS_EXPORT dds_entity_t +dds_find_topic (dds_find_scope_t scope, dds_entity_t participant, const char *name, const dds_typeinfo_t *type_info, dds_duration_t timeout); + +/** + * @deprecated Finds a locally created or discovered remote topic by topic name + * @ingroup deprecated + * Use @ref dds_find_topic instead. + * + * Finds a locally created topic or a discovered remote topic based on the topic + * name. In case the topic is not found, this function will wait for the topic + * to become available until the provided time out. + * + * In case multiple (discovered) topics exist with the provided name, this function + * will return randomly one of these topic. The caller can decide to read DCPSTopic + * data and select one of the topic definitions to create the topic. + * + * The returned topic should be released with dds_delete. + * + * @param[in] scope The scope used to find the topic + * @param[in] participant The handle of the participant the found topic will be created in + * @param[in] name The name of the topic to find. + * @param[in] timeout The timeout for waiting for the topic to become available + * + * @returns A valid topic handle or an error code. + * + * @retval >0 + * A valid topic handle. + * @retval 0 + * No topic of this name existed yet + * @retval DDS_RETCODE_BAD_PARAMETER + * Participant handle or scope invalid + */ +DDS_DEPRECATED_EXPORT dds_entity_t +dds_find_topic_scoped (dds_find_scope_t scope, dds_entity_t participant, const char *name, dds_duration_t timeout); + + +/** + * @ingroup topic + * @brief Creates topic descriptor for the provided type_info + * + * @param[in] scope The scope used to find the type: DDS_FIND_SCOPE_LOCAL_DOMAIN or DDS_FIND_SCOPE_GLOBAL. In case DDS_FIND_SCOPE_GLOBAL is used, a type lookup request will be sent to other nodes. + * @param[in] participant The handle of the participant. + * @param[in] type_info The type (dds_typeinfo_t) of the topic to find. + * @param[in] timeout The timeout for waiting for the type to become available + * @param[out] descriptor - Pointer to a dds_topic_descriptor_t pointer that will be allocated and populated. To free allocated memory for this descriptor, use dds_delete_topic_descriptor. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The topic descriptor has been succesfully created. + * @retval DDS_RETCODE_BAD_PARAMETER + * Type_info or descriptor parameter not provided, invalid entity (not a participant) or scope invalid. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The participant or the type_id was not found. + * @retval DDS_RETCODE_TIMEOUT + * Type was not resolved within the provided timeout + * @retval DDS_RETCODE_UNSUPPORTED + * Cyclone DDS built without type discovery + * (cf. DDS_HAS_TYPE_DISCOVERY) + */ +DDS_EXPORT dds_return_t +dds_create_topic_descriptor (dds_find_scope_t scope, dds_entity_t participant, const dds_typeinfo_t *type_info, dds_duration_t timeout, dds_topic_descriptor_t **descriptor); + +/** + * @ingroup topic + * @brief Delete memory allocated to the provided topic descriptor + * + * @param[in] descriptor - Pointer to a dds_topic_descriptor_t + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The topic descriptor has been succesfully deleted. + * @retval DDS_RETCODE_BAD_PARAMETER + * No descriptor provided + * @retval DDS_RETCODE_UNSUPPORTED + * Cyclone DDS built without type discovery + * (cf. DDS_HAS_TYPE_DISCOVERY) + */ +DDS_EXPORT dds_return_t +dds_delete_topic_descriptor (dds_topic_descriptor_t *descriptor); + +/** + * @brief Returns the name of a given topic. + * @ingroup topic + * + * @param[in] topic The topic. + * @param[out] name Buffer to write the topic name to. + * @param[in] size Number of bytes available in the buffer. + * + * @returns A dds_return_t indicating success or failure. + * + * @return Actual length of topic name (name is truncated if return value >= size) or error + */ +DDS_EXPORT dds_return_t +dds_get_name(dds_entity_t topic, char *name, size_t size); + +/** + * @brief Returns the type name of a given topic. + * @ingroup topic + * + * @param[in] topic The topic. + * @param[out] name Buffer to write the topic type name to. + * @param[in] size Number of bytes available in the buffer. + * + * @returns A dds_return_t indicating success or failure. + * + * @return Actual length of type name (name is truncated if return value >= size) or error + */ +DDS_EXPORT dds_return_t +dds_get_type_name(dds_entity_t topic, char *name, size_t size); + +/** + * @defgroup topic_filter (Topic filters) + * @ingroup topic + * Topic filter functions. + * @warning part of the Unstable API: no guarantee that any + * of this will be maintained for backwards compatibility. + * + * Sampleinfo is all zero when filtering in a write call (i.e., writer created + * using a filtered topic, which one perhaps shouldn't be doing), otherwise it + * has as much filled in correctly as is possible given the context and the rest + * fixed: + * - sample_state DDS_SST_NOT_READ; + * - publication_handle set to writer's instance handle + * - source_timestamp set to source timestamp of sample + * - ranks 0 + * - valid_data true + * - instance_handle set to instance handle of existing instance if the + * sample matches an existing instance, otherwise to what + * the instance handle will be if it passes the filter + * - view_state set to instance view state if sample being filtered + * matches an existing instance, NEW if not + * - instance_state set to instance state if sample being filtered + * matches an existing instance, NEW if not + * - generation counts set to instance's generation counts if the sample + * matches an existing instance instance, 0 if not + */ + +/** + * @anchor dds_topic_filter_sample_fn + * @brief Topic filter function that only needs to look at the sample. + * @ingroup topic_filter + * @warning Unstable API + */ +typedef bool (*dds_topic_filter_sample_fn) (const void * sample); + +/** + * @anchor dds_topic_filter_sample_arg_fn + * @brief Topic filter function that only needs to look at the sample and a custom argument. + * @ingroup topic_filter + * @warning Unstable API + */ +typedef bool (*dds_topic_filter_sample_arg_fn) (const void * sample, void * arg); + +/** + * @anchor dds_topic_filter_sampleinfo_arg_fn + * @brief Topic filter function that only needs to look at the sampleinfo and a custom argument. + * @ingroup topic_filter + * @warning Unstable API + */ +typedef bool (*dds_topic_filter_sampleinfo_arg_fn) (const dds_sample_info_t * sampleinfo, void * arg); + +/** + * @anchor dds_topic_filter_sample_sampleinfo_arg_fn + * @brief Topic filter function that needs to look at the sample, the sampleinfo and a custom argument. + * @ingroup topic_filter + * @warning Unstable API + */ +typedef bool (*dds_topic_filter_sample_sampleinfo_arg_fn) (const void * sample, const dds_sample_info_t * sampleinfo, void * arg); + +/** + * @anchor dds_topic_filter_fn + * @brief See \ref dds_topic_filter_sample_fn + * @ingroup topic_filter + * @warning Unstable API + */ +typedef dds_topic_filter_sample_fn dds_topic_filter_fn; + +/** + * @anchor dds_topic_filter_arg_fn + * @brief See \ref dds_topic_filter_sample_arg_fn + * @ingroup topic_filter + * @warning Unstable API + */ +typedef dds_topic_filter_sample_arg_fn dds_topic_filter_arg_fn; + +/** + * @brief Topic filter mode; + * @ingroup topic_filter + * @warning Unstable API + */ +enum dds_topic_filter_mode { + DDS_TOPIC_FILTER_NONE, /**< Can be used to reset topic filter */ + DDS_TOPIC_FILTER_SAMPLE, /**< Use with \ref dds_topic_filter_sample_fn */ + DDS_TOPIC_FILTER_SAMPLE_ARG, /**< Use with \ref dds_topic_filter_sample_arg_fn */ + DDS_TOPIC_FILTER_SAMPLEINFO_ARG, /**< Use with \ref dds_topic_filter_sampleinfo_arg_fn */ + DDS_TOPIC_FILTER_SAMPLE_SAMPLEINFO_ARG, /**< Use with \ref dds_topic_filter_sample_sampleinfo_arg_fn */ +}; + +/** + * @brief Union of all filter function types; + * @ingroup topic_filter + * @warning Unstable API +*/ +union dds_topic_filter_function_union { + dds_topic_filter_sample_fn sample; /**< Use with mode dds_topic_filter_mode::DDS_TOPIC_FILTER_SAMPLE */ + dds_topic_filter_sample_arg_fn sample_arg; /**< Use with mode dds_topic_filter_mode::DDS_TOPIC_FILTER_SAMPLE_ARG */ + dds_topic_filter_sampleinfo_arg_fn sampleinfo_arg; /**< Use with mode dds_topic_filter_mode::DDS_TOPIC_FILTER_SAMPLEINFO_ARG */ + dds_topic_filter_sample_sampleinfo_arg_fn sample_sampleinfo_arg; /**< Use with mode dds_topic_filter_mode::DDS_TOPIC_FILTER_SAMPLE_SAMPLEINFO_ARG */ +}; + +/** + * @brief Full topic filter container; + * @ingroup topic_filter + * @warning Unstable API + */ +struct dds_topic_filter { + enum dds_topic_filter_mode mode; /**< Provide a mode */ + union dds_topic_filter_function_union f; /**< Provide a filter function */ + void *arg; /**< Provide an argument, can be NULL */ +}; + +/** + * @brief Sets a filter on a topic. To be replaced by proper filtering on readers, + * @ingroup topic_filter + * @warning Unstable API + * @deprecated use @ref dds_set_topic_filter_and_arg or @ref dds_set_topic_filter_extended instead + * + * Not thread-safe with respect to data being read/written using readers/writers + * using this topic. Be sure to create a topic entity specific to the reader you + * want to filter, then set the filter function, and only then create the reader. + * And don't change it unless you know there are no concurrent writes. + * + * @param[in] topic The topic on which the content filter is set. + * @param[in] filter The filter function used to filter topic samples. + */ +DDS_DEPRECATED_EXPORT void +dds_set_topic_filter(dds_entity_t topic, dds_topic_filter_fn filter); + +/** + * @brief Sets a filter on a topic. To be replaced by proper filtering on readers, + * @ingroup topic_filter + * @warning Unstable API + * @deprecated use @ref dds_set_topic_filter_and_arg or @ref dds_set_topic_filter_extended instead + * + * Not thread-safe with respect to data being read/written using readers/writers + * using this topic. Be sure to create a topic entity specific to the reader you + * want to filter, then set the filter function, and only then create the reader. + * And don't change it unless you know there are no concurrent writes. + * + * @param[in] topic The topic on which the content filter is set. + * @param[in] filter The filter function used to filter topic samples. + */ +DDS_DEPRECATED_EXPORT void +dds_topic_set_filter(dds_entity_t topic, dds_topic_filter_fn filter); + +/** + * @anchor dds_set_topic_filter_and_arg + * @brief Sets a filter and filter argument on a topic. + * @ingroup topic_filter + * @warning Unstable API + * To be replaced by proper filtering on readers. + * + * Not thread-safe with respect to data being read/written using readers/writers + * using this topic. Be sure to create a topic entity specific to the reader you + * want to filter, then set the filter function, and only then create the reader. + * And don't change it unless you know there are no concurrent writes. + * + * @param[in] topic The topic on which the content filter is set. + * @param[in] filter The filter function used to filter topic samples. + * @param[in] arg Argument for the filter function. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK Filter set successfully + * @retval DDS_RETCODE_BAD_PARAMETER The topic handle is invalid +*/ +DDS_EXPORT dds_return_t +dds_set_topic_filter_and_arg( + dds_entity_t topic, + dds_topic_filter_arg_fn filter, + void *arg); + +/** + * @anchor dds_set_topic_filter_extended + * @brief Sets a filter and filter argument on a topic. + * @ingroup topic_filter + * @warning Unstable API + * To be replaced by proper filtering on readers. + * + * Not thread-safe with respect to data being read/written using readers/writers + * using this topic. Be sure to create a topic entity specific to the reader you + * want to filter, then set the filter function, and only then create the reader. + * And don't change it unless you know there are no concurrent writes. + * + * @param[in] topic The topic on which the content filter is set. + * @param[in] filter The filter specification. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK Filter set successfully + * @retval DDS_RETCODE_BAD_PARAMETER The topic handle is invalid +*/ +DDS_EXPORT dds_return_t +dds_set_topic_filter_extended( + dds_entity_t topic, + const struct dds_topic_filter *filter); + +/** + * @brief Gets the filter for a topic. + * @ingroup topic_filter + * @deprecated Use dds_get_topic_filter_and_arg() or dds_get_topic_filter_extended() instead. + * @warning Unstable API + * + * To be replaced by proper filtering on readers. + * + * @param[in] topic The topic from which to get the filter. + * + * @returns The topic filter, or 0 when of type other than "sample". + */ +DDS_DEPRECATED_EXPORT dds_topic_filter_fn +dds_get_topic_filter(dds_entity_t topic); + +/** + * @brief Gets the filter for a topic. + * @ingroup topic_filter + * @deprecated Use dds_get_topic_filter_and_arg() or dds_get_topic_filter_extended() instead. + * @warning Unstable API + * + * To be replaced by proper filtering on readers. + * + * @param[in] topic The topic from which to get the filter. + * + * @returns The topic filter, or 0 when of type other than "sample". + */ +DDS_DEPRECATED_EXPORT dds_topic_filter_fn +dds_topic_get_filter(dds_entity_t topic); + +/** + * @brief Gets the filter for a topic. + * @ingroup topic_filter + * @warning Unstable API + * + * To be replaced by proper filtering on readers + * + * @param[in] topic The topic from which to get the filter. + * @param[out] fn The topic filter function (fn may be NULL). + * @param[out] arg Filter function argument (arg may be NULL). + * + * @retval DDS_RETCODE_OK Filter set successfully + * @retval DDS_RETCODE_PRECONDITION_NOT_MET Filter is not of "none" or "sample_arg" + * @retval DDS_RETCODE_BAD_PARAMETER The topic handle is invalid + */ +DDS_EXPORT dds_return_t +dds_get_topic_filter_and_arg ( + dds_entity_t topic, + dds_topic_filter_arg_fn *fn, + void **arg); + +/** + * @brief Gets the filter for a topic. + * @ingroup topic_filter + * @warning Unstable API + * + * To be replaced by proper filtering on readers + * + * @param[in] topic The topic from which to get the filter. + * @param[out] filter The topic filter specification. + * + * @retval DDS_RETCODE_OK Filter set successfully + * @retval DDS_RETCODE_BAD_PARAMETER The topic handle is invalid + */ +DDS_EXPORT dds_return_t +dds_get_topic_filter_extended ( + dds_entity_t topic, + struct dds_topic_filter *filter); + +/** + * @defgroup subscriber (Subscriber) + * @ingroup subscription + * DOC_TODO The Subscriber is a DDS Entity + */ + +/** + * @brief Creates a new instance of a DDS subscriber + * @ingroup subscriber + * + * @param[in] participant The participant on which the subscriber is being created. + * @param[in] qos The QoS to set on the new subscriber (can be NULL). + * @param[in] listener Any listener functions associated with the new subscriber (can be NULL). + * + * @returns A valid subscriber handle or an error code. + * + * @retval >0 + * A valid subscriber handle. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the parameters is invalid. + */ +DDS_EXPORT dds_entity_t +dds_create_subscriber( + dds_entity_t participant, + const dds_qos_t *qos, + const dds_listener_t *listener); + + +/** + * @defgroup publication (Publication) + * @ingroup dds + * DOC_TODO This contains the definitions regarding publication of data. + */ + +/** + * @defgroup publisher (Publisher) + * @ingroup publication + * DOC_TODO The Publisher is a DDS Entity + */ + +/** + * @brief Creates a new instance of a DDS publisher + * @ingroup publisher + * + * @param[in] participant The participant to create a publisher for. + * @param[in] qos The QoS to set on the new publisher (can be NULL). + * @param[in] listener Any listener functions associated with the new publisher (can be NULL). + * + * @returns A valid publisher handle or an error code. + * + * @retval >0 + * A valid publisher handle. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + */ +/* TODO: Check list of error codes is complete. */ +DDS_EXPORT dds_entity_t +dds_create_publisher( + dds_entity_t participant, + const dds_qos_t *qos, + const dds_listener_t *listener); + +/** + * @brief Suspends the publications of the Publisher + * @ingroup publisher + * + * This operation is a hint to the Service so it can optimize its performance by e.g., collecting + * modifications to DDS writers and then batching them. The Service is not required to use the hint. + * + * Every invocation of this operation must be matched by a corresponding call to @see dds_resume + * indicating that the set of modifications has completed. + * + * @param[in] publisher The publisher for which all publications will be suspended. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Publications suspended successfully. + * @retval DDS_RETCODE_BAD_PARAMETER + * The pub parameter is not a valid publisher. + * @retval DDS_RETCODE_UNSUPPORTED + * Operation is not supported. + */ +DDS_EXPORT dds_return_t +dds_suspend(dds_entity_t publisher); + +/** + * @brief Resumes the publications of the Publisher + * @ingroup publisher + * + * This operation is a hint to the Service to indicate that the application has + * completed changes initiated by a previous dds_suspend(). The Service is not + * required to use the hint. + * + * The call to resume_publications must match a previous call to @see suspend_publications. + * + * @param[in] publisher The publisher for which all publications will be resumed. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Publications resumed successfully. + * @retval DDS_RETCODE_BAD_PARAMETER + * The pub parameter is not a valid publisher. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * No previous matching dds_suspend(). + * @retval DDS_RETCODE_UNSUPPORTED + * Operation is not supported. + */ +DDS_EXPORT dds_return_t +dds_resume(dds_entity_t publisher); + +/** + * @brief Waits at most for the duration timeout for acks for data in the publisher or writer. + * @ingroup publication + * + * This operation blocks the calling thread until either all data written by the publisher + * or writer is acknowledged by all matched reliable reader entities, or else the duration + * specified by the timeout parameter elapses, whichever happens first. + * + * @param[in] publisher_or_writer Publisher or writer whose acknowledgments must be waited for + * @param[in] timeout How long to wait for acknowledgments before time out + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * All acknowledgments successfully received with the timeout. + * @retval DDS_RETCODE_BAD_PARAMETER + * The publisher_or_writer is not a valid publisher or writer. + * @retval DDS_RETCODE_TIMEOUT + * Timeout expired before all acknowledgments from reliable reader entities were received. + * @retval DDS_RETCODE_UNSUPPORTED + * Operation is not supported. + */ +DDS_EXPORT dds_return_t +dds_wait_for_acks(dds_entity_t publisher_or_writer, dds_duration_t timeout); + + +/** + * @defgroup reader (Reader) + * @ingroup subscription + * DOC_TODO The reader is a DDS Entity + */ + +/** + * @brief Creates a new instance of a DDS reader. + * @ingroup reader + * + * When a participant is used to create a reader, an implicit subscriber is created. + * This implicit subscriber will be deleted automatically when the created reader + * is deleted. + * + * @param[in] participant_or_subscriber The participant or subscriber on which the reader is being created. + * @param[in] topic The topic to read. + * @param[in] qos The QoS to set on the new reader (can be NULL). + * @param[in] listener Any listener functions associated with the new reader (can be NULL). + * + * @returns A valid reader handle or an error code. + * + * @retval >0 + * A valid reader handle. + * @retval DDS_RETCODE_ERROR + * An internal error occurred. + * + * DOC_TODO: Complete list of error codes + */ +DDS_EXPORT dds_entity_t +dds_create_reader( + dds_entity_t participant_or_subscriber, + dds_entity_t topic, + const dds_qos_t *qos, + const dds_listener_t *listener); + +/** + * @brief Creates a new instance of a DDS reader with a custom history cache. + * @ingroup reader + * + * When a participant is used to create a reader, an implicit subscriber is created. + * This implicit subscriber will be deleted automatically when the created reader + * is deleted. + * + * @param[in] participant_or_subscriber The participant or subscriber on which the reader is being created. + * @param[in] topic The topic to read. + * @param[in] qos The QoS to set on the new reader (can be NULL). + * @param[in] listener Any listener functions associated with the new reader (can be NULL). + * @param[in] rhc Reader history cache to use, reader becomes the owner + * + * @returns A valid reader handle or an error code. + * + * @retval >0 + * A valid reader handle. + * @retval DDS_RETCODE_ERROR + * An internal error occurred. + * + * DOC_TODO: Complete list of error codes + */ +DDS_EXPORT dds_entity_t +dds_create_reader_rhc( + dds_entity_t participant_or_subscriber, + dds_entity_t topic, + const dds_qos_t *qos, + const dds_listener_t *listener, + struct dds_rhc *rhc); + +/** + * @brief Wait until reader receives all historic data + * @ingroup reader + * + * The operation blocks the calling thread until either all "historical" data is + * received, or else the duration specified by the max_wait parameter elapses, whichever happens + * first. A return value of 0 indicates that all the "historical" data was received; a return + * value of TIMEOUT indicates that max_wait elapsed before all the data was received. + * + * @param[in] reader The reader on which to wait for historical data. + * @param[in] max_wait How long to wait for historical data before time out. + * + * @returns a status, 0 on success, TIMEOUT on timeout or a negative value to indicate error. + * + * DOC_TODO: Complete list of error codes + */ +DDS_EXPORT dds_return_t +dds_reader_wait_for_historical_data( + dds_entity_t reader, + dds_duration_t max_wait); + +/** + * @defgroup writer (Writer) + * @ingroup publication + * DOC_TODO The writer is a DDS Entity + */ + +/** + * @brief Creates a new instance of a DDS writer. + * @ingroup writer + * + * When a participant is used to create a writer, an implicit publisher is created. + * This implicit publisher will be deleted automatically when the created writer + * is deleted. + * + * @param[in] participant_or_publisher The participant or publisher on which the writer is being created. + * @param[in] topic The topic to write. + * @param[in] qos The QoS to set on the new writer (can be NULL). + * @param[in] listener Any listener functions associated with the new writer (can be NULL). + * + * @returns A valid writer handle or an error code. + * + * @returns >0 + * A valid writer handle. + * @returns DDS_RETCODE_ERROR + * An internal error occurred. + * + * DOC_TODO: Complete list of error codes + */ +DDS_EXPORT dds_entity_t +dds_create_writer( + dds_entity_t participant_or_publisher, + dds_entity_t topic, + const dds_qos_t *qos, + const dds_listener_t *listener); + + +/** + * @defgroup writing (Writing data) + * @ingroup writer + * Writing data (and variants of it) is straightforward. The first set + * is equivalent to the second set with -1 passed for "timestamp", + * meaning, substitute the result of a call to time(). The dispose + * and unregister operations take an object of the topic's type, but + * only touch the key fields; the remained may be undefined. +*/ + +/** + * @brief Registers an instance + * @ingroup writing + * + * This operation registers an instance with a key value to the data writer and + * returns an instance handle that could be used for successive write & dispose + * operations. When the handle is not allocated, the function will return an + * error and the handle will be un-touched. + * + * @param[in] writer The writer to which instance has be associated. + * @param[out] handle The instance handle. + * @param[in] data The instance with the key value. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + */ +DDS_EXPORT dds_return_t +dds_register_instance( + dds_entity_t writer, + dds_instance_handle_t *handle, + const void *data); + +/** + * @brief Unregisters an instance by instance + * @ingroup writing + * + * This operation reverses the action of register instance, removes all information regarding + * the instance and unregisters an instance with a key value from the data writer. + * + * @param[in] writer The writer to which instance is associated. + * @param[in] data The instance with the key value. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + */ +DDS_EXPORT dds_return_t +dds_unregister_instance(dds_entity_t writer, const void *data); + +/** + * @brief Unregisters an instance by instance handle + * @ingroup writing + * + * This operation unregisters the instance which is identified by the key fields of the given + * typed instance handle. + * + * @param[in] writer The writer to which instance is associated. + * @param[in] handle The instance handle. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + */ +DDS_EXPORT dds_return_t +dds_unregister_instance_ih(dds_entity_t writer, dds_instance_handle_t handle); + +/** + * @brief Unregisters an instance by instance with timestamp + * @ingroup writing + * + * This operation reverses the action of register instance, removes all information regarding + * the instance and unregisters an instance with a key value from the data writer. It also + * provides a value for the timestamp explicitly. + * + * @param[in] writer The writer to which instance is associated. + * @param[in] data The instance with the key value. + * @param[in] timestamp The timestamp used at registration. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + */ +DDS_EXPORT dds_return_t +dds_unregister_instance_ts( + dds_entity_t writer, + const void *data, + dds_time_t timestamp); + +/** + * @brief Unregisters an instance by instance handle with timestamp + * @ingroup writing + * + * This operation unregisters an instance with a key value from the handle. Instance can be identified + * from instance handle. If an unregistered key ID is passed as an instance data, an error is logged and + * not flagged as return value. + * + * @param[in] writer The writer to which instance is associated. + * @param[in] handle The instance handle. + * @param[in] timestamp The timestamp used at registration. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object + */ +DDS_EXPORT dds_return_t +dds_unregister_instance_ih_ts( + dds_entity_t writer, + dds_instance_handle_t handle, + dds_time_t timestamp); + +/** + * @brief This operation modifies and disposes a data instance. + * @ingroup writing + * + * This operation requests the Data Distribution Service to modify the instance and + * mark it for deletion. Copies of the instance and its corresponding samples, which are + * stored in every connected reader and, dependent on the QoS policy settings (also in + * the Transient and Persistent stores) will be modified and marked for deletion by + * setting their dds_instance_state_t to DDS_IST_NOT_ALIVE_DISPOSED. + * + * @par Blocking + * If the history QoS policy is set to DDS_HISTORY_KEEP_ALL, the + * dds_writedispose operation on the writer may block if the modification + * would cause data to be lost because one of the limits, specified in the + * resource_limits QoS policy, to be exceeded. In case the synchronous + * attribute value of the reliability Qos policy is set to true for + * communicating writers and readers then the writer will wait until + * all synchronous readers have acknowledged the data. Under these + * circumstances, the max_blocking_time attribute of the reliability + * QoS policy configures the maximum time the dds_writedispose operation + * may block. + * If max_blocking_time elapses before the writer is able to store the + * modification without exceeding the limits and all expected acknowledgements + * are received, the dds_writedispose operation will fail and returns + * DDS_RETCODE_TIMEOUT. + * + * @param[in] writer The writer to dispose the data instance from. + * @param[in] data The data to be written and disposed. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The sample is written and the instance is marked for deletion. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * At least one of the arguments is invalid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_TIMEOUT + * Either the current action overflowed the available resources as + * specified by the combination of the reliability QoS policy, + * history QoS policy and resource_limits QoS policy, or the + * current action was waiting for data delivery acknowledgement + * by synchronous readers. This caused blocking of this operation, + * which could not be resolved before max_blocking_time of the + * reliability QoS policy elapsed. + */ +DDS_EXPORT dds_return_t +dds_writedispose(dds_entity_t writer, const void *data); + +/** + * @brief This operation modifies and disposes a data instance with a specific + * timestamp. + * @ingroup writing + * + * This operation performs the same functions as dds_writedispose() except that + * the application provides the value for the source_timestamp that is made + * available to connected reader objects. This timestamp is important for the + * interpretation of the destination_order QoS policy. + * + * @param[in] writer The writer to dispose the data instance from. + * @param[in] data The data to be written and disposed. + * @param[in] timestamp The timestamp used as source timestamp. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The sample is written and the instance is marked for deletion. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * At least one of the arguments is invalid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_TIMEOUT + * Either the current action overflowed the available resources as + * specified by the combination of the reliability QoS policy, + * history QoS policy and resource_limits QoS policy, or the + * current action was waiting for data delivery acknowledgement + * by synchronous readers. This caused blocking of this operation, + * which could not be resolved before max_blocking_time of the + * reliability QoS policy elapsed. + */ +DDS_EXPORT dds_return_t +dds_writedispose_ts( + dds_entity_t writer, + const void *data, + dds_time_t timestamp); + +/** + * @brief This operation disposes an instance, identified by the data sample. + * @ingroup writing + * + * This operation requests the Data Distribution Service to modify the instance and + * mark it for deletion. Copies of the instance and its corresponding samples, which are + * stored in every connected reader and, dependent on the QoS policy settings (also in + * the Transient and Persistent stores) will be modified and marked for deletion by + * setting their dds_instance_state_t to DDS_IST_NOT_ALIVE_DISPOSED. + * + * @par Blocking + * If the history QoS policy is set to DDS_HISTORY_KEEP_ALL, the + * dds_writedispose operation on the writer may block if the modification + * would cause data to be lost because one of the limits, specified in the + * resource_limits QoS policy, to be exceeded. In case the synchronous + * attribute value of the reliability Qos policy is set to true for + * communicating writers and readers then the writer will wait until + * all synchronous readers have acknowledged the data. Under these + * circumstances, the max_blocking_time attribute of the reliability + * QoS policy configures the maximum time the dds_writedispose operation + * may block. + * If max_blocking_time elapses before the writer is able to store the + * modification without exceeding the limits and all expected acknowledgements + * are received, the dds_writedispose operation will fail and returns + * DDS_RETCODE_TIMEOUT. + * + * @param[in] writer The writer to dispose the data instance from. + * @param[in] data The data sample that identifies the instance + * to be disposed. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The sample is written and the instance is marked for deletion. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * At least one of the arguments is invalid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_TIMEOUT + * Either the current action overflowed the available resources as + * specified by the combination of the reliability QoS policy, + * history QoS policy and resource_limits QoS policy, or the + * current action was waiting for data delivery acknowledgement + * by synchronous readers. This caused blocking of this operation, + * which could not be resolved before max_blocking_time of the + * reliability QoS policy elapsed. + */ +DDS_EXPORT dds_return_t +dds_dispose(dds_entity_t writer, const void *data); + +/** + * @brief This operation disposes an instance with a specific timestamp, identified by the data sample. + * @ingroup writing + * + * This operation performs the same functions as dds_dispose() except that + * the application provides the value for the source_timestamp that is made + * available to connected reader objects. This timestamp is important for the + * interpretation of the destination_order QoS policy. + * + * @param[in] writer The writer to dispose the data instance from. + * @param[in] data The data sample that identifies the instance + * to be disposed. + * @param[in] timestamp The timestamp used as source timestamp. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The sample is written and the instance is marked for deletion + * @retval DDS_RETCODE_ERROR + * An internal error has occurred + * @retval DDS_RETCODE_BAD_PARAMETER + * At least one of the arguments is invalid + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted + * @retval DDS_RETCODE_TIMEOUT + * Either the current action overflowed the available resources as + * specified by the combination of the reliability QoS policy, + * history QoS policy and resource_limits QoS policy, or the + * current action was waiting for data delivery acknowledgment + * by synchronous readers. This caused blocking of this operation, + * which could not be resolved before max_blocking_time of the + * reliability QoS policy elapsed. + */ +DDS_EXPORT dds_return_t +dds_dispose_ts( + dds_entity_t writer, + const void *data, + dds_time_t timestamp); + +/** + * @brief This operation disposes an instance, identified by the instance handle. + * @ingroup writing + * + * This operation requests the Data Distribution Service to modify the instance and + * mark it for deletion. Copies of the instance and its corresponding samples, which are + * stored in every connected reader and, dependent on the QoS policy settings (also in + * the Transient and Persistent stores) will be modified and marked for deletion by + * setting their dds_instance_state_t to DDS_IST_NOT_ALIVE_DISPOSED. + * + * @par Instance Handle + * The given instance handle must correspond to the value that was returned by either + * the dds_register_instance operation, dds_register_instance_ts or dds_lookup_instance. + * If there is no correspondence, then the result of the operation is unspecified. + * + * @param[in] writer The writer to dispose the data instance from. + * @param[in] handle The handle to identify an instance. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The sample is written and the instance is marked for deletion. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * At least one of the arguments is invalid + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this writer + */ +DDS_EXPORT dds_return_t +dds_dispose_ih(dds_entity_t writer, dds_instance_handle_t handle); + +/** + * @brief This operation disposes an instance with a specific timestamp, identified by the instance handle. + * @ingroup writing + * + * This operation performs the same functions as dds_dispose_ih() except that + * the application provides the value for the source_timestamp that is made + * available to connected reader objects. This timestamp is important for the + * interpretation of the destination_order QoS policy. + * + * @param[in] writer The writer to dispose the data instance from. + * @param[in] handle The handle to identify an instance. + * @param[in] timestamp The timestamp used as source timestamp. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The sample is written and the instance is marked for deletion. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * At least one of the arguments is invalid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this writer. + */ +DDS_EXPORT dds_return_t +dds_dispose_ih_ts( + dds_entity_t writer, + dds_instance_handle_t handle, + dds_time_t timestamp); + +/** + * @brief Write the value of a data instance + * @ingroup writing + * + * With this API, the value of the source timestamp is automatically made + * available to the data reader by the service. + * + * @param[in] writer The writer entity. + * @param[in] data Value to be written. + * + * @returns dds_return_t indicating success or failure. + */ +DDS_EXPORT dds_return_t +dds_write(dds_entity_t writer, const void *data); + +/** + * @brief Flush a writers batched writes + * @ingroup writing + * + * When using the WriteBatch mode you can manually batch small writes into larger + * datapackets for network efficiency. The normal dds_write() calls will no longer + * automatically decide when to send data, you will do that manually using this function. + * + * DOC_TODO check if my assumptions about how this function works are correct + * + * @param[in] writer The writer entity. + */ +DDS_EXPORT void +dds_write_flush(dds_entity_t writer); + +/** + * @brief Write a serialized value of a data instance + * @ingroup writing + * + * This call causes the writer to write the serialized value that is provided + * in the serdata argument. Timestamp and statusinfo fields are set to the + * current time and 0 (indicating a regular write), respectively. + * + * @param[in] writer The writer entity. + * @param[in] serdata Serialized value to be written. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The writer successfully wrote the serialized value. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_TIMEOUT + * The writer failed to write the serialized value reliably within the specified max_blocking_time. + */ +DDS_EXPORT dds_return_t +dds_writecdr(dds_entity_t writer, struct ddsi_serdata *serdata); + +/** + * @brief Write a serialized value of a data instance + * @ingroup writing + * + * This call causes the writer to write the serialized value that is provided + * in the serdata argument. Timestamp and statusinfo are used as is. + * + * @param[in] writer The writer entity. + * @param[in] serdata Serialized value to be written. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The writer successfully wrote the serialized value. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_TIMEOUT + * The writer failed to write the serialized value reliably within the specified max_blocking_time. + */ +DDS_EXPORT dds_return_t +dds_forwardcdr(dds_entity_t writer, struct ddsi_serdata *serdata); + +/** + * @brief Write the value of a data instance along with the source timestamp passed. + * @ingroup writing + * + * @param[in] writer The writer entity. + * @param[in] data Value to be written. + * @param[in] timestamp Source timestamp. + * + * @returns A dds_return_t indicating success or failure. + */ +DDS_EXPORT dds_return_t +dds_write_ts( + dds_entity_t writer, + const void *data, + dds_time_t timestamp); + +/** + * @defgroup readcondition (ReadCondition) + * @ingroup condition + */ +/** + * @defgroup querycondition (QueryCondition) + * @ingroup condition + */ +/** + * @defgroup guardcondition (GuardCondition) + * @ingroup condition + */ + +/** + * @brief Creates a readcondition associated to the given reader. + * @ingroup readcondition + * + * The readcondition allows specifying which samples are of interest in + * a data reader's history, by means of a mask. The mask is or'd with + * the flags that are dds_sample_state_t, dds_view_state_t and + * dds_instance_state_t. + * + * Based on the mask value set, the readcondition gets triggered when + * data is available on the reader. + * + * Waitsets allow waiting for an event on some of any set of entities. + * This means that the readcondition can be used to wake up a waitset when + * data is in the reader history with states that matches the given mask. + * + * @note The parent reader and every of its associated conditions (whether + * they are readconditions or queryconditions) share the same resources. + * This means that one of these entities reads or takes data, the states + * of the data will change for other entities automatically. For instance, + * if one reads a sample, then the sample state will become 'read' for all + * associated reader/conditions. Or if one takes a sample, then it's not + * available to any other associated reader/condition. + * + * @param[in] reader Reader to associate the condition to. + * @param[in] mask Interest (dds_sample_state_t|dds_view_state_t|dds_instance_state_t). + * + * @returns A valid condition handle or an error code. + * + * @retval >0 + * A valid condition handle + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_entity_t +dds_create_readcondition(dds_entity_t reader, uint32_t mask); + +/** + * @brief Function signature for a querycondition filter + * @ingroup querycondition + */ +typedef bool (*dds_querycondition_filter_fn) (const void * sample); + +/** + * @brief Creates a queryondition associated to the given reader. + * @ingroup querycondition + * + * The queryondition allows specifying which samples are of interest in + * a data reader's history, by means of a mask and a filter. The mask is + * or'd with the flags that are dds_sample_state_t, dds_view_state_t and + * dds_instance_state_t. + * + * Based on the mask value set and data that matches the filter, the + * querycondition gets triggered when data is available on the reader. + * + * Waitsets allow waiting for an event on some of any set of entities. + * This means that the querycondition can be used to wake up a waitset when + * data is in the reader history with states that matches the given mask + * and filter. + * + * @note The parent reader and every of its associated conditions (whether + * they are readconditions or queryconditions) share the same resources. + * This means that one of these entities reads or takes data, the states + * of the data will change for other entities automatically. For instance, + * if one reads a sample, then the sample state will become 'read' for all + * associated reader/conditions. Or if one takes a sample, then it's not + * available to any other associated reader/condition. + * + * @param[in] reader Reader to associate the condition to. + * @param[in] mask Interest (dds_sample_state_t|dds_view_state_t|dds_instance_state_t). + * @param[in] filter Callback that the application can use to filter specific samples. + * + * @returns A valid condition handle or an error code + * + * @retval >=0 + * A valid condition handle. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_entity_t +dds_create_querycondition( + dds_entity_t reader, + uint32_t mask, + dds_querycondition_filter_fn filter); + +/** + * @brief Creates a guardcondition. + * @ingroup guardcondition + * + * Waitsets allow waiting for an event on some of any set of entities. + * This means that the guardcondition can be used to wake up a waitset when + * data is in the reader history with states that matches the given mask. + * + * @param[in] participant Participant on which to create the guardcondition. + * + * @returns A valid condition handle or an error code. + * + * @retval >0 + * A valid condition handle + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_entity_t +dds_create_guardcondition(dds_entity_t participant); + +/** + * @brief Sets the trigger status of a guardcondition. + * @ingroup guardcondition + * + * @param[in] guardcond Guard condition to set the trigger status of. + * @param[in] triggered The triggered status to set. + * + * @retval DDS_RETCODE_OK + * Operation successful + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_set_guardcondition(dds_entity_t guardcond, bool triggered); + +/** + * @brief Reads the trigger status of a guardcondition. + * @ingroup guardcondition + * + * @param[in] guardcond Guard condition to read the trigger status of. + * @param[out] triggered The triggered status read from the guard condition. + * + * @retval DDS_RETCODE_OK + * Operation successful + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_read_guardcondition(dds_entity_t guardcond, bool *triggered); + +/** + * @brief Reads and resets the trigger status of a guardcondition. + * @ingroup guardcondition + * + * @param[in] guardcond Guard condition to read and reset the trigger status of. + * @param[out] triggered The triggered status read from the guard condition. + * + * @retval DDS_RETCODE_OK + * Operation successful + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_take_guardcondition(dds_entity_t guardcond, bool *triggered); + +/** + * @defgroup waitset (WaitSet) + * @ingroup dds + */ + +/** + * @brief Waitset attachment argument. + * @ingroup waitset + * + * Every entity that is attached to the waitset can be accompanied by such + * an attachment argument. When the waitset wait is unblocked because of an + * entity that triggered, then the returning array will be populated with + * these attachment arguments that are related to the triggered entity. + */ +typedef intptr_t dds_attach_t; + +/** + * @brief Create a waitset and allocate the resources required + * @ingroup waitset + * + * A WaitSet object allows an application to wait until one or more of the + * conditions of the attached entities evaluates to TRUE or until the timeout + * expires. + * + * @param[in] participant Domain participant which the WaitSet contains. + * + * @returns A valid waitset handle or an error code. + * + * @retval >=0 + * A valid waitset handle. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_entity_t +dds_create_waitset(dds_entity_t participant); + +/** + * @brief Acquire previously attached entities. + * @ingroup waitset + * + * This functions takes a pre-allocated list to put the entities in and + * will return the number of found entities. It is possible that the given + * size of the list is not the same as the number of found entities. If + * less entities are found, then the last few entries in the list are + * untouched. When more entities are found, then only 'size' number of + * entries are inserted into the list, but still the complete count of the + * found entities is returned. Which entities are returned in the latter + * case is undefined. + * + * @param[in] waitset Waitset from which to get its attached entities. + * @param[out] entities Pre-allocated array to contain the found entities. + * @param[in] size Size of the pre-allocated entities' list. + * + * @returns A dds_return_t with the number of children or an error code. + * + * @retval >=0 + * Number of children found (can be larger than 'size'). + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entities parameter is NULL, while a size is provided. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The waitset has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_waitset_get_entities( + dds_entity_t waitset, + dds_entity_t *entities, + size_t size); + +/** + * @brief This operation attaches an Entity to the WaitSet. + * @ingroup waitset + * + * This operation attaches an Entity to the WaitSet. The dds_waitset_wait() + * will block when none of the attached entities are triggered. 'Triggered' + * (dds_triggered()) doesn't mean the same for every entity: + * - Reader/Writer/Publisher/Subscriber/Topic/Participant + * - These are triggered when their status changed. + * - WaitSet + * - Triggered when trigger value was set to true by the application. + * It stays triggered until application sets the trigger value to + * false (dds_waitset_set_trigger()). This can be used to wake up an + * waitset for different reasons (f.i. termination) than the 'normal' + * status change (like new data). + * - ReadCondition/QueryCondition + * - Triggered when data is available on the related Reader that matches + * the Condition. + * + * Multiple entities can be attached to a single waitset. A particular entity + * can be attached to multiple waitsets. However, a particular entity can not + * be attached to a particular waitset multiple times. + * + * @param[in] waitset The waitset to attach the given entity to. + * @param[in] entity The entity to attach. + * @param[in] x Blob that will be supplied when the waitset wait is + * triggered by the given entity. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Entity attached. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The given waitset or entity are not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The waitset has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The entity was already attached. + */ +DDS_EXPORT dds_return_t +dds_waitset_attach( + dds_entity_t waitset, + dds_entity_t entity, + dds_attach_t x); + +/** + * @brief This operation detaches an Entity from the WaitSet. + * @ingroup waitset + * + * @param[in] waitset The waitset to detach the given entity from. + * @param[in] entity The entity to detach. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Entity detached. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The given waitset or entity are not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The waitset has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The entity is not attached. + */ +DDS_EXPORT dds_return_t +dds_waitset_detach( + dds_entity_t waitset, + dds_entity_t entity); + +/** + * @brief Sets the trigger_value associated with a waitset. + * @ingroup waitset + * + * When the waitset is attached to itself and the trigger value is + * set to 'true', then the waitset will wake up just like with an + * other status change of the attached entities. + * + * This can be used to forcefully wake up a waitset, for instance + * when the application wants to shut down. So, when the trigger + * value is true, the waitset will wake up or not wait at all. + * + * The trigger value will remain true until the application sets it + * false again deliberately. + * + * @param[in] waitset The waitset to set the trigger value on. + * @param[in] trigger The trigger value to set. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Trigger value set. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The given waitset is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The waitset has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_waitset_set_trigger( + dds_entity_t waitset, + bool trigger); + +/** + * @brief This operation allows an application thread to wait for the a status + * change or other trigger on (one of) the entities that are attached to + * the WaitSet. + * @ingroup waitset + * + * The dds_waitset_wait() operation blocks until the some of the attached + * entities have triggered or "reltimeout" has elapsed. + * 'Triggered' (dds_triggered()) doesn't mean the same for every entity: + * - Reader/Writer/Publisher/Subscriber/Topic/Participant + * - These are triggered when their status changed. + * - WaitSet + * - Triggered when trigger value was set to true by the application. + * It stays triggered until application sets the trigger value to + * false (dds_waitset_set_trigger()). This can be used to wake up an + * waitset for different reasons (f.i. termination) than the 'normal' + * status change (like new data). + * - ReadCondition/QueryCondition + * - Triggered when data is available on the related Reader that matches + * the Condition. + * + * This functions takes a pre-allocated list to put the "xs" blobs in (that + * were provided during the attach of the related entities) and will return + * the number of triggered entities. It is possible that the given size + * of the list is not the same as the number of triggered entities. If less + * entities were triggered, then the last few entries in the list are + * untouched. When more entities are triggered, then only 'size' number of + * entries are inserted into the list, but still the complete count of the + * triggered entities is returned. Which "xs" blobs are returned in the + * latter case is undefined. + * + * In case of a time out, the return value is 0. + * + * Deleting the waitset while the application is blocked results in an + * error code (i.e. < 0) returned by "wait". + * + * Multiple threads may block on a single waitset at the same time; + * the calls are entirely independent. + * + * An empty waitset never triggers (i.e., dds_waitset_wait on an empty + * waitset is essentially equivalent to a sleep). + * + * The "dds_waitset_wait_until" operation is the same as the + * "dds_waitset_wait" except that it takes an absolute timeout. + * + * @param[in] waitset The waitset to set the trigger value on. + * @param[out] xs Pre-allocated list to store the 'blobs' that were + * provided during the attach of the triggered entities. + * @param[in] nxs The size of the pre-allocated blobs list. + * @param[in] reltimeout Relative timeout + * + * @returns A dds_return_t with the number of entities triggered or an error code + * + * @retval >0 + * Number of entities triggered. + * @retval 0 + * Time out (no entities were triggered). + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The given waitset is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The waitset has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_waitset_wait( + dds_entity_t waitset, + dds_attach_t *xs, + size_t nxs, + dds_duration_t reltimeout); + +/** + * @brief This operation allows an application thread to wait for the a status + * change or other trigger on (one of) the entities that are attached to + * the WaitSet. + * @ingroup waitset + * + * The dds_waitset_wait() operation blocks until the some of the attached + * entities have triggered or "abstimeout" has been reached. + * 'Triggered' (dds_triggered()) doesn't mean the same for every entity: + * - Reader/Writer/Publisher/Subscriber/Topic/Participant + * - These are triggered when their status changed. + * - WaitSet + * - Triggered when trigger value was set to true by the application. + * It stays triggered until application sets the trigger value to + * false (dds_waitset_set_trigger()). This can be used to wake up an + * waitset for different reasons (f.i. termination) than the 'normal' + * status change (like new data). + * - ReadCondition/QueryCondition + * - Triggered when data is available on the related Reader that matches + * the Condition. + * + * This functions takes a pre-allocated list to put the "xs" blobs in (that + * were provided during the attach of the related entities) and will return + * the number of triggered entities. It is possible that the given size + * of the list is not the same as the number of triggered entities. If less + * entities were triggered, then the last few entries in the list are + * untouched. When more entities are triggered, then only 'size' number of + * entries are inserted into the list, but still the complete count of the + * triggered entities is returned. Which "xs" blobs are returned in the + * latter case is undefined. + * + * In case of a time out, the return value is 0. + * + * Deleting the waitset while the application is blocked results in an + * error code (i.e. < 0) returned by "wait". + * + * Multiple threads may block on a single waitset at the same time; + * the calls are entirely independent. + * + * An empty waitset never triggers (i.e., dds_waitset_wait on an empty + * waitset is essentially equivalent to a sleep). + * + * The "dds_waitset_wait" operation is the same as the + * "dds_waitset_wait_until" except that it takes an relative timeout. + * + * The "dds_waitset_wait" operation is the same as the "dds_wait" + * except that it takes an absolute timeout. + * + * @param[in] waitset The waitset to set the trigger value on. + * @param[out] xs Pre-allocated list to store the 'blobs' that were + * provided during the attach of the triggered entities. + * @param[in] nxs The size of the pre-allocated blobs list. + * @param[in] abstimeout Absolute timeout + * + * @returns A dds_return_t with the number of entities triggered or an error code. + * + * @retval >0 + * Number of entities triggered. + * @retval 0 + * Time out (no entities were triggered). + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The given waitset is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The waitset has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_waitset_wait_until( + dds_entity_t waitset, + dds_attach_t *xs, + size_t nxs, + dds_time_t abstimeout); + +/** + * @defgroup reading (Reading Data) + * @ingroup reader + * There are a number of ways to aquire data, divided into variations of "read" and "take". + * The return value of a read/take operation is the number of elements returned. "max_samples" + * should have the same type, as one can't return more than MAX_INT + * this way, anyway. X, Y, CX, CY return to the various filtering + * options, see the DCPS spec. + * + * O ::= read | take + * + * X => CX + * (empty) (empty) + * _next_instance instance_handle_t prev + * + * Y => CY + * (empty) uint32_t mask + * _cond cond_t cond -- refers to a read condition (or query if implemented) + */ + +/** + * @brief Access and read the collection of data values (of same type) and sample info from the + * data reader, readcondition or querycondition. + * @ingroup reading + * + * Return value provides information about number of samples read, which will + * be <= maxs. Based on the count, the buffer will contain data to be read only + * when valid_data bit in sample info structure is set. + * The buffer required for data values, could be allocated explicitly or can + * use the memory from data reader to prevent copy. In the latter case, buffer and + * sample_info should be returned back, once it is no longer using the Data. + * Data values once read will remain in the buffer with the sample_state set to READ + * and view_state set to NOT_NEW. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] bufsz The size of buffer provided. + * @param[in] maxs Maximum number of samples to read. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_read( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + size_t bufsz, + uint32_t maxs); + +/** + * @brief Access and read loaned samples of data reader, readcondition or querycondition. + * @ingroup reading + * + * After dds_read_wl function is being called and the data has been handled, dds_return_loan() function must be called to possibly free memory. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL) + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value + * @param[in] maxs Maximum number of samples to read + * + * @returns A dds_return_t with the number of samples read or an error code + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_read_wl( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + uint32_t maxs); + +/** + * @brief Read the collection of data values and sample info from the data reader, readcondition + * or querycondition based on mask. + * @ingroup reading + * + * When using a readcondition or querycondition, their masks are or'd with the given mask. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] bufsz The size of buffer provided. + * @param[in] maxs Maximum number of samples to read. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_read_mask( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + size_t bufsz, + uint32_t maxs, + uint32_t mask); + +/** + * @brief Access and read loaned samples of data reader, readcondition + * or querycondition based on mask + * @ingroup reading + * + * When using a readcondition or querycondition, their masks are or'd with the given mask. + * + * After dds_read_mask_wl function is being called and the data has been handled, dds_return_loan() function must be called to possibly free memory + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] maxs Maximum number of samples to read. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_read_mask_wl( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + uint32_t maxs, + uint32_t mask); + +/** + * @brief Access and read the collection of data values (of same type) and sample info from the + * data reader, readcondition or querycondition, coped by the provided instance handle. + * @ingroup reading + * + * This operation implements the same functionality as dds_read, except that only data scoped to + * the provided instance handle is read. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] bufsz The size of buffer provided. + * @param[in] maxs Maximum number of samples to read. + * @param[in] handle Instance handle related to the samples to read. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this reader. + */ +DDS_EXPORT dds_return_t +dds_read_instance( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + size_t bufsz, + uint32_t maxs, + dds_instance_handle_t handle); + +/** + * @brief Access and read loaned samples of data reader, readcondition or querycondition, + * scoped by the provided instance handle. + * @ingroup reading + * + * This operation implements the same functionality as dds_read_wl, except that only data + * scoped to the provided instance handle is read. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] maxs Maximum number of samples to read. + * @param[in] handle Instance handle related to the samples to read. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this reader. + */ +DDS_EXPORT dds_return_t +dds_read_instance_wl( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + uint32_t maxs, + dds_instance_handle_t handle); + +/** + * @brief Read the collection of data values and sample info from the data reader, readcondition + * or querycondition based on mask and scoped by the provided instance handle. + * @ingroup reading + * + * This operation implements the same functionality as dds_read_mask, except that only data + * scoped to the provided instance handle is read. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] bufsz The size of buffer provided. + * @param[in] maxs Maximum number of samples to read. + * @param[in] handle Instance handle related to the samples to read. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this reader. + */ +DDS_EXPORT dds_return_t +dds_read_instance_mask( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + size_t bufsz, + uint32_t maxs, + dds_instance_handle_t handle, + uint32_t mask); + +/** + * @brief Access and read loaned samples of data reader, readcondition or + * querycondition based on mask, scoped by the provided instance handle. + * @ingroup reading + * + * This operation implements the same functionality as dds_read_mask_wl, except that + * only data scoped to the provided instance handle is read. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] maxs Maximum number of samples to read. + * @param[in] handle Instance handle related to the samples to read. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this reader. + */ +DDS_EXPORT dds_return_t +dds_read_instance_mask_wl( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + uint32_t maxs, + dds_instance_handle_t handle, + uint32_t mask); + +/** + * @brief Access the collection of data values (of same type) and sample info from the + * data reader, readcondition or querycondition. + * @ingroup reading + * + * Data value once read is removed from the Data Reader cannot to + * 'read' or 'taken' again. + * Return value provides information about number of samples read, which will + * be <= maxs. Based on the count, the buffer will contain data to be read only + * when valid_data bit in sample info structure is set. + * The buffer required for data values, could be allocated explicitly or can + * use the memory from data reader to prevent copy. In the latter case, buffer and + * sample_info should be returned back, once it is no longer using the Data. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] bufsz The size of buffer provided. + * @param[in] maxs Maximum number of samples to read. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_take( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + size_t bufsz, + uint32_t maxs); + +/** + * @brief Access loaned samples of data reader, readcondition or querycondition. + * @ingroup reading + * + * After dds_take_wl function is being called and the data has been handled, dds_return_loan() function must be called to possibly free memory + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] maxs Maximum number of samples to read. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_take_wl( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + uint32_t maxs); + +/** + * @brief Take the collection of data values (of same type) and sample info from the + * data reader, readcondition or querycondition based on mask + * @ingroup reading + * + * When using a readcondition or querycondition, their masks are or'd with the given mask. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] bufsz The size of buffer provided. + * @param[in] maxs Maximum number of samples to read. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_take_mask( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + size_t bufsz, + uint32_t maxs, + uint32_t mask); + +/** + * @brief Access loaned samples of data reader, readcondition or querycondition based on mask. + * @ingroup reading + * + * When using a readcondition or querycondition, their masks are or'd with the given mask. + * + * After dds_take_mask_wl function is being called and the data has been handled, dds_return_loan() function must be called to possibly free memory + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] maxs Maximum number of samples to read. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_take_mask_wl( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + uint32_t maxs, + uint32_t mask); + +/** + * @anchor DDS_HAS_READCDR + * @ingroup reading + * @brief Set when function dds_has_readcdr is defined. + */ +#define DDS_HAS_READCDR 1 + +/** + * @brief Access the collection of serialized data values (of same type) and + * sample info from the data reader, readcondition or querycondition. + * @ingroup reading + * + * This call accesses the serialized data from the data reader, readcondition or + * querycondition and makes it available to the application. The serialized data + * is made available through @ref ddsi_serdata structures. Returned samples are + * marked as READ. + * + * Return value provides information about the number of samples read, which will + * be <= maxs. Based on the count, the buffer will contain serialized data to be + * read only when valid_data bit in sample info structure is set. + * The buffer required for data values, could be allocated explicitly or can + * use the memory from data reader to prevent copy. In the latter case, buffer and + * sample_info should be returned back, once it is no longer using the data. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to @ref ddsi_serdata structures that contain + * the serialized data. The pointers can be NULL. + * @param[in] maxs Maximum number of samples to read. + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The precondition for this operation is not met. + */ +DDS_EXPORT dds_return_t +dds_readcdr( + dds_entity_t reader_or_condition, + struct ddsi_serdata **buf, + uint32_t maxs, + dds_sample_info_t *si, + uint32_t mask); + +/** + * @brief Access the collection of serialized data values (of same type) and + * sample info from the data reader, readcondition or querycondition + * scoped by the provided instance handle. + * @ingroup reading + * + * This operation implements the same functionality as dds_read_instance_wl, except that + * samples are now in their serialized form. The serialized data is made available through + * @ref ddsi_serdata structures. Returned samples are marked as READ. + * + * Return value provides information about the number of samples read, which will + * be <= maxs. Based on the count, the buffer will contain serialized data to be + * read only when valid_data bit in sample info structure is set. + * The buffer required for data values, could be allocated explicitly or can + * use the memory from data reader to prevent copy. In the latter case, buffer and + * sample_info should be returned back, once it is no longer using the data. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to @ref ddsi_serdata structures that contain + * the serialized data. The pointers can be NULL. + * @param[in] maxs Maximum number of samples to read. + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] handle Instance handle related to the samples to read. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this reader. + */ +DDS_EXPORT dds_return_t +dds_readcdr_instance ( + dds_entity_t reader_or_condition, + struct ddsi_serdata **buf, + uint32_t maxs, + dds_sample_info_t *si, + dds_instance_handle_t handle, + uint32_t mask); + +/** + * @brief Access the collection of serialized data values (of same type) and + * sample info from the data reader, readcondition or querycondition. + * @ingroup reading + * + * This call accesses the serialized data from the data reader, readcondition or + * querycondition and makes it available to the application. The serialized data + * is made available through @ref ddsi_serdata structures. Once read the data is + * removed from the reader and cannot be 'read' or 'taken' again. + * + * Return value provides information about the number of samples read, which will + * be <= maxs. Based on the count, the buffer will contain serialized data to be + * read only when valid_data bit in sample info structure is set. + * The buffer required for data values, could be allocated explicitly or can + * use the memory from data reader to prevent copy. In the latter case, buffer and + * sample_info should be returned back, once it is no longer using the data. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to @ref ddsi_serdata structures that contain + * the serialized data. The pointers can be NULL. + * @param[in] maxs Maximum number of samples to read. + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The precondition for this operation is not met. + */ +DDS_EXPORT dds_return_t +dds_takecdr( + dds_entity_t reader_or_condition, + struct ddsi_serdata **buf, + uint32_t maxs, + dds_sample_info_t *si, + uint32_t mask); + +/** + * @brief Access the collection of serialized data values (of same type) and + * sample info from the data reader, readcondition or querycondition + * scoped by the provided instance handle. + * @ingroup reading + * + * This operation implements the same functionality as dds_take_instance_wl, except that + * samples are now in their serialized form. The serialized data is made available through + * @ref ddsi_serdata structures. Returned samples are marked as READ. + * + * Return value provides information about the number of samples read, which will + * be <= maxs. Based on the count, the buffer will contain serialized data to be + * read only when valid_data bit in sample info structure is set. + * The buffer required for data values, could be allocated explicitly or can + * use the memory from data reader to prevent copy. In the latter case, buffer and + * sample_info should be returned back, once it is no longer using the data. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to @ref ddsi_serdata structures that contain + * the serialized data. The pointers can be NULL. + * @param[in] maxs Maximum number of samples to read. + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] handle Instance handle related to the samples to read. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this reader. + */ +DDS_EXPORT dds_return_t +dds_takecdr_instance ( + dds_entity_t reader_or_condition, + struct ddsi_serdata **buf, + uint32_t maxs, + dds_sample_info_t *si, + dds_instance_handle_t handle, + uint32_t mask); + + +/** + * @brief Access the collection of data values (of same type) and sample info from the + * data reader, readcondition or querycondition but scoped by the given + * instance handle. + * @ingroup reading + * + * This operation mplements the same functionality as dds_take, except that only data + * scoped to the provided instance handle is taken. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] bufsz The size of buffer provided. + * @param[in] maxs Maximum number of samples to read. + * @param[in] handle Instance handle related to the samples to read. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this reader. + */ +DDS_EXPORT dds_return_t +dds_take_instance( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + size_t bufsz, + uint32_t maxs, + dds_instance_handle_t handle); + +/** + * @brief Access loaned samples of data reader, readcondition or querycondition, + * scoped by the given instance handle. + * @ingroup reading + * + * This operation implements the same functionality as dds_take_wl, except that + * only data scoped to the provided instance handle is read. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] maxs Maximum number of samples to read. + * @param[in] handle Instance handle related to the samples to read. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this reader. + */ +DDS_EXPORT dds_return_t +dds_take_instance_wl( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + uint32_t maxs, + dds_instance_handle_t handle); + +/** + * @brief Take the collection of data values (of same type) and sample info from the + * data reader, readcondition or querycondition based on mask and scoped + * by the given instance handle. + * @ingroup reading + * + * This operation implements the same functionality as dds_take_mask, except that only + * data scoped to the provided instance handle is read. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] bufsz The size of buffer provided. + * @param[in] maxs Maximum number of samples to read. + * @param[in] handle Instance handle related to the samples to read. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples read or an error code. + * + * @retval >=0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this reader. + */ +DDS_EXPORT dds_return_t +dds_take_instance_mask( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + size_t bufsz, + uint32_t maxs, + dds_instance_handle_t handle, + uint32_t mask); + +/** + * @brief Access loaned samples of data reader, readcondition or querycondition based + * on mask and scoped by the given intance handle. + * @ingroup reading + * + * This operation implements the same functionality as dds_take_mask_wl, except that + * only data scoped to the provided instance handle is read. + * + * @param[in] reader_or_condition Reader, readcondition or querycondition entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si Pointer to an array of @ref dds_sample_info_t returned for each data value. + * @param[in] maxs Maximum number of samples to read. + * @param[in] handle Instance handle related to the samples to read. + * @param[in] mask Filter the data based on dds_sample_state_t|dds_view_state_t|dds_instance_state_t. + * + * @returns A dds_return_t with the number of samples or an error code. + * + * @retval >= 0 + * Number of samples read. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * The instance handle has not been registered with this reader. + */ +DDS_EXPORT dds_return_t +dds_take_instance_mask_wl( + dds_entity_t reader_or_condition, + void **buf, + dds_sample_info_t *si, + uint32_t maxs, + dds_instance_handle_t handle, + uint32_t mask); + +/** + * @brief Read, copy and remove the status set for the entity + * @ingroup reading + * + * This operation copies the next, non-previously accessed + * data value and corresponding sample info and removes from + * the data reader. As an entity, only reader is accepted. + * + * The read/take next functions return a single sample. The returned sample + * has a sample state of NOT_READ, a view state of ANY_VIEW_STATE and an + * instance state of ANY_INSTANCE_STATE. + * + * @param[in] reader The reader entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si The pointer to @ref dds_sample_info_t returned for a data value. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_take_next( + dds_entity_t reader, + void **buf, + dds_sample_info_t *si); + +/** + * @brief Read, copy and remove the status set for the entity + * @ingroup reading + * + * This operation copies the next, non-previously accessed + * data value and corresponding sample info and removes from + * the data reader. As an entity, only reader is accepted. + * + * The read/take next functions return a single sample. The returned sample + * has a sample state of NOT_READ, a view state of ANY_VIEW_STATE and an + * instance state of ANY_INSTANCE_STATE. + * + * After dds_take_next_wl function is being called and the data has been handled, + * dds_return_loan() function must be called to possibly free memory. + * + * @param[in] reader The reader entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si The pointer to @ref dds_sample_info_t returned for a data value. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_take_next_wl( + dds_entity_t reader, + void **buf, + dds_sample_info_t *si); + +/** + * @brief Read and copy the status set for the entity + * @ingroup reading + * + * This operation copies the next, non-previously accessed + * data value and corresponding sample info. As an entity, + * only reader is accepted. + * + * The read/take next functions return a single sample. The returned sample + * has a sample state of NOT_READ, a view state of ANY_VIEW_STATE and an + * instance state of ANY_INSTANCE_STATE. + * + * @param[in] reader The reader entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si The pointer to @ref dds_sample_info_t returned for a data value. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_read_next( + dds_entity_t reader, + void **buf, + dds_sample_info_t *si); + +/** + * @brief Read and copy the status set for the loaned sample + * @ingroup reading + * + * This operation copies the next, non-previously accessed + * data value and corresponding loaned sample info. As an entity, + * only reader is accepted. + * + * The read/take next functions return a single sample. The returned sample + * has a sample state of NOT_READ, a view state of ANY_VIEW_STATE and an + * instance state of ANY_INSTANCE_STATE. + * + * After dds_read_next_wl function is being called and the data has been handled, + * dds_return_loan() function must be called to possibly free memory. + * + * @param[in] reader The reader entity. + * @param[out] buf An array of pointers to samples into which data is read (pointers can be NULL). + * @param[out] si The pointer to @ref dds_sample_info_t returned for a data value. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_read_next_wl( + dds_entity_t reader, + void **buf, + dds_sample_info_t *si); + + +/** + * @defgroup loan (Loans API) + * @ingroup dds + */ + +/** + * @brief Return loaned samples to a reader or writer + * @ingroup loan + * + * Used to release sample buffers returned by a read/take operation (a reader-loan) + * or, in case shared memory is enabled, of the loan_sample operation (a writer-loan). + * + * When the application provides an empty buffer to a reader-loan, memory is allocated and + * managed by DDS. By calling dds_return_loan(), the reader-loan is released so that the buffer + * can be reused during a successive read/take operation. When a condition is provided, the + * reader to which the condition belongs is looked up. + * + * Writer-loans are normally released implicitly when writing a loaned sample, but you can + * cancel a writer-loan prematurely by invoking the return_loan() operation. For writer loans, buf is + * overwritten with null pointers for all successfully returned entries. Any failure causes it to abort, + * possibly midway through buf. + * + * @param[in] entity The entity that the loan belongs to. + * @param[in,out] buf An array of (pointers to) samples, some or all of which will be set to null pointers. + * @param[in] bufsz The number of (pointers to) samples stored in buf. + * + * @returns A dds_return_t indicating success or failure + * @retval DDS_RETCODE_OK + * - the operation was successful; for a writer loan, all entries in buf are set to null + * - this specifically includes cases where bufsz <= 0 while entity is valid + * @retval DDS_RETCODE_BAD_PARAMETER + * - the entity parameter is not a valid parameter + * - buf is null, or bufsz > 0 and buf[0] = null + * - (for writer loans) buf[0 <= i < bufsz] is null; operation is aborted, all buf[j < i] = null on return + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * - (for reader loans) buf was already returned (not guaranteed to be detected) + * - (for writer loans) buf[0 <= i < bufsz] does not correspond to an outstanding loan, all buf[j < i] = null on return + * @retval DDS_RETCODE_UNSUPPORTED + * - (for writer loans) invoked on a writer not supporting loans. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * - the operation is invoked on an inappropriate object. + */ +DDS_EXPORT dds_return_t +dds_return_loan( + dds_entity_t entity, + void **buf, + int32_t bufsz); + +/** + * @defgroup instance_handle (Instance Handles) + * @ingroup dds + * Instance handle <=> key value mapping. + * Functions exactly as read w.r.t. treatment of data + * parameter. On output, only key values set. + * @code{c} + * T x = { ... }; + * T y; + * dds_instance_handle_t ih; + * ih = dds_lookup_instance (e, &x); + * dds_instance_get_key (e, ih, &y); + * @endcode +*/ + +/** + * @brief This operation takes a sample and returns an instance handle to be used for subsequent operations. + * @ingroup instance_handle + * + * @param[in] entity Reader or Writer entity. + * @param[in] data Sample with a key fields set. + * + * @returns instance handle or DDS_HANDLE_NIL if instance could not be found from key. + */ +DDS_EXPORT dds_instance_handle_t +dds_lookup_instance(dds_entity_t entity, const void *data); + +/** + * @deprecated Get enabled status on entity. Use \ref dds_lookup_instance instead. + * @ingroup instance_handle + * + * @param[in] entity Reader or Writer entity. + * @param[in] data Sample with a key fields set. + * + * @returns instance handle or DDS_HANDLE_NIL if instance could not be found from key. + */ +DDS_DEPRECATED_EXPORT dds_instance_handle_t +dds_instance_lookup(dds_entity_t entity, const void *data); + +/** + * @brief This operation takes an instance handle and return a key-value corresponding to it. + * @ingroup instance_handle + * + * @param[in] entity Reader, writer, readcondition or querycondition entity. + * @param[in] inst Instance handle. + * @param[out] data pointer to an instance, to which the key ID corresponding to the instance handle will be + * returned, the sample in the instance should be ignored. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the parameters was invalid or the topic does not exist. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * + * DOC_TODO: Check return codes for completeness + */ +DDS_EXPORT dds_return_t +dds_instance_get_key( + dds_entity_t entity, + dds_instance_handle_t inst, + void *data); + +/** + * @brief Begin coherent publishing or begin accessing a coherent set in a subscriber + * @ingroup publication + * + * Invoking on a Writer or Reader behaves as if dds_begin_coherent was invoked on its parent + * Publisher or Subscriber respectively. + * + * @param[in] entity The entity that is prepared for coherent access. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * The provided entity is invalid or not supported. + */ +DDS_EXPORT dds_return_t +dds_begin_coherent(dds_entity_t entity); + +/** + * @brief End coherent publishing or end accessing a coherent set in a subscriber + * @ingroup publication + * + * Invoking on a Writer or Reader behaves as if dds_end_coherent was invoked on its parent + * Publisher or Subscriber respectively. + * + * @param[in] entity The entity on which coherent access is finished. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The provided entity is invalid or not supported. + */ +DDS_EXPORT dds_return_t +dds_end_coherent(dds_entity_t entity); + +/** + * @brief Trigger DATA_AVAILABLE event on contained readers + * @ingroup subscriber + * + * The DATA_AVAILABLE event is broadcast to all readers owned by this subscriber that currently + * have new data available. Any on_data_available listener callbacks attached to respective + * readers are invoked. + * + * @param[in] subscriber A valid subscriber handle. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The provided subscriber is invalid. + */ +DDS_EXPORT dds_return_t +dds_notify_readers(dds_entity_t subscriber); + +/** + * @brief Checks whether the entity has one of its enabled statuses triggered. + * @ingroup entity + * + * @param[in] entity Entity for which to check for triggered status. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_triggered(dds_entity_t entity); + +/** + * @brief Get the topic + * @ingroup entity + * + * This operation returns a topic (handle) when the function call is done + * with reader, writer, read condition or query condition. For instance, it + * will return the topic when it is used for creating the reader or writer. + * For the conditions, it returns the topic that is used for creating the reader + * which was used to create the condition. + * + * @param[in] entity The entity. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_entity_t +dds_get_topic(dds_entity_t entity); + +/** + * @brief Get instance handles of the data readers matching a writer + * @ingroup builtintopic + * + * This operation fills the provided array with the instance handles + * of the data readers that match the writer. On successful output, + * the number of entries of "rds" set is the minimum of the return + * value and the value of "nrds". + * + * @param[in] writer The writer. + * @param[in] rds The array to be filled. + * @param[in] nrds The size of the rds array, at most the first + * nrds entries will be filled. rds = NULL and nrds = 0 + * is a valid way of determining the number of matched + * readers, but inefficient compared to relying on the + * matched publication status. + * + * @returns A dds_return_t indicating the number of matched readers + * or failure. The return value may be larger than nrds + * if there are more matching readers than the array can + * hold. + * + * @retval >=0 + * The number of matching readers. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not valid or rds = NULL and + * nrds > 0. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + */ +DDS_EXPORT dds_return_t +dds_get_matched_subscriptions ( + dds_entity_t writer, + dds_instance_handle_t *rds, + size_t nrds); + +/** + * @brief Get a description of a reader matched with the provided writer + * @ingroup builtintopic + * + * This operation looks up the reader instance handle in the set of + * readers matched with the specified writer, returning a freshly + * allocated sample of the DCPSSubscription built-in topic if found, + * and NULL if not. The caller is responsible for freeing the + * memory allocated, e.g. using dds_builtintopic_free_endpoint. + * + * This operation is similar to performing a read of the given + * instance handle on a reader of the DCPSSubscription built-in + * topic, but this operation additionally filters on whether the + * reader is matched by the provided writer. + * + * @param[in] writer The writer. + * @param[in] ih The instance handle of a reader. + * + * @returns A newly allocated sample containing the information on the + * reader, or a NULL pointer for any kind of failure. + * + * @retval != NULL + * The requested data + * @retval NULL + * The writer is not valid or ih is not an instance handle + * of a matched reader. + */ +DDS_EXPORT dds_builtintopic_endpoint_t * +dds_get_matched_subscription_data ( + dds_entity_t writer, + dds_instance_handle_t ih); + +/** + * @brief Get instance handles of the data writers matching a reader + * @ingroup builtintopic + * + * This operation fills the provided array with the instance handles + * of the data writers that match the reader. On successful output, + * the number of entries of "wrs" set is the minimum of the return + * value and the value of "nwrs". + * + * @param[in] reader The reader. + * @param[in] wrs The array to be filled. + * @param[in] nwrs The size of the wrs array, at most the first + * nwrs entries will be filled. wrs = NULL and wrds = 0 + * is a valid way of determining the number of matched + * readers, but inefficient compared to relying on the + * matched publication status. + * + * @returns A dds_return_t indicating the number of matched writers + * or failure. The return value may be larger than nwrs + * if there are more matching writers than the array can + * hold. + * + * @retval >=0 + * The number of matching writers. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not valid or wrs = NULL and + * nwrs > 0. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + */ +DDS_EXPORT dds_return_t +dds_get_matched_publications ( + dds_entity_t reader, + dds_instance_handle_t *wrs, + size_t nwrs); + +/** + * @brief Get a description of a writer matched with the provided reader + * @ingroup builtintopic + * + * This operation looks up the writer instance handle in the set of + * writers matched with the specified reader, returning a freshly + * allocated sample of the DCPSPublication built-in topic if found, + * and NULL if not. The caller is responsible for freeing the + * memory allocated, e.g. using dds_builtintopic_free_endpoint. + * + * This operation is similar to performing a read of the given + * instance handle on a reader of the DCPSPublication built-in + * topic, but this operation additionally filters on whether the + * writer is matched by the provided reader. + * + * @param[in] reader The reader. + * @param[in] ih The instance handle of a writer. + * + * @returns A newly allocated sample containing the information on the + * writer, or a NULL pointer for any kind of failure. + * + * @retval != NULL + * The requested data + * @retval NULL + * The reader is not valid or ih is not an instance handle + * of a matched writer. + */ +DDS_EXPORT dds_builtintopic_endpoint_t * +dds_get_matched_publication_data ( + dds_entity_t reader, + dds_instance_handle_t ih); + +#ifdef DDS_HAS_TYPE_DISCOVERY +/** + * @brief Gets the type information from endpoint information that was + * retrieved by dds_get_matched_subscription_data or + * dds_get_matched_publication_data + * @ingroup builtintopic + * + * @param[in] builtintopic_endpoint The builtintopic endpoint struct + * @param[out] type_info Type information that will be allocated by this function in case of success. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * One or more parameters are invalid + */ +DDS_EXPORT dds_return_t +dds_builtintopic_get_endpoint_type_info ( + dds_builtintopic_endpoint_t * builtintopic_endpoint, + const dds_typeinfo_t ** type_info); +#endif + +/** + * @brief Free the endpoint information that was retrieved by + * dds_get_matched_subscription_data or dds_get_matched_publication_data + * @ingroup builtintopic + * + * This operation deallocates the memory of the fields in a + * dds_builtintopic_endpoint_t struct and deallocates the + * struct itself. + * + * @param[in] builtintopic_endpoint The builtintopic endpoint struct + */ +DDS_EXPORT void +dds_builtintopic_free_endpoint ( + dds_builtintopic_endpoint_t * builtintopic_endpoint); + +/** + * @brief Free the provided topic information + * @ingroup builtintopic + * + * This operation deallocates the memory of the fields in a + * dds_builtintopic_topic_t struct and deallocates the + * struct itself. + * + * @param[in] builtintopic_topic The builtintopic topic struct + */ +DDS_EXPORT void +dds_builtintopic_free_topic ( + dds_builtintopic_topic_t * builtintopic_topic); + +/** + * @brief Free the provided participant information + * @ingroup builtintopic + * + * This operation deallocates the memory of the fields in a + * dds_builtintopic_participant_t struct and deallocates the + * struct itself. + * + * @param[in] builtintopic_participant The builtintopic participant struct + */ +DDS_EXPORT void +dds_builtintopic_free_participant ( + dds_builtintopic_participant_t * builtintopic_participant); + +/** + * @brief This operation manually asserts the liveliness of a writer + * or domain participant. + * @ingroup entity + * + * This operation manually asserts the liveliness of a writer + * or domain participant. This is used in combination with the Liveliness + * QoS policy to indicate that the entity remains active. This operation need + * only be used if the liveliness kind in the QoS is either + * DDS_LIVELINESS_MANUAL_BY_PARTICIPANT or DDS_LIVELINESS_MANUAL_BY_TOPIC. + * + * @param[in] entity A domain participant or writer + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + */ +DDS_EXPORT dds_return_t +dds_assert_liveliness ( + dds_entity_t entity); + + +/** + * @defgroup internal (Internal) + * @ingroup dds + */ + +/** + * @defgroup testing (Testing tools) + * @ingroup internal + */ + +/** + * + * @brief This operation allows making the domain's network stack temporarily deaf and/or mute. + * @ingroup testing + * @warning Unstable API, for testing + * + * This is a support function for testing and, other special uses and is subject to change. + * + * @param[in] entity A domain entity or an entity bound to a domain, such + * as a participant, reader or writer. + * @param[in] deaf Whether to network stack should pretend to be deaf and + * ignore any incoming packets. + * @param[in] mute Whether to network stack should pretend to be mute and + * discard any outgoing packets where it normally would. + * pass them to the operating system kernel for transmission. + * @param[in] reset_after Any value less than INFINITY will cause it to + * set deaf = mute = false after reset_after ns have passed. + * This is done by an event scheduled for the appropriate + * time and otherwise forgotten. These events are not + * affected by subsequent calls to this function. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. +*/ +DDS_EXPORT dds_return_t +dds_domain_set_deafmute ( + dds_entity_t entity, + bool deaf, + bool mute, + dds_duration_t reset_after); + + +/** + * @defgroup xtypes (XTypes) + * @ingroup dds + * + * CycloneDDS supports XTypes, but most of that functionality outside the new IDL constructs + * happens behind the scenes. However, some API functionality is added that allows inspecting + * types at runtime. Using it in C is not very ergonomic, but dynamic languages like Python can + * make good use of it. + */ + +/** + * @brief This function resolves the type for the provided type identifier, + * which can e.g. be retrieved from endpoint or topic discovery data. + * @ingroup xtypes + * + * @param[in] entity A domain entity or an entity bound to a domain, such + * as a participant, reader or writer. + * @param[in] type_id Type identifier + * @param[in] timeout Timeout for waiting for requested type information to be available + * @param[out] type_obj The type information, untouched if type is not resolved + * + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The entity parameter is not a valid parameter, type_id or type name + * is not provided, or the sertype out parameter is NULL + * @retval DDS_RETCODE_NOT_FOUND + * A type with the provided type_id and type_name was not found + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_UNSUPPORTED + * Cyclone DDS built without type discovery + * (cf. DDS_HAS_TYPE_DISCOVERY) +*/ +DDS_EXPORT dds_return_t +dds_get_typeobj ( + dds_entity_t entity, + const dds_typeid_t *type_id, + dds_duration_t timeout, + dds_typeobj_t **type_obj); + +/** + * @brief Free the type object that was retrieved using dds_get_typeobj + * @ingroup xtypes + * + * @param[in] type_obj The type object + * + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The type_obj parameter is NULL + * @retval DDS_RETCODE_UNSUPPORTED + * Cyclone DDS built without type discovery + * (cf. DDS_HAS_TYPE_DISCOVERY) +*/ +DDS_EXPORT dds_return_t +dds_free_typeobj ( + dds_typeobj_t *type_obj); + +/** + * @brief This function gets the type information from the + * provided topic, reader or writer + * @ingroup xtypes + * + * @param[in] entity A topic/reader/writer entity + * @param[out] type_info The type information, untouched if returncode indicates failure + * + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The type_info parameter is null + * @retval DDS_RETCODE_NOT_FOUND + * The entity does not have type information set + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_UNSUPPORTED + * Cyclone DDS built without type discovery + * (cf. DDS_HAS_TYPE_DISCOVERY) +*/ +DDS_EXPORT dds_return_t +dds_get_typeinfo ( + dds_entity_t entity, + dds_typeinfo_t **type_info); + +/** + * @brief Free the type information that was retrieved using dds_get_typeinfo + * @ingroup xtypes + * + * @param[in] type_info The type information + * + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * The operation was successful. + * @retval DDS_RETCODE_BAD_PARAMETER + * The type_info parameter is NULL + * @retval DDS_RETCODE_UNSUPPORTED + * Cyclone DDS built without type discovery + * (cf. DDS_HAS_TYPE_DISCOVERY) +*/ +DDS_EXPORT dds_return_t +dds_free_typeinfo ( + dds_typeinfo_t *type_info); + +#if defined (__cplusplus) +} +#endif +#endif /* DDS_H */ diff --git a/unitree_SDK/include/dds/ddsc/dds_basic_types.h b/unitree_SDK/include/dds/ddsc/dds_basic_types.h new file mode 100644 index 0000000..b7ef539 --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_basic_types.h @@ -0,0 +1,48 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * Copyright(c) 2021 Apex.AI, Inc + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +#ifndef _DDS_BASIC_TYPES_H_ +#define _DDS_BASIC_TYPES_H_ + +#include +#include +#include + +/** + * @brief Handle to an entity + * @ingroup entity + * + * A valid entity handle will always have a positive integer value. + * Should the value be negative, it is one of the DDS_RETCODE_* + * error codes. + */ +typedef int32_t dds_entity_t; + +/** + * @anchor DDS_MIN_PSEUDO_HANDLE + * @ingroup internal + * @brief Pseudo Handle origin + * + * Some handles in CycloneDDS are 'fake', most importantly the builtin topic handles. + * These handles are derived from this constant. + */ +#define DDS_MIN_PSEUDO_HANDLE ((dds_entity_t)0x7fff0000) + +/** + * @anchor DDS_CYCLONEDDS_HANDLE + * @ingroup internal + * @brief Special handle representing the entity corresponding to the CycloneDDS library itself + */ +#define DDS_CYCLONEDDS_HANDLE ((dds_entity_t)(DDS_MIN_PSEUDO_HANDLE + 256)) + +#endif /*_DDS_PUBLIC_TYPES_H_*/ diff --git a/unitree_SDK/include/dds/ddsc/dds_data_allocator.h b/unitree_SDK/include/dds/ddsc/dds_data_allocator.h new file mode 100644 index 0000000..cd266ee --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_data_allocator.h @@ -0,0 +1,149 @@ +/* + * Copyright(c) 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +#ifndef DDS_DATA_ALLOCATOR_H +#define DDS_DATA_ALLOCATOR_H + +/** + * @defgroup data_allocator (Data Allocator) + * @ingroup dds + * A quick-and-dirty provisional interface + */ + +#include "dds/dds.h" +#include "dds/ddsrt/attributes.h" +#include "dds/export.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +// macOS' mutexes require quite a lot of space, but it is not quite enough +// to make this system-dependent +#define DDS_DATA_ALLOCATOR_MAX_SIZE (12 * sizeof (void *)) + +/** + * @ingroup data_allocator + * @brief Data Allocator structure + * Contains internal details about the data allocator for a given entity + */ +typedef struct dds_data_allocator { + dds_entity_t entity; /**< to which entity this allocator is attached */ + union { + unsigned char bytes[DDS_DATA_ALLOCATOR_MAX_SIZE]; /**< internal details */ + void *align_ptr; /**< internal details */ + uint64_t align_u64; /**< internal details */ + } opaque; /**< internal details */ +} dds_data_allocator_t; + +/** + * @ingroup data_allocator + * @brief Initialize an object for performing allocations/frees in the context of a reader/writer + * + * The operation will fall back to standard heap allocation if nothing better is available. + * + * @param[in] entity the handle of the entity + * @param[out] data_allocator opaque allocator object to initialize + * + * @returns success or a generic error indication + * + * @retval DDS_RETCODE_OK + * the allocator object was successfully initialized + * @retval DDS_RETCODE_BAD_PARAMETER + * entity is invalid, data_allocator is a null pointer + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * Cyclone DDS is not initialized + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * operation not supported on this entity + */ +DDS_EXPORT dds_return_t dds_data_allocator_init (dds_entity_t entity, dds_data_allocator_t *data_allocator); + +/** + * @ingroup data_allocator + * @brief Initialize an object for performing standard allocations/frees on the heap + * + * @param[out] data_allocator opaque allocator object to initialize + * + * @returns success or a generic error indication + * + * @retval DDS_RETCODE_OK + * the allocator object was successfully initialized + * @retval DDS_RETCODE_BAD_PARAMETER + * entity is invalid, data_allocator is a null pointer + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * Cyclone DDS is not initialized + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * operation not supported on this entity + */ +DDS_EXPORT dds_return_t dds_data_allocator_init_heap (dds_data_allocator_t *data_allocator); + +/** + * @ingroup data_allocator + * @brief Finalize a previously initialized allocator object + * + * @param[in,out] data_allocator object to finalize + * + * @returns success or an error indication + * + * @retval DDS_RETCODE_OK + * the data was successfully finalized + * @retval DDS_RETCODE_BAD_PARAMETER + * data_allocator does not reference a valid entity + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * Cyclone DDS is not initialized + */ +DDS_EXPORT dds_return_t dds_data_allocator_fini (dds_data_allocator_t *data_allocator); + +/** + * @ingroup data_allocator + * @brief Allocate memory using the given allocator + * + * @param[in,out] data_allocator initialized allocator object + * @param[in] size minimum number of bytes to allocate with suitable alignment + * + * @returns a pointer to unaliased, uninitialized memory of at least the requested size, or NULL + */ +DDS_EXPORT void *dds_data_allocator_alloc (dds_data_allocator_t *data_allocator, size_t size) + ddsrt_attribute_warn_unused_result ddsrt_attribute_malloc; + +/** + * @ingroup data_allocator + * @brief Release memory using the given allocator + * + * @param[in,out] data_allocator initialized allocator object + * @param[in] ptr memory to free + * + * @returns success or an error indication + * + * @retval DDS_RETCODE_OK + * the memory was successfully released + * @retval DDS_RETCODE_BAD_PARAMETER + * data_allocator does not reference a valid entity + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * dds_data_allocator already finalized + */ +DDS_EXPORT dds_return_t dds_data_allocator_free (dds_data_allocator_t *data_allocator, void *ptr); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +/// @note This function declaration is deprecated here and has been moved to +/// dds_loan_api.h. +DDS_EXPORT bool dds_is_loan_available(const dds_entity_t entity); + +/// @note This function declaration is deprecated here and has been moved to +/// dds_loan_api.h. +DDS_EXPORT bool is_loan_available(const dds_entity_t entity); +#endif + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsc/dds_internal_api.h b/unitree_SDK/include/dds/ddsc/dds_internal_api.h new file mode 100644 index 0000000..555468f --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_internal_api.h @@ -0,0 +1,56 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/* + * WARNING This file is only needed for the work around for https://github.com/eclipse-cyclonedds/cyclonedds/issues/74 + * Do not include this file in an application! Once issue #74 is solved this header file should be removed. + */ + +#ifndef DDS_INTERNAL_API_H +#define DDS_INTERNAL_API_H + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @anchor DDS_READ_WITHOUT_LOCK + * @ingroup internal + * @brief Constant to use with dds_read() or dds_take() when using dds_reader_lock_samples() + */ +#define DDS_READ_WITHOUT_LOCK (0xFFFFFFED) + +/** + * @ingroup internal + * @brief Returns number of samples in read cache and locks the reader cache, + * to make sure that the samples content doesn't change. + * + * Because the cache is locked, you should be able to read/take without having to + * lock first. This is done by passing the @ref DDS_READ_WITHOUT_LOCK value to the + * read/take call as maxs. Then the read/take will not lock but still unlock. + * + * CycloneDDS doesn't support a read/take that just returns all + * available samples issue #74. As a work around to support LENGTH_UNLIMITED in C++. + * dds_reader_lock_samples() and @ref DDS_READ_WITHOUT_LOCK are needed. + * + * @param[in] reader Reader to lock the cache of. + * + * @returns the number of samples in the reader cache. + */ +DDS_EXPORT uint32_t +dds_reader_lock_samples (dds_entity_t reader); + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsc/dds_loan_api.h b/unitree_SDK/include/dds/ddsc/dds_loan_api.h new file mode 100644 index 0000000..4cebca7 --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_loan_api.h @@ -0,0 +1,95 @@ +/* + * Copyright(c) 2021 ZettaScale Technology + * Copyright(c) 2021 Apex.AI, Inc + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +// API extension +// defines functions needed for loaning and shared memory usage + +#ifndef _DDS_LOAN_API_H_ +#define _DDS_LOAN_API_H_ + +#include "dds/ddsc/dds_basic_types.h" +#include "dds/ddsrt/retcode.h" +#include "dds/export.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/** + * @ingroup loan + * @brief Check if a Loan is available to reader/writer + * The loan is available if the shared memory is enabled and all the constraints + * to enable shared memory are met and the type is fixed + * @note dds_loan_sample can be used if and only if + * dds_is_loan_available returns true. + * + * @param[in] entity the handle of the entity + * + * @returns loan available or not + */ +DDS_EXPORT bool dds_is_loan_available(const dds_entity_t entity); + +/** + * @ingroup loan + * @brief Check if a shared memory is available to reader/writer. + * + * @note dds_loan_shared_memory_buffer can be used if and only if + * dds_is_shared_memory_available returns true. + * + * @param[in] entity the handle of the entity + * + * @returns true if shared memory is available, false otherwise + */ +DDS_EXPORT bool dds_is_shared_memory_available(const dds_entity_t entity); + +DDS_DEPRECATED_EXPORT bool is_loan_available(const dds_entity_t entity); + +/** + * @ingroup loan + * @brief Loan a shared memory buffer of a specific size from the writer. + * + * @note Currently this function is to be used with dds_writecdr by adding the + * loaned buffer to serdata as iox_chunk. + * @note The function can only be used if dds_is_shared_memory_available is + * true for the writer. + * + * @param[in] writer the writer to loan the buffer from + * @param[in] size the requested buffer size + * @param[out] buffer the loaned buffer + * + * @returns DDS_RETCODE_OK if successful, DDS_RETCODE_ERROR otherwise + */ +DDS_EXPORT dds_return_t dds_loan_shared_memory_buffer(dds_entity_t writer, + size_t size, + void **buffer); + +/** + * @ingroup loan + * @brief Loan a sample from the writer. + * + * @note This function is to be used with dds_write to publish the loaned + * sample. + * @note The function can only be used if dds_is_loan_available is + * true for the writer. + * + * @param[in] writer the writer to loan the buffer from + * @param[out] sample the loaned sample + * + * @returns DDS_RETCODE_OK if successful, DDS_RETCODE_ERROR otherwise + */ +DDS_EXPORT dds_return_t dds_loan_sample(dds_entity_t writer, void **sample); + +#if defined(__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsc/dds_opcodes.h b/unitree_SDK/include/dds/ddsc/dds_opcodes.h new file mode 100644 index 0000000..c39a83d --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_opcodes.h @@ -0,0 +1,626 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +#ifndef DDS_OPCODES_H +#define DDS_OPCODES_H + +#include "dds/ddsrt/align.h" +#include "dds/ddsrt/static_assert.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @defgroup serialization (Serialization) + * @ingroup dds + * + * Opcodes for (de)serialization of types generated by idlc. Isolated in a + * separate header to share with idlc without the need to pull in the entire + * Eclipse Cyclone DDS C language binding. + * + * One opcode is a uint32 and depending on which code it is can contain several uint32 arguments. + */ + +/** + * @anchor DDS_OP_MASK + * @ingroup serialization + * @brief Mask for the OP + */ +#define DDS_OP_MASK 0xff000000 + +/** + * @anchor DDS_OP_TYPE_FLAGS_MASK + * @ingroup serialization + * @brief Mask for the OP type flags + */ +#define DDS_OP_TYPE_FLAGS_MASK 0x00800000 + +/** + * @anchor DDS_OP_TYPE_MASK + * @ingroup serialization + * @brief Mask for the OP type + */ +#define DDS_OP_TYPE_MASK 0x007f0000 + +/** + * @anchor DDS_OP_SUBTYPE_MASK + * @ingroup serialization + * @brief Mask for the OP subtype + */ +#define DDS_OP_SUBTYPE_MASK 0x0000ff00 + +/** + * @anchor DDS_OP_JMP_MASK + * @ingroup serialization + * @brief Mask for the OP jump + */ +#define DDS_OP_JMP_MASK 0x0000ffff + +/** + * @anchor DDS_OP_FLAGS_MASK + * @ingroup serialization + * @brief Mask for the OP flags + */ +#define DDS_OP_FLAGS_MASK 0x000000ff + +/** + * @anchor DDS_JEQ_TYPE_FLAGS_MASK + * @ingroup serialization + * @brief Mask for the JEQ type flags + */ +#define DDS_JEQ_TYPE_FLAGS_MASK 0x00800000 + +/** + * @anchor DDS_JEQ_TYPE_MASK + * @ingroup serialization + * @brief Mask for the JEQ type + */ +#define DDS_JEQ_TYPE_MASK 0x007f0000 + +/** + * @anchor DDS_PLM_FLAGS_MASK + * @ingroup serialization + * @brief Mask for the PLM flags + */ +#define DDS_PLM_FLAGS_MASK 0x00ff0000 + +/** + * @anchor DDS_KOF_OFFSET_MASK + * @ingroup serialization + * @brief Mask for the KOF offset + */ +#define DDS_KOF_OFFSET_MASK 0x0000ffff + + + +/** + * @anchor DDS_OP + * @ingroup serialization + * @brief Extract the DDS OP from a uint32 as a \ref dds_stream_opcode + */ +#define DDS_OP(o) ((enum dds_stream_opcode) ((o) & DDS_OP_MASK)) + +/** + * @anchor DDS_OP_TYPE + * @ingroup serialization + * @brief Extract the DDS OP_TYPE from a uint32 as a \ref dds_stream_typecode + */ +#define DDS_OP_TYPE(o) ((enum dds_stream_typecode) (((o) & DDS_OP_TYPE_MASK) >> 16)) + +/** + * @anchor DDS_OP_TYPE_FLAGS + * @ingroup serialization + * @brief Extract the DDS OP_TYPE_FLAGS from a uint32 + * DOC_TODO: possible values? + */ +#define DDS_OP_TYPE_FLAGS(o) ((o) & DDS_OP_TYPE_FLAGS_MASK) + +/** + * @anchor DDS_OP_SUBTYPE + * @ingroup serialization + * @brief Extract the DDS OP_SUBTYPE from a uint32 as a \ref dds_stream_typecode + * Used for collections, the OP_TYPE is array/sequence + */ +#define DDS_OP_SUBTYPE(o) ((enum dds_stream_typecode) (((o) & DDS_OP_SUBTYPE_MASK) >> 8)) + +/** + * @anchor DDS_OP_FLAGS + * @ingroup serialization + * @brief Extract the DDS OP_FLAGS from a uint32 + * DOC_TODO: possible values? + */ +#define DDS_OP_FLAGS(o) ((o) & DDS_OP_FLAGS_MASK) + +/** + * @anchor DDS_OP_ADR_JSR + * @ingroup serialization + * @brief Extract the ADR JSR from a uint32 + * DOC_TODO: meaning? + */ +#define DDS_OP_ADR_JSR(o) ((int16_t) ((o) & DDS_OP_JMP_MASK)) + +/** + * @anchor DDS_OP_ADR_PLM + * @ingroup serialization + * @brief Extract the ADR PLM from a uint32 + * DOC_TODO: meaning? + */ +#define DDS_OP_ADR_PLM(o) ((int16_t) ((o) & DDS_OP_JMP_MASK)) + +/** + * @anchor DDS_OP_LENGTH + * @ingroup serialization + * @brief Extract the LENGTH from a uint32 + * DOC_TODO: meaning? + */ +#define DDS_OP_LENGTH(o) ((uint16_t) ((o) & DDS_OP_JMP_MASK)) + +/** + * @anchor DDS_OP_JUMP + * @ingroup serialization + * @brief Extract the JUMP from a uint32 + * DOC_TODO: meaning? + */ +#define DDS_OP_JUMP(o) ((int16_t) ((o) & DDS_OP_JMP_MASK)) + +/** + * @anchor DDS_OP_ADR_JMP + * @ingroup serialization + * @brief Extract the ADR_JMP from a uint32 + * DOC_TODO: meaning? + */ +#define DDS_OP_ADR_JMP(o) ((o) >> 16) + +/** + * @anchor DDS_JEQ_TYPE + * @ingroup serialization + * @brief Extract the JEQ_TYPE from a uint32 as a \ref dds_stream_typecode + * DOC_TODO: meaning? + */ +#define DDS_JEQ_TYPE(o) ((enum dds_stream_typecode) (((o) & DDS_JEQ_TYPE_MASK) >> 16)) + +/** + * @anchor DDS_JEQ_TYPE_FLAGS + * @ingroup serialization + * @brief Extract the JEQ_TYPE_FLAGS from a uint32 + * DOC_TODO: meaning? + */ +#define DDS_JEQ_TYPE_FLAGS(o) ((o) & DDS_JEQ_TYPE_FLAGS_MASK) + +/** + * @anchor DDS_PLM_FLAGS + * @ingroup serialization + * @brief Extract the PLM_FLAGS from a uint32 as a \ref dds_stream_typecode + * DOC_TODO: meaning? + */ +#define DDS_PLM_FLAGS(o) ((enum dds_stream_typecode) (((o) & DDS_PLM_FLAGS_MASK) >> 16)) + + + +/** + * @ingroup serialization + * @brief Topic encoding instruction types +*/ +enum dds_stream_opcode { + /** return from subroutine, exits top-level + [RTS, 0, 0, 0] */ + DDS_OP_RTS = 0x00 << 24, + + /** data field + [ADR, nBY, 0, f] [offset] + [ADR, BLN, 0, f] [offset] + [ADR, ENU, 0, f] [offset] [max] + [ADR, BMK, 0, f] [offset] [bits-high] [bits-low] + [ADR, STR, 0, f] [offset] + [ADR, BST, 0, f] [offset] [max-size] + + [ADR, SEQ, nBY, f] [offset] + [ADR, SEQ, BLN, f] [offset] + [ADR, SEQ, ENU, f] [offset] [max] + [ADR, SEQ, BMK, f] [offset] [bits-high] [bits-low] + [ADR, SEQ, STR, f] [offset] + [ADR, SEQ, BST, f] [offset] [max-size] + [ADR, SEQ, s, f] [offset] [elem-size] [next-insn, elem-insn] + where s = {SEQ,ARR,UNI,STU,BSQ} + [ADR, SEQ, EXT, f] *** not supported + + [ADR, BSQ, nBY, f] [offset] [sbound] + [ADR, BSQ, BLN, f] [offset] [sbound] + [ADR, BSQ, ENU, f] [offset] [sbound] [max] + [ADR, BSQ, BMK, f] [offset] [sbound] [bits-high] [bits-low] + [ADR, BSQ, STR, f] [offset] [sbound] + [ADR, BSQ, BST, f] [offset] [sbound] [max-size] + [ADR, BSQ, s, f] [offset] [sbound] [elem-size] [next-insn, elem-insn] + where s = {SEQ,ARR,UNI,STU,BSQ} + [ADR, BSQ, EXT, f] *** not supported + + [ADR, ARR, nBY, f] [offset] [alen] + [ADR, ARR, BLN, f] [offset] [alen] + [ADR, ARR, ENU, f] [offset] [alen] [max] + [ADR, ARR, BMK, f] [offset] [alen] [bits-high] [bits-low] + [ADR, ARR, STR, f] [offset] [alen] + [ADR, ARR, BST, f] [offset] [alen] [0] [max-size] + [ADR, ARR, s, f] [offset] [alen] [next-insn, elem-insn] [elem-size] + where s = {SEQ,ARR,UNI,STU,BSQ} + [ADR, ARR, EXT, f] *** not supported + + [ADR, UNI, d, z] [offset] [alen] [next-insn, cases] + [ADR, UNI, ENU, z] [offset] [alen] [next-insn, cases] [max] + [ADR, UNI, EXT, f] *** not supported + where + d = discriminant type of {1BY,2BY,4BY,BLN} + z = default present/not present (DDS_OP_FLAG_DEF) + offset = discriminant offset + max = max enum value + followed by alen case labels: in JEQ format + + [ADR, e | EXT, 0, f] [offset] [next-insn, elem-insn] [elem-size iff "external" flag e is set, or flag f has DDS_OP_FLAG_OPT] + [ADR, STU, 0, f] *** not supported + where + s = subtype + e = external: stored as external data (pointer) (DDS_OP_FLAG_EXT) + f = flags: + - key/not key (DDS_OP_FLAG_KEY) + - base type member, used with EXT type (DDS_OP_FLAG_BASE) + - optional (DDS_OP_FLAG_OPT) + - must-understand (DDS_OP_FLAG_MU) + - storage size, only for ENU and BMK (n << DDS_OP_FLAG_SZ_SHIFT) + [offset] = field offset from start of element in memory + [elem-size] = element size in memory (elem-size is only included in case 'external' flag is set) + [max-size] = string bound + 1 + [max] = max enum value + [bits-..] = identified bits in the bitmask, split into high and low 32 bits + [alen] = array length, number of cases + [sbound] = bounded sequence maximum number of elements + [next-insn] = (unsigned 16 bits) offset to instruction for next field, from start of insn + [elem-insn] = (unsigned 16 bits) offset to first instruction for element, from start of insn + [cases] = (unsigned 16 bits) offset to first case label, from start of insn + */ + DDS_OP_ADR = 0x01 << 24, + + /** jump-to-subroutine (e.g. used for recursive types and appendable unions) + [JSR, 0, e] + where + e = (signed 16 bits) offset to first instruction in subroutine, from start of insn + instruction sequence must end in RTS, execution resumes at instruction + following JSR */ + DDS_OP_JSR = 0x02 << 24, + + /** jump-if-equal, used for union cases: + [JEQ, nBY, 0] [disc] [offset] + [JEQ, BLN, 0] [disc] [offset] + [JEQ, STR, 0] [disc] [offset] + [JEQ, s, i] [disc] [offset] + [JEQ4, e | nBY, 0] [disc] [offset] 0 + [JEQ4, e | STR, 0] [disc] [offset] 0 + [JEQ4, e | ENU, f] [disc] [offset] [max] + [JEQ4, EXT, 0] *** not supported, use STU/UNI for external defined types + [JEQ4, e | s, i] [disc] [offset] [elem-size iff "external" flag e is set, else 0] + where + e = external: stored as external data (pointer) (DDS_OP_FLAG_EXT) + s = subtype other than {nBY,STR} for JEQ and {nBY,STR,ENU,EXT} for JEQ4 + (note that BMK cannot be inline, because it needs 2 additional instructions + for the bits that are identified in the bitmask type) + i = (unsigned 16 bits) offset to first instruction for case, from start of insn + instruction sequence must end in RTS, at which point executes continues + at the next field's instruction as specified by the union + f = size flags for ENU instruction + + Note that the JEQ instruction is deprecated and replaced by the JEQ4 instruction. The + IDL compiler only generates JEQ4 for union cases, the JEQ instruction is included here + for backwards compatibility (topic descriptors generated with a previous version of IDLC) + */ + DDS_OP_JEQ = 0x03 << 24, + + /** XCDR2 delimited CDR (inserts DHEADER before type) + [DLC, 0, 0] + */ + DDS_OP_DLC = 0x04 << 24, + + /** XCDR2 parameter list CDR (inserts DHEADER before type and EMHEADER before each member) + [PLC, 0, 0] + followed by a list of JEQ instructions + */ + DDS_OP_PLC = 0x05 << 24, + + /** + [PLM, f, elem-insn] [member id] + for members of aggregated mutable types (pl-cdr): + where + f = flags: + - jump to base type (DDS_OP_FLAG_BASE) + [elem-insn] = (unsigned 16 bits) offset to instruction for element, from start of insn + when FLAG_BASE is set, this is the offset of the PLM list of the base type + [member id] = id for this member (0 in case FLAG_BASE is set) + */ + DDS_OP_PLM = 0x06 << 24, + + /** Key offset list + [KOF, 0, n] [offset-1] ... [offset-n] + where + n = number of key offsets in following ops + offset = Offset of the key field relative to the previous offset, repeated n times when key is + in a nested struct. In case of inheritance of mutable structs, a single offset of + the key member relative to the first op of the top-level type (index 0). + */ + DDS_OP_KOF = 0x07 << 24, + + /** see comment for JEQ/JEQ4 above */ + DDS_OP_JEQ4 = 0x08 << 24 +}; + +/** + * @ingroup serialization + * @brief datatypes as recognized by serialization VM. + */ +enum dds_stream_typecode { + DDS_OP_VAL_1BY = 0x01, /**< one byte simple type (char, octet) */ + DDS_OP_VAL_2BY = 0x02, /**< two byte simple type ((unsigned) short) */ + DDS_OP_VAL_4BY = 0x03, /**< four byte simple type ((unsigned) long, float) */ + DDS_OP_VAL_8BY = 0x04, /**< eight byte simple type ((unsigned) long long, double) */ + DDS_OP_VAL_STR = 0x05, /**< string */ + DDS_OP_VAL_BST = 0x06, /**< bounded string */ + DDS_OP_VAL_SEQ = 0x07, /**< sequence */ + DDS_OP_VAL_ARR = 0x08, /**< array */ + DDS_OP_VAL_UNI = 0x09, /**< union */ + DDS_OP_VAL_STU = 0x0a, /**< struct */ + DDS_OP_VAL_BSQ = 0x0b, /**< bounded sequence */ + DDS_OP_VAL_ENU = 0x0c, /**< enumerated value (long) */ + DDS_OP_VAL_EXT = 0x0d, /**< field with external definition */ + DDS_OP_VAL_BLN = 0x0e, /**< boolean */ + DDS_OP_VAL_BMK = 0x0f /**< bitmask */ +}; + +/** + * @ingroup serialization + * @brief primary type code for DDS_OP_ADR, DDS_OP_JEQ + * Convinience pre-bitshifted values. + */ +enum dds_stream_typecode_primary { + DDS_OP_TYPE_1BY = DDS_OP_VAL_1BY << 16, /**< one byte simple type (char, octet) */ + DDS_OP_TYPE_2BY = DDS_OP_VAL_2BY << 16, /**< two byte simple type ((unsigned) short) */ + DDS_OP_TYPE_4BY = DDS_OP_VAL_4BY << 16, /**< four byte simple type ((unsigned) long, float) */ + DDS_OP_TYPE_8BY = DDS_OP_VAL_8BY << 16, /**< eight byte simple type ((unsigned) long long, double) */ + DDS_OP_TYPE_STR = DDS_OP_VAL_STR << 16, /**< string */ + DDS_OP_TYPE_BST = DDS_OP_VAL_BST << 16, /**< bounded string */ + DDS_OP_TYPE_SEQ = DDS_OP_VAL_SEQ << 16, /**< sequence */ + DDS_OP_TYPE_ARR = DDS_OP_VAL_ARR << 16, /**< array */ + DDS_OP_TYPE_UNI = DDS_OP_VAL_UNI << 16, /**< union */ + DDS_OP_TYPE_STU = DDS_OP_VAL_STU << 16, /**< struct */ + DDS_OP_TYPE_BSQ = DDS_OP_VAL_BSQ << 16, /**< bounded sequence */ + DDS_OP_TYPE_ENU = DDS_OP_VAL_ENU << 16, /**< enumerated value (long) */ + DDS_OP_TYPE_EXT = DDS_OP_VAL_EXT << 16, /**< field with external definition */ + DDS_OP_TYPE_BLN = DDS_OP_VAL_BLN << 16, /**< boolean */ + DDS_OP_TYPE_BMK = DDS_OP_VAL_BMK << 16 /**< bitmask */ +}; + +/** + * @anchor DDS_OP_FLAG_EXT + * @ingroup serialization + * @brief This flag indicates that the type has external data + * (i.e. a mapped to a pointer type), which can be the case because of (1) the \@external annotation + * in idl or (2) the \@optional annotation (optional fields are also mapped to pointer types as described + * in the XTypes spec). This flag is stored in the most-significant bit of the 'type' part of the + * serializer instruction. + */ +#define DDS_OP_FLAG_EXT (1u << 23) + + + +/** + * @ingroup serialization + * @brief sub-type code + * - encodes element type for DDS_OP_TYPE_{SEQ,ARR}, + * - discriminant type for DDS_OP_TYPE_UNI + * Convinience pre-bitshifted values. + */ +enum dds_stream_typecode_subtype { + DDS_OP_SUBTYPE_1BY = DDS_OP_VAL_1BY << 8, /**< one byte simple type (char, octet) */ + DDS_OP_SUBTYPE_2BY = DDS_OP_VAL_2BY << 8, /**< two byte simple type ((unsigned) short) */ + DDS_OP_SUBTYPE_4BY = DDS_OP_VAL_4BY << 8, /**< four byte simple type ((unsigned) long, float) */ + DDS_OP_SUBTYPE_8BY = DDS_OP_VAL_8BY << 8, /**< eight byte simple type ((unsigned) long long, double) */ + DDS_OP_SUBTYPE_STR = DDS_OP_VAL_STR << 8, /**< string */ + DDS_OP_SUBTYPE_BST = DDS_OP_VAL_BST << 8, /**< bounded string */ + DDS_OP_SUBTYPE_SEQ = DDS_OP_VAL_SEQ << 8, /**< sequence */ + DDS_OP_SUBTYPE_ARR = DDS_OP_VAL_ARR << 8, /**< array */ + DDS_OP_SUBTYPE_UNI = DDS_OP_VAL_UNI << 8, /**< union */ + DDS_OP_SUBTYPE_STU = DDS_OP_VAL_STU << 8, /**< struct */ + DDS_OP_SUBTYPE_BSQ = DDS_OP_VAL_BSQ << 8, /**< bounded sequence */ + DDS_OP_SUBTYPE_ENU = DDS_OP_VAL_ENU << 8, /**< enumerated value (long) */ + DDS_OP_SUBTYPE_BLN = DDS_OP_VAL_BLN << 8, /**< boolean */ + DDS_OP_SUBTYPE_BMK = DDS_OP_VAL_BMK << 8 /**< bitmask */ +}; + +/** + * @anchor DDS_OP_FLAG_KEY + * @ingroup serialization + * @brief mark field as key + * applicable to {1,2,4,8}BY, STR, BST, ARR-of-{1,2,4,8}BY. + * Note that when defining keys in nested types, the key flag should be set + * on both the field(s) in the subtype and on the enclosing STU/EXT field. + */ +#define DDS_OP_FLAG_KEY (1u << 0) + +/** + * @anchor DDS_OP_FLAG_DEF + * @ingroup serialization + * @brief For a union: + * -# the discriminator may be a key field; + * -# there may be a default value; + * -# and the discriminator can be an integral type (or enumerated - here treated as equivalent). + * What it can't be is a floating-point type. So DEF and FP need never be set at the same time. + * There are only a few flag bits, so saving one is not such a bad idea. + * + * union has a default case (for DDS_OP_ADR | DDS_OP_TYPE_UNI) + */ +#define DDS_OP_FLAG_DEF (1u << 1) + +/** + * @anchor DDS_OP_FLAG_FP + * @ingroup serialization + * @brief floating-point, + * applicable to {4,8}BY and arrays, sequences of them + */ +#define DDS_OP_FLAG_FP (1u << 1) + +/** + * @anchor DDS_OP_FLAG_SGN + * @ingroup serialization + * @brief signed, + * applicable to {1,2,4,8}BY and arrays, sequences of them + */ +#define DDS_OP_FLAG_SGN (1u << 2) + +/** + * @anchor DDS_OP_FLAG_MU + * @ingroup serialization + * @brief must-understand flag, + * as defined by the XTypes spec. + */ +#define DDS_OP_FLAG_MU (1u << 3) + +/** + * @anchor DDS_OP_FLAG_BASE + * @ingroup serialization + * @brief jump to base type, + * used with PLM in mutable types and for the TYPE_EXT 'parent' member + * in final and appendable types + */ +#define DDS_OP_FLAG_BASE (1u << 4) + +/** + * @anchor DDS_OP_FLAG_OPT + * @ingroup serialization + * @brief optional flag, + * used with struct members. For non-string types, an optional member + * also gets the FLAG_EXT, see above. + */ +#define DDS_OP_FLAG_OPT (1u << 5) + +/** + * @anchor DDS_OP_FLAG_SZ_SHIFT + * @ingroup serialization + * @brief Enum and bitmask storage size (shift amount) + */ +#define DDS_OP_FLAG_SZ_SHIFT (6) + +/** + * @anchor DDS_OP_FLAG_SZ_MASK + * @ingroup serialization + * @brief Enum and bitmask storage size + * -# 00 = 1 byte, + * -# 01 = 2 bytes, + * -# 10 = 4 bytes, + * -# 11 = 8 bytes (bitmask only) + */ +#define DDS_OP_FLAG_SZ_MASK (3u << DDS_OP_FLAG_SZ_SHIFT) + +/** + * @anchor DDS_OP_FLAGS_SZ + * @ingroup serialization + * @brief Extract the Enum and Bitmask storage size from flags + */ +#define DDS_OP_FLAGS_SZ(f) (1u << (((f) & DDS_OP_FLAG_SZ_MASK) >> DDS_OP_FLAG_SZ_SHIFT)) + +/** + * @anchor DDS_OP_TYPE_SZ + * @ingroup serialization + * @brief Extract the Enum and Bitmask storage size from an uint32 + */ +#define DDS_OP_TYPE_SZ(o) DDS_OP_FLAGS_SZ(DDS_OP_FLAGS(o)) + +/** + * @defgroup topic_flags (Topic flags) + * @ingroup serialization + * There are several flags that can be added to dds_topic_descriptor_t by the IDL compiler. + */ + +/** + * @anchor DDS_TOPIC_NO_OPTIMIZE + * @ingroup topic_flags + * @brief Don't optimize the opcodes to quick memcpy's. + * If a topic includes only plain types and directly nested structs, + * it can be that a simple copy+optional byteswap can produce the right + * C memory layout straight from CDR. If this flag is added it means that + * there is pointer 'magic' involved in decoding the type and no shortcuts should be taken. + * @deprecated Optimizability is determined runtime when creating the sertype_default + * for the type, this flag is not used. + */ +#define DDS_TOPIC_NO_OPTIMIZE (1u << 0) + +/** + * @anchor DDS_TOPIC_FIXED_KEY + * @ingroup topic_flags + * @brief The XCDRV1 serialized key fits in 16 bytes. + * If statically determined that a key always fits in 16 bytes + * the spec specifies that the key of a sample is the resulting CDR. + * If it is longer we must use MD5 to hash the resultant key CDR. + */ +#define DDS_TOPIC_FIXED_KEY (1u << 1) + +/** + * @anchor DDS_TOPIC_CONTAINS_UNION + * @ingroup topic_flags + * @brief at arbitrary deep nesting the topic type contains at least one union. + */ +#define DDS_TOPIC_CONTAINS_UNION (1u << 2) + + +// (1u << 3) unused, was used for DDS_TOPIC_DISABLE_TYPECHECK + +/** + * @anchor DDS_TOPIC_FIXED_SIZE + * @ingroup topic_flags + * @brief The size in memory of a sample of this topic type is fully fixed. + */ +#define DDS_TOPIC_FIXED_SIZE (1u << 4) + +/** + * @anchor DDS_TOPIC_FIXED_KEY_XCDR2 + * @ingroup topic_flags + * @brief The XCDRV2 serialized key fits in 16 bytes. + * If statically determined that a key always fits in 16 bytes + * the spec specifies that the key of a sample is the resulting CDR. + * If it is longer we must use MD5 to hash the resultant key CDR. + * + * This is separate from the XCDRV1 version because it can differ due + * to the change in alignment of 8byte types. + */ +#define DDS_TOPIC_FIXED_KEY_XCDR2 (1u << 5) + +/** + * @anchor DDS_TOPIC_XTYPES_METADATA + * @ingroup topic_flags + * @brief Set if XTypes meta-data is present for this topic + */ +#define DDS_TOPIC_XTYPES_METADATA (1u << 6) + +/** + * @anchor DDS_TOPIC_RESTRICT_DATA_REPRESENTATION + * @ingroup topic_flags + * @brief Set if data representation restrictions for the top-level type are present in the topic descriptor + */ +#define DDS_TOPIC_RESTRICT_DATA_REPRESENTATION (1u << 7) + +/** + * @anchor DDS_FIXED_KEY_MAX_SIZE + * @ingroup topic_flags + * @brief Max size of fixed key + */ +#define DDS_FIXED_KEY_MAX_SIZE (16) + +#if defined(__cplusplus) +} +#endif + +#endif /* DDS_OPCODES_H */ diff --git a/unitree_SDK/include/dds/ddsc/dds_public_alloc.h b/unitree_SDK/include/dds/ddsc/dds_public_alloc.h new file mode 100644 index 0000000..f6bf50a --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_public_alloc.h @@ -0,0 +1,156 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +/* TODO: do we really need to expose this as an API? */ + +/** @file + * + * @brief DDS C Allocation API + * + * This header file defines the public API of allocation convenience functions + * in the Eclipse Cyclone DDS C language binding. + */ +#ifndef DDS_ALLOC_H +#define DDS_ALLOC_H + +#include + +#include "dds/export.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct dds_topic_descriptor; +struct dds_sequence; + +/** + * @anchor DDS_FREE_KEY_BIT + * @ingroup alloc + * @brief Instruction to free all keyfields in sample + */ +#define DDS_FREE_KEY_BIT 0x01 + +/** + * @anchor DDS_FREE_CONTENTS_BIT + * @ingroup alloc + * @brief Instruction to free all non-keyfields in sample + */ +#define DDS_FREE_CONTENTS_BIT 0x02 + +/** + * @anchor DDS_FREE_ALL_BIT + * @ingroup alloc + * @brief Instruction to free outer sample + */ +#define DDS_FREE_ALL_BIT 0x04 + +/** + * @brief Freeing operation type + * @ingroup alloc + * What part of a sample to free + */ +typedef enum +{ + DDS_FREE_ALL = DDS_FREE_KEY_BIT | DDS_FREE_CONTENTS_BIT | DDS_FREE_ALL_BIT, /**< free full sample */ + DDS_FREE_CONTENTS = DDS_FREE_KEY_BIT | DDS_FREE_CONTENTS_BIT, /**< free all sample contents, but leave sample pointer intact */ + DDS_FREE_KEY = DDS_FREE_KEY_BIT /**< free only the keyfields in a sample */ +} +dds_free_op_t; + +/** + * @brief DDS Allocator + * @ingroup alloc + * C-Style allocator API + */ +typedef struct dds_allocator +{ + void * (*malloc) (size_t size); /**< behave like C malloc */ + void * (*realloc) (void *ptr, size_t size); /**< behave like C realloc, may be null */ + void (*free) (void *ptr); /**< behave like C free */ +} +dds_allocator_t; + +/** + * @brief Perform an alloc() with the default allocator. + * + * @param[in] size number of bytes + * @returns new pointer or NULL if out of memory + */ +DDS_EXPORT void * dds_alloc (size_t size); + +/** + * @brief Perform a realloc() with the default allocator. + * + * @param[in] ptr previously alloc()'ed pointer + * @param[in] size new size + * @return new pointer or NULL if out of memory + */ +DDS_EXPORT void * dds_realloc (void * ptr, size_t size); + +/** + * @brief Perform a realloc() with the default allocator. Zero out memory. + * + * @param[in] ptr previously alloc()'ed pointer + * @param[in] size new size + * @return new pointer or NULL if out of memory + */ +DDS_EXPORT void * dds_realloc_zero (void * ptr, size_t size); + +/** + * @brief Perform a free() on a memory fragment allocated with the default allocator. + * + * @param[in] ptr previously alloc()'ed pointer + */ +DDS_EXPORT void dds_free (void * ptr); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +typedef void * (*dds_alloc_fn_t) (size_t); +typedef void * (*dds_realloc_fn_t) (void *, size_t); +typedef void (*dds_free_fn_t) (void *); +#endif // DOXYGEN_SHOULD_SKIP_THIS + +/** + * @brief Allocated a string with size, accounting for the null terminator. + * + * @param[in] size number of characters + * @returns newly allocated string or NULL if out of memory + */ +DDS_EXPORT char * dds_string_alloc (size_t size); + +/** + * @brief Duplicate a null-terminated string + * + * @param[in] str string to duplicate + * @returns newly allocated duplicate string, or NULL if out of memory + */ +DDS_EXPORT char * dds_string_dup (const char * str); + +/** + * @brief Free a string, equivalent to dds_free + * + * @param[in] str string to free + */ +DDS_EXPORT void dds_string_free (char * str); + +/** + * @brief Free (parts of) a sample according to the \ref dds_free_op_t + * + * @param[in] sample sample to free + * @param[in] desc topic descriptor of the type this sample was created from. + * @param[in] op Which parts of the sample to free. + */ +DDS_EXPORT void dds_sample_free (void * sample, const struct dds_topic_descriptor * desc, dds_free_op_t op); + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsc/dds_public_error.h b/unitree_SDK/include/dds/ddsc/dds_public_error.h new file mode 100644 index 0000000..1967eba --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_public_error.h @@ -0,0 +1,56 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +/** @file + * + * @brief DDS C Error API + * + * This header file defines the public API of error values and convenience + * functions in the CycloneDDS C language binding. + */ +#ifndef DDS_ERROR_H +#define DDS_ERROR_H + +#include "dds/export.h" +#include "dds/ddsrt/log.h" +#include "dds/ddsrt/retcode.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* ** DEPRECATED ** */ +#ifndef DOXYGEN_SHOULD_SKIP_THIS + +/* Error masks for returned status values */ + +#define DDS_ERR_NR_MASK 0x000000ff +#define DDS_ERR_LINE_MASK 0x003fff00 +#define DDS_ERR_FILE_ID_MASK 0x7fc00000 + +/* Error code handling functions */ + +/** Macro to extract error number */ +#define dds_err_nr(e) (e) + +/** Macro to extract line number */ +#define dds_err_line(e) (0) + +/** Macro to extract file identifier */ +#define dds_err_file_id(e) (0) + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsc/dds_public_impl.h b/unitree_SDK/include/dds/ddsc/dds_public_impl.h new file mode 100644 index 0000000..368ff21 --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_public_impl.h @@ -0,0 +1,350 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +/* TODO: do we really need to expose all of this as an API? maybe some, but all? */ + +/** @file + * + * @brief DDS C Implementation API + * + * This header file defines the public API for all kinds of things in the + * Eclipse Cyclone DDS C language binding. + */ +#ifndef DDS_IMPL_H +#define DDS_IMPL_H + +#include +#include +#include "dds/export.h" +#include "dds/features.h" +#include "dds/ddsrt/align.h" +#include "dds/ddsc/dds_public_alloc.h" +#include "dds/ddsc/dds_opcodes.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @defgroup implementation (Public Implementation Details) + * @ingroup dds + * Miscellaneous types and functions that are required to be public, since they are + * in the output of the IDL compiler, but are not intended for direct use. + */ + +/** + * @ingroup implementation + * @brief Datastructure of a Sequence type + * Container for a sequence of bytes. The general model of this type is also used in IDL output, + * where the uint8_t * _buffer is replaced by the appropriate subtype of what is contained. + */ +typedef struct dds_sequence +{ + uint32_t _maximum; /**< Allocated space in _buffer */ + uint32_t _length; /**< Used space in _buffer */ + uint8_t * _buffer; /**< Sequence of bytes */ + bool _release; /**< Whether a CycloneDDS _free method should free the contained buffer. + if you put in your own allocated _buffer set this to false to avoid + CycloneDDS calling free() on it. */ +} +dds_sequence_t; + +/** + * @ingroup implementation + * @brief Key Descriptor + * Used to describe a named key field in a type with the offset from the start of a struct. + */ +typedef struct dds_key_descriptor +{ + const char * m_name; /**< name of keyfield */ + uint32_t m_offset; /**< offset from pointer */ + uint32_t m_idx; /**< m_idx'th key of type */ +} +dds_key_descriptor_t; + +/** + * @defgroup topic_definition (Topic Definition) + * @ingroup implementation + * Topic definitions are output by the IDL compiler and have an + * implementation-private definition. The only thing exposed on the + * API is a pointer to the "dds_topic_descriptor_t" struct type. + */ + +/** + * @ingroup topic_definition + * @brief Simple sized byte container to hold serialized type info + * Holds XTypes information (TypeInformation, TypeMapping) for a + * type + */ +struct dds_type_meta_ser +{ + unsigned char * data; /**< data pointer */ + uint32_t sz; /**< data size */ +}; + +/** + * @anchor DDS_DATA_REPRESENTATION_XCDR1 + * @ingroup topic_definition + * @brief Data representation XCDR1 + * Type can be represented using XCDR1 + */ +#define DDS_DATA_REPRESENTATION_XCDR1 0 + +/** + * @anchor DDS_DATA_REPRESENTATION_XML + * @ingroup topic_definition + * @brief Data representation XML + * Type can be represented using XML + */ +#define DDS_DATA_REPRESENTATION_XML 1 + +/** + * @anchor DDS_DATA_REPRESENTATION_XCDR2 + * @ingroup topic_definition + * @brief Data representation XCDR2 + * Type can be represented using XCDR2 + */ +#define DDS_DATA_REPRESENTATION_XCDR2 2 + + +/** + * @anchor DDS_DATA_REPRESENTATION_FLAG_XCDR1 + * @ingroup topic_definition + * @brief Data representation XCDR1 flag + * Type can be represented using XCDR1, preshifted + */ +#define DDS_DATA_REPRESENTATION_FLAG_XCDR1 (1u << DDS_DATA_REPRESENTATION_XCDR1) + +/** + * @anchor DDS_DATA_REPRESENTATION_FLAG_XML + * @ingroup topic_definition + * @brief Data representation XML flag + * Type can be represented using XML, preshifted + */ +#define DDS_DATA_REPRESENTATION_FLAG_XML (1u << DDS_DATA_REPRESENTATION_XML) + +/** + * @anchor DDS_DATA_REPRESENTATION_FLAG_XCDR2 + * @ingroup topic_definition + * @brief Data representation XCDR2 flag + * Type can be represented using XCDR2, preshifted + */ +#define DDS_DATA_REPRESENTATION_FLAG_XCDR2 (1u << DDS_DATA_REPRESENTATION_XCDR2) + +/** + * @anchor DDS_DATA_REPRESENTATION_RESTRICT_DEFAULT + * @ingroup topic_definition + * @brief Default datarepresentation flag, XCDR1 and XCDR2 flags + */ +#define DDS_DATA_REPRESENTATION_RESTRICT_DEFAULT (DDS_DATA_REPRESENTATION_FLAG_XCDR1 | DDS_DATA_REPRESENTATION_FLAG_XCDR2) + +/** + * @brief Topic Descriptor + * @ingroup topic_definition + * @warning Unstable/Private API + * Contains all meta information about a type, usually produced by the IDL compiler + * Since this type is not intended for public consumption it can change without warning. + */ +typedef struct dds_topic_descriptor +{ + const uint32_t m_size; /**< Size of topic type */ + const uint32_t m_align; /**< Alignment of topic type */ + const uint32_t m_flagset; /**< Flags */ + const uint32_t m_nkeys; /**< Number of keys (can be 0) */ + const char * m_typename; /**< Type name */ + const dds_key_descriptor_t * m_keys; /**< Key descriptors (NULL iff m_nkeys 0) */ + const uint32_t m_nops; /**< Number of ops in m_ops */ + const uint32_t * m_ops; /**< Marshalling meta data */ + const char * m_meta; /**< XML topic description meta data */ + struct dds_type_meta_ser type_information; /**< XCDR2 serialized TypeInformation, only present if flag DDS_TOPIC_XTYPES_METADATA is set */ + struct dds_type_meta_ser type_mapping; /**< XCDR2 serialized TypeMapping: maps type-id to type object and minimal to complete type id, + only present if flag DDS_TOPIC_XTYPES_METADATA is set */ + const uint32_t restrict_data_representation; /**< restrictions on the data representations allowed for the top-level type for this topic, + only present if flag DDS_TOPIC_RESTRICT_DATA_REPRESENTATION */ +} +dds_topic_descriptor_t; + +/** + * @defgroup reading_masks (Reading Masks) + * @ingroup conditions + * Masks for read condition, read, take: there is only one mask here, + * which combines the sample, view and instance states. +*/ + +/** + * @anchor DDS_READ_SAMPLE_STATE + * @ingroup reading_masks + * @brief Samples that were already returned once by a read/take operation + */ +#define DDS_READ_SAMPLE_STATE 1u + +/** + * @anchor DDS_NOT_READ_SAMPLE_STATE + * @ingroup reading_masks + * @brief Samples that have not been returned by a read/take operation yet + */ +#define DDS_NOT_READ_SAMPLE_STATE 2u + +/** + * @anchor DDS_ANY_SAMPLE_STATE + * @ingroup reading_masks + * @brief Samples \ref DDS_READ_SAMPLE_STATE or \ref DDS_NOT_READ_SAMPLE_STATE + */ +#define DDS_ANY_SAMPLE_STATE (1u | 2u) + + +/** + * @anchor DDS_NEW_VIEW_STATE + * @ingroup reading_masks + * @brief Samples that belong to a new instance (unique key value) + */ +#define DDS_NEW_VIEW_STATE 4u + +/** + * @anchor DDS_NOT_NEW_VIEW_STATE + * @ingroup reading_masks + * @brief Samples that belong to an existing instance (previously received key value) + */ +#define DDS_NOT_NEW_VIEW_STATE 8u + +/** + * @anchor DDS_ANY_VIEW_STATE + * @ingroup reading_masks + * @brief Samples \ref DDS_NEW_VIEW_STATE or \ref DDS_NOT_NEW_VIEW_STATE + */ +#define DDS_ANY_VIEW_STATE (4u | 8u) + + +/** + * @anchor DDS_ALIVE_INSTANCE_STATE + * @ingroup reading_masks + * @brief Samples that belong to a write + */ +#define DDS_ALIVE_INSTANCE_STATE 16u + +/** + * @anchor DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE + * @ingroup reading_masks + * @brief Samples that belong to a (write)dispose + */ +#define DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE 32u + +/** + * @anchor DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE + * @ingroup reading_masks + * @brief Samples that belong a writer that is gone + */ +#define DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE 64u + +/** + * @anchor DDS_ANY_INSTANCE_STATE + * @ingroup reading_masks + * @brief Samples \ref DDS_ALIVE_INSTANCE_STATE, \ref DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE or \ref DDS_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE + */ +#define DDS_ANY_INSTANCE_STATE (16u | 32u | 64u) + +/** + * @anchor DDS_ANY_STATE + * @ingroup reading_masks + * @brief Any and all samples + * Equivalen to \ref DDS_ANY_SAMPLE_STATE | \ref DDS_ANY_VIEW_STATE | \ref DDS_ANY_INSTANCE_STATE + */ +#define DDS_ANY_STATE (DDS_ANY_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE) + +/** + * @anchor DDS_DOMAIN_DEFAULT + * @ingroup domain + * @brief Select the default domain + */ +#define DDS_DOMAIN_DEFAULT ((uint32_t) 0xffffffffu) + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +#define DDS_HANDLE_NIL 0 +#define DDS_ENTITY_NIL 0 +#endif + +/** + * @brief DDS Entity Kind constants + * @ingroup internal + * @warning Unstable/Private API + * Used throughout the library to indicate what entity is what. + */ +typedef enum dds_entity_kind +{ + DDS_KIND_DONTCARE, /**< Retrieving any entity */ + DDS_KIND_TOPIC, /**< Topic entity */ + DDS_KIND_PARTICIPANT, /**< Domain Participant entity */ + DDS_KIND_READER, /**< Reader entity */ + DDS_KIND_WRITER, /**< Writer entity */ + DDS_KIND_SUBSCRIBER, /**< Subscriber entity */ + DDS_KIND_PUBLISHER, /**< Publisher entity */ + DDS_KIND_COND_READ, /**< ReadCondition entity */ + DDS_KIND_COND_QUERY, /**< QueryCondition entity */ + DDS_KIND_COND_GUARD, /**< GuardCondition entity */ + DDS_KIND_WAITSET, /**< WaitSet entity */ + DDS_KIND_DOMAIN, /**< Domain entity */ + DDS_KIND_CYCLONEDDS /**< CycloneDDS library entity */ +} dds_entity_kind_t; +/** + * @anchor DDS_KIND_MAX + * @ingroup internal + * @brief Max entity kind, used for loops. + */ +#define DDS_KIND_MAX DDS_KIND_CYCLONEDDS + +/** + * @ingroup internal + * @warning Private API + * @brief Instance handles are uint64_t behind the scenes + */ +typedef uint64_t dds_instance_handle_t; + +/** + * @ingroup domain + * @brief Domain IDs are 32 bit unsigned integers. + */ +typedef uint32_t dds_domainid_t; + +/** + * @ingroup topic + * @brief Scope for dds_find_topic() + */ +typedef enum dds_find_scope +{ + DDS_FIND_SCOPE_GLOBAL, /**< locate the topic anywhere CycloneDDS knows about */ + DDS_FIND_SCOPE_LOCAL_DOMAIN, /**< locate the topic locally within domain boundaries */ + DDS_FIND_SCOPE_PARTICIPANT /**< locate the topic within the current participant */ +} +dds_find_scope_t; + +/** + * @ingroup builtintopic + * @brief Type identifier kind for getting endpoint type identifier + */ +typedef enum dds_typeid_kind +{ + DDS_TYPEID_MINIMAL, /**< XTypes Minimal Type ID */ + DDS_TYPEID_COMPLETE /**< XTypes Complete Type ID */ +} +dds_typeid_kind_t; + +/** + * @brief Enable or disable write batching. + * Overrides default configuration setting for write batching (Internal/WriteBatch). + * + * @param[in] enable Enables or disables write batching for all writers. + */ +DDS_EXPORT void dds_write_set_batch (bool enable); + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsc/dds_public_listener.h b/unitree_SDK/include/dds/ddsc/dds_public_listener.h new file mode 100644 index 0000000..2dd404b --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_public_listener.h @@ -0,0 +1,813 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +/** + * @defgroup listener (Listener API) + * @ingroup dds + * + * This defines the public API of listeners in the + * Eclipse Cyclone DDS C language binding. + */ +#ifndef _DDS_PUBLIC_LISTENER_H_ +#define _DDS_PUBLIC_LISTENER_H_ + +#include "dds/export.h" +#include "dds/ddsc/dds_public_impl.h" +#include "dds/ddsc/dds_public_status.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* Listener callbacks */ +typedef void (*dds_on_inconsistent_topic_fn) (dds_entity_t topic, const dds_inconsistent_topic_status_t status, void* arg); +typedef void (*dds_on_liveliness_lost_fn) (dds_entity_t writer, const dds_liveliness_lost_status_t status, void* arg); +typedef void (*dds_on_offered_deadline_missed_fn) (dds_entity_t writer, const dds_offered_deadline_missed_status_t status, void* arg); +typedef void (*dds_on_offered_incompatible_qos_fn) (dds_entity_t writer, const dds_offered_incompatible_qos_status_t status, void* arg); +typedef void (*dds_on_data_on_readers_fn) (dds_entity_t subscriber, void* arg); +typedef void (*dds_on_sample_lost_fn) (dds_entity_t reader, const dds_sample_lost_status_t status, void* arg); +typedef void (*dds_on_data_available_fn) (dds_entity_t reader, void* arg); +typedef void (*dds_on_sample_rejected_fn) (dds_entity_t reader, const dds_sample_rejected_status_t status, void* arg); +typedef void (*dds_on_liveliness_changed_fn) (dds_entity_t reader, const dds_liveliness_changed_status_t status, void* arg); +typedef void (*dds_on_requested_deadline_missed_fn) (dds_entity_t reader, const dds_requested_deadline_missed_status_t status, void* arg); +typedef void (*dds_on_requested_incompatible_qos_fn) (dds_entity_t reader, const dds_requested_incompatible_qos_status_t status, void* arg); +typedef void (*dds_on_publication_matched_fn) (dds_entity_t writer, const dds_publication_matched_status_t status, void* arg); +typedef void (*dds_on_subscription_matched_fn) (dds_entity_t reader, const dds_subscription_matched_status_t status, void* arg); + +/** + * @anchor DDS_LUNSET + * @ingroup internal + * @brief Default initial value (nullptr) for listener functions. + */ +#define DDS_LUNSET 0 + +/** + * @brief DDS Listener struct (opaque) + * @ingroup listener + */ +struct dds_listener; + +/** + * @brief DDS Listener type (opaque) + * @ingroup listener + */ +typedef struct dds_listener dds_listener_t; + +/** + * @ingroup listener + * @brief Allocate memory and initializes to default values (@ref DDS_LUNSET) of a listener + * + * @param[in] arg optional pointer that will be passed on to the listener callbacks + * + * @returns Returns a pointer to the allocated memory for dds_listener_t structure. + */ +DDS_EXPORT dds_listener_t* dds_create_listener(void* arg); + +/** + * @ingroup deprecated + * @deprecated use \ref dds_create_listener instead. + * Allocate memory and initializes to default values (@ref DDS_LUNSET) of a listener + * + * @param[in] arg optional pointer that will be passed on to the listener callbacks + * + * @return Returns a pointer to the allocated memory for dds_listener_t structure. + */ +DDS_DEPRECATED_EXPORT dds_listener_t* dds_listener_create (void* arg); + +/** + * @ingroup listener + * @brief Delete the memory allocated to listener structure + * + * @param[in] listener pointer to the listener struct to delete + */ +DDS_EXPORT void dds_delete_listener (dds_listener_t * __restrict listener); +DDS_DEPRECATED_EXPORT void dds_listener_delete (dds_listener_t * __restrict listener); + +/** + * @ingroup listener + * @brief Reset the listener structure contents to @ref DDS_LUNSET + * + * @param[in,out] listener pointer to the listener struct to reset + */ +DDS_EXPORT void dds_reset_listener (dds_listener_t * __restrict listener); +DDS_DEPRECATED_EXPORT void dds_listener_reset (dds_listener_t * __restrict listener); + +/** + * @ingroup listener + * @brief Copy the listener callbacks from source to destination + * + * @param[in,out] dst The pointer to the destination listener structure, where the content is to copied + * @param[in] src The pointer to the source listener structure to be copied + */ +DDS_EXPORT void dds_copy_listener (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src); +DDS_DEPRECATED_EXPORT void dds_listener_copy (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src); + +/** + * @ingroup listener + * @brief Copy the listener callbacks from source to destination, unless already set + * + * Any listener callbacks already set in @p dst (including NULL) are skipped, only + * those set to DDS_LUNSET are copied from @p src. + * + * @param[in,out] dst The pointer to the destination listener structure, where the content is merged + * @param[in] src The pointer to the source listener structure to be copied + */ +DDS_EXPORT void dds_merge_listener (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src); +DDS_DEPRECATED_EXPORT void dds_listener_merge (dds_listener_t * __restrict dst, const dds_listener_t * __restrict src); + +/************************************************************************************************ + * Setters + ************************************************************************************************/ + +/** + * @defgroup listener_setters (Setters) + * @ingroup listener + */ + +/** + * @ingroup listener_setters + * @brief Set the data_available callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_data_available_arg (dds_listener_t * __restrict listener, dds_on_data_available_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the data_on_readers callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_data_on_readers_arg (dds_listener_t * __restrict listener, dds_on_data_on_readers_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the inconsistent_topic callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_inconsistent_topic_arg (dds_listener_t * __restrict listener, dds_on_inconsistent_topic_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the liveliness_changed callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_liveliness_changed_arg (dds_listener_t * __restrict listener, dds_on_liveliness_changed_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the liveliness_lost callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_liveliness_lost_arg (dds_listener_t * __restrict listener, dds_on_liveliness_lost_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the offered_deadline_missed callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_offered_deadline_missed_arg (dds_listener_t * __restrict listener, dds_on_offered_deadline_missed_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the offered_incompatible_qos callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_offered_incompatible_qos_arg (dds_listener_t * __restrict listener, dds_on_offered_incompatible_qos_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the publication_matched callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_publication_matched_arg (dds_listener_t * __restrict listener, dds_on_publication_matched_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the requested_deadline_missed callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_requested_deadline_missed_arg (dds_listener_t * __restrict listener, dds_on_requested_deadline_missed_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the requested_incompatible_qos callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_requested_incompatible_qos_arg (dds_listener_t * __restrict listener, dds_on_requested_incompatible_qos_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the sample_lost callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_sample_lost_arg (dds_listener_t * __restrict listener, dds_on_sample_lost_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the sample_rejected callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_sample_rejected_arg (dds_listener_t * __restrict listener, dds_on_sample_rejected_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the subscription_matched callback and argument in the listener structure. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + * @param[in] arg callback argument that is passed uninterpreted to the callback function + * @param[in] reset_on_invoke whether or not the status should be cleared when the listener callback is invoked + * + * @retval DDS_RETCODE_OK success + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lset_subscription_matched_arg (dds_listener_t * __restrict listener, dds_on_subscription_matched_fn callback, void *arg, bool reset_on_invoke); + +/** + * @ingroup listener_setters + * @brief Set the inconsistent_topic callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_inconsistent_topic_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_inconsistent_topic (dds_listener_t * __restrict listener, dds_on_inconsistent_topic_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the liveliness_lost callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_liveliness_lost_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_liveliness_lost (dds_listener_t * __restrict listener, dds_on_liveliness_lost_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the offered_deadline_missed callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_offered_deadline_missed_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_offered_deadline_missed (dds_listener_t * __restrict listener, dds_on_offered_deadline_missed_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the offered_incompatible_qos callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_offered_incompatible_qos_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_offered_incompatible_qos (dds_listener_t * __restrict listener, dds_on_offered_incompatible_qos_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the data_on_readers callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_data_on_readers_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_data_on_readers (dds_listener_t * __restrict listener, dds_on_data_on_readers_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the sample_lost callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_sample_lost_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_sample_lost (dds_listener_t * __restrict listener, dds_on_sample_lost_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the data_available callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_data_available_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_data_available (dds_listener_t * __restrict listener, dds_on_data_available_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the sample_rejected callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_sample_rejected_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_sample_rejected (dds_listener_t * __restrict listener, dds_on_sample_rejected_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the liveliness_changed callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_liveliness_changed_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_liveliness_changed (dds_listener_t * __restrict listener, dds_on_liveliness_changed_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the requested_deadline_missed callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_requested_deadline_missed_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_requested_deadline_missed (dds_listener_t * __restrict listener, dds_on_requested_deadline_missed_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the requested_incompatible_qos callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_requested_incompatible_qos_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_requested_incompatible_qos (dds_listener_t * __restrict listener, dds_on_requested_incompatible_qos_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the publication_matched callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_publication_matched_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_publication_matched (dds_listener_t * __restrict listener, dds_on_publication_matched_fn callback); + +/** + * @ingroup listener_setters + * @brief Set the subscription_matched callback in the listener structure. + * + * Equivalent to calling @ref dds_lset_subscription_matched_arg with arg set to the argument passed in + * dds_create_listener() and reset_on_invoke to true, and throwing away the result. + * + * @param[in,out] listener listener structure to update + * @param[in] callback the callback to set or a null pointer + */ +DDS_EXPORT void dds_lset_subscription_matched (dds_listener_t * __restrict listener, dds_on_subscription_matched_fn callback); + + +/************************************************************************************************ + * Getters + ************************************************************************************************/ + +/** + * @defgroup listener_getters (Getters) + * @ingroup listener + */ + +/** + * @ingroup listener_getters + * @brief Get the data_available callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_data_available_arg (const dds_listener_t * __restrict listener, dds_on_data_available_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the data_on_readers callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_data_on_readers_arg (const dds_listener_t * __restrict listener, dds_on_data_on_readers_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the inconsistent_topic callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_inconsistent_topic_arg (const dds_listener_t * __restrict listener, dds_on_inconsistent_topic_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the liveliness_changed callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_liveliness_changed_arg (const dds_listener_t * __restrict listener, dds_on_liveliness_changed_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the liveliness_lost callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_liveliness_lost_arg (const dds_listener_t * __restrict listener, dds_on_liveliness_lost_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the offered_deadline_missed callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_offered_deadline_missed_arg (const dds_listener_t * __restrict listener, dds_on_offered_deadline_missed_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the offered_incompatible_qos callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_offered_incompatible_qos_arg (const dds_listener_t * __restrict listener, dds_on_offered_incompatible_qos_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the publication_matched callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_publication_matched_arg (const dds_listener_t * __restrict listener, dds_on_publication_matched_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the subscription_matched callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_requested_deadline_missed_arg (const dds_listener_t * __restrict listener, dds_on_requested_deadline_missed_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the requested_incompatible_qos callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_requested_incompatible_qos_arg (const dds_listener_t * __restrict listener, dds_on_requested_incompatible_qos_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the sample_lost callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_sample_lost_arg (const dds_listener_t * __restrict listener, dds_on_sample_lost_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the sample_rejected callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_sample_rejected_arg (const dds_listener_t * __restrict listener, dds_on_sample_rejected_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the subscription_matched callback from the listener structure. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + * @param[out] arg Callback argument pointer; may be a null pointer + * @param[out] reset_on_invoke Whether the status is reset by listener invocation; may be a null pointer + * + * @retval DDS_RETCODE_OK if successful + * @retval DDS_RETCODE_BAD_PARAMETER listener is a null pointer + */ +DDS_EXPORT dds_return_t dds_lget_subscription_matched_arg (const dds_listener_t * __restrict listener, dds_on_subscription_matched_fn *callback, void **arg, bool *reset_on_invoke); + +/** + * @ingroup listener_getters + * @brief Get the inconsistent_topic callback from the listener structure + * + * Equivalent to calling @ref dds_lget_inconsistent_topic_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_inconsistent_topic (const dds_listener_t * __restrict listener, dds_on_inconsistent_topic_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the liveliness_lost callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_liveliness_lost_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_liveliness_lost (const dds_listener_t * __restrict listener, dds_on_liveliness_lost_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the offered_deadline_missed callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_offered_deadline_missed_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_offered_deadline_missed (const dds_listener_t * __restrict listener, dds_on_offered_deadline_missed_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the offered_incompatible_qos callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_offered_incompatible_qos_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_offered_incompatible_qos (const dds_listener_t * __restrict listener, dds_on_offered_incompatible_qos_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the data_on_readers callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_data_on_readers_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_data_on_readers (const dds_listener_t * __restrict listener, dds_on_data_on_readers_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the sample_lost callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_sample_lost_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_sample_lost (const dds_listener_t *__restrict listener, dds_on_sample_lost_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the data_available callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_data_available_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_data_available (const dds_listener_t *__restrict listener, dds_on_data_available_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the sample_rejected callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_sample_rejected_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_sample_rejected (const dds_listener_t *__restrict listener, dds_on_sample_rejected_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the liveliness_changed callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_liveliness_changed_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_liveliness_changed (const dds_listener_t * __restrict listener, dds_on_liveliness_changed_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the requested_deadline_missed callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_requested_deadline_missed_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_requested_deadline_missed (const dds_listener_t * __restrict listener, dds_on_requested_deadline_missed_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the requested_incompatible_qos callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_requested_incompatible_qos_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_requested_incompatible_qos (const dds_listener_t * __restrict listener, dds_on_requested_incompatible_qos_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the publication_matched callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_publication_matched_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_publication_matched (const dds_listener_t * __restrict listener, dds_on_publication_matched_fn *callback); + +/** + * @ingroup listener_getters + * @brief Get the subscription_matched callback from the listener structure. + * + * Equivalent to calling @ref dds_lget_subscription_matched_arg with arg and reset_on_invoke set to a null pointer and throwing away the result. + * + * @param[in] listener The pointer to the listener structure, where the callback will be retrieved from + * @param[out] callback Callback function; may be a null pointer + */ +DDS_EXPORT void dds_lget_subscription_matched (const dds_listener_t * __restrict listener, dds_on_subscription_matched_fn *callback); + +#if defined (__cplusplus) +} +#endif + +#endif /*_DDS_PUBLIC_LISTENER_H_*/ diff --git a/unitree_SDK/include/dds/ddsc/dds_public_qos.h b/unitree_SDK/include/dds/ddsc/dds_public_qos.h new file mode 100644 index 0000000..07d24ea --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_public_qos.h @@ -0,0 +1,1021 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +/** + * @defgroup qos (DDS C QoS API) + * @ingroup dds + * + * This defines the public API of QoS and Policies in the + * Eclipse Cyclone DDS C language binding. + */ +#ifndef DDS_QOS_H +#define DDS_QOS_H + +#include "dds/export.h" +#include "dds/ddsc/dds_public_qosdefs.h" + +/** + * @anchor DDS_HAS_PROPERTY_LIST_QOS + * @ingroup qos + * @brief Whether or not the "property list" QoS setting is supported in this version. If it is, + * the "dds.sec." properties are treated specially, preventing the accidental creation of + * an non-secure participant by an implementation built without support for DDS Security. + */ +#define DDS_HAS_PROPERTY_LIST_QOS 1 + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @ingroup qos + * @brief Allocate memory and initialize default QoS-policies + * + * @returns - Pointer to the initialized dds_qos_t structure, NULL if unsuccessful. + */ +DDS_EXPORT +dds_qos_t * dds_create_qos (void); + +/** + * @ingroup deprecated + * @deprecated use \ref dds_create_qos instead. + * Allocate memory and initialize default QoS-policies + * + * @returns - Pointer to the initialized dds_qos_t structure, NULL if unsuccessful. + */ +DDS_DEPRECATED_EXPORT +dds_qos_t * dds_qos_create (void); + +/** + * @ingroup qos + * @brief Delete memory allocated to QoS-policies structure + * + * @param[in] qos - Pointer to dds_qos_t structure + */ +DDS_EXPORT void +dds_delete_qos (dds_qos_t * __restrict qos); + +DDS_DEPRECATED_EXPORT void +dds_qos_delete (dds_qos_t * __restrict qos); + +/** + * @ingroup qos + * @brief Reset a QoS-policies structure to default values + * + * @param[in,out] qos - Pointer to the dds_qos_t structure + */ +DDS_EXPORT void +dds_reset_qos(dds_qos_t * __restrict qos); + +DDS_DEPRECATED_EXPORT +void dds_qos_reset (dds_qos_t * __restrict qos +); + +/** + * @ingroup qos + * @brief Copy all QoS-policies from one structure to another + * + * @param[in,out] dst - Pointer to the destination dds_qos_t structure + * @param[in] src - Pointer to the source dds_qos_t structure + * + * @returns - Return-code indicating success or failure + */ +DDS_EXPORT dds_return_t +dds_copy_qos (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src); + +DDS_DEPRECATED_EXPORT dds_return_t +dds_qos_copy (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src); + +/** + * @ingroup qos + * @brief Copy all QoS-policies from one structure to another, unless already set + * + * Policies are copied from src to dst, unless src already has the policy set to a non-default value. + * + * @param[in,out] dst - Pointer to the destination qos structure + * @param[in] src - Pointer to the source qos structure + */ +DDS_EXPORT void +dds_merge_qos (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src); + +DDS_DEPRECATED_EXPORT void +dds_qos_merge (dds_qos_t * __restrict dst, const dds_qos_t * __restrict src); + +/** + * @ingroup qos + * @brief Copy all QoS-policies from one structure to another, unless already set + * + * Policies are copied from src to dst, unless src already has the policy set to a non-default value. + * + * @param[in,out] a - Pointer to the destination qos structure + * @param[in] b - Pointer to the source qos structure + * + * @returns whether the copy was successful. + */ +DDS_EXPORT bool +dds_qos_equal (const dds_qos_t * __restrict a, const dds_qos_t * __restrict b); + +/** + * @defgroup qos_setters (Qos Setters) + * @ingroup qos + */ + +/** + * @ingroup qos_setters + * @brief Set the userdata of a qos structure. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the userdata + * @param[in] value - Pointer to the userdata + * @param[in] sz - Size of userdata stored in value + */ +DDS_EXPORT void +dds_qset_userdata ( + dds_qos_t * __restrict qos, + const void * __restrict value, + size_t sz); + +/** + * @ingroup qos_setters + * @brief Set the topicdata of a qos structure. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the topicdata + * @param[in] value - Pointer to the topicdata + * @param[in] sz - Size of the topicdata stored in value + */ +DDS_EXPORT void +dds_qset_topicdata ( + dds_qos_t * __restrict qos, + const void * __restrict value, + size_t sz); + +/** + * @ingroup qos_setters + * @brief Set the groupdata of a qos structure. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the groupdata + * @param[in] value - Pointer to the group data + * @param[in] sz - Size of groupdata stored in value + */ +DDS_EXPORT void +dds_qset_groupdata ( + dds_qos_t * __restrict qos, + const void * __restrict value, + size_t sz); + +/** + * @ingroup qos_setters + * @brief Set the durability policy of a qos structure. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] kind - Durability kind value + */ +DDS_EXPORT void +dds_qset_durability (dds_qos_t * __restrict qos, dds_durability_kind_t kind); + +/** + * @ingroup qos_setters + * @brief Set the history policy of a qos structure. + * + * Note that depth is only relevant for keep last. If you want limited history for keep all, use dds_qset_resource_limits(). + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] kind - History kind value + * @param[in] depth - History depth value + */ +DDS_EXPORT void +dds_qset_history ( + dds_qos_t * __restrict qos, + dds_history_kind_t kind, + int32_t depth); + +/** + * @ingroup qos_setters + * @brief Set the resource limits policy of a qos structure. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] max_samples - Number of samples resource-limit value + * @param[in] max_instances - Number of instances resource-limit value + * @param[in] max_samples_per_instance - Number of samples per instance resource-limit value + */ +DDS_EXPORT void +dds_qset_resource_limits ( + dds_qos_t * __restrict qos, + int32_t max_samples, + int32_t max_instances, + int32_t max_samples_per_instance); + +/** + * @ingroup qos_setters + * @brief Set the presentation policy of a qos structure. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] access_scope - Access-scope kind + * @param[in] coherent_access - Coherent access enable value + * @param[in] ordered_access - Ordered access enable value + */ +DDS_EXPORT void +dds_qset_presentation ( + dds_qos_t * __restrict qos, + dds_presentation_access_scope_kind_t access_scope, + bool coherent_access, + bool ordered_access); + +/** + * @ingroup qos_setters + * @brief Set the lifespan policy of a qos structure. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] lifespan - Lifespan duration (expiration time relative to source timestamp of a sample) + */ +DDS_EXPORT void +dds_qset_lifespan ( + dds_qos_t * __restrict qos, + dds_duration_t lifespan); + +/** + * @ingroup qos_setters + * @brief Set the deadline policy of a qos structure. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] deadline - Deadline duration + */ +DDS_EXPORT void +dds_qset_deadline ( + dds_qos_t * __restrict qos, + dds_duration_t deadline); + +/** + * @ingroup qos_setters + * @brief Set the latency-budget policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] duration - Latency budget duration + */ +DDS_EXPORT void +dds_qset_latency_budget ( + dds_qos_t * __restrict qos, + dds_duration_t duration); + +/** + * @ingroup qos_setters + * @brief Set the ownership policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] kind - Ownership kind + */ +DDS_EXPORT void +dds_qset_ownership ( + dds_qos_t * __restrict qos, + dds_ownership_kind_t kind); + +/** + * @ingroup qos_setters + * @brief Set the ownership strength policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] value - Ownership strength value + */ +DDS_EXPORT void +dds_qset_ownership_strength (dds_qos_t * __restrict qos, int32_t value); + +/** + * @ingroup qos_setters + * @brief Set the liveliness policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] kind - Liveliness kind + * @param[in] lease_duration - Lease duration + */ +DDS_EXPORT void +dds_qset_liveliness ( + dds_qos_t * __restrict qos, + dds_liveliness_kind_t kind, + dds_duration_t lease_duration); + +/** + * @ingroup qos_setters + * @brief Set the time-based filter policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] minimum_separation - Minimum duration between sample delivery for an instance + */ +DDS_EXPORT void +dds_qset_time_based_filter ( + dds_qos_t * __restrict qos, + dds_duration_t minimum_separation); + +/** + * @ingroup qos_setters + * @brief Set the partition policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] n - Number of partitions stored in ps + * @param[in] ps - Pointer to string(s) storing partition name(s) + */ +DDS_EXPORT void +dds_qset_partition ( + dds_qos_t * __restrict qos, + uint32_t n, + const char ** __restrict ps); + +/** + * @ingroup qos_setters + * @brief Convenience function to set the partition policy of a qos structure to a + * single name. Name may be a null pointer. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] name - Pointer to the name + */ +DDS_EXPORT void +dds_qset_partition1 ( + dds_qos_t * __restrict qos, + const char * __restrict name); + +/** + * @ingroup qos_setters + * @brief Set the reliability policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] kind - Reliability kind + * @param[in] max_blocking_time - Max blocking duration applied when kind is reliable. This is how long the writer will block when its history is full. + */ +DDS_EXPORT void +dds_qset_reliability ( + dds_qos_t * __restrict qos, + dds_reliability_kind_t kind, + dds_duration_t max_blocking_time); + +/** + * @ingroup qos_setters + * @brief Set the transport-priority policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] value - Priority value + */ +DDS_EXPORT void +dds_qset_transport_priority (dds_qos_t * __restrict qos, int32_t value); + +/** + * @ingroup qos_setters + * @brief Set the destination-order policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] kind - Destination-order kind + */ +DDS_EXPORT void +dds_qset_destination_order ( + dds_qos_t * __restrict qos, + dds_destination_order_kind_t kind); + +/** + * @ingroup qos_setters + * @brief Set the writer data-lifecycle policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] autodispose - Automatic disposal of unregistered instances + */ +DDS_EXPORT void +dds_qset_writer_data_lifecycle (dds_qos_t * __restrict qos, bool autodispose); + +/** + * @ingroup qos_setters + * @brief Set the reader data-lifecycle policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] autopurge_nowriter_samples_delay - Delay for purging of samples from instances in a no-writers state + * @param[in] autopurge_disposed_samples_delay - Delay for purging of samples from disposed instances + */ +DDS_EXPORT void +dds_qset_reader_data_lifecycle ( + dds_qos_t * __restrict qos, + dds_duration_t autopurge_nowriter_samples_delay, + dds_duration_t autopurge_disposed_samples_delay); + +/** + * @ingroup qos_setters + * @brief Set the durability-service policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] service_cleanup_delay - Delay for purging of abandoned instances from the durability service + * @param[in] history_kind - History policy kind applied by the durability service + * @param[in] history_depth - History policy depth applied by the durability service + * @param[in] max_samples - Number of samples resource-limit policy applied by the durability service + * @param[in] max_instances - Number of instances resource-limit policy applied by the durability service + * @param[in] max_samples_per_instance - Number of samples per instance resource-limit policy applied by the durability service + */ +DDS_EXPORT void +dds_qset_durability_service ( + dds_qos_t * __restrict qos, + dds_duration_t service_cleanup_delay, + dds_history_kind_t history_kind, + int32_t history_depth, + int32_t max_samples, + int32_t max_instances, + int32_t max_samples_per_instance); + +/** + * @ingroup qos_setters + * @brief Set the ignore-local policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] ignore - True if readers and writers owned by the same participant should be ignored + */ +DDS_EXPORT void +dds_qset_ignorelocal ( + dds_qos_t * __restrict qos, + dds_ignorelocal_kind_t ignore); + +/** + * @ingroup qos_setters + * @brief Stores a property with the provided name and string value in a qos structure. + * + * In the case a property with the provided name already exists in the qos structure, + * the value for this entry is overwritten with the provided string value. If more than + * one property with the provided name exists, only the value of the first of these + * properties is updated. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the property + * @param[in] name - Pointer to name of the property + * @param[in] value - Pointer to a (null-terminated) string that will be stored + */ +DDS_EXPORT void +dds_qset_prop ( + dds_qos_t * __restrict qos, + const char * name, + const char * value); + +/** + * @ingroup qos_setters + * @brief Removes the property with the provided name from a qos structure. + * + * In case more than one property exists with this name, only the first property + * is removed. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that contains the property + * @param[in] name - Pointer to name of the property + */ +DDS_EXPORT void +dds_qunset_prop ( + dds_qos_t * __restrict qos, + const char * name); + +/** + * @ingroup qos_setters + * @brief Stores the provided binary data as a property in a qos structure + * + * In the case a property with the provided name already exists in the qos structure, + * the value for this entry is overwritten with the provided data. If more than one + * property with the provided name exists, only the value of the first of these + * properties is updated. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the property + * @param[in] name - Pointer to name of the property + * @param[in] value - Pointer to data to be stored in the property + * @param[in] sz - Size of the data + */ +DDS_EXPORT void +dds_qset_bprop ( + dds_qos_t * __restrict qos, + const char * name, + const void * value, + const size_t sz); + +/** + * @ingroup qos_setters + * @brief Removes the binary property with the provided name from a qos structure. + * + * In case more than one binary property exists with this name, only the first binary + * property is removed. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that contains the binary property + * @param[in] name - Pointer to name of the property + */ +DDS_EXPORT void +dds_qunset_bprop ( + dds_qos_t * __restrict qos, + const char * name); + +/** + * @ingroup qos_setters + * @brief Set the type consistency enforcement policy of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] kind - Type consistency policy kind + * @param[in] ignore_sequence_bounds - Ignore sequence bounds in type assignability checking + * @param[in] ignore_string_bounds - Ignore string bounds in type assignability checking + * @param[in] ignore_member_names - Ignore member names in type assignability checking + * @param[in] prevent_type_widening - Prevent type widening in type assignability checking + * @param[in] force_type_validation - Force type validation in assignability checking + */ +DDS_EXPORT void +dds_qset_type_consistency ( + dds_qos_t * __restrict qos, + dds_type_consistency_kind_t kind, + bool ignore_sequence_bounds, + bool ignore_string_bounds, + bool ignore_member_names, + bool prevent_type_widening, + bool force_type_validation); + +/** + * @ingroup qos_setters + * @brief Set the data representation of a qos structure + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the policy + * @param[in] n - Number of data representation values + * @param[in] values - Data representation values + */ +DDS_EXPORT void +dds_qset_data_representation ( + dds_qos_t * __restrict qos, + uint32_t n, + const dds_data_representation_id_t *values); + +/** + * @ingroup qos_setters + * @brief Set the entity name. + * + * When using this QoS to initialize a participant, publisher, subscriber, reader or writer + * it will take the name set here. This name is visible over discovery and can be used + * to make sense of network in tooling. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that will store the entity name. + * @param[in] name - Pointer to the entity name to set. + */ +DDS_EXPORT void +dds_qset_entity_name ( + dds_qos_t * __restrict qos, + const char * name); + + +/** + * @defgroup qos_getters (QoS Getters) + * @ingroup qos + */ + +/** + * @ingroup qos_getters + * @brief Get the userdata from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] value - Pointer that will store the userdata. If sz = 0, then a null pointer, else it is a pointer to an allocated buffer of sz+1 bytes where the last byte is always 0 + * @param[in,out] sz - Pointer that will store the size of userdata + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool dds_qget_userdata (const dds_qos_t * __restrict qos, void **value, size_t *sz); + +/** + * @ingroup qos_getters + * @brief Get the topicdata from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] value - Pointer that will store the topicdata. If sz = 0, then a null pointer, else it is a pointer to an allocated buffer of sz+1 bytes where the last byte is always 0 + * @param[in,out] sz - Pointer that will store the size of topicdata + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object +*/ +DDS_EXPORT bool dds_qget_topicdata (const dds_qos_t * __restrict qos, void **value, size_t *sz); + +/** + * @ingroup qos_getters + * @brief Get the groupdata from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] value - Pointer that will store the groupdata. If sz = 0, then a null pointer, else it is a pointer to an allocated buffer of sz+1 bytes where the last byte is always 0 + * @param[in,out] sz - Pointer that will store the size of groupdata + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool dds_qget_groupdata (const dds_qos_t * __restrict qos, void **value, size_t *sz); + +/** + * @ingroup qos_getters + * @brief Get the durability policy from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] kind - Pointer that will store the durability kind + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool dds_qget_durability (const dds_qos_t * __restrict qos, dds_durability_kind_t *kind); + +/** + * @ingroup qos_getters + * @brief Get the history policy from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] kind - Pointer that will store the history kind (optional) + * @param[in,out] depth - Pointer that will store the history depth (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool dds_qget_history (const dds_qos_t * __restrict qos, dds_history_kind_t *kind, int32_t *depth); + +/** + * @ingroup qos_getters + * @brief Get the resource-limits policy from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] max_samples - Pointer that will store the number of samples resource-limit (optional) + * @param[in,out] max_instances - Pointer that will store the number of instances resource-limit (optional) + * @param[in,out] max_samples_per_instance - Pointer that will store the number of samples per instance resource-limit (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_resource_limits ( + const dds_qos_t * __restrict qos, + int32_t *max_samples, + int32_t *max_instances, + int32_t *max_samples_per_instance); + +/** + * @ingroup qos_getters + * @brief Get the presentation policy from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] access_scope - Pointer that will store access scope kind (optional) + * @param[in,out] coherent_access - Pointer that will store coherent access enable value (optional) + * @param[in,out] ordered_access - Pointer that will store orderede access enable value (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_presentation ( + const dds_qos_t * __restrict qos, + dds_presentation_access_scope_kind_t *access_scope, + bool *coherent_access, + bool *ordered_access); + +/** + * @ingroup qos_getters + * @brief Get the lifespan policy from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] lifespan - Pointer that will store lifespan duration + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_lifespan ( + const dds_qos_t * __restrict qos, + dds_duration_t *lifespan); + +/** + * @ingroup qos_getters + * @brief Get the deadline policy from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] deadline - Pointer that will store deadline duration + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_deadline ( + const dds_qos_t * __restrict qos, + dds_duration_t *deadline); + +/** + * @ingroup qos_getters + * @brief Get the latency-budget policy from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] duration - Pointer that will store latency-budget duration + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_latency_budget ( + const dds_qos_t * __restrict qos, + dds_duration_t *duration); + +/** + * @ingroup qos_getters + * @brief Get the ownership policy from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] kind - Pointer that will store the ownership kind + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_ownership ( + const dds_qos_t * __restrict qos, + dds_ownership_kind_t *kind); + +/** + * @ingroup qos_getters + * @brief Get the ownership strength qos policy + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] value - Pointer that will store the ownership strength value + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_ownership_strength ( + const dds_qos_t * __restrict qos, + int32_t *value); + +/** + * @ingroup qos_getters + * @brief Get the liveliness qos policy + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] kind - Pointer that will store the liveliness kind (optional) + * @param[in,out] lease_duration - Pointer that will store the liveliness lease duration (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_liveliness ( + const dds_qos_t * __restrict qos, + dds_liveliness_kind_t *kind, + dds_duration_t *lease_duration); + +/** + * @ingroup qos_getters + * @brief Get the time-based filter qos policy + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] minimum_separation - Pointer that will store the minimum separation duration (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_time_based_filter ( + const dds_qos_t * __restrict qos, + dds_duration_t *minimum_separation); + +/** + * @ingroup qos_getters + * @brief Get the partition qos policy + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] n - Pointer that will store the number of partitions (optional) + * @param[in,out] ps - Pointer that will store the string(s) containing partition name(s) (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_partition ( + const dds_qos_t * __restrict qos, + uint32_t *n, + char ***ps); + +/** + * @ingroup qos_getters + * @brief Get the reliability qos policy + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] kind - Pointer that will store the reliability kind (optional) + * @param[in,out] max_blocking_time - Pointer that will store the max blocking time for reliable reliability (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_reliability ( + const dds_qos_t * __restrict qos, + dds_reliability_kind_t *kind, + dds_duration_t *max_blocking_time); + +/** + * @ingroup qos_getters + * @brief Get the transport priority qos policy + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] value - Pointer that will store the transport priority value + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_transport_priority ( + const dds_qos_t * __restrict qos, + int32_t *value); + +/** + * @ingroup qos_getters + * @brief Get the destination-order qos policy + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] kind - Pointer that will store the destination-order kind + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_destination_order ( + const dds_qos_t * __restrict qos, + dds_destination_order_kind_t *kind); + +/** + * @ingroup qos_getters + * @brief Get the writer data-lifecycle qos policy + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] autodispose - Pointer that will store the autodispose unregistered instances enable value + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_writer_data_lifecycle ( + const dds_qos_t * __restrict qos, + bool *autodispose); + +/** + * @ingroup qos_getters + * @brief Get the reader data-lifecycle qos policy + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] autopurge_nowriter_samples_delay - Pointer that will store the delay for auto-purging samples from instances in a no-writer state (optional) + * @param[in,out] autopurge_disposed_samples_delay - Pointer that will store the delay for auto-purging of disposed instances (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_reader_data_lifecycle ( + const dds_qos_t * __restrict qos, + dds_duration_t *autopurge_nowriter_samples_delay, + dds_duration_t *autopurge_disposed_samples_delay); + +/** + * @ingroup qos_getters + * @brief Get the durability-service qos policy values. + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] service_cleanup_delay - Pointer that will store the delay for purging of abandoned instances from the durability service (optional) + * @param[in,out] history_kind - Pointer that will store history policy kind applied by the durability service (optional) + * @param[in,out] history_depth - Pointer that will store history policy depth applied by the durability service (optional) + * @param[in,out] max_samples - Pointer that will store number of samples resource-limit policy applied by the durability service (optional) + * @param[in,out] max_instances - Pointer that will store number of instances resource-limit policy applied by the durability service (optional) + * @param[in,out] max_samples_per_instance - Pointer that will store number of samples per instance resource-limit policy applied by the durability service (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_durability_service ( + const dds_qos_t * __restrict qos, + dds_duration_t *service_cleanup_delay, + dds_history_kind_t *history_kind, + int32_t *history_depth, + int32_t *max_samples, + int32_t *max_instances, + int32_t *max_samples_per_instance); + +/** + * @ingroup qos_getters + * @brief Get the ignore-local qos policy + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] ignore - Pointer that will store whether to ignore readers/writers owned by the same participant (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_ignorelocal ( + const dds_qos_t * __restrict qos, + dds_ignorelocal_kind_t *ignore); + +/** + * @ingroup qos_getters + * @brief Gets the names of the properties from a qos structure. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that contains properties + * @param[in,out] n - Pointer to number of property names that are returned (optional) + * @param[in,out] names - Pointer that will store the string(s) containing property name(s) (optional). This function will allocate the memory for the list of names and for the strings containing the names; the caller gets ownership of the allocated memory + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_propnames ( + const dds_qos_t * __restrict qos, + uint32_t * n, + char *** names); + +/** + * @ingroup qos_getters + * @brief Get the value of the property with the provided name from a qos structure. + * + * In case more than one property exists with this name, the value for the first + * property with this name will be returned. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that contains the property + * @param[in] name - Pointer to name of the property + * @param[in,out] value - Pointer to a string that will store the value of the property. The memory for storing the string value will be allocated by this function and the caller gets ownership of the allocated memory + * + * @returns - false iff any of the arguments is invalid, the qos is not present in the qos object or there was no property found with the provided name + */ +DDS_EXPORT bool +dds_qget_prop ( + const dds_qos_t * __restrict qos, + const char * name, + char ** value); + +/** + * @ingroup qos_getters + * @brief Gets the names of the binary properties from a qos structure. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that contains binary properties + * @param[in,out] n - Pointer to number of binary property names that are returned (optional) + * @param[in,out] names - Pointer that will store the string(s) containing binary property name(s) (optional). This function will allocate the memory for the list of names and for the strings containing the names; the caller gets ownership of the allocated memory + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_bpropnames ( + const dds_qos_t * __restrict qos, + uint32_t * n, + char *** names); + +/** + * @ingroup qos_getters + * @brief Get the value of the binary property with the provided name from a qos structure. + * + * In case more than one binary property exists with this name, the value for the first + * binary property with this name will be returned. + * + * @param[in,out] qos - Pointer to a dds_qos_t structure that contains the property + * @param[in] name - Pointer to name of the binary property + * @param[in,out] value - Pointer to a buffer that will store the value of the property. If sz = 0 then a NULL pointer. The memory for storing the value will be allocated by this function and the caller gets ownership of the allocated memory + * @param[in,out] sz - Pointer that will store the size of the returned buffer. + * + * @returns - false iff any of the arguments is invalid, the qos is not present in the qos object or there was no binary property found with the provided name + */ +DDS_EXPORT bool +dds_qget_bprop ( + const dds_qos_t * __restrict qos, + const char * name, + void ** value, + size_t * sz); + +/** + * @ingroup qos_getters + * @brief Get the type consistency enforcement qos policy values. + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] kind - Pointer that will store the type consistency enforcement kind (optional) + * @param[in,out] ignore_sequence_bounds - Pointer that will store the boolean value for ignoring sequence bounds in type assignability checking (optional) + * @param[in,out] ignore_string_bounds - Pointer that will store the boolean value for ignoring string bounds in type assignability checking (optional) + * @param[in,out] ignore_member_names - Pointer that will store the boolean value for ignoring member names in type assignability checking (optional) + * @param[in,out] prevent_type_widening - Pointer that will store the boolean value to prevent type widening in type assignability checking (optional) + * @param[in,out] force_type_validation - Pointer that will store the boolean value to force type validation in assignability checking (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_type_consistency ( + const dds_qos_t * __restrict qos, + dds_type_consistency_kind_t *kind, + bool *ignore_sequence_bounds, + bool *ignore_string_bounds, + bool *ignore_member_names, + bool *prevent_type_widening, + bool *force_type_validation); + +/** + * @ingroup qos_getters + * @brief Get the data representation qos policy value. + * + * Returns the data representation values that are set in the provided QoS object + * and stores the number of values in out parameter 'n'. In case the 'values' parameter + * is provided, this function will allocate a buffer that contains the data representation + * values, and set 'values' to point to this buffer. It is the responsibility of the caller + * to free the memory of this buffer. + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the policy + * @param[in,out] n - Pointer that will store the number of data representation values + * @param[in,out] values - Pointer that will store the data representation values (optional) + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + */ +DDS_EXPORT bool +dds_qget_data_representation ( + const dds_qos_t * __restrict qos, + uint32_t *n, + dds_data_representation_id_t **values); + +/** + * @ingroup qos_getters + * @brief Get the entity name from a qos structure + * + * @param[in] qos - Pointer to a dds_qos_t structure storing the entity name + * @param[in,out] name - Pointer to a string that will store the returned entity name + * + * @returns - false iff any of the arguments is invalid or the qos is not present in the qos object + * or if a buffer to store the name could not be allocated. + */ +DDS_EXPORT bool dds_qget_entity_name (const dds_qos_t * __restrict qos, char **name); + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsc/dds_public_qosdefs.h b/unitree_SDK/include/dds/ddsc/dds_public_qosdefs.h new file mode 100644 index 0000000..b179aa6 --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_public_qosdefs.h @@ -0,0 +1,184 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +#ifndef DDS_QOSDEFS_H +#define DDS_QOSDEFS_H + +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @anchor DDS_LENGTH_UNLIMITED + * @ingroup qos + * @brief Used for indicating unlimited length in dds_qset_resource_limits() + */ +#define DDS_LENGTH_UNLIMITED -1 + +/** + * @brief Qos Policy IDs + * @ingroup internal + * Used internally to mark the QoS policy type + */ +typedef enum dds_qos_policy_id { + DDS_INVALID_QOS_POLICY_ID, /**< Invalid Policy */ + DDS_USERDATA_QOS_POLICY_ID, /**< Userdata policy dds_qset_userdata() */ + DDS_DURABILITY_QOS_POLICY_ID, /**< Durability policy dds_qset_durability() */ + DDS_PRESENTATION_QOS_POLICY_ID, /**< Presentation policy dds_qset_presentation() */ + DDS_DEADLINE_QOS_POLICY_ID, /**< Deadline policy dds_qset_deadline() */ + DDS_LATENCYBUDGET_QOS_POLICY_ID, /**< LatencyBudget policy dds_qset_latency_budget() */ + DDS_OWNERSHIP_QOS_POLICY_ID, /**< Ownership policy dds_qset_ownership() */ + DDS_OWNERSHIPSTRENGTH_QOS_POLICY_ID, /**< OwnershipStrength policy dds_qset_ownership_strength() */ + DDS_LIVELINESS_QOS_POLICY_ID, /**< Liveliness policy dds_qset_liveliness() */ + DDS_TIMEBASEDFILTER_QOS_POLICY_ID, /**< TimeBasedFilter policy dds_qset_time_based_filter() */ + DDS_PARTITION_QOS_POLICY_ID, /**< Partition policy dds_qset_partition() */ + DDS_RELIABILITY_QOS_POLICY_ID, /**< Reliability policy dds_qset_reliability() */ + DDS_DESTINATIONORDER_QOS_POLICY_ID, /**< DestinationOrder policy dds_qset_destination_order() */ + DDS_HISTORY_QOS_POLICY_ID, /**< History policy dds_qset_history() */ + DDS_RESOURCELIMITS_QOS_POLICY_ID, /**< ResourceLimits policy dds_qset_resource_limits() */ + DDS_ENTITYFACTORY_QOS_POLICY_ID, /**< EntityFactory policy */ + DDS_WRITERDATALIFECYCLE_QOS_POLICY_ID, /**< WriterDataLifecycle policy dds_qset_writer_data_lifecycle() */ + DDS_READERDATALIFECYCLE_QOS_POLICY_ID, /**< ReaderDataLifecycle policy dds_qset_reader_data_lifecycle() */ + DDS_TOPICDATA_QOS_POLICY_ID, /**< Topicdata policy dds_qset_topicdata() */ + DDS_GROUPDATA_QOS_POLICY_ID, /**< Groupdata policy dds_qset_groupdata() */ + DDS_TRANSPORTPRIORITY_QOS_POLICY_ID, /**< TransportPriority policy dds_qset_transport_priority() */ + DDS_LIFESPAN_QOS_POLICY_ID, /**< Livespan policy dds_qset_lifespan() */ + DDS_DURABILITYSERVICE_QOS_POLICY_ID, /**< DurabilityService policy dds_qset_durability_service() */ + DDS_PROPERTY_QOS_POLICY_ID, /**< Property policy dds_qset_property() */ + DDS_TYPE_CONSISTENCY_ENFORCEMENT_QOS_POLICY_ID, /**< TypeConsistencyEnforcement policy dds_qset_type_consistency_enforcements() */ + DDS_DATA_REPRESENTATION_QOS_POLICY_ID /**< DataRepresentation policy dds_qset_data_representation() */ +} dds_qos_policy_id_t; + + +/** + * @brief QoS datatype + * @ingroup qos + * QoS structure is opaque + */ +typedef struct dds_qos dds_qos_t; + +/** + * @brief Durability QoS: Applies to Topic, DataReader, DataWriter + * @ingroup qos + */ +typedef enum dds_durability_kind +{ + DDS_DURABILITY_VOLATILE, /**< Volatile durability */ + DDS_DURABILITY_TRANSIENT_LOCAL, /**< Transient Local durability */ + DDS_DURABILITY_TRANSIENT, /**< Transient durability */ + DDS_DURABILITY_PERSISTENT /**< Persistent durability */ +} +dds_durability_kind_t; + +/** + * @brief History QoS: Applies to Topic, DataReader, DataWriter + * @ingroup qos + */ +typedef enum dds_history_kind +{ + DDS_HISTORY_KEEP_LAST, /**< Keep Last history */ + DDS_HISTORY_KEEP_ALL /**< Keep All history */ +} +dds_history_kind_t; + +/** + * @brief Ownership QoS: Applies to Topic, DataReader, DataWriter + * @ingroup qos + */ +typedef enum dds_ownership_kind +{ + DDS_OWNERSHIP_SHARED, /**< Shared Ownership */ + DDS_OWNERSHIP_EXCLUSIVE /**< Exclusive Ownership */ +} +dds_ownership_kind_t; + +/** + * @brief Liveliness QoS: Applies to Topic, DataReader, DataWriter + * @ingroup qos + */ +typedef enum dds_liveliness_kind +{ + DDS_LIVELINESS_AUTOMATIC, /**< Automatic liveliness */ + DDS_LIVELINESS_MANUAL_BY_PARTICIPANT, /**< Manual by Participant liveliness */ + DDS_LIVELINESS_MANUAL_BY_TOPIC /**< Manual by Topic liveliness */ +} +dds_liveliness_kind_t; + +/** + * @brief Reliability QoS: Applies to Topic, DataReader, DataWriter + * @ingroup qos + */ +typedef enum dds_reliability_kind +{ + DDS_RELIABILITY_BEST_EFFORT, /**< Best Effort reliability */ + DDS_RELIABILITY_RELIABLE /**< Reliable reliability */ +} +dds_reliability_kind_t; + +/** + * @brief DestinationOrder QoS: Applies to Topic, DataReader, DataWriter + * @ingroup qos + */ +typedef enum dds_destination_order_kind +{ + DDS_DESTINATIONORDER_BY_RECEPTION_TIMESTAMP, /**< order by reception timestamp */ + DDS_DESTINATIONORDER_BY_SOURCE_TIMESTAMP /**< order by source timestamp */ +} +dds_destination_order_kind_t; + +/** + * @brief Presentation QoS: Applies to Publisher, Subscriber + * @ingroup qos + */ +typedef enum dds_presentation_access_scope_kind +{ + DDS_PRESENTATION_INSTANCE, /**< presentation scope per instance */ + DDS_PRESENTATION_TOPIC, /**< presentation scope per topic */ + DDS_PRESENTATION_GROUP /**< presentation scope per group */ +} +dds_presentation_access_scope_kind_t; + +/** + * @brief Ignore-local QoS: Applies to DataReader, DataWriter + * @ingroup qos + */ +typedef enum dds_ignorelocal_kind +{ + DDS_IGNORELOCAL_NONE, /**< Don't ignore local data */ + DDS_IGNORELOCAL_PARTICIPANT, /**< Ignore local data from same participant */ + DDS_IGNORELOCAL_PROCESS /**< Ignore local data from same process */ +} +dds_ignorelocal_kind_t; + +/** + * @brief Type-consistency QoS: Applies to DataReader, DataWriter + * @ingroup qos + */ +typedef enum dds_type_consistency_kind +{ + DDS_TYPE_CONSISTENCY_DISALLOW_TYPE_COERCION, /**< Do not allow type coercion */ + DDS_TYPE_CONSISTENCY_ALLOW_TYPE_COERCION /**< Allow type coercion */ +} +dds_type_consistency_kind_t; + +/** + * @brief Data Representation QoS: Applies to Topic, DataReader, DataWriter + * @ingroup qos + */ +typedef int16_t dds_data_representation_id_t; + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsc/dds_public_status.h b/unitree_SDK/include/dds/ddsc/dds_public_status.h new file mode 100644 index 0000000..7485f5e --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_public_status.h @@ -0,0 +1,512 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +/** + * @defgroup dcps_status (DDS C Communication Status API) + * @ingroup dds + * This defines the public API of the Communication Status in the + * Eclipse Cyclone DDS C language binding. Listeners are implemented + * as structs containing callback functions that take listener status types + * as arguments. + */ +#ifndef DDS_STATUS_H +#define DDS_STATUS_H + +#include "dds/export.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @ingroup dcps_status + * @brief DCPS_Status_OfferedDeadlineMissed + * DOC_TODO + */ +typedef struct dds_offered_deadline_missed_status +{ + uint32_t total_count; /**< DOC_TODO */ + int32_t total_count_change; /**< DOC_TODO */ + dds_instance_handle_t last_instance_handle; /**< DOC_TODO */ +} +dds_offered_deadline_missed_status_t; + +/** + * @ingroup dcps_status + * @brief DCPS_Status_OfferedIncompatibleQoS + * DOC_TODO + */ +typedef struct dds_offered_incompatible_qos_status +{ + uint32_t total_count; /**< DOC_TODO */ + int32_t total_count_change; /**< DOC_TODO */ + uint32_t last_policy_id; /**< DOC_TODO */ +} +dds_offered_incompatible_qos_status_t; + +/** + * @ingroup dcps_status + * @brief DCPS_Status_PublicationMatched + * DOC_TODO + */ +typedef struct dds_publication_matched_status +{ + uint32_t total_count; /**< DOC_TODO */ + int32_t total_count_change; /**< DOC_TODO */ + uint32_t current_count; /**< DOC_TODO */ + int32_t current_count_change; /**< DOC_TODO */ + dds_instance_handle_t last_subscription_handle; /**< DOC_TODO */ +} +dds_publication_matched_status_t; + +/** + * @ingroup dcps_status + * @brief DCPS_Status_LivelinessLost + * DOC_TODO + */ +typedef struct dds_liveliness_lost_status +{ + uint32_t total_count; /**< DOC_TODO */ + int32_t total_count_change; /**< DOC_TODO */ +} +dds_liveliness_lost_status_t; + +/** + * @ingroup dcps_status + * @brief DCPS_Status_SubscriptionMatched + * DOC_TODO + */ +typedef struct dds_subscription_matched_status +{ + uint32_t total_count; /**< DOC_TODO */ + int32_t total_count_change; /**< DOC_TODO */ + uint32_t current_count; /**< DOC_TODO */ + int32_t current_count_change; /**< DOC_TODO */ + dds_instance_handle_t last_publication_handle; /**< DOC_TODO */ +} +dds_subscription_matched_status_t; + +/** + * @ingroup dcps_status + * @brief Rejected Status + * DOC_TODO + */ +typedef enum +{ + DDS_NOT_REJECTED, /**< DOC_TODO */ + DDS_REJECTED_BY_INSTANCES_LIMIT, /**< DOC_TODO */ + DDS_REJECTED_BY_SAMPLES_LIMIT, /**< DOC_TODO */ + DDS_REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT /**< DOC_TODO */ +} +dds_sample_rejected_status_kind; + +/** + * @ingroup dcps_status + * @brief DCPS_Status_SampleRejected + * DOC_TODO + */ +typedef struct dds_sample_rejected_status +{ + uint32_t total_count; /**< DOC_TODO */ + int32_t total_count_change; /**< DOC_TODO */ + dds_sample_rejected_status_kind last_reason; /**< DOC_TODO */ + dds_instance_handle_t last_instance_handle; /**< DOC_TODO */ +} +dds_sample_rejected_status_t; + +/** + * @ingroup dcps_status + * @brief DCPS_Status_LivelinessChanged + * DOC_TODO + */ +typedef struct dds_liveliness_changed_status +{ + uint32_t alive_count; /**< DOC_TODO */ + uint32_t not_alive_count; /**< DOC_TODO */ + int32_t alive_count_change; /**< DOC_TODO */ + int32_t not_alive_count_change; /**< DOC_TODO */ + dds_instance_handle_t last_publication_handle; /**< DOC_TODO */ +} +dds_liveliness_changed_status_t; + +/** + * @ingroup dcps_status + * @brief DCPS_Status_RequestedDeadlineMissed + * DOC_TODO + */ +typedef struct dds_requested_deadline_missed_status +{ + uint32_t total_count; /**< DOC_TODO */ + int32_t total_count_change; /**< DOC_TODO */ + dds_instance_handle_t last_instance_handle; /**< DOC_TODO */ +} +dds_requested_deadline_missed_status_t; + +/** + * @ingroup dcps_status + * @brief DCPS_Status_RequestedIncompatibleQoS + * DOC_TODO + */ +typedef struct dds_requested_incompatible_qos_status +{ + uint32_t total_count; /**< DOC_TODO */ + int32_t total_count_change; /**< DOC_TODO */ + uint32_t last_policy_id; /**< DOC_TODO */ +} +dds_requested_incompatible_qos_status_t; + +/** + * @ingroup dcps_status + * @brief DCPS_Status_SampleLost + * DOC_TODO + */ +typedef struct dds_sample_lost_status +{ + uint32_t total_count; /**< DOC_TODO */ + int32_t total_count_change; /**< DOC_TODO */ +} +dds_sample_lost_status_t; + +/** + * @ingroup dcps_status + * @brief DCPS_Status_InconsistentTopic + * DOC_TODO + */ +typedef struct dds_inconsistent_topic_status +{ + uint32_t total_count; /**< DOC_TODO */ + int32_t total_count_change; /**< DOC_TODO */ +} +dds_inconsistent_topic_status_t; + + +/** + * @defgroup dcps_status_getters (DCPS Status Getters) + * @ingroup dcps_status + * get_ APIs return the status of an entity and resets the status +*/ + +/** + * @ingroup dcps_status_getters + * @brief Get INCONSISTENT_TOPIC status + * + * This operation gets the status value corresponding to INCONSISTENT_TOPIC + * and reset the status. The value can be obtained, only if the status is enabled for an entity. + * NULL value for status is allowed and it will reset the trigger value when status is enabled. + * + * @param[in] topic The entity to get the status + * @param[out] status The pointer to @ref dds_inconsistent_topic_status_t to get the status + * + * @returns 0 - Success + * @returns <0 - Failure + * + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_inconsistent_topic_status ( + dds_entity_t topic, + dds_inconsistent_topic_status_t * status); + +/** + * @ingroup dcps_status_getters + * @brief Get PUBLICATION_MATCHED status + * + * This operation gets the status value corresponding to PUBLICATION_MATCHED + * and reset the status. The value can be obtained, only if the status is enabled for an entity. + * NULL value for status is allowed and it will reset the trigger value when status is enabled. + * + * @param[in] writer The entity to get the status + * @param[out] status The pointer to @ref dds_publication_matched_status_t to get the status + * + * @returns 0 - Success + * @returns <0 - Failure + * + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_publication_matched_status ( + dds_entity_t writer, + dds_publication_matched_status_t * status); + +/** + * @ingroup dcps_status_getters + * @brief Get LIVELINESS_LOST status + * + * This operation gets the status value corresponding to LIVELINESS_LOST + * and reset the status. The value can be obtained, only if the status is enabled for an entity. + * NULL value for status is allowed and it will reset the trigger value when status is enabled. + * + * @param[in] writer The entity to get the status + * @param[out] status The pointer to @ref dds_liveliness_lost_status_t to get the status + * + * @returns 0 - Success + * @returns <0 - Failure + * + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_liveliness_lost_status ( + dds_entity_t writer, + dds_liveliness_lost_status_t * status); + +/** + * @ingroup dcps_status_getters + * @brief Get OFFERED_DEADLINE_MISSED status + * + * This operation gets the status value corresponding to OFFERED_DEADLINE_MISSED + * and reset the status. The value can be obtained, only if the status is enabled for an entity. + * NULL value for status is allowed and it will reset the trigger value when status is enabled. + * + * @param[in] writer The entity to get the status + * @param[out] status The pointer to @ref dds_offered_deadline_missed_status_t to get the status + * + * @returns 0 - Success + * @returns <0 - Failure + * + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_offered_deadline_missed_status( + dds_entity_t writer, + dds_offered_deadline_missed_status_t *status); + +/** + * @ingroup dcps_status_getters + * @brief Get OFFERED_INCOMPATIBLE_QOS status + * + * This operation gets the status value corresponding to OFFERED_INCOMPATIBLE_QOS + * and reset the status. The value can be obtained, only if the status is enabled for an entity. + * NULL value for status is allowed and it will reset the trigger value when status is enabled. + * + * @param[in] writer The writer entity to get the status + * @param[out] status The pointer to @ref dds_offered_incompatible_qos_status_t to get the status + * + * @returns 0 - Success + * @returns <0 - Failure + * + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_offered_incompatible_qos_status ( + dds_entity_t writer, + dds_offered_incompatible_qos_status_t * status); + +/** + * @ingroup dcps_status_getters + * @brief Get SUBSCRIPTION_MATCHED status + * + * This operation gets the status value corresponding to SUBSCRIPTION_MATCHED + * and reset the status. The value can be obtained, only if the status is enabled for an entity. + * NULL value for status is allowed and it will reset the trigger value when status is enabled. + * + * @param[in] reader The reader entity to get the status + * @param[out] status The pointer to @ref dds_subscription_matched_status_t to get the status + * + * @returns 0 - Success + * @returns <0 - Failure + * + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_subscription_matched_status ( + dds_entity_t reader, + dds_subscription_matched_status_t * status); + +/** + * @ingroup dcps_status_getters + * @brief Get LIVELINESS_CHANGED status + * + * This operation gets the status value corresponding to LIVELINESS_CHANGED + * and reset the status. The value can be obtained, only if the status is enabled for an entity. + * NULL value for status is allowed and it will reset the trigger value when status is enabled. + * + * @param[in] reader The entity to get the status + * @param[out] status The pointer to @ref dds_liveliness_changed_status_t to get the status + * + * @returns 0 - Success + * @returns <0 - Failure + * + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_liveliness_changed_status ( + dds_entity_t reader, + dds_liveliness_changed_status_t * status); + +/** + * @ingroup dcps_status_getters + * @brief Get SAMPLE_REJECTED status + * + * This operation gets the status value corresponding to SAMPLE_REJECTED + * and reset the status. The value can be obtained, only if the status is enabled for an entity. + * NULL value for status is allowed and it will reset the trigger value when status is enabled. + * + * @param[in] reader The entity to get the status + * @param[out] status The pointer to @ref dds_sample_rejected_status_t to get the status + * + * @returns 0 - Success + * @returns <0 - Failure + * + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_sample_rejected_status ( + dds_entity_t reader, + dds_sample_rejected_status_t * status); + +/** + * @ingroup dcps_status_getters + * @brief Get SAMPLE_LOST status + * + * This operation gets the status value corresponding to SAMPLE_LOST + * and reset the status. The value can be obtained, only if the status is enabled for an entity. + * NULL value for status is allowed and it will reset the trigger value when status is enabled. + * + * @param[in] reader The entity to get the status + * @param[out] status The pointer to @ref dds_sample_lost_status_t to get the status + * + * @returns A dds_return_t indicating success or failure + * + * @retval DDS_RETCODE_OK + * Success + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_sample_lost_status ( + dds_entity_t reader, + dds_sample_lost_status_t * status); + +/** + * @ingroup dcps_status_getters + * @brief Get REQUESTED_DEADLINE_MISSED status + * + * This operation gets the status value corresponding to REQUESTED_DEADLINE_MISSED + * and reset the status. The value can be obtained, only if the status is enabled for an entity. + * NULL value for status is allowed and it will reset the trigger value when status is enabled. + * + * @param[in] reader The entity to get the status + * @param[out] status The pointer to @ref dds_requested_deadline_missed_status_t to get the status + * + * @returns A dds_return_t indicating success or failure + * + * @retval DDS_RETCODE_OK + * Success + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_requested_deadline_missed_status ( + dds_entity_t reader, + dds_requested_deadline_missed_status_t * status); + +/** + * @ingroup dcps_status_getters + * @brief Get REQUESTED_INCOMPATIBLE_QOS status + * + * This operation gets the status value corresponding to REQUESTED_INCOMPATIBLE_QOS + * and reset the status. The value can be obtained, only if the status is enabled for an entity. + * NULL value for status is allowed and it will reset the trigger value when status is enabled. + * + * @param[in] reader The entity to get the status + * @param[out] status The pointer to @ref dds_requested_incompatible_qos_status_t to get the status + * + * @returns A dds_return_t indicating success or failure + * + * @retval DDS_RETCODE_OK + * Success + * @retval DDS_RETCODE_ERROR + * An internal error has occurred. + * @retval DDS_RETCODE_BAD_PARAMETER + * One of the given arguments is not valid. + * @retval DDS_RETCODE_ILLEGAL_OPERATION + * The operation is invoked on an inappropriate object. + * @retval DDS_RETCODE_ALREADY_DELETED + * The entity has already been deleted. + */ +DDS_EXPORT dds_return_t +dds_get_requested_incompatible_qos_status ( + dds_entity_t reader, + dds_requested_incompatible_qos_status_t * status); + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsc/dds_rhc.h b/unitree_SDK/include/dds/ddsc/dds_rhc.h new file mode 100644 index 0000000..9267f40 --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_rhc.h @@ -0,0 +1,109 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef _DDS_RHC_H_ +#define _DDS_RHC_H_ + +#include "dds/ddsrt/static_assert.h" +#include "dds/ddsi/ddsi_rhc.h" + +#ifndef DOXYGEN_SHOULD_SKIP_THIS /** DOC_TODO we should document the rhc */ + +#define NO_STATE_MASK_SET (DDS_ANY_STATE + 1) + +#if defined (__cplusplus) +extern "C" { +#endif + +struct dds_rhc; +struct dds_readcond; +struct dds_reader; +struct ddsi_tkmap; + +typedef dds_return_t (*dds_rhc_associate_t) (struct dds_rhc *rhc, struct dds_reader *reader, const struct ddsi_sertype *type, struct ddsi_tkmap *tkmap); +typedef int32_t (*dds_rhc_read_take_t) (struct dds_rhc *rhc, bool lock, void **values, dds_sample_info_t *info_seq, uint32_t max_samples, uint32_t mask, dds_instance_handle_t handle, struct dds_readcond *cond); +typedef int32_t (*dds_rhc_read_take_cdr_t) (struct dds_rhc *rhc, bool lock, struct ddsi_serdata **values, dds_sample_info_t *info_seq, uint32_t max_samples, uint32_t sample_states, uint32_t view_states, uint32_t instance_states, dds_instance_handle_t handle); + +typedef bool (*dds_rhc_add_readcondition_t) (struct dds_rhc *rhc, struct dds_readcond *cond); +typedef void (*dds_rhc_remove_readcondition_t) (struct dds_rhc *rhc, struct dds_readcond *cond); + +typedef uint32_t (*dds_rhc_lock_samples_t) (struct dds_rhc *rhc); + +struct dds_rhc_ops { + /* A copy of DDSI rhc ops comes first so we can use either interface without + additional indirections */ + struct ddsi_rhc_ops rhc_ops; + dds_rhc_read_take_t read; + dds_rhc_read_take_t take; + dds_rhc_read_take_cdr_t readcdr; + dds_rhc_read_take_cdr_t takecdr; + dds_rhc_add_readcondition_t add_readcondition; + dds_rhc_remove_readcondition_t remove_readcondition; + dds_rhc_lock_samples_t lock_samples; + dds_rhc_associate_t associate; +}; + +struct dds_rhc { + union { + const struct dds_rhc_ops *ops; + struct ddsi_rhc rhc; + } common; +}; + +DDSRT_STATIC_ASSERT (offsetof (struct dds_rhc, common.ops) == offsetof (struct ddsi_rhc, ops)); + +DDS_INLINE_EXPORT inline dds_return_t dds_rhc_associate (struct dds_rhc *rhc, struct dds_reader *reader, const struct ddsi_sertype *type, struct ddsi_tkmap *tkmap) { + return rhc->common.ops->associate (rhc, reader, type, tkmap); +} +DDS_INLINE_EXPORT inline bool dds_rhc_store (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wrinfo, struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk) { + return rhc->common.ops->rhc_ops.store (&rhc->common.rhc, wrinfo, sample, tk); +} +DDS_INLINE_EXPORT inline void dds_rhc_unregister_wr (struct dds_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wrinfo) { + rhc->common.ops->rhc_ops.unregister_wr (&rhc->common.rhc, wrinfo); +} +DDS_INLINE_EXPORT inline void dds_rhc_relinquish_ownership (struct dds_rhc * __restrict rhc, const uint64_t wr_iid) { + rhc->common.ops->rhc_ops.relinquish_ownership (&rhc->common.rhc, wr_iid); +} +DDS_INLINE_EXPORT inline void dds_rhc_set_qos (struct dds_rhc *rhc, const struct dds_qos *qos) { + rhc->common.ops->rhc_ops.set_qos (&rhc->common.rhc, qos); +} +DDS_INLINE_EXPORT inline void dds_rhc_free (struct dds_rhc *rhc) { + rhc->common.ops->rhc_ops.free (&rhc->common.rhc); +} +DDS_INLINE_EXPORT inline int32_t dds_rhc_read (struct dds_rhc *rhc, bool lock, void **values, dds_sample_info_t *info_seq, uint32_t max_samples, uint32_t mask, dds_instance_handle_t handle, struct dds_readcond *cond) { + return (rhc->common.ops->read) (rhc, lock, values, info_seq, max_samples, mask, handle, cond); +} +DDS_INLINE_EXPORT inline int32_t dds_rhc_take (struct dds_rhc *rhc, bool lock, void **values, dds_sample_info_t *info_seq, uint32_t max_samples, uint32_t mask, dds_instance_handle_t handle, struct dds_readcond *cond) { + return rhc->common.ops->take (rhc, lock, values, info_seq, max_samples, mask, handle, cond); +} +DDS_INLINE_EXPORT inline int32_t dds_rhc_readcdr (struct dds_rhc *rhc, bool lock, struct ddsi_serdata **values, dds_sample_info_t *info_seq, uint32_t max_samples, uint32_t sample_states, uint32_t view_states, uint32_t instance_states, dds_instance_handle_t handle) { + return rhc->common.ops->readcdr (rhc, lock, values, info_seq, max_samples, sample_states, view_states, instance_states, handle); +} +DDS_INLINE_EXPORT inline int32_t dds_rhc_takecdr (struct dds_rhc *rhc, bool lock, struct ddsi_serdata **values, dds_sample_info_t *info_seq, uint32_t max_samples, uint32_t sample_states, uint32_t view_states, uint32_t instance_states, dds_instance_handle_t handle) { + return rhc->common.ops->takecdr (rhc, lock, values, info_seq, max_samples, sample_states, view_states, instance_states, handle); +} +DDS_INLINE_EXPORT inline bool dds_rhc_add_readcondition (struct dds_rhc *rhc, struct dds_readcond *cond) { + return rhc->common.ops->add_readcondition (rhc, cond); +} +DDS_INLINE_EXPORT inline void dds_rhc_remove_readcondition (struct dds_rhc *rhc, struct dds_readcond *cond) { + rhc->common.ops->remove_readcondition (rhc, cond); +} +DDS_INLINE_EXPORT inline uint32_t dds_rhc_lock_samples (struct dds_rhc *rhc) { + return rhc->common.ops->lock_samples (rhc); +} + +DDS_EXPORT void dds_reader_data_available_cb (struct dds_reader *rd); + +#if defined (__cplusplus) +} +#endif +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsc/dds_statistics.h b/unitree_SDK/include/dds/ddsc/dds_statistics.h new file mode 100644 index 0000000..d2a2a2a --- /dev/null +++ b/unitree_SDK/include/dds/ddsc/dds_statistics.h @@ -0,0 +1,133 @@ +/* + * Copyright(c) 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +#ifndef DDS_STATISTICS_H +#define DDS_STATISTICS_H + +/** + * @defgroup statistics (DDS Statistics) + * @ingroup dds + * @warning Unstable API + * + * A quick-and-dirty provisional interface + */ + +#include "dds/dds.h" +#include "dds/ddsrt/attributes.h" +#include "dds/export.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @brief Kind of statistical value + * @ingroup statistics + */ +enum dds_stat_kind { + DDS_STAT_KIND_UINT32, /**< value is a 32-bit unsigned integer */ + DDS_STAT_KIND_UINT64, /**< value is a 64-bit unsigned integer */ + DDS_STAT_KIND_LENGTHTIME /**< value is integral(length(t) dt) */ +}; + +/** + * @brief KeyValue statistics entry + * @ingroup statistics + */ +struct dds_stat_keyvalue { + const char *name; /**< name, memory owned by library */ + enum dds_stat_kind kind; /**< value type */ + union { + uint32_t u32; /**< used if kind == DDS_STAT_KIND_UINT32 */ + uint64_t u64; /**< used if kind == DDS_STAT_KIND_UINT64 */ + uint64_t lengthtime; /**< used if kind == DDS_STAT_KIND_LENGTHTIME */ + } u; /**< value */ +}; + +/** + * @brief Statistics container + * @ingroup statistics + */ +struct dds_statistics { + dds_entity_t entity; /**< handle of entity to which this set of values applies */ + uint64_t opaque; /**< internal data */ + dds_time_t time; /**< time stamp of latest call to dds_refresh_statistics() */ + size_t count; /**< number of key-value pairs */ + struct dds_stat_keyvalue kv[]; /**< data */ +}; + +/** + * @brief Allocate a new statistics object for entity + * @ingroup statistics + * + * This allocates and populates a newly allocated `struct dds_statistics` for the + * specified entity. + * + * @param[in] entity the handle of the entity + * + * @returns a newly allocated and populated statistics structure or NULL if entity is + * invalid or doesn't support any statistics. + */ +DDS_EXPORT struct dds_statistics *dds_create_statistics (dds_entity_t entity); + +/** + * @brief Update a previously created statistics structure with current values + * @ingroup statistics + * + * Only the time stamp and the values (and "opaque") may change. The set of keys and the + * types of the values do not change. + * + * @param[in,out] stat statistics structure to update the values of + * + * @returns success or an error indication + * + * @retval DDS_RETCODE_OK + * the data was successfully updated + * @retval DDS_RETCODE_BAD_PARAMETER + * stats is a null pointer or the referenced entity no longer exists + * @retval DDS_RETCODE_PRECONDITION_NOT_MET + * library was deinitialized + */ +DDS_EXPORT dds_return_t dds_refresh_statistics (struct dds_statistics *stat); + +/** + * @brief Free a previously created statistics object + * @ingroup statistics + * + * This frees the statistics object. Passing a null pointer is a no-op. The operation + * succeeds also if the referenced entity no longer exists. + * + * @param[in] stat statistics object to free + */ +DDS_EXPORT void dds_delete_statistics (struct dds_statistics *stat); + +/** + * @brief Lookup a specific value by name + * @ingroup statistics + * + * This looks up the specified name in the list of keys in `stat` and returns the address + * of the key-value pair if present, a null pointer if not. If `stat` is a null pointer, + * it returns a null pointer. + * + * @param[in] stat statistics object to lookup a name in (or NULL) + * @param[in] name name to look for + * + * @returns The address of the key-value pair inside `stat`, or NULL if `stat` is NULL or + * `name` does not match a key in `stat. + */ +DDS_EXPORT const struct dds_stat_keyvalue *dds_lookup_statistic (const struct dds_statistics *stat, const char *name) + ddsrt_nonnull ((2)); + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_acknack.h b/unitree_SDK/include/dds/ddsi/ddsi_acknack.h new file mode 100644 index 0000000..2f3025a --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_acknack.h @@ -0,0 +1,43 @@ +/* + * Copyright(c) 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_ACKNACK_H +#define DDSI_ACKNACK_H + +#include +#include + +#include "dds/ddsrt/time.h" +#include "dds/ddsi/q_xevent.h" +#include "dds/ddsi/ddsi_entity.h" +#include "dds/ddsi/q_protocol.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +enum add_AckNack_result { + AANR_SUPPRESSED_ACK, //!< sending nothing: too short a time since the last ACK + AANR_ACK, //!< sending an ACK and there's nothing to NACK + AANR_SUPPRESSED_NACK, //!< sending an ACK even though there are things to NACK + AANR_NACK, //!< sending a NACK, possibly also a NACKFRAG + AANR_NACKFRAG_ONLY //!< sending only a NACKFRAG +}; + +void sched_acknack_if_needed (struct xevent *ev, struct ddsi_proxy_writer *pwr, struct ddsi_pwr_rd_match *rwn, ddsrt_mtime_t tnow, bool avoid_suppressed_nack); + +struct nn_xmsg *make_and_resched_acknack (struct xevent *ev, struct ddsi_proxy_writer *pwr, struct ddsi_pwr_rd_match *rwn, ddsrt_mtime_t tnow, bool avoid_suppressed_nack); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_ACKNACK_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_builtin_topic_if.h b/unitree_SDK/include/dds/ddsi/ddsi_builtin_topic_if.h new file mode 100644 index 0000000..da5ecba --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_builtin_topic_if.h @@ -0,0 +1,57 @@ +/* + * Copyright(c) 2019 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef _DDSI_BUILTIN_TOPIC_IF_H_ +#define _DDSI_BUILTIN_TOPIC_IF_H_ + +#include "dds/ddsi/ddsi_vendor.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_entity_common; +struct ddsi_tkmap_instance; +struct ddsi_sertype; +struct ddsi_guid; +struct ddsi_topic_definition; + +struct ddsi_builtin_topic_interface { + void *arg; + + bool (*builtintopic_is_builtintopic) (const struct ddsi_sertype *type, void *arg); + bool (*builtintopic_is_visible) (const struct ddsi_guid *guid, nn_vendorid_t vendorid, void *arg); + struct ddsi_tkmap_instance * (*builtintopic_get_tkmap_entry) (const struct ddsi_guid *guid, void *arg); + void (*builtintopic_write_endpoint) (const struct ddsi_entity_common *e, ddsrt_wctime_t timestamp, bool alive, void *arg); + void (*builtintopic_write_topic) (const struct ddsi_topic_definition *tpd, ddsrt_wctime_t timestamp, bool alive, void *arg); +}; + +DDS_INLINE_EXPORT inline bool builtintopic_is_visible (const struct ddsi_builtin_topic_interface *btif, const struct ddsi_guid *guid, nn_vendorid_t vendorid) { + return btif ? btif->builtintopic_is_visible (guid, vendorid, btif->arg) : false; +} +DDS_INLINE_EXPORT inline bool builtintopic_is_builtintopic (const struct ddsi_builtin_topic_interface *btif, const struct ddsi_sertype *type) { + return btif ? btif->builtintopic_is_builtintopic (type, btif->arg) : false; +} +DDS_INLINE_EXPORT inline struct ddsi_tkmap_instance *builtintopic_get_tkmap_entry (const struct ddsi_builtin_topic_interface *btif, const struct ddsi_guid *guid) { + return btif ? btif->builtintopic_get_tkmap_entry (guid, btif->arg) : NULL; +} +DDS_INLINE_EXPORT inline void builtintopic_write_endpoint (const struct ddsi_builtin_topic_interface *btif, const struct ddsi_entity_common *e, ddsrt_wctime_t timestamp, bool alive) { + if (btif) btif->builtintopic_write_endpoint (e, timestamp, alive, btif->arg); +} +DDS_INLINE_EXPORT inline void builtintopic_write_topic (const struct ddsi_builtin_topic_interface *btif, const struct ddsi_topic_definition *tpd, ddsrt_wctime_t timestamp, bool alive) { + if (btif) btif->builtintopic_write_topic (tpd, timestamp, alive, btif->arg); +} + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_cdrstream.h b/unitree_SDK/include/dds/ddsi/ddsi_cdrstream.h new file mode 100644 index 0000000..1ad00bb --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_cdrstream.h @@ -0,0 +1,101 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_CDRSTREAM_H +#define DDSI_CDRSTREAM_H + +#include "dds/ddsrt/static_assert.h" +#include "dds/ddsi/ddsi_serdata.h" +#include "dds/ddsi/ddsi_serdata_default.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#define DDSI_CDRSTREAM_MAX_NESTING_DEPTH 32 /* maximum level of nesting for key extraction */ + +typedef struct dds_istream { + const unsigned char *m_buffer; + uint32_t m_size; /* Buffer size */ + uint32_t m_index; /* Read/write offset from start of buffer */ + uint32_t m_xcdr_version; /* XCDR version of the data */ +} dds_istream_t; + +typedef struct dds_ostream { + unsigned char *m_buffer; + uint32_t m_size; /* Buffer size */ + uint32_t m_index; /* Read/write offset from start of buffer */ + uint32_t m_xcdr_version; /* XCDR version to use for serializing data */ +} dds_ostream_t; + +typedef struct dds_ostreamBE { + dds_ostream_t x; +} dds_ostreamBE_t; + +typedef struct dds_ostreamLE { + dds_ostream_t x; +} dds_ostreamLE_t; + +DDSRT_STATIC_ASSERT (offsetof (dds_ostreamLE_t, x) == 0); +DDSRT_STATIC_ASSERT (offsetof (dds_ostreamBE_t, x) == 0); + +DDS_EXPORT void dds_istream_init (dds_istream_t * __restrict st, uint32_t size, const void * __restrict input, uint32_t xcdr_version); +DDS_EXPORT void dds_istream_fini (dds_istream_t * __restrict st); +DDS_EXPORT void dds_ostream_init (dds_ostream_t * __restrict st, uint32_t size, uint32_t xcdr_version); +DDS_EXPORT void dds_ostream_fini (dds_ostream_t * __restrict st); +DDS_EXPORT void dds_ostreamLE_init (dds_ostreamLE_t * __restrict st, uint32_t size, uint32_t xcdr_version); +DDS_EXPORT void dds_ostreamLE_fini (dds_ostreamLE_t * __restrict st); +DDS_EXPORT void dds_ostreamBE_init (dds_ostreamBE_t * __restrict st, uint32_t size, uint32_t xcdr_version); +DDS_EXPORT void dds_ostreamBE_fini (dds_ostreamBE_t * __restrict st); + +// *actual_size is set to the actual size of the data (*actual_size <= size) on successful return +DDS_EXPORT bool dds_stream_normalize (void * __restrict data, uint32_t size, bool bswap, uint32_t xcdr_version, const struct ddsi_sertype_default * __restrict type, bool just_key, uint32_t * __restrict actual_size) ddsrt_attribute_warn_unused_result ddsrt_nonnull_all; +DDS_EXPORT const uint32_t *dds_stream_normalize_data (char * __restrict data, uint32_t * __restrict off, uint32_t size, bool bswap, uint32_t xcdr_version, const uint32_t * __restrict ops) ddsrt_attribute_warn_unused_result ddsrt_nonnull_all; + +DDS_EXPORT const uint32_t *dds_stream_write (dds_ostream_t * __restrict os, const char * __restrict data, const uint32_t * __restrict ops); +DDS_EXPORT const uint32_t *dds_stream_writeLE (dds_ostreamLE_t * __restrict os, const char * __restrict data, const uint32_t * __restrict ops); +DDS_EXPORT const uint32_t *dds_stream_writeBE (dds_ostreamBE_t * __restrict os, const char * __restrict data, const uint32_t * __restrict ops); +DDS_EXPORT const uint32_t * dds_stream_write_with_byte_order (dds_ostream_t * __restrict os, const char * __restrict data, const uint32_t * __restrict ops, enum ddsrt_byte_order_selector bo); +DDS_EXPORT bool dds_stream_write_sample (dds_ostream_t * __restrict os, const void * __restrict data, const struct ddsi_sertype_default * __restrict type); +DDS_EXPORT bool dds_stream_write_sampleLE (dds_ostreamLE_t * __restrict os, const void * __restrict data, const struct ddsi_sertype_default * __restrict type); +DDS_EXPORT bool dds_stream_write_sampleBE (dds_ostreamBE_t * __restrict os, const void * __restrict data, const struct ddsi_sertype_default * __restrict type); +DDS_EXPORT void dds_stream_read_sample (dds_istream_t * __restrict is, void * __restrict data, const struct ddsi_sertype_default * __restrict type); +DDS_EXPORT void dds_stream_free_sample (void * __restrict data, const uint32_t * __restrict ops); + +DDS_EXPORT uint32_t dds_stream_countops (const uint32_t * __restrict ops, uint32_t nkeys, const dds_key_descriptor_t * __restrict keys); +DDS_EXPORT size_t dds_stream_check_optimize (const struct ddsi_sertype_default_desc * __restrict desc, uint32_t xcdr_version); +DDS_EXPORT void dds_istream_from_serdata_default (dds_istream_t * __restrict s, const struct ddsi_serdata_default * __restrict d); +DDS_EXPORT void dds_ostream_from_serdata_default (dds_ostream_t * __restrict s, const struct ddsi_serdata_default * __restrict d); +DDS_EXPORT void dds_ostream_add_to_serdata_default (dds_ostream_t * __restrict s, struct ddsi_serdata_default ** __restrict d); + +DDS_EXPORT void dds_stream_write_key (dds_ostream_t * __restrict os, const char * __restrict sample, const struct ddsi_sertype_default * __restrict type); +DDS_EXPORT void dds_stream_write_keyBE (dds_ostreamBE_t * __restrict os, const char * __restrict sample, const struct ddsi_sertype_default * __restrict type); +DDS_EXPORT bool dds_stream_extract_key_from_data (dds_istream_t * __restrict is, dds_ostream_t * __restrict os, const struct ddsi_sertype_default * __restrict type); +DDS_EXPORT void dds_stream_extract_key_from_key (dds_istream_t * __restrict is, dds_ostream_t * __restrict os, const struct ddsi_sertype_default * __restrict type); +DDS_EXPORT bool dds_stream_extract_keyBE_from_data (dds_istream_t * __restrict is, dds_ostreamBE_t * __restrict os, const struct ddsi_sertype_default * __restrict type); +DDS_EXPORT void dds_stream_extract_keyBE_from_key (dds_istream_t * __restrict is, dds_ostreamBE_t * __restrict os, const struct ddsi_sertype_default * __restrict type); + +DDS_EXPORT const uint32_t *dds_stream_read (dds_istream_t * __restrict is, char * __restrict data, const uint32_t * __restrict ops); +DDS_EXPORT void dds_stream_read_key (dds_istream_t * __restrict is, char * __restrict sample, const struct ddsi_sertype_default * __restrict type); + +DDS_EXPORT size_t dds_stream_print_key (dds_istream_t * __restrict is, const struct ddsi_sertype_default * __restrict type, char * __restrict buf, size_t size); + +DDS_EXPORT size_t dds_stream_print_sample (dds_istream_t * __restrict is, const struct ddsi_sertype_default * __restrict type, char * __restrict buf, size_t size); + +DDS_EXPORT uint16_t dds_stream_minimum_xcdr_version (const uint32_t * __restrict ops); +DDS_EXPORT uint32_t dds_stream_type_nesting_depth (const uint32_t * __restrict ops); +DDS_EXPORT bool dds_stream_extensibility (const uint32_t * __restrict ops, enum ddsi_sertype_extensibility *ext); + + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_cfgelems.h b/unitree_SDK/include/dds/ddsi/ddsi_cfgelems.h new file mode 100644 index 0000000..3cb2f8b --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_cfgelems.h @@ -0,0 +1,2253 @@ +/* + * Copyright(c) 2020 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_CFGELEMS_H +#define DDSI_CFGELEMS_H + +#include "dds/features.h" + + +static struct cfgelem network_interface_attributes[] = { + STRING("autodetermine", NULL, 1, "false", + MEMBEROF(ddsi_config_network_interface_listelem, cfg.automatic), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

If set to \"true\" an interface is automatically selected. Specifying " + "a name or an address when automatic is set is considered an error.

" + )), + STRING("name", NULL, 1, "", + MEMBEROF(ddsi_config_network_interface_listelem, cfg.name), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This attribute specifies the name of the interface.

" + )), + STRING("address", NULL, 1, "", + MEMBEROF(ddsi_config_network_interface_listelem, cfg.address), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This attribute specifies the address of the interface. With ipv4 allows " + " matching on network part if host part is set to zero.

" + )), + STRING("priority", NULL, 1, "default", + MEMBEROF(ddsi_config_network_interface_listelem, cfg.priority), + FUNCTIONS(0, uf_maybe_int32, 0, pf_maybe_int32), + DESCRIPTION( + "

This attribute specifies the interface priority (decimal integer or " + "default). The default value for loopback interfaces is 2, for all " + "other interfaces it is 0.

" + )), + BOOL("prefer_multicast", NULL, 1, "false", + MEMBEROF(ddsi_config_network_interface_listelem, cfg.prefer_multicast), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

When false (default) Cyclone DDS uses unicast for data whenever " + "there a single unicast suffices. Setting this to true makes it prefer " + "multicasting data, falling back to unicast only when no multicast " + "is available.

" + )), + BOOL("presence_required", NULL, 1, "true", + MEMBEROF(ddsi_config_network_interface_listelem, cfg.presence_required), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

By default all specified network interfaces must be present, if they " + "are missing Cyclone will refuse to start. By explicitly setting this setting " + "for an interface you can instruct Cyclone to simply ignore that interface if " + "it is not present.

" + )), + STRING("multicast", NULL, 1, "default", + MEMBEROF(ddsi_config_network_interface_listelem, cfg.multicast), + FUNCTIONS(0, uf_boolean_default, 0, pf_boolean_default), + DESCRIPTION( + "

This attribute specifies the whether the interface should use multicast. " + "On its default setting 'default' it will use the value as return by the operating " + "system. If set to 'true' the interface will be assumed to be multicast capable " + "even when the interface flags returned by the operating system state it is not " + "(this provides a workaround for some platforms). If set to 'false' the interface " + "will never be used for multicast.") + ), + END_MARKER +}; + + +static struct cfgelem interfaces_cfgelems[] = { + GROUP("NetworkInterface", NULL, network_interface_attributes, INT_MAX, + MEMBER(network_interfaces), + FUNCTIONS(if_network_interfaces, 0, 0, 0), + DESCRIPTION( + "

This element defines a network interface. You can set autodetermine=\"true\" " + "to autoselect the interface CycloneDDS deems to be the highest quality. If " + "autodetermine=\"false\" (the default), you must specify the name and/or address " + "attribute. If you specify both they must match the same interface.

")), + END_MARKER +}; + +static struct cfgelem entity_autonaming_attributes[] = { + STRING("seed", NULL, 1, "", + MEMBER(entity_naming_seed), + FUNCTIONS(0, uf_random_seed, 0, pf_random_seed), + DESCRIPTION( + "

Provide an initial seed for the entity naming. Your string will be " + "hashed to provided the random state. When provided the same sequence of " + "names is generated every run. If you create your entities in the same " + "order this will ensure they are the same between runs. If you run multiple " + "nodes set this via environment variable to ensure every node generates " + "unique names. When left empty (the default) a random starting seed is " + "chosen.

" + )), + END_MARKER +}; + + +static struct cfgelem general_cfgelems[] = { + STRING("MulticastRecvNetworkInterfaceAddresses", NULL, 1, "preferred", + MEMBER(networkRecvAddressStrings), + FUNCTIONS(0, uf_networkAddresses, ff_networkAddresses, pf_networkAddresses), + DESCRIPTION( + "

This element specifies on which network interfaces Cyclone DDS " + "listens to multicasts. The following options are available:

\n" + "
    \n" + "
  • all: " + "listen for multicasts on all multicast-capable interfaces; or" + "
  • \n" + "
  • any: " + "listen for multicasts on the operating system default interface; or" + "
  • \n" + "
  • preferred: " + "listen for multicasts on the preferred interface " + "(General/Interface/NetworkInterface with highest priority); or" + "
  • \n" + "
  • none: " + "does not listen for multicasts on any interface; or" + "
  • \n" + "
  • a comma-separated list of network addresses: configures Cyclone DDS to " + "listen for multicasts on all of the listed addresses." + "
  • \n" + "
\n" + "

If Cyclone DDS is in IPv6 mode and the address of the preferred network " + "interface is a link-local address, \"all\" is treated as a synonym for " + "\"preferred\" and a comma-separated list is treated as \"preferred\" " + "if it contains the preferred interface and as \"none\" if not.

" + )), + GROUP("Interfaces", interfaces_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

This element specifies the network interfaces for use by Cyclone " + "DDS. Multiple interfaces can be specified with an assigned priority. " + "The list in use will be sorted by priority. If interfaces have an " + "equal priority the specification order will be preserved.

" + )), + STRING(DEPRECATED("NetworkInterfaceAddress"), NULL, 1, "auto", + MEMBER(depr_networkAddressString), + FUNCTIONS(0, uf_networkAddress, ff_free, pf_networkAddress), + DESCRIPTION( + "

This configuration option is deprecated. Use General/Interfaces " + " instead. " + " This element specifies the preferred network interface for use by " + "Cyclone DDS. The preferred network interface determines the IP address " + "that Cyclone DDS advertises in the discovery protocol (but see also " + "General/ExternalNetworkAddress), and is also the only interface over " + "which multicasts are transmitted. The interface can be identified by " + "its IP address, network interface name or network portion of the " + "address. If the value \"auto\" is entered here, Cyclone DDS will " + "select what it considers the most suitable interface.

" + )), + STRING("ExternalNetworkAddress", NULL, 1, "auto", + MEMBER(externalAddressString), + FUNCTIONS(0, uf_networkAddress, ff_free, pf_networkAddress), + DESCRIPTION( + "

This element allows explicitly overruling the network address " + "Cyclone DDS advertises in the discovery protocol, which by default is " + "the address of the preferred network interface " + "(General/NetworkInterfaceAddress), to allow Cyclone DDS to communicate " + "across a Network Address Translation (NAT) device.

")), + STRING("ExternalNetworkMask", NULL, 1, "0.0.0.0", + MEMBER(externalMaskString), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This element specifies the network mask of the external network " + "address. This element is relevant only when an external network " + "address (General/ExternalNetworkAddress) is explicitly configured. In " + "this case locators received via the discovery protocol that are " + "within the same external subnet (as defined by this mask) will be " + "translated to an internal address by replacing the network portion of " + "the external address with the corresponding portion of the preferred " + "network interface address. This option is IPv4-only.

")), + LIST("AllowMulticast", NULL, 1, "default", + MEMBER(allowMulticast), + FUNCTIONS(0, uf_allow_multicast, 0, pf_allow_multicast), + DESCRIPTION( + "

This element controls whether Cyclone DDS uses multicasts for data " + "traffic.

\n" + "

It is a comma-separated list of some of the following keywords: " + "\"spdp\", \"asm\", \"ssm\", or either of \"false\" or \"true\", or " + "\"default\".

\n" + "
    \n" + "
  • spdp: " + "enables the use of ASM (any-source multicast) for participant " + "discovery, joining the multicast group on the discovery socket, " + "transmitting SPDP messages to this group, but never advertising nor " + "using any multicast address in any discovery message, thus forcing " + "unicast communications for all endpoint discovery and user data." + "
  • \n" + "
  • asm: " + "enables the use of ASM for all traffic, including receiving SPDP but " + "not transmitting SPDP messages via multicast" + "
  • \n" + "
  • ssm: " + "enables the use of SSM (source-specific multicast) for all non-SPDP " + "traffic (if supported)" + "
  • \n" + "
\n" + "

When set to \"false\" all multicasting is disabled. The default, " + "\"true\" enables full use of multicasts. Listening for multicasts can " + "be controlled by General/MulticastRecvNetworkInterfaceAddresses.

\n" + "

\"default\" maps on spdp if the network is a WiFi network, on true " + "if it is a wired network

"), + VALUES("false","spdp","asm","ssm","true")), + BOOL(DEPRECATED("PreferMulticast"), NULL, 1, "false", + MEMBER(depr_prefer_multicast), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

Deprecated, use Interfaces/NetworkInterface[@multicast_cost] instead. " + "When false (default) Cyclone DDS uses unicast for data whenever " + "there a single unicast suffices. Setting this to true makes it prefer " + "multicasting data, falling back to unicast only when no multicast " + "address is available.

")), + INT("MulticastTimeToLive", NULL, 1, "32", + MEMBER(multicast_ttl), + FUNCTIONS(0, uf_natint_255, 0, pf_int), + DESCRIPTION( + "

This element specifies the time-to-live setting for outgoing " + "multicast packets.

"), + RANGE("0;255")), + BOOL("DontRoute", NULL, 1, "false", + MEMBER(dontRoute), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element allows setting the SO_DONTROUTE option for outgoing " + "packets, to bypass the local routing tables. This is generally useful " + "only when the routing tables cannot be trusted, which is highly " + "unusual.

")), + ENUM("UseIPv6", NULL, 1, "default", + MEMBER(compat_use_ipv6), + FUNCTIONS(0, uf_boolean_default, 0, pf_nop), + DESCRIPTION("

Deprecated (use Transport instead)

"), + VALUES("false","true","default")), + ENUM("Transport", NULL, 1, "default", + MEMBER(transport_selector), + FUNCTIONS(0, uf_transport_selector, 0, pf_transport_selector), + DESCRIPTION( + "

This element allows selecting the transport to be used (udp, udp6, " + "tcp, tcp6, raweth)

"), + VALUES("default","udp","udp6","tcp","tcp6","raweth")), + BOOL("EnableMulticastLoopback", NULL, 1, "true", + MEMBER(enableMulticastLoopback), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element specifies whether Cyclone DDS allows IP multicast " + "packets to be visible to all DDSI participants in the same node, " + "including itself. It must be \"true\" for intra-node multicast " + "communications, but if a node runs only a single Cyclone DDS service " + "and does not host any other DDSI-capable programs, it should be set " + "to \"false\" for improved performance.

")), + STRING("MaxMessageSize", NULL, 1, "14720 B", + MEMBER(max_msg_size), + FUNCTIONS(0, uf_memsize, 0, pf_memsize), + DESCRIPTION( + "

This element specifies the maximum size of the UDP payload that " + "Cyclone DDS will generate. Cyclone DDS will try to maintain this limit within " + "the bounds of the DDSI specification, which means that in some cases " + "(especially for very low values of MaxMessageSize) larger payloads " + "may sporadically be observed (currently up to 1192 B).

\n" + "

On some networks it may be necessary to set this item to keep the " + "packetsize below the MTU to prevent IP fragmentation.

"), + UNIT("memsize")), + STRING("MaxRexmitMessageSize", NULL, 1, "1456 B", + MEMBER(max_rexmit_msg_size), + FUNCTIONS(0, uf_memsize, 0, pf_memsize), + DESCRIPTION( + "

This element specifies the maximum size of the UDP payload that " + "Cyclone DDS will generate for a retransmit. Cyclone DDS will try to " + "maintain this limit within the bounds of the DDSI specification, which " + "means that in some cases (especially for very low values) larger payloads " + "may sporadically be observed (currently up to 1192 B).

\n" + "

On some networks it may be necessary to set this item to keep the " + "packetsize below the MTU to prevent IP fragmentation.

"), + UNIT("memsize")), + STRING("FragmentSize", NULL, 1, "1344 B", + MEMBER(fragment_size), + FUNCTIONS(0, uf_memsize16, 0, pf_memsize16), + DESCRIPTION( + "

This element specifies the size of DDSI sample fragments generated " + "by Cyclone DDS. Samples larger than FragmentSize are fragmented into " + "fragments of FragmentSize bytes each, except the last one, which may " + "be smaller. The DDSI spec mandates a minimum fragment size of 1025 " + "bytes, but Cyclone DDS will do whatever size is requested, accepting " + "fragments of which the size is at least the minimum of 1025 and " + "FragmentSize.

"), + UNIT("memsize")), + BOOL("RedundantNetworking", NULL, 1, "false", + MEMBER(redundant_networking), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

When enabled, use selected network interfaces in parallel for " + "redundancy.

")), + ENUM("EntityAutoNaming", entity_autonaming_attributes, 1, "empty", + MEMBER(entity_naming_mode), + FUNCTIONS(0, uf_entity_naming_mode, 0, pf_entity_naming_mode), + DESCRIPTION( + "

This element specifies the entity autonaming mode. By default set " + "to 'empty' which means no name will be set (but you can still use " + "dds_qset_entity_name). When set to 'fancy' participants, publishers, " + "subscribers, writers and readers will get randomly generated names. " + "An autonamed entity will share a 3-letter prefix with their parent " + "entity.

"), + VALUES("empty","fancy")), + END_MARKER +}; + +#ifdef DDS_HAS_SECURITY +static struct cfgelem authentication_library_attributes[] = { + STRING("path", NULL, 1, "dds_security_auth", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.authentication_plugin.library_path), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This element points to the path of Authentication plugin library.

\n" + "

It can be either absolute path excluding file extension " + "( /usr/lib/dds_security_auth ) or single file without extension " + "( dds_security_auth ).

\n" + "

If single file is supplied, the library located by way of the " + "current working directory, or LD_LIBRARY_PATH for Unix systems, and " + "PATH for Windows system.

" + )), + STRING("initFunction", NULL, 1, "init_authentication", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.authentication_plugin.library_init), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This element names the initialization function of Authentication " + "plugin. This function is called after loading the plugin library for " + "instantiation purposes. Init function must return an object that " + "implements DDS Security Authentication interface.

" + )), + STRING("finalizeFunction", NULL, 1, "finalize_authentication", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.authentication_plugin.library_finalize), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This element names the finalization function of Authentication " + "plugin. This function is called to let the plugin release its " + "resources.

" + )), + END_MARKER +}; + +static struct cfgelem access_control_library_attributes[] = { + STRING("path", NULL, 1, "dds_security_ac", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.access_control_plugin.library_path), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This element points to the path of Access Control plugin library.

\n" + "

It can be either absolute path excluding file extension " + "( /usr/lib/dds_security_ac ) or single file without extension " + "( dds_security_ac ).

\n" + "

If single file is supplied, the library located by way of the " + "current working directory, or LD_LIBRARY_PATH for Unix systems, and " + "PATH for Windows systems.

" + )), + STRING("initFunction", NULL, 1, "init_access_control", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.access_control_plugin.library_init), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This element names the initialization function of Access Control " + "plugin. This function is called after loading the plugin library for " + "instantiation purposes. Init function must return an object that " + "implements DDS Security Access Control interface.

" + )), + STRING("finalizeFunction", NULL, 1, "finalize_access_control", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.access_control_plugin.library_finalize), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This element names the finalization function of Access Control " + "plugin. This function is called to let the plugin release its " + "resources.

" + )), + END_MARKER +}; + +static struct cfgelem cryptography_library_attributes[] = { + STRING("path", NULL, 1, "dds_security_crypto", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.cryptography_plugin.library_path), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This element points to the path of Cryptographic plugin library.

\n" + "

It can be either absolute path excluding file extension " + "( /usr/lib/dds_security_crypto ) or single file without extension " + "( dds_security_crypto ).

\n" + "

If single file is supplied, the library located by way of the " + "current working directory, or LD_LIBRARY_PATH for Unix systems, and " + "PATH for Windows systems.

" + )), + STRING("initFunction", NULL, 1, "init_crypto", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.cryptography_plugin.library_init), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This element names the initialization function of Cryptographic " + "plugin. This function is called after loading the plugin library for " + "instantiation purposes. Init function must return an object that " + "implements DDS Security Cryptographic interface.

" + )), + STRING("finalizeFunction", NULL, 1, "finalize_crypto", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.cryptography_plugin.library_finalize), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This element names the finalization function of Cryptographic " + "plugin. This function is called to let the plugin release its " + "resources.

" + )), + END_MARKER +}; + +static struct cfgelem authentication_config_elements[] = { + STRING("Library", authentication_library_attributes, 1, "", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.authentication_plugin), + FUNCTIONS(0, 0, 0, pf_string), + DESCRIPTION( + "

This element specifies the library to be loaded as the DDS " + "Security Access Control plugin.

" + )), + STRING("IdentityCertificate", NULL, 1, NULL, + MEMBEROF(ddsi_config_omg_security_listelem, cfg.authentication_properties.identity_certificate), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

Identity certificate that will be used for identifying all " + "participants in the OSPL instance.
The content is URI to a X509 " + "certificate signed by the IdentityCA in PEM format containing the " + "signed public key.

\n" + "

Supported URI schemes: file, data

\n" + "

Examples:

\n" + "

file:participant1_identity_cert.pem

\n" + "

data:,-----BEGIN CERTIFICATE-----
\n" + "MIIDjjCCAnYCCQDCEu9...6rmT87dhTo=
\n" + "-----END CERTIFICATE-----

" + )), + STRING("IdentityCA", NULL, 1, NULL, + MEMBEROF(ddsi_config_omg_security_listelem, cfg.authentication_properties.identity_ca), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

URI to the X509 certificate [39] of the Identity CA that is the " + "signer of Identity Certificate.

\n" + "

Supported URI schemes: file, data

\n" + "

The file and data schemas shall refer to a X.509 v3 certificate " + "(see X.509 v3 ITU-T Recommendation X.509 (2005) [39]) in PEM format.

\n" + "

Examples:

\n" + "

file:identity_ca.pem

\n" + "

data:,-----BEGIN CERTIFICATE-----
\n" + "MIIC3DCCAcQCCQCWE5x+Z...PhovK0mp2ohhRLYI0ZiyYQ==
\n" + "-----END CERTIFICATE-----

" + )), + STRING("PrivateKey", NULL, 1, NULL, + MEMBEROF(ddsi_config_omg_security_listelem, cfg.authentication_properties.private_key), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

URI to access the private Private Key for all of the participants " + "in the OSPL federation.

\n" + "

Supported URI schemes: file, data

\n" + "

Examples:

\n" + "

file:identity_ca_private_key.pem

\n" + "

data:,-----BEGIN RSA PRIVATE KEY-----
\n" + "MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg==
\n" + "-----END RSA PRIVATE KEY-----

" + )), + STRING("Password", NULL, 1, "", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.authentication_properties.password), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

A password used to decrypt the private_key.

\n" + "

The value of the password property shall be interpreted as the " + "Base64 encoding of the AES-128 key that shall be used to decrypt the " + "private_key using AES128-CBC.

\n" + "

If the password property is not present, then the value supplied in " + "the private_key property must contain the unencrypted private key.

" + )), + STRING("TrustedCADirectory", NULL, 1, "", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.authentication_properties.trusted_ca_dir), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

Trusted CA Directory which contains trusted CA certificates as " + "separated files.

" + )), + STRING("CRL", NULL, 1, "", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.authentication_properties.crl), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

Optional URI to load an X509 Certificate Revocation List

\n" + "

Supported URI schemes: file, data

\n" + "

Examples:

\n" + "

file:crl.pem

\n" + "

data:,-----BEGIN X509 CRL-----
\n" + "MIIEpAIBAAKCAQEA3HIh...AOBaaqSV37XBUJg=
\n" + "-----END X509 CRL-----

" + )), + BOOL("IncludeOptionalFields", NULL, 1, "false", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.authentication_properties.include_optional_fields), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

The authentication handshake tokens may contain optional fields to " + "be included for finding interoperability problems. If this parameter " + "is set to true the optional fields are included in the handshake token " + "exchange.

" + )), + END_MARKER +}; + +static struct cfgelem access_control_config_elements[] = { + STRING("Library", access_control_library_attributes, 1, "", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.access_control_plugin), + FUNCTIONS(0, 0, 0, pf_string), + DESCRIPTION( + "

This element specifies the library to be loaded as the " + "DDS Security Access Control plugin.

" + )), + STRING("PermissionsCA", NULL, 1, "", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.access_control_properties.permissions_ca), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

URI to a X509 certificate for the PermissionsCA in PEM format.

\n" + "

Supported URI schemes: file, data

\n" + "

The file and data schemas shall refer to a X.509 v3 certificate " + "(see X.509 v3 ITU-T Recommendation X.509 (2005) [39]) in PEM format.


\n" + "

Examples:


\n" + "

file:permissions_ca.pem

\n" + "

file:/home/myuser/permissions_ca.pem


\n" + "

data:,-----BEGIN CERTIFICATE-----

\n" + "

MIIC3DCCAcQCCQCWE5x+Z ... PhovK0mp2ohhRLYI0ZiyYQ==

\n" + "

-----END CERTIFICATE-----

" + )), + STRING("Governance", NULL, 1, "", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.access_control_properties.governance), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

URI to the shared Governance Document signed by the Permissions CA in S/MIME format

\n" + "

URI schemes: file, data


\n" + "

Examples file URIs:

\n" + "

file:governance.smime

\n" + "

file:/home/myuser/governance.smime


\n" + "

\n" + "

Content-Type: multipart/signed; protocol=\"application/x-pkcs7-signature\"; micalg=\"sha-256\"; boundary=\"----F9A8A198D6F08E1285A292ADF14DD04F\"

\n" + "

This is an S/MIME signed message

\n" + "

------F9A8A198D6F08E1285A292ADF14DD04F

\n" + "

\n" + "

\n" + "

xsi:noNamespaceSchemaLocation=\"omg_shared_ca_governance.xsd\">

\n" + "

\n" + "

. . .

\n" + "

\n" + "

\n" + "

...

\n" + "

------F9A8A198D6F08E1285A292ADF14DD04F

\n" + "

Content-Type: application/x-pkcs7-signature; name=\"smime.p7s\"

\n" + "

Content-Transfer-Encoding: base64

\n" + "

Content-Disposition: attachment; filename=\"smime.p7s\"

\n" + "

MIIDuAYJKoZIhv ...al5s=

\n" + "

------F9A8A198D6F08E1285A292ADF14DD04F-]]

" + )), + STRING("Permissions", NULL, 1, "", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.access_control_properties.permissions), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

URI to the DomainParticipant permissions document signed by the " + "Permissions CA in S/MIME format

\n" + "

The permissions document specifies the permissions to be applied to a domain.


\n" + "

Example file URIs:

\n" + "

file:permissions_document.p7s

\n" + "

file:/path_to/permissions_document.p7s

\n" + "

Example data URI:

\n" + "

" + )), + END_MARKER +}; + +static struct cfgelem cryptography_config_elements[] = { + STRING("Library", cryptography_library_attributes, 1, "", + MEMBEROF(ddsi_config_omg_security_listelem, cfg.cryptography_plugin), + FUNCTIONS(0, 0, 0, pf_string), + DESCRIPTION( + "

This element specifies the library to be loaded as the DDS Security Cryptographic plugin.

" + )), + END_MARKER +}; + +static struct cfgelem security_omg_config_elements[] = { + GROUP("Authentication", authentication_config_elements, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

This element configures the Authentication plugin of the DDS Security specification.

" + )), + GROUP("AccessControl", access_control_config_elements, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

This element configures the Access Control plugin of the DDS Security specification.

" + )), + GROUP("Cryptographic", cryptography_config_elements, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

This element configures the Cryptographic plugin of the DDS Security specification.

" + )), + END_MARKER +}; +#endif /* DDS_HAS_SECURITY */ + +#ifdef DDS_HAS_NETWORK_PARTITIONS +static struct cfgelem networkpartition_cfgattrs[] = { + STRING("Name", NULL, 1, NULL, + MEMBEROF(ddsi_config_networkpartition_listelem, name), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This attribute specifies the name of this Cyclone DDS network " + "partition. Two network partitions cannot have the same name.

")), + STRING("Address", NULL, 1, NULL, + MEMBEROF(ddsi_config_networkpartition_listelem, address_string), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This attribute specifies the multicast addresses associated with " + "the network partition as a comma-separated list. Readers matching " + "this network partition (cf. Partitioning/PartitionMappings) will " + "listen for multicasts on all of these addresses and advertise them " + "in the discovery protocol. The writers will select the most suitable " + "address from the addresses advertised by the readers.

")), + END_MARKER +}; + +static struct cfgelem networkpartitions_cfgelems[] = { + STRING("NetworkPartition", networkpartition_cfgattrs, INT_MAX, 0, + MEMBER(networkPartitions), + FUNCTIONS(if_network_partition, 0, 0, 0), + DESCRIPTION( + "

This element defines a Cyclone DDS network partition.

" + )), + END_MARKER +}; + +static struct cfgelem ignoredpartitions_cfgattrs[] = { + STRING("DCPSPartitionTopic", NULL, 1, NULL, + MEMBEROF(ddsi_config_ignoredpartition_listelem, DCPSPartitionTopic), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This attribute specifies a partition and a topic expression, " + "separated by a single '.', that are used to determine if a given " + "partition and topic will be ignored or not. The expressions may use " + "the usual wildcards '*' and '?'. Cyclone DDS will consider an wildcard " + "DCPS partition to match an expression iff there exists a string that " + "satisfies both expressions.

" + )), + END_MARKER +}; + +static struct cfgelem ignoredpartitions_cfgelems[] = { + STRING("IgnoredPartition", ignoredpartitions_cfgattrs, INT_MAX, 0, + MEMBER(ignoredPartitions), + FUNCTIONS(if_ignored_partition, 0, 0, 0), + DESCRIPTION( + "

This element can be used to prevent certain combinations of DCPS " + "partition and topic from being transmitted over the network. Cyclone DDS " + "will complete ignore readers and writers for which all DCPS " + "partitions as well as their topic is ignored, not even creating DDSI " + "readers and writers to mirror the DCPS ones.

" + )), + END_MARKER +}; + +static struct cfgelem partitionmappings_cfgattrs[] = { + STRING("NetworkPartition", NULL, 1, NULL, + MEMBEROF(ddsi_config_partitionmapping_listelem, networkPartition), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This attribute specifies which Cyclone DDS network partition is to be " + "used for DCPS partition/topic combinations matching the " + "DCPSPartitionTopic attribute within this PartitionMapping element.

" + )), + STRING("DCPSPartitionTopic", NULL, 1, NULL, + MEMBEROF(ddsi_config_partitionmapping_listelem, DCPSPartitionTopic), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This attribute specifies a partition and a topic expression, " + "separated by a single '.', that are used to determine if a given " + "partition and topic maps to the Cyclone DDS network partition named by the " + "NetworkPartition attribute in this PartitionMapping element. The " + "expressions may use the usual wildcards '*' and '?'. Cyclone DDS will " + "consider a wildcard DCPS partition to match an expression if there " + "exists a string that satisfies both expressions.

" + )), + END_MARKER +}; + +static struct cfgelem partitionmappings_cfgelems[] = { + STRING("PartitionMapping", partitionmappings_cfgattrs, INT_MAX, 0, + MEMBER(partitionMappings), + FUNCTIONS(if_partition_mapping, 0, 0, 0), + DESCRIPTION( + "

This element defines a mapping from a DCPS partition/topic " + "combination to a Cyclone DDS network partition. This allows partitioning " + "data flows by using special multicast addresses for part of the data " + "and possibly also encrypting the data flow.

" + )), + END_MARKER +}; + +static struct cfgelem partitioning_cfgelems[] = { + GROUP("NetworkPartitions", networkpartitions_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

The NetworkPartitions element specifies the Cyclone DDS network " + "partitions.

" + )), + GROUP("IgnoredPartitions", ignoredpartitions_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

The IgnoredPartitions element specifies DCPS partition/topic " + "combinations that are not distributed over the network.

" + )), + GROUP("PartitionMappings", partitionmappings_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

The PartitionMappings element specifies the mapping from DCPS " + "partition/topic combinations to Cyclone DDS network partitions.

" + )), + END_MARKER +}; +#endif /* DDS_HAS_NETWORK_PARTITIONS */ + +#ifdef DDS_HAS_NETWORK_CHANNELS +static struct cfgelem channel_cfgelems[] = { +#ifdef DDS_HAS_BANDWIDTH_LIMITING + STRING("DataBandwidthLimit", NULL, 1, "inf", + MEMBEROF(ddsi_config_channel_listelem, data_bandwidth_limit), + FUNCTIONS(0, uf_bandwidth, 0, pf_bandwidth), + DESCRIPTION( + "

This element specifies the maximum transmit rate of new samples " + "and directly related data, for this channel. Bandwidth limiting uses " + "a leaky bucket scheme. The default value \"inf\" means Cyclone DDS imposes " + "no limitation, the underlying operating system and hardware will " + "likely limit the maximum transmit rate.

") + BEHIND_FLAG("DDS_HAS_BANDWIDTH_LIMITING") + UNIT("bandwidth")), + STRING("AuxiliaryBandwidthLimit", NULL, 1, "inf", + MEMBEROF(ddsi_config_channel_listelem, auxiliary_bandwidth_limit), + FUNCTIONS(0, uf_bandwidth, 0, pf_bandwidth), + DESCRIPTION( + "

This element specifies the maximum transmit rate of auxiliary " + "traffic on this channel (e.g. retransmits, heartbeats, etc). " + "Bandwidth limiting uses a leaky bucket scheme. The default value " + "\"inf\" means Cyclone DDS imposes no limitation, the underlying operating " + "system and hardware will likely limit the maximum transmit rate.

") + UNIT("bandwidth")), +#endif + INT("DiffServField", NULL, 1, "0", + MEMBEROF(ddsi_config_channel_listelem, diffserv_field), + FUNCTIONS(0, uf_natint, 0, pf_int), + DESCRIPTION( + "

This element describes the DiffServ setting the channel will apply " + "to the networking messages. This parameter determines the value of " + "the diffserv field of the IP version 4 packets sent on this channel " + "which allows QoS setting to be applied to the network traffic send on " + "this channel.
\n" + "Windows platform support for setting the diffserv field is dependent " + "on the OS version.
\n" + "For Windows version 7 or higher a new API (qWAVE) has been introduced. " + "For these platforms the specified diffserv value is mapped to one of " + "the support traffic types.\n" + "The mapping is as follows: 1-8 background traffic; 9-40 excellent " + "traffic; 41-55 audio/video traffic; 56 voice traffic; 57-63 control " + "traffic.\n" + "When an application is run without Administrative priveleges then " + "only the diffserv value of 0, 8, 40 or 56 is allowed.

" + ), + BEHIND_FLAG("DDS_HAS_NETWORK_CHANNELS") + ), + END_MARKER +}; + +static struct cfgelem channel_cfgattrs[] = { + STRING("Name", NULL, 1, NULL, + MEMBEROF(ddsi_config_channel_listelem, name), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

This attribute specifies name of this channel. The name should " + "uniquely identify the channel.

" + )), + INT("TransportPriority", NULL, 1, "0", + MEMBEROF(ddsi_config_channel_listelem, priority), + FUNCTIONS(0, uf_natint, 0, pf_int), + DESCRIPTION( + "

This attribute sets the transport priority threshold for the " + "channel. Each DCPS data writer has a \"transport_priority\" QoS and " + "this QoS is used to select a channel for use by this writer. The " + "selected channel is the one with the largest threshold not greater " + "than the writer's transport priority, and if no such channel exists, " + "the channel with the lowest threshold.

" + )), + END_MARKER +}; + +static struct cfgelem channels_cfgelems[] = { + GROUP("Channel", channel_cfgelems, channel_cfgattrs, INT_MAX, + MEMBER(channels), + FUNCTIONS(if_channel, 0, 0, 0), + DESCRIPTION("

This element defines a channel.

")), + END_MARKER +}; +#endif /* DDS_HAS_NETWORK_CHANNELS */ + +static struct cfgelem thread_properties_sched_cfgelems[] = { + ENUM("Class", NULL, 1, "default", + MEMBEROF(ddsi_config_thread_properties_listelem, sched_class), + FUNCTIONS(0, uf_sched_class, 0, pf_sched_class), + DESCRIPTION( + "

This element specifies the thread scheduling class " + "(realtime, timeshare or default). The user may " + "need special privileges from the underlying operating system to be " + "able to assign some of the privileged scheduling classes.

"), + VALUES("realtime","timeshare","default")), + STRING("Priority", NULL, 1, "default", + MEMBEROF(ddsi_config_thread_properties_listelem, schedule_priority), + FUNCTIONS(0, uf_maybe_int32, 0, pf_maybe_int32), + DESCRIPTION( + "

This element specifies the thread priority (decimal integer or " + "default). Only priorities that are supported by the underlying " + "operating system can be assigned to this element. The user may need " + "special privileges from the underlying operating system to be able to " + "assign some of the privileged priorities.

" + )), + END_MARKER +}; + +static struct cfgelem thread_properties_cfgattrs[] = { + STRING("Name", NULL, 1, NULL, + MEMBEROF(ddsi_config_thread_properties_listelem, name), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

The Name of the thread for which properties are being set. The " + "following threads exist:

\n" + "
    \n" + "
  • gc: " + "garbage collector thread involved in deleting entities;
  • \n" + "
  • recv: " + "receive thread, taking data from the network and running the protocol " + "state machine;
  • \n" + "
  • dq.builtins: " + "delivery thread for DDSI-builtin data, primarily for discovery;
  • \n" + "
  • lease: " + "DDSI liveliness monitoring;
  • \n" + "
  • tev: " + "general timed-event handling, retransmits and discovery;
  • \n" + "
  • fsm: " + "finite state machine thread for handling security handshake;
  • \n" + "
  • xmit.CHAN: " + "transmit thread for channel CHAN;
  • \n" + "
  • dq.CHAN: " + "delivery thread for channel CHAN;
  • \n" + "
  • tev.CHAN: " + "timed-event thread for channel CHAN.
" + )), + END_MARKER +}; + +static struct cfgelem thread_properties_cfgelems[] = { + GROUP("Scheduling", thread_properties_sched_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

This element configures the scheduling properties of the thread.

" + )), + STRING("StackSize", NULL, 1, "default", + MEMBEROF(ddsi_config_thread_properties_listelem, stack_size), + FUNCTIONS(0, uf_maybe_memsize, 0, pf_maybe_memsize), + DESCRIPTION( + "

This element configures the stack size for this thread. The " + "default value default leaves the stack size at the operating " + "system default.

"), + UNIT("memsize")), + END_MARKER +}; + +static struct cfgelem threads_cfgelems[] = { + GROUP("Thread", thread_properties_cfgelems, thread_properties_cfgattrs, INT_MAX, + MEMBER(thread_properties), + FUNCTIONS(if_thread_properties, 0, 0, 0), + DESCRIPTION("

This element is used to set thread properties.

")), + END_MARKER +}; + +static struct cfgelem compatibility_cfgelems[] = { + ENUM("StandardsConformance", NULL, 1, "lax", + MEMBER(standards_conformance), + FUNCTIONS(0, uf_standards_conformance, 0, pf_standards_conformance), + DESCRIPTION( + "

This element sets the level of standards conformance of this " + "instance of the Cyclone DDS Service. Stricter conformance typically means " + "less interoperability with other implementations. Currently three " + "modes are defined:

\n" + "
  • pedantic: very strictly conform to the specification, " + "ultimately for compliancy testing, but currently of little value " + "because it adheres even to what will most likely turn out to be " + "editing errors in the DDSI standard. Arguably, as long as no errata " + "have been published it is the current text that is in effect, and " + "that is what pedantic currently does.
  • \n" + "
  • strict: a slightly less strict view of the standard than " + "does pedantic: it follows the established behaviour where the " + "standard is obviously in error.
  • \n" + "
  • lax: attempt to provide the smoothest possible " + "interoperability, anticipating future revisions of elements in the " + "standard in areas that other implementations do not adhere to, even " + "though there is no good reason not to.
"), + VALUES("lax","strict","pedantic")), + BOOL("ExplicitlyPublishQosSetToDefault", NULL, 1, "false", + MEMBER(explicitly_publish_qos_set_to_default), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element specifies whether QoS settings set to default values " + "are explicitly published in the discovery protocol. Implementations " + "are to use the default value for QoS settings not published, which " + "allows a significant reduction of the amount of data that needs to be " + "exchanged for the discovery protocol, but this requires all " + "implementations to adhere to the default values specified by the " + "specifications.

\n" + "

When interoperability is required with an implementation that does " + "not follow the specifications in this regard, setting this option to " + "true will help.

" + )), + ENUM("ManySocketsMode", NULL, 1, "single", + MEMBER(many_sockets_mode), + FUNCTIONS(0, uf_many_sockets_mode, 0, pf_many_sockets_mode), + DESCRIPTION( + "

This option specifies whether a network socket will be created for " + "each domain participant on a host. The specification seems to assume " + "that each participant has a unique address, and setting this option " + "will ensure this to be the case. This is not the default.

\n" + "

Disabling it slightly improves performance and reduces network " + "traffic somewhat. It also causes the set of port numbers needed by " + "Cyclone DDS to become predictable, which may be useful for firewall and " + "NAT configuration.

"), + VALUES("false","true","single","none","many")), + BOOL("AssumeRtiHasPmdEndpoints", NULL, 1, "false", + MEMBER(assume_rti_has_pmd_endpoints), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This option assumes ParticipantMessageData endpoints required by " + "the liveliness protocol are present in RTI participants even when not " + "properly advertised by the participant discovery protocol.

" + )), + END_MARKER +}; + +static struct cfgelem internal_test_cfgelems[] = { + INT("XmitLossiness", NULL, 1, "0", + MEMBER(xmit_lossiness), + FUNCTIONS(0, uf_int, 0, pf_int), + DESCRIPTION( + "

This element controls the fraction of outgoing packets to drop, " + "specified as samples per thousand.

" + )), + END_MARKER +}; + +static struct cfgelem internal_watermarks_cfgelems[] = { + STRING("WhcLow", NULL, 1, "1 kB", + MEMBER(whc_lowwater_mark), + FUNCTIONS(0, uf_memsize, 0, pf_memsize), + DESCRIPTION( + "

This element sets the low-water mark for the Cyclone DDS WHCs, " + "expressed in bytes. A suspended writer resumes transmitting when its " + "Cyclone DDS WHC shrinks to this size.

"), + UNIT("memsize")), + STRING("WhcHigh", NULL, 1, "500 kB", + MEMBER(whc_highwater_mark), + FUNCTIONS(0, uf_memsize, 0, pf_memsize), + DESCRIPTION( + "

This element sets the maximum allowed high-water mark for the " + "Cyclone DDS WHCs, expressed in bytes. A writer is suspended when the WHC " + "reaches this size.

"), + UNIT("memsize")), + STRING("WhcHighInit", NULL, 1, "30 kB", + MEMBER(whc_init_highwater_mark), + FUNCTIONS(0, uf_maybe_memsize, 0, pf_maybe_memsize), + DESCRIPTION( + "

This element sets the initial level of the high-water mark for the " + "Cyclone DDS WHCs, expressed in bytes.

"), + UNIT("memsize")), + BOOL("WhcAdaptive|WhcAdaptative", NULL, 1, "true", + MEMBER(whc_adaptive), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element controls whether Cyclone DDS will adapt the high-water " + "mark to current traffic conditions, based on retransmit requests and " + "transmit pressure.

" + )), + END_MARKER +}; + +static struct cfgelem internal_burstsize_cfgelems[] = { + STRING("MaxRexmit", NULL, 1, "1 MiB", + MEMBER(max_rexmit_burst_size), + FUNCTIONS(0, uf_memsize, 0, pf_memsize), + DESCRIPTION( + "

This element specifies the amount of data to be retransmitted in " + "response to one NACK.

"), + UNIT("memsize")), + STRING("MaxInitTransmit", NULL, 1, "4294967295", + MEMBER(init_transmit_extra_pct), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

This element specifies how much more than the (presumed or discovered) " + "receive buffer size may be sent when transmitting a sample for the first " + "time, expressed as a percentage; the remainder will then be handled via " + "retransmits. Usually the receivers can keep up with transmitter, at least " + "on average, and so generally it is better to hope for the best and recover. " + "Besides, the retransmits will be unicast, and so any multicast advantage " + "will be lost as well.

"), + UNIT("memsize")), + END_MARKER +}; + +static struct cfgelem control_topic_cfgattrs[] = { + BOOL(DEPRECATED("Enable"), NULL, 1, "false", + MEMBER(enable_control_topic), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element controls whether Cyclone DDS should create a topic to " + "control Cyclone DDS's behaviour dynamically.

")), + STRING(DEPRECATED("InitialReset"), NULL, 1, "inf", + MEMBER(initial_deaf_mute_reset), + FUNCTIONS(0, uf_duration_inf, 0, pf_duration), + DESCRIPTION( + "

This element controls after how much time an initial deaf/mute " + "state will automatically reset.

")), + END_MARKER +}; + +static struct cfgelem control_topic_cfgelems[] = { + BOOL(DEPRECATED("Deaf"), NULL, 1, "false", + MEMBER(initial_deaf), + FUNCTIONS(0, uf_deaf_mute, 0, pf_boolean), + DESCRIPTION( + "

This element controls whether Cyclone DDS defaults to deaf mode or to " + "normal mode. This controls both the initial behaviour and what " + "behaviour it auto-reverts to.

")), + BOOL(DEPRECATED("Mute"), NULL, 1, "false", + MEMBER(initial_mute), + FUNCTIONS(0, uf_deaf_mute, 0, pf_boolean), + DESCRIPTION( + "

This element controls whether Cyclone DDS defaults to mute mode or to " + "normal mode. This controls both the initial behaviour and what " + "behaviour it auto-reverts to.

")), + END_MARKER +}; + +static struct cfgelem rediscovery_blacklist_duration_attrs[] = { + BOOL("enforce", NULL, 1, "false", + MEMBER(prune_deleted_ppant.enforce_delay), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This attribute controls whether the configured time during which " + "recently deleted participants will not be rediscovered (i.e., \"black " + "listed\") is enforced and following complete removal of the " + "participant in Cyclone DDS, or whether it can be rediscovered earlier " + "provided all traces of that participant have been removed already.

" + )), + END_MARKER +}; + +static struct cfgelem heartbeat_interval_attrs[] = { + STRING("min", NULL, 1, "5 ms", + MEMBER(const_hb_intv_min), + FUNCTIONS(0, uf_duration_inf, 0, pf_duration), + DESCRIPTION( + "

This attribute sets the minimum interval that must have passed " + "since the most recent heartbeat from a writer, before another " + "asynchronous (not directly related to writing) will be sent.

"), + UNIT("duration_inf")), + STRING("minsched", NULL, 1, "20 ms", + MEMBER(const_hb_intv_sched_min), + FUNCTIONS(0, uf_duration_inf, 0, pf_duration), + DESCRIPTION( + "

This attribute sets the minimum interval for periodic heartbeats. " + "Other events may still cause heartbeats to go out.

"), + UNIT("duration_inf")), + STRING("max", NULL, 1, "8 s", + MEMBER(const_hb_intv_sched_max), + FUNCTIONS(0, uf_duration_inf, 0, pf_duration), + DESCRIPTION( + "

This attribute sets the maximum interval for periodic heartbeats.

"), + UNIT("duration_inf")), + END_MARKER +}; + +static struct cfgelem liveliness_monitoring_attrs[] = { + BOOL("StackTraces", NULL, 1, "true", + MEMBER(noprogress_log_stacktraces), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element controls whether or not to write stack traces to the " + "DDSI2 trace when a thread fails to make progress (on select platforms " + "only).

")), + STRING("Interval", NULL, 1, "1s", + MEMBER(liveliness_monitoring_interval), + FUNCTIONS(0, uf_duration_100ms_1hr, 0, pf_duration), + DESCRIPTION( + "

This element controls the interval at which to check whether " + "threads have been making progress.

"), + UNIT("duration"), + RANGE("100ms;1hr")), + END_MARKER +}; + +static struct cfgelem multiple_recv_threads_attrs[] = { + INT("maxretries", NULL, 1, "4294967295", + MEMBER(recv_thread_stop_maxretries), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

Receive threads dedicated to a single socket can only be triggered " + "for termination by sending a packet. Reception of any packet will do, " + "so termination failure due to packet loss is exceedingly unlikely, " + "but to eliminate all risks, it will retry as many times as specified " + "by this attribute before aborting.

" + )), + END_MARKER +}; + +static struct cfgelem sock_rcvbuf_size_attrs[] = { + STRING("min", NULL, 1, "default", + MEMBER(socket_rcvbuf_size.min), + FUNCTIONS(0, uf_maybe_memsize, 0, pf_maybe_memsize), + DESCRIPTION( + "

This sets the minimum acceptable socket receive buffer size, " + "with the special value \"default\" indicating that whatever is " + "available is acceptable.

"), + UNIT("memsize")), + STRING("max", NULL, 1, "default", + MEMBER(socket_rcvbuf_size.max), + FUNCTIONS(0, uf_maybe_memsize, 0, pf_maybe_memsize), + DESCRIPTION( + "

This sets the size of the socket receive buffer to request, " + "with the special value of \"default\" indicating that it should " + "try to satisfy the minimum buffer size. If both are at \"default\", " + "it will request 1MiB and accept anything. If the maximum is set " + "to less than the minimum, it is ignored.

"), + UNIT("memsize")), + END_MARKER +}; + +static struct cfgelem sock_sndbuf_size_attrs[] = { + STRING("min", NULL, 1, "64 KiB", + MEMBER(socket_sndbuf_size.min), + FUNCTIONS(0, uf_maybe_memsize, 0, pf_maybe_memsize), + DESCRIPTION( + "

This sets the minimum acceptable socket send buffer size, " + "with the special value \"default\" indicating that whatever is " + "available is acceptable.

"), + UNIT("memsize")), + STRING("max", NULL, 1, "default", + MEMBER(socket_sndbuf_size.max), + FUNCTIONS(0, uf_maybe_memsize, 0, pf_maybe_memsize), + DESCRIPTION( + "

This sets the size of the socket send buffer to request, " + "with the special value of \"default\" indicating that it should " + "try to satisfy the minimum buffer size. If both are at \"default\", " + "it will use whatever is the system default. If the maximum is set " + "to less than the minimum, it is ignored.

"), + UNIT("memsize")), + END_MARKER +}; + +static struct cfgelem internal_cfgelems[] = { + MOVED("MaxMessageSize", "CycloneDDS/Domain/General/MaxMessageSize"), + MOVED("FragmentSize", "CycloneDDS/Domain/General/FragmentSize"), + INT("DeliveryQueueMaxSamples", NULL, 1, "256", + MEMBER(delivery_queue_maxsamples), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

This element controls the maximum size of a delivery queue, " + "expressed in samples. Once a delivery queue is full, incoming samples " + "destined for that queue are dropped until space becomes available " + "again.

")), + INT("PrimaryReorderMaxSamples", NULL, 1, "128", + MEMBER(primary_reorder_maxsamples), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

This element sets the maximum size in samples of a primary " + "re-order administration. Each proxy writer has one primary re-order " + "administration to buffer the packet flow in case some packets arrive " + "out of order. Old samples are forwarded to secondary re-order " + "administrations associated with readers in need of historical " + "data.

")), + INT("SecondaryReorderMaxSamples", NULL, 1, "128", + MEMBER(secondary_reorder_maxsamples), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

This element sets the maximum size in samples of a secondary " + "re-order administration. The secondary re-order administration is per " + "reader in need of historical data.

")), + INT("DefragUnreliableMaxSamples", NULL, 1, "4", + MEMBER(defrag_unreliable_maxsamples), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

This element sets the maximum number of samples that can be " + "defragmented simultaneously for a best-effort writers.

")), + INT("DefragReliableMaxSamples", NULL, 1, "16", + MEMBER(defrag_reliable_maxsamples), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

This element sets the maximum number of samples that can be " + "defragmented simultaneously for a reliable writer. This has to be " + "large enough to handle retransmissions of historical data in addition " + "to new samples.

")), + ENUM("BuiltinEndpointSet", NULL, 1, "writers", + MEMBER(besmode), + FUNCTIONS(0, uf_besmode, 0, pf_besmode), + DESCRIPTION( + "

This element controls which participants will have which built-in " + "endpoints for the discovery and liveliness protocols. Valid values " + "are:

\n" + "
  • full: all participants have all endpoints;
  • \n" + "
  • writers: " + "all participants have the writers, but just one has the readers;
  • \n" + "
  • minimal: " + "only one participant has built-in endpoints.
\n" + "

The default is writers, as this is thought to be compliant " + "and reasonably efficient. Minimal may or may not be compliant " + "but is most efficient, and full is inefficient but certain to " + "be compliant. See also Internal/ConservativeBuiltinReaderStartup.

"), + VALUES("full","writers","minimal")), + BOOL("MeasureHbToAckLatency", NULL, 1, "false", + MEMBER(meas_hb_to_ack_latency), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element enables heartbeat-to-ack latency among Cyclone DDS " + "services by prepending timestamps to Heartbeat and AckNack messages " + "and calculating round trip times. This is non-standard behaviour. The " + "measured latencies are quite noisy and are currently not used " + "anywhere.

")), + BOOL("UnicastResponseToSPDPMessages", NULL, 1, "true", + MEMBER(unicast_response_to_spdp_messages), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element controls whether the response to a newly discovered " + "participant is sent as a unicasted SPDP packet, instead of " + "rescheduling the periodic multicasted one. There is no known benefit " + "to setting this to false.

")), + INT("SynchronousDeliveryPriorityThreshold", NULL, 1, "0", + MEMBER(synchronous_delivery_priority_threshold), + FUNCTIONS(0, uf_int, 0, pf_int), + DESCRIPTION( + "

This element controls whether samples sent by a writer with QoS " + "settings latency_budget <= SynchronousDeliveryLatencyBound and " + "transport_priority greater than or equal to this element's value will " + "be delivered synchronously from the \"recv\" thread, all others will " + "be delivered asynchronously through delivery queues. This reduces " + "latency at the expense of aggregate bandwidth.

")), + STRING("SynchronousDeliveryLatencyBound", NULL, 1, "inf", + MEMBER(synchronous_delivery_latency_bound), + FUNCTIONS(0, uf_duration_inf, 0, pf_duration), + DESCRIPTION( + "

This element controls whether samples sent by a writer with QoS " + "settings transport_priority >= SynchronousDeliveryPriorityThreshold " + "and a latency_budget at most this element's value will be delivered " + "synchronously from the \"recv\" thread, all others will be delivered " + "asynchronously through delivery queues. This reduces latency at the " + "expense of aggregate bandwidth.

"), + UNIT("duration_inf")), + INT("MaxParticipants", NULL, 1, "0", + MEMBER(max_participants), + FUNCTIONS(0, uf_natint, 0, pf_int), + DESCRIPTION( + "

This elements configures the maximum number of DCPS domain " + "participants this Cyclone DDS instance is willing to service. 0 is " + "unlimited.

")), + INT("AccelerateRexmitBlockSize", NULL, 1, "0", + MEMBER(accelerate_rexmit_block_size), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

Proxy readers that are assumed to sill be retrieving historical " + "data get this many samples retransmitted when they NACK something, " + "even if some of these samples have sequence numbers outside the set " + "covered by the NACK.

")), + ENUM("RetransmitMerging", NULL, 1, "never", + MEMBER(retransmit_merging), + FUNCTIONS(0, uf_retransmit_merging, 0, pf_retransmit_merging), + DESCRIPTION( + "

This elements controls the addressing and timing of retransmits. " + "Possible values are:

\n" + "
  • never: retransmit only to the NACK-ing reader;
  • \n" + "
  • adaptive: attempt to combine retransmits needed for " + "reliability, but send historical (transient-local) data to the " + "requesting reader only;
  • \n" + "
  • always: do not distinguish between different causes, " + "always try to merge.
\n" + "

The default is never. See also " + "Internal/RetransmitMergingPeriod.

"), + VALUES("never","adaptive","always")), + STRING("RetransmitMergingPeriod", NULL, 1, "5 ms", + MEMBER(retransmit_merging_period), + FUNCTIONS(0, uf_duration_us_1s, 0, pf_duration), + DESCRIPTION( + "

This setting determines the size of the time window in which a " + "NACK of some sample is ignored because a retransmit of that sample " + "has been multicasted too recently. This setting has no effect on " + "unicasted retransmits.

\n" + "

See also Internal/RetransmitMerging.

"), + UNIT("duration"), + RANGE("0;1s")), + STRING("HeartbeatInterval", heartbeat_interval_attrs, 1, "100 ms", + MEMBER(const_hb_intv_sched), + FUNCTIONS(0, uf_duration_inf, 0, pf_duration), + DESCRIPTION( + "

This element allows configuring the base interval for sending " + "writer heartbeats and the bounds within which it can vary.

"), + UNIT("duration_inf")), + STRING("MaxQueuedRexmitBytes", NULL, 1, "512 kB", + MEMBER(max_queued_rexmit_bytes), + FUNCTIONS(0, uf_memsize, 0, pf_memsize), + DESCRIPTION( + "

This setting limits the maximum number of bytes queued for " + "retransmission. The default value of 0 is unlimited unless an " + "AuxiliaryBandwidthLimit has been set, in which case it becomes " + "NackDelay * AuxiliaryBandwidthLimit. It must be large enough to " + "contain the largest sample that may need to be retransmitted.

"), + UNIT("memsize")), + INT("MaxQueuedRexmitMessages", NULL, 1, "200", + MEMBER(max_queued_rexmit_msgs), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

This settings limits the maximum number of samples queued for " + "retransmission.

" + )), + MOVED("LeaseDuration", "CycloneDDS/Domain/Discovery/LeaseDuration"), + STRING("WriterLingerDuration", NULL, 1, "1 s", + MEMBER(writer_linger_duration), + FUNCTIONS(0, uf_duration_ms_1hr, 0, pf_duration), + DESCRIPTION( + "

This setting controls the maximum duration for which actual " + "deletion of a reliable writer with unacknowledged data in its history " + "will be postponed to provide proper reliable transmission.

"), + UNIT("duration")), + MOVED("MinimumSocketReceiveBufferSize", "CycloneDDS/Domain/Internal/SocketReceiveBufferSize[@min]"), + MOVED("MinimumSocketSendBufferSize", "CycloneDDS/Domain/Internal/SocketSendBufferSize[@min]"), + GROUP("SocketReceiveBufferSize", NULL, sock_rcvbuf_size_attrs, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

The settings in this element control the size of the socket receive buffers. " + "The operating system provides some size receive buffer upon creation " + "of the socket, this option can be used to increase the size of the " + "buffer beyond that initially provided by the operating system. If the " + "buffer size cannot be increased to the requested minimum size, an error is " + "reported.

\n" + "

The default setting requests a buffer size of 1MiB but accepts whatever " + "is available after that.

")), + GROUP("SocketSendBufferSize", NULL, sock_sndbuf_size_attrs, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

The settings in this element control the size of the socket send buffers. " + "The operating system provides some size send buffer upon creation " + "of the socket, this option can be used to increase the size of the " + "buffer beyond that initially provided by the operating system. If the " + "buffer size cannot be increased to the requested minimum size, an error is " + "reported.

\n" + "

The default setting requires a buffer of at least 64KiB.

")), + STRING("NackDelay", NULL, 1, "100 ms", + MEMBER(nack_delay), + FUNCTIONS(0, uf_duration_ms_1hr, 0, pf_duration), + DESCRIPTION( + "

This setting controls the delay between receipt of a HEARTBEAT " + "indicating missing samples and a NACK (ignored when the HEARTBEAT " + "requires an answer). However, no NACK is sent if a NACK had been " + "scheduled already for a response earlier than the delay requests: " + "then that NACK will incorporate the latest information.

"), + UNIT("duration")), + STRING("AckDelay", NULL, 1, "10 ms", + MEMBER(ack_delay), + FUNCTIONS(0, uf_duration_ms_1hr, 0, pf_duration), + DESCRIPTION( + "

This setting controls the delay between sending identical " + "acknowledgements.

"), + UNIT("duration")), + STRING("AutoReschedNackDelay", NULL, 1, "3 s", + MEMBER(auto_resched_nack_delay), + FUNCTIONS(0, uf_duration_inf, 0, pf_duration), + DESCRIPTION( + "

This setting controls the interval with which a reader will " + "continue NACK'ing missing samples in the absence of a response from " + "the writer, as a protection mechanism against writers incorrectly " + "stopping the sending of HEARTBEAT messages.

"), + UNIT("duration_inf")), + STRING("PreEmptiveAckDelay", NULL, 1, "10 ms", + MEMBER(preemptive_ack_delay), + FUNCTIONS(0, uf_duration_ms_1hr, 0, pf_duration), + DESCRIPTION( + "

This setting controls the delay between the discovering a remote " + "writer and sending a pre-emptive AckNack to discover the range of " + "data available.

"), + UNIT("duration")), + STRING("ScheduleTimeRounding", NULL, 1, "0 ms", + MEMBER(schedule_time_rounding), + FUNCTIONS(0, uf_duration_ms_1hr, 0, pf_duration), + DESCRIPTION( + "

This setting allows the timing of scheduled events to be rounded " + "up so that more events can be handled in a single cycle of the event " + "queue. The default is 0 and causes no rounding at all, i.e. are " + "scheduled exactly, whereas a value of 10ms would mean that events are " + "rounded up to the nearest 10 milliseconds.

"), + UNIT("duration")), +#ifdef DDS_HAS_BANDWIDTH_LIMITING + STRING("AuxiliaryBandwidthLimit", NULL, 1, "inf", + MEMBER(auxiliary_bandwidth_limit), + FUNCTIONS(0, uf_bandwidth, 0, pf_bandwidth), + DESCRIPTION( + "

This element specifies the maximum transmit rate of auxiliary " + "traffic not bound to a specific channel, such as discovery traffic, " + "as well as auxiliary traffic related to a certain channel if that " + "channel has elected to share this global AuxiliaryBandwidthLimit. " + "Bandwidth limiting uses a leaky bucket scheme. The default value " + "\"inf\" means Cyclone DDS imposes no limitation, the underlying operating " + "system and hardware will likely limit the maximum transmit rate.

" + ), + BEHIND_FLAG("DDS_HAS_BANDWIDTH_LIMITING") + ), +#endif + INT("DDSI2DirectMaxThreads", NULL, 1, "1", + MEMBER(ddsi2direct_max_threads), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

This element sets the maximum number of extra threads for an " + "experimental, undocumented and unsupported direct mode.

")), + BOOL("SquashParticipants", NULL, 1, "false", + MEMBER(squash_participants), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element controls whether Cyclone DDS advertises all the domain " + "participants it serves in DDSI (when set to false), or rather " + "only one domain participant (the one corresponding to the Cyclone DDS " + "process; when set to true). In the latter case Cyclone DDS becomes " + "the virtual owner of all readers and writers of all domain " + "participants, dramatically reducing discovery traffic (a similar " + "effect can be obtained by setting Internal/BuiltinEndpointSet to " + "\"minimal\" but with less loss of information).

" + )), + STRING("SPDPResponseMaxDelay", NULL, 1, "0 ms", + MEMBER(spdp_response_delay_max), + FUNCTIONS(0, uf_duration_ms_1s, 0, pf_duration), + DESCRIPTION( + "

Maximum pseudo-random delay in milliseconds between discovering a" + "remote participant and responding to it.

"), + UNIT("duration")), + BOOL("LateAckMode", NULL, 1, "false", + MEMBER(late_ack_mode), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

Ack a sample only when it has been delivered, instead of when " + "committed to delivering it.

")), + BOOL("RetryOnRejectBestEffort", NULL, 1, "false", + MEMBER(retry_on_reject_besteffort), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

Whether or not to locally retry pushing a received best-effort " + "sample into the reader caches when resource limits are reached.

")), + BOOL("GenerateKeyhash", NULL, 1, "false", + MEMBER(generate_keyhash), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

When true, include keyhashes in outgoing data for topics with " + "keys.

" + )), + STRING("MaxSampleSize", NULL, 1, "2147483647 B", + MEMBER(max_sample_size), + FUNCTIONS(0, uf_memsize, 0, pf_memsize), + DESCRIPTION( + "

This setting controls the maximum (CDR) serialised size of samples " + "that Cyclone DDS will forward in either direction. Samples larger than " + "this are discarded with a warning.

"), + UNIT("memsize")), + BOOL("WriteBatch", NULL, 1, "false", + MEMBER(whc_batch), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element enables the batching of write operations. By default " + "each write operation writes through the write cache and out onto the " + "transport. Enabling write batching causes multiple small write " + "operations to be aggregated within the write cache into a single " + "larger write. This gives greater throughput at the expense of " + "latency. Currently there is no mechanism for the write cache to " + "automatically flush itself, so that if write batching is enabled, " + "the application may have to use the dds_write_flush function to " + "ensure that all samples are written.

" + )), + BOOL("LivelinessMonitoring", liveliness_monitoring_attrs, 1, "false", + MEMBER(liveliness_monitoring), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element controls whether or not implementation should " + "internally monitor its own liveliness. If liveliness monitoring is " + "enabled, stack traces can be dumped automatically when some thread " + "appears to have stopped making progress.

" + )), + INT("MonitorPort", NULL, 1, "-1", + MEMBER(monitor_port), + FUNCTIONS(0, uf_int, 0, pf_int), + DESCRIPTION( + "

This element allows configuring a service that dumps a text " + "description of part the internal state to TCP clients. By default " + "(-1), this is disabled; specifying 0 means a kernel-allocated port is " + "used; a positive number is used as the TCP port number.

" + )), + STRING(DEPRECATED("AssumeMulticastCapable"), NULL, 1, "", + MEMBER(depr_assumeMulticastCapable), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

Deprecated, use General/Interfaces/NetworkInterface[@multicast] instead. " + "This element controls which network interfaces are assumed to be " + "capable of multicasting even when the interface flags returned by the " + "operating system state it is not (this provides a workaround for some " + "platforms). It is a comma-separated lists of patterns (with ? and * " + "wildcards) against which the interface names are matched.

" + )), + BOOL("PrioritizeRetransmit", NULL, 1, "true", + MEMBER(prioritize_retransmit), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

This element controls whether retransmits are prioritized over new " + "data, speeding up recovery.

" + )), + INT("UseMulticastIfMreqn", NULL, 1, "0", + MEMBER(use_multicast_if_mreqn), + FUNCTIONS(0, uf_int, 0, pf_int), + DESCRIPTION("

Do not use.

")), + STRING("RediscoveryBlacklistDuration", rediscovery_blacklist_duration_attrs, 1, "0s", + MEMBER(prune_deleted_ppant.delay), + FUNCTIONS(0, uf_duration_inf, 0, pf_duration), + DESCRIPTION( + "

This element controls for how long a remote participant that was " + "previously deleted will remain on a blacklist to prevent rediscovery, " + "giving the software on a node time to perform any cleanup actions it " + "needs to do. To some extent this delay is required internally by " + "Cyclone DDS, but in the default configuration with the 'enforce' attribute " + "set to false, Cyclone DDS will reallow rediscovery as soon as it has " + "cleared its internal administration. Setting it to too small a value " + "may result in the entry being pruned from the blacklist before Cyclone DDS " + "is ready, it is therefore recommended to set it to at least several " + "seconds.

"), + UNIT("duration_inf")), + ENUM("MultipleReceiveThreads", multiple_recv_threads_attrs, 1, "default", + MEMBER(multiple_recv_threads), + FUNCTIONS(0, uf_boolean_default, 0, pf_boolean_default), + DESCRIPTION( + "

This element controls whether all traffic is handled by a single " + "receive thread (false) or whether multiple receive threads may be used " + "to improve latency (true). By default it is disabled on Windows because " + "it appears that one cannot count on being able to send packets to " + "oneself, which is necessary to stop the thread during shutdown. " + "Currently multiple receive threads are only used for connectionless " + "transport (e.g., UDP) and ManySocketsMode not set to single (the " + "default).

"), + VALUES("false","true","default")), + GROUP("ControlTopic", control_topic_cfgelems, control_topic_cfgattrs, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

The ControlTopic element allows configured whether Cyclone DDS provides " + "a special control interface via a predefined topic or not.

" + )), + GROUP("Test", internal_test_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION("

Testing options.

")), + GROUP("Watermarks", internal_watermarks_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION("

Watermarks for flow-control.

")), + GROUP("BurstSize", internal_burstsize_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION("

Setting for controlling the size of transmit bursts.

")), + LIST("EnableExpensiveChecks", NULL, 1, "", + MEMBER(enabled_xchecks), + FUNCTIONS(0, uf_xcheck, 0, pf_xcheck), + DESCRIPTION( + "

This element enables expensive checks in builds with assertions " + "enabled and is ignored otherwise. Recognised categories are:

\n" + "
    \n" + "
  • whc: writer history cache checking
  • \n" + "
  • rhc: reader history cache checking
  • \n" + "
  • xevent: xevent checking
  • \n" + "

    In addition, there is the keyword all that enables all " + "checks.

    "), + VALUES("whc","rhc","xevent","all")), + END_MARKER +}; + +static struct cfgelem sizing_cfgelems[] = { + STRING("ReceiveBufferSize", NULL, 1, "1 MiB", + MEMBER(rbuf_size), + FUNCTIONS(0, uf_memsize, 0, pf_memsize), + DESCRIPTION( + "

    This element sets the size of a single receive buffer. Many receive " + "buffers may be needed. The minimum workable size a little bit larger " + "than Sizing/ReceiveBufferChunkSize, and the value used is taken as the " + "configured value and the actual minimum workable size.

    "), + UNIT("memsize")), + STRING("ReceiveBufferChunkSize", NULL, 1, "128 KiB", + MEMBER(rmsg_chunk_size), + FUNCTIONS(0, uf_memsize, 0, pf_memsize), + DESCRIPTION( + "

    This element specifies the size of one allocation unit in the " + "receive buffer. Must be greater than the maximum packet size by a " + "modest amount (too large packets are dropped). Each allocation is " + "shrunk immediately after processing a message, or freed " + "straightaway.

    "), + UNIT("memsize")), + END_MARKER +}; + +static struct cfgelem discovery_ports_cfgelems[] = { + INT("Base", NULL, 1, "7400", + MEMBER(ports.base), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

    This element specifies the base port number (refer to the DDSI 2.1 " + "specification, section 9.6.1, constant PB).

    " + )), + INT("DomainGain", NULL, 1, "250", + MEMBER(ports.dg), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

    This element specifies the domain gain, relating domain ids to sets " + "of port numbers (refer to the DDSI 2.1 specification, section 9.6.1, " + "constant DG).

    " + )), + INT("ParticipantGain", NULL, 1, "2", + MEMBER(ports.pg), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

    This element specifies the participant gain, relating p0, " + "participant index to sets of port numbers (refer to the DDSI 2.1 " + "specification, section 9.6.1, constant PG).

    " + )), + INT("MulticastMetaOffset", NULL, 1, "0", + MEMBER(ports.d0), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

    This element specifies the port number for multicast meta traffic " + "(refer to the DDSI 2.1 specification, section 9.6.1, constant d0).

    " + )), + INT("UnicastMetaOffset", NULL, 1, "10", + MEMBER(ports.d1), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

    This element specifies the port number for unicast meta traffic " + "(refer to the DDSI 2.1 specification, section 9.6.1, constant d1).

    " + )), + INT("MulticastDataOffset", NULL, 1, "1", + MEMBER(ports.d2), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

    This element specifies the port number for multicast data traffic " + "(refer to the DDSI 2.1 specification, section 9.6.1, constant d2).

    " + )), + INT("UnicastDataOffset", NULL, 1, "11", + MEMBER(ports.d3), + FUNCTIONS(0, uf_uint, 0, pf_uint), + DESCRIPTION( + "

    This element specifies the port number for unicast data traffic " + "(refer to the DDSI 2.1 specification, section 9.6.1, constant d3).

    " + )), + END_MARKER +}; + +static struct cfgelem tcp_cfgelems[] = { + ENUM("Enable", NULL, 1, "default", + MEMBER(compat_tcp_enable), + FUNCTIONS(0, uf_boolean_default, 0, pf_nop), + DESCRIPTION( + "

    This element enables the optional TCP transport - deprecated, " + "use General/Transport instead.

    "), + VALUES("false","true","default")), + BOOL("NoDelay", NULL, 1, "true", + MEMBER(tcp_nodelay), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

    This element enables the TCP_NODELAY socket option, preventing " + "multiple DDSI messages being sent in the same TCP request. Setting " + "this option typically optimises latency over throughput.

    " + )), + INT("Port", NULL, 1, "-1", + MEMBER(tcp_port), + FUNCTIONS(0, uf_dyn_port, 0, pf_int), + DESCRIPTION( + "

    This element specifies the TCP port number on which Cyclone DDS accepts " + "connections. If the port is set it is used in entity locators, " + "published with DDSI discovery. Dynamically allocated if zero. Disabled " + "if -1 or not configured. If disabled other DDSI services will not be " + "able to establish connections with the service, the service can only " + "communicate by establishing connections to other services.

    "), + RANGE("-1;65535")), + STRING("ReadTimeout", NULL, 1, "2 s", + MEMBER(tcp_read_timeout), + FUNCTIONS(0, uf_duration_ms_1hr, 0, pf_duration), + DESCRIPTION( + "

    This element specifies the timeout for blocking TCP read " + "operations. If this timeout expires then the connection is closed.

    "), + UNIT("duration")), + STRING("WriteTimeout", NULL, 1, "2 s", + MEMBER(tcp_write_timeout), + FUNCTIONS(0, uf_duration_ms_1hr, 0, pf_duration), + DESCRIPTION( + "

    This element specifies the timeout for blocking TCP write " + "operations. If this timeout expires then the connection is closed.

    "), + UNIT("duration")), + BOOL("AlwaysUsePeeraddrForUnicast", NULL, 1, "false", + MEMBER(tcp_use_peeraddr_for_unicast), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

    Setting this to true means the unicast addresses in SPDP packets " + "will be ignored and the peer address from the TCP connection will be " + "used instead. This may help work around incorrectly advertised " + "addresses when using TCP.

    " + )), + END_MARKER +}; + +#ifdef DDS_HAS_SSL +static struct cfgelem ssl_cfgelems[] = { + BOOL("Enable", NULL, 1, "false", + MEMBER(ssl_enable), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION("

    This enables SSL/TLS for TCP.

    ")), + BOOL("CertificateVerification", NULL, 1, "true", + MEMBER(ssl_verify), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

    If disabled this allows SSL connections to occur even if an X509 " + "certificate fails verification.

    " + )), + BOOL("VerifyClient", NULL, 1, "true", + MEMBER(ssl_verify_client), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

    This enables an SSL server checking the X509 certificate of a " + "connecting client.

    " + )), + BOOL("SelfSignedCertificates", NULL, 1, "false", + MEMBER(ssl_self_signed), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

    This enables the use of self signed X509 certificates.

    " + )), + STRING("KeystoreFile", NULL, 1, "keystore", + MEMBER(ssl_keystore), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

    The SSL/TLS key and certificate store file name. The keystore must " + "be in PEM format.

    " + )), + STRING("KeyPassphrase", NULL, 1, "secret", + MEMBER(ssl_key_pass), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION("

    The SSL/TLS key pass phrase for encrypted keys.

    ")), + STRING("Ciphers", NULL, 1, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH", + MEMBER(ssl_ciphers), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION("

    The set of ciphers used by SSL/TLS

    ")), + STRING("EntropyFile", NULL, 1, "", + MEMBER(ssl_rand_file), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION("

    The SSL/TLS random entropy file name.

    ")), + STRING("MinimumTLSVersion", NULL, 1, "1.3", + MEMBER(ssl_min_version), + FUNCTIONS(0, uf_min_tls_version, 0, pf_min_tls_version), + DESCRIPTION( + "

    The minimum TLS version that may be negotiated, valid values are " + "1.2 and 1.3.

    " + )), + END_MARKER +}; +#endif + +#ifdef DDS_HAS_SHM +static struct cfgelem shmem_cfgelems[] = { + BOOL("Enable", NULL, 1, "false", + MEMBER(enable_shm), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION("

    This element allows to enable shared memory in Cyclone DDS.

    ")), + STRING("Locator", NULL, 1, "", + MEMBER(shm_locator), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

    Explicitly set the Iceoryx locator used by Cyclone to check whether " + "a pair of processes is attached to the same Iceoryx shared memory. The " + "default is to use one of the MAC addresses of the machine, which should " + "work well in most cases.

    " + )), + STRING("Prefix", NULL, 1, "DDS_CYCLONE", + MEMBER(iceoryx_service), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

    Override the Iceoryx service name used by Cyclone.

    " + )), + ENUM("LogLevel", NULL, 1, "info", + MEMBER(shm_log_lvl), + FUNCTIONS(0, uf_shm_loglevel, 0, pf_shm_loglevel), + DESCRIPTION( + "

    This element decides the verbosity level of shared memory message:

    \n" + "
    • off: no log
    • \n" + "
    • fatal: show fatal log
    • \n" + "
    • error: show error log
    • \n" + "
    • warn: show warn log
    • \n" + "
    • info: show info log
    • \n" + "
    • debug: show debug log
    • \n" + "
    • verbose: show verbose log
    • \n" + "

      If you don't want to see any log from shared memory, use off to disable log message.

      "), + VALUES( + "off","fatal","error","warn","info","debug","verbose" + )), + END_MARKER +}; +#endif + +static struct cfgelem discovery_peer_cfgattrs[] = { + STRING("Address", NULL, 1, NULL, + MEMBEROF(ddsi_config_peer_listelem, peer), + FUNCTIONS(0, uf_ipv4, ff_free, pf_string), + DESCRIPTION( + "

      This element specifies an IP address to which discovery packets " + "must be sent, in addition to the default multicast address (see also " + "General/AllowMulticast). Both a hostnames and a numerical IP address " + "is accepted; the hostname or IP address may be suffixed with :PORT to " + "explicitly set the port to which it must be sent. Multiple Peers may " + "be specified.

      " + )), + END_MARKER +}; + +static struct cfgelem discovery_peers_cfgelems[] = { + GROUP("Peer", NULL, discovery_peer_cfgattrs, INT_MAX, + MEMBER(peers), + FUNCTIONS(if_peer, 0, 0, 0), + DESCRIPTION( + "

      This element statically configures an addresses for discovery.

      " + )), + END_MARKER +}; + +static struct cfgelem discovery_cfgelems[] = { + STRING("Tag", NULL, 1, "", + MEMBER(domainTag), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

      String extension for domain id that remote participants must match " + "to be discovered.

      " + )), + STRING("ExternalDomainId", NULL, 1, "default", + MEMBER(extDomainId), + FUNCTIONS(0, uf_maybe_int32, 0, pf_maybe_int32), + DESCRIPTION( + "

      An override for the domain id, to be used in discovery and for " + "determining the port number mapping. This allows creating multiple " + "domains in a single process while making them appear as a single " + "domain on the network. The value \"default\" disables the override.

      " + )), + STRING("DSGracePeriod", NULL, 1, "30 s", + MEMBER(ds_grace_period), + FUNCTIONS(0, uf_duration_inf, 0, pf_duration), + DESCRIPTION( + "

      This setting controls for how long endpoints discovered via a " + "Cloud discovery service will survive after the discovery service " + "disappeared, allowing reconnect without loss of data when the " + "discovery service restarts (or another instance takes over).

      "), + UNIT("duration_inf")), + GROUP("Peers", discovery_peers_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      This element statically configures addresses for discovery.

      " + )), + STRING("ParticipantIndex", NULL, 1, "none", + MEMBER(participantIndex), + FUNCTIONS(0, uf_participantIndex, 0, pf_participantIndex), + DESCRIPTION( + "

      This element specifies the DDSI participant index used by this " + "instance of the Cyclone DDS service for discovery purposes. Only one such " + "participant id is used, independent of the number of actual " + "DomainParticipants on the node. It is either:

      \n" + "
      • auto: which will attempt to automatically determine an " + "available participant index " + "(see also Discovery/MaxAutoParticipantIndex), or
      • \n" + "
      • a non-negative integer less than 120, or
      • \n" + "
      • none:, which causes it to use arbitrary port numbers for " + "unicast sockets which entirely removes the constraints on the " + "participant index but makes unicast discovery impossible.
      \n" + "

      The default is auto. The participant index is part of the " + "port number calculation and if predictable port numbers are needed " + "and fixing the participant index has no adverse effects, it is " + "recommended that the second be option be used.

      " + )), + INT("MaxAutoParticipantIndex", NULL, 1, "9", + MEMBER(maxAutoParticipantIndex), + FUNCTIONS(0, uf_natint, 0, pf_int), + DESCRIPTION( + "

      This element specifies the maximum DDSI participant index selected " + "by this instance of the Cyclone DDS service if the " + "Discovery/ParticipantIndex is \"auto\".

      " + )), + STRING("SPDPMulticastAddress", NULL, 1, "239.255.0.1", + MEMBER(spdpMulticastAddressString), + FUNCTIONS(0, uf_ipv4, ff_free, pf_string), + DESCRIPTION( + "

      This element specifies the multicast address that is used as the " + "destination for the participant discovery packets. In IPv4 mode the " + "default is the (standardised) 239.255.0.1, in IPv6 mode it becomes " + "ff02::ffff:239.255.0.1, which is a non-standardised link-local " + "multicast address.

      " + )), + STRING("SPDPInterval", NULL, 1, "30 s", + MEMBER(spdp_interval), + FUNCTIONS(0, uf_duration_ms_1hr, 0, pf_duration), + DESCRIPTION( + "

      This element specifies the interval between spontaneous " + "transmissions of participant discovery packets.

      "), + UNIT("duration")), + STRING("DefaultMulticastAddress", NULL, 1, "auto", + MEMBER(defaultMulticastAddressString), + FUNCTIONS(0, uf_networkAddress, ff_free, pf_networkAddress), + DESCRIPTION( + "

      This element specifies the default multicast address for all " + "traffic other than participant discovery packets. It defaults to " + "Discovery/SPDPMulticastAddress.

      " + )), + GROUP("Ports", discovery_ports_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The Ports element allows specifying various parameters related to " + "the port numbers used for discovery. These all have default values " + "specified by the DDSI 2.1 specification and rarely need to be " + "changed.

      " + )), +#ifdef DDS_HAS_TOPIC_DISCOVERY + BOOL("EnableTopicDiscoveryEndpoints", NULL, 1, "false", + MEMBER(enable_topic_discovery_endpoints), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

      This element controls whether the built-in endpoints for topic " + "discovery are created and used to exchange topic discovery information.

      " + ), + BEHIND_FLAG("DDS_HAS_TOPIC_DISCOVERY") + ), +#endif + STRING("LeaseDuration", NULL, 1, "10 s", + MEMBER(lease_duration), + FUNCTIONS(0, uf_duration_ms_1hr, 0, pf_duration), + DESCRIPTION( + "

      This setting controls the default participant lease duration.

      "), + UNIT("duration")), + END_MARKER +}; + +static struct cfgelem tracing_cfgelems[] = { + LIST("Category|EnableCategory", NULL, 1, "", + NOMEMBER, + FUNCTIONS(0, uf_tracemask, 0, pf_tracemask), + DESCRIPTION( + "

      This element enables individual logging categories. These are " + "enabled in addition to those enabled by Tracing/Verbosity. Recognised " + "categories are:

      \n" + "
        \n" + "
      • fatal: all fatal errors, errors causing immediate termination
      • \n" + "
      • error: failures probably impacting correctness but not necessarily causing immediate termination
      • \n" + "
      • warning: abnormal situations that will likely not impact correctness
      • \n" + "
      • config: full dump of the configuration
      • \n" + "
      • info: general informational notices
      • \n" + "
      • discovery: all discovery activity
      • \n" + "
      • data: include data content of samples in traces
      • \n" + "
      • radmin: receive buffer administration
      • \n" + "
      • timing: periodic reporting of CPU loads per thread
      • \n" + "
      • traffic: periodic reporting of total outgoing data
      • \n" + "
      • whc: tracing of writer history cache changes
      • \n" + "
      • tcp: tracing of TCP-specific activity
      • \n" + "
      • topic: tracing of topic definitions
      • \n" + "
      • plist: tracing of discovery parameter list interpretation
      • " + "
      \n" + "

      In addition, there is the keyword trace that enables all " + "but radmin, topic, plist and whc

      .\n" + "

      The categorisation of tracing output is incomplete and hence most " + "of the verbosity levels and categories are not of much use in the " + "current release. This is an ongoing process and here we describe the " + "target situation rather than the current situation. Currently, the " + "most useful is trace.

      "), + VALUES( + "fatal","error","warning","info","config","discovery","data","radmin", + "timing","traffic","topic","tcp","plist","whc","throttle","rhc", + "content","shm","trace" + )), + ENUM("Verbosity", NULL, 1, "none", + NOMEMBER, + FUNCTIONS(0, uf_verbosity, 0, pf_nop), + DESCRIPTION( + "

      This element enables standard groups of categories, based on a " + "desired verbosity level. This is in addition to the categories " + "enabled by the Tracing/Category setting. Recognised verbosity levels " + "and the categories they map to are:

      \n" + "
      • none: no Cyclone DDS log
      • \n" + "
      • severe: error and fatal
      • \n" + "
      • warning: severe + warning
      • \n" + "
      • info: warning + info
      • \n" + "
      • config: info + config
      • \n" + "
      • fine: config + discovery
      • \n" + "
      • finer: fine + traffic and timing
      • \n" + "
      • finest: finer + trace
      \n" + "

      While none prevents any message from being written to a " + "DDSI2 log file.

      \n" + "

      The categorisation of tracing output is incomplete and hence most " + "of the verbosity levels and categories are not of much use in the " + "current release. This is an ongoing process and here we describe the " + "target situation rather than the current situation. Currently, the " + "most useful verbosity levels are config, fine and " + "finest.

      "), + VALUES( + "finest","finer","fine","config","info","warning","severe","none" + )), + STRING("OutputFile", NULL, 1, "cyclonedds.log", + MEMBER(tracefile), + FUNCTIONS(0, uf_tracingOutputFileName, ff_free, pf_string), + DESCRIPTION( + "

      This option specifies where the logging is printed to. Note that " + "stdout and stderr are treated as special values, " + "representing \"standard out\" and \"standard error\" respectively. No " + "file is created unless logging categories are enabled using the " + "Tracing/Verbosity or Tracing/EnabledCategory settings.

      " + )), + BOOL("AppendToFile", NULL, 1, "false", + MEMBER(tracingAppendToFile), + FUNCTIONS(0, uf_boolean, 0, pf_boolean), + DESCRIPTION( + "

      This option specifies whether the output is to be appended to an " + "existing log file. The default is to create a new log file each time, " + "which is generally the best option if a detailed log is generated.

      " + )), + STRING("PacketCaptureFile", NULL, 1, "", + MEMBER(pcap_file), + FUNCTIONS(0, uf_string, ff_free, pf_string), + DESCRIPTION( + "

      This option specifies the file to which received and sent packets " + "will be logged in the \"pcap\" format suitable for analysis using " + "common networking tools, such as WireShark. IP and UDP headers are " + "fictitious, in particular the destination address of received packets. " + "The TTL may be used to distinguish between sent and received packets: " + "it is 255 for sent packets and 128 for received ones. Currently IPv4 " + "only.

      " + )), + END_MARKER +}; + +/* Multiplicity = 0 is a special for Domain/[@Id] as it has some special processing to + only process relevant configuration sections. */ +static struct cfgelem domain_cfgattrs[] = { + STRING("Id", NULL, 0, "any", + MEMBER(domainId), + FUNCTIONS(0, uf_domainId, 0, pf_domainId), + DESCRIPTION( + "

      Domain id this configuration applies to, or \"any\" if it applies " + "to all domain ids.

      " + )), + END_MARKER +}; + +static struct cfgelem domain_cfgelems[] = { + MOVED("Id", "CycloneDDS/Domain[@Id]"), + GROUP("General", general_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The General element specifies overall Cyclone DDS service settings.

      " + )), +#ifdef DDS_HAS_SECURITY + GROUP("Security|DDSSecurity", security_omg_config_elements, NULL, INT_MAX, + MEMBER(omg_security_configuration), + FUNCTIONS(if_omg_security, 0, 0, 0), + DESCRIPTION( + "

      This element is used to configure Cyclone DDS with the DDS Security " + "specification plugins and settings.

      " + ), + BEHIND_FLAG("DDS_HAS_SECURITY"), + MAXIMUM(1)), /* Security must occur at most once, but INT_MAX is required + because of the way its processed (for now) */ +#endif +#ifdef DDS_HAS_NETWORK_PARTITIONS + GROUP("Partitioning", partitioning_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The Partitioning element specifies Cyclone DDS network partitions and " + "how DCPS partition/topic combinations are mapped onto the network " + "partitions.

      " + ), + BEHIND_FLAG("DDS_HAS_NETWORK_PARTITIONS") + ), +#endif +#ifdef DDS_HAS_NETWORK_CHANNELS + GROUP("Channels", channels_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      This element is used to group a set of channels. The channels are " + "independent data paths through Cyclone DDS and by using separate threads " + "and setting their priorities appropriately, chanenls can be used to " + "map transport priorities to operating system scheduler priorities, " + "ensuring system-wide end-to-end priority preservation.

      " + ), + BEHIND_FLAG("DDS_HAS_NETWORK_CHANNELS") + ), +#endif + GROUP("Threads", threads_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      This element is used to set thread properties.

      " + )), + GROUP("Sizing", sizing_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The Sizing element specifies a variety of configuration settings " + "dealing with expected system sizes, buffer sizes, &c.

      " + )), + GROUP("Compatibility", compatibility_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The Compatibility elements allows specifying various settings " + "related to compatibility with standards and with other DDSI " + "implementations.

      " + )), + GROUP("Discovery", discovery_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The Discovery element allows specifying various parameters related " + "to the discovery of peers.

      " + )), + GROUP("Tracing", tracing_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The Tracing element controls the amount and type of information " + "that is written into the tracing log by the DDSI service. This is " + "useful to track the DDSI service during application development.

      " + )), + GROUP("Internal|Unsupported", internal_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The Internal elements deal with a variety of settings that " + "evolving and that are not necessarily fully supported. For the vast " + "majority of the Internal settings, the functionality per-se is " + "supported, but the right to change the way the options control the " + "functionality is reserved. This includes renaming or moving " + "options.

      " + )), + GROUP("TCP", tcp_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The TCP element allows specifying various parameters related to " + "running DDSI over TCP.

      " + )), +#ifdef DDS_HAS_SSL + GROUP("SSL", ssl_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The SSL element allows specifying various parameters related to " + "using SSL/TLS for DDSI over TCP.

      " + ), + BEHIND_FLAG("DDS_HAS_SSL") + ), +#endif +#ifdef DDS_HAS_SHM + GROUP("SharedMemory", shmem_cfgelems, NULL, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The Shared Memory element allows specifying various parameters " + "related to using shared memory.

      " + ), + BEHIND_FLAG("DDS_HAS_SHM") + ), +#endif + END_MARKER +}; + +static struct cfgelem root_cfgelems[] = { + GROUP("Domain", domain_cfgelems, domain_cfgattrs, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION( + "

      The General element specifying Domain related settings.

      " + )), + MOVED("General", "CycloneDDS/Domain/General"), +#if DDS_HAS_NETWORK_PARTITIONS + MOVED("Partitioning", "CycloneDDS/Domain/Partitioning"), +#endif +#if DDS_HAS_NETWORK_CHANNELS + MOVED("Channels", "CycloneDDS/Domain/Channels"), +#endif + MOVED("Threads", "CycloneDDS/Domain/Threads"), + MOVED("Sizing", "CycloneDDS/Domain/Sizing"), + MOVED("Compatibility", "CycloneDDS/Domain/Compatibility"), + MOVED("Discovery", "CycloneDDS/Domain/Discovery"), + MOVED("Tracing", "CycloneDDS/Domain/Tracing"), + MOVED("Internal|Unsupported", "CycloneDDS/Domain/Internal"), + MOVED("TCP", "CycloneDDS/Domain/TCP"), +#if DDS_HAS_SECURITY + MOVED("DDSSecurity", "CycloneDDS/Domain/Security"), +#endif +#if DDS_HAS_SSL + MOVED("SSL", "CycloneDDS/Domain/SSL"), +#endif +#ifdef DDS_HAS_SHM + MOVED("SharedMemory", "CycloneDDS/Domain/SharedMemory"), +#endif + MOVED("DDSI2E|DDSI2", "CycloneDDS/Domain"), + END_MARKER +}; + +static struct cfgelem root_cfgattrs[] = { + NOP("xmlns"), + NOP("xmlns:xsi"), + NOP("xsi:schemaLocation"), + NOP("xsi:noNamespaceSchemaLocation"), + END_MARKER +}; + +static struct cfgelem cyclonedds_root_cfgelems[] = { + GROUP("CycloneDDS", root_cfgelems, root_cfgattrs, 1, + NOMEMBER, + NOFUNCTIONS, + DESCRIPTION("CycloneDDS configuration")), + END_MARKER +}; + +#endif /* DDSI_CFGELEMS_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_cfgunits.h b/unitree_SDK/include/dds/ddsi/ddsi_cfgunits.h new file mode 100644 index 0000000..83666f6 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_cfgunits.h @@ -0,0 +1,48 @@ +/* + * Copyright(c) 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_CFGUNITS_H +#define DDSI_CFGUNITS_H + +static const struct cfgunit cfgunits[] = { + UNIT("bandwidth", + DESCRIPTION( + "

      The unit must be specified explicitly. Recognised units: " + "Xb/s, Xbps for bits/s or XB/s, XBps for " + "bytes/s; where X is an optional prefix: k for 103, " + "Ki for 210, M for 106, Mi for 220, " + "G for 109, Gi for 230.

      "), + PATTERN( + "0|(\\d+(\\.\\d*)?([Ee][\\-+]?\\d+)?|\\.\\d+([Ee][\\-+]?\\d+)?) *([kMG]i?)?[Bb][p/]s")), + UNIT("duration", + DESCRIPTION( + "

      The unit must be specified explicitly. Recognised units: ns, us, ms, " + "s, min, hr, day.

      "), + PATTERN( + "0|(\\d+(\\.\\d*)?([Ee][\\-+]?\\d+)?|\\.\\d+([Ee][\\-+]?\\d+)?) *([num]?s|min|hr|day)")), + UNIT("duration_inf", + DESCRIPTION( + "

      Valid values are finite durations with an explicit unit or the " + "keyword 'inf' for infinity. Recognised units: ns, us, ms, s, min, hr, " + "day.

      "), + PATTERN( + "inf|0|(\\d+(\\.\\d*)?([Ee][\\-+]?\\d+)?|\\.\\d+([Ee][\\-+]?\\d+)?) *([num]?s|min|hr|day)")), + UNIT("memsize", + DESCRIPTION( + "

      The unit must be specified explicitly. Recognised units: B (bytes), " + "kB & KiB (210 bytes), MB & MiB (220 bytes), GB & " + "GiB (230 bytes).

      "), + PATTERN( + "0|(\\d+(\\.\\d*)?([Ee][\\-+]?\\d+)?|\\.\\d+([Ee][\\-+]?\\d+)?) *([kMG]i?)?B")), + END_MARKER +}; + +#endif /* DDSI_CFGUNITS_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_config.h b/unitree_SDK/include/dds/ddsi/ddsi_config.h new file mode 100644 index 0000000..223ee7d --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_config.h @@ -0,0 +1,455 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_CONFIG_H +#define DDSI_CONFIG_H + +#include + +#include "dds/export.h" +#include "dds/features.h" +#include "dds/ddsrt/sched.h" +#include "dds/ddsrt/random.h" +#include "dds/ddsi/ddsi_portmapping.h" +#include "dds/ddsi/ddsi_locator.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_config; + +/** + * @brief Default-initialize a configuration (unstable) + * + * @param[out] cfg The configuration struct to be initialized. + */ +DDS_EXPORT void ddsi_config_init_default (struct ddsi_config *cfg); + +enum ddsi_standards_conformance { + DDSI_SC_PEDANTIC, + DDSI_SC_STRICT, + DDSI_SC_LAX +}; + +#define DDSI_SC_PEDANTIC_P(config) ((config).standards_conformance <= DDSI_SC_PEDANTIC) +#define DDSI_SC_STRICT_P(config) ((config).standards_conformance <= DDSI_SC_STRICT) + +enum ddsi_besmode { + DDSI_BESMODE_FULL, + DDSI_BESMODE_WRITERS, + DDSI_BESMODE_MINIMAL +}; + +enum ddsi_retransmit_merging { + DDSI_REXMIT_MERGE_NEVER, + DDSI_REXMIT_MERGE_ADAPTIVE, + DDSI_REXMIT_MERGE_ALWAYS +}; + +enum ddsi_boolean_default { + DDSI_BOOLDEF_DEFAULT, + DDSI_BOOLDEF_FALSE, + DDSI_BOOLDEF_TRUE +}; + +#ifdef DDS_HAS_SHM +enum ddsi_shm_loglevel { + DDSI_SHM_OFF = 0, + DDSI_SHM_FATAL, + DDSI_SHM_ERROR, + DDSI_SHM_WARN, + DDSI_SHM_INFO, + DDSI_SHM_DEBUG, + DDSI_SHM_VERBOSE +}; +#endif + +#define DDSI_PARTICIPANT_INDEX_AUTO -1 +#define DDSI_PARTICIPANT_INDEX_NONE -2 + +/* ddsi_config_listelem must be an overlay for all used listelem types */ +struct ddsi_config_listelem { + struct ddsi_config_listelem *next; +}; + +#ifdef DDS_HAS_NETWORK_PARTITIONS +struct networkpartition_address { + struct networkpartition_address *next; + ddsi_locator_t loc; +}; + +struct ddsi_config_networkpartition_listelem { + struct ddsi_config_networkpartition_listelem *next; + char *name; + char *address_string; + struct networkpartition_address *uc_addresses; + struct networkpartition_address *asm_addresses; +#ifdef DDS_HAS_SSM + struct networkpartition_address *ssm_addresses; +#endif +}; + +struct ddsi_config_ignoredpartition_listelem { + struct ddsi_config_ignoredpartition_listelem *next; + char *DCPSPartitionTopic; +}; + +struct ddsi_config_partitionmapping_listelem { + struct ddsi_config_partitionmapping_listelem *next; + char *networkPartition; + char *DCPSPartitionTopic; + struct ddsi_config_networkpartition_listelem *partition; +}; +#endif /* DDS_HAS_NETWORK_PARTITIONS */ + +#ifdef DDS_HAS_NETWORK_CHANNELS +struct ddsi_config_channel_listelem { + struct ddsi_config_channel_listelem *next; + char *name; + int priority; + int64_t resolution; +#ifdef DDS_HAS_BANDWIDTH_LIMITING + uint32_t data_bandwidth_limit; + uint32_t auxiliary_bandwidth_limit; +#endif + int diffserv_field; + struct thread_state *channel_reader_thrst; /* keeping an handle to the running thread for this channel */ + struct nn_dqueue *dqueue; /* The handle of teh delivery queue servicing incoming data for this channel*/ + struct xeventq *evq; /* The handle of the event queue servicing this channel*/ + uint32_t queueId; /* the index of the networkqueue serviced by this channel*/ + struct ddsi_tran_conn * transmit_conn; /* the connection used for sending data out via this channel */ +}; +#endif /* DDS_HAS_NETWORK_CHANNELS */ + +struct ddsi_config_maybe_int32 { + int isdefault; + int32_t value; +}; + +struct ddsi_config_maybe_uint32 { + int isdefault; + uint32_t value; +}; + +struct ddsi_config_thread_properties_listelem { + struct ddsi_config_thread_properties_listelem *next; + char *name; + ddsrt_sched_t sched_class; + struct ddsi_config_maybe_int32 schedule_priority; + struct ddsi_config_maybe_uint32 stack_size; +}; + +struct ddsi_config_peer_listelem +{ + struct ddsi_config_peer_listelem *next; + char *peer; +}; + +struct ddsi_config_prune_deleted_ppant { + int64_t delay; + int enforce_delay; +}; + +/* allow multicast bits (default depends on network type): */ +#define DDSI_AMC_FALSE 0u +#define DDSI_AMC_SPDP 1u +#define DDSI_AMC_ASM 2u +#ifdef DDS_HAS_SSM +#define DDSI_AMC_SSM 4u +#define DDSI_AMC_TRUE (DDSI_AMC_SPDP | DDSI_AMC_ASM | DDSI_AMC_SSM) +#else +#define DDSI_AMC_TRUE (DDSI_AMC_SPDP | DDSI_AMC_ASM) +#endif +#define DDSI_AMC_DEFAULT 0x80000000u + +/* FIXME: this should be fully dynamic ... but this is easier for a quick hack */ +enum ddsi_transport_selector { + DDSI_TRANS_DEFAULT, /* actually UDP, but this is so we can tell what has been set */ + DDSI_TRANS_UDP, + DDSI_TRANS_UDP6, + DDSI_TRANS_TCP, + DDSI_TRANS_TCP6, + DDSI_TRANS_RAWETH, + DDSI_TRANS_NONE /* FIXME: see FIXME above ... :( */ +}; + +enum ddsi_many_sockets_mode { + DDSI_MSM_NO_UNICAST, + DDSI_MSM_SINGLE_UNICAST, + DDSI_MSM_MANY_UNICAST +}; + +#ifdef DDS_HAS_SECURITY +struct ddsi_plugin_library_properties { + char *library_path; + char *library_init; + char *library_finalize; +}; + +struct ddsi_authentication_properties { + char *identity_certificate; + char *identity_ca; + char *private_key; + char *password; + char *trusted_ca_dir; + char *crl; + int include_optional_fields; +}; + +struct ddsi_access_control_properties { + char *permissions; + char *permissions_ca; + char *governance; +}; + +struct ddsi_config_omg_security { + struct ddsi_authentication_properties authentication_properties; + struct ddsi_access_control_properties access_control_properties; + struct ddsi_plugin_library_properties authentication_plugin; + struct ddsi_plugin_library_properties access_control_plugin; + struct ddsi_plugin_library_properties cryptography_plugin; +}; + +struct ddsi_config_omg_security_listelem { + struct ddsi_config_omg_security_listelem *next; + struct ddsi_config_omg_security cfg; +}; +#endif /* DDS_HAS_SECURITY */ + +#ifdef DDS_HAS_SSL +struct ddsi_config_ssl_min_version { + int major; + int minor; +}; +#endif + +struct ddsi_config_socket_buf_size { + struct ddsi_config_maybe_uint32 min, max; +}; + +struct ddsi_config_network_interface { + int automatic; + char *name; + char *address; + int prefer_multicast; + int presence_required; + enum ddsi_boolean_default multicast; + struct ddsi_config_maybe_int32 priority; +}; + +struct ddsi_config_network_interface_listelem { + struct ddsi_config_network_interface_listelem *next; + struct ddsi_config_network_interface cfg; +}; + +enum ddsi_config_entity_naming_mode { + DDSI_ENTITY_NAMING_DEFAULT_EMPTY, + DDSI_ENTITY_NAMING_DEFAULT_FANCY +}; + +/* Expensive checks (compiled in when NDEBUG not defined, enabled only if flag set in xchecks) */ +#define DDSI_XCHECK_WHC 1u +#define DDSI_XCHECK_RHC 2u +#define DDSI_XCHECK_XEV 4u + +struct ddsi_config +{ + int valid; + uint32_t tracemask; + uint32_t enabled_xchecks; + char *pcap_file; + + /* interfaces */ + struct ddsi_config_network_interface_listelem *network_interfaces; + + /* deprecated interface support */ + char *depr_networkAddressString; + int depr_prefer_multicast; + char *depr_assumeMulticastCapable; + + char **networkRecvAddressStrings; + uint32_t allowMulticast; + char *externalAddressString; + char *externalMaskString; + FILE *tracefp; + char *tracefile; + int tracingAppendToFile; + enum ddsi_transport_selector transport_selector; + enum ddsi_boolean_default compat_use_ipv6; + enum ddsi_boolean_default compat_tcp_enable; + int dontRoute; + int enableMulticastLoopback; + uint32_t domainId; + struct ddsi_config_maybe_uint32 extDomainId; // domain id advertised in discovery + char *domainTag; + int participantIndex; + int maxAutoParticipantIndex; + char *spdpMulticastAddressString; + char *defaultMulticastAddressString; + int64_t spdp_interval; + int64_t spdp_response_delay_max; + int64_t lease_duration; + int64_t const_hb_intv_sched; + int64_t const_hb_intv_sched_min; + int64_t const_hb_intv_sched_max; + int64_t const_hb_intv_min; + enum ddsi_retransmit_merging retransmit_merging; + int64_t retransmit_merging_period; + int squash_participants; + int liveliness_monitoring; + int noprogress_log_stacktraces; + int64_t liveliness_monitoring_interval; + int prioritize_retransmit; + enum ddsi_boolean_default multiple_recv_threads; + unsigned recv_thread_stop_maxretries; + + unsigned primary_reorder_maxsamples; + unsigned secondary_reorder_maxsamples; + + unsigned delivery_queue_maxsamples; + + uint16_t fragment_size; + uint32_t max_msg_size; + uint32_t max_rexmit_msg_size; + uint32_t init_transmit_extra_pct; + uint32_t max_rexmit_burst_size; + + int publish_uc_locators; /* Publish discovery unicast locators */ + int enable_uc_locators; /* If false, don't even try to create a unicast socket */ + +#ifdef DDS_HAS_TOPIC_DISCOVERY + int enable_topic_discovery_endpoints; +#endif + + /* TCP transport configuration */ + int tcp_nodelay; + int tcp_port; + int64_t tcp_read_timeout; + int64_t tcp_write_timeout; + int tcp_use_peeraddr_for_unicast; + +#ifdef DDS_HAS_SSL + /* SSL support for TCP */ + int ssl_enable; + int ssl_verify; + int ssl_verify_client; + int ssl_self_signed; + char * ssl_keystore; + char * ssl_rand_file; + char * ssl_key_pass; + char * ssl_ciphers; + struct ddsi_config_ssl_min_version ssl_min_version; +#endif + +#ifdef DDS_HAS_NETWORK_CHANNELS + struct ddsi_config_channel_listelem *channels; + struct ddsi_config_channel_listelem *max_channel; /* channel with highest prio; always computed */ +#endif /* DDS_HAS_NETWORK_CHANNELS */ +#ifdef DDS_HAS_NETWORK_PARTITIONS + struct ddsi_config_networkpartition_listelem *networkPartitions; + unsigned nof_networkPartitions; + struct ddsi_config_ignoredpartition_listelem *ignoredPartitions; + struct ddsi_config_partitionmapping_listelem *partitionMappings; +#endif /* DDS_HAS_NETWORK_PARTITIONS */ + struct ddsi_config_peer_listelem *peers; + struct ddsi_config_thread_properties_listelem *thread_properties; + + /* debug/test/undoc features: */ + int xmit_lossiness; /**<< fraction of packets to drop on xmit, in units of 1e-3 */ + uint32_t rmsg_chunk_size; /**<< size of a chunk in the receive buffer */ + uint32_t rbuf_size; /* << size of a single receiver buffer */ + enum ddsi_besmode besmode; + int meas_hb_to_ack_latency; + int unicast_response_to_spdp_messages; + int synchronous_delivery_priority_threshold; + int64_t synchronous_delivery_latency_bound; + + /* Write cache */ + + int whc_batch; + uint32_t whc_lowwater_mark; + uint32_t whc_highwater_mark; + struct ddsi_config_maybe_uint32 whc_init_highwater_mark; + int whc_adaptive; + + unsigned defrag_unreliable_maxsamples; + unsigned defrag_reliable_maxsamples; + unsigned accelerate_rexmit_block_size; + int64_t responsiveness_timeout; + uint32_t max_participants; + int64_t writer_linger_duration; + int multicast_ttl; + struct ddsi_config_socket_buf_size socket_rcvbuf_size; + struct ddsi_config_socket_buf_size socket_sndbuf_size; + int64_t ack_delay; + int64_t nack_delay; + int64_t preemptive_ack_delay; + int64_t schedule_time_rounding; + int64_t auto_resched_nack_delay; + int64_t ds_grace_period; +#ifdef DDS_HAS_BANDWIDTH_LIMITING + uint32_t auxiliary_bandwidth_limit; /* bytes/second */ +#endif + uint32_t max_queued_rexmit_bytes; + unsigned max_queued_rexmit_msgs; + unsigned ddsi2direct_max_threads; + int late_ack_mode; + int retry_on_reject_besteffort; + int generate_keyhash; + uint32_t max_sample_size; + + /* compability options */ + enum ddsi_standards_conformance standards_conformance; + int explicitly_publish_qos_set_to_default; + enum ddsi_many_sockets_mode many_sockets_mode; + int assume_rti_has_pmd_endpoints; + + struct ddsi_portmapping ports; + + int monitor_port; + + int enable_control_topic; + int initial_deaf; + int initial_mute; + int64_t initial_deaf_mute_reset; + + int use_multicast_if_mreqn; + struct ddsi_config_prune_deleted_ppant prune_deleted_ppant; + int redundant_networking; + +#ifdef DDS_HAS_SECURITY + struct ddsi_config_omg_security_listelem *omg_security_configuration; +#endif + +#ifdef DDS_HAS_SHM + int enable_shm; + char *shm_locator; + char *iceoryx_service; + enum ddsi_shm_loglevel shm_log_lvl; +#endif + + enum ddsi_config_entity_naming_mode entity_naming_mode; + ddsrt_prng_seed_t entity_naming_seed; + +#if defined (__cplusplus) +public: + ddsi_config() { + ddsi_config_init_default (this); + } +#endif +}; + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_CONFIG_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_config_impl.h b/unitree_SDK/include/dds/ddsi/ddsi_config_impl.h new file mode 100644 index 0000000..b22fa12 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_config_impl.h @@ -0,0 +1,37 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_CONFIG_H +#define NN_CONFIG_H + +#include + +#include "dds/ddsrt/attributes.h" +#include "dds/ddsi/ddsi_config.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct cfgst; +struct ddsrt_log_cfg; + +struct cfgst *ddsi_config_init (const char *config, struct ddsi_config *cfg, uint32_t domid) ddsrt_nonnull((1,2)); +void ddsi_config_print_cfgst (struct cfgst *cfgst, const struct ddsrt_log_cfg *logcfg); +void ddsi_config_print_rawconfig (const struct ddsi_config *cfg, const struct ddsrt_log_cfg *logcfg); +void ddsi_config_free_source_info (struct cfgst *cfgst); +void ddsi_config_fini (struct cfgst *cfgst); + +#if defined (__cplusplus) +} +#endif + +#endif /* NN_CONFIG_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_deadline.h b/unitree_SDK/include/dds/ddsi/ddsi_deadline.h new file mode 100644 index 0000000..29fcdbc --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_deadline.h @@ -0,0 +1,84 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_DEADLINE_H +#define DDSI_DEADLINE_H + +#include "dds/ddsrt/circlist.h" +#include "dds/ddsrt/time.h" +#include "dds/ddsi/ddsi_domaingv.h" +#include "dds/ddsi/q_xevent.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef ddsrt_mtime_t (*deadline_missed_cb_t)(void *hc, ddsrt_mtime_t tnow); + +struct deadline_adm { + struct ddsrt_circlist list; /* linked list for deadline missed */ + struct xevent *evt; /* xevent that triggers when deadline expires for an instance */ + deadline_missed_cb_t deadline_missed_cb; /* callback for deadline missed; this cb can use deadline_next_missed_locked to get next instance that has a missed deadline */ + size_t list_offset; /* offset of deadline_adm element in whc or rhc */ + size_t elem_offset; /* offset of deadline_elem element in whc or rhc instance */ + dds_duration_t dur; /* deadline duration */ +}; + +struct deadline_elem { + struct ddsrt_circlist_elem e; + ddsrt_mtime_t t_deadline; +}; + +DDS_EXPORT void deadline_init (const struct ddsi_domaingv *gv, struct deadline_adm *deadline_adm, size_t list_offset, size_t elem_offset, deadline_missed_cb_t deadline_missed_cb); +DDS_EXPORT void deadline_stop (const struct deadline_adm *deadline_adm); +DDS_EXPORT void deadline_clear (struct deadline_adm *deadline_adm); +DDS_EXPORT void deadline_fini (const struct deadline_adm *deadline_adm); +DDS_EXPORT ddsrt_mtime_t deadline_next_missed_locked (struct deadline_adm *deadline_adm, ddsrt_mtime_t tnow, void **instance); +DDS_EXPORT void deadline_register_instance_real (struct deadline_adm *deadline_adm, struct deadline_elem *elem, ddsrt_mtime_t tprev, ddsrt_mtime_t tnow); +DDS_EXPORT void deadline_unregister_instance_real (struct deadline_adm *deadline_adm, struct deadline_elem *elem); +DDS_EXPORT void deadline_renew_instance_real (struct deadline_adm *deadline_adm, struct deadline_elem *elem); + +DDS_INLINE_EXPORT inline void deadline_register_instance_locked (struct deadline_adm *deadline_adm, struct deadline_elem *elem, ddsrt_mtime_t tnow) +{ + if (deadline_adm->dur != DDS_INFINITY) + deadline_register_instance_real (deadline_adm, elem, tnow, tnow); +} + +DDS_INLINE_EXPORT inline void deadline_reregister_instance_locked (struct deadline_adm *deadline_adm, struct deadline_elem *elem, ddsrt_mtime_t tnow) +{ + if (deadline_adm->dur != DDS_INFINITY) + deadline_register_instance_real (deadline_adm, elem, elem->t_deadline, tnow); +} + +DDS_INLINE_EXPORT inline void deadline_unregister_instance_locked (struct deadline_adm *deadline_adm, struct deadline_elem *elem) +{ + if (deadline_adm->dur != DDS_INFINITY) + { + assert (elem->t_deadline.v != DDS_NEVER); + deadline_unregister_instance_real (deadline_adm, elem); + } +} + +DDS_INLINE_EXPORT inline void deadline_renew_instance_locked (struct deadline_adm *deadline_adm, struct deadline_elem *elem) +{ + if (deadline_adm->dur != DDS_INFINITY) + { + assert (elem->t_deadline.v != DDS_NEVER); + deadline_renew_instance_real (deadline_adm, elem); + } +} + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_DEADLINE_H */ + diff --git a/unitree_SDK/include/dds/ddsi/ddsi_deliver_locally.h b/unitree_SDK/include/dds/ddsi/ddsi_deliver_locally.h new file mode 100644 index 0000000..3eae903 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_deliver_locally.h @@ -0,0 +1,62 @@ +/* + * Copyright(c) 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_DELIVER_LOCALLY_H +#define DDSI_DELIVER_LOCALLY_H + +#include +#include + +#include "dds/export.h" +#include "dds/ddsrt/retcode.h" +#include "dds/ddsrt/avl.h" +#include "dds/ddsi/ddsi_guid.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_domaingv; +struct ddsi_tkmap_instance; +struct ddsi_sertype; +struct ddsi_serdata; +struct entity_index; +struct ddsi_reader; +struct ddsi_entity_common; +struct ddsi_writer_info; +struct ddsi_local_reader_ary; + +typedef struct ddsi_serdata * (*deliver_locally_makesample_t) (struct ddsi_tkmap_instance **tk, struct ddsi_domaingv *gv, struct ddsi_sertype const * const type, void *vsourceinfo); +typedef struct ddsi_reader * (*deliver_locally_first_reader_t) (struct entity_index *entity_index, struct ddsi_entity_common *source_entity, ddsrt_avl_iter_t *it); +typedef struct ddsi_reader * (*deliver_locally_next_reader_t) (struct entity_index *entity_index, ddsrt_avl_iter_t *it); + +/** return: + - DDS_RETCODE_OK to try again immediately + - DDS_RETCODE_TRY_AGAIN to complete restart the operation later + - anything else: error to be returned from deliver_locally_xxx */ +typedef dds_return_t (*deliver_locally_on_failure_fastpath_t) (struct ddsi_entity_common *source_entity, bool source_entity_locked, struct ddsi_local_reader_ary *fastpath_rdary, void *vsourceinfo); + +struct deliver_locally_ops { + deliver_locally_makesample_t makesample; + deliver_locally_first_reader_t first_reader; + deliver_locally_next_reader_t next_reader; + deliver_locally_on_failure_fastpath_t on_failure_fastpath; +}; + +dds_return_t deliver_locally_one (struct ddsi_domaingv *gv, struct ddsi_entity_common *source_entity, bool source_entity_locked, const ddsi_guid_t *rdguid, const struct ddsi_writer_info *wrinfo, const struct deliver_locally_ops * __restrict ops, void *vsourceinfo); + +dds_return_t deliver_locally_allinsync (struct ddsi_domaingv *gv, struct ddsi_entity_common *source_entity, bool source_entity_locked, struct ddsi_local_reader_ary *fastpath_rdary, const struct ddsi_writer_info *wrinfo, const struct deliver_locally_ops * __restrict ops, void *vsourceinfo); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_DELIVER_LOCALLY_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_domaingv.h b/unitree_SDK/include/dds/ddsi/ddsi_domaingv.h new file mode 100644 index 0000000..6d2bc5f --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_domaingv.h @@ -0,0 +1,357 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_DOMAINGV_H +#define DDSI_DOMAINGV_H + +#include + +#include "dds/export.h" +#include "dds/features.h" + +#include "dds/ddsrt/atomics.h" +#include "dds/ddsrt/sockets.h" +#include "dds/ddsrt/sync.h" +#include "dds/ddsrt/fibheap.h" +#include "dds/ddsrt/avl.h" +#include "dds/ddsrt/random.h" + +#include "dds/ddsi/ddsi_plist.h" +#include "dds/ddsi/ddsi_ownip.h" +#include "dds/ddsi/q_protocol.h" +#include "dds/ddsi/q_sockwaitset.h" +#include "dds/ddsi/ddsi_config_impl.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct nn_xmsgpool; +struct serdatapool; +struct nn_dqueue; +struct nn_reorder; +struct nn_defrag; +struct addrset; +struct xeventq; +struct gcreq_queue; +struct entity_index; +struct lease; +struct ddsi_tran_conn; +struct ddsi_tran_listener; +struct ddsi_tran_factory; +struct debug_monitor; +struct ddsi_tkmap; +struct dds_security_context; +struct dds_security_match_index; +struct ddsi_hsadmin; + +typedef struct config_in_addr_node { + ddsi_locator_t loc; + struct config_in_addr_node *next; +} config_in_addr_node; + +enum recvips_mode { + RECVIPS_MODE_ALL, /* all MC capable interfaces */ + RECVIPS_MODE_ANY, /* kernel-default interface */ + RECVIPS_MODE_PREFERRED, /* selected interface only */ + RECVIPS_MODE_NONE, /* no interfaces at all */ + RECVIPS_MODE_SOME /* explicit list of interfaces; only one requiring recvips */ +}; + +enum recv_thread_mode { + RTM_SINGLE, + RTM_MANY +}; + +struct recv_thread_arg { + enum recv_thread_mode mode; + struct nn_rbufpool *rbpool; + struct ddsi_domaingv *gv; + union { + struct { + const ddsi_locator_t *loc; + struct ddsi_tran_conn *conn; + } single; + struct { + os_sockWaitset ws; + } many; + } u; +}; + +struct deleted_participants_admin; + +struct ddsi_domaingv { + volatile int terminate; + volatile int deaf; + volatile int mute; + + struct ddsrt_log_cfg logconfig; + struct ddsi_config config; + + struct ddsi_tkmap * m_tkmap; + + /* Hash tables for participants, readers, writers, proxy + participants, proxy readers and proxy writers by GUID. */ + struct entity_index *entity_index; + + /* Timed events admin */ + struct xeventq *xevents; + + /* Queue for garbage collection requests */ + struct gcreq_queue *gcreq_queue; + + /* Lease junk */ + ddsrt_mutex_t leaseheap_lock; + ddsrt_fibheap_t leaseheap; + + /* Transport factories & selected factory */ + struct ddsi_tran_factory *ddsi_tran_factories; + struct ddsi_tran_factory *m_factory; + + /* Connections for multicast discovery & data, and those that correspond + to the one DDSI participant index that the DDSI2 service uses. The + DCPS participant of DDSI2 itself will be mirrored in a DDSI + participant, and in multi-socket mode that one gets its own + socket. */ + struct ddsi_tran_conn * disc_conn_mc; + struct ddsi_tran_conn * data_conn_mc; + struct ddsi_tran_conn * disc_conn_uc; + struct ddsi_tran_conn * data_conn_uc; + + /* Connection used for all output (for connectionless transports), this + used to simply be data_conn_uc, but: + + - Windows has a quirk that makes multicast delivery within a machine + utterly unreliable if the transmitting socket is bound to 0.0.0.0 + (despite all sockets having multicast interfaces set correctly), + but apparently only in the presence of sockets transmitting to the + same multicast group that have been bound to non-0.0.0.0 ... + - At least Fast-RTPS and Connext fail to honour the set of advertised + addresses and substitute 127.0.0.1 for the advertised IP address and + expect it to work. + - Fast-RTPS (at least) binds the socket it uses for transmitting + multicasts to non-0.0.0.0 + + So binding to 0.0.0.0 means the unicasts from Fast-RTPS & Connext will + arrive but the multicasts from Cyclone get dropped often on Windows + when trying to interoperate; and binding to the IP address means + unicast messages from the others fail to arrive (because they fail to + arrive). + + The only work around is to use a separate socket for sending. It is + rather sad that Cyclone needs to work around the bugs of the others, + but it seems the only way to get the users what they expect. */ +#define MAX_XMIT_CONNS 4 + struct ddsi_tran_conn * xmit_conns[MAX_XMIT_CONNS]; + ddsi_xlocator_t intf_xlocators[MAX_XMIT_CONNS]; + + /* TCP listener */ + struct ddsi_tran_listener * listener; + + /* In many sockets mode, the receive threads maintain a local array + with participant GUIDs and sockets, participant_set_generation is + used to notify them. */ + ddsrt_atomic_uint32_t participant_set_generation; + + /* nparticipants is used primarily for limiting the number of active + participants, but also during shutdown to determine when it is + safe to stop the GC thread. */ + ddsrt_mutex_t participant_set_lock; + ddsrt_cond_t participant_set_cond; + uint32_t nparticipants; + + /* For participants without (some) built-in writers, we fall back to + this participant, which is the first one created with all + built-in writers present. It MUST be created before any in need + of it pops up! */ + struct ddsi_participant *privileged_pp; + ddsrt_mutex_t privileged_pp_lock; + + /* For tracking (recently) deleted participants */ + struct deleted_participants_admin *deleted_participants; + + /* GUID to be used in next call to new_participant; also protected + by privileged_pp_lock */ + struct ddsi_guid ppguid_base; + + /* number of selected interfaces. */ + int n_interfaces; + struct nn_interface interfaces[MAX_XMIT_CONNS]; + /* whether we're using a link-local address (and therefore + only listening to multicasts on that interface) */ + int using_link_local_intf; + + /* Addressing: actual own (preferred) IP address, IP address + advertised in discovery messages (so that an external IP address on + a NAT may be advertised), and the DDSI multi-cast address. */ + enum recvips_mode recvips_mode; + struct config_in_addr_node *recvips; + ddsi_locator_t extmask; + + /* Locators */ + + ddsi_locator_t loc_spdp_mc; + ddsi_locator_t loc_meta_mc; + ddsi_locator_t loc_meta_uc; + ddsi_locator_t loc_default_mc; + ddsi_locator_t loc_default_uc; +#ifdef DDS_HAS_SHM + ddsi_locator_t loc_iceoryx_addr; +#endif + + /* + Initial discovery address set, and the current discovery address + set. These are the addresses that SPDP pings get sent to. + */ + struct addrset *as_disc; + + ddsrt_mutex_t lock; + + /* Receive thread. (We can only has one for now, cos of the signal + trigger socket.) Receive buffer pool is per receive thread, + it is only a global variable because it needs to be freed way later + than the receive thread itself terminates */ +#define MAX_RECV_THREADS 3 + uint32_t n_recv_threads; + struct recv_thread { + const char *name; + struct thread_state *thrst; + struct recv_thread_arg arg; + } recv_threads[MAX_RECV_THREADS]; + + /* Listener thread for connection based transports */ + struct thread_state *listen_ts; + + /* Flag cleared when stopping (receive threads). FIXME. */ + ddsrt_atomic_uint32_t rtps_keepgoing; + + /* Start time of the DDSI2 service, for logging relative time stamps, + should I ever so desire. */ + ddsrt_wctime_t tstart; + + /* Default QoSs for participant, readers and writers (needed for + eliminating default values in outgoing discovery packets, and for + supplying values for missing QoS settings in incoming discovery + packets); plus the actual QoSs needed for the builtin + endpoints. */ + ddsi_plist_t default_local_plist_pp; + dds_qos_t spdp_endpoint_xqos; + dds_qos_t builtin_endpoint_xqos_rd; + dds_qos_t builtin_endpoint_xqos_wr; +#ifdef DDS_HAS_TYPE_DISCOVERY + dds_qos_t builtin_volatile_xqos_rd; + dds_qos_t builtin_volatile_xqos_wr; +#endif +#ifdef DDS_HAS_SECURITY + dds_qos_t builtin_secure_volatile_xqos_rd; + dds_qos_t builtin_secure_volatile_xqos_wr; + dds_qos_t builtin_stateless_xqos_rd; + dds_qos_t builtin_stateless_xqos_wr; +#endif + + /* SPDP packets get very special treatment (they're the only packets + we accept from writers we don't know) and have their very own + do-nothing defragmentation and reordering thingummies, as well as a + global mutex to in lieu of the proxy writer lock. */ + ddsrt_mutex_t spdp_lock; + struct nn_defrag *spdp_defrag; + struct nn_reorder *spdp_reorder; + + /* Built-in stuff other than SPDP gets funneled through the builtins + delivery queue; currently just SEDP and PMD */ + struct nn_dqueue *builtins_dqueue; + + struct debug_monitor *debmon; + +#ifndef DDS_HAS_NETWORK_CHANNELS + uint32_t networkQueueId; + struct thread_state *channel_reader_thrst; + + /* Application data gets its own delivery queue */ + struct nn_dqueue *user_dqueue; +#endif + + /* Transmit side: pools for the serializer & transmit messages and a + transmit queue*/ + struct serdatapool *serpool; + struct nn_xmsgpool *xmsgpool; + struct ddsi_sertype *spdp_type; /* key = participant GUID */ + struct ddsi_sertype *sedp_reader_type; /* key = endpoint GUID */ + struct ddsi_sertype *sedp_writer_type; /* key = endpoint GUID */ + struct ddsi_sertype *sedp_topic_type; /* key = topic GUID */ + struct ddsi_sertype *pmd_type; /* participant message data */ +#ifdef DDS_HAS_TYPE_DISCOVERY + struct ddsi_sertype *tl_svc_request_type; /* TypeLookup service request, no key */ + struct ddsi_sertype *tl_svc_reply_type; /* TypeLookup service reply, no key */ +#endif +#ifdef DDS_HAS_SECURITY + struct ddsi_sertype *spdp_secure_type; /* key = participant GUID */ + struct ddsi_sertype *sedp_reader_secure_type; /* key = endpoint GUID */ + struct ddsi_sertype *sedp_writer_secure_type; /* key = endpoint GUID */ + struct ddsi_sertype *pmd_secure_type; /* participant message data */ + struct ddsi_sertype *pgm_stateless_type; /* participant generic message */ + struct ddsi_sertype *pgm_volatile_type; /* participant generic message */ +#endif + + ddsrt_mutex_t sendq_lock; + ddsrt_cond_t sendq_cond; + unsigned sendq_length; + struct nn_xpack *sendq_head; + struct nn_xpack *sendq_tail; + int sendq_stop; + struct thread_state *sendq_ts; + bool sendq_running; + ddsrt_mutex_t sendq_running_lock; + + /* File for dumping captured packets, NULL if disabled */ + FILE *pcap_fp; + ddsrt_mutex_t pcap_lock; + + struct ddsi_builtin_topic_interface *builtin_topic_interface; + + struct nn_group_membership *mship; + + ddsrt_mutex_t sertypes_lock; + struct ddsrt_hh *sertypes; + +#ifdef DDS_HAS_TYPE_DISCOVERY + ddsrt_mutex_t typelib_lock; + ddsrt_avl_tree_t typelib; + ddsrt_avl_tree_t typedeps; + ddsrt_avl_tree_t typedeps_reverse; + ddsrt_cond_t typelib_resolved_cond; +#endif +#ifdef DDS_HAS_TOPIC_DISCOVERY + ddsrt_mutex_t topic_defs_lock; + struct ddsrt_hh *topic_defs; +#endif + + ddsrt_mutex_t new_topic_lock; + ddsrt_cond_t new_topic_cond; + uint32_t new_topic_version; + + /* security globals */ +#ifdef DDS_HAS_SECURITY + struct dds_security_context *security_context; + struct ddsi_hsadmin *hsadmin; + bool handshake_include_optional; +#endif + + /* naming */ + ddsrt_mutex_t naming_lock; + ddsrt_prng_t naming_rng; +}; + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_DOMAINGV_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_endpoint.h b/unitree_SDK/include/dds/ddsi/ddsi_endpoint.h new file mode 100644 index 0000000..5ca97aa --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_endpoint.h @@ -0,0 +1,237 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_ENDPOINT_H +#define DDSI_ENDPOINT_H + +#include "dds/export.h" +#include "dds/features.h" + +#include "dds/ddsrt/fibheap.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_participant; +struct ddsi_type_pair; +struct ddsi_entity_common; +struct ddsi_endpoint_common; +struct dds_qos; + +/* Liveliness changed is more complicated than just add/remove. Encode the event + in ddsi_status_cb_data_t::extra and ignore ddsi_status_cb_data_t::add */ +enum ddsi_liveliness_changed_data_extra { + DDSI_LIVELINESS_CHANGED_ADD_ALIVE, + DDSI_LIVELINESS_CHANGED_ADD_NOT_ALIVE, + DDSI_LIVELINESS_CHANGED_REMOVE_NOT_ALIVE, + DDSI_LIVELINESS_CHANGED_REMOVE_ALIVE, + DDSI_LIVELINESS_CHANGED_ALIVE_TO_NOT_ALIVE, + DDSI_LIVELINESS_CHANGED_NOT_ALIVE_TO_ALIVE +}; + +struct ddsi_endpoint_common { + struct ddsi_participant *pp; + ddsi_guid_t group_guid; +#ifdef DDS_HAS_TYPE_DISCOVERY + struct ddsi_type_pair *type_pair; +#endif +}; + +enum ddsi_writer_state { + WRST_OPERATIONAL, /* normal situation */ + WRST_INTERRUPT, /* will be deleted, unblock throttle_writer but do not do anything further */ + WRST_LINGERING, /* writer deletion has been requested but still has unack'd data */ + WRST_DELETING /* writer is actually being deleted (removed from hash table) */ +}; + +typedef ddsrt_atomic_uint64_t seq_xmit_t; + +struct ldur_fhnode { + ddsrt_fibheap_node_t heapnode; + dds_duration_t ldur; +}; + +struct ddsi_writer +{ + struct ddsi_entity_common e; + struct ddsi_endpoint_common c; + ddsi_status_cb_t status_cb; + void * status_cb_entity; + ddsrt_cond_t throttle_cond; /* used to trigger a transmit thread blocked in throttle_writer() or wait_for_acks() */ + seqno_t seq; /* last sequence number (transmitted seqs are 1 ... seq, 0 when nothing published yet) */ + seqno_t cs_seq; /* 1st seq in coherent set (or 0) */ + seq_xmit_t seq_xmit; /* last sequence number actually transmitted */ + seqno_t min_local_readers_reject_seq; /* mimum of local_readers->last_deliv_seq */ + nn_count_t hbcount; /* last hb seq number */ + nn_count_t hbfragcount; /* last hb frag seq number */ + int throttling; /* non-zero when some thread is waiting for the WHC to shrink */ + struct hbcontrol hbcontrol; /* controls heartbeat timing, piggybacking */ + struct dds_qos *xqos; + enum ddsi_writer_state state; + unsigned reliable: 1; /* iff 1, writer is reliable <=> heartbeat_xevent != NULL */ + unsigned handle_as_transient_local: 1; /* controls whether data is retained in WHC */ + unsigned force_md5_keyhash: 1; /* iff 1, when keyhash has to be hashed, no matter the size */ + unsigned retransmitting: 1; /* iff 1, this writer is currently retransmitting */ + unsigned alive: 1; /* iff 1, the writer is alive (lease for this writer is not expired); field may be modified only when holding both wr->e.lock and wr->c.pp->e.lock */ + unsigned test_ignore_acknack : 1; /* iff 1, the writer ignores all arriving ACKNACK messages */ + unsigned test_suppress_retransmit : 1; /* iff 1, the writer does not respond to retransmit requests */ + unsigned test_suppress_heartbeat : 1; /* iff 1, the writer suppresses all periodic heartbeats */ + unsigned test_drop_outgoing_data : 1; /* iff 1, the writer drops outgoing data, forcing the readers to request a retransmit */ +#ifdef DDS_HAS_SHM + unsigned has_iceoryx : 1; +#endif +#ifdef DDS_HAS_SSM + unsigned supports_ssm: 1; + struct addrset *ssm_as; +#endif + uint32_t alive_vclock; /* virtual clock counting transitions between alive/not-alive */ + const struct ddsi_sertype * type; /* type of the data written by this writer */ + struct addrset *as; /* set of addresses to publish to */ + struct xevent *heartbeat_xevent; /* timed event for "periodically" publishing heartbeats when unack'd data present, NULL <=> unreliable */ + struct ldur_fhnode *lease_duration; /* fibheap node to keep lease duration for this writer, NULL in case of automatic liveliness with inifite duration */ + struct whc *whc; /* WHC tracking history, T-L durability service history + samples by sequence number for retransmit */ + uint32_t whc_low, whc_high; /* watermarks for WHC in bytes (counting only unack'd data) */ + ddsrt_etime_t t_rexmit_start; + ddsrt_etime_t t_rexmit_end; /* time of last 1->0 transition of "retransmitting" */ + ddsrt_etime_t t_whc_high_upd; /* time "whc_high" was last updated for controlled ramp-up of throughput */ + uint32_t init_burst_size_limit; /* derived from reader's receive_buffer_size */ + uint32_t rexmit_burst_size_limit; /* derived from reader's receive_buffer_size */ + uint32_t num_readers; /* total number of matching PROXY readers */ + uint32_t num_reliable_readers; /* number of matching reliable PROXY readers */ + uint32_t num_readers_requesting_keyhash; /* also +1 for protected keys and config override for generating keyhash */ + ddsrt_avl_tree_t readers; /* all matching PROXY readers, see struct ddsi_wr_prd_match */ + ddsrt_avl_tree_t local_readers; /* all matching LOCAL readers, see struct ddsi_wr_rd_match */ +#ifdef DDS_HAS_NETWORK_PARTITIONS + const struct ddsi_config_networkpartition_listelem *network_partition; +#endif + uint32_t num_acks_received; /* cum received ACKNACKs with no request for retransmission */ + uint32_t num_nacks_received; /* cum received ACKNACKs that did request retransmission */ + uint32_t throttle_count; /* cum times transmitting was throttled (whc hitting high-level mark) */ + uint32_t throttle_tracing; + uint32_t rexmit_count; /* cum samples retransmitted (counting events; 1 sample can be counted many times) */ + uint32_t rexmit_lost_count; /* cum samples lost but retransmit requested (also counting events) */ + uint64_t rexmit_bytes; /* cum bytes queued for retransmit */ + uint64_t time_throttled; /* cum time in throttled state */ + uint64_t time_retransmit; /* cum time in retransmitting state */ + struct xeventq *evq; /* timed event queue to be used by this writer */ + struct ddsi_local_reader_ary rdary; /* LOCAL readers for fast-pathing; if not fast-pathed, fall back to scanning local_readers */ + struct lease *lease; /* for liveliness administration (writer can only become inactive when using manual liveliness) */ +#ifdef DDS_HAS_SECURITY + struct ddsi_writer_sec_attributes *sec_attr; +#endif +}; + +struct ddsi_local_orphan_writer { + struct ddsi_writer wr; +}; + +struct ddsi_reader +{ + struct ddsi_entity_common e; + struct ddsi_endpoint_common c; + ddsi_status_cb_t status_cb; + void * status_cb_entity; + struct ddsi_rhc * rhc; /* reader history, tracks registrations and data */ + struct dds_qos *xqos; + unsigned reliable: 1; /* 1 iff reader is reliable */ + unsigned handle_as_transient_local: 1; /* 1 iff reader wants historical data from proxy writers */ + unsigned request_keyhash: 1; /* really controlled by the sertype */ +#ifdef DDS_HAS_SSM + unsigned favours_ssm: 1; /* iff 1, this reader favours SSM */ +#endif +#ifdef DDS_HAS_SHM + unsigned has_iceoryx : 1; +#endif + nn_count_t init_acknack_count; /* initial value for "count" (i.e. ACK seq num) for newly matched proxy writers */ +#ifdef DDS_HAS_NETWORK_PARTITIONS + struct networkpartition_address *uc_as; + struct networkpartition_address *mc_as; +#endif + const struct ddsi_sertype * type; /* type of the data read by this reader */ + uint32_t num_writers; /* total number of matching PROXY writers */ + ddsrt_avl_tree_t writers; /* all matching PROXY writers, see struct ddsi_rd_pwr_match */ + ddsrt_avl_tree_t local_writers; /* all matching LOCAL writers, see struct ddsi_rd_wr_match */ + ddsi2direct_directread_cb_t ddsi2direct_cb; + void *ddsi2direct_cbarg; +#ifdef DDS_HAS_SECURITY + struct ddsi_reader_sec_attributes *sec_attr; +#endif +}; + +DDS_EXPORT extern const ddsrt_avl_treedef_t ddsi_wr_readers_treedef; +DDS_EXPORT extern const ddsrt_avl_treedef_t ddsi_wr_local_readers_treedef; +DDS_EXPORT extern const ddsrt_avl_treedef_t ddsi_rd_writers_treedef; +DDS_EXPORT extern const ddsrt_avl_treedef_t ddsi_rd_local_writers_treedef; + +DDS_INLINE_EXPORT inline seqno_t ddsi_writer_read_seq_xmit (const struct ddsi_writer *wr) +{ + return ddsrt_atomic_ld64 (&wr->seq_xmit); +} + +DDS_INLINE_EXPORT inline void ddsi_writer_update_seq_xmit (struct ddsi_writer *wr, seqno_t nv) +{ + uint64_t ov; + do { + ov = ddsrt_atomic_ld64 (&wr->seq_xmit); + if (nv <= ov) break; + } while (!ddsrt_atomic_cas64 (&wr->seq_xmit, ov, nv)); +} + +// generic +bool ddsi_is_local_orphan_endpoint (const struct ddsi_entity_common *e); +int ddsi_is_keyed_endpoint_entityid (ddsi_entityid_t id); +int ddsi_is_builtin_volatile_endpoint (ddsi_entityid_t id); + +DDS_EXPORT int ddsi_is_builtin_endpoint (ddsi_entityid_t id, nn_vendorid_t vendorid); + +// writer +dds_return_t ddsi_new_writer_guid (struct ddsi_writer **wr_out, const struct ddsi_guid *guid, const struct ddsi_guid *group_guid, struct ddsi_participant *pp, const char *topic_name, const struct ddsi_sertype *type, const struct dds_qos *xqos, struct whc *whc, ddsi_status_cb_t status_cb, void *status_entity); +int ddsi_is_writer_entityid (ddsi_entityid_t id); +void ddsi_deliver_historical_data (const struct ddsi_writer *wr, const struct ddsi_reader *rd); +unsigned ddsi_remove_acked_messages (struct ddsi_writer *wr, struct whc_state *whcst, struct whc_node **deferred_free_list); +seqno_t ddsi_writer_max_drop_seq (const struct ddsi_writer *wr); +int ddsi_writer_must_have_hb_scheduled (const struct ddsi_writer *wr, const struct whc_state *whcst); +void ddsi_writer_set_retransmitting (struct ddsi_writer *wr); +void ddsi_writer_clear_retransmitting (struct ddsi_writer *wr); +dds_return_t ddsi_delete_writer_nolinger (struct ddsi_domaingv *gv, const struct ddsi_guid *guid); +void ddsi_writer_get_alive_state (struct ddsi_writer *wr, struct ddsi_alive_state *st); +void ddsi_rebuild_writer_addrset (struct ddsi_writer *wr); +void ddsi_writer_set_alive_may_unlock (struct ddsi_writer *wr, bool notify); +int ddsi_writer_set_notalive (struct ddsi_writer *wr, bool notify); + +DDS_EXPORT struct ddsi_local_orphan_writer *ddsi_new_local_orphan_writer (struct ddsi_domaingv *gv, ddsi_entityid_t entityid, const char *topic_name, struct ddsi_sertype *type, const struct dds_qos *xqos, struct whc *whc); +DDS_EXPORT void ddsi_delete_local_orphan_writer (struct ddsi_local_orphan_writer *wr); +DDS_EXPORT dds_return_t ddsi_new_writer (struct ddsi_writer **wr_out, struct ddsi_guid *wrguid, const struct ddsi_guid *group_guid, struct ddsi_participant *pp, const char *topic_name, const struct ddsi_sertype *type, const struct dds_qos *xqos, struct whc * whc, ddsi_status_cb_t status_cb, void *status_cb_arg); +DDS_EXPORT void ddsi_update_writer_qos (struct ddsi_writer *wr, const struct dds_qos *xqos); +DDS_EXPORT void ddsi_make_writer_info(struct ddsi_writer_info *wrinfo, const struct ddsi_entity_common *e, const struct dds_qos *xqos, uint32_t statusinfo); +DDS_EXPORT dds_return_t ddsi_writer_wait_for_acks (struct ddsi_writer *wr, const ddsi_guid_t *rdguid, dds_time_t abstimeout); +DDS_EXPORT dds_return_t ddsi_unblock_throttled_writer (struct ddsi_domaingv *gv, const struct ddsi_guid *guid); +DDS_EXPORT dds_return_t ddsi_delete_writer (struct ddsi_domaingv *gv, const struct ddsi_guid *guid); + +// reader +dds_return_t ddsi_new_reader_guid (struct ddsi_reader **rd_out, const struct ddsi_guid *guid, const struct ddsi_guid *group_guid, struct ddsi_participant *pp, const char *topic_name, const struct ddsi_sertype *type, const struct dds_qos *xqos, struct ddsi_rhc *rhc, ddsi_status_cb_t status_cb, void * status_entity); +int ddsi_is_reader_entityid (ddsi_entityid_t id); +void ddsi_reader_update_notify_wr_alive_state (struct ddsi_reader *rd, const struct ddsi_writer *wr, const struct ddsi_alive_state *alive_state); +void ddsi_reader_update_notify_pwr_alive_state (struct ddsi_reader *rd, const struct ddsi_proxy_writer *pwr, const struct ddsi_alive_state *alive_state); +void ddsi_reader_update_notify_pwr_alive_state_guid (const struct ddsi_guid *rd_guid, const struct ddsi_proxy_writer *pwr, const struct ddsi_alive_state *alive_state); +void ddsi_update_reader_init_acknack_count (const ddsrt_log_cfg_t *logcfg, const struct entity_index *entidx, const struct ddsi_guid *rd_guid, nn_count_t count); + +DDS_EXPORT dds_return_t ddsi_new_reader (struct ddsi_reader **rd_out, struct ddsi_guid *rdguid, const struct ddsi_guid *group_guid, struct ddsi_participant *pp, const char *topic_name, const struct ddsi_sertype *type, const struct dds_qos *xqos, struct ddsi_rhc * rhc, ddsi_status_cb_t status_cb, void *status_cb_arg); +DDS_EXPORT void ddsi_update_reader_qos (struct ddsi_reader *rd, const struct dds_qos *xqos); +DDS_EXPORT dds_return_t ddsi_delete_reader (struct ddsi_domaingv *gv, const struct ddsi_guid *guid); + + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_ENDPOINT_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_entity.h b/unitree_SDK/include/dds/ddsi/ddsi_entity.h new file mode 100644 index 0000000..c905a60 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_entity.h @@ -0,0 +1,134 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_ENTITY_H +#define DDSI_ENTITY_H + +#include "dds/export.h" +#include "dds/features.h" + +#include "dds/ddsrt/atomics.h" +#include "dds/ddsrt/avl.h" +#include "dds/ddsrt/fibheap.h" +#include "dds/ddsrt/sync.h" +#include "dds/ddsi/q_rtps.h" +#include "dds/ddsi/ddsi_plist.h" +#include "dds/ddsi/q_protocol.h" +#include "dds/ddsi/q_lat_estim.h" +#include "dds/ddsi/q_hbcontrol.h" +#include "dds/ddsi/q_feature_check.h" +#include "dds/ddsi/q_inverse_uint32_set.h" +#include "dds/ddsi/ddsi_typelib.h" +#include "dds/ddsi/ddsi_serdata_default.h" +#include "dds/ddsi/ddsi_handshake.h" +#include "dds/ddsi/ddsi_typelookup.h" +#include "dds/ddsi/ddsi_tran.h" +#include "dds/ddsi/ddsi_list_genptr.h" +#include "dds/ddsi/q_gc.h" +#include "dds/ddsi/q_lease.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct whc_node; +struct ddsi_plist; +struct nn_rsample_info; +struct nn_rdata; +struct ddsi_tkmap_instance; +struct ddsi_writer_info; +struct entity_index; + +typedef void (*ddsi2direct_directread_cb_t) (const struct nn_rsample_info *sampleinfo, const struct nn_rdata *fragchain, void *arg); + +enum ddsi_entity_kind { + DDSI_EK_PARTICIPANT, + DDSI_EK_PROXY_PARTICIPANT, + DDSI_EK_TOPIC, + DDSI_EK_WRITER, + DDSI_EK_PROXY_WRITER, + DDSI_EK_READER, + DDSI_EK_PROXY_READER +}; + +typedef struct ddsi_status_cb_data +{ + int raw_status_id; + uint32_t extra; + uint64_t handle; + bool add; +} ddsi_status_cb_data_t; + +typedef void (*ddsi_status_cb_t) (void *entity, const ddsi_status_cb_data_t *data); + +typedef struct ddsi_type_pair +#ifdef DDS_HAS_TYPE_DISCOVERY +{ + struct ddsi_type *minimal; + struct ddsi_type *complete; +} +#endif +ddsi_type_pair_t; + +struct ddsi_entity_common { + enum ddsi_entity_kind kind; + ddsi_guid_t guid; + ddsrt_wctime_t tupdate; /* timestamp of last update */ + uint64_t iid; + struct ddsi_tkmap_instance *tk; + ddsrt_mutex_t lock; + bool onlylocal; + struct ddsi_domaingv *gv; + ddsrt_avl_node_t all_entities_avlnode; + + /* QoS changes always lock the entity itself, and additionally + (and within the scope of the entity lock) acquire qos_lock + while manipulating the QoS. So any thread that needs to read + the QoS without acquiring the entity's lock can still do so + (e.g., the materialisation of samples for built-in topics + when connecting a reader to a writer for a built-in topic). + + qos_lock lock order across entities in is in increasing + order of entity addresses cast to uintptr_t. */ + ddsrt_mutex_t qos_lock; +}; + +struct ddsi_local_reader_ary { + ddsrt_mutex_t rdary_lock; + unsigned valid: 1; /* always true until (proxy-)writer is being deleted; !valid => !fastpath_ok */ + unsigned fastpath_ok: 1; /* if not ok, fall back to using GUIDs (gives access to the reader-writer match data for handling readers that bumped into resource limits, hence can flip-flop, unlike "valid") */ + uint32_t n_readers; + struct ddsi_reader **rdary; /* for efficient delivery, null-pointer terminated, grouped by topic */ +}; + +struct ddsi_alive_state { + bool alive; + uint32_t vclock; +}; + +bool ddsi_is_null_guid (const ddsi_guid_t *guid); +int ddsi_is_builtin_entityid (ddsi_entityid_t id, nn_vendorid_t vendorid); +bool ddsi_update_qos_locked (struct ddsi_entity_common *e, dds_qos_t *ent_qos, const dds_qos_t *xqos, ddsrt_wctime_t timestamp); +int ddsi_set_topic_type_name (dds_qos_t *xqos, const char * topic_name, const char * type_name); +int ddsi_compare_entityid (const void *a, const void *b); + +DDS_EXPORT int ddsi_compare_guid (const void *va, const void *vb); +DDS_EXPORT ddsi_entityid_t ddsi_to_entityid (unsigned u); +DDS_EXPORT nn_vendorid_t ddsi_get_entity_vendorid (const struct ddsi_entity_common *e); +DDS_EXPORT uint64_t ddsi_get_entity_instanceid (const struct ddsi_domaingv *gv, const struct ddsi_guid *guid); +DDS_EXPORT void ddsi_entity_common_init (struct ddsi_entity_common *e, struct ddsi_domaingv *gv, const struct ddsi_guid *guid, enum ddsi_entity_kind kind, ddsrt_wctime_t tcreate, nn_vendorid_t vendorid, bool onlylocal); +DDS_EXPORT void ddsi_entity_common_fini (struct ddsi_entity_common *e); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_ENTITY_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_entity_index.h b/unitree_SDK/include/dds/ddsi/ddsi_entity_index.h new file mode 100644 index 0000000..1b56cd7 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_entity_index.h @@ -0,0 +1,163 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_ENTITY_INDEX_H +#define DDSI_ENTITY_INDEX_H + +#include "dds/ddsrt/hopscotch.h" +#include "dds/ddsi/q_thread.h" +#include "dds/ddsi/ddsi_entity.h" +#include "dds/ddsi/ddsi_topic.h" +#include "dds/ddsi/ddsi_endpoint.h" +#include "dds/ddsi/ddsi_proxy_endpoint.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct entity_index; +struct ddsi_guid; +struct ddsi_domaingv; + +struct match_entities_range_key { + union { +#ifdef DDS_HAS_TOPIC_DISCOVERY + struct ddsi_topic tp; +#endif + struct ddsi_writer wr; + struct ddsi_reader rd; + struct ddsi_entity_common e; + struct ddsi_generic_proxy_endpoint gpe; + } entity; + struct dds_qos xqos; +#ifdef DDS_HAS_TOPIC_DISCOVERY + struct ddsi_topic_definition tpdef; +#endif +}; + +struct entidx_enum +{ + struct entity_index *entidx; + enum ddsi_entity_kind kind; + struct ddsi_entity_common *cur; +#ifndef NDEBUG + vtime_t vtime; +#endif +}; + +/* Readers & writers are both in a GUID- and in a GID-keyed table. If + they are in the GID-based one, they are also in the GUID-based one, + but not the way around, for two reasons: + + - firstly, there are readers & writers that do not have a GID + (built-in endpoints, fictitious transient data readers), + + - secondly, they are inserted first in the GUID-keyed one, and then + in the GID-keyed one. + + The GID is used solely for the interface with the OpenSplice + kernel, all internal state and protocol handling is done using the + GUID. So all this means is that, e.g., a writer being deleted + becomes invisible to the network reader slightly before it + disappears in the protocol handling, or that a writer might exist + at the protocol level slightly before the network reader can use it + to transmit data. */ + +struct entity_index *entity_index_new (struct ddsi_domaingv *gv) ddsrt_nonnull_all; +void entity_index_free (struct entity_index *ei) ddsrt_nonnull_all; + +void entidx_insert_participant_guid (struct entity_index *ei, struct ddsi_participant *pp) ddsrt_nonnull_all; +void entidx_insert_proxy_participant_guid (struct entity_index *ei, struct ddsi_proxy_participant *proxypp) ddsrt_nonnull_all; +void entidx_insert_writer_guid (struct entity_index *ei, struct ddsi_writer *wr) ddsrt_nonnull_all; +void entidx_insert_reader_guid (struct entity_index *ei, struct ddsi_reader *rd) ddsrt_nonnull_all; +void entidx_insert_proxy_writer_guid (struct entity_index *ei, struct ddsi_proxy_writer *pwr) ddsrt_nonnull_all; +void entidx_insert_proxy_reader_guid (struct entity_index *ei, struct ddsi_proxy_reader *prd) ddsrt_nonnull_all; + +void entidx_remove_participant_guid (struct entity_index *ei, struct ddsi_participant *pp) ddsrt_nonnull_all; +void entidx_remove_proxy_participant_guid (struct entity_index *ei, struct ddsi_proxy_participant *proxypp) ddsrt_nonnull_all; +void entidx_remove_writer_guid (struct entity_index *ei, struct ddsi_writer *wr) ddsrt_nonnull_all; +void entidx_remove_reader_guid (struct entity_index *ei, struct ddsi_reader *rd) ddsrt_nonnull_all; +void entidx_remove_proxy_writer_guid (struct entity_index *ei, struct ddsi_proxy_writer *pwr) ddsrt_nonnull_all; +void entidx_remove_proxy_reader_guid (struct entity_index *ei, struct ddsi_proxy_reader *prd) ddsrt_nonnull_all; + +DDS_EXPORT void *entidx_lookup_guid_untyped (const struct entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all; +DDS_EXPORT void *entidx_lookup_guid (const struct entity_index *ei, const struct ddsi_guid *guid, enum ddsi_entity_kind kind) ddsrt_nonnull_all; + +DDS_EXPORT struct ddsi_participant *entidx_lookup_participant_guid (const struct entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all; +DDS_EXPORT struct ddsi_proxy_participant *entidx_lookup_proxy_participant_guid (const struct entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all; +DDS_EXPORT struct ddsi_writer *entidx_lookup_writer_guid (const struct entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all; +DDS_EXPORT struct ddsi_reader *entidx_lookup_reader_guid (const struct entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all; +DDS_EXPORT struct ddsi_proxy_writer *entidx_lookup_proxy_writer_guid (const struct entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all; +DDS_EXPORT struct ddsi_proxy_reader *entidx_lookup_proxy_reader_guid (const struct entity_index *ei, const struct ddsi_guid *guid) ddsrt_nonnull_all; + +/* Enumeration of entries in the hash table: + + - "next" visits at least all entries that were in the hash table at + the time of calling init and that have not subsequently been + removed; + + - "next" may visit an entry more than once, but will do so only + because of rare events (i.e., resize or so); + + - the order in which entries are visited is arbitrary; + + - the caller must call init() before it may call next(); it must + call fini() before it may call init() again. */ +struct entidx_enum_participant { struct entidx_enum st; }; +struct entidx_enum_writer { struct entidx_enum st; }; +struct entidx_enum_reader { struct entidx_enum st; }; +struct entidx_enum_proxy_participant { struct entidx_enum st; }; +struct entidx_enum_proxy_writer { struct entidx_enum st; }; +struct entidx_enum_proxy_reader { struct entidx_enum st; }; + +void entidx_enum_init (struct entidx_enum *st, const struct entity_index *ei, enum ddsi_entity_kind kind) ddsrt_nonnull_all; +void entidx_enum_init_topic (struct entidx_enum *st, const struct entity_index *gh, enum ddsi_entity_kind kind, const char *topic, struct match_entities_range_key *max) ddsrt_nonnull_all; +void entidx_enum_init_topic_w_prefix (struct entidx_enum *st, const struct entity_index *ei, enum ddsi_entity_kind kind, const char *topic, const ddsi_guid_prefix_t *prefix, struct match_entities_range_key *max) ddsrt_nonnull_all; +void *entidx_enum_next_max (struct entidx_enum *st, const struct match_entities_range_key *max) ddsrt_nonnull_all; +void *entidx_enum_next (struct entidx_enum *st) ddsrt_nonnull_all; +void entidx_enum_fini (struct entidx_enum *st) ddsrt_nonnull_all; + +void entidx_enum_writer_init (struct entidx_enum_writer *st, const struct entity_index *ei) ddsrt_nonnull_all; +void entidx_enum_reader_init (struct entidx_enum_reader *st, const struct entity_index *ei) ddsrt_nonnull_all; +void entidx_enum_proxy_writer_init (struct entidx_enum_proxy_writer *st, const struct entity_index *ei) ddsrt_nonnull_all; +void entidx_enum_proxy_reader_init (struct entidx_enum_proxy_reader *st, const struct entity_index *ei) ddsrt_nonnull_all; +void entidx_enum_participant_init (struct entidx_enum_participant *st, const struct entity_index *ei) ddsrt_nonnull_all; +void entidx_enum_proxy_participant_init (struct entidx_enum_proxy_participant *st, const struct entity_index *ei) ddsrt_nonnull_all; + +struct ddsi_writer *entidx_enum_writer_next (struct entidx_enum_writer *st) ddsrt_nonnull_all; +struct ddsi_reader *entidx_enum_reader_next (struct entidx_enum_reader *st) ddsrt_nonnull_all; +struct ddsi_proxy_writer *entidx_enum_proxy_writer_next (struct entidx_enum_proxy_writer *st) ddsrt_nonnull_all; +struct ddsi_proxy_reader *entidx_enum_proxy_reader_next (struct entidx_enum_proxy_reader *st) ddsrt_nonnull_all; +struct ddsi_participant *entidx_enum_participant_next (struct entidx_enum_participant *st) ddsrt_nonnull_all; +struct ddsi_proxy_participant *entidx_enum_proxy_participant_next (struct entidx_enum_proxy_participant *st) ddsrt_nonnull_all; + +void entidx_enum_writer_fini (struct entidx_enum_writer *st) ddsrt_nonnull_all; +void entidx_enum_reader_fini (struct entidx_enum_reader *st) ddsrt_nonnull_all; +void entidx_enum_proxy_writer_fini (struct entidx_enum_proxy_writer *st) ddsrt_nonnull_all; +void entidx_enum_proxy_reader_fini (struct entidx_enum_proxy_reader *st) ddsrt_nonnull_all; +void entidx_enum_participant_fini (struct entidx_enum_participant *st) ddsrt_nonnull_all; +void entidx_enum_proxy_participant_fini (struct entidx_enum_proxy_participant *st) ddsrt_nonnull_all; + +#ifdef DDS_HAS_TOPIC_DISCOVERY +void entidx_insert_topic_guid (struct entity_index *ei, struct ddsi_topic *tp) ddsrt_nonnull_all; +void entidx_remove_topic_guid (struct entity_index *ei, struct ddsi_topic *tp) ddsrt_nonnull_all; +DDS_EXPORT struct ddsi_topic *entidx_lookup_topic_guid (const struct entity_index *ei, const struct ddsi_guid *guid); +struct entidx_enum_topic { struct entidx_enum st; }; +void entidx_enum_topic_init (struct entidx_enum_topic *st, const struct entity_index *ei) ddsrt_nonnull_all; +struct ddsi_topic *entidx_enum_topic_next (struct entidx_enum_topic *st) ddsrt_nonnull_all; +void entidx_enum_topic_fini (struct entidx_enum_topic *st) ddsrt_nonnull_all; +#endif + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_ENTITY_INDEX_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_entity_match.h b/unitree_SDK/include/dds/ddsi/ddsi_entity_match.h new file mode 100644 index 0000000..b3e97e8 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_entity_match.h @@ -0,0 +1,203 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_ENTITY_MATCH_H +#define DDSI_ENTITY_MATCH_H + +#include "dds/export.h" +#include "dds/features.h" + +#include "dds/ddsrt/avl.h" +#include "dds/ddsi/ddsi_entity.h" +#include "dds/ddsi/q_addrset.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_participant; +struct ddsi_proxy_participant; +struct ddsi_writer; +struct ddsi_reader; +struct ddsi_proxy_writer; +struct ddsi_proxy_reader; +struct ddsi_alive_state; +struct ddsi_generic_proxy_endpoint; + +struct bestab { + unsigned besflag; + unsigned entityid; + const char *topic_name; +}; + +#ifdef DDS_HAS_SECURITY +struct setab { + enum ddsi_entity_kind kind; + uint32_t id; +}; +#endif + +struct ddsi_prd_wr_match { + ddsrt_avl_node_t avlnode; + ddsi_guid_t wr_guid; +#ifdef DDS_HAS_SECURITY + int64_t crypto_handle; +#endif +}; + +struct ddsi_rd_pwr_match { + ddsrt_avl_node_t avlnode; + ddsi_guid_t pwr_guid; + unsigned pwr_alive: 1; /* tracks pwr's alive state */ + uint32_t pwr_alive_vclock; /* used to ensure progress */ +#ifdef DDS_HAS_SSM + ddsi_xlocator_t ssm_mc_loc; + ddsi_xlocator_t ssm_src_loc; +#endif +#ifdef DDS_HAS_SECURITY + int64_t crypto_handle; +#endif +}; + +struct ddsi_wr_rd_match { + ddsrt_avl_node_t avlnode; + ddsi_guid_t rd_guid; +}; + +struct ddsi_rd_wr_match { + ddsrt_avl_node_t avlnode; + ddsi_guid_t wr_guid; + unsigned wr_alive: 1; /* tracks wr's alive state */ + uint32_t wr_alive_vclock; /* used to ensure progress */ +}; + +struct ddsi_wr_prd_match { + ddsrt_avl_node_t avlnode; + ddsi_guid_t prd_guid; /* guid of the proxy reader */ + unsigned assumed_in_sync: 1; /* set to 1 upon receipt of ack not nack'ing msgs */ + unsigned has_replied_to_hb: 1; /* we must keep sending HBs until all readers have this set */ + unsigned all_have_replied_to_hb: 1; /* true iff 'has_replied_to_hb' for all readers in subtree */ + unsigned is_reliable: 1; /* true iff reliable proxy reader */ + seqno_t min_seq; /* smallest ack'd seq nr in subtree */ + seqno_t max_seq; /* sort-of highest ack'd seq nr in subtree (see augment function) */ + seqno_t seq; /* highest acknowledged seq nr */ + seqno_t last_seq; /* highest seq send to this reader used when filter is applied */ + uint32_t num_reliable_readers_where_seq_equals_max; + ddsi_guid_t arbitrary_unacked_reader; + nn_count_t prev_acknack; /* latest accepted acknack sequence number */ + nn_count_t prev_nackfrag; /* latest accepted nackfrag sequence number */ + ddsrt_etime_t t_acknack_accepted; /* (local) time an acknack was last accepted */ + ddsrt_etime_t t_nackfrag_accepted; /* (local) time a nackfrag was last accepted */ + struct nn_lat_estim hb_to_ack_latency; + ddsrt_wctime_t hb_to_ack_latency_tlastlog; + uint32_t non_responsive_count; + uint32_t rexmit_requests; +#ifdef DDS_HAS_SECURITY + int64_t crypto_handle; +#endif +}; + +enum pwr_rd_match_syncstate { + PRMSS_SYNC, /* in sync with proxy writer, has caught up with historical data */ + PRMSS_TLCATCHUP, /* in sync with proxy writer, pwr + readers still catching up on historical data */ + PRMSS_OUT_OF_SYNC /* not in sync with proxy writer */ +}; + +struct last_nack_summary { + seqno_t seq_end_p1; /* last seq for which we requested a retransmit */ + seqno_t seq_base; + uint32_t frag_end_p1; /* last fragnum of seq_last_nack for which requested a retransmit */ + uint32_t frag_base; +}; + +struct ddsi_pwr_rd_match { + ddsrt_avl_node_t avlnode; + ddsi_guid_t rd_guid; + ddsrt_mtime_t tcreate; + nn_count_t count; /* most recent acknack sequence number */ + nn_count_t prev_heartbeat; /* latest accepted heartbeat (see also add_proxy_writer_to_reader) */ + ddsrt_wctime_t hb_timestamp; /* time of most recent heartbeat that rescheduled the ack event */ + ddsrt_etime_t t_heartbeat_accepted; /* (local) time a heartbeat was last accepted */ + ddsrt_mtime_t t_last_nack; /* (local) time we last sent a NACK */ + ddsrt_mtime_t t_last_ack; /* (local) time we last sent any ACKNACK */ + seqno_t last_seq; /* last known sequence number from this writer */ + struct last_nack_summary last_nack; + struct xevent *acknack_xevent; /* entry in xevent queue for sending acknacks */ + enum pwr_rd_match_syncstate in_sync; /* whether in sync with the proxy writer */ + unsigned ack_requested : 1; /* set on receipt of HEARTBEAT with FINAL clear, cleared on sending an ACKNACK */ + unsigned heartbeat_since_ack : 1; /* set when a HEARTBEAT has been received since the last ACKNACK */ + unsigned heartbeatfrag_since_ack : 1; /* set when a HEARTBEATFRAG has been received since the last ACKNACK */ + unsigned directed_heartbeat : 1; /* set on receipt of a directed heartbeat, cleared on sending an ACKNACK */ + unsigned nack_sent_on_nackdelay : 1; /* set when the most recent NACK sent was because of the NackDelay */ + unsigned filtered : 1; + union { + struct { + seqno_t end_of_tl_seq; /* when seq >= end_of_tl_seq, it's in sync, =0 when not tl */ + struct nn_reorder *reorder; /* can be done (mostly) per proxy writer, but that is harder; only when state=OUT_OF_SYNC */ + } not_in_sync; + } u; +#ifdef DDS_HAS_SECURITY + int64_t crypto_handle; +#endif +}; + +void connect_writer_with_proxy_reader_secure (struct ddsi_writer *wr, struct ddsi_proxy_reader *prd, ddsrt_mtime_t tnow, int64_t crypto_handle); +void connect_reader_with_proxy_writer_secure (struct ddsi_reader *rd, struct ddsi_proxy_writer *pwr, ddsrt_mtime_t tnow, int64_t crypto_handle); +void match_writer_with_proxy_readers (struct ddsi_writer *wr, ddsrt_mtime_t tnow); +void match_writer_with_local_readers (struct ddsi_writer *wr, ddsrt_mtime_t tnow); +void match_reader_with_proxy_writers (struct ddsi_reader *rd, ddsrt_mtime_t tnow); +void match_reader_with_local_writers (struct ddsi_reader *rd, ddsrt_mtime_t tnow); +void match_proxy_writer_with_readers (struct ddsi_proxy_writer *pwr, ddsrt_mtime_t tnow); +void match_proxy_reader_with_writers (struct ddsi_proxy_reader *prd, ddsrt_mtime_t tnow); +void free_wr_prd_match (const struct ddsi_domaingv *gv, const ddsi_guid_t *wr_guid, struct ddsi_wr_prd_match *m); +void free_rd_pwr_match (struct ddsi_domaingv *gv, const ddsi_guid_t *rd_guid, struct ddsi_rd_pwr_match *m); +void free_pwr_rd_match (struct ddsi_pwr_rd_match *m); +void free_prd_wr_match (struct ddsi_prd_wr_match *m); +void free_rd_wr_match (struct ddsi_rd_wr_match *m); +void free_wr_rd_match (struct ddsi_wr_rd_match *m); + +void writer_add_connection (struct ddsi_writer *wr, struct ddsi_proxy_reader *prd, int64_t crypto_handle); +void writer_add_local_connection (struct ddsi_writer *wr, struct ddsi_reader *rd); +void reader_add_connection (struct ddsi_reader *rd, struct ddsi_proxy_writer *pwr, nn_count_t *init_count, const struct ddsi_alive_state *alive_state, int64_t crypto_handle); +void reader_add_local_connection (struct ddsi_reader *rd, struct ddsi_writer *wr, const struct ddsi_alive_state *alive_state); +void proxy_writer_add_connection (struct ddsi_proxy_writer *pwr, struct ddsi_reader *rd, ddsrt_mtime_t tnow, nn_count_t init_count, int64_t crypto_handle); +void proxy_reader_add_connection (struct ddsi_proxy_reader *prd, struct ddsi_writer *wr, int64_t crypto_handle); + +void writer_drop_connection (const struct ddsi_guid *wr_guid, const struct ddsi_proxy_reader *prd); +void writer_drop_local_connection (const struct ddsi_guid *wr_guid, struct ddsi_reader *rd); +void reader_drop_connection (const struct ddsi_guid *rd_guid, const struct ddsi_proxy_writer *pwr); +void reader_drop_local_connection (const struct ddsi_guid *rd_guid, const struct ddsi_writer *wr); +void proxy_writer_drop_connection (const struct ddsi_guid *pwr_guid, struct ddsi_reader *rd); +void proxy_reader_drop_connection (const struct ddsi_guid *prd_guid, struct ddsi_writer *wr); + +void local_reader_ary_init (struct ddsi_local_reader_ary *x); +void local_reader_ary_fini (struct ddsi_local_reader_ary *x); +void local_reader_ary_setinvalid (struct ddsi_local_reader_ary *x); +void local_reader_ary_insert (struct ddsi_local_reader_ary *x, struct ddsi_reader *rd); +void local_reader_ary_remove (struct ddsi_local_reader_ary *x, struct ddsi_reader *rd); +void local_reader_ary_setfastpath_ok (struct ddsi_local_reader_ary *x, bool fastpath_ok); + +#ifdef DDS_HAS_SECURITY +void handshake_end_cb (struct ddsi_handshake *handshake, struct ddsi_participant *pp, struct ddsi_proxy_participant *proxypp, enum ddsi_handshake_state result); +bool proxy_participant_has_pp_match (struct ddsi_domaingv *gv, struct ddsi_proxy_participant *proxypp); +void proxy_participant_create_handshakes (struct ddsi_domaingv *gv, struct ddsi_proxy_participant *proxypp); +void disconnect_proxy_participant_secure (struct ddsi_proxy_participant *proxypp); +void match_volatile_secure_endpoints (struct ddsi_participant *pp, struct ddsi_proxy_participant *proxypp); +void update_proxy_participant_endpoint_matching (struct ddsi_proxy_participant *proxypp, struct ddsi_participant *pp); +#endif + +DDS_EXPORT void ddsi_update_proxy_endpoint_matching (const struct ddsi_domaingv *gv, struct ddsi_generic_proxy_endpoint *proxy_ep); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_ENTITY_MATCH_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_guid.h b/unitree_SDK/include/dds/ddsi/ddsi_guid.h new file mode 100644 index 0000000..1b5efd7 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_guid.h @@ -0,0 +1,37 @@ +/* + * Copyright(c) 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_GUID_H +#define DDSI_GUID_H + +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef union ddsi_guid_prefix { + unsigned char s[12]; + uint32_t u[3]; +} ddsi_guid_prefix_t; +typedef union ddsi_entityid { + uint32_t u; +} ddsi_entityid_t; +typedef struct ddsi_guid { + ddsi_guid_prefix_t prefix; + ddsi_entityid_t entityid; +} ddsi_guid_t; + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_handshake.h b/unitree_SDK/include/dds/ddsi/ddsi_handshake.h new file mode 100644 index 0000000..939fc6c --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_handshake.h @@ -0,0 +1,226 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_HANDSHAKE_H +#define DDSI_HANDSHAKE_H + +#include "dds/ddsi/ddsi_entity.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_participant; +struct ddsi_proxy_participant; +struct ddsi_handshake; +struct dssi_hsadmin; + +enum ddsi_handshake_state { + STATE_HANDSHAKE_IN_PROGRESS, + STATE_HANDSHAKE_TIMED_OUT, + STATE_HANDSHAKE_FAILED, + STATE_HANDSHAKE_PROCESSED, + STATE_HANDSHAKE_SEND_TOKENS, + STATE_HANDSHAKE_OK +}; + +/* The handshake will not use the related handshake object after this callback + * was executed. This means that it can be deleted in this callback. */ +typedef void (*ddsi_handshake_end_cb_t)( + struct ddsi_handshake *handshake, + struct ddsi_participant *pp, + struct ddsi_proxy_participant *proxypp, + enum ddsi_handshake_state result); + +#ifdef DDS_HAS_SECURITY + +#include "dds/ddsi/ddsi_security_msg.h" + +/** + * @brief Release the handshake. + * + * This function will decrement the refcount associated with the handshake + * and delete the handshake when the refcount becomes 0. + * + * @param[in] handshake The handshake. + */ +void ddsi_handshake_release(struct ddsi_handshake *handshake); + +/** + * @brief Handle an authentication handshake message received from the remote participant. + * + * During the authentication phase handshake messages are being exchanged between the local and + * the remote participant. THis function will handle a handshake message received from a remote + * participant. + * + * @param[in] handshake The handshake. + * @param[in] pp The local participant. + * @param[in] proxypp The remote participant. + * @param[in] msg The handshake message received. + */ +void ddsi_handshake_handle_message(struct ddsi_handshake *handshake, const struct ddsi_participant *pp, const struct ddsi_proxy_participant *proxypp, const struct nn_participant_generic_message *msg); + +/** + * @brief Notify the handshake that crypto tokens have been received. + * + * The handshake could be finished at one end while the other side has not yet processed the + * final handshake messages. The arrival of crypto tokens signals that the other side has also finished + * processing the handshake. This function is used to signal the handshake that crypto tokens have been + * received. + * + * @param[in] handshake The handshake. + */ +void ddsi_handshake_crypto_tokens_received(struct ddsi_handshake *handshake); + +/** + * @brief Get the shared secret handle. + * + * During the handshake a shared secret is established which is used to encrypt + * and decrypt the crypto token exchange messages. This function will return a + * handle to the shared secret which will be passed to the crypto plugin to + * determine the session keys used for the echange of the the crypto tokens. + * + * @param[in] handshake The handshake. + * + * @returns handle to the shared sercet. + */ +int64_t ddsi_handshake_get_shared_secret(const struct ddsi_handshake *handshake); + +/** + * @brief Get the handshake handle + * + * This function returns the handshake handle that was returned by the authentication plugin + * when starting the handshake. + * + * @param[in] handshake The handshake. + * + * @returns The handshake handle. + */ +int64_t ddsi_handshake_get_handle(const struct ddsi_handshake *handshake); + +/** + * @brief Create and start the handshake for the participants + * + * This function will create a handshake for the specified local + * and remote participants when it does not yet exists. It will start the + * handshake procedure by calling the corresponding functions of the authentication plugin. + * The callback function is called by the handshake when to report events, + * for example to indicate that the handshake has finished or has failed. + * + * @param[in] pp The local participant. + * @param[in] proxypp The remote participant. + * @param[in] callback The callback function. + * + */ +void ddsi_handshake_register(struct ddsi_participant *pp, struct ddsi_proxy_participant *proxypp, ddsi_handshake_end_cb_t callback); + +/** + * @brief Remove the handshake associated with the specified participants. + * + * This function will remove the handshake from the handshake administation and release + * the handshake. When the handshake argument is not specified the handshake is searched + * in the handshake administation. + * + * @param[in] pp The local participant. + * @param[in] proxypp The remote participant. + * + */ +void ddsi_handshake_remove(struct ddsi_participant *pp, struct ddsi_proxy_participant *proxypp); + +/** + * @brief Searches for the handshake associated with the specified participants + * + * This function will search through the handshake administration to find the handshake + * corresponding the to specified local and remote participant. + * + * @param[in] pp The local participant. + * @param[in] proxypp The remote participant. + * + * @returns The handshake + */ +struct ddsi_handshake * ddsi_handshake_find(struct ddsi_participant *pp, struct ddsi_proxy_participant *proxypp); + +/** + * @brief Searches for the handshake associated with the specified participants + * + * This function will search through the handshake administration to find the handshake + * corresponding the to specified local and remote participant. + * + * @param[in] pp The local participant. + * @param[in] proxypp The remote participant. + * + * @returns The handshake + */ +struct ddsi_handshake * ddsi_handshake_find(struct ddsi_participant *pp, struct ddsi_proxy_participant *proxypp); + +/** + * @brief Initialize the handshake administration + * + * @param[in] gv The global parameters + */ +void ddsi_handshake_admin_init(struct ddsi_domaingv *gv); + +/** +* @brief Stop handshake background processing. +* +* @param[in] gv The global parameters +*/ +void ddsi_handshake_admin_stop(struct ddsi_domaingv *gv); + +/** + * @brief Deinitialze the handshake administration. + * + * @param[in] gv The global parameters + */ +void ddsi_handshake_admin_deinit(struct ddsi_domaingv *gv); + +#else /* DDS_HAS_SECURITY */ + +#include "dds/ddsi/q_unused.h" + +DDS_INLINE_EXPORT inline void ddsi_handshake_register(UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(struct ddsi_proxy_participant *proxypp), UNUSED_ARG(ddsi_handshake_end_cb_t callback)) +{ +} + +DDS_INLINE_EXPORT inline void ddsi_handshake_release(UNUSED_ARG(struct ddsi_handshake *handshake)) +{ +} + +DDS_INLINE_EXPORT inline void ddsi_handshake_crypto_tokens_received(UNUSED_ARG(struct ddsi_handshake *handshake)) +{ +} + +DDS_INLINE_EXPORT inline int64_t ddsi_handshake_get_shared_secret(UNUSED_ARG(const struct ddsi_handshake *handshake)) +{ + return 0; +} + +DDS_INLINE_EXPORT inline int64_t ddsi_handshake_get_handle(UNUSED_ARG(const struct ddsi_handshake *handshake)) +{ + return 0; +} + +DDS_INLINE_EXPORT inline void ddsi_handshake_remove(UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(struct ddsi_proxy_participant *proxypp), UNUSED_ARG(struct ddsi_handshake *handshake)) +{ +} + +DDS_INLINE_EXPORT inline struct ddsi_handshake * ddsi_handshake_find(UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(struct ddsi_proxy_participant *proxypp)) +{ + return NULL; +} + +#endif /* DDS_HAS_SECURITY */ + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_HANDSHAKE_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_iid.h b/unitree_SDK/include/dds/ddsi/ddsi_iid.h new file mode 100644 index 0000000..5e1d8d2 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_iid.h @@ -0,0 +1,35 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef _DDS_IID_H_ +#define _DDS_IID_H_ + +#include "dds/export.h" +#include "dds/ddsrt/atomics.h" +#include "dds/ddsrt/sync.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_iid { + ddsrt_atomic_uint64_t counter; + uint32_t key[4]; +}; + +DDS_EXPORT void ddsi_iid_init (void); +DDS_EXPORT void ddsi_iid_fini (void); +DDS_EXPORT uint64_t ddsi_iid_gen (void); + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_ipaddr.h b/unitree_SDK/include/dds/ddsi/ddsi_ipaddr.h new file mode 100644 index 0000000..2b49641 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_ipaddr.h @@ -0,0 +1,33 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_IPADDR_H +#define DDSI_IPADDR_H + +#include "dds/ddsi/ddsi_tran.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +enum ddsi_nearby_address_result ddsi_ipaddr_is_nearby_address (const ddsi_locator_t *loc, size_t ninterf, const struct nn_interface *interf, size_t *interf_idx); +enum ddsi_locator_from_string_result ddsi_ipaddr_from_string (ddsi_locator_t *loc, const char *str, int32_t kind); +int ddsi_ipaddr_compare (const struct sockaddr *const sa1, const struct sockaddr *const sa2); +char *ddsi_ipaddr_to_string (char *dst, size_t sizeof_dst, const ddsi_locator_t *loc, int with_port, const struct nn_interface *interf); +void ddsi_ipaddr_to_loc (ddsi_locator_t *dst, const struct sockaddr *src, int32_t kind); +void ddsi_ipaddr_to_xloc (const struct ddsi_tran_factory *tran, ddsi_xlocator_t *dst, const struct sockaddr *src, int32_t kind); +void ddsi_ipaddr_from_loc (struct sockaddr_storage *dst, const ddsi_locator_t *src); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_keyhash.h b/unitree_SDK/include/dds/ddsi/ddsi_keyhash.h new file mode 100644 index 0000000..b53d19e --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_keyhash.h @@ -0,0 +1,27 @@ +/* + * Copyright(c) 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_KEYHASH_H +#define DDSI_KEYHASH_H + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct ddsi_keyhash { + unsigned char value[16]; +} ddsi_keyhash_t; + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_lifespan.h b/unitree_SDK/include/dds/ddsi/ddsi_lifespan.h new file mode 100644 index 0000000..dc3d521 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_lifespan.h @@ -0,0 +1,61 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_LIFESPAN_H +#define DDSI_LIFESPAN_H + +#include "dds/ddsrt/fibheap.h" +#include "dds/ddsrt/time.h" +#include "dds/ddsi/ddsi_domaingv.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef ddsrt_mtime_t (*sample_expired_cb_t)(void *hc, ddsrt_mtime_t tnow); + +struct lifespan_adm { + ddsrt_fibheap_t ls_exp_heap; /* heap for sample expiration (lifespan) */ + struct xevent *evt; /* xevent that triggers for sample with earliest expiration */ + sample_expired_cb_t sample_expired_cb; /* callback for expired sample; this cb can use lifespan_next_expired_locked to get next expired sample */ + size_t fh_offset; /* offset of lifespan_adm element in whc or rhc */ + size_t fhn_offset; /* offset of lifespan_fhnode element in whc or rhc node (sample) */ +}; + +struct lifespan_fhnode { + ddsrt_fibheap_node_t heapnode; + ddsrt_mtime_t t_expire; +}; + +DDS_EXPORT void lifespan_init (const struct ddsi_domaingv *gv, struct lifespan_adm *lifespan_adm, size_t fh_offset, size_t fh_node_offset, sample_expired_cb_t sample_expired_cb); +DDS_EXPORT void lifespan_fini (const struct lifespan_adm *lifespan_adm); +DDS_EXPORT ddsrt_mtime_t lifespan_next_expired_locked (const struct lifespan_adm *lifespan_adm, ddsrt_mtime_t tnow, void **sample); +DDS_EXPORT void lifespan_register_sample_real (struct lifespan_adm *lifespan_adm, struct lifespan_fhnode *node); +DDS_EXPORT void lifespan_unregister_sample_real (struct lifespan_adm *lifespan_adm, struct lifespan_fhnode *node); + +DDS_INLINE_EXPORT inline void lifespan_register_sample_locked (struct lifespan_adm *lifespan_adm, struct lifespan_fhnode *node) +{ + if (node->t_expire.v != DDS_NEVER) + lifespan_register_sample_real (lifespan_adm, node); +} + +DDS_INLINE_EXPORT inline void lifespan_unregister_sample_locked (struct lifespan_adm *lifespan_adm, struct lifespan_fhnode *node) +{ + if (node->t_expire.v != DDS_NEVER) + lifespan_unregister_sample_real (lifespan_adm, node); +} + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_LIFESPAN_H */ + diff --git a/unitree_SDK/include/dds/ddsi/ddsi_list_genptr.h b/unitree_SDK/include/dds/ddsi/ddsi_list_genptr.h new file mode 100644 index 0000000..5ec71f7 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_list_genptr.h @@ -0,0 +1,103 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_LIST_GENPTR_H +#define DDSI_LIST_GENPTR_H + +#include +#include "dds/export.h" +#include "dds/ddsrt/types.h" +#include "dds/ddsi/ddsi_list_tmpl.h" + +#define NOARG +DDSI_LIST_TYPES_TMPL(generic_ptr_list, void *, NOARG, 32) +DDSI_LIST_DECLS_TMPL(extern, generic_ptr_list, void *, ddsrt_attribute_unused) +#undef NOARG + +#define DDSI_LIST_GENERIC_PTR_TYPES(prefix_) \ +typedef struct generic_ptr_list_node prefix_##_node_t; \ +typedef struct generic_ptr_list prefix_##_t; \ +typedef struct generic_ptr_list_iter prefix_##_iter_t; \ +typedef struct generic_ptr_list_iter_d prefix_##_iter_d_t; + +#define DDSI_LIST_GENERIC_PTR_DECL(linkage_, prefix_, elemT_, attrs_) \ +linkage_ void prefix_##_init (prefix_##_t *list) attrs_; \ +linkage_ void prefix_##_free (prefix_##_t *list) attrs_; \ +linkage_ elemT_ prefix_##_insert (prefix_##_t *list, elemT_ o) attrs_; \ +linkage_ elemT_ prefix_##_append (prefix_##_t *list, elemT_ o) attrs_; \ +linkage_ elemT_ prefix_##_iter_first (const prefix_##_t *list, prefix_##_iter_t *iter) attrs_; \ +linkage_ elemT_ prefix_##_iter_next (prefix_##_iter_t *iter) attrs_; \ +linkage_ elemT_ *prefix_##_iter_elem_addr (prefix_##_iter_t *iter) attrs_; \ +linkage_ elemT_ prefix_##_iter_d_first (prefix_##_t *list, prefix_##_iter_d_t *iter) attrs_; \ +linkage_ elemT_ prefix_##_iter_d_next (prefix_##_iter_d_t *iter) attrs_; \ +linkage_ void prefix_##_iter_d_remove (prefix_##_iter_d_t *iter) attrs_; \ +linkage_ elemT_ prefix_##_remove (prefix_##_t *list, elemT_ o) attrs_; \ +linkage_ elemT_ prefix_##_take_first (prefix_##_t *list) attrs_; \ +linkage_ elemT_ prefix_##_take_last (prefix_##_t *list) attrs_; \ +linkage_ uint32_t prefix_##_count (const prefix_##_t *list) attrs_; \ +linkage_ void prefix_##_append_list (prefix_##_t *list, prefix_##_t *b) attrs_; \ +linkage_ elemT_ *prefix_##_index_addr (prefix_##_t *list, uint32_t index) attrs_; \ +linkage_ elemT_ prefix_##_index (prefix_##_t *list, uint32_t index) attrs_; + +#define DDSI_LIST_GENERIC_PTR_CODE(linkage_, prefix_, elemT_, equals_) \ +linkage_ void prefix_##_init (prefix_##_t *list) { \ + generic_ptr_list_init ((struct generic_ptr_list *) list); \ +} \ +linkage_ void prefix_##_free (prefix_##_t *list) { \ + generic_ptr_list_free ((struct generic_ptr_list *) list); \ +} \ +linkage_ elemT_ prefix_##_insert (prefix_##_t *list, elemT_ o) { \ + return (elemT_) generic_ptr_list_insert ((struct generic_ptr_list *) list, (void *) o); \ +} \ +linkage_ elemT_ prefix_##_append (prefix_##_t *list, elemT_ o) { \ + return (elemT_) generic_ptr_list_append ((struct generic_ptr_list *) list, (void *) o); \ +} \ +linkage_ elemT_ prefix_##_iter_first (const prefix_##_t *list, prefix_##_iter_t *iter) { \ + return (elemT_) generic_ptr_list_iter_first ((struct generic_ptr_list *) list, (struct generic_ptr_list_iter *) iter); \ +} \ +linkage_ elemT_ prefix_##_iter_next (prefix_##_iter_t *iter) { \ + return (elemT_) generic_ptr_list_iter_next ((struct generic_ptr_list_iter *) iter); \ +} \ +linkage_ elemT_ *prefix_##_iter_elem_addr (prefix_##_iter_t *iter) { \ + return (elemT_ *) generic_ptr_list_iter_elem_addr ((struct generic_ptr_list_iter *) iter); \ +} \ +linkage_ elemT_ prefix_##_iter_d_first (prefix_##_t *list, prefix_##_iter_d_t *iter) { \ + return (elemT_) generic_ptr_list_iter_d_first ((struct generic_ptr_list *) list, (struct generic_ptr_list_iter_d *) iter); \ +} \ +linkage_ elemT_ prefix_##_iter_d_next (prefix_##_iter_d_t *iter) { \ + return (elemT_) generic_ptr_list_iter_d_next ((struct generic_ptr_list_iter_d *) iter);\ +} \ +linkage_ void prefix_##_iter_d_remove (prefix_##_iter_d_t *iter) { \ + generic_ptr_list_iter_d_remove ((struct generic_ptr_list_iter_d *) iter); \ +} \ +linkage_ elemT_ prefix_##_remove (prefix_##_t *list, elemT_ o) { \ + return (elemT_) generic_ptr_list_remove ((struct generic_ptr_list *) list, (void *) o, (generic_ptr_list_eq_fn) equals_); \ +} \ +linkage_ elemT_ prefix_##_take_first (prefix_##_t *list) { \ + return (elemT_) generic_ptr_list_take_first ((struct generic_ptr_list *) list); \ +} \ +linkage_ elemT_ prefix_##_take_last (prefix_##_t *list) { \ + return (elemT_) generic_ptr_list_take_last ((struct generic_ptr_list *) list); \ +} \ +linkage_ uint32_t prefix_##_count (const prefix_##_t *list) { \ + return generic_ptr_list_count ((struct generic_ptr_list *) list); \ +} \ +linkage_ void prefix_##_append_list (prefix_##_t *list, prefix_##_t *b) { \ + generic_ptr_list_append_list ((struct generic_ptr_list *) list, (struct generic_ptr_list *) b); \ +} \ +linkage_ elemT_ *prefix_##_index_addr (prefix_##_t *list, uint32_t index) { \ + return (elemT_ *) generic_ptr_list_index_addr ((struct generic_ptr_list *) list, index); \ +} \ +linkage_ elemT_ prefix_##_index (prefix_##_t *list, uint32_t index) { \ + return (elemT_) generic_ptr_list_index ((struct generic_ptr_list *) list, index); \ +} + +#endif /* DDSI_LIST_GENPTR_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_list_tmpl.h b/unitree_SDK/include/dds/ddsi/ddsi_list_tmpl.h new file mode 100644 index 0000000..a962a65 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_list_tmpl.h @@ -0,0 +1,318 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_LIST_TMPL_H +#define DDSI_LIST_TMPL_H + +#define DDSI_LIST_TYPES_TMPL(prefix_, elemT_, extension_, batch_) \ +struct prefix_##_node { \ + struct prefix_##_node *next; \ + uint32_t first, lastp1; \ + elemT_ ary[(batch_)]; \ +}; \ + \ +struct prefix_ { \ + struct prefix_##_node *head; \ + struct prefix_##_node *tail; \ + uint32_t count; \ + extension_ \ +}; \ + \ +struct prefix_##_iter { \ + struct prefix_##_node *node; \ + uint32_t idx; \ +}; \ + \ +struct prefix_##_iter_d { \ + struct prefix_ *list; \ + struct prefix_##_node *node; \ + struct prefix_##_node *prev; \ + uint32_t idx; \ +}; \ + \ +typedef int (*prefix_##_eq_fn)(const elemT_, const elemT_); + +#ifndef NDEBUG +#define DDSI_LIST_TMPL_POISON(x) do { x = (void *)1; } while (0) +#else +#define DDSI_LIST_TMPL_POISON(x) do {} while (0) +#endif + +#define DDSI_LIST_DECLS_TMPL(linkage_, prefix_, elemT_, attrs_) \ +linkage_ void prefix_##_init (struct prefix_ *list) attrs_; \ +linkage_ void prefix_##_free (struct prefix_ *list) attrs_; \ +linkage_ elemT_ prefix_##_insert (struct prefix_ *list, elemT_ o) attrs_; \ +linkage_ elemT_ prefix_##_append (struct prefix_ *list, elemT_ o) attrs_; \ +linkage_ elemT_ prefix_##_iter_first (const struct prefix_ *list, struct prefix_##_iter *iter) attrs_; \ +linkage_ elemT_ prefix_##_iter_next (struct prefix_##_iter *iter) attrs_; \ +linkage_ elemT_ *prefix_##_iter_elem_addr (struct prefix_##_iter *iter) attrs_; \ +linkage_ elemT_ prefix_##_iter_d_first (struct prefix_ *list, struct prefix_##_iter_d *iter) attrs_; \ +linkage_ elemT_ prefix_##_iter_d_next (struct prefix_##_iter_d *iter) attrs_; \ +linkage_ void prefix_##_iter_d_remove (struct prefix_##_iter_d *iter) attrs_; \ +linkage_ elemT_ prefix_##_remove (struct prefix_ *list, elemT_ o, prefix_##_eq_fn) attrs_; \ +linkage_ elemT_ prefix_##_take_first (struct prefix_ *list) attrs_; \ +linkage_ elemT_ prefix_##_take_last (struct prefix_ *list) attrs_; \ +linkage_ uint32_t prefix_##_count (const struct prefix_ *list) attrs_; \ +linkage_ void prefix_##_append_list (struct prefix_ *list, struct prefix_ *b) attrs_; \ +linkage_ elemT_ *prefix_##_index_addr (struct prefix_ *list, uint32_t index) attrs_; \ +linkage_ elemT_ prefix_##_index (struct prefix_ *list, uint32_t index) attrs_; + +#define DDSI_LIST_CODE_TMPL(linkage_, prefix_, elemT_, null_, malloc_, free_) \ +linkage_ void prefix_##_init (struct prefix_ *list) \ +{ \ + list->head = NULL; \ + list->tail = NULL; \ + list->count = 0; \ +} \ + \ +linkage_ void prefix_##_free (struct prefix_ *list) \ +{ \ + /* Note: just free, not re-init */ \ + struct prefix_##_node *n; \ + while ((n = list->head) != NULL) \ + { \ + list->head = n->next; \ + free_ (n); \ + } \ +} \ + \ +linkage_ elemT_ prefix_##_insert (struct prefix_ *list, elemT_ o) \ +{ \ + struct prefix_##_node *n; \ + const uint32_t bs = (uint32_t) (sizeof (n->ary) / sizeof (n->ary[0])); \ + if (list->head != NULL && list->head->first > 0) \ + n = list->head; \ + else \ + { \ + if ((n = (malloc_ (sizeof (struct prefix_##_node)))) == NULL) \ + return null_; \ + n->next = list->head; \ + n->first = n->lastp1 = bs; \ + if (list->head == NULL) \ + list->tail = n; \ + list->head = n; \ + } \ + n->ary[--n->first] = o; \ + list->count++; \ + return o; \ +} \ + \ +linkage_ elemT_ prefix_##_append (struct prefix_ *list, elemT_ o) \ +{ \ + struct prefix_##_node *n; \ + const uint32_t bs = (uint32_t) (sizeof (n->ary) / sizeof (n->ary[0])); \ + if (list->head != NULL && list->tail->lastp1 < bs) \ + n = list->tail; \ + else \ + { \ + if ((n = (malloc_ (sizeof (struct prefix_##_node)))) == NULL) \ + return null_; \ + n->next = NULL; \ + n->first = n->lastp1 = 0; \ + if (list->head == NULL) \ + list->head = n; \ + else \ + list->tail->next = n; \ + list->tail = n; \ + } \ + n->ary[n->lastp1++] = o; \ + list->count++; \ + return o; \ +} \ + \ +linkage_ elemT_ prefix_##_iter_first (const struct prefix_ *list, struct prefix_##_iter *iter) \ +{ \ + iter->node = list->head; \ + if (iter->node == NULL) \ + { \ + iter->idx = 0; \ + return null_; \ + } \ + iter->idx = iter->node->first; \ + if (iter->node->first < iter->node->lastp1) \ + return iter->node->ary[iter->idx]; \ + return null_; \ +} \ + \ +linkage_ elemT_ prefix_##_iter_next (struct prefix_##_iter *iter) \ +{ \ + /* You MAY NOT call _list_iter_next after having received a null \ + * pointer from _iter_first or _iter_next */ \ + assert (iter->node != NULL); \ + if (iter->idx+1 < iter->node->lastp1) \ + return iter->node->ary[++iter->idx]; \ + if (iter->node->next == NULL) \ + return null_; \ + iter->node = iter->node->next; \ + iter->idx = iter->node->first; \ + return iter->node->ary[iter->idx]; \ +} \ + \ +linkage_ elemT_ *prefix_##_iter_elem_addr (struct prefix_##_iter *iter) \ +{ \ + assert (iter->node != NULL); \ + return &iter->node->ary[iter->idx]; \ +} \ + \ +linkage_ elemT_ prefix_##_iter_d_first (struct prefix_ *list, struct prefix_##_iter_d *iter) \ +{ \ + iter->list = list; \ + iter->node = list->head; \ + iter->prev = NULL; \ + if (iter->node == NULL) \ + { \ + iter->idx = 0; \ + return null_; \ + } \ + iter->idx = iter->node->first; \ + if (iter->node->first < iter->node->lastp1) \ + return iter->node->ary[iter->idx]; \ + return null_; \ +} \ + \ +linkage_ elemT_ prefix_##_iter_d_next (struct prefix_##_iter_d *iter) \ +{ \ + /* You MAY NOT call _list_iter_d_next after having received a null \ + * pointer from _iter_d_first or _iter_d_next */ \ + if (iter->node == NULL) \ + return prefix_##_iter_d_first (iter->list, iter); \ + if (iter->idx+1 < iter->node->lastp1) \ + return iter->node->ary[++iter->idx]; \ + if (iter->node->next == NULL) \ + return null_; \ + iter->prev = iter->node; \ + iter->node = iter->node->next; \ + iter->idx = iter->node->first; \ + return iter->node->ary[iter->idx]; \ +} \ + \ +linkage_ void prefix_##_iter_d_remove (struct prefix_##_iter_d *iter) \ +{ \ + struct prefix_ * const list = iter->list; \ + struct prefix_##_node * const n = iter->node; \ + uint32_t j; \ + assert(iter->node); \ + list->count--; \ + for (j = iter->idx; j > n->first; j--) \ + n->ary[j] = n->ary[j-1]; \ + n->first++; \ + if (n->first == n->lastp1) \ + { \ + if (n == list->tail) \ + list->tail = iter->prev; \ + if (iter->prev) \ + { \ + iter->prev->next = n->next; \ + iter->node = iter->prev; \ + iter->idx = iter->prev->lastp1; \ + DDSI_LIST_TMPL_POISON(iter->prev); \ + } \ + else \ + { \ + list->head = n->next; \ + iter->node = NULL; /* removed first entry, restart */ \ + } \ + free_ (n); \ + } \ +} \ + \ +linkage_ elemT_ prefix_##_remove (struct prefix_ *list, elemT_ o, prefix_##_eq_fn equals) \ +{ \ + struct prefix_##_iter_d iter; \ + elemT_ obj; \ + for (obj = prefix_##_iter_d_first (list, &iter); !(equals (obj, null_)); obj = prefix_##_iter_d_next (&iter)) \ + { \ + if (equals (obj, o)) \ + { \ + prefix_##_iter_d_remove (&iter); \ + return obj; \ + } \ + } \ + return null_; \ +} \ + \ +linkage_ elemT_ prefix_##_take_first (struct prefix_ *list) \ +{ \ + if (list->count == 0) \ + return null_; \ + struct prefix_##_iter_d iter; \ + elemT_ obj = prefix_##_iter_d_first (list, &iter); \ + prefix_##_iter_d_remove (&iter); \ + return obj; \ +} \ + \ +linkage_ elemT_ prefix_##_take_last (struct prefix_ *list) \ +{ \ + if (list->count == 0) \ + return null_; \ + struct prefix_##_iter_d iter; \ + uint32_t i; \ + elemT_ obj; \ + obj = prefix_##_iter_d_first (list, &iter); \ + for (i = 0; i < list->count - 1; i++) \ + obj = prefix_##_iter_d_next (&iter); \ + prefix_##_iter_d_remove (&iter); \ + return obj; \ +} \ + \ +linkage_ uint32_t prefix_##_count (const struct prefix_ *list) \ +{ \ + return list->count; \ +} \ + \ +linkage_ void prefix_##_append_list (struct prefix_ *list, struct prefix_ *b) \ +{ \ + if (list->head == NULL) \ + *list = *b; \ + else if (b->head != NULL) \ + { \ + list->tail->next = b->head; \ + list->tail = b->tail; \ + list->count += b->count; \ + } \ +} \ + \ +linkage_ elemT_ *prefix_##_index_addr (struct prefix_ *list, uint32_t index) \ +{ \ + struct prefix_##_node *n; \ + uint32_t pos = 0; \ + if (index >= list->count) \ + return NULL; \ + if (index == list->count - 1) \ + { \ + n = list->tail; \ + pos = list->count - (n->lastp1 - n->first); \ + } \ + else \ + { \ + for (n = list->head; n; n = n->next) \ + { \ + const uint32_t c = n->lastp1 - n->first; \ + if (pos + c > index) \ + break; \ + pos += c; \ + } \ + } \ + if (n == NULL) \ + return NULL; \ + assert (pos <= index && index < pos + n->lastp1 - n->first); \ + return &n->ary[n->first + (index - pos)]; \ +} \ + \ +linkage_ elemT_ prefix_##_index (struct prefix_ *list, uint32_t index) \ +{ \ + elemT_ *p = prefix_##_index_addr (list, index); \ + if (p == NULL) \ + return null_; \ + return *p; \ +} + +#endif /* DDSI_LIST_TMPL_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_locator.h b/unitree_SDK/include/dds/ddsi/ddsi_locator.h new file mode 100644 index 0000000..891f8fe --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_locator.h @@ -0,0 +1,39 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_LOCATOR_H +#define DDSI_LOCATOR_H + +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_tran_factory; +struct ddsi_tran_conn; + +/* address field in locator maintained in network byte order, the rest in host */ +typedef struct { + int32_t kind; + uint32_t port; + unsigned char address[16]; +} ddsi_locator_t; +typedef struct { + ddsi_locator_t c; + struct ddsi_tran_conn *conn; +} ddsi_xlocator_t; + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_LOCATOR_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_mcgroup.h b/unitree_SDK/include/dds/ddsi/ddsi_mcgroup.h new file mode 100644 index 0000000..b15f0f9 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_mcgroup.h @@ -0,0 +1,34 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_MCGROUP_H +#define DDSI_MCGROUP_H + +#include "dds/ddsi/ddsi_tran.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct nn_group_membership; + +struct nn_group_membership *new_group_membership (void); +void free_group_membership (struct nn_group_membership *mship); +int ddsi_join_mc (const struct ddsi_domaingv *gv, struct nn_group_membership *mship, ddsi_tran_conn_t conn, const ddsi_locator_t *srcip, const ddsi_locator_t *mcip); +int ddsi_leave_mc (const struct ddsi_domaingv *gv, struct nn_group_membership *mship, ddsi_tran_conn_t conn, const ddsi_locator_t *srcip, const ddsi_locator_t *mcip); +void ddsi_transfer_group_membership (struct nn_group_membership *mship, ddsi_tran_conn_t conn, ddsi_tran_conn_t newconn); +int ddsi_rejoin_transferred_mcgroups (const struct ddsi_domaingv *gv, struct nn_group_membership *mship, ddsi_tran_conn_t conn); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_ownip.h b/unitree_SDK/include/dds/ddsi/ddsi_ownip.h new file mode 100644 index 0000000..c5857e9 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_ownip.h @@ -0,0 +1,48 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_OWNIP_H +#define DDSI_OWNIP_H + +#include + +#include "dds/ddsrt/ifaddrs.h" +#include "dds/ddsrt/sockets.h" +#include "dds/ddsi/ddsi_locator.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_domaingv; + +struct nn_interface { + ddsi_locator_t loc; // actual interface address + ddsi_locator_t extloc; // interface address to advertise in discovery + ddsi_locator_t netmask; + uint32_t if_index; + unsigned mc_capable: 1; + unsigned mc_flaky: 1; + unsigned point_to_point: 1; + unsigned loopback: 1; + unsigned link_local: 1; + unsigned prefer_multicast: 1; + int32_t priority; + char *name; +}; + +int find_own_ip (struct ddsi_domaingv *gv); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_OWNIP_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_participant.h b/unitree_SDK/include/dds/ddsi/ddsi_participant.h new file mode 100644 index 0000000..a731779 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_participant.h @@ -0,0 +1,241 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_PARTICIPANT_H +#define DDSI_PARTICIPANT_H + +#include "dds/export.h" +#include "dds/features.h" + +#include "dds/ddsrt/avl.h" +#include "dds/ddsrt/fibheap.h" +#include "dds/ddsrt/sync.h" +#include "dds/ddsi/ddsi_entity.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#define DPG_LOCAL 1 +#define DPG_REMOTE 2 + +extern const ddsrt_fibheap_def_t ldur_fhdef; +extern const ddsrt_fibheap_def_t lease_fhdef_pp; + +struct deleted_participant { + ddsrt_avl_node_t avlnode; + ddsi_guid_t guid; + unsigned for_what; + ddsrt_mtime_t t_prune; +}; + +struct deleted_participants_admin { + ddsrt_mutex_t deleted_participants_lock; + ddsrt_avl_tree_t deleted_participants; + const ddsrt_log_cfg_t *logcfg; + int64_t delay; +}; + +struct avail_entityid_set { + struct inverse_uint32_set x; +}; + +enum ddsi_participant_state { + DDSI_PARTICIPANT_STATE_INITIALIZING, + DDSI_PARTICIPANT_STATE_OPERATIONAL, + DDSI_PARTICIPANT_STATE_DELETE_STARTED, + DDSI_PARTICIPANT_STATE_DELETING_BUILTINS +}; + +struct ddsi_participant +{ + struct ddsi_entity_common e; + dds_duration_t lease_duration; /* constant */ + uint32_t bes; /* built-in endpoint set */ + unsigned is_ddsi2_pp: 1; /* true for the "federation leader", the ddsi2 participant itself in OSPL; FIXME: probably should use this for broker mode as well ... */ + struct ddsi_plist *plist; /* settings/QoS for this participant */ + struct xevent *spdp_xevent; /* timed event for periodically publishing SPDP */ + struct xevent *pmd_update_xevent; /* timed event for periodically publishing ParticipantMessageData */ + ddsi_locator_t m_locator; /* this is always a unicast address, it is set if it is in the many unicast mode */ + ddsi_tran_conn_t m_conn; /* this is connection to m_locator, if it is set, this is used */ + struct avail_entityid_set avail_entityids; /* available entity ids [e.lock] */ + ddsrt_mutex_t refc_lock; + int32_t user_refc; /* number of non-built-in endpoints in this participant [refc_lock] */ + int32_t builtin_refc; /* number of built-in endpoints in this participant [refc_lock] */ + enum ddsi_participant_state state; /* current state of this participant [refc_lock] */ + ddsrt_fibheap_t ldur_auto_wr; /* Heap that contains lease duration for writers with automatic liveliness in this participant */ + ddsrt_atomic_voidp_t minl_man; /* clone of min(leaseheap_man) */ + ddsrt_fibheap_t leaseheap_man; /* keeps leases for this participant's writers (with liveliness manual-by-participant) */ +#ifdef DDS_HAS_SECURITY + struct participant_sec_attributes *sec_attr; + nn_security_info_t security_info; +#endif +}; + +/* Interface for glue code between the OpenSplice kernel and the DDSI + entities. These all return 0 iff successful. All GIDs supplied + __MUST_BE_UNIQUE__. All hell may break loose if they aren't. + + All delete operations synchronously remove the entity being deleted + from the various global hash tables on GUIDs. This ensures no new + operations can be invoked by the glue code, discovery, protocol + messages, &c. The entity is then scheduled for garbage collection. + + There is one exception: a participant without built-in + endpoints: that one synchronously reaches reference count zero + and is then freed immediately. + + If ddsi_new_writer () and/or ddsi_new_reader () may be called in parallel to + ddsi_delete_participant (), trouble ensues. The current glue code + performs all local discovery single-threaded, and can't ever get + into that issue. + + A garbage collector thread is used to perform the actual freeing of + an entity, but it never does so before all threads have made + sufficient progress to guarantee they are not using that entity any + longer, with the exception of use via internal pointers in the + entity data structures. + + An example of the latter is that (proxy) endpoints have a pointer + to the owning (proxy) participant, but the (proxy) participant is + reference counted to make this safe. + + The case of a proxy writer is particularly complicated is it has to + pass through a multiple-stage delay in the garbage collector before + it may be freed: first there is the possibility of a parallel + delete or protocol message, then there is still the possibility of + data in a delivery queue. This is dealt by requeueing garbage + collection and sending bubbles through the delivery queue. */ + +/* Set this flag in new_participant to prevent the creation SPDP, SEDP + and PMD readers for that participant. It doesn't really need it, + they all share the information anyway. But you do need it once. */ +#define RTPS_PF_NO_BUILTIN_READERS 1u +/* Set this flag to prevent the creation of SPDP, SEDP and PMD + writers. It will then rely on the "privileged participant", which + must exist at the time of creation. It creates a reference to that + "privileged participant" to ensure it won't disappear too early. */ +#define RTPS_PF_NO_BUILTIN_WRITERS 2u +/* Set this flag to mark the participant as the "privileged + participant", there can only be one of these. The privileged + participant MUST have all builtin readers and writers. */ +#define RTPS_PF_PRIVILEGED_PP 4u + /* Set this flag to mark the participant as is_ddsi2_pp. */ +#define RTPS_PF_IS_DDSI2_PP 8u + /* Set this flag to mark the participant as an local entity only. */ +#define RTPS_PF_ONLY_LOCAL 16u + + +void ddsi_participant_add_wr_lease_locked (struct ddsi_participant * pp, const struct ddsi_writer * wr); +void ddsi_participant_remove_wr_lease_locked (struct ddsi_participant * pp, struct ddsi_writer * wr); +dds_return_t ddsi_participant_allocate_entityid (ddsi_entityid_t *id, uint32_t kind, struct ddsi_participant *pp); +void ddsi_participant_release_entityid (struct ddsi_participant *pp, ddsi_entityid_t id); +void ddsi_gc_participant_lease (struct gcreq *gcreq); +void ddsi_prune_deleted_participant_guids (struct deleted_participants_admin *admin, ddsrt_mtime_t tnow); +void ddsi_remove_deleted_participant_guid (struct deleted_participants_admin *admin, const struct ddsi_guid *guid, unsigned for_what); +void ddsi_remember_deleted_participant_guid (struct deleted_participants_admin *admin, const struct ddsi_guid *guid); +struct ddsi_participant *ddsi_ref_participant (struct ddsi_participant *pp, const struct ddsi_guid *guid_of_refing_entity); +void ddsi_unref_participant (struct ddsi_participant *pp, const struct ddsi_guid *guid_of_refing_entity); +struct deleted_participants_admin *ddsi_deleted_participants_admin_new (const ddsrt_log_cfg_t *logcfg, int64_t delay); +void ddsi_deleted_participants_admin_free (struct deleted_participants_admin *admin); +int ddsi_is_deleted_participant_guid (struct deleted_participants_admin *admin, const struct ddsi_guid *guid, unsigned for_what); + + + +/** + * @brief Create a new participant in the domain + * + * @param[out] ppguid + * On successful return: the GUID of the new participant; + * Undefined on error. + * @param[in] flags + * Zero or more of: + * - RTPS_PF_NO_BUILTIN_READERS do not create discovery readers in new ppant + * - RTPS_PF_NO_BUILTIN_WRITERS do not create discvoery writers in new ppant + * - RTPS_PF_PRIVILEGED_PP FIXME: figure out how to describe this ... + * - RTPS_PF_IS_DDSI2_PP FIXME: OSPL holdover - there is no DDSI2E here + * - RTPS_PF_ONLY_LOCAL FIXME: not used, it seems + * @param[in] plist + * Parameters/QoS for this participant + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Success, there is now a local participant with the GUID stored in + * *ppguid + * @retval DDS_RETCODE_OUT_OF_RESOURCES + * Failed to allocate a new GUID (note: currently this will always + * happen after 2**24-1 successful calls to new_participant ...). + * @retval DDS_RETCODE_OUT_OF_RESOURCES + * The configured maximum number of participants has been reached. +*/ +DDS_EXPORT dds_return_t ddsi_new_participant (struct ddsi_guid *ppguid, struct ddsi_domaingv *gv, unsigned flags, const struct ddsi_plist *plist); + +/** + * @brief Initiate the deletion of the participant: + * - dispose/unregister built-in topic + * - list it as one of the recently deleted participants + * - remote it from the GUID hash tables + * - schedule the scare stuff to really delete it via the GC + * + * It is ok to call delete_participant without deleting all DDSI-level + * readers/writers: those will simply be deleted. (New ones can't be + * created anymore because the participant can no longer be located via + * the hash tables). + * + * @param[in] ppguid + * GUID of the participant to be deleted. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Success, it is no longer visible and GC events have + * been scheduled for eventual deleting of all remaining + * readers and writers and freeing of memory + * @retval DDS_RETCODE_BAD_PARAMETER + * ppguid lookup failed. +*/ +DDS_EXPORT dds_return_t ddsi_delete_participant (struct ddsi_domaingv *gv, const struct ddsi_guid *ppguid); + +/** + * @brief Updates the parameters list for this participant and trigger sending + * an updated SPDP message. + * + * @param[in] pp The participant + * @param[in] plist The new parameters + */ +DDS_EXPORT void ddsi_update_participant_plist (struct ddsi_participant *pp, const struct ddsi_plist *plist); + +/** + * @brief Gets the interval for PMD messages, which is the minimal lease duration for writers + * with auto liveliness in this participant, or the participants lease duration if shorter + * + * @param[in] pp The participant + * @returns The PMD interval of the participant + */ +DDS_EXPORT dds_duration_t ddsi_participant_get_pmd_interval (struct ddsi_participant *pp); + +/** + * @brief To obtain the builtin writer to be used for publishing SPDP, SEDP, PMD stuff for + * PP and its endpoints, given the entityid. If PP has its own writer, use it; else use the + * privileged participant. + * + * @param[in] pp The participant + * @param[in] entityid The entity ID of the writer + * @returns The built-in writer + */ +DDS_EXPORT struct ddsi_writer *ddsi_get_builtin_writer (const struct ddsi_participant *pp, unsigned entityid); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_PARTICIPANT_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_plist.h b/unitree_SDK/include/dds/ddsi/ddsi_plist.h new file mode 100644 index 0000000..9d72a89 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_plist.h @@ -0,0 +1,526 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_PLIST_H +#define DDSI_PLIST_H + +#include "dds/ddsrt/bswap.h" +#include "dds/ddsi/q_feature_check.h" +#include "dds/ddsi/ddsi_xqos.h" +#include "dds/ddsi/ddsi_keyhash.h" +#include "dds/ddsi/ddsi_tran.h" /* FIXME: eliminate */ +#include "dds/ddsi/ddsi_typelookup.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#define PP_PROTOCOL_VERSION ((uint64_t)1 << 0) +#define PP_VENDORID ((uint64_t)1 << 1) +#define PP_UNICAST_LOCATOR ((uint64_t)1 << 2) +#define PP_MULTICAST_LOCATOR ((uint64_t)1 << 3) +#define PP_DEFAULT_UNICAST_LOCATOR ((uint64_t)1 << 4) +#define PP_DEFAULT_MULTICAST_LOCATOR ((uint64_t)1 << 5) +#define PP_METATRAFFIC_UNICAST_LOCATOR ((uint64_t)1 << 6) +#define PP_METATRAFFIC_MULTICAST_LOCATOR ((uint64_t)1 << 7) +#define PP_EXPECTS_INLINE_QOS ((uint64_t)1 << 8) +#define PP_PARTICIPANT_MANUAL_LIVELINESS_COUNT ((uint64_t)1 << 9) +#define PP_PARTICIPANT_BUILTIN_ENDPOINTS ((uint64_t)1 << 10) +#define PP_PARTICIPANT_LEASE_DURATION ((uint64_t)1 << 11) +#define PP_CONTENT_FILTER_PROPERTY ((uint64_t)1 << 12) +#define PP_PARTICIPANT_GUID ((uint64_t)1 << 13) +#define PP_PARTICIPANT_ENTITYID ((uint64_t)1 << 14) +#define PP_GROUP_GUID ((uint64_t)1 << 15) +#define PP_GROUP_ENTITYID ((uint64_t)1 << 16) +#define PP_BUILTIN_ENDPOINT_SET ((uint64_t)1 << 17) +#define PP_PROPERTIES ((uint64_t)1 << 18) +#define PP_TYPE_MAX_SIZE_SERIALIZED ((uint64_t)1 << 19) +#define PP_CYCLONE_REDUNDANT_NETWORKING ((uint64_t)1 << 20) +#define PP_KEYHASH ((uint64_t)1 << 21) +#define PP_STATUSINFO ((uint64_t)1 << 22) +#define PP_ORIGINAL_WRITER_INFO ((uint64_t)1 << 23) +#define PP_ENDPOINT_GUID ((uint64_t)1 << 24) +#define PP_ADLINK_PARTICIPANT_VERSION_INFO ((uint64_t)1 << 26) +#define PP_ADLINK_TYPE_DESCRIPTION ((uint64_t)1 << 27) +#define PP_COHERENT_SET ((uint64_t)1 << 28) +#ifdef DDS_HAS_SSM +#define PP_READER_FAVOURS_SSM ((uint64_t)1 << 29) +#endif +#define PP_DOMAIN_ID ((uint64_t)1 << 30) +#define PP_DOMAIN_TAG ((uint64_t)1 << 31) +/* Security extensions. */ +#define PP_IDENTITY_TOKEN ((uint64_t)1 << 32) +#define PP_PERMISSIONS_TOKEN ((uint64_t)1 << 33) +#define PP_ENDPOINT_SECURITY_INFO ((uint64_t)1 << 34) +#define PP_PARTICIPANT_SECURITY_INFO ((uint64_t)1 << 35) +#define PP_IDENTITY_STATUS_TOKEN ((uint64_t)1 << 36) +#define PP_DATA_TAGS ((uint64_t)1 << 37) +/* Other stuff */ +#define PP_CYCLONE_RECEIVE_BUFFER_SIZE ((uint64_t)1 << 38) +#define PP_CYCLONE_TOPIC_GUID ((uint64_t)1 << 39) +#define PP_CYCLONE_REQUESTS_KEYHASH ((uint64_t)1 << 40) + +/* Set for unrecognized parameters that are in the reserved space or + in our own vendor-specific space that have the + PID_UNRECOGNIZED_INCOMPATIBLE_FLAG set (see DDSI 2.1 9.6.2.2.1) */ +#define PP_INCOMPATIBLE ((uint64_t)1 << 63) + +#define NN_ADLINK_PARTICIPANT_VERSION_INFO_FIXED_CDRSIZE (24) + +#define NN_ADLINK_FL_KERNEL_SEQUENCE_NUMBER (1u << 0) +#define NN_ADLINK_FL_DISCOVERY_INCLUDES_GID (1u << 1) +#define NN_ADLINK_FL_PTBES_FIXED_0 (1u << 2) +#define NN_ADLINK_FL_DDSI2_PARTICIPANT_FLAG (1u << 3) +#define NN_ADLINK_FL_PARTICIPANT_IS_DDSI2 (1u << 4) +#define NN_ADLINK_FL_MINIMAL_BES_MODE (1u << 5) +#define NN_ADLINK_FL_SUPPORTS_STATUSINFOX (1u << 5) +/* SUPPORTS_STATUSINFOX: when set, also means any combination of + write/unregister/dispose supported */ + +/* For locators one could patch the received message data to create + singly-linked lists (parameter header -> offset of next entry in + list relative to current), allowing aliasing of the data. But that + requires modifying the data. For string sequences the length does + the same thing. */ +struct nn_locators_one { + struct nn_locators_one *next; + ddsi_locator_t loc; +}; + +typedef struct nn_locators { + uint32_t n; + struct nn_locators_one *first; + struct nn_locators_one *last; +} nn_locators_t; + +typedef uint32_t nn_ipv4address_t; + +typedef uint32_t nn_port_t; + +#ifdef DDS_HAS_SECURITY +typedef struct nn_tag { + char *name; + char *value; +} nn_tag_t; + +typedef struct nn_tagseq { + uint32_t n; + nn_tag_t *tags; +} nn_tagseq_t; + +typedef struct nn_datatags { + nn_tagseq_t tags; +} nn_datatags_t; +#endif + +#ifdef DDS_HAS_SSM +typedef struct nn_reader_favours_ssm { + uint32_t state; /* default is false */ +} nn_reader_favours_ssm_t; +#endif + +#ifdef DDS_HAS_SECURITY +typedef struct nn_dataholder +{ + char *class_id; + dds_propertyseq_t properties; + dds_binarypropertyseq_t binary_properties; +} nn_dataholder_t; + +typedef struct nn_dataholderseq { + uint32_t n; + nn_dataholder_t *tags; +} nn_dataholderseq_t; + +typedef nn_dataholder_t nn_token_t; + +/* Used for both nn_participant_security_info and nn_endpoint_security_info. */ +typedef struct nn_security_info +{ + uint32_t security_attributes; + uint32_t plugin_security_attributes; +} nn_security_info_t; + +#define NN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_READ_PROTECTED (1u << 0) +#define NN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_WRITE_PROTECTED (1u << 1) +#define NN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_DISCOVERY_PROTECTED (1u << 2) +#define NN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_SUBMESSAGE_PROTECTED (1u << 3) +#define NN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_PAYLOAD_PROTECTED (1u << 4) +#define NN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_KEY_PROTECTED (1u << 5) +#define NN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_LIVELINESS_PROTECTED (1u << 6) +#define NN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_VALID (1u << 31) + +#define NN_PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_SUBMESSAGE_ENCRYPTED (1u << 0) +#define NN_PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_PAYLOAD_ENCRYPTED (1u << 1) +#define NN_PLUGIN_ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_SUBMESSAGE_ORIGIN_AUTHENTICATED (1u << 2) + +#define NN_PARTICIPANT_SECURITY_ATTRIBUTES_FLAG_IS_RTPS_PROTECTED (1u << 0) +#define NN_PARTICIPANT_SECURITY_ATTRIBUTES_FLAG_IS_DISCOVERY_PROTECTED (1u << 1) +#define NN_PARTICIPANT_SECURITY_ATTRIBUTES_FLAG_IS_LIVELINESS_PROTECTED (1u << 2) +#define NN_PARTICIPANT_SECURITY_ATTRIBUTES_FLAG_IS_VALID (1u << 31) + +#define NN_PLUGIN_PARTICIPANT_SECURITY_ATTRIBUTES_FLAG_IS_RTPS_ENCRYPTED (1u << 0) +#define NN_PLUGIN_PARTICIPANT_SECURITY_ATTRIBUTES_FLAG_IS_DISCOVERY_ENCRYPTED (1u << 1) +#define NN_PLUGIN_PARTICIPANT_SECURITY_ATTRIBUTES_FLAG_IS_LIVELINESS_ENCRYPTED (1u << 2) +#define NN_PLUGIN_PARTICIPANT_SECURITY_ATTRIBUTES_FLAG_IS_RTPS_AUTHENTICATED (1u << 3) +#define NN_PLUGIN_PARTICIPANT_SECURITY_ATTRIBUTES_FLAG_IS_DISCOVERY_AUTHENTICATED (1u << 4) +#define NN_PLUGIN_PARTICIPANT_SECURITY_ATTRIBUTES_FLAG_IS_LIVELINESS_AUTHENTICATED (1u << 5) +#else +struct nn_security_info; +typedef struct nn_security_info nn_security_info_t; +#endif + +typedef struct nn_adlink_participant_version_info +{ + uint32_t version; + uint32_t flags; + uint32_t unused[3]; + char *internals; +} nn_adlink_participant_version_info_t; + +typedef struct ddsi_plist { + uint64_t present; + uint64_t aliased; + + dds_qos_t qos; + + nn_protocol_version_t protocol_version; + nn_vendorid_t vendorid; + nn_locators_t unicast_locators; + nn_locators_t multicast_locators; + nn_locators_t default_unicast_locators; + nn_locators_t default_multicast_locators; + nn_locators_t metatraffic_unicast_locators; + nn_locators_t metatraffic_multicast_locators; + + unsigned char expects_inline_qos; + nn_count_t participant_manual_liveliness_count; + uint32_t participant_builtin_endpoints; + dds_duration_t participant_lease_duration; + /* nn_content_filter_property_t content_filter_property; */ + ddsi_guid_t participant_guid; + ddsi_guid_t endpoint_guid; + ddsi_guid_t group_guid; + ddsi_guid_t topic_guid; +#if 0 /* reserved, rather than NIY */ + nn_entityid_t participant_entityid; + nn_entityid_t group_entityid; +#endif + uint32_t builtin_endpoint_set; + /* int type_max_size_serialized; */ + ddsi_keyhash_t keyhash; + uint32_t statusinfo; + nn_adlink_participant_version_info_t adlink_participant_version_info; + char *type_description; + nn_sequence_number_t coherent_set_seqno; +#ifdef DDS_HAS_SECURITY + nn_token_t identity_token; + nn_token_t permissions_token; + nn_security_info_t endpoint_security_info; + nn_security_info_t participant_security_info; + nn_token_t identity_status_token; + nn_datatags_t data_tags; +#endif +#ifdef DDS_HAS_SSM + nn_reader_favours_ssm_t reader_favours_ssm; +#endif + uint32_t domain_id; + char *domain_tag; + uint32_t cyclone_receive_buffer_size; + unsigned char cyclone_requests_keyhash; + unsigned char cyclone_redundant_networking; +} ddsi_plist_t; + + +/***/ + +typedef struct ddsi_plist_src { + nn_protocol_version_t protocol_version; /**< input protocol version */ + nn_vendorid_t vendorid; /**< vendor code for input */ + int encoding; /**< PL_CDR_LE or PL_CDR_BE */ + const unsigned char *buf; /**< input buffer */ + size_t bufsz; /**< size of input buffer */ + bool strict; /**< whether to be strict in checking */ +} ddsi_plist_src_t; + +DDS_EXPORT extern const ddsi_plist_t ddsi_default_plist_participant; + +/** + * @brief Initialize global parameter-list parsing indices. + * + * These indices are derived from compile-time constant tables. This only does the work + * once; ideally it would be done at compile time instead. + */ +void ddsi_plist_init_tables (void); + +/** + * @brief Initialize a ddsi_plist_t as an empty object + * + * In principle, this only clears the "present" and "aliased" bitmasks. A debug build + * additionally initializes all other bytes to 0x55. + * + * @param[out] dest plist_t to be initialized. + */ +DDS_EXPORT void ddsi_plist_init_empty (ddsi_plist_t *dest); + +/** + * @brief Extend "a" with selected entries present in "b" + * + * This copies into "a" any entries present in "b" that are included in "pmask" and + * "qmask" and missing in "a". It doesn't touch any entries already present in "a". + * Calling this on an empty "a" with all bits set in "pmask" and "qmask" all is equivalent + * to copying "b" into "a"; calling this with "pmask" and "qmask" both 0 copies nothing. + * + * @param[in,out] a ddsi_plist_t to be extended + * @param[in] b ddsi_plist_t from which to copy entries + * @param[in] pmask subset of non-QoS part of b (if PP_X is set, include X) + * @param[in] qmask subset of QoS part of b (if QP_X is set, include X) + */ +DDS_EXPORT void ddsi_plist_mergein_missing (ddsi_plist_t *a, const ddsi_plist_t *b, uint64_t pmask, uint64_t qmask); + +/** + * @brief Copy "src" to "dst" + * + * @param[out] dst destination, any contents are overwritten + * @param[in] src source ddsi_plist_t + */ +DDS_EXPORT void ddsi_plist_copy (ddsi_plist_t *dst, const ddsi_plist_t *src); + +/** + * @brief Duplicate "src" + * + * @param[in] src ddsi_plist_t to be duplicated + * + * @returns a new (allocated using ddsrt_malloc) ddsi_plist_t containing a copy of "src". + */ +DDS_EXPORT ddsi_plist_t *ddsi_plist_dup (const ddsi_plist_t *src); + +/** + * @brief Initialize an ddsi_plist_t from a PL_CDR_{LE,BE} paylaod. + * + * @param[in] pwanted + * PP_... flags indicating which non-QoS parameters are of interest, treated as + * a hint. Parameters in the input that are outside the mask may or may not be + * ignored. + * @param[in] qwanted + * QP_... flags indicating which QoS settings are of interest, and is treated as + * a hint. Parameters in the input that are outside the mask may or may not be + * ignored. + * @param[in] src + * Serialized payload to be parsed, validated and copied into dest + * - protocol_version is the version protocol version according to which the list + * should be parsed + * - vendorid is the vendor id code for the source of the parameter list (for + * handling vendor-specific parameters and compatibility workarounds) + * - encoding is PL_CDR_LE or PL_CDR_BE + * - buf is a pointer to the first parameter header + * - bufsz is the size in bytes of the input buffer + * @param[in] gv + * Global context, used for locator kind lookups and tracing + * @param[out] dest + * Filled with the recognized parameters in the input if successful, otherwise + * initialized to an empty parameter list. Where possible, pointers alias the + * input (indicated by the "aliased" bits in the plist/xqos structures), but + * some things cannot be aliased (e.g., the array of pointers to strings for a + * sequence of strings). + * Generally, ddsi_plist_fini should be called when done with the parameter list, + * even when ddsi_plist_unlias or ddsi_xqos_unlias hasn't been called. + * @param[out] nextafterplist + * If non-NULL, *nextafterplist is set to the first byte following the parameter + * list sentinel on successful parse, or to NULL on failure + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * All parameters valid (or ignored), dest and *nextafterplist have been set + * accordingly. + * @retval DDS_INCONSISTENT_POLICY + * All individual settings are valid, but there are inconsistencies between + * dependent settings. + * @retval DDS_RETCODE_BAD_PARAMETER + * Input contained invalid data; dest is cleared, *nextafterplist is NULL. + * @retval DDS_RETCODE_UNSUPPORTED + * Input contained an unrecognized parameter with the "incompatible-if-unknown" + * flag set; dest is cleared, *nextafterplist is NULL. + */ +DDS_EXPORT dds_return_t ddsi_plist_init_frommsg (ddsi_plist_t *dest, char **nextafterplist, uint64_t pwanted, uint64_t qwanted, const ddsi_plist_src_t *src, struct ddsi_domaingv const * const gv); + +/** + * @brief Free memory owned by "ps" + * + * A ddsi_plist_t may own other allocated blocks of memory, depending on which fields are + * set, their types and whether they are marked as "aliased". This function releases any + * such memory owned by "ps", but not "ps" itself. Afterward, the contents of "ps" is + * undefined and must not be used again without initialising it (either via + * `ddsi_plist_init_empty`, `ddsi_plist_init_frommsg` or `ddsi_plist_copy`. + * + * @param[in] ps ddsi_plist_t for which to free memory + */ +DDS_EXPORT void ddsi_plist_fini (ddsi_plist_t *ps); + +/** + * @brief Free memory owned by "plist" for a subset of the entries + * + * A ddsi_plist_t may own other allocated blocks of memory, depending on which fields are + * set, their types and whether they are marked as "aliased". This function releases any + * such memory owned by "plist" for entries included in "pmask" and "qmask". The + * "present" and "aliased" bits are cleared accordingly. + * + * @param[in,out] plist ddsi_plist_t for which to free memory + * @param[in] pmask subset of non-QoS part of b (if PP_X is set, free X if present) + * @param[in] qmask subset of QoS part of b (if QP_X is set, free X if present) + */ +DDS_EXPORT void ddsi_plist_fini_mask (ddsi_plist_t *plist, uint64_t pmask, uint64_t qmask); + +/** + * @brief Replace any memory "plist" aliases by copies it owns + * + * A ddsi_plist_t may can reference other memory without owning it. This functions allows + * one to replace any such aliased memory by copies, allowing one to free the original + * copy. + * + * @param[in,out] plist ddsi_plist_t for which to replace all aliased memory by owned + * copies + */ +DDS_EXPORT void ddsi_plist_unalias (ddsi_plist_t *plist); + +/** + * @brief Add selected entries in "ps" to a message in native endianness. + * + * This functions appends to "m" a serialized copy of the the entries selected by + * "pwanted"/"qwanted" and present in "ps". Each copy is preceded by a 4-byte header with + * a parameter id and length (conform the PL_CDR representation). It does *not* add a + * sentinel to allow adding additional data to the parameter list. A sentinel can be + * added using `nn_xmsg_addpar_sentinel`. + * + * @param[in,out] m message to append the parameters to + * @param[in] ps source + * @param[in] pwanted subset of non-QoS part of ps (if PP_X is set, add X if present) + * @param[in] qwanted subset of QoS part of ps (if QP_X is set, add X if present) + */ +DDS_EXPORT void ddsi_plist_addtomsg (struct nn_xmsg *m, const ddsi_plist_t *ps, uint64_t pwanted, uint64_t qwanted); + +/** + * @brief Add selected entries in "ps" to a message with selected endianness. + * + * This functions appends to "m" a serialized copy of the the entries selected by + * "pwanted"/"qwanted" and present in "ps". Each copy is preceded by a 4-byte header with + * a parameter id and length (conform the PL_CDR representation). It does *not* add a + * sentinel to allow adding additional data to the parameter list. A sentinel can be + * added using `nn_xmsg_addpar_sentinel`. + * + * @param[in,out] m message to append the parameters to + * @param[in] ps source + * @param[in] pwanted subset of non-QoS part of ps (if PP_X is set, add X if present) + * @param[in] qwanted subset of QoS part of ps (if QP_X is set, add X if present) + * @param[in] bo byte order + */ +DDS_EXPORT void ddsi_plist_addtomsg_bo (struct nn_xmsg *m, const ddsi_plist_t *ps, uint64_t pwanted, uint64_t qwanted, enum ddsrt_byte_order_selector bo); + +/** + * @brief Determine the set of entries in which "x" differs from "y" + * + * This computes the entries set in "x" but not set in "y", not set in "x" but set in "y", + * or set in both "x" and "y" but to a different value. It returns this set reduced to + * only those included in "pmask"/"qmask", that is, if bit X is clear in "pmask", bit X + * will be clear in "pdelta", etc. + * + * @param[out] pdelta non-QoS entries that are different and not masked out + * @param[out] qdelta QoS entries that are different and not masked out + * @param[in] x one of the two plists to compare + * @param[in] y other plist to compare + * @param[in] pmask subset of non-QoS part to be compared + * @param[in] qmask subset of QoS part to be compared + */ +DDS_EXPORT void ddsi_plist_delta (uint64_t *pdelta, uint64_t *qdelta, const ddsi_plist_t *x, const ddsi_plist_t *y, uint64_t pmask, uint64_t qmask); + +/** + * @brief Formats plist using `ddsi_plist_print` and writes it to the trace. + * + * @param[in] cat log category to use + * @param[in] logcfg logging configuration + * @param[in] plist parameter list to be logged + */ +DDS_EXPORT void ddsi_plist_log (uint32_t cat, const struct ddsrt_log_cfg *logcfg, const ddsi_plist_t *plist); + +/** + * @brief Formats plist into a buffer + * + * The representation is somewhat cryptic as all enumerated types are dumped as numbers + * and timestamps are durations as nanoseconds with "infinite" represented as + * 9223372036854775807 (INT64_MAX). + * + * @param[out] buf buffer to store the formatted representation in + * @param[in] bufsize size of buffer, if > 0, there will be a terminating 0 in buf on + * return + * @param[in] plist parameter list to be formatted as a string + * + * @returns number of bytes written to buf, excluding a terminating 0. + */ +DDS_EXPORT size_t ddsi_plist_print (char * __restrict buf, size_t bufsize, const ddsi_plist_t *plist); + +struct nn_rsample_info; + +/** + * @brief Scan a PL_CDR-serialized parameter list, checking structure and copying some information to "dest". + * + * This checks that the serialized data is structured correctly (proper aligned headers, + * declared lengths within bounds, a sentinel at the end). It sets the `statusinfo` of + * `dest` to the least significant two bits (UNREGISTER and DISPOSE) of a status info + * parameter if present, else to 0. A statusinfo parameter that is too short (less than 4 + * bytes) is treated as an invalid input. + * + * It sets the `complex_qos` flag if it encounters any parameter other than a statusinfo + * limited to those two bits, keyhash or padding, and clears it otherwise. + * + * It clears the `bswap` flag in `dest` if the input is in native endianness, and sets it + * otherwise. + * + * @param[out] dest internal sample info of which some fields will be set + * @param[in] src input description (see `ddsi_plist_init_frommsg`) + * @param[out] keyhashp set to point to keyhash in inline QoS if present, else to NULL + * @param[in] gv global context (for logging) + * + * @return pointer to the first byte following the sentinel if the input is well-formed, a + * null pointer if it is not. +*/ +DDS_EXPORT unsigned char *ddsi_plist_quickscan (struct nn_rsample_info *dest, const ddsi_keyhash_t **keyhashp, const ddsi_plist_src_t *src, struct ddsi_domaingv const * const gv); + +/** + * @brief Locate a specific parameter in a PL_CDR-serialized parameter list + * + * This scans the serialized data until it encounters the sentinel, recording whether the + * specified parameter occurs and returning the size and address of it in `buf`. + * + * If `needle` is PID_SENTINEL, it will simply check well-formedness of the input and + * `needlep` and `needlesz` must both be null pointers. If `needle` is not PID_SENTINEL, + * `needlep` and `needlesz` may not be null pointers. + * + * @param[in] buf serialized parameter list to scan + * @param[in] bufsz length of serialized form + * @param[in] encoding encoding of `buf`, either PL_CDR_LE or PL_CDR_BE + * @param[in] needle parameter id to look for + * @param[out] needlep where to store the address of the `needle` value + * @param[out] needlesz where to store the size of the `needle` value + * + * @return Whether input was valid and if so, whether it contains the needle. + * + * @retval DDS_RETCODE_BAD_PARAMETER invalid input + * @retval DDS_RETCODE_NOT_FOUND valid input, `needle` not present + * @retval DDS_RETCODE_OK valid input, `needle` is present +*/ +DDS_EXPORT dds_return_t ddsi_plist_findparam_checking (const void *buf, size_t bufsz, uint16_t encoding, nn_parameterid_t needle, void **needlep, size_t *needlesz); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_PLIST_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_plist_generic.h b/unitree_SDK/include/dds/ddsi/ddsi_plist_generic.h new file mode 100644 index 0000000..553e2fd --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_plist_generic.h @@ -0,0 +1,66 @@ +/* + * Copyright(c) 2019 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_PLIST_GENERIC_H +#define DDSI_PLIST_GENERIC_H + +#include +#include +#include + +#include "dds/export.h" +#include "dds/ddsrt/bswap.h" +#include "dds/ddsrt/attributes.h" +#include "dds/ddsrt/retcode.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* Instructions for the generic serializer (&c) that handles most parameters. + The "packed" attribute means single-byte instructions on GCC and Clang. */ +enum pserop { + XSTOP, + XO, /* octet sequence */ + XS, /* string */ + XE1, XE2, XE3, /* enum 0..1, 0..2, 0..3 */ + Xs, /* int16_t */ + Xi, Xix2, Xix3, Xix4, /* int32_t, 1 .. 4 in a row */ + Xu, Xux2, Xux3, Xux4, Xux5, /* uint32_t, 1 .. 5 in a row */ + XD, XDx2, /* duration, 1 .. 2 in a row */ + Xl, /* int64_t */ + Xo, Xox2, /* octet, 1 .. 2 in a row */ + Xb, Xbx2, Xbx3, Xbx4, Xbx5, /* boolean, 1 .. 5 in a row */ + XbCOND, /* boolean: compare to ignore remainder if false (for use_... flags) */ + XbPROP, /* boolean: omit in serialized form; skip serialization if false; always true on deserialize */ + XG, /* GUID */ + XK, /* keyhash */ + XQ, /* arbitary non-nested sequence */ + Xopt, /* remainder is optional on deser, 0-init if not present */ +} ddsrt_attribute_packed; + +DDS_EXPORT void plist_fini_generic (void * __restrict dst, const enum pserop *desc, bool aliased); +DDS_EXPORT void plist_ser_generic_size_embeddable (size_t *dstoff, const void *src, size_t srcoff, const enum pserop * __restrict desc); +DDS_EXPORT dds_return_t plist_deser_generic (void * __restrict dst, const void * __restrict src, size_t srcsize, bool bswap, const enum pserop * __restrict desc); +DDS_EXPORT dds_return_t plist_deser_generic_srcoff (void * __restrict dst, const void * __restrict src, size_t srcsize, size_t *srcoff, bool bswap, const enum pserop * __restrict desc); +DDS_EXPORT dds_return_t plist_ser_generic_embeddable (char * const data, size_t *dstoff, const void *src, size_t srcoff, const enum pserop * __restrict desc, enum ddsrt_byte_order_selector bo); +DDS_EXPORT dds_return_t plist_ser_generic (void **dst, size_t *dstsize, const void *src, const enum pserop * __restrict desc); +DDS_EXPORT dds_return_t plist_ser_generic_be (void **dst, size_t *dstsize, const void *src, const enum pserop * __restrict desc); +DDS_EXPORT dds_return_t plist_unalias_generic (void * __restrict dst, const enum pserop * __restrict desc); +DDS_EXPORT bool plist_equal_generic (const void *srcx, const void *srcy, const enum pserop * __restrict desc); +DDS_EXPORT size_t plist_memsize_generic (const enum pserop * __restrict desc); +DDS_EXPORT size_t plist_print_generic (char * __restrict buf, size_t bufsize, const void * __restrict src, const enum pserop * __restrict desc); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_pmd.h b/unitree_SDK/include/dds/ddsi/ddsi_pmd.h new file mode 100644 index 0000000..9631d15 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_pmd.h @@ -0,0 +1,51 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_PMD_H +#define DDSI_PMD_H + +#include +#include "dds/ddsrt/time.h" +#include "dds/ddsi/ddsi_serdata.h" +#include "dds/ddsi/ddsi_plist_generic.h" +#include "dds/ddsi/ddsi_guid.h" +#include "dds/ddsi/ddsi_xqos.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_domaingv; +struct thread_state; +struct ddsi_guid; +struct nn_xpack; +struct ddsi_participant; +struct receiver_state; + +typedef struct ParticipantMessageData { + ddsi_guid_prefix_t participantGuidPrefix; + uint32_t kind; /* really 4 octets */ + ddsi_octetseq_t value; +} ParticipantMessageData_t; + +extern const enum pserop participant_message_data_ops[]; +extern size_t participant_message_data_nops; +extern const enum pserop participant_message_data_ops_key[]; +extern size_t participant_message_data_nops_key; + +void write_pmd_message_guid (struct ddsi_domaingv * const gv, struct ddsi_guid *pp_guid, unsigned pmd_kind); +void write_pmd_message (struct thread_state * const ts1, struct nn_xpack *xp, struct ddsi_participant *pp, unsigned pmd_kind); +void handle_pmd_message (const struct receiver_state *rst, struct ddsi_serdata *sample_common); + +#if defined (__cplusplus) +} +#endif +#endif /* DDSI_PMD_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_portmapping.h b/unitree_SDK/include/dds/ddsi/ddsi_portmapping.h new file mode 100644 index 0000000..a34fada --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_portmapping.h @@ -0,0 +1,49 @@ +/* + * Copyright(c) 2019 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_PORTMAPPING_H +#define DDSI_PORTMAPPING_H + +#include +#include +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +enum ddsi_port { + DDSI_PORT_MULTI_DISC, + DDSI_PORT_MULTI_DATA, + DDSI_PORT_UNI_DISC, + DDSI_PORT_UNI_DATA +}; + +struct ddsi_portmapping { + uint32_t base; + uint32_t dg; + uint32_t pg; + uint32_t d0; + uint32_t d1; + uint32_t d2; + uint32_t d3; +}; + +struct ddsi_config; + +bool ddsi_valid_portmapping (const struct ddsi_config *config, int32_t participant_index, char *msg, size_t msgsize); +uint32_t ddsi_get_port (const struct ddsi_config *config, enum ddsi_port which, int32_t participant_index); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_PORTMAPPING_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_proxy_endpoint.h b/unitree_SDK/include/dds/ddsi/ddsi_proxy_endpoint.h new file mode 100644 index 0000000..1ba1a48 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_proxy_endpoint.h @@ -0,0 +1,143 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_PROXY_ENDPOINT_H +#define DDSI_PROXY_ENDPOINT_H + +#include "dds/export.h" +#include "dds/features.h" + +#include "dds/ddsrt/avl.h" +#include "dds/ddsrt/atomics.h" +#include "dds/ddsi/ddsi_guid.h" +#include "dds/ddsi/ddsi_domaingv.h" +#include "dds/ddsi/ddsi_entity.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_proxy_participant; +struct dds_qos; +struct addrset; + +struct ddsi_proxy_endpoint_common +{ + struct ddsi_proxy_participant *proxypp; /* counted backref to proxy participant */ + struct ddsi_proxy_endpoint_common *next_ep; /* next \ endpoint belonging to this proxy participant */ + struct ddsi_proxy_endpoint_common *prev_ep; /* prev / -- this is in arbitrary ordering */ + struct dds_qos *xqos; /* proxy endpoint QoS lives here; FIXME: local ones should have it moved to common as well */ + struct addrset *as; /* address set to use for communicating with this endpoint */ + ddsi_guid_t group_guid; /* 0:0:0:0 if not available */ + nn_vendorid_t vendor; /* cached from proxypp->vendor */ + seqno_t seq; /* sequence number of most recent SEDP message */ +#ifdef DDS_HAS_TYPE_DISCOVERY + struct ddsi_type_pair *type_pair; +#endif +#ifdef DDS_HAS_SECURITY + nn_security_info_t security_info; +#endif +}; + +struct ddsi_generic_proxy_endpoint { + struct ddsi_entity_common e; + struct ddsi_proxy_endpoint_common c; +}; + +struct ddsi_proxy_writer { + struct ddsi_entity_common e; + struct ddsi_proxy_endpoint_common c; + ddsrt_avl_tree_t readers; /* matching LOCAL readers, see pwr_rd_match */ + int32_t n_reliable_readers; /* number of those that are reliable */ + int32_t n_readers_out_of_sync; /* number of those that require special handling (accepting historical data, waiting for historical data set to become complete) */ + seqno_t last_seq; /* highest known seq published by the writer, not last delivered */ + uint32_t last_fragnum; /* last known frag for last_seq, or UINT32_MAX if last_seq not partial */ + nn_count_t nackfragcount; /* last nackfrag seq number */ + ddsrt_atomic_uint32_t next_deliv_seq_lowword; /* lower 32-bits for next sequence number that will be delivered; for generating acks; 32-bit so atomic reads on all supported platforms */ + unsigned deliver_synchronously: 1; /* iff 1, delivery happens straight from receive thread for non-historical data; else through delivery queue "dqueue" */ + unsigned have_seen_heartbeat: 1; /* iff 1, we have received at least on heartbeat from this proxy writer */ + unsigned local_matching_inprogress: 1; /* iff 1, we are still busy matching local readers; this is so we don't deliver incoming data to some but not all readers initially */ + unsigned alive: 1; /* iff 1, the proxy writer is alive (lease for this proxy writer is not expired); field may be modified only when holding both pwr->e.lock and pwr->c.proxypp->e.lock */ + unsigned filtered: 1; /* iff 1, builtin proxy writer uses content filter, which affects heartbeats and gaps. */ + unsigned redundant_networking: 1; /* 1 iff requests receiving data on all advertised interfaces */ +#ifdef DDS_HAS_SSM + unsigned supports_ssm: 1; /* iff 1, this proxy writer supports SSM */ +#endif +#ifdef DDS_HAS_SHM + unsigned is_iceoryx : 1; +#endif + uint32_t alive_vclock; /* virtual clock counting transitions between alive/not-alive */ + struct nn_defrag *defrag; /* defragmenter for this proxy writer; FIXME: perhaps shouldn't be for historical data */ + struct nn_reorder *reorder; /* message reordering for this proxy writer, out-of-sync readers can have their own, see pwr_rd_match */ + struct nn_dqueue *dqueue; /* delivery queue for asynchronous delivery (historical data is always delivered asynchronously) */ + struct xeventq *evq; /* timed event queue to be used for ACK generation */ + struct ddsi_local_reader_ary rdary; /* LOCAL readers for fast-pathing; if not fast-pathed, fall back to scanning local_readers */ + ddsi2direct_directread_cb_t ddsi2direct_cb; + void *ddsi2direct_cbarg; + struct lease *lease; +}; + + +typedef int (*ddsi_filter_fn_t)(struct ddsi_writer *wr, struct ddsi_proxy_reader *prd, struct ddsi_serdata *serdata); + +struct ddsi_proxy_reader { + struct ddsi_entity_common e; + struct ddsi_proxy_endpoint_common c; + unsigned deleting: 1; /* set when being deleted */ + unsigned is_fict_trans_reader: 1; /* only true when it is certain that is a fictitious transient data reader (affects built-in topic generation) */ + unsigned requests_keyhash: 1; /* 1 iff this reader would like to receive keyhashes */ + unsigned redundant_networking: 1; /* 1 iff requests receiving data on all advertised interfaces */ +#ifdef DDS_HAS_SSM + unsigned favours_ssm: 1; /* iff 1, this proxy reader favours SSM when available */ +#endif +#ifdef DDS_HAS_SHM + unsigned is_iceoryx: 1; +#endif + ddsrt_avl_tree_t writers; /* matching LOCAL writers */ + uint32_t receive_buffer_size; /* assumed receive buffer size inherited from proxypp */ + ddsi_filter_fn_t filter; +}; + +DDS_EXPORT extern const ddsrt_avl_treedef_t ddsi_pwr_readers_treedef; +DDS_EXPORT extern const ddsrt_avl_treedef_t ddsi_prd_writers_treedef; + +void ddsi_proxy_writer_set_alive_may_unlock (struct ddsi_proxy_writer *pwr, bool notify); +int ddsi_proxy_writer_set_notalive (struct ddsi_proxy_writer *pwr, bool notify); +void ddsi_proxy_writer_get_alive_state (struct ddsi_proxy_writer *pwr, struct ddsi_alive_state *st); +struct ddsi_entity_common *ddsi_entity_common_from_proxy_endpoint_common (const struct ddsi_proxy_endpoint_common *c); +bool ddsi_is_proxy_endpoint (const struct ddsi_entity_common *e); + + +/* To create a new proxy writer or reader; the proxy participant is + determined from the GUID and must exist. */ +DDS_EXPORT int ddsi_new_proxy_writer (struct ddsi_domaingv *gv, const struct ddsi_guid *ppguid, const struct ddsi_guid *guid, struct addrset *as, const struct ddsi_plist *plist, struct nn_dqueue *dqueue, struct xeventq *evq, ddsrt_wctime_t timestamp, seqno_t seq); +DDS_EXPORT int ddsi_new_proxy_reader (struct ddsi_domaingv *gv, const struct ddsi_guid *ppguid, const struct ddsi_guid *guid, struct addrset *as, const struct ddsi_plist *plist, ddsrt_wctime_t timestamp, seqno_t seq +#ifdef DDS_HAS_SSM +, int favours_ssm +#endif +); + +/* To delete a proxy writer or reader; these synchronously hide it + from the outside world, preventing it from being matched to a + reader or writer. Actual deletion is scheduled in the future, when + no outstanding references may still exist (determined by checking + thread progress, &c.). */ +DDS_EXPORT int ddsi_delete_proxy_writer (struct ddsi_domaingv *gv, const struct ddsi_guid *guid, ddsrt_wctime_t timestamp, int isimplicit); +DDS_EXPORT int ddsi_delete_proxy_reader (struct ddsi_domaingv *gv, const struct ddsi_guid *guid, ddsrt_wctime_t timestamp, int isimplicit); + +DDS_EXPORT void ddsi_update_proxy_reader (struct ddsi_proxy_reader *prd, seqno_t seq, struct addrset *as, const struct dds_qos *xqos, ddsrt_wctime_t timestamp); +DDS_EXPORT void ddsi_update_proxy_writer (struct ddsi_proxy_writer *pwr, seqno_t seq, struct addrset *as, const struct dds_qos *xqos, ddsrt_wctime_t timestamp); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_PROXY_ENDPOINT_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_proxy_participant.h b/unitree_SDK/include/dds/ddsi/ddsi_proxy_participant.h new file mode 100644 index 0000000..055fc0e --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_proxy_participant.h @@ -0,0 +1,109 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_PROXY_PARTICIPANT_H +#define DDSI_PROXY_PARTICIPANT_H + +#include "dds/export.h" +#include "dds/features.h" + +#include "dds/ddsrt/atomics.h" +#include "dds/ddsrt/avl.h" +#include "dds/ddsrt/fibheap.h" +#include "dds/ddsi/ddsi_domaingv.h" +#include "dds/ddsi/ddsi_entity.h" +#include "dds/ddsi/ddsi_topic.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct lease; +struct ddsi_plist; +struct addrset; +struct ddsi_proxy_endpoint_common; + +struct ddsi_proxy_participant +{ + struct ddsi_entity_common e; + uint32_t refc; /* number of proxy endpoints (both user & built-in; not groups, they don't have a life of their own) */ + nn_vendorid_t vendor; /* vendor code from discovery */ + unsigned bes; /* built-in endpoint set */ + ddsi_guid_t privileged_pp_guid; /* if this PP depends on another PP for its SEDP writing */ + struct ddsi_plist *plist; /* settings/QoS for this participant */ + ddsrt_atomic_voidp_t minl_auto; /* clone of min(leaseheap_auto) */ + ddsrt_fibheap_t leaseheap_auto; /* keeps leases for this proxypp and leases for pwrs (with liveliness automatic) */ + ddsrt_atomic_voidp_t minl_man; /* clone of min(leaseheap_man) */ + ddsrt_fibheap_t leaseheap_man; /* keeps leases for this proxypp and leases for pwrs (with liveliness manual-by-participant) */ + struct lease *lease; /* lease for this proxypp */ + struct addrset *as_default; /* default address set to use for user data traffic */ + struct addrset *as_meta; /* default address set to use for discovery traffic */ + struct ddsi_proxy_endpoint_common *endpoints; /* all proxy endpoints can be reached from here */ +#ifdef DDS_HAS_TOPIC_DISCOVERY + ddsrt_avl_tree_t topics; +#endif + seqno_t seq; /* sequence number of most recent SPDP message */ + uint32_t receive_buffer_size; /* assumed size of receive buffer, used to limit bursts involving this proxypp */ + unsigned implicitly_created : 1; /* participants are implicitly created for Cloud/Fog discovered endpoints */ + unsigned is_ddsi2_pp: 1; /* if this is the federation-leader on the remote node */ + unsigned minimal_bes_mode: 1; + unsigned lease_expired: 1; + unsigned deleting: 1; + unsigned proxypp_have_spdp: 1; + unsigned owns_lease: 1; + unsigned redundant_networking: 1; /* 1 iff requests receiving data on all advertised interfaces */ +#ifdef DDS_HAS_SECURITY + nn_security_info_t security_info; + struct ddsi_proxy_participant_sec_attributes *sec_attr; +#endif +}; + +#ifdef DDS_HAS_TOPIC_DISCOVERY +extern const ddsrt_avl_treedef_t ddsi_proxypp_proxytp_treedef; +#endif + +/* Set when this proxy participant is created implicitly and has to be deleted upon disappearance + of its last endpoint. FIXME: Currently there is a potential race with adding a new endpoint + in parallel to deleting the last remaining one. The endpoint will then be created, added to the + proxy participant and then both are deleted. With the current single-threaded discovery + this can only happen when it is all triggered by lease expiry. */ +#define CF_IMPLICITLY_CREATED_PROXYPP (1 << 0) +/* Set when this proxy participant is a DDSI2 participant, to help Cloud figure out whom to send + discovery data when used in conjunction with the networking bridge */ +#define CF_PARTICIPANT_IS_DDSI2 (1 << 1) +/* Set when this proxy participant is not to be announced on the built-in topics yet */ +#define CF_PROXYPP_NO_SPDP (1 << 2) + +int ddsi_update_proxy_participant_plist_locked (struct ddsi_proxy_participant *proxypp, seqno_t seq, const struct ddsi_plist *datap, ddsrt_wctime_t timestamp); +void ddsi_proxy_participant_reassign_lease (struct ddsi_proxy_participant *proxypp, struct lease *newlease); +void ddsi_purge_proxy_participants (struct ddsi_domaingv *gv, const ddsi_xlocator_t *loc, bool delete_from_as_disc); +int ddsi_ref_proxy_participant (struct ddsi_proxy_participant *proxypp, struct ddsi_proxy_endpoint_common *c); +void ddsi_unref_proxy_participant (struct ddsi_proxy_participant *proxypp, struct ddsi_proxy_endpoint_common *c); +void ddsi_proxy_participant_add_pwr_lease_locked (struct ddsi_proxy_participant * proxypp, const struct ddsi_proxy_writer * pwr); +void ddsi_proxy_participant_remove_pwr_lease_locked (struct ddsi_proxy_participant * proxypp, struct ddsi_proxy_writer * pwr); + +/* To create or delete a new proxy participant: "guid" MUST have the + pre-defined participant entity id. Unlike ddsi_delete_participant (), + deleting a proxy participant will automatically delete all its + readers & writers. Delete removes the participant from a hash table + and schedules the actual deletion. + + TODO: what about proxy participants without built-in endpoints? +*/ + +DDS_EXPORT bool ddsi_new_proxy_participant (struct ddsi_domaingv *gv, const struct ddsi_guid *guid, uint32_t bes, const struct ddsi_guid *privileged_pp_guid, struct addrset *as_default, struct addrset *as_meta, const struct ddsi_plist *plist, dds_duration_t tlease_dur, nn_vendorid_t vendor, unsigned custom_flags, ddsrt_wctime_t timestamp, seqno_t seq); +DDS_EXPORT int ddsi_delete_proxy_participant_by_guid (struct ddsi_domaingv *gv, const struct ddsi_guid *guid, ddsrt_wctime_t timestamp, int isimplicit); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_PROXY_PARTICIPANT_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_raweth.h b/unitree_SDK/include/dds/ddsi/ddsi_raweth.h new file mode 100644 index 0000000..b09dac3 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_raweth.h @@ -0,0 +1,25 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_RAWETH_H +#define DDSI_RAWETH_H + +#if defined (__cplusplus) +extern "C" { +#endif + +int ddsi_raweth_init (struct ddsi_domaingv *gv); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_rhc.h b/unitree_SDK/include/dds/ddsi/ddsi_rhc.h new file mode 100644 index 0000000..630cd1a --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_rhc.h @@ -0,0 +1,85 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_RHC_H +#define DDSI_RHC_H + +#include +#include +#include + +#include "dds/export.h" +#include "dds/features.h" + +/* DDS_EXPORT inline i.c.w. __attributes__((visibility...)) and some compilers: */ +#include "dds/ddsrt/attributes.h" +#include "dds/ddsrt/time.h" +#include "dds/ddsi/ddsi_guid.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct dds_qos; +struct ddsi_rhc; +struct ddsi_tkmap_instance; +struct ddsi_serdata; + +struct ddsi_writer_info +{ + ddsi_guid_t guid; + bool auto_dispose; + int32_t ownership_strength; + uint64_t iid; +#ifdef DDS_HAS_LIFESPAN + ddsrt_mtime_t lifespan_exp; +#endif +}; + +typedef void (*ddsi_rhc_free_t) (struct ddsi_rhc *rhc); +typedef bool (*ddsi_rhc_store_t) (struct ddsi_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wrinfo, struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk); +typedef void (*ddsi_rhc_unregister_wr_t) (struct ddsi_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wrinfo); +typedef void (*ddsi_rhc_relinquish_ownership_t) (struct ddsi_rhc * __restrict rhc, const uint64_t wr_iid); +typedef void (*ddsi_rhc_set_qos_t) (struct ddsi_rhc *rhc, const struct dds_qos *qos); + +struct ddsi_rhc_ops { + ddsi_rhc_store_t store; + ddsi_rhc_unregister_wr_t unregister_wr; + ddsi_rhc_relinquish_ownership_t relinquish_ownership; + ddsi_rhc_set_qos_t set_qos; + ddsi_rhc_free_t free; +}; + +struct ddsi_rhc { + const struct ddsi_rhc_ops *ops; +}; + +DDS_INLINE_EXPORT inline bool ddsi_rhc_store (struct ddsi_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wrinfo, struct ddsi_serdata * __restrict sample, struct ddsi_tkmap_instance * __restrict tk) { + return rhc->ops->store (rhc, wrinfo, sample, tk); +} +DDS_INLINE_EXPORT inline void ddsi_rhc_unregister_wr (struct ddsi_rhc * __restrict rhc, const struct ddsi_writer_info * __restrict wrinfo) { + rhc->ops->unregister_wr (rhc, wrinfo); +} +DDS_INLINE_EXPORT inline void ddsi_rhc_relinquish_ownership (struct ddsi_rhc * __restrict rhc, const uint64_t wr_iid) { + rhc->ops->relinquish_ownership (rhc, wr_iid); +} +DDS_INLINE_EXPORT inline void ddsi_rhc_set_qos (struct ddsi_rhc *rhc, const struct dds_qos *qos) { + rhc->ops->set_qos (rhc, qos); +} +DDS_INLINE_EXPORT inline void ddsi_rhc_free (struct ddsi_rhc *rhc) { + rhc->ops->free (rhc); +} + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_RHC_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_security_exchange.h b/unitree_SDK/include/dds/ddsi/ddsi_security_exchange.h new file mode 100644 index 0000000..a2e3ef2 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_security_exchange.h @@ -0,0 +1,51 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_SECURITY_EXCHANGE_H +#define DDSI_SECURITY_EXCHANGE_H + +#include "dds/features.h" + +#ifdef DDS_HAS_SECURITY + +#if defined (__cplusplus) +extern "C" { +#endif + +#include "dds/ddsi/q_rtps.h" +#include "dds/ddsi/q_radmin.h" +#include "dds/ddsi/ddsi_entity.h" +#include "dds/ddsi/ddsi_security_msg.h" + + +#define GMCLASSID_SECURITY_PARTICIPANT_CRYPTO_TOKENS "dds.sec.participant_crypto_tokens" +#define GMCLASSID_SECURITY_DATAWRITER_CRYPTO_TOKENS "dds.sec.datawriter_crypto_tokens" +#define GMCLASSID_SECURITY_DATAREADER_CRYPTO_TOKENS "dds.sec.datareader_crypto_tokens" + +bool write_auth_handshake_message(const struct ddsi_participant *pp, const struct ddsi_proxy_participant *proxypp, nn_dataholderseq_t *mdata, bool request, const nn_message_identity_t *related_message_id); +void handle_auth_handshake_message(const struct receiver_state *rst, ddsi_entityid_t wr_entity_id, struct ddsi_serdata *sample); +void handle_crypto_exchange_message(const struct receiver_state *rst, struct ddsi_serdata *sample); +void auth_get_serialized_participant_data(struct ddsi_participant *pp, ddsi_octetseq_t *seq); +bool write_crypto_participant_tokens(const struct ddsi_participant *pp, const struct ddsi_proxy_participant *proxypp, const nn_dataholderseq_t *tokens); +bool write_crypto_writer_tokens(const struct ddsi_writer *wr, const struct ddsi_proxy_reader *prd, const nn_dataholderseq_t *tokens); +bool write_crypto_reader_tokens(const struct ddsi_reader *rd, const struct ddsi_proxy_writer *pwr, const nn_dataholderseq_t *tokens); + +#if defined (__cplusplus) +} +#endif + +#else /* DDS_HAS_SECURITY */ + +#define volatile_secure_data_filter NULL + +#endif /* DDS_HAS_SECURITY */ + +#endif /* DDSI_SECURITY_EXCHANGE_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_security_msg.h b/unitree_SDK/include/dds/ddsi/ddsi_security_msg.h new file mode 100644 index 0000000..f837778 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_security_msg.h @@ -0,0 +1,122 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_SECURITY_MSG_H +#define DDSI_SECURITY_MSG_H + +#include "dds/features.h" + +#ifdef DDS_HAS_SECURITY + +#include "dds/ddsi/ddsi_plist.h" +#include "dds/ddsi/ddsi_guid.h" +#include "dds/ddsrt/retcode.h" +#include "dds/ddsrt/misc.h" +#include "dds/ddsi/ddsi_plist_generic.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_participant; +struct ddsi_writer; +struct ddsi_proxy_reader; +struct ddsi_serdata; + +#define DDS_SECURITY_AUTH_REQUEST "dds.sec.auth_request" +#define DDS_SECURITY_AUTH_HANDSHAKE "dds.sec.auth" + +#define DDS_SECURITY_AUTH_VERSION_MAJOR 1 +#define DDS_SECURITY_AUTH_VERSION_MINOR 0 + +#define DDS_SECURITY_AUTH_TOKEN_CLASS_ID_BASE "DDS:Auth:PKI-DH:" +#define DDS_SECURITY_AUTH_TOKEN_CLASS_ID DDS_SECURITY_AUTH_TOKEN_CLASS_ID_BASE DDSRT_STRINGIFY(DDS_SECURITY_AUTH_VERSION_MAJOR) "." DDSRT_STRINGIFY(DDS_SECURITY_AUTH_VERSION_MINOR) + +#define DDS_SECURITY_AUTH_REQUEST_TOKEN_CLASS_ID DDS_SECURITY_AUTH_TOKEN_CLASS_ID "+AuthReq" +#define DDS_SECURITY_AUTH_HANDSHAKE_REQUEST_TOKEN_ID DDS_SECURITY_AUTH_TOKEN_CLASS_ID "+Req" +#define DDS_SECURITY_AUTH_HANDSHAKE_REPLY_TOKEN_ID DDS_SECURITY_AUTH_TOKEN_CLASS_ID "+Reply" +#define DDS_SECURITY_AUTH_HANDSHAKE_FINAL_TOKEN_ID DDS_SECURITY_AUTH_TOKEN_CLASS_ID "+Final" + + +typedef struct nn_message_identity { + ddsi_guid_t source_guid; + seqno_t sequence_number; +} nn_message_identity_t; + +typedef struct nn_participant_generic_message { + nn_message_identity_t message_identity; + nn_message_identity_t related_message_identity; + ddsi_guid_t destination_participant_guid; + ddsi_guid_t destination_endpoint_guid; + ddsi_guid_t source_endpoint_guid; + const char *message_class_id; + nn_dataholderseq_t message_data; +} nn_participant_generic_message_t; + + +/* + * The arguments are aliased in the resulting message structure. + * This means that the lifecycle of the arguments should be longer + * then that of the message. + */ +DDS_EXPORT void +nn_participant_generic_message_init( + nn_participant_generic_message_t *msg, + const ddsi_guid_t *wrguid, + seqno_t wrseq, + const ddsi_guid_t *dstpguid, + const ddsi_guid_t *dsteguid, + const ddsi_guid_t *srceguid, + const char *classid, + const nn_dataholderseq_t *mdata, + const nn_message_identity_t *rmid); + +/* + * Aliased struct variables will not be freed. + */ +DDS_EXPORT void +nn_participant_generic_message_deinit( + nn_participant_generic_message_t *msg); + +/* + * Some struct variables are aliased to the given buffer. + * This means that the lifecycle of the data buffer should be + * longer then that of the message. + */ +DDS_EXPORT dds_return_t +nn_participant_generic_message_deseralize( + nn_participant_generic_message_t *msg, + const unsigned char *data, + size_t len, + bool bswap); + +DDS_EXPORT dds_return_t +nn_participant_generic_message_serialize( + const nn_participant_generic_message_t *msg, + unsigned char **data, + size_t *len); + +DDS_EXPORT extern const enum pserop pserop_participant_generic_message[]; +DDS_EXPORT extern const size_t pserop_participant_generic_message_nops; + +DDS_EXPORT int +volatile_secure_data_filter( + struct ddsi_writer *wr, + struct ddsi_proxy_reader *prd, + struct ddsi_serdata *serdata); + +#if defined (__cplusplus) +} +#endif + +#endif + +#endif /* DDSI_SECURITY_MSG_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_security_omg.h b/unitree_SDK/include/dds/ddsi/ddsi_security_omg.h new file mode 100644 index 0000000..731f65c --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_security_omg.h @@ -0,0 +1,1455 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_OMG_SECURITY_H +#define DDSI_OMG_SECURITY_H + +#include "dds/features.h" + +#include "dds/ddsrt/sync.h" +#include "dds/ddsrt/avl.h" + +#include "dds/ddsi/ddsi_plist.h" +#include "dds/ddsi/ddsi_entity.h" +#include "dds/ddsi/ddsi_entity_match.h" +#include "dds/ddsi/ddsi_domaingv.h" +#include "dds/ddsi/q_radmin.h" +#include "dds/ddsi/q_xmsg.h" +#include "dds/ddsrt/retcode.h" +#include "dds/ddsrt/types.h" +#include "dds/ddsrt/sync.h" +#include "dds/ddsi/ddsi_xqos.h" + +#ifdef DDS_HAS_SECURITY +#include "dds/security/dds_security_api.h" +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef enum { + NN_RTPS_MSG_STATE_ERROR, + NN_RTPS_MSG_STATE_PLAIN, + NN_RTPS_MSG_STATE_ENCODED +} nn_rtps_msg_state_t; + +struct ddsi_hsadmin; +struct participant_sec_attributes; +struct ddsi_proxy_participant_sec_attributes; +struct ddsi_writer_sec_attributes; +struct ddsi_reader_sec_attributes; +struct dds_security_context; +struct ddsi_topic; +struct ddsi_proxy_endpoint_common; + +#ifdef DDS_HAS_SECURITY + +typedef struct nn_msg_sec_info { + unsigned encoded:1; + unsigned use_rtps_encoding:1; + int64_t src_pp_handle; + int64_t dst_pp_handle; +} nn_msg_sec_info_t; + +struct pp_proxypp_match { + ddsrt_avl_node_t avlnode; + ddsi_guid_t proxypp_guid; + DDS_Security_ParticipantCryptoHandle proxypp_crypto_handle; +}; + +struct proxypp_pp_match { + ddsrt_avl_node_t avlnode; + ddsi_guid_t pp_guid; + DDS_Security_ParticipantCryptoHandle pp_crypto_handle; + DDS_Security_PermissionsHandle permissions_handle; + DDS_Security_SharedSecretHandle shared_secret; + bool authenticated; +}; + +struct participant_sec_attributes { + ddsrt_avl_node_t avlnode; + ddsi_guid_t pp_guid; + DDS_Security_ParticipantSecurityAttributes attr; + DDS_Security_IdentityHandle local_identity_handle; + DDS_Security_PermissionsHandle permissions_handle; + DDS_Security_ParticipantCryptoHandle crypto_handle; + bool plugin_attr; + ddsrt_mutex_t lock; + ddsrt_avl_ctree_t proxy_participants; + bool initialized; +}; + +struct ddsi_proxy_participant_sec_attributes { + struct dds_security_context *sc; + DDS_Security_IdentityHandle remote_identity_handle; + DDS_Security_ParticipantCryptoHandle crypto_handle; + ddsrt_mutex_t lock; + ddsrt_avl_tree_t participants; + bool initialized; +}; + +struct ddsi_writer_sec_attributes { + DDS_Security_EndpointSecurityAttributes attr; + DDS_Security_DatawriterCryptoHandle crypto_handle; + bool plugin_attr; +}; + +struct ddsi_reader_sec_attributes { + DDS_Security_EndpointSecurityAttributes attr; + DDS_Security_DatareaderCryptoHandle crypto_handle; + bool plugin_attr; +}; + +DDS_EXPORT struct dds_security_access_control *q_omg_participant_get_access_control(const struct ddsi_participant *pp); +DDS_EXPORT struct dds_security_authentication *q_omg_participant_get_authentication(const struct ddsi_participant *pp); +DDS_EXPORT struct dds_security_cryptography *q_omg_participant_get_cryptography(const struct ddsi_participant *pp); + +void q_omg_vlog_exception(const struct ddsrt_log_cfg *lc, uint32_t cat, DDS_Security_SecurityException *exception, const char *file, uint32_t line, const char *func, const char *fmt, va_list ap); +void q_omg_log_exception(const struct ddsrt_log_cfg *lc, uint32_t cat, DDS_Security_SecurityException *exception, const char *file, uint32_t line, const char *func, const char *fmt, ...); + +/** + * @brief Check if access control is enabled for the participant. + * + * @param[in] pp Participant to check. + * + * @returns bool True if access control is enabled for participant + */ +bool q_omg_participant_is_access_protected(const struct ddsi_participant *pp); + +/** + * @brief Check if protection at RTPS level is enabled for the participant. + * + * @param[in] pp Participant to check. + * + * @returns bool True if RTPS protection enabled for participant + */ +bool q_omg_participant_is_rtps_protected(const struct ddsi_participant *pp); + +/** + * @brief Check if liveliness is protected for the participant. + * + * @param[in] pp Participant to check. + * + * @returns bool True if liveliness data for participant is protected + */ +bool q_omg_participant_is_liveliness_protected(const struct ddsi_participant *pp); + +/** + * @brief Check if discovery is protected for the participant. + * + * @param[in] pp Participant to check. + * + * @returns bool True if discovery data for participant is protected + */ +bool q_omg_participant_is_discovery_protected(const struct ddsi_participant *pp); + +/** + * @brief Check if security is enabled for the participant. + * + * @param[in] pp Participant to check if it is secure. + * + * @returns bool True if participant is secure + */ +bool q_omg_participant_is_secure(const struct ddsi_participant *pp); + +/** + * @brief Check if security is enabled for the proxy participant. + * + * @param[in] proxypp Proxy participant to check if it is secure. + * + * @returns bool True if proxy participant is secure + */ +bool q_omg_proxy_participant_is_secure(const struct ddsi_proxy_participant *proxypp); + +/** + * @brief Check security if it is allowed to create the participant. + * + * When security is enabled for this participant it is checked if the + * participant is authenticated by checking the provided security + * certificates. When that is ok the participant is registered with + * access control and with cryptography. When that is all successful + * this function return true; + * + * @param[in] pp The participant to check if alloweed by security. + * #param[in] domain_id The domain_id + * + * @returns dds_return_t + * @retval DDS_RETCODE_OK Participant is allowed + * @retval DDS_RETCODE_NOT_ALLOWED_BY_SECURITY + * Participant is not allowed + */ +dds_return_t q_omg_security_check_create_participant(struct ddsi_participant *pp, uint32_t domain_id); + +void q_omg_security_participant_set_initialized(struct ddsi_participant *pp); + +bool q_omg_security_participant_is_initialized(struct ddsi_participant *pp); + +/** + * @brief Remove the participant from the security plugins. + * + * When the participant was registered with the security + * plugins then this function will release the allocated + * security resources. + * + * @param[in] pp Participant to remove. + */ +void q_omg_security_deregister_participant(struct ddsi_participant *pp); + +/** + * @brief Get the identity handle associate with this participant. + * + * This function returns the identity handle that was created + * when the participant was authenticated. This handle corresponds + * with the handle returned by calling validate_local_identity on + * the authentication plugin. + * + * @param[in] pp Participant to check if it is secure. + * + * @returns int64_t + * @retval !0 Identity handle associated with the participant. + * @retval 0 Invalid handle the participant was not registered + */ +int64_t q_omg_security_get_local_participant_handle(const struct ddsi_participant *pp); + +/** + * @brief Get security info flags of the given participant. + * + * @param[in] pp Participant to get the security info from. + * @param[out] info The security info. + * + * @returns bool + * @retval true Security info set. + * @retval false Security info not set. + */ +bool q_omg_get_participant_security_info(const struct ddsi_participant *pp, nn_security_info_t *info); + +/** + * @brief Get the is_rtps_protected flag of the given remote participant. + * + * @param[in] pp The participant. + * @param[in] entityid ID of the entity to check. + * + * @returns bool + * @retval true RTPS protected is set. + * @retval false RTPS protected is not set. + */ +bool q_omg_security_is_local_rtps_protected(const struct ddsi_participant *pp, ddsi_entityid_t entityid); + +/** + * @brief Check if the participant and the proxy participant + * have compatible security info settings. + * + * Associated with a secure participant is the ParticipantSecurityInfo parameter. + * This parameter contains the setting of the security attributes and the associated + * plugin security attributes of the secure participant. + * This function will check if the received ParticipantSecurityInfo parameter is + * compatible with the local ParticipantSecurityInfo parameter. + * + * @param[in] pp The participant. + * @param[in] proxypp The proxy participant. + * + * @returns bool + * @retval true The participant and the proxy participant have compatible + * security info settings. + * @retval false Otherwise. + */ +bool q_omg_is_similar_participant_security_info(struct ddsi_participant *pp, struct ddsi_proxy_participant *proxypp); + +/** + * @brief Check if the parameter list key hash is protected + * + * @param[in] plist The parameter list + * + * @returns bool True if the parameter list key hash is protected + */ +bool q_omg_plist_keyhash_is_protected(const ddsi_plist_t *plist); + +/** + * @brief Check if the endpoint is protected + * + * Checks whether the provided parameter list has the flag + * ENDPOINT_SECURITY_ATTRIBUTES_FLAG_IS_VALID set. When this flag + * is set, this implies that the remote endpoint has protection + * enabled. + * + * @param[in] plist The parameter list + * + * @returns bool True if the endpoint is protected + */ +bool q_omg_is_endpoint_protected(const ddsi_plist_t *plist); + +/** + * @brief Writes the security attributes and security plugin attributes to log (category discovery) + * + * @param[in] gv Global variable + * @param[in] plist The parameter list + */ +void q_omg_log_endpoint_protection(struct ddsi_domaingv * const gv, const ddsi_plist_t *plist); + +/** + * @brief Check if security allows to create the topic. + * + * This function checks with access control if is allowed to create + * this topic for the specified domain. + * + * @param[in] gv The domain global information. + * @param[in] pp_guid The participant guid. + * @param[in] topic_name The name of the topic. + * @param[in] qos The topic QoS used. + * + * @returns bool + * @retval true Creation of the topic is allowed + * @retval false Otherwise. + */ +bool q_omg_security_check_create_topic(const struct ddsi_domaingv *gv, const ddsi_guid_t *pp_guid, const char *topic_name, const struct dds_qos *qos); + +/** + * @brief Get security info flags of the given writer. + * + * @param[in] wr Writer to get the security info from. + * @param[out] info The security info. + * + * @returns bool + * @retval true Security info set. + * @retval false Security info not set (probably unsecure writer). + */ +bool q_omg_get_writer_security_info(const struct ddsi_writer *wr, nn_security_info_t *info); + +/** + * @brief Return the builtin writer id for this writers' discovery. + * + * Return builtin entity id of the writer to use for the publication + * discovery information. + * Depending on whether the discovery is protected or not (for the + * given writer), either the default writer or protected writer needs + * to be used. + * + * @param[in] wr Writer to determine the publication writer from. + * + * @returns unsigned + * @retval NN_ENTITYID_SEDP_BUILTIN_PUBLICATIONS_SECURE_WRITER + * @retval NN_ENTITYID_SEDP_BUILTIN_PUBLICATIONS_WRITER + */ +unsigned determine_publication_writer(const struct ddsi_writer *wr); + +/** + * @brief Check if security allows to create the writer. + * + * This function checks with access control if is allowed to create + * this writer for the specified domain. + * + * @param[in] pp Participant on which the topic is being created. + * @param[in] domain_id The corresponding domain_id. + * @param[in] topic_name The name of the topic. + * @param[in] writer_qos The writer QoS used. + * + * @returns bool + * @retval true Creation of the writer is allowed + * @retval false Otherwise. + */ +bool q_omg_security_check_create_writer(struct ddsi_participant *pp, uint32_t domain_id, const char *topic_name, const struct dds_qos *writer_qos); + +/** + * @brief Register the writer with security. + * + * This function registers the writer with security + * when the associated participant has security enabled. + * The security settings associated with this writer are determined + * and the writer is registered with cryptography when needed by + * the security settings which indicate if payload protection and or + * submessage protection is enabled for this writer. + * + * @param[in] wr The writer to register. + */ +void q_omg_security_register_writer(struct ddsi_writer *wr); + +/** + * @brief Remove the writer from security. + * + * When the writer was registered with security then this function + * will remove the writer from security which will free the allocated + * security resource created for this writer. + * + * @param[in] wr The writer to remove. + */ +void q_omg_security_deregister_writer(struct ddsi_writer *wr); + +/** + * @brief Get security info flags of the given reader. + * + * @param[in] rd Reader to get the security info from. + * @param[out] info The security info. + * + * @returns bool + * @retval true Security info set. + * @retval false Security info not set (probably unsecure reader). + */ +bool q_omg_get_reader_security_info(const struct ddsi_reader *rd, nn_security_info_t *info); + +/** + * @brief Return the builtin writer id for this readers' discovery. + * + * Return builtin entity id of the writer to use for the subscription + * discovery information. + * Depending on whether the discovery is protected or not (for the + * given reader), either the default writer or protected writer needs + * to be used. + * + * @param[in] rd Reader to determine the subscription writer from. + * + * @returns unsigned + * @retval NN_ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_WRITER + * @retval NN_ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_WRITER + */ +unsigned determine_subscription_writer(const struct ddsi_reader *rd); + +#ifdef DDS_HAS_TOPIC_DISCOVERY +/** + * @brief Return the builtin writer id for topic discovery. + * + * Return builtin entity id of the writer to use for the topic + * discovery information. + * + * @param[in] tp Topic to determine the writer from. + * + * @returns unsigned + * @retval NN_ENTITYID_SEDP_BUILTIN_TOPIC_WRITER + */ +unsigned determine_topic_writer(const struct ddsi_topic *tp); +#endif /* DDS_HAS_TOPIC_DISCOVERY */ + +/** + * @brief Check if security allows to create the reader. + * + * This function checks with access control if is allowed to create + * this reader for the specified domain. + * + * @param[in] pp Participant on which the topic is being created. + * @param[in] domain_id The corresponding domain_id. + * @param[in] topic_name The name of the topic. + * @param[in] reader_qos The reader QoS used. + * + * @returns bool + * @retval true Creation of the writer is allowed + * @retval false Otherwise. + */ +bool q_omg_security_check_create_reader(struct ddsi_participant *pp, uint32_t domain_id, const char *topic_name, const struct dds_qos *reader_qos); + +/** + * @brief Register the reader with security. + * + * This function registers the reader with security + * when the associated participant has security enabled. + * The security settings associated with this reader are determined + * and the reader is registered with cryptography when needed by + * the security settings which indicate if submessage protection is + * enabled for this reader. + * + * @param[in] rd The reader to register. + */ +void q_omg_security_register_reader(struct ddsi_reader *rd); + +/** + * @brief Remove the reader from security. + * + * When the reader was registered with security then this function + * will remove the reader from security which will free the allocated + * security resource created for this reader. + * + * @param[in] rd The reader to remove. + */ +void q_omg_security_deregister_reader(struct ddsi_reader *rd); + +/** + * @brief Determine if the proxy participant is allowed to be deleted + * by the given writer. + * + * If an proxy participant is authenticated, it is only allowed to + * to deleted when a dispose is received from the proper protected + * discovery writer. + * + * @param[in] gv Used for tracing. + * @param[in] guid Guid of the proxy participant to be deleted. + * @param[in] pwr_entityid Writer that send the dispose. + * + * @returns bool + * @retval true The proxy participant may be deleted. + * @retval false The proxy participant may not be deleted by this writer. + */ +bool is_proxy_participant_deletion_allowed(struct ddsi_domaingv * const gv, const struct ddsi_guid *guid, const ddsi_entityid_t pwr_entityid); + +/** + * @brief Determine if the messages, related to the given remote + * entity, are RTPS protected or not. + * + * @param[in] proxy_pp Related proxy participant. + * @param[in] entityid ID of the entity to check. + * + * @returns bool + * @retval true The entity messages are RTPS protected. + * @retval false The entity messages are not RTPS protected. + */ +bool q_omg_security_is_remote_rtps_protected(const struct ddsi_proxy_participant *proxy_pp, ddsi_entityid_t entityid); + +/** + * @brief Set security information, depending on plist, into the given + * proxy participant. + * + * @param[in] proxypp Proxy participant to set security info on. + * @param[in] plist Paramater list, possibly contains security info. + */ +void set_proxy_participant_security_info(struct ddsi_proxy_participant *proxypp, const ddsi_plist_t *plist); + +/** + * @brief Determine if the messages, related to the given remote + * entity, are RTPS protected or not. + * + * @param[in] pp The participant. + * @param[in] entityid ID of the entity to check. + * + * @returns bool + * @retval true The entity messages are RTPS protected. + * @retval false The entity messages are not RTPS protected. + */ +bool q_omg_security_is_local_rtps_protected(const struct ddsi_participant *pp, ddsi_entityid_t entityid); + +/** + * @brief Check if the participant allows communication with unauthenticated + * participants + * + * @param[in] pp The participant. + * + * @returns bool + * @retval true The participant allows unauthenticated communication + * @retval false Otherwise. + */ +bool q_omg_participant_allow_unauthenticated(struct ddsi_participant *pp); + +/** + * @brief Initialize the proxy participant security attributes + * + * @param[in] proxypp The proxy participant. + * + */ +void q_omg_security_init_remote_participant(struct ddsi_proxy_participant *proxypp); + +void q_omg_security_remote_participant_set_initialized(struct ddsi_proxy_participant *proxypp); + +bool q_omg_security_remote_participant_is_initialized(struct ddsi_proxy_participant *proxypp); + +/** + * @brief Registers the matched proxy participant with the crypto plugin + * + * When the proxy participant is authenticated and allowed by access control then the match between the local and + * the remote participant must be registered with the cypto factory provided by the crypto plugin. The + * shared secret handle obtained from the authentication phase and the permission handle returned when validating + * the proxy participant with access control plugin have to be provided. + * + * + * @param[in] pp The participant. + * @param[in] proxypp The proxy participant. + * @param[in] shared_secret The shared_secret handle. + * + * @returns bool + * @retval true The proxy participant is allowed. + * @retval false The proxy participant is not allowed. + */ +bool q_omg_security_register_remote_participant(struct ddsi_participant *pp, struct ddsi_proxy_participant *proxypp, int64_t shared_secret); + +/** + * @brief Sets the matching participant and proxy participant as authorized. + * + * When the authentication handshake has finished successfully and the + * volatile secure readers and writers are matched then with this function + * the matching local and remote participant are set to authenticated which + * allows the crypto tokens to be exchanged and the corresponding entities + * be matched. + * + * @param[in] pp The participant. + * @param[in] proxypp The proxy participant. + */ +void q_omg_security_set_remote_participant_authenticated(struct ddsi_participant *pp, struct ddsi_proxy_participant *proxypp); + +/** + * @brief Removes a registered proxy participant from administation of the authentication, + * access control and crypto plugins. + * + * @param[in] proxypp The proxy participant. + */ +void q_omg_security_deregister_remote_participant(struct ddsi_proxy_participant *proxypp); + +/** + * @brief Generate and send the crypto tokens needed for encoding RTPS messages. + * + * When the security settings indicate that RTPS message encoding or signing is + * configured for the participant then this function will ask the cypto echange for + * the corresponding cypto tokens and send these to the proxy participant. + * + * @param[in] pp The participant. + * @param[in] proxypp The proxy participant. + */ +void q_omg_security_participant_send_tokens(struct ddsi_participant *pp, struct ddsi_proxy_participant *proxypp); + +/** + * @brief Get the cypto handle associated with the proxy participant. + * + * This function returns the handle which is the association between + * the proxy participant and the crypto plugin. This handle is created + * when the proxy participant is registered with the crypto plugin. + * + * @param[in] proxypp The proxy participant. + * + * @returns handle + * @retval !0 Valid crypto handle associated with the proxy participant. + * @retval 0 Otherwise. + */ +int64_t q_omg_security_get_remote_participant_handle(struct ddsi_proxy_participant *proxypp); + +/** + * @brief Set the crypto tokens used for the encryption and decryption of RTPS messages. + * + * The remote participant will send the crypto tokens when the security settings determine that the + * communication between the participants must be secure. These tokens are used for the necryption and + * decryption of complete RTPS messages. When these tokens are received this function will register these tokens + * with the crypto plugin. The crypto plugin will return a crypto handle that will be used to associate the + * stored tokens with the remote participant. + * + * @param[in] pp The local participant. + * @param[in] proxypp The remote participant. + * @param[in] tokens The crypto token received from the remote participant for the local participant. + */ +void q_omg_security_set_participant_crypto_tokens(struct ddsi_participant *pp, struct ddsi_proxy_participant *proxypp, const nn_dataholderseq_t *tokens); + +/** + * @brief Check if the writer has the is_discovery_protected flag set + * + * @param[in] wr The local writer. + * + * @returns bool True if the writer has the is_discovery_protected flag set + */ +bool q_omg_writer_is_discovery_protected(const struct ddsi_writer *wr); + +/** + * @brief Check if the writer has the is_submessage_protected flag set + * + * @param[in] wr The local writer. + * + * @returns bool True if the writer has the is_submessage_protected flag set + */ +bool q_omg_writer_is_submessage_protected(const struct ddsi_writer *wr); + +/** + * @brief Check if the writer has the is_payload_protected flag set + * + * @param[in] wr The local writer. + * + * @returns bool True if the writer has the is_payload_protected flag set + */ +bool q_omg_writer_is_payload_protected(const struct ddsi_writer *wr); + +/** + * @brief Check if the remote writer is allowed to communicate with endpoints of the + * local participant. + * + * This function will check with the access control plugin if the remote writer + * is allowed to communicate with this participant. + * + * @param[in] pwr The remote writer. + * @param[in] domain_id The domain id. + * @param[in] pp The local participant. + * + * @returns bool + * @retval true The remote writer is allowed to communicate. + * @retval false Otherwise. + */ +bool q_omg_security_check_remote_writer_permissions(const struct ddsi_proxy_writer *pwr, uint32_t domain_id, struct ddsi_participant *pp); + +/** + * @brief Check it the remote writer is allowed to communicate with the local reader. + * + * When a remote writer is allowed by access control it has to be checked if the remote + * writer is allowed to communicate with a particular local reader. This function will + * check if the provided security end-point attributes are compatible, When the security + * attributes are compatible then the function will register the reader and remote writer + * match with the crypto factory and will also ask the crypto exchange to generate the + * crypto tokens associate with the local reader which will be sent to the remote entity. + * Note that the reader crypto tokens are used to encrypt the reader specific submessages + * when submessage encoding or signing is configured. + * + * @param[in] rd The local reader. + * @param[in] pwr The remote writer. + * @param[out] crypto_handle The crypto handle associated with the match. + * + * @returns bool + * @retval true The local reader and remote writer are allowed to communicate. + * @retval false Otherwise. + */ +bool q_omg_security_match_remote_writer_enabled(struct ddsi_reader *rd, struct ddsi_proxy_writer *pwr, int64_t *crypto_handle); + +/** + * @brief Release the security information associated with the match between a reader and + * a remote writer. + * + * This function releases the security resources that were allocated for this reader and remote + * writer match. For example it will release the security tokens that where associated with this + * reader and the remote writer. + * + * @param[in] gv The global parameters. + * @param[in] rd_guid The guid of the reader. + * @param[in] match The reader-proxy_writer match. + */ +void q_omg_security_deregister_remote_writer_match(const struct ddsi_domaingv *gv, const ddsi_guid_t *rd_guid, struct ddsi_rd_pwr_match *match); + +/** + * @brief Set the crypto tokens used for the secure communication from the remote writer to the reader. + * + * The remote writer instance will send the crypto tokens when the security settings determine that the + * communication between the remote writer and the reader must be secure. When these tokens are received + * this function will register these tokens with the crypto plugin and set the corresponding crypto handle returned + * by the crypto plugin which is then used for decrypting messages received from that remote writer to the reader. + * + * @param[in] rd The local reader. + * @param[in] pwr_guid The guid of the remote writer. + * @param[in] tokens The crypto token received from the remote writer for the reader. + */ +void q_omg_security_set_remote_writer_crypto_tokens(struct ddsi_reader *rd, const ddsi_guid_t *pwr_guid, const nn_dataholderseq_t *tokens); + +/** + * @brief Release all the security resources associated with the remote writer. + * + * Cleanup security resource associated with the remote writer. + * + * @param[in] pwr The remote writer. + */ +void q_omg_security_deregister_remote_writer(const struct ddsi_proxy_writer *pwr); + +/** + * @brief Set security information, depending on plist and proxy participant, + * into the given proxy reader. + * + * @param[in] prd Proxy reader to set security info on. + * @param[in] plist Paramater list, possibly contains security info. + */ +void set_proxy_reader_security_info(struct ddsi_proxy_reader *prd, const ddsi_plist_t *plist); + +/** + * @brief Determine the security settings associated with the remote reader. + * + * From the security information contained in the parameter list from the remote reader + * the corresponding security settings are determined and returned in the info parameter. + * + * @param[in] prd The remote reader. + * @param[in] plist The parameter list from the remote reader. + * @param[out] info The security settings associated with the remote reader. + */ +void q_omg_get_proxy_reader_security_info(struct ddsi_proxy_reader *prd, const ddsi_plist_t *plist, nn_security_info_t *info); + +/** + * @brief Check if the reader has the is_discovery_protected flag set + * + * @param[in] rd The local reader. + * + * @returns bool True if the reader has the is_discovery_protected flag set + */ +bool q_omg_reader_is_discovery_protected(const struct ddsi_reader *rd); + +/** + * @brief Check if the reader has the is_submessage_protected flag set + * + * @param[in] rd The local reader. + * + * @returns bool True if the reader has the is_submessage_protected flag set + */ +bool q_omg_reader_is_submessage_protected(const struct ddsi_reader *rd); + +/** + * @brief Check if the remote reader is allowed to communicate with endpoints of the + * local participant. + * + * This function will check with the access control plugin if the remote reader + * is allowed to communicate with this participant. + * + * @param[in] prd The remote reader. + * @param[in] domain_id The domain id. + * @param[in] pp The local participant. + * @param[out] relay_only The "relay_only" value returned by the access control + * operation check_remote_datareader() + * + * @returns bool + * @retval true The remote reader is allowed to communicate. + * @retval false Otherwise; relay_only is unspecified. + */ +bool q_omg_security_check_remote_reader_permissions(const struct ddsi_proxy_reader *prd, uint32_t domain_id, struct ddsi_participant *pp, bool *relay_only); + + +/** + * @brief Set security information, depending on plist and proxy participant, + * into the given proxy endpoint. + * + * @param[in] entity The endpoint common attributes. + * @param[in] proxypp_sec_info The security info of the proxy participant + * @param[in] plist Paramater list which may contain security info. + * @param[in] info The proxy endpoint security info to be set. + */ +void q_omg_get_proxy_endpoint_security_info(const struct ddsi_entity_common *entity, nn_security_info_t *proxypp_sec_info, const ddsi_plist_t *plist, nn_security_info_t *info); + +/** + * @brief Check it the local writer is allowed to communicate with the remote reader. + * + * When a remote reader is allowed by accessstruct dds_security_garbage control it has to be checked if the local + * writer is allowed to communicate with a particular local writer. This function will + * check if the provided security end-point attributes are compatible, When the security + * attributes are compatible then the function will register the writer and remote reader + * match with the crypto factory and will also ask the crypto exchange to generate the + * crypto tokens associate with the local writer which will be sent to the remote entity. + * Note that the writer crypto tokens are used to encrypt the writer specific submessages + * when submessage encoding or signing is configured and also the crypto tokens used + * for encoding the payload of data or datafrag messages. + * + * @param[in] wr The local writer. + * @param[in] prd The remote reader. + * @param[in] relay_only The "relay_only" returned by access control + * operation check_remote_datareader() + * @param[out] crypto_handle The crypto handle associated with the match. + * + * @returns bool + * @retval true The local writer and remote reader are allowed to communicate. + * @retval false Otherwise. + */ +bool q_omg_security_match_remote_reader_enabled(struct ddsi_writer *wr, struct ddsi_proxy_reader *prd, bool relay_only, int64_t *crypto_handle); + +/** + * @brief Release the security information associated with the match between a writer and + * a remote reader. + * + * This function releases the security resources that were allocated for this writer and remote + * reader match. For example it will release the security tokens that where associated with this + * writer and the remote reader. + * + * @param[in] gv The global parameters. + * @param[in] wr_guid The guid of the writer. + * @param[in] match The writer-proxy_reader match. + */ +void q_omg_security_deregister_remote_reader_match(const struct ddsi_domaingv *gv, const ddsi_guid_t *wr_guid, struct ddsi_wr_prd_match *match); + +/** + * @brief Set the crypto tokens used for the secure communication from the remote reader to the writer. + * + * The remote reader instance will send the crypto tokens when the security settings determine that the + * communication between the remote reader and the writer must be secure. When these tokens are received + * this function will register these tokens with the crypto plugin and set the corresponding crypto handle returned + * by the crypto plugin which is then used for decrypting messages received from that remote reader to the writer. + * + * @param[in] wr The local writer. + * @param[in] prd_guid The guid of the remote reader. + * @param[in] tokens The crypto token received from the remote reader for the writer. + */ +void q_omg_security_set_remote_reader_crypto_tokens(struct ddsi_writer *wr, const ddsi_guid_t *prd_guid, const nn_dataholderseq_t *tokens); + +/** + * @brief Release all the security resources associated with the remote reader. + * + * Cleanup security resource associated with the remote reader. + * + * @param[in] prd The remote reader. + */ +void q_omg_security_deregister_remote_reader(const struct ddsi_proxy_reader *prd); + +/** + * @brief Encode RTPS message. + * + * @param[in] src_handle Security handle of data source. + * @param[in] src_guid GUID of the entity data source. + * @param[in] src_buf Original RTPS message. + * @param[in] src_len Original RTPS message size. + * @param[out] dst_buf Encoded RTPS message. + * @param[out] dst_len Encoded RTPS message size. + * @param[in] dst_handle Security handle of data destination. + * + * @returns bool + * @retval true Encoding succeeded. + * @retval false Encoding failed. + */ +bool +q_omg_security_encode_rtps_message( + const struct ddsi_domaingv *gv, + int64_t src_handle, + const ddsi_guid_t *src_guid, + const unsigned char *src_buf, + size_t src_len, + unsigned char **dst_buf, + size_t *dst_len, + int64_t dst_handle); + +/** + * @brief Encode payload when necessary. + * + * When encoding is necessary, *buf will be allocated and the vec contents + * will change to point to that buffer. + * It is expected that the vec contents is always aliased. + * + * If no encoding is necessary, nothing changes. + * + * encoding( not needed) -> return( true), vec(untouched), buf(NULL) + * encoding(needed&success) -> return( true), vec( buf(new)) + * encoding(needed&failure) -> return(false), vec(untouched), buf(NULL) + * + * @param[in] wr Writer that writes the payload. + * @param[in,out] vec An iovec that contains the payload. + * @param[out] buf Buffer to contain the encoded payload. + * + * @returns bool + * @retval true Encoding succeeded or not necessary. Either way, vec + * contains the payload that should be send. + * @retval false Encoding was necessary, but failed. + */ +bool encode_payload(struct ddsi_writer *wr, ddsrt_iovec_t *vec, unsigned char **buf); + +/** + * @brief Decode the payload of a Data submessage. + * + * When decoding is necessary, the payloadp memory will be replaced + * by the decoded payload. This means that the original submessage + * now contains payload that can be deserialized. + * + * If no decoding is necessary, nothing changes. + * + * @param[in] gv Global information. + * @param[in] sampleinfo Sample information. + * @param[in,out] payloadp Pointer to payload memory. + * @param[in] payloadsz Size of payload. + * @param[in,out] submsg_len Size of submessage. + * + * @returns bool + * @retval true Decoding succeeded or not necessary. Either way, payloadp + * contains the data that should be deserialized. + * @retval false Decoding was necessary, but failed. + */ +bool decode_Data(const struct ddsi_domaingv *gv, struct nn_rsample_info *sampleinfo, unsigned char *payloadp, uint32_t payloadsz, size_t *submsg_len); + +/** + * @brief Decode the payload of a DataFrag submessage. + * + * When decoding is necessary, the payloadp memory will be replaced + * by the decoded payload. This means that the original submessage + * now contains payload that can be deserialized. + * + * If no decoding is necessary, nothing changes. + * + * @param[in] gv Global information. + * @param[in] sampleinfo Sample information. + * @param[in,out] payloadp Pointer to payload memory. + * @param[in] payloadsz Size of payload. + * @param[in,out] submsg_len Size of submessage. + * + * @returns bool + * @retval true Decoding succeeded or not necessary. Either way, payloadp + * contains the data that should be deserialized. + * @retval false Decoding was necessary, but failed. + */ +bool decode_DataFrag(const struct ddsi_domaingv *gv, struct nn_rsample_info *sampleinfo, unsigned char *payloadp, uint32_t payloadsz, size_t *submsg_len); + +/** + * @brief Encode datareader submessage when necessary. + * + * When encoding is necessary, the original submessage will be replaced + * by a new encoded submessage. + * If the encoding fails, the original submessage will be removed. + * + * If no encoding is necessary, nothing changes. + * + * @param[in,out] msg Complete message. + * @param[in,out] sm_marker Submessage location within message. + * @param[in] pwr Writer for which the message is intended. + * @param[in] rd_guid Origin reader guid. + */ +void encode_datareader_submsg(struct nn_xmsg *msg, struct nn_xmsg_marker sm_marker, const struct ddsi_proxy_writer *pwr, const struct ddsi_guid *rd_guid); + +/** + * @brief Encode datawriter submessage when necessary. + * + * When encoding is necessary, the original submessage will be replaced + * by a new encoded submessage. + * If the encoding fails, the original submessage will be removed. + * + * If no encoding is necessary, nothing changes. + * + * @param[in,out] msg Complete message. + * @param[in,out] sm_marker Submessage location within message. + * @param[in] wr Origin writer guid. + */ +void encode_datawriter_submsg(struct nn_xmsg *msg, struct nn_xmsg_marker sm_marker, struct ddsi_writer *wr); + +/** + * @brief Check if given submessage is properly decoded. + * + * When decoding is necessary, it should be checked if a plain submessage was + * actually decoded. Otherwise data can be injected just by inserting a plain + * submessage directly. + * + * @param[in] e Entity information. + * @param[in] c Proxy endpoint information. + * @param[in] proxypp Related proxy participant. + * @param[in] rst Receiver information. + * @param[in] prev_smid Previously handled submessage ID. + * + * @returns bool + * @retval true Decoding succeeded or was not necessary. + * @retval false Decoding was necessary, but not detected. + */ +bool +validate_msg_decoding( + const struct ddsi_entity_common *e, + const struct ddsi_proxy_endpoint_common *c, + const struct ddsi_proxy_participant *proxypp, + const struct receiver_state *rst, + SubmessageKind_t prev_smid); + +/** + * @brief Decode not only SecPrefix, but also the SecBody and SecPostfix + * sub-messages. + * + * When encrypted, the original SecBody will be replaced by the decrypted + * submessage. Then the normal sequence can continue as if there was no + * encrypted data. + * + * @param[in] rst Receiver information. + * @param[in,out] submsg Pointer to SecPrefix/(SecBody|Submsg)/SecPostfix. + * @param[in] submsg_size Size of SecPrefix submessage. + * @param[in] msg_end End of the complete message. + * @param[in] src_prefix Prefix of the source entity. + * @param[in] dst_prefix Prefix of the destination entity. + * @param[in] byteswap Do the bytes need swapping? + * + * @returns bool + * @retval true Decoding succeeded. + * @retval false Decoding failed. + */ +bool +decode_SecPrefix( + const struct receiver_state *rst, + unsigned char *submsg, + size_t submsg_size, + unsigned char * const msg_end, + const ddsi_guid_prefix_t * const src_prefix, + const ddsi_guid_prefix_t * const dst_prefix, + int byteswap); + +/** + * @brief Decode the RTPS message. + * + * When encrypted, the original buffers and information will be replaced + * by the decrypted RTPS message. Then the normal sequence can continue + * as if there was no encrypted data. + * + * @param[in] thrst Thread information. + * @param[in] gv Global information. + * @param[in,out] rmsg Message information. + * @param[in,out] hdr Message header. + * @param[in,out] buff Message buffer. + * @param[in,out] sz Message size. + * @param[in] rbpool Buffers pool. + * @param[in] isstream Is message a stream variant? + * + * @returns nn_rtps_msg_state_t + * @retval NN_RTPS_MSG_STATE_PLAIN No decoding was necessary. + * @retval NN_RTPS_MSG_STATE_ENCODED Decoding succeeded. + * @retval NN_RTPS_MSG_STATE_ERROR Decoding failed. + */ +nn_rtps_msg_state_t decode_rtps_message(struct thread_state * const thrst, struct ddsi_domaingv *gv, struct nn_rmsg **rmsg, Header_t **hdr, unsigned char **buff, size_t *sz, struct nn_rbufpool *rbpool, bool isstream); + +/** + * @brief Send the RTPS message securely. + * + * @param[in] conn Connection to use. + * @param[in] dst Possible destination information. + * @param[in] niov Number of io vectors. + * @param[in] iov Array of io vectors. + * @param[in] flags Connection write flags. + * @param[in,out] msg_len Submessage containing length. + * @param[in] dst_one Is there only one specific destination? + * @param[in] sec_info Security information for handles. + * @param[in] conn_write_cb Function to call to do the actual writing. + * + * @returns ssize_t + * @retval negative/zero Something went wrong. + * @retval positive Secure writing succeeded. + */ +ssize_t +secure_conn_write( + const struct ddsi_domaingv *gv, + ddsi_tran_conn_t conn, + const ddsi_locator_t *dst, + size_t niov, + const ddsrt_iovec_t *iov, + uint32_t flags, + MsgLen_t *msg_len, + bool dst_one, + nn_msg_sec_info_t *sec_info, + ddsi_tran_write_fn_t conn_write_cb); + + +/** + * @brief Loads the security plugins with the given configuration. + * This function tries to load the plugins only once. Returns the same + * result on subsequent calls. + * It logs the reason and returns error if can not load a plugin. + * + * @param[in] qos Participant qos which owns the Property list + * that contains security configurations and + * plugin properties that are required for loading libraries + * @returns dds_return_t + * @retval DDS_RETCODE_OK All plugins are successfully loaded + * @retval DDS_RETCODE_ERROR One or more security plugins are not loaded. + */ +dds_return_t q_omg_security_load( struct dds_security_context *security_context, const dds_qos_t *qos, struct ddsi_domaingv *gv ); + + +void q_omg_security_init( struct ddsi_domaingv *gv ); + +void q_omg_security_stop (struct ddsi_domaingv *gv); + +void q_omg_security_deinit (struct dds_security_context *sc ); + +void q_omg_security_free (struct ddsi_domaingv *gv); + +bool q_omg_is_security_loaded( struct dds_security_context *sc ); + +#else /* DDS_HAS_SECURITY */ + +#include "dds/ddsi/q_unused.h" + +DDS_INLINE_EXPORT inline bool q_omg_security_enabled(void) +{ + return false; +} + +DDS_INLINE_EXPORT inline bool q_omg_participant_is_access_protected(UNUSED_ARG(const struct ddsi_participant *pp)) +{ + return false; +} + +DDS_INLINE_EXPORT inline bool q_omg_participant_is_rtps_protected(UNUSED_ARG(const struct ddsi_participant *pp)) +{ + return false; +} + +DDS_INLINE_EXPORT inline bool q_omg_participant_is_liveliness_protected(UNUSED_ARG(const struct ddsi_participant *pp)) +{ + return false; +} + +DDS_INLINE_EXPORT inline bool q_omg_participant_is_discovery_protected(UNUSED_ARG(const struct ddsi_participant *pp)) +{ + return false; +} + +DDS_INLINE_EXPORT inline bool q_omg_participant_is_secure(UNUSED_ARG(const struct ddsi_participant *pp)) +{ + return false; +} + +DDS_INLINE_EXPORT inline bool q_omg_proxy_participant_is_secure(UNUSED_ARG(const struct ddsi_proxy_participant *proxypp)) +{ + return false; +} + +DDS_INLINE_EXPORT inline unsigned determine_subscription_writer(UNUSED_ARG(const struct ddsi_reader *rd)) +{ + return NN_ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_WRITER; +} + +DDS_INLINE_EXPORT inline unsigned determine_publication_writer(UNUSED_ARG(const struct ddsi_writer *wr)) +{ + return NN_ENTITYID_SEDP_BUILTIN_PUBLICATIONS_WRITER; +} + +#ifdef DDS_HAS_TOPIC_DISCOVERY +DDS_INLINE_EXPORT inline unsigned determine_topic_writer(UNUSED_ARG(const struct ddsi_topic *tp)) +{ + return NN_ENTITYID_SEDP_BUILTIN_TOPIC_WRITER; +} +#endif + +DDS_INLINE_EXPORT inline bool is_proxy_participant_deletion_allowed(UNUSED_ARG(struct ddsi_domaingv * const gv), UNUSED_ARG(const struct ddsi_guid *guid), UNUSED_ARG(const ddsi_entityid_t pwr_entityid)) +{ + return true; +} + +DDS_INLINE_EXPORT inline bool q_omg_is_similar_participant_security_info(UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(struct ddsi_proxy_participant *proxypp)) +{ + return true; +} + +DDS_INLINE_EXPORT inline bool q_omg_participant_allow_unauthenticated(UNUSED_ARG(struct ddsi_participant *pp)) +{ + return true; +} + +DDS_INLINE_EXPORT inline bool q_omg_security_check_create_participant(UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(uint32_t domain_id)) +{ + return true; +} + +DDS_INLINE_EXPORT inline void q_omg_security_deregister_participant(UNUSED_ARG(struct ddsi_participant *pp)) +{ +} + +DDS_INLINE_EXPORT inline bool q_omg_security_check_create_topic(UNUSED_ARG(const struct ddsi_domaingv *gv), UNUSED_ARG(const ddsi_guid_t *pp_guid), UNUSED_ARG(const char *topic_name), UNUSED_ARG(const struct dds_qos *qos)) +{ + return true; +} + +DDS_INLINE_EXPORT inline int64_t q_omg_security_get_local_participant_handle(UNUSED_ARG(const struct ddsi_participant *pp)) +{ + return 0; +} + +DDS_INLINE_EXPORT inline bool q_omg_security_check_create_writer(UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(uint32_t domain_id), UNUSED_ARG(const char *topic_name), UNUSED_ARG(const struct dds_qos *writer_qos)) +{ + return true; +} + +DDS_INLINE_EXPORT inline void q_omg_security_register_writer(UNUSED_ARG(struct ddsi_writer *wr)) +{ +} + +DDS_INLINE_EXPORT inline void q_omg_security_deregister_writer(UNUSED_ARG(struct ddsi_writer *wr)) +{ +} + +DDS_INLINE_EXPORT inline bool q_omg_security_check_create_reader(UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(uint32_t domain_id), UNUSED_ARG(const char *topic_name), UNUSED_ARG(const struct dds_qos *reader_qos)) +{ + return true; +} + +DDS_INLINE_EXPORT inline void q_omg_security_register_reader(UNUSED_ARG(struct ddsi_reader *rd)) +{ +} + +DDS_INLINE_EXPORT inline void q_omg_security_deregister_reader(UNUSED_ARG(struct ddsi_reader *rd)) +{ +} + +DDS_INLINE_EXPORT inline bool q_omg_security_is_remote_rtps_protected(UNUSED_ARG(const struct ddsi_proxy_participant *proxypp), UNUSED_ARG(ddsi_entityid_t entityid)) +{ + return false; +} + +DDS_INLINE_EXPORT inline void q_omg_security_init_remote_participant(UNUSED_ARG(struct ddsi_proxy_participant *proxypp)) +{ +} + +DDS_INLINE_EXPORT inline int64_t q_omg_security_check_remote_participant_permissions(UNUSED_ARG(uint32_t domain_id), UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(struct ddsi_proxy_participant *proxypp)) +{ + return 0LL; +} + +DDS_INLINE_EXPORT inline bool q_omg_security_register_remote_participant(UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(struct ddsi_proxy_participant *proxypp), UNUSED_ARG(int64_t identity_handle), UNUSED_ARG(int64_t shared_secret)) +{ + return true; +} + +DDS_INLINE_EXPORT inline void q_omg_security_deregister_remote_participant(UNUSED_ARG(struct ddsi_proxy_participant *proxypp)) +{ +} + +DDS_INLINE_EXPORT inline void q_omg_security_participant_send_tokens(UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(struct ddsi_proxy_participant *proxypp)) +{ +} + +DDS_INLINE_EXPORT inline int64_t q_omg_security_get_remote_participant_handle(UNUSED_ARG(struct ddsi_proxy_participant *proxypp)) +{ + return 0; +} + +DDS_INLINE_EXPORT inline bool q_omg_security_match_remote_writer_enabled(UNUSED_ARG(struct ddsi_reader *rd), UNUSED_ARG(struct ddsi_proxy_writer *pwr), UNUSED_ARG(int64_t *crypto_handle)) +{ + return true; +} + +DDS_INLINE_EXPORT inline bool q_omg_security_match_remote_reader_enabled(UNUSED_ARG(struct ddsi_writer *wr), UNUSED_ARG(struct ddsi_proxy_reader *prd), UNUSED_ARG(bool relay_only), UNUSED_ARG(int64_t *crypto_handle)) +{ + return true; +} + +DDS_INLINE_EXPORT inline void q_omg_get_proxy_writer_security_info(UNUSED_ARG(struct ddsi_proxy_writer *pwr), UNUSED_ARG(const ddsi_plist_t *plist), UNUSED_ARG(nn_security_info_t *info)) +{ +} + +DDS_INLINE_EXPORT inline bool q_omg_writer_is_discovery_protected(UNUSED_ARG(const struct ddsi_writer *wr)) +{ + return false; +} + +DDS_INLINE_EXPORT inline bool q_omg_writer_is_submessage_protected(UNUSED_ARG(const struct ddsi_writer *wr)) +{ + return false; +} + +DDS_INLINE_EXPORT inline bool q_omg_writer_is_payload_protected(UNUSED_ARG(const struct ddsi_writer *wr)) +{ + return false; +} + +DDS_INLINE_EXPORT inline bool q_omg_security_check_remote_writer_permissions(UNUSED_ARG(const struct ddsi_proxy_writer *pwr), UNUSED_ARG(uint32_t domain_id), UNUSED_ARG(struct ddsi_participant *pp)) +{ + return true; +} + +DDS_INLINE_EXPORT inline void q_omg_security_deregister_remote_writer_match(UNUSED_ARG(const struct ddsi_proxy_writer *pwr), UNUSED_ARG(const struct ddsi_reader *rd), UNUSED_ARG(struct ddsi_rd_pwr_match *match)) +{ +} + +DDS_INLINE_EXPORT inline void q_omg_get_proxy_reader_security_info(UNUSED_ARG(struct ddsi_proxy_reader *prd), UNUSED_ARG(const ddsi_plist_t *plist), UNUSED_ARG(nn_security_info_t *info)) +{ +} + +DDS_INLINE_EXPORT inline bool q_omg_reader_is_discovery_protected(UNUSED_ARG(const struct ddsi_reader *rd)) +{ + return false; +} + +DDS_INLINE_EXPORT inline bool q_omg_reader_is_submessage_protected(UNUSED_ARG(const struct ddsi_reader *rd)) +{ + return false; +} + + +DDS_INLINE_EXPORT inline bool q_omg_security_check_remote_reader_permissions(UNUSED_ARG(const struct ddsi_proxy_reader *prd), UNUSED_ARG(uint32_t domain_id), UNUSED_ARG(struct ddsi_participant *pp), UNUSED_ARG(bool *relay_only)) +{ + *relay_only = false; + return true; +} + +DDS_INLINE_EXPORT inline void set_proxy_participant_security_info(UNUSED_ARG(struct ddsi_proxy_participant *prd), UNUSED_ARG(const ddsi_plist_t *plist)) +{ +} + +DDS_INLINE_EXPORT inline void set_proxy_reader_security_info(UNUSED_ARG(struct ddsi_proxy_reader *prd), UNUSED_ARG(const ddsi_plist_t *plist)) +{ +} + +DDS_INLINE_EXPORT inline void set_proxy_writer_security_info(UNUSED_ARG(struct ddsi_proxy_writer *pwr), UNUSED_ARG(const ddsi_plist_t *plist)) +{ +} + +DDS_INLINE_EXPORT inline bool +decode_Data( + UNUSED_ARG(const struct ddsi_domaingv *gv), + UNUSED_ARG(struct nn_rsample_info *sampleinfo), + UNUSED_ARG(unsigned char *payloadp), + UNUSED_ARG(uint32_t payloadsz), + UNUSED_ARG(size_t *submsg_len)) +{ + return true; +} + +DDS_INLINE_EXPORT inline bool +decode_DataFrag( + UNUSED_ARG(const struct ddsi_domaingv *gv), + UNUSED_ARG(struct nn_rsample_info *sampleinfo), + UNUSED_ARG(unsigned char *payloadp), + UNUSED_ARG(uint32_t payloadsz), + UNUSED_ARG(size_t *submsg_len)) +{ + return true; +} + +DDS_INLINE_EXPORT inline void +encode_datareader_submsg( + UNUSED_ARG(struct nn_xmsg *msg), + UNUSED_ARG(struct nn_xmsg_marker sm_marker), + UNUSED_ARG(const struct ddsi_proxy_writer *pwr), + UNUSED_ARG(const struct ddsi_guid *rd_guid)) +{ +} + +DDS_INLINE_EXPORT inline void +encode_datawriter_submsg( + UNUSED_ARG(struct nn_xmsg *msg), + UNUSED_ARG(struct nn_xmsg_marker sm_marker), + UNUSED_ARG(struct ddsi_writer *wr)) +{ +} + +DDS_INLINE_EXPORT inline bool +validate_msg_decoding( + UNUSED_ARG(const struct ddsi_entity_common *e), + UNUSED_ARG(const struct ddsi_proxy_endpoint_common *c), + UNUSED_ARG(struct ddsi_proxy_participant *proxypp), + UNUSED_ARG(struct receiver_state *rst), + UNUSED_ARG(SubmessageKind_t prev_smid)) +{ + return true; +} + +DDS_INLINE_EXPORT inline int +decode_SecPrefix( + UNUSED_ARG(struct receiver_state *rst), + UNUSED_ARG(unsigned char *submsg), + UNUSED_ARG(size_t submsg_size), + UNUSED_ARG(unsigned char * const msg_end), + UNUSED_ARG(const ddsi_guid_prefix_t * const src_prefix), + UNUSED_ARG(const ddsi_guid_prefix_t * const dst_prefix), + UNUSED_ARG(int byteswap)) +{ + /* Just let the parsing ignore the security sub-messages. */ + return true; +} + +DDS_INLINE_EXPORT inline nn_rtps_msg_state_t +decode_rtps_message( + UNUSED_ARG(struct thread_state * const thrst), + UNUSED_ARG(struct ddsi_domaingv *gv), + UNUSED_ARG(struct nn_rmsg **rmsg), + UNUSED_ARG(Header_t **hdr), + UNUSED_ARG(unsigned char **buff), + UNUSED_ARG(size_t *sz), + UNUSED_ARG(struct nn_rbufpool *rbpool), + UNUSED_ARG(bool isstream)) +{ + return NN_RTPS_MSG_STATE_PLAIN; +} + +DDS_INLINE_EXPORT inline dds_return_t q_omg_security_load( UNUSED_ARG( struct dds_security_context *security_context ), UNUSED_ARG( const dds_qos_t *property_seq), UNUSED_ARG ( struct ddsi_domaingv *gv ) ) +{ + return DDS_RETCODE_ERROR; +} + +DDS_INLINE_EXPORT inline bool q_omg_is_security_loaded( UNUSED_ARG( struct dds_security_context *sc )) { return false; } + +DDS_INLINE_EXPORT inline void q_omg_security_deregister_remote_reader_match(UNUSED_ARG(const struct ddsi_proxy_reader *prd), UNUSED_ARG(const struct ddsi_writer *wr), UNUSED_ARG(struct ddsi_wr_prd_match *match)) +{ +} + +DDS_INLINE_EXPORT inline bool q_omg_plist_keyhash_is_protected(UNUSED_ARG(const ddsi_plist_t *plist)) +{ + return false; +} + +DDS_INLINE_EXPORT inline bool q_omg_is_endpoint_protected(UNUSED_ARG(const ddsi_plist_t *plist)) +{ + return false; +} + +DDS_INLINE_EXPORT inline void q_omg_log_endpoint_protection(UNUSED_ARG(struct ddsi_domaingv * const gv), UNUSED_ARG(const ddsi_plist_t *plist)) +{ +} + +#endif /* DDS_HAS_SECURITY */ + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_OMG_SECURITY_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_security_util.h b/unitree_SDK/include/dds/ddsi/ddsi_security_util.h new file mode 100644 index 0000000..860fa77 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_security_util.h @@ -0,0 +1,66 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_SECURITY_UTIL_H +#define DDSI_SECURITY_UTIL_H + +#include "dds/features.h" + +#ifdef DDS_HAS_SECURITY + +#include "dds/ddsi/ddsi_plist.h" +#include "dds/security/core/dds_security_utils.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +void g_omg_shallow_copy_StringSeq(DDS_Security_StringSeq *dst, const ddsi_stringseq_t *src); +void g_omg_shallow_free_StringSeq(DDS_Security_StringSeq *obj); +void q_omg_copy_PropertySeq(DDS_Security_PropertySeq *dst, const dds_propertyseq_t *src); +void q_omg_shallow_copyin_PropertySeq(DDS_Security_PropertySeq *dst, const dds_propertyseq_t *src); +void q_omg_shallow_copyout_PropertySeq(dds_propertyseq_t *dst, const DDS_Security_PropertySeq *src); +void q_omg_shallow_free_PropertySeq(DDS_Security_PropertySeq *obj); +void q_omg_shallow_copyin_BinaryPropertySeq(DDS_Security_BinaryPropertySeq *dst, const dds_binarypropertyseq_t *src); +void q_omg_shallow_copyout_BinaryPropertySeq(dds_binarypropertyseq_t *dst, const DDS_Security_BinaryPropertySeq *src); +void q_omg_shallow_free_BinaryPropertySeq(DDS_Security_BinaryPropertySeq *obj); +void q_omg_shallow_copy_PropertyQosPolicy(DDS_Security_PropertyQosPolicy *dst, const dds_property_qospolicy_t *src); +void q_omg_shallow_copy_security_qos(DDS_Security_Qos *dst, const struct dds_qos *src); +void q_omg_shallow_free_PropertyQosPolicy(DDS_Security_PropertyQosPolicy *obj); +void q_omg_shallow_free_security_qos(DDS_Security_Qos *obj); +void q_omg_security_dataholder_copyin(nn_dataholder_t *dh, const DDS_Security_DataHolder *holder); +void q_omg_security_dataholder_copyout(DDS_Security_DataHolder *holder, const nn_dataholder_t *dh); +void q_omg_shallow_copyin_DataHolder(DDS_Security_DataHolder *dst, const nn_dataholder_t *src); +void q_omg_shallow_copyout_DataHolder(nn_dataholder_t *dst, const DDS_Security_DataHolder *src); +void q_omg_shallow_free_DataHolder(DDS_Security_DataHolder *obj); +void q_omg_shallow_free_nn_dataholder(nn_dataholder_t *holder); +void q_omg_shallow_copyin_DataHolderSeq(DDS_Security_DataHolderSeq *dst, const nn_dataholderseq_t *src); +void q_omg_copyin_DataHolderSeq(DDS_Security_DataHolderSeq *dst, const nn_dataholderseq_t *src); +void q_omg_shallow_copyout_DataHolderSeq(nn_dataholderseq_t *dst, const DDS_Security_DataHolderSeq *src); +void q_omg_shallow_free_DataHolderSeq(DDS_Security_DataHolderSeq *obj); +void q_omg_shallow_free_nn_dataholderseq(nn_dataholderseq_t *obj); +void q_omg_shallow_copy_ParticipantBuiltinTopicDataSecure(DDS_Security_ParticipantBuiltinTopicDataSecure *dst, const ddsi_guid_t *guid, const ddsi_plist_t *plist); +void q_omg_shallow_free_ParticipantBuiltinTopicDataSecure(DDS_Security_ParticipantBuiltinTopicDataSecure *obj); +void q_omg_shallow_copy_SubscriptionBuiltinTopicDataSecure(DDS_Security_SubscriptionBuiltinTopicDataSecure *dst, const ddsi_guid_t *guid, const struct dds_qos *qos, const nn_security_info_t *secinfo); +void q_omg_shallow_free_SubscriptionBuiltinTopicDataSecure(DDS_Security_SubscriptionBuiltinTopicDataSecure *obj); +void q_omg_shallow_copy_PublicationBuiltinTopicDataSecure(DDS_Security_PublicationBuiltinTopicDataSecure *dst, const ddsi_guid_t *guid, const struct dds_qos *qos, const nn_security_info_t *secinfo); +void q_omg_shallow_free_PublicationBuiltinTopicDataSecure(DDS_Security_PublicationBuiltinTopicDataSecure *obj); +void q_omg_shallow_copy_TopicBuiltinTopicData(DDS_Security_TopicBuiltinTopicData *dst, const char *topic_name, const char *type_name); +void q_omg_shallow_free_TopicBuiltinTopicData(DDS_Security_TopicBuiltinTopicData *obj); + +#if defined (__cplusplus) +} +#endif + + +#endif /* DDS_HAS_SECURITY */ + +#endif /* DDSI_SECURITY_UTIL_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_serdata.h b/unitree_SDK/include/dds/ddsi/ddsi_serdata.h new file mode 100644 index 0000000..9493103 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_serdata.h @@ -0,0 +1,348 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_SERDATA_H +#define DDSI_SERDATA_H + +#include "dds/features.h" +#include "dds/ddsrt/misc.h" +#include "dds/ddsrt/time.h" +#include "dds/ddsrt/iovec.h" +#include "dds/ddsi/ddsi_sertype.h" +#include "dds/ddsi/ddsi_keyhash.h" +#include "dds/ddsi/ddsi_typelib.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct nn_rdata; + +enum ddsi_serdata_kind { + SDK_EMPTY, + SDK_KEY, + SDK_DATA +}; + +struct ddsi_serdata { + // Backwards compatibility support for ddsi_sertopic (which is intended to exist + // only for a little while, have to see how that works out ...) relies on reading + // and writing the first few fields of ddsi_serdata regardless of whether it is a + // new or an old one. + // + // At a minimum, it needs to look at "ops" for this. Currently, because the old + // serdata is a prefix of the new serdata anyway, it also looks directly at "type" + // in dds_writecdr_impl, and elsewhere it simply timestamp and statusinfo. + // + // So don't change anything of the layout up to and including "twrite" unless + // checking the compatibility code in ddsi_sertopic.c, dds_writecdr_impl and + // dds_readcdr_impl. + + const struct ddsi_serdata_ops *ops; /* cached from type->serdata_ops */ + uint32_t hash; + ddsrt_atomic_uint32_t refc; + enum ddsi_serdata_kind kind; + const struct ddsi_sertype *type; + + /* these get set by generic code after creating the serdata */ + ddsrt_wctime_t timestamp; + uint32_t statusinfo; + + /* FIXME: can I get rid of this one? */ + ddsrt_mtime_t twrite; /* write time, not source timestamp, set post-throttling */ + +#ifdef DDS_HAS_SHM + void* iox_chunk; + void* iox_subscriber; // actually: iox_sub_t * +#endif +}; + +struct ddsi_serdata_wrapper { + struct ddsi_serdata c; + void *compat_wrap; +}; + +/* Serialised size of sample inclusive of DDSI encoding header + - uint32_t because the protocol can't handle samples larger than 4GB anyway + - FIXME: get the encoding header out of the serialised data */ +typedef uint32_t (*ddsi_serdata_size_t) (const struct ddsi_serdata *d); + +/* Free a serdata (called by unref when refcount goes to 0) */ +typedef void (*ddsi_serdata_free_t) (struct ddsi_serdata *d); + +/* Construct a serdata from a fragchain received over the network + - "kind" is KEY or DATA depending on the type of payload + - "size" is the serialised size of the sample, inclusive of DDSI encoding header + - the first fragchain always contains the encoding header in its entirety + - fragchains may overlap, though I have never seen any DDS implementation + actually send such nasty fragments + - FIXME: get the encoding header out of the serialised data */ +typedef struct ddsi_serdata * (*ddsi_serdata_from_ser_t) (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const struct nn_rdata *fragchain, size_t size); + +/* Exactly like ddsi_serdata_from_ser_t, but with the data in an iovec and guaranteed absence of overlap */ +typedef struct ddsi_serdata * (*ddsi_serdata_from_ser_iov_t) (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, ddsrt_msg_iovlen_t niov, const ddsrt_iovec_t *iov, size_t size); + +/* Construct a serdata from a keyhash (an SDK_KEY by definition) */ +typedef struct ddsi_serdata * (*ddsi_serdata_from_keyhash_t) (const struct ddsi_sertype *type, const struct ddsi_keyhash *keyhash); + +/* Construct a serdata from an application sample + - "kind" is KEY or DATA depending on the operation invoked by the application; + e.g., write results in kind = DATA, dispose in kind = KEY. The important bit + is to not assume anything of the contents of non-key fields if kind = KEY + unless additional application knowledge is available */ +typedef struct ddsi_serdata * (*ddsi_serdata_from_sample_t) (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const void *sample); + +/* Construct a untyped serdata with just a keyvalue given a normal serdata (either key or data) + - used for mapping key values to instance ids in tkmap + - two reasons: size (keys are typically smaller than samples), and data in tkmap + is shared across topics + - whether a serdata is untyped or not is known from the context, and the topic + field may have any value for a untyped serdata (so in some cases, one can + simply do "return ddsi_serdata_ref(d);" + */ +typedef struct ddsi_serdata * (*ddsi_serdata_to_untyped_t) (const struct ddsi_serdata *d); + +/* Fill buffer with 'size' bytes of serialised data, starting from 'off' + - 0 <= off < off+sz <= alignup4(size(d)) + - bytes at offsets 0 .. 3 are DDSI encoding header, size(d) includes that header + - what to copy for bytes in [size(d), alignup4(size(d))) depends on the serdata + implementation, the protocol treats them as undefined + - FIXME: get the encoding header out of the serialised data */ +typedef void (*ddsi_serdata_to_ser_t) (const struct ddsi_serdata *d, size_t off, size_t sz, void *buf); + +/* Provide a pointer to 'size' bytes of serialised data, starting from 'off' + - see ddsi_serdata_to_ser_t above + - instead of copying, this gives a reference that must remain valid until the + corresponding call to to_ser_unref + - multiple calls to to_ser_ref() may be issued in parallel + - lazily creating the serialised representation is allowed (though I'm not sure + how that would work with knowing the serialised size beforehand ...) */ +typedef struct ddsi_serdata * (*ddsi_serdata_to_ser_ref_t) (const struct ddsi_serdata *d, size_t off, size_t sz, ddsrt_iovec_t *ref); + +/* Release a lock on serialised data + - ref was previousy filled by ddsi_serdata_to_ser_ref_t */ +typedef void (*ddsi_serdata_to_ser_unref_t) (struct ddsi_serdata *d, const ddsrt_iovec_t *ref); + +/* Turn serdata into an application sample (or just the key values if only key values are + available); return false on error (typically out-of-memory, but if from_ser doesn't do any + validation it might be a deserialisation error, too). + + If (bufptr != 0), then *bufptr .. buflim is space to be used from *bufptr up (with minimal + padding) for any data in the sample that needs to be allocated (e.g., strings, sequences); + otherwise malloc() is to be used for those. (This allows read/take to be given a block of memory + by the caller.) */ +typedef bool (*ddsi_serdata_to_sample_t) (const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim); + +/* Create a sample from a untyped serdata, as returned by serdata_to_untyped. This sample + obviously has just the key fields filled in and is used for generating invalid samples. */ +typedef bool (*ddsi_serdata_untyped_to_sample_t) (const struct ddsi_sertype *type, const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim); + +/* Test key values of two serdatas for equality. The two will have the same ddsi_serdata_ops, + but are not necessarily of the same topic (one can decide to never consider them equal if they + are of different topics, of course; but the nice thing about _not_ doing that is that all + instances with a certain key value with have the same instance id, and that in turn makes + computing equijoins across topics much simpler). */ +typedef bool (*ddsi_serdata_eqkey_t) (const struct ddsi_serdata *a, const struct ddsi_serdata *b); + +/* Print a serdata into the provided buffer (truncating as necessary) + - topic is present for supporting printing of "untyped" samples + - buf != NULL, bufsize > 0 on input + - buf must always be terminated with a nul character on return + - returns the number of characters (excluding the terminating 0) needed to print it + in full (or, as an optimization, it may pretend that it has printed it in full, + returning bufsize-1) if it had to truncate) */ +typedef size_t (*ddsi_serdata_print_t) (const struct ddsi_sertype *type, const struct ddsi_serdata *d, char *buf, size_t size); + +/* Add keyhash (from serdata) to buffer (forcing md5 when necessary). + - key needs to be set within serdata (can already be md5) + - buf needs to be at least 16 bytes large */ +typedef void (*ddsi_serdata_get_keyhash_t) (const struct ddsi_serdata *d, struct ddsi_keyhash *buf, bool force_md5); + +#ifdef DDS_HAS_SHM +typedef uint32_t(*ddsi_serdata_iox_size_t) (const struct ddsi_serdata* d); + +// Used for receiving a sample from a Iceoryx and for constructing a serdata for writing a "loaned sample", +// that is, for constructing a sample where the data is already in shared memory. The latter allows one +// to avoid serializing the data for zero-copy data transfer if all subscribers are reachable via Iceoryx. +// +// The first case is when "sub" is not NULL, in which case it is a pointer to the Iceoryx subscriber +typedef struct ddsi_serdata* (*ddsi_serdata_from_iox_t) (const struct ddsi_sertype* type, enum ddsi_serdata_kind kind, void* sub, void* buffer); +#endif + +struct ddsi_serdata_ops { + ddsi_serdata_eqkey_t eqkey; + ddsi_serdata_size_t get_size; + ddsi_serdata_from_ser_t from_ser; + ddsi_serdata_from_ser_iov_t from_ser_iov; + ddsi_serdata_from_keyhash_t from_keyhash; + ddsi_serdata_from_sample_t from_sample; + ddsi_serdata_to_ser_t to_ser; + ddsi_serdata_to_ser_ref_t to_ser_ref; + ddsi_serdata_to_ser_unref_t to_ser_unref; + ddsi_serdata_to_sample_t to_sample; + ddsi_serdata_to_untyped_t to_untyped; + ddsi_serdata_untyped_to_sample_t untyped_to_sample; + ddsi_serdata_free_t free; + ddsi_serdata_print_t print; + ddsi_serdata_get_keyhash_t get_keyhash; +#ifdef DDS_HAS_SHM + ddsi_serdata_iox_size_t get_sample_size; + ddsi_serdata_from_iox_t from_iox_buffer; +#endif +}; + +#define DDSI_SERDATA_HAS_PRINT 1 +#define DDSI_SERDATA_HAS_FROM_SER_IOV 1 +#define DDSI_SERDATA_HAS_GET_KEYHASH 1 + +DDS_EXPORT void ddsi_serdata_init (struct ddsi_serdata *d, const struct ddsi_sertype *type, enum ddsi_serdata_kind kind); + +/** + * @brief Return a pointer to the keyhash in the message fragchain if it was present, or else NULL. + * + * @param[in] fragchain the fragchain argument passed to @ref ddsi_serdata_from_ser (the first one, not any subsequent ones) + * @returns A pointer to the keyhash in the message if it was present, NULL if not. The lifetime is at least that of the fragchain itself. + */ +DDS_EXPORT const ddsi_keyhash_t *ddsi_serdata_keyhash_from_fragchain (const struct nn_rdata *fragchain); + +/* backwards compatibility: wrap a sertopic-derived serdata so that it may be used as a sertype-derived one; increments refcount */ +DDS_EXPORT struct ddsi_serdata *ddsi_sertopic_wrap_serdata (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, void *old); + +/** + * @brief Return a reference to a serdata with possible type conversion + * + * If `serdata` is of type `type`, this increments the reference count and returns + * `serdata`. Otherwise, it constructs a new one from the serialised representation of + * `serdata`. This can fail, in which case it returns NULL. + * + * @param[in] type sertype the returned serdata must have + * @param[in] serdata source sample (untouched except for the reference count and/or + * extracting the serialised representation) + * @returns A reference to a serdata that is equivalent to the input with the correct + * topic, or a null pointer on failure. The reference must be released with @ref + * ddsi_serdata_unref. + */ +DDS_EXPORT struct ddsi_serdata *ddsi_serdata_ref_as_type (const struct ddsi_sertype *type, struct ddsi_serdata *serdata); + +DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_ref (const struct ddsi_serdata *serdata_const) { +#if defined (__cplusplus) + DDSRT_WARNING_GNUC_OFF(old-style-cast) + DDSRT_WARNING_CLANG_OFF(old-style-cast) +#endif + struct ddsi_serdata *serdata = (struct ddsi_serdata *)serdata_const; +#if defined (__cplusplus) + DDSRT_WARNING_CLANG_ON(old-style-cast) + DDSRT_WARNING_GNUC_ON(old-style-cast) +#endif + ddsrt_atomic_inc32 (&serdata->refc); + return serdata; +} + +DDS_INLINE_EXPORT inline void ddsi_serdata_unref (struct ddsi_serdata *serdata) { + if (ddsrt_atomic_dec32_ov (&serdata->refc) == 1) + serdata->ops->free (serdata); +} + +DDS_INLINE_EXPORT inline uint32_t ddsi_serdata_size (const struct ddsi_serdata *d) { + return d->ops->get_size (d); +} + +DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_from_ser (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const struct nn_rdata *fragchain, size_t size) { + return type->serdata_ops->from_ser (type, kind, fragchain, size); +} + +DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_from_ser_iov (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, ddsrt_msg_iovlen_t niov, const ddsrt_iovec_t *iov, size_t size) { + return type->serdata_ops->from_ser_iov (type, kind, niov, iov, size); +} + +DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_from_keyhash (const struct ddsi_sertype *type, const struct ddsi_keyhash *keyhash) { + return type->serdata_ops->from_keyhash (type, keyhash); +} + +DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_from_sample (const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const void *sample) { + return type->serdata_ops->from_sample (type, kind, sample); +} + +DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_to_untyped (const struct ddsi_serdata *d) { + return d->ops->to_untyped (d); +} + +DDS_INLINE_EXPORT inline void ddsi_serdata_to_ser (const struct ddsi_serdata *d, size_t off, size_t sz, void *buf) { + d->ops->to_ser (d, off, sz, buf); +} + +DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_to_ser_ref (const struct ddsi_serdata *d, size_t off, size_t sz, ddsrt_iovec_t *ref) { + return d->ops->to_ser_ref (d, off, sz, ref); +} + +DDS_INLINE_EXPORT inline void ddsi_serdata_to_ser_unref (struct ddsi_serdata *d, const ddsrt_iovec_t *ref) { + d->ops->to_ser_unref (d, ref); +} + +DDS_INLINE_EXPORT inline bool ddsi_serdata_to_sample (const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim) { + return d->ops->to_sample (d, sample, bufptr, buflim); +} + +DDS_INLINE_EXPORT inline bool ddsi_serdata_untyped_to_sample (const struct ddsi_sertype *type, const struct ddsi_serdata *d, void *sample, void **bufptr, void *buflim) { + return d->ops->untyped_to_sample (type, d, sample, bufptr, buflim); +} + +DDS_INLINE_EXPORT inline bool ddsi_serdata_eqkey (const struct ddsi_serdata *a, const struct ddsi_serdata *b) { + return a->ops->eqkey (a, b); +} + +DDS_INLINE_EXPORT inline bool ddsi_serdata_print (const struct ddsi_serdata *d, char *buf, size_t size) { + return d->ops->print (d->type, d, buf, size); +} + +DDS_INLINE_EXPORT inline bool ddsi_serdata_print_untyped (const struct ddsi_sertype *type, const struct ddsi_serdata *d, char *buf, size_t size) { + if (d->ops->print) + return d->ops->print (type, d, buf, size); + else + { + buf[0] = 0; + return 0; + } +} + +DDS_INLINE_EXPORT inline void ddsi_serdata_get_keyhash (const struct ddsi_serdata *d, struct ddsi_keyhash *buf, bool force_md5) { + d->ops->get_keyhash (d, buf, force_md5); +} + +#ifdef DDS_HAS_SHM +DDS_INLINE_EXPORT inline uint32_t ddsi_serdata_iox_size(const struct ddsi_serdata* d) +{ + return d->type->iox_size; +} + +inline struct ddsi_serdata* ddsi_serdata_from_iox(const struct ddsi_sertype* type, enum ddsi_serdata_kind kind, void* sub, void* iox_buffer) ddsrt_nonnull_all; + +DDS_INLINE_EXPORT inline struct ddsi_serdata* ddsi_serdata_from_iox(const struct ddsi_sertype* type, enum ddsi_serdata_kind kind, void* sub, void* iox_buffer) +{ + return type->serdata_ops->from_iox_buffer(type, kind, sub, iox_buffer); +} + +inline struct ddsi_serdata *ddsi_serdata_from_loaned_sample(const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const char *sample) ddsrt_nonnull_all; + +DDS_INLINE_EXPORT inline struct ddsi_serdata *ddsi_serdata_from_loaned_sample(const struct ddsi_sertype *type, enum ddsi_serdata_kind kind, const char *sample) +{ + if (type->serdata_ops->from_iox_buffer) + return type->serdata_ops->from_iox_buffer (type, kind, NULL, (void *) sample); + else + return type->serdata_ops->from_sample (type, kind, sample); +} +#endif + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_serdata_default.h b/unitree_SDK/include/dds/ddsi/ddsi_serdata_default.h new file mode 100644 index 0000000..92f429b --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_serdata_default.h @@ -0,0 +1,182 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_SERDATA_DEFAULT_H +#define DDSI_SERDATA_DEFAULT_H + +#include "dds/ddsrt/endian.h" +#include "dds/ddsi/q_protocol.h" /* for nn_parameterid_t */ +#include "dds/ddsi/q_freelist.h" +#include "dds/ddsrt/avl.h" +#include "dds/ddsi/ddsi_serdata.h" +#include "dds/ddsi/ddsi_plist_generic.h" +#include "dds/ddsi/ddsi_typelib.h" +#include "dds/ddsi/ddsi_typelookup.h" + +#include "dds/dds.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct CDRHeader { + unsigned short identifier; + unsigned short options; +}; + +struct serdatapool { + struct nn_freelist freelist; +}; + +#define KEYBUFTYPE_UNSET 0u +#define KEYBUFTYPE_STATIC 1u // uses u.stbuf +#define KEYBUFTYPE_DYNALIAS 2u // points into payload +#define KEYBUFTYPE_DYNALLOC 3u // dynamically allocated + +#define SERDATA_DEFAULT_KEYSIZE_MASK 0x3FFFFFFFu + +struct ddsi_serdata_default_key { + unsigned buftype : 2; + unsigned keysize : 30; + union { + unsigned char stbuf[DDS_FIXED_KEY_MAX_SIZE]; + unsigned char *dynbuf; + } u; +}; + +/* Debug builds may want to keep some additional state */ +#ifndef NDEBUG +#define DDSI_SERDATA_DEFAULT_DEBUG_FIELDS \ + bool fixed; +#else +#define DDSI_SERDATA_DEFAULT_DEBUG_FIELDS +#endif + +/* There is an alignment requirement on the raw data (it must be at + offset mod 8 for the conversion to/from a dds_stream to work). + So we define two types: one without any additional padding, and + one where the appropriate amount of padding is inserted */ +#define DDSI_SERDATA_DEFAULT_PREPAD \ + struct ddsi_serdata c; \ + uint32_t pos; \ + uint32_t size; \ + DDSI_SERDATA_DEFAULT_DEBUG_FIELDS \ + struct ddsi_serdata_default_key key;\ + struct serdatapool *serpool; \ + struct ddsi_serdata_default *next /* in pool->freelist */ +/* We suppress the zero-array warning (MSVC C4200) here ONLY for MSVC + and ONLY if it is being compiled as C++ code, as it only causes + issues there */ +#if defined _MSC_VER && defined __cplusplus +#define DDSI_SERDATA_DEFAULT_POSTPAD \ + struct CDRHeader hdr; \ + DDSRT_WARNING_MSVC_OFF(4200) \ + char data[]; \ + DDSRT_WARNING_MSVC_ON(4200) +#else +#define DDSI_SERDATA_DEFAULT_POSTPAD \ + struct CDRHeader hdr; \ + char data[] +#endif + +struct ddsi_serdata_default_unpadded { + DDSI_SERDATA_DEFAULT_PREPAD; + DDSI_SERDATA_DEFAULT_POSTPAD; +}; + +#ifdef __GNUC__ +#define DDSI_SERDATA_DEFAULT_PAD(n) ((n) % 8) +#else +#define DDSI_SERDATA_DEFAULT_PAD(n) (n) +#endif + +struct ddsi_serdata_default { + DDSI_SERDATA_DEFAULT_PREPAD; + char pad[DDSI_SERDATA_DEFAULT_PAD (8 - (offsetof (struct ddsi_serdata_default_unpadded, data) % 8))]; + DDSI_SERDATA_DEFAULT_POSTPAD; +}; + +#undef DDSI_SERDATA_DEFAULT_PAD +#undef DDSI_SERDATA_DEFAULT_POSTPAD +#undef DDSI_SERDATA_DEFAULT_PREPAD +#undef DDSI_SERDATA_DEFAULT_FIXED_FIELD + +#ifndef DDS_TOPIC_INTERN_FILTER_FN_DEFINED +#define DDS_TOPIC_INTERN_FILTER_FN_DEFINED +typedef bool (*dds_topic_intern_filter_fn) (const void * sample, void *ctx); +#endif + +typedef struct ddsi_sertype_default_desc_key { + uint32_t ops_offs; /* Offset for key ops */ + uint32_t idx; /* Key index (used for key order) */ +} ddsi_sertype_default_desc_key_t; + +typedef struct ddsi_sertype_default_desc_key_seq { + uint32_t nkeys; + ddsi_sertype_default_desc_key_t *keys; +} ddsi_sertype_default_desc_key_seq_t; + +typedef struct ddsi_sertype_default_desc_op_seq { + uint32_t nops; /* Number of words in ops (which >= number of ops stored in preproc output) */ + uint32_t *ops; /* Marshalling meta data */ +} ddsi_sertype_default_desc_op_seq_t; + +/* Reduced version of dds_topic_descriptor_t */ +struct ddsi_sertype_default_desc { + uint32_t size; /* Size of topic type */ + uint32_t align; /* Alignment of topic type */ + uint32_t flagset; /* Flags */ + ddsi_sertype_default_desc_key_seq_t keys; + ddsi_sertype_default_desc_op_seq_t ops; + ddsi_sertype_cdr_data_t typeinfo_ser; + ddsi_sertype_cdr_data_t typemap_ser; +}; + +struct ddsi_sertype_default { + struct ddsi_sertype c; + uint16_t encoding_format; /* CDR_ENC_FORMAT_(PLAIN|DELIMITED|PL) - CDR encoding format for the top-level type in this sertype */ + uint16_t write_encoding_version; /* CDR_ENC_VERSION_(1|2) - CDR encoding version used for writing data using this sertype */ + struct serdatapool *serpool; + struct ddsi_sertype_default_desc type; + size_t opt_size_xcdr1; + size_t opt_size_xcdr2; +}; + +struct ddsi_plist_sample { + void *blob; + size_t size; + nn_parameterid_t keyparam; +}; + +struct ddsi_rawcdr_sample { + void *blob; + size_t size; + void *key; + size_t keysize; +}; + +extern DDS_EXPORT const struct ddsi_sertype_ops ddsi_sertype_ops_default; + +extern DDS_EXPORT const struct ddsi_serdata_ops ddsi_serdata_ops_cdr; +extern DDS_EXPORT const struct ddsi_serdata_ops ddsi_serdata_ops_cdr_nokey; + +extern DDS_EXPORT const struct ddsi_serdata_ops ddsi_serdata_ops_xcdr2; +extern DDS_EXPORT const struct ddsi_serdata_ops ddsi_serdata_ops_xcdr2_nokey; + +struct serdatapool * ddsi_serdatapool_new (void); +void ddsi_serdatapool_free (struct serdatapool * pool); +dds_return_t ddsi_sertype_default_init (const struct ddsi_domaingv *gv, struct ddsi_sertype_default *st, const dds_topic_descriptor_t *desc, uint16_t min_xcdrv, dds_data_representation_id_t data_representation); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_serdata_plist.h b/unitree_SDK/include/dds/ddsi/ddsi_serdata_plist.h new file mode 100644 index 0000000..a40d918 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_serdata_plist.h @@ -0,0 +1,76 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_SERDATA_PLIST_H +#define DDSI_SERDATA_PLIST_H + +#include "dds/ddsi/q_protocol.h" /* for nn_parameterid_t */ +#include "dds/ddsi/ddsi_keyhash.h" +#include "dds/ddsi/ddsi_serdata.h" +#include "dds/ddsi/ddsi_sertype.h" + +#include "dds/dds.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* There is an alignment requirement on the raw data (it must be at + offset mod 8 for the conversion to/from a dds_stream to work). + So we define two types: one without any additional padding, and + one where the appropriate amount of padding is inserted */ +#define DDSI_SERDATA_PLIST_PREPAD \ + struct ddsi_serdata c; \ + uint32_t pos; \ + uint32_t size; \ + nn_vendorid_t vendorid; \ + nn_protocol_version_t protoversion; \ + ddsi_keyhash_t keyhash +#define DDSI_SERDATA_PLIST_POSTPAD \ + uint16_t identifier; \ + uint16_t options; \ + char data[] + +struct ddsi_serdata_plist_unpadded { + DDSI_SERDATA_PLIST_PREPAD; + DDSI_SERDATA_PLIST_POSTPAD; +}; + +#ifdef __GNUC__ +#define DDSI_SERDATA_PLIST_PAD(n) ((n) % 8) +#else +#define DDSI_SERDATA_PLIST_PAD(n) (n) +#endif + +struct ddsi_serdata_plist { + DDSI_SERDATA_PLIST_PREPAD; + char pad[DDSI_SERDATA_PLIST_PAD (8 - (offsetof (struct ddsi_serdata_plist_unpadded, data) % 8))]; + DDSI_SERDATA_PLIST_POSTPAD; +}; + +#undef DDSI_SERDATA_PLIST_PAD +#undef DDSI_SERDATA_PLIST_POSTPAD +#undef DDSI_SERDATA_PLIST_PREPAD + +struct ddsi_sertype_plist { + struct ddsi_sertype c; + uint16_t encoding_format; /* CDR_ENC_FORMAT_(PLAIN|DELIMITED|PL) */ + nn_parameterid_t keyparam; +}; + +extern DDS_EXPORT const struct ddsi_sertype_ops ddsi_sertype_ops_plist; +extern DDS_EXPORT const struct ddsi_serdata_ops ddsi_serdata_ops_plist; + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_serdata_pserop.h b/unitree_SDK/include/dds/ddsi/ddsi_serdata_pserop.h new file mode 100644 index 0000000..f0e4f07 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_serdata_pserop.h @@ -0,0 +1,78 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_SERDATA_PSEROP_H +#define DDSI_SERDATA_PSEROP_H + +#include "dds/ddsi/ddsi_serdata.h" +#include "dds/ddsi/ddsi_sertype.h" +#include "dds/ddsi/ddsi_plist_generic.h" + +#include "dds/dds.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* There is an alignment requirement on the raw data (it must be at + offset mod 8 for the conversion to/from a dds_stream to work). + So we define two types: one without any additional padding, and + one where the appropriate amount of padding is inserted */ +#define DDSI_SERDATA_PSEROP_PREPAD \ + struct ddsi_serdata c; \ + void *sample; \ + bool keyless; /*cached from topic*/ \ + uint32_t pos; \ + uint32_t size +#define DDSI_SERDATA_PSEROP_POSTPAD \ + uint16_t identifier; \ + uint16_t options; \ + char data[] + +struct ddsi_serdata_pserop_unpadded { + DDSI_SERDATA_PSEROP_PREPAD; + DDSI_SERDATA_PSEROP_POSTPAD; +}; + +#ifdef __GNUC__ +#define DDSI_SERDATA_PSEROP_PAD(n) ((n) % 8) +#else +#define DDSI_SERDATA_PSEROP_PAD(n) (n) +#endif + +struct ddsi_serdata_pserop { + DDSI_SERDATA_PSEROP_PREPAD; + char pad[DDSI_SERDATA_PSEROP_PAD (8 - (offsetof (struct ddsi_serdata_pserop_unpadded, data) % 8))]; + DDSI_SERDATA_PSEROP_POSTPAD; +}; + +#undef DDSI_SERDATA_PSEROP_PAD +#undef DDSI_SERDATA_PSEROP_POSTPAD +#undef DDSI_SERDATA_PSEROP_PREPAD + +struct ddsi_sertype_pserop { + struct ddsi_sertype c; + uint16_t encoding_format; /* CDR_ENC_FORMAT_(PLAIN|DELIMITED|PL) */ + size_t memsize; + size_t nops; + const enum pserop *ops; + size_t nops_key; + const enum pserop *ops_key; /* NULL <=> no key; != NULL <=> 16-byte key at offset 0 */ +}; + +extern DDS_EXPORT const struct ddsi_sertype_ops ddsi_sertype_ops_pserop; +extern DDS_EXPORT const struct ddsi_serdata_ops ddsi_serdata_ops_pserop; + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_sertopic.h b/unitree_SDK/include/dds/ddsi/ddsi_sertopic.h new file mode 100644 index 0000000..e8a3671 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_sertopic.h @@ -0,0 +1,184 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_SERTOPIC_H +#define DDSI_SERTOPIC_H + +#include "dds/ddsrt/atomics.h" +#include "dds/ddsrt/avl.h" +#include "dds/ddsc/dds_public_alloc.h" +#include "dds/ddsi/ddsi_sertype.h" +#include "dds/ddsi/ddsi_serdata.h" // for serdata_kind +#include "dds/ddsi/ddsi_keyhash.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct nn_rdata; +struct ddsi_serdata; +struct ddsi_sertopic_serdata_ops; +struct ddsi_sertopic_ops; +struct ddsi_domaingv; + +struct ddsi_sertopic { + const struct ddsi_sertopic_ops *ops; + const struct ddsi_sertopic_serdata_ops *serdata_ops; + uint32_t serdata_basehash; + bool topickind_no_key; + char *name; + char *type_name; + struct ddsi_domaingv *gv; + ddsrt_atomic_uint32_t refc; /* counts refs from entities (topic, reader, writer), not from data */ +}; + +/* Called to compare two sertopics for equality, if it is already known that name, + type name, topickind_no_Key, and operations are all the same. (serdata_basehash + is computed from the set of operations.) */ +typedef bool (*ddsi_sertopic_equal_t) (const struct ddsi_sertopic *a, const struct ddsi_sertopic *b); + +/* Hash the custom components of a sertopic (this XOR'd with a hash computed from + the fields that are defined in struct ddsi_sertopic) */ +typedef uint32_t (*ddsi_sertopic_hash_t) (const struct ddsi_sertopic *tp); + +/* Called when the refcount dropped to zero */ +typedef void (*ddsi_sertopic_free_t) (struct ddsi_sertopic *tp); + +/* Zero out a sample, used for generating samples from just a key value and in cleaning up + after dds_return_loan */ +typedef void (*ddsi_sertopic_zero_samples_t) (const struct ddsi_sertopic *d, void *samples, size_t count); + +/* (Re)allocate an array of samples, used in growing loaned sample arrays in dds_read */ +typedef void (*ddsi_sertopic_realloc_samples_t) (void **ptrs, const struct ddsi_sertopic *d, void *old, size_t oldcount, size_t count); + +/* Release any memory allocated by ddsi_sertopic_to_sample (also undo sertopic_alloc_sample if "op" so requests) */ +typedef void (*ddsi_sertopic_free_samples_t) (const struct ddsi_sertopic *d, void **ptrs, size_t count, dds_free_op_t op); + +struct ddsi_sertopic_ops { + ddsi_sertopic_free_t free; + ddsi_sertopic_zero_samples_t zero_samples; + ddsi_sertopic_realloc_samples_t realloc_samples; + ddsi_sertopic_free_samples_t free_samples; + ddsi_sertopic_equal_t equal; + ddsi_sertopic_hash_t hash; +}; + +extern const struct ddsi_serdata_ops ddsi_sertopic_serdata_ops_wrap; + +DDS_EXPORT void ddsi_sertopic_init (struct ddsi_sertopic *tp, const char *name, const char *type_name, const struct ddsi_sertopic_ops *sertopic_ops, const struct ddsi_sertopic_serdata_ops *serdata_ops, bool topickind_no_key); +DDS_EXPORT void ddsi_sertopic_fini (struct ddsi_sertopic *tp); +DDS_EXPORT struct ddsi_sertopic *ddsi_sertopic_ref (const struct ddsi_sertopic *tp); +DDS_EXPORT void ddsi_sertopic_unref (struct ddsi_sertopic *tp); +DDS_EXPORT uint32_t ddsi_sertopic_compute_serdata_basehash (const struct ddsi_sertopic_serdata_ops *ops); +DDS_EXPORT struct ddsi_sertype *ddsi_sertype_from_sertopic (struct ddsi_sertopic *tp); + +DDS_EXPORT bool ddsi_sertopic_equal (const struct ddsi_sertopic *a, const struct ddsi_sertopic *b); +DDS_EXPORT uint32_t ddsi_sertopic_hash (const struct ddsi_sertopic *tp); + +DDS_INLINE_EXPORT inline void ddsi_sertopic_free (struct ddsi_sertopic *tp) { + tp->ops->free (tp); +} +DDS_INLINE_EXPORT inline void ddsi_sertopic_zero_samples (const struct ddsi_sertopic *tp, void *samples, size_t count) { + tp->ops->zero_samples (tp, samples, count); +} +DDS_INLINE_EXPORT inline void ddsi_sertopic_realloc_samples (void **ptrs, const struct ddsi_sertopic *tp, void *old, size_t oldcount, size_t count) { + tp->ops->realloc_samples (ptrs, tp, old, oldcount, count); +} +DDS_INLINE_EXPORT inline void ddsi_sertopic_free_samples (const struct ddsi_sertopic *tp, void **ptrs, size_t count, dds_free_op_t op) { + tp->ops->free_samples (tp, ptrs, count, op); +} +DDS_INLINE_EXPORT inline void ddsi_sertopic_zero_sample (const struct ddsi_sertopic *tp, void *sample) { + ddsi_sertopic_zero_samples (tp, sample, 1); +} +DDS_INLINE_EXPORT inline void *ddsi_sertopic_alloc_sample (const struct ddsi_sertopic *tp) { + void *ptr; + ddsi_sertopic_realloc_samples (&ptr, tp, NULL, 0, 1); + return ptr; +} +DDS_INLINE_EXPORT inline void ddsi_sertopic_free_sample (const struct ddsi_sertopic *tp, void *sample, dds_free_op_t op) { + ddsi_sertopic_free_samples (tp, &sample, 1, op); +} + +// THINGS USED FOR TESTING BINARY COMPATIBILITY WITH OLD SERTOPIC INTERFACE + +struct ddsi_sertopic_serdata { + const struct ddsi_sertopic_serdata_ops *ops; /* cached from topic->serdata_ops */ + uint32_t hash; + ddsrt_atomic_uint32_t refc; + enum ddsi_serdata_kind kind; + const struct ddsi_sertopic *topic; + + /* these get set by generic code after creating the serdata */ + ddsrt_wctime_t timestamp; + uint32_t statusinfo; + + /* FIXME: can I get rid of this one? */ + ddsrt_mtime_t twrite; /* write time, not source timestamp, set post-throttling */ +}; + +typedef uint32_t (*ddsi_sertopic_serdata_size_t) (const struct ddsi_sertopic_serdata *d); +typedef void (*ddsi_sertopic_serdata_free_t) (struct ddsi_sertopic_serdata *d); +typedef struct ddsi_sertopic_serdata * (*ddsi_sertopic_serdata_from_ser_t) (const struct ddsi_sertopic *topic, enum ddsi_serdata_kind kind, const struct nn_rdata *fragchain, size_t size); +typedef struct ddsi_sertopic_serdata * (*ddsi_sertopic_serdata_from_ser_iov_t) (const struct ddsi_sertopic *topic, enum ddsi_serdata_kind kind, ddsrt_msg_iovlen_t niov, const ddsrt_iovec_t *iov, size_t size); +typedef struct ddsi_sertopic_serdata * (*ddsi_sertopic_serdata_from_keyhash_t) (const struct ddsi_sertopic *topic, const struct ddsi_keyhash *keyhash); +typedef struct ddsi_sertopic_serdata * (*ddsi_sertopic_serdata_from_sample_t) (const struct ddsi_sertopic *topic, enum ddsi_serdata_kind kind, const void *sample); +typedef struct ddsi_sertopic_serdata * (*ddsi_sertopic_serdata_to_topicless_t) (const struct ddsi_sertopic_serdata *d); +typedef void (*ddsi_sertopic_serdata_to_ser_t) (const struct ddsi_sertopic_serdata *d, size_t off, size_t sz, void *buf); +typedef struct ddsi_sertopic_serdata * (*ddsi_sertopic_serdata_to_ser_ref_t) (const struct ddsi_sertopic_serdata *d, size_t off, size_t sz, ddsrt_iovec_t *ref); +typedef void (*ddsi_sertopic_serdata_to_ser_unref_t) (struct ddsi_sertopic_serdata *d, const ddsrt_iovec_t *ref); +typedef bool (*ddsi_sertopic_serdata_to_sample_t) (const struct ddsi_sertopic_serdata *d, void *sample, void **bufptr, void *buflim); +typedef bool (*ddsi_sertopic_serdata_topicless_to_sample_t) (const struct ddsi_sertopic *topic, const struct ddsi_sertopic_serdata *d, void *sample, void **bufptr, void *buflim); +typedef bool (*ddsi_sertopic_serdata_eqkey_t) (const struct ddsi_sertopic_serdata *a, const struct ddsi_sertopic_serdata *b); +typedef size_t (*ddsi_sertopic_serdata_print_t) (const struct ddsi_sertopic *topic, const struct ddsi_sertopic_serdata *d, char *buf, size_t size); +typedef void (*ddsi_sertopic_serdata_get_keyhash_t) (const struct ddsi_sertopic_serdata *d, struct ddsi_keyhash *buf, bool force_md5); + +struct ddsi_sertopic_serdata_ops { + ddsi_sertopic_serdata_eqkey_t eqkey; + ddsi_sertopic_serdata_size_t get_size; + ddsi_sertopic_serdata_from_ser_t from_ser; + ddsi_sertopic_serdata_from_ser_iov_t from_ser_iov; + ddsi_sertopic_serdata_from_keyhash_t from_keyhash; + ddsi_sertopic_serdata_from_sample_t from_sample; + ddsi_sertopic_serdata_to_ser_t to_ser; + ddsi_sertopic_serdata_to_ser_ref_t to_ser_ref; + ddsi_sertopic_serdata_to_ser_unref_t to_ser_unref; + ddsi_sertopic_serdata_to_sample_t to_sample; + ddsi_sertopic_serdata_to_topicless_t to_topicless; + ddsi_sertopic_serdata_topicless_to_sample_t topicless_to_sample; + ddsi_sertopic_serdata_free_t free; + ddsi_sertopic_serdata_print_t print; + ddsi_sertopic_serdata_get_keyhash_t get_keyhash; +}; + +DDS_EXPORT void ddsi_sertopic_serdata_init (struct ddsi_sertopic_serdata *d, const struct ddsi_sertopic *topic, enum ddsi_serdata_kind kind); +DDS_EXPORT struct ddsi_sertopic_serdata *ddsi_sertopic_serdata_ref (const struct ddsi_sertopic_serdata *serdata_const); +DDS_EXPORT void ddsi_sertopic_serdata_unref (struct ddsi_sertopic_serdata *serdata); +DDS_EXPORT uint32_t ddsi_sertopic_serdata_size (const struct ddsi_sertopic_serdata *d); +DDS_EXPORT struct ddsi_sertopic_serdata *ddsi_sertopic_serdata_from_ser (const struct ddsi_sertopic *topic, enum ddsi_serdata_kind kind, const struct nn_rdata *fragchain, size_t size); +DDS_EXPORT struct ddsi_sertopic_serdata *ddsi_sertopic_serdata_from_ser_iov (const struct ddsi_sertopic *topic, enum ddsi_serdata_kind kind, ddsrt_msg_iovlen_t niov, const ddsrt_iovec_t *iov, size_t size); +DDS_EXPORT struct ddsi_sertopic_serdata *ddsi_sertopic_serdata_from_keyhash (const struct ddsi_sertopic *topic, const struct ddsi_keyhash *keyhash); +DDS_EXPORT struct ddsi_sertopic_serdata *ddsi_sertopic_serdata_from_sample (const struct ddsi_sertopic *topic, enum ddsi_serdata_kind kind, const void *sample); +DDS_EXPORT struct ddsi_sertopic_serdata *ddsi_sertopic_serdata_to_topicless (const struct ddsi_sertopic_serdata *d); +DDS_EXPORT void ddsi_sertopic_serdata_to_ser (const struct ddsi_sertopic_serdata *d, size_t off, size_t sz, void *buf); +DDS_EXPORT struct ddsi_sertopic_serdata *ddsi_sertopic_serdata_to_ser_ref (const struct ddsi_sertopic_serdata *d, size_t off, size_t sz, ddsrt_iovec_t *ref); +DDS_EXPORT void ddsi_sertopic_serdata_to_ser_unref (struct ddsi_sertopic_serdata *d, const ddsrt_iovec_t *ref); +DDS_EXPORT bool ddsi_sertopic_serdata_to_sample (const struct ddsi_sertopic_serdata *d, void *sample, void **bufptr, void *buflim); +DDS_EXPORT bool ddsi_sertopic_serdata_topicless_to_sample (const struct ddsi_sertopic *topic, const struct ddsi_sertopic_serdata *d, void *sample, void **bufptr, void *buflim); +DDS_EXPORT bool ddsi_sertopic_serdata_eqkey (const struct ddsi_sertopic_serdata *a, const struct ddsi_sertopic_serdata *b); +DDS_EXPORT bool ddsi_sertopic_serdata_print (const struct ddsi_sertopic_serdata *d, char *buf, size_t size); +DDS_EXPORT bool ddsi_sertopic_serdata_print_topicless (const struct ddsi_sertopic *topic, const struct ddsi_sertopic_serdata *d, char *buf, size_t size); +DDS_EXPORT void ddsi_sertopic_serdata_get_keyhash (const struct ddsi_sertopic_serdata *d, struct ddsi_keyhash *buf, bool force_md5); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_sertype.h b/unitree_SDK/include/dds/ddsi/ddsi_sertype.h new file mode 100644 index 0000000..7417c6f --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_sertype.h @@ -0,0 +1,266 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_SERTYPE_H +#define DDSI_SERTYPE_H + +#include "dds/features.h" +#include "dds/ddsrt/atomics.h" +#include "dds/ddsrt/avl.h" +#include "dds/ddsi/ddsi_xqos.h" +#include "dds/ddsi/ddsi_typelib.h" +#include "dds/ddsc/dds_public_alloc.h" +#include "dds/export.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_serdata; +struct ddsi_serdata_ops; +struct ddsi_sertype_ops; +struct ddsi_domaingv; +struct ddsi_typeid; +struct ddsi_type_pair; + +#define DDSI_SERTYPE_REGISTERING 0x40000000u // set prior to setting gv +#define DDSI_SERTYPE_REGISTERED 0x80000000u // set after setting gv +#define DDSI_SERTYPE_REFC_MASK 0x0fffffffu + +typedef struct ddsi_sertype_cdr_data { + uint32_t sz; + uint8_t *data; +} ddsi_sertype_cdr_data_t; + +struct ddsi_sertype { + const struct ddsi_sertype_ops *ops; + const struct ddsi_serdata_ops *serdata_ops; + uint32_t serdata_basehash; + uint32_t typekind_no_key : 1; + uint32_t request_keyhash : 1; + uint32_t fixed_size : 1; + uint32_t allowed_data_representation; /* Allowed data representations set in IDL for this type, or DDS_DATA_REPRESENTATION_RESTRICT_DEFAULT in case of + no restrictions in the IDL. Unsupported representations for the type are left out when creating the sertype. */ + char *type_name; + ddsrt_atomic_voidp_t gv; /* set during registration */ + ddsrt_atomic_uint32_t flags_refc; /* counts refs from entities (topic, reader, writer), not from data */ + const struct ddsi_sertype *base_sertype; /* counted ref to sertype used to derive this sertype, used to overwrite the serdata_ops for a specific data representation */ + void *wrapped_sertopic; /* void pointer because that simplifies the required type-punning */ +#ifdef DDS_HAS_SHM + uint32_t iox_size; +#endif +}; + +/* The old and the new happen to have the same memory layout on a 64-bit machine + and so any user that memset's the ddsi_sertype to 0 before filling out the + required fields gets unchanged behaviour. 32-bit machines have a different + layout and no such luck. + + There are presumably very few users of this type outside Cyclone DDS itself, + but the ROS2 RMW implementation does use it -- indeed, it prompted the change. + This define makes it possible to have a single version of the source that is + compatible with the old and the new definition, even if it is only partially + binary compatible. */ +#define DDSI_SERTOPIC_HAS_TOPICKIND_NO_KEY 1 + +/* Type changed: name_type_name and ii removed and gv added; and the set of + operations got extended by the a predicate for testing to sertypes (with the + same "ops") for equality ("equal") as well as a function for hashing the + non-generic part of the sertype definition (via "hash"). These two operations + make it possible to intern sertypes without duplicates, which has become + relevant now that multiple ddsi_sertypes can be associated with a single topic + name. + + Testing for DDSI_SERTOPIC_HAS_EQUAL_AND_HASH allows one to have a single source + that can handle both variants, but there's no binary compatbility. */ +#define DDSI_SERTOPIC_HAS_EQUAL_AND_HASH 1 + +/* It was a bad decision to have a boolean argument in "init" specifying whether + the entity kind should say "with key" or "without key". A general "flags" + argument is much more flexible ... */ +#define DDSI_SERTYPE_HAS_SERTYPE_INIT_FLAGS 1 + +/* Called to compare two sertypes for equality, if it is already known that + type name, kind_no_Key, and operations are all the same. (serdata_basehash + is computed from the set of operations.) */ +typedef bool (*ddsi_sertype_equal_t) (const struct ddsi_sertype *a, const struct ddsi_sertype *b); + +/* Hash the custom components of a sertype (this XOR'd with a hash computed from + the fields that are defined in struct ddsi_sertype) */ +typedef uint32_t (*ddsi_sertype_hash_t) (const struct ddsi_sertype *tp); + +/* Called when the refcount dropped to zero */ +typedef void (*ddsi_sertype_free_t) (struct ddsi_sertype *tp); + +/* Zero out a sample, used for generating samples from just a key value and in cleaning up + after dds_return_loan */ +typedef void (*ddsi_sertype_zero_samples_t) (const struct ddsi_sertype *d, void *samples, size_t count); + +/* (Re)allocate an array of samples, used in growing loaned sample arrays in dds_read */ +typedef void (*ddsi_sertype_realloc_samples_t) (void **ptrs, const struct ddsi_sertype *d, void *old, size_t oldcount, size_t count); + +/* Release any memory allocated by ddsi_sertype_to_sample (also undo sertype_alloc_sample if "op" so requests) */ +typedef void (*ddsi_sertype_free_samples_t) (const struct ddsi_sertype *d, void **ptrs, size_t count, dds_free_op_t op); + +/* Gets the type identifier of the requested kind (minimal or complete) for this sertype */ +typedef ddsi_typeid_t * (*ddsi_sertype_typeid_t) (const struct ddsi_sertype *tp, ddsi_typeid_kind_t kind); + +/* Compute the serialized size based on the sertype information and the sample */ +// Note: size_t maximum is reserved as error value +typedef size_t (*ddsi_sertype_get_serialized_size_t)( + const struct ddsi_sertype *d, const void *sample); + +/* Serialize into a destination buffer */ +// Note that we assume the destination buffer is large enough (we do not necessarily check) +// The required size can be obtained with ddsi_sertype_get_serialized_size_t +// Returns true if the serialization succeeds, false otherwise. +typedef bool (*ddsi_sertype_serialize_into_t)(const struct ddsi_sertype *d, + const void *sample, + void *dst_buffer, + size_t dst_size); + +/* Gets the type map for this sertype */ +typedef ddsi_typemap_t * (*ddsi_sertype_typemap_t) (const struct ddsi_sertype *tp); + +/* Gets the CDR blob for the type information of this sertype */ +typedef ddsi_typeinfo_t * (*ddsi_sertype_typeinfo_t) (const struct ddsi_sertype *tp); + +/* Create a new derived sertype (a shallow copy of the provided sertype) with the + serdata_ops for the provided data representation */ +typedef struct ddsi_sertype * (*ddsi_sertype_derive_t) (const struct ddsi_sertype *sertype, dds_data_representation_id_t data_representation, dds_type_consistency_enforcement_qospolicy_t tce_qos); + +struct ddsi_sertype_v0; +typedef void (*ddsi_sertype_v0_t) (struct ddsi_sertype_v0 *dummy); + +// Because Windows ... just can't get its act together ... +#ifndef _WIN32 +DDS_EXPORT void ddsi_sertype_v0 (struct ddsi_sertype_v0 *dummy); +#else +#define ddsi_sertype_v0 ((ddsi_sertype_v0_t) 1) +#endif + +struct ddsi_sertype_ops { + ddsi_sertype_v0_t version; + void *arg; + + ddsi_sertype_free_t free; + ddsi_sertype_zero_samples_t zero_samples; + ddsi_sertype_realloc_samples_t realloc_samples; + ddsi_sertype_free_samples_t free_samples; + ddsi_sertype_equal_t equal; + ddsi_sertype_hash_t hash; + ddsi_sertype_typeid_t type_id; + ddsi_sertype_typemap_t type_map; + ddsi_sertype_typeinfo_t type_info; + ddsi_sertype_derive_t derive_sertype; + ddsi_sertype_get_serialized_size_t get_serialized_size; + ddsi_sertype_serialize_into_t serialize_into; +}; + +enum ddsi_sertype_extensibility +{ + DDSI_SERTYPE_EXT_FINAL = 0, + DDSI_SERTYPE_EXT_APPENDABLE = 1, + DDSI_SERTYPE_EXT_MUTABLE = 2 +}; + +struct ddsi_sertype *ddsi_sertype_lookup_locked (struct ddsi_domaingv *gv, const struct ddsi_sertype *sertype_template); +void ddsi_sertype_register_locked (struct ddsi_domaingv *gv, struct ddsi_sertype *sertype); + +#define DDSI_SERTYPE_FLAG_TOPICKIND_NO_KEY (1u) +#define DDSI_SERTYPE_FLAG_REQUEST_KEYHASH (2u) +#define DDSI_SERTYPE_FLAG_FIXED_SIZE (4u) + +#define DDSI_SERTYPE_FLAG_MASK (0x7u) + +DDS_EXPORT void ddsi_sertype_init_flags (struct ddsi_sertype *tp, const char *type_name, const struct ddsi_sertype_ops *sertype_ops, const struct ddsi_serdata_ops *serdata_ops, uint32_t flags); +DDS_EXPORT void ddsi_sertype_init (struct ddsi_sertype *tp, const char *type_name, const struct ddsi_sertype_ops *sertype_ops, const struct ddsi_serdata_ops *serdata_ops, bool topickind_no_key); +DDS_EXPORT void ddsi_sertype_fini (struct ddsi_sertype *tp); +DDS_EXPORT struct ddsi_sertype *ddsi_sertype_ref (const struct ddsi_sertype *tp); + +DDS_EXPORT void ddsi_sertype_unref_locked (struct ddsi_domaingv * const gv, struct ddsi_sertype *tp); /* gv->sertypes_lock must be held */ +DDS_EXPORT void ddsi_sertype_unref (struct ddsi_sertype *tp); /* tp->gv->sertypes_lock may not be held */ + +DDS_EXPORT uint32_t ddsi_sertype_compute_serdata_basehash (const struct ddsi_serdata_ops *ops); + +DDS_EXPORT bool ddsi_sertype_equal (const struct ddsi_sertype *a, const struct ddsi_sertype *b); +DDS_EXPORT uint32_t ddsi_sertype_hash (const struct ddsi_sertype *tp); + +DDS_EXPORT uint16_t ddsi_sertype_extensibility_enc_format (enum ddsi_sertype_extensibility type_extensibility); +DDS_EXPORT uint16_t ddsi_sertype_get_native_enc_identifier (uint32_t enc_version, uint32_t encoding_format); +DDS_EXPORT uint32_t ddsi_sertype_enc_id_xcdr_version (uint16_t cdr_identifier); +DDS_EXPORT uint32_t ddsi_sertype_enc_id_enc_format (uint16_t cdr_identifier); + +DDS_INLINE_EXPORT inline void ddsi_sertype_free (struct ddsi_sertype *tp) { + tp->ops->free (tp); +} +DDS_INLINE_EXPORT inline void ddsi_sertype_zero_samples (const struct ddsi_sertype *tp, void *samples, size_t count) { + tp->ops->zero_samples (tp, samples, count); +} +DDS_INLINE_EXPORT inline void ddsi_sertype_realloc_samples (void **ptrs, const struct ddsi_sertype *tp, void *old, size_t oldcount, size_t count) +{ + tp->ops->realloc_samples (ptrs, tp, old, oldcount, count); +} +DDS_INLINE_EXPORT inline void ddsi_sertype_free_samples (const struct ddsi_sertype *tp, void **ptrs, size_t count, dds_free_op_t op) { + tp->ops->free_samples (tp, ptrs, count, op); +} +DDS_INLINE_EXPORT inline void ddsi_sertype_zero_sample (const struct ddsi_sertype *tp, void *sample) { + ddsi_sertype_zero_samples (tp, sample, 1); +} +DDS_INLINE_EXPORT inline void *ddsi_sertype_alloc_sample (const struct ddsi_sertype *tp) { + void *ptr; + ddsi_sertype_realloc_samples (&ptr, tp, NULL, 0, 1); + return ptr; +} +DDS_INLINE_EXPORT inline void ddsi_sertype_free_sample (const struct ddsi_sertype *tp, void *sample, dds_free_op_t op) { + ddsi_sertype_free_samples (tp, &sample, 1, op); +} +DDS_INLINE_EXPORT inline ddsi_typeid_t * ddsi_sertype_typeid (const struct ddsi_sertype *tp, ddsi_typeid_kind_t kind) +{ + if (!tp->ops->type_id) + return NULL; + return tp->ops->type_id (tp, kind); +} +DDS_INLINE_EXPORT inline ddsi_typemap_t * ddsi_sertype_typemap (const struct ddsi_sertype *tp) +{ + if (!tp->ops->type_map) + return NULL; + return tp->ops->type_map (tp); +} +DDS_INLINE_EXPORT inline ddsi_typeinfo_t *ddsi_sertype_typeinfo (const struct ddsi_sertype *tp) +{ + if (!tp->ops->type_info) + return NULL; + return tp->ops->type_info (tp); +} +DDS_INLINE_EXPORT inline struct ddsi_sertype * ddsi_sertype_derive_sertype (const struct ddsi_sertype *base_sertype, dds_data_representation_id_t data_representation, dds_type_consistency_enforcement_qospolicy_t tce_qos) { + if (!base_sertype->ops->derive_sertype) + return NULL; + return base_sertype->ops->derive_sertype (base_sertype, data_representation, tce_qos); +} + +DDS_INLINE_EXPORT inline size_t +ddsi_sertype_get_serialized_size(const struct ddsi_sertype *tp, + const void *sample) { + return tp->ops->get_serialized_size(tp, sample); +} + +DDS_INLINE_EXPORT inline bool +ddsi_sertype_serialize_into(const struct ddsi_sertype *tp, const void *sample, + void *dst_buffer, size_t dst_size) { + return tp->ops->serialize_into(tp, sample, dst_buffer, dst_size); +} + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_SERTYPE_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_shm_transport.h b/unitree_SDK/include/dds/ddsi/ddsi_shm_transport.h new file mode 100644 index 0000000..1fc10ca --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_shm_transport.h @@ -0,0 +1,89 @@ +/* + * Copyright(c) 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDS_SHM__TRANSPORT_H +#define DDS_SHM__TRANSPORT_H + +#include "dds/export.h" +#include "dds/features.h" + +#include "dds/ddsi/ddsi_config.h" +#include "dds/ddsi/ddsi_keyhash.h" +#include "dds/ddsi/ddsi_tran.h" +#include "dds/ddsi/q_protocol.h" /* for, e.g., SubmessageKind_t */ +#include "dds/ddsrt/sync.h" + +#include "iceoryx_binding_c/chunk.h" +#include "iceoryx_binding_c/publisher.h" +#include "iceoryx_binding_c/subscriber.h" +#include "iceoryx_binding_c/config.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef enum { + IOX_CHUNK_UNINITIALIZED, + IOX_CHUNK_CONTAINS_RAW_DATA, + IOX_CHUNK_CONTAINS_SERIALIZED_DATA +} iox_shm_data_state_t; + +struct iceoryx_header { + struct ddsi_guid guid; + dds_time_t tstamp; + uint32_t statusinfo; + uint32_t data_size; + unsigned char data_kind; + ddsi_keyhash_t keyhash; + iox_shm_data_state_t shm_data_state; +}; + +typedef struct iceoryx_header iceoryx_header_t; + +struct dds_reader; +struct shm_monitor; + +typedef struct { + ddsrt_mutex_t mutex; + struct shm_monitor *monitor; + struct dds_reader *parent_reader; +} iox_sub_context_t; + +DDS_EXPORT iox_sub_context_t **iox_sub_context_ptr(iox_sub_t sub); + +DDS_EXPORT void iox_sub_context_init(iox_sub_context_t *context); + +DDS_EXPORT void +iox_sub_context_fini(iox_sub_context_t *context); + +// lock and unlock for individual subscribers +DDS_EXPORT void shm_lock_iox_sub(iox_sub_t sub); + +DDS_EXPORT void shm_unlock_iox_sub(iox_sub_t sub); + +DDS_EXPORT void free_iox_chunk(iox_sub_t *iox_sub, void **iox_chunk); + +DDS_EXPORT iceoryx_header_t *iceoryx_header_from_chunk(const void *iox_chunk); + +DDS_EXPORT void shm_set_loglevel(enum ddsi_shm_loglevel); + +DDS_EXPORT void *shm_create_chunk(iox_pub_t iox_pub, size_t size); + +DDS_EXPORT void shm_set_data_state(void *iox_chunk, + iox_shm_data_state_t data_state); + +DDS_EXPORT iox_shm_data_state_t shm_get_data_state(void *iox_chunk); + +#if defined(__cplusplus) +} +#endif + +#endif // DDS_SHM__TRANSPORT_H diff --git a/unitree_SDK/include/dds/ddsi/ddsi_ssl.h b/unitree_SDK/include/dds/ddsi/ddsi_ssl.h new file mode 100644 index 0000000..b7cc4d7 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_ssl.h @@ -0,0 +1,49 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef _DDSI_SSL_H_ +#define _DDSI_SSL_H_ + +#include "dds/features.h" + +#ifdef DDS_HAS_SSL + +#ifdef _WIN32 +/* supposedly WinSock2 must be included before openssl headers otherwise winsock will be used */ +#include +#endif +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_ssl_plugins +{ + bool (*init) (struct ddsi_domaingv *gv); + void (*fini) (void); + void (*ssl_free) (SSL *ssl); + void (*bio_vfree) (BIO *bio); + ssize_t (*read) (SSL *ssl, void *buf, size_t len, dds_return_t *err); + ssize_t (*write) (SSL *ssl, const void *msg, size_t len, dds_return_t *err); + SSL * (*connect) (const struct ddsi_domaingv *gv, ddsrt_socket_t sock); + BIO * (*listen) (ddsrt_socket_t sock); + SSL * (*accept) (const struct ddsi_domaingv *gv, BIO *bio, ddsrt_socket_t *sock); +}; + +void ddsi_ssl_config_plugin (struct ddsi_ssl_plugins *plugin); + +#if defined (__cplusplus) +} +#endif + +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_statistics.h b/unitree_SDK/include/dds/ddsi/ddsi_statistics.h new file mode 100644 index 0000000..99e697e --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_statistics.h @@ -0,0 +1,30 @@ +/* + * Copyright(c) 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef _DDSI_STATISTICS_H_ +#define _DDSI_STATISTICS_H_ + +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_reader; +struct ddsi_writer; + +void ddsi_get_writer_stats (struct ddsi_writer *wr, uint64_t * __restrict rexmit_bytes, uint32_t * __restrict throttle_count, uint64_t * __restrict time_throttled, uint64_t * __restrict time_retransmit); +void ddsi_get_reader_stats (struct ddsi_reader *rd, uint64_t * __restrict discarded_bytes); + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_tcp.h b/unitree_SDK/include/dds/ddsi/ddsi_tcp.h new file mode 100644 index 0000000..12e33b3 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_tcp.h @@ -0,0 +1,27 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef _DDSI_TCP_H_ +#define _DDSI_TCP_H_ + +#include "dds/ddsi/ddsi_tran.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +DDS_EXPORT int ddsi_tcp_init (struct ddsi_domaingv *gv); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_threadmon.h b/unitree_SDK/include/dds/ddsi/ddsi_threadmon.h new file mode 100644 index 0000000..9063199 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_threadmon.h @@ -0,0 +1,33 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_THREADMON_H +#define DDSI_THREADMON_H + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_threadmon; +struct ddsi_domaingv; + +struct ddsi_threadmon *ddsi_threadmon_new (int64_t liveliness_monitoring_interval, bool noprogress_log_stacktraces); +dds_return_t ddsi_threadmon_start (struct ddsi_threadmon *sl, const char *name); +void ddsi_threadmon_register_domain (struct ddsi_threadmon *sl, const struct ddsi_domaingv *gv); +void ddsi_threadmon_unregister_domain (struct ddsi_threadmon *sl, const struct ddsi_domaingv *gv); +void ddsi_threadmon_stop (struct ddsi_threadmon *sl); +void ddsi_threadmon_free (struct ddsi_threadmon *sl); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_THREADMON_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_time.h b/unitree_SDK/include/dds/ddsi/ddsi_time.h new file mode 100644 index 0000000..6ef479a --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_time.h @@ -0,0 +1,44 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_TIME_H +#define DDSI_TIME_H + +#include + +#include "dds/export.h" +#include "dds/ddsrt/time.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct { + int32_t seconds; + uint32_t fraction; +} ddsi_time_t; +#define DDSI_TIME_INFINITE ((ddsi_time_t) { INT32_MAX, UINT32_MAX }) +#define DDSI_TIME_INVALID ((ddsi_time_t) { -1, UINT32_MAX }) + +typedef ddsi_time_t ddsi_duration_t; + +bool ddsi_is_valid_timestamp (ddsi_time_t t); + +DDS_EXPORT ddsi_time_t ddsi_wctime_to_ddsi_time (ddsrt_wctime_t t); +DDS_EXPORT ddsrt_wctime_t ddsi_wctime_from_ddsi_time (ddsi_time_t x); +DDS_EXPORT ddsi_duration_t ddsi_to_ddsi_duration (dds_duration_t t); +DDS_EXPORT dds_duration_t ddsi_from_ddsi_duration (ddsi_duration_t x); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_TIME_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_tkmap.h b/unitree_SDK/include/dds/ddsi/ddsi_tkmap.h new file mode 100644 index 0000000..1b1a03c --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_tkmap.h @@ -0,0 +1,45 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef _DDS_TKMAP_H_ +#define _DDS_TKMAP_H_ + +#include "dds/ddsrt/atomics.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_tkmap; +struct ddsi_serdata; +struct dds_topic; +struct ddsi_domaingv; + +struct ddsi_tkmap_instance +{ + struct ddsi_serdata *m_sample; + uint64_t m_iid; + ddsrt_atomic_uint32_t m_refc; +}; + +DDS_EXPORT struct ddsi_tkmap *ddsi_tkmap_new (struct ddsi_domaingv *gv); +DDS_EXPORT void ddsi_tkmap_free (struct ddsi_tkmap *tkmap); +DDS_EXPORT void ddsi_tkmap_instance_ref (struct ddsi_tkmap_instance *tk); +DDS_EXPORT uint64_t ddsi_tkmap_lookup (struct ddsi_tkmap *tkmap, const struct ddsi_serdata *serdata); +DDS_EXPORT struct ddsi_tkmap_instance * ddsi_tkmap_find(struct ddsi_tkmap *map, struct ddsi_serdata *sd, const bool create); +DDS_EXPORT struct ddsi_tkmap_instance * ddsi_tkmap_find_by_id (struct ddsi_tkmap *map, uint64_t iid); +DDS_EXPORT struct ddsi_tkmap_instance * ddsi_tkmap_lookup_instance_ref (struct ddsi_tkmap *map, struct ddsi_serdata * sd); +DDS_EXPORT void ddsi_tkmap_instance_unref (struct ddsi_tkmap *map, struct ddsi_tkmap_instance *tk); + +#if defined (__cplusplus) +} +#endif +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_topic.h b/unitree_SDK/include/dds/ddsi/ddsi_topic.h new file mode 100644 index 0000000..7ba1f8b --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_topic.h @@ -0,0 +1,76 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_TOPIC_H +#define DDSI_TOPIC_H + +#include "dds/export.h" +#include "dds/features.h" + +#include "dds/ddsi/ddsi_domaingv.h" +#include "dds/ddsi/ddsi_entity.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +DDS_EXPORT int ddsi_is_builtin_topic (ddsi_entityid_t id, nn_vendorid_t vendorid); +DDS_EXPORT int ddsi_is_topic_entityid (ddsi_entityid_t id); + +#ifdef DDS_HAS_TOPIC_DISCOVERY + +struct ddsi_type_pair; +struct dds_qos; + +struct ddsi_topic_definition { + unsigned char key[16]; /* key for this topic definition (MD5 hash of the type_id and qos) */ + struct ddsi_type_pair *type_pair; /* has a ddsi_type object for the minimal and complete type, which contains the XTypes type identifiers */ + struct dds_qos *xqos; /* contains also the topic name and type name */ + uint32_t refc; + struct ddsi_domaingv *gv; +}; + +struct ddsi_topic { + struct ddsi_entity_common e; + struct ddsi_topic_definition *definition; /* ref to (shared) topic definition, protected by e.qos_lock */ + struct ddsi_participant *pp; /* backref to the participant */ +}; + +struct ddsi_proxy_topic +{ + ddsi_entityid_t entityid; + struct ddsi_topic_definition *definition; /* ref to (shared) topic definition */ + ddsrt_wctime_t tupdate; /* timestamp of last update */ + seqno_t seq; /* sequence number of most recent SEDP message */ + ddsrt_avl_node_t avlnode; /* entry in proxypp->topics */ + unsigned deleted: 1; +}; + +int ddsi_topic_definition_equal (const struct ddsi_topic_definition *tpd_a, const struct ddsi_topic_definition *tpd_b); +uint32_t ddsi_topic_definition_hash (const struct ddsi_topic_definition *tpd); + +dds_return_t ddsi_new_proxy_topic (struct ddsi_proxy_participant *proxypp, seqno_t seq, const ddsi_guid_t *guid, const ddsi_typeid_t *type_id_minimal, const ddsi_typeid_t *type_id, struct dds_qos *qos, ddsrt_wctime_t timestamp); +struct ddsi_proxy_topic *ddsi_lookup_proxy_topic (struct ddsi_proxy_participant *proxypp, const ddsi_guid_t *guid); +void ddsi_update_proxy_topic (struct ddsi_proxy_participant *proxypp, struct ddsi_proxy_topic *proxytp, seqno_t seq, struct dds_qos *xqos, ddsrt_wctime_t timestamp); +int ddsi_delete_proxy_topic_locked (struct ddsi_proxy_participant *proxypp, struct ddsi_proxy_topic *proxytp, ddsrt_wctime_t timestamp); + +DDS_EXPORT dds_return_t ddsi_new_topic (struct ddsi_topic **tp_out, struct ddsi_guid *tpguid, struct ddsi_participant *pp, const char *topic_name, const struct ddsi_sertype *type, const struct dds_qos *xqos, bool is_builtin, bool *new_topic_def); +DDS_EXPORT void ddsi_update_topic_qos (struct ddsi_topic *tp, const dds_qos_t *xqos); +DDS_EXPORT dds_return_t ddsi_delete_topic (struct ddsi_domaingv *gv, const struct ddsi_guid *guid); +DDS_EXPORT dds_return_t ddsi_lookup_topic_definition (struct ddsi_domaingv *gv, const char * topic_name, const ddsi_typeid_t *type_id, struct ddsi_topic_definition **tpd); + +#endif /* DDS_HAS_TOPIC_DISCOVERY */ + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_TOPIC_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_tran.h b/unitree_SDK/include/dds/ddsi/ddsi_tran.h new file mode 100644 index 0000000..242f414 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_tran.h @@ -0,0 +1,336 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef _DDSI_TRAN_H_ +#define _DDSI_TRAN_H_ + +/* DDSI Transport module */ + +#include "dds/ddsrt/ifaddrs.h" +#include "dds/ddsrt/atomics.h" +#include "dds/ddsi/ddsi_locator.h" +#include "dds/ddsi/ddsi_config.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct nn_interface; +struct ddsi_domaingv; + +/* Types supporting handles */ + +#define DDSI_TRAN_CONN 1 +#define DDSI_TRAN_LISTENER 2 + +/* Flags */ + +#define DDSI_TRAN_ON_CONNECT 0x0001 + +/* Core types */ + +typedef struct ddsi_tran_base * ddsi_tran_base_t; +typedef struct ddsi_tran_conn * ddsi_tran_conn_t; +typedef struct ddsi_tran_listener * ddsi_tran_listener_t; +typedef struct ddsi_tran_factory * ddsi_tran_factory_t; +typedef struct ddsi_tran_qos ddsi_tran_qos_t; + +/* Function pointer types */ + +typedef ssize_t (*ddsi_tran_read_fn_t) (ddsi_tran_conn_t, unsigned char *, size_t, bool, ddsi_locator_t *); +typedef ssize_t (*ddsi_tran_write_fn_t) (ddsi_tran_conn_t, const ddsi_locator_t *, size_t, const ddsrt_iovec_t *, uint32_t); +typedef int (*ddsi_tran_locator_fn_t) (ddsi_tran_factory_t, ddsi_tran_base_t, ddsi_locator_t *); +typedef bool (*ddsi_tran_supports_fn_t) (const struct ddsi_tran_factory *, int32_t); +typedef ddsrt_socket_t (*ddsi_tran_handle_fn_t) (ddsi_tran_base_t); +typedef int (*ddsi_tran_listen_fn_t) (ddsi_tran_listener_t); +typedef void (*ddsi_tran_free_fn_t) (ddsi_tran_factory_t); +typedef void (*ddsi_tran_peer_locator_fn_t) (ddsi_tran_conn_t, ddsi_locator_t *); +typedef void (*ddsi_tran_disable_multiplexing_fn_t) (ddsi_tran_conn_t); +typedef ddsi_tran_conn_t (*ddsi_tran_accept_fn_t) (ddsi_tran_listener_t); +typedef dds_return_t (*ddsi_tran_create_conn_fn_t) (ddsi_tran_conn_t *conn, ddsi_tran_factory_t fact, uint32_t, const struct ddsi_tran_qos *); +typedef dds_return_t (*ddsi_tran_create_listener_fn_t) (ddsi_tran_listener_t *listener, ddsi_tran_factory_t fact, uint32_t port, const struct ddsi_tran_qos *); +typedef void (*ddsi_tran_release_conn_fn_t) (ddsi_tran_conn_t); +typedef void (*ddsi_tran_close_conn_fn_t) (ddsi_tran_conn_t); +typedef void (*ddsi_tran_unblock_listener_fn_t) (ddsi_tran_listener_t); +typedef void (*ddsi_tran_release_listener_fn_t) (ddsi_tran_listener_t); +typedef int (*ddsi_tran_join_mc_fn_t) (ddsi_tran_conn_t, const ddsi_locator_t *srcip, const ddsi_locator_t *mcip, const struct nn_interface *interf); +typedef int (*ddsi_tran_leave_mc_fn_t) (ddsi_tran_conn_t, const ddsi_locator_t *srcip, const ddsi_locator_t *mcip, const struct nn_interface *interf); +typedef int (*ddsi_is_loopbackaddr_fn_t) (const struct ddsi_tran_factory *tran, const ddsi_locator_t *loc); +typedef int (*ddsi_is_mcaddr_fn_t) (const struct ddsi_tran_factory *tran, const ddsi_locator_t *loc); +typedef int (*ddsi_is_ssm_mcaddr_fn_t) (const struct ddsi_tran_factory *tran, const ddsi_locator_t *loc); +typedef int (*ddsi_is_valid_port_fn_t) (const struct ddsi_tran_factory *tran, uint32_t port); +typedef uint32_t (*ddsi_receive_buffer_size_fn_t) (const struct ddsi_tran_factory *fact); + +enum ddsi_nearby_address_result { + DNAR_DISTANT, + DNAR_LOCAL +}; + +typedef enum ddsi_nearby_address_result (*ddsi_is_nearby_address_fn_t) (const ddsi_locator_t *loc, size_t ninterf, const struct nn_interface *interf, size_t *interf_idx); + +enum ddsi_locator_from_string_result { + AFSR_OK, /* conversion succeeded */ + AFSR_INVALID, /* bogus input */ + AFSR_UNKNOWN, /* transport or hostname lookup failure */ + AFSR_MISMATCH /* recognised format, but mismatch with expected (e.g., IPv4/IPv6) */ +}; + +typedef enum ddsi_locator_from_string_result (*ddsi_locator_from_string_fn_t) (const struct ddsi_tran_factory *tran, ddsi_locator_t *loc, const char *str); + +typedef int (*ddsi_locator_from_sockaddr_fn_t) (const struct ddsi_tran_factory *tran, ddsi_locator_t *loc, const struct sockaddr *sockaddr); + +typedef char * (*ddsi_locator_to_string_fn_t) (char *dst, size_t sizeof_dst, const ddsi_locator_t *loc, ddsi_tran_conn_t conn, int with_port); + +typedef int (*ddsi_enumerate_interfaces_fn_t) (ddsi_tran_factory_t tran, enum ddsi_transport_selector transport_selector, ddsrt_ifaddrs_t **interfs); + +/* Data types */ +struct ddsi_tran_base +{ + /* Data */ + + uint32_t m_port; + uint32_t m_trantype; + bool m_multicast; + struct ddsi_domaingv *gv; + + /* Functions */ + + ddsi_tran_handle_fn_t m_handle_fn; +}; + +struct ddsi_tran_conn +{ + struct ddsi_tran_base m_base; + + /* Functions */ + + ddsi_tran_read_fn_t m_read_fn; + ddsi_tran_write_fn_t m_write_fn; + ddsi_tran_peer_locator_fn_t m_peer_locator_fn; + ddsi_tran_disable_multiplexing_fn_t m_disable_multiplexing_fn; + ddsi_tran_locator_fn_t m_locator_fn; + + /* Data */ + + bool m_server; + bool m_connless; + bool m_stream; + bool m_closed; + ddsrt_atomic_uint32_t m_count; + + /* Relationships */ + + const struct nn_interface *m_interf; + ddsi_tran_factory_t m_factory; + ddsi_tran_listener_t m_listener; + ddsi_tran_conn_t m_conn; +}; + +struct ddsi_tran_listener +{ + struct ddsi_tran_base m_base; + + /* Functions */ + + ddsi_tran_listen_fn_t m_listen_fn; + ddsi_tran_accept_fn_t m_accept_fn; + ddsi_tran_locator_fn_t m_locator_fn; + + /* Relationships */ + + ddsi_tran_conn_t m_connections; + ddsi_tran_factory_t m_factory; + ddsi_tran_listener_t m_listener; +}; + +struct ddsi_tran_factory +{ + /* Functions */ + + ddsi_tran_create_conn_fn_t m_create_conn_fn; + ddsi_tran_create_listener_fn_t m_create_listener_fn; + ddsi_tran_release_conn_fn_t m_release_conn_fn; + ddsi_tran_close_conn_fn_t m_close_conn_fn; + ddsi_tran_unblock_listener_fn_t m_unblock_listener_fn; + ddsi_tran_release_listener_fn_t m_release_listener_fn; + ddsi_tran_supports_fn_t m_supports_fn; + ddsi_tran_free_fn_t m_free_fn; + ddsi_tran_join_mc_fn_t m_join_mc_fn; + ddsi_tran_leave_mc_fn_t m_leave_mc_fn; + ddsi_is_loopbackaddr_fn_t m_is_loopbackaddr_fn; + ddsi_is_mcaddr_fn_t m_is_mcaddr_fn; + ddsi_is_ssm_mcaddr_fn_t m_is_ssm_mcaddr_fn; + ddsi_is_nearby_address_fn_t m_is_nearby_address_fn; + ddsi_locator_from_string_fn_t m_locator_from_string_fn; + ddsi_locator_to_string_fn_t m_locator_to_string_fn; + ddsi_enumerate_interfaces_fn_t m_enumerate_interfaces_fn; + ddsi_is_valid_port_fn_t m_is_valid_port_fn; + ddsi_receive_buffer_size_fn_t m_receive_buffer_size_fn; + ddsi_locator_from_sockaddr_fn_t m_locator_from_sockaddr_fn; + + /* Data */ + + /// Transport name, also used as prefix in string representation of locator (e.g., udp/1.2.3.4) + const char *m_typename; + + /// Whether this is a connection-oriented transport like TCP (false), where a socket communicates + /// with one other socket after connecting; or whether it can send to any address at any time like + /// UDP (true). + bool m_connless; + + /// Whether this transport deals with byte streams (TCP, true) or with datagrams (UDP, false). A + /// byte stream forces the upper layer to do add some framing. + bool m_stream; + + /// Whether this transport is enabled for DDS communications. Only locators mapping handled + /// by enabled transports are taken into account when parsing discovery data. + /// + /// The usefulness of disabled transports is (currently) limited to running in UDP mode while using + /// the TCP transport code as a portable means for providing a debug interface. + bool m_enable; + + /// Whether this transport should be included in SPDP advertisements. Not all transports are + /// created equally: those that only provide a representation for an integrated pub-sub messaging + /// system that can be used to by-pass RTPS should not by included in anything related to SPDP. + bool m_enable_spdp; + + /// Default SPDP address for this transport (the spec only gives an UDPv4 default one), NULL if + /// no default address exists. + const char *m_default_spdp_address; + + struct ddsi_domaingv *gv; + + /* Relationships */ + + ddsi_tran_factory_t m_factory; +}; + +enum ddsi_tran_qos_purpose { + DDSI_TRAN_QOS_XMIT_UC, // will send unicast only + DDSI_TRAN_QOS_XMIT_MC, // may send unicast or multicast + DDSI_TRAN_QOS_RECV_UC, // will be used for receiving unicast + DDSI_TRAN_QOS_RECV_MC // will be used for receiving multicast +}; + +struct ddsi_tran_qos +{ + enum ddsi_tran_qos_purpose m_purpose; + int m_diffserv; + struct nn_interface *m_interface; // only for purpose = XMIT +}; + +void ddsi_tran_factories_fini (struct ddsi_domaingv *gv); +void ddsi_factory_add (struct ddsi_domaingv *gv, ddsi_tran_factory_t factory); +DDS_EXPORT void ddsi_factory_free (ddsi_tran_factory_t factory); +DDS_EXPORT ddsi_tran_factory_t ddsi_factory_find (const struct ddsi_domaingv *gv, const char * type); +ddsi_tran_factory_t ddsi_factory_find_supported_kind (const struct ddsi_domaingv *gv, int32_t kind); +void ddsi_factory_conn_init (const struct ddsi_tran_factory *factory, const struct nn_interface *interf, ddsi_tran_conn_t conn); + +DDS_INLINE_EXPORT inline bool ddsi_factory_supports (const struct ddsi_tran_factory *factory, int32_t kind) { + return factory->m_supports_fn (factory, kind); +} +DDS_INLINE_EXPORT inline int ddsi_is_valid_port (const struct ddsi_tran_factory *factory, uint32_t port) { + return factory->m_is_valid_port_fn (factory, port); +} +DDS_INLINE_EXPORT inline uint32_t ddsi_receive_buffer_size (const struct ddsi_tran_factory *factory) { + return factory->m_receive_buffer_size_fn (factory); +} +DDS_INLINE_EXPORT inline dds_return_t ddsi_factory_create_conn (ddsi_tran_conn_t *conn, ddsi_tran_factory_t factory, uint32_t port, const struct ddsi_tran_qos *qos) { + *conn = NULL; + if ((qos->m_interface != NULL) != (qos->m_purpose == DDSI_TRAN_QOS_XMIT_UC || qos->m_purpose == DDSI_TRAN_QOS_XMIT_MC)) + return DDS_RETCODE_BAD_PARAMETER; + if (!ddsi_is_valid_port (factory, port)) + return DDS_RETCODE_BAD_PARAMETER; + return factory->m_create_conn_fn (conn, factory, port, qos); +} +DDS_INLINE_EXPORT inline dds_return_t ddsi_factory_create_listener (ddsi_tran_listener_t *listener, ddsi_tran_factory_t factory, uint32_t port, const struct ddsi_tran_qos *qos) { + *listener = NULL; + if (!ddsi_is_valid_port (factory, port)) + return DDS_RETCODE_BAD_PARAMETER; + return factory->m_create_listener_fn (listener, factory, port, qos); +} + +void ddsi_tran_free (ddsi_tran_base_t base); +DDS_INLINE_EXPORT inline ddsrt_socket_t ddsi_tran_handle (ddsi_tran_base_t base) { + return base->m_handle_fn (base); +} +DDS_INLINE_EXPORT inline ddsrt_socket_t ddsi_conn_handle (ddsi_tran_conn_t conn) { + return conn->m_base.m_handle_fn (&conn->m_base); +} +DDS_INLINE_EXPORT inline uint32_t ddsi_conn_type (const struct ddsi_tran_conn *conn) { + return conn->m_base.m_trantype; +} +DDS_INLINE_EXPORT inline uint32_t ddsi_conn_port (const struct ddsi_tran_conn *conn) { + return conn->m_base.m_port; +} +DDS_INLINE_EXPORT inline int ddsi_conn_locator (ddsi_tran_conn_t conn, ddsi_locator_t * loc) { + return conn->m_locator_fn (conn->m_factory, &conn->m_base, loc); +} +DDS_INLINE_EXPORT inline ssize_t ddsi_conn_write (ddsi_tran_conn_t conn, const ddsi_locator_t *dst, size_t niov, const ddsrt_iovec_t *iov, uint32_t flags) { + return conn->m_closed ? -1 : (conn->m_write_fn) (conn, dst, niov, iov, flags); +} +DDS_INLINE_EXPORT inline ssize_t ddsi_conn_read (ddsi_tran_conn_t conn, unsigned char * buf, size_t len, bool allow_spurious, ddsi_locator_t *srcloc) { + return conn->m_closed ? -1 : conn->m_read_fn (conn, buf, len, allow_spurious, srcloc); +} +bool ddsi_conn_peer_locator (ddsi_tran_conn_t conn, ddsi_locator_t * loc); +void ddsi_conn_disable_multiplexing (ddsi_tran_conn_t conn); +void ddsi_conn_add_ref (ddsi_tran_conn_t conn); +void ddsi_conn_free (ddsi_tran_conn_t conn); +int ddsi_conn_join_mc (ddsi_tran_conn_t conn, const ddsi_locator_t *srcip, const ddsi_locator_t *mcip, const struct nn_interface *interf); +int ddsi_conn_leave_mc (ddsi_tran_conn_t conn, const ddsi_locator_t *srcip, const ddsi_locator_t *mcip, const struct nn_interface *interf); +void ddsi_conn_transfer_group_membership (ddsi_tran_conn_t conn, ddsi_tran_conn_t newconn); +int ddsi_conn_rejoin_transferred_mcgroups (ddsi_tran_conn_t conn); +int ddsi_is_loopbackaddr (const struct ddsi_domaingv *gv, const ddsi_locator_t *loc); +int ddsi_is_mcaddr (const struct ddsi_domaingv *gv, const ddsi_locator_t *loc); +int ddsi_is_ssm_mcaddr (const struct ddsi_domaingv *gv, const ddsi_locator_t *loc); +enum ddsi_nearby_address_result ddsi_is_nearby_address (const struct ddsi_domaingv *gv, const ddsi_locator_t *loc, size_t ninterf, const struct nn_interface *interf, size_t *interf_idx); + +DDS_EXPORT enum ddsi_locator_from_string_result ddsi_locator_from_string (const struct ddsi_domaingv *gv, ddsi_locator_t *loc, const char *str, ddsi_tran_factory_t default_factory); + +DDS_EXPORT int ddsi_locator_from_sockaddr (const struct ddsi_tran_factory *tran, ddsi_locator_t *loc, const struct sockaddr *sockaddr); + +/* 8 for transport/ + 1 for [ + 48 for IPv6 hex digits (3*16) + separators + 2 for ]: + 10 for port (DDSI loc has signed 32-bit) + 11 for @ifindex + 1 for terminator + -- + 81 +*/ +#define DDSI_LOCSTRLEN 81 + +char *ddsi_xlocator_to_string (char *dst, size_t sizeof_dst, const ddsi_xlocator_t *loc); +char *ddsi_locator_to_string (char *dst, size_t sizeof_dst, const ddsi_locator_t *loc); + +char *ddsi_xlocator_to_string_no_port (char *dst, size_t sizeof_dst, const ddsi_xlocator_t *loc); +char *ddsi_locator_to_string_no_port (char *dst, size_t sizeof_dst, const ddsi_locator_t *loc); + +int ddsi_enumerate_interfaces (ddsi_tran_factory_t factory, enum ddsi_transport_selector transport_selector, ddsrt_ifaddrs_t **interfs); + +DDS_INLINE_EXPORT inline int ddsi_listener_locator (ddsi_tran_listener_t listener, ddsi_locator_t *loc) { + return listener->m_locator_fn (listener->m_factory, &listener->m_base, loc); +} +DDS_INLINE_EXPORT inline int ddsi_listener_listen (ddsi_tran_listener_t listener) { + return listener->m_listen_fn (listener); +} +DDS_INLINE_EXPORT inline ddsi_tran_conn_t ddsi_listener_accept (ddsi_tran_listener_t listener) { + return listener->m_accept_fn (listener); +} +void ddsi_listener_unblock (ddsi_tran_listener_t listener); +void ddsi_listener_free (ddsi_tran_listener_t listener); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_typebuilder.h b/unitree_SDK/include/dds/ddsi/ddsi_typebuilder.h new file mode 100644 index 0000000..af09367 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_typebuilder.h @@ -0,0 +1,37 @@ +/* + * Copyright(c) 2022 ZettaScale Technology + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_TYPEBUILDER_H +#define DDSI_TYPEBUILDER_H + +#include "dds/features.h" + +#include +#include +#include "dds/dds.h" +#include "dds/ddsi/ddsi_typelib.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#ifdef DDS_HAS_TYPE_DISCOVERY + +DDS_EXPORT dds_return_t ddsi_topic_descriptor_from_type (struct ddsi_domaingv *gv, dds_topic_descriptor_t *desc, const struct ddsi_type *type); +DDS_EXPORT void ddsi_topic_descriptor_fini (dds_topic_descriptor_t *desc); + +#endif /* DDS_HAS_TYPE_DISCOVERY */ + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_TYPEBUILDER_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_typelib.h b/unitree_SDK/include/dds/ddsi/ddsi_typelib.h new file mode 100644 index 0000000..7892f41 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_typelib.h @@ -0,0 +1,141 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_TYPELIB_H +#define DDSI_TYPELIB_H + +#include "dds/features.h" + +#include +#include +#include "dds/ddsrt/static_assert.h" +#include "dds/ddsrt/avl.h" +#include "dds/ddsi/ddsi_guid.h" +#include "dds/ddsi/ddsi_list_tmpl.h" +#include "dds/ddsi/ddsi_typewrap.h" +#include "dds/ddsi/ddsi_sertype.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#ifdef DDS_HAS_TYPE_DISCOVERY + +extern const ddsrt_avl_treedef_t ddsi_typelib_treedef; +extern const ddsrt_avl_treedef_t ddsi_typedeps_treedef; +extern const ddsrt_avl_treedef_t ddsi_typedeps_reverse_treedef; + +struct ddsi_generic_proxy_endpoint; +struct ddsi_domaingv; +struct ddsi_sertype; +struct ddsi_sertype_cdr_data; +struct ddsi_type; +struct ddsi_type_pair; + +enum ddsi_type_state { + DDSI_TYPE_UNRESOLVED, + DDSI_TYPE_REQUESTED, + DDSI_TYPE_PARTIAL_RESOLVED, + DDSI_TYPE_RESOLVED, + DDSI_TYPE_INVALID, +}; + +typedef enum ddsi_type_request { + DDSI_TYPE_NO_REQUEST, + DDSI_TYPE_SEND_REQUEST +} ddsi_type_request_t; + +/* Used for converting type-id to strings */ +struct ddsi_typeid_str { + char str[50]; +}; + +DDS_EXPORT char *ddsi_make_typeid_str (struct ddsi_typeid_str *buf, const ddsi_typeid_t *type_id); + +DDS_EXPORT bool ddsi_typeinfo_equal (const ddsi_typeinfo_t *a, const ddsi_typeinfo_t *b, ddsi_type_include_deps_t deps); +DDS_EXPORT ddsi_typeid_t *ddsi_typeinfo_typeid (const ddsi_typeinfo_t *type_info, ddsi_typeid_kind_t kind); +DDS_EXPORT ddsi_typeinfo_t *ddsi_typeinfo_deser (const struct ddsi_sertype_cdr_data *ser); +DDS_EXPORT void ddsi_typeinfo_fini (ddsi_typeinfo_t *typeinfo); +DDS_EXPORT ddsi_typeinfo_t * ddsi_typeinfo_dup (const ddsi_typeinfo_t *src); +DDS_EXPORT const ddsi_typeid_t *ddsi_typeinfo_minimal_typeid (const ddsi_typeinfo_t *typeinfo); +DDS_EXPORT const ddsi_typeid_t *ddsi_typeinfo_complete_typeid (const ddsi_typeinfo_t *typeinfo); +DDS_EXPORT bool ddsi_typeinfo_present (const ddsi_typeinfo_t *typeinfo); +DDS_EXPORT bool ddsi_typeinfo_valid (const ddsi_typeinfo_t *typeinfo); + +DDS_EXPORT ddsi_typemap_t *ddsi_typemap_deser (const struct ddsi_sertype_cdr_data *ser); +DDS_EXPORT void ddsi_typemap_fini (ddsi_typemap_t *typemap); + +DDS_EXPORT void ddsi_type_register_dep (struct ddsi_domaingv *gv, const ddsi_typeid_t *src_type_id, struct ddsi_type **dst_dep_type, const struct DDS_XTypes_TypeIdentifier *dep_type_id); +DDS_EXPORT void ddsi_type_ref_locked (struct ddsi_domaingv *gv, struct ddsi_type **type, const struct ddsi_type *src); +DDS_EXPORT dds_return_t ddsi_type_ref_id_locked (struct ddsi_domaingv *gv, struct ddsi_type **type, const ddsi_typeid_t *type_id); +DDS_EXPORT dds_return_t ddsi_type_ref_local (struct ddsi_domaingv *gv, struct ddsi_type **type, const struct ddsi_sertype *sertype, ddsi_typeid_kind_t kind); +DDS_EXPORT dds_return_t ddsi_type_ref_proxy (struct ddsi_domaingv *gv, struct ddsi_type **type, const ddsi_typeinfo_t *type_info, ddsi_typeid_kind_t kind, const ddsi_guid_t *proxy_guid); +DDS_EXPORT dds_return_t ddsi_type_add_typeobj (struct ddsi_domaingv *gv, struct ddsi_type *type, const struct DDS_XTypes_TypeObject *type_obj); +DDS_EXPORT struct ddsi_typeobj *ddsi_type_get_typeobj (struct ddsi_domaingv *gv, const struct ddsi_type *type); +DDS_EXPORT dds_return_t ddsi_type_get_typeinfo_ser (struct ddsi_domaingv *gv, const struct ddsi_type *type, unsigned char **data, uint32_t *sz); +DDS_EXPORT dds_return_t ddsi_type_get_typeinfo (struct ddsi_domaingv *gv, const struct ddsi_type *type, struct ddsi_typeinfo *type_info); +DDS_EXPORT dds_return_t ddsi_type_get_typemap_ser (struct ddsi_domaingv *gv, const struct ddsi_type *type, unsigned char **data, uint32_t *sz); +DDS_EXPORT void ddsi_type_unreg_proxy (struct ddsi_domaingv *gv, struct ddsi_type *type, const ddsi_guid_t *proxy_guid); +DDS_EXPORT void ddsi_type_unref (struct ddsi_domaingv *gv, struct ddsi_type *type); +DDS_EXPORT void ddsi_type_unref_sertype (struct ddsi_domaingv *gv, const struct ddsi_sertype *sertype); +DDS_EXPORT void ddsi_type_unref_locked (struct ddsi_domaingv *gv, struct ddsi_type *type); +DDS_EXPORT bool ddsi_type_resolved_locked (struct ddsi_domaingv *gv, const struct ddsi_type *type, ddsi_type_include_deps_t resolved_kind); +DDS_EXPORT bool ddsi_type_resolved (struct ddsi_domaingv *gv, const struct ddsi_type *type, ddsi_type_include_deps_t resolved_kind); + +/** + * @brief Waits for the provided type to be resolved + * + * In case the type is succesfully resolved (or was already resolved), this + * function increases the refcount for this type. Caller should do the unref. + */ +DDS_EXPORT dds_return_t ddsi_wait_for_type_resolved (struct ddsi_domaingv *gv, const ddsi_typeid_t *type_id, dds_duration_t timeout, struct ddsi_type **type, ddsi_type_include_deps_t resolved_kind, ddsi_type_request_t request); + +DDS_EXPORT bool ddsi_is_assignable_from (struct ddsi_domaingv *gv, const struct ddsi_type_pair *rd_type_pair, uint32_t rd_resolved, const struct ddsi_type_pair *wr_type_pair, uint32_t wr_resolved, const dds_type_consistency_enforcement_qospolicy_t *tce); +DDS_EXPORT const ddsi_typeid_t *ddsi_type_pair_minimal_id (const struct ddsi_type_pair *type_pair); +DDS_EXPORT const ddsi_typeid_t *ddsi_type_pair_complete_id (const struct ddsi_type_pair *type_pair); +DDS_EXPORT ddsi_typeinfo_t *ddsi_type_pair_minimal_info (struct ddsi_domaingv *gv, const struct ddsi_type_pair *type_pair); +DDS_EXPORT ddsi_typeinfo_t *ddsi_type_pair_complete_info (struct ddsi_domaingv *gv, const struct ddsi_type_pair *type_pair); +DDS_EXPORT struct ddsi_type_pair *ddsi_type_pair_init (const ddsi_typeid_t *type_id_minimal, const ddsi_typeid_t *type_id_complete); +DDS_EXPORT void ddsi_type_pair_free (struct ddsi_type_pair *type_pair); + +/** + * Returns the type lookup meta object for the provided type identifier. + * The caller of this functions needs to have locked gv->typelib_lock + * + * @remark The returned object from this function is not refcounted, + * its lifetime is at lease the lifetime of the (proxy) endpoints + * that are referring to it. + */ +DDS_EXPORT struct ddsi_type * ddsi_type_lookup_locked (struct ddsi_domaingv *gv, const ddsi_typeid_t *type_id); +/* Same as above, but does not require to have the lock */ +DDS_EXPORT struct ddsi_type * ddsi_type_lookup (struct ddsi_domaingv *gv, const ddsi_typeid_t *type_id); + +/** + * Gets a list of proxy endpoints that are registered for the provided type + * or for types that (indirectly) depend on this type. The resulting set of + * endpoints is stored in the gpe_match_upd parameter. The parameter n_match_upd + * should contain the actual number of entries in gpe_match_upd and will + * be updated if new entries are added. + */ +DDS_EXPORT void ddsi_type_get_gpe_matches (struct ddsi_domaingv *gv, const struct ddsi_type *type, struct ddsi_generic_proxy_endpoint ***gpe_match_upd, uint32_t *n_match_upd); + +/** + * Compares the provided type lookup meta objects. + */ +DDS_EXPORT int ddsi_type_compare (const struct ddsi_type *a, const struct ddsi_type *b); + +#endif /* DDS_HAS_TYPE_DISCOVERY */ + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_TYPELIB_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_typelookup.h b/unitree_SDK/include/dds/ddsi/ddsi_typelookup.h new file mode 100644 index 0000000..6f828c1 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_typelookup.h @@ -0,0 +1,75 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_TYPELOOKUP_H +#define DDSI_TYPELOOKUP_H + +#include "dds/features.h" + +#ifdef DDS_HAS_TYPE_DISCOVERY + +#include +#include "dds/ddsrt/time.h" +#include "dds/ddsrt/hopscotch.h" +#include "dds/ddsrt/mh3.h" +#include "dds/ddsi/ddsi_serdata.h" +#include "dds/ddsi/ddsi_sertype.h" +#include "dds/ddsi/ddsi_plist_generic.h" +#include "dds/ddsi/ddsi_xqos.h" +#include "dds/ddsi/ddsi_xt_typeinfo.h" +#include "dds/ddsi/ddsi_xt_typelookup.h" +#include "dds/ddsi/ddsi_typelib.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_guid; +struct ddsi_domaingv; +struct thread_state; +struct nn_xpack; +struct ddsi_participant; +struct receiver_state; +struct ddsi_serdata; +struct ddsi_sertype; +struct ddsi_type; + +/** + * Send a type lookup request message in order to request type information for the + * provided type identifier. + */ +DDS_EXPORT bool ddsi_tl_request_type (struct ddsi_domaingv * const gv, const ddsi_typeid_t *type_id, const ddsi_guid_t *proxypp_guid, ddsi_type_include_deps_t deps); + +/** + * Handle an incoming type lookup request message. For all types requested + * that are known in this node, the serialized sertype is send in a type + * lookup reply message. In case none of the requested types is known, + * an empty reply message will be sent. + */ +DDS_EXPORT void ddsi_tl_handle_request (struct ddsi_domaingv *gv, struct ddsi_serdata *sample_common); + +/** + * Add type information from a type lookup reply to the type library. + */ +DDS_EXPORT void ddsi_tl_add_types (struct ddsi_domaingv *gv, const DDS_Builtin_TypeLookup_Reply *reply, struct ddsi_generic_proxy_endpoint ***gpe_match_upd, uint32_t *n_match_upd); + +/** + * Handle an incoming type lookup reply message. The sertypes from this + * reply are registered in the local type administation and referenced + * from the corresponding proxy endpoints. + */ +DDS_EXPORT void ddsi_tl_handle_reply (struct ddsi_domaingv *gv, struct ddsi_serdata *sample_common); + +#if defined (__cplusplus) +} +#endif +#endif /* DDS_HAS_TYPE_DISCOVERY */ +#endif /* DDSI_TYPELOOKUP_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_typewrap.h b/unitree_SDK/include/dds/ddsi/ddsi_typewrap.h new file mode 100644 index 0000000..4a25701 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_typewrap.h @@ -0,0 +1,100 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_TYPEWRAP_H +#define DDSI_TYPEWRAP_H + +#include "dds/features.h" + +#include +#include +#include "dds/ddsrt/static_assert.h" +#include "dds/ddsi/ddsi_xt_typeinfo.h" +#include "dds/ddsi/ddsi_xt_typemap.h" +#include "dds/ddsi/ddsi_typelib.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#ifdef DDS_HAS_TYPE_DISCOVERY + +#define XT_FLAG_EXTENSIBILITY_MASK 0x7 + +#define DDS_XTypes_TRY_CONSTRUCT_INVALID 0 +#define DDS_XTypes_TRY_CONSTRUCT_DISCARD DDS_XTypes_TRY_CONSTRUCT1 +#define DDS_XTypes_TRY_CONSTRUCT_USE_DEFAULT DDS_XTypes_TRY_CONSTRUCT2 +#define DDS_XTypes_TRY_CONSTRUCT_TRIM (DDS_XTypes_TRY_CONSTRUCT1 | DDS_XTypes_TRY_CONSTRUCT2) + +struct xt_type; + +typedef struct ddsi_typeid ddsi_typeid_t; +typedef struct ddsi_typeinfo ddsi_typeinfo_t; +typedef struct ddsi_typeobj ddsi_typeobj_t; +typedef struct ddsi_typemap ddsi_typemap_t; + +typedef enum ddsi_typeid_kind { + DDSI_TYPEID_KIND_MINIMAL, + DDSI_TYPEID_KIND_COMPLETE, + DDSI_TYPEID_KIND_PLAIN_COLLECTION_MINIMAL, + DDSI_TYPEID_KIND_PLAIN_COLLECTION_COMPLETE, + DDSI_TYPEID_KIND_FULLY_DESCRIPTIVE +} ddsi_typeid_kind_t; + +typedef enum ddsi_type_include_deps { + DDSI_TYPE_IGNORE_DEPS, + DDSI_TYPE_INCLUDE_DEPS +} ddsi_type_include_deps_t; + +DDS_EXPORT const char * ddsi_typekind_descr (unsigned char disc); + +DDS_EXPORT void ddsi_typeid_copy (ddsi_typeid_t *dst, const ddsi_typeid_t *src); +DDS_EXPORT ddsi_typeid_t * ddsi_typeid_dup (const ddsi_typeid_t *src); +DDS_EXPORT int ddsi_typeid_compare (const ddsi_typeid_t *a, const ddsi_typeid_t *b); +DDS_EXPORT void ddsi_typeid_ser (const ddsi_typeid_t *type_id, unsigned char **buf, uint32_t *sz); +DDS_EXPORT void ddsi_typeid_fini (ddsi_typeid_t *type_id); +DDS_EXPORT bool ddsi_typeid_is_none (const ddsi_typeid_t *type_id); +DDS_EXPORT bool ddsi_typeid_is_hash (const ddsi_typeid_t *type_id); +DDS_EXPORT bool ddsi_typeid_is_minimal (const ddsi_typeid_t *type_id); +DDS_EXPORT bool ddsi_typeid_is_complete (const ddsi_typeid_t *type_id); +DDS_EXPORT bool ddsi_typeid_is_fully_descriptive (const ddsi_typeid_t *type_id); +DDS_EXPORT void ddsi_typeid_get_equivalence_hash (const ddsi_typeid_t *type_id, DDS_XTypes_EquivalenceHash *hash); +DDS_EXPORT bool ddsi_type_id_with_deps_equal (const struct DDS_XTypes_TypeIdentifierWithDependencies *a, const struct DDS_XTypes_TypeIdentifierWithDependencies *b, ddsi_type_include_deps_t deps); +DDS_EXPORT ddsi_typeid_kind_t ddsi_typeid_kind (const ddsi_typeid_t *type); + +DDS_EXPORT dds_return_t ddsi_typeobj_get_hash_id (const struct DDS_XTypes_TypeObject *type_obj, ddsi_typeid_t *type_id); +DDS_EXPORT void ddsi_typeobj_get_hash_id_impl (const struct DDS_XTypes_TypeObject *type_obj, struct DDS_XTypes_TypeIdentifier *type_id); +DDS_EXPORT void ddsi_typeobj_fini (ddsi_typeobj_t *typeobj); + +DDS_EXPORT dds_return_t ddsi_xt_type_init (struct ddsi_domaingv *gv, struct xt_type *xt, const ddsi_typeid_t *ti, const ddsi_typeobj_t *to); +DDS_EXPORT dds_return_t ddsi_xt_type_add_typeobj (struct ddsi_domaingv *gv, struct xt_type *xt, const struct DDS_XTypes_TypeObject *to); +DDS_EXPORT void ddsi_xt_get_typeobject_kind_impl (const struct xt_type *xt, struct DDS_XTypes_TypeObject *to, ddsi_typeid_kind_t kind); +DDS_EXPORT void ddsi_xt_get_typeobject (const struct xt_type *xt, ddsi_typeobj_t *to); +DDS_EXPORT void ddsi_xt_type_fini (struct ddsi_domaingv *gv, struct xt_type *xt, bool include_typeid); +DDS_EXPORT bool ddsi_xt_is_assignable_from (struct ddsi_domaingv *gv, const struct xt_type *rd_xt, const struct xt_type *wr_xt, const dds_type_consistency_enforcement_qospolicy_t *tce); +DDS_EXPORT dds_return_t ddsi_xt_validate (struct ddsi_domaingv *gv, const struct xt_type *t); +DDS_EXPORT bool ddsi_xt_is_unresolved (const struct xt_type *t); +DDS_EXPORT bool ddsi_xt_is_resolved (const struct xt_type *t); + +#else /* DDS_HAS_TYPE_DISCOVERY */ + +typedef void ddsi_typeid_t; +typedef int ddsi_typeid_kind_t; +typedef void ddsi_typemap_t; +typedef void ddsi_typeinfo_t; + +#endif /* DDS_HAS_TYPE_DISCOVERY */ + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_TYPEWRAP_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_udp.h b/unitree_SDK/include/dds/ddsi/ddsi_udp.h new file mode 100644 index 0000000..4918477 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_udp.h @@ -0,0 +1,33 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef _DDSI_UDP_H_ +#define _DDSI_UDP_H_ + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct nn_udpv4mcgen_address { + /* base IPv4 MC address is ipv4, host bits are bits base .. base+count-1, this machine is bit idx */ + struct in_addr ipv4; + uint8_t base; + uint8_t count; + uint8_t idx; /* must be last: then sorting will put them consecutively */ +} nn_udpv4mcgen_address_t; + +DDS_EXPORT int ddsi_udp_init (struct ddsi_domaingv *gv); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_vendor.h b/unitree_SDK/include/dds/ddsi/ddsi_vendor.h new file mode 100644 index 0000000..2ad45fc --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_vendor.h @@ -0,0 +1,106 @@ +/* + * Copyright(c) 2019 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_VENDOR_H +#define DDSI_VENDOR_H + +#include +#include + +#include "dds/export.h" + +typedef struct { + uint8_t id[2]; +} nn_vendorid_t; + + +/* All existing vendor codes have the major part equal to 1 (and this will probably be true for a long, long time) */ +#define NN_VENDORID_MINOR_RTI 0x01 +#define NN_VENDORID_MINOR_ADLINK_OSPL 0x02 +#define NN_VENDORID_MINOR_OCI 0x03 +#define NN_VENDORID_MINOR_MILSOFT 0x04 +#define NN_VENDORID_MINOR_KONGSBERG 0x05 +#define NN_VENDORID_MINOR_TWINOAKS 0x06 +#define NN_VENDORID_MINOR_LAKOTA 0x07 +#define NN_VENDORID_MINOR_ICOUP 0x08 +#define NN_VENDORID_MINOR_ETRI 0x09 +#define NN_VENDORID_MINOR_RTI_MICRO 0x0a +#define NN_VENDORID_MINOR_ADLINK_JAVA 0x0b +#define NN_VENDORID_MINOR_ADLINK_GATEWAY 0x0c +#define NN_VENDORID_MINOR_ADLINK_LITE 0x0d +#define NN_VENDORID_MINOR_TECHNICOLOR 0x0e +#define NN_VENDORID_MINOR_EPROSIMA 0x0f +#define NN_VENDORID_MINOR_ECLIPSE 0x10 +#define NN_VENDORID_MINOR_ADLINK_CLOUD 0x20 + +#define NN_VENDORID_INIT(vendor) {{ 0x01, NN_VENDORID_MINOR_##vendor }} +#define NN_VENDORID_INIT_UNKNOWN {{ 0x00, 0x00 }} + +#define NN_VENDORID(vendor) ((nn_vendorid_t) NN_VENDORID_INIT(vendor)) +#define NN_VENDORID_UNKNOWN ((nn_vendorid_t) NN_VENDORID_INIT_UNKNOWN) + +#define NN_VENDORID_ECLIPSE NN_VENDORID(ECLIPSE) + +#if defined (__cplusplus) +extern "C" { +#endif + +DDS_INLINE_EXPORT inline bool vendor_equals (nn_vendorid_t a, nn_vendorid_t b) { + return ((a.id[0] << 8) | a.id[1]) == ((b.id[0] << 8) | b.id[1]); +} +DDS_INLINE_EXPORT inline bool vendor_is_eclipse (nn_vendorid_t vendor) { + const nn_vendorid_t x = NN_VENDORID_INIT (ECLIPSE); + return vendor_equals (vendor, x); +} +DDS_INLINE_EXPORT inline bool vendor_is_rti (nn_vendorid_t vendor) { + const nn_vendorid_t x = NN_VENDORID_INIT (RTI); + return vendor_equals (vendor, x); +} +DDS_INLINE_EXPORT inline bool vendor_is_opensplice (nn_vendorid_t vendor) { + const nn_vendorid_t x = NN_VENDORID_INIT (ADLINK_OSPL); + return vendor_equals (vendor, x); +} +DDS_INLINE_EXPORT inline bool vendor_is_twinoaks (nn_vendorid_t vendor) { + const nn_vendorid_t x = NN_VENDORID_INIT (TWINOAKS); + return vendor_equals (vendor, x); +} +DDS_INLINE_EXPORT inline bool vendor_is_eprosima (nn_vendorid_t vendor) { + const nn_vendorid_t x = NN_VENDORID_INIT (EPROSIMA); + return vendor_equals (vendor, x); +} +DDS_INLINE_EXPORT inline bool vendor_is_cloud (nn_vendorid_t vendor) { + const nn_vendorid_t x = NN_VENDORID_INIT (ADLINK_CLOUD); + return vendor_equals (vendor, x); +} +DDS_INLINE_EXPORT inline bool vendor_is_eclipse_or_opensplice (nn_vendorid_t vendor) { + return vendor_is_eclipse (vendor) || vendor_is_opensplice (vendor); +} +DDS_INLINE_EXPORT inline bool vendor_is_adlink (nn_vendorid_t vendor) { + const nn_vendorid_t a = NN_VENDORID_INIT (ADLINK_OSPL); + const nn_vendorid_t b = NN_VENDORID_INIT (ADLINK_LITE); + const nn_vendorid_t c = NN_VENDORID_INIT (ADLINK_GATEWAY); + const nn_vendorid_t d = NN_VENDORID_INIT (ADLINK_JAVA); + const nn_vendorid_t e = NN_VENDORID_INIT (ADLINK_CLOUD); + return (vendor_equals (vendor, a) || + vendor_equals (vendor, b) || + vendor_equals (vendor, c) || + vendor_equals (vendor, d) || + vendor_equals (vendor, e)); +} +DDS_INLINE_EXPORT inline bool vendor_is_eclipse_or_adlink (nn_vendorid_t vendor) { + return vendor_is_eclipse (vendor) || vendor_is_adlink (vendor); +} + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_VENDOR_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_vnet.h b/unitree_SDK/include/dds/ddsi/ddsi_vnet.h new file mode 100644 index 0000000..d173fbe --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_vnet.h @@ -0,0 +1,25 @@ +/* + * Copyright(c) 2020 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_VNET_H +#define DDSI_VNET_H + +#if defined (__cplusplus) +extern "C" { +#endif + +int ddsi_vnet_init (struct ddsi_domaingv *gv, const char *name, int32_t locator_kind); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/ddsi_wraddrset.h b/unitree_SDK/include/dds/ddsi/ddsi_wraddrset.h new file mode 100644 index 0000000..58fddfd --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_wraddrset.h @@ -0,0 +1,31 @@ +/* + * Copyright(c) 2020 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_WRADDRSET_H +#define DDSI_WRADDRSET_H + +#include +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +struct addrset; +struct ddsi_writer; + +struct addrset *compute_writer_addrset (const struct ddsi_writer *wr); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_WRADDRSET_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_xqos.h b/unitree_SDK/include/dds/ddsi/ddsi_xqos.h new file mode 100644 index 0000000..32397bf --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_xqos.h @@ -0,0 +1,548 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_XQOS_H +#define DDSI_XQOS_H + +#include "dds/features.h" + +#include "dds/ddsc/dds_public_qosdefs.h" +#include "dds/ddsi/q_protocol.h" +#include "dds/ddsi/q_rtps.h" +#include "dds/ddsi/q_log.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_typeinfo; + +typedef struct ddsi_octetseq { + uint32_t length; + unsigned char *value; +} ddsi_octetseq_t; + +typedef ddsi_octetseq_t dds_userdata_qospolicy_t; +typedef ddsi_octetseq_t dds_topicdata_qospolicy_t; +typedef ddsi_octetseq_t dds_groupdata_qospolicy_t; + +typedef struct dds_property { + /* The propagate boolean will not be send over the wire. + * When the value is 'false', the complete struct shouldn't be send. + * It has to be the first variable within the structure because it + * is mapped to XbPROP in the serialiser. */ + unsigned char propagate; + char *name; + char *value; +} dds_property_t; + +typedef struct dds_propertyseq { + uint32_t n; + dds_property_t *props; +} dds_propertyseq_t; + +typedef struct dds_binaryproperty { + /* The propagate boolean will not be send over the wire. + * When the value is 'false', the complete struct shouldn't be send. + * It has to be the first variable within the structure because it + * is mapped to XbPROP in the serialiser. */ + unsigned char propagate; + char *name; + ddsi_octetseq_t value; +} dds_binaryproperty_t; + +typedef struct dds_binarypropertyseq { + uint32_t n; + dds_binaryproperty_t *props; +} dds_binarypropertyseq_t; + +typedef struct dds_property_qospolicy { + dds_propertyseq_t value; + dds_binarypropertyseq_t binary_value; +} dds_property_qospolicy_t; + +typedef struct dds_durability_qospolicy { + dds_durability_kind_t kind; +} dds_durability_qospolicy_t; + +typedef struct dds_history_qospolicy { + dds_history_kind_t kind; + int32_t depth; +} dds_history_qospolicy_t; + +typedef struct dds_resource_limits_qospolicy { + int32_t max_samples; + int32_t max_instances; + int32_t max_samples_per_instance; +} dds_resource_limits_qospolicy_t; + +typedef struct dds_durability_service_qospolicy { + dds_duration_t service_cleanup_delay; + dds_history_qospolicy_t history; + dds_resource_limits_qospolicy_t resource_limits; +} dds_durability_service_qospolicy_t; + +typedef struct dds_external_durability_service_qospolicy { + ddsi_duration_t service_cleanup_delay; + dds_history_qospolicy_t history; + dds_resource_limits_qospolicy_t resource_limits; +} dds_external_durability_service_qospolicy_t; + +typedef struct dds_presentation_qospolicy { + dds_presentation_access_scope_kind_t access_scope; + unsigned char coherent_access; + unsigned char ordered_access; +} dds_presentation_qospolicy_t; + +typedef struct dds_deadline_qospolicy { + dds_duration_t deadline; +} dds_deadline_qospolicy_t; + +typedef struct dds_external_deadline_qospolicy { + ddsi_duration_t deadline; +} dds_external_deadline_qospolicy_t; + +typedef struct dds_latency_budget_qospolicy { + dds_duration_t duration; +} dds_latency_budget_qospolicy_t; + +typedef struct dds_external_latency_budget_qospolicy { + ddsi_duration_t duration; +} dds_external_latency_budget_qospolicy_t; + +typedef struct dds_ownership_qospolicy { + dds_ownership_kind_t kind; +} dds_ownership_qospolicy_t; + +typedef struct dds_ownership_strength_qospolicy { + int32_t value; +} dds_ownership_strength_qospolicy_t; + +typedef struct dds_liveliness_qospolicy { + dds_liveliness_kind_t kind; + dds_duration_t lease_duration; +} dds_liveliness_qospolicy_t; + +typedef struct dds_external_liveliness_qospolicy { + dds_liveliness_kind_t kind; + ddsi_duration_t lease_duration; +} dds_external_liveliness_qospolicy_t; + +typedef struct dds_time_based_filter_qospolicy { + dds_duration_t minimum_separation; +} dds_time_based_filter_qospolicy_t; + +typedef struct dds_external_time_based_filter_qospolicy { + ddsi_duration_t minimum_separation; +} dds_external_time_based_filter_qospolicy_t; + +typedef struct ddsi_stringseq { + uint32_t n; + char **strs; +} ddsi_stringseq_t; + +typedef ddsi_stringseq_t dds_partition_qospolicy_t; + +typedef struct dds_reliability_qospolicy { + dds_reliability_kind_t kind; + dds_duration_t max_blocking_time; +} dds_reliability_qospolicy_t; + +typedef enum dds_external_reliability_kind { + DDS_EXTERNAL_RELIABILITY_BEST_EFFORT = 1, + DDS_EXTERNAL_RELIABILITY_RELIABLE = 2 +} dds_external_reliability_kind_t; + +typedef struct dds_external_reliability_qospolicy { + dds_external_reliability_kind_t kind; + ddsi_duration_t max_blocking_time; +} dds_external_reliability_qospolicy_t; + +typedef struct dds_transport_priority_qospolicy { + int32_t value; +} dds_transport_priority_qospolicy_t; + +typedef struct dds_lifespan_qospolicy { + dds_duration_t duration; +} dds_lifespan_qospolicy_t; + +typedef struct dds_external_lifespan_qospolicy { + ddsi_duration_t duration; +} dds_external_lifespan_qospolicy_t; + +typedef struct dds_destination_order_qospolicy { + dds_destination_order_kind_t kind; +} dds_destination_order_qospolicy_t; + +typedef struct dds_entity_factory_qospolicy { + unsigned char autoenable_created_entities; +} dds_entity_factory_qospolicy_t; + +typedef struct dds_writer_data_lifecycle_qospolicy { + unsigned char autodispose_unregistered_instances; +} dds_writer_data_lifecycle_qospolicy_t; + +typedef struct dds_reader_data_lifecycle_qospolicy { + dds_duration_t autopurge_nowriter_samples_delay; + dds_duration_t autopurge_disposed_samples_delay; +} dds_reader_data_lifecycle_qospolicy_t; + +typedef struct dds_external_reader_data_lifecycle_qospolicy { + ddsi_duration_t autopurge_nowriter_samples_delay; + ddsi_duration_t autopurge_disposed_samples_delay; +} dds_external_reader_data_lifecycle_qospolicy_t; + +typedef struct dds_subscription_keys_qospolicy { + unsigned char use_key_list; + ddsi_stringseq_t key_list; +} dds_subscription_keys_qospolicy_t; + +typedef struct dds_reader_lifespan_qospolicy { + unsigned char use_lifespan; + dds_duration_t duration; +} dds_reader_lifespan_qospolicy_t; + +typedef struct dds_external_reader_lifespan_qospolicy { + unsigned char use_lifespan; + ddsi_duration_t duration; +} dds_external_reader_lifespan_qospolicy_t; + +typedef struct dds_ignorelocal_qospolicy { + dds_ignorelocal_kind_t value; +} dds_ignorelocal_qospolicy_t; + +typedef struct dds_type_consistency_enforcement_qospolicy { + dds_type_consistency_kind_t kind; + bool ignore_sequence_bounds; + bool ignore_string_bounds; + bool ignore_member_names; + bool prevent_type_widening; + bool force_type_validation; +} dds_type_consistency_enforcement_qospolicy_t; + +typedef uint32_t dds_locator_mask_t; + +typedef struct dds_data_representation_id_seq { + uint32_t n; + dds_data_representation_id_t *ids; +} dds_data_representation_id_seq_t; + +typedef struct dds_data_representation_qospolicy { + dds_data_representation_id_seq_t value; +} dds_data_representation_qospolicy_t; + + +/***/ + +/* Qos Present bit indices */ +#define QP_TOPIC_NAME ((uint64_t)1 << 0) +#define QP_TYPE_NAME ((uint64_t)1 << 1) +#define QP_PRESENTATION ((uint64_t)1 << 2) +#define QP_PARTITION ((uint64_t)1 << 3) +#define QP_GROUP_DATA ((uint64_t)1 << 4) +#define QP_TOPIC_DATA ((uint64_t)1 << 5) +#define QP_DURABILITY ((uint64_t)1 << 6) +#define QP_DURABILITY_SERVICE ((uint64_t)1 << 7) +#define QP_DEADLINE ((uint64_t)1 << 8) +#define QP_LATENCY_BUDGET ((uint64_t)1 << 9) +#define QP_LIVELINESS ((uint64_t)1 << 10) +#define QP_RELIABILITY ((uint64_t)1 << 11) +#define QP_DESTINATION_ORDER ((uint64_t)1 << 12) +#define QP_HISTORY ((uint64_t)1 << 13) +#define QP_RESOURCE_LIMITS ((uint64_t)1 << 14) +#define QP_TRANSPORT_PRIORITY ((uint64_t)1 << 15) +#define QP_LIFESPAN ((uint64_t)1 << 16) +#define QP_USER_DATA ((uint64_t)1 << 17) +#define QP_OWNERSHIP ((uint64_t)1 << 18) +#define QP_OWNERSHIP_STRENGTH ((uint64_t)1 << 19) +#define QP_TIME_BASED_FILTER ((uint64_t)1 << 20) +#define QP_ADLINK_WRITER_DATA_LIFECYCLE ((uint64_t)1 << 21) +#define QP_ADLINK_READER_DATA_LIFECYCLE ((uint64_t)1 << 22) +#define QP_ADLINK_READER_LIFESPAN ((uint64_t)1 << 24) +#define QP_ADLINK_SUBSCRIPTION_KEYS ((uint64_t)1 << 25) +#define QP_ADLINK_ENTITY_FACTORY ((uint64_t)1 << 27) +#define QP_CYCLONE_IGNORELOCAL ((uint64_t)1 << 30) +#define QP_PROPERTY_LIST ((uint64_t)1 << 31) +#define QP_TYPE_CONSISTENCY_ENFORCEMENT ((uint64_t)1 << 32) +#define QP_TYPE_INFORMATION ((uint64_t)1 << 33) +#define QP_LOCATOR_MASK ((uint64_t)1 << 34) +#define QP_DATA_REPRESENTATION ((uint64_t)1 << 35) +#define QP_ENTITY_NAME ((uint64_t)1 << 36) + + +/* Partition QoS is not RxO according to the specification (DDS 1.2, + section 7.1.3), but communication will not take place unless it + matches. Same for topic and type. Relaxed qos matching is a bit of + a weird one, but it affects matching, so ... */ +#define QP_RXO_MASK (QP_DURABILITY | QP_PRESENTATION | QP_DEADLINE | QP_LATENCY_BUDGET | QP_OWNERSHIP | QP_LIVELINESS | QP_RELIABILITY | QP_DESTINATION_ORDER | QP_DATA_REPRESENTATION) +#define QP_CHANGEABLE_MASK (QP_USER_DATA | QP_TOPIC_DATA | QP_GROUP_DATA | QP_DEADLINE | QP_LATENCY_BUDGET | QP_OWNERSHIP_STRENGTH | QP_TIME_BASED_FILTER | QP_PARTITION | QP_TRANSPORT_PRIORITY | QP_LIFESPAN | QP_ADLINK_ENTITY_FACTORY | QP_ADLINK_WRITER_DATA_LIFECYCLE | QP_ADLINK_READER_DATA_LIFECYCLE) +#define QP_UNRECOGNIZED_INCOMPATIBLE_MASK ((uint64_t) 0) + +/* readers & writers have an extended qos, hence why it is a separate + type */ +struct dds_qos { + /* Entries present, for sparse QoS */ + uint64_t present; + uint64_t aliased; + + /*v---- in ...Qos + v--- in ...BuiltinTopicData + v-- mapped in DDSI + v- reader/writer/publisher/subscriber/participant specific */ + /* Extras: */ + /* xx */char *topic_name; + /* xx */char *type_name; + /* xx */char *entity_name; +#ifdef DDS_HAS_TYPE_DISCOVERY + /* xx */struct ddsi_typeinfo *type_information; +#endif + /* PublisherQos, SubscriberQos: */ + /*xxx */dds_presentation_qospolicy_t presentation; + /*xxx */dds_partition_qospolicy_t partition; + /*xxx */dds_groupdata_qospolicy_t group_data; + /*x xX*/dds_entity_factory_qospolicy_t entity_factory; + /* TopicQos: */ + /*xxx */dds_topicdata_qospolicy_t topic_data; + /* DataWriterQos, DataReaderQos: */ + /*xxx */dds_durability_qospolicy_t durability; + /*xxx */dds_durability_service_qospolicy_t durability_service; + /*xxx */dds_deadline_qospolicy_t deadline; + /*xxx */dds_latency_budget_qospolicy_t latency_budget; + /*xxx */dds_liveliness_qospolicy_t liveliness; + /*xxx */dds_reliability_qospolicy_t reliability; + /*xxx */dds_destination_order_qospolicy_t destination_order; + /*x x */dds_history_qospolicy_t history; + /*x x */dds_resource_limits_qospolicy_t resource_limits; + /*x x */dds_transport_priority_qospolicy_t transport_priority; + /*xxx */dds_lifespan_qospolicy_t lifespan; + /*xxx */dds_userdata_qospolicy_t user_data; + /*xxx */dds_ownership_qospolicy_t ownership; + /*xxxW*/dds_ownership_strength_qospolicy_t ownership_strength; + /*xxxR*/dds_time_based_filter_qospolicy_t time_based_filter; + /*x W*/dds_writer_data_lifecycle_qospolicy_t writer_data_lifecycle; + /*x xR*/dds_reader_data_lifecycle_qospolicy_t reader_data_lifecycle; + /*x xR*/dds_subscription_keys_qospolicy_t subscription_keys; + /*x xR*/dds_reader_lifespan_qospolicy_t reader_lifespan; + /* x */dds_ignorelocal_qospolicy_t ignorelocal; + /*xxx */dds_property_qospolicy_t property; + /*xxxR*/dds_type_consistency_enforcement_qospolicy_t type_consistency; + /*xxxX*/dds_locator_mask_t ignore_locator_type; + /*xxx */dds_data_representation_qospolicy_t data_representation; +}; + +struct nn_xmsg; + +DDS_EXPORT extern const dds_qos_t ddsi_default_qos_reader; +DDS_EXPORT extern const dds_qos_t ddsi_default_qos_writer; +DDS_EXPORT extern const dds_qos_t ddsi_default_qos_topic; +DDS_EXPORT extern const dds_qos_t ddsi_default_qos_publisher_subscriber; + +/** + * @brief Initialize a new empty dds_qos_t as an empty object + * + * In principle, this only clears the "present" and "aliased" bitmasks. A debug build + * additionally initializes all other bytes to 0x55. + * + * @param[out] xqos qos object to be initialized. + */ +DDS_EXPORT void ddsi_xqos_init_empty (dds_qos_t *xqos); + +/** + * @brief Copy "src" to "dst" + * + * @param[out] dst destination, any contents are overwritten + * @param[in] src source dds_qos_t + */ +DDS_EXPORT void ddsi_xqos_copy (dds_qos_t *dst, const dds_qos_t *src); + +/** + * @brief Replace any memory "xqos" aliases by copies it owns + * + * A dds_qos_t may can reference other memory without owning it. This functions allows + * one to replace any such aliased memory by copies, allowing one to free the original + * copy. + * + * @param[in,out] xqos qos object for which to replace all aliased memory by owned + * copies + */ +DDS_EXPORT void ddsi_xqos_unalias (dds_qos_t *xqos); + +/** + * @brief Free memory owned by "xqos" + * + * A dds_qos_t may own other allocated blocks of memory, depending on which fields are + * set, their types and whether they are marked as "aliased". This function releases any + * such memory owned by "xqos", but not "xqos" itself. Afterward, the content of "xqos" + * is undefined and must not be used again without initialising it. + * + * @param[in] xqos dds_qos_t for which to free memory + */ +DDS_EXPORT void ddsi_xqos_fini (dds_qos_t *xqos); + +/** + * @brief Free memory owned by "xqos" for a subset of the entries + * + * A dds_qos_t may own other allocated blocks of memory, depending on which fields are + * set, their types and whether they are marked as "aliased". This function releases any + * such memory owned by "xqos" for entries included in "mask". The "present" and + * "aliased" bits are cleared accordingly. + * + * @param[in,out] xqos dds_qos_t for which to free memory + * @param[in] mask entries to free (if QP_X is set, free X if present) + */ +DDS_EXPORT void ddsi_xqos_fini_mask (dds_qos_t *xqos, uint64_t mask); + +/** + * @brief Check whether xqos is valid according to the validation rules in the spec + * + * The checks concern the values for the individual fields as well as a few combinations + * of fields. Only those that are set are checked (the defaults are all valid anyway), + * and where a combination of fields must be checked and some but not all fields are + * specified, it uses the defaults for the missing ones. + * + * Invalid values get logged as category "plist" according to the specified logging + * configuration. + * + * @param[in] logcfg logging configuration + * @param[in] xqos qos object to check + * + * @returns DDS_RETCODE_OK or DDS_RETCODE_BAD_PARAMETER + */ +DDS_EXPORT dds_return_t ddsi_xqos_valid (const struct ddsrt_log_cfg *logcfg, const dds_qos_t *xqos); + +/** + * @brief Extend "a" with selected entries present in "b" + * + * This copies into "a" any entries present in "b" that are included in "mask" and missing + * in "a". It doesn't touch any entries already present in "a". Calling this on an empty + * "a" with all bits set in "mask" is equivalent to copying "b" into "a"; calling this + * with "mask" 0 copies nothing. + * + * @param[in,out] a dds_qos_t to be extended + * @param[in] b dds_qos_t from which to copy entries + * @param[in] mask which to include (if QP_X is set, include X) + */ +DDS_EXPORT void ddsi_xqos_mergein_missing (dds_qos_t *a, const dds_qos_t *b, uint64_t mask); + +/** + * @brief Determine the set of entries in which "x" differs from "y" + * + * This computes the entries set in "x" but not set in "y", not set in "x" but set in "y", + * or set in both "x" and "y" but to a different value. It returns this set reduced to + * only those included in "mask", that is, if bit X is clear in "mask", bit X will be + * clear in the result. + * + * @param[in] a one of the two plists to compare + * @param[in] b other plist to compare + * @param[in] mask subset of entries to be compared + * + * @returns Bitmask of differences + */ +DDS_EXPORT uint64_t ddsi_xqos_delta (const dds_qos_t *a, const dds_qos_t *b, uint64_t mask); + +/** + * @brief Add selected entries in "xqos" to a message in native endianness. + * + * This functions appends to "xqos" a serialized copy of the the entries selected by + * "wanted" and present in "xqos". Each copy is preceded by a 4-byte header with a + * parameter id and length (conform the PL_CDR representation). It does *not* add a + * sentinel to allow adding additional data to the parameter list. A sentinel can be + * added using `nn_xmsg_addpar_sentinel`. + * + * @param[in,out] m message to append the parameters to + * @param[in] xqos source + * @param[in] wanted subset to be added (if QP_X is set, add X if present) + */ +DDS_EXPORT void ddsi_xqos_addtomsg (struct nn_xmsg *m, const dds_qos_t *xqos, uint64_t wanted); + +/** + * @brief Formats xqos using `ddsi_xqos_print` and writes it to the trace. + * + * @param[in] cat log category to use + * @param[in] logcfg logging configuration + * @param[in] xqos qos object to be logged + */ +DDS_EXPORT void ddsi_xqos_log (uint32_t cat, const struct ddsrt_log_cfg *logcfg, const dds_qos_t *xqos); + +/** + * @brief Formats xqos into a buffer + * + * The representation is somewhat cryptic as all enumerated types are dumped as numbers + * and timestamps are durations as nanoseconds with "infinite" represented as + * 9223372036854775807 (INT64_MAX). + * + * @param[out] buf buffer to store the formatted representation in + * @param[in] bufsize size of buffer, if > 0, there will be a terminating 0 in buf on + * return + * @param[in] xqos parameter list to be formatted as a string + * + * @returns number of bytes written to buf, excluding a terminating 0. + */ +DDS_EXPORT size_t ddsi_xqos_print (char * __restrict buf, size_t bufsize, const dds_qos_t *xqos); + +/** + * @brief Add a property 'name' to the properties of "xqos" if it does not exists + * + * @param[in] xqos qos object to add property to. + * @param[in] propagate whether to propagate (emit to wire) the property + * @param[in] name property name + * @param[in] value property value + * + * @returns true iff xqos was modified (property did not exist yet) + */ +DDS_EXPORT bool ddsi_xqos_add_property_if_unset (dds_qos_t *xqos, bool propagate, const char *name, const char *value); + +/** + * @brief Duplicate "src" + * + * @param[in] src dds_qos_t to be duplicated + * + * @returns a new (allocated using ddsrt_malloc) dds_qos_t containing a copy of "src". + */ +DDS_EXPORT dds_qos_t *ddsi_xqos_dup (const dds_qos_t *src); + +/** + * @brief Check if "xqos" includes properties with a name starting with "nameprefix" + * + * That is, if xqos.present has QP_PROPERTY_LIST set, and at least one of them has a name + * starting with "nameprefix". + * + * @param[in] xqos qos object to check + * @param[in] nameprefix prefix to check for + * + * @returns true iff xqos contains a matching property + */ +DDS_EXPORT bool ddsi_xqos_has_prop_prefix (const dds_qos_t *xqos, const char *nameprefix); + +/** + * @brief Lookup property "name" in "xqos" and return a pointer to its value + * + * The value pointer is left unchanged if the property doesn't exist. The returned + * address points into the memory owned by the QoS object and must not be freed. + * + * @param[in] xqos qos object to check + * @param[in] name name to look for + * @param[out] value pointer to set to the value of the property if it exists + * + * @returns true iff xqos contains the property + */ +DDS_EXPORT bool ddsi_xqos_find_prop (const dds_qos_t *xqos, const char *name, const char **value); + +#ifdef DDS_HAS_SECURITY +struct ddsi_config_omg_security; +DDS_EXPORT void ddsi_xqos_mergein_security_config (dds_qos_t *xqos, const struct ddsi_config_omg_security *cfg); +#endif + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_XQOS_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_xt_impl.h b/unitree_SDK/include/dds/ddsi/ddsi_xt_impl.h new file mode 100644 index 0000000..b61280d --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_xt_impl.h @@ -0,0 +1,314 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSI_XT_IMPL_H +#define DDSI_XT_IMPL_H + +#include "dds/features.h" + +#include +#include +#include "dds/ddsrt/avl.h" +#include "dds/ddsrt/misc.h" +#include "dds/ddsi/ddsi_xt_typeinfo.h" +#include "dds/ddsi/ddsi_xt_typemap.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#define PTYPEIDFMT "[%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x]" +#define PHASH(x, n) ((x)._d == DDS_XTypes_EK_MINIMAL || (x)._d == DDS_XTypes_EK_COMPLETE ? (x)._u.equivalence_hash[(n)] : 0) +#define PTYPEID(x) (ddsi_typekind_descr((x)._d)), PHASH((x), 0), PHASH(x, 1), PHASH((x), 2), PHASH((x), 3), PHASH((x), 4), PHASH((x), 5), PHASH((x), 6), PHASH((x), 7), PHASH((x), 8), PHASH((x), 9), PHASH((x), 10), PHASH((x), 11), PHASH((x), 12), PHASH((x), 13) + +#define NOARG +DDSI_LIST_TYPES_TMPL(ddsi_type_proxy_guid_list, ddsi_guid_t, NOARG, 32) +#undef NOARG + +struct ddsi_typeid { + struct DDS_XTypes_TypeIdentifier x; +}; + +struct ddsi_typeobj { + struct DDS_XTypes_TypeObject x; +}; + +struct ddsi_typeinfo { + struct DDS_XTypes_TypeInformation x; +}; + +struct ddsi_typemap { + struct DDS_XTypes_TypeMapping x; +}; + +struct xt_applied_type_annotations { + struct DDS_XTypes_AppliedBuiltinTypeAnnotations *ann_builtin; + struct DDS_XTypes_AppliedAnnotationSeq *ann_custom; +}; + +struct xt_applied_member_annotations { + struct DDS_XTypes_AppliedBuiltinMemberAnnotations *ann_builtin; + struct DDS_XTypes_AppliedAnnotationSeq *ann_custom; +}; + +struct xt_type_detail { + DDS_XTypes_QualifiedTypeName type_name; + struct xt_applied_type_annotations annotations; +}; + +struct xt_member_detail { + DDS_XTypes_MemberName name; + DDS_XTypes_NameHash name_hash; + struct xt_applied_member_annotations annotations; +}; + +struct xt_string { + DDS_XTypes_LBound bound; +}; + +struct xt_collection_common { + DDS_XTypes_CollectionTypeFlag flags; + DDS_XTypes_EquivalenceKind ek; + struct xt_type_detail detail; + struct ddsi_type *element_type; + DDS_XTypes_CollectionElementFlag element_flags; + struct xt_applied_member_annotations element_annotations; +}; + +struct xt_seq { + struct xt_collection_common c; + DDS_XTypes_LBound bound; +}; + +struct xt_array { + struct xt_collection_common c; + struct DDS_XTypes_LBoundSeq bounds; +}; + +struct xt_map { + struct xt_collection_common c; + DDS_XTypes_LBound bound; + DDS_XTypes_CollectionElementFlag key_flags; + struct ddsi_type *key_type; + struct xt_applied_member_annotations key_annotations; +}; + +struct xt_alias { + struct ddsi_type *related_type; + DDS_XTypes_AliasTypeFlag flags; + DDS_XTypes_AliasMemberFlag related_flags; + struct xt_type_detail detail; +}; + +struct xt_annotation_parameter { + struct ddsi_type *member_type; + DDS_XTypes_AnnotationParameterFlag flags; + DDS_XTypes_MemberName name; + DDS_XTypes_NameHash name_hash; + struct DDS_XTypes_AnnotationParameterValue default_value; +}; +struct xt_annotation_parameter_seq { + uint32_t length; + struct xt_annotation_parameter *seq; +}; +struct xt_annotation { + DDS_XTypes_QualifiedTypeName annotation_name; + struct xt_annotation_parameter_seq *members; +}; + +struct xt_struct_member { + DDS_XTypes_MemberId id; + DDS_XTypes_StructMemberFlag flags; + struct ddsi_type *type; + struct xt_member_detail detail; +}; +struct xt_struct_member_seq { + uint32_t length; + struct xt_struct_member *seq; +}; +struct xt_struct { + DDS_XTypes_StructTypeFlag flags; + struct ddsi_type *base_type; + struct xt_struct_member_seq members; + struct xt_type_detail detail; +}; + +struct xt_union_member { + DDS_XTypes_MemberId id; + DDS_XTypes_UnionMemberFlag flags; + struct ddsi_type *type; + struct DDS_XTypes_UnionCaseLabelSeq label_seq; + struct xt_member_detail detail; +}; +struct xt_union_member_seq { + uint32_t length; + struct xt_union_member *seq; +}; +struct xt_union { + DDS_XTypes_UnionTypeFlag flags; + struct ddsi_type *disc_type; + DDS_XTypes_UnionDiscriminatorFlag disc_flags; + struct xt_applied_type_annotations disc_annotations; + struct xt_union_member_seq members; + struct xt_type_detail detail; +}; + +struct xt_bitfield { + uint16_t position; + DDS_XTypes_BitsetMemberFlag flags; + uint8_t bitcount; + DDS_XTypes_TypeKind holder_type; // Must be primitive integer type + struct xt_member_detail detail; +}; +struct xt_bitfield_seq { + uint32_t length; + struct xt_bitfield *seq; +}; +struct xt_bitset { + DDS_XTypes_BitsetTypeFlag flags; + struct xt_bitfield_seq fields; + struct xt_type_detail detail; +}; + +struct xt_enum_literal { + int32_t value; + DDS_XTypes_EnumeratedLiteralFlag flags; + struct xt_member_detail detail; +}; +struct xt_enum_literal_seq { + uint32_t length; + struct xt_enum_literal *seq; +}; +struct xt_enum { + DDS_XTypes_EnumTypeFlag flags; + DDS_XTypes_BitBound bit_bound; + struct xt_enum_literal_seq literals; + struct xt_type_detail detail; +}; + +struct xt_bitflag { + uint16_t position; + DDS_XTypes_BitflagFlag flags; + struct xt_member_detail detail; +}; +struct xt_bitflag_seq { + uint32_t length; + struct xt_bitflag *seq; +}; +struct xt_bitmask { + DDS_XTypes_BitmaskTypeFlag flags; + DDS_XTypes_BitBound bit_bound; + struct xt_bitflag_seq bitflags; + struct xt_type_detail detail; +}; + +struct xt_type +{ + ddsi_typeid_t id; + ddsi_typeid_kind_t kind; + struct DDS_XTypes_StronglyConnectedComponentId sc_component_id; + + uint8_t _d; + union { + // case TK_NONE: + // case TK_BOOLEAN: + // case TK_BYTE: + // case TK_INT16: + // case TK_INT32: + // case TK_INT64: + // case TK_UINT8: + // case TK_UINT16: + // case TK_UINT32: + // case TK_UINT64: + // case TK_FLOAT32: + // case TK_FLOAT64: + // case TK_FLOAT128: + // case TK_CHAR8: + // case TK_CHAR16: + // + // case TK_STRING8: + struct xt_string str8; + // case TK_STRING16: + struct xt_string str16; + // case TK_SEQUENCE: + struct xt_seq seq; + // case TK_ARRAY: + struct xt_array array; + // case TK_MAP: + struct xt_map map; + // case TK_ALIAS: + struct xt_alias alias; + // case TK_ANNOTATION: + struct xt_annotation annotation; + // case TK_STRUCTURE: + struct xt_struct structure; + // case TK_UNION: + struct xt_union union_type; + // case TK_BITSET: + struct xt_bitset bitset; + // case TK_ENUM: + struct xt_enum enum_type; + // case TK_BITMASK: + struct xt_bitmask bitmask; + } _u; +}; + +/* Type identifier must at offset 0, see comment for ddsi_type */ +DDSRT_STATIC_ASSERT (offsetof (struct xt_type, id) == 0); + +struct ddsi_type_dep { + ddsrt_avl_node_t src_avl_node; + ddsrt_avl_node_t dep_avl_node; + ddsi_typeid_t src_type_id; // type that has the dependency on dep_type_id + ddsi_typeid_t dep_type_id; // dependent type, a direct or indirect dependency of src_type_id + bool from_type_info; // entry was added based on a dependent type in the type-info, requires unref of the dependent type on deletion +}; + +struct ddsi_type { + struct xt_type xt; /* wrapper for XTypes type id/obj */ + ddsrt_avl_node_t avl_node; + enum ddsi_type_state state; + seqno_t request_seqno; /* sequence number of the last type lookup request message */ + struct ddsi_type_proxy_guid_list proxy_guids; /* administration for proxy endpoints (not proxy topics) that are using this type */ + uint32_t refc; /* refcount for this record */ +}; + +/* The xt_type member must be at offset 0 so that the type identifier field + in this type is at offset 0, and a ddsi_type can be used for hash table lookup + without copying the type identifier in the search template */ +DDSRT_STATIC_ASSERT (offsetof (struct ddsi_type, xt) == 0); + +DDS_EXPORT char *ddsi_make_typeid_str_impl (struct ddsi_typeid_str *buf, const DDS_XTypes_TypeIdentifier *type_id); +DDS_EXPORT int ddsi_typeid_compare_impl (const struct DDS_XTypes_TypeIdentifier *a, const struct DDS_XTypes_TypeIdentifier *b); +DDS_EXPORT void ddsi_typeid_fini_impl (struct DDS_XTypes_TypeIdentifier *type_id); + +DDS_EXPORT void ddsi_typeid_copy_impl (struct DDS_XTypes_TypeIdentifier *dst, const struct DDS_XTypes_TypeIdentifier *src); +DDS_EXPORT void ddsi_typeid_copy_to_impl (struct DDS_XTypes_TypeIdentifier *dst, const ddsi_typeid_t *src); +DDS_EXPORT struct DDS_XTypes_TypeIdentifier * ddsi_typeid_dup_impl (const struct DDS_XTypes_TypeIdentifier *src); +DDS_EXPORT ddsi_typeid_t * ddsi_typeid_dup_from_impl (const struct DDS_XTypes_TypeIdentifier *src); +DDS_EXPORT bool ddsi_typeid_is_none_impl (const struct DDS_XTypes_TypeIdentifier *type_id); + +DDS_EXPORT void ddsi_xt_get_typeobject_impl (const struct xt_type *xt, struct DDS_XTypes_TypeObject *to); +DDS_EXPORT dds_return_t ddsi_type_ref_id_locked_impl (struct ddsi_domaingv *gv, struct ddsi_type **type, const struct DDS_XTypes_TypeIdentifier *type_id); +DDS_EXPORT struct ddsi_type * ddsi_type_lookup_locked_impl (struct ddsi_domaingv *gv, const struct DDS_XTypes_TypeIdentifier *type_id); +DDS_EXPORT const struct DDS_XTypes_TypeObject * ddsi_typemap_typeobj (const ddsi_typemap_t *tmap, const struct DDS_XTypes_TypeIdentifier *type_id); + +DDS_EXPORT bool ddsi_typeid_is_hash_impl (const struct DDS_XTypes_TypeIdentifier *type_id); +DDS_EXPORT bool ddsi_typeid_is_minimal_impl (const struct DDS_XTypes_TypeIdentifier *type_id); +DDS_EXPORT bool ddsi_typeid_is_complete_impl (const struct DDS_XTypes_TypeIdentifier *type_id); +DDS_EXPORT void ddsi_typeobj_fini_impl (struct DDS_XTypes_TypeObject *typeobj); +DDS_EXPORT dds_return_t ddsi_xt_type_init_impl (struct ddsi_domaingv *gv, struct xt_type *xt, const struct DDS_XTypes_TypeIdentifier *ti, const struct DDS_XTypes_TypeObject *to); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSI_XT_IMPL_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_xt_typeinfo.h b/unitree_SDK/include/dds/ddsi/ddsi_xt_typeinfo.h new file mode 100644 index 0000000..1424200 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_xt_typeinfo.h @@ -0,0 +1,1304 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to C Translator + File name: ddsi_xt_typeinfo.h + Source: ddsi_xt_typeinfo.idl + Cyclone DDS: V0.9.0 + +*****************************************************************/ +#ifndef DDSI_XT_TYPEINFO_H +#define DDSI_XT_TYPEINFO_H + +#include "dds/ddsc/dds_public_impl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint8_t DDS_XTypes_EquivalenceKind; + +#define DDS_XTypes_EquivalenceKind__alloc() \ +((DDS_XTypes_EquivalenceKind*) dds_alloc (sizeof (DDS_XTypes_EquivalenceKind))); + +#define DDS_XTypes_EK_MINIMAL 241 +#define DDS_XTypes_EK_COMPLETE 242 +#define DDS_XTypes_EK_BOTH 243 +typedef uint8_t DDS_XTypes_TypeKind; + +#define DDS_XTypes_TypeKind__alloc() \ +((DDS_XTypes_TypeKind*) dds_alloc (sizeof (DDS_XTypes_TypeKind))); + +#define DDS_XTypes_TK_NONE 0 +#define DDS_XTypes_TK_BOOLEAN 1 +#define DDS_XTypes_TK_BYTE 2 +#define DDS_XTypes_TK_INT16 3 +#define DDS_XTypes_TK_INT32 4 +#define DDS_XTypes_TK_INT64 5 +#define DDS_XTypes_TK_UINT16 6 +#define DDS_XTypes_TK_UINT32 7 +#define DDS_XTypes_TK_UINT64 8 +#define DDS_XTypes_TK_FLOAT32 9 +#define DDS_XTypes_TK_FLOAT64 10 +#define DDS_XTypes_TK_FLOAT128 11 +#define DDS_XTypes_TK_CHAR8 16 +#define DDS_XTypes_TK_CHAR16 17 +#define DDS_XTypes_TK_STRING8 32 +#define DDS_XTypes_TK_STRING16 33 +#define DDS_XTypes_TK_ALIAS 48 +#define DDS_XTypes_TK_ENUM 64 +#define DDS_XTypes_TK_BITMASK 65 +#define DDS_XTypes_TK_ANNOTATION 80 +#define DDS_XTypes_TK_STRUCTURE 81 +#define DDS_XTypes_TK_UNION 82 +#define DDS_XTypes_TK_BITSET 83 +#define DDS_XTypes_TK_SEQUENCE 96 +#define DDS_XTypes_TK_ARRAY 97 +#define DDS_XTypes_TK_MAP 98 +typedef uint8_t DDS_XTypes_TypeIdentiferKind; + +#define DDS_XTypes_TypeIdentiferKind__alloc() \ +((DDS_XTypes_TypeIdentiferKind*) dds_alloc (sizeof (DDS_XTypes_TypeIdentiferKind))); + +#define DDS_XTypes_TI_STRING8_SMALL 112 +#define DDS_XTypes_TI_STRING8_LARGE 113 +#define DDS_XTypes_TI_STRING16_SMALL 114 +#define DDS_XTypes_TI_STRING16_LARGE 115 +#define DDS_XTypes_TI_PLAIN_SEQUENCE_SMALL 128 +#define DDS_XTypes_TI_PLAIN_SEQUENCE_LARGE 129 +#define DDS_XTypes_TI_PLAIN_ARRAY_SMALL 144 +#define DDS_XTypes_TI_PLAIN_ARRAY_LARGE 145 +#define DDS_XTypes_TI_PLAIN_MAP_SMALL 160 +#define DDS_XTypes_TI_PLAIN_MAP_LARGE 161 +#define DDS_XTypes_TI_STRONGLY_CONNECTED_COMPONENT 176 +#define DDS_XTypes_MEMBER_NAME_MAX_LENGTH 256 +typedef char DDS_XTypes_MemberName[257]; + +#define DDS_XTypes_MemberName__alloc() \ +((DDS_XTypes_MemberName*) dds_alloc (sizeof (DDS_XTypes_MemberName))); + +#define DDS_XTypes_TYPE_NAME_MAX_LENGTH 256 +typedef char DDS_XTypes_QualifiedTypeName[257]; + +#define DDS_XTypes_QualifiedTypeName__alloc() \ +((DDS_XTypes_QualifiedTypeName*) dds_alloc (sizeof (DDS_XTypes_QualifiedTypeName))); + +typedef uint8_t DDS_XTypes_PrimitiveTypeId; + +#define DDS_XTypes_PrimitiveTypeId__alloc() \ +((DDS_XTypes_PrimitiveTypeId*) dds_alloc (sizeof (DDS_XTypes_PrimitiveTypeId))); + +typedef uint8_t DDS_XTypes_EquivalenceHash[14]; + +#define DDS_XTypes_EquivalenceHash__alloc() \ +((DDS_XTypes_EquivalenceHash*) dds_alloc (sizeof (DDS_XTypes_EquivalenceHash))); + +typedef uint8_t DDS_XTypes_NameHash[4]; + +#define DDS_XTypes_NameHash__alloc() \ +((DDS_XTypes_NameHash*) dds_alloc (sizeof (DDS_XTypes_NameHash))); + +typedef uint32_t DDS_XTypes_LBound; + +#define DDS_XTypes_LBound__alloc() \ +((DDS_XTypes_LBound*) dds_alloc (sizeof (DDS_XTypes_LBound))); + +typedef struct DDS_XTypes_LBoundSeq +{ + uint32_t _maximum; + uint32_t _length; + DDS_XTypes_LBound *_buffer; + bool _release; +} DDS_XTypes_LBoundSeq; + +#define DDS_XTypes_LBoundSeq__alloc() \ +((DDS_XTypes_LBoundSeq*) dds_alloc (sizeof (DDS_XTypes_LBoundSeq))); + +#define DDS_XTypes_LBoundSeq_allocbuf(l) \ +((DDS_XTypes_LBound *) dds_alloc ((l) * sizeof (DDS_XTypes_LBound))) +#define DDS_XTypes_INVALID_LBOUND 0 +typedef uint8_t DDS_XTypes_SBound; + +#define DDS_XTypes_SBound__alloc() \ +((DDS_XTypes_SBound*) dds_alloc (sizeof (DDS_XTypes_SBound))); + +typedef struct DDS_XTypes_SBoundSeq +{ + uint32_t _maximum; + uint32_t _length; + DDS_XTypes_SBound *_buffer; + bool _release; +} DDS_XTypes_SBoundSeq; + +#define DDS_XTypes_SBoundSeq__alloc() \ +((DDS_XTypes_SBoundSeq*) dds_alloc (sizeof (DDS_XTypes_SBoundSeq))); + +#define DDS_XTypes_SBoundSeq_allocbuf(l) \ +((DDS_XTypes_SBound *) dds_alloc ((l) * sizeof (DDS_XTypes_SBound))) +#define DDS_XTypes_INVALID_SBOUND 0 +typedef struct DDS_XTypes_TypeObjectHashId +{ + uint8_t _d; + union + { + DDS_XTypes_EquivalenceHash hash; + } _u; +} DDS_XTypes_TypeObjectHashId; + +typedef uint16_t DDS_XTypes_MemberFlag; +#define DDS_XTypes_TRY_CONSTRUCT1 (1 << 0) +#define DDS_XTypes_TRY_CONSTRUCT2 (1 << 1) +#define DDS_XTypes_IS_EXTERNAL (1 << 2) +#define DDS_XTypes_IS_OPTIONAL (1 << 3) +#define DDS_XTypes_IS_MUST_UNDERSTAND (1 << 4) +#define DDS_XTypes_IS_KEY (1 << 5) +#define DDS_XTypes_IS_DEFAULT (1 << 6) +typedef DDS_XTypes_MemberFlag DDS_XTypes_CollectionElementFlag; + +#define DDS_XTypes_CollectionElementFlag__alloc() \ +((DDS_XTypes_CollectionElementFlag*) dds_alloc (sizeof (DDS_XTypes_CollectionElementFlag))); + +typedef DDS_XTypes_MemberFlag DDS_XTypes_StructMemberFlag; + +#define DDS_XTypes_StructMemberFlag__alloc() \ +((DDS_XTypes_StructMemberFlag*) dds_alloc (sizeof (DDS_XTypes_StructMemberFlag))); + +typedef DDS_XTypes_MemberFlag DDS_XTypes_UnionMemberFlag; + +#define DDS_XTypes_UnionMemberFlag__alloc() \ +((DDS_XTypes_UnionMemberFlag*) dds_alloc (sizeof (DDS_XTypes_UnionMemberFlag))); + +typedef DDS_XTypes_MemberFlag DDS_XTypes_UnionDiscriminatorFlag; + +#define DDS_XTypes_UnionDiscriminatorFlag__alloc() \ +((DDS_XTypes_UnionDiscriminatorFlag*) dds_alloc (sizeof (DDS_XTypes_UnionDiscriminatorFlag))); + +typedef DDS_XTypes_MemberFlag DDS_XTypes_EnumeratedLiteralFlag; + +#define DDS_XTypes_EnumeratedLiteralFlag__alloc() \ +((DDS_XTypes_EnumeratedLiteralFlag*) dds_alloc (sizeof (DDS_XTypes_EnumeratedLiteralFlag))); + +typedef DDS_XTypes_MemberFlag DDS_XTypes_AnnotationParameterFlag; + +#define DDS_XTypes_AnnotationParameterFlag__alloc() \ +((DDS_XTypes_AnnotationParameterFlag*) dds_alloc (sizeof (DDS_XTypes_AnnotationParameterFlag))); + +typedef DDS_XTypes_MemberFlag DDS_XTypes_AliasMemberFlag; + +#define DDS_XTypes_AliasMemberFlag__alloc() \ +((DDS_XTypes_AliasMemberFlag*) dds_alloc (sizeof (DDS_XTypes_AliasMemberFlag))); + +typedef DDS_XTypes_MemberFlag DDS_XTypes_BitflagFlag; + +#define DDS_XTypes_BitflagFlag__alloc() \ +((DDS_XTypes_BitflagFlag*) dds_alloc (sizeof (DDS_XTypes_BitflagFlag))); + +typedef DDS_XTypes_MemberFlag DDS_XTypes_BitsetMemberFlag; + +#define DDS_XTypes_BitsetMemberFlag__alloc() \ +((DDS_XTypes_BitsetMemberFlag*) dds_alloc (sizeof (DDS_XTypes_BitsetMemberFlag))); + +#define DDS_XTypes_MemberFlagMinimalMask 63 +typedef uint16_t DDS_XTypes_TypeFlag; +#define DDS_XTypes_IS_FINAL (1 << 0) +#define DDS_XTypes_IS_APPENDABLE (1 << 1) +#define DDS_XTypes_IS_MUTABLE (1 << 2) +#define DDS_XTypes_IS_NESTED (1 << 3) +#define DDS_XTypes_IS_AUTOID_HASH (1 << 4) +typedef DDS_XTypes_TypeFlag DDS_XTypes_StructTypeFlag; + +#define DDS_XTypes_StructTypeFlag__alloc() \ +((DDS_XTypes_StructTypeFlag*) dds_alloc (sizeof (DDS_XTypes_StructTypeFlag))); + +typedef DDS_XTypes_TypeFlag DDS_XTypes_UnionTypeFlag; + +#define DDS_XTypes_UnionTypeFlag__alloc() \ +((DDS_XTypes_UnionTypeFlag*) dds_alloc (sizeof (DDS_XTypes_UnionTypeFlag))); + +typedef DDS_XTypes_TypeFlag DDS_XTypes_CollectionTypeFlag; + +#define DDS_XTypes_CollectionTypeFlag__alloc() \ +((DDS_XTypes_CollectionTypeFlag*) dds_alloc (sizeof (DDS_XTypes_CollectionTypeFlag))); + +typedef DDS_XTypes_TypeFlag DDS_XTypes_AnnotationTypeFlag; + +#define DDS_XTypes_AnnotationTypeFlag__alloc() \ +((DDS_XTypes_AnnotationTypeFlag*) dds_alloc (sizeof (DDS_XTypes_AnnotationTypeFlag))); + +typedef DDS_XTypes_TypeFlag DDS_XTypes_AliasTypeFlag; + +#define DDS_XTypes_AliasTypeFlag__alloc() \ +((DDS_XTypes_AliasTypeFlag*) dds_alloc (sizeof (DDS_XTypes_AliasTypeFlag))); + +typedef DDS_XTypes_TypeFlag DDS_XTypes_EnumTypeFlag; + +#define DDS_XTypes_EnumTypeFlag__alloc() \ +((DDS_XTypes_EnumTypeFlag*) dds_alloc (sizeof (DDS_XTypes_EnumTypeFlag))); + +typedef DDS_XTypes_TypeFlag DDS_XTypes_BitmaskTypeFlag; + +#define DDS_XTypes_BitmaskTypeFlag__alloc() \ +((DDS_XTypes_BitmaskTypeFlag*) dds_alloc (sizeof (DDS_XTypes_BitmaskTypeFlag))); + +typedef DDS_XTypes_TypeFlag DDS_XTypes_BitsetTypeFlag; + +#define DDS_XTypes_BitsetTypeFlag__alloc() \ +((DDS_XTypes_BitsetTypeFlag*) dds_alloc (sizeof (DDS_XTypes_BitsetTypeFlag))); + +#define DDS_XTypes_TypeFlagMinimalMask 7 +struct DDS_XTypes_TypeIdentifier; +typedef struct DDS_XTypes_StringSTypeDefn +{ + DDS_XTypes_SBound bound; +} DDS_XTypes_StringSTypeDefn; + +typedef struct DDS_XTypes_StringLTypeDefn +{ + DDS_XTypes_LBound bound; +} DDS_XTypes_StringLTypeDefn; + +typedef struct DDS_XTypes_PlainCollectionHeader +{ + DDS_XTypes_EquivalenceKind equiv_kind; + DDS_XTypes_CollectionElementFlag element_flags; +} DDS_XTypes_PlainCollectionHeader; + +typedef struct DDS_XTypes_PlainSequenceSElemDefn +{ + struct DDS_XTypes_PlainCollectionHeader header; + DDS_XTypes_SBound bound; + struct DDS_XTypes_TypeIdentifier * element_identifier; +} DDS_XTypes_PlainSequenceSElemDefn; + +typedef struct DDS_XTypes_PlainSequenceLElemDefn +{ + struct DDS_XTypes_PlainCollectionHeader header; + DDS_XTypes_LBound bound; + struct DDS_XTypes_TypeIdentifier * element_identifier; +} DDS_XTypes_PlainSequenceLElemDefn; + +typedef struct DDS_XTypes_PlainArraySElemDefn +{ + struct DDS_XTypes_PlainCollectionHeader header; + DDS_XTypes_SBoundSeq array_bound_seq; + struct DDS_XTypes_TypeIdentifier * element_identifier; +} DDS_XTypes_PlainArraySElemDefn; + +typedef struct DDS_XTypes_PlainArrayLElemDefn +{ + struct DDS_XTypes_PlainCollectionHeader header; + DDS_XTypes_LBoundSeq array_bound_seq; + struct DDS_XTypes_TypeIdentifier * element_identifier; +} DDS_XTypes_PlainArrayLElemDefn; + +typedef struct DDS_XTypes_PlainMapSTypeDefn +{ + struct DDS_XTypes_PlainCollectionHeader header; + DDS_XTypes_SBound bound; + struct DDS_XTypes_TypeIdentifier * element_identifier; + DDS_XTypes_CollectionElementFlag key_flags; + struct DDS_XTypes_TypeIdentifier * key_identifier; +} DDS_XTypes_PlainMapSTypeDefn; + +typedef struct DDS_XTypes_PlainMapLTypeDefn +{ + struct DDS_XTypes_PlainCollectionHeader header; + DDS_XTypes_LBound bound; + struct DDS_XTypes_TypeIdentifier * element_identifier; + DDS_XTypes_CollectionElementFlag key_flags; + struct DDS_XTypes_TypeIdentifier * key_identifier; +} DDS_XTypes_PlainMapLTypeDefn; + +typedef struct DDS_XTypes_StronglyConnectedComponentId +{ + struct DDS_XTypes_TypeObjectHashId sc_component_id; + int32_t scc_length; + int32_t scc_index; +} DDS_XTypes_StronglyConnectedComponentId; + +#if 0 /* empty struct */ +typedef struct DDS_XTypes_ExtendedTypeDefn +{ +} DDS_XTypes_ExtendedTypeDefn; +#endif /* empty struct */ + +typedef struct DDS_XTypes_TypeIdentifier +{ + uint8_t _d; + union + { + struct DDS_XTypes_StringSTypeDefn string_sdefn; + struct DDS_XTypes_StringLTypeDefn string_ldefn; + struct DDS_XTypes_PlainSequenceSElemDefn seq_sdefn; + struct DDS_XTypes_PlainSequenceLElemDefn seq_ldefn; + struct DDS_XTypes_PlainArraySElemDefn array_sdefn; + struct DDS_XTypes_PlainArrayLElemDefn array_ldefn; + struct DDS_XTypes_PlainMapSTypeDefn map_sdefn; + struct DDS_XTypes_PlainMapLTypeDefn map_ldefn; + struct DDS_XTypes_StronglyConnectedComponentId sc_component_id; + DDS_XTypes_EquivalenceHash equivalence_hash; + } _u; +} DDS_XTypes_TypeIdentifier; + +DDS_EXPORT extern const dds_topic_descriptor_t DDS_XTypes_TypeIdentifier_desc; + +#define DDS_XTypes_TypeIdentifier__alloc() \ +((DDS_XTypes_TypeIdentifier*) dds_alloc (sizeof (DDS_XTypes_TypeIdentifier))); + +#define DDS_XTypes_TypeIdentifier_free(d,o) \ +dds_sample_free ((d), &DDS_XTypes_TypeIdentifier_desc, (o)) + +typedef struct DDS_XTypes_TypeIdentifierSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifier *_buffer; + bool _release; +} DDS_XTypes_TypeIdentifierSeq; + +#define DDS_XTypes_TypeIdentifierSeq__alloc() \ +((DDS_XTypes_TypeIdentifierSeq*) dds_alloc (sizeof (DDS_XTypes_TypeIdentifierSeq))); + +#define DDS_XTypes_TypeIdentifierSeq_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifier *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifier))) +typedef uint32_t DDS_XTypes_MemberId; + +#define DDS_XTypes_MemberId__alloc() \ +((DDS_XTypes_MemberId*) dds_alloc (sizeof (DDS_XTypes_MemberId))); + +#define DDS_XTypes_ANNOTATION_STR_VALUE_MAX_LEN 128 +#define DDS_XTypes_ANNOTATION_OCTETSEC_VALUE_MAX_LEN 128 +#if 0 /* empty struct */ +typedef struct DDS_XTypes_ExtendedAnnotationParameterValue +{ +} DDS_XTypes_ExtendedAnnotationParameterValue; +#endif /* empty struct */ + +typedef struct DDS_XTypes_AnnotationParameterValue +{ + uint8_t _d; + union + { + bool boolean_value; + uint8_t byte_value; + int16_t int16_value; + uint16_t uint_16_value; + int32_t int32_value; + uint32_t uint32_value; + int64_t int64_value; + uint64_t uint64_value; + float float32_value; + double float64_value; + char char_value; + int32_t enumerated_value; + char string8_value[129]; + /* struct DDS_XTypes_ExtendedAnnotationParameterValue extended_value */ /* no members */ + } _u; +} DDS_XTypes_AnnotationParameterValue; + +typedef struct DDS_XTypes_AppliedAnnotationParameter +{ + DDS_XTypes_NameHash paramname_hash; + struct DDS_XTypes_AnnotationParameterValue value; +} DDS_XTypes_AppliedAnnotationParameter; + +typedef struct DDS_XTypes_AppliedAnnotationParameterSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_AppliedAnnotationParameter *_buffer; + bool _release; +} DDS_XTypes_AppliedAnnotationParameterSeq; + +#define DDS_XTypes_AppliedAnnotationParameterSeq__alloc() \ +((DDS_XTypes_AppliedAnnotationParameterSeq*) dds_alloc (sizeof (DDS_XTypes_AppliedAnnotationParameterSeq))); + +#define DDS_XTypes_AppliedAnnotationParameterSeq_allocbuf(l) \ +((struct DDS_XTypes_AppliedAnnotationParameter *) dds_alloc ((l) * sizeof (struct DDS_XTypes_AppliedAnnotationParameter))) +typedef struct DDS_XTypes_AppliedAnnotation +{ + struct DDS_XTypes_TypeIdentifier annotation_typeid; + DDS_XTypes_AppliedAnnotationParameterSeq * param_seq; +} DDS_XTypes_AppliedAnnotation; + +typedef struct DDS_XTypes_AppliedAnnotationSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_AppliedAnnotation *_buffer; + bool _release; +} DDS_XTypes_AppliedAnnotationSeq; + +#define DDS_XTypes_AppliedAnnotationSeq__alloc() \ +((DDS_XTypes_AppliedAnnotationSeq*) dds_alloc (sizeof (DDS_XTypes_AppliedAnnotationSeq))); + +#define DDS_XTypes_AppliedAnnotationSeq_allocbuf(l) \ +((struct DDS_XTypes_AppliedAnnotation *) dds_alloc ((l) * sizeof (struct DDS_XTypes_AppliedAnnotation))) +typedef struct DDS_XTypes_AppliedVerbatimAnnotation +{ + char placement[33]; + char language[33]; + char * text; +} DDS_XTypes_AppliedVerbatimAnnotation; + +typedef struct DDS_XTypes_AppliedBuiltinMemberAnnotations +{ + char * unit; + struct DDS_XTypes_AnnotationParameterValue * min; + struct DDS_XTypes_AnnotationParameterValue * max; + char * hash_id; +} DDS_XTypes_AppliedBuiltinMemberAnnotations; + +typedef struct DDS_XTypes_CommonStructMember +{ + DDS_XTypes_MemberId member_id; + DDS_XTypes_StructMemberFlag member_flags; + struct DDS_XTypes_TypeIdentifier member_type_id; +} DDS_XTypes_CommonStructMember; + +typedef struct DDS_XTypes_CompleteMemberDetail +{ + DDS_XTypes_MemberName name; + struct DDS_XTypes_AppliedBuiltinMemberAnnotations * ann_builtin; + DDS_XTypes_AppliedAnnotationSeq * ann_custom; +} DDS_XTypes_CompleteMemberDetail; + +typedef struct DDS_XTypes_MinimalMemberDetail +{ + DDS_XTypes_NameHash name_hash; +} DDS_XTypes_MinimalMemberDetail; + +typedef struct DDS_XTypes_CompleteStructMember +{ + struct DDS_XTypes_CommonStructMember common; + struct DDS_XTypes_CompleteMemberDetail detail; +} DDS_XTypes_CompleteStructMember; + +typedef struct DDS_XTypes_CompleteStructMemberSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_CompleteStructMember *_buffer; + bool _release; +} DDS_XTypes_CompleteStructMemberSeq; + +#define DDS_XTypes_CompleteStructMemberSeq__alloc() \ +((DDS_XTypes_CompleteStructMemberSeq*) dds_alloc (sizeof (DDS_XTypes_CompleteStructMemberSeq))); + +#define DDS_XTypes_CompleteStructMemberSeq_allocbuf(l) \ +((struct DDS_XTypes_CompleteStructMember *) dds_alloc ((l) * sizeof (struct DDS_XTypes_CompleteStructMember))) +typedef struct DDS_XTypes_MinimalStructMember +{ + struct DDS_XTypes_CommonStructMember common; + struct DDS_XTypes_MinimalMemberDetail detail; +} DDS_XTypes_MinimalStructMember; + +typedef struct DDS_XTypes_MinimalStructMemberSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_MinimalStructMember *_buffer; + bool _release; +} DDS_XTypes_MinimalStructMemberSeq; + +#define DDS_XTypes_MinimalStructMemberSeq__alloc() \ +((DDS_XTypes_MinimalStructMemberSeq*) dds_alloc (sizeof (DDS_XTypes_MinimalStructMemberSeq))); + +#define DDS_XTypes_MinimalStructMemberSeq_allocbuf(l) \ +((struct DDS_XTypes_MinimalStructMember *) dds_alloc ((l) * sizeof (struct DDS_XTypes_MinimalStructMember))) +typedef struct DDS_XTypes_AppliedBuiltinTypeAnnotations +{ + struct DDS_XTypes_AppliedVerbatimAnnotation * verbatim; +} DDS_XTypes_AppliedBuiltinTypeAnnotations; + +#if 0 /* empty struct */ +typedef struct DDS_XTypes_MinimalTypeDetail +{ +} DDS_XTypes_MinimalTypeDetail; +#endif /* empty struct */ + +typedef struct DDS_XTypes_CompleteTypeDetail +{ + struct DDS_XTypes_AppliedBuiltinTypeAnnotations * ann_builtin; + DDS_XTypes_AppliedAnnotationSeq * ann_custom; + DDS_XTypes_QualifiedTypeName type_name; +} DDS_XTypes_CompleteTypeDetail; + +typedef struct DDS_XTypes_CompleteStructHeader +{ + struct DDS_XTypes_TypeIdentifier base_type; + struct DDS_XTypes_CompleteTypeDetail detail; +} DDS_XTypes_CompleteStructHeader; + +typedef struct DDS_XTypes_MinimalStructHeader +{ + struct DDS_XTypes_TypeIdentifier base_type; + /* struct DDS_XTypes_MinimalTypeDetail detail */ /* no members */ +} DDS_XTypes_MinimalStructHeader; + +typedef struct DDS_XTypes_CompleteStructType +{ + DDS_XTypes_StructTypeFlag struct_flags; + struct DDS_XTypes_CompleteStructHeader header; + DDS_XTypes_CompleteStructMemberSeq member_seq; +} DDS_XTypes_CompleteStructType; + +typedef struct DDS_XTypes_MinimalStructType +{ + DDS_XTypes_StructTypeFlag struct_flags; + struct DDS_XTypes_MinimalStructHeader header; + DDS_XTypes_MinimalStructMemberSeq member_seq; +} DDS_XTypes_MinimalStructType; + +typedef struct DDS_XTypes_UnionCaseLabelSeq +{ + uint32_t _maximum; + uint32_t _length; + int32_t *_buffer; + bool _release; +} DDS_XTypes_UnionCaseLabelSeq; + +#define DDS_XTypes_UnionCaseLabelSeq__alloc() \ +((DDS_XTypes_UnionCaseLabelSeq*) dds_alloc (sizeof (DDS_XTypes_UnionCaseLabelSeq))); + +#define DDS_XTypes_UnionCaseLabelSeq_allocbuf(l) \ +((int32_t *) dds_alloc ((l) * sizeof (int32_t))) +typedef struct DDS_XTypes_CommonUnionMember +{ + DDS_XTypes_MemberId member_id; + DDS_XTypes_UnionMemberFlag member_flags; + struct DDS_XTypes_TypeIdentifier type_id; + DDS_XTypes_UnionCaseLabelSeq label_seq; +} DDS_XTypes_CommonUnionMember; + +typedef struct DDS_XTypes_CompleteUnionMember +{ + struct DDS_XTypes_CommonUnionMember common; + struct DDS_XTypes_CompleteMemberDetail detail; +} DDS_XTypes_CompleteUnionMember; + +typedef struct DDS_XTypes_CompleteUnionMemberSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_CompleteUnionMember *_buffer; + bool _release; +} DDS_XTypes_CompleteUnionMemberSeq; + +#define DDS_XTypes_CompleteUnionMemberSeq__alloc() \ +((DDS_XTypes_CompleteUnionMemberSeq*) dds_alloc (sizeof (DDS_XTypes_CompleteUnionMemberSeq))); + +#define DDS_XTypes_CompleteUnionMemberSeq_allocbuf(l) \ +((struct DDS_XTypes_CompleteUnionMember *) dds_alloc ((l) * sizeof (struct DDS_XTypes_CompleteUnionMember))) +typedef struct DDS_XTypes_MinimalUnionMember +{ + struct DDS_XTypes_CommonUnionMember common; + struct DDS_XTypes_MinimalMemberDetail detail; +} DDS_XTypes_MinimalUnionMember; + +typedef struct DDS_XTypes_MinimalUnionMemberSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_MinimalUnionMember *_buffer; + bool _release; +} DDS_XTypes_MinimalUnionMemberSeq; + +#define DDS_XTypes_MinimalUnionMemberSeq__alloc() \ +((DDS_XTypes_MinimalUnionMemberSeq*) dds_alloc (sizeof (DDS_XTypes_MinimalUnionMemberSeq))); + +#define DDS_XTypes_MinimalUnionMemberSeq_allocbuf(l) \ +((struct DDS_XTypes_MinimalUnionMember *) dds_alloc ((l) * sizeof (struct DDS_XTypes_MinimalUnionMember))) +typedef struct DDS_XTypes_CommonDiscriminatorMember +{ + DDS_XTypes_UnionDiscriminatorFlag member_flags; + struct DDS_XTypes_TypeIdentifier type_id; +} DDS_XTypes_CommonDiscriminatorMember; + +typedef struct DDS_XTypes_CompleteDiscriminatorMember +{ + struct DDS_XTypes_CommonDiscriminatorMember common; + struct DDS_XTypes_AppliedBuiltinTypeAnnotations * ann_builtin; + DDS_XTypes_AppliedAnnotationSeq * ann_custom; +} DDS_XTypes_CompleteDiscriminatorMember; + +typedef struct DDS_XTypes_MinimalDiscriminatorMember +{ + struct DDS_XTypes_CommonDiscriminatorMember common; +} DDS_XTypes_MinimalDiscriminatorMember; + +typedef struct DDS_XTypes_CompleteUnionHeader +{ + struct DDS_XTypes_CompleteTypeDetail detail; +} DDS_XTypes_CompleteUnionHeader; + +#if 0 /* empty struct */ +typedef struct DDS_XTypes_MinimalUnionHeader +{ + /* struct DDS_XTypes_MinimalTypeDetail detail */ /* no members */ +} DDS_XTypes_MinimalUnionHeader; +#endif /* empty struct */ + +typedef struct DDS_XTypes_CompleteUnionType +{ + DDS_XTypes_UnionTypeFlag union_flags; + struct DDS_XTypes_CompleteUnionHeader header; + struct DDS_XTypes_CompleteDiscriminatorMember discriminator; + DDS_XTypes_CompleteUnionMemberSeq member_seq; +} DDS_XTypes_CompleteUnionType; + +typedef struct DDS_XTypes_MinimalUnionType +{ + DDS_XTypes_UnionTypeFlag union_flags; + /* struct DDS_XTypes_MinimalUnionHeader header */ /* no members */ + struct DDS_XTypes_MinimalDiscriminatorMember discriminator; + DDS_XTypes_MinimalUnionMemberSeq member_seq; +} DDS_XTypes_MinimalUnionType; + +typedef struct DDS_XTypes_CommonAnnotationParameter +{ + DDS_XTypes_AnnotationParameterFlag member_flags; + struct DDS_XTypes_TypeIdentifier member_type_id; +} DDS_XTypes_CommonAnnotationParameter; + +typedef struct DDS_XTypes_CompleteAnnotationParameter +{ + struct DDS_XTypes_CommonAnnotationParameter common; + DDS_XTypes_MemberName name; + struct DDS_XTypes_AnnotationParameterValue default_value; +} DDS_XTypes_CompleteAnnotationParameter; + +typedef struct DDS_XTypes_CompleteAnnotationParameterSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_CompleteAnnotationParameter *_buffer; + bool _release; +} DDS_XTypes_CompleteAnnotationParameterSeq; + +#define DDS_XTypes_CompleteAnnotationParameterSeq__alloc() \ +((DDS_XTypes_CompleteAnnotationParameterSeq*) dds_alloc (sizeof (DDS_XTypes_CompleteAnnotationParameterSeq))); + +#define DDS_XTypes_CompleteAnnotationParameterSeq_allocbuf(l) \ +((struct DDS_XTypes_CompleteAnnotationParameter *) dds_alloc ((l) * sizeof (struct DDS_XTypes_CompleteAnnotationParameter))) +typedef struct DDS_XTypes_MinimalAnnotationParameter +{ + struct DDS_XTypes_CommonAnnotationParameter common; + DDS_XTypes_NameHash name_hash; + struct DDS_XTypes_AnnotationParameterValue default_value; +} DDS_XTypes_MinimalAnnotationParameter; + +typedef struct DDS_XTypes_MinimalAnnotationParameterSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_MinimalAnnotationParameter *_buffer; + bool _release; +} DDS_XTypes_MinimalAnnotationParameterSeq; + +#define DDS_XTypes_MinimalAnnotationParameterSeq__alloc() \ +((DDS_XTypes_MinimalAnnotationParameterSeq*) dds_alloc (sizeof (DDS_XTypes_MinimalAnnotationParameterSeq))); + +#define DDS_XTypes_MinimalAnnotationParameterSeq_allocbuf(l) \ +((struct DDS_XTypes_MinimalAnnotationParameter *) dds_alloc ((l) * sizeof (struct DDS_XTypes_MinimalAnnotationParameter))) +typedef struct DDS_XTypes_CompleteAnnotationHeader +{ + DDS_XTypes_QualifiedTypeName annotation_name; +} DDS_XTypes_CompleteAnnotationHeader; + +#if 0 /* empty struct */ +typedef struct DDS_XTypes_MinimalAnnotationHeader +{ +} DDS_XTypes_MinimalAnnotationHeader; +#endif /* empty struct */ + +typedef struct DDS_XTypes_CompleteAnnotationType +{ + DDS_XTypes_AnnotationTypeFlag annotation_flag; + struct DDS_XTypes_CompleteAnnotationHeader header; + DDS_XTypes_CompleteAnnotationParameterSeq member_seq; +} DDS_XTypes_CompleteAnnotationType; + +typedef struct DDS_XTypes_MinimalAnnotationType +{ + DDS_XTypes_AnnotationTypeFlag annotation_flag; + /* struct DDS_XTypes_MinimalAnnotationHeader header */ /* no members */ + DDS_XTypes_MinimalAnnotationParameterSeq member_seq; +} DDS_XTypes_MinimalAnnotationType; + +typedef struct DDS_XTypes_CommonAliasBody +{ + DDS_XTypes_AliasMemberFlag related_flags; + struct DDS_XTypes_TypeIdentifier related_type; +} DDS_XTypes_CommonAliasBody; + +typedef struct DDS_XTypes_CompleteAliasBody +{ + struct DDS_XTypes_CommonAliasBody common; + struct DDS_XTypes_AppliedBuiltinMemberAnnotations * ann_builtin; + DDS_XTypes_AppliedAnnotationSeq * ann_custom; +} DDS_XTypes_CompleteAliasBody; + +typedef struct DDS_XTypes_MinimalAliasBody +{ + struct DDS_XTypes_CommonAliasBody common; +} DDS_XTypes_MinimalAliasBody; + +typedef struct DDS_XTypes_CompleteAliasHeader +{ + struct DDS_XTypes_CompleteTypeDetail detail; +} DDS_XTypes_CompleteAliasHeader; + +#if 0 /* empty struct */ +typedef struct DDS_XTypes_MinimalAliasHeader +{ +} DDS_XTypes_MinimalAliasHeader; +#endif /* empty struct */ + +typedef struct DDS_XTypes_CompleteAliasType +{ + DDS_XTypes_AliasTypeFlag alias_flags; + struct DDS_XTypes_CompleteAliasHeader header; + struct DDS_XTypes_CompleteAliasBody body; +} DDS_XTypes_CompleteAliasType; + +typedef struct DDS_XTypes_MinimalAliasType +{ + DDS_XTypes_AliasTypeFlag alias_flags; + /* struct DDS_XTypes_MinimalAliasHeader header */ /* no members */ + struct DDS_XTypes_MinimalAliasBody body; +} DDS_XTypes_MinimalAliasType; + +typedef struct DDS_XTypes_CompleteElementDetail +{ + struct DDS_XTypes_AppliedBuiltinMemberAnnotations * ann_builtin; + DDS_XTypes_AppliedAnnotationSeq * ann_custom; +} DDS_XTypes_CompleteElementDetail; + +typedef struct DDS_XTypes_CommonCollectionElement +{ + DDS_XTypes_CollectionElementFlag element_flags; + struct DDS_XTypes_TypeIdentifier type; +} DDS_XTypes_CommonCollectionElement; + +typedef struct DDS_XTypes_CompleteCollectionElement +{ + struct DDS_XTypes_CommonCollectionElement common; + struct DDS_XTypes_CompleteElementDetail detail; +} DDS_XTypes_CompleteCollectionElement; + +typedef struct DDS_XTypes_MinimalCollectionElement +{ + struct DDS_XTypes_CommonCollectionElement common; +} DDS_XTypes_MinimalCollectionElement; + +typedef struct DDS_XTypes_CommonCollectionHeader +{ + DDS_XTypes_LBound bound; +} DDS_XTypes_CommonCollectionHeader; + +typedef struct DDS_XTypes_CompleteCollectionHeader +{ + struct DDS_XTypes_CommonCollectionHeader common; + struct DDS_XTypes_CompleteTypeDetail * detail; +} DDS_XTypes_CompleteCollectionHeader; + +typedef struct DDS_XTypes_MinimalCollectionHeader +{ + struct DDS_XTypes_CommonCollectionHeader common; +} DDS_XTypes_MinimalCollectionHeader; + +typedef struct DDS_XTypes_CompleteSequenceType +{ + DDS_XTypes_CollectionTypeFlag collection_flag; + struct DDS_XTypes_CompleteCollectionHeader header; + struct DDS_XTypes_CompleteCollectionElement element; +} DDS_XTypes_CompleteSequenceType; + +typedef struct DDS_XTypes_MinimalSequenceType +{ + DDS_XTypes_CollectionTypeFlag collection_flag; + struct DDS_XTypes_MinimalCollectionHeader header; + struct DDS_XTypes_MinimalCollectionElement element; +} DDS_XTypes_MinimalSequenceType; + +typedef struct DDS_XTypes_CommonArrayHeader +{ + DDS_XTypes_LBoundSeq bound_seq; +} DDS_XTypes_CommonArrayHeader; + +typedef struct DDS_XTypes_CompleteArrayHeader +{ + struct DDS_XTypes_CommonArrayHeader common; + struct DDS_XTypes_CompleteTypeDetail detail; +} DDS_XTypes_CompleteArrayHeader; + +typedef struct DDS_XTypes_MinimalArrayHeader +{ + struct DDS_XTypes_CommonArrayHeader common; +} DDS_XTypes_MinimalArrayHeader; + +typedef struct DDS_XTypes_CompleteArrayType +{ + DDS_XTypes_CollectionTypeFlag collection_flag; + struct DDS_XTypes_CompleteArrayHeader header; + struct DDS_XTypes_CompleteCollectionElement element; +} DDS_XTypes_CompleteArrayType; + +typedef struct DDS_XTypes_MinimalArrayType +{ + DDS_XTypes_CollectionTypeFlag collection_flag; + struct DDS_XTypes_MinimalArrayHeader header; + struct DDS_XTypes_MinimalCollectionElement element; +} DDS_XTypes_MinimalArrayType; + +typedef struct DDS_XTypes_CompleteMapType +{ + DDS_XTypes_CollectionTypeFlag collection_flag; + struct DDS_XTypes_CompleteCollectionHeader header; + struct DDS_XTypes_CompleteCollectionElement key; + struct DDS_XTypes_CompleteCollectionElement element; +} DDS_XTypes_CompleteMapType; + +typedef struct DDS_XTypes_MinimalMapType +{ + DDS_XTypes_CollectionTypeFlag collection_flag; + struct DDS_XTypes_MinimalCollectionHeader header; + struct DDS_XTypes_MinimalCollectionElement key; + struct DDS_XTypes_MinimalCollectionElement element; +} DDS_XTypes_MinimalMapType; + +typedef uint16_t DDS_XTypes_BitBound; + +#define DDS_XTypes_BitBound__alloc() \ +((DDS_XTypes_BitBound*) dds_alloc (sizeof (DDS_XTypes_BitBound))); + +typedef struct DDS_XTypes_CommonEnumeratedLiteral +{ + int32_t value; + DDS_XTypes_EnumeratedLiteralFlag flags; +} DDS_XTypes_CommonEnumeratedLiteral; + +typedef struct DDS_XTypes_CompleteEnumeratedLiteral +{ + struct DDS_XTypes_CommonEnumeratedLiteral common; + struct DDS_XTypes_CompleteMemberDetail detail; +} DDS_XTypes_CompleteEnumeratedLiteral; + +typedef struct DDS_XTypes_CompleteEnumeratedLiteralSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_CompleteEnumeratedLiteral *_buffer; + bool _release; +} DDS_XTypes_CompleteEnumeratedLiteralSeq; + +#define DDS_XTypes_CompleteEnumeratedLiteralSeq__alloc() \ +((DDS_XTypes_CompleteEnumeratedLiteralSeq*) dds_alloc (sizeof (DDS_XTypes_CompleteEnumeratedLiteralSeq))); + +#define DDS_XTypes_CompleteEnumeratedLiteralSeq_allocbuf(l) \ +((struct DDS_XTypes_CompleteEnumeratedLiteral *) dds_alloc ((l) * sizeof (struct DDS_XTypes_CompleteEnumeratedLiteral))) +typedef struct DDS_XTypes_MinimalEnumeratedLiteral +{ + struct DDS_XTypes_CommonEnumeratedLiteral common; + struct DDS_XTypes_MinimalMemberDetail detail; +} DDS_XTypes_MinimalEnumeratedLiteral; + +typedef struct DDS_XTypes_MinimalEnumeratedLiteralSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_MinimalEnumeratedLiteral *_buffer; + bool _release; +} DDS_XTypes_MinimalEnumeratedLiteralSeq; + +#define DDS_XTypes_MinimalEnumeratedLiteralSeq__alloc() \ +((DDS_XTypes_MinimalEnumeratedLiteralSeq*) dds_alloc (sizeof (DDS_XTypes_MinimalEnumeratedLiteralSeq))); + +#define DDS_XTypes_MinimalEnumeratedLiteralSeq_allocbuf(l) \ +((struct DDS_XTypes_MinimalEnumeratedLiteral *) dds_alloc ((l) * sizeof (struct DDS_XTypes_MinimalEnumeratedLiteral))) +typedef struct DDS_XTypes_CommonEnumeratedHeader +{ + DDS_XTypes_BitBound bit_bound; +} DDS_XTypes_CommonEnumeratedHeader; + +typedef struct DDS_XTypes_CompleteEnumeratedHeader +{ + struct DDS_XTypes_CommonEnumeratedHeader common; + struct DDS_XTypes_CompleteTypeDetail detail; +} DDS_XTypes_CompleteEnumeratedHeader; + +typedef struct DDS_XTypes_MinimalEnumeratedHeader +{ + struct DDS_XTypes_CommonEnumeratedHeader common; +} DDS_XTypes_MinimalEnumeratedHeader; + +typedef struct DDS_XTypes_CompleteEnumeratedType +{ + DDS_XTypes_EnumTypeFlag enum_flags; + struct DDS_XTypes_CompleteEnumeratedHeader header; + DDS_XTypes_CompleteEnumeratedLiteralSeq literal_seq; +} DDS_XTypes_CompleteEnumeratedType; + +typedef struct DDS_XTypes_MinimalEnumeratedType +{ + DDS_XTypes_EnumTypeFlag enum_flags; + struct DDS_XTypes_MinimalEnumeratedHeader header; + DDS_XTypes_MinimalEnumeratedLiteralSeq literal_seq; +} DDS_XTypes_MinimalEnumeratedType; + +typedef struct DDS_XTypes_CommonBitflag +{ + uint16_t position; + DDS_XTypes_BitflagFlag flags; +} DDS_XTypes_CommonBitflag; + +typedef struct DDS_XTypes_CompleteBitflag +{ + struct DDS_XTypes_CommonBitflag common; + struct DDS_XTypes_CompleteMemberDetail detail; +} DDS_XTypes_CompleteBitflag; + +typedef struct DDS_XTypes_CompleteBitflagSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_CompleteBitflag *_buffer; + bool _release; +} DDS_XTypes_CompleteBitflagSeq; + +#define DDS_XTypes_CompleteBitflagSeq__alloc() \ +((DDS_XTypes_CompleteBitflagSeq*) dds_alloc (sizeof (DDS_XTypes_CompleteBitflagSeq))); + +#define DDS_XTypes_CompleteBitflagSeq_allocbuf(l) \ +((struct DDS_XTypes_CompleteBitflag *) dds_alloc ((l) * sizeof (struct DDS_XTypes_CompleteBitflag))) +typedef struct DDS_XTypes_MinimalBitflag +{ + struct DDS_XTypes_CommonBitflag common; + struct DDS_XTypes_MinimalMemberDetail detail; +} DDS_XTypes_MinimalBitflag; + +typedef struct DDS_XTypes_MinimalBitflagSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_MinimalBitflag *_buffer; + bool _release; +} DDS_XTypes_MinimalBitflagSeq; + +#define DDS_XTypes_MinimalBitflagSeq__alloc() \ +((DDS_XTypes_MinimalBitflagSeq*) dds_alloc (sizeof (DDS_XTypes_MinimalBitflagSeq))); + +#define DDS_XTypes_MinimalBitflagSeq_allocbuf(l) \ +((struct DDS_XTypes_MinimalBitflag *) dds_alloc ((l) * sizeof (struct DDS_XTypes_MinimalBitflag))) +typedef struct DDS_XTypes_CommonBitmaskHeader +{ + DDS_XTypes_BitBound bit_bound; +} DDS_XTypes_CommonBitmaskHeader; + +typedef DDS_XTypes_CompleteEnumeratedHeader DDS_XTypes_CompleteBitmaskHeader; + +#define DDS_XTypes_CompleteBitmaskHeader__alloc() \ +((DDS_XTypes_CompleteBitmaskHeader*) dds_alloc (sizeof (DDS_XTypes_CompleteBitmaskHeader))); + +typedef DDS_XTypes_MinimalEnumeratedHeader DDS_XTypes_MinimalBitmaskHeader; + +#define DDS_XTypes_MinimalBitmaskHeader__alloc() \ +((DDS_XTypes_MinimalBitmaskHeader*) dds_alloc (sizeof (DDS_XTypes_MinimalBitmaskHeader))); + +typedef struct DDS_XTypes_CompleteBitmaskType +{ + DDS_XTypes_BitmaskTypeFlag bitmask_flags; + DDS_XTypes_CompleteBitmaskHeader header; + DDS_XTypes_CompleteBitflagSeq flag_seq; +} DDS_XTypes_CompleteBitmaskType; + +typedef struct DDS_XTypes_MinimalBitmaskType +{ + DDS_XTypes_BitmaskTypeFlag bitmask_flags; + DDS_XTypes_MinimalBitmaskHeader header; + DDS_XTypes_MinimalBitflagSeq flag_seq; +} DDS_XTypes_MinimalBitmaskType; + +typedef struct DDS_XTypes_CommonBitfield +{ + uint16_t position; + DDS_XTypes_BitsetMemberFlag flags; + uint8_t bitcount; + DDS_XTypes_TypeKind holder_type; +} DDS_XTypes_CommonBitfield; + +typedef struct DDS_XTypes_CompleteBitfield +{ + struct DDS_XTypes_CommonBitfield common; + struct DDS_XTypes_CompleteMemberDetail detail; +} DDS_XTypes_CompleteBitfield; + +typedef struct DDS_XTypes_CompleteBitfieldSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_CompleteBitfield *_buffer; + bool _release; +} DDS_XTypes_CompleteBitfieldSeq; + +#define DDS_XTypes_CompleteBitfieldSeq__alloc() \ +((DDS_XTypes_CompleteBitfieldSeq*) dds_alloc (sizeof (DDS_XTypes_CompleteBitfieldSeq))); + +#define DDS_XTypes_CompleteBitfieldSeq_allocbuf(l) \ +((struct DDS_XTypes_CompleteBitfield *) dds_alloc ((l) * sizeof (struct DDS_XTypes_CompleteBitfield))) +typedef struct DDS_XTypes_MinimalBitfield +{ + struct DDS_XTypes_CommonBitfield common; + DDS_XTypes_NameHash name_hash; +} DDS_XTypes_MinimalBitfield; + +typedef struct DDS_XTypes_MinimalBitfieldSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_MinimalBitfield *_buffer; + bool _release; +} DDS_XTypes_MinimalBitfieldSeq; + +#define DDS_XTypes_MinimalBitfieldSeq__alloc() \ +((DDS_XTypes_MinimalBitfieldSeq*) dds_alloc (sizeof (DDS_XTypes_MinimalBitfieldSeq))); + +#define DDS_XTypes_MinimalBitfieldSeq_allocbuf(l) \ +((struct DDS_XTypes_MinimalBitfield *) dds_alloc ((l) * sizeof (struct DDS_XTypes_MinimalBitfield))) +typedef struct DDS_XTypes_CompleteBitsetHeader +{ + struct DDS_XTypes_CompleteTypeDetail detail; +} DDS_XTypes_CompleteBitsetHeader; + +#if 0 /* empty struct */ +typedef struct DDS_XTypes_MinimalBitsetHeader +{ +} DDS_XTypes_MinimalBitsetHeader; +#endif /* empty struct */ + +typedef struct DDS_XTypes_CompleteBitsetType +{ + DDS_XTypes_BitsetTypeFlag bitset_flags; + struct DDS_XTypes_CompleteBitsetHeader header; + DDS_XTypes_CompleteBitfieldSeq field_seq; +} DDS_XTypes_CompleteBitsetType; + +typedef struct DDS_XTypes_MinimalBitsetType +{ + DDS_XTypes_BitsetTypeFlag bitset_flags; + /* struct DDS_XTypes_MinimalBitsetHeader header */ /* no members */ + DDS_XTypes_MinimalBitfieldSeq field_seq; +} DDS_XTypes_MinimalBitsetType; + +#if 0 /* empty struct */ +typedef struct DDS_XTypes_CompleteExtendedType +{ +} DDS_XTypes_CompleteExtendedType; +#endif /* empty struct */ + +typedef struct DDS_XTypes_CompleteTypeObject +{ + uint8_t _d; + union + { + struct DDS_XTypes_CompleteAliasType alias_type; + struct DDS_XTypes_CompleteAnnotationType annotation_type; + struct DDS_XTypes_CompleteStructType struct_type; + struct DDS_XTypes_CompleteUnionType union_type; + struct DDS_XTypes_CompleteBitsetType bitset_type; + struct DDS_XTypes_CompleteSequenceType sequence_type; + struct DDS_XTypes_CompleteArrayType array_type; + struct DDS_XTypes_CompleteMapType map_type; + struct DDS_XTypes_CompleteEnumeratedType enumerated_type; + struct DDS_XTypes_CompleteBitmaskType bitmask_type; + /* struct DDS_XTypes_CompleteExtendedType extended_type */ /* no members */ + } _u; +} DDS_XTypes_CompleteTypeObject; + +#if 0 /* empty struct */ +typedef struct DDS_XTypes_MinimalExtendedType +{ +} DDS_XTypes_MinimalExtendedType; +#endif /* empty struct */ + +typedef struct DDS_XTypes_MinimalTypeObject +{ + uint8_t _d; + union + { + struct DDS_XTypes_MinimalAliasType alias_type; + struct DDS_XTypes_MinimalAnnotationType annotation_type; + struct DDS_XTypes_MinimalStructType struct_type; + struct DDS_XTypes_MinimalUnionType union_type; + struct DDS_XTypes_MinimalBitsetType bitset_type; + struct DDS_XTypes_MinimalSequenceType sequence_type; + struct DDS_XTypes_MinimalArrayType array_type; + struct DDS_XTypes_MinimalMapType map_type; + struct DDS_XTypes_MinimalEnumeratedType enumerated_type; + struct DDS_XTypes_MinimalBitmaskType bitmask_type; + /* struct DDS_XTypes_MinimalExtendedType extended_type */ /* no members */ + } _u; +} DDS_XTypes_MinimalTypeObject; + +typedef struct DDS_XTypes_TypeObject +{ + uint8_t _d; + union + { + struct DDS_XTypes_CompleteTypeObject complete; + struct DDS_XTypes_MinimalTypeObject minimal; + } _u; +} DDS_XTypes_TypeObject; + +DDS_EXPORT extern const dds_topic_descriptor_t DDS_XTypes_TypeObject_desc; + +#define DDS_XTypes_TypeObject__alloc() \ +((DDS_XTypes_TypeObject*) dds_alloc (sizeof (DDS_XTypes_TypeObject))); + +#define DDS_XTypes_TypeObject_free(d,o) \ +dds_sample_free ((d), &DDS_XTypes_TypeObject_desc, (o)) + +typedef struct DDS_XTypes_TypeObjectSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeObject *_buffer; + bool _release; +} DDS_XTypes_TypeObjectSeq; + +#define DDS_XTypes_TypeObjectSeq__alloc() \ +((DDS_XTypes_TypeObjectSeq*) dds_alloc (sizeof (DDS_XTypes_TypeObjectSeq))); + +#define DDS_XTypes_TypeObjectSeq_allocbuf(l) \ +((struct DDS_XTypes_TypeObject *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeObject))) +typedef DDS_XTypes_TypeObjectSeq DDS_XTypes_StronglyConnectedComponent; + +#define DDS_XTypes_StronglyConnectedComponent__alloc() \ +((DDS_XTypes_StronglyConnectedComponent*) dds_alloc (sizeof (DDS_XTypes_StronglyConnectedComponent))); + +typedef struct DDS_XTypes_TypeIdentifierTypeObjectPair +{ + struct DDS_XTypes_TypeIdentifier type_identifier; + struct DDS_XTypes_TypeObject type_object; +} DDS_XTypes_TypeIdentifierTypeObjectPair; + +typedef struct DDS_XTypes_TypeIdentifierTypeObjectPairSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifierTypeObjectPair *_buffer; + bool _release; +} DDS_XTypes_TypeIdentifierTypeObjectPairSeq; + +#define DDS_XTypes_TypeIdentifierTypeObjectPairSeq__alloc() \ +((DDS_XTypes_TypeIdentifierTypeObjectPairSeq*) dds_alloc (sizeof (DDS_XTypes_TypeIdentifierTypeObjectPairSeq))); + +#define DDS_XTypes_TypeIdentifierTypeObjectPairSeq_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifierTypeObjectPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierTypeObjectPair))) +typedef struct DDS_XTypes_TypeIdentifierPair +{ + struct DDS_XTypes_TypeIdentifier type_identifier1; + struct DDS_XTypes_TypeIdentifier type_identifier2; +} DDS_XTypes_TypeIdentifierPair; + +typedef struct DDS_XTypes_TypeIdentifierPairSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifierPair *_buffer; + bool _release; +} DDS_XTypes_TypeIdentifierPairSeq; + +#define DDS_XTypes_TypeIdentifierPairSeq__alloc() \ +((DDS_XTypes_TypeIdentifierPairSeq*) dds_alloc (sizeof (DDS_XTypes_TypeIdentifierPairSeq))); + +#define DDS_XTypes_TypeIdentifierPairSeq_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifierPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierPair))) +typedef struct DDS_XTypes_TypeIdentifierWithSize +{ + struct DDS_XTypes_TypeIdentifier type_id; + uint32_t typeobject_serialized_size; +} DDS_XTypes_TypeIdentifierWithSize; + +typedef struct DDS_XTypes_TypeIdentifierWithSizeSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifierWithSize *_buffer; + bool _release; +} DDS_XTypes_TypeIdentifierWithSizeSeq; + +#define DDS_XTypes_TypeIdentifierWithSizeSeq__alloc() \ +((DDS_XTypes_TypeIdentifierWithSizeSeq*) dds_alloc (sizeof (DDS_XTypes_TypeIdentifierWithSizeSeq))); + +#define DDS_XTypes_TypeIdentifierWithSizeSeq_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifierWithSize *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierWithSize))) +#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERWITHSIZE_DEFINED +#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERWITHSIZE_DEFINED +typedef struct dds_sequence_DDS_XTypes_TypeIdentifierWithSize +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifierWithSize *_buffer; + bool _release; +} dds_sequence_DDS_XTypes_TypeIdentifierWithSize; + +#define dds_sequence_DDS_XTypes_TypeIdentifierWithSize__alloc() \ +((dds_sequence_DDS_XTypes_TypeIdentifierWithSize*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierWithSize))); + +#define dds_sequence_DDS_XTypes_TypeIdentifierWithSize_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifierWithSize *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierWithSize))) +#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERWITHSIZE_DEFINED */ + +typedef struct DDS_XTypes_TypeIdentifierWithDependencies +{ + struct DDS_XTypes_TypeIdentifierWithSize typeid_with_size; + int32_t dependent_typeid_count; + dds_sequence_DDS_XTypes_TypeIdentifierWithSize dependent_typeids; +} DDS_XTypes_TypeIdentifierWithDependencies; + +typedef struct DDS_XTypes_TypeIdentifierWithDependenciesSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifierWithDependencies *_buffer; + bool _release; +} DDS_XTypes_TypeIdentifierWithDependenciesSeq; + +#define DDS_XTypes_TypeIdentifierWithDependenciesSeq__alloc() \ +((DDS_XTypes_TypeIdentifierWithDependenciesSeq*) dds_alloc (sizeof (DDS_XTypes_TypeIdentifierWithDependenciesSeq))); + +#define DDS_XTypes_TypeIdentifierWithDependenciesSeq_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifierWithDependencies *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierWithDependencies))) +typedef struct DDS_XTypes_TypeInformation +{ + struct DDS_XTypes_TypeIdentifierWithDependencies minimal; + struct DDS_XTypes_TypeIdentifierWithDependencies complete; +} DDS_XTypes_TypeInformation; + +DDS_EXPORT extern const dds_topic_descriptor_t DDS_XTypes_TypeInformation_desc; + +#define DDS_XTypes_TypeInformation__alloc() \ +((DDS_XTypes_TypeInformation*) dds_alloc (sizeof (DDS_XTypes_TypeInformation))); + +#define DDS_XTypes_TypeInformation_free(d,o) \ +dds_sample_free ((d), &DDS_XTypes_TypeInformation_desc, (o)) + +typedef struct DDS_XTypes_TypeInformationSeq +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeInformation *_buffer; + bool _release; +} DDS_XTypes_TypeInformationSeq; + +#define DDS_XTypes_TypeInformationSeq__alloc() \ +((DDS_XTypes_TypeInformationSeq*) dds_alloc (sizeof (DDS_XTypes_TypeInformationSeq))); + +#define DDS_XTypes_TypeInformationSeq_allocbuf(l) \ +((struct DDS_XTypes_TypeInformation *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeInformation))) +#ifdef __cplusplus +} +#endif + +#endif /* DDSI_XT_TYPEINFO_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_xt_typeinfo.idl b/unitree_SDK/include/dds/ddsi/ddsi_xt_typeinfo.idl new file mode 100644 index 0000000..b7e745c --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_xt_typeinfo.idl @@ -0,0 +1,1069 @@ +/* dds-xtypes_typeobject.idl */ + +// The types in this file shall be serialized with XCDR encoding version 2 +module DDS { module XTypes { + + // ---------- Equivalence Kinds ------------------- + typedef octet EquivalenceKind; + const octet EK_MINIMAL = 0xF1; // 0x1111 0001 + const octet EK_COMPLETE = 0xF2; // 0x1111 0010 + const octet EK_BOTH = 0xF3; // 0x1111 0011 + + // ---------- TypeKinds (begin) ------------------- + typedef octet TypeKind; + + // Primitive TKs + const octet TK_NONE = 0x00; + const octet TK_BOOLEAN = 0x01; + const octet TK_BYTE = 0x02; + const octet TK_INT16 = 0x03; + const octet TK_INT32 = 0x04; + const octet TK_INT64 = 0x05; + const octet TK_UINT16 = 0x06; + const octet TK_UINT32 = 0x07; + const octet TK_UINT64 = 0x08; + const octet TK_FLOAT32 = 0x09; + const octet TK_FLOAT64 = 0x0A; + const octet TK_FLOAT128 = 0x0B; + const octet TK_CHAR8 = 0x10; + const octet TK_CHAR16 = 0x11; + + // String TKs + const octet TK_STRING8 = 0x20; + const octet TK_STRING16 = 0x21; + + // Constructed/Named types + const octet TK_ALIAS = 0x30; + + // Enumerated TKs + const octet TK_ENUM = 0x40; + const octet TK_BITMASK = 0x41; + + // Structured TKs + const octet TK_ANNOTATION = 0x50; + const octet TK_STRUCTURE = 0x51; + const octet TK_UNION = 0x52; + const octet TK_BITSET = 0x53; + + // Collection TKs + const octet TK_SEQUENCE = 0x60; + const octet TK_ARRAY = 0x61; + const octet TK_MAP = 0x62; + // ---------- TypeKinds (end) ------------------- + + // ---------- Extra TypeIdentifiers (begin) ------------ + typedef octet TypeIdentiferKind; + const octet TI_STRING8_SMALL = 0x70; + const octet TI_STRING8_LARGE = 0x71; + const octet TI_STRING16_SMALL = 0x72; + const octet TI_STRING16_LARGE = 0x73; + + const octet TI_PLAIN_SEQUENCE_SMALL = 0x80; + const octet TI_PLAIN_SEQUENCE_LARGE = 0x81; + + const octet TI_PLAIN_ARRAY_SMALL = 0x90; + const octet TI_PLAIN_ARRAY_LARGE = 0x91; + + const octet TI_PLAIN_MAP_SMALL = 0xA0; + const octet TI_PLAIN_MAP_LARGE = 0xA1; + + const octet TI_STRONGLY_CONNECTED_COMPONENT = 0xB0; + // ---------- Extra TypeIdentifiers (end) -------------- + + // The name of some element (e.g. type, type member, module) + // Valid characters are alphanumeric plus the "_" cannot start with digit + const long MEMBER_NAME_MAX_LENGTH = 256; + typedef string MemberName; + + // Qualified type name includes the name of containing modules + // using "::" as separator. No leading "::". E.g. "MyModule::MyType" + const long TYPE_NAME_MAX_LENGTH = 256; + typedef string QualifiedTypeName; + + // Every type has an ID. Those of the primitive types are pre-defined. + typedef octet PrimitiveTypeId; + + // First 14 bytes of MD5 of the serialized TypeObject using XCDR + // version 2 with Little Endian encoding + typedef octet EquivalenceHash[14]; + + // First 4 bytes of MD5 of of a member name converted to bytes + // using UTF-8 encoding and without a 'nul' terminator. + // Example: the member name "color" has NameHash {0x70, 0xDD, 0xA5, 0xDF} + typedef octet NameHash[4]; + + // Long Bound of a collection type + typedef unsigned long LBound; + typedef sequence LBoundSeq; + const LBound INVALID_LBOUND = 0; + + // Short Bound of a collection type + typedef octet SBound; + typedef sequence SBoundSeq; + const SBound INVALID_SBOUND = 0; + + @extensibility(FINAL) @nested + union TypeObjectHashId switch (octet) { + case EK_COMPLETE: + case EK_MINIMAL: + EquivalenceHash hash; + }; + + // Flags that apply to struct/union/collection/enum/bitmask/bitset + // members/elements and DO affect type assignability + // Depending on the flag it may not apply to members of all types + // When not all, the applicable member types are listed + @bit_bound(16) + bitmask MemberFlag { + @position(0) TRY_CONSTRUCT1, // T1 | 00 = INVALID, 01 = DISCARD + @position(1) TRY_CONSTRUCT2, // T2 | 10 = USE_DEFAULT, 11 = TRIM + @position(2) IS_EXTERNAL, // X StructMember, UnionMember, + // CollectionElement + @position(3) IS_OPTIONAL, // O StructMember + @position(4) IS_MUST_UNDERSTAND, // M StructMember + @position(5) IS_KEY, // K StructMember, UnionDiscriminator + @position(6) IS_DEFAULT // D UnionMember, EnumerationLiteral + }; + typedef MemberFlag CollectionElementFlag; // T1, T2, X + typedef MemberFlag StructMemberFlag; // T1, T2, O, M, K, X + typedef MemberFlag UnionMemberFlag; // T1, T2, D, X + typedef MemberFlag UnionDiscriminatorFlag; // T1, T2, K + typedef MemberFlag EnumeratedLiteralFlag; // D + typedef MemberFlag AnnotationParameterFlag; // Unused. No flags apply + typedef MemberFlag AliasMemberFlag; // Unused. No flags apply + typedef MemberFlag BitflagFlag; // Unused. No flags apply + typedef MemberFlag BitsetMemberFlag; // Unused. No flags apply + + // Mask used to remove the flags that do no affect assignability + // Selects T1, T2, O, M, K, D + const unsigned short MemberFlagMinimalMask = 0x003f; + + // Flags that apply to type declarationa and DO affect assignability + // Depending on the flag it may not apply to all types + // When not all, the applicable types are listed + @bit_bound(16) + bitmask TypeFlag { + @position(0) IS_FINAL, // F | + @position(1) IS_APPENDABLE, // A |- Struct, Union + @position(2) IS_MUTABLE, // M | (exactly one flag) + + @position(3) IS_NESTED, // N Struct, Union + @position(4) IS_AUTOID_HASH // H Struct + }; + typedef TypeFlag StructTypeFlag; // All flags apply + typedef TypeFlag UnionTypeFlag; // All flags apply + typedef TypeFlag CollectionTypeFlag; // Unused. No flags apply + typedef TypeFlag AnnotationTypeFlag; // Unused. No flags apply + typedef TypeFlag AliasTypeFlag; // Unused. No flags apply + typedef TypeFlag EnumTypeFlag; // Unused. No flags apply + typedef TypeFlag BitmaskTypeFlag; // Unused. No flags apply + typedef TypeFlag BitsetTypeFlag; // Unused. No flags apply + + // Mask used to remove the flags that do no affect assignability + const unsigned short TypeFlagMinimalMask = 0x0007; // Selects M, A, F + + // Forward declaration + union TypeIdentifier; + + // 1 Byte + @extensibility(FINAL) @nested + struct StringSTypeDefn { + SBound bound; + }; + + // 4 Bytes + @extensibility(FINAL) @nested + struct StringLTypeDefn { + LBound bound; + }; + + @extensibility(FINAL) @nested + struct PlainCollectionHeader { + EquivalenceKind equiv_kind; + CollectionElementFlag element_flags; + }; + + @extensibility(FINAL) @nested + struct PlainSequenceSElemDefn { + PlainCollectionHeader header; + SBound bound; + @external TypeIdentifier element_identifier; + }; + + @extensibility(FINAL) @nested + struct PlainSequenceLElemDefn { + PlainCollectionHeader header; + LBound bound; + @external TypeIdentifier element_identifier; + }; + + @extensibility(FINAL) @nested + struct PlainArraySElemDefn { + PlainCollectionHeader header; + SBoundSeq array_bound_seq; + @external TypeIdentifier element_identifier; + }; + + @extensibility(FINAL) @nested + struct PlainArrayLElemDefn { + PlainCollectionHeader header; + LBoundSeq array_bound_seq; + @external TypeIdentifier element_identifier; + }; + + @extensibility(FINAL) @nested + struct PlainMapSTypeDefn { + PlainCollectionHeader header; + SBound bound; + @external TypeIdentifier element_identifier; + CollectionElementFlag key_flags; + @external TypeIdentifier key_identifier; + }; + + @extensibility(FINAL) @nested + struct PlainMapLTypeDefn { + PlainCollectionHeader header; + LBound bound; + @external TypeIdentifier element_identifier; + CollectionElementFlag key_flags; + @external TypeIdentifier key_identifier; + }; + + // Used for Types that have cyclic depencencies with other types + @extensibility(APPENDABLE) @nested + struct StronglyConnectedComponentId { + TypeObjectHashId sc_component_id; // Hash StronglyConnectedComponent + long scc_length; // StronglyConnectedComponent.length + long scc_index ; // identify type in Strongly Connected Comp. + }; + + // Future extensibility + @extensibility(MUTABLE) @nested + struct ExtendedTypeDefn { + }; + + + + // The TypeIdentifier uniquely identifies a type (a set of equivalent + // types according to an equivalence relationship: COMPLETE, MNIMAL). + // + // In some cases (primitive types, strings, plain types) the identifier + // is a explicit description of the type. + // In other cases the Identifier is a Hash of the type description + // + // In the case of primitive types and strings the implied equivalence + // relation is the identity. + // + // For Plain Types and Hash-defined TypeIdentifiers there are three + // possibilities: MINIMAL, COMPLETE, and COMMON: + // - MINIMAL indicates the TypeIdentifier identifies equivalent types + // according to the MINIMAL equivalence relation + // - COMPLETE indicates the TypeIdentifier identifies equivalent types + // according to the COMPLETE equivalence relation + // - COMMON indicates the TypeIdentifier identifies equivalent types + // according to both the MINIMAL and the COMMON equivalence relation. + // This means the TypeIdentifier is the same for both relationships + // + @extensibility(FINAL) @nested(FALSE) + union TypeIdentifier switch (octet) { + // ============ Primitive types - use TypeKind ==================== + // All primitive types fall here. + // Commented-out because Unions cannot have cases with no member. + /* + case TK_NONE: + case TK_BOOLEAN: + case TK_BYTE_TYPE: + case TK_INT16_TYPE: + case TK_INT32_TYPE: + case TK_INT64_TYPE: + case TK_UINT16_TYPE: + case TK_UINT32_TYPE: + case TK_UINT64_TYPE: + case TK_FLOAT32_TYPE: + case TK_FLOAT64_TYPE: + case TK_FLOAT128_TYPE: + case TK_CHAR8_TYPE: + case TK_CHAR16_TYPE: + // No Value + */ + + // ============ Strings - use TypeIdentifierKind =================== + case TI_STRING8_SMALL: + case TI_STRING16_SMALL: + StringSTypeDefn string_sdefn; + + case TI_STRING8_LARGE: + case TI_STRING16_LARGE: + StringLTypeDefn string_ldefn; + + // ============ Plain collectios - use TypeIdentifierKind ========= + case TI_PLAIN_SEQUENCE_SMALL: + PlainSequenceSElemDefn seq_sdefn; + case TI_PLAIN_SEQUENCE_LARGE: + PlainSequenceLElemDefn seq_ldefn; + + case TI_PLAIN_ARRAY_SMALL: + PlainArraySElemDefn array_sdefn; + case TI_PLAIN_ARRAY_LARGE: + PlainArrayLElemDefn array_ldefn; + + case TI_PLAIN_MAP_SMALL: + PlainMapSTypeDefn map_sdefn; + case TI_PLAIN_MAP_LARGE: + PlainMapLTypeDefn map_ldefn; + + // ============ Types that are mutually dependent on each other === + case TI_STRONGLY_CONNECTED_COMPONENT: + StronglyConnectedComponentId sc_component_id; + + // ============ The remaining cases - use EquivalenceKind ========= + case EK_COMPLETE: + case EK_MINIMAL: + EquivalenceHash equivalence_hash; + + // =================== Future extensibility ============ + // Future extensions + + /* Disabled default so that cases with no member do not + map to the default member */ + // default: + // ExtendedTypeDefn extended_defn; + }; + typedef sequence TypeIdentifierSeq; + + + // --- Annotation usage: ----------------------------------------------- + + // ID of a type member + typedef unsigned long MemberId; + const unsigned long ANNOTATION_STR_VALUE_MAX_LEN = 128; + const unsigned long ANNOTATION_OCTETSEC_VALUE_MAX_LEN = 128; + + // Empty. Available for future extension + @extensibility(MUTABLE) @nested + struct ExtendedAnnotationParameterValue { + }; + + /* Literal value of an annotation member: either the default value in its definition or the value applied in its usage. */ + @extensibility(FINAL) @nested + union AnnotationParameterValue switch (octet) { + case TK_BOOLEAN: + boolean boolean_value; + case TK_BYTE: + octet byte_value; + case TK_INT16: + short int16_value; + case TK_UINT16: + unsigned short uint_16_value; + case TK_INT32: + long int32_value; + case TK_UINT32: + unsigned long uint32_value; + case TK_INT64: + long long int64_value; + case TK_UINT64: + unsigned long long uint64_value; + case TK_FLOAT32: + float float32_value; + case TK_FLOAT64: + double float64_value; + // case TK_FLOAT128: + // long double float128_value; + case TK_CHAR8: + char char_value; + // case TK_CHAR16: + // wchar wchar_value; + case TK_ENUM: + long enumerated_value; + case TK_STRING8: + string string8_value; + // case TK_STRING16: + // wstring string16_value; + default: + ExtendedAnnotationParameterValue extended_value; + }; + + // The application of an annotation to some type or type member + @extensibility(APPENDABLE) @nested + struct AppliedAnnotationParameter { + NameHash paramname_hash; + AnnotationParameterValue value; + }; + // Sorted by AppliedAnnotationParameter.paramname_hash + typedef + sequence AppliedAnnotationParameterSeq; + + @extensibility(APPENDABLE) @nested + struct AppliedAnnotation { + TypeIdentifier annotation_typeid; + @optional AppliedAnnotationParameterSeq param_seq; + }; + // Sorted by AppliedAnnotation.annotation_typeid + typedef sequence AppliedAnnotationSeq; + + // @verbatim(placement="", language="", text="") + @extensibility(FINAL) @nested + struct AppliedVerbatimAnnotation { + string<32> placement; + string<32> language; + string text; + }; + + + // --- Aggregate types: ------------------------------------------------ + @extensibility(APPENDABLE) @nested + struct AppliedBuiltinMemberAnnotations { + @optional string unit; // @unit("") + @optional AnnotationParameterValue min; // @min , @range + @optional AnnotationParameterValue max; // @max , @range + @optional string hash_id; // @hash_id("") + }; + + @extensibility(FINAL) @nested + struct CommonStructMember { + MemberId member_id; + StructMemberFlag member_flags; + TypeIdentifier member_type_id; + }; + + // COMPLETE Details for a member of an aggregate type + @extensibility(FINAL) @nested + struct CompleteMemberDetail { + MemberName name; + @optional AppliedBuiltinMemberAnnotations ann_builtin; + @optional AppliedAnnotationSeq ann_custom; + }; + + // MINIMAL Details for a member of an aggregate type + @extensibility(FINAL) @nested + struct MinimalMemberDetail { + NameHash name_hash; + }; + + // Member of an aggregate type + @extensibility(APPENDABLE) @nested + struct CompleteStructMember { + CommonStructMember common; + CompleteMemberDetail detail; + }; + // Ordered by the member_index + typedef sequence CompleteStructMemberSeq; + + // Member of an aggregate type + @extensibility(APPENDABLE) @nested + struct MinimalStructMember { + CommonStructMember common; + MinimalMemberDetail detail; + }; + // Ordered by common.member_id + typedef sequence MinimalStructMemberSeq; + + + @extensibility(APPENDABLE) @nested + struct AppliedBuiltinTypeAnnotations { + @optional AppliedVerbatimAnnotation verbatim; // @verbatim(...) + }; + + @extensibility(FINAL) @nested + struct MinimalTypeDetail { + // Empty. Available for future extension + }; + + @extensibility(FINAL) @nested + struct CompleteTypeDetail { + @optional AppliedBuiltinTypeAnnotations ann_builtin; + @optional AppliedAnnotationSeq ann_custom; + QualifiedTypeName type_name; + }; + + @extensibility(APPENDABLE) @nested + struct CompleteStructHeader { + TypeIdentifier base_type; + CompleteTypeDetail detail; + }; + + @extensibility(APPENDABLE) @nested + struct MinimalStructHeader { + TypeIdentifier base_type; + MinimalTypeDetail detail; + }; + + @extensibility(FINAL) @nested + struct CompleteStructType { + StructTypeFlag struct_flags; + CompleteStructHeader header; + CompleteStructMemberSeq member_seq; + }; + + @extensibility(FINAL) @nested + struct MinimalStructType { + StructTypeFlag struct_flags; + MinimalStructHeader header; + MinimalStructMemberSeq member_seq; + }; + + // --- Union: ---------------------------------------------------------- + + // Case labels that apply to a member of a union type + // Ordered by their values + typedef sequence UnionCaseLabelSeq; + + @extensibility(FINAL) @nested + struct CommonUnionMember { + MemberId member_id; + UnionMemberFlag member_flags; + TypeIdentifier type_id; + UnionCaseLabelSeq label_seq; + }; + + // Member of a union type + @extensibility(APPENDABLE) @nested + struct CompleteUnionMember { + CommonUnionMember common; + CompleteMemberDetail detail; + }; + // Ordered by member_index + typedef sequence CompleteUnionMemberSeq; + + // Member of a union type + @extensibility(APPENDABLE) @nested + struct MinimalUnionMember { + CommonUnionMember common; + MinimalMemberDetail detail; + }; + // Ordered by MinimalUnionMember.common.member_id + typedef sequence MinimalUnionMemberSeq; + + @extensibility(FINAL) @nested + struct CommonDiscriminatorMember { + UnionDiscriminatorFlag member_flags; + TypeIdentifier type_id; + }; + + // Member of a union type + @extensibility(APPENDABLE) @nested + struct CompleteDiscriminatorMember { + CommonDiscriminatorMember common; + @optional AppliedBuiltinTypeAnnotations ann_builtin; + @optional AppliedAnnotationSeq ann_custom; + }; + + // Member of a union type + @extensibility(APPENDABLE) @nested + struct MinimalDiscriminatorMember { + CommonDiscriminatorMember common; + }; + + @extensibility(APPENDABLE) @nested + struct CompleteUnionHeader { + CompleteTypeDetail detail; + }; + + @extensibility(APPENDABLE) @nested + struct MinimalUnionHeader { + MinimalTypeDetail detail; + }; + + @extensibility(FINAL) @nested + struct CompleteUnionType { + UnionTypeFlag union_flags; + CompleteUnionHeader header; + CompleteDiscriminatorMember discriminator; + CompleteUnionMemberSeq member_seq; + }; + + @extensibility(FINAL) @nested + struct MinimalUnionType { + UnionTypeFlag union_flags; + MinimalUnionHeader header; + MinimalDiscriminatorMember discriminator; + MinimalUnionMemberSeq member_seq; + }; + + // --- Annotation: ---------------------------------------------------- + @extensibility(FINAL) @nested + struct CommonAnnotationParameter { + AnnotationParameterFlag member_flags; + TypeIdentifier member_type_id; + }; + + // Member of an annotation type + @extensibility(APPENDABLE) @nested + struct CompleteAnnotationParameter { + CommonAnnotationParameter common; + MemberName name; + AnnotationParameterValue default_value; + }; + // Ordered by CompleteAnnotationParameter.name + typedef + sequence CompleteAnnotationParameterSeq; + + @extensibility(APPENDABLE) @nested + struct MinimalAnnotationParameter { + CommonAnnotationParameter common; + NameHash name_hash; + AnnotationParameterValue default_value; + }; + // Ordered by MinimalAnnotationParameter.name_hash + typedef + sequence MinimalAnnotationParameterSeq; + + @extensibility(APPENDABLE) @nested + struct CompleteAnnotationHeader { + QualifiedTypeName annotation_name; + }; + + @extensibility(APPENDABLE) @nested + struct MinimalAnnotationHeader { + // Empty. Available for future extension + }; + + @extensibility(FINAL) @nested + struct CompleteAnnotationType { + AnnotationTypeFlag annotation_flag; + CompleteAnnotationHeader header; + CompleteAnnotationParameterSeq member_seq; + }; + + @extensibility(FINAL) @nested + struct MinimalAnnotationType { + AnnotationTypeFlag annotation_flag; + MinimalAnnotationHeader header; + MinimalAnnotationParameterSeq member_seq; + }; + + + // --- Alias: ---------------------------------------------------------- + @extensibility(FINAL) @nested + struct CommonAliasBody { + AliasMemberFlag related_flags; + TypeIdentifier related_type; + }; + + @extensibility(APPENDABLE) @nested + struct CompleteAliasBody { + CommonAliasBody common; + @optional AppliedBuiltinMemberAnnotations ann_builtin; + @optional AppliedAnnotationSeq ann_custom; + }; + + @extensibility(APPENDABLE) @nested + struct MinimalAliasBody { + CommonAliasBody common; + }; + + @extensibility(APPENDABLE) @nested + struct CompleteAliasHeader { + CompleteTypeDetail detail; + }; + + @extensibility(APPENDABLE) @nested + struct MinimalAliasHeader { + // Empty. Available for future extension + }; + + @extensibility(FINAL) @nested + struct CompleteAliasType { + AliasTypeFlag alias_flags; + CompleteAliasHeader header; + CompleteAliasBody body; + }; + + @extensibility(FINAL) @nested + struct MinimalAliasType { + AliasTypeFlag alias_flags; + MinimalAliasHeader header; + MinimalAliasBody body; + }; + + // --- Collections: ---------------------------------------------------- + @extensibility(FINAL) @nested + struct CompleteElementDetail { + @optional AppliedBuiltinMemberAnnotations ann_builtin; + @optional AppliedAnnotationSeq ann_custom; + }; + + @extensibility(FINAL) @nested + struct CommonCollectionElement { + CollectionElementFlag element_flags; + TypeIdentifier type; + }; + + @extensibility(APPENDABLE) @nested + struct CompleteCollectionElement { + CommonCollectionElement common; + CompleteElementDetail detail; + }; + + @extensibility(APPENDABLE) @nested + struct MinimalCollectionElement { + CommonCollectionElement common; + }; + + @extensibility(FINAL) @nested + struct CommonCollectionHeader { + LBound bound; + }; + + @extensibility(APPENDABLE) @nested + struct CompleteCollectionHeader { + CommonCollectionHeader common; + @optional CompleteTypeDetail detail; // not present for anonymous + }; + + @extensibility(APPENDABLE) @nested + struct MinimalCollectionHeader { + CommonCollectionHeader common; + }; + + // --- Sequence: ------------------------------------------------------ + @extensibility(FINAL) @nested + struct CompleteSequenceType { + CollectionTypeFlag collection_flag; + CompleteCollectionHeader header; + CompleteCollectionElement element; + }; + + @extensibility(FINAL) @nested + struct MinimalSequenceType { + CollectionTypeFlag collection_flag; + MinimalCollectionHeader header; + MinimalCollectionElement element; + }; + + // --- Array: ------------------------------------------------------ + @extensibility(FINAL) @nested + struct CommonArrayHeader { + LBoundSeq bound_seq; + }; + + @extensibility(APPENDABLE) @nested + struct CompleteArrayHeader { + CommonArrayHeader common; + CompleteTypeDetail detail; + }; + + @extensibility(APPENDABLE) @nested + struct MinimalArrayHeader { + CommonArrayHeader common; + }; + + @extensibility(APPENDABLE) @nested + struct CompleteArrayType { + CollectionTypeFlag collection_flag; + CompleteArrayHeader header; + CompleteCollectionElement element; + }; + + @extensibility(FINAL) @nested + struct MinimalArrayType { + CollectionTypeFlag collection_flag; + MinimalArrayHeader header; + MinimalCollectionElement element; + }; + + // --- Map: ------------------------------------------------------ + @extensibility(FINAL) @nested + struct CompleteMapType { + CollectionTypeFlag collection_flag; + CompleteCollectionHeader header; + CompleteCollectionElement key; + CompleteCollectionElement element; + }; + + @extensibility(FINAL) @nested + struct MinimalMapType { + CollectionTypeFlag collection_flag; + MinimalCollectionHeader header; + MinimalCollectionElement key; + MinimalCollectionElement element; + }; + + // --- Enumeration: ---------------------------------------------------- + typedef unsigned short BitBound; + + // Constant in an enumerated type + @extensibility(APPENDABLE) @nested + struct CommonEnumeratedLiteral { + long value; + EnumeratedLiteralFlag flags; + }; + + // Constant in an enumerated type + @extensibility(APPENDABLE) @nested + struct CompleteEnumeratedLiteral { + CommonEnumeratedLiteral common; + CompleteMemberDetail detail; + }; + // Ordered by EnumeratedLiteral.common.value + typedef sequence CompleteEnumeratedLiteralSeq; + + // Constant in an enumerated type + @extensibility(APPENDABLE) @nested + struct MinimalEnumeratedLiteral { + CommonEnumeratedLiteral common; + MinimalMemberDetail detail; + }; + // Ordered by EnumeratedLiteral.common.value + typedef sequence MinimalEnumeratedLiteralSeq; + + @extensibility(FINAL) @nested + struct CommonEnumeratedHeader { + BitBound bit_bound; + }; + + @extensibility(APPENDABLE) @nested + struct CompleteEnumeratedHeader { + CommonEnumeratedHeader common; + CompleteTypeDetail detail; + }; + + @extensibility(APPENDABLE) @nested + struct MinimalEnumeratedHeader { + CommonEnumeratedHeader common; + }; + + // Enumerated type + @extensibility(FINAL) @nested + struct CompleteEnumeratedType { + EnumTypeFlag enum_flags; // unused + CompleteEnumeratedHeader header; + CompleteEnumeratedLiteralSeq literal_seq; + }; + + // Enumerated type + @extensibility(FINAL) @nested + struct MinimalEnumeratedType { + EnumTypeFlag enum_flags; // unused + MinimalEnumeratedHeader header; + MinimalEnumeratedLiteralSeq literal_seq; + }; + + // --- Bitmask: -------------------------------------------------------- + // Bit in a bit mask + @extensibility(FINAL) @nested + struct CommonBitflag { + unsigned short position; + BitflagFlag flags; + }; + + @extensibility(APPENDABLE) @nested + struct CompleteBitflag { + CommonBitflag common; + CompleteMemberDetail detail; + }; + // Ordered by Bitflag.position + typedef sequence CompleteBitflagSeq; + + @extensibility(APPENDABLE) @nested + struct MinimalBitflag { + CommonBitflag common; + MinimalMemberDetail detail; + }; + // Ordered by Bitflag.position + typedef sequence MinimalBitflagSeq; + + @extensibility(FINAL) @nested + struct CommonBitmaskHeader { + BitBound bit_bound; + }; + + typedef CompleteEnumeratedHeader CompleteBitmaskHeader; + + typedef MinimalEnumeratedHeader MinimalBitmaskHeader; + + @extensibility(APPENDABLE) @nested + struct CompleteBitmaskType { + BitmaskTypeFlag bitmask_flags; // unused + CompleteBitmaskHeader header; + CompleteBitflagSeq flag_seq; + }; + + @extensibility(APPENDABLE) @nested + struct MinimalBitmaskType { + BitmaskTypeFlag bitmask_flags; // unused + MinimalBitmaskHeader header; + MinimalBitflagSeq flag_seq; + }; + + // --- Bitset: ---------------------------------------------------------- + @extensibility(FINAL) @nested + struct CommonBitfield { + unsigned short position; + BitsetMemberFlag flags; + octet bitcount; + TypeKind holder_type; // Must be primitive integer type + }; + + @extensibility(APPENDABLE) @nested + struct CompleteBitfield { + CommonBitfield common; + CompleteMemberDetail detail; + }; + // Ordered by Bitfield.position + typedef sequence CompleteBitfieldSeq; + + @extensibility(APPENDABLE) @nested + struct MinimalBitfield { + CommonBitfield common; + NameHash name_hash; + }; + // Ordered by Bitfield.position + typedef sequence MinimalBitfieldSeq; + + @extensibility(APPENDABLE) @nested + struct CompleteBitsetHeader { + CompleteTypeDetail detail; + }; + + @extensibility(APPENDABLE) @nested + struct MinimalBitsetHeader { + // Empty. Available for future extension + }; + + @extensibility(APPENDABLE) @nested + struct CompleteBitsetType { + BitsetTypeFlag bitset_flags; // unused + CompleteBitsetHeader header; + CompleteBitfieldSeq field_seq; + }; + + @extensibility(APPENDABLE) @nested + struct MinimalBitsetType { + BitsetTypeFlag bitset_flags; // unused + MinimalBitsetHeader header; + MinimalBitfieldSeq field_seq; + }; + + // --- Type Object: --------------------------------------------------- + // The types associated with each case selection must have extensibility + // kind APPENDABLE or MUTABLE so that they can be extended in the future + + @extensibility(MUTABLE) @nested + struct CompleteExtendedType { + // Empty. Available for future extension + }; + + @extensibility(FINAL) @nested + union CompleteTypeObject switch (octet) { + case TK_ALIAS: + CompleteAliasType alias_type; + case TK_ANNOTATION: + CompleteAnnotationType annotation_type; + case TK_STRUCTURE: + CompleteStructType struct_type; + case TK_UNION: + CompleteUnionType union_type; + case TK_BITSET: + CompleteBitsetType bitset_type; + case TK_SEQUENCE: + CompleteSequenceType sequence_type; + case TK_ARRAY: + CompleteArrayType array_type; + case TK_MAP: + CompleteMapType map_type; + case TK_ENUM: + CompleteEnumeratedType enumerated_type; + case TK_BITMASK: + CompleteBitmaskType bitmask_type; + + // =================== Future extensibility ============ + default: + CompleteExtendedType extended_type; + }; + + @extensibility(MUTABLE) @nested + struct MinimalExtendedType { + // Empty. Available for future extension + }; + + + @extensibility(FINAL) @nested + union MinimalTypeObject switch (octet) { + case TK_ALIAS: + MinimalAliasType alias_type; + case TK_ANNOTATION: + MinimalAnnotationType annotation_type; + case TK_STRUCTURE: + MinimalStructType struct_type; + case TK_UNION: + MinimalUnionType union_type; + case TK_BITSET: + MinimalBitsetType bitset_type; + case TK_SEQUENCE: + MinimalSequenceType sequence_type; + case TK_ARRAY: + MinimalArrayType array_type; + case TK_MAP: + MinimalMapType map_type; + case TK_ENUM: + MinimalEnumeratedType enumerated_type; + case TK_BITMASK: + MinimalBitmaskType bitmask_type; + + // =================== Future extensibility ============ + default: + MinimalExtendedType extended_type; + }; + + @extensibility(APPENDABLE) @nested(FALSE) + union TypeObject switch (octet) { // EquivalenceKind + case EK_COMPLETE: + CompleteTypeObject complete; + case EK_MINIMAL: + MinimalTypeObject minimal; + }; + typedef sequence TypeObjectSeq; + + // Set of TypeObjects representing a strong component: Equivalence class + // for the Strong Connectivity relationship (mutual reachability between + // types). + // Ordered by fully qualified typename lexicographic order + typedef TypeObjectSeq StronglyConnectedComponent; + + @extensibility(FINAL) @nested + struct TypeIdentifierTypeObjectPair { + TypeIdentifier type_identifier; + TypeObject type_object; + }; + typedef + sequence TypeIdentifierTypeObjectPairSeq; + + @extensibility(FINAL) @nested + struct TypeIdentifierPair { + TypeIdentifier type_identifier1; + TypeIdentifier type_identifier2; + }; + typedef sequence TypeIdentifierPairSeq; + + @extensibility(APPENDABLE) @nested + struct TypeIdentifierWithSize { + DDS::XTypes::TypeIdentifier type_id; + unsigned long typeobject_serialized_size; + }; + typedef sequence TypeIdentifierWithSizeSeq; + + @extensibility(APPENDABLE) @nested + struct TypeIdentifierWithDependencies { + TypeIdentifierWithSize typeid_with_size; + // The total additional types related to minimal_type + long dependent_typeid_count; + sequence dependent_typeids; + }; + typedef + sequence TypeIdentifierWithDependenciesSeq; + + // This appears in the builtin DDS topics PublicationBuiltinTopicData + // and SubscriptionBuiltinTopicData + @extensibility(MUTABLE) @nested(FALSE) + struct TypeInformation { + @id(0x1001) TypeIdentifierWithDependencies minimal; + @id(0x1002) TypeIdentifierWithDependencies complete; + }; + typedef sequence TypeInformationSeq; + +}; // end of module XTypes +}; // end module DDS + + + diff --git a/unitree_SDK/include/dds/ddsi/ddsi_xt_typelookup.h b/unitree_SDK/include/dds/ddsi/ddsi_xt_typelookup.h new file mode 100644 index 0000000..c83d59d --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_xt_typelookup.h @@ -0,0 +1,308 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to C Translator + File name: ddsi_xt_typelookup.h + Source: ddsi_xt_typelookup.idl + Cyclone DDS: V0.9.0 + +*****************************************************************/ +#ifndef DDSI_XT_TYPELOOKUP_H +#define DDSI_XT_TYPELOOKUP_H + +#include "dds/ddsi/ddsi_xt_typeinfo.h" +#include "dds/ddsc/dds_public_impl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint8_t DDS_GuidPrefix_t[12]; + +#define DDS_GuidPrefix_t__alloc() \ +((DDS_GuidPrefix_t*) dds_alloc (sizeof (DDS_GuidPrefix_t))); + +typedef struct DDS_EntityId_t +{ + uint8_t entityKey[3]; + uint8_t entityKind; +} DDS_EntityId_t; + +typedef struct DDS_GUID_t +{ + DDS_GuidPrefix_t guidPrefix; + struct DDS_EntityId_t entityId; +} DDS_GUID_t; + +typedef struct DDS_SequenceNumber +{ + int32_t high; + uint32_t low; +} DDS_SequenceNumber; + +typedef struct DDS_SampleIdentity +{ + struct DDS_GUID_t writer_guid; + struct DDS_SequenceNumber sequence_number; +} DDS_SampleIdentity; + +#define DDS_DDS_RETCODE_OK 0 +typedef uint8_t DDS_RPC_UnknownOperation; + +#define DDS_RPC_UnknownOperation__alloc() \ +((DDS_RPC_UnknownOperation*) dds_alloc (sizeof (DDS_RPC_UnknownOperation))); + +typedef uint8_t DDS_RPC_UnknownException; + +#define DDS_RPC_UnknownException__alloc() \ +((DDS_RPC_UnknownException*) dds_alloc (sizeof (DDS_RPC_UnknownException))); + +typedef uint8_t DDS_RPC_UnusedMember; + +#define DDS_RPC_UnusedMember__alloc() \ +((DDS_RPC_UnusedMember*) dds_alloc (sizeof (DDS_RPC_UnusedMember))); + +typedef enum DDS_RPC_RemoteExceptionCode +{ + DDS_RPC_REMOTE_EX_OK, + DDS_RPC_REMOTE_EX_UNSUPPORTED, + DDS_RPC_REMOTE_EX_INVALID_ARGUMENT, + DDS_RPC_REMOTE_EX_OUT_OF_RESOURCES, + DDS_RPC_REMOTE_EX_UNKNOWN_OPERATION, + DDS_RPC_REMOTE_EX_UNKNOWN_EXCEPTION +} DDS_RPC_RemoteExceptionCode; + +#define DDS_RPC_RemoteExceptionCode__alloc() \ +((DDS_RPC_RemoteExceptionCode*) dds_alloc (sizeof (DDS_RPC_RemoteExceptionCode))); + +typedef char DDS_RPC_InstanceName[256]; + +#define DDS_RPC_InstanceName__alloc() \ +((DDS_RPC_InstanceName*) dds_alloc (sizeof (DDS_RPC_InstanceName))); + +typedef struct DDS_RPC_RequestHeader +{ + struct DDS_SampleIdentity requestId; + DDS_RPC_InstanceName instanceName; +} DDS_RPC_RequestHeader; + +typedef struct DDS_RPC_ReplyHeader +{ + struct DDS_SampleIdentity relatedRequestId; + DDS_RPC_RemoteExceptionCode remoteEx; +} DDS_RPC_ReplyHeader; + +#define DDS_Builtin_TypeLookup_getTypes_HashId 25318099 +#define DDS_Builtin_TypeLookup_getDependencies_HashId 95091505 +#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED +#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED +typedef struct dds_sequence_DDS_XTypes_TypeIdentifier +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifier *_buffer; + bool _release; +} dds_sequence_DDS_XTypes_TypeIdentifier; + +#define dds_sequence_DDS_XTypes_TypeIdentifier__alloc() \ +((dds_sequence_DDS_XTypes_TypeIdentifier*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifier))); + +#define dds_sequence_DDS_XTypes_TypeIdentifier_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifier *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifier))) +#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED */ + +typedef struct DDS_Builtin_TypeLookup_getTypes_In +{ + dds_sequence_DDS_XTypes_TypeIdentifier type_ids; +} DDS_Builtin_TypeLookup_getTypes_In; + +#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED +#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED +typedef struct dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifierTypeObjectPair *_buffer; + bool _release; +} dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair; + +#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair__alloc() \ +((dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair))); + +#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifierTypeObjectPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierTypeObjectPair))) +#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED */ + +#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED +#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED +typedef struct dds_sequence_DDS_XTypes_TypeIdentifierPair +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifierPair *_buffer; + bool _release; +} dds_sequence_DDS_XTypes_TypeIdentifierPair; + +#define dds_sequence_DDS_XTypes_TypeIdentifierPair__alloc() \ +((dds_sequence_DDS_XTypes_TypeIdentifierPair*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierPair))); + +#define dds_sequence_DDS_XTypes_TypeIdentifierPair_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifierPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierPair))) +#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED */ + +typedef struct DDS_Builtin_TypeLookup_getTypes_Out +{ + dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair types; + dds_sequence_DDS_XTypes_TypeIdentifierPair complete_to_minimal; +} DDS_Builtin_TypeLookup_getTypes_Out; + +typedef struct DDS_Builtin_TypeLookup_getTypes_Result +{ + int32_t _d; + union + { + struct DDS_Builtin_TypeLookup_getTypes_Out result; + } _u; +} DDS_Builtin_TypeLookup_getTypes_Result; + +#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED +#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED +typedef struct dds_sequence_DDS_XTypes_TypeIdentifier +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifier *_buffer; + bool _release; +} dds_sequence_DDS_XTypes_TypeIdentifier; + +#define dds_sequence_DDS_XTypes_TypeIdentifier__alloc() \ +((dds_sequence_DDS_XTypes_TypeIdentifier*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifier))); + +#define dds_sequence_DDS_XTypes_TypeIdentifier_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifier *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifier))) +#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIER_DEFINED */ + +#ifndef DDS_SEQUENCE_OCTET_DEFINED +#define DDS_SEQUENCE_OCTET_DEFINED +typedef struct dds_sequence_octet +{ + uint32_t _maximum; + uint32_t _length; + uint8_t *_buffer; + bool _release; +} dds_sequence_octet; + +#define dds_sequence_octet__alloc() \ +((dds_sequence_octet*) dds_alloc (sizeof (dds_sequence_octet))); + +#define dds_sequence_octet_allocbuf(l) \ +((uint8_t *) dds_alloc ((l) * sizeof (uint8_t))) +#endif /* DDS_SEQUENCE_OCTET_DEFINED */ + +typedef struct DDS_Builtin_TypeLookup_getTypeDependencies_In +{ + dds_sequence_DDS_XTypes_TypeIdentifier type_ids; + dds_sequence_octet continuation_point; +} DDS_Builtin_TypeLookup_getTypeDependencies_In; + +#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERWITHSIZE_DEFINED +#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERWITHSIZE_DEFINED +typedef struct dds_sequence_DDS_XTypes_TypeIdentifierWithSize +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifierWithSize *_buffer; + bool _release; +} dds_sequence_DDS_XTypes_TypeIdentifierWithSize; + +#define dds_sequence_DDS_XTypes_TypeIdentifierWithSize__alloc() \ +((dds_sequence_DDS_XTypes_TypeIdentifierWithSize*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierWithSize))); + +#define dds_sequence_DDS_XTypes_TypeIdentifierWithSize_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifierWithSize *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierWithSize))) +#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERWITHSIZE_DEFINED */ + +#ifndef DDS_SEQUENCE_OCTET_DEFINED +#define DDS_SEQUENCE_OCTET_DEFINED +typedef struct dds_sequence_octet +{ + uint32_t _maximum; + uint32_t _length; + uint8_t *_buffer; + bool _release; +} dds_sequence_octet; + +#define dds_sequence_octet__alloc() \ +((dds_sequence_octet*) dds_alloc (sizeof (dds_sequence_octet))); + +#define dds_sequence_octet_allocbuf(l) \ +((uint8_t *) dds_alloc ((l) * sizeof (uint8_t))) +#endif /* DDS_SEQUENCE_OCTET_DEFINED */ + +typedef struct DDS_Builtin_TypeLookup_getTypeDependencies_Out +{ + dds_sequence_DDS_XTypes_TypeIdentifierWithSize dependent_typeids; + dds_sequence_octet continuation_point; +} DDS_Builtin_TypeLookup_getTypeDependencies_Out; + +typedef struct DDS_Builtin_TypeLookup_getTypeDependencies_Result +{ + int32_t _d; + union + { + struct DDS_Builtin_TypeLookup_getTypeDependencies_Out result; + } _u; +} DDS_Builtin_TypeLookup_getTypeDependencies_Result; + +typedef struct DDS_Builtin_TypeLookup_Call +{ + int32_t _d; + union + { + struct DDS_Builtin_TypeLookup_getTypes_In getTypes; + struct DDS_Builtin_TypeLookup_getTypeDependencies_In getTypeDependencies; + } _u; +} DDS_Builtin_TypeLookup_Call; + +typedef struct DDS_Builtin_TypeLookup_Request +{ + struct DDS_RPC_RequestHeader header; + struct DDS_Builtin_TypeLookup_Call data; +} DDS_Builtin_TypeLookup_Request; + +DDS_EXPORT extern const dds_topic_descriptor_t DDS_Builtin_TypeLookup_Request_desc; + +#define DDS_Builtin_TypeLookup_Request__alloc() \ +((DDS_Builtin_TypeLookup_Request*) dds_alloc (sizeof (DDS_Builtin_TypeLookup_Request))); + +#define DDS_Builtin_TypeLookup_Request_free(d,o) \ +dds_sample_free ((d), &DDS_Builtin_TypeLookup_Request_desc, (o)) + +typedef struct DDS_Builtin_TypeLookup_Return +{ + int32_t _d; + union + { + struct DDS_Builtin_TypeLookup_getTypes_Result getType; + struct DDS_Builtin_TypeLookup_getTypeDependencies_Result getTypeDependencies; + } _u; +} DDS_Builtin_TypeLookup_Return; + +typedef struct DDS_Builtin_TypeLookup_Reply +{ + struct DDS_RPC_ReplyHeader header; + struct DDS_Builtin_TypeLookup_Return return_data; +} DDS_Builtin_TypeLookup_Reply; + +DDS_EXPORT extern const dds_topic_descriptor_t DDS_Builtin_TypeLookup_Reply_desc; + +#define DDS_Builtin_TypeLookup_Reply__alloc() \ +((DDS_Builtin_TypeLookup_Reply*) dds_alloc (sizeof (DDS_Builtin_TypeLookup_Reply))); + +#define DDS_Builtin_TypeLookup_Reply_free(d,o) \ +dds_sample_free ((d), &DDS_Builtin_TypeLookup_Reply_desc, (o)) + +#ifdef __cplusplus +} +#endif + +#endif /* DDSI_XT_TYPELOOKUP_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_xt_typelookup.idl b/unitree_SDK/include/dds/ddsi/ddsi_xt_typelookup.idl new file mode 100644 index 0000000..580e76e --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_xt_typelookup.idl @@ -0,0 +1,144 @@ +#include "ddsi_xt_typeinfo.idl" + +@default_nested(TRUE) +module DDS { + +typedef octet GuidPrefix_t[12]; + +@final +struct EntityId_t { + octet entityKey[3]; octet entityKind; +}; + +@final +struct GUID_t { + GuidPrefix_t guidPrefix; + EntityId_t entityId; +}; + +@final +struct SequenceNumber { + long high; + unsigned long low; +}; + +@final +struct SampleIdentity { + GUID_t writer_guid; + SequenceNumber sequence_number; +}; + +const long DDS_RETCODE_OK = 0; + +}; // module DDS + +@default_nested(TRUE) +module DDS { module RPC { + +typedef octet UnknownOperation; +typedef octet UnknownException; +typedef octet UnusedMember; + +enum RemoteExceptionCode { + REMOTE_EX_OK, + REMOTE_EX_UNSUPPORTED, + REMOTE_EX_INVALID_ARGUMENT, + REMOTE_EX_OUT_OF_RESOURCES, + REMOTE_EX_UNKNOWN_OPERATION, + REMOTE_EX_UNKNOWN_EXCEPTION +}; + +typedef string<255> InstanceName; + +@final +struct RequestHeader { + DDS::SampleIdentity requestId; + DDS::RPC::InstanceName instanceName; +}; + +@final +struct ReplyHeader { + DDS::SampleIdentity relatedRequestId; + DDS::RPC::RemoteExceptionCode remoteEx; +}; + +}; }; // module DDS::RPC + + +@default_nested(TRUE) +module DDS { module Builtin { + +// computed from @hashid("getTypes") +const unsigned long TypeLookup_getTypes_HashId = 0x018252d3; + +// computed from @hashid("getDependencies"); +const unsigned long TypeLookup_getDependencies_HashId = 0x05aafb31; + +// Query the TypeObjects associated with one or more TypeIdentifiers +@extensibility(MUTABLE) +struct TypeLookup_getTypes_In { + @hashid sequence type_ids; +}; + +@extensibility(MUTABLE) +struct TypeLookup_getTypes_Out { + @hashid sequence types; + @hashid sequence complete_to_minimal; +}; + +union TypeLookup_getTypes_Result switch(long) { + case DDS_RETCODE_OK: + TypeLookup_getTypes_Out result; +}; + +// Query TypeIdentifiers that the specified types depend on +@extensibility(MUTABLE) +struct TypeLookup_getTypeDependencies_In { + @hashid sequence type_ids; + @hashid sequence continuation_point; +}; + +@extensibility(MUTABLE) +struct TypeLookup_getTypeDependencies_Out { + @hashid sequence dependent_typeids; + @hashid sequence continuation_point; +}; + +union TypeLookup_getTypeDependencies_Result switch(long){ + case DDS_RETCODE_OK: + TypeLookup_getTypeDependencies_Out result; +}; + +// Service Request +union TypeLookup_Call switch(long) { + case TypeLookup_getTypes_HashId: + TypeLookup_getTypes_In getTypes; + case TypeLookup_getDependencies_HashId: + TypeLookup_getTypeDependencies_In getTypeDependencies; +}; + +@nested(FALSE) +@RPCRequestType +@final +struct TypeLookup_Request { + DDS::RPC::RequestHeader header; + TypeLookup_Call data; +}; + +// Service Reply +union TypeLookup_Return switch(long) { + case TypeLookup_getTypes_HashId: + TypeLookup_getTypes_Result getType; + case TypeLookup_getDependencies_HashId: + TypeLookup_getTypeDependencies_Result getTypeDependencies; +}; + +@nested(FALSE) +@RPCReplyType +@final +struct TypeLookup_Reply { + DDS::RPC::ReplyHeader header; + TypeLookup_Return return_data; // changed from return to return_data to avoid collision with return keyword +}; + +}; }; // dds::builtin diff --git a/unitree_SDK/include/dds/ddsi/ddsi_xt_typemap.h b/unitree_SDK/include/dds/ddsi/ddsi_xt_typemap.h new file mode 100644 index 0000000..e27f6ea --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_xt_typemap.h @@ -0,0 +1,89 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to C Translator + File name: ddsi_xt_typemap.h + Source: ddsi_xt_typemap.idl + Cyclone DDS: V0.9.0 + +*****************************************************************/ +#ifndef DDSI_XT_TYPEMAP_H +#define DDSI_XT_TYPEMAP_H + +#include "dds/ddsi/ddsi_xt_typeinfo.h" +#include "dds/ddsc/dds_public_impl.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED +#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED +typedef struct dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifierTypeObjectPair *_buffer; + bool _release; +} dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair; + +#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair__alloc() \ +((dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair))); + +#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifierTypeObjectPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierTypeObjectPair))) +#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED */ + +#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED +#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED +typedef struct dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifierTypeObjectPair *_buffer; + bool _release; +} dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair; + +#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair__alloc() \ +((dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair))); + +#define dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifierTypeObjectPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierTypeObjectPair))) +#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERTYPEOBJECTPAIR_DEFINED */ + +#ifndef DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED +#define DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED +typedef struct dds_sequence_DDS_XTypes_TypeIdentifierPair +{ + uint32_t _maximum; + uint32_t _length; + struct DDS_XTypes_TypeIdentifierPair *_buffer; + bool _release; +} dds_sequence_DDS_XTypes_TypeIdentifierPair; + +#define dds_sequence_DDS_XTypes_TypeIdentifierPair__alloc() \ +((dds_sequence_DDS_XTypes_TypeIdentifierPair*) dds_alloc (sizeof (dds_sequence_DDS_XTypes_TypeIdentifierPair))); + +#define dds_sequence_DDS_XTypes_TypeIdentifierPair_allocbuf(l) \ +((struct DDS_XTypes_TypeIdentifierPair *) dds_alloc ((l) * sizeof (struct DDS_XTypes_TypeIdentifierPair))) +#endif /* DDS_SEQUENCE_DDS_XTYPES_TYPEIDENTIFIERPAIR_DEFINED */ + +typedef struct DDS_XTypes_TypeMapping +{ + dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair identifier_object_pair_minimal; + dds_sequence_DDS_XTypes_TypeIdentifierTypeObjectPair identifier_object_pair_complete; + dds_sequence_DDS_XTypes_TypeIdentifierPair identifier_complete_minimal; +} DDS_XTypes_TypeMapping; + +DDS_EXPORT extern const dds_topic_descriptor_t DDS_XTypes_TypeMapping_desc; + +#define DDS_XTypes_TypeMapping__alloc() \ +((DDS_XTypes_TypeMapping*) dds_alloc (sizeof (DDS_XTypes_TypeMapping))); + +#define DDS_XTypes_TypeMapping_free(d,o) \ +dds_sample_free ((d), &DDS_XTypes_TypeMapping_desc, (o)) + +#ifdef __cplusplus +} +#endif + +#endif /* DDSI_XT_TYPEMAP_H */ diff --git a/unitree_SDK/include/dds/ddsi/ddsi_xt_typemap.idl b/unitree_SDK/include/dds/ddsi/ddsi_xt_typemap.idl new file mode 100644 index 0000000..924d9d5 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/ddsi_xt_typemap.idl @@ -0,0 +1,15 @@ + +#include "ddsi_xt_typeinfo.idl" + +module DDS { module XTypes { + + @extensibility(FINAL) @nested(FALSE) + struct TypeMapping { + sequence identifier_object_pair_minimal; + sequence identifier_object_pair_complete; + sequence identifier_complete_minimal; + }; + + +}; // end of module XTypes +}; // end module DDS diff --git a/unitree_SDK/include/dds/ddsi/q_addrset.h b/unitree_SDK/include/dds/ddsi/q_addrset.h new file mode 100644 index 0000000..7bd0477 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_addrset.h @@ -0,0 +1,97 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_ADDRSET_H +#define NN_ADDRSET_H + +#include "dds/ddsrt/sync.h" +#include "dds/ddsrt/avl.h" +#include "dds/ddsi/q_log.h" +#include "dds/ddsi/q_thread.h" +#include "dds/ddsi/q_protocol.h" +#include "dds/ddsi/q_feature_check.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct addrset_node { + ddsrt_avl_node_t avlnode; + ddsi_xlocator_t loc; +} * addrset_node_t; + +struct addrset { + ddsrt_mutex_t lock; + ddsrt_atomic_uint32_t refc; + ddsrt_avl_ctree_t ucaddrs, mcaddrs; +}; + +typedef void (*addrset_forall_fun_t) (const ddsi_xlocator_t *loc, void *arg); +typedef ssize_t (*addrset_forone_fun_t) (const ddsi_xlocator_t *loc, void *arg); + +DDS_EXPORT struct addrset *new_addrset (void); +DDS_EXPORT struct addrset *ref_addrset (struct addrset *as); +DDS_EXPORT void unref_addrset (struct addrset *as); +DDS_EXPORT void add_locator_to_addrset (const struct ddsi_domaingv *gv, struct addrset *as, const ddsi_locator_t *loc); +DDS_EXPORT void add_xlocator_to_addrset (const struct ddsi_domaingv *gv, struct addrset *as, const ddsi_xlocator_t *loc); +DDS_EXPORT void remove_from_addrset (const struct ddsi_domaingv *gv, struct addrset *as, const ddsi_xlocator_t *loc); +DDS_EXPORT int addrset_purge (struct addrset *as); +int compare_locators (const ddsi_locator_t *a, const ddsi_locator_t *b); +int compare_xlocators (const ddsi_xlocator_t *a, const ddsi_xlocator_t *b); + +/* These lock ASADD, then lock/unlock AS any number of times, then + unlock ASADD */ +void copy_addrset_into_addrset_uc (const struct ddsi_domaingv *gv, struct addrset *as, const struct addrset *asadd); +void copy_addrset_into_addrset_mc (const struct ddsi_domaingv *gv, struct addrset *as, const struct addrset *asadd); +void copy_addrset_into_addrset (const struct ddsi_domaingv *gv, struct addrset *as, const struct addrset *asadd); + +size_t addrset_count (const struct addrset *as); +size_t addrset_count_uc (const struct addrset *as); +size_t addrset_count_mc (const struct addrset *as); +int addrset_empty_uc (const struct addrset *as); +int addrset_empty_mc (const struct addrset *as); +int addrset_empty (const struct addrset *as); +int addrset_any_uc (const struct addrset *as, ddsi_xlocator_t *dst); +int addrset_any_mc (const struct addrset *as, ddsi_xlocator_t *dst); +void addrset_any_uc_else_mc_nofail (const struct addrset *as, ddsi_xlocator_t *dst); + +/* Keeps AS locked */ +int addrset_forone (struct addrset *as, addrset_forone_fun_t f, void *arg); +DDS_EXPORT void addrset_forall (struct addrset *as, addrset_forall_fun_t f, void *arg); +size_t addrset_forall_count (struct addrset *as, addrset_forall_fun_t f, void *arg); +size_t addrset_forall_uc_else_mc_count (struct addrset *as, addrset_forall_fun_t f, void *arg); +size_t addrset_forall_mc_count (struct addrset *as, addrset_forall_fun_t f, void *arg); +void nn_log_addrset (struct ddsi_domaingv *gv, uint32_t tf, const char *prefix, const struct addrset *as); + +/* Tries to lock A then B for a decent check, returning false if + trylock B fails */ +int addrset_eq_onesidederr (const struct addrset *a, const struct addrset *b); + +int is_unspec_locator (const ddsi_locator_t *loc); +int is_unspec_xlocator (const ddsi_xlocator_t *loc); +void set_unspec_locator (ddsi_locator_t *loc); +void set_unspec_xlocator (ddsi_xlocator_t *loc); + +struct ddsi_domaingv; +int add_addresses_to_addrset (const struct ddsi_domaingv *gv, struct addrset *as, const char *addrs, int port_mode, const char *msgtag, int req_mc); + +#ifdef DDS_HAS_SSM +int addrset_contains_ssm (const struct ddsi_domaingv *gv, const struct addrset *as); +int addrset_any_ssm (const struct ddsi_domaingv *gv, const struct addrset *as, ddsi_xlocator_t *dst); +int addrset_any_non_ssm_mc (const struct ddsi_domaingv *gv, const struct addrset *as, ddsi_xlocator_t *dst); +void copy_addrset_into_addrset_no_ssm_mc (const struct ddsi_domaingv *gv, struct addrset *as, const struct addrset *asadd); +void copy_addrset_into_addrset_no_ssm (const struct ddsi_domaingv *gv, struct addrset *as, const struct addrset *asadd); +#endif + +#if defined (__cplusplus) +} +#endif +#endif /* NN_ADDRSET_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_bitset.h b/unitree_SDK/include/dds/ddsi/q_bitset.h new file mode 100644 index 0000000..7bd5d2c --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_bitset.h @@ -0,0 +1,65 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_BITSET_H +#define NN_BITSET_H + +#include +#include +#include + +#include "dds/export.h" +#include "dds/ddsi/q_unused.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +DDS_INLINE_EXPORT inline int nn_bitset_isset (uint32_t numbits, const uint32_t *bits, uint32_t idx) +{ + return idx < numbits && (bits[idx/32] & (UINT32_C(1) << (31 - (idx%32)))); +} + +DDS_INLINE_EXPORT inline void nn_bitset_set (UNUSED_ARG_NDEBUG (uint32_t numbits), uint32_t *bits, uint32_t idx) +{ + assert (idx < numbits); + bits[idx/32] |= UINT32_C(1) << (31 - (idx%32)); +} + +DDS_INLINE_EXPORT inline void nn_bitset_clear (UNUSED_ARG_NDEBUG (uint32_t numbits), uint32_t *bits, uint32_t idx) +{ + assert (idx < numbits); + bits[idx/32] &= ~(UINT32_C(1) << (31 - (idx%32))); +} + +DDS_INLINE_EXPORT inline void nn_bitset_zero (uint32_t numbits, uint32_t *bits) +{ + memset (bits, 0, 4 * ((numbits + 31) / 32)); +} + +DDS_INLINE_EXPORT inline void nn_bitset_one (uint32_t numbits, uint32_t *bits) +{ + memset (bits, 0xff, 4 * ((numbits + 31) / 32)); + + /* clear bits "accidentally" set */ + if ((numbits % 32) != 0) + { + const uint32_t k = numbits / 32; + const uint32_t n = numbits % 32; + bits[k] &= ~(~UINT32_C(0) >> n); + } +} + +#if defined (__cplusplus) +} +#endif + +#endif /* NN_BITSET_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_bswap.h b/unitree_SDK/include/dds/ddsi/q_bswap.h new file mode 100644 index 0000000..5f47c64 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_bswap.h @@ -0,0 +1,48 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_BSWAP_H +#define NN_BSWAP_H + +#include + +#include "dds/ddsrt/bswap.h" +#include "dds/ddsrt/misc.h" +#include "dds/ddsi/q_rtps.h" /* for nn_guid_t, nn_guid_prefix_t */ +#include "dds/ddsi/q_protocol.h" /* for nn_sequence_number_t */ + +#if defined (__cplusplus) +extern "C" { +#endif + +inline void bswapSN (nn_sequence_number_t *sn) +{ + sn->high = ddsrt_bswap4 (sn->high); + sn->low = ddsrt_bswap4u (sn->low); +} + +ddsi_guid_prefix_t nn_hton_guid_prefix (ddsi_guid_prefix_t p); +ddsi_guid_prefix_t nn_ntoh_guid_prefix (ddsi_guid_prefix_t p); +ddsi_entityid_t nn_hton_entityid (ddsi_entityid_t e); +ddsi_entityid_t nn_ntoh_entityid (ddsi_entityid_t e); +DDS_EXPORT ddsi_guid_t nn_hton_guid (ddsi_guid_t g); +DDS_EXPORT ddsi_guid_t nn_ntoh_guid (ddsi_guid_t g); + +void bswap_sequence_number_set_hdr (nn_sequence_number_set_header_t *snset); +void bswap_sequence_number_set_bitmap (nn_sequence_number_set_header_t *snset, uint32_t *bits); +void bswap_fragment_number_set_hdr (nn_fragment_number_set_header_t *fnset); +void bswap_fragment_number_set_bitmap (nn_fragment_number_set_header_t *fnset, uint32_t *bits); + +#if defined (__cplusplus) +} +#endif + +#endif /* NN_BSWAP_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_ddsi_discovery.h b/unitree_SDK/include/dds/ddsi/q_ddsi_discovery.h new file mode 100644 index 0000000..6536a8a --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_ddsi_discovery.h @@ -0,0 +1,52 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_DDSI_DISCOVERY_H +#define NN_DDSI_DISCOVERY_H + +#include "dds/ddsi/q_unused.h" +#include "dds/ddsi/ddsi_domaingv.h" // FIXME: MAX_XMIT_CONNS + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_participant; +struct ddsi_topic; +struct ddsi_writer; +struct ddsi_reader; +struct nn_rsample_info; +struct nn_rdata; +struct ddsi_plist; + +struct participant_builtin_topic_data_locators { + struct nn_locators_one def_uni[MAX_XMIT_CONNS], meta_uni[MAX_XMIT_CONNS]; + struct nn_locators_one def_multi, meta_multi; +}; + +void get_participant_builtin_topic_data (const struct ddsi_participant *pp, ddsi_plist_t *dst, struct participant_builtin_topic_data_locators *locs); + +int spdp_write (struct ddsi_participant *pp); +int spdp_dispose_unregister (struct ddsi_participant *pp); + +int sedp_write_topic (struct ddsi_topic *tp, bool alive); +int sedp_write_writer (struct ddsi_writer *wr); +int sedp_write_reader (struct ddsi_reader *rd); +int sedp_dispose_unregister_writer (struct ddsi_writer *wr); +int sedp_dispose_unregister_reader (struct ddsi_reader *rd); + +int builtins_dqueue_handler (const struct nn_rsample_info *sampleinfo, const struct nn_rdata *fragchain, const ddsi_guid_t *rdguid, void *qarg); + +#if defined (__cplusplus) +} +#endif + +#endif /* NN_DDSI_DISCOVERY_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_debmon.h b/unitree_SDK/include/dds/ddsi/q_debmon.h new file mode 100644 index 0000000..6084cb0 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_debmon.h @@ -0,0 +1,32 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_DEBMON_H +#define Q_DEBMON_H + +#if defined (__cplusplus) +extern "C" { +#endif + +struct debug_monitor; +typedef int (*debug_monitor_cpf_t) (ddsi_tran_conn_t conn, const char *fmt, ...); +typedef int (*debug_monitor_plugin_t) (ddsi_tran_conn_t conn, debug_monitor_cpf_t cpf, void *arg); + +struct debug_monitor *new_debug_monitor (struct ddsi_domaingv *gv, int32_t port); +void add_debug_monitor_plugin (struct debug_monitor *dm, debug_monitor_plugin_t fn, void *arg); +bool get_debug_monitor_locator (struct debug_monitor *dm, ddsi_locator_t *locator); +void free_debug_monitor (struct debug_monitor *dm); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/q_feature_check.h b/unitree_SDK/include/dds/ddsi/q_feature_check.h new file mode 100644 index 0000000..6c3f464 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_feature_check.h @@ -0,0 +1,49 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +/* Feature macros: + + - SSM: support for source-specific multicast + requires: NETWORK_PARTIITONS + also requires platform support; SSM is silently disabled if the + platform doesn't support it + + - BANDWIDTH_LIMITING: transmit-side bandwidth limiting + requires: NETWORK_CHANNELS (for now, anyway) + + - IPV6: support for IPV6 + requires: platform support (which itself is not part of DDSI) + + - NETWORK_PARTITIONS: support for multiple network partitions + + - NETWORK_CHANNELS: support for multiple network channels + +*/ +#include "dds/features.h" + +#ifdef DDS_HAS_SSM + #ifndef DDS_HAS_NETWORK_PARTITIONS + #error "SSM requires NETWORK_PARTITIONS" + #endif + + #include "dds/ddsrt/sockets.h" + #ifndef DDSRT_HAVE_SSM + #error "DDSRT_HAVE_SSM should be defined" + #elif ! DDSRT_HAVE_SSM + #undef DDS_HAS_SSM + #endif +#endif + +#ifdef DDS_HAS_BANDWIDTH_LIMITING + #ifndef DDS_HAS_NETWORK_CHANNELS + #error "BANDWIDTH_LIMITING requires NETWORK_CHANNELS" + #endif +#endif diff --git a/unitree_SDK/include/dds/ddsi/q_freelist.h b/unitree_SDK/include/dds/ddsi/q_freelist.h new file mode 100644 index 0000000..2f31527 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_freelist.h @@ -0,0 +1,91 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_FREELIST_H +#define NN_FREELIST_H + +#include "dds/ddsrt/atomics.h" +#include "dds/ddsrt/sync.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#define FREELIST_NONE 1 +#define FREELIST_ATOMIC_LIFO 2 +#define FREELIST_DOUBLE 3 + +#define FREELIST_TYPE FREELIST_DOUBLE + +#ifndef FREELIST_TYPE +#if DDSRT_HAVE_ATOMIC_LIFO +#define FREELIST_TYPE FREELIST_ATOMIC_LIFO +#else +#define FREELIST_TYPE FREELIST_DOUBLE +#endif +#endif + +#if FREELIST_TYPE == FREELIST_NONE + +struct nn_freelist { + char dummy; +}; + +#elif FREELIST_TYPE == FREELIST_ATOMIC_LIFO + +struct nn_freelist { + ddsrt_atomic_lifo_t x; + ddsrt_atomic_uint32_t count; + uint32_t max; + size_t linkoff; +}; + +#elif FREELIST_TYPE == FREELIST_DOUBLE + +#define NN_FREELIST_NPAR 4 +#define NN_FREELIST_NPAR_LG2 2 +#define NN_FREELIST_MAGSIZE 256 + +struct nn_freelistM { + void *x[NN_FREELIST_MAGSIZE]; + void *next; +}; + +struct nn_freelist1 { + ddsrt_mutex_t lock; + uint32_t count; + struct nn_freelistM *m; +}; + +struct nn_freelist { + struct nn_freelist1 inner[NN_FREELIST_NPAR]; + ddsrt_atomic_uint32_t cc; + ddsrt_mutex_t lock; + struct nn_freelistM *mlist; + struct nn_freelistM *emlist; + uint32_t count; + uint32_t max; + size_t linkoff; +}; + +#endif + +void nn_freelist_init (struct nn_freelist *fl, uint32_t max, size_t linkoff); +void nn_freelist_fini (struct nn_freelist *fl, void (*free) (void *elem)); +bool nn_freelist_push (struct nn_freelist *fl, void *elem); +void *nn_freelist_pushmany (struct nn_freelist *fl, void *first, void *last, uint32_t n); +void *nn_freelist_pop (struct nn_freelist *fl); + +#if defined (__cplusplus) +} +#endif + +#endif /* NN_FREELIST_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_gc.h b/unitree_SDK/include/dds/ddsi/q_gc.h new file mode 100644 index 0000000..de2357f --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_gc.h @@ -0,0 +1,61 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_GC_H +#define Q_GC_H + +#include "dds/export.h" +#include "dds/ddsi/q_thread.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct gcreq; +struct gcreq_queue; +struct ddsi_domaingv; + +struct ddsi_writer; +struct ddsi_reader; +struct ddsi_proxy_writer; +struct ddsi_proxy_reader; + +typedef void (*gcreq_cb_t) (struct gcreq *gcreq); + +struct idx_vtime { + struct thread_state *thrst; + vtime_t vtime; +}; + +struct gcreq { + struct gcreq *next; + struct gcreq_queue *queue; + gcreq_cb_t cb; + void *arg; + uint32_t nvtimes; + struct idx_vtime vtimes[]; +}; + +DDS_EXPORT struct gcreq_queue *gcreq_queue_new (struct ddsi_domaingv *gv); +DDS_EXPORT void gcreq_queue_drain (struct gcreq_queue *q); +DDS_EXPORT void gcreq_queue_free (struct gcreq_queue *q); + +DDS_EXPORT struct gcreq *gcreq_new (struct gcreq_queue *gcreq_queue, gcreq_cb_t cb); +DDS_EXPORT bool gcreq_queue_start (struct gcreq_queue *q); +DDS_EXPORT void gcreq_free (struct gcreq *gcreq); +DDS_EXPORT void gcreq_enqueue (struct gcreq *gcreq); +DDS_EXPORT int gcreq_requeue (struct gcreq *gcreq, gcreq_cb_t cb); + +#if defined (__cplusplus) +} +#endif + +#endif /* Q_GC_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_hbcontrol.h b/unitree_SDK/include/dds/ddsi/q_hbcontrol.h new file mode 100644 index 0000000..7712688 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_hbcontrol.h @@ -0,0 +1,51 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_HBCONTROL_H +#define Q_HBCONTROL_H + +#include "dds/features.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_writer; +struct whc_state; +struct ddsi_proxy_reader; + +struct hbcontrol { + ddsrt_mtime_t t_of_last_write; + ddsrt_mtime_t t_of_last_hb; + ddsrt_mtime_t t_of_last_ackhb; + ddsrt_mtime_t tsched; + uint32_t hbs_since_last_write; + uint32_t last_packetid; +}; + +void writer_hbcontrol_init (struct hbcontrol *hbc); +int64_t writer_hbcontrol_intv (const struct ddsi_writer *wr, const struct whc_state *whcst, ddsrt_mtime_t tnow); +void writer_hbcontrol_note_asyncwrite (struct ddsi_writer *wr, ddsrt_mtime_t tnow); +int writer_hbcontrol_ack_required (const struct ddsi_writer *wr, const struct whc_state *whcst, ddsrt_mtime_t tnow); +struct nn_xmsg *writer_hbcontrol_piggyback (struct ddsi_writer *wr, const struct whc_state *whcst, ddsrt_mtime_t tnow, uint32_t packetid, int *hbansreq); +int writer_hbcontrol_must_send (const struct ddsi_writer *wr, const struct whc_state *whcst, ddsrt_mtime_t tnow); +struct nn_xmsg *writer_hbcontrol_create_heartbeat (struct ddsi_writer *wr, const struct whc_state *whcst, ddsrt_mtime_t tnow, int hbansreq, int issync); + +#ifdef DDS_HAS_SECURITY +struct nn_xmsg *writer_hbcontrol_p2p(struct ddsi_writer *wr, const struct whc_state *whcst, int hbansreq, struct ddsi_proxy_reader *prd); +#endif + + +#if defined (__cplusplus) +} +#endif + +#endif /* Q_HBCONTROL_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_init.h b/unitree_SDK/include/dds/ddsi/q_init.h new file mode 100644 index 0000000..0acb10a --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_init.h @@ -0,0 +1,26 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_INIT_H +#define Q_INIT_H + +#if defined (__cplusplus) +extern "C" { +#endif + +int create_multicast_sockets (struct ddsi_domaingv *gv); +int joinleave_spdp_defmcip (struct ddsi_domaingv *gv, int dojoin); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/q_inverse_uint32_set.h b/unitree_SDK/include/dds/ddsi/q_inverse_uint32_set.h new file mode 100644 index 0000000..5cfe149 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_inverse_uint32_set.h @@ -0,0 +1,40 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_INVERSE_UINT32_SET_H +#define NN_INVERSE_UINT32_SET_H + +#include "dds/ddsrt/avl.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct inverse_uint32_set_node { + ddsrt_avl_node_t avlnode; + uint32_t min, max; +}; +struct inverse_uint32_set { + ddsrt_avl_tree_t ids; + uint32_t cursor; + uint32_t min, max; +}; + +void inverse_uint32_set_init(struct inverse_uint32_set *set, uint32_t min, uint32_t max); +void inverse_uint32_set_fini(struct inverse_uint32_set *set); +int inverse_uint32_set_alloc(uint32_t * const id, struct inverse_uint32_set *set); +void inverse_uint32_set_free(struct inverse_uint32_set *set, uint32_t id); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsi/q_lat_estim.h b/unitree_SDK/include/dds/ddsi/q_lat_estim.h new file mode 100644 index 0000000..e2dcc5b --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_lat_estim.h @@ -0,0 +1,42 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_LAT_ESTIM_H +#define NN_LAT_ESTIM_H + +#include "dds/ddsi/q_log.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#define NN_LAT_ESTIM_MEDIAN_WINSZ 7 + +struct nn_lat_estim { + /* median filtering with a small window in an attempt to remove the + worst outliers */ + int index; + float window[NN_LAT_ESTIM_MEDIAN_WINSZ]; + /* simple alpha filtering for smoothing */ + float smoothed; +}; + +void nn_lat_estim_init (struct nn_lat_estim *le); +void nn_lat_estim_fini (struct nn_lat_estim *le); +void nn_lat_estim_update (struct nn_lat_estim *le, int64_t est); +double nn_lat_estim_current (const struct nn_lat_estim *le); +int nn_lat_estim_log (uint32_t logcat, const struct ddsrt_log_cfg *logcfg, const char *tag, const struct nn_lat_estim *le); + +#if defined (__cplusplus) +} +#endif + +#endif /* NN_LAT_ESTIM_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_lease.h b/unitree_SDK/include/dds/ddsi/q_lease.h new file mode 100644 index 0000000..d4ae606 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_lease.h @@ -0,0 +1,54 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_LEASE_H +#define Q_LEASE_H + +#include "dds/ddsrt/atomics.h" +#include "dds/ddsrt/fibheap.h" +#include "dds/ddsrt/time.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct receiver_state; +struct ddsi_participant; +struct ddsi_entity_common; +struct ddsi_domaingv; /* FIXME: make a special for the lease admin */ + +struct lease { + ddsrt_fibheap_node_t heapnode; + ddsrt_fibheap_node_t pp_heapnode; + ddsrt_etime_t tsched; /* access guarded by leaseheap_lock */ + ddsrt_atomic_uint64_t tend; /* really an ddsrt_etime_t */ + dds_duration_t tdur; /* constant (renew depends on it) */ + struct ddsi_entity_common *entity; /* constant */ +}; + +int compare_lease_tsched (const void *va, const void *vb); +int compare_lease_tdur (const void *va, const void *vb); +void lease_management_init (struct ddsi_domaingv *gv); +void lease_management_term (struct ddsi_domaingv *gv); +struct lease *lease_new (ddsrt_etime_t texpire, int64_t tdur, struct ddsi_entity_common *e); +struct lease *lease_clone (const struct lease *l); +void lease_register (struct lease *l); +void lease_unregister (struct lease *l); +void lease_free (struct lease *l); +DDS_EXPORT void lease_renew (struct lease *l, ddsrt_etime_t tnow); +void lease_set_expiry (struct lease *l, ddsrt_etime_t when); +int64_t check_and_handle_lease_expiration (struct ddsi_domaingv *gv, ddsrt_etime_t tnow); + +#if defined (__cplusplus) +} +#endif + +#endif /* Q_LEASE_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_log.h b/unitree_SDK/include/dds/ddsi/q_log.h new file mode 100644 index 0000000..2f33003 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_log.h @@ -0,0 +1,71 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_LOG_H +#define NN_LOG_H + +#include + +#include "dds/ddsrt/log.h" +#include "dds/ddsi/ddsi_time.h" +#include "dds/ddsrt/rusage.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#define GVTRACE(...) DDS_CTRACE (&gv->logconfig, __VA_ARGS__) +#define GVLOG(cat, ...) DDS_CLOG ((cat), &gv->logconfig, __VA_ARGS__) +#define GVWARNING(...) DDS_CLOG (DDS_LC_WARNING, &gv->logconfig, __VA_ARGS__) +#define GVERROR(...) DDS_CLOG (DDS_LC_ERROR, &gv->logconfig, __VA_ARGS__) + +#define RSTTRACE(...) DDS_CTRACE (&rst->gv->logconfig, __VA_ARGS__) + +#define ETRACE(e_, ...) DDS_CTRACE (&(e_)->e.gv->logconfig, __VA_ARGS__) +#define EETRACE(e_, ...) DDS_CTRACE (&(e_)->gv->logconfig, __VA_ARGS__) +#define ELOG(cat, e_, ...) DDS_CLOG ((cat), &(e_)->e.gv->logconfig, __VA_ARGS__) +#define EELOG(cat, e_, ...) DDS_CLOG ((cat), &(e_)->gv->logconfig, __VA_ARGS__) + +/* There are quite a few places where discovery-related things are logged, so abbreviate those + a bit */ +#define GVLOGDISC(...) DDS_CLOG (DDS_LC_DISCOVERY, &gv->logconfig, __VA_ARGS__) +#define ELOGDISC(e_,...) DDS_CLOG (DDS_LC_DISCOVERY, &(e_)->e.gv->logconfig, __VA_ARGS__) +#define EELOGDISC(e_, ...) DDS_CLOG (DDS_LC_DISCOVERY, &(e_)->gv->logconfig, __VA_ARGS__) + +/* LOG_THREAD_CPUTIME must be considered private. */ +#if DDSRT_HAVE_RUSAGE +#define LOG_THREAD_CPUTIME(logcfg, guard) \ + do { \ + if ((logcfg)->c.mask & DDS_LC_TIMING) { \ + ddsrt_mtime_t tnowlt = ddsrt_time_monotonic (); \ + if (tnowlt.v >= (guard).v) { \ + ddsrt_rusage_t usage; \ + if (ddsrt_getrusage(DDSRT_RUSAGE_THREAD, &usage) == 0) { \ + DDS_CLOG( \ + DDS_LC_TIMING, \ + (logcfg), \ + "thread_cputime %d.%09d\n", \ + (int)(usage.stime / DDS_NSECS_IN_SEC), \ + (int)(usage.stime % DDS_NSECS_IN_SEC)); \ + (guard).v = tnowlt.v + DDS_NSECS_IN_SEC; \ + } \ + } \ + } \ + } while (0) +#else +#define LOG_THREAD_CPUTIME(logcfg, guard) (void)(guard) +#endif /* DDSRT_HAVE_RUSAGE */ + +#if defined (__cplusplus) +} +#endif + +#endif /* NN_LOG_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_misc.h b/unitree_SDK/include/dds/ddsi/q_misc.h new file mode 100644 index 0000000..b82f194 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_misc.h @@ -0,0 +1,77 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_MISC_H +#define NN_MISC_H + +#include "dds/ddsi/q_protocol.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +DDS_INLINE_EXPORT inline seqno_t fromSN (const nn_sequence_number_t sn) { + uint64_t sn_high = (uint32_t) sn.high; + return (sn_high << 32) | sn.low; +} + +DDS_INLINE_EXPORT inline bool validating_fromSN (const nn_sequence_number_t sn, seqno_t *res) { + // fromSN does not checks whatsoever (and shouldn't because it is used quite a lot) + // Valid sequence numbers are in [1 .. 2**63-1] union { SEQUENCE_NUMBER_UNKNOWN } + // where SEQUENCE_NUMBER_UNKNOWN is the usual abomination: ((2**32-1) << 32) + // + // As far as I can tell, there are no messages where SEQUENCE_NUMBER_UNKNOWN is actually a + // valid input (it would perhaps have been an elegant way to mark pre-emptive HEARTBEATs and + // ACKNACKs, but convention is different). So we reject them as invalid until we are forced + // to do differently. That leaves [1 .. 2**63-1] + // + // Since we use uint64_t, we can easily test by checking whether (s-1) is in [0 .. 2**63-1) + const seqno_t tmp = fromSN (sn); + *res = tmp; + return (tmp - 1) < MAX_SEQ_NUMBER; +} + +DDS_INLINE_EXPORT inline nn_sequence_number_t toSN (seqno_t n) { + nn_sequence_number_t x; + x.high = (int32_t) (n >> 32); + x.low = (uint32_t) n; + return x; +} + +unsigned char normalize_data_datafrag_flags (const SubmessageHeader_t *smhdr); + +#ifdef DDS_HAS_NETWORK_PARTITIONS +int WildcardOverlap(char * p1, char * p2); +#endif + +extern const ddsi_guid_t nullguid; +DDS_EXPORT bool guid_prefix_zero (const ddsi_guid_prefix_t *a); +DDS_EXPORT int guid_prefix_eq (const ddsi_guid_prefix_t *a, const ddsi_guid_prefix_t *b); +DDS_EXPORT int guid_eq (const struct ddsi_guid *a, const struct ddsi_guid *b); +DDS_EXPORT int ddsi2_patmatch (const char *pat, const char *str); + +#ifdef DDS_HAS_NETWORK_PARTITIONS +struct ddsi_config; +struct ddsi_config_partitionmapping_listelem; +struct ddsi_config_partitionmapping_listelem *find_partitionmapping (const struct ddsi_config *cfg, const char *partition, const char *topic); +int is_ignored_partition (const struct ddsi_config *cfg, const char *partition, const char *topic); +#endif +#ifdef DDS_HAS_NETWORK_CHANNELS +struct ddsi_config; +struct ddsi_config_channel_listelem; +struct ddsi_config_channel_listelem *find_channel (const struct config *cfg, nn_transport_priority_qospolicy_t transport_priority); +#endif + +#if defined (__cplusplus) +} +#endif + +#endif /* NN_MISC_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_pcap.h b/unitree_SDK/include/dds/ddsi/q_pcap.h new file mode 100644 index 0000000..e73cabc --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_pcap.h @@ -0,0 +1,34 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_PCAP_H +#define Q_PCAP_H + +#include +#include "dds/ddsrt/time.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct msghdr; + +FILE * new_pcap_file (struct ddsi_domaingv *gv, const char *name); + +void write_pcap_received (struct ddsi_domaingv *gv, ddsrt_wctime_t tstamp, const struct sockaddr_storage *src, const struct sockaddr_storage *dst, unsigned char *buf, size_t sz); +void write_pcap_sent (struct ddsi_domaingv *gv, ddsrt_wctime_t tstamp, const struct sockaddr_storage *src, + const ddsrt_msghdr_t *hdr, size_t sz); + +#if defined (__cplusplus) +} +#endif + +#endif /* Q_PCAP_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_protocol.h b/unitree_SDK/include/dds/ddsi/q_protocol.h new file mode 100644 index 0000000..4f9f027 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_protocol.h @@ -0,0 +1,527 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_PROTOCOL_H +#define NN_PROTOCOL_H + +#include "dds/ddsrt/endian.h" +#include "dds/ddsrt/misc.h" +#include "dds/ddsi/q_feature_check.h" + +#include "dds/ddsi/q_rtps.h" +#include "dds/ddsi/ddsi_time.h" +#include "dds/ddsi/ddsi_locator.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct { + uint8_t id[4]; +} nn_protocolid_t; +typedef struct { + int32_t high; + uint32_t low; +} nn_sequence_number_t; +#define NN_SEQUENCE_NUMBER_UNKNOWN_HIGH -1 +#define NN_SEQUENCE_NUMBER_UNKNOWN_LOW 0 +#define NN_SEQUENCE_NUMBER_UNKNOWN ((seqno_t) (((uint64_t)NN_SEQUENCE_NUMBER_UNKNOWN_HIGH << 32) | NN_SEQUENCE_NUMBER_UNKNOWN_LOW)) +/* C99 disallows flex array in nested struct, so only put the + header in. (GCC and Clang allow it, but there are other + compilers in the world as well.) */ +typedef struct nn_sequence_number_set_header { + nn_sequence_number_t bitmap_base; + uint32_t numbits; +} nn_sequence_number_set_header_t; +/* SequenceNumberSet size is base (2 words) + numbits (1 word) + + bitmap ((numbits+31)/32 words), and this at 4 bytes/word */ +#define NN_SEQUENCE_NUMBER_SET_MAX_BITS (256u) +#define NN_SEQUENCE_NUMBER_SET_BITS_SIZE(numbits) ((unsigned) (4 * (((numbits) + 31) / 32))) +#define NN_SEQUENCE_NUMBER_SET_SIZE(numbits) (sizeof (nn_sequence_number_set_header_t) + NN_SEQUENCE_NUMBER_SET_BITS_SIZE (numbits)) +typedef uint32_t nn_fragment_number_t; +typedef struct nn_fragment_number_set_header { + nn_fragment_number_t bitmap_base; + uint32_t numbits; +} nn_fragment_number_set_header_t; +/* FragmentNumberSet size is base (2 words) + numbits (1 word) + + bitmap ((numbits+31)/32 words), and this at 4 bytes/word */ +#define NN_FRAGMENT_NUMBER_SET_MAX_BITS (256u) +#define NN_FRAGMENT_NUMBER_SET_BITS_SIZE(numbits) ((unsigned) (4 * (((numbits) + 31) / 32))) +#define NN_FRAGMENT_NUMBER_SET_SIZE(numbits) (sizeof (nn_fragment_number_set_header_t) + NN_FRAGMENT_NUMBER_SET_BITS_SIZE (numbits)) +typedef uint32_t nn_count_t; + +#define NN_STATUSINFO_DISPOSE 0x1u +#define NN_STATUSINFO_UNREGISTER 0x2u +#define NN_STATUSINFO_STANDARDIZED (NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER) +#define NN_STATUSINFO_OSPL_AUTO 0x10000000u /* OSPL extension, not on the wire */ +#define NN_STATUSINFOX_OSPL_AUTO 0x1 /* statusinfo word 2, OSPL L_AUTO flag on the wire */ + +#define NN_GUID_PREFIX_UNKNOWN_INITIALIZER {{0,0,0,0, 0,0,0,0, 0,0,0,0}} + +#define NN_DISC_BUILTIN_ENDPOINT_PARTICIPANT_ANNOUNCER (1u << 0) +#define NN_DISC_BUILTIN_ENDPOINT_PARTICIPANT_DETECTOR (1u << 1) +#define NN_DISC_BUILTIN_ENDPOINT_PUBLICATION_ANNOUNCER (1u << 2) +#define NN_DISC_BUILTIN_ENDPOINT_PUBLICATION_DETECTOR (1u << 3) +#define NN_DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_ANNOUNCER (1u << 4) +#define NN_DISC_BUILTIN_ENDPOINT_SUBSCRIPTION_DETECTOR (1u << 5) +#define NN_DISC_BUILTIN_ENDPOINT_PARTICIPANT_PROXY_ANNOUNCER (1u << 6) /* undefined meaning */ +#define NN_DISC_BUILTIN_ENDPOINT_PARTICIPANT_PROXY_DETECTOR (1u << 7) /* undefined meaning */ +#define NN_DISC_BUILTIN_ENDPOINT_PARTICIPANT_STATE_ANNOUNCER (1u << 8) /* undefined meaning */ +#define NN_DISC_BUILTIN_ENDPOINT_PARTICIPANT_STATE_DETECTOR (1u << 9) /* undefined meaning */ +#define NN_BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_WRITER (1u << 10) +#define NN_BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_DATA_READER (1u << 11) +#define NN_BUILTIN_ENDPOINT_TL_SVC_REQUEST_DATA_WRITER (1u << 12) +#define NN_BUILTIN_ENDPOINT_TL_SVC_REQUEST_DATA_READER (1u << 13) +#define NN_BUILTIN_ENDPOINT_TL_SVC_REPLY_DATA_WRITER (1u << 14) +#define NN_BUILTIN_ENDPOINT_TL_SVC_REPLY_DATA_READER (1u << 15) +#define NN_DISC_BUILTIN_ENDPOINT_TOPICS_ANNOUNCER (1u << 28) +#define NN_DISC_BUILTIN_ENDPOINT_TOPICS_DETECTOR (1u << 29) + +/* Security extensions: */ +#define NN_BUILTIN_ENDPOINT_PUBLICATION_MESSAGE_SECURE_ANNOUNCER (1u<<16) +#define NN_BUILTIN_ENDPOINT_PUBLICATION_MESSAGE_SECURE_DETECTOR (1u<<17) +#define NN_BUILTIN_ENDPOINT_SUBSCRIPTION_MESSAGE_SECURE_ANNOUNCER (1u<<18) +#define NN_BUILTIN_ENDPOINT_SUBSCRIPTION_MESSAGE_SECURE_DETECTOR (1u<<19) +#define NN_BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_SECURE_ANNOUNCER (1u<<20) +#define NN_BUILTIN_ENDPOINT_PARTICIPANT_MESSAGE_SECURE_DETECTOR (1u<<21) +#define NN_BUILTIN_ENDPOINT_PARTICIPANT_STATELESS_MESSAGE_ANNOUNCER (1u<<22) +#define NN_BUILTIN_ENDPOINT_PARTICIPANT_STATELESS_MESSAGE_DETECTOR (1u<<23) +#define NN_BUILTIN_ENDPOINT_PARTICIPANT_VOLATILE_SECURE_ANNOUNCER (1u<<24) +#define NN_BUILTIN_ENDPOINT_PARTICIPANT_VOLATILE_SECURE_DETECTOR (1u<<25) +#define NN_DISC_BUILTIN_ENDPOINT_PARTICIPANT_SECURE_ANNOUNCER (1u << 26) +#define NN_DISC_BUILTIN_ENDPOINT_PARTICIPANT_SECURE_DETECTOR (1u << 27) + +#define NN_BES_MASK_NON_SECURITY 0xf000ffffu + +#define NN_LOCATOR_KIND_INVALID -1 +#define NN_LOCATOR_KIND_RESERVED 0 +#define NN_LOCATOR_KIND_UDPv4 1 +#define NN_LOCATOR_KIND_UDPv6 2 +#define NN_LOCATOR_KIND_TCPv4 4 +#define NN_LOCATOR_KIND_TCPv6 8 +#define NN_LOCATOR_KIND_SHEM 16 +#define NN_LOCATOR_KIND_RAWETH 0x8000 /* proposed vendor-specific */ +#define NN_LOCATOR_KIND_UDPv4MCGEN 0x4fff0000 +#define NN_LOCATOR_PORT_INVALID 0 + +/* Only one specific version is grokked */ +#define RTPS_MAJOR 2 +#define RTPS_MINOR 1 +#define RTPS_MINOR_MINIMUM 1 + +typedef struct Header { + nn_protocolid_t protocol; + nn_protocol_version_t version; + nn_vendorid_t vendorid; + ddsi_guid_prefix_t guid_prefix; +} Header_t; +#if DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN +#define NN_PROTOCOLID_AS_UINT32 (((uint32_t)'R' << 0) | ((uint32_t)'T' << 8) | ((uint32_t)'P' << 16) | ((uint32_t)'S' << 24)) +#elif DDSRT_ENDIAN == DDSRT_BIG_ENDIAN +#define NN_PROTOCOLID_AS_UINT32 (((uint32_t)'R' << 24) | ((uint32_t)'T' << 16) | ((uint32_t)'P' << 8) | ((uint32_t)'S' << 0)) +#else +#error "DDSRT_ENDIAN neither LITTLE nor BIG" +#endif +#define RTPS_MESSAGE_HEADER_SIZE (sizeof (Header_t)) + +typedef struct SubmessageHeader { + uint8_t submessageId; + uint8_t flags; + uint16_t octetsToNextHeader; +} SubmessageHeader_t; +#define RTPS_SUBMESSAGE_HEADER_SIZE (sizeof (SubmessageHeader_t)) +#define SMFLAG_ENDIANNESS 0x01u + +typedef enum SubmessageKind { + SMID_PAD = 0x01, + SMID_ACKNACK = 0x06, + SMID_HEARTBEAT = 0x07, + SMID_GAP = 0x08, + SMID_INFO_TS = 0x09, + SMID_INFO_SRC = 0x0c, + SMID_INFO_REPLY_IP4 = 0x0d, + SMID_INFO_DST = 0x0e, + SMID_INFO_REPLY = 0x0f, + SMID_NACK_FRAG = 0x12, + SMID_HEARTBEAT_FRAG = 0x13, + SMID_DATA = 0x15, + SMID_DATA_FRAG = 0x16, + /* security-specific sub messages */ + SMID_SEC_BODY = 0x30, + SMID_SEC_PREFIX = 0x31, + SMID_SEC_POSTFIX = 0x32, + SMID_SRTPS_PREFIX = 0x33, + SMID_SRTPS_POSTFIX = 0x34, + /* vendor-specific sub messages (0x80 .. 0xff) */ + SMID_ADLINK_MSG_LEN = 0x81, + SMID_ADLINK_ENTITY_ID = 0x82 +} SubmessageKind_t; + +typedef struct InfoTimestamp { + SubmessageHeader_t smhdr; + ddsi_time_t time; +} InfoTimestamp_t; + +typedef struct EntityId { + SubmessageHeader_t smhdr; + ddsi_entityid_t entityid; +} EntityId_t; + +typedef struct InfoDST { + SubmessageHeader_t smhdr; + ddsi_guid_prefix_t guid_prefix; +} InfoDST_t; + +typedef struct InfoSRC { + SubmessageHeader_t smhdr; + unsigned unused; + nn_protocol_version_t version; + nn_vendorid_t vendorid; + ddsi_guid_prefix_t guid_prefix; +} InfoSRC_t; + +#if DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN +#define CDR_BE 0x0000u +#define CDR_LE 0x0100u +#define PL_CDR_BE 0x0200u +#define PL_CDR_LE 0x0300u +#define CDR2_BE 0x0600u +#define CDR2_LE 0x0700u +#define D_CDR2_BE 0x0800u +#define D_CDR2_LE 0x0900u +#define PL_CDR2_BE 0x0a00u +#define PL_CDR2_LE 0x0b00u + +#define CDR_ENC_LE(x) (((x) & 0x0100) == 0x0100) +#define CDR_ENC_IS_NATIVE(x) (CDR_ENC_LE ((x))) +#define CDR_ENC_IS_VALID(x) (!((x) > PL_CDR2_LE || (x) == 0x0400 || (x) == 0x0500)) +#define CDR_ENC_TO_NATIVE(x) ((x) | 0x0100) +#else +#define CDR_BE 0x0000u +#define CDR_LE 0x0001u +#define PL_CDR_BE 0x0002u +#define PL_CDR_LE 0x0003u +#define CDR2_BE 0x0006u +#define CDR2_LE 0x0007u +#define D_CDR2_BE 0x0008u +#define D_CDR2_LE 0x0009u +#define PL_CDR2_BE 0x000au +#define PL_CDR2_LE 0x000bu + +#define CDR_ENC_LE(x) (((x) & 0x0001) == 0x0001) +#define CDR_ENC_IS_NATIVE(x) (!CDR_ENC_LE ((x))) +#define CDR_ENC_IS_VALID(x) (!((x) > PL_CDR2_LE || (x) == 0x0004 || (x) == 0x0005)) +#define CDR_ENC_TO_NATIVE(x) ((x) & ~0x0001) +#endif + +/* + Encoding version to be used for serialization. Encoding version 1 + represents the XCDR1 format as defined in the DDS XTypes specification, + with PLAIN_CDR(1) that is backwards compatible with the CDR encoding + used by non-XTypes enabled nodes. +*/ +#define CDR_ENC_VERSION_UNDEF 0 +#define CDR_ENC_VERSION_1 1 +#define CDR_ENC_VERSION_2 2 + +#define CDR_ENC_FORMAT_PLAIN 0 +#define CDR_ENC_FORMAT_DELIMITED 1 +#define CDR_ENC_FORMAT_PL 2 + + +typedef uint16_t nn_parameterid_t; /* spec says short */ +typedef struct nn_parameter { + nn_parameterid_t parameterid; + uint16_t length; /* spec says signed short */ + /* char value[] */ +} nn_parameter_t; + +typedef struct Data_DataFrag_common { + SubmessageHeader_t smhdr; + uint16_t extraFlags; + uint16_t octetsToInlineQos; + ddsi_entityid_t readerId; + ddsi_entityid_t writerId; + nn_sequence_number_t writerSN; +} Data_DataFrag_common_t; + +typedef struct Data { + Data_DataFrag_common_t x; +} Data_t; +#define DATA_FLAG_INLINE_QOS 0x02u +#define DATA_FLAG_DATAFLAG 0x04u +#define DATA_FLAG_KEYFLAG 0x08u + +typedef struct DataFrag { + Data_DataFrag_common_t x; + nn_fragment_number_t fragmentStartingNum; + uint16_t fragmentsInSubmessage; + uint16_t fragmentSize; + uint32_t sampleSize; +} DataFrag_t; +#define DATAFRAG_FLAG_INLINE_QOS 0x02u +#define DATAFRAG_FLAG_KEYFLAG 0x04u + +typedef struct MsgLen { + SubmessageHeader_t smhdr; + uint32_t length; +} MsgLen_t; + +DDSRT_WARNING_MSVC_OFF(4200) +typedef struct AckNack { + SubmessageHeader_t smhdr; + ddsi_entityid_t readerId; + ddsi_entityid_t writerId; + nn_sequence_number_set_header_t readerSNState; + uint32_t bits[]; + /* nn_count_t count; */ +} AckNack_t; +DDSRT_WARNING_MSVC_ON(4200) +#define ACKNACK_FLAG_FINAL 0x02u +#define ACKNACK_SIZE(numbits) (offsetof (AckNack_t, bits) + NN_SEQUENCE_NUMBER_SET_BITS_SIZE (numbits) + 4) +#define ACKNACK_SIZE_MAX ACKNACK_SIZE (NN_SEQUENCE_NUMBER_SET_MAX_BITS) + +DDSRT_WARNING_MSVC_OFF(4200) +typedef struct Gap { + SubmessageHeader_t smhdr; + ddsi_entityid_t readerId; + ddsi_entityid_t writerId; + nn_sequence_number_t gapStart; + nn_sequence_number_set_header_t gapList; + uint32_t bits[]; +} Gap_t; +DDSRT_WARNING_MSVC_ON(4200) +#define GAP_SIZE(numbits) (offsetof (Gap_t, bits) + NN_SEQUENCE_NUMBER_SET_BITS_SIZE (numbits)) +#define GAP_SIZE_MAX GAP_SIZE (NN_SEQUENCE_NUMBER_SET_MAX_BITS) + +typedef struct InfoTS { + SubmessageHeader_t smhdr; + ddsi_time_t time; +} InfoTS_t; +#define INFOTS_INVALIDATE_FLAG 0x2u + +typedef struct Heartbeat { + SubmessageHeader_t smhdr; + ddsi_entityid_t readerId; + ddsi_entityid_t writerId; + nn_sequence_number_t firstSN; + nn_sequence_number_t lastSN; + nn_count_t count; +} Heartbeat_t; +#define HEARTBEAT_FLAG_FINAL 0x02u +#define HEARTBEAT_FLAG_LIVELINESS 0x04u + +typedef struct HeartbeatFrag { + SubmessageHeader_t smhdr; + ddsi_entityid_t readerId; + ddsi_entityid_t writerId; + nn_sequence_number_t writerSN; + nn_fragment_number_t lastFragmentNum; + nn_count_t count; +} HeartbeatFrag_t; + +DDSRT_WARNING_MSVC_OFF(4200) +typedef struct NackFrag { + SubmessageHeader_t smhdr; + ddsi_entityid_t readerId; + ddsi_entityid_t writerId; + nn_sequence_number_t writerSN; + nn_fragment_number_set_header_t fragmentNumberState; + uint32_t bits[]; + /* nn_count_t count; */ +} NackFrag_t; +DDSRT_WARNING_MSVC_ON(4200) +#define NACKFRAG_SIZE(numbits) (offsetof (NackFrag_t, bits) + NN_FRAGMENT_NUMBER_SET_BITS_SIZE (numbits) + 4) +#define NACKFRAG_SIZE_MAX NACKFRAG_SIZE (NN_FRAGMENT_NUMBER_SET_MAX_BITS) + +typedef union Submessage { + SubmessageHeader_t smhdr; + AckNack_t acknack; + Data_t data; + DataFrag_t datafrag; + InfoTS_t infots; + InfoDST_t infodst; + InfoSRC_t infosrc; + Heartbeat_t heartbeat; + HeartbeatFrag_t heartbeatfrag; + Gap_t gap; + NackFrag_t nackfrag; +} Submessage_t; + +#define PARTICIPANT_MESSAGE_DATA_KIND_UNKNOWN 0x0u +#define PARTICIPANT_MESSAGE_DATA_KIND_AUTOMATIC_LIVELINESS_UPDATE 0x1u +#define PARTICIPANT_MESSAGE_DATA_KIND_MANUAL_LIVELINESS_UPDATE 0x2u +#define PARTICIPANT_MESSAGE_DATA_VENDOR_SPECIFIC_KIND_FLAG 0x8000000u + +#define PID_VENDORSPECIFIC_FLAG 0x8000u +#define PID_UNRECOGNIZED_INCOMPATIBLE_FLAG 0x4000u + +#define PID_PAD 0x0u +#define PID_SENTINEL 0x1u +#define PID_DOMAIN_ID 0xfu +#define PID_DOMAIN_TAG (0x14u | PID_UNRECOGNIZED_INCOMPATIBLE_FLAG) +#define PID_USER_DATA 0x2cu +#define PID_TOPIC_NAME 0x5u +#define PID_TYPE_NAME 0x7u +#define PID_GROUP_DATA 0x2du +#define PID_TOPIC_DATA 0x2eu +#define PID_DURABILITY 0x1du +#define PID_DURABILITY_SERVICE 0x1eu +#define PID_DEADLINE 0x23u +#define PID_LATENCY_BUDGET 0x27u +#define PID_LIVELINESS 0x1bu +#define PID_RELIABILITY 0x1au +#define PID_LIFESPAN 0x2bu +#define PID_DESTINATION_ORDER 0x25u +#define PID_HISTORY 0x40u +#define PID_RESOURCE_LIMITS 0x41u +#define PID_OWNERSHIP 0x1fu +#define PID_OWNERSHIP_STRENGTH 0x6u +#define PID_PRESENTATION 0x21u +#define PID_PARTITION 0x29u +#define PID_TIME_BASED_FILTER 0x4u +#define PID_TRANSPORT_PRIORITY 0x49u +#define PID_PROTOCOL_VERSION 0x15u +#define PID_VENDORID 0x16u +#define PID_UNICAST_LOCATOR 0x2fu +#define PID_MULTICAST_LOCATOR 0x30u +#define PID_MULTICAST_IPADDRESS 0x11u +#define PID_DEFAULT_UNICAST_LOCATOR 0x31u +#define PID_DEFAULT_MULTICAST_LOCATOR 0x48u +#define PID_METATRAFFIC_UNICAST_LOCATOR 0x32u +#define PID_METATRAFFIC_MULTICAST_LOCATOR 0x33u +#define PID_DEFAULT_UNICAST_IPADDRESS 0xcu +#define PID_DEFAULT_UNICAST_PORT 0xeu +#define PID_METATRAFFIC_UNICAST_IPADDRESS 0x45u +#define PID_METATRAFFIC_UNICAST_PORT 0xdu +#define PID_METATRAFFIC_MULTICAST_IPADDRESS 0xbu +#define PID_METATRAFFIC_MULTICAST_PORT 0x46u +#define PID_EXPECTS_INLINE_QOS 0x43u +#define PID_PARTICIPANT_MANUAL_LIVELINESS_COUNT 0x34u +#define PID_PARTICIPANT_BUILTIN_ENDPOINTS 0x44u +#define PID_PARTICIPANT_LEASE_DURATION 0x2u +#define PID_CONTENT_FILTER_PROPERTY 0x35u +#define PID_PARTICIPANT_GUID 0x50u +#define PID_PARTICIPANT_ENTITYID 0x51u +#define PID_GROUP_GUID 0x52u +#define PID_GROUP_ENTITYID 0x53u +#define PID_BUILTIN_ENDPOINT_SET 0x58u +#define PID_PROPERTY_LIST 0x59u +#define PID_TYPE_MAX_SIZE_SERIALIZED 0x60u +#define PID_ENTITY_NAME 0x62u +#define PID_KEYHASH 0x70u +#define PID_STATUSINFO 0x71u +#define PID_CONTENT_FILTER_INFO 0x55u +#define PID_COHERENT_SET 0x56u +#define PID_DIRECTED_WRITE 0x57u +#define PID_ORIGINAL_WRITER_INFO 0x61u +#define PID_ENDPOINT_GUID 0x5au /* !SPEC <=> ADLINK_ENDPOINT_GUID */ +#define PID_DATA_REPRESENTATION 0x73u +#define PID_TYPE_CONSISTENCY_ENFORCEMENT 0x74u +#define PID_TYPE_INFORMATION 0x75u + +/* Security related PID values. */ +#define PID_IDENTITY_TOKEN 0x1001u +#define PID_PERMISSIONS_TOKEN 0x1002u +#define PID_DATA_TAGS 0x1003u +#define PID_ENDPOINT_SECURITY_INFO 0x1004u +#define PID_PARTICIPANT_SECURITY_INFO 0x1005u +#define PID_IDENTITY_STATUS_TOKEN 0x1006u + +#ifdef DDS_HAS_SSM +/* To indicate whether a reader favours the use of SSM. Iff the + reader favours SSM, it will use SSM if available. */ +#define PID_READER_FAVOURS_SSM 0x72u +#endif + +/* Deprecated parameter IDs (accepted but ignored) */ +#define PID_PERSISTENCE 0x03u +#define PID_TYPE_CHECKSUM 0x08u +#define PID_TYPE2_NAME 0x09u +#define PID_TYPE2_CHECKSUM 0x0au +#define PID_EXPECTS_ACK 0x10u +#define PID_MANAGER_KEY 0x12u +#define PID_SEND_QUEUE_SIZE 0x13u +#define PID_RELIABILITY_ENABLED 0x14u +#define PID_VARGAPPS_SEQUENCE_NUMBER_LAST 0x17u +#define PID_RECV_QUEUE_SIZE 0x18u +#define PID_RELIABILITY_OFFERED 0x19u + +#define PID_ADLINK_BUILTIN_ENDPOINT_SET (PID_VENDORSPECIFIC_FLAG | 0x0u) + +/* parameter ids for READER_DATA_LIFECYCLE & WRITER_DATA_LIFECYCLE are + undefined, but let's publish them anyway */ +#define PID_ADLINK_READER_DATA_LIFECYCLE (PID_VENDORSPECIFIC_FLAG | 0x2u) +#define PID_ADLINK_WRITER_DATA_LIFECYCLE (PID_VENDORSPECIFIC_FLAG | 0x3u) + +/* ENDPOINT_GUID is formally undefined, so in strictly conforming + mode, we use our own */ +#define PID_ADLINK_ENDPOINT_GUID (PID_VENDORSPECIFIC_FLAG | 0x4u) + +#define PID_ADLINK_SYNCHRONOUS_ENDPOINT (PID_VENDORSPECIFIC_FLAG | 0x5u) + +/* Relaxed QoS matching readers/writers are best ignored by + implementations that don't understand them. This also covers "old" + DDSI2's, although they may emit an error. */ +#define PID_ADLINK_RELAXED_QOS_MATCHING (PID_VENDORSPECIFIC_FLAG | PID_UNRECOGNIZED_INCOMPATIBLE_FLAG | 0x6u) + +#define PID_ADLINK_PARTICIPANT_VERSION_INFO (PID_VENDORSPECIFIC_FLAG | 0x7u) + +#define PID_ADLINK_NODE_NAME (PID_VENDORSPECIFIC_FLAG | 0x8u) +#define PID_ADLINK_EXEC_NAME (PID_VENDORSPECIFIC_FLAG | 0x9u) +#define PID_ADLINK_PROCESS_ID (PID_VENDORSPECIFIC_FLAG | 0xau) +#define PID_ADLINK_SERVICE_TYPE (PID_VENDORSPECIFIC_FLAG | 0xbu) +#define PID_ADLINK_ENTITY_FACTORY (PID_VENDORSPECIFIC_FLAG | 0xcu) +#define PID_ADLINK_WATCHDOG_SCHEDULING (PID_VENDORSPECIFIC_FLAG | 0xdu) +#define PID_ADLINK_LISTENER_SCHEDULING (PID_VENDORSPECIFIC_FLAG | 0xeu) +#define PID_ADLINK_SUBSCRIPTION_KEYS (PID_VENDORSPECIFIC_FLAG | 0xfu) +#define PID_ADLINK_READER_LIFESPAN (PID_VENDORSPECIFIC_FLAG | 0x10u) +#define PID_ADLINK_TYPE_DESCRIPTION (PID_VENDORSPECIFIC_FLAG | 0x12u) +#define PID_ADLINK_LAN (PID_VENDORSPECIFIC_FLAG | 0x13u) +#define PID_ADLINK_ENDPOINT_GID (PID_VENDORSPECIFIC_FLAG | 0x14u) +#define PID_ADLINK_GROUP_GID (PID_VENDORSPECIFIC_FLAG | 0x15u) +#define PID_ADLINK_EOTINFO (PID_VENDORSPECIFIC_FLAG | 0x16u) +#define PID_ADLINK_PART_CERT_NAME (PID_VENDORSPECIFIC_FLAG | 0x17u) +#define PID_ADLINK_LAN_CERT_NAME (PID_VENDORSPECIFIC_FLAG | 0x18u) +#define PID_CYCLONE_RECEIVE_BUFFER_SIZE (PID_VENDORSPECIFIC_FLAG | 0x19u) +#define PID_CYCLONE_TYPE_INFORMATION (PID_VENDORSPECIFIC_FLAG | 0x1au) +#define PID_CYCLONE_TOPIC_GUID (PID_VENDORSPECIFIC_FLAG | 0x1bu) +#define PID_CYCLONE_REQUESTS_KEYHASH (PID_VENDORSPECIFIC_FLAG | 0x1cu) +#define PID_CYCLONE_REDUNDANT_NETWORKING (PID_VENDORSPECIFIC_FLAG | 0x1du) + +/* Names of the built-in topics */ +#define DDS_BUILTIN_TOPIC_PARTICIPANT_NAME "DCPSParticipant" +#define DDS_BUILTIN_TOPIC_PUBLICATION_NAME "DCPSPublication" +#define DDS_BUILTIN_TOPIC_SUBSCRIPTION_NAME "DCPSSubscription" +#define DDS_BUILTIN_TOPIC_TOPIC_NAME "DCPSTopic" +#define DDS_BUILTIN_TOPIC_PARTICIPANT_MESSAGE_NAME "DCPSParticipantMessage" +#define DDS_BUILTIN_TOPIC_TYPELOOKUP_REQUEST_NAME "DCPSTypeLookupRequest" +#define DDS_BUILTIN_TOPIC_TYPELOOKUP_REPLY_NAME "DCPSTypeLookupReply" +#define DDS_BUILTIN_TOPIC_PARTICIPANT_SECURE_NAME "DCPSParticipantsSecure" +#define DDS_BUILTIN_TOPIC_PUBLICATION_SECURE_NAME "DCPSPublicationsSecure" +#define DDS_BUILTIN_TOPIC_SUBSCRIPTION_SECURE_NAME "DCPSSubscriptionsSecure" +#define DDS_BUILTIN_TOPIC_PARTICIPANT_MESSAGE_SECURE_NAME "DCPSParticipantMessageSecure" +#define DDS_BUILTIN_TOPIC_PARTICIPANT_STATELESS_MESSAGE_NAME "DCPSParticipantStatelessMessage" +#define DDS_BUILTIN_TOPIC_PARTICIPANT_VOLATILE_MESSAGE_SECURE_NAME "DCPSParticipantVolatileMessageSecure" + +/* Participant built-in topic qos properties */ +#define DDS_BUILTIN_TOPIC_PARTICIPANT_PROPERTY_PROCESS_NAME "__ProcessName" +#define DDS_BUILTIN_TOPIC_PARTICIPANT_PROPERTY_PID "__Pid" +#define DDS_BUILTIN_TOPIC_PARTICIPANT_PROPERTY_HOSTNAME "__Hostname" +#define DDS_BUILTIN_TOPIC_PARTICIPANT_PROPERTY_NETWORKADDRESSES "__NetworkAddresses" +#define DDS_BUILTIN_TOPIC_PARTICIPANT_DEBUG_MONITOR "__DebugMonitor" +#define DDS_BUILTIN_TOPIC_NULL_NAME NULL + +#if defined (__cplusplus) +} +#endif + +#endif /* NN_PROTOCOL_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_qosmatch.h b/unitree_SDK/include/dds/ddsi/q_qosmatch.h new file mode 100644 index 0000000..77eed1c --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_qosmatch.h @@ -0,0 +1,66 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_QOSMATCH_H +#define Q_QOSMATCH_H + +#include "dds/features.h" +#include "dds/ddsi/ddsi_typelib.h" +#include "dds/ddsi/ddsi_entity.h" +#if defined (__cplusplus) +extern "C" { +#endif + +struct dds_qos; + +/* perform reader/writer QoS (and topic name, type name, partition) matching; + mask can be used to exclude some of these (including topic name and type + name, so be careful!) + + reason will be set to the policy id of one of the mismatching QoS, or to + DDS_INVALID_QOS_POLICY_ID if there is no mismatch or if the mismatch is + in topic or type name (those are not really QoS and don't have a policy id) + + rd/wr_type_unknown is set to true in case the matching cannot be completed + because of missing type information. A type-lookup request is required to get the + details of the type to do the qos matching (e.g. check assignability) */ +bool qos_match_mask_p ( + struct ddsi_domaingv *gv, + const dds_qos_t *rd_qos, + const dds_qos_t *wr_qos, + uint64_t mask, + dds_qos_policy_id_t *reason +#ifdef DDS_HAS_TYPE_DISCOVERY + , const struct ddsi_type_pair *rd_type_pair + , const struct ddsi_type_pair *wr_type_pair + , bool *rd_typeid_req_lookup + , bool *wr_typeid_req_lookup +#endif +); + +bool qos_match_p ( + struct ddsi_domaingv *gv, + const dds_qos_t *rd_qos, + const dds_qos_t *wr_qos, + dds_qos_policy_id_t *reason +#ifdef DDS_HAS_TYPE_DISCOVERY + , const struct ddsi_type_pair *rd_type_pair + , const struct ddsi_type_pair *wr_type_pair + , bool *rd_typeid_req_lookup + , bool *wr_typeid_req_lookup +#endif +); + +#if defined (__cplusplus) +} +#endif + +#endif /* Q_QOSMATCH_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_radmin.h b/unitree_SDK/include/dds/ddsi/q_radmin.h new file mode 100644 index 0000000..b050dcc --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_radmin.h @@ -0,0 +1,276 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_RADMIN_H +#define NN_RADMIN_H + +#include + +#include "dds/ddsrt/time.h" +#include "dds/ddsrt/atomics.h" +#include "dds/ddsrt/threads.h" +#include "dds/ddsrt/align.h" +#include "dds/ddsrt/static_assert.h" +#include "dds/ddsi/ddsi_locator.h" +#include "dds/ddsi/q_rtps.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct nn_rbufpool; +struct nn_rbuf; +struct nn_rmsg; +struct nn_rdata; +struct nn_rsample; +struct nn_rsample_chain; +struct nn_rsample_info; +struct nn_defrag; +struct nn_reorder; +struct nn_dqueue; +struct ddsi_guid; +struct ddsi_tran_conn; + +struct ddsi_proxy_writer; + +struct nn_fragment_number_set; +struct nn_sequence_number_set; + +typedef int (*nn_dqueue_handler_t) (const struct nn_rsample_info *sampleinfo, const struct nn_rdata *fragchain, const struct ddsi_guid *rdguid, void *qarg); + +struct nn_rmsg_chunk { + struct nn_rbuf *rbuf; + struct nn_rmsg_chunk *next; + + /* Size is 0 after initial allocation, must be set with + nn_rmsg_setsize after receiving a packet from the kernel and + before processing it. */ + union { + uint32_t size; + + /* to ensure reasonable alignment of payload */ + int64_t l; + double d; + void *p; + } u; + + /* unsigned char payload[] -- disallowed by C99 because of nesting */ +}; + +struct nn_rmsg { + /* Reference count: all references to rdatas of this message are + counted. The rdatas themselves do not have a reference count. + + The refcount is biased by RMSG_REFCOUNT_UNCOMMITED_BIAS while + still being inserted to allow verifying it is still uncommitted + when allocating memory, increasing refcounts, &c. + + Each rdata adds RMS_REFCOUNT_RDATA_BIAS when it leaves + defragmentation until it has been rejected by reordering or has + been scheduled for delivery. This allows delaying the + decrementing of refcounts until after a sample has been added to + all radmins even though be delivery of it may take place in + concurrently. */ + ddsrt_atomic_uint32_t refcount; + + /* Worst-case memory requirement is gigantic (64kB UDP packet, only + 1-byte final fragments, each of one a new interval, or maybe 1 + byte messages, destined for many readers and in each case + introducing a new interval, with receiver state changes in + between, &c.), so we can either: + + - allocate a _lot_ and cover the worst case + + - allocate enough for all "reasonable" cases, discarding data when that limit is hit + + - dynamically add chunks of memory, and even entire receive buffers. + + The latter seems the best approach, especially because it also + covers the second one. We treat the other chunks specially, + which is not strictly required but also not entirely + unreasonable, considering that the first chunk has the refcount & + the real packet. */ + struct nn_rmsg_chunk *lastchunk; + + /* whether to log */ + bool trace; + + struct nn_rmsg_chunk chunk; +}; +DDSRT_STATIC_ASSERT (sizeof (struct nn_rmsg) == offsetof (struct nn_rmsg, chunk) + sizeof (struct nn_rmsg_chunk)); +#define NN_RMSG_PAYLOAD(m) ((unsigned char *) (m + 1)) +#define NN_RMSG_PAYLOADOFF(m, o) (NN_RMSG_PAYLOAD (m) + (o)) + +/* Allocated inside a chunk of memory by a custom allocator and requires >= 8-byte alignment */ +#define ALIGNOF_RMSG (dds_alignof(struct nn_rmsg) > 8 ? dds_alignof(struct nn_rmsg) : 8) + +struct receiver_state { + ddsi_guid_prefix_t src_guid_prefix; /* 12 */ + ddsi_guid_prefix_t dst_guid_prefix; /* 12 */ + struct addrset *reply_locators; /* 4/8 */ + uint32_t forme:1; /* 4 */ + uint32_t rtps_encoded:1; /* - */ + nn_vendorid_t vendor; /* 2 */ + nn_protocol_version_t protocol_version; /* 2 => 44/48 */ + struct ddsi_tran_conn *conn; /* Connection for request */ + ddsi_locator_t srcloc; + struct ddsi_domaingv *gv; +}; + +struct nn_rsample_info { + seqno_t seq; + struct receiver_state *rst; + struct ddsi_proxy_writer *pwr; + uint32_t size; + uint32_t fragsize; + ddsrt_wctime_t timestamp; + ddsrt_wctime_t reception_timestamp; /* OpenSplice extension -- but we get it essentially for free, so why not? */ + unsigned statusinfo: 2; /* just the two defined bits from the status info */ + unsigned bswap: 1; /* so we can extract well formatted writer info quicker */ + unsigned complex_qos: 1; /* includes QoS other than keyhash, 2-bit statusinfo, PT writer info */ +}; + +struct nn_rdata { + struct nn_rmsg *rmsg; /* received (and refcounted) in rmsg */ + struct nn_rdata *nextfrag; /* fragment chain */ + uint32_t min, maxp1; /* fragment as byte offsets */ + uint16_t submsg_zoff; /* offset to submessage from packet start, or 0 */ + uint16_t payload_zoff; /* offset to payload from packet start */ + uint16_t keyhash_zoff; /* offset to keyhash from packet start, or 0 */ +#ifndef NDEBUG + ddsrt_atomic_uint32_t refcount_bias_added; +#endif +}; + +/* All relative offsets in packets that we care about (submessage + header, payload, writer info) are at multiples of 4 bytes and + within 64kB, so technically we can make do with 14 bits instead of + 16, in case we run out of space. + + If we _really_ need to squeeze out every last bit, only the submsg + offset really requires 14 bits, the for the others we could use an + offset relative to the submessage header so that it is limited by + the maximum size of the inline QoS ... Defining the macros now, so + we have the option to do wild things. */ +#ifndef NDEBUG +#define NN_ZOFF_TO_OFF(zoff) ((unsigned) (zoff)) +#define NN_OFF_TO_ZOFF(off) (assert ((off) < 65536), ((unsigned short) (off))) +#else +#define NN_ZOFF_TO_OFF(zoff) ((unsigned) (zoff)) +#define NN_OFF_TO_ZOFF(off) ((unsigned short) (off)) +#endif +#define NN_RDATA_PAYLOAD_OFF(rdata) NN_ZOFF_TO_OFF ((rdata)->payload_zoff) +#define NN_RDATA_SUBMSG_OFF(rdata) NN_ZOFF_TO_OFF ((rdata)->submsg_zoff) +#define NN_RDATA_KEYHASH_OFF(rdata) NN_ZOFF_TO_OFF ((rdata)->keyhash_zoff) + +struct nn_rsample_chain_elem { + /* FIXME: evidently smaller than a defrag_iv, but maybe better to + merge it with defrag_iv in a union anyway. */ + struct nn_rdata *fragchain; + struct nn_rsample_chain_elem *next; + /* Gaps have sampleinfo = NULL, but nonetheless a fragchain with 1 + rdata with min=maxp1 (length 0) and valid rmsg pointer. And (see + DQUEUE) its lsb gets abused so we can queue "bubbles" in addition + to data). */ + struct nn_rsample_info *sampleinfo; +}; + +struct nn_rsample_chain { + struct nn_rsample_chain_elem *first; + struct nn_rsample_chain_elem *last; +}; + +enum nn_reorder_mode { + NN_REORDER_MODE_NORMAL, + NN_REORDER_MODE_MONOTONICALLY_INCREASING, + NN_REORDER_MODE_ALWAYS_DELIVER +}; + +enum nn_defrag_drop_mode { + NN_DEFRAG_DROP_OLDEST, /* (believed to be) best for unreliable */ + NN_DEFRAG_DROP_LATEST /* (...) best for reliable */ +}; + +typedef int32_t nn_reorder_result_t; +/* typedef of reorder result serves as a warning that it is to be + interpreted as follows: */ +/* REORDER_DELIVER > 0 -- number of samples in sample chain */ +#define NN_REORDER_ACCEPT 0 /* accepted/stored (for gap: also adjusted next_expected) */ +#define NN_REORDER_TOO_OLD -1 /* discarded because it was too old */ +#define NN_REORDER_REJECT -2 /* caller may reuse memory ("real" reject for data, "fake" for gap) */ + +typedef void (*nn_dqueue_callback_t) (void *arg); + +struct ddsrt_log_cfg; +struct nn_fragment_number_set_header; +struct nn_sequence_number_set_header; + +DDS_EXPORT struct nn_rbufpool *nn_rbufpool_new (const struct ddsrt_log_cfg *logcfg, uint32_t rbuf_size, uint32_t max_rmsg_size); +DDS_EXPORT void nn_rbufpool_setowner (struct nn_rbufpool *rbp, ddsrt_thread_t tid); +DDS_EXPORT void nn_rbufpool_free (struct nn_rbufpool *rbp); + +DDS_EXPORT struct nn_rmsg *nn_rmsg_new (struct nn_rbufpool *rbufpool); +DDS_EXPORT void nn_rmsg_setsize (struct nn_rmsg *rmsg, uint32_t size); +DDS_EXPORT void nn_rmsg_commit (struct nn_rmsg *rmsg); +DDS_EXPORT void nn_rmsg_free (struct nn_rmsg *rmsg); +DDS_EXPORT void *nn_rmsg_alloc (struct nn_rmsg *rmsg, uint32_t size); + +DDS_EXPORT struct nn_rdata *nn_rdata_new (struct nn_rmsg *rmsg, uint32_t start, uint32_t endp1, uint32_t submsg_offset, uint32_t payload_offset, uint32_t keyhash_offset); +DDS_EXPORT struct nn_rdata *nn_rdata_newgap (struct nn_rmsg *rmsg); +DDS_EXPORT void nn_fragchain_adjust_refcount (struct nn_rdata *frag, int adjust); +DDS_EXPORT void nn_fragchain_unref (struct nn_rdata *frag); + +DDS_EXPORT struct nn_defrag *nn_defrag_new (const struct ddsrt_log_cfg *logcfg, enum nn_defrag_drop_mode drop_mode, uint32_t max_samples); +DDS_EXPORT void nn_defrag_free (struct nn_defrag *defrag); +DDS_EXPORT struct nn_rsample *nn_defrag_rsample (struct nn_defrag *defrag, struct nn_rdata *rdata, const struct nn_rsample_info *sampleinfo); +void nn_defrag_notegap (struct nn_defrag *defrag, seqno_t min, seqno_t maxp1); + +enum nn_defrag_nackmap_result { + DEFRAG_NACKMAP_UNKNOWN_SAMPLE, + DEFRAG_NACKMAP_ALL_ADVERTISED_FRAGMENTS_KNOWN, + DEFRAG_NACKMAP_FRAGMENTS_MISSING +}; + +enum nn_defrag_nackmap_result nn_defrag_nackmap (struct nn_defrag *defrag, seqno_t seq, uint32_t maxfragnum, struct nn_fragment_number_set_header *map, uint32_t *mapbits, uint32_t maxsz); + +void nn_defrag_prune (struct nn_defrag *defrag, ddsi_guid_prefix_t *dst, seqno_t min); + +DDS_EXPORT struct nn_reorder *nn_reorder_new (const struct ddsrt_log_cfg *logcfg, enum nn_reorder_mode mode, uint32_t max_samples, bool late_ack_mode); +DDS_EXPORT void nn_reorder_free (struct nn_reorder *r); +struct nn_rsample *nn_reorder_rsample_dup_first (struct nn_rmsg *rmsg, struct nn_rsample *rsampleiv); +DDS_EXPORT struct nn_rdata *nn_rsample_fragchain (struct nn_rsample *rsample); +DDS_EXPORT nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_reorder *reorder, struct nn_rsample *rsampleiv, int *refcount_adjust, int delivery_queue_full_p); +DDS_EXPORT nn_reorder_result_t nn_reorder_gap (struct nn_rsample_chain *sc, struct nn_reorder *reorder, struct nn_rdata *rdata, seqno_t min, seqno_t maxp1, int *refcount_adjust); +void nn_reorder_drop_upto (struct nn_reorder *reorder, seqno_t maxp1); // drops [1,maxp1); next_seq' = maxp1 +DDS_EXPORT int nn_reorder_wantsample (const struct nn_reorder *reorder, seqno_t seq); +unsigned nn_reorder_nackmap (const struct nn_reorder *reorder, seqno_t base, seqno_t maxseq, struct nn_sequence_number_set_header *map, uint32_t *mapbits, uint32_t maxsz, int notail); +DDS_EXPORT seqno_t nn_reorder_next_seq (const struct nn_reorder *reorder); +void nn_reorder_set_next_seq (struct nn_reorder *reorder, seqno_t seq); + +struct nn_dqueue *nn_dqueue_new (const char *name, const struct ddsi_domaingv *gv, uint32_t max_samples, nn_dqueue_handler_t handler, void *arg); +bool nn_dqueue_start (struct nn_dqueue *q); +void nn_dqueue_free (struct nn_dqueue *q); +bool nn_dqueue_enqueue_deferred_wakeup (struct nn_dqueue *q, struct nn_rsample_chain *sc, nn_reorder_result_t rres); +void dd_dqueue_enqueue_trigger (struct nn_dqueue *q); +void nn_dqueue_enqueue (struct nn_dqueue *q, struct nn_rsample_chain *sc, nn_reorder_result_t rres); +void nn_dqueue_enqueue1 (struct nn_dqueue *q, const ddsi_guid_t *rdguid, struct nn_rsample_chain *sc, nn_reorder_result_t rres); +void nn_dqueue_enqueue_callback (struct nn_dqueue *q, nn_dqueue_callback_t cb, void *arg); +int nn_dqueue_is_full (struct nn_dqueue *q); +void nn_dqueue_wait_until_empty_if_full (struct nn_dqueue *q); + +DDS_EXPORT void nn_defrag_stats (struct nn_defrag *defrag, uint64_t *discarded_bytes); +DDS_EXPORT void nn_reorder_stats (struct nn_reorder *reorder, uint64_t *discarded_bytes); + +#if defined (__cplusplus) +} +#endif + +#endif /* NN_RADMIN_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_receive.h b/unitree_SDK/include/dds/ddsi/q_receive.h new file mode 100644 index 0000000..672dfa3 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_receive.h @@ -0,0 +1,51 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_RECEIVE_H +#define Q_RECEIVE_H + +#if defined (__cplusplus) +extern "C" { +#endif + +struct nn_rbufpool; +struct nn_rsample_info; +struct nn_rdata; +struct nn_rmsg; +struct ddsi_tran_listener; +struct recv_thread_arg; +struct ddsi_writer; +struct ddsi_proxy_reader; + +struct nn_gap_info { + seqno_t gapstart; // == 0 on init, indicating no gap recorded yet + seqno_t gapend; // >= gapstart + uint32_t gapnumbits; + uint32_t gapbits[256 / 32]; +}; + +void nn_gap_info_init(struct nn_gap_info *gi); +void nn_gap_info_update(struct ddsi_domaingv *gv, struct nn_gap_info *gi, seqno_t seqnr); +struct nn_xmsg * nn_gap_info_create_gap(struct ddsi_writer *wr, struct ddsi_proxy_reader *prd, struct nn_gap_info *gi); + +void trigger_recv_threads (const struct ddsi_domaingv *gv); +uint32_t recv_thread (void *vrecv_thread_arg); +uint32_t listen_thread (struct ddsi_tran_listener * listener); +int user_dqueue_handler (const struct nn_rsample_info *sampleinfo, const struct nn_rdata *fragchain, const ddsi_guid_t *rdguid, void *qarg); +int add_Gap (struct nn_xmsg *msg, struct ddsi_writer *wr, struct ddsi_proxy_reader *prd, seqno_t start, seqno_t base, uint32_t numbits, const uint32_t *bits); + +DDS_EXPORT void ddsi_handle_rtps_message (struct thread_state * const thrst, struct ddsi_domaingv *gv, ddsi_tran_conn_t conn, const ddsi_guid_prefix_t *guidprefix, struct nn_rbufpool *rbpool, struct nn_rmsg *rmsg, size_t sz, unsigned char *msg, const ddsi_locator_t *srcloc); + +#if defined (__cplusplus) +} +#endif + +#endif /* Q_RECEIVE_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_rtps.h b/unitree_SDK/include/dds/ddsi/q_rtps.h new file mode 100644 index 0000000..0c598cc --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_rtps.h @@ -0,0 +1,101 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_RTPS_H +#define NN_RTPS_H + +#include "dds/export.h" +#include "dds/ddsi/ddsi_vendor.h" +#include "dds/ddsi/ddsi_guid.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct { + uint8_t major, minor; +} nn_protocol_version_t; +typedef uint64_t seqno_t; +#define MAX_SEQ_NUMBER INT64_MAX + +#define PGUIDPREFIX(gp) (gp).u[0], (gp).u[1], (gp).u[2] +#define PGUID(g) PGUIDPREFIX ((g).prefix), (g).entityid.u +#define PGUIDPREFIXFMT "%" PRIx32 ":%" PRIx32 ":%" PRIx32 +#define PGUIDFMT PGUIDPREFIXFMT ":%" PRIx32 + +/* predefined entity ids; here viewed as an unsigned int, on the + network as four bytes corresponding to the integer in network byte + order */ +#define NN_ENTITYID_UNKNOWN 0x0 +#define NN_ENTITYID_PARTICIPANT 0x1c1 +#define NN_ENTITYID_SEDP_BUILTIN_TOPIC_WRITER 0x2c2 +#define NN_ENTITYID_SEDP_BUILTIN_TOPIC_READER 0x2c7 +#define NN_ENTITYID_SEDP_BUILTIN_PUBLICATIONS_WRITER 0x3c2 +#define NN_ENTITYID_SEDP_BUILTIN_PUBLICATIONS_READER 0x3c7 +#define NN_ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_WRITER 0x4c2 +#define NN_ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_READER 0x4c7 +#define NN_ENTITYID_SPDP_BUILTIN_PARTICIPANT_WRITER 0x100c2 +#define NN_ENTITYID_SPDP_BUILTIN_PARTICIPANT_READER 0x100c7 +#define NN_ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_WRITER 0x200c2 +#define NN_ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_READER 0x200c7 + +#define NN_ENTITYID_TL_SVC_BUILTIN_REQUEST_WRITER 0x300c3 +#define NN_ENTITYID_TL_SVC_BUILTIN_REQUEST_READER 0x300c4 +#define NN_ENTITYID_TL_SVC_BUILTIN_REPLY_WRITER 0x301c3 +#define NN_ENTITYID_TL_SVC_BUILTIN_REPLY_READER 0x301c4 + +#define NN_ENTITYID_SEDP_BUILTIN_PUBLICATIONS_SECURE_WRITER 0xff0003c2 +#define NN_ENTITYID_SEDP_BUILTIN_PUBLICATIONS_SECURE_READER 0xff0003c7 +#define NN_ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_WRITER 0xff0004c2 +#define NN_ENTITYID_SEDP_BUILTIN_SUBSCRIPTIONS_SECURE_READER 0xff0004c7 +#define NN_ENTITYID_P2P_BUILTIN_PARTICIPANT_STATELESS_MESSAGE_WRITER 0x201c3 +#define NN_ENTITYID_P2P_BUILTIN_PARTICIPANT_STATELESS_MESSAGE_READER 0x201c4 +#define NN_ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_SECURE_WRITER 0xff0200c2 +#define NN_ENTITYID_P2P_BUILTIN_PARTICIPANT_MESSAGE_SECURE_READER 0xff0200c7 +#define NN_ENTITYID_P2P_BUILTIN_PARTICIPANT_VOLATILE_SECURE_WRITER 0xff0202c3 +#define NN_ENTITYID_P2P_BUILTIN_PARTICIPANT_VOLATILE_SECURE_READER 0xff0202c4 +#define NN_ENTITYID_SPDP_RELIABLE_BUILTIN_PARTICIPANT_SECURE_WRITER 0xff0101c2 +#define NN_ENTITYID_SPDP_RELIABLE_BUILTIN_PARTICIPANT_SECURE_READER 0xff0101c7 + +#define NN_ENTITYID_SOURCE_MASK 0xc0 +#define NN_ENTITYID_SOURCE_USER 0x00 +#define NN_ENTITYID_SOURCE_BUILTIN 0xc0 +#define NN_ENTITYID_SOURCE_VENDOR 0x40 +#define NN_ENTITYID_KIND_MASK 0x3f +#define NN_ENTITYID_KIND_WRITER_WITH_KEY 0x02 +#define NN_ENTITYID_KIND_WRITER_NO_KEY 0x03 +#define NN_ENTITYID_KIND_READER_NO_KEY 0x04 +#define NN_ENTITYID_KIND_READER_WITH_KEY 0x07 +/* Entity kind topic is not defined in the RTPS spec, so the following two + should to be used as vendor specific entities using NN_ENTITYID_SOURCE_VENDOR. + Two entity kinds for built-in and user topics are required, because the + vendor and built-in flags cannot be combined. */ +#define NN_ENTITYID_KIND_CYCLONE_TOPIC_BUILTIN 0x0c +#define NN_ENTITYID_KIND_CYCLONE_TOPIC_USER 0x0d + +#define NN_ENTITYID_ALLOCSTEP 0x100 + +struct cfgst; +struct ddsi_domaingv; +DDS_EXPORT int rtps_config_prep (struct ddsi_domaingv *gv, struct cfgst *cfgst); +int rtps_config_open_trace (struct ddsi_domaingv *gv); +DDS_EXPORT int rtps_init (struct ddsi_domaingv *gv); +int rtps_start (struct ddsi_domaingv *gv); +void rtps_stop (struct ddsi_domaingv *gv); +DDS_EXPORT void rtps_fini (struct ddsi_domaingv *gv); + +DDS_EXPORT void ddsi_set_deafmute (struct ddsi_domaingv *gv, bool deaf, bool mute, int64_t reset_after); + +#if defined (__cplusplus) +} +#endif + +#endif /* NN_RTPS_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_sockwaitset.h b/unitree_SDK/include/dds/ddsi/q_sockwaitset.h new file mode 100644 index 0000000..f8c7b94 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_sockwaitset.h @@ -0,0 +1,110 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_SOCKWAITSET_H +#define Q_SOCKWAITSET_H + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct os_sockWaitset * os_sockWaitset; +typedef struct os_sockWaitsetCtx * os_sockWaitsetCtx; +struct ddsi_tran_conn; + +/* + Allocates a new connection waitset. The waitset is thread-safe in + that multiple threads may add and remove connections from the wait set + or trigger it. However only a single thread may process events from + the wait set using the Wait and NextEvent functions in a single handling + loop. +*/ +os_sockWaitset os_sockWaitsetNew (void); + +/* + Frees the waitset WS. Any connections associated with it will + be closed. +*/ +void os_sockWaitsetFree (os_sockWaitset ws); + +/* + Triggers the waitset, from any thread. It is level + triggered, when called while no thread is waiting in + os_sockWaitsetWait the trigger will cause an (early) wakeup on the + next call to os_sockWaitsetWait. Returns DDS_RETCODE_OK if + successfully triggered, DDS_RETCODE_BAD_PARAMETER if an error occurs. + + Triggering a waitset may require resources and they may be counted. + Do not trigger a waitset arbitrarily often without ensuring + os_sockWaitsetWait is called often enough to let it release any + resources used. + + Shared state updates preceding os_sockWaitsetTrigger are visible + following os_sockWaitsetWait. +*/ +void os_sockWaitsetTrigger (os_sockWaitset ws); + +/* + A connection may be associated with only one waitset at any time, and + may be added to the waitset only once. Failure to comply with this + restriction results in undefined behaviour. + + Closing a connection associated with a waitset is handled gracefully: no + operations will signal errors because of it. + + Returns < 0 on error, 0 if already present, 1 if added +*/ +int os_sockWaitsetAdd (os_sockWaitset ws, struct ddsi_tran_conn * conn); + +/* + Drops all connections from the waitset from index onwards. Index + 0 corresponds to the first connection added to the waitset, index 1 to + the second, etc. Behaviour is undefined when called after a successful wait + but before all events had been enumerated. +*/ +void os_sockWaitsetPurge (os_sockWaitset ws, unsigned index); + +/* + Waits until some of the connections in WS have data to be read. + + Returns a new wait set context if one or more connections have data to read. + However, the return may be spurious (NULL) (i.e., no events) + + If a context is returned it must be enumerated before os_sockWaitsetWait + may be called again. + + Shared state updates preceding os_sockWaitsetTrigger are visible + following os_sockWaitsetWait. +*/ +os_sockWaitsetCtx os_sockWaitsetWait (os_sockWaitset ws); + +/* + Returns the index of the next triggered connection in the + waitset contect ctx, or -1 if the set of available events has been + exhausted. Index 0 is the first connection added to the waitset, index + 1 the second, &c. + + Following a call to os_sockWaitsetWait on waitset that returned + a context, one MUST enumerate all available events before + os_sockWaitsetWait may be called again. + + If the return value is >= 0, *conn contains the connection on which + data is available. +*/ +int os_sockWaitsetNextEvent (os_sockWaitsetCtx ctx, struct ddsi_tran_conn ** conn); + +/* Remove connection */ +void os_sockWaitsetRemove (os_sockWaitset ws, struct ddsi_tran_conn * conn); + +#if defined (__cplusplus) +} +#endif +#endif /* Q_SOCKWAITSET_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_thread.h b/unitree_SDK/include/dds/ddsi/q_thread.h new file mode 100644 index 0000000..a7a22ad --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_thread.h @@ -0,0 +1,246 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_THREAD_H +#define Q_THREAD_H + +#include +#include "dds/export.h" +#include "dds/ddsrt/atomics.h" +#include "dds/ddsrt/sync.h" +#include "dds/ddsrt/threads.h" +#include "dds/ddsrt/static_assert.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* Things don't go wrong if CACHE_LINE_SIZE is defined incorrectly, + they just run slower because of false cache-line sharing. It can be + discovered at run-time, but in practice it's 64 for most CPUs and + 128 for some. */ +#define CACHE_LINE_SIZE 64 + +typedef uint32_t vtime_t; +typedef int32_t svtime_t; /* signed version */ +#define VTIME_NEST_MASK 0xfu +#define VTIME_TIME_MASK 0xfffffff0u +#define VTIME_TIME_SHIFT 4 + +/* GCC has a nifty feature allowing the specification of the required + alignment: __attribute__ ((aligned (CACHE_LINE_SIZE))) in this + case. Many other compilers implement it as well, but it is by no + means a standard feature. So we do it the old-fashioned way. */ + + +/* These strings are used to indicate the required scheduling class to the "create_thread()" */ +#define Q_THREAD_SCHEDCLASS_REALTIME "Realtime" +#define Q_THREAD_SCHEDCLASS_TIMESHARE "Timeshare" + +/* When this value is used, the platform default for scheduling priority will be used */ +#define Q_THREAD_SCHEDPRIO_DEFAULT 0 + +enum thread_state_kind { + THREAD_STATE_ZERO, /* known to be dead */ + THREAD_STATE_STOPPED, /* internal thread, stopped-but-not-reaped */ + THREAD_STATE_INIT, /* internal thread, initializing */ + THREAD_STATE_LAZILY_CREATED, /* lazily created in response because an application used it. Reclaimed if the thread terminates, but not considered an error if all of Cyclone is shutdown while this thread hasn't terminated yet */ + THREAD_STATE_ALIVE /* known to be alive - for Cyclone internal threads */ +}; + +struct ddsi_domaingv; +struct ddsi_config; +struct ddsrt_log_cfg; + +/* + * vtime indicates progress for the garbage collector and the liveliness monitoring. + * + * vtime is updated without using atomic operations: only the owning thread updates + * them, and the garbage collection mechanism and the liveliness monitoring only + * observe the value + * + * gv is constant for internal threads, i.e., for threads with state = ALIVE + * gv is non-NULL for internal threads except thread liveliness monitoring + * + * Q_THREAD_DEBUG enables some really costly debugging stuff that may not be fully + * portable (I used it once, might as well keep it) + */ +#define Q_THREAD_DEBUG 0 +#if Q_THREAD_DEBUG +#define Q_THREAD_NSTACKS 20 +#define Q_THREAD_STACKDEPTH 10 +#define Q_THREAD_BASE_DEBUG \ + void *stks[Q_THREAD_NSTACKS][Q_THREAD_STACKDEPTH]; \ + int stks_depth[Q_THREAD_NSTACKS]; \ + int stks_idx; + +struct thread_state; +void thread_vtime_trace (struct thread_state *thrst); +#else /* Q_THREAD_DEBUG */ +#define Q_THREAD_BASE_DEBUG +#define thread_vtime_trace(thrst) do { } while (0) +#endif /* Q_THREAD_DEBUG */ + +#define THREAD_BASE \ + ddsrt_atomic_uint32_t vtime; \ + enum thread_state_kind state; \ + ddsrt_atomic_voidp_t gv; \ + ddsrt_thread_t tid; \ + uint32_t (*f) (void *arg); \ + void *f_arg; \ + Q_THREAD_BASE_DEBUG /* note: no semicolon! */ \ + char name[24] /* note: no semicolon! */ + +struct thread_state_base { + THREAD_BASE; +}; + +struct thread_state { + THREAD_BASE; + char pad[CACHE_LINE_SIZE + * ((sizeof (struct thread_state_base) + CACHE_LINE_SIZE - 1) + / CACHE_LINE_SIZE) + - sizeof (struct thread_state_base)]; +}; +#undef THREAD_BASE + +#define THREAD_STATE_BATCH 32 + +struct thread_states_list { + struct thread_state thrst[THREAD_STATE_BATCH]; + struct thread_states_list *next; + uint32_t nthreads; // = THREAD_STATE_BATCH + (next ? next->nthreads : 0) +}; + +struct thread_states { + ddsrt_mutex_t lock; + ddsrt_atomic_voidp_t thread_states_head; +}; + +extern DDS_EXPORT struct thread_states thread_states; + +// thread_local cannot (and doesn't need to?) be exported on Windows +#ifdef _WIN32 +extern ddsrt_thread_local struct thread_state *tsd_thread_state; +#else +extern DDS_EXPORT ddsrt_thread_local struct thread_state *tsd_thread_state; +#endif + + +DDS_EXPORT void thread_states_init (void); +DDS_EXPORT bool thread_states_fini (void); + +DDS_EXPORT const struct ddsi_config_thread_properties_listelem *lookup_thread_properties (const struct ddsi_config *config, const char *name); +DDS_EXPORT dds_return_t create_thread_with_properties (struct thread_state **thrst, struct ddsi_config_thread_properties_listelem const * const tprops, const char *name, uint32_t (*f) (void *arg), void *arg); +DDS_EXPORT dds_return_t create_thread (struct thread_state **thrst, const struct ddsi_domaingv *gv, const char *name, uint32_t (*f) (void *arg), void *arg); +DDS_EXPORT struct thread_state *lookup_thread_state_real (void); +DDS_EXPORT dds_return_t join_thread (struct thread_state *thrst); +DDS_EXPORT void log_stack_traces (const struct ddsrt_log_cfg *logcfg, const struct ddsi_domaingv *gv); + +DDS_INLINE_EXPORT inline struct thread_state *lookup_thread_state (void) { + struct thread_state *thrst = tsd_thread_state; + if (thrst) + return thrst; + else + return lookup_thread_state_real (); +} + +DDS_INLINE_EXPORT inline bool vtime_awake_p (vtime_t vtime) +{ + return (vtime & VTIME_NEST_MASK) != 0; +} + +DDS_INLINE_EXPORT inline bool vtime_asleep_p (vtime_t vtime) +{ + return (vtime & VTIME_NEST_MASK) == 0; +} + +DDS_INLINE_EXPORT inline bool vtime_gt (vtime_t vtime1, vtime_t vtime0) +{ + DDSRT_STATIC_ASSERT_CODE (sizeof (vtime_t) == sizeof (svtime_t)); + return (svtime_t) ((vtime1 & VTIME_TIME_MASK) - (vtime0 & VTIME_TIME_MASK)) > 0; +} + +DDS_INLINE_EXPORT inline bool thread_is_awake (void) +{ + struct thread_state *thrst = lookup_thread_state (); + vtime_t vt = ddsrt_atomic_ld32 (&thrst->vtime); + return vtime_awake_p (vt); +} + +DDS_INLINE_EXPORT inline bool thread_is_asleep (void) +{ + struct thread_state *thrst = lookup_thread_state (); + vtime_t vt = ddsrt_atomic_ld32 (&thrst->vtime); + return vtime_asleep_p (vt); +} + +DDS_INLINE_EXPORT inline void thread_state_asleep (struct thread_state *thrst) +{ + vtime_t vt = ddsrt_atomic_ld32 (&thrst->vtime); + assert (vtime_awake_p (vt)); + /* nested calls a rare and an extra fence doesn't break things */ + ddsrt_atomic_fence_rel (); + thread_vtime_trace (thrst); + if ((vt & VTIME_NEST_MASK) == 1) + vt += (1u << VTIME_TIME_SHIFT) - 1u; + else + vt -= 1u; + ddsrt_atomic_st32 (&thrst->vtime, vt); +} + +DDS_INLINE_EXPORT inline void thread_state_awake (struct thread_state *thrst, const struct ddsi_domaingv *gv) +{ + vtime_t vt = ddsrt_atomic_ld32 (&thrst->vtime); + assert ((vt & VTIME_NEST_MASK) < VTIME_NEST_MASK); + assert (gv != NULL); + assert (thrst->state != THREAD_STATE_ALIVE || gv == ddsrt_atomic_ldvoidp (&thrst->gv)); + thread_vtime_trace (thrst); + ddsrt_atomic_stvoidp (&thrst->gv, (struct ddsi_domaingv *) gv); + ddsrt_atomic_fence_stst (); + ddsrt_atomic_st32 (&thrst->vtime, vt + 1u); + /* nested calls a rare and an extra fence doesn't break things */ + ddsrt_atomic_fence_acq (); +} + +DDS_INLINE_EXPORT inline void thread_state_awake_domain_ok (struct thread_state *thrst) +{ + vtime_t vt = ddsrt_atomic_ld32 (&thrst->vtime); + assert ((vt & VTIME_NEST_MASK) < VTIME_NEST_MASK); + assert (ddsrt_atomic_ldvoidp (&thrst->gv) != NULL); + thread_vtime_trace (thrst); + ddsrt_atomic_st32 (&thrst->vtime, vt + 1u); + /* nested calls a rare and an extra fence doesn't break things */ + ddsrt_atomic_fence_acq (); +} + +DDS_INLINE_EXPORT inline void thread_state_awake_fixed_domain (struct thread_state *thrst) +{ + /* fixed domain -> must be an internal thread */ + assert (thrst->state == THREAD_STATE_ALIVE); + thread_state_awake_domain_ok (thrst); +} + +DDS_INLINE_EXPORT inline void thread_state_awake_to_awake_no_nest (struct thread_state *thrst) +{ + vtime_t vt = ddsrt_atomic_ld32 (&thrst->vtime); + assert ((vt & VTIME_NEST_MASK) == 1); + ddsrt_atomic_fence_rel (); + thread_vtime_trace (thrst); + ddsrt_atomic_st32 (&thrst->vtime, vt + (1u << VTIME_TIME_SHIFT)); + ddsrt_atomic_fence_acq (); +} + +#if defined (__cplusplus) +} +#endif + +#endif /* Q_THREAD_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_transmit.h b/unitree_SDK/include/dds/ddsi/q_transmit.h new file mode 100644 index 0000000..c1aa678 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_transmit.h @@ -0,0 +1,54 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_TRANSMIT_H +#define Q_TRANSMIT_H + +#include "dds/ddsi/q_rtps.h" /* for nn_entityid_t */ + +#if defined (__cplusplus) +extern "C" { +#endif + +struct nn_xpack; +struct nn_xmsg; +struct ddsi_writer; +struct whc_state; +struct ddsi_proxy_reader; +struct ddsi_serdata; +struct ddsi_tkmap_instance; +struct thread_state; + +/* Writing new data; serdata_twrite (serdata) is assumed to be really + recentish; serdata is unref'd. If xp == NULL, data is queued, else + packed. + + "nogc": no GC may occur, so it may not block to throttle the writer if the high water mark of the WHC is reached, which implies true KEEP_LAST behaviour. This is true for all the DDSI built-in writers. + "gc": GC may occur, which means the writer history and watermarks can be anything. This must be used for all application data. + */ +int write_sample_gc (struct thread_state * const thrst, struct nn_xpack *xp, struct ddsi_writer *wr, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk); +int write_sample_nogc (struct thread_state * const thrst, struct nn_xpack *xp, struct ddsi_writer *wr, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk); +int write_sample_gc_notk (struct thread_state * const thrst, struct nn_xpack *xp, struct ddsi_writer *wr, struct ddsi_serdata *serdata); +int write_sample_nogc_notk (struct thread_state * const thrst, struct nn_xpack *xp, struct ddsi_writer *wr, struct ddsi_serdata *serdata); + +/* When calling the following functions, wr->lock must be held */ +dds_return_t create_fragment_message (struct ddsi_writer *wr, seqno_t seq, const struct ddsi_plist *plist, struct ddsi_serdata *serdata, uint32_t fragnum, uint16_t nfrags, struct ddsi_proxy_reader *prd,struct nn_xmsg **msg, int isnew, uint32_t advertised_fragnum); +int enqueue_sample_wrlock_held (struct ddsi_writer *wr, seqno_t seq, const struct ddsi_plist *plist, struct ddsi_serdata *serdata, struct ddsi_proxy_reader *prd, int isnew); +void enqueue_spdp_sample_wrlock_held (struct ddsi_writer *wr, seqno_t seq, struct ddsi_serdata *serdata, struct ddsi_proxy_reader *prd); +void add_Heartbeat (struct nn_xmsg *msg, struct ddsi_writer *wr, const struct whc_state *whcst, int hbansreq, int hbliveliness, ddsi_entityid_t dst, int issync); +dds_return_t write_hb_liveliness (struct ddsi_domaingv * const gv, struct ddsi_guid *wr_guid, struct nn_xpack *xp); +int write_sample_p2p_wrlock_held(struct ddsi_writer *wr, seqno_t seq, struct ddsi_plist *plist, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk, struct ddsi_proxy_reader *prd); + +#if defined (__cplusplus) +} +#endif + +#endif /* Q_TRANSMIT_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_unused.h b/unitree_SDK/include/dds/ddsi/q_unused.h new file mode 100644 index 0000000..c89d32c --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_unused.h @@ -0,0 +1,27 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_UNUSED_H +#define NN_UNUSED_H + +#ifdef __GNUC__ +#define UNUSED_ARG(x) x __attribute__ ((unused)) +#else +#define UNUSED_ARG(x) x +#endif + +#ifndef NDEBUG +#define UNUSED_ARG_NDEBUG(x) x +#else +#define UNUSED_ARG_NDEBUG(x) UNUSED_ARG (x) +#endif + +#endif /* NN_UNUSED_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_whc.h b/unitree_SDK/include/dds/ddsi/q_whc.h new file mode 100644 index 0000000..5da5476 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_whc.h @@ -0,0 +1,141 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef Q_WHC_H +#define Q_WHC_H + +#include +#include "dds/ddsrt/time.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_serdata; +struct ddsi_plist; +struct ddsi_tkmap_instance; +struct whc_node; /* opaque, but currently used for deferred free lists */ +struct whc; + +struct whc_borrowed_sample { + seqno_t seq; + struct ddsi_serdata *serdata; + struct ddsi_plist *plist; + bool unacked; + ddsrt_mtime_t last_rexmit_ts; + unsigned rexmit_count; +}; + +struct whc_state { + seqno_t min_seq; /* 0 if WHC empty, else > 0 */ + seqno_t max_seq; /* 0 if WHC empty, else >= min_seq */ + size_t unacked_bytes; +}; +#define WHCST_ISEMPTY(whcst) ((whcst)->max_seq == 0) + +/* Adjust SIZE and alignment stuff as needed: they are here simply so we can allocate + an iter on the stack without specifying an implementation. If future changes or + implementations require more, these can be adjusted. An implementation should check + things fit at compile time. */ +#define WHC_SAMPLE_ITER_SIZE (8 * sizeof(void *)) +struct whc_sample_iter_base { + struct whc *whc; +}; +struct whc_sample_iter { + struct whc_sample_iter_base c; + union { + char opaque[WHC_SAMPLE_ITER_SIZE]; + /* cover alignment requirements: */ + uint64_t x; + double y; + void *p; + } opaque; +}; + +typedef seqno_t (*whc_next_seq_t)(const struct whc *whc, seqno_t seq); +typedef void (*whc_get_state_t)(const struct whc *whc, struct whc_state *st); +typedef bool (*whc_borrow_sample_t)(const struct whc *whc, seqno_t seq, struct whc_borrowed_sample *sample); +typedef bool (*whc_borrow_sample_key_t)(const struct whc *whc, const struct ddsi_serdata *serdata_key, struct whc_borrowed_sample *sample); +typedef void (*whc_return_sample_t)(struct whc *whc, struct whc_borrowed_sample *sample, bool update_retransmit_info); +typedef void (*whc_sample_iter_init_t)(const struct whc *whc, struct whc_sample_iter *it); +typedef bool (*whc_sample_iter_borrow_next_t)(struct whc_sample_iter *it, struct whc_borrowed_sample *sample); +typedef void (*whc_free_t)(struct whc *whc); + +/* min_seq is lowest sequence number that must be retained because of + reliable readers that have not acknowledged all data */ +/* max_drop_seq must go soon, it's way too ugly. */ +/* plist may be NULL or ddsrt_malloc'd, WHC takes ownership of plist */ +typedef int (*whc_insert_t)(struct whc *whc, seqno_t max_drop_seq, seqno_t seq, ddsrt_mtime_t exp, struct ddsi_plist *plist, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk); +typedef uint32_t (*whc_downgrade_to_volatile_t)(struct whc *whc, struct whc_state *st); +typedef uint32_t (*whc_remove_acked_messages_t)(struct whc *whc, seqno_t max_drop_seq, struct whc_state *whcst, struct whc_node **deferred_free_list); +typedef void (*whc_free_deferred_free_list_t)(struct whc *whc, struct whc_node *deferred_free_list); + +struct whc_ops { + whc_insert_t insert; + whc_remove_acked_messages_t remove_acked_messages; + whc_free_deferred_free_list_t free_deferred_free_list; + whc_get_state_t get_state; + whc_next_seq_t next_seq; + whc_borrow_sample_t borrow_sample; + whc_borrow_sample_key_t borrow_sample_key; + whc_return_sample_t return_sample; + whc_sample_iter_init_t sample_iter_init; + whc_sample_iter_borrow_next_t sample_iter_borrow_next; + whc_downgrade_to_volatile_t downgrade_to_volatile; + whc_free_t free; +}; + +struct whc { + const struct whc_ops *ops; +}; + +DDS_INLINE_EXPORT inline seqno_t whc_next_seq (const struct whc *whc, seqno_t seq) { + return whc->ops->next_seq (whc, seq); +} +DDS_INLINE_EXPORT inline void whc_get_state (const struct whc *whc, struct whc_state *st) { + whc->ops->get_state (whc, st); +} +DDS_INLINE_EXPORT inline bool whc_borrow_sample (const struct whc *whc, seqno_t seq, struct whc_borrowed_sample *sample) { + return whc->ops->borrow_sample (whc, seq, sample); +} +DDS_INLINE_EXPORT inline bool whc_borrow_sample_key (const struct whc *whc, const struct ddsi_serdata *serdata_key, struct whc_borrowed_sample *sample) { + return whc->ops->borrow_sample_key (whc, serdata_key, sample); +} +DDS_INLINE_EXPORT inline void whc_return_sample (struct whc *whc, struct whc_borrowed_sample *sample, bool update_retransmit_info) { + whc->ops->return_sample (whc, sample, update_retransmit_info); +} +DDS_INLINE_EXPORT inline void whc_sample_iter_init (const struct whc *whc, struct whc_sample_iter *it) { + whc->ops->sample_iter_init (whc, it); +} +DDS_INLINE_EXPORT inline bool whc_sample_iter_borrow_next (struct whc_sample_iter *it, struct whc_borrowed_sample *sample) { + return it->c.whc->ops->sample_iter_borrow_next (it, sample); +} +DDS_INLINE_EXPORT inline void whc_free (struct whc *whc) { + whc->ops->free (whc); +} +DDS_INLINE_EXPORT inline int whc_insert (struct whc *whc, seqno_t max_drop_seq, seqno_t seq, ddsrt_mtime_t exp, struct ddsi_plist *plist, struct ddsi_serdata *serdata, struct ddsi_tkmap_instance *tk) { + return whc->ops->insert (whc, max_drop_seq, seq, exp, plist, serdata, tk); +} +DDS_INLINE_EXPORT inline unsigned whc_downgrade_to_volatile (struct whc *whc, struct whc_state *st) { + return whc->ops->downgrade_to_volatile (whc, st); +} +DDS_INLINE_EXPORT inline unsigned whc_remove_acked_messages (struct whc *whc, seqno_t max_drop_seq, struct whc_state *whcst, struct whc_node **deferred_free_list) { + return whc->ops->remove_acked_messages (whc, max_drop_seq, whcst, deferred_free_list); +} +DDS_INLINE_EXPORT inline void whc_free_deferred_free_list (struct whc *whc, struct whc_node *deferred_free_list) { + whc->ops->free_deferred_free_list (whc, deferred_free_list); +} + +#if defined (__cplusplus) +} +#endif + +#endif /* Q_WHC_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_xevent.h b/unitree_SDK/include/dds/ddsi/q_xevent.h new file mode 100644 index 0000000..d5e030e --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_xevent.h @@ -0,0 +1,78 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_XEVENT_H +#define NN_XEVENT_H + +#include "dds/ddsrt/retcode.h" +#include "dds/ddsi/ddsi_guid.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* NOTE: xevents scheduled with the same tsched used to always be + executed in the order of scheduling, but that is no longer true. + With the messages now via the "untimed" path, that should not + introduce any issues. */ + +struct ddsi_writer; +struct ddsi_pwr_rd_match; +struct ddsi_participant; +struct ddsi_proxy_participant; +struct ddsi_tran_conn; +struct xevent; +struct xeventq; +struct ddsi_proxy_writer; +struct ddsi_proxy_reader; +struct ddsi_domaingv; +struct nn_xmsg; + +DDS_EXPORT struct xeventq *xeventq_new (struct ddsi_domaingv *gv, size_t max_queued_rexmit_bytes, size_t max_queued_rexmit_msgs, uint32_t auxiliary_bandwidth_limit); + +/* xeventq_free calls callback handlers with t = NEVER, at which point they are required to free + whatever memory is claimed for the argument and call delete_xevent. */ +DDS_EXPORT void xeventq_free (struct xeventq *evq); +DDS_EXPORT dds_return_t xeventq_start (struct xeventq *evq, const char *name); /* <0 => error, =0 => ok */ +DDS_EXPORT void xeventq_stop (struct xeventq *evq); + +DDS_EXPORT void qxev_msg (struct xeventq *evq, struct nn_xmsg *msg); + +DDS_EXPORT void qxev_pwr_entityid (struct ddsi_proxy_writer * pwr, const ddsi_guid_t *guid); +DDS_EXPORT void qxev_prd_entityid (struct ddsi_proxy_reader * prd, const ddsi_guid_t *guid); +DDS_EXPORT void qxev_nt_callback (struct xeventq *evq, void (*cb) (void *arg), void *arg); + +enum qxev_msg_rexmit_result { + QXEV_MSG_REXMIT_DROPPED, + QXEV_MSG_REXMIT_MERGED, + QXEV_MSG_REXMIT_QUEUED +}; + +DDS_EXPORT enum qxev_msg_rexmit_result qxev_msg_rexmit_wrlock_held (struct xeventq *evq, struct nn_xmsg *msg, int force); + +/* All of the following lock EVQ for the duration of the operation */ +DDS_EXPORT void delete_xevent (struct xevent *ev); +DDS_EXPORT void delete_xevent_callback (struct xevent *ev); +DDS_EXPORT int resched_xevent_if_earlier (struct xevent *ev, ddsrt_mtime_t tsched); + +DDS_EXPORT struct xevent *qxev_heartbeat (struct xeventq *evq, ddsrt_mtime_t tsched, const ddsi_guid_t *wr_guid); +DDS_EXPORT struct xevent *qxev_acknack (struct xeventq *evq, ddsrt_mtime_t tsched, const ddsi_guid_t *pwr_guid, const ddsi_guid_t *rd_guid); +DDS_EXPORT struct xevent *qxev_spdp (struct xeventq *evq, ddsrt_mtime_t tsched, const ddsi_guid_t *pp_guid, const ddsi_guid_t *proxypp_guid); +DDS_EXPORT struct xevent *qxev_pmd_update (struct xeventq *evq, ddsrt_mtime_t tsched, const ddsi_guid_t *pp_guid); +DDS_EXPORT struct xevent *qxev_delete_writer (struct xeventq *evq, ddsrt_mtime_t tsched, const ddsi_guid_t *guid); + +/* cb will be called with now = NEVER if the event is still enqueued when when xeventq_free starts cleaning up */ +DDS_EXPORT struct xevent *qxev_callback (struct xeventq *evq, ddsrt_mtime_t tsched, void (*cb) (struct xevent *xev, void *arg, ddsrt_mtime_t now), void *arg); + +#if defined (__cplusplus) +} +#endif +#endif /* NN_XEVENT_H */ diff --git a/unitree_SDK/include/dds/ddsi/q_xmsg.h b/unitree_SDK/include/dds/ddsi/q_xmsg.h new file mode 100644 index 0000000..ec37eb6 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/q_xmsg.h @@ -0,0 +1,164 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef NN_XMSG_H +#define NN_XMSG_H + +#include + +#include "dds/ddsrt/bswap.h" +#include "dds/ddsi/q_protocol.h" /* for, e.g., SubmessageKind_t */ +//#include "dds/ddsi/ddsi_xqos.h" /* for, e.g., octetseq, stringseq */ +#include "dds/ddsi/ddsi_tran.h" +#include "dds/features.h" + +#ifdef DDS_HAS_SHM +#include "dds/ddsi/ddsi_shm_transport.h" +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsi_serdata; +struct addrset; +struct ddsi_proxy_reader; +struct ddsi_proxy_writer; +struct ddsi_writer; +struct ddsi_participant; + +struct nn_adlink_participant_version_info; +struct nn_xmsgpool; +struct nn_xmsg_data; +struct nn_xmsg; +struct nn_xpack; +struct ddsi_plist_sample; + +struct nn_xmsg_marker { + size_t offset; +}; + +enum nn_xmsg_kind { + NN_XMSG_KIND_CONTROL, + NN_XMSG_KIND_DATA, + NN_XMSG_KIND_DATA_REXMIT, + NN_XMSG_KIND_DATA_REXMIT_NOMERGE +}; + +/* XMSGPOOL */ + +struct nn_xmsgpool *nn_xmsgpool_new (void); +void nn_xmsgpool_free (struct nn_xmsgpool *pool); + +/* XMSG */ + +/* To allocate a new xmsg from the pool; if expected_size is NOT + exceeded, no reallocs will be performed, else the address of the + xmsg may change because of reallocing when appending to it. */ +struct nn_xmsg *nn_xmsg_new (struct nn_xmsgpool *pool, const ddsi_guid_t *src_guid, struct ddsi_participant *pp, size_t expected_size, enum nn_xmsg_kind kind); + +/* For sending to a particular destination (participant) */ +void nn_xmsg_setdst1 (struct ddsi_domaingv *gv, struct nn_xmsg *m, const ddsi_guid_prefix_t *gp, const ddsi_xlocator_t *addr); +bool nn_xmsg_getdst1prefix (struct nn_xmsg *m, ddsi_guid_prefix_t *gp); + +/* For sending to a particular proxy reader; this is a convenience + routine that extracts a suitable address from the proxy reader's + address sets and calls setdst1. */ +void nn_xmsg_setdstPRD (struct nn_xmsg *m, const struct ddsi_proxy_reader *prd); +void nn_xmsg_setdstPWR (struct nn_xmsg *m, const struct ddsi_proxy_writer *pwr); + +/* For sending to all in the address set AS -- typically, the writer's + address set to multicast to all matched readers */ +void nn_xmsg_setdstN (struct nn_xmsg *msg, struct addrset *as); + +int nn_xmsg_setmaxdelay (struct nn_xmsg *msg, int64_t maxdelay); + +#ifdef DDS_HAS_NETWORK_PARTITIONS +int nn_xmsg_setencoderid (struct nn_xmsg *msg, uint32_t encoderid); +#endif + +/* Sets the location of the destination readerId within the message + (address changes because of reallocations are handled correctly). + M must be a rexmit, and for all rexmits this must be called. It is + a separate function because the location may only become known at a + late-ish stage in the construction of the message. */ +void nn_xmsg_set_data_readerId (struct nn_xmsg *m, ddsi_entityid_t *readerId); + +/* If M and MADD are both xmsg's containing the same retransmit + message, this will merge the destination embedded in MADD into M. + Typically, this will cause the readerId of M to be cleared and the + destination to change to the writer's address set. + + M and MADD *must* contain the same sample/fragment of a sample. + + Returns 1 if merge was successful, else 0. On failure, neither + message will have been changed and both should be sent as if there + had been no merging. */ +int nn_xmsg_merge_rexmit_destinations_wrlock_held (struct ddsi_domaingv *gv, struct nn_xmsg *m, const struct nn_xmsg *madd); + +/* To set writer ids for updating last transmitted sequence number; + wrfragid is 0 based, unlike DDSI but like other places where + fragment numbers are handled internally. */ +void nn_xmsg_setwriterseq (struct nn_xmsg *msg, const ddsi_guid_t *wrguid, seqno_t wrseq); +void nn_xmsg_setwriterseq_fragid (struct nn_xmsg *msg, const ddsi_guid_t *wrguid, seqno_t wrseq, nn_fragment_number_t wrfragid); + +/* Comparison function for retransmits: orders messages on writer + guid, sequence number and fragment id */ +int nn_xmsg_compare_fragid (const struct nn_xmsg *a, const struct nn_xmsg *b); + +void nn_xmsg_free (struct nn_xmsg *msg); +size_t nn_xmsg_size (const struct nn_xmsg *m); +void *nn_xmsg_payload (size_t *sz, struct nn_xmsg *m); +void nn_xmsg_payload_to_plistsample (struct ddsi_plist_sample *dst, nn_parameterid_t keyparam, const struct nn_xmsg *m); +enum nn_xmsg_kind nn_xmsg_kind (const struct nn_xmsg *m); +void nn_xmsg_guid_seq_fragid (const struct nn_xmsg *m, ddsi_guid_t *wrguid, seqno_t *wrseq, nn_fragment_number_t *wrfragid); + +void *nn_xmsg_submsg_from_marker (struct nn_xmsg *msg, struct nn_xmsg_marker marker); +void *nn_xmsg_append (struct nn_xmsg *m, struct nn_xmsg_marker *marker, size_t sz); +void nn_xmsg_shrink (struct nn_xmsg *m, struct nn_xmsg_marker marker, size_t sz); +void nn_xmsg_serdata (struct nn_xmsg *m, struct ddsi_serdata *serdata, size_t off, size_t len, struct ddsi_writer *wr); +#ifdef DDS_HAS_SECURITY +size_t nn_xmsg_submsg_size (struct nn_xmsg *msg, struct nn_xmsg_marker marker); +void nn_xmsg_submsg_remove (struct nn_xmsg *msg, struct nn_xmsg_marker sm_marker); +void nn_xmsg_submsg_replace (struct nn_xmsg *msg, struct nn_xmsg_marker sm_marker, unsigned char *new_submsg, size_t new_len); +void nn_xmsg_submsg_append_refd_payload (struct nn_xmsg *msg, struct nn_xmsg_marker sm_marker); +#endif +void nn_xmsg_submsg_setnext (struct nn_xmsg *msg, struct nn_xmsg_marker marker); +void nn_xmsg_submsg_init (struct nn_xmsg *msg, struct nn_xmsg_marker marker, SubmessageKind_t smkind); +void nn_xmsg_add_timestamp (struct nn_xmsg *m, ddsrt_wctime_t t); +void nn_xmsg_add_entityid (struct nn_xmsg * m); +void *nn_xmsg_addpar_bo (struct nn_xmsg *m, nn_parameterid_t pid, size_t len, enum ddsrt_byte_order_selector bo); +void *nn_xmsg_addpar (struct nn_xmsg *m, nn_parameterid_t pid, size_t len); +void nn_xmsg_addpar_keyhash (struct nn_xmsg *m, const struct ddsi_serdata *serdata, bool force_md5); +void nn_xmsg_addpar_statusinfo (struct nn_xmsg *m, unsigned statusinfo); +void nn_xmsg_addpar_sentinel (struct nn_xmsg *m); +void nn_xmsg_addpar_sentinel_bo (struct nn_xmsg * m, enum ddsrt_byte_order_selector bo); +int nn_xmsg_addpar_sentinel_ifparam (struct nn_xmsg *m); + +/* XPACK */ + +struct nn_xpack * nn_xpack_new (struct ddsi_domaingv *gv, uint32_t bw_limit, bool async_mode); +void nn_xpack_free (struct nn_xpack *xp); +void nn_xpack_send (struct nn_xpack *xp, bool immediately /* unused */); +int nn_xpack_addmsg (struct nn_xpack *xp, struct nn_xmsg *m, const uint32_t flags); +int64_t nn_xpack_maxdelay (const struct nn_xpack *xp); +unsigned nn_xpack_packetid (const struct nn_xpack *xp); + +/* SENDQ */ +void nn_xpack_sendq_init (struct ddsi_domaingv *gv); +void nn_xpack_sendq_start (struct ddsi_domaingv *gv); +void nn_xpack_sendq_stop (struct ddsi_domaingv *gv); +void nn_xpack_sendq_fini (struct ddsi_domaingv *gv); + +#if defined (__cplusplus) +} +#endif +#endif /* NN_XMSG_H */ diff --git a/unitree_SDK/include/dds/ddsi/sysdeps.h b/unitree_SDK/include/dds/ddsi/sysdeps.h new file mode 100644 index 0000000..e4e5229 --- /dev/null +++ b/unitree_SDK/include/dds/ddsi/sysdeps.h @@ -0,0 +1,33 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef SYSDEPS_H +#define SYSDEPS_H + +#include "dds/export.h" +#include "dds/ddsrt/threads.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#define ASSERT_RDLOCK_HELD(x) ((void) 0) +#define ASSERT_WRLOCK_HELD(x) ((void) 0) +#define ASSERT_MUTEX_HELD(x) ((void) 0) + +struct ddsrt_log_cfg; +DDS_EXPORT void log_stacktrace (const struct ddsrt_log_cfg *logcfg, const char *name, ddsrt_thread_t tid); + +#if defined (__cplusplus) +} +#endif + +#endif /* SYSDEPS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/align.h b/unitree_SDK/include/dds/ddsrt/align.h new file mode 100644 index 0000000..e9197bc --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/align.h @@ -0,0 +1,25 @@ +/* + * Copyright(c) 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_ALIGN_H +#define DDSRT_ALIGN_H + +#if defined (__cplusplus) +extern "C" { +#endif + +#define dds_alignof _Alignof + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_ALIGN_H */ diff --git a/unitree_SDK/include/dds/ddsrt/arch.h b/unitree_SDK/include/dds/ddsrt/arch.h new file mode 100644 index 0000000..312bc4f --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/arch.h @@ -0,0 +1,29 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_ARCH_H +#define DDSRT_ARCH_H + +#if _WIN32 +# if _WIN64 +# define DDSRT_64BIT 1 +# else +# define DDSRT_64BIT 0 +# endif +#else +# if defined(_LP64) +# define DDSRT_64BIT 1 +# else +# define DDSRT_64BIT 0 +# endif +#endif + +#endif /* DDSRT_ARCH_H */ diff --git a/unitree_SDK/include/dds/ddsrt/atomics.h b/unitree_SDK/include/dds/ddsrt/atomics.h new file mode 100644 index 0000000..b655ef8 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/atomics.h @@ -0,0 +1,94 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_ATOMICS_H +#define DDSRT_ATOMICS_H + +#include + +#include "dds/export.h" +#include "dds/ddsrt/arch.h" +#include "dds/ddsrt/endian.h" +#include "dds/ddsrt/types.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @brief Types on which atomic operations are defined. + * + * @note 64-bit types are defined even if atomic operations on them are not + * really supported. atomic + */ +typedef struct { uint32_t v; } ddsrt_atomic_uint32_t; +typedef struct { uint64_t v; } ddsrt_atomic_uint64_t; +typedef struct { uintptr_t v; } ddsrt_atomic_uintptr_t; +typedef ddsrt_atomic_uintptr_t ddsrt_atomic_voidp_t; + +#if DDSRT_64BIT +# define DDSRT_HAVE_ATOMIC64 1 +#endif + +/** + * @brief Initializers for the types on which atomic operations are defined. + */ +#define DDSRT_ATOMIC_UINT32_INIT(v) { (v) } +#define DDSRT_ATOMIC_UINT64_INIT(v) { (v) } +#define DDSRT_ATOMIC_UINTPTR_INIT(v) { (v) } +#define DDSRT_ATOMIC_VOIDP_INIT(v) { (uintptr_t) (v) } + + +#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40100 +#include "dds/ddsrt/atomics/gcc.h" +#elif defined(_WIN32) +#include "dds/ddsrt/atomics/msvc.h" +#elif defined(__sun) +#include "dds/ddsrt/atomics/sun.h" +#elif defined(__IAR_SYSTEMS_ICC__) && defined(__ICCARM__) +#include "dds/ddsrt/atomics/arm.h" +#else +#error "Atomic operations are not supported" +#endif + +#if ! DDSRT_HAVE_ATOMIC64 +/* 64-bit atomics are not supported by all hardware, but it would be a shame not to use them when + they are available. That necessitates an alternative implementation when they are not, either in + the form of a different implementation where it is used, or as an emulation using a mutex in + ddsrt. It seems that the places where they'd be used end up adding a mutex, so an emulation in + ddsrt while being able to check whether it is supported by hardware is a sensible approach. */ +DDS_EXPORT uint64_t ddsrt_atomic_ld64 (const volatile ddsrt_atomic_uint64_t *x); +DDS_EXPORT void ddsrt_atomic_st64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v); +DDS_EXPORT void ddsrt_atomic_inc64 (volatile ddsrt_atomic_uint64_t *x); +DDS_EXPORT uint64_t ddsrt_atomic_inc64_nv (volatile ddsrt_atomic_uint64_t *x); +DDS_EXPORT void ddsrt_atomic_dec64 (volatile ddsrt_atomic_uint64_t *x); +DDS_EXPORT uint64_t ddsrt_atomic_dec64_nv (volatile ddsrt_atomic_uint64_t *x); +DDS_EXPORT void ddsrt_atomic_add64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v); +DDS_EXPORT uint64_t ddsrt_atomic_add64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v); +DDS_EXPORT void ddsrt_atomic_sub64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v); +DDS_EXPORT uint64_t ddsrt_atomic_sub64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v); +DDS_EXPORT void ddsrt_atomic_and64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v); +DDS_EXPORT uint64_t ddsrt_atomic_and64_ov (volatile ddsrt_atomic_uint64_t *x, uint64_t v); +DDS_EXPORT uint64_t ddsrt_atomic_and64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v); +DDS_EXPORT void ddsrt_atomic_or64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v); +DDS_EXPORT uint64_t ddsrt_atomic_or64_ov (volatile ddsrt_atomic_uint64_t *x, uint64_t v); +DDS_EXPORT uint64_t ddsrt_atomic_or64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v); +DDS_EXPORT int ddsrt_atomic_cas64 (volatile ddsrt_atomic_uint64_t *x, uint64_t exp, uint64_t des); +#endif + +void ddsrt_atomics_init (void); +void ddsrt_atomics_fini (void); + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_ATOMICS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/atomics/arm.h b/unitree_SDK/include/dds/ddsrt/atomics/arm.h new file mode 100644 index 0000000..24c532c --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/atomics/arm.h @@ -0,0 +1,173 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_ATOMICS_ARM_H +#define DDSRT_ATOMICS_ARM_H + +#if defined (__cplusplus) +extern "C" { +#endif + +#if !defined(__arm__) +#define __arm__ +#endif + +/* IAR documentation states that __CPU_MODE__ is a predefined preprocessor + symbol reflecting the selected CPU mode and is defined to 1 for Thumb and + 2 for ARM. */ +#if !defined(__thumb__) && __CPU_MODE__ == 1 +#define __thumb__ +#endif + +/* LD, ST */ + +inline uint32_t ddsrt_atomic_ld32 (const volatile ddsrt_atomic_uint32_t *x) { return x->v; } +inline uintptr_t ddsrt_atomic_ldptr (const volatile ddsrt_atomic_uintptr_t *x) { return x->v; } +inline void *ddsrt_atomic_ldvoidp (const volatile ddsrt_atomic_voidp_t *x) { return (void *) ddsrt_atomic_ldptr (x); } + +inline void ddsrt_atomic_st32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { x->v = v; } +inline void ddsrt_atomic_stptr (volatile ddsrt_atomic_uintptr_t *x, uintptr_t v) { x->v = v; } +inline void ddsrt_atomic_stvoidp (volatile ddsrt_atomic_voidp_t *x, void *v) { ddsrt_atomic_stptr (x, (uintptr_t) v); } + +/* CAS */ + +inline int ddsrt_atomic_cas32 (volatile ddsrt_atomic_uint32_t *x, uint32_t exp, uint32_t des) { + register int result; + asm volatile ("ldrex r0, [%1]\n\t" /*exclusive load of ptr */ + "cmp r0, %2\n\t" /*compare the oldval == *ptr */ +#if defined(__thumb__) + "ite eq\n\t" +#endif + "strexeq %0, %3, [%1]\n\t" /*store if eq, strex+eq*/ +#if defined(__thumb__) + "clrexne" +#endif + : "=&r" (result) + : "r"(&x->v), "r"(exp),"r"(des) + : "r0"); + return result == 0; +} +inline int ddsrt_atomic_casptr (volatile ddsrt_atomic_uintptr_t *x, uintptr_t exp, uintptr_t des) { + return ddsrt_atomic_cas32 ((volatile ddsrt_atomic_uint32_t *) x, exp, des); +} +inline int ddsrt_atomic_casvoidp (volatile ddsrt_atomic_voidp_t *x, void *exp, void *des) { + return ddsrt_atomic_casptr ((volatile ddsrt_atomic_uintptr_t *) x, (uintptr_t) exp, (uintptr_t) des); +} + +/* ADD */ + +inline uint32_t ddsrt_atomic_add32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + register unsigned int result; + asm volatile ("1: ldrex %0, [%1]\n\t" + "add %0, %0, %2\n\t" + "strex r1, %0, [%1]\n\t" + "cmp r1, #0\n\t" + "bne 1b" + : "=&r" (result) + : "r"(&x->v), "r"(v) + : "r1"); + return result; +} +inline void ddsrt_atomic_add32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + (void) ddsrt_atomic_add32_nv (x, v); +} +inline uint32_t ddsrt_atomic_add32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return ddsrt_atomic_add32_nv (x, v) - v; +} + +/* SUB */ + +inline uint32_t ddsrt_atomic_sub32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return ddsrt_atomic_add32_nv (x, -v); +} +inline void ddsrt_atomic_sub32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + ddsrt_atomic_add32 (x, -v); +} + +/* INC */ + +inline uint32_t ddsrt_atomic_inc32_ov (volatile ddsrt_atomic_uint32_t *x) { + return ddsrt_atomic_add32_nv (x, 1) - 1; +} +inline uint32_t ddsrt_atomic_inc32_nv (volatile ddsrt_atomic_uint32_t *x) { + return ddsrt_atomic_add32_nv (x, 1); +} +inline void ddsrt_atomic_inc32 (volatile ddsrt_atomic_uint32_t *x) { + (void) ddsrt_atomic_inc32_nv (x); +} + +/* DEC */ + +inline uint32_t ddsrt_atomic_dec32_ov (volatile ddsrt_atomic_uint32_t *x) { + return ddsrt_atomic_sub32_nv (x, 1) + 1; +} +inline uint32_t ddsrt_atomic_dec32_nv (volatile ddsrt_atomic_uint32_t *x) { + return ddsrt_atomic_sub32_nv (x, 1); +} +inline void ddsrt_atomic_dec32 (volatile ddsrt_atomic_uint32_t *x) { + (void) ddsrt_atomic_dec32_nv (x); +} + +/* AND */ + +inline uint32_t ddsrt_atomic_and32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + uint32_t oldval, newval; + do { oldval = x->v; newval = oldval & v; } while (!ddsrt_atomic_cas32 (x, oldval, newval)); + return oldval; +} +inline uint32_t ddsrt_atomic_and32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + uint32_t oldval, newval; + do { oldval = x->v; newval = oldval & v; } while (!ddsrt_atomic_cas32 (x, oldval, newval)); + return newval; +} +inline void ddsrt_atomic_and32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + (void) ddsrt_atomic_and32_nv (x, v); +} + +/* OR */ + +inline uint32_t ddsrt_atomic_or32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + uint32_t oldval, newval; + do { oldval = x->v; newval = oldval | v; } while (!ddsrt_atomic_cas32 (x, oldval, newval)); + return oldval; +} +inline uint32_t ddsrt_atomic_or32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + uint32_t oldval, newval; + do { oldval = x->v; newval = oldval | v; } while (!ddsrt_atomic_cas32 (x, oldval, newval)); + return newval; +} +inline void ddsrt_atomic_or32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + (void) ddsrt_atomic_or32_nv (x, v); +} + +/* FENCES */ + +inline void ddsrt_atomic_fence (void) { + __asm volatile ("dmb" : : : "memory"); +} +inline void ddsrt_atomic_fence_ldld (void) { + ddsrt_atomic_fence (); +} +inline void ddsrt_atomic_fence_stst (void) { + ddsrt_atomic_fence (); +} +inline void ddsrt_atomic_fence_acq (void) { + ddsrt_atomic_fence (); +} +inline void ddsrt_atomic_fence_rel (void) { + ddsrt_atomic_fence (); +} + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_ATOMICS_ARM_H */ diff --git a/unitree_SDK/include/dds/ddsrt/atomics/gcc.h b/unitree_SDK/include/dds/ddsrt/atomics/gcc.h new file mode 100644 index 0000000..0e30d5b --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/atomics/gcc.h @@ -0,0 +1,309 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_ATOMICS_GCC_H +#define DDSRT_ATOMICS_GCC_H + +#include "dds/ddsrt/misc.h" +#include "dds/ddsrt/attributes.h" + +#if defined (__cplusplus) +extern "C" { +DDSRT_WARNING_GNUC_OFF(old-style-cast) +DDSRT_WARNING_CLANG_OFF(old-style-cast) +#endif + +#if ( DDSRT_HAVE_ATOMIC64 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16) || \ + (!DDSRT_HAVE_ATOMIC64 && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) +# define DDSRT_HAVE_ATOMIC_LIFO 1 +#endif + +/* LD, ST */ + +DDS_INLINE_EXPORT ddsrt_attribute_no_sanitize (("thread")) +inline uint32_t ddsrt_atomic_ld32(const volatile ddsrt_atomic_uint32_t *x) +{ + return x->v; +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT ddsrt_attribute_no_sanitize (("thread")) +inline uint64_t ddsrt_atomic_ld64(const volatile ddsrt_atomic_uint64_t *x) +{ + return x->v; +} +#endif +DDS_INLINE_EXPORT ddsrt_attribute_no_sanitize (("thread")) +inline uintptr_t ddsrt_atomic_ldptr(const volatile ddsrt_atomic_uintptr_t *x) +{ + return x->v; +} +DDS_INLINE_EXPORT ddsrt_attribute_no_sanitize (("thread")) +inline void *ddsrt_atomic_ldvoidp(const volatile ddsrt_atomic_voidp_t *x) +{ + return (void *) ddsrt_atomic_ldptr(x); +} + +DDS_INLINE_EXPORT ddsrt_attribute_no_sanitize (("thread")) +inline void ddsrt_atomic_st32(volatile ddsrt_atomic_uint32_t *x, uint32_t v) +{ + x->v = v; +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT ddsrt_attribute_no_sanitize (("thread")) +inline void ddsrt_atomic_st64(volatile ddsrt_atomic_uint64_t *x, uint64_t v) +{ + x->v = v; +} +#endif +DDS_INLINE_EXPORT ddsrt_attribute_no_sanitize (("thread")) +inline void ddsrt_atomic_stptr(volatile ddsrt_atomic_uintptr_t *x, uintptr_t v) +{ + x->v = v; +} +DDS_INLINE_EXPORT ddsrt_attribute_no_sanitize (("thread")) +inline void ddsrt_atomic_stvoidp(volatile ddsrt_atomic_voidp_t *x, void *v) +{ + ddsrt_atomic_stptr(x, (uintptr_t)v); +} + +/* INC */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_inc32(volatile ddsrt_atomic_uint32_t *x) { + __sync_fetch_and_add (&x->v, 1); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_inc64 (volatile ddsrt_atomic_uint64_t *x) { + __sync_fetch_and_add (&x->v, 1); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_inc32_ov (volatile ddsrt_atomic_uint32_t *x) { + return __sync_fetch_and_add (&x->v, 1); +} +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_inc32_nv (volatile ddsrt_atomic_uint32_t *x) { + return __sync_add_and_fetch (&x->v, 1); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_inc64_nv (volatile ddsrt_atomic_uint64_t *x) { + return __sync_add_and_fetch (&x->v, 1); +} +#endif + +/* DEC */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_dec32 (volatile ddsrt_atomic_uint32_t *x) { + __sync_fetch_and_sub (&x->v, 1); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_dec64 (volatile ddsrt_atomic_uint64_t *x) { + __sync_fetch_and_sub (&x->v, 1); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_dec32_nv (volatile ddsrt_atomic_uint32_t *x) { + return __sync_sub_and_fetch (&x->v, 1); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_dec64_nv (volatile ddsrt_atomic_uint64_t *x) { + return __sync_sub_and_fetch (&x->v, 1); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_dec32_ov (volatile ddsrt_atomic_uint32_t *x) { + return __sync_fetch_and_sub (&x->v, 1); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_dec64_ov (volatile ddsrt_atomic_uint64_t *x) { + return __sync_fetch_and_sub (&x->v, 1); +} +#endif + +/* ADD */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_add32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + __sync_fetch_and_add (&x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_add64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + __sync_fetch_and_add (&x->v, v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_add32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return __sync_fetch_and_add (&x->v, v); +} +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_add32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return __sync_add_and_fetch (&x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_add64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return __sync_add_and_fetch (&x->v, v); +} +#endif + +/* SUB */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_sub32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + __sync_fetch_and_sub (&x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_sub64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + __sync_fetch_and_sub (&x->v, v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_sub32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return __sync_fetch_and_sub (&x->v, v); +} +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_sub32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return __sync_sub_and_fetch (&x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_sub64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return __sync_sub_and_fetch (&x->v, v); +} +#endif + +/* AND */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_and32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + __sync_fetch_and_and (&x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_and64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + __sync_fetch_and_and (&x->v, v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_and32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return __sync_fetch_and_and (&x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_and64_ov (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return __sync_fetch_and_and (&x->v, v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_and32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return __sync_and_and_fetch (&x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_and64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return __sync_and_and_fetch (&x->v, v); +} +#endif + +/* OR */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_or32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + __sync_fetch_and_or (&x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_or64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + __sync_fetch_and_or (&x->v, v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_or32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return __sync_fetch_and_or (&x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_or64_ov (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return __sync_fetch_and_or (&x->v, v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_or32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return __sync_or_and_fetch (&x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_or64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return __sync_or_and_fetch (&x->v, v); +} +#endif + +/* CAS */ + +DDS_INLINE_EXPORT inline int ddsrt_atomic_cas32 (volatile ddsrt_atomic_uint32_t *x, uint32_t exp, uint32_t des) { + return __sync_bool_compare_and_swap (&x->v, exp, des); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline int ddsrt_atomic_cas64 (volatile ddsrt_atomic_uint64_t *x, uint64_t exp, uint64_t des) { + return __sync_bool_compare_and_swap (&x->v, exp, des); +} +#endif +DDS_INLINE_EXPORT inline int ddsrt_atomic_casptr (volatile ddsrt_atomic_uintptr_t *x, uintptr_t exp, uintptr_t des) { + return __sync_bool_compare_and_swap (&x->v, exp, des); +} +DDS_INLINE_EXPORT inline int ddsrt_atomic_casvoidp (volatile ddsrt_atomic_voidp_t *x, void *exp, void *des) { + return ddsrt_atomic_casptr (x, (uintptr_t) exp, (uintptr_t) des); +} +#if DDSRT_HAVE_ATOMIC_LIFO +#if DDSRT_HAVE_ATOMIC64 +#if defined(__s390__) || defined(__s390x__) || defined(__zarch__) +typedef __int128_t __attribute__((aligned(16))) ddsrt_atomic_int128_t; +#else +typedef __int128_t ddsrt_atomic_int128_t; +#endif +typedef union { ddsrt_atomic_int128_t x; struct { uintptr_t a, b; } s; } ddsrt_atomic_uintptr2_t; +#else +typedef union { uint64_t x; struct { uintptr_t a, b; } s; } ddsrt_atomic_uintptr2_t; +#endif + +typedef struct { + ddsrt_atomic_uintptr2_t aba_head; +} ddsrt_atomic_lifo_t; + +DDS_EXPORT void ddsrt_atomic_lifo_init(ddsrt_atomic_lifo_t *head); +DDS_EXPORT void ddsrt_atomic_lifo_push(ddsrt_atomic_lifo_t *head, void *elem, size_t linkoff); +DDS_EXPORT void *ddsrt_atomic_lifo_pop(ddsrt_atomic_lifo_t *head, size_t linkoff); +DDS_EXPORT void ddsrt_atomic_lifo_pushmany(ddsrt_atomic_lifo_t *head, void *first, void *last, size_t linkoff); + +DDS_INLINE_EXPORT inline int ddsrt_atomic_casvoidp2 (volatile ddsrt_atomic_uintptr2_t *x, uintptr_t a0, uintptr_t b0, uintptr_t a1, uintptr_t b1) { + ddsrt_atomic_uintptr2_t o, n; + o.s.a = a0; o.s.b = b0; + n.s.a = a1; n.s.b = b1; +#if defined(__s390__) || defined(__s390x__) || defined(__zarch__) + return __sync_bool_compare_and_swap ((ddsrt_atomic_int128_t*)__builtin_assume_aligned(&x->x, 16), o.x, n.x); +#else + return __sync_bool_compare_and_swap (&x->x, o.x, n.x); +#endif +} +#endif + +/* FENCES */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_fence (void) { + __sync_synchronize (); +} +DDS_INLINE_EXPORT inline void ddsrt_atomic_fence_ldld (void) { +#if !(defined __i386__ || defined __x86_64__ || defined _M_IX86 || defined _M_X64) + __sync_synchronize (); +#endif +} +DDS_INLINE_EXPORT inline void ddsrt_atomic_fence_stst (void) { +#if !(defined __i386__ || defined __x86_64__ || defined _M_IX86 || defined _M_X64) + __sync_synchronize (); +#endif +} +DDS_INLINE_EXPORT inline void ddsrt_atomic_fence_acq (void) { +#if !(defined __i386__ || defined __x86_64__ || defined _M_IX86 || defined _M_X64) + ddsrt_atomic_fence (); +#else + asm volatile ("" ::: "memory"); +#endif +} +DDS_INLINE_EXPORT inline void ddsrt_atomic_fence_rel (void) { +#if !(defined __i386__ || defined __x86_64__ || defined _M_IX86 || defined _M_X64) + ddsrt_atomic_fence (); +#else + asm volatile ("" ::: "memory"); +#endif +} + +#if defined (__cplusplus) +DDSRT_WARNING_CLANG_ON(old-style-cast) +DDSRT_WARNING_GNUC_ON(old-style-cast) +} +#endif + +#endif /* DDSRT_ATOMICS_GCC_H */ diff --git a/unitree_SDK/include/dds/ddsrt/atomics/msvc.h b/unitree_SDK/include/dds/ddsrt/atomics/msvc.h new file mode 100644 index 0000000..99c2b70 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/atomics/msvc.h @@ -0,0 +1,262 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_ATOMICS_MSVC_H +#define DDSRT_ATOMICS_MSVC_H + +#include "dds/ddsrt/misc.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* x86 has supported 64-bit CAS for a long time, so Windows ought to + provide all the interlocked operations for 64-bit operands on x86 + platforms, but it doesn't. */ + +#define DDSRT_ATOMIC_OP32(name, ...) name ((volatile long *) __VA_ARGS__) +#if DDSRT_HAVE_ATOMIC64 +#define DDSRT_ATOMIC_OP64(name, ...) name##64 ((volatile int64_t *) __VA_ARGS__) +#define DDSRT_ATOMIC_PTROP(name, ...) name##64 ((volatile int64_t *) __VA_ARGS__) +#else +#define DDSRT_ATOMIC_PTROP(name, ...) name ((volatile long *) __VA_ARGS__) +#endif + +/* LD, ST */ + +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_ld32 (const volatile ddsrt_atomic_uint32_t *x) { return x->v; } +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_ld64 (const volatile ddsrt_atomic_uint64_t *x) { return x->v; } +#endif +DDS_INLINE_EXPORT inline uintptr_t ddsrt_atomic_ldptr (const volatile ddsrt_atomic_uintptr_t *x) { return x->v; } +DDS_INLINE_EXPORT inline void *ddsrt_atomic_ldvoidp (const volatile ddsrt_atomic_voidp_t *x) { return (void *) ddsrt_atomic_ldptr (x); } + +DDS_INLINE_EXPORT inline void ddsrt_atomic_st32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { x->v = v; } +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_st64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { x->v = v; } +#endif +DDS_INLINE_EXPORT inline void ddsrt_atomic_stptr (volatile ddsrt_atomic_uintptr_t *x, uintptr_t v) { x->v = v; } +DDS_INLINE_EXPORT inline void ddsrt_atomic_stvoidp (volatile ddsrt_atomic_voidp_t *x, void *v) { ddsrt_atomic_stptr (x, (uintptr_t) v); } + +/* CAS */ + +DDS_INLINE_EXPORT inline int ddsrt_atomic_cas32 (volatile ddsrt_atomic_uint32_t *x, uint32_t exp, uint32_t des) { + return DDSRT_ATOMIC_OP32 (InterlockedCompareExchange, &x->v, des, exp) == exp; +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline int ddsrt_atomic_cas64 (volatile ddsrt_atomic_uint64_t *x, uint64_t exp, uint64_t des) { + return DDSRT_ATOMIC_OP64 (InterlockedCompareExchange, &x->v, des, exp) == exp; +} +#endif +DDS_INLINE_EXPORT inline int ddsrt_atomic_casptr (volatile ddsrt_atomic_uintptr_t *x, uintptr_t exp, uintptr_t des) { + return DDSRT_ATOMIC_PTROP (InterlockedCompareExchange, &x->v, des, exp) == exp; +} +DDS_INLINE_EXPORT inline int ddsrt_atomic_casvoidp (volatile ddsrt_atomic_voidp_t *x, void *exp, void *des) { + return ddsrt_atomic_casptr ((volatile ddsrt_atomic_uintptr_t *) x, (uintptr_t) exp, (uintptr_t) des); +} + +/* INC */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_inc32 (volatile ddsrt_atomic_uint32_t *x) { + DDSRT_ATOMIC_OP32 (InterlockedIncrement, &x->v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_inc64 (volatile ddsrt_atomic_uint64_t *x) { + DDSRT_ATOMIC_OP64 (InterlockedIncrement, &x->v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_inc32_ov (volatile ddsrt_atomic_uint32_t *x) { + return DDSRT_ATOMIC_OP32 (InterlockedIncrement, &x->v) - 1; +} +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_inc32_nv (volatile ddsrt_atomic_uint32_t *x) { + return DDSRT_ATOMIC_OP32 (InterlockedIncrement, &x->v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_inc64_nv (volatile ddsrt_atomic_uint64_t *x) { + return DDSRT_ATOMIC_OP64 (InterlockedIncrement, &x->v); +} +#endif + +/* DEC */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_dec32 (volatile ddsrt_atomic_uint32_t *x) { + DDSRT_ATOMIC_OP32 (InterlockedDecrement, &x->v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_dec64 (volatile ddsrt_atomic_uint64_t *x) { + DDSRT_ATOMIC_OP64 (InterlockedDecrement, &x->v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_dec32_nv (volatile ddsrt_atomic_uint32_t *x) { + return DDSRT_ATOMIC_OP32 (InterlockedDecrement, &x->v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_dec64_nv (volatile ddsrt_atomic_uint64_t *x) { + return DDSRT_ATOMIC_OP64 (InterlockedDecrement, &x->v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_dec32_ov (volatile ddsrt_atomic_uint32_t *x) { + return DDSRT_ATOMIC_OP32 (InterlockedDecrement, &x->v) + 1; +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_dec64_ov (volatile ddsrt_atomic_uint64_t *x) { + return DDSRT_ATOMIC_OP64 (InterlockedDecrement, &x->v) + 1; +} +#endif + +/* ADD */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_add32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + DDSRT_ATOMIC_OP32 (InterlockedExchangeAdd, &x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_add64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + DDSRT_ATOMIC_OP64 (InterlockedExchangeAdd, &x->v, v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_add32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return DDSRT_ATOMIC_OP32 (InterlockedExchangeAdd, &x->v, v); +} +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_add32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return DDSRT_ATOMIC_OP32 (InterlockedExchangeAdd, &x->v, v) + v; +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_add64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return DDSRT_ATOMIC_OP64 (InterlockedExchangeAdd, &x->v, v) + v; +} +#endif + +/* SUB */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_sub32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + /* disable unary minus applied to unsigned type, result still unsigned */ + DDSRT_WARNING_MSVC_OFF(4146) + DDSRT_ATOMIC_OP32 (InterlockedExchangeAdd, &x->v, -v); + DDSRT_WARNING_MSVC_ON(4146) +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_sub64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + /* disable unary minus applied to unsigned type, result still unsigned */ + DDSRT_WARNING_MSVC_OFF(4146) + DDSRT_ATOMIC_OP64 (InterlockedExchangeAdd, &x->v, -v); + DDSRT_WARNING_MSVC_ON(4146) +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_sub32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + /* disable unary minus applied to unsigned type, result still unsigned */ + DDSRT_WARNING_MSVC_OFF(4146) + return DDSRT_ATOMIC_OP32 (InterlockedExchangeAdd, &x->v, -v); + DDSRT_WARNING_MSVC_ON(4146) +} +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_sub32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + /* disable unary minus applied to unsigned type, result still unsigned */ + DDSRT_WARNING_MSVC_OFF(4146) + return DDSRT_ATOMIC_OP32 (InterlockedExchangeAdd, &x->v, -v) - v; + DDSRT_WARNING_MSVC_ON(4146) +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_sub64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + /* disable unary minus applied to unsigned type, result still unsigned */ + DDSRT_WARNING_MSVC_OFF(4146) + return DDSRT_ATOMIC_OP64 (InterlockedExchangeAdd, &x->v, -v) - v; + DDSRT_WARNING_MSVC_ON(4146) +} +#endif + +/* AND */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_and32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + DDSRT_ATOMIC_OP32 (InterlockedAnd, &x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_and64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + DDSRT_ATOMIC_OP64 (InterlockedAnd, &x->v, v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_and32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return DDSRT_ATOMIC_OP32 (InterlockedAnd, &x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_and64_ov (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return DDSRT_ATOMIC_OP64 (InterlockedAnd, &x->v, v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_and32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return DDSRT_ATOMIC_OP32 (InterlockedAnd, &x->v, v) & v; +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_and64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return DDSRT_ATOMIC_OP64 (InterlockedAnd, &x->v, v) & v; +} +#endif + +/* OR */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_or32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + DDSRT_ATOMIC_OP32 (InterlockedOr, &x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline void ddsrt_atomic_or64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + DDSRT_ATOMIC_OP64 (InterlockedOr, &x->v, v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_or32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return DDSRT_ATOMIC_OP32 (InterlockedOr, &x->v, v); +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_or64_ov (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return DDSRT_ATOMIC_OP64 (InterlockedOr, &x->v, v); +} +#endif +DDS_INLINE_EXPORT inline uint32_t ddsrt_atomic_or32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return DDSRT_ATOMIC_OP32 (InterlockedOr, &x->v, v) | v; +} +#if DDSRT_HAVE_ATOMIC64 +DDS_INLINE_EXPORT inline uint64_t ddsrt_atomic_or64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return DDSRT_ATOMIC_OP64 (InterlockedOr, &x->v, v) | v; +} +#endif + +/* FENCES */ + +DDS_INLINE_EXPORT inline void ddsrt_atomic_fence (void) { + /* 28113: accessing a local variable tmp via an Interlocked + function: This is an unusual usage which could be reconsidered. + It is too heavyweight, true, but it does the trick. */ + DDSRT_WARNING_MSVC_OFF(28113) + volatile LONG tmp = 0; + InterlockedExchange (&tmp, 0); + DDSRT_WARNING_MSVC_ON(28113) +} +DDS_INLINE_EXPORT inline void ddsrt_atomic_fence_ldld (void) { +#if !(defined _M_IX86 || defined _M_X64) + ddsrt_atomic_fence (); +#endif +} +DDS_INLINE_EXPORT inline void ddsrt_atomic_fence_stst (void) { +#if !(defined _M_IX86 || defined _M_X64) + ddsrt_atomic_fence (); +#endif +} +DDS_INLINE_EXPORT inline void ddsrt_atomic_fence_acq (void) { + ddsrt_atomic_fence (); +} +DDS_INLINE_EXPORT inline void ddsrt_atomic_fence_rel (void) { + ddsrt_atomic_fence (); +} + +#undef DDSRT_ATOMIC_PTROP + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_ATOMICS_MSVC_H */ diff --git a/unitree_SDK/include/dds/ddsrt/atomics/sun.h b/unitree_SDK/include/dds/ddsrt/atomics/sun.h new file mode 100644 index 0000000..d794a56 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/atomics/sun.h @@ -0,0 +1,199 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +#define DDSRT_ATOMIC64_SUPPORT 1 + +/* LD, ST */ + +inline uint32_t ddsrt_atomic_ld32 (const volatile ddsrt_atomic_uint32_t *x) { return x->v; } +inline uint64_t ddsrt_atomic_ld64 (const volatile ddsrt_atomic_uint64_t *x) { return x->v; } +inline uintptr_t ddsrt_atomic_ldptr (const volatile ddsrt_atomic_uintptr_t *x) { return x->v; } +inline void *ddsrt_atomic_ldvoidp (const volatile ddsrt_atomic_voidp_t *x) { return (void *) ddsrt_atomic_ldptr (x); } + +inline void ddsrt_atomic_st32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { x->v = v; } +inline void ddsrt_atomic_st64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { x->v = v; } +inline void ddsrt_atomic_stptr (volatile ddsrt_atomic_uintptr_t *x, uintptr_t v) { x->v = v; } +inline void ddsrt_atomic_stvoidp (volatile ddsrt_atomic_voidp_t *x, void *v) { ddsrt_atomic_stptr (x, (uintptr_t) v); } + +/* INC */ + +inline void ddsrt_atomic_inc32 (volatile ddsrt_atomic_uint32_t *x) { + atomic_inc_32 (&x->v); +} +inline void ddsrt_atomic_inc64 (volatile ddsrt_atomic_uint64_t *x) { + atomic_inc_64 (&x->v); +} +inline uint32_t ddsrt_atomic_inc32_ov (volatile ddsrt_atomic_uint32_t *x) { + uint32_t oldval, newval; + do { oldval = x->v; newval = oldval + 1; } while (atomic_cas_32 (&x->v, oldval, newval) != oldval); + return oldval; +} +inline uint32_t ddsrt_atomic_inc32_nv (volatile ddsrt_atomic_uint32_t *x) { + return atomic_inc_32_nv (&x->v); +} +inline uint64_t ddsrt_atomic_inc64_nv (volatile ddsrt_atomic_uint64_t *x) { + return atomic_inc_64_nv (&x->v); +} + +/* DEC */ + +inline void ddsrt_atomic_dec32 (volatile ddsrt_atomic_uint32_t *x) { + atomic_dec_32 (&x->v); +} +inline void ddsrt_atomic_dec64 (volatile ddsrt_atomic_uint64_t *x) { + atomic_dec_64 (&x->v); +} +inline uint32_t ddsrt_atomic_dec32_nv (volatile ddsrt_atomic_uint32_t *x) { + return atomic_dec_32_nv (&x->v); +} +inline uint64_t ddsrt_atomic_dec64_nv (volatile ddsrt_atomic_uint64_t *x) { + return atomic_dec_64_nv (&x->v); +} +inline uint32_t ddsrt_atomic_dec32_ov (volatile ddsrt_atomic_uint32_t *x) { + uint32_t oldval, newval; + do { oldval = x->v; newval = oldval - 1; } while (atomic_cas_32 (&x->v, oldval, newval) != oldval); + return oldval; +} +inline uint64_t ddsrt_atomic_dec64_ov (volatile ddsrt_atomic_uint64_t *x) { + uint64_t oldval, newval; + do { oldval = x->v; newval = oldval - 1; } while (atomic_cas_64 (&x->v, oldval, newval) != oldval); + return oldval; +} + +/* ADD */ + +inline void ddsrt_atomic_add32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + atomic_add_32 (&x->v, v); +} +inline void ddsrt_atomic_add64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + atomic_add_64 (&x->v, v); +} +inline uint32_t ddsrt_atomic_add32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return atomic_add_32_nv (&x->v, v) - v; +} +inline uint32_t ddsrt_atomic_add32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return atomic_add_32_nv (&x->v, v); +} +inline uint64_t ddsrt_atomic_add64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return atomic_add_64_nv (&x->v, v); +} + +/* SUB */ + +inline void ddsrt_atomic_sub32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + atomic_add_32 (&x->v, -v); +} +inline void ddsrt_atomic_sub64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + atomic_add_64 (&x->v, -v); +} +inline uint32_t ddsrt_atomic_sub32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return atomic_add_32_nv (&x->v, -v) + v; +} +inline uint32_t ddsrt_atomic_sub32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return atomic_add_32_nv (&x->v, -v); +} +inline uint64_t ddsrt_atomic_sub64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return atomic_add_64_nv (&x->v, -v); +} + +/* AND */ + +inline void ddsrt_atomic_and32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + atomic_and_32 (&x->v, v); +} +inline void ddsrt_atomic_and64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + atomic_and_64 (&x->v, v); +} +inline uint32_t ddsrt_atomic_and32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + uint32_t oldval, newval; + do { oldval = x->v; newval = oldval & v; } while (atomic_cas_32 (&x->v, oldval, newval) != oldval); + return oldval; +} +inline uint64_t ddsrt_atomic_and64_ov (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + uint64_t oldval, newval; + do { oldval = x->v; newval = oldval & v; } while (atomic_cas_64 (&x->v, oldval, newval) != oldval); + return oldval; +} +inline uint32_t ddsrt_atomic_and32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return atomic_and_32_nv (&x->v, v); +} +inline uint64_t ddsrt_atomic_and64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return atomic_and_64_nv (&x->v, v); +} + +/* OR */ + +inline void ddsrt_atomic_or32 (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + atomic_or_32 (&x->v, v); +} +inline void ddsrt_atomic_or64 (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + atomic_or_64 (&x->v, v); +} +inline uint32_t ddsrt_atomic_or32_ov (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + uint32_t oldval, newval; + do { oldval = x->v; newval = oldval | v; } while (atomic_cas_32 (&x->v, oldval, newval) != oldval); + return oldval; +} +inline uint64_t ddsrt_atomic_or64_ov (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + uint64_t oldval, newval; + do { oldval = x->v; newval = oldval | v; } while (atomic_cas_64 (&x->v, oldval, newval) != oldval); + return oldval; +} +inline uint32_t ddsrt_atomic_or32_nv (volatile ddsrt_atomic_uint32_t *x, uint32_t v) { + return atomic_or_32_nv (&x->v, v); +} +inline uint64_t ddsrt_atomic_or64_nv (volatile ddsrt_atomic_uint64_t *x, uint64_t v) { + return atomic_or_64_nv (&x->v, v); +} + +/* CAS */ + +inline int ddsrt_atomic_cas32 (volatile ddsrt_atomic_uint32_t *x, uint32_t exp, uint32_t des) { + return atomic_cas_32 (&x->v, exp, des) == exp; +} +inline int ddsrt_atomic_cas64 (volatile ddsrt_atomic_uint64_t *x, uint64_t exp, uint64_t des) { + return atomic_cas_64 (&x->v, exp, des) == exp; +} +inline int ddsrt_atomic_casptr (volatile ddsrt_atomic_uintptr_t *x, uintptr_t exp, uintptr_t des) { + return atomic_cas_ulong (&x->v, exp, des) == exp; +} +inline int ddsrt_atomic_casvoidp (volatile ddsrt_atomic_voidp_t *x, void *exp, void *des) { + return atomic_cas_ptr (&x->v, exp, des) == exp; +} + +/* FENCES */ + +inline void ddsrt_atomic_fence (void) { + membar_exit (); + membar_enter (); +} +inline void ddsrt_atomic_fence_ldld (void) { + membar_consumer (); +} +inline void ddsrt_atomic_fence_stst (void) { + membar_producer (); +} +inline void ddsrt_atomic_fence_acq (void) { + membar_enter (); +} +inline void ddsrt_atomic_fence_rel (void) { + membar_exit (); +} + +#if defined (__cplusplus) +} +#endif diff --git a/unitree_SDK/include/dds/ddsrt/attributes.h b/unitree_SDK/include/dds/ddsrt/attributes.h new file mode 100644 index 0000000..296de34 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/attributes.h @@ -0,0 +1,138 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_ATTRIBUTES_H +#define DDSRT_ATTRIBUTES_H + +#if __GNUC__ +# define ddsrt_gnuc (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#else +# define ddsrt_gnuc (0) +#endif + +#if __clang__ +# define ddsrt_clang (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) +#else +# define ddsrt_clang (0) +#endif + +#ifdef __SUNPRO_C +# define __attribute__(x) +#endif + +#if defined(__has_attribute) +# define ddsrt_has_attribute(params) __has_attribute(params) +#elif ddsrt_gnuc +# define ddsrt_has_attribute(params) (1) /* GCC < 5 */ +#else +# define ddsrt_has_attribute(params) (0) +#endif + +#if ddsrt_has_attribute(malloc) +# define ddsrt_attribute_malloc __attribute__ ((__malloc__)) +#else +# define ddsrt_attribute_malloc +#endif + +#if ddsrt_has_attribute(unused) +# define ddsrt_attribute_unused __attribute__((__unused__)) +#else +# define ddsrt_attribute_unused +#endif + +#if ddsrt_has_attribute(noreturn) +# define ddsrt_attribute_noreturn __attribute__ ((__noreturn__)) +#else +# define ddsrt_attribute_noreturn +#endif + +#if ddsrt_has_attribute(nonnull) +# define ddsrt_nonnull(params) __attribute__ ((__nonnull__ params)) +# define ddsrt_nonnull_all __attribute__ ((__nonnull__)) +#else +# define ddsrt_nonnull(params) +# define ddsrt_nonnull_all +#endif + +#if ddsrt_has_attribute(returns_nonnull) && (ddsrt_clang || ddsrt_gnuc >= 40900) +# define ddsrt_attribute_returns_nonnull __attribute__ ((__returns_nonnull__)) +#else +# define ddsrt_attribute_returns_nonnull +#endif + +/* GCC <= 4.2.4 has the attribute, but warns that it ignores it. */ +#if !ddsrt_has_attribute(alloc_size) || (ddsrt_gnuc <= 40204) +# define ddsrt_attribute_alloc_size(params) +#else +# define ddsrt_attribute_alloc_size(params) __attribute__ ((__alloc_size__ params)) +#endif + +#if ddsrt_has_attribute(const) +# define ddsrt_attribute_const __attribute__ ((__const__)) +#else +# define ddsrt_attribute_const +#endif + +#if ddsrt_has_attribute(pure) +# define ddsrt_attribute_pure __attribute__ ((__pure__)) +#else +# define ddsrt_attribute_pure +#endif + +#if ddsrt_has_attribute(format) +# define ddsrt_attribute_format(params) __attribute__ ((__format__ params)) +# if __MINGW32__ +# if !defined(__MINGW_PRINTF_FORMAT) +# define __MINGW_PRINTF_FORMAT gnu_printf +# endif + /* GCC assumes printf MS style arguments on Windows */ +# define ddsrt_attribute_format_printf(string_index, first_to_check) \ + ddsrt_attribute_format((__MINGW_PRINTF_FORMAT, string_index, first_to_check)) +# else +# define ddsrt_attribute_format_printf(string_index, first_to_check) \ + ddsrt_attribute_format((printf, string_index, first_to_check)) +# endif +#else +# define ddsrt_attribute_format(params) +# define ddsrt_attribute_format_printf(string_index, first_to_check) +#endif + +#if ddsrt_has_attribute(warn_unused_result) +# define ddsrt_attribute_warn_unused_result __attribute__ ((__warn_unused_result__)) +#else +# define ddsrt_attribute_warn_unused_result +#endif + +#if ddsrt_has_attribute(assume_aligned) +# define ddsrt_attribute_assume_aligned(params) __attribute__ ((__assume_aligned__ params)) +#else +# define ddsrt_attribute_assume_aligned(params) +#endif + +#if ddsrt_has_attribute(packed) +# define ddsrt_attribute_packed __attribute__ ((__packed__)) +#else +# define ddsrt_attribute_packed +#endif + +#if ddsrt_has_attribute(no_sanitize) +# define ddsrt_attribute_no_sanitize(params) __attribute__ ((__no_sanitize__ params)) +#else +# define ddsrt_attribute_no_sanitize(params) +#endif + +#if defined(__has_feature) +# define ddsrt_has_feature_thread_sanitizer __has_feature(thread_sanitizer) +#else +# define ddsrt_has_feature_thread_sanitizer 0 +#endif + +#endif /* DDSRT_ATTRIBUTES_H */ diff --git a/unitree_SDK/include/dds/ddsrt/avl.h b/unitree_SDK/include/dds/ddsrt/avl.h new file mode 100644 index 0000000..665cc10 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/avl.h @@ -0,0 +1,359 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_AVL_H +#define DDSRT_AVL_H + +/* The tree library never performs memory allocations or deallocations internally. + + - Treedef_t: defines the properties of the tree, offsets, + comparison functions, augmented structures, flags -- these are + related to the code/data structure in which the tree is embedded, + and in nearly all cases known at compile time. + - avlTree_t: represents the tree, i.e., pointer to the root. + - avlNode_t: contains the administrative data for a single node in + the tree. + + For a tree node: + struct T { + avlNode_t avlnode; + int key; + }; + by definition, avlnodeoffset == offsetof(struct T, avlnode) and + keyoffset = offsetof(struct T, key). The user of the library only + ever deals in pointers to (in this case) struct T, never with + pointers to the avlNode_t, and the compare function operations on + pointers to keys, in this case pointers to "int"s. If you wish, you + can also do: keyoffset = 0, in which case the compare function + would be operating on struct T's. + + The compare function is assumed to behave just like all compare + functions in the C library: < 0, =0, >0 for left argument less + than, equal to or greater than the right argument. + + The "augment" function is automatically called whenever some of the + children of a node change, as well as when the "augment" function + has been called on some of the children. It allows you to maintain + a "summary" of the subtree -- currently only used in ddsi2e, in one + spot. + + Trees come in various "variants", configured through "treedef" + flags: + - direct/indirect key: direct meaning the key value is embedded in + the structure containing the avlNode_t, indirect meaning a + pointer to the key value is. The compare function doesn't deal + with tree nodes, but with key values. + - re-entrant: in the style of the C library, meaning, the + comparison function gets a user-supplied 3rd argument (in + particular used by mmstat). + - unique keys/duplicate keys: when keys must be unique, some + optimizations apply; it is up to the caller to ensure one doesn't + violate the uniqueness of the keys (it'll happily crash in insert + if you don't); when duplicate keys are allowed, a forward scan of + the tree will visit them in the order of insertion. + + For a tree node: + struct T { + avlnode_t avlnode; + char *key; + }; + you could set the "indirect" flag, and then you simply use + strcmp(), avoiding the need for passing templates in looking up key + values. Much nicer. + + There is also an orthogonal variant that is enforced through the + type system -- note that would be possible for all of the above as + well, but the number of cases simply explodes and none of the above + flags affects the dynamically changing data structures (just the + tree definition), unlike this one. + + - the "C" variant keeps track of the number of nodes in the tree to + support a "count" operation in O(1) time, but is otherwise + identical. + + The various initializer macros and TreedefInit functions should + make sense with this. + + All functions for looking up nodes return NULL if there is no node + satisfying the requirements. + + - Init: initializes a tree (really just: root = NULL, perhaps count = 0) + - Free: calls "freefun" on each node, which may free the node + - FreeArg: as "Free", but with an extra, user-supplied, argument + - Root: returns the root node + - Lookup: returns a node with key value "key" (ref allowdups flag) + - LookupIPath: like Lookup, but also filling an IPath_t structure + for efficient insertion in case of a failed lookup (or inserting + duplicates) + - LookupDPath: like Lookup, but also filling a DPath_t structure + that helps with deleting a node + - LookupPredEq: locates the node with the greatest key value <= "key" + - LookupSuccEq: similar, but smallest key value >= "key" + - LookupPred: similar, < "key" + - LookupSucc: similar, > "key" + - Insert: convenience function: LookupIPath ; InsertIPath + - Delete: convenience function: LookupDPath ; DeleteDPath + - InsertIPath: insert node based on the "path" obtained from LookupIPath + - DeleteDPath: delete node, using information in "path" to do so efficiently + - SwapNode: replace "oldn" by "newn" without modifying the tree + structure (the key need not be equal, but must be + FindPred(oldn).key < newn.key < FindSucc(oldn).key, where a + non-existing predecessor has key -inf and a non-existing + successor has key +inf, and where it is understood that the < + operator becomes <= if allowdups is set + - AugmentUpdate: to be called when something in "node" changes that + affects the subtree "summary" computed by the configured + "augment" function + - IsEmpty: returns 1 if tree is empty, 0 if not + - IsSingleton: returns 1 if tree contains exactly one node, 0 if not + - FindMin: returns the node with the smallest key value in the tree + - FindMax: similar, largest key value + - FindPred: preceding node in in-order treewalk + - FindSucc: similar, following node + + - Walk: calls "f" with user-supplied argument "a" once for each + node, starting at FindMin and ending at FindMax + - ConstWalk: same, but with a const tree + - WalkRange: like Walk, but only visiting nodes with key values in + range [min,max] (that's inclusive) + - ConstWalkRange: same, but with a const tree + - WalkRangeReverse: like WalkRange, but in the reverse direction + - ConstWalkRangeReverse: same, but with a const tree + - IterFirst: starts forward iteration, starting at (and returning) FindMin + - IterSuccEq: similar, starting at LookupSuccEq + - IterSucc: similar, starting at LookupSucc + - IterNext: returns FindSucc(last returned node); may not be called + if preceding IterXXX call on same "iter" returned NULL + + That's all there is to it. + + Note that all calls to Walk(f,a) can be rewritten as: + for(n=IterFirst(&it); n; n=IterNext(&it)) { f(n,a) } + or as + for(n=FindMin(); n; n=FindSucc(n)) { f(n,a) } + + The walk functions and iterators may not alter the tree + structure. If that is desired, the latter can easily be rewritten + as: + n=FindMin() ; while(n) { nn=FindSucc(n); f(n,a); n=nn } + because FindMin/FindSucc doesn't store any information to allow + fast processing. That'll allow every operation, with the obvious + exception of f(n) calling Delete(FindSucc(n)). + + Currently, all trees maintain parent pointers, but it may be worth + doing a separate set without it, as it reduces the size of + avlNode_t. But in that case, the FindMin/FindSucc option would no + longer be a reasonable option because it would be prohibitively + expensive, whereas the IterFirst/IterNext option are alway + efficiently. If one were to do a threaded tree variant, the + implemetantion of IterFirst/IterNext would become absolute trivial + and faster still, but at the cost of significantly more overhead in + memory and updates. */ + +#include +#include + +#include "dds/export.h" +#include "dds/ddsrt/attributes.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#define DDSRT_AVL_MAX_TREEHEIGHT (12 * sizeof (void *)) + +typedef int (*ddsrt_avl_compare_t) (const void *a, const void *b); +typedef int (*ddsrt_avl_compare_r_t) (const void *a, const void *b, void *arg); +typedef void (*ddsrt_avl_augment_t) (void *node, const void *left, const void *right); +typedef void (*ddsrt_avl_walk_t) (void *node, void *arg); +typedef void (*ddsrt_avl_const_walk_t) (const void *node, void *arg); + +typedef struct ddsrt_avl_node { + struct ddsrt_avl_node *cs[2]; /* 0 = left, 1 = right */ + struct ddsrt_avl_node *parent; + int height; +} ddsrt_avl_node_t; + +#define DDSRT_AVL_TREEDEF_FLAG_INDKEY 1 +#define DDSRT_AVL_TREEDEF_FLAG_R 2 +#define DDSRT_AVL_TREEDEF_FLAG_ALLOWDUPS 4 + +typedef struct ddsrt_avl_treedef { +#if defined (__cplusplus) + ddsrt_avl_treedef() {} +#endif + size_t avlnodeoffset; + size_t keyoffset; + union { + ddsrt_avl_compare_t comparekk; + ddsrt_avl_compare_r_t comparekk_r; + } u; + ddsrt_avl_augment_t augment; + uint32_t flags; + void *cmp_arg; /* for _r variant */ +} ddsrt_avl_treedef_t; + +typedef struct ddsrt_avl_ctreedef { + ddsrt_avl_treedef_t t; +} ddsrt_avl_ctreedef_t; + +typedef struct ddsrt_avl_tree { + ddsrt_avl_node_t *root; +} ddsrt_avl_tree_t; + +typedef struct ddsrt_avl_ctree { + ddsrt_avl_tree_t t; + size_t count; +} ddsrt_avl_ctree_t; + +typedef struct ddsrt_avl_path { + int depth; /* total depth of path */ + int pnodeidx; + ddsrt_avl_node_t *parent; /* (nodeidx == 0 ? NULL : *(path[nodeidx-1])) */ + ddsrt_avl_node_t **pnode[DDSRT_AVL_MAX_TREEHEIGHT]; +} ddsrt_avl_path_t; + +typedef struct ddsrt_avl_ipath { + ddsrt_avl_path_t p; +} ddsrt_avl_ipath_t; + +typedef struct ddsrt_avl_dpath { + ddsrt_avl_path_t p; +} ddsrt_avl_dpath_t; + +typedef struct ddsrt_avl_iter { + const ddsrt_avl_treedef_t *td; + ddsrt_avl_node_t *right; + ddsrt_avl_node_t **todop; + ddsrt_avl_node_t *todo[1+DDSRT_AVL_MAX_TREEHEIGHT]; +} ddsrt_avl_iter_t; + +typedef struct ddsrt_avl_citer { + ddsrt_avl_iter_t t; +} ddsrt_avl_citer_t; + +/* avlnodeoffset and keyoffset must both be in [0,2**31-1] */ +#define DDSRT_AVL_TREEDEF_INITIALIZER(avlnodeoffset, keyoffset, comparekk_, augment) { (avlnodeoffset), (keyoffset), { .comparekk = (comparekk_) }, (augment), 0, 0 } +#define DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY(avlnodeoffset, keyoffset, comparekk_, augment) { (avlnodeoffset), (keyoffset), { .comparekk = (comparekk_) }, (augment), DDSRT_AVL_TREEDEF_FLAG_INDKEY, 0 } +#define DDSRT_AVL_TREEDEF_INITIALIZER_ALLOWDUPS(avlnodeoffset, keyoffset, comparekk_, augment) { (avlnodeoffset), (keyoffset), { .comparekk = (comparekk_) }, (augment), DDSRT_AVL_TREEDEF_FLAG_ALLOWDUPS, 0 } +#define DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY_ALLOWDUPS(avlnodeoffset, keyoffset, comparekk_, augment) { (avlnodeoffset), (keyoffset), { .comparekk = (comparekk_) }, (augment), DDSRT_AVL_TREEDEF_FLAG_INDKEY|DDSRT_AVL_TREEDEF_FLAG_ALLOWDUPS, 0 } +#define DDSRT_AVL_TREEDEF_INITIALIZER_R(avlnodeoffset, keyoffset, comparekk_, cmparg, augment) { (avlnodeoffset), (keyoffset), { .comparekk_r = (comparekk_) }, (augment), DDSRT_AVL_TREEDEF_FLAG_R, (cmparg) } +#define DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY_R(avlnodeoffset, keyoffset, comparekk_, cmparg, augment) { (avlnodeoffset), (keyoffset), { .comparekk_r = (comparekk_) }, (augment), DDSRT_AVL_TREEDEF_FLAG_INDKEY|DDSRT_AVL_TREEDEF_FLAG_R, (cmparg) } +#define DDSRT_AVL_TREEDEF_INITIALIZER_R_ALLOWDUPS(avlnodeoffset, keyoffset, comparekk_, cmparg, augment) { (avlnodeoffset), (keyoffset), { .comparekk_r = (comparekk_) }, (augment), DDSRT_AVL_TREEDEF_FLAG_R|DDSRT_AVL_TREEDEF_FLAG_ALLOWDUPS, (cmparg) } +#define DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY_R_ALLOWDUPS(avlnodeoffset, keyoffset, comparekk_, cmparg, augment) { (avlnodeoffset), (keyoffset), { .comparekk_r = (comparekk_) }, (augment), DDSRT_AVL_TREEDEF_FLAG_INDKEY|DDSRT_AVL_TREEDEF_FLAG_R|DDSRT_AVL_TREEDEF_FLAG_ALLOWDUPS, (cmparg) } + +/* Not maintaining # nodes */ + +DDS_EXPORT void ddsrt_avl_treedef_init (ddsrt_avl_treedef_t *td, size_t avlnodeoffset, size_t keyoffset, ddsrt_avl_compare_t comparekk, ddsrt_avl_augment_t augment, uint32_t flags) ddsrt_nonnull((1,4)); +DDS_EXPORT void ddsrt_avl_treedef_init_r (ddsrt_avl_treedef_t *td, size_t avlnodeoffset, size_t keyoffset, ddsrt_avl_compare_r_t comparekk_r, void *cmp_arg, ddsrt_avl_augment_t augment, uint32_t flags) ddsrt_nonnull((1,4)); + +DDS_EXPORT void ddsrt_avl_init (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_free (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void (*freefun) (void *node)) ddsrt_nonnull((1,2)); +DDS_EXPORT void ddsrt_avl_free_arg (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void (*freefun) (void *node, void *arg), void *arg) ddsrt_nonnull((1,2)); + +DDS_EXPORT void *ddsrt_avl_root (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_root_non_empty (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree) ddsrt_nonnull_all ddsrt_attribute_returns_nonnull; +DDS_EXPORT void *ddsrt_avl_lookup (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_lookup_ipath (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, const void *key, ddsrt_avl_ipath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_lookup_dpath (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, const void *key, ddsrt_avl_dpath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_lookup_pred_eq (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_lookup_succ_eq (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_lookup_pred (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_lookup_succ (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, const void *key) ddsrt_nonnull_all; + +DDS_EXPORT void ddsrt_avl_insert (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *node) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_delete (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *node) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_insert_ipath (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *node, ddsrt_avl_ipath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_delete_dpath (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *node, ddsrt_avl_dpath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_swap_node (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, void *oldn, void *newn) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_augment_update (const ddsrt_avl_treedef_t *td, void *node) ddsrt_nonnull_all; + +DDS_EXPORT int ddsrt_avl_is_empty (const ddsrt_avl_tree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT int ddsrt_avl_is_singleton (const ddsrt_avl_tree_t *tree) ddsrt_nonnull_all; + +DDS_EXPORT void *ddsrt_avl_find_min (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_find_max (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_find_pred (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, const void *vnode) ddsrt_nonnull((1,2)); +DDS_EXPORT void *ddsrt_avl_find_succ (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, const void *vnode) ddsrt_nonnull((1,2)); + +DDS_EXPORT void ddsrt_avl_walk (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, ddsrt_avl_walk_t f, void *a) ddsrt_nonnull((1,2,3)); +DDS_EXPORT void ddsrt_avl_const_walk (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, ddsrt_avl_const_walk_t f, void *a) ddsrt_nonnull((1,2,3)); +DDS_EXPORT void ddsrt_avl_walk_range (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, const void *min, const void *max, ddsrt_avl_walk_t f, void *a) ddsrt_nonnull((1,2,3,4,5)); +DDS_EXPORT void ddsrt_avl_const_walk_range (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, const void *min, const void *max, ddsrt_avl_const_walk_t f, void *a) ddsrt_nonnull((1,2,3,4,5)); +DDS_EXPORT void ddsrt_avl_walk_range_reverse (const ddsrt_avl_treedef_t *td, ddsrt_avl_tree_t *tree, const void *min, const void *max, ddsrt_avl_walk_t f, void *a) ddsrt_nonnull((1,2,3)); +DDS_EXPORT void ddsrt_avl_const_walk_range_reverse (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, const void *min, const void *max, ddsrt_avl_const_walk_t f, void *a) ddsrt_nonnull((1,2,3)); + +DDS_EXPORT void *ddsrt_avl_iter_first (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, ddsrt_avl_iter_t *iter) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_iter_succ_eq (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, ddsrt_avl_iter_t *iter, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_iter_succ (const ddsrt_avl_treedef_t *td, const ddsrt_avl_tree_t *tree, ddsrt_avl_iter_t *iter, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_iter_next (ddsrt_avl_iter_t *iter) ddsrt_nonnull_all; + +/* Maintaining # nodes */ + +#define DDSRT_AVL_CTREEDEF_INITIALIZER(avlnodeoffset, keyoffset, comparekk, augment) { DDSRT_AVL_TREEDEF_INITIALIZER (avlnodeoffset, keyoffset, comparekk, augment) } +#define DDSRT_AVL_CTREEDEF_INITIALIZER_INDKEY(avlnodeoffset, keyoffset, comparekk, augment) { DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY (avlnodeoffset, keyoffset, comparekk, augment) } +#define DDSRT_AVL_CTREEDEF_INITIALIZER_ALLOWDUPS(avlnodeoffset, keyoffset, comparekk, augment) { DDSRT_AVL_TREEDEF_INITIALIZER_ALLOWDUPS (avlnodeoffset, keyoffset, comparekk, augment) } +#define DDSRT_AVL_CTREEDEF_INITIALIZER_INDKEY_ALLOWDUPS(avlnodeoffset, keyoffset, comparekk, augment) { DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY_ALLOWDUPS (avlnodeoffset, keyoffset, comparekk, augment) } +#define DDSRT_AVL_CTREEDEF_INITIALIZER_R(avlnodeoffset, keyoffset, comparekk, cmparg, augment) { DDSRT_AVL_TREEDEF_INITIALIZER_R (avlnodeoffset, keyoffset, comparekk, cmparg, augment) } +#define DDSRT_AVL_CTREEDEF_INITIALIZER_INDKEY_R(avlnodeoffset, keyoffset, comparekk, cmparg, augment) { DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY_R (avlnodeoffset, keyoffset, comparekk, cmparg, augment) } +#define DDSRT_AVL_CTREEDEF_INITIALIZER_R_ALLOWDUPS(avlnodeoffset, keyoffset, comparekk, cmparg, augment) { DDSRT_AVL_TREEDEF_INITIALIZER_R_ALLOWDUPS (avlnodeoffset, keyoffset, comparekk, cmparg, augment) } +#define DDSRT_AVL_CTREEDEF_INITIALIZER_INDKEY_R_ALLOWDUPS(avlnodeoffset, keyoffset, comparekk, cmparg, augment) { DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY_R_ALLOWDUPS (avlnodeoffset, keyoffset, comparekk, cmparg, augment) } + +DDS_EXPORT void ddsrt_avl_ctreedef_init (ddsrt_avl_ctreedef_t *td, size_t avlnodeoffset, size_t keyoffset, ddsrt_avl_compare_t comparekk, ddsrt_avl_augment_t augment, uint32_t flags) ddsrt_nonnull((1,4)); +DDS_EXPORT void ddsrt_avl_ctreedef_init_r (ddsrt_avl_ctreedef_t *td, size_t avlnodeoffset, size_t keyoffset, ddsrt_avl_compare_r_t comparekk_r, void *cmp_arg, ddsrt_avl_augment_t augment, uint32_t flags) ddsrt_nonnull((1,4)); + +DDS_EXPORT void ddsrt_avl_cinit (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_cfree (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void (*freefun) (void *node)) ddsrt_nonnull((1,2)); +DDS_EXPORT void ddsrt_avl_cfree_arg (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void (*freefun) (void *node, void *arg), void *arg) ddsrt_nonnull((1,2)); + +DDS_EXPORT void *ddsrt_avl_croot (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_croot_non_empty (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_clookup (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_clookup_ipath (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *key, ddsrt_avl_ipath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_clookup_dpath (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *key, ddsrt_avl_dpath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_clookup_pred_eq (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_clookup_succ_eq (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_clookup_pred (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_clookup_succ (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *key) ddsrt_nonnull_all; + +DDS_EXPORT void ddsrt_avl_cinsert (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_cdelete (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_cinsert_ipath (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node, ddsrt_avl_ipath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_cdelete_dpath (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *node, ddsrt_avl_dpath_t *path) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_cswap_node (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, void *oldn, void *newn) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_avl_caugment_update (const ddsrt_avl_ctreedef_t *td, void *node) ddsrt_nonnull_all; + +DDS_EXPORT int ddsrt_avl_cis_empty (const ddsrt_avl_ctree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT int ddsrt_avl_cis_singleton (const ddsrt_avl_ctree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT size_t ddsrt_avl_ccount (const ddsrt_avl_ctree_t *tree) ddsrt_nonnull_all; + +DDS_EXPORT void *ddsrt_avl_cfind_min (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_cfind_max (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_cfind_pred (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *vnode) ddsrt_nonnull((1,2)); +DDS_EXPORT void *ddsrt_avl_cfind_succ (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *vnode) ddsrt_nonnull((1,2)); + +DDS_EXPORT void ddsrt_avl_cwalk (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, ddsrt_avl_walk_t f, void *a) ddsrt_nonnull((1,2,3)); +DDS_EXPORT void ddsrt_avl_cconst_walk (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, ddsrt_avl_const_walk_t f, void *a) ddsrt_nonnull((1,2,3)); +DDS_EXPORT void ddsrt_avl_cwalk_range (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, const void *min, const void *max, ddsrt_avl_walk_t f, void *a) ddsrt_nonnull((1,2,3,4,5)); +DDS_EXPORT void ddsrt_avl_cconst_walk_range (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *min, const void *max, ddsrt_avl_const_walk_t f, void *a) ddsrt_nonnull((1,2,3,4,5)); +DDS_EXPORT void ddsrt_avl_cwalk_range_reverse (const ddsrt_avl_ctreedef_t *td, ddsrt_avl_ctree_t *tree, const void *min, const void *max, ddsrt_avl_walk_t f, void *a) ddsrt_nonnull((1,2,3,4,5)); +DDS_EXPORT void ddsrt_avl_cconst_walk_range_reverse (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, const void *min, const void *max, ddsrt_avl_const_walk_t f, void *a) ddsrt_nonnull((1,2,3,4,5)); + +DDS_EXPORT void *ddsrt_avl_citer_first (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, ddsrt_avl_citer_t *iter) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_citer_succ_eq (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, ddsrt_avl_citer_t *iter, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_citer_succ (const ddsrt_avl_ctreedef_t *td, const ddsrt_avl_ctree_t *tree, ddsrt_avl_citer_t *iter, const void *key) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_avl_citer_next (ddsrt_avl_citer_t *iter) ddsrt_nonnull_all; + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_AVL_H */ diff --git a/unitree_SDK/include/dds/ddsrt/bswap.h b/unitree_SDK/include/dds/ddsrt/bswap.h new file mode 100644 index 0000000..3e01e8c --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/bswap.h @@ -0,0 +1,119 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_BSWAP_H +#define DDSRT_BSWAP_H + +#include +#include + +#include "dds/export.h" +#include "dds/ddsrt/endian.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +enum ddsrt_byte_order_selector { + DDSRT_BOSEL_NATIVE, + DDSRT_BOSEL_BE, + DDSRT_BOSEL_LE, +}; + +DDS_INLINE_EXPORT inline uint16_t ddsrt_bswap2u (uint16_t x) +{ + return (uint16_t) ((x >> 8) | (x << 8)); +} + +DDS_INLINE_EXPORT inline int16_t ddsrt_bswap2 (int16_t x) +{ + return (int16_t) ddsrt_bswap2u ((uint16_t) x); +} + +DDS_INLINE_EXPORT inline uint32_t ddsrt_bswap4u (uint32_t x) +{ + return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24); +} + +DDS_INLINE_EXPORT inline int32_t ddsrt_bswap4 (int32_t x) +{ + return (int32_t) ddsrt_bswap4u ((uint32_t) x); +} + +DDS_INLINE_EXPORT inline uint64_t ddsrt_bswap8u (uint64_t x) +{ + const uint32_t newhi = ddsrt_bswap4u ((uint32_t) x); + const uint32_t newlo = ddsrt_bswap4u ((uint32_t) (x >> 32)); + return ((uint64_t) newhi << 32) | (uint64_t) newlo; +} + +DDS_INLINE_EXPORT inline int64_t ddsrt_bswap8 (int64_t x) +{ + return (int64_t) ddsrt_bswap8u ((uint64_t) x); +} + +#if DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN +#define ddsrt_toBE2(x) ddsrt_bswap2 (x) +#define ddsrt_toBE2u(x) ddsrt_bswap2u (x) +#define ddsrt_toBE4(x) ddsrt_bswap4 (x) +#define ddsrt_toBE4u(x) ddsrt_bswap4u (x) +#define ddsrt_toBE8(x) ddsrt_bswap8 (x) +#define ddsrt_toBE8u(x) ddsrt_bswap8u (x) +#define ddsrt_toLE2(x) (x) +#define ddsrt_toLE2u(x) (x) +#define ddsrt_toLE4(x) (x) +#define ddsrt_toLE4u(x) (x) +#define ddsrt_toLE8(x) (x) +#define ddsrt_toLE8u(x) (x) +#define ddsrt_toBO2(bo, x) ((bo) == DDSRT_BOSEL_BE ? ddsrt_bswap2 (x) : (x)) +#define ddsrt_toBO2u(bo, x) ((bo) == DDSRT_BOSEL_BE ? ddsrt_bswap2u (x) : (x)) +#define ddsrt_toBO4(bo, x) ((bo) == DDSRT_BOSEL_BE ? ddsrt_bswap4 (x) : (x)) +#define ddsrt_toBO4u(bo, x) ((bo) == DDSRT_BOSEL_BE ? ddsrt_bswap4u (x) : (x)) +#define ddsrt_toBO8(bo, x) ((bo) == DDSRT_BOSEL_BE ? ddsrt_bswap8 (x) : (x)) +#define ddsrt_toBO8u(bo, x) ((bo) == DDSRT_BOSEL_BE ? ddsrt_bswap8u (x) : (x)) +#define ddsrt_fromBE2(x) ddsrt_bswap2 (x) +#define ddsrt_fromBE2u(x) ddsrt_bswap2u (x) +#define ddsrt_fromBE4(x) ddsrt_bswap4 (x) +#define ddsrt_fromBE4u(x) ddsrt_bswap4u (x) +#define ddsrt_fromBE8(x) ddsrt_bswap8 (x) +#define ddsrt_fromBE8u(x) ddsrt_bswap8u (x) +#else +#define ddsrt_toBE2u(x) (x) +#define ddsrt_toBE4(x) (x) +#define ddsrt_toBE4u(x) (x) +#define ddsrt_toBE8(x) (x) +#define ddsrt_toBE8u(x) (x) +#define ddsrt_toLE2(x) ddsrt_bswap2 (x) +#define ddsrt_toLE2u(x) ddsrt_bswap2u (x) +#define ddsrt_toLE4(x) ddsrt_bswap4 (x) +#define ddsrt_toLE4u(x) ddsrt_bswap4u (x) +#define ddsrt_toLE8(x) ddsrt_bswap8 (x) +#define ddsrt_toLE8u(x) ddsrt_bswap8u (x) +#define ddsrt_toBO2(bo, x) ((bo) == DDSRT_BOSEL_LE ? ddsrt_bswap2 (x) : (x)) +#define ddsrt_toBO2u(bo, x) ((bo) == DDSRT_BOSEL_LE ? ddsrt_bswap2u (x) : (x)) +#define ddsrt_toBO4(bo, x) ((bo) == DDSRT_BOSEL_LE ? ddsrt_bswap4 (x) : (x)) +#define ddsrt_toBO4u(bo, x) ((bo) == DDSRT_BOSEL_LE ? ddsrt_bswap4u (x) : (x)) +#define ddsrt_toBO8(bo, x) ((bo) == DDSRT_BOSEL_LE ? ddsrt_bswap8 (x) : (x)) +#define ddsrt_toBO8u(bo, x) ((bo) == DDSRT_BOSEL_LE ? ddsrt_bswap8u (x) : (x)) +#define ddsrt_fromBE2(x) (x) +#define ddsrt_fromBE2u(x) (x) +#define ddsrt_fromBE4(x) (x) +#define ddsrt_fromBE4u(x) (x) +#define ddsrt_fromBE8(x) (x) +#define ddsrt_fromBE8u(x) (x) +#endif + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_BSWAP_H */ + diff --git a/unitree_SDK/include/dds/ddsrt/cdtors.h b/unitree_SDK/include/dds/ddsrt/cdtors.h new file mode 100644 index 0000000..5206745 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/cdtors.h @@ -0,0 +1,34 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_CDTORS_H +#define DDSRT_CDTORS_H + +#include "dds/export.h" +#include "dds/ddsrt/sync.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +DDS_EXPORT void ddsrt_init(void); + +DDS_EXPORT void ddsrt_fini(void); + +DDS_EXPORT ddsrt_mutex_t *ddsrt_get_singleton_mutex(void); + +DDS_EXPORT ddsrt_cond_t *ddsrt_get_singleton_cond(void); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_CDTORS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/circlist.h b/unitree_SDK/include/dds/ddsrt/circlist.h new file mode 100644 index 0000000..63b819c --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/circlist.h @@ -0,0 +1,43 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_CIRCLIST_H +#define DDSRT_CIRCLIST_H + +/* Circular doubly linked list implementation */ + +#include +#include +#include "dds/export.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#define DDSRT_FROM_CIRCLIST(typ_, member_, cle_) ((typ_ *) ((char *) (cle_) - offsetof (typ_, member_))) + +struct ddsrt_circlist { + struct ddsrt_circlist_elem *latest; /* pointer to latest inserted element */ +}; + +struct ddsrt_circlist_elem { + struct ddsrt_circlist_elem *next; + struct ddsrt_circlist_elem *prev; +}; + +DDS_EXPORT void ddsrt_circlist_init (struct ddsrt_circlist *list); +DDS_EXPORT bool ddsrt_circlist_isempty (const struct ddsrt_circlist *list); +DDS_EXPORT void ddsrt_circlist_append (struct ddsrt_circlist *list, struct ddsrt_circlist_elem *elem); +DDS_EXPORT void ddsrt_circlist_remove (struct ddsrt_circlist *list, struct ddsrt_circlist_elem *elem); +DDS_EXPORT struct ddsrt_circlist_elem *ddsrt_circlist_oldest (const struct ddsrt_circlist *list); +DDS_EXPORT struct ddsrt_circlist_elem *ddsrt_circlist_latest (const struct ddsrt_circlist *list); + +#endif /* DDSRT_CIRCLIST_H */ diff --git a/unitree_SDK/include/dds/ddsrt/countargs.h b/unitree_SDK/include/dds/ddsrt/countargs.h new file mode 100644 index 0000000..1909db2 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/countargs.h @@ -0,0 +1,20 @@ +/* + * Copyright(c) 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_COUNTARGS_H +#define DDSRT_COUNTARGS_H + +#define DDSRT_COUNT_ARGS_MSVC_WORKAROUND(x) x +#define DDSRT_COUNT_ARGS(...) DDSRT_COUNT_ARGS1 (__VA_ARGS__, 10,9,8,7,6,5,4,3,2,1,0) +#define DDSRT_COUNT_ARGS1(...) DDSRT_COUNT_ARGS_MSVC_WORKAROUND (DDSRT_COUNT_ARGS_ARGN (__VA_ARGS__)) +#define DDSRT_COUNT_ARGS_ARGN(a,b,c,d,e,f,g,h,i,j,n,...) n + +#endif diff --git a/unitree_SDK/include/dds/ddsrt/dynlib.h b/unitree_SDK/include/dds/ddsrt/dynlib.h new file mode 100644 index 0000000..6c1e812 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/dynlib.h @@ -0,0 +1,149 @@ + +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_DYNLIB_H +#define DDSRT_DYNLIB_H + +#include "dds/export.h" +#include "dds/config.h" +#include "dds/ddsrt/types.h" +#include "dds/ddsrt/retcode.h" +#include "dds/ddsrt/attributes.h" + +#if DDSRT_HAVE_DYNLIB + +#if defined (__cplusplus) +extern "C" { +#endif + + +//typedef void *ddsrt_dynlib_t; +typedef struct ddsrt_dynlib *ddsrt_dynlib_t; + + +/** + * @brief Load a dynamic shared library. + * + * The function ddsrt_dlopen() loads the dynamic shared object (shared library) + * file, identified by 'name', sets the handle parameter for the loaded library and + * returns the result with dds return code. + * + * If the 'translate' boolean is true, this function will first try to open the + * library with a translated 'name'. Translated in this context means that if + * "mylibrary" is provided, it will be translated into libmylibrary.so, + * libmylibrary.dylib or mylibrary.dll depending on the platform. + * This translation only happens when the given name does not contain + * a directory. + * If the function isn't able to load the library with the translated name, it + * will still try the given name. + * + * @param[in] name Library file name. + * @param[in] translate Automatic name translation on/off. + * @param[out] handle Library handle that will be assigned after successfull operation. It is assigned to NULL if loading fails. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Library handle was successfully loaded. + * @retval DDS_RETCODE_BAD_PARAM + * There is an invalid input in the parameter list + * @retval DDS_RETCODE_ERROR + * Loading failed. + * Use ddsrt_dlerror() to diagnose the failure. + */ +DDS_EXPORT dds_return_t +ddsrt_dlopen( + const char *name, + bool translate, + ddsrt_dynlib_t *handle) ddsrt_nonnull_all; + +/** + * @brief Close the library. + * + * The function ddsrt_dlclose() informs the system that the + * library, identified by 'handle', is no longer needed. + * will get the memory address of a symbol, + * identified by 'symbol', from a loaded library 'handle'. + * + * @param[in] handle Library handle. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Library handle was successfully closed. + * @retval DDS_RETCODE_ERROR + * Library closing failed. + * Use ddsrt_dlerror() to diagnose the failure. + */ +DDS_EXPORT dds_return_t +ddsrt_dlclose( + ddsrt_dynlib_t handle); + +/** + * @brief Get the memory address of a symbol. + * + * The function ddsrt_dlsym() will get the memory address of a symbol, + * identified by 'symbol', from a loaded library 'handle'. + * + * @param[in] handle Library handle. + * @param[in] symbol Symbol name. + * @param[out] address The memory address of the loaded symbol (void*). + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Symbol was found in the loaded library. + * Address parameter is ready to use. + * @retval DDS_RETCODE_ERROR + * Symbol was not found. + * Use ddsrt_dlerror() to diagnose the failure. + */ +DDS_EXPORT dds_return_t +ddsrt_dlsym( + ddsrt_dynlib_t handle, + const char *symbol, + void **address); + +/** + * @brief Get the most recent library related error. + * + * The function ddsrt_dlerror() will return the most recent error of a + * call to ddsrt_dlopen, ddsrt_dlclose, ddsrt_dlsym in human readable form. + * + * If no error was found, it's either due to the fact that there + * actually was no error since init or last ddsrt_dlerror() call, + * or due to an unknown unrelated error. + * + * @param[out] buf Buffer to store the error message + * @param[in] buflen The length of the provided buffer (must be > 0). + * + * @returns A dds_return_t indicating success (>0) or failure. + * + * @retval >0 + * The length of the returned error message + * @retval 0 + * No dynamic library loading related error present + * @retval DDS_RETCODE_NOT_ENOUGH_SPACE + * Buffer is not large enough to hold the error message + */ +DDS_EXPORT dds_return_t +ddsrt_dlerror( + char *buf, + size_t buflen); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_HAVE_DYNLIB */ + +#endif /* DDSRT_DYNLIB_H */ diff --git a/unitree_SDK/include/dds/ddsrt/endian.h b/unitree_SDK/include/dds/ddsrt/endian.h new file mode 100644 index 0000000..9c7e79c --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/endian.h @@ -0,0 +1,62 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_ENDIAN_H +#define DDSRT_ENDIAN_H + +#if defined(__cplusplus) +extern "C" { +#endif + +#define DDSRT_LITTLE_ENDIAN 1 +#define DDSRT_BIG_ENDIAN 2 + +#if _WIN32 +# if defined(__BIG_ENDIAN) +# define DDSRT_ENDIAN DDSRT_BIG_ENDIAN +# else +# define DDSRT_ENDIAN DDSRT_LITTLE_ENDIAN +# endif +/* _WIN32 */ +#elif defined(__IAR_SYSTEMS_ICC__) +# if __LITTLE_ENDIAN__ == 1 +# define DDSRT_ENDIAN DDSRT_LITTLE_ENDIAN +# else +# define DDSRT_ENDIAN DDSRT_BIG_ENDIAN +# endif +/* __IAR_SYSTEMS_ICC__ */ +#else +# if defined(__BYTE_ORDER__) +# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +# define DDSRT_ENDIAN DDSRT_BIG_ENDIAN +# elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +# define DDSRT_ENDIAN DDSRT_LITTLE_ENDIAN +# endif +# elif defined(__sun) +# include +# if defined(_BIG_ENDIAN) +# define DDSRT_ENDIAN DDSRT_BIG_ENDIAN +# elif defined(_LITTLE_ENDIAN) +# define DDSRT_ENDIAN DDSRT_LITTLE_ENDIAN +# endif +# endif +#endif /* _WIN32 */ + +#if (DDSRT_ENDIAN != DDSRT_LITTLE_ENDIAN) && \ + (DDSRT_ENDIAN != DDSRT_BIG_ENDIAN) +# error "Endianness cannot be determined" +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_ENDIAN_H */ diff --git a/unitree_SDK/include/dds/ddsrt/environ.h b/unitree_SDK/include/dds/ddsrt/environ.h new file mode 100644 index 0000000..f460e7a --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/environ.h @@ -0,0 +1,150 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_ENVIRON_H +#define DDSRT_ENVIRON_H + +#include "dds/export.h" +#include "dds/ddsrt/attributes.h" +#include "dds/ddsrt/expand_vars.h" +#include "dds/ddsrt/retcode.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/** + * @brief Get value for environment variable. + * + * @param[in] name Environment variable name. + * @param[out] value Alias to value of environment variable - must not be modified + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Environment variable written to @buf. + * @retval DDS_RETCODE_NOT_FOUND + * Environment variable not found. + * @retval DDS_RETCODE_BAD_PARAMETER + * FIXME: document + * @retval DDS_RETCODE_OUT_OF_RESOURCES + * FIXME: document + * @retval DDS_RETCODE_ERROR + * Unspecified error. + */ +DDS_EXPORT dds_return_t +ddsrt_getenv( + const char *name, + const char **value) +ddsrt_nonnull_all; + +/** + * @brief Set environment variable value. + * + * Sets the environment variable to the value specified in value, or + * alternatively, unsets the environment variable if value is an empty string. + * + * @param[in] name Environment variable name. + * @param[in] value Value to set environment variable to. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Environment variable successfully set to @value. + * @retval DDS_RETCODE_BAD_PARAMETER + * Invalid environment variable name. + * @retval DDS_RETCODE_OUT_OF_RESOURCES + * Not enough system resources to set environment variable. + * @retval DDS_RETCODE_ERROR + * Unspecified system error. + */ +DDS_EXPORT dds_return_t +ddsrt_setenv( + const char *name, + const char *value) +ddsrt_nonnull_all; + +/** + * @brief Unset environment variable value. + * + * @param[in] name Environment variable name. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Environment variable successfully unset. + * @retval DDS_RETCODE_BAD_PARAMETER + * Invalid environment variable name. + * @retval DDS_RETCODE_OUT_OF_RESOURCES + * Not enough system resources to unset environment variable. + * @retval DDS_RETCODE_ERROR + * Unspecified system error. + */ +DDS_EXPORT dds_return_t +ddsrt_unsetenv( + const char *name) +ddsrt_nonnull_all; + +/** + * @brief Expand environment variables within string. + * + * Expands ${X}, ${X:-Y}, ${X:+Y}, ${X:?Y} forms, but not $X. + * + * The result string should be freed with ddsrt_free(). + * + * @param[in] string String to expand. + * @param[in] domid Domain id that this is relevant to + * UINT32_MAX means none (see logging) + * also made available as + * ${CYCLONEDDS_DOMAIN_ID} + * + * @returns Allocated char*. + * + * @retval NULL + * Expansion failed. + * @retval Pointer + * Copy of the string argument with the environment + * variables expanded. + */ +DDS_EXPORT char* +ddsrt_expand_envvars( + const char *string, + uint32_t domid); + +/** + * @brief Expand environment variables within string. + * + * Expands $X, ${X}, ${X:-Y}, ${X:+Y}, ${X:?Y} forms, $ and \ + * can be escaped with \. + * + * The result string should be freed with ddsrt_free(). + * + * @param[in] string String to expand. + * + * @returns Allocated char*. + * + * @retval NULL + * Expansion failed. + * @retval Pointer + * Copy of the string argument with the environment + * variables expanded. + */ +DDS_EXPORT char* +ddsrt_expand_envvars_sh( + const char *string, + uint32_t domid); + + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_ENVIRON_H */ diff --git a/unitree_SDK/include/dds/ddsrt/expand_vars.h b/unitree_SDK/include/dds/ddsrt/expand_vars.h new file mode 100644 index 0000000..36172c4 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/expand_vars.h @@ -0,0 +1,78 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_EXPAND_VARS_H +#define DDSRT_EXPAND_VARS_H + +#include "dds/export.h" +#include "dds/ddsrt/attributes.h" +#include "dds/ddsrt/retcode.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef const char * (*expand_lookup_fn)(const char *name, void *data); + +/** + * @brief Expand variables within string. + * + * Expands ${X}, ${X:-Y}, ${X:+Y}, ${X:?Y} forms, but not $X. + * + * The result string should be freed with ddsrt_free(). + * + * @param[in] string String to expand. + * @param[in] lookup Lookup function to retrieve replacement value + * @param[in] data Data passed to lookup function + * + * @returns Allocated char*. + * + * @retval NULL + * Expansion failed. + * @retval Pointer + * Copy of the string argument with the variables expanded. + */ +DDS_EXPORT char* +ddsrt_expand_vars( + const char *string, + expand_lookup_fn lookup, + void * data); + +/** + * @brief Expand variables within string. + * + * Expands $X, ${X}, ${X:-Y}, ${X:+Y}, ${X:?Y} forms, $ and \ + * can be escaped with \. + * + * The result string should be freed with ddsrt_free(). + * + * @param[in] string String to expand. + * @param[in] lookup Lookup function to retrieve replacement value + * @param[in] data Data passed to lookup function + * + * @returns Allocated char*. + * + * @retval NULL + * Expansion failed. + * @retval Pointer + * Copy of the string argument with the variables expanded. + */ +DDS_EXPORT char* +ddsrt_expand_vars_sh( + const char *string, + expand_lookup_fn lookup, + void * data); + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_EXPAND_VARS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/fibheap.h b/unitree_SDK/include/dds/ddsrt/fibheap.h new file mode 100644 index 0000000..a20bfea --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/fibheap.h @@ -0,0 +1,54 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_FIBHEAP_H +#define DDSRT_FIBHEAP_H + +#include + +#include "dds/export.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct ddsrt_fibheap_node { + struct ddsrt_fibheap_node *parent, *children; + struct ddsrt_fibheap_node *prev, *next; + unsigned mark: 1; + unsigned degree: 31; +} ddsrt_fibheap_node_t; + +typedef struct ddsrt_fibheap_def { + uintptr_t offset; + int (*cmp) (const void *va, const void *vb); +} ddsrt_fibheap_def_t; + +typedef struct ddsrt_fibheap { + ddsrt_fibheap_node_t *roots; /* points to root with min key value */ +} ddsrt_fibheap_t; + +#define DDSRT_FIBHEAPDEF_INITIALIZER(offset, cmp) { (offset), (cmp) } + +DDS_EXPORT void ddsrt_fibheap_def_init (ddsrt_fibheap_def_t *fhdef, uintptr_t offset, int (*cmp) (const void *va, const void *vb)); +DDS_EXPORT void ddsrt_fibheap_init (const ddsrt_fibheap_def_t *fhdef, ddsrt_fibheap_t *fh); +DDS_EXPORT void *ddsrt_fibheap_min (const ddsrt_fibheap_def_t *fhdef, const ddsrt_fibheap_t *fh); +DDS_EXPORT void ddsrt_fibheap_merge (const ddsrt_fibheap_def_t *fhdef, ddsrt_fibheap_t *a, ddsrt_fibheap_t *b); +DDS_EXPORT void ddsrt_fibheap_insert (const ddsrt_fibheap_def_t *fhdef, ddsrt_fibheap_t *fh, const void *vnode); +DDS_EXPORT void ddsrt_fibheap_delete (const ddsrt_fibheap_def_t *fhdef, ddsrt_fibheap_t *fh, const void *vnode); +DDS_EXPORT void *ddsrt_fibheap_extract_min (const ddsrt_fibheap_def_t *fhdef, ddsrt_fibheap_t *fh); +DDS_EXPORT void ddsrt_fibheap_decrease_key (const ddsrt_fibheap_def_t *fhdef, ddsrt_fibheap_t *fh, const void *vnode); /* to be called AFTER decreasing the key */ + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_FIBHEAP_H */ diff --git a/unitree_SDK/include/dds/ddsrt/filesystem.h b/unitree_SDK/include/dds/ddsrt/filesystem.h new file mode 100644 index 0000000..3fd4c52 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/filesystem.h @@ -0,0 +1,127 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_FILESYSTEM_H +#define DDSRT_FILESYSTEM_H + +#include + +#include "dds/export.h" +#include "dds/config.h" +#include "dds/ddsrt/retcode.h" +#include "dds/ddsrt/time.h" + +#if DDSRT_HAVE_FILESYSTEM + +#if _WIN32 +#include "dds/ddsrt/filesystem/windows.h" +#else +#include "dds/ddsrt/filesystem/posix.h" +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +struct ddsrt_stat { + ddsrt_mode_t stat_mode; + size_t stat_size; + dds_time_t stat_mtime; +}; + + +struct ddsrt_dirent { + char d_name[DDSRT_PATH_MAX + 1]; +}; + +/** \brief opendir wrapper + * + * Open the directory conform opendir + * + * Precondition: + * none + * + * Possible results: + * - return DDS_RETCODE_OK if directory 'name' is opened + * - DDS_RETCODE_ERROR if 'name' could not + * be found or is not a directory. + */ +DDS_EXPORT dds_return_t ddsrt_opendir(const char *name, ddsrt_dir_handle_t *dir); + +/** \brief closedir wrapper + * + * Close the directory conform closdir + * + * Precondition: + * none + * + * Possible results: + * - return DDS_RETCODE_OK if directory identified by the handle + * is succesfully closed + * - return DDS_RETCODE_ERROR if the handle is invalid. + */ +DDS_EXPORT dds_return_t ddsrt_closedir(ddsrt_dir_handle_t d); + +/** \brief readdir wrapper + * + * Read the directory conform readdir. + * + * Precondition: + * none + * + * Possible results: + * - return DDS_RETCODE_OK if next directory is found + * - return DDS_RETCODE_ERROR if no more directories are found. + */ +DDS_EXPORT dds_return_t ddsrt_readdir(ddsrt_dir_handle_t d, struct ddsrt_dirent *direntp); + +/** \brief stat wrapper + * + * Gets directory status conform stat. + * + * Precondition: + * none + * + * Possible results: + * - return DDS_RETCODE_OK if stat is successful + * - return DDS_RETCODE_ERROR if stat fails. + */ +DDS_EXPORT dds_return_t ddsrt_stat(const char *path, struct ddsrt_stat *buf); + +/** \brief Transforms the given filepath into a platform specific filepath. + * + * This translation function will replace any platform file seperator into + * the fileseperator of the current platform. Doulbe quotes are removed + * as well. + * + * Precondition: + * none + * + * Possible results: + * - returns normalized filepath conform current platform + * - return NULL if out of memory. + */ +DDS_EXPORT char* ddsrt_file_normalize(const char *filepath); + +/** \brief Get file seperator + * + * Possible Results: + * - "" + */ +DDS_EXPORT const char* ddsrt_file_sep(void); + +#if defined (__cplusplus) +} +#endif + +#endif // DDRT_HAVE_FILESYSTEM + +#endif // DDSRT_FILESYSTEM_H diff --git a/unitree_SDK/include/dds/ddsrt/filesystem/posix.h b/unitree_SDK/include/dds/ddsrt/filesystem/posix.h new file mode 100644 index 0000000..163ad11 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/filesystem/posix.h @@ -0,0 +1,34 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_FILESYSTEM_POSIX_H +#define DDSRT_FILESYSTEM_POSIX_H + +#include +#include +#include +#include + +typedef DIR *ddsrt_dir_handle_t; +typedef mode_t ddsrt_mode_t; + +#define DDSRT_PATH_MAX PATH_MAX +#define DDSRT_FILESEPCHAR '/' + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_FILESYSTEM_POSIX_H */ diff --git a/unitree_SDK/include/dds/ddsrt/filesystem/windows.h b/unitree_SDK/include/dds/ddsrt/filesystem/windows.h new file mode 100644 index 0000000..4123e02 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/filesystem/windows.h @@ -0,0 +1,34 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_FILESYSTEM_WINDOWS_H +#define DDSRT_FILESYSTEM_WINDOWS_H + +#include +#include + +#include "dds/ddsrt/types.h" + +typedef HANDLE ddsrt_dir_handle_t; +typedef unsigned short ddsrt_mode_t; + +#define DDSRT_PATH_MAX MAX_PATH +#define DDSRT_FILESEPCHAR '\\' + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_FILESYSTEM_WINDOWS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/heap.h b/unitree_SDK/include/dds/ddsrt/heap.h new file mode 100644 index 0000000..fb7c2ce --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/heap.h @@ -0,0 +1,155 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +/** + * @file heap.h + * @brief Heap memory management. + * + * Platform independent interface to heap memory management. + */ +#ifndef DDSRT_HEAP_H +#define DDSRT_HEAP_H + +#include + +#include "dds/export.h" +#include "dds/ddsrt/attributes.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @brief Allocate memory from heap. + * + * The allocated block of memory must be freed by calling @ddsrt_free when no + * longer used. + * + * @param[in] size The size, in bytes, of the block of memory to allocate. + * + * @returns A pointer to the allocated block of memory. abort() is called if + * not enough free memory was available. + */ +DDS_EXPORT void * +ddsrt_malloc( + size_t size) +ddsrt_attribute_malloc +ddsrt_attribute_alloc_size((1)); + +/** + * @brief Allocate memory from heap. + * + * Allocate a block of memory from heap with the given size. The allocated + * block of memory must be freed by calling @ddsrt_free when no longer used. + * + * @param[in] size The size, in bytes, of memory to allocate. + * + * @returns A pointer to the allocated block of memory, NULL if not enough + * memory was available. + */ +DDS_EXPORT void * +ddsrt_malloc_s( + size_t size) +ddsrt_attribute_malloc +ddsrt_attribute_alloc_size((1)); + +/** + * @brief Allocate memory from heap for an array of @count elements of @size + * bytes. + * + * The allocated memory is initialized to zero. The allocated memory must be + * freed by calling @ddsrt_free when no longer used. + * + * A non-NULL pointer, that must be freed is always returned, even if the sum + * @count and @size equals zero. + * + * @returns A pointer to the allocated memory. abort() is called if not enough + * free memory was available. + */ +DDS_EXPORT void * +ddsrt_calloc( + size_t count, + size_t size) +ddsrt_attribute_malloc +ddsrt_attribute_alloc_size((1,2)); + +/** + * @brief Allocate memory from heap for an array of @count elements of @size + * bytes. + * + * The allocated memory is initialized to zero. The allocated memory must be + * freed by calling @ddsrt_free when no longer used. + * + * A non-NULL pointer, that must be freed is always returned, even if the sum + * @count and @size equals zero. + * + * @returns A pointer to the allocated memory, or NULL if not enough memory was + * available. + */ +DDS_EXPORT void * +ddsrt_calloc_s( + size_t count, + size_t size) +ddsrt_attribute_malloc +ddsrt_attribute_alloc_size((1,2)); + +/** + * @brief Reallocate memory from heap. + * + * Reallocate memory from heap. If memblk is NULL the function returns + * ddsrt_malloc_s(size). If size is 0, ddsrt_realloc_s free's the memory + * pointed to by memblk and returns a pointer as if ddsrt_malloc_s(0) was + * invoked. The returned pointer must be free'd with ddsrt_free. + * + * @returns A pointer to reallocated memory. Calls abort() if not enough free + * memory was available. + */ +DDS_EXPORT void * +ddsrt_realloc( + void *memblk, + size_t size) +ddsrt_attribute_malloc +ddsrt_attribute_alloc_size((2)); + +/** + * @brief Reallocate memory from heap. + * + * Reallocate memory from heap. If memblk is NULL the function returns + * ddsrt_malloc_s(size). If size is 0, ddsrt_realloc_s free's the memory + * pointed to by memblk and returns a pointer as if ddsrt_malloc_s(0) was + * invoked. The returned pointer must be free'd with ddsrt_free. + * + * @returns A pointer to reallocated memory, or NULL if not enough free memory + * was available. + */ +DDS_EXPORT void * +ddsrt_realloc_s( + void *memblk, + size_t size) +ddsrt_attribute_malloc +ddsrt_attribute_alloc_size((2)); + +/** + * @brief Free a previously allocated block of memory and return it to heap. + * + * Free the allocated memory pointed to by @ptr and release it to the heap. No + * action will be taken if @ptr is NULL. + * + * @param[in] ptr Pointer to previously allocated block of memory. + */ +DDS_EXPORT void +ddsrt_free(void *ptr); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_HEAP_H */ diff --git a/unitree_SDK/include/dds/ddsrt/hopscotch.h b/unitree_SDK/include/dds/ddsrt/hopscotch.h new file mode 100644 index 0000000..18b9d9a --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/hopscotch.h @@ -0,0 +1,113 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_HOPSCOTCH_H +#define DDSRT_HOPSCOTCH_H + +#include + +#include "dds/export.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* + * The hopscotch hash table is dependent on a proper functioning hash. + * If the hash function generates a lot of hash collisions, then it will + * not be able to handle that by design. + * It is capable of handling some collisions, but not more than 32 per + * bucket (less, when other hash values are clustered around the + * collision value). + * When proper distributed hash values are generated, then hopscotch + * works nice and quickly. + */ +typedef uint32_t (*ddsrt_hh_hash_fn) (const void *a); + +/* + * Hopscotch needs to be able to compare two elements. + * Returns 0 when not equal. + */ +typedef int (*ddsrt_hh_equals_fn) (const void *a, const void *b); + +/* + * Hopscotch is will resize its internal buckets list when needed. It will + * call this garbage collection function with the old buckets list. The + * caller has to delete the list when it deems it safe to do so. + */ +typedef void (*ddsrt_hh_buckets_gc_fn) (void *bs, void *arg); + +/* Sequential version */ +struct ddsrt_hh; + +struct ddsrt_hh_iter { + struct ddsrt_hh *hh; + uint32_t cursor; +}; + +DDS_EXPORT struct ddsrt_hh *ddsrt_hh_new (uint32_t init_size, ddsrt_hh_hash_fn hash, ddsrt_hh_equals_fn equals) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_hh_free (struct ddsrt_hh * __restrict hh) ddsrt_nonnull_all; +DDS_EXPORT void *ddsrt_hh_lookup (const struct ddsrt_hh * __restrict rt, const void * __restrict keyobject) ddsrt_nonnull_all; +DDS_EXPORT int ddsrt_hh_add (struct ddsrt_hh * __restrict rt, void * __restrict data) ddsrt_nonnull_all; +DDS_EXPORT int ddsrt_hh_remove (struct ddsrt_hh * __restrict rt, const void * __restrict keyobject) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_hh_add_absent (struct ddsrt_hh * __restrict rt, void * __restrict data) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_hh_remove_present (struct ddsrt_hh * __restrict rt, void * __restrict keyobject) ddsrt_nonnull_all; +DDS_EXPORT void ddsrt_hh_enum (struct ddsrt_hh * __restrict rt, void (*f) (void *a, void *f_arg), void *f_arg) ddsrt_nonnull ((1, 2)); /* may delete a */ +DDS_EXPORT void *ddsrt_hh_iter_first (struct ddsrt_hh * __restrict rt, struct ddsrt_hh_iter * __restrict iter) ddsrt_nonnull_all; /* may delete nodes */ +DDS_EXPORT void *ddsrt_hh_iter_next (struct ddsrt_hh_iter * __restrict iter) ddsrt_nonnull_all; + +/* Concurrent version */ +struct ddsrt_chh; +struct ddsrt_chh_bucket; + +#if ! ddsrt_has_feature_thread_sanitizer +struct ddsrt_chh_iter { + struct ddsrt_chh_bucket *bs; + uint32_t size; + uint32_t cursor; +}; +#else +struct ddsrt_chh_iter { + struct ddsrt_chh *chh; + struct ddsrt_hh_iter it; +}; +#endif + +DDS_EXPORT struct ddsrt_chh *ddsrt_chh_new (uint32_t init_size, ddsrt_hh_hash_fn hash, ddsrt_hh_equals_fn equals, ddsrt_hh_buckets_gc_fn gc_buckets, void *gc_buckets_arg); +DDS_EXPORT void ddsrt_chh_free (struct ddsrt_chh * __restrict hh); +DDS_EXPORT void *ddsrt_chh_lookup (struct ddsrt_chh * __restrict rt, const void * __restrict keyobject); +DDS_EXPORT int ddsrt_chh_add (struct ddsrt_chh * __restrict rt, void * __restrict data); +DDS_EXPORT int ddsrt_chh_remove (struct ddsrt_chh * __restrict rt, const void * __restrict keyobject); +DDS_EXPORT void ddsrt_chh_enum_unsafe (struct ddsrt_chh * __restrict rt, void (*f) (void *a, void *f_arg), void *f_arg); /* may delete a */ +DDS_EXPORT void *ddsrt_chh_iter_first (struct ddsrt_chh * __restrict rt, struct ddsrt_chh_iter *it); +DDS_EXPORT void *ddsrt_chh_iter_next (struct ddsrt_chh_iter *it); +/* Sequential version, embedded data */ +struct ddsrt_ehh; + +struct ddsrt_ehh_iter { + struct ddsrt_ehh *hh; + uint32_t cursor; +}; + +DDS_EXPORT struct ddsrt_ehh *ddsrt_ehh_new (size_t elemsz, uint32_t init_size, ddsrt_hh_hash_fn hash, ddsrt_hh_equals_fn equals); +DDS_EXPORT void ddsrt_ehh_free (struct ddsrt_ehh * __restrict hh); +DDS_EXPORT void *ddsrt_ehh_lookup (const struct ddsrt_ehh * __restrict rt, const void * __restrict keyobject); +DDS_EXPORT int ddsrt_ehh_add (struct ddsrt_ehh * __restrict rt, const void * __restrict data); +DDS_EXPORT int ddsrt_ehh_remove (struct ddsrt_ehh * __restrict rt, const void * __restrict keyobject); +DDS_EXPORT void ddsrt_ehh_enum (struct ddsrt_ehh * __restrict rt, void (*f) (void *a, void *f_arg), void *f_arg); /* may delete a */ +DDS_EXPORT void *ddsrt_ehh_iter_first (struct ddsrt_ehh * __restrict rt, struct ddsrt_ehh_iter * __restrict iter); /* may delete nodes */ +DDS_EXPORT void *ddsrt_ehh_iter_next (struct ddsrt_ehh_iter * __restrict iter); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsrt/ifaddrs.h b/unitree_SDK/include/dds/ddsrt/ifaddrs.h new file mode 100644 index 0000000..a8162f2 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/ifaddrs.h @@ -0,0 +1,58 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_IFADDRS_H +#define DDSRT_IFADDRS_H + +#include "dds/ddsrt/sockets.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +enum ddsrt_iftype { + DDSRT_IFTYPE_UNKNOWN, + DDSRT_IFTYPE_WIRED, + DDSRT_IFTYPE_WIFI +}; + +struct ddsrt_ifaddrs { + struct ddsrt_ifaddrs *next; + char *name; + uint32_t index; + uint32_t flags; + enum ddsrt_iftype type; + struct sockaddr *addr; + struct sockaddr *netmask; + struct sockaddr *broadaddr; +}; + +typedef struct ddsrt_ifaddrs ddsrt_ifaddrs_t; + +DDS_EXPORT dds_return_t +ddsrt_getifaddrs( + ddsrt_ifaddrs_t **ifap, + const int *afs); + +DDS_EXPORT void +ddsrt_freeifaddrs( + ddsrt_ifaddrs_t *ifa); + +DDS_EXPORT dds_return_t +ddsrt_eth_get_mac_addr( + char *interface_name, + unsigned char *mac_addr); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_IFADDRS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/io.h b/unitree_SDK/include/dds/ddsrt/io.h new file mode 100644 index 0000000..9ebf801 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/io.h @@ -0,0 +1,51 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_IO_H +#define DDSRT_IO_H + +#include +#include + +#include "dds/export.h" +#include "dds/ddsrt/attributes.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/** + * @brief Write a formatted string to a newly allocated buffer. + */ +DDS_EXPORT int +ddsrt_vasprintf( + char **strp, + const char *fmt, + va_list ap); + +/** + * @brief Write a formatted string to a newly allocated buffer. + */ +DDS_EXPORT int +ddsrt_asprintf( + char **strp, + const char *fmt, + ...) ddsrt_attribute_format ((printf, 2, 3)); + +#if defined(_MSC_VER) && (_MSC_VER < 1900) +extern int snprintf(char *s, size_t n, const char *format, ...); +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_IO_H */ diff --git a/unitree_SDK/include/dds/ddsrt/iovec.h b/unitree_SDK/include/dds/ddsrt/iovec.h new file mode 100644 index 0000000..d0a093b --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/iovec.h @@ -0,0 +1,45 @@ +/* + * Copyright(c) 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_IOVEC_H +#define DDSRT_IOVEC_H + +#if _WIN32 +typedef unsigned ddsrt_iov_len_t; +typedef struct ddsrt_iovec { + ddsrt_iov_len_t iov_len; + void *iov_base; +} ddsrt_iovec_t; + +// Equivalent to a DWORD +typedef unsigned long ddsrt_msg_iovlen_t; + +#else // _WIN32 + +#if DDSRT_WITH_LWIP +#include +#else +#include +#include +#endif + +typedef struct iovec ddsrt_iovec_t; +typedef size_t ddsrt_iov_len_t; + +#if defined(__linux) && !LWIP_SOCKET +typedef size_t ddsrt_msg_iovlen_t; +#else /* POSIX says int (which macOS, FreeBSD, Solaris do) */ +typedef int ddsrt_msg_iovlen_t; +#endif + +#endif // _WIN32 + +#endif diff --git a/unitree_SDK/include/dds/ddsrt/log.h b/unitree_SDK/include/dds/ddsrt/log.h new file mode 100644 index 0000000..4c54637 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/log.h @@ -0,0 +1,456 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +/** @file + * + * @brief DDS C Logging API + * + * This header file defines the public API for logging and controlling logging + * in the DDS C language binding. + */ +#ifndef DDS_LOG_H +#define DDS_LOG_H + +#include +#include +#include + +#include "dds/export.h" +#include "dds/ddsrt/attributes.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/** @defgroup log_categories Convenience log category definitions. + * + * These defines expand into numeric values that can be ORed together to + * specify messages of which categories must be passed to the respective sinks. + * + * Every category other than DDS_LC_FATAL, DDS_LC_ERROR, DDS_LC_WARNING and + * DDS_LC_INFO automatically falls into the trace category. + * + * @{ + */ +/** Fatal error condition. Immediate abort on sink return. */ +#define DDS_LC_FATAL (1u) +/** Error condition. */ +#define DDS_LC_ERROR (2u) +/** Warning condition. */ +#define DDS_LC_WARNING (4u) +/** Informational message. */ +#define DDS_LC_INFO (8u) +/** Debug/trace messages related to configuration settings. */ +#define DDS_LC_CONFIG (16u) +/** Debug/trace messages related to node discovery. */ +#define DDS_LC_DISCOVERY (32u) +/** Currently unused. */ +#define DDS_LC_DATA (64u) +/** Debug/trace messages for which no specialized category exists (yet). */ +#define DDS_LC_TRACE (128u) +/** Debug/trace messages related to receive administration. */ +#define DDS_LC_RADMIN (256u) +/** Debug/trace messages related to timing. */ +#define DDS_LC_TIMING (512u) +/** Debug/trace messages related to send administration. */ +#define DDS_LC_TRAFFIC (1024u) +/** Currently unused. */ +#define DDS_LC_TOPIC (2048u) +/** Debug/trace messages related to TCP communication. */ +#define DDS_LC_TCP (4096u) +/** Debug/trace messages related to parameter list processing. */ +#define DDS_LC_PLIST (8192u) +/** Debug/trace messages related to the writer history cache. */ +#define DDS_LC_WHC (16384u) +/** Debug/trace messages related to throttling. */ +#define DDS_LC_THROTTLE (32768u) +/** Reader history cache. */ +#define DDS_LC_RHC (65536u) +/** Include content in traces. */ +#define DDS_LC_CONTENT (131072u) +/** Debug/trace messages related to SHMEM */ +#define DDS_LC_SHM (262144u) +/** All common trace categories. */ +#define DDS_LC_ALL \ + (DDS_LC_FATAL | DDS_LC_ERROR | DDS_LC_WARNING | DDS_LC_INFO | \ + DDS_LC_CONFIG | DDS_LC_DISCOVERY | DDS_LC_DATA | DDS_LC_TRACE | \ + DDS_LC_TIMING | DDS_LC_TRAFFIC | DDS_LC_TCP | DDS_LC_THROTTLE | \ + DDS_LC_CONTENT | DDS_LC_SHM) +/** @}*/ + +#define DDS_LOG_MASK \ + (DDS_LC_FATAL | DDS_LC_ERROR | DDS_LC_WARNING | DDS_LC_INFO) + +#define DDS_TRACE_MASK \ + (~DDS_LOG_MASK) + +/** Structure with log message and meta data passed to callbacks. */ +typedef struct { + /** Log category the message falls into. */ + uint32_t priority; + /** Log domain id, UINT32_MAX is global. */ + uint32_t domid; + /** Filename where message was generated. */ + const char *file; + /** Line number in file where message was generated. */ + uint32_t line; + /** Name of function message where message was generated. */ + const char *function; + /** Log message. */ + const char *message; + /** Size of log message. */ + size_t size; + /** Default log message header length */ + size_t hdrsize; +} dds_log_data_t; + +/** Function signature that log and trace callbacks must adhere too. */ +typedef void (*dds_log_write_fn_t) (void *, const dds_log_data_t *); + +/** Semi-opaque type for log/trace configuration. */ +struct ddsrt_log_cfg_common { + /** Mask for testing whether the xLOG macro should forward to the + function (and so incur the cost of constructing the parameters). + Messages in DDS_LOG_MASK are rare, so the overhead of calling + the function and then dropping the message is not an issue, unlike + for messages in DDS_TRACE_MASK. */ + uint32_t mask; + + /** The actual configured trace mask */ + uint32_t tracemask; + + /** Domain id for reporting; UINT32_MAX = no domain */ + uint32_t domid; +}; + +typedef struct ddsrt_log_cfg { + struct ddsrt_log_cfg_common c; + union { + dds_log_write_fn_t fnptr; + void *ptr; + uint32_t u32; + unsigned char pad[72]; + } u; +} ddsrt_log_cfg_t; + +DDS_EXPORT extern uint32_t *const dds_log_mask; + +/** + * @brief Get currently enabled log and trace categories. + * + * @returns A uint32_t with enabled categories set. + */ +DDS_INLINE_EXPORT inline uint32_t +dds_get_log_mask(void) +{ + return *dds_log_mask; +} + +/** + * @brief Set enabled log and trace categories. + * + * @param[in] cats Log and trace categories to enable. + */ +DDS_EXPORT void +dds_set_log_mask( + uint32_t cats); + +/** + * @private + */ +DDS_EXPORT void +dds_set_log_file( + FILE *file); + +/** + * @private + */ +DDS_EXPORT void +dds_set_trace_file( + FILE *file); + +/** + * @brief Register callback to receive log messages + * + * Callbacks registered to handle log messages will receive messages of type + * info, warning, error and fatal. Messages that fall into the trace category + * will never be delivered to the callback. + * + * This operation is synchronous and only returns once the operation is + * registered with all threads. Meaning that neither callback or userdata will + * be referenced by the DDS stack on return. + * + * @param[in] callback Function pointer matching dds_log_write_fn signature + * or a null pointer to restore the default sink. + * @param[in] userdata User specified data passed along with each invocation + * of callback. + */ +DDS_EXPORT void +dds_set_log_sink( + dds_log_write_fn_t callback, + void *userdata); + +/** + * @brief Register callback to receive trace messages + * + * Callbacks registered to handle trace messages will receive messages of type + * info, warning, error and fatal as well as all message types that fall into + * the trace category depending on the log mask. + * + * This operation is synchronous and only returns once the operation is + * registered with all threads. Meaning that neither callback or + * userdata will be referenced by the DDS stack on return. + * + * @param[in] callback Function pointer matching dds_log_write_fn_t signature + * or a null pointer to restore the default sink. + * @param[in] userdata User specified data passed along with each invocation + * of callback. + */ +DDS_EXPORT void +dds_set_trace_sink( + dds_log_write_fn_t callback, + void *userdata); + +/** + * @brief Initialize a struct ddsrt_log_cfg for use with dds_log_cfg + * + * Callbacks registered to handle log messages will receive messages of type + * info, warning, error and fatal. Messages that fall into the trace category + * will never be delivered to the callback. + * + * Callbacks registered to handle trace messages will receive messages of type + * info, warning, error and fatal as well as all message types that fall into + * the trace category depending on the log mask. + * + * This operation is synchronous and only returns once the operation is + * registered with all threads. Meaning that neither callback or + * userdata will be referenced by the DDS stack on return. + * + * @param[out] cfg On return, initialised to make dds_log_cfg invoked + * with this config object behave as specified by the + * other parameters. + * @param[in] domid Numerical identifier in log/trace, UINT32_MAX is + * reserved for global logging. + * @param[in] tracemask Mask determining which traces should be written. + * @param[in] log_fp File for default sink. + * @param[in] trace_fp File for default sink. + */ +DDS_EXPORT void +dds_log_cfg_init( + struct ddsrt_log_cfg *cfg, + uint32_t domid, + uint32_t tracemask, + FILE *log_fp, + FILE *trace_fp); + +/** + * @brief Write a log or trace message for a specific logging configuraiton + * (categories, id, sinks). + * + * Direct use of #dds_log is discouraged. Use #DDS_CINFO, #DDS_CWARNING, + * #DDS_CERROR, #DDS_CTRACE or #DDS_CLOG instead. + */ +DDS_EXPORT void +dds_log_cfg( + const struct ddsrt_log_cfg *cfg, + uint32_t prio, + const char *file, + uint32_t line, + const char *func, + const char *fmt, + ...) + ddsrt_attribute_format_printf(6, 7); + +/** + * @brief Write a log or trace message to the global configuration but with + * specific domain (intended solely for use during domain start-up, while + * the domain-specific logging/tracing hasn't been set yet). + * + * Write a log or trace message to one (or both) of the currently active sinks. + * + * Direct use of #dds_log_id is discouraged. Use #DDS_ILOG instead. + */ +DDS_EXPORT void +dds_log_id( + uint32_t prio, + uint32_t domid, + const char *file, + uint32_t line, + const char *func, + const char *fmt, + ...) + ddsrt_attribute_format_printf(6, 7); + +/** + * @brief Write a log or trace message to the global log/trace. + * + * Write a log or trace message to one (or both) of the currently active sinks. + * + * Direct use of #dds_log is discouraged. Use #DDS_INFO, #DDS_WARNING, + * #DDS_ERROR, #DDS_FATAL or #DDS_LOG instead. + */ +DDS_EXPORT void +dds_log( + uint32_t prio, + const char *file, + uint32_t line, + const char *func, + const char *fmt, + ...) + ddsrt_attribute_format_printf(5, 6); + +/** + * @brief Undecorated function name of the current function. + * + * Behavior of DDS_FUNCTION outside a function is undefined. Note that + * implementations differ across compilers and compiler versions. It might be + * implemented as either a string literal or a constant variable. + */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) +# define DDS_FUNCTION __func__ +#elif defined(__cplusplus) && (__cplusplus >= 201103) +# define DDS_FUNCTION __func__ +#elif defined(__GNUC__) +# define DDS_FUNCTION __FUNCTION__ +#elif defined(__clang__) +# define DDS_FUNCTION __FUNCTION__ +#elif defined(__ghs__) +# define DDS_FUNCTION __FUNCTION__ +#elif (defined(__SUNPRO_C) || defined(__SUNPRO_CC)) +/* Solaris Studio had support for __func__ before it supported __FUNCTION__. + Compiler flag -features=extensions is required on older versions. */ +# define DDS_FUNCTION __func__ +#elif defined(__FUNCTION__) +/* Visual Studio */ +# define DDS_FUNCTION __FUNCTION__ +#elif defined(__vxworks) +/* At least versions 2.9.6 and 3.3.4 of the GNU C Preprocessor only define + __GNUC__ if the entire GNU C compiler is in use. VxWorks 5.5 targets invoke + the preprocessor separately resulting in __GNUC__ not being defined. */ +# define DDS_FUNCTION __FUNCTION__ +#else +# warning "DDS_FUNCTION is not supported" +# define DDS_FUNCTION "" +#endif + +/** + * @brief Function signature of the current function. + * + * See comments on DDS_FUNCTION for details. + */ +#if defined(__GNUC__) +# define DDS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__clang__) +# define DDS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__ghs__) +# define DDS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif (defined(__SUNPRO_C) && __SUNPRO_C >= 0x5100) +/* Solaris Studio supports __PRETTY_FUNCTION__ in C since version 12.1 */ +# define DDS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5120) +/* Solaris Studio supports __PRETTY_FUNCTION__ in C++ since version 12.3 */ +# define DDS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__FUNCSIG__) +/* Visual Studio */ +# define DDS_PRETTY_FUNCTION __FUNCSIG__ +#elif defined(__vxworks) +/* See comments on __vxworks macro above. */ +# define DDS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#else +/* Fall back to DDS_FUNCTION. */ +# define DDS_PRETTY_FUNCTION DDS_FUNCTION +#endif + +/** + * @brief Write a log message. + * + * Write a log or trace message to the currently active log and/or trace sinks + * if the log category is enabled. Whether or not the category is enabled is + * checked before any dds_log-related activities to save a couple of % CPU. + * + * Only messages that fall into one of the log categories are passed onto + * dds_log. While messages that fall into a trace category could have been + * passed just as easily, they are rejected so that tracing is kept entirely + * separate from logging, if only cosmetic. + */ +#define DDS_LOG(cat, ...) \ + ((dds_get_log_mask() & (cat)) ? \ + dds_log((cat), __FILE__, __LINE__, DDS_FUNCTION, __VA_ARGS__) : 0) + +/** + * @brief Write a log message with a domain id override. + * + * Write a log or trace message to the currently active log and/or trace sinks + * if the log category is enabled. Whether or not the category is enabled is + * checked before any dds_log-related activities to save a couple of % CPU. + * + * Only messages that fall into one of the log categories are passed onto + * dds_log. While messages that fall into a trace category could have been + * passed just as easily, they are rejected so that tracing is kept entirely + * separate from logging, if only cosmetic. + */ +#define DDS_ILOG(cat, domid, ...) \ + ((dds_get_log_mask() & (cat)) ? \ + dds_log_id((cat), (domid), __FILE__, __LINE__, DDS_FUNCTION, __VA_ARGS__) : 0) + +/** + * @brief Write a log message using a specific config. + * + * Write a log or trace message to the currently active log and/or trace sinks + * if the log category is enabled. Whether or not the category is enabled is + * checked before any dds_log-related activities to save a couple of % CPU. + * + * Only messages that fall into one of the log categories are passed onto + * dds_log. While messages that fall into a trace category could have been + * passed just as easily, they are rejected so that tracing is kept entirely + * separate from logging, if only cosmetic. + */ +#define DDS_CLOG(cat, cfg, ...) \ + (((cfg)->c.mask & (cat)) ? \ + dds_log_cfg((cfg), (cat), __FILE__, __LINE__, DDS_FUNCTION, __VA_ARGS__) : 0) + +/** Write a log message of type #DDS_LC_INFO into global log. */ +#define DDS_INFO(...) \ + DDS_LOG(DDS_LC_INFO, __VA_ARGS__) +/** Write a log message of type #DDS_LC_WARNING into global log. */ +#define DDS_WARNING(...) \ + DDS_LOG(DDS_LC_WARNING, __VA_ARGS__) +/** Write a log message of type #DDS_LC_ERROR into global log. */ +#define DDS_ERROR(...) \ + DDS_LOG(DDS_LC_ERROR, __VA_ARGS__) +/** Write a log message of type #DDS_LC_ERROR into global log and abort. */ +#define DDS_FATAL(...) \ + dds_log(DDS_LC_FATAL, __FILE__, __LINE__, DDS_FUNCTION, __VA_ARGS__) + +/* MSVC mishandles __VA_ARGS__ while claiming to be conforming -- and even + if they have a defensible implement, they still differ from every other + compiler out there. An extra layer of macro expansion works around it. */ +#define DDS_CLOG_MSVC_WORKAROUND(x) x + +/** Write a log message of type #DDS_LC_INFO using specific logging config. */ +#define DDS_CINFO(...) \ + DDS_CLOG_MSVC_WORKAROUND(DDS_CLOG(DDS_LC_INFO, __VA_ARGS__)) +/** Write a log message of type #DDS_LC_WARNING using specific logging config. */ +#define DDS_CWARNING(...) \ + DDS_CLOG_MSVC_WORKAROUND(DDS_CLOG(DDS_LC_WARNING, __VA_ARGS__)) +/** Write a log message of type #DDS_LC_ERROR using specific logging config. */ +#define DDS_CERROR(...) \ + DDS_CLOG_MSVC_WORKAROUND(DDS_CLOG(DDS_LC_ERROR, __VA_ARGS__)) +/** Write a #DDS_LC_TRACE message using specific logging config. */ +#define DDS_CTRACE(...) \ + DDS_CLOG_MSVC_WORKAROUND(DDS_CLOG(DDS_LC_TRACE, __VA_ARGS__)) + +#if defined (__cplusplus) +} +#endif + +#endif /* DDS_LOG_H */ diff --git a/unitree_SDK/include/dds/ddsrt/md5.h b/unitree_SDK/include/dds/ddsrt/md5.h new file mode 100644 index 0000000..3709e0d --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/md5.h @@ -0,0 +1,106 @@ +/* Minimal changes introduced, for which: */ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +/* + Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + L. Peter Deutsch + ghost@aladdin.com + + */ +/* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */ +/* + Independent implementation of MD5 (RFC 1321). + + This code implements the MD5 Algorithm defined in RFC 1321, whose + text is available at + http://www.ietf.org/rfc/rfc1321.txt + The code is derived from the text of the RFC, including the test suite + (section A.5) but excluding the rest of Appendix A. It does not include + any code or documentation that is identified in the RFC as being + copyrighted. + + The original and principal author of md5.h is L. Peter Deutsch + . Other authors are noted in the change history + that follows (in reverse chronological order): + + 2002-04-13 lpd Removed support for non-ANSI compilers; removed + references to Ghostscript; clarified derivation from RFC 1321; + now handles byte order either statically or dynamically. + 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. + 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); + added conditionalization for C++ compilation from Martin + Purschke . + 1999-05-03 lpd Original version. + */ + +#ifndef DDSRT_MD5_H +#define DDSRT_MD5_H + +#include +#include "dds/export.h" + +/* + * This package supports both compile-time and run-time determination of CPU + * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be + * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is + * defined as non-zero, the code will be compiled to run only on big-endian + * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to + * run on either big- or little-endian CPUs, but will run slightly less + * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. + */ + +typedef unsigned char ddsrt_md5_byte_t; /* 8-bit byte */ +typedef unsigned int ddsrt_md5_word_t; /* 32-bit word */ + +/* Define the state of the MD5 Algorithm. */ +typedef struct ddsrt_md5_state_s { + ddsrt_md5_word_t count[2]; /* message length in bits, lsw first */ + ddsrt_md5_word_t abcd[4]; /* digest buffer */ + ddsrt_md5_byte_t buf[64]; /* accumulate block */ +} ddsrt_md5_state_t; + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Initialize the algorithm. */ +DDS_EXPORT void ddsrt_md5_init(ddsrt_md5_state_t *pms); + +/* Append a string to the message. */ +DDS_EXPORT void ddsrt_md5_append(ddsrt_md5_state_t *pms, const ddsrt_md5_byte_t *data, unsigned nbytes); + +/* Finish the message and return the digest. */ +DDS_EXPORT void ddsrt_md5_finish(ddsrt_md5_state_t *pms, ddsrt_md5_byte_t digest[16]); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +#endif /* DDSRT_MD5_H */ diff --git a/unitree_SDK/include/dds/ddsrt/mh3.h b/unitree_SDK/include/dds/ddsrt/mh3.h new file mode 100644 index 0000000..089ce9e --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/mh3.h @@ -0,0 +1,34 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_MH3_H +#define DDSRT_MH3_H + +#include +#include + +#include "dds/export.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +DDS_EXPORT uint32_t +ddsrt_mh3( + const void *key, + size_t len, + uint32_t seed); + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_MH3_H */ diff --git a/unitree_SDK/include/dds/ddsrt/misc.h b/unitree_SDK/include/dds/ddsrt/misc.h new file mode 100644 index 0000000..1fa3cbb --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/misc.h @@ -0,0 +1,99 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_MISC_H +#define DDSRT_MISC_H + +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +#define DDSRT_STRINGIFY(x) DDSRT_STRINGIFY1(x) +#define DDSRT_STRINGIFY1(x) #x + +#if defined(__clang__) || \ + defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 +# define DDSRT_STR(s) #s +# define DDSRT_JOINSTR(x,y) DDSRT_STR(x ## y) +# define DDSRT_DO_PRAGMA(x) _Pragma(#x) +# define DDSRT_PRAGMA(x) DDSRT_DO_PRAGMA(GCC diagnostic x) + +# if defined(__clang__) +# define DDSRT_WARNING_CLANG_OFF(x) \ + DDSRT_PRAGMA(push) \ + DDSRT_PRAGMA(ignored DDSRT_JOINSTR(-W,x)) +# define DDSRT_WARNING_CLANG_ON(x) \ + DDSRT_PRAGMA(pop) +# elif ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406 +# define DDSRT_WARNING_GNUC_OFF(x) \ + DDSRT_PRAGMA(push) \ + DDSRT_PRAGMA(ignored DDSRT_JOINSTR(-W,x)) +# define DDSRT_WARNING_GNUC_ON(x) \ + DDSRT_PRAGMA(pop) +# else +# define DDSRT_WARNING_GNUC_OFF(x) \ + DDSRT_PRAGMA(ignored DDSRT_JOINSTR(-W,x)) +# define DDSRT_WARNING_GNUC_ON(x) \ + DDSRT_PRAGMA(warning DDSRT_JOINSTR(-W,x)) +# endif +#endif + +#if !defined(DDSRT_WARNING_CLANG_OFF) && \ + !defined(DDSRT_WARNING_CLANG_ON) +# define DDSRT_WARNING_CLANG_OFF(x) +# define DDSRT_WARNING_CLANG_ON(x) +#endif + +#if !defined(DDSRT_WARNING_GNUC_OFF) && \ + !defined(DDSRT_WARNING_GNUC_ON) +# define DDSRT_WARNING_GNUC_OFF(x) +# define DDSRT_WARNING_GNUC_ON(x) +#endif + +#if defined(_MSC_VER) +# define DDSRT_WARNING_MSVC_OFF(x) \ + __pragma (warning(push)) \ + __pragma (warning(disable: ## x)) +# define DDSRT_WARNING_MSVC_ON(x) \ + __pragma (warning(pop)) +#else +# define DDSRT_WARNING_MSVC_OFF(x) +# define DDSRT_WARNING_MSVC_ON(x) +#endif + +/** + * @brief Macro to disable unused argument warnings + */ +#define DDSRT_UNUSED_ARG(a) (void)(a) + +/** + * @brief Macro to disable warnings for calling deprecated interfaces + */ +#define DDSRT_WARNING_DEPRECATED_OFF \ + DDSRT_WARNING_CLANG_OFF(deprecated-declarations) \ + DDSRT_WARNING_GNUC_OFF(deprecated-declarations) \ + DDSRT_WARNING_MSVC_OFF(4996) + +/** + * @brief Macro to enable warnings for calling deprecated interfaces + */ +#define DDSRT_WARNING_DEPRECATED_ON \ + DDSRT_WARNING_CLANG_ON(deprecated-declarations) \ + DDSRT_WARNING_GNUC_ON(deprecated-declarations) \ + DDSRT_WARNING_MSVC_ON(4996) + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_MISC_H */ diff --git a/unitree_SDK/include/dds/ddsrt/netstat.h b/unitree_SDK/include/dds/ddsrt/netstat.h new file mode 100644 index 0000000..2741ee5 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/netstat.h @@ -0,0 +1,68 @@ +/* + * Copyright(c) 2019 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_NETSTAT_H +#define DDSRT_NETSTAT_H + +#include + +#include "dds/export.h" +#include "dds/config.h" +#include "dds/ddsrt/retcode.h" + +#if DDSRT_HAVE_NETSTAT + +#if defined(__cplusplus) +extern "C" { +#endif + +struct ddsrt_netstat { + uint64_t ipkt; + uint64_t opkt; + uint64_t ibytes; + uint64_t obytes; +}; + +/** + * @brief Platform dependent control structure for network statistics + */ +struct ddsrt_netstat_control; + +/** + * @brief Prepare for gathering network statistics for specified interface. + */ +DDS_EXPORT dds_return_t +ddsrt_netstat_new ( + struct ddsrt_netstat_control **control, + const char *device); + +/** + * @brief Release resources for gathering network statistics. + */ +DDS_EXPORT dds_return_t +ddsrt_netstat_free ( + struct ddsrt_netstat_control *control); + +/** + * @brief Get network statistics. + */ +DDS_EXPORT dds_return_t +ddsrt_netstat_get ( + struct ddsrt_netstat_control *control, + struct ddsrt_netstat *stats); + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_HAVE_NETSTAT */ + +#endif /* DDSRT_NETSTAT_H */ diff --git a/unitree_SDK/include/dds/ddsrt/process.h b/unitree_SDK/include/dds/ddsrt/process.h new file mode 100644 index 0000000..44d1843 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/process.h @@ -0,0 +1,74 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_PROCESS_H +#define DDSRT_PROCESS_H + +#include "dds/export.h" +#include "dds/ddsrt/time.h" +#include "dds/ddsrt/types.h" +#include "dds/ddsrt/retcode.h" + +#if DDSRT_WITH_FREERTOS +#include +#include +typedef TaskHandle_t ddsrt_pid_t; /* typedef void *TaskHandle_t */ +#define PRIdPID "p" +#define DDSRT_HAVE_MULTI_PROCESS 0 +/* DDSRT_WITH_FREERTOS */ +#elif defined(_WIN32) +typedef uint32_t ddsrt_pid_t; +#define PRIdPID PRIu32 +#define DDSRT_HAVE_MULTI_PROCESS 1 +/* _WIN32 */ +#else +#include +#if defined(_WRS_KERNEL) +typedef RTP_ID ddsrt_pid_t; /* typedef struct wind_rtp *RTP_ID */ +#define PRIdPID PRIuPTR +#define DDSRT_HAVE_MULTI_PROCESS 0 +#else +typedef pid_t ddsrt_pid_t; +#define PRIdPID "d" +#define DDSRT_HAVE_MULTI_PROCESS 1 +#endif +#endif + + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @brief Return process ID (PID) of the calling process. + * + * @returns The process ID of the calling process. + */ +DDS_EXPORT ddsrt_pid_t +ddsrt_getpid(void); + +/** + * @brief Return process name of the calling process. + * + * On linux maps to /proc/self/cmdline's first entry (argv[0]), + * on mac/windows maps to relevant API calls. Falls back to process-{pid} + * on failure. + * + * @returns The process name of the calling process. + */ +DDS_EXPORT char * +ddsrt_getprocessname(void); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_PROCESS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/random.h b/unitree_SDK/include/dds/ddsrt/random.h new file mode 100644 index 0000000..71f1d05 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/random.h @@ -0,0 +1,50 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_RANDOM_H +#define DDSRT_RANDOM_H + +#include +#include +#include +#include "dds/export.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +#define DDSRT_MT19937_N 624 + +typedef struct ddsrt_prng_seed { + uint32_t key[8]; +} ddsrt_prng_seed_t; + +typedef struct ddsrt_prng { + uint32_t mt[DDSRT_MT19937_N]; + uint32_t mti; +} ddsrt_prng_t; + +DDS_EXPORT void ddsrt_random_init (void); +DDS_EXPORT void ddsrt_random_fini (void); + +DDS_EXPORT void ddsrt_prng_init_simple (ddsrt_prng_t *prng, uint32_t seed); +DDS_EXPORT bool ddsrt_prng_makeseed (struct ddsrt_prng_seed *seed); +DDS_EXPORT void ddsrt_prng_init (ddsrt_prng_t *prng, const struct ddsrt_prng_seed *seed); +DDS_EXPORT uint32_t ddsrt_prng_random (ddsrt_prng_t *prng); +DDS_EXPORT size_t ddsrt_prng_random_name(ddsrt_prng_t *prng, char* output, size_t output_size); + +DDS_EXPORT uint32_t ddsrt_random (void); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_RANDOM_H */ diff --git a/unitree_SDK/include/dds/ddsrt/retcode.h b/unitree_SDK/include/dds/ddsrt/retcode.h new file mode 100644 index 0000000..e91c713 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/retcode.h @@ -0,0 +1,98 @@ +#ifndef DDS_RETCODE_H +#define DDS_RETCODE_H + +#include + +#include "dds/export.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef int32_t dds_return_t; + +/* + State is unchanged following a function call returning an error + other than UNSPECIFIED, OUT_OF_RESOURCES and ALREADY_DELETED. + + Error handling functions. Three components to returned int status value. + + 1 - The DDS_ERR_xxx error number + 2 - The file identifier + 3 - The line number + + All functions return >= 0 on success, < 0 on error +*/ + +/** + * @defgroup retcode (Return Codes) + * @ingroup dds + * @{ + */ +#define DDS_RETCODE_OK (0) /**< Success */ +#define DDS_RETCODE_ERROR (-1) /**< Non specific error */ +#define DDS_RETCODE_UNSUPPORTED (-2) /**< Feature unsupported */ +#define DDS_RETCODE_BAD_PARAMETER (-3) /**< Bad parameter value */ +#define DDS_RETCODE_PRECONDITION_NOT_MET (-4) /**< Precondition for operation not met */ +#define DDS_RETCODE_OUT_OF_RESOURCES (-5) /**< When an operation fails because of a lack of resources */ +#define DDS_RETCODE_NOT_ENABLED (-6) /**< When a configurable feature is not enabled */ +#define DDS_RETCODE_IMMUTABLE_POLICY (-7) /**< When an attempt is made to modify an immutable policy */ +#define DDS_RETCODE_INCONSISTENT_POLICY (-8) /**< When a policy is used with inconsistent values */ +#define DDS_RETCODE_ALREADY_DELETED (-9) /**< When an attempt is made to delete something more than once */ +#define DDS_RETCODE_TIMEOUT (-10) /**< When a timeout has occurred */ +#define DDS_RETCODE_NO_DATA (-11) /**< When expected data is not provided */ +#define DDS_RETCODE_ILLEGAL_OPERATION (-12) /**< When a function is called when it should not be */ +#define DDS_RETCODE_NOT_ALLOWED_BY_SECURITY (-13) /**< When credentials are not enough to use the function */ + + +/* Extended return codes are not in the DDS specification and are meant + exclusively for internal use and must not be returned by the C API. */ +#define DDS_XRETCODE_BASE (-50) /**< Base offset for extended return codes */ +#define DDS_XRETCODE(x) (DDS_XRETCODE_BASE - (x)) /**< Extended return code generator */ + +/** Requested resource is busy */ +#define DDS_RETCODE_IN_PROGRESS DDS_XRETCODE(1) +/** Resource unavailable, try again */ +#define DDS_RETCODE_TRY_AGAIN DDS_XRETCODE(2) +/** Operation was interrupted */ +#define DDS_RETCODE_INTERRUPTED DDS_XRETCODE(3) +/** Permission denied */ +#define DDS_RETCODE_NOT_ALLOWED DDS_XRETCODE(4) +/** Host not found */ +#define DDS_RETCODE_HOST_NOT_FOUND DDS_XRETCODE(5) +/** Network is not available */ +#define DDS_RETCODE_NO_NETWORK DDS_XRETCODE(6) +/** Connection is not available */ +#define DDS_RETCODE_NO_CONNECTION DDS_XRETCODE(7) +/* Host not reachable is used to indicate that a connection was refused + (ECONNREFUSED), reset by peer (ECONNRESET) or that a host or network cannot + be reached (EHOSTUNREACH, ENETUNREACH). Generally all system errors that + indicate a connection cannot be made or that a message cannot be delivered, + map onto host not reachable. */ +/** Not enough space available */ +#define DDS_RETCODE_NOT_ENOUGH_SPACE DDS_XRETCODE(8) +/* Not enough space is used to indicate there is not enough buffer space to + read a message from the network (i.e. EMSGSIZE), but is also used to + indicate there is not enough space left on a device, etc. */ +/** Result too large */ +#define DDS_RETCODE_OUT_OF_RANGE DDS_XRETCODE(9) +/** Not found */ +#define DDS_RETCODE_NOT_FOUND DDS_XRETCODE(10) + + +/** + * @brief Takes the error value and outputs a string corresponding to it. + * + * @param[in] ret Error value to be converted to a string + * + * @returns String corresponding to the error value + */ +DDS_EXPORT const char *dds_strretcode(dds_return_t ret); +/** + * @} + */ +#if defined (__cplusplus) +} +#endif + +#endif /* DDS_RETCODE_H */ diff --git a/unitree_SDK/include/dds/ddsrt/rusage.h b/unitree_SDK/include/dds/ddsrt/rusage.h new file mode 100644 index 0000000..fa85f7c --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/rusage.h @@ -0,0 +1,86 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_RUSAGE_H +#define DDSRT_RUSAGE_H + + +#include + +#include "dds/config.h" +#include "dds/ddsrt/time.h" +#include "dds/ddsrt/retcode.h" +#include "dds/ddsrt/threads.h" + +#if DDSRT_HAVE_RUSAGE + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct { + dds_time_t utime; /* User CPU time used. */ + dds_time_t stime; /* System CPU time used. */ + size_t maxrss; /* Maximum resident set size in bytes. */ + size_t idrss; /* Integral unshared data size. Not maintained on (at least) + Linux and Windows. */ + size_t nvcsw; /* Voluntary context switches. Not maintained on Windows. */ + size_t nivcsw; /* Involuntary context switches. Not maintained on Windows. */ +} ddsrt_rusage_t; + +enum ddsrt_getrusage_who { + DDSRT_RUSAGE_SELF, + DDSRT_RUSAGE_THREAD +}; + +/** + * @brief Get resource usage for the current thread or process. + * + * @param[in] who DDSRT_RUSAGE_SELF or DDSRT_RUSAGE_THREAD. + * @param[in] usage Structure where resource usage is returned. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Resource usage successfully returned in @usage. + * @retval DDS_RETCODE_OUT_OF_RESOURCES + * There were not enough resources to get resource usage. + * @retval DDS_RETCODE_ERROR + * An unidentified error occurred. + */ +DDS_EXPORT dds_return_t ddsrt_getrusage(enum ddsrt_getrusage_who who, ddsrt_rusage_t *usage); + +#if DDSRT_HAVE_THREAD_LIST +/** + * @brief Get resource usage for some thread. + * + * @param[in] tid id of the thread of to get the resource usage for + * @param[in] usage Structure where resource usage is returned. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Resource usage successfully returned in @usage. + * @retval DDS_RETCODE_OUT_OF_RESOURCES + * There were not enough resources to get resource usage. + * @retval DDS_RETCODE_ERROR + * An unidentified error occurred. + */ +DDS_EXPORT dds_return_t ddsrt_getrusage_anythread (ddsrt_thread_list_id_t tid, ddsrt_rusage_t * __restrict usage); +#endif + +#if defined (__cplusplus) +} +#endif + +#endif // DDSRT_HAVE_RUSAGE + +#endif // DDSRT_RUSAGE_H diff --git a/unitree_SDK/include/dds/ddsrt/sched.h b/unitree_SDK/include/dds/ddsrt/sched.h new file mode 100644 index 0000000..21bfc66 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/sched.h @@ -0,0 +1,49 @@ +/* + * Copyright(c) 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_SCHED_H +#define DDSRT_SCHED_H + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @brief Thread scheduling classes + * @{ + */ +typedef enum { + /** Schedule processes and threads according a platform default. + * DDSRT_SCHED_REALTIME for timesharing platforms and + * DDSRT_SCHED_TIMESHARE for realtime platforms + */ + DDSRT_SCHED_DEFAULT, + /** Schedule processes and threads on realtime basis, + * on most platforms implying: + * - Fixed Priority + * - Preemption + * - Either "First In First Out" or "Round Robin" + */ + DDSRT_SCHED_REALTIME, + /** Schedule processes and threads on timesharing basis, + * on most platforms implying: + * - Dynamic Priority to guarantee fair share + * - Preemption + */ + DDSRT_SCHED_TIMESHARE +} ddsrt_sched_t; +/** @} */ + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_SCHED_H */ diff --git a/unitree_SDK/include/dds/ddsrt/sockets.h b/unitree_SDK/include/dds/ddsrt/sockets.h new file mode 100644 index 0000000..576b811 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/sockets.h @@ -0,0 +1,315 @@ +#ifndef DDSRT_SOCKETS_H +#define DDSRT_SOCKETS_H + +#include + +#include "dds/export.h" +#include "dds/config.h" +#include "dds/ddsrt/types.h" +#include "dds/ddsrt/attributes.h" +#include "dds/ddsrt/retcode.h" +#include "dds/ddsrt/time.h" +#include "dds/ddsrt/misc.h" +#if _WIN32 +#include "dds/ddsrt/sockets/windows.h" +#else +#include "dds/ddsrt/sockets/posix.h" +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +#define INET_ADDRSTRLEN_EXTENDED (INET_ADDRSTRLEN + 6) /* ":12345" */ + +#if DDSRT_HAVE_IPV6 +#define INET6_ADDRSTRLEN_EXTENDED (INET6_ADDRSTRLEN + 8) /* "[]:12345" */ +extern const struct in6_addr ddsrt_in6addr_any; +extern const struct in6_addr ddsrt_in6addr_loopback; +#endif /* DDSRT_HAVE_IPV6 */ + +#define DDSRT_AF_TERM (-1) + +#if DDSRT_HAVE_GETHOSTNAME +DDS_EXPORT dds_return_t +ddsrt_gethostname( + char *hostname, + size_t buffersize); +#endif + +DDS_EXPORT dds_return_t +ddsrt_socket( + ddsrt_socket_t *sockptr, + int domain, + int type, + int protocol); + +DDS_EXPORT dds_return_t +ddsrt_close( + ddsrt_socket_t sock); + +DDS_EXPORT dds_return_t +ddsrt_connect( + ddsrt_socket_t sock, + const struct sockaddr *addr, + socklen_t addrlen); + +DDS_EXPORT dds_return_t +ddsrt_accept( + ddsrt_socket_t sock, + struct sockaddr *addr, + socklen_t *addrlen, + ddsrt_socket_t *connptr); + +DDS_EXPORT dds_return_t +ddsrt_listen( + ddsrt_socket_t sock, + int backlog); + +DDS_EXPORT dds_return_t +ddsrt_bind( + ddsrt_socket_t sock, + const struct sockaddr *addr, + socklen_t addrlen); + +DDS_EXPORT dds_return_t +ddsrt_getsockname( + ddsrt_socket_t sock, + struct sockaddr *addr, + socklen_t *addrlen); + +DDS_EXPORT dds_return_t +ddsrt_send( + ddsrt_socket_t sock, + const void *buf, + size_t len, + int flags, + ssize_t *sent); + +DDS_EXPORT dds_return_t +ddsrt_sendmsg( + ddsrt_socket_t sock, + const ddsrt_msghdr_t *msg, + int flags, + ssize_t *sent); + +DDS_EXPORT dds_return_t +ddsrt_recv( + ddsrt_socket_t sock, + void *buf, + size_t len, + int flags, + ssize_t *rcvd); + +DDS_EXPORT dds_return_t +ddsrt_recvmsg( + ddsrt_socket_t sock, + ddsrt_msghdr_t *msg, + int flags, + ssize_t *rcvd); + +DDS_EXPORT dds_return_t +ddsrt_getsockopt( + ddsrt_socket_t sock, + int32_t level, /* SOL_SOCKET */ + int32_t optname, /* SO_REUSEADDR, SO_DONTROUTE, SO_BROADCAST, SO_SNDBUF, SO_RCVBUF, ... */ + void *optval, + socklen_t *optlen); + +DDS_EXPORT dds_return_t +ddsrt_setsockopt( + ddsrt_socket_t sock, + int32_t level, /* SOL_SOCKET */ + int32_t optname, /* SO_REUSEADDR, SO_DONTROUTE, SO_BROADCAST, SO_SNDBUF, SO_RCVBUF, ... */ + const void *optval, + socklen_t optlen); + +/** + * @brief Set the I/O on the socket to blocking or non-nonblocking. + * + * @param[in] sock Socket to set I/O mode for. + * @param[in] nonblock true for nonblocking, or false for blocking I/O. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * I/O mode successfully set to (non)blocking. + * @retval DDS_RETCODE_TRY_AGAIN + * A blocking call is in progress. + * @retval DDS_RETCODE_BAD_PARAMETER + * @sock is not a valid socket. + * @retval DDS_RETCODE_ERROR + * An unknown error error occurred. + */ +DDS_EXPORT dds_return_t +ddsrt_setsocknonblocking( + ddsrt_socket_t sock, + bool nonblock); + +/** + * @brief Set whether a port may be shared with other sockets + * + * Maps to SO_REUSEPORT (if defined) followed by SO_REUSEADDR + * + * @param[in] sock Socket to set reusability for. + * @param[in] reuse Whether to allow sharing the address/port. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * SO_REUSEPORT successfully set, or not defined, + * or returned ENOPROTOOPT + * SO_REUSEADDR successfully set + * @retval DDS_RETCODE_UNSUPPORTED + * Network stack doesn't support SO_REUSEADDR and + * returned ENOPROTOOPT + * @retval DDS_RETCODE_BAD_PARAMETER + * Bad things happened (e.g., not a socket) + * @retval DDS_RETCODE_ERROR + * An unknown error occurred. + */ +DDS_EXPORT dds_return_t +ddsrt_setsockreuse( + ddsrt_socket_t sock, + bool reuse); + +/** + * @brief Monitor multiple sockets, waiting until one or more become ready. + * + * @param[in] nfds Highest-numbered file descriptor in any of the sets. + * @param[in] readfds Set of sockets to monitor for read ready status. + * @param[in] writefds Set of sockets to monitor for write ready status. + * @param[in] errorfds Set of sockets to monitor for exceptional conditions. + * @param[in] reltime Interval to block for sockets to become ready. + * + * @returns The number of sockets ready in the sets or a return code. + */ +DDS_EXPORT dds_return_t +ddsrt_select( + int32_t nfds, + fd_set *readfds, + fd_set *writefds, + fd_set *errorfds, + dds_duration_t reltime); + +#if _WIN32 +/* SOCKETs on Windows are NOT integers. The nfds parameter is only there for + compatibility, the implementation ignores it. Implicit casts will generate + warnings though, therefore ddsrt_select is redefined to discard the + parameter on Windows. */ +#define ddsrt_select(nfds, readfds, writefds, errorfds, timeout) \ + ddsrt_select(-1, readfds, writefds, errorfds, timeout) +#endif /* _WIN32 */ + +/** + * @brief Get the size of a socket address. + * + * @param[in] sa Socket address to return the size for. + * + * @returns Size of the socket address based on the address family, or 0 if + * the address family is unknown. + */ +DDS_EXPORT socklen_t +ddsrt_sockaddr_get_size( + const struct sockaddr *const sa) ddsrt_nonnull_all; + +/** + * @brief Get the port number from a socket address. + * + * @param[in] sa Socket address to retrieve the port from. + * + * @return Port number in host order. + */ +DDS_EXPORT uint16_t +ddsrt_sockaddr_get_port( + const struct sockaddr *const sa) ddsrt_nonnull_all; + +/** + * @brief Check if the given address is unspecified. + * + * @param[in] sa Socket address to check. + * + * @return true if the address is unspecified, false otherwise. + */ +DDS_EXPORT bool +ddsrt_sockaddr_isunspecified( + const struct sockaddr *__restrict sa) ddsrt_nonnull_all; + +/** + * @brief Check if the given address is a loopback address. + * + * @param[in] sa Socket address to check. + * + * @return true if the address is a loopback address, false otherwise. + */ +DDS_EXPORT bool +ddsrt_sockaddr_isloopback( + const struct sockaddr *__restrict sa) ddsrt_nonnull_all; + +/** + * @brief Check if given socket IP addresses reside in the same subnet. + * + * Checks if two socket IP addresses reside in the same subnet, considering the + * given subnetmask. IPv6 mapped IPv4 addresses are not taken in account. + * + * @param[in] sa1 First address + * @param[in] sa2 Second address. + * @param[in] mask Subnetmask. + * + * @returns true if both addresses reside in the same subnet, false otherwise. + */ +DDS_EXPORT bool +ddsrt_sockaddr_insamesubnet( + const struct sockaddr *sa1, + const struct sockaddr *sa2, + const struct sockaddr *mask) +ddsrt_nonnull_all; + +DDS_EXPORT dds_return_t +ddsrt_sockaddrfromstr( + int af, const char *str, void *sa); + +DDS_EXPORT dds_return_t +ddsrt_sockaddrtostr( + const void *sa, char *buf, size_t size); + +#if DDSRT_HAVE_DNS +DDSRT_WARNING_MSVC_OFF(4200) +typedef struct { + size_t naddrs; + struct sockaddr_storage addrs[]; +} ddsrt_hostent_t; +DDSRT_WARNING_MSVC_ON(4200) + +/** + * @brief Lookup addresses for given host name. + * + * @param[in] name Host name to resolve. + * @param[in] af Address family, either AF_INET, AF_INET6 or AF_UNSPEC. + * @param[out] hentp Structure of type ddsrt_hostent_t. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Host name successfully resolved to address(es). + * @retval DDS_RETCODE_HOST_NOT_FOUND + * Host not found. + * @retval DDS_RETCODE_NO_DATA + * Valid name, no data record of requested type. + * @retval DDS_RETCODE_ERROR + * Nonrecoverable error. + * @retval DDS_RETCODE_TRY_AGAIN + * Nonauthoratitative host not found. + */ +DDS_EXPORT dds_return_t +ddsrt_gethostbyname( + const char *name, + int af, + ddsrt_hostent_t **hentp); +#endif + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_SOCKETS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/sockets/posix.h b/unitree_SDK/include/dds/ddsrt/sockets/posix.h new file mode 100644 index 0000000..fedc2f8 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/sockets/posix.h @@ -0,0 +1,63 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_SOCKETS_POSIX_H +#define DDSRT_SOCKETS_POSIX_H + +#if DDSRT_WITH_LWIP +#include +#include +#else +#include +#include +#include +#include +#include +#include +#endif + +#include "dds/ddsrt/iovec.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef int ddsrt_socket_t; +#define DDSRT_INVALID_SOCKET (-1) +#define PRIdSOCK "d" + +#if LWIP_SOCKET +# define DDSRT_HAVE_SSM 0 +# define IFF_UP 0x1 +# define IFF_BROADCAST 0x2 +# define IFF_LOOPBACK 0x8 +# define IFF_POINTOPOINT 0x10 +# define IFF_MULTICAST 0x1000 +#elif __SunOS_5_6 +# define DDSRT_HAVE_SSM 0 +#else /* LWIP_SOCKET */ +# define DDSRT_HAVE_SSM 1 +#endif /* LWIP_SOCKET */ + +typedef struct msghdr ddsrt_msghdr_t; + +#if (defined(__sun) && !defined(_XPG4_2)) || \ + (defined(LWIP_SOCKET)) +# define DDSRT_MSGHDR_FLAGS 0 +#else +# define DDSRT_MSGHDR_FLAGS 1 +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_SOCKETS_POSIX_H */ diff --git a/unitree_SDK/include/dds/ddsrt/sockets/windows.h b/unitree_SDK/include/dds/ddsrt/sockets/windows.h new file mode 100644 index 0000000..43b5f8e --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/sockets/windows.h @@ -0,0 +1,51 @@ +#ifndef DDSRT_WINDOWS_SOCKET_H +#define DDSRT_WINDOWS_SOCKET_H + +#include +#include // Required for MSG_TRUNC when compiling with mingw-w64. +#include +#include "dds/ddsrt/iovec.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef SOCKET ddsrt_socket_t; +#define DDSRT_INVALID_SOCKET (INVALID_SOCKET) +#define PRIdSOCK PRIuPTR + +#if defined(NTDDI_VERSION) && \ + defined(_WIN32_WINNT_WS03) && \ + (NTDDI_VERSION >= _WIN32_WINNT_WS03) +#define DDSRT_HAVE_SSM 1 +#else +#define DDSRT_HAVE_SSM 0 +#endif + +#define IFF_POINTOPOINT IFF_POINTTOPOINT + +// Required when compiling with mingw-w64. +#ifndef MCAST_JOIN_SOURCE_GROUP +#define MCAST_JOIN_SOURCE_GROUP 45 +#endif +#ifndef MCAST_LEAVE_SOURCE_GROUP +#define MCAST_LEAVE_SOURCE_GROUP 46 +#endif + +typedef struct ddsrt_msghdr { + void *msg_name; + socklen_t msg_namelen; + ddsrt_iovec_t *msg_iov; + ddsrt_msg_iovlen_t msg_iovlen; + void *msg_control; + size_t msg_controllen; + int msg_flags; +} ddsrt_msghdr_t; + +#define DDSRT_MSGHDR_FLAGS 1 + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_WINDOWS_SOCKET_H */ diff --git a/unitree_SDK/include/dds/ddsrt/static_assert.h b/unitree_SDK/include/dds/ddsrt/static_assert.h new file mode 100644 index 0000000..1925a66 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/static_assert.h @@ -0,0 +1,42 @@ +/* + * Copyright(c) 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_STATIC_ASSERT_H +#define DDSRT_STATIC_ASSERT_H + +/* There are many tricks to use a constant expression to yield an + illegal type or expression at compile time, such as zero-sized + arrays and duplicate case or enum labels. So this is but one of the + many tricks. */ + +#define DDSRT_STATIC_ASSERT2(line, pred) \ + struct static_assert_##line { \ + char cond[(pred) ? 1 : -1]; \ + } +#define DDSRT_STATIC_ASSERT1(line, pred) \ + DDSRT_STATIC_ASSERT2 (line, pred) +#define DDSRT_STATIC_ASSERT(pred) \ + DDSRT_STATIC_ASSERT1 (__LINE__, pred) + +#ifndef _MSC_VER +#define DDSRT_STATIC_ASSERT_CODE(pred) do { switch(0) { case 0: case (pred): ; } } while (0) +#else +/* Temporarily disabling warning C6326: Potential comparison of a + constant with another constant. */ +#define DDSRT_STATIC_ASSERT_CODE(pred) do { \ + __pragma (warning (push)) \ + __pragma (warning (disable : 6326)) \ + switch(0) { case 0: case (pred): ; } \ + __pragma (warning (pop)) \ + } while (0) +#endif + +#endif diff --git a/unitree_SDK/include/dds/ddsrt/string.h b/unitree_SDK/include/dds/ddsrt/string.h new file mode 100644 index 0000000..61dee27 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/string.h @@ -0,0 +1,200 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_STRING_H +#define DDSRT_STRING_H + +#include "dds/export.h" +#include "dds/ddsrt/attributes.h" +#include "dds/ddsrt/retcode.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @brief Compare two strings ignoring case. + * + * @param[in] s1 String to compare. + * @param[in] s2 String to compare. + * + * @returns Zero if @s1 and @s2 match, a negative integer if @s1 is less than + * @s2 or a positive integer if @s1 is greater than @s2. + */ +DDS_EXPORT int +ddsrt_strcasecmp( + const char *s1, + const char *s2) +ddsrt_nonnull_all; + +/** + * @brief Compare two strings ignoring case, but no more than @n bytes. + * + * @param[in] s1 String to compare. + * @param[in] s2 String to compare. + * @param[in] n Maximum number of bytes to compare. + * + * @returns Zero if @s1 and @s2 match, a negative integer if @s1 is less than + * @s2 or a positive integer if @s1 is greater than @s2. + */ +DDS_EXPORT int +ddsrt_strncasecmp( + const char *s1, + const char *s2, + size_t n) +ddsrt_nonnull((1,2)); + +/** + * @brief Extract token from string. + * + * Finds the first token in @stringp delimited by one of the characters in + * @delim. The delimiter is overwritten with a null byte, terminating the + * token and @stringp is updated to point past the delimiter. + * + * @param[in,out] stringp String to extract token from. + * @param[in] delim Characters that delimit a token. + * + * @returns The original value of @stringp. + */ +DDS_EXPORT char * +ddsrt_strsep( + char **stringp, + const char *delim); + +/** + * @brief Duplicate block of memory. + * + * Copy a block of memory into a newly allocated block of memory. The memory + * is obtained with @ddsrt_malloc and must be freed with @ddsrt_free when it + * is no longer used. + * + * @param[in] ptr Pointer to block of memory to duplicate. + * @param[in] len Number of bytes to copy into newly allocated buffer. + * + * @returns A new block of memory that is a duplicate of the block pointed to + * by @ptr or NULL if not enough memory was available. + */ +DDS_EXPORT void * +ddsrt_memdup( + const void *ptr, + size_t len) +ddsrt_nonnull((1)) +ddsrt_attribute_malloc; + +/** + * @brief Duplicate string. + * + * Copy string into a newly allocated block of memory. The memory is obtained + * with @ddsrt_malloc and must be freed with @ddsrt_free when it is no longer + * used. + * + * @param[in] str String to duplicate. + * + * @returns A new string that is a duplicate of @str or NULL if not enough + * memory was available. + */ +DDS_EXPORT char * +ddsrt_strdup( + const char *str) +ddsrt_nonnull_all +ddsrt_attribute_malloc; + +/** + * @brief Duplicate at most @len bytes of string @str. + * + * Copy at most @len number of bytes into a newly allocated block of memory. + * The memory is obtained with @ddsrt_malloc and must be freed with + * @ddsrt_free when it is no longer used. + * + * @param[in] str String to duplicate. + * @param[in] len Maximum number of bytes to copy. + * + * @returns A new string that is a duplicate of @str up to @len bytes or NULL + * if not enough memory was available. + */ +DDS_EXPORT char * +ddsrt_strndup( + const char *str, + size_t len) +ddsrt_nonnull((1)) +ddsrt_attribute_malloc; + +/** + * @brief Copy string. + * + * Copy string to buffer with specified size. The string is truncated if there + * is not enough space. The resulting string is guaranteed to be null + * terminated if there is space. + * + * @param[out] dest Destination buffer. + * @param[in] src Null terminated string to copy to dest. + * @param[in] size Number of bytes available in dest. + * + * @returns Number of characters copied to dest (excluding the null byte), or + * the number of characters that would have been copied if dest is not + * sufficiently large enough. + */ +DDS_EXPORT +size_t +ddsrt_strlcpy( + char * __restrict dest, + const char * __restrict src, + size_t size) +ddsrt_nonnull((1,2)); + +/** + * @brief Concatenate strings. + * + * Append the string specified by src to the string specified by dest. The + * terminating null byte at the end of dest is overwritten. The resulting + * string is truncated if there is not enough space. The resulting string + * guaranteed to be null terminated if there is space. + * + * @param[in,out] dest Destination buffer. + * @param[in] src Null terminated string to append to dest. + * @param[in] size Number of bytes available in dest. + * + * @returns Number of characters copied to dest (excluding the null byte), or + * the number of characters that would have been copied if dest is not + * sufficiently large enough. + */ +DDS_EXPORT +size_t +ddsrt_strlcat( + char * __restrict dest, + const char * __restrict src, + size_t size) +ddsrt_nonnull((1,2)); + +/** + * @brief Replace substring of null terminated string + * + * @param[in] str pointer to string + * @param[in] srch non-empty string to replace + * @param[in] subst string to substitute character "srch" with + * @param[in] max maximum number of times to replace search, or 0 for unlimited + * + * @returns Pointer to newly allocated string with max occurrences of srch replaced, or + * NULL on allocation failure or if srch is an empty string. + */ +DDS_EXPORT char * +ddsrt_str_replace( + const char *str, + const char *srch, + const char *subst, + size_t max) +ddsrt_nonnull_all; + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_STRING_H */ diff --git a/unitree_SDK/include/dds/ddsrt/strtod.h b/unitree_SDK/include/dds/ddsrt/strtod.h new file mode 100644 index 0000000..6a839ba --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/strtod.h @@ -0,0 +1,83 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +/** + * @file strtod.h + * @brief Floating-point number to/from string conversion functions. + * + * Locale independent versions of the floating-point number conversion + * functions found in the standard library. + */ +#ifndef DDSRT_STRTOD_H +#define DDSRT_STRTOD_H + +#include "dds/export.h" +#include "dds/ddsrt/retcode.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @brief Convert a string to a double precision floating point number. + * + * @param[in] nptr A string to convert into a double. + * @param[out] endptr If not NULL, a char* where the address of first invalid + * character is stored. + * @param[out] dblptr A double where the result is stored. + * + * @returns A dds_return_t indicating success or failure. + */ +DDS_EXPORT dds_return_t +ddsrt_strtod(const char *nptr, char **endptr, double *dblptr); + +/** + * @brief Convert a string to a floating point number. + * + * @param[in] nptr A string to convert into a float. + * @param[in] endptr If not NULL, a char* where the address of first invalid + * character is stored. + * @param[out] fltptr A float where the floating-point number is stored. + * + * @returns A dds_return_t indicating success or failure. + */ +DDS_EXPORT dds_return_t +ddsrt_strtof(const char *nptr, char **endptr, float *fltptr); + +/** + * @brief Convert a double-precision floating-point number to a string. + * + * @param[in] src Double-precision floating-point number to convert. + * @param[in] str Buffer where string representation is written. + * @param[in] size Number of bytes available in @str. + * + * @returns The number of bytes written (excluding the null terminating byte). + */ +DDS_EXPORT int +ddsrt_dtostr(double src, char *str, size_t size); + +/** + * @brief convert a floating-point number to a string. + * + * @param[in] src Floating-point number to conver. + * @param[in] str Buffer where string representation is written. + * @param[in] size Number of bytes available in @str. + * + * @returns The number of bytes written (exluding the null terminating byte). + */ +DDS_EXPORT int +ddsrt_ftostr(float src, char *str, size_t size); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_STRTOD_H */ diff --git a/unitree_SDK/include/dds/ddsrt/strtol.h b/unitree_SDK/include/dds/ddsrt/strtol.h new file mode 100644 index 0000000..c7b5073 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/strtol.h @@ -0,0 +1,181 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_STRTOL_H +#define DDSRT_STRTOL_H + +#include + +#include "dds/export.h" +#include "dds/ddsrt/retcode.h" + +#if defined(__cplusplus) +extern "C" { +#endif + +/** + * @brief Convert a character to an integer value + * + * Translates the numeric value of the provided character. For characters in range + * '0' to '9' the returned integer value is 0-9. For the range 'a' to 'z' and 'A' + * to 'Z', the numeric return value is 10-36. + * + * @param[in] chr The character + * + * @returns The integer value for the character, or -1 in case @chr cannot be translated to a numeric value + */ +DDS_EXPORT int32_t ddsrt_todigit(const int chr); + +/** + * @brief Convert a string to a long long integer. + * + * Translate @str to a long long integer considering base, and sign. If @base + * is 0, base is determined from @str. A prefix of "0x" or "0X" will cause the + * number be read in base 16 (hexadecimal), otherwise base 10 (decimal) is + * used, unless the first character is '0', in which case the number will be + * read in base 8 (octal). + * + * @param[in] str String to convert into a number. + * @param[out] endptr If not NULL, a char* where the address of first invalid + * character is stored. + * @param[in] base Base to use. Must be a base between 2 and 36, or 0 to + * determine from @str. + * @param[out] llng A long long integer where the number is stored. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * String successfully converted to an integer. + * @retval DDS_RETCODE_BAD_PARAMETER + * Base is invalid. + * @retval DDS_RETCODE_OUT_OF_RANGE + * String converted to an integer, but was out of range. + */ +DDS_EXPORT dds_return_t +ddsrt_strtoll( + const char *str, + char **endptr, + int32_t base, + long long *llng); + +/** + * @brief Convert a string to an unsigned long long integer. + * + * Translate @str to an unsigned long long integer considering base, and sign. + * If @base is 0, base is determined from @str. A prefix of "0x" or "0X" will + * cause the number be read in base 16 (hexadecimal), otherwise base 10 + * (decimal) is used, unless the first character is '0', in which case the + * number will be read in base 8 (octal). + * + * @param[in] str String to convert into a number. + * @param[out] endptr If not NULL, a char* where the address of first invalid + * character is stored. + * @param[in] base Base to use. Must be a base between 2 and 36, or 0 to + * determine from @str. + * @param[out] ullng A long long integer where the number is stored. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * String successfully converted to an integer. + * @retval DDS_RETCODE_BAD_PARAMETER + * Base is invalid. + * @retval DDS_RETCODE_OUT_OF_RANGE + * String converted to an integer, but was out of range. + */ +DDS_EXPORT dds_return_t +ddsrt_strtoull( + const char *str, + char **endptr, + int32_t base, + unsigned long long *ullng); + +/** + * @brief Convert a string to a long long integer. + * + * @param[in] str String to convert into a long long integer. + * @param[in] llng A long long integer where the number is stored. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * String successfully converted to an integer. + * @retval DDS_RETCODE_BAD_PARAMETER + * Base is invalid. + * @retval DDS_RETCODE_OUT_OF_RANGE + * String converted to an integer, but was out of range. + */ +DDS_EXPORT dds_return_t +ddsrt_atoll( + const char *str, + long long *llng); + +/** + * @brief Convert a string to an unsigned long long integer. + * + * @param[in] str String to conver into an unsigned long long integer. + * @param[out] ullng An unsigned long long integer where the number is stored. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * String successfully converted to an integer. + * @retval DDS_RETCODE_BAD_PARAMETER + * Base is invalid. + * @retval DDS_RETCODE_OUT_OF_RANGE + * String converted to an integer, but was out of range. + */ +DDS_EXPORT dds_return_t +ddsrt_atoull( + const char *str, + unsigned long long *ullng); + +/** + * @brief Convert a long long integer into a string. + * + * @param[in] num Long long integer to convert into a string. + * @param[in] str Buffer where string representation is written. + * @param[in] len Number of bytes available in buffer. + * @param[out] endptr A char* where the address of the null terminating byte + * is stored. + * + * @returns The value of @str on success, otherwise NULL. + */ +DDS_EXPORT char * +ddsrt_lltostr( + long long num, + char *str, + size_t len, + char **endptr); + +/** + * @brief Convert an unsigned long long integer into a string. + * + * @param[in] num Unsigned long long integer to covert into a string. + * @param[in] str Buffer where string representation is stored. + * @param[in] len Number of bytes available in buffer. + * @param[out] endptr A char* where the adress of the null terminating byte + * is stored. + * + * @returns The value of @str on success, otherwise NULL. + */ +DDS_EXPORT char * +ddsrt_ulltostr( + unsigned long long num, + char *str, + size_t len, + char **endptr); + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_STRTOL_H */ diff --git a/unitree_SDK/include/dds/ddsrt/sync.h b/unitree_SDK/include/dds/ddsrt/sync.h new file mode 100644 index 0000000..d31029b --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/sync.h @@ -0,0 +1,302 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_SYNC_H +#define DDSRT_SYNC_H + +#include + +#include "dds/ddsrt/time.h" +#include "dds/ddsrt/retcode.h" +#include "dds/ddsrt/attributes.h" + +#if DDSRT_WITH_FREERTOS +#include "dds/ddsrt/sync/freertos.h" +#elif _WIN32 +#include "dds/ddsrt/sync/windows.h" +#elif __SunOS_5_6 +#include "dds/ddsrt/sync/solaris2.6.h" +#else +#include "dds/ddsrt/sync/posix.h" +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +/** + * @brief Initialize a mutex. + * + * @param[in] mutex Mutex to itialize. + */ +DDS_EXPORT void +ddsrt_mutex_init( + ddsrt_mutex_t *mutex) +ddsrt_nonnull_all; + +/** + * @brief Destroy a mutex. + * + * @param[in] mutex Mutex to destroy. + */ +DDS_EXPORT void +ddsrt_mutex_destroy( + ddsrt_mutex_t *mutex) +ddsrt_nonnull_all; + +/** + * @brief Acquire a mutex. + * + * @param[in] mutex Mutex to acquire. + */ +DDS_EXPORT void +ddsrt_mutex_lock( + ddsrt_mutex_t *mutex) +ddsrt_nonnull_all; + +/** + * @brief Acquire a mutex if it is not already acquired. + * + * @param[in] mutex Mutex to acquire. + * + * @returns true if the mutex was acquired, false otherwise. + */ +DDS_EXPORT bool +ddsrt_mutex_trylock( + ddsrt_mutex_t *mutex) +ddsrt_nonnull_all +ddsrt_attribute_warn_unused_result; + +/** + * @brief Release an acquired mutex. + * + * @param[in] mutex Mutex to release. + */ +DDS_EXPORT void +ddsrt_mutex_unlock ( + ddsrt_mutex_t *mutex) +ddsrt_nonnull_all; + +/** + * @brief Initialize a condition variable. + * + * @param[in] cond Condition variable to initialize. + */ +DDS_EXPORT void +ddsrt_cond_init( + ddsrt_cond_t *cond) +ddsrt_nonnull_all; + +/** + * @brief Destroy a condition variable. + * + * @param[in] cond Condition variable to destroy. + */ +DDS_EXPORT void +ddsrt_cond_destroy( + ddsrt_cond_t *cond) +ddsrt_nonnull_all; + +/** + * @brief Wait for a condition variable to be signalled. + * + * @param[in] cond Condition variable to block on. + * @param[in] mutex Mutex to associate with condition variable. + * + * @pre The calling thread must hold the mutex specified by @mutex. + * + * @post The calling thread will hold the mutex specified by @mutex. + */ +DDS_EXPORT void +ddsrt_cond_wait( + ddsrt_cond_t *cond, + ddsrt_mutex_t *mutex) +ddsrt_nonnull_all; + +/** + * @brief Wait until @abstime for a condition variable to be signalled. + * + * @param[in] cond Condition variable to block on. + * @param[in] mutex Mutex to associate with condition variable. + * @param[in] abstime Time in nanoseconds since UNIX Epoch. + * + * @pre The calling thread must hold the mutex specified by @mutex. + * + * @post The calling thread will hold the mutex specified by @mutex. + * + * @returns false if the condition variable was not signalled before the + * absolute time specified by @abstime passed, otherwise true. + */ +DDS_EXPORT bool +ddsrt_cond_waituntil( + ddsrt_cond_t *cond, + ddsrt_mutex_t *mutex, + dds_time_t abstime) +ddsrt_nonnull((1,2)); + +/** + * @brief Wait for @reltime for a condition variable to be signalled. + * + * @param[in] cond Condition variable to block on. + * @param[in] mutex Mutex to associate with condition variable. + * @param[in] reltime Time in nanoseconds since UNIX Epoch. + * + * @pre The calling thread must hold the mutex specified by @mutex. + * + * @post The calling thread will hold the mutex specified by @mutex. + * + * @returns false if the condition variable was not signalled before the + * relative time specified by @reltime passed, otherwise true. + */ +DDS_EXPORT bool +ddsrt_cond_waitfor( + ddsrt_cond_t *cond, + ddsrt_mutex_t *mutex, + dds_duration_t reltime) +ddsrt_nonnull((1,2)); + +/** + * @brief Signal a condition variable and unblock at least one thread. + * + * @param[in] cond Condition variable to signal. + * + * @pre The mutex associated with the condition in general should be acquired + * by the calling thread before setting the condition state and + * signalling. + */ +DDS_EXPORT void +ddsrt_cond_signal( + ddsrt_cond_t *cond) +ddsrt_nonnull_all; + +/** + * @brief Signal a condition variable and unblock all threads. + * + * @param[in] cond Condition variable to signal. + * + * @pre The mutex associated with the condition in general should be acquired + * by the calling thread before setting the condition state and + * signalling + */ +DDS_EXPORT void +ddsrt_cond_broadcast( + ddsrt_cond_t *cond) +ddsrt_nonnull_all; + +/** + * @brief Initialize a read-write lock. + * + * @param[in] rwlock Read-write lock to initialize. + */ +DDS_EXPORT void +ddsrt_rwlock_init( + ddsrt_rwlock_t *rwlock) +ddsrt_nonnull_all; + +/** + * @brief Destroy a read-write lock. + * + * @param[in] rwlock Read-write lock to destroy. + */ +DDS_EXPORT void +ddsrt_rwlock_destroy( + ddsrt_rwlock_t *rwlock); + +/** + * @brief Acquire a read-write lock for reading. + * + * @param[in] rwlock Read-write lock to acquire. + * + * @post Data related to the critical section must not be changed by the + * calling thread. + */ +DDS_EXPORT void +ddsrt_rwlock_read( + ddsrt_rwlock_t *rwlock) +ddsrt_nonnull_all; + +/** + * @brief Acquire a read-write lock for writing. + * + * @param[in] rwlock Read-write lock to acquire. + */ +DDS_EXPORT void +ddsrt_rwlock_write( + ddsrt_rwlock_t *rwlock) +ddsrt_nonnull_all; + +/** + * @brief Try to acquire a read-write lock for reading. + * + * Try to acquire a read-write lock while for reading, immediately return if + * the lock is already exclusively acquired by another thread. + * + * @param[in] rwlock Read-write lock to aqcuire. + * + * @post Data related to the critical section must not changed by the + * calling thread. + * + * @returns true if the lock was acquired, otherwise false. + */ +DDS_EXPORT bool +ddsrt_rwlock_tryread( + ddsrt_rwlock_t *rwlock) +ddsrt_nonnull_all +ddsrt_attribute_warn_unused_result; + +/** + * @brief Try to acquire a read-write lock for writing. + * + * Try to acquire a read-write lock for writing, immediately return if the + * lock is already acquired, either for reading or writing, by another thread. + * + * @param[in] rwlock Read-write lock to acquire. + * + * @returns true if the lock was acquired, otherwise false. + */ +DDS_EXPORT bool +ddsrt_rwlock_trywrite( + ddsrt_rwlock_t *rwlock) +ddsrt_nonnull_all +ddsrt_attribute_warn_unused_result; + +/** + * @brief Release a previously acquired read-write lock. + * + * @param[in] rwlock Read-write lock to release. + */ +DDS_EXPORT void +ddsrt_rwlock_unlock( + ddsrt_rwlock_t *rwlock) +ddsrt_nonnull_all; + +/* Initialization callback used by ddsrt_once */ +typedef void (*ddsrt_once_fn)(void); + +/** + * @brief Invoke init_fn exactly once for a given control. + * + * The first thread to call this function with a given control will call the + * function specified by @init_fn with no arguments. All following calls with + * the same control will not call the specified function. + * + * @pre The control parameter is properly initialized with DDSRT_ONCE_INIT. + */ +DDS_EXPORT void +ddsrt_once( + ddsrt_once_t *control, + ddsrt_once_fn init_fn); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_SYNC_H */ diff --git a/unitree_SDK/include/dds/ddsrt/sync/freertos.h b/unitree_SDK/include/dds/ddsrt/sync/freertos.h new file mode 100644 index 0000000..591cbcd --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/sync/freertos.h @@ -0,0 +1,93 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_SYNC_FREERTOS_H +#define DDSRT_SYNC_FREERTOS_H + +#include +#include +#include +#include + +#include "dds/ddsrt/atomics.h" + +#if (INCLUDE_vTaskSuspend != 1) +/* INCLUDE_vTaskSuspend must be set to 1 to make xSemaphoreTake wait + indefinitely when passed portMAX_DELAY. See reference manual. */ +#error "INCLUDE_vTaskSuspend != 1 in FreeRTOSConfig.h" +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct { + SemaphoreHandle_t sem; +} ddsrt_mutex_t; + +typedef struct { + size_t len; + size_t cnt; + size_t off; + size_t end; + TaskHandle_t *tasks; +} ddsrt_tasklist_t; + +typedef struct { + SemaphoreHandle_t sem; + ddsrt_tasklist_t tasks; +} ddsrt_cond_t; + +/* This readers-writer lock implementation does not prefer writers over readers + or vice versa. Multiple readers are allowed to hold the lock simultaneously + and can acquire it directly if no writers are queued. However, if a writer + is queued, new readers and writers are queued behind it in order. Any reader + that acquires the lock after a writer frees it, notifies the next task. If + that task tries to acquire a write lock it waits until the reader frees the + lock. However, if the task tries to acquire a read lock it will succeed, and + notify the next task, etc. */ +typedef struct { + SemaphoreHandle_t sem; + ddsrt_tasklist_t tasks; + int32_t state; + uint32_t cnt; + uint32_t rdcnt; + uint32_t wrcnt; +} ddsrt_rwlock_t; + +typedef ddsrt_atomic_uint32_t ddsrt_once_t; +#define DDSRT_ONCE_INIT { .v = (1<<0) /* ONCE_NOT_STARTED */ } + + +/* The declarations below are here for tests and must be considered private. */ + +/* Number of buckets to grow buffer by. */ +#define DDSRT_TASKLIST_CHUNK (5) +/* Number of buckets to allocate initially. */ +#define DDSRT_TASKLIST_INITIAL (DDSRT_TASKLIST_CHUNK * 2) + +int ddsrt_tasklist_init(ddsrt_tasklist_t *list); +void ddsrt_tasklist_fini(ddsrt_tasklist_t *list); +void ddsrt_tasklist_ltrim(ddsrt_tasklist_t *list); +void ddsrt_tasklist_rtrim(ddsrt_tasklist_t *list); +void ddsrt_tasklist_pack(ddsrt_tasklist_t *list); +int ddsrt_tasklist_shrink(ddsrt_tasklist_t *list); +int ddsrt_tasklist_grow(ddsrt_tasklist_t *list); +ssize_t ddsrt_tasklist_find(ddsrt_tasklist_t *list, TaskHandle_t task); +TaskHandle_t ddsrt_tasklist_peek(ddsrt_tasklist_t *list, TaskHandle_t task); +TaskHandle_t ddsrt_tasklist_pop(ddsrt_tasklist_t *list, TaskHandle_t task); +int ddsrt_tasklist_push(ddsrt_tasklist_t *list, TaskHandle_t task); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_SYNC_FREERTOS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/sync/posix.h b/unitree_SDK/include/dds/ddsrt/sync/posix.h new file mode 100644 index 0000000..d398821 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/sync/posix.h @@ -0,0 +1,48 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_POSIX_SYNC_H +#define DDSRT_POSIX_SYNC_H + +#include +#include +#if HAVE_LKST +#include "lkst.h" +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct { + pthread_cond_t cond; +} ddsrt_cond_t; + +typedef struct { + pthread_mutex_t mutex; +} ddsrt_mutex_t; + +typedef struct { +#if __SunOS_5_6 + pthread_mutex_t rwlock; +#else + pthread_rwlock_t rwlock; +#endif +} ddsrt_rwlock_t; + +typedef pthread_once_t ddsrt_once_t; +#define DDSRT_ONCE_INIT PTHREAD_ONCE_INIT + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_POSIX_SYNC_H */ diff --git a/unitree_SDK/include/dds/ddsrt/sync/windows.h b/unitree_SDK/include/dds/ddsrt/sync/windows.h new file mode 100644 index 0000000..b93b5e9 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/sync/windows.h @@ -0,0 +1,39 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_WINDOWS_SYNC_H +#define DDSRT_WINDOWS_SYNC_H + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct { + CONDITION_VARIABLE cond; +} ddsrt_cond_t; + +typedef struct { + SRWLOCK lock; +} ddsrt_mutex_t; + +typedef struct os_rwlock { + SRWLOCK lock; + int state; /* -1: exclusive, 0: free, 1: shared */ +} ddsrt_rwlock_t; + +typedef INIT_ONCE ddsrt_once_t; +#define DDSRT_ONCE_INIT INIT_ONCE_STATIC_INIT + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_WINDOWS_SYNC_H */ diff --git a/unitree_SDK/include/dds/ddsrt/threads.h b/unitree_SDK/include/dds/ddsrt/threads.h new file mode 100644 index 0000000..e20100f --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/threads.h @@ -0,0 +1,298 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +/** + * @file threads.h + * @brief Thread management and creation. + * + * Platform independent interface for managing and creating execution threads. + */ +#ifndef DDSRT_THREADS_H +#define DDSRT_THREADS_H + +#include +#include + +#include "dds/config.h" +#include "dds/export.h" +#include "dds/ddsrt/attributes.h" +#include "dds/ddsrt/retcode.h" +#include "dds/ddsrt/sched.h" + +#if DDSRT_WITH_FREERTOS +#include "dds/ddsrt/threads/freertos.h" +#elif _WIN32 +#include "dds/ddsrt/threads/windows.h" +#else +#include "dds/ddsrt/threads/posix.h" +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +#if defined(_MSC_VER) || __MINGW__ + /* Thread-local storage using __declspec(thread) on Windows versions before + Vista and Server 2008 works in DLLs if they are bound to the executable, + it does not work if the library is loaded using LoadLibrary. */ +#define ddsrt_thread_local __declspec(thread) +#elif defined(__GNUC__) || (defined(__clang__) && __clang_major__ >= 2) + /* GCC supports Thread-local storage for x86 since version 3.3. Clang + supports Thread-local storage since version 2.0. */ + /* VxWorks 7 supports __thread for both GCC and DIAB, older versions may + support it as well, but that is not verified. */ +#define ddsrt_thread_local __thread +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +#define ddsrt_thread_local __thread +#else +#error "Thread-local storage is not supported" +#endif + +/** + * @brief Definition for a thread routine invoked on thread create. + */ +typedef uint32_t (*ddsrt_thread_routine_t)(void*); + +/** + * @brief Definition of the thread attributes + */ +typedef struct { + /** Specifies the scheduling class */ + ddsrt_sched_t schedClass; + /** Specifies the thread priority */ + int32_t schedPriority; + /** Specifies the thread stack size */ + uint32_t stackSize; +} ddsrt_threadattr_t; + +/** + * @brief Initialize thread attributes to platform defaults. + */ +DDS_EXPORT void +ddsrt_threadattr_init( + ddsrt_threadattr_t *attr) +ddsrt_nonnull_all; + +/** + * @brief Create a new thread. + * + * Creates a new thread of control that executes concurrently with + * the calling thread. The new thread applies the function start_routine + * passing it arg as first argument. + * + * The new thread terminates by returning from the start_routine function. + * The created thread is identified by the returned threadId. + * + * @param[out] thread Location where thread id is stored. + * @param[in] name Name assigned to created thread. + * @param[in] attr Attributes to create thread with. + * @param[in] start_routine Function to execute in created thread. + * @param[in] arg Argument passed to @start_routine. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Thread successfully created. + * @retval DDS_RETCODE_ERROR + * Thread could not be created. + */ +DDS_EXPORT dds_return_t +ddsrt_thread_create( + ddsrt_thread_t *thread, + const char *name, + const ddsrt_threadattr_t *attr, + ddsrt_thread_routine_t start_routine, + void *arg) +ddsrt_nonnull((1,2,3,4)); + +/** + * @brief Retrieve integer representation of the given thread id. + * + * @returns The integer representation of the current thread. + */ +DDS_EXPORT ddsrt_tid_t +ddsrt_gettid(void); + +/** + * @brief Retrieve integer representation of the given thread id. + * + * @returns The integer representation of the given thread. + */ +DDS_EXPORT ddsrt_tid_t +ddsrt_gettid_for_thread( ddsrt_thread_t thread); + + +/** + * @brief Return thread ID of the calling thread. + * + * @returns Thread ID of the calling thread. + */ +DDS_EXPORT ddsrt_thread_t +ddsrt_thread_self(void); + +/** + * @brief Compare thread identifiers. + * + * @returns true if thread ids match, otherwise false. + */ +DDS_EXPORT bool +ddsrt_thread_equal(ddsrt_thread_t t1, ddsrt_thread_t t2); + +/** + * @brief Wait for termination of the specified thread. + * + * If the specified thread is still running, wait for its termination + * else return immediately. In thread_result it returns the exit status + * of the thread. If NULL is passed for @thread_result, no exit status is + * returned, but ddsrt_thread_join still waits for the thread to terminate. + * + * @param[in] thread Id of thread to wait for. + * @param[out] thread_result Location where thread result is stored. + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Target thread terminated. + * @retval DDS_RETCODE_ERROR + * An error occurred while waiting for the thread to terminate. + */ +DDS_EXPORT dds_return_t +ddsrt_thread_join( + ddsrt_thread_t thread, + uint32_t *thread_result); + +/** + * @brief Get name of current thread. + * + * @param[in] name Buffer where the name is copied to. + * @param[in] size Number of bytes available in the buffer. + * + * @returns The number of bytes (excluding the null terminating bytes) that + * are written. If the buffer is not sufficiently large enough, the + * name is truncated and the number of bytes that would have been + * written is returned. + */ +DDS_EXPORT size_t +ddsrt_thread_getname( + char *__restrict name, + size_t size); + +/** + * @brief Set name of current thread. + * + * Set name of the current thread to @name. If the name is longer than the + * platform maximum, it is silently truncated. + * + * @param[in] name Name for current thread. + */ +#if DDSRT_HAVE_THREAD_SETNAME +DDS_EXPORT void +ddsrt_thread_setname( + const char *__restrict name); +#endif + +#if DDSRT_HAVE_THREAD_LIST +/** + * @brief Get a list of threads in the calling process + * + * @param[out] tids Array of size elements to be filled with thread + * identifiers, may be NULL if size is 0 + * @param[in] size The size of the tids array; 0 is allowed + * + * @returns A dds_return_t indicating the number of threads in the process + * or an error code on failure. + * + * @retval > 0 + * Number of threads in the process, may be larger than size + * tids[0 .. (return - 1)] are valid + * @retval DDS_RETCODE_ERROR + * Something went wrong, contents of tids is undefined + * @retval DDS_RETCODE_UNSUPPORTED + * Not supported on the platform + */ +DDS_EXPORT dds_return_t ddsrt_thread_list (ddsrt_thread_list_id_t * __restrict tids, size_t size); + +/** + * @brief Get the name of the specified thread (in the calling process) + * + * @param[in] tid Thread identifier for which the name is sought + * @param[out] name Filled with the thread name (or a synthesized one) + * on successful return; name is silently truncated + * if the actual name is longer than name can hold; + * always 0-terminated if size > 0 + * @param[in] size Number of bytes of name that may be assigned, size + * is 0 is allowed, though somewhat useless + * + * @returns A dds_return_t indicating success or failure. + * + * @retval DDS_RETCODE_OK + * Possibly truncated name is returned as a null-terminated + * string in name (provided size > 0). + * @retval DDS_RETCODE_NOT_FOUND + * Thread not found; the contents of name is unchanged + * @retval DDS_RETCODE_ERROR + * Unspecified failure, the contents of name is undefined + * @retval DDS_RETCODE_UNSUPPORTED + * Not supported on the platform + */ +DDS_EXPORT dds_return_t ddsrt_thread_getname_anythread (ddsrt_thread_list_id_t tid, char *__restrict name, size_t size); +#endif + +/** + * @brief Push cleanup handler onto the cleanup stack + * + * Push a cleanup handler onto the top of the calling thread's cleanup + * stack. The cleanup handler will be popped of the thread's cleanup stack + * and invoked with the specified argument when the thread exits. + * + * @param[in] routine Cleanup handler to push onto the thread cleanup stack. + * @param[in] arg Argument that will be passed to the cleanup handler. + */ +DDS_EXPORT dds_return_t +ddsrt_thread_cleanup_push( + void (*routine)(void*), + void *arg); + +/** + * @brief Pop cleanup handler from the top of the cleanup stack + * + * Remove routine at the top of the calling thread's cleanup stack and + * optionally invoke it (if execute is non-zero). + */ +DDS_EXPORT dds_return_t +ddsrt_thread_cleanup_pop( + int execute); + +/** + * @brief Initialize thread internals. + * + * Initialize internals for threads not created with @ddsrt_create_thread. By + * default initialization is done automatically. + */ +DDS_EXPORT void +ddsrt_thread_init(uint32_t reason); + +/** + * @brief Free thread resources and execute cleanup handlers. + * + * Platforms that support it, automatically free resources claimed by the + * current thread and call any registered cleanup routines. This function only + * needs to be called on platforms that do not support thread destructors and + * only for threads that were not created with @ddsrt_thread_create. + */ +DDS_EXPORT void +ddsrt_thread_fini(uint32_t reason); + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_THREADS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/threads/freertos.h b/unitree_SDK/include/dds/ddsrt/threads/freertos.h new file mode 100644 index 0000000..1f682f9 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/threads/freertos.h @@ -0,0 +1,37 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_THREADS_FREERTOS_H +#define DDSRT_THREADS_FREERTOS_H + +#include +#include + +#define DDSRT_HAVE_THREAD_SETNAME (0) +#define DDSRT_HAVE_THREAD_LIST (0) + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef struct { + TaskHandle_t task; +} ddsrt_thread_t; + +typedef UBaseType_t ddsrt_tid_t; +typedef TaskHandle_t ddsrt_thread_list_id_t; +#define PRIdTID "lu" + +#if defined(__cplusplus) +} +#endif + +#endif /* DDSRT_THREADS_FREERTOS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/threads/posix.h b/unitree_SDK/include/dds/ddsrt/threads/posix.h new file mode 100644 index 0000000..75b3aa9 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/threads/posix.h @@ -0,0 +1,73 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_POSIX_THREAD_H +#define DDSRT_POSIX_THREAD_H + +#include + +#if defined(__VXWORKS__) +#define DDSRT_HAVE_THREAD_SETNAME (0) +#else +#define DDSRT_HAVE_THREAD_SETNAME (1) +#endif +#if defined (__linux) || defined (__APPLE__) +#define DDSRT_HAVE_THREAD_LIST (1) +#else +#define DDSRT_HAVE_THREAD_LIST (0) +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +#if defined(__linux) +typedef long int ddsrt_tid_t; +#define PRIdTID "ld" +typedef long int ddsrt_thread_list_id_t; +/* __linux */ +#elif defined(__FreeBSD__) && (__FreeBSD__ >= 9) +/* FreeBSD >= 9.0 */ +typedef int ddsrt_tid_t; +#define PRIdTID "d" +/* __FreeBSD__ */ +#elif defined(__APPLE__) && !(defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ + __MAC_OS_X_VERSION_MIN_REQUIRED < 1060) +/* macOS X >= 10.6 */ +typedef uint64_t ddsrt_tid_t; +#define PRIdTID PRIu64 +/* ddsrt_thread_list_id_t is actually a mach_port_t */ +typedef uint32_t ddsrt_thread_list_id_t; +/* __APPLE__ */ +#elif defined(__VXWORKS__) +/* TODO: Verify taskIdSelf is the right function to use on VxWorks */ +typedef TASK_ID ddsrt_tid_t; +# if defined(_WRS_CONFIG_LP64) +# define PRIdPID PRIuPTR /* typedef struct windTcb *TASK_ID */ +# else +# define PRIdPID "d" /* typedef int TASK_ID */ +# endif +/* __VXWORKS__ */ +#else +typedef uintptr_t ddsrt_tid_t; +#define PRIdTID PRIuPTR +#endif + +/* Wrapped in a struct to force conformation to abstraction. */ +typedef struct { + pthread_t v; +} ddsrt_thread_t; + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_POSIX_THREAD_H */ diff --git a/unitree_SDK/include/dds/ddsrt/threads/windows.h b/unitree_SDK/include/dds/ddsrt/threads/windows.h new file mode 100644 index 0000000..39c6a32 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/threads/windows.h @@ -0,0 +1,38 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_WINDOWS_THREADS_H +#define DDSRT_WINDOWS_THREADS_H + +#include "dds/ddsrt/types.h" + +#define DDSRT_HAVE_THREAD_SETNAME (1) +#define DDSRT_HAVE_THREAD_LIST (1) + +#if defined (__cplusplus) +extern "C" { +#endif + +typedef struct { + DWORD tid; + HANDLE handle; +} ddsrt_thread_t; + +typedef uint32_t ddsrt_tid_t; +#define PRIdTID PRIu32 + +typedef HANDLE ddsrt_thread_list_id_t; + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_WINDOWS_THREADS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/time.h b/unitree_SDK/include/dds/ddsrt/time.h new file mode 100644 index 0000000..f4f13e0 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/time.h @@ -0,0 +1,307 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +/** + * @file + * @brief DDS C Time support API + * + * This header file defines the public API of the in the + * CycloneDDS C language binding. + */ +#ifndef DDS_TIME_H +#define DDS_TIME_H + +#include +#include + +#include "dds/export.h" +#include "dds/config.h" +#include "dds/ddsrt/types.h" + +#if defined (__cplusplus) +extern "C" { +#endif + +/* + Times are represented using a 64-bit signed integer, encoding + nanoseconds since the epoch. Considering the nature of these + systems, one would best use TAI, International Atomic Time, rather + than something UTC, but availability may be limited. + + Valid times are non-negative and times up to 2**63-2 can be + represented. 2**63-1 is defined to represent, essentially, "never". + This is good enough for a couple of centuries. +*/ + +/** Absolute Time definition */ +typedef int64_t dds_time_t; + +/** Relative Time definition in nanoseconds */ +typedef int64_t dds_duration_t; + +/** @name Macro definition for time units in nanoseconds. + @{**/ +#define DDS_NSECS_IN_SEC INT64_C(1000000000) +#define DDS_NSECS_IN_MSEC INT64_C(1000000) +#define DDS_NSECS_IN_USEC INT64_C(1000) +/** @}*/ + +/** @name Infinite timeout for indicate absolute time */ +#define DDS_NEVER ((dds_time_t) INT64_MAX) + +/** @name Infinite timeout for relative time */ +#define DDS_INFINITY ((dds_duration_t) INT64_MAX) + +/** @name Invalid time value for assigning to time output when something goes wrong */ +#define DDS_TIME_INVALID ((dds_time_t) INT64_MIN) + +/** @name Invalid duration value */ +#define DDS_DURATION_INVALID ((dds_duration_t) INT64_MIN) + +/** @name Macro definition for time conversion to nanoseconds + @{**/ +#define DDS_SECS(n) ((n) * DDS_NSECS_IN_SEC) +#define DDS_MSECS(n) ((n) * DDS_NSECS_IN_MSEC) +#define DDS_USECS(n) ((n) * DDS_NSECS_IN_USEC) +/** @}*/ + +typedef struct { + dds_time_t v; +} ddsrt_mtime_t; + +typedef struct { + dds_time_t v; +} ddsrt_wctime_t; + +typedef struct { + dds_time_t v; +} ddsrt_etime_t; + +#define DDSRT_MTIME_NEVER ((ddsrt_mtime_t) { DDS_NEVER }) +#define DDSRT_WCTIME_NEVER ((ddsrt_wctime_t) { DDS_NEVER }) +#define DDSRT_ETIME_NEVER ((ddsrt_etime_t) { DDS_NEVER }) +#define DDSRT_WCTIME_INVALID ((ddsrt_wctime_t) { INT64_MIN }) + +/** + * @brief Get the current time in nanoseconds since the UNIX Epoch. + * + * @returns Current time. + */ +DDS_EXPORT dds_time_t dds_time(void); + +/** + * @brief Suspend execution of calling thread until relative time n elapsed. + * + * Execution is suspended for n nanoseconds. Should the call be interrupted, + * the call is re-entered with the remaining time. + * + * @param[in] reltime Relative time in nanoseconds. + */ +DDS_EXPORT void dds_sleepfor (dds_duration_t reltime); + +/** + * @brief Get the current time in nanoseconds since the UNIX Epoch. Identical + * to (ddsrt_wctime_t){dds_time()} + * + * @returns Curren time. + */ +DDS_EXPORT ddsrt_wctime_t ddsrt_time_wallclock(void); + +/** + * @brief Get high resolution, monotonic time. + * + * The monotonic clock is a clock with near real-time progression and can be + * used when a high-resolution time is needed without the need for it to be + * related to the wall-clock. The resolution of the clock is typically the + * highest available on the platform. + * + * The clock is not guaranteed to be strictly monotonic, but on most common + * platforms it will be (based on performance-counters or HPET's). + * + * @returns Monotonic time if available, otherwise real time. + */ +DDS_EXPORT ddsrt_mtime_t ddsrt_time_monotonic(void); + +/** + * @brief Get high resolution, elapsed (and thus monotonic) time since some + * fixed unspecified past time. + * + * The elapsed time clock is a clock with near real-time progression and can be + * used when a high-resolution suspend-aware monotonic clock is needed, without + * having to deal with the complications of discontinuities if for example the + * time is changed. The fixed point from which the elapsed time is returned is + * not guaranteed to be fixed over reboots of the system. + * + * @returns Elapsed time if available, otherwise return monotonic time. + */ +DDS_EXPORT ddsrt_etime_t ddsrt_time_elapsed(void); + +/** + * @brief Convert time into a human readable string in RFC 3339 format. + * + * Converts the calender time into a null-terminated string in RFC 3339 format. + * e.g. "2014-10-24 15:32:27-04:00". + * + * UTC offset is omitted if time-zone information is unknown. + * + * @param[in] abstime Time in nanoseconds since UNIX Epoch. + * @param[in] str String to write human readable timestamp to. + * @param[in] size Number of bytes available in @str. + * + * @returns Number of bytes written (excluding terminating null byte). The + * string is truncated if str is not sufficiently large enough. Thus, + * a return value of size or more means the output was truncated. + */ +#define DDSRT_RFC3339STRLEN (25) + +DDS_EXPORT size_t ddsrt_ctime(dds_time_t abstime, char *str, size_t size); + +/** + * @brief Calculate a time given an offset time and a duration. + * + * Negative time can become positive by adding a large enough duration, of + * course a positive time can become negative given a large enough negative + * duration. + * + * @param[in] abstime Timestamp in nanoseconds since UNIX Epoch. + * @param[in] reltime Relative time in nanoseconds. + * + * @returns A timestamp in nanoseconds since UNIX Epoch. + */ +DDS_INLINE_EXPORT inline dds_time_t ddsrt_time_add_duration(dds_time_t abstime, dds_duration_t reltime) +{ + assert(abstime >= 0); + assert(reltime >= 0); + return (reltime >= DDS_NEVER - abstime ? DDS_NEVER : abstime + reltime); +} + +/** + * @brief Calculate a monotonic time given an offset time and a duration. + * + * Negative time can become positive by adding a large enough duration, of + * course a positive time can become negative given a large enough negative + * duration. + * + * @param[in] abstime Timestamp in nanoseconds since UNIX Epoch. + * @param[in] reltime Relative time in nanoseconds. + * + * @returns A timestamp in nanoseconds since UNIX Epoch. + */ +DDS_INLINE_EXPORT inline ddsrt_mtime_t ddsrt_mtime_add_duration(ddsrt_mtime_t abstime, dds_duration_t reltime) { + ddsrt_mtime_t t; + t.v = ddsrt_time_add_duration (abstime.v, reltime); + return t; +} + +/** + * @brief Calculate a wall-clock time given an offset time and a duration. + * + * Negative time can become positive by adding a large enough duration, of + * course a positive time can become negative given a large enough negative + * duration. + * + * @param[in] abstime Timestamp in nanoseconds since UNIX Epoch. + * @param[in] reltime Relative time in nanoseconds. + * + * @returns A timestamp in nanoseconds since UNIX Epoch. + */ +DDS_INLINE_EXPORT inline ddsrt_wctime_t ddsrt_wctime_add_duration(ddsrt_wctime_t abstime, dds_duration_t reltime) { + ddsrt_wctime_t t; + t.v = ddsrt_time_add_duration (abstime.v, reltime); + return t; +} + +/** + * @brief Calculate an elapsed time given an offset time and a duration. + * + * Negative time can become positive by adding a large enough duration, of + * course a positive time can become negative given a large enough negative + * duration. + * + * @param[in] abstime Timestamp in nanoseconds since UNIX Epoch. + * @param[in] reltime Relative time in nanoseconds. + * + * @returns A timestamp in nanoseconds since UNIX Epoch. + */ +DDS_INLINE_EXPORT inline ddsrt_etime_t ddsrt_etime_add_duration(ddsrt_etime_t abstime, dds_duration_t reltime) { + ddsrt_etime_t t; + t.v = ddsrt_time_add_duration (abstime.v, reltime); + return t; +} + +#if _WIN32 +/** + * @brief Convert a relative time to microseconds rounding up. + * + * @param[in] reltime Relative time to convert. + * + * @returns INFINITE if @reltime was @DDS_INIFINITY, relative time converted to + * microseconds otherwise. + */ +DDS_INLINE_EXPORT inline DWORD +ddsrt_duration_to_msecs_ceil(dds_duration_t reltime) +{ + if (reltime == DDS_INFINITY) { + return INFINITE; + } else if (reltime > 0) { + assert(INFINITE < (DDS_INFINITY / DDS_NSECS_IN_MSEC)); + dds_duration_t max_nsecs = (INFINITE - 1) * DDS_NSECS_IN_MSEC; + + if (reltime < (max_nsecs - (DDS_NSECS_IN_MSEC - 1))) { + reltime += (DDS_NSECS_IN_MSEC - 1); + } else { + reltime = max_nsecs; + } + + return (DWORD)(reltime / DDS_NSECS_IN_MSEC); + } + + return 0; +} +#endif + +/** + * @brief Convert monotonic time seconds & microseconds + * + * @param[in] t Monotonic time to convert + * @param[out] sec Seconds part + * @param[out] usec Microseconds part + */ +DDS_EXPORT void ddsrt_mtime_to_sec_usec (int32_t * __restrict sec, int32_t * __restrict usec, ddsrt_mtime_t t); + +/** + * @brief Convert wall-clock time seconds & microseconds + * + * @param[in] t Wall-clock time to convert + * @param[out] sec Seconds part + * @param[out] usec Microseconds part + */ +DDS_EXPORT void ddsrt_wctime_to_sec_usec (int32_t * __restrict sec, int32_t * __restrict usec, ddsrt_wctime_t t); + +/** + * @brief Convert elapsed time seconds & microseconds + * + * @param[in] t Elasped time to convert + * @param[out] sec Seconds part + * @param[out] usec Microseconds part + */ +DDS_EXPORT void ddsrt_etime_to_sec_usec (int32_t * __restrict sec, int32_t * __restrict usec, ddsrt_etime_t t); + +#if defined(__cplusplus) +} +#endif + +#if DDSRT_WITH_FREERTOS +#include "dds/ddsrt/time/freertos.h" +#endif + +#endif /* DDSRT_TIME_H */ diff --git a/unitree_SDK/include/dds/ddsrt/time/freertos.h b/unitree_SDK/include/dds/ddsrt/time/freertos.h new file mode 100644 index 0000000..e1a187d --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/time/freertos.h @@ -0,0 +1,53 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_TIME_FREERTOS_H +#define DDSRT_TIME_FREERTOS_H + +#include +#include + +#if defined (__cplusplus) +extern "C" { +#endif + +#define DDSRT_NSECS_PER_TICK (DDS_NSECS_IN_SEC / configTICK_RATE_HZ) + +inline TickType_t +ddsrt_duration_to_ticks_ceil( + dds_duration_t reltime) +{ + TickType_t ticks = 0; + + assert(portMAX_DELAY > configTICK_RATE_HZ); + + if (reltime == DDS_INFINITY) { + ticks = portMAX_DELAY; + } else if (reltime > 0) { + dds_duration_t max_nsecs = + (DDS_INFINITY / DDSRT_NSECS_PER_TICK < portMAX_DELAY + ? DDS_INFINITY - 1 : portMAX_DELAY * DDSRT_NSECS_PER_TICK); + + if (reltime > max_nsecs - (DDSRT_NSECS_PER_TICK - 1)) { + ticks = portMAX_DELAY; + } else { + ticks = (TickType_t)((reltime + (DDSRT_NSECS_PER_TICK - 1)) / DDSRT_NSECS_PER_TICK); + } + } + + return ticks; +} + +#if defined (__cplusplus) +} +#endif + +#endif /* DDSRT_TIME_FREERTOS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/types.h b/unitree_SDK/include/dds/ddsrt/types.h new file mode 100644 index 0000000..e7d51de --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/types.h @@ -0,0 +1,30 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_TYPES_H +#define DDSRT_TYPES_H + +#include +#include + +#if _WIN32 +# include "dds/ddsrt/types/windows.h" +#elif __VXWORKS__ +# include "dds/ddsrt/types/vxworks.h" +#else +# include "dds/ddsrt/types/posix.h" +#endif + +#define PRIdSIZE "zd" +#define PRIuSIZE "zu" +#define PRIxSIZE "zx" + +#endif /* DDSRT_TYPES_H */ diff --git a/unitree_SDK/include/dds/ddsrt/types/posix.h b/unitree_SDK/include/dds/ddsrt/types/posix.h new file mode 100644 index 0000000..8e1585d --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/types/posix.h @@ -0,0 +1,23 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_TYPES_POSIX_H +#define DDSRT_TYPES_POSIX_H + +#include +#include +#if defined(__IAR_SYSTEMS_ICC__) +typedef long int ssize_t; +#else +#include +#endif + +#endif /* DDSRT_TYPES_POSIX_H */ diff --git a/unitree_SDK/include/dds/ddsrt/types/vxworks.h b/unitree_SDK/include/dds/ddsrt/types/vxworks.h new file mode 100644 index 0000000..3ad1ae6 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/types/vxworks.h @@ -0,0 +1,74 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_TYPES_VXWORKS_H +#define DDSRT_TYPES_VXWORKS_H + +#if defined(_WRS_KERNEL) +/* inttypes.h does not exist in VxWorks DKM. */ +#include +#include +/* The above inttypes includes don't seem to define uintmax_t &c. */ +#ifdef _WRS_CONFIG_LP64 /* Used in cafe/inttypes.h too. */ +#define _PFX_64 "l" +typedef unsigned long int uintmax_t; +#else +#define _PFX_64 "ll" +typedef unsigned long long int uintmax_t; +#endif + +/* Not a complete replacement for inttypes.h (yet); No SCN/PRI?LEAST/FAST/etc. */ +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" +#define PRId64 _PFX_64 "d" + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "i" +#define PRIi64 _PFX_64 "i" + +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "o" +#define PRIo64 _PFX_64 "o" + +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "u" +#define PRIu64 _PFX_64 "u" + +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" + +#define PRIX8 "X" +#define PRIX16 "X" +#define PRIX32 "X" +#define PRIX64 _PFX_64 "X" + +#define PRIdMAX _PFX_64 "d" +#define PRIiMAX _PFX_64 "i" +#define PRIoMAX _PFX_64 "o" +#define PRIuMAX _PFX_64 "u" +#define PRIxMAX _PFX_64 "x" +#define PRIXMAX _PFX_64 "X" + +#define PRIdPTR _PFX_64 "d" +#define PRIiPTR _PFX_64 "i" +#define PRIoPTR _PFX_64 "o" +#define PRIXPTR _PFX_64 "X" + +#else /* _WRS_KERNEL */ +#include +#endif /* _WRS_KERNEL */ + +#endif /* DDSRT_TYPES_VXWORKS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/types/windows.h b/unitree_SDK/include/dds/ddsrt/types/windows.h new file mode 100644 index 0000000..ed53d73 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/types/windows.h @@ -0,0 +1,31 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_TYPES_WINDOWS_H +#define DDSRT_TYPES_WINDOWS_H + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#ifndef NOMINMAX +#define NOMINMAX +#endif + +#include +#include +#include +#include +#include + +typedef SSIZE_T ssize_t; + +#endif /* DDSRT_TYPES_WINDOWS_H */ diff --git a/unitree_SDK/include/dds/ddsrt/xmlparser.h b/unitree_SDK/include/dds/ddsrt/xmlparser.h new file mode 100644 index 0000000..2277dc5 --- /dev/null +++ b/unitree_SDK/include/dds/ddsrt/xmlparser.h @@ -0,0 +1,54 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSRT_XMLPARSER_H +#define DDSRT_XMLPARSER_H + +#include +#include + +#include "dds/export.h" + +#if defined (__cplusplus) +extern "C" { +#endif + + typedef int (*ddsrt_xmlp_proc_elem_open_t) (void *varg, uintptr_t parentinfo, uintptr_t *eleminfo, const char *name, int line); + typedef int (*ddsrt_xmlp_proc_attr_t) (void *varg, uintptr_t eleminfo, const char *name, const char *value, int line); + typedef int (*ddsrt_xmlp_proc_elem_data_t) (void *varg, uintptr_t eleminfo, const char *data, int line); + typedef int (*ddsrt_xmlp_proc_elem_close_t) (void *varg, uintptr_t eleminfo, int line); + typedef void (*ddsrt_xmlp_error) (void *varg, const char *msg, int line); + + struct ddsrt_xmlp_callbacks { + ddsrt_xmlp_proc_elem_open_t elem_open; + ddsrt_xmlp_proc_attr_t attr; + ddsrt_xmlp_proc_elem_data_t elem_data; + ddsrt_xmlp_proc_elem_close_t elem_close; + ddsrt_xmlp_error error; + }; + + struct ddsrt_xmlp_state; + +#define DDSRT_XMLP_REQUIRE_EOF 1u /* set by default; if not set, junk may follow top-level closing tag */ +#define DDSRT_XMLP_ANONYMOUS_CLOSE_TAG 2u /* clear by default; if set allow closing an element with instead of */ +#define DDSRT_XMLP_MISSING_CLOSE_AS_EOF 4u /* clear by default; if set, treat missing close tag as EOF */ + DDS_EXPORT struct ddsrt_xmlp_state *ddsrt_xmlp_new_file (FILE *fp, void *varg, const struct ddsrt_xmlp_callbacks *cb); + DDS_EXPORT struct ddsrt_xmlp_state *ddsrt_xmlp_new_string (const char *string, void *varg, const struct ddsrt_xmlp_callbacks *cb); + DDS_EXPORT void ddsrt_xmlp_set_options (struct ddsrt_xmlp_state *st, unsigned options); + DDS_EXPORT size_t ddsrt_xmlp_get_bufpos (const struct ddsrt_xmlp_state *st); + DDS_EXPORT void ddsrt_xmlp_free (struct ddsrt_xmlp_state *st); + DDS_EXPORT int ddsrt_xmlp_parse (struct ddsrt_xmlp_state *st); + +#if defined (__cplusplus) +} +#endif + +#endif diff --git a/unitree_SDK/include/dds/export.h b/unitree_SDK/include/dds/export.h new file mode 100644 index 0000000..5e42e8c --- /dev/null +++ b/unitree_SDK/include/dds/export.h @@ -0,0 +1,50 @@ + +#ifndef DDS_EXPORT_H +#define DDS_EXPORT_H + +#ifdef DDS_STATIC_DEFINE +# define DDS_EXPORT +# define DDS_NO_EXPORT +#else +# ifndef DDS_EXPORT +# ifdef ddsc_EXPORTS + /* We are building this library */ +# define DDS_EXPORT __attribute__((visibility("default"))) +# else + /* We are using this library */ +# define DDS_EXPORT __attribute__((visibility("default"))) +# endif +# endif + +# ifndef DDS_NO_EXPORT +# define DDS_NO_EXPORT __attribute__((visibility("hidden"))) +# endif +#endif + +#ifndef DDS_DEPRECATED +# define DDS_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef DDS_DEPRECATED_EXPORT +# define DDS_DEPRECATED_EXPORT DDS_EXPORT DDS_DEPRECATED +#endif + +#ifndef DDS_DEPRECATED_NO_EXPORT +# define DDS_DEPRECATED_NO_EXPORT DDS_NO_EXPORT DDS_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef DDS_NO_DEPRECATED +# define DDS_NO_DEPRECATED +# endif +#endif + +#ifndef DDS_INLINE_EXPORT +# if __MINGW32__ && (!defined(__clang__) || !defined(ddsc_EXPORTS)) +# define DDS_INLINE_EXPORT +# else +# define DDS_INLINE_EXPORT DDS_EXPORT +# endif +#endif + +#endif /* DDS_EXPORT_H */ diff --git a/unitree_SDK/include/dds/features.h b/unitree_SDK/include/dds/features.h new file mode 100644 index 0000000..4d37a34 --- /dev/null +++ b/unitree_SDK/include/dds/features.h @@ -0,0 +1,42 @@ +/* + * Copyright(c) 2020 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef _DDS_PUBLIC_FEATURES_H_ +#define _DDS_PUBLIC_FEATURES_H_ + +/* Whether or not support for DDS Security is included */ +/* #undef DDS_HAS_SECURITY */ + +/* Whether or not support for the lifespan QoS is included */ +#define DDS_HAS_LIFESPAN 1 + +/* Whether or not support for generating "deadline missed" events is included */ +#define DDS_HAS_DEADLINE_MISSED 1 + +/* Whether or not support for network partitions is included */ +#define DDS_HAS_NETWORK_PARTITIONS 1 + +/* Whether or not support for source-specific multicast is included */ +#define DDS_HAS_SSM 1 + +/* Whether or not features dependent on OpenSSL are included */ +/* #undef DDS_HAS_SSL */ + +/* Whether or not support for type discovery is included */ +#define DDS_HAS_TYPE_DISCOVERY 1 + +/* Whether or not support for topic discovery is included */ +#define DDS_HAS_TOPIC_DISCOVERY 1 + +/* Whether or not support for Iceoryx support is included */ +/* #undef DDS_HAS_SHM */ + +#endif diff --git a/unitree_SDK/include/dds/version.h b/unitree_SDK/include/dds/version.h new file mode 100644 index 0000000..12d7445 --- /dev/null +++ b/unitree_SDK/include/dds/version.h @@ -0,0 +1,25 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDS_VERSION_H +#define DDS_VERSION_H + +#define DDS_VERSION "0.10.2" +#define DDS_VERSION_MAJOR 0 +#define DDS_VERSION_MINOR 10 +#define DDS_VERSION_PATCH 2 +#define DDS_VERSION_TWEAK +#define DDS_PROJECT_NAME "CycloneDDS" + +#define DDS_HOST_NAME "Linux" +#define DDS_TARGET_NAME "Linux" + +#endif /* DDS_VERSION_H */ diff --git a/unitree_SDK/include/ddsc/dds.h b/unitree_SDK/include/ddsc/dds.h new file mode 100644 index 0000000..cf86b84 --- /dev/null +++ b/unitree_SDK/include/ddsc/dds.h @@ -0,0 +1,20 @@ +/* + * Copyright(c) 2006 to 2019 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSC_DDS_H +#define DDSC_DDS_H + +/* All header files distributed with Cyclone DDS reside in dds. This file is + merely a proxy for dds/dds.h and must be considered deprecated. */ +#include "dds/dds.h" + +#endif /* DDSC_DDS_H */ + diff --git a/unitree_SDK/include/ddscxx/dds/LICENSE b/unitree_SDK/include/ddscxx/dds/LICENSE new file mode 100644 index 0000000..19bd209 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/LICENSE @@ -0,0 +1,190 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + Copyright 2020 ADLINK Technology Limited + + 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. diff --git a/unitree_SDK/include/ddscxx/dds/core/BuiltinTopicTypes.hpp b/unitree_SDK/include/ddscxx/dds/core/BuiltinTopicTypes.hpp new file mode 100644 index 0000000..9e5e12e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/BuiltinTopicTypes.hpp @@ -0,0 +1,44 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ + +#ifndef OMG_DDS_CORE_BUILTIN_TOPIC_TYPES_HPP_ +#define OMG_DDS_CORE_BUILTIN_TOPIC_TYPES_HPP_ + +#include +#include +#include + +#if defined (OMG_DDS_X_TYPES_BUILTIN_TOPIC_TYPES_SUPPORT) +namespace dds +{ +namespace core +{ +/** + * @file + * This file contains the type definitions for BuiltinTopicTypes + */ +typedef TBytesTopicType BytesTopicType; +typedef TStringTopicType StringTopicType; +typedef TKeyedBytesTopicType KeyedBytesTopicType; +typedef TKeyedStringTopicType KeyedStringTopicType; +} +} + +#endif + +#endif /* OMG_DDS_CORE_BUILTIN_TOPIC_TYPES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/Duration.hpp b/unitree_SDK/include/ddscxx/dds/core/Duration.hpp new file mode 100644 index 0000000..4f8429c --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/Duration.hpp @@ -0,0 +1,275 @@ +#ifndef OMG_DDS_CORE_DURATION_HPP_ +#define OMG_DDS_CORE_DURATION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace core +{ + +/** + * @file + * This class represents a time interval. + */ + +/** + * Duration represents a time interval and can - + * * Can be incremented by durations expressed as seconds, nanoseconds + * milliseconds, or Duration objects. + * + * * Can be converted to and from Durations expressed in + * milliseconds (or other units) as integer types. + */ +class OMG_DDS_API Duration +{ +public: + /** + * Create a Duration elapsing zero seconds. + */ + static const Duration zero(); // {0, 0} + + /** + * Create an infinite Duration. + */ + static const Duration infinite(); // {0x7fffffff, 0x7fffffff} + +public: + /** + * Create a Duration elapsing the default amount of time (zero seconds). + */ + Duration(); + + /** + * Create a Duration elapsing a specific amount of time. + * + * @param sec Amount of seconds for the Duration. + * @param nanosec Amount of nanoseconds for the Duration. + */ + explicit Duration(int32_t sec, uint32_t nanosec = 0); +#if __cplusplus >= 199711L + /** @copydoc dds::core::Duration::Duration(int32_t sec, uint32_t nanosec = 0) */ + explicit Duration(int64_t sec, uint32_t nanosec = 0); +#endif + +public: + /** + * Create a Duration from a number of microseconds + * @param microseconds number of microseconds + */ + static const Duration from_microsecs(int64_t microseconds); + + /** + * Create a Duration from a number of milliseconds + * @param milliseconds number of milliseconds + */ + static const Duration from_millisecs(int64_t milliseconds); + + /** + * Create a Duration from a number of seconds + * @param seconds number of seconds + */ + static const Duration from_secs(double seconds); + +public: + /** + * Get seconds part of the Duration. + * @return number of seconds + */ + int64_t sec() const; + /** + * Set number of seconds + * @param s number of seconds + */ + void sec(int64_t s); + + /** + * Get nanoseconds part of the Duration. + * @return number of nanoseconds + */ + uint32_t nanosec() const; + /** + * Set number of nanoseconds + * @param ns number of nanoseconds + */ + void nanosec(uint32_t ns); + +public: + /** + * Returns an integer value for a comparison of two Durations: + * 1 if this Duration is greater than the comparator (that) + * -1 if the Duration is less than the comparator (that) + * 0 if the Duration matches the comparator (that) + * + * @param that Duration to compare + * + * @return comparison result + */ + int compare(const Duration& that) const; + + /** + * Returns true if the Duration is greater than the comparator + * + * @param that Duration to compare + * @return comparison result + */ + bool operator >(const Duration& that) const; + + /** + * Returns true if the Duration is greater than or equal to the comparator + * @param that the Duration to compare + * @return true if that is larger than or equal to this + */ + bool operator >=(const Duration& that) const; + + /** + * Returns true if the Duration is not equal to the comparator + * + * @param that Duration to compare + * @return comparison result + */ + bool operator !=(const Duration& that) const; + + /** + * Returns true if the Duration is equal to the comparator + * + * @param that Duration to compare + * @return comparison result + */ + bool operator ==(const Duration& that) const; + + /** + * Returns true if the Duration is less than or equal to the comparator + * + * @param that Duration to compare + * @return comparison result + */ + bool operator <=(const Duration& that) const; + + /** + * Returns true if the Duration is less than the comparator + * + * @param that Duration to compare + * @return comparison result + */ + bool operator <(const Duration& that) const; + +public: + /** + * Add a Duration to this Duration + * + * @param a_ti Duration to add + * @return this Duration + a_ti + */ + Duration& operator+=(const Duration& a_ti); + + /** + * Subtract a Duration from this Duration + * + * @param a_ti Duration to subtract + * @return this Duration - a_ti + */ + Duration& operator-=(const Duration& a_ti); + + /** + * Multiply this Duration by a factor + * + * @param factor the factor to multiply this Duration by + * @return this Duration * factor + */ + Duration& operator*=(uint64_t factor); + + /** + * Add a Duration to Duration + * + * @param other a Duration + * @return Duration + other + */ + const Duration operator +(const Duration& other) const; + + /** + * Subtract a Duration from Duration + * + * @param other a Duration + * @return the Duration - other + */ + const Duration operator -(const Duration& other) const; +public: + /** + * Returns this Duration in milliseconds. + * + * @return the duration in milliseconds + */ + int64_t to_millisecs() const; + + /** + * Returns this Duration in micro-seconds. + * + * @return the duration in micro-seconds + */ + int64_t to_microsecs() const; + + /** + * Returns this Duration in seconds. + * + * @return the duration in seconds + */ + double to_secs() const; + +private: + int32_t sec_; + uint32_t nsec_; +}; + +/** + * Multiply Duration by a factor + * + * @param lhs factor by which to multiply + * @param rhs Duration to multiply + * + * @return factor * Duration + */ +const Duration OMG_DDS_API operator *(uint64_t lhs, + const Duration& rhs); + +/** + * Multiply Duration by a factor + * + * @param lhs Duration to multiply + * @param rhs factor by which to multiply + * + * @return Duration * factor + */ +const Duration OMG_DDS_API operator *(const Duration& lhs, + uint64_t rhs); + +/** + * Divide Duration by a factor + * + * @param lhs Duration to divide + * @param rhs factor by which to divide + */ +const Duration OMG_DDS_API operator /(const Duration& lhs, + uint64_t rhs); + +} +} /* namespace dds / namespace core */ +#endif /* OMG_DDS_CORE_DURATION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/Entity.hpp b/unitree_SDK/include/ddscxx/dds/core/Entity.hpp new file mode 100644 index 0000000..6f81f3f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/Entity.hpp @@ -0,0 +1,31 @@ +#ifndef OMG_DDS_CORE_ENTITY_HPP_ +#define OMG_DDS_CORE_ENTITY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +namespace dds +{ +namespace core +{ +typedef dds::core::detail::Entity Entity; +} +} + +#endif /* OMG_DDS_CORE_ENTITY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/Exception.hpp b/unitree_SDK/include/ddscxx/dds/core/Exception.hpp new file mode 100644 index 0000000..14e7709 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/Exception.hpp @@ -0,0 +1,372 @@ +#ifndef OMG_DDS_CORE_EXCEPTION_HPP_ +#define OMG_DDS_CORE_EXCEPTION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + +#if defined _MSC_VER +# pragma warning (push) +# pragma warning (disable:4275) // non dll-interface class 'std::foo_error' used as base for dll-interface class 'dds::core::BarError' +#endif + +namespace dds +{ +namespace core +{ + +/** + * @brief + * %Exception: base class for specified DDS Exceptions. + * + * DDS PIM Return Code | DDS-PSM-CXX Exception Class | std C++ Parent Exception + * ------------------- | --------------------------- | ------------------------ + * RETCODE_OK | Normal return; no exception | N/A + * RETCODE_NO_DATA | Normal return with informational state attached | N/A + * RETCODE_ERROR | Error | std::logic_error + * RETCODE_BAD_PARAMETER | InvalidArgumentError | std::invalid_argument + * RETCODE_TIMEOUT | TimeoutError | std::runtime_error + * RETCODE_UNSUPPORTED | UnsupportedError | std::logic_error + * RETCODE_ALREADY_DELETED | AlreadyClosedError | std::logic_error + * RETCODE_ILLEGAL_OPERATION | IllegalOperationError | std::logic_error + * RETCODE_NOT_ENABLED | NotEnabledError | std::logic_error + * RETCODE_PRECONDITION_NOT_MET | PreconditionNotMetError | std::logic_error + * RETCODE_IMMUTABLE_POLICY | ImmutablePolicyError | std::logic_error + * RETCODE_INCONSISTENT_POLICY | InconsistentPolicyError | std::logic_error + * RETCODE_OUT_OF_RESOURCES | OutOfResourcesError | std::runtime_error + * + * The DDS-PSM-Cxx maps error codes to C++ exceptions defined in the dds::core namespace and + * inheriting from a base Exception class and the appropriate standard C++ exception. + * Table 7.3 lists the mapping between error codes as defined in the DDS PIM and C++ exceptions + * as used in this specification. Exceptions have value semantics; this means that they must + * always have deep copy semantics. + * The full list of exceptions is included in the file dds/core/Exceptions.hpp. + * + */ +class OMG_DDS_API Exception +{ +protected: + Exception(); +public: + /** @cond */ + virtual ~Exception() throw(); + /** @endcond */ + +public: + /** + * Retrieve information about the exception that was thrown. + * + * Example + * @code{.cpp} + * try { + * // Do something that will trigger a dds exception, like: + * dds::domain::DomainParticipant participant = dds::core::null; + * participant.domain_id(); + * } catch (const dds::core::Exception& e) { + * std::cout << e.what() << std::endl; + * } + * @endcode + * %Exception information (of the NullReferenceError in this case) + * @code + * Null reference: Reference[157] == dds::core::null + * ======================================================================================== + * Context : dds::domain::DomainParticipant::domain_id + * Date : Wed Oct 21 19:28:00 CET 2015 + * Node : DeLorean + * Process : flux_capacitor <15423> + * Thread : mr_fusion b6f25700 + * Internals : ReferenceImpl.hpp/157/V6.6.0 + * ---------------------------------------------------------------------------------------- + * Report : Null reference: Reference[157] == dds::core::null + * Internals : dds::core::Reference::delegate/ReferenceImpl.hpp/157 + * @endcode + * + * @return Exception information + */ + virtual const char* what() const throw() = 0; +}; + +/** + * @brief + * %Exception: Generic, unspecified error. + */ +class OMG_DDS_API Error : public Exception, public std::logic_error +{ +/** @cond */ +public: + explicit Error(const std::string& msg); + Error(const Error& src); + virtual ~Error() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: The object target of this operation has already been closed. + */ +class OMG_DDS_API AlreadyClosedError : public Exception, public std::logic_error +{ +/** @cond */ +public: + explicit AlreadyClosedError(const std::string& msg); + AlreadyClosedError(const AlreadyClosedError& src); + virtual ~AlreadyClosedError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: An operation was invoked on an inappropriate object or at an inappropriate time. + * + * This is determined by policies set by the specification or the Service implementation. + * + * There is no precondition that could be changed to make the operation succeed. + */ +class OMG_DDS_API IllegalOperationError : public Exception, public std::logic_error +{ +/** @cond */ +public: + explicit IllegalOperationError(const std::string& msg); + IllegalOperationError(const IllegalOperationError& src); + virtual ~IllegalOperationError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: Application attempted to modify an immutable QosPolicy. + */ +class OMG_DDS_API ImmutablePolicyError : public Exception, public std::logic_error +{ +/** @cond */ +public: + explicit ImmutablePolicyError(const std::string& msg); + ImmutablePolicyError(const ImmutablePolicyError& src); + virtual ~ImmutablePolicyError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: Application specified a set of policies that are not + * consistent with each other. + */ +class OMG_DDS_API InconsistentPolicyError : public Exception, public std::logic_error +{ +/** @cond */ +public: + explicit InconsistentPolicyError(const std::string& msg); + InconsistentPolicyError(const InconsistentPolicyError& src); + virtual ~InconsistentPolicyError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: Application is passing an invalid argument. + */ +class OMG_DDS_API InvalidArgumentError : public Exception, public std::invalid_argument +{ +/** @cond */ +public: + explicit InvalidArgumentError(const std::string& msg); + InvalidArgumentError(const InvalidArgumentError& src); + virtual ~InvalidArgumentError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: Operation invoked on an Entity that is not yet enabled. + */ +class OMG_DDS_API NotEnabledError : public Exception, public std::logic_error +{ +/** @cond */ +public: + explicit NotEnabledError(const std::string& msg); + NotEnabledError(const NotEnabledError& src); + virtual ~NotEnabledError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: Service ran out of the resources needed to complete the + * operation. + */ +class OMG_DDS_API OutOfResourcesError : public Exception, public std::runtime_error +{ +/** @cond */ +public: + explicit OutOfResourcesError(const std::string& msg); + OutOfResourcesError(const OutOfResourcesError& src); + virtual ~OutOfResourcesError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + + +/** + * @brief + * %Exception: A pre-condition for the operation was not met. + */ +class OMG_DDS_API PreconditionNotMetError : public Exception, public std::logic_error +{ +/** @cond */ +public: + explicit PreconditionNotMetError(const std::string& msg); + PreconditionNotMetError(const PreconditionNotMetError& src); + virtual ~PreconditionNotMetError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: The operation timed out. + */ +class OMG_DDS_API TimeoutError : public Exception, public std::runtime_error +{ +/** @cond */ +public: + explicit TimeoutError(const std::string& msg); + TimeoutError(const TimeoutError& src); + virtual ~TimeoutError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: Unsupported operation. + * + * This can only be thrown by operations that are optional. + */ +class OMG_DDS_API UnsupportedError : public Exception, public std::logic_error +{ +/** @cond */ +public: + explicit UnsupportedError(const std::string& msg); + UnsupportedError(const UnsupportedError& src); + virtual ~UnsupportedError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: Application has attempted to cast incompatible types. + */ +class OMG_DDS_API InvalidDowncastError : public Exception, public std::runtime_error +{ +/** @cond */ +public: + explicit InvalidDowncastError(const std::string& msg); + InvalidDowncastError(const InvalidDowncastError& src); + virtual ~InvalidDowncastError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: Application used a null reference. + * + * Very likely, the used DDS object is a dds::core::null object. + * @code{.cpp} + * dds::domain::DomainParticipant participant = dds::core::null; + * try { + * participant.domain_id(); + * } catch (const dds::core::NullReferenceError& e) { + * std::cout << e.what() << std::endl; + * } + * @endcode + */ +class OMG_DDS_API NullReferenceError : public Exception, public std::runtime_error +{ +/** @cond */ +public: + explicit NullReferenceError(const std::string& msg); + NullReferenceError(const NullReferenceError& src); + virtual ~NullReferenceError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +/** + * @brief + * %Exception: Application provided invalid data + */ +class OMG_DDS_API InvalidDataError : public Exception, public std::logic_error +{ +/** @cond */ +public: + explicit InvalidDataError(const std::string& msg); + InvalidDataError(const InvalidDataError& src); + virtual ~InvalidDataError() throw(); + +public: + virtual const char* what() const throw(); +/** @endcond */ +}; + +} +} + +#if defined _MSC_VER +# pragma warning (pop) +#endif + + +#endif /* OMG_DDS_CORE_EXCEPTION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/External.hpp b/unitree_SDK/include/ddscxx/dds/core/External.hpp new file mode 100644 index 0000000..6c1af2d --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/External.hpp @@ -0,0 +1,114 @@ +#ifndef OMG_DDS_CORE_EXTERNAL_HPP_ +#define OMG_DDS_CORE_EXTERNAL_HPP_ + +/* + * Copyright(c) 2022 ZettaScale Technology and others + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds +{ +namespace core +{ + +template +class external { + public: + external() = default; + external(T* p, bool locked = false): ptr_(p), locked_(locked) {;} + external(std::shared_ptr p): ptr_(p) {;} + external(const external& other); + ~external() = default; + external& operator=(const external& other); + T& operator*(); + const T& operator*() const; + T* get() {return ptr_.get();} + const T* get() const {return ptr_.get();} + std::shared_ptr get_shared_ptr() {return ptr_;} + T* operator->() {return get();} + const T* operator->() const {return get();} + bool operator==(const external& other) const {return other.ptr_ == ptr_;} + bool operator!=(const external& other) const {return !(*this == other);} + operator bool() const {return static_cast(ptr_);} + bool is_locked() const {return locked_;} + void lock(); + private: + std::shared_ptr ptr_; + bool locked_ = false; +}; + +template +external::external(const external& other) +{ + if (other.is_locked()) + ptr_ = std::make_shared(*other); //if other is locked, this implies that it can be dereferenced, and deep copy + else + ptr_ = other.ptr_; //unlocked means shallow copy +} + +template +external& external::operator=(const external& other) +{ + if (is_locked()) + throw InvalidDataError("attempting to assign to locked external field"); //assignments to locked externals are not allowed + + if (other.is_locked()) { + if (ptr_) + *ptr_ = *other; //copy over existing object + else + ptr_ = std::make_shared(*other); //deep copy into new object + } else { + ptr_ = other.ptr_; //shallow copy + } + + return *this; +} + +template +T& external::operator*() +{ + auto p = get(); + if (!p) + throw NullReferenceError("attempting to dereference unset external field"); //dereferencing unset externals is not allowed + + return *p; +} + +template +const T& external::operator*() const +{ + auto p = get(); + if (!p) + throw NullReferenceError("attempting to dereference unset external field"); //dereferencing unset externals is not allowed + + return *p; +} + +template +void external::lock() +{ + if (!*this) + throw NullReferenceError("attempting to lock unset external field"); //locking unbound externals is not allowed + + locked_ = true; +} + +} +} + +#endif /* !defined(OMG_DDS_CORE_EXTERNAL_HPP_) */ diff --git a/unitree_SDK/include/ddscxx/dds/core/InstanceHandle.hpp b/unitree_SDK/include/ddscxx/dds/core/InstanceHandle.hpp new file mode 100644 index 0000000..7395173 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/InstanceHandle.hpp @@ -0,0 +1,38 @@ +#ifndef OMG_DDS_CORE_INSTANCE_HANDLE_HPP_ +#define OMG_DDS_CORE_INSTANCE_HANDLE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + + +namespace dds +{ +namespace core +{ +typedef dds::core::detail::InstanceHandle InstanceHandle; +typedef std::vector InstanceHandleSeq; +} +} + +inline std::ostream& operator << (std::ostream& os, const dds::core::InstanceHandle& h); + + +#endif /* !defined(OMG_DDS_CORE_INSTANCE_HANDLE_HPP_) */ diff --git a/unitree_SDK/include/ddscxx/dds/core/LengthUnlimited.hpp b/unitree_SDK/include/ddscxx/dds/core/LengthUnlimited.hpp new file mode 100644 index 0000000..f9e5535 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/LengthUnlimited.hpp @@ -0,0 +1,31 @@ +#ifndef OMG_DDS_CORE_LENGTH_UNLIMITED_HPP_ +#define OMG_DDS_CORE_LENGTH_UNLIMITED_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +namespace dds +{ +namespace core +{ +const int32_t LENGTH_UNLIMITED = -1; +} +} + +#endif // !defined(OMG_DDS_CORE_LENGTH_UNLIMITED_HPP_) diff --git a/unitree_SDK/include/ddscxx/dds/core/Optional.hpp b/unitree_SDK/include/ddscxx/dds/core/Optional.hpp new file mode 100644 index 0000000..68aeda1 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/Optional.hpp @@ -0,0 +1,98 @@ +#ifndef OMG_DDS_CORE_OPTIONAL_HPP_ +#define OMG_DDS_CORE_OPTIONAL_HPP_ + + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +namespace dds +{ +namespace core +{ + +/** + * The optional class is used to wrap attributes annotated in the idl with the + * \@optional annotation. This class provides a simple and safe way of + * accessing, setting and resetting the stored attribute. + * + * IDL: + * @code + * struct RadarTrack { + * string id; + * long x; + * long y; + * long z; //@Optional + * }; + * @endcode + * + * C++ Representation: + * @code{.cpp} + * class RadarTrack { + * public: + * RadarTrack(); + * RadarTrack(const std::string& id, + * int32_t x, + * int32_t y, + * int32_t z); + * public: + * std::string& id() const; + * void id(const std::string& s); + * + * int32_t x() const; + * void x(int32_t v); + * + * int32_t y() const; + * void y(int32_t v); + * + * dds::core::optional& z() const; + * void z(int32_t v); + * void z(const dds::core::optional& z) + * }; + * @endcode + */ +template class DELEGATE> +class optional : public dds::core::Value< DELEGATE > +{ +public: + optional(const T& t); + +public: + /** + * Returns true only if the attribute is set. + */ + bool is_set() const; + + /** + * Reset the attribute. + */ + void reset(); + + /** + * Get the attribute. An exception is thrown if the attribute is not set. + */ + const T& get() const; + + /** + * Get the attribute. An exception is thrown if the attribute is not set. + */ + T& get(); +}; + +} +} +#endif /* OMG_DDS_CORE_OPTIONAL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/QosProvider.hpp b/unitree_SDK/include/ddscxx/dds/core/QosProvider.hpp new file mode 100644 index 0000000..cc548fb --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/QosProvider.hpp @@ -0,0 +1,33 @@ +#ifndef OMG_DDS_CORE_QOS_PROVIDER_HPP_ +#define OMG_DDS_CORE_QOS_PROVIDER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + + +namespace dds +{ +namespace core +{ +typedef dds::core::detail::QosProvider QosProvider; +} +} + +#endif /* OMG_DDS_CORE_QOS_PROVIDER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/Reference.hpp b/unitree_SDK/include/ddscxx/dds/core/Reference.hpp new file mode 100644 index 0000000..3b78c6a --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/Reference.hpp @@ -0,0 +1,353 @@ +#ifndef OMG_DDS_CORE_REFERENCE_HPP_ +#define OMG_DDS_CORE_REFERENCE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + + +namespace dds +{ +namespace core +{ + + +/** + * @brief + * Base class for reference-counted objects. + * + * All objects that have a reference-type have an associated shallow (polymorphic) + * assignment operator that simply changes the value of the reference. + * Furthermore, reference-types are safe, meaning that under no circumstances can + * a reference point to an invalid object. + * At any single point in time a reference can either refer to the null object or + * to a valid object. + * + * The semantics for Reference types is defined by the DDS-PSM-Cxx class + * dds::core::Reference. In the context of this specification the semantics implied + * by the ReferenceType is mandatory, yet the implementation supplied as part of + * this standard is provided to show one possible way of implementing this semantics. + * + * List of reference types: + * + * * Entity + * * Condition + * * GuardCondition + * * ReadCondition + * * QueryCondition + * * Waitset + * * DomainParticipant + * * AnyDataWriter + * * Publisher + * * DataWriter + * * AnyDataReader + * * Subscriber + * * DataReader + * * SharedSamples + * * AnyTopic + * * Topic + * + * Instances of reference types are created using C++ constructors. + * The trivial constructor is not defined for reference types; the only + * alternative to properly constructing a reference is to initialize it to a + * null reference by assigning dds::core::null. + * + * Resource management for some reference types might involve relatively + * heavyweight operating-system resources (such as threads, mutexes, + * and network sockets) in addition to memory. + * These objects therefore provide a function close() that shall halt network + * communication (in the case of entities) and dispose of any appropriate + * operating-system resources. + * + * Users of this PSM are recommended to call close on objects of all reference + * types once they are finished using them. In addition, implementations may + * automatically close objects that they deem to be no longer in use, + * subject to the following restrictions: + * + * * Any object to which the application has a direct reference + * (not including a WeakReference) is still in use. + * + * * Any object that has been explicitly retained is still in use. + * + * * The creator of any object that is still in use is itself still in use. + * + */ +template +class Reference +{ +public: + DECLARE_TYPE_TRAITS(DELEGATE) + + /** + * Creates a "null" Reference. + */ + explicit Reference(dds::core::null_type&); + +public: + /** + * Creates a Reference from another. + * + * @param ref the other reference + */ + explicit Reference(const Reference& ref); + + /** + * Creates a Reference from another. + * + * @param ref the other reference + */ + explicit Reference(Reference&& ref); + + /** + * Creates a Reference from other Reference type safely. + * + * @param ref the other reference + */ + template + explicit Reference(const Reference& ref); + + /** @cond + * The following two constructors create a dds Reference from a vendor + * specific delegate. + * + * They are public, because the implementation of other delegates may + * need to be able to create References in that manner. + * + * However, it shouldn't actually be part of the API. So, leave it from + * the doxygen generated API documentation. + */ + explicit Reference(DELEGATE_T* p); + explicit Reference(const DELEGATE_REF_T& p); + /** @endcond */ + +public: + /** + * Destroys a Reference. + * + * There might be an associated garbage collection activity when + * the current reference is not empty. When the underlaying delegate + * is referenced by another Reference object as well, then that + * delegate will not be destroyed. + */ + ~Reference(); + +public: + /** @cond + * Function possibly needed for delegate implementation, but not recommended + * for application usage: exclude from the API documentation for clarity. + * + * Returns an object to the underlying delegate. + */ + operator DELEGATE_REF_T() const; + /** @endcond */ + + /** + * Compares two Reference objects and returns true if they are equal. + * + * Equality is based on the referential equality of the object being + * pointed. + * + * @param ref the other Reference object + * @return true when equal + */ + template + bool operator==(const R& ref) const; + + /** + * Compares two Reference objects and returns true if they are not + * equal. + * + * Inequality is based on the referential inequality of the object + * being pointed to. + * + * @param ref the other Reference object + * @return true when not equal + */ + template + bool operator!=(const R& ref) const; + + /** + * Assign new referenced object to this dds reference. + * + * There might be an associated garbage collection activity when + * the current reference is not empty. + * + * @return reference pointing to the new object. + */ + template + Reference& operator=(const Reference& that); + + /** @copydoc dds::core::Reference::operator=(const Reference& that) */ + template + Reference& operator=(const R& rhs); + + /** @copydoc dds::core::Reference::operator=(const Reference& that) */ + Reference& operator=(const Reference& other) = default; + + /** @copydoc dds::core::Reference::operator=(const Reference& that) */ + Reference& operator=(Reference&& other) = default; + + /** + * Special assignment operators that takes care of assigning + * dds::core::null to this reference. + * + * When assigning null, there might be an associated garbage collection + * activity. + * + * @return reference pointing to a null object. + */ + Reference& + operator=(const null_type); + + /** + * Check if the referenced object is nil. + * + * In other words, check if the reference is pointing to a null object. + * + * @return true if the referenced object is null. + */ + bool is_nil() const; + + /** + * Special operator== used to check if this reference object + * equals the dds::core::null reference. + * + * The null-check can be done like this: + * @code{.cpp} + * if (r == dds::core::null) { + * // Do not use the dds reference object r in its current state + * } + * @endcode + * + * @return true if this reference is null. + */ + bool + operator==(const null_type) const; + + /** + * Special operator!= used to check if this reference object + * does not equal the dds::core::null reference. + * + * The non-null-check can be done like this: + * @code{.cpp} + * if (r != dds::core::null) { + * // Use the dds reference object r + * } + * @endcode + * + * @return true if this reference is not null. + */ + bool operator!=(const null_type nil) const; + +private: + // -- disallow dynamic allocation for reference types + void* operator new(size_t); + + + +public: + /** @cond + * Functions possibly needed for delegate implementation, but not recommended + * for application usage: exclude from the API documentation for clarity. + * + * Returns an object to the underlying delegate. + */ + const DELEGATE_REF_T& delegate() const; + DELEGATE_REF_T& delegate(); + /** @endcond */ + + /** + * The operator->() is provided to be able to directly invoke + * functions on the delegate. + * + * The decision to provide direct access to + * the delegate was motivated by the need for providing a way that + * was not invasive with respect to the CXXDDS API and yet would allow + * for vendor-specific extension. + * Thus vendor-specific extensions can be invoked on the Reference + * and on all its subclasses as follows: + * @code{.cpp} + * my_dds_entity.standard_function(); + * my_dds_entity->vendor_specific_extension(); + * @endcode + * + * @return a reference to delegate. + */ + DELEGATE* operator->(); + + /** @copydoc dds::core::Reference::operator->() */ + const DELEGATE* operator->() const; + + /** @cond + * Functions possibly needed for delegate implementation, but not recommended + * for application usage: exclude from the API documentation for clarity. + * + * Returns an object to the underlying delegate. + */ + operator DELEGATE_REF_T& (); + operator const DELEGATE_REF_T& () const; + /** @endcond */ + +protected: + Reference() {} + + void set_ref(DELEGATE_T* p); + +protected: + DELEGATE_REF_T impl_; +}; + + +} +} /* namespace dds / namespace core */ + + +/** + * Special operator== used to check if this reference object + * does not equal the dds::core::null reference. + * + * The non-null-check can be done like this: + * @code{.cpp} + * if (dds::core::null == r) { + * // Do not use the dds reference object r in its current state + * } + * @endcode + * + * @return true if this reference is not null. + */ +template bool operator == (dds::core::null_type, const dds::core::Reference& r); + +/** + * Special operator!= used to check if this reference object + * does not equal the dds::core::null reference. + * + * The non-null-check can be done like this: + * @code{.cpp} + * if (dds::core::null != r) { + * // Use the dds reference object r + * } + * @endcode + * + * @return true if this reference is not null. + */ +template bool operator != (dds::core::null_type, const dds::core::Reference& r); + +#endif /* OMG_DDS_CORE_REFERENCE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/SafeEnumeration.hpp b/unitree_SDK/include/ddscxx/dds/core/SafeEnumeration.hpp new file mode 100644 index 0000000..6b3f2e7 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/SafeEnumeration.hpp @@ -0,0 +1,79 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_SAFEENUMERATION_HPP_ +#define OMG_DDS_CORE_SAFEENUMERATION_HPP_ + +namespace dds +{ +namespace core +{ + +/** + * safe_enum provides a wrapper for enumerated types in a typesafe + * manner. + * + * safe_enums allow specification of the underlying type, + * do not implictly convert to integers, and resolve scoping issues. + */ +template +class safe_enum : public def +{ + typedef typename def::Type type; + inner val; + +public: + + safe_enum(type v) : val(v) {} + inner underlying() const + { + return val; + } + + bool operator == (const safe_enum& s) const + { + return this->val == s.val; + } + bool operator != (const safe_enum& s) const + { + return this->val != s.val; + } + bool operator < (const safe_enum& s) const + { + return this->val < s.val; + } + bool operator <= (const safe_enum& s) const + { + return this->val <= s.val; + } + bool operator > (const safe_enum& s) const + { + return this->val > s.val; + } + bool operator >= (const safe_enum& s) const + { + return this->val >= s.val; + } +}; + + +} +} + + + +#endif /* OMG_DDS_CORE_SAFEENUMERATION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/TBuiltinTopicTypes.hpp b/unitree_SDK/include/ddscxx/dds/core/TBuiltinTopicTypes.hpp new file mode 100644 index 0000000..b174f77 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/TBuiltinTopicTypes.hpp @@ -0,0 +1,112 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_TBUILTIN_TOPIC_TYPES_HPP_ +#define OMG_DDS_CORE_TBUILTIN_TOPIC_TYPES_HPP_ + + +#if defined (OMG_DDS_X_TYPES_BUILTIN_TOPIC_TYPES_SUPPORT) +namespace dds +{ +namespace core +{ + +template +class TBytesTopicType; + +template +class TStringTopicType; + +template +class TKeyedBytesTopicType; + +template +class TKeyedStringTopicType; +} +} + +template +class dds::core::TBytesTopicType +{ +public: + TBytesTopicType(); + TBytesTopicType(const std::vector& data); +public: + operator std::vector& (); +public: + const std::vector& data(); + void data(const std::vector& bytes); +}; + +template +class dds::core::TStringTopicType +{ +public: + TStringTopicType(); + TStringTopicType(const std::string& data); +public: + operator std::string& (); +public: + const std::string& data(); + void data(const std::string& bytes); +}; + + +/** + * This class represents a built-in topic type that can be used + * to readily create Topics, DataReaders and DataWriters for this type. + * No code generation is required when using this type. + */ +template +class dds::core::TKeyedStringTopicType +{ +public: + TKeyedStringTopicType(); + TKeyedStringTopicType(const std::string& key, const std::string& value); + +public: + const std::string& key() const; + void key(const std::string& value); + + const std::string& value() const; + void value(const std::string& value); +}; + +/** + * This class represents a built-in topic type that can be used + * to readily create Topics, DataReaders and DataWriters for this type. + * No code generation is required when using this type. + */ +template +class dds::core::TKeyedBytesTopicType +{ +public: + TKeyedBytesTopicType(); + TKeyedBytesTopicType(const std::string& key, const std::vector& bytes); + +public: + const std::string& key() const; + void key(const std::string& value); + + const std::vector& value() const; + void value(const std::vector& value); +}; + + +#endif /* OMG_DDS_X_TYPES_BUILTIN_TOPIC_TYPES_SUPPORT */ + +#endif /* OMG_DDS_CORE_TBUILTIN_TOPIC_TYPES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/TEntity.hpp b/unitree_SDK/include/ddscxx/dds/core/TEntity.hpp new file mode 100644 index 0000000..5c6a77d --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/TEntity.hpp @@ -0,0 +1,222 @@ +#ifndef OMG_TDDS_CORE_ENTITY_HPP_ +#define OMG_TDDS_CORE_ENTITY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +#include +#include + +namespace dds +{ +namespace core +{ +template +class TEntity; +} +} + +/** + * @brief This class is the abstract base class for all the DCPS objects. + * + * This class is the abstract base class for all of the DCPS objects + * that support QoS policies a listener and a status condition: + * + * - dds::domain::DomainParticipant + * - dds::sub::Subscriber + * - dds::sub::DataReader + * - dds::pub::Publisher + * - dds::pub::DataWriter + * - dds::topic::Topic + * + * In the ISO C++ PSM each DDS entity behaves like a polymorphic reference + * in that it automatically manages its resource and it can be + * safely assigned up and down the DDS Entity type hierarchy. + * + */ +template +class dds::core::TEntity : public virtual dds::core::Reference +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TEntity, dds::core::Reference, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(TEntity) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_EXPLICIT(TEntity) + +public: + /** + * Enable entity. + * + * This operation enables the Entity. Entity objects can be created + * either enabled or disabled. This is controlled by the value of + * the dds::core::policy::EntityFactory QoS policy on the corresponding + * factory for the Entity. + * + * Enabled entities are immediately activated at creation time meaning all their + * immutable QoS settings can no longer be changed. Disabled Entities are not yet + * activated, so it is still possible to change there immutable QoS settings. However, + * once activated the immutable QoS settings can no longer be changed. + * + * Creating disabled entities can make sense when the creator of the Entity does not + * yet know which QoS settings to apply, thus allowing another piece of code to set the + * QoS later on. + * + * The default setting of dds::core::policy::EntityFactory is such that, + * by default, it is not necessary to explicitly call enable on newly- + * created entities. + * + * The enable operation is idempotent. Calling enable on an already- + * enabled Entity does not raise exceptions and has no effect. + * + * If an Entity has not yet been enabled, the only operations that can be invoked on it + * are: the ones to set, get or copy the QosPolicy settings, the ones that set (or get) the + * listener, the ones that get the StatusCondition, the get_status_changes + * operation (although the status of a disabled entity never changes), and the ‘factory’ + * operations that create, delete or lookup other Entities. Other operations will + * throw the exception dds::core::NotEnabledError. + * + * Entities created from a factory that is disabled are created + * disabled regardless of the setting of the dds::core::policy::EntityFactory + * Qos policy. Calling enable on an Entity whose factory is not + * enabled will fail and throw an dds::core::PreconditionNotMetError + * exception. + * + * If the dds::core::policy::EntityFactory QoS policy has autoenable_created_entities + * set to TRUE, the enable operation on the factory will automatically + * enable all entities created from the factory. + * + * The Listeners associated with an entity are not called until + * the entity is enabled. Conditions associated with an entity that + * is not enabled are inactive; that is, they have a trigger_value==false + * (dds::core::cond::Condition and dds::core::cond::WaitSet). + * + * eg. + * @code{.cpp} + * dds::domain::qos::DomainParticipantQos dpq; + * dpq << dds::core::policy::EntityFactory::ManuallyEnable(); + * ... + * dds::sub::DataReader dr(dp, topic, drqos); + * dr.enable(); + * @endcode + * + * @throw dds::core::PreconditionNotMetError + * Entities' factory is not enabled. + */ + void enable(); + + /** + * This operation returns a mask with the communication statuses in the Entity that + * are “triggered”. + * + * This operation retrieves the list of communication statuses in the Entity + * that are triggered. That is the set of communication statuses whose value have changed + * since the last time the application called this operation. This operation shows + * whether a change has occurred even when the status seems unchanged because the + * status changed back to the original status. + * + * When the Entity is first created or if the Entity is not enabled, all + * communication statuses are in the “un-triggered” state so the mask returned by the + * operation is empty. + * + * The result value is a bit mask in which each bit shows which value has changed. The + * relevant bits represent one of the following statuses: + * - dds::core::status::StatusMask::inconsistent_topic() + * - dds::core::status::StatusMask::offered_deadline_missed() + * - dds::core::status::StatusMask::requested_deadline_missed() + * - dds::core::status::StatusMask::offered_incompatible_qos() + * - dds::core::status::StatusMask::requested_incompatible_qos() + * - dds::core::status::StatusMask::sample_lost() + * - dds::core::status::StatusMask::sample_rejected() + * - dds::core::status::StatusMask::data_on_readers() + * - dds::core::status::StatusMask::data_available() + * - dds::core::status::StatusMask::liveliness_lost() + * - dds::core::status::StatusMask::liveliness_changed() + * - dds::core::status::StatusMask::publication_matched() + * - dds::core::status::StatusMask::subscription_matched() + * + * When the entity is first created, or if the entity is not enabled, + * all communication statuses are in the untriggered state so the list + * returned by the status_changes operation will be empty. + * + * Each status bit is declared as a constant and can be used in an AND operation to + * check the status bit against the result of type StatusMask. Not all statuses are + * relevant to all Entity objects. See the respective Listener interfaces for each + * Entity for more information. + * + * The list of statuses returned by the status_changes operation refers + * to the statuses that are triggered on the Entity itself, and does not + * include statuses that apply to contained entities. + * + * @return dds::core::status::StatusMask + * a bit mask in which each bit shows which value has changed. + */ + const dds::core::status::StatusMask status_changes(); + + /** + * This operation returns the InstanceHandle_t that represents the Entity. + * + * The relevant state of some Entity objects are distributed using built-in topics. + * Each built-in topic sample represents the state of a specific Entity and has a + * unique instance_handle. This operation returns the instance_handle of the + * built-in topic sample that represents the specified Entity.
      + * Some Entities (dds::pub::Publisher and dds::sub::Subscriber) do not have a corresponding + * built-in topic sample, but they still have an instance_handle that uniquely + * identifies the Entity. The instance_handles obtained this way can also be used + * to check whether a specific Entity is located in a specific DomainParticipant + * (dds::domain::DomainParticipant::contains_entity()). + * + * @return dds::core::InstanceHandle + * Result value is the instance_handle of the built-in topic + * sample that represents the state of this Entity. + */ + const dds::core::InstanceHandle instance_handle() const; + + + /** + * This function closes the entity and releases related resources. + * + * Resource management for some reference types might involve relatively heavyweight + * operating- system resources — such as e.g., threads, mutexes, and network sockets — + * in addition to memory. These objects therefore provide a method close() that shall + * halt network communication (in the case of entities) and dispose of any appropriate + * operating-system resources. + * + * Users of this PSM are recommended to call close on objects of all reference types once + * they are finished using them. In addition, implementations may automatically close + * objects that they deem to be no longer in use, subject to the following restrictions: + * - Any object to which the application has a direct reference is still in use. + * - Any object that has been explicitly retained is still in use + * - The creator of any object that is still in use is itself still in use. + */ + void close(); + + /** + * Retain the Entity, even when it goes out of scope. + * + * This function indicates that references to this object may go out of + * scope but that the application expects to look it up again later. + * Therefore the Service must consider this object to be still in use + * and may not close it automatically. + */ + void retain(); +}; + + + +#endif /* OMG_TDDS_CORE_ENTITY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/TEntityQos.hpp b/unitree_SDK/include/ddscxx/dds/core/TEntityQos.hpp new file mode 100644 index 0000000..8e8d8f4 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/TEntityQos.hpp @@ -0,0 +1,159 @@ +#ifndef OMG_TDDS_CORE_QOS_ENTITY_QOS_HPP_ +#define OMG_TDDS_CORE_QOS_ENTITY_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + + +namespace dds +{ +namespace core +{ +template +class TEntityQos; +} +} + +/** + * @brief + * QoS Container + * + * Acts as a container for Qos policies allowing all the policies of + * an entity to be set and retrieved as a unit. + * + * For more information see \ref DCPS_Modules_Infrastructure "Infrastructure Module" + * and \ref DCPS_QoS "Supported Quality of Service" + */ +template +class dds::core::TEntityQos : public dds::core::Value +{ +public: + /** + * Create default QoS. + */ + TEntityQos(); + + /** + * Create copied QoS. + * + * @param other the QoS to copy. + */ + TEntityQos(const TEntityQos& other); + + /** + * Create moved QoS. + * + * @param other the QoS to move. + */ + TEntityQos(TEntityQos&& other); + + /** + * Copy to this QoS. + * + * @param other the QoS to copy. + * + * @return reference to the Qos which was copied to. + */ + TEntityQos& operator=(const TEntityQos& other) = default; + + /** + * Move to this QoS. + * + * @param other the QoS to move. + * + * @return reference to the Qos which was moved to. + */ + TEntityQos& operator=(TEntityQos&& other) = default; + + /** + * Create/copy QoS from different QoS type. + * + * @param qos the QoS to copy policies from. + */ + template + TEntityQos(const TEntityQos& qos); + +public: + /** @cond */ + ~TEntityQos() = default; + /** @endcond */ + +public: + /** + * Generic function for setting a policy applicable to this QoS object. + * Available policies depend on the actual instantiation of the template + * class, which might be DomainParticipantQos, TopicQos, PublisherQos, etc. + * + * @param p the policy to be set for this QoS instance. + */ + template + TEntityQos& policy(const POLICY& p); + + /** + * Generic function for obtaining the value of a specific policy + * belonging to this QoS instance. + * + * @return policy + */ + template + const POLICY& policy() const; + + /** + * Generic function for obtaining the value of a specific policy + * belonging to this QoS instance. + * + * @return policy + */ + template + POLICY& policy(); + + /** + * Generic function for setting a policy applicable to this QoS object. + * Available policies depend on the actual instantiation of the template + * class, which might be DomainParticipantQos, TopicQos, PublisherQos, etc. + * + * @param p the policy to be set for this QoS instance. + */ + template + TEntityQos& operator << (const POLICY& p); + + /** + * Generic function for obtaining the value of a specific policy + * belonging to this QoS instance. + * + * @return policy + */ + template + const TEntityQos& operator >> (POLICY& p) const; + + /** + * Generic function for setting a policy applicable to this QoS object. + * Available policies depend on the actual instantiation of the template + * class, which might be DomainParticipantQos, TopicQos, PublisherQos, etc. + * + * @param other the TEntityQos to set + */ + template + TEntityQos& operator = (const TEntityQos& other); + +}; +/* namespace tdds / namespace core / namespace qos */ + +#endif /* OMG_TDDS_CORE_QOS_ENTITY_QOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/TInstanceHandle.hpp b/unitree_SDK/include/ddscxx/dds/core/TInstanceHandle.hpp new file mode 100644 index 0000000..f38e630 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/TInstanceHandle.hpp @@ -0,0 +1,139 @@ +#ifndef OMG_TDDS_CORE_INSTANCE_HANDLE_HPP_ +#define OMG_TDDS_CORE_INSTANCE_HANDLE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + + +namespace dds +{ +namespace core +{ +template +class TInstanceHandle; +} +} + +/** + * @brief + * Class to hold the handle associated with in sample instance. + */ +template +class dds::core::TInstanceHandle : public dds::core::Value +{ +public: + /** + * Create an nil instance handle. + */ + TInstanceHandle(); + + /** + * Create an nil instance handle. + * + * @param nullHandle placeholder + */ + TInstanceHandle(const dds::core::null_type& nullHandle); + + /** + * Copy an existing InstanceHandle + * + * @param other InstanceHandle to copy + */ + TInstanceHandle(const TInstanceHandle& other); + + /** + * Move an existing InstanceHandle + * + * @param other InstanceHandle to move + */ + TInstanceHandle(TInstanceHandle&& other); + + /** @cond */ + ~TInstanceHandle() = default; + /** @endcond */ + + /** + * @cond + * Parametric constructor for creating an instance-handle + * from some other type. This function is intended for internal + * usage. + */ + template + TInstanceHandle(const ARG0& arg0); + /** @endcond */ + +public: + /** + * Copy-assign an existing InstanceHandle to this InstanceHandle + * + * @param that The TInstanceHandle to assign to this + */ + TInstanceHandle& operator=(const TInstanceHandle& that); + + /** + * Move-assign an existing InstanceHandle to this InstanceHandle + * + * @param that The TInstanceHandle to assign to this + */ + TInstanceHandle& operator=(TInstanceHandle&& that); + + /** + * Compare this InstanceHandle to another InstanceHandle + * + * @param that The TInstanceHandle to compare + * @return true if they match + */ + bool operator==(const TInstanceHandle& that) const; + + /** + * Compare this InstanceHandle to another InstanceHandle + * + * @param that The TInstanceHandle to compare + * @return true if this is less than that + */ + bool operator<(const TInstanceHandle& that) const; + + /** + * Compare this InstanceHandle to another InstanceHandle + * + * @param that The TInstanceHandle to compare + * @return true if this is greater than that + */ + bool operator>(const TInstanceHandle& that) const; + +public: + /** + * Create an nil instance handle. + * + * @return a nil InstanceHandle + */ + static const TInstanceHandle nil(); + + /** + * Check if the InstanceHandle is nil. + * + * @return true if the InstanceHandle is nil + */ + bool is_nil() const; +}; + + +#endif // !defined(OMG_TDDS_CORE_INSTANCE_HANDLE_HPP_) diff --git a/unitree_SDK/include/ddscxx/dds/core/TQosProvider.hpp b/unitree_SDK/include/ddscxx/dds/core/TQosProvider.hpp new file mode 100644 index 0000000..9abf7ed --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/TQosProvider.hpp @@ -0,0 +1,342 @@ +#ifndef OMG_DDS_CORE_QOS_TPROVIDER_HPP_ +#define OMG_DDS_CORE_QOS_TPROVIDER_HPP_ + + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +#include + +#include + +#include +#include + +#include +#include + +namespace dds +{ +namespace core +{ +template +class TQosProvider; +} +} + +/** + * @brief + * The QosProvider API allows users to specify the QoS settings of their DCPS + * entities outside of application code in XML. + * + * The QosProvider is delivered as part of the DCPS API of Vortex OpenSplice. + * + * @see for more information: @ref DCPS_QoS_Provider "QoS Provider extensive information." + */ +template +class dds::core::TQosProvider : public dds::core::Reference +{ +public: + /** + * Constructs a new QosProvider based on the provided uri and profile. + * + * A QosProvider instance that is instantiated with all profiles and/or QoS’s loaded + * from the location specified by the provided uri. + * + * Initialization of the QosProvider will fail under the following conditions:
      + * - No uri is provided. + * - The resource pointed to by uri cannot be found. + * - The content of the resource pointed to by uri is malformed (e.g., malformed XML). + * When initialization fails (for example, due to a parse error or when the resource + * identified by uri cannot be found), then PreconditionNotMetError will be thrown. + * + * Look @ref DCPS_QoS_Provider "here" for more information. + * + * @param uri A Uniform Resource Identifier (URI) that points to the location + * where the QoS profile needs to be loaded from. Currently only URI’s with a + * ‘file’ scheme that point to an XML file are supported. If profiles and/or QoS + * settings are not uniquely identifiable by name within the resource pointed to by + * uri, a random one of them will be stored. + * @param profile The name of the QoS profile within the xml file that serves as the default QoS + * profile for the get qos operations. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * When multiple thread try to invoke the function concurrently. + */ + explicit TQosProvider(const std::string& uri, const std::string& profile); + + /** + * Constructs a new QosProvider based on the provided uri. + * + * A QosProvider instance that is instantiated with all profiles and/or QoS’s loaded + * from the location specified by the provided uri. + * + * Initialization of the QosProvider will fail under the following conditions:
      + * - No uri is provided. + * - The resource pointed to by uri cannot be found. + * - The content of the resource pointed to by uri is malformed (e.g., malformed XML). + * When initialization fails (for example, due to a parse error or when the resource + * identified by uri cannot be found), then PreconditionNotMetError will be thrown. + * + * Look @ref DCPS_QoS_Provider "here" for more information. + * + * @param uri A Uniform Resource Identifier (URI) that points to the location + * where the QoS profile needs to be loaded from. Currently only URI’s with a + * ‘file’ scheme that point to an XML file are supported. If profiles and/or QoS + * settings are not uniquely identifiable by name within the resource pointed to by + * uri, a random one of them will be stored. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * When multiple thread try to invoke the function concurrently. + */ + explicit TQosProvider(const std::string& uri); + + /** + * Resolves the DomainParticipantQos from the uri this QosProvider is associated with. + * + * @return DomainParticipantQos from the given URI (and profile) + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no DomainParticipantQos can be found within the uri associated + * with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::domain::qos::DomainParticipantQos participant_qos(); + + /** + * Resolves the DomainParticipantQos identified by the id from the uri this + * QosProvider is associated with. + * + * @param id The fully-qualified name that identifies a QoS within the uri + * associated with the QosProvider or a name that identifies a QoS within the + * uri associated with the QosProvider instance relative to its default QoS + * profile. Id’s starting with ‘::’ are interpreted as fully-qualified names and all + * others are interpreted as names relative to the default QoS profile of the + * QosProvider instance. When id is NULL it is interpreted as a non-named QoS + * within the default QoS profile associated with the QosProvider. + * @return DomainParticipantQos from the given URI (and profile) using the id + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no DomainParticipantQos that matches the provided id can be + * found within the uri associated with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::domain::qos::DomainParticipantQos participant_qos(const std::string& id); + + /** + * Resolves the TopicQos from the uri this QosProvider is associated with. + * + * @return TopicQos from the given URI (and profile) + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no TopicQos can be found within the uri associated + * with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::topic::qos::TopicQos topic_qos(); + + /** + * Resolves the TopicQos identified by the id from the uri this + * QosProvider is associated with. + * + * @param id The fully-qualified name that identifies a QoS within the uri + * associated with the QosProvider or a name that identifies a QoS within the + * uri associated with the QosProvider instance relative to its default QoS + * profile. Id’s starting with ‘::’ are interpreted as fully-qualified names and all + * others are interpreted as names relative to the default QoS profile of the + * QosProvider instance. When id is NULL it is interpreted as a non-named QoS + * within the default QoS profile associated with the QosProvider. + * @return TopicQos from the given URI (and profile) using the id + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no TopicQos that matches the provided id can be + * found within the uri associated with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::topic::qos::TopicQos topic_qos(const std::string& id); + + /** + * Resolves the SubscriberQos from the uri this QosProvider is associated with. + * + * @return SubscriberQos from the given URI (and profile) + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no SubscriberQos can be found within the uri associated + * with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::sub::qos::SubscriberQos subscriber_qos(); + + /** + * Resolves the SubscriberQos identified by the id from the uri this + * QosProvider is associated with. + * + * @param id The fully-qualified name that identifies a QoS within the uri + * associated with the QosProvider or a name that identifies a QoS within the + * uri associated with the QosProvider instance relative to its default QoS + * profile. Id’s starting with ‘::’ are interpreted as fully-qualified names and all + * others are interpreted as names relative to the default QoS profile of the + * QosProvider instance. When id is NULL it is interpreted as a non-named QoS + * within the default QoS profile associated with the QosProvider. + * @return SubscriberQos from the given URI (and profile) using the id + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no SubscriberQos that matches the provided id can be + * found within the uri associated with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::sub::qos::SubscriberQos subscriber_qos(const std::string& id); + + /** + * Resolves the DataReaderQos from the uri this QosProvider is associated with. + * + * @return DataReadertQos from the given URI (and profile) + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no DataReaderQos can be found within the uri associated + * with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::sub::qos::DataReaderQos datareader_qos(); + + /** + * Resolves the DataReaderQos identified by the id from the uri this + * QosProvider is associated with. + * + * @param id The fully-qualified name that identifies a QoS within the uri + * associated with the QosProvider or a name that identifies a QoS within the + * uri associated with the QosProvider instance relative to its default QoS + * profile. Id’s starting with ‘::’ are interpreted as fully-qualified names and all + * others are interpreted as names relative to the default QoS profile of the + * QosProvider instance. When id is NULL it is interpreted as a non-named QoS + * within the default QoS profile associated with the QosProvider. + * @return DataReaderQos from the given URI (and profile) using the id + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no DataReaderQos that matches the provided id can be + * found within the uri associated with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::sub::qos::DataReaderQos datareader_qos(const std::string& id); + + /** + * Resolves the PublisherQos from the uri this QosProvider is associated with. + * + * @return PublisherQos from the given URI (and profile) + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no PublisherQos can be found within the uri associated + * with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::pub::qos::PublisherQos publisher_qos(); + + /** + * Resolves the PublisherQos identified by the id from the uri this + * QosProvider is associated with. + * + * @param id The fully-qualified name that identifies a QoS within the uri + * associated with the QosProvider or a name that identifies a QoS within the + * uri associated with the QosProvider instance relative to its default QoS + * profile. Id’s starting with ‘::’ are interpreted as fully-qualified names and all + * others are interpreted as names relative to the default QoS profile of the + * QosProvider instance. When id is NULL it is interpreted as a non-named QoS + * within the default QoS profile associated with the QosProvider. + * @return PublisherQos from the given URI (and profile) using the id + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no PublisherQos that matches the provided id can be + * found within the uri associated with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::pub::qos::PublisherQos publisher_qos(const std::string& id); + + /** + * Resolves the DataWriterQos from the uri this QosProvider is associated with. + * + * @return DataWriterQos from the given URI (and profile) + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no DataWriterQos can be found within the uri associated + * with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::pub::qos::DataWriterQos datawriter_qos(); + + /** + * Resolves the DataWriterQos identified by the id from the uri this + * QosProvider is associated with. + * + * @param id The fully-qualified name that identifies a QoS within the uri + * associated with the QosProvider or a name that identifies a QoS within the + * uri associated with the QosProvider instance relative to its default QoS + * profile. Id’s starting with ‘::’ are interpreted as fully-qualified names and all + * others are interpreted as names relative to the default QoS profile of the + * QosProvider instance. When id is NULL it is interpreted as a non-named QoS + * within the default QoS profile associated with the QosProvider. + * @return DataWriterQos from the given URI (and profile) using the id + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::PreconditionNotMetError + * If no DataWriterQos that matches the provided id can be + * found within the uri associated with the QosProvider. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::pub::qos::DataWriterQos datawriter_qos(const std::string& id); +}; + +#endif /* OMG_DDS_CORE_QOS_TPROVIDER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/Time.hpp b/unitree_SDK/include/ddscxx/dds/core/Time.hpp new file mode 100644 index 0000000..ffd4df5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/Time.hpp @@ -0,0 +1,212 @@ +#ifndef OMG_DDS_CORE_TIME_HPP_ +#define OMG_DDS_CORE_TIME_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace core +{ +class Duration; +class Time; +} +} + +/** +* Time represents a time value and can: +* +* * Be incremented by Duration expressed as seconds, +* nanoseconds, milliseconds, or Duration objects. +* +* * Be converted to and from Times expressed in +* milliseconds (or other units) as integer types. +*/ +class OMG_DDS_API dds::core::Time +{ +public: + static const Time invalid(); // {-1, 0xffffffff} + +public: + /** + * Create a Time from a number of microseconds + * + * @param microseconds number of microseconds + */ + static const Time from_microsecs(int64_t microseconds); + /** + * Create a Time from a number of milliseconds + * + * @param milliseconds number of miliseconds + */ + static const Time from_millisecs(int64_t milliseconds); + /** + * Create a Time from a number of seconds + * + * @param seconds number of seconds + */ + static const Time from_secs(double seconds); + +public: + /** + * Create a Time of zero seconds. + */ + Time(); + /** + * Create a Time elapsing a specific amount of time. + */ + explicit Time(int64_t sec, uint32_t nanosec = 0); + +public: + /** + * @return number of seconds + */ + int64_t sec() const; + + /** + * Set number of seconds + * @param s number of seconds + */ + void sec(int64_t s); + + /** + * @return number of nanoseconds + */ + uint32_t nanosec() const; + + /** + * Set number of nanoseconds + * @param ns number of nanoseconds + */ + void nanosec(uint32_t ns); + +public: + /** + * Returns an integer indicating the result of a comparison + * of two Times: + * 1 if this Time is greater than the comparator (that) + * -1 if the Time is less than the comparator (that) + * 0 if the Time matches the comparator (that) + * + * @param that Time to compare + * @return comparison result + */ + int compare(const Time& that) const; + + /** + * @param that Time to compare + * @return true if the Time is greater than the comparator + */ + bool operator >(const Time& that) const; + + /** + * @param that Time to compare + * @return true if the Time is greater than or equal to the comparator + */ + bool operator >=(const Time& that) const; + + /** + * @param that Time to compare + * @return true if the Time is not equal to the comparator + */ + bool operator !=(const Time& that) const; + + /** + * @param that Time to compare + * @return true if the Time is equal to the comparator + */ + bool operator ==(const Time& that) const; + /** + * @param that Time to compare + * @return true if the Time is less than or equal to the comparator + */ + bool operator <=(const Time& that) const; + /** + * @param that Time to compare + * @return true if the Time is less than the comparator + */ + bool operator <(const Time& that) const; + +public: + /** + * @param a_ti Duration to add + * @return Time value + Duration + */ + Time& operator+=(const Duration& a_ti); + /** + * @param a_ti Duration to subtract + * @return Time value - Duration + */ + Time& operator-=(const Duration& a_ti); + +public: + /** + * Returns this Time in milliseconds. + * + * @return this Time in milliseconds + */ + int64_t to_millisecs() const; + + /** + * Returns this Time in micro-seconds. + * + * @return this Time in micro-seconds + */ + int64_t to_microsecs() const; + + /** + * Returns this Time in seconds. + * + * @return this Time in seconds + */ + double to_secs() const; + +private: + int64_t sec_; + uint32_t nsec_; +}; + +// Time arithmetic operators. +/** + * Add a Duration to a Time value + * @param lhs Time + * @param rhs Duration + * @return Time * Duration + */ +const dds::core::Time OMG_DDS_API operator +(const dds::core::Time& lhs, const dds::core::Duration& rhs); + +/** + * Add a Duration to a Time value + * @param lhs Duration + * @param rhs Time + * @return Duration + Time + */ +const dds::core::Time OMG_DDS_API operator +(const dds::core::Duration& lhs, const dds::core::Time& rhs); + +/** + * Subtract a Duration from a Time value + * @param lhs Time + * @param rhs Duration + * @return Time - Duration + */ +const dds::core::Time OMG_DDS_API operator -(const dds::core::Time& lhs, const dds::core::Duration& rhs); + + +#endif /* OMG_DDS_CORE_TIME_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/Value.hpp b/unitree_SDK/include/ddscxx/dds/core/Value.hpp new file mode 100644 index 0000000..d7ec1d6 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/Value.hpp @@ -0,0 +1,200 @@ +#ifndef OMG_DDS_CORE_VALUE_HPP_ +#define OMG_DDS_CORE_VALUE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +namespace dds +{ +namespace core +{ +template +class Value; +} +} + +/** + * @brief + * This class is the base for various value-type dds objects. + * + * QoS, Policy, Statuses, and Topic samples are all modeled as value-types. + * + * All objects that have a value-type have a deep-copy assignment and copy + * construction semantics. + * It should also be pointed out that value-types are not 'pure-value-types' in + * the sense that they are immutable (as in functional programming languages). + * + * The DDS-PSM-Cxx makes value-types mutable to limit the number of copies as well + * as to limit the time-overhead necessary to change a value-type + * (note that for immutable value-types the only form of change is to create a new + * value-type). + */ +template +class dds::core::Value +{ +protected: + Value(); + Value(const Value& p) = default; //check on this != &p? + Value(Value&& p) = default; //check on this != &p? + +public: + /** @cond + * The following Constructors are not really relevant for the API. + * So, leave them from the doxygen generated API documentation for clarity. + */ + + /** + * Create a value-type object of one internal value + * + * @param arg VALUETYPE value + */ + template + Value(const ARG& arg); + + /** + * Create a value-type object of two internal value + * + * @param arg1 VALUETYPES value + * @param arg2 VALUETYPES value + */ + template + Value(const ARG1& arg1, const ARG2& arg2); + + /** + * Create a value-type object of three internal value + * + * @param arg1 VALUETYPES value + * @param arg2 VALUETYPES value + * @param arg3 VALUETYPES value + */ + template + Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3); + + /** + * Create a value-type object of four internal value + * + * @param arg1 VALUETYPES value + * @param arg2 VALUETYPES value + * @param arg3 VALUETYPES value + * @param arg4 VALUETYPES value + */ + template + Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4); + + /** + * Create a value-type object of five internal value + * + * @param arg1 VALUETYPES value + * @param arg2 VALUETYPES value + * @param arg3 VALUETYPES value + * @param arg4 VALUETYPES value + * @param arg5 VALUETYPES value + */ + template + Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4, const ARG5& arg5); + + /** + * Create a value-type object of six internal value + * + * @param arg1 VALUETYPES value + * @param arg2 VALUETYPES value + * @param arg3 VALUETYPES value + * @param arg4 VALUETYPES value + * @param arg5 VALUETYPES value + * @param arg6 VALUETYPES value + */ + template + Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4, const ARG5& arg5, const ARG6& arg6); + /** @endcond */ + +public: + /** @cond */ + ~Value() = default; + /** @endcond */ + +public: + /** + * Assigns new delegate to this Value + * @param other Value + */ + Value& operator=(const Value& other); + + /** + * Moves delegate to this Value + * @param other Value + */ + Value& operator=(Value&& other); + + /** + * Compare this Value with another Value + * + * @param other Value + * @return true if equal + */ + bool operator==(const Value& other) const; + + /** + * Compare this Value with another Value + * + * @param other Value + * @return true if not equal + */ + bool operator !=(const Value& other) const; + +public: + /** + * The operator->() is provided to be able to directly invoke + * functions on the delegate. + * + * The decision to provide direct access to + * the delegate was motivated by the need for providing a way that + * was not invasive with respect to the CXXDDS API and yet would allow + * for vendor-specific extension. + * Thus vendor-specific extensions can be invoked on the Value + * and on all its subclasses as follows: + * @code{.cpp} + * my_dds_value.standard_function(); + * my_dds_value->vendor_specific_extension(); + * @endcode + * + * @return a reference to delegate. + */ + D* operator->(); + + /** @copydoc dds::core::Value::operator->() */ + const D* operator->() const; + + /** @cond + * Functions possibly needed for delegate implementation, but not recommended + * for application usage: exclude from the API documentation for clarity. + * + * Returns an object to the underlying delegate. + */ + const D& delegate() const; + D& delegate(); + operator D& (); + operator const D& () const; + /** @endcond */ + +protected: + D d_; +}; + + +#endif /* OMG_DDS_CORE_VALUE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/WeakReference.hpp b/unitree_SDK/include/ddscxx/dds/core/WeakReference.hpp new file mode 100644 index 0000000..993e122 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/WeakReference.hpp @@ -0,0 +1,79 @@ +#ifndef OMG_DDS_CORE_WEAK_REFERENCE_HPP_ +#define OMG_DDS_CORE_WEAK_REFERENCE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace core +{ +template +class WeakReference; +} +} +/** + * @brief + * The WeakReference class enables you to maintain a weak + * reference to a DDS reference type. + * + * The existence of a weak link will not prevent the garbage + * collection of the reference type. + */ +template +class dds::core::WeakReference +{ +public: + typedef T ReferenceType; + +public: + /** + * Creates a weak reference without an referenced dds object. + */ + WeakReference(); + + /** + * Creates a weak reference for the reference type passed as argument. + * + * @param t dds object the new weak reference will refer to + */ + WeakReference(const T& t); + + /** + * Checks whether the underlying reference has been deleted. + * + * @returns true if the underlying reference has expired, false otherwise + */ + bool expired(); + + /** + * Gives access to the underlying shared reference. + * + * If the reference has expired the returned object will be referencing 'dds::core::null'. + * + * @return referenced dds object + */ + T lock(); + +private: + typename T::DELEGATE_WEAK_REF_T impl_; +}; + +#endif /* OMG_DDS_CORE_WEAK_REFERENCE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/array.hpp b/unitree_SDK/include/ddscxx/dds/core/array.hpp new file mode 100644 index 0000000..40c7a98 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/array.hpp @@ -0,0 +1,31 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef ORG_OMG_DDS_CORE_ARRAY_HPP_ +#define ORG_OMG_DDS_CORE_ARRAY_HPP_ + +#include + +namespace dds +{ +namespace core +{ +using dds::core::detail::array; +} +} + +#endif /* ORG_OMG_DDS_CORE_ARRAY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/Condition.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/Condition.hpp new file mode 100644 index 0000000..b7c23ac --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/Condition.hpp @@ -0,0 +1,35 @@ +#ifndef OMG_DDS_CORE_COND_CONDITION_HPP_ +#define OMG_DDS_CORE_COND_CONDITION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +typedef dds::core::cond::detail::Condition Condition; +} +} +} + +#endif /* OMG_DDS_CORE_COND_CONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/GuardCondition.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/GuardCondition.hpp new file mode 100644 index 0000000..aae8d6e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/GuardCondition.hpp @@ -0,0 +1,36 @@ +#ifndef OMG_DDS_CORE_COND_GUARDCONDITION_HPP_ +#define OMG_DDS_CORE_COND_GUARDCONDITION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +typedef dds::core::cond::detail::GuardCondition GuardCondition; +} +} +} + +#endif /* OMG_DDS_CORE_COND_GUARDCONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/StatusCondition.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/StatusCondition.hpp new file mode 100644 index 0000000..bee2747 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/StatusCondition.hpp @@ -0,0 +1,35 @@ +#ifndef OMG_DDS_CORE_STATUSCONDITION_HPP_ +#define OMG_DDS_CORE_STATUSCONDITION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ +#include +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +typedef detail::StatusCondition StatusCondition; +} +} +} + +#endif /* OMG_DDS_CORE_STATUSCONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/TCondition.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/TCondition.hpp new file mode 100644 index 0000000..74e40b9 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/TCondition.hpp @@ -0,0 +1,117 @@ +#ifndef OMG_TDDS_DDS_CORE_COND_CONDITION_HPP_ +#define OMG_TDDS_DDS_CORE_COND_CONDITION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +template +class TCondition; +} +} +} + +/** + * @brief + * This class is the base class for all the conditions that may be attached to a dds::core::cond::WaitSet. + * + * This base class is specialized in three classes by the Data Distribution Service: + * - dds::core::cond::GuardCondition + * - dds::core::cond::StatusCondition + * - dds::sub::cond::ReadCondition + * - dds::sub::cond::QueryCondition + * + * Each Condition has a trigger_value that can be TRUE or FALSE and is set by + * the Data Distribution Service (except a GuardCondition) depending on the + * evaluation of the Condition. + * + * @see for more information: @ref DCPS_Modules_Infrastructure_Status "Status concept" + * @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept" + */ +template +class dds::core::cond::TCondition : public virtual dds::core::Reference +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TCondition, dds::core::Reference, DELEGATE) + OMG_DDS_EXPLICIT_REF_BASE_DECL(TCondition, dds::core::cond::detail::StatusCondition) + OMG_DDS_EXPLICIT_REF_BASE_DECL(TCondition, dds::core::cond::detail::GuardCondition) + OMG_DDS_EXPLICIT_REF_BASE_DECL(TCondition, dds::sub::cond::detail::ReadCondition) + OMG_DDS_EXPLICIT_REF_BASE_DECL(TCondition, dds::sub::cond::detail::QueryCondition) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_EXPLICIT(TCondition) + +public: + /** + * Registers a functor as custom handler with this Condition. + * + * The supplied functor will be called when this Condition is triggered + * and either the dds::core::cond::Condition::dispatch() is called or the + * dds::core::cond::WaitSet::dispatch() on the WaitSet to which this + * Condition is attached to. + * + * @param func The functor to be called when the StatusCondition triggers. + * @throw dds::core::Exception + */ + template + void handler(Functor func); + + /** + * Resets the handler for this Condition. + * + * After the invocation of this function no handler will be registered with + * this Condition. + * + * @throw dds::core::Exception + */ + void reset_handler(); + + /** + * Dispatches the functor that have been registered with the Condition. + * + * The Condition has to have been triggered for the functor will be called + * by this function. + * + * @throw dds::core::Exception + */ + void dispatch(); + + /** + * This operation retrieves the trigger_value of the Condition. + * + * A Condition has a trigger_value that can be TRUE or FALSE and is set by the + * Data Distribution Service (except a GuardCondition). This operation returns the + * trigger_value of the Condition. + * + * @return bool The boolean value to which the Condition is set. + * @throw dds::core::Exception + */ + bool trigger_value() const; + +}; + +#endif /* OMG_TDDS_DDS_CORE_CONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/TGuardCondition.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/TGuardCondition.hpp new file mode 100644 index 0000000..dc62e44 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/TGuardCondition.hpp @@ -0,0 +1,124 @@ +#ifndef OMG_TDDS_CORE_COND_GUARD_CONDITION_HPP_ +#define OMG_TDDS_CORE_COND_GUARD_CONDITION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + + +namespace dds +{ +namespace core +{ +namespace cond +{ +template +class TGuardCondition; +} +} +} + +/** + * @brief + * A GuardCondition object is a specific Condition whose trigger_value is + * completely under the control of the application. + * + * When a GuardCondition is initially created, the trigger_value is FALSE. + * + * The purpose of the GuardCondition is to provide the means for the + * application to manually triggering a WaitSet to stop waiting. This is accomplished by + * attaching the GuardCondition to the WaitSet and then setting the + * trigger_value by means of the set trigger_value operation. + * + * @code{.cpp} + * dds::core::cond::GuardCondition guard; + * dds::core::cond::WaitSet waitset; + * waitset.attach_condition(guard); + * waitset.wait(); + * ... + * // To wakeup waitset, do in another thread: + * guard.trigger_value(true); + * @endcode + * See the @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" for more examples.
      + * Although the WaitSet examples use the StatusCondition, the basic usage of this Condition + * with a WaitSet is the same. + * + * @see dds::core::cond::Condition + * @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept" + * @see for more information: @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" + */ +template +class dds::core::cond::TGuardCondition : public dds::core::cond::TCondition +{ +public: + OMG_DDS_REF_TYPE_NO_DC(TGuardCondition, dds::core::cond::TCondition, DELEGATE) + OMG_DDS_EXPLICIT_REF_BASE(TGuardCondition, dds::core::cond::Condition) + +public: + /** + * Create a dds::core::cond::GuardCondition. + * + * The GuardCondition can then be added to a dds::core::cond::WaitSet so that the + * application can manually wake up a thread that is blocked on that WaitSet. + * + * @throw dds::core::Exception + */ + TGuardCondition(); + + /** + * Create a dds::core::cond::GuardCondition. + * + * The GuardCondition can then be added to a dds::core::cond::WaitSet so that the + * application can manually wake up a thread that is blocked on that WaitSet. + * + * The supplied functor will be called when this GuardCondition is triggered + * and either the inherited dds::core::cond::Condition::dispatch() is called or the + * dds::core::cond::WaitSet::dispatch() on the WaitSet to which this GuardCondition is + * attached to. + * + * @param functor The functor to be called when the GuardCondition triggers. + * @throw dds::core::Exception + */ + template + TGuardCondition(FUN functor); + +public: + + /** + * This operation sets the trigger_value of the GuardCondition. + * + * A GuardCondition object is a specific Condition which trigger_value is + * completely under the control of the application. This operation must be used by the + * application to manually wake-up a WaitSet. This operation sets the + * trigger_value of the GuardCondition to the parameter value. The + * GuardCondition is directly created using the GuardCondition constructor. + * When a GuardCondition is initially created, the trigger_value is FALSE. + * + * @param value The boolean value to which the GuardCondition is set. + * @throw dds::core::Exception + */ + void trigger_value(bool value); + + /** + * @copydoc dds::core::cond::TCondition::trigger_value() + */ + bool trigger_value(); +}; + +#endif /* OMG_TDDS_CORE_GUARD_CONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/TStatusCondition.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/TStatusCondition.hpp new file mode 100644 index 0000000..260099b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/TStatusCondition.hpp @@ -0,0 +1,218 @@ +#ifndef OMG_DDS_CORE_T_STATUS_CONDITION_HPP_ +#define OMG_DDS_CORE_T_STATUS_CONDITION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +template +class TStatusCondition; +} +} +} + +/** + * @brief + * A StatusCondition object is a specific Condition that is associated with each Entity. + * + * Entity objects that have status attributes also have a StatusCondition, access is + * provided to the application by the get_statuscondition operation. + * The communication statuses whose changes can be communicated to the application + * depend on the Entity. The following table shows the relevant statuses for each + * Entity. + * + * Entity | Status Name + * -------------------- | -------------------- + * dds::topic::Topic | dds::core::status::StatusMask::inconsistent_topic() + * dds::sub::Subscriber | dds::core::status::StatusMask::data_on_readers() + * dds::sub::DataReader | dds::core::status::StatusMask::sample_rejected()
      dds::core::status::StatusMask::liveliness_changed()
      dds::core::status::StatusMask::requested_deadline_missed()
      dds::core::status::StatusMask::requested_incompatible_qos()
      dds::core::status::StatusMask::data_available()
      dds::core::status::StatusMask::sample_lost()
      dds::core::status::StatusMask::subscription_matched() + * dds::pub::DataWriter | dds::core::status::StatusMask::liveliness_lost()
      dds::core::status::StatusMask::offered_deadline_missed()
      dds::core::status::StatusMask::offered_incompatible_qos()
      dds::core::status::StatusMask::publication_matched() + * + * The inherited dds::core::cond::Condition::trigger_value() of the StatusCondition + * depends on the communication statuses of that Entity (e.g., missed deadline) and + * also depends on the value of the dds::core::status::StatusMask. + * + * A StatusCondition can be attached to a WaitSet in order to allow an application + * to suspend until the trigger_value has become TRUE. + * + * The trigger_value of a StatusCondition will be TRUE if one of the enabled + * StatusChangedFlags is set. That is, trigger_value==FALSE only if all the + * values of the StatusChangedFlags are FALSE. + * + * The sensitivity of the StatusCondition to a particular communication status is + * controlled by the list of enabled_statuses set on the condition by means of + * dds::core::cond::StatusCondition::enabled_statuses(const ::dds::core::status::StatusMask& status) + * When the enabled_statuses are not changed by that + * operation, all statuses are enabled by default. + * + * See the @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" for examples + * how to use this Condition. + * + * @see dds::core::cond::Condition + * @see for more information: @ref DCPS_Modules_Infrastructure_Status "Status concept" + * @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept" + * @see for more information: @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" + */ +template +class dds::core::cond::TStatusCondition : public dds::core::cond::TCondition +{ +public: + OMG_DDS_REF_TYPE_DELEGATE_C(TStatusCondition, dds::core::cond::TCondition, DELEGATE) + OMG_DDS_EXPLICIT_REF_BASE(TStatusCondition, dds::core::cond::Condition) + + /** + * Create a dds::core::cond::StatusCondition associated with an Entity. + * + * The StatusCondition can then be added to a dds::core::cond::WaitSet so that the + * application can wait for specific status changes that affect the Entity. + * + * @param e The Entity to associate with the StatusCondition. + * @throw dds::core::Exception + */ + TStatusCondition(const dds::core::Entity& e); + + /** + * Create a dds::core::cond::StatusCondition associated with an Entity. + * + * The StatusCondition can then be added to a dds::core::cond::WaitSet so that the + * application can wait for specific status changes that affect the Entity. + * + * The supplied functor will be called when this StatusCondition is triggered + * and either the inherited dds::core::cond::Condition::dispatch() is called or the + * dds::core::cond::WaitSet::dispatch() on the WaitSet to which this StatusCondition is + * attached to. + * + * @param e The Entity to associate with the StatusCondition. + * @param functor The functor to be called when the StatusCondition triggers. + * @throw dds::core::Exception + */ + template + TStatusCondition(const dds::core::Entity& e, FUN functor); + +public: + /** + * This operation sets the list of communication statuses that are taken into account to + * determine the trigger_value of the StatusCondition. + * + * The inherited dds::core::cond::Condition::trigger_value() of the StatusCondition + * depends on the communication status of that Entity (e.g., missed deadline, + * loss of information, etc.), ‘filtered’ by the set of enabled_statuses on the StatusCondition. + * + * This operation sets the list of communication statuses that are taken into account to + * determine the trigger_value of the StatusCondition. This operation may + * change the trigger_value of the StatusCondition. + * + * dds::core::cond::WaitSet objects behaviour depend on the changes of the trigger_value of + * their attached Conditions. Therefore, any WaitSet to which the StatusCondition + * is attached is potentially affected by this operation. + * If this function is not invoked, the default list of enabled_statuses includes all + * the statuses. + * + * The result value is a bit mask in which each bit shows which value has changed. The + * relevant bits represent one of the following statuses: + * - dds::core::status::StatusMask::inconsistent_topic() + * - dds::core::status::StatusMask::offered_deadline_missed() + * - dds::core::status::StatusMask::requested_deadline_missed() + * - dds::core::status::StatusMask::offered_incompatible_qos() + * - dds::core::status::StatusMask::requested_incompatible_qos() + * - dds::core::status::StatusMask::sample_lost() + * - dds::core::status::StatusMask::sample_rejected() + * - dds::core::status::StatusMask::data_on_readers() + * - dds::core::status::StatusMask::data_available() + * - dds::core::status::StatusMask::liveliness_lost() + * - dds::core::status::StatusMask::liveliness_changed() + * - dds::core::status::StatusMask::publication_matched() + * - dds::core::status::StatusMask::subscription_matched() + * + * Each status bit is declared as a constant and can be used in an AND operation to + * check the status bit against the result of type StatusMask. Not all statuses are + * relevant to all Entity objects. See the respective Listener interfaces for each + * Entity for more information. + * + * @param status A bit mask in which each bit sets the status which is taken + * into account for the StatusCondition.the enabled statuses. + * @throw dds::core::AlreadyClosedError + * @throw dds::core::Error + */ + void + enabled_statuses(const ::dds::core::status::StatusMask& status) const; + + /** + * This operation returns the list of enabled communication statuses of the + * StatusCondition. + * + * The inherited dds::core::cond::Condition::trigger_value() of the StatusCondition + * depends on the communication status of that Entity (e.g., missed deadline, + * loss of information, etc.), ‘filtered’ by the set of enabled_statuses on the StatusCondition. + * + * This operation returns the list of communication statuses that are taken into account + * to determine the trigger_value of the StatusCondition. This operation + * returns the statuses that were explicitly set on the last call to + * dds::core::cond::StatusCondition::enabled_statuses(const ::dds::core::status::StatusMask& status) const + * or, if enabled_statuses(status) was never called, the default list. + * + * The result value is a bit mask in which each bit shows which value has changed. The + * relevant bits represent one of the following statuses: + * - dds::core::status::StatusMask::inconsistent_topic() + * - dds::core::status::StatusMask::offered_deadline_missed() + * - dds::core::status::StatusMask::requested_deadline_missed() + * - dds::core::status::StatusMask::offered_incompatible_qos() + * - dds::core::status::StatusMask::requested_incompatible_qos() + * - dds::core::status::StatusMask::sample_lost() + * - dds::core::status::StatusMask::sample_rejected() + * - dds::core::status::StatusMask::data_on_readers() + * - dds::core::status::StatusMask::data_available() + * - dds::core::status::StatusMask::liveliness_lost() + * - dds::core::status::StatusMask::liveliness_changed() + * - dds::core::status::StatusMask::publication_matched() + * - dds::core::status::StatusMask::subscription_matched() + * + * Each status bit is declared as a constant and can be used in an AND operation to + * check the status bit against the result of type StatusMask. Not all statuses are + * relevant to all Entity objects. See the respective Listener interfaces for each + * Entity for more information. + * + * @return dds::core::status::StatusMask + * A bit mask in which each bit shows which status is taken into + * account for the StatusCondition. + * @throw dds::core::Exception + */ + const ::dds::core::status::StatusMask enabled_statuses() const; + + /** + * This operation returns the Entity associated with the StatusCondition + * + * Note that there is exactly one Entity associated with each StatusCondition. + * + * @return dds::core::Entity The Entity associated with the StatusCondition. + * @throw dds::core::AlreadyClosedError + */ + const dds::core::Entity& entity() const; +}; + +#endif /* OMG_DDS_CORE_T_STATUS_CONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/TWaitSet.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/TWaitSet.hpp new file mode 100644 index 0000000..6641a7b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/TWaitSet.hpp @@ -0,0 +1,411 @@ +#ifndef OMG_TDDS_CORE_WAIT_SET_HPP_ +#define OMG_TDDS_CORE_WAIT_SET_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +#include +#include +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +template +class TWaitSet; +} +} +} + + +/** + * @brief + * A WaitSet object allows an application to wait until one or more of + * the attached Condition objects has a trigger_value of TRUE or else + * until the timeout expires. + * + * A WaitSet is not necessarily associated with a single DomainParticipant + * and could be used to wait for Condition objects associated with different + * DomainParticipant objects. + * + * @anchor anchor_dds_core_cond_waitset_examples + * Example with wait()
      + * When using the wait() operation, the triggered Conditions are returned in a list. + * @code{.cpp} + * // Create a Condition to attach to a Waitset + * dds::core::cond::StatusCondition readerSC = dds::core::cond::StatusCondition(reader); + * readerSC.enabled_statuses(dds::core::status::StatusMask::data_available()); + * + * // Create WaitSet and attach Condition + * dds::core::cond::WaitSet waitset; + * waitset.attach_condition(readerSC); // or waitset += readerSC; + * + * dds::core::cond::WaitSet::ConditionSeq conditions; + * while(true) { + * // Wait for any Condition to trigger. + * conditions = waitset.wait(); + * + * // Loop through the triggered conditions. + * for (int i=0; i < conditions.size(); i++) { + * // Handle data_available when right Condition triggered. + * if (conditions[i] == readerSC) { + * // Read samples from the DataReader + * } + * } + * } + * @endcode + + * Example with dispatch()
      + * When using the dispatch() operation, the Functors of the triggered Conditions + * will be called. + * @code{.cpp} + * // Functor to add to a Condition + * class FunctorStatusCondition { + * public: + * void operator()(const dds::core::cond::StatusCondition& condition) { + * // Possibly get reader from the condition and read some samples. + * } + * }; + * FunctorStatusCondition functor; + * + * // Create a Condition with functor to attach to a Waitset + * dds::core::cond::StatusCondition readerSC = dds::core::cond::StatusCondition(reader, functor); + * readerSC.enabled_statuses(dds::core::status::StatusMask::data_available()); + * + * // Create WaitSet and attach Condition + * dds::core::cond::WaitSet waitset; + * waitset.attach_condition(readerSC); // or waitset += readerSC; + * + * while(true) { + * // Wait for any Condition to trigger. + * // The functors of the Conditions are automatically called + * // when the Condition triggers. + * waitset.dispatch(); + * } + * @endcode + * + * @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept" + */ +template +class dds::core::cond::TWaitSet : public dds::core::Reference +{ +public: + typedef std::vector ConditionSeq; + +public: + OMG_DDS_REF_TYPE_NO_DC(TWaitSet, dds::core::Reference, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(TWaitSet) + +public: + /** + * Create a WaitSet instance. + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + TWaitSet(); + +public: + /** + * This operation allows an application thread to wait for the occurrence + * of at least one of the conditions that is attached to the WaitSet. + * + * This operation allows an application thread to wait for the occurrence + * of certain Conditions. If none of the Conditions attached to the + * WaitSet have a trigger_value of TRUE, the wait operation will block + * suspending the calling thread. + * + * The wait operation takes a timeout argument that specifies the maximum + * duration for the wait. If this duration is exceeded and none of + * the attached Condition objects is true, a TimeoutError will be thrown. + * + * It is not allowed for more than one application thread to be waiting + * on the same WaitSet. If the wait operation is invoked on a WaitSet that + * already has a thread blocking on it, the operation will immediately + * raise a PreconditionNotMetError exception. + * + * The result of the wait operation is the list of all the attached + * Conditions that have a trigger_value of TRUE (i.e., the Conditions + * that unblocked the wait). + * + * @param timeout The maximum amount of time for which the wait + * should block while waiting for a Condition to be triggered. + * @return ConditionSeq + * A vector containing the triggered Conditions + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The WaitSet was not properly created and references to dds::core::null. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::TimeoutError + * The timeout has elapsed without any of the attached + * conditions becoming TRUE. + * @throws dds::core::PreconditionNotMetError + * When multiple thread try to invoke the function concurrently. + */ + const ConditionSeq wait(const dds::core::Duration& timeout); + + /** + * This operation allows an application thread to wait for the occurrence + * of at least one of the conditions that is attached to the WaitSet. + * + * This operation allows an application thread to wait for the occurrence + * of certain Conditions. If none of the Conditions attached to the + * WaitSet have a trigger_value of TRUE, the wait operation will block + * suspending the calling thread. + * + * It is not allowed for more than one application thread to be waiting + * on the same WaitSet. If the wait operation is invoked on a WaitSet that + * already has a thread blocking on it, the operation will immediately + * raise a PreconditionNotMetError exception. + * + * The result of the wait operation is the list of all the attached + * Conditions that have a trigger_value of TRUE (i.e., the Conditions + * that unblocked the wait). + * + * @return ConditionSeq + * A vector containing the triggered Conditions + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The WaitSet was not properly created and references to dds::core::null. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::PreconditionNotMetError + * When multiple thread try to invoke the function concurrently. + */ + const ConditionSeq wait(); + + /** + * This operation allows an application thread to wait for the occurrence + * of at least one of the conditions that is attached to the WaitSet. + * + * This operation allows an application thread to wait for the occurrence + * of certain Conditions. If none of the Conditions attached to the + * WaitSet have a trigger_value of TRUE, the wait operation will block + * suspending the calling thread. + * + * The wait operation takes a timeout argument that specifies the maximum + * duration for the wait. If this duration is exceeded and none of + * the attached Condition objects is true, a TimeoutError will be thrown. + * + * It is not allowed for more than one application thread to be waiting + * on the same WaitSet. If the wait operation is invoked on a WaitSet that + * already has a thread blocking on it, the operation will immediately + * raise a PreconditionNotMetError exception. + * + * The result of the wait operation is the list of all the attached + * Conditions that have a trigger_value of TRUE (i.e., the Conditions + * that unblocked the wait). + * + * @param triggered A ConditionSeq in which to put Conditions that were + * triggered during the wait. + * @param timeout The maximum amount of time for which the wait should + * block while waiting for a Condition to be triggered. + * @return ConditionSeq + * A vector containing the triggered Conditions + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The WaitSet was not properly created and references to dds::core::null. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::TimeoutError + * The timeout has elapsed without any of the attached + * conditions becoming TRUE. + * @throws dds::core::PreconditionNotMetError + * When multiple thread try to invoke the function concurrently. + */ + ConditionSeq& wait(ConditionSeq& triggered, + const dds::core::Duration& timeout); + + /** + * This operation allows an application thread to wait for the occurrence + * of at least one of the conditions that is attached to the WaitSet. + * + * This operation allows an application thread to wait for the occurrence + * of certain Conditions. If none of the Conditions attached to the + * WaitSet have a trigger_value of TRUE, the wait operation will block + * suspending the calling thread. + * + * It is not allowed for more than one application thread to be waiting + * on the same WaitSet. If the wait operation is invoked on a WaitSet that + * already has a thread blocking on it, the operation will immediately + * raise a PreconditionNotMetError exception. + * + * The result of the wait operation is the list of all the attached + * Conditions that have a trigger_value of TRUE (i.e., the Conditions + * that unblocked the wait). + * + * @param triggered A ConditionSeq in which to put Conditions that were + * triggered during the wait. + * @return ConditionSeq + * A vector containing the triggered Conditions + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The WaitSet was not properly created and references to dds::core::null. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::PreconditionNotMetError + * When multiple thread try to invoke the function concurrently. + */ + ConditionSeq& wait(ConditionSeq& triggered); + +public: + /** + * Waits for at least one of the attached Conditions to trigger and then + * dispatches the functor associated with the Condition. + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The WaitSet was not properly created and references to dds::core::null. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::PreconditionNotMetError + * When multiple thread try to invoke the function concurrently. + */ + void dispatch(); + + /** + * Waits for at least one of the attached Conditions to trigger and then + * dispatches the functor associated with the Condition, or, times + * out and throws a TimeoutError. + * + * @param timeout The maximum amount of time for which the dispatch should + * block while waiting for a Condition to be triggered. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The WaitSet was not properly created and references to dds::core::null. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::TimeoutError + * The timeout has elapsed without any of the attached + * conditions becoming TRUE. + * @throws dds::core::PreconditionNotMetError + * When multiple thread try to invoke the function concurrently. + */ + void dispatch(const dds::core::Duration& timeout); + +public: + /** @copydoc dds::core::cond::TWaitSet::attach_condition(const dds::core::cond::Condition& cond) */ + TWaitSet& operator +=(const dds::core::cond::Condition& cond); + + /** @copydoc dds::core::cond::TWaitSet::detach_condition(const dds::core::cond::Condition& cond) */ + TWaitSet& operator -=(const dds::core::cond::Condition& cond); + + /** + * This operation attaches a Condition to the WaitSet. + * + * Attaches a Condition to the WaitSet. It is possible to attach a + * Condition on a WaitSet that is currently being waited upon + * (via the wait operation). In this case, if the Condition has a + * trigger_value of TRUE, then attaching the Condition will unblock + * the WaitSet. Adding a Condition that is already attached to the WaitSet + * has no effect. + * + * @param cond The Condition to be attached to this WaitSet. + * @return WaitSet The WaitSet itself so that attaching Conditions + * can be chained. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The WaitSet was not properly created and references to dds::core::null. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + TWaitSet& attach_condition(const dds::core::cond::Condition& cond); + + /** + * This operation detaches a Condition to the WaitSet. + * + * Detaches a Condition from the WaitSet. If the Condition was not + * attached to the WaitSet, the operation will return false. + * + * @param cond The Condition to detach from this WaitSet + * @return bool True if the Condition was found and detached, False + * if the Condition was not part of the WaitSet. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The WaitSet was not properly created and references to dds::core::null. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + bool detach_condition(const dds::core::cond::Condition& cond); + + /** + * This operation retrieves the list of attached Conditions. + * + * The resulting sequence will either be an empty sequence, meaning there were + * no conditions attached, or will contain a list of ReadCondition, + * QueryCondition, StatusCondition and GuardCondition. + * + * @return ConditionSeq + * The list of attached Conditions. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The WaitSet was not properly created and references to dds::core::null. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + const ConditionSeq conditions() const; + + /** + * This operation retrieves the list of attached Conditions. + * + * The resulting sequence will either be an empty sequence, meaning there were + * no conditions attached, or will contain a list of ReadCondition, + * QueryCondition, StatusCondition and GuardCondition. + * + * @param conds A ConditionSeq in which to put the attached Conditions. + * @return ConditionSeq + * The list of attached Conditions. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The WaitSet was not properly created and references to dds::core::null. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + ConditionSeq& conditions(ConditionSeq& conds) const; +}; + +#endif /* OMG_TDDS_CORE_WAIT_SET_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/WaitSet.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/WaitSet.hpp new file mode 100644 index 0000000..c8206fc --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/WaitSet.hpp @@ -0,0 +1,35 @@ +#ifndef OMG_DDS_CORE_WAITSET_HPP_ +#define OMG_DDS_CORE_WAITSET_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +typedef dds::core::cond::detail::WaitSet WaitSet; +} +} +} + +#endif /* OMG_DDS_CORE_DETAIL_WAITSET_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/detail/Condition.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/detail/Condition.hpp new file mode 100644 index 0000000..c33edbb --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/detail/Condition.hpp @@ -0,0 +1,41 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_COND_DETAIL_CONDITION_HPP_ +#define CYCLONEDDS_DDS_CORE_COND_DETAIL_CONDITION_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +namespace detail +{ +typedef dds::core::cond::TCondition Condition; +} +} +} +} + + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_COND_DETAIL_CONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/detail/GuardCondition.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/detail/GuardCondition.hpp new file mode 100644 index 0000000..baa1a4b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/detail/GuardCondition.hpp @@ -0,0 +1,58 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_COND_DETAIL_GUARDCONDITION_HPP_ +#define CYCLONEDDS_DDS_CORE_COND_DETAIL_GUARDCONDITION_HPP_ + +/** + * @file + */ + +// Implementation + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ +class GuardConditionDelegate; +} +} +} +} +} + +namespace dds +{ +namespace core +{ +namespace cond +{ + +template +class TGuardCondition; + +namespace detail +{ +typedef dds::core::cond::TGuardCondition GuardCondition; +} +} +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_COND_DETAIL_GUARDCONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/detail/StatusCondition.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/detail/StatusCondition.hpp new file mode 100644 index 0000000..5f45db1 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/detail/StatusCondition.hpp @@ -0,0 +1,57 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_COND_DETAIL_STATUSCONDITION_HPP_ +#define CYCLONEDDS_DDS_CORE_COND_DETAIL_STATUSCONDITION_HPP_ + +/** + * @file + */ + +// Implementation +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ +class StatusConditionDelegate; +} +} +} +} +} + +namespace dds +{ +namespace core +{ +namespace cond +{ + +template +class TStatusCondition; + +namespace detail +{ +typedef dds::core::cond::TStatusCondition StatusCondition; +} +} +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_COND_DETAIL_STATUSCONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/detail/TConditionImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/detail/TConditionImpl.hpp new file mode 100644 index 0000000..43ef00e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/detail/TConditionImpl.hpp @@ -0,0 +1,64 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_COND_TCONDITION_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_COND_TCONDITION_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include +#include + +// Implementation +namespace dds +{ +namespace core +{ +namespace cond +{ + +template +template +void TCondition::handler(Functor func) +{ + this->delegate()->set_handler(func); +} + +template +void TCondition::reset_handler() +{ + this->delegate()->reset_handler(); +} + +template +void TCondition::dispatch() +{ + this->delegate()->dispatch(); +} + +template +bool TCondition::trigger_value() const +{ + return this->delegate()->trigger_value(); +} + +} +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_COND_TCONDITION_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/detail/TGuardConditionImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/detail/TGuardConditionImpl.hpp new file mode 100644 index 0000000..ccd09e4 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/detail/TGuardConditionImpl.hpp @@ -0,0 +1,103 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_COND_TGUARDCONDITION_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_COND_TGUARDCONDITION_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include +#include + +// Implementation +namespace dds +{ +namespace core +{ +namespace cond +{ + +template +TGuardCondition::TGuardCondition() +{ + this->set_ref(new DELEGATE); + this->delegate()->init(this->impl_); +} + +template +template +TGuardCondition::TGuardCondition(FUN functor) +{ + this->set_ref(new DELEGATE); + this->delegate()->init(this->impl_); + this->delegate()->set_handler(functor); +} + +template +void TGuardCondition::trigger_value(bool value) +{ + this->delegate()->trigger_value(value); +} + +template +bool TGuardCondition::trigger_value() +{ + return TCondition::trigger_value(); +} + +template +TCondition::TCondition(const dds::core::cond::TGuardCondition& h) +{ + if (h.is_nil()) { + /* We got a null object and are not really able to do a typecheck here. */ + /* So, just set a null object. */ + *this = dds::core::null; + } else { + this->::dds::core::Reference::impl_ = ::std::dynamic_pointer_cast(h.delegate()); + if (h.delegate() != this->::dds::core::Reference::impl_) { + throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name()); + } + } +} + +template +TCondition& +TCondition::operator=(const dds::core::cond::TGuardCondition& rhs) +{ + const TCondition &t = rhs; + if (this != &t) { + if (rhs.is_nil()) { + /* We got a null object and are not really able to do a typecheck here. */ + /* So, just set a null object. */ + *this = dds::core::null; + } else { + TCondition other(rhs); + /* Dont have to copy when the delegate is the same. */ + if (other.delegate() != this->::dds::core::Reference::impl_) { + *this = other; + } + } + } + return *this; +} + +} +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_COND_TGUARDCONDITION_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/detail/TStatusConditionImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/detail/TStatusConditionImpl.hpp new file mode 100644 index 0000000..7dc7fde --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/detail/TStatusConditionImpl.hpp @@ -0,0 +1,113 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_COND_TSTATUSCONDITION_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_COND_TSTATUSCONDITION_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include +#include + +// Implementation +namespace dds +{ +namespace core +{ +namespace cond +{ + +template +TStatusCondition::TStatusCondition(const dds::core::Entity& e) +{ + dds::core::Reference::impl_= + ::std::dynamic_pointer_cast( + e.delegate()->get_statusCondition()); +} + +template +template +TStatusCondition::TStatusCondition(const dds::core::Entity& e, FUN functor) +{ + dds::core::Reference::impl_= + ::std::dynamic_pointer_cast( + e.delegate()->get_statusCondition()); + this->delegate()->set_handler(functor); +} + +template +void TStatusCondition::enabled_statuses(const dds::core::status::StatusMask& status) const +{ + this->delegate()->enabled_statuses(status); +} + +template +const dds::core::status::StatusMask TStatusCondition::enabled_statuses() const +{ + return this->delegate()->enabled_statuses(); +} + +template +const dds::core::Entity& TStatusCondition::entity() const +{ + return this->delegate()->entity(); +} + + +template +TCondition::TCondition(const dds::core::cond::TStatusCondition& h) +{ + if (h.is_nil()) { + /* We got a null object and are not really able to do a typecheck here. */ + /* So, just set a null object. */ + *this = dds::core::null; + } else { + this->::dds::core::Reference::impl_ = ::std::dynamic_pointer_cast(h.delegate()); + if (h.delegate() != this->::dds::core::Reference::impl_) { + throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name()); + } + } +} + +template +TCondition& +TCondition::operator=(const dds::core::cond::TStatusCondition& rhs) +{ + const TCondition &t = rhs; + if (this != &t) { + if (rhs.is_nil()) { + /* We got a null object and are not really able to do a typecheck here. */ + /* So, just set a null object. */ + *this = dds::core::null; + } else { + TCondition other(rhs); + /* Dont have to copy when the delegate is the same. */ + if (other.delegate() != this->::dds::core::Reference::impl_) { + *this = other; + } + } + } + return *this; +} + + +} +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_COND_TSTATUSCONDITION_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/detail/TWaitSetImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/detail/TWaitSetImpl.hpp new file mode 100644 index 0000000..38fbd26 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/detail/TWaitSetImpl.hpp @@ -0,0 +1,123 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_COND_TWAITSET_HPP_ +#define CYCLONEDDS_DDS_CORE_COND_TWAITSET_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include + +// Implementation +namespace dds +{ +namespace core +{ +namespace cond +{ +template +TWaitSet::TWaitSet() +{ + this->set_ref(new DELEGATE); + this->delegate()->init(this->impl_); +} + +template +const typename TWaitSet::ConditionSeq TWaitSet::wait(const dds::core::Duration& timeout) +{ + ConditionSeq triggered; + return this->wait(triggered, timeout); +} + +template +const typename TWaitSet::ConditionSeq TWaitSet::wait() +{ + ConditionSeq triggered; + return this->wait(triggered, dds::core::Duration::infinite()); +} + +template +typename TWaitSet::ConditionSeq& TWaitSet::wait(ConditionSeq& triggered, const dds::core::Duration& timeout) +{ + return this->delegate()->wait(triggered, timeout); +} + +template +typename TWaitSet::ConditionSeq& TWaitSet::wait(ConditionSeq& triggered) +{ + return this->wait(triggered, dds::core::Duration::infinite()); +} + +template +void TWaitSet::dispatch() +{ + this->dispatch(dds::core::Duration::infinite()); +} + +template +void TWaitSet::dispatch(const dds::core::Duration& timeout) +{ + this->delegate()->dispatch(timeout); +} + +template +TWaitSet& TWaitSet::operator +=(const dds::core::cond::Condition& cond) +{ + this->attach_condition(cond); + return *this; +} + +template +TWaitSet& TWaitSet::operator -=(const dds::core::cond::Condition& cond) +{ + this->detach_condition(cond); + return *this; +} + +template +TWaitSet& TWaitSet::attach_condition(const dds::core::cond::Condition& cond) +{ + this->delegate()->attach_condition(cond); + return *this; +} + +template +bool TWaitSet::detach_condition(const dds::core::cond::Condition& cond) +{ + return this->delegate()->detach_condition(cond.delegate().get()); +} + +template +const typename TWaitSet::ConditionSeq TWaitSet::conditions() const +{ + ConditionSeq conds; + return this->conditions(conds); +} + +template +typename TWaitSet::ConditionSeq& TWaitSet::conditions(ConditionSeq& conds) const +{ + return this->delegate()->conditions(conds); +} + +} +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_COND_TWAITSET_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/cond/detail/WaitSet.hpp b/unitree_SDK/include/ddscxx/dds/core/cond/detail/WaitSet.hpp new file mode 100644 index 0000000..1e73de5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/cond/detail/WaitSet.hpp @@ -0,0 +1,40 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_COND_DETAIL_WAITSET_HPP_ +#define CYCLONEDDS_DDS_CORE_COND_DETAIL_WAITSET_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +namespace detail +{ +typedef dds::core::cond::TWaitSet WaitSet; +} +} +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_COND_DETAIL_WAITSET_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/conformance.hpp b/unitree_SDK/include/ddscxx/dds/core/conformance.hpp new file mode 100644 index 0000000..36db2b9 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/conformance.hpp @@ -0,0 +1,23 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_CONFORMANCE_HPP_ +#define OMG_DDS_CORE_CONFORMANCE_HPP_ + +#include + +#endif /* OMG_DDS_CORE_CONFORMANCE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/ddscore.hpp b/unitree_SDK/include/ddscxx/dds/core/ddscore.hpp new file mode 100644 index 0000000..289a4a7 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/ddscore.hpp @@ -0,0 +1,35 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_PACKAGE_INCLUDE_HPP_ +#define OMG_DDS_CORE_PACKAGE_INCLUDE_HPP_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#endif /* OMG_DDS_CORE_PACKAGE_INCLUDE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/BuiltinTopicTypes.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/BuiltinTopicTypes.hpp new file mode 100644 index 0000000..0b2b1c1 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/BuiltinTopicTypes.hpp @@ -0,0 +1,29 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +#ifndef OMG_DDS_CORE_DELEGATE_BUILTIN_TOPIC_TYPES_HPP_ +#define OMG_DDS_CORE_DELEGATE_BUILTIN_TOPIC_TYPES_HPP_ + +namespace dds { + namespace core { + namespace detail { + + class BytesTopicType { }; + class StringTopicType { }; + class KeyedBytesTopicType { }; + class KeyedStringTopicType { }; + } + } +} + + +#endif /* OMG_DDS_CORE_DELEGATE_BUILTIN_TOPIC_TYPES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/Entity.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/Entity.hpp new file mode 100644 index 0000000..b9f059b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/Entity.hpp @@ -0,0 +1,29 @@ +#ifndef OMG_DDS_CORE_DETAIL_ENTITY_IMPL_HPP_ +#define OMG_DDS_CORE_DETAIL_ENTITY_IMPL_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds { namespace core { namespace detail { + typedef dds::core::TEntity Entity; +} } } + +#endif /* OMG_DDS_CORE_DETAIL_ENTITY_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/InstanceHandle.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/InstanceHandle.hpp new file mode 100644 index 0000000..29dccf2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/InstanceHandle.hpp @@ -0,0 +1,29 @@ +#ifndef OMG_DDS_CORE_DETAIL_INSTANCE_HANDLE_HPP_ +#define OMG_DDS_CORE_DETAIL_INSTANCE_HANDLE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds { namespace core { namespace detail { + typedef dds::core::TInstanceHandle InstanceHandle; +} } } + +#endif /* !defined(OMG_DDS_CORE_DETAIL_INSTANCE_HANDLE_HPP_) */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/QosProvider.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/QosProvider.hpp new file mode 100644 index 0000000..5ec8ae9 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/QosProvider.hpp @@ -0,0 +1,34 @@ +#ifndef OMG_DDS_CORE_DETAIL_QOS_PROVIDER_HPP_ +#define OMG_DDS_CORE_DETAIL_QOS_PROVIDER_HPP_ + + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds { + namespace core { + namespace detail { + typedef dds::core::TQosProvider QosProvider; + } + } +} + +#endif /* OMG_DDS_CORE_DETAIL_QOS_PROVIDER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/ReferenceImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/ReferenceImpl.hpp new file mode 100644 index 0000000..1894509 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/ReferenceImpl.hpp @@ -0,0 +1,221 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_REFERENCE_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_REFERENCE_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include + +// Implementation +template +dds::core::Reference::Reference(dds::core::null_type&) : impl_() +{ +} + +template +dds::core::Reference::Reference(const Reference& ref) : impl_(ref.impl_) +{ +} + +template +dds::core::Reference::Reference(Reference&& ref) : impl_(ref.impl_) +{ +} + +template +template +dds::core::Reference::Reference(const Reference& ref) +{ + impl_ = ::std::dynamic_pointer_cast(ref.impl_); + if (impl_ != ref.impl_) { + throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(ref).name() + " to " + typeid(*this).name()); + } +} + +template +dds::core::Reference::Reference(DELEGATE_T* p) : impl_(p) +{ +} + +template +dds::core::Reference::Reference(const DELEGATE_REF_T& p) : impl_(p) +{ + //OMG_DDS_LOG("MM", "Reference(DELEGATE_REF_T& p)"); +} + +template +dds::core::Reference::~Reference() +{ +} + +template +dds::core::Reference::operator DELEGATE_REF_T() const +{ + ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); + return impl_; +} + +template +template +bool +dds::core::Reference::operator==(const R& ref) const +{ + bool equal = false; + if (this->is_nil() && ref.is_nil()) { + /* Both delegates are null. */ + equal = true; + } else if (!this->is_nil() && !ref.is_nil()) { + /* Check delegates. */ + equal = (this->delegate() == ref.delegate()); + } + return equal; +} + +template +template +bool +dds::core::Reference::operator!=(const R& ref) const +{ + return !(*this == ref); +} + +template +template +dds::core::Reference& +dds::core::Reference::operator=(const Reference& that) +{ + OMG_DDS_STATIC_ASSERT((dds::core::is_base_of::value)); + if(this != static_cast(&that)) + { + *this = Reference(that); + } + return *this; +} + +template +template +dds::core::Reference& +dds::core::Reference::operator=(const R& rhs) +{ + OMG_DDS_STATIC_ASSERT((dds::core::is_base_of< DELEGATE_T, typename R::DELEGATE_T>::value)); + if(this != static_cast(&rhs)) + { + *this = Reference(rhs); + } + return *this; +} + +template +dds::core::Reference& +dds::core::Reference::operator=(const null_type) +{ + DELEGATE_REF_T tmp; + impl_ = tmp; + return *this; +} + +template +bool +dds::core::Reference::is_nil() const +{ + return impl_.get() == 0; +} + +template +bool +dds::core::Reference::operator==(const null_type) const +{ + return this->is_nil(); +} + +template +bool +dds::core::Reference::operator!=(const null_type) const +{ + return !(this->is_nil()); +} + +template +const typename dds::core::Reference::DELEGATE_REF_T& +dds::core::Reference::delegate() const +{ + ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); + return impl_; +} + +template +typename dds::core::Reference::DELEGATE_REF_T& +dds::core::Reference::delegate() +{ + ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); + return impl_; +} + +template +DELEGATE* +dds::core::Reference::operator->() +{ + ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); + return impl_.get(); +} + +template +const DELEGATE* +dds::core::Reference::operator->() const +{ + ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); + return impl_.get(); +} + +template +dds::core::Reference::operator +const typename dds::core::Reference::DELEGATE_REF_T& () const +{ + ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); + return impl_; +} + +template +dds::core::Reference::operator +typename dds::core::Reference::DELEGATE_REF_T& () +{ + ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); + return impl_; +} + +template +void dds::core::Reference::set_ref(DELEGATE_T* p) +{ + impl_.reset(p); +} + + +template bool operator == (dds::core::null_type, const dds::core::Reference& r) +{ + return r.is_nil(); +} + +template bool operator != (dds::core::null_type, const dds::core::Reference& r) +{ + return !r.is_nil(); +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_REFERENCE_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/TEntityImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/TEntityImpl.hpp new file mode 100644 index 0000000..af6aa6c --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/TEntityImpl.hpp @@ -0,0 +1,65 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_TENTITY_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_TENTITY_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include +#include + +// Implementation + +template +void +dds::core::TEntity::enable() +{ + this->delegate()->enable(); +} + +template +const dds::core::status::StatusMask +dds::core::TEntity::status_changes() +{ + return this->delegate()->status_changes(); +} + +template +const dds::core::InstanceHandle +dds::core::TEntity::instance_handle() const +{ + return this->delegate()->instance_handle(); +} + +template +void +dds::core::TEntity::close() +{ + this->delegate()->close(); +} + +template +void +dds::core::TEntity::retain() +{ + this->delegate()->retain(); +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_TENTITY_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/TEntityQosImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/TEntityQosImpl.hpp new file mode 100644 index 0000000..3248f9e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/TEntityQosImpl.hpp @@ -0,0 +1,100 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_TENTITYQOS_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_TENTITYQOS_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace core +{ + +template +TEntityQos::TEntityQos() : dds::core::Value() { } + +template +TEntityQos::TEntityQos(const TEntityQos& other) + : dds::core::Value(other.delegate()) { } + +template +TEntityQos::TEntityQos(TEntityQos&& other) + : dds::core::Value(other.delegate()) { } + +template +template +TEntityQos::TEntityQos(const TEntityQos& qos) : + dds::core::Value(qos.delegate()) { } + +template +template +TEntityQos& TEntityQos::policy(const POLICY& p) +{ + this->dds::core::Value::delegate().policy(p); + return *this; +} + +template +template +const POLICY& TEntityQos::policy() const +{ + return this->delegate().template policy(); +} + +template +template +POLICY& TEntityQos::policy() +{ + return this->delegate().template policy(); +} + +template +template +TEntityQos& TEntityQos::operator << (const POLICY& p) +{ + this->policy(p); + return *this; +} + +template +template +const TEntityQos& TEntityQos::operator >> (POLICY& p) const +{ + p = this->policy(); + return *this; +} + +template +template +TEntityQos& TEntityQos::operator = (const TEntityQos& other) +{ + if(this != reinterpret_cast*>(&other)) + { + this->d_ = other.delegate(); + } + return *this; +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_TENTITYQOS_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/TInstanceHandleImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/TInstanceHandleImpl.hpp new file mode 100644 index 0000000..c5230be --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/TInstanceHandleImpl.hpp @@ -0,0 +1,110 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_TINSTANCEHANDLE_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_TINSTANCEHANDLE_IMPL_HPP_ + +/** + * @file + */ +#include +#include + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace core +{ + +template +TInstanceHandle::TInstanceHandle() { } + +template +template +TInstanceHandle::TInstanceHandle(const ARG0& arg0) : dds::core::Value(arg0) { } + +template +TInstanceHandle::TInstanceHandle(const dds::core::null_type& nullHandle) : dds::core::Value(nullHandle) { } + +template +TInstanceHandle::TInstanceHandle(const TInstanceHandle& other): dds::core::Value(other.delegate()) { } + +template +TInstanceHandle::TInstanceHandle(TInstanceHandle&& other): dds::core::Value(other.delegate()) { } + +template +TInstanceHandle& TInstanceHandle::operator=(const TInstanceHandle& that) +{ + if(this != &that) + { + this->delegate() = that.delegate(); + } + return *this; +} + +template +TInstanceHandle& TInstanceHandle::operator=(TInstanceHandle&& that) +{ + if(this != &that) + { + this->delegate() = that.delegate(); + } + return *this; +} + +template +bool TInstanceHandle::operator==(const TInstanceHandle& that) const +{ + return this->delegate() == that.delegate(); +} + +template +bool TInstanceHandle::operator<(const TInstanceHandle& that) const +{ + return this->delegate() < that.delegate(); +} + +template +bool TInstanceHandle::operator>(const TInstanceHandle& that) const +{ + return this->delegate() > that.delegate(); +} + +template +const TInstanceHandle TInstanceHandle::nil() +{ + dds::core::null_type nt; + static TInstanceHandle nil_handle(nt); + return nil_handle; +} + +template +bool TInstanceHandle::is_nil() const +{ + return this->delegate().is_nil(); +} +} +} + +inline std::ostream& operator << (std::ostream& os, const dds::core::TInstanceHandle& h) +{ + os << h.delegate(); + return os; +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_TINSTANCEHANDLE_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/TQosProviderImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/TQosProviderImpl.hpp new file mode 100644 index 0000000..28795be --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/TQosProviderImpl.hpp @@ -0,0 +1,126 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_DETAIL_TQOSPROVIDERIMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_DETAIL_TQOSPROVIDERIMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace core +{ + +template +TQosProvider::TQosProvider(const std::string& uri, const std::string& profile) + : Reference(new DELEGATE(uri, profile)) { } + +template +TQosProvider::TQosProvider(const std::string& uri) + : Reference(new DELEGATE(uri)) { } + +template +dds::domain::qos::DomainParticipantQos +TQosProvider::participant_qos() +{ + return this->delegate()->participant_qos(NULL); +} + +template +dds::domain::qos::DomainParticipantQos +TQosProvider::participant_qos(const std::string& id) +{ + return this->delegate()->participant_qos(id.c_str()); +} + +template +dds::topic::qos::TopicQos +TQosProvider::topic_qos() +{ + return this->delegate()->topic_qos(NULL); +} + +template +dds::topic::qos::TopicQos +TQosProvider::topic_qos(const std::string& id) +{ + return this->delegate()->topic_qos(id.c_str()); +} + + +template +dds::sub::qos::SubscriberQos +TQosProvider::subscriber_qos() +{ + return this->delegate()->subscriber_qos(NULL); +} + +template +dds::sub::qos::SubscriberQos +TQosProvider::subscriber_qos(const std::string& id) +{ + return this->delegate()->subscriber_qos(id.c_str()); +} + +template +dds::sub::qos::DataReaderQos +TQosProvider::datareader_qos() +{ + return this->delegate()->datareader_qos(NULL); +} + +template +dds::sub::qos::DataReaderQos +TQosProvider::datareader_qos(const std::string& id) +{ + return this->delegate()->datareader_qos(id.c_str()); +} + +template +dds::pub::qos::PublisherQos +TQosProvider::publisher_qos() +{ + return this->delegate()->publisher_qos(NULL); +} + +template +dds::pub::qos::PublisherQos +TQosProvider::publisher_qos(const std::string& id) +{ + return this->delegate()->publisher_qos(id.c_str()); +} + +template +dds::pub::qos::DataWriterQos +TQosProvider::datawriter_qos() +{ + return this->delegate()->datawriter_qos(NULL); +} + +template +dds::pub::qos::DataWriterQos +TQosProvider::datawriter_qos(const std::string& id) +{ + return this->delegate()->datawriter_qos(id.c_str()); +} +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_DETAIL_TQOSPROVIDERIMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/Value.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/Value.hpp new file mode 100644 index 0000000..deb1f32 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/Value.hpp @@ -0,0 +1,139 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_DETAIL_VALUE_HPP_ +#define CYCLONEDDS_DDS_CORE_DETAIL_VALUE_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace core +{ + +/** + * @internal @todo We can't assume that the compiler supports variadic templates, yet. + * This code should be refactored to take advantage of compilers that do support variadic + * templates. + */ + +template +Value::Value() { } + +template +template +Value::Value(const ARG& arg) : d_(arg) { } + +template +template +Value::Value(const ARG1& arg1, const ARG2& arg2) : d_(arg1, arg2) { } + +template +template +Value::Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3) + : d_(arg1, arg2, arg3) { } + +template +template +Value::Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4) + : d_(arg1, arg2, arg3, arg4) { } + +template +template +Value::Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4, const ARG5& arg5) + : d_(arg1, arg2, arg3, arg4, arg5) { } + +template +template +Value::Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4, const ARG5& arg5, const ARG6& arg6) + : d_(arg1, arg2, arg3, arg4, arg5, arg6) { } + +template +Value& Value::operator=(const Value& other) +{ + if(this != &other) + { + d_ = other.d_; + } + return *this; +} + +template +Value& Value::operator=(Value&& other) +{ + if(this != &other) + { + d_ = other.d_; + } + return *this; +} + +template +bool Value::operator==(const Value& other) const +{ + return (d_ == other.d_); +} + +template +bool Value::operator !=(const Value& other) const +{ + return !(d_ == other.d_); +} + +template +const D* Value::operator->() const +{ + return &d_; +} + +template +D* Value::operator->() +{ + return &d_; +} + +template +const D& Value::delegate() const +{ + return d_; +} + +template +D& Value::delegate() +{ + return d_; +} + +template +Value::operator D& () +{ + return d_; +} + +template +Value::operator const D& () const +{ + return d_; +} + +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_DETAIL_VALUE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/WeakReferenceImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/WeakReferenceImpl.hpp new file mode 100644 index 0000000..bf76153 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/WeakReferenceImpl.hpp @@ -0,0 +1,58 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_WEAK_REFERENCE_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_WEAK_REFERENCE_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include + + +// Implementation +namespace dds +{ +namespace core +{ + +template +WeakReference::WeakReference() { } + +template +WeakReference::WeakReference(const T& t) +{ + if (!t.is_nil()) { + impl_ = t.delegate(); + } +} + +template +bool WeakReference::expired() +{ + return impl_.expired(); +} + +template +T WeakReference::lock() +{ + return T(impl_.lock()); +} +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_WEAK_REFERENCE_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/array.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/array.hpp new file mode 100644 index 0000000..6a2c739 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/array.hpp @@ -0,0 +1,28 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_DETAIL_ARRAY_HPP_ +#define CYCLONEDDS_DDS_CORE_DETAIL_ARRAY_HPP_ + +#include + +namespace dds +{ +namespace core +{ +namespace detail +{ +using ::std::array; +} +} +} + +#endif /* CYCLONEDDS_DDS_CORE_DETAIL_ARRAY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/conformance.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/conformance.hpp new file mode 100644 index 0000000..c2ed9be --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/conformance.hpp @@ -0,0 +1,36 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_DETAIL_CONFORMANCE_HPP_ +#define CYCLONEDDS_DDS_CORE_DETAIL_CONFORMANCE_HPP_ + +// Implementation + +/** + * @file + * @internal + * @note Values 'set' in this file should be mirrored in etc/doxygen_isocpp2_common.cfg + * in order to ensure the doxygen documentation includes all supported QoS + * and features and ting. + */ + +#define OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT FULL +// #define OMG_DDS_MULTI_TOPIC_SUPPORT FULL +#define OMG_DDS_PERSISTENCE_SUPPORT FULL +#define OMG_DDS_OWNERSHIP_SUPPORT FULL +#define OMG_DDS_OBJECT_MODEL_SUPPORT FULL +#define OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT FULL +// #define OMG_DDS_X_TYPES_BUILTIN_TOPIC_TYPES_SUPPORT FULL + +#define OMG_DDS_HAS_PRETTY_PRINT_COUT 1 +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_DETAIL_CONFORMANCE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/ddscore.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/ddscore.hpp new file mode 100644 index 0000000..73e4ee1 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/ddscore.hpp @@ -0,0 +1,17 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_CORE_PACKAGE_DETAIL_INCLUDE_HPP_ +#define OMG_DDS_CORE_PACKAGE_DETAIL_INCLUDE_HPP_ + +/* Nothing to 'post' include. */ + +#endif /* OMG_DDS_CORE_PACKAGE_DETAIL_INCLUDE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/export.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/export.hpp new file mode 100644 index 0000000..d0e080e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/export.hpp @@ -0,0 +1,42 @@ + +#ifndef OMG_DDS_API_DETAIL_H +#define OMG_DDS_API_DETAIL_H + +#ifdef OMG_DDS_API_DETAIL_STATIC_DEFINE +# define OMG_DDS_API_DETAIL +# define OMG_DDS_API_DETAIL_NO_EXPORT +#else +# ifndef OMG_DDS_API_DETAIL +# ifdef ddscxx_EXPORTS + /* We are building this library */ +# define OMG_DDS_API_DETAIL __attribute__((visibility("default"))) +# else + /* We are using this library */ +# define OMG_DDS_API_DETAIL __attribute__((visibility("default"))) +# endif +# endif + +# ifndef OMG_DDS_API_DETAIL_NO_EXPORT +# define OMG_DDS_API_DETAIL_NO_EXPORT __attribute__((visibility("hidden"))) +# endif +#endif + +#ifndef OMG_DDS_API_DETAIL_DEPRECATED +# define OMG_DDS_API_DETAIL_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef OMG_DDS_API_DETAIL_DEPRECATED_EXPORT +# define OMG_DDS_API_DETAIL_DEPRECATED_EXPORT OMG_DDS_API_DETAIL OMG_DDS_API_DETAIL_DEPRECATED +#endif + +#ifndef OMG_DDS_API_DETAIL_DEPRECATED_NO_EXPORT +# define OMG_DDS_API_DETAIL_DEPRECATED_NO_EXPORT OMG_DDS_API_DETAIL_NO_EXPORT OMG_DDS_API_DETAIL_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef OMG_DDS_API_DETAIL_NO_DEPRECATED +# define OMG_DDS_API_DETAIL_NO_DEPRECATED +# endif +#endif + +#endif /* OMG_DDS_API_DETAIL_H */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/inttypes.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/inttypes.hpp new file mode 100644 index 0000000..a6e6b22 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/inttypes.hpp @@ -0,0 +1,35 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_DETAIL_INTTYPES_HPP_ +#define CYCLONEDDS_DDS_CORE_DETAIL_INTTYPES_HPP_ + +/** + * @file + */ + +// Implementation + +/* (from spec:) This implementation-defined header stands in for the C99 header files + * inttypes.h. Under toolchains that support inttypes.h, this header can + * simply include that one. Under toolchains that do not, this header must + * provide equivalent definitions. + */ +#if defined(__GNUC__) && __GNUC__ < 5 +#define __STDC_FORMAT_MACROS +#endif + +#include +#include + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_DETAIL_INTTYPES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/macros.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/macros.hpp new file mode 100644 index 0000000..e3f2158 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/macros.hpp @@ -0,0 +1,100 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_DETAIL_MACROS_HPP_ +#define CYCLONEDDS_DDS_CORE_DETAIL_MACROS_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include + +// == Constants +#define OMG_DDS_DEFAULT_STATE_BIT_COUNT_DETAIL static_cast(32) +#define OMG_DDS_DEFAULT_STATUS_COUNT_DETAIL static_cast(32) +// ========================================================================== + +#define OSPL_DEFAULT_TO_CXX11 +#define OSPL_USE_CXX11 + +// == Static Assert +#define OMG_DDS_STATIC_ASSERT_DETAIL(condition) static_assert(condition, #condition) +// ========================================================================== + +// DLL Export Macros +#include "dds/core/detail/export.hpp" + +// ========================================================================== + +// Logging Macros +#if 0 +#include +#define OMG_DDS_LOG_DETAIL(kind, msg) \ + if (dds::core::detail::maplog(kind) >= os_reportVerbosity) os_report(dds::core::detail::maplog(kind),"isocpp-OMG_DDS_LOG",__FILE__,__LINE__,0,msg) +// std::cout << "[" << kind << "]: " << msg << std::endl; +// ========================================================================== +#endif + +// C++ 11 features +// Slightly pathological - we could (for example) want to use boost traits +// and 'STL' implementations but compile with -std=c++11, so set a macro for +// C++11 compile being on. This way we can always use language features +#define OSPL_DDS_CXX11 +#include + +#if defined (_MSC_VER) && ( _MSC_VER < 1700) +// http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx +// 'Visual C++ in Visual Studio 2010 ... "final" was ... supported, but +// under the different spelling "sealed". The Standard spelling and +// semantics of "override" and "final" are now completely supported.' +# define OSPL_DDS_FINAL sealed +#else +# define OSPL_DDS_FINAL final +#endif + +#if defined (_MSC_VER) && (_MSC_VER <= 1800) +// See: http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx +// "These are now supported, but with this exception: For defaulted functions, +// the use of = default to request member-wise move constructors and move +// assignment operators is not supported." +// ('now' is currently VS 2013 - _MSC_VER == 1800). +# define OSPL_CXX11_NO_FUNCTION_DEFAULTS +#endif + +#define OSPL_ENUM enum class +#define OSPL_ENUM_LABEL(_escope,_etype,_elabel) _escope::_etype::_elabel + +/** + * @brief Macro to disable unused argument warnings + */ +#define DDSCXX_UNUSED_ARG(a) (void)(a) + +/** + * @brief Macro to disable specific compiler warnings + */ +#if defined(_MSC_VER) +#define DDSCXX_WARNING_MSVC_OFF(x) \ + __pragma(warning(push)) \ + __pragma(warning(disable: ## x)) +#define DDSCXX_WARNING_MSVC_ON(x) \ + __pragma(warning(pop)) +#else +#define DDSCXX_WARNING_MSVC_OFF(x) +#define DDSCXX_WARNING_MSVC_ON(x) +#endif + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_DETAIL_MACROS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/module_docs.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/module_docs.hpp new file mode 100644 index 0000000..ffcf870 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/module_docs.hpp @@ -0,0 +1,177 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_DETAIL_MODULE_DOCS_HPP_ +#define CYCLONEDDS_DDS_CORE_DETAIL_MODULE_DOCS_HPP_ + +// Implementation + +/** + * @file + * This file exists only to be fed to doxygen. There is quite + * literally nothing else to see here. + */ + +/** + * @addtogroup isocpp2_dcps ISO/IEC C++ 2 API for DDS Data-centric Publish-Subscribe (DCPS) + */ +/** @{*/ +/** @dir dds */ +/** @}*/ + +/** + * @addtogroup isocpp2_dcps_domain Domain Module - ::dds::domain + * @ingroup isocpp2_dcps */ +/** @{*/ +/** @dir dds/domain */ +/** @}*/ + + +/** + * @addtogroup isocpp2_dcps_topic Topic Module- ::dds::topic + * @ingroup isocpp2_dcps */ +/** @{*/ +/** @dir dds/topic */ +/** @}*/ + +/** + * @addtogroup isocpp2_dcps_pub Publication Module - ::dds::pub + * @ingroup isocpp2_dcps */ +/** @{*/ +/** @dir dds/pub */ +/** @}*/ + + +/** + * @addtogroup isocpp2_dcps_sub Subscription Module - ::dds::sub + * @ingroup isocpp2_dcps */ +/** @{*/ +/** @dir dds/sub */ +/** @}*/ + +/** + * @addtogroup isocpp2_dcps_core Core / Common Module - ::dds::core + * @ingroup isocpp2_dcps */ +/** @{*/ +/** @dir dds/core */ +/** @}*/ + + +/** + * @addtogroup examplesdcpsisocpp ISO/IEC C++ DCPS PSM Examples + */ +/** @{*/ +/** @dir examples/common */ +/** @}*/ + + + +/** + * @ingroup isocpp2_dcps + */ +namespace dds +{ +/** + * @ingroup isocpp2_dcps_domain + * @ingroup isocpp2_dcps */ +namespace domain +{ +/** @ingroup isocpp2_dcps_domain + * @ingroup isocpp2_dcps */ +namespace qos +{ +namespace detail {} +} +namespace detail {} +} +/** + * @ingroup isocpp2_dcps_topic + * @ingroup isocpp2_dcps */ +namespace topic +{ +/** @ingroup isocpp2_dcps_topic + * @ingroup isocpp2_dcps */ +namespace qos +{ +namespace detail {} +} +namespace detail {} +} +/** + * @ingroup isocpp2_dcps_pub + * @ingroup isocpp2_dcps */ +namespace pub +{ +/** @ingroup isocpp2_dcps_pub + * @ingroup isocpp2_dcps */ +namespace qos +{ +namespace detail {} +} +namespace detail {} +} +/** + * @ingroup isocpp2_dcps_sub + * @ingroup isocpp2_dcps */ +namespace sub +{ +/** @ingroup isocpp2_dcps_sub + * @ingroup isocpp2_dcps */ +namespace cond +{ +namespace detail {} +} +/** @ingroup isocpp2_dcps_sub + * @ingroup isocpp2_dcps */ +namespace functors +{ +namespace detail {} +} +/** @ingroup isocpp2_dcps_sub + * @ingroup isocpp2_dcps */ +namespace status {} +/** @ingroup isocpp2_dcps_sub + * @ingroup isocpp2_dcps */ +namespace qos +{ +namespace detail {} +} +} +/** + * @ingroup isocpp2_dcps_core + * @ingroup isocpp2_dcps */ +namespace core +{ +/** @ingroup isocpp2_dcps_core + * @ingroup isocpp2_dcps */ +namespace policy +{ +namespace detail {} +} +/** @ingroup isocpp2_dcps_core + * @ingroup isocpp2_dcps */ +namespace cond +{ +namespace detail {} +} +/** @ingroup isocpp2_dcps_core + * @ingroup isocpp2_dcps */ +namespace status +{ +namespace detail {} +} +namespace detail {} +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_DETAIL_MODULE_DOCS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/old_win_stdint.h b/unitree_SDK/include/ddscxx/dds/core/detail/old_win_stdint.h new file mode 100644 index 0000000..128172e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/old_win_stdint.h @@ -0,0 +1,247 @@ +/** + * @file + * This file provides definitions for stdint header types for versions of + * Windows that didn't have it. It was discovered on the intahwebs at + * http://snipplr.com/view/18199/stdinth/ where it was described thus: + * "A public domain stdint.h. Original code is from a public domain version + * in the MinGW distribution. This one has been modified to fix a couple bugs + * (to make some macros 64-bit aware) and to make it compatible with VC6." + * It was published there on 08/12/09 + * @see dds/core/detail/inttypes.h + */ + +/* ISO C9x 7.18 Integer types + * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794) + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * Contributor: Danny Smith + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * Date: 2000-12-02 + * + * mwb: This was modified in the following ways: + * + * - make it compatible with Visual C++ 6 (which uses + * non-standard keywords and suffixes for 64-bit types) + * - some environments need stddef.h included (for wchar stuff?) + * - handle the fact that Microsoft's limits.h header defines + * SIZE_MAX + * - make corrections for SIZE_MAX, INTPTR_MIN, INTPTR_MAX, UINTPTR_MAX, + * PTRDIFF_MIN, PTRDIFF_MAX, SIG_ATOMIC_MIN, and SIG_ATOMIC_MAX + * to be 64-bit aware. + */ + + +#ifndef _STDINT_H +#define _STDINT_H +#define __need_wint_t +#define __need_wchar_t +#include +#include + +#if _MSC_VER && (_MSC_VER < 1300) +/* using MSVC 6 or earlier - no "long long" type, but might have _int64 type */ +#define __STDINT_LONGLONG __int64 +#define __STDINT_LONGLONG_SUFFIX i64 +#else +#define __STDINT_LONGLONG long long +#define __STDINT_LONGLONG_SUFFIX LL +#endif + +#if !defined( PASTE) +#define PASTE2( x, y) x##y +#define PASTE( x, y) PASTE2( x, y) +#endif /* PASTE */ + + +/* 7.18.1.1 Exact-width integer types */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned uint32_t; +typedef __STDINT_LONGLONG int64_t; +typedef unsigned __STDINT_LONGLONG uint64_t; + +/* 7.18.1.2 Minimum-width integer types */ +typedef signed char int_least8_t; +typedef unsigned char uint_least8_t; +typedef short int_least16_t; +typedef unsigned short uint_least16_t; +typedef int int_least32_t; +typedef unsigned uint_least32_t; +typedef __STDINT_LONGLONG int_least64_t; +typedef unsigned __STDINT_LONGLONG uint_least64_t; + +/* 7.18.1.3 Fastest minimum-width integer types + * Not actually guaranteed to be fastest for all purposes + * Here we use the exact-width types for 8 and 16-bit ints. + */ +typedef char int_fast8_t; +typedef unsigned char uint_fast8_t; +typedef short int_fast16_t; +typedef unsigned short uint_fast16_t; +typedef int int_fast32_t; +typedef unsigned int uint_fast32_t; +typedef __STDINT_LONGLONG int_fast64_t; +typedef unsigned __STDINT_LONGLONG uint_fast64_t; + +/* 7.18.1.4 Integer types capable of holding object pointers */ +#ifndef _INTPTR_T_DEFINED +#define _INTPTR_T_DEFINED +#ifdef _WIN64 +typedef __STDINT_LONGLONG intptr_t +#else +typedef int intptr_t; +#endif /* _WIN64 */ +#endif /* _INTPTR_T_DEFINED */ + +#ifndef _UINTPTR_T_DEFINED +#define _UINTPTR_T_DEFINED +#ifdef _WIN64 +typedef unsigned __STDINT_LONGLONG uintptr_t +#else +typedef unsigned int uintptr_t; +#endif /* _WIN64 */ +#endif /* _UINTPTR_T_DEFINED */ + +/* 7.18.1.5 Greatest-width integer types */ +typedef __STDINT_LONGLONG intmax_t; +typedef unsigned __STDINT_LONGLONG uintmax_t; + +/* 7.18.2 Limits of specified-width integer types */ +#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) + +/* 7.18.2.1 Limits of exact-width integer types */ +#define INT8_MIN (-128) +#define INT16_MIN (-32768) +#define INT32_MIN (-2147483647 - 1) +#define INT64_MIN (PASTE( -9223372036854775807, __STDINT_LONGLONG_SUFFIX) - 1) + +#define INT8_MAX 127 +#define INT16_MAX 32767 +#define INT32_MAX 2147483647 +#define INT64_MAX (PASTE( 9223372036854775807, __STDINT_LONGLONG_SUFFIX)) + +#define UINT8_MAX 0xff /* 255U */ +#define UINT16_MAX 0xffff /* 65535U */ +#define UINT32_MAX 0xffffffff /* 4294967295U */ +#define UINT64_MAX (PASTE( 0xffffffffffffffffU, __STDINT_LONGLONG_SUFFIX)) /* 18446744073709551615ULL */ + +/* 7.18.2.2 Limits of minimum-width integer types */ +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST64_MIN INT64_MIN + +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MAX INT64_MAX + +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +/* 7.18.2.3 Limits of fastest minimum-width integer types */ +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST64_MIN INT64_MIN + +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MAX INT64_MAX + +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +/* 7.18.2.4 Limits of integer types capable of holding + object pointers */ +#ifdef _WIN64 +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX +#else +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#endif /* _WIN64 */ + +/* 7.18.2.5 Limits of greatest-width integer types */ +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +/* 7.18.3 Limits of other integer types */ +#define PTRDIFF_MIN INTPTR_MIN +#define PTRDIFF_MAX INTPTR_MAX + +#define SIG_ATOMIC_MIN INTPTR_MIN +#define SIG_ATOMIC_MAX INTPTR_MAX + +/* we need to check for SIZE_MAX already defined because MS defines it in limits.h */ +#ifndef SIZE_MAX +#define SIZE_MAX UINTPTR_MAX +#endif + +#ifndef WCHAR_MIN /* also in wchar.h */ +#define WCHAR_MIN 0 +#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */ +#endif + +/* + * wint_t is unsigned short for compatibility with MS runtime + */ +#define WINT_MIN 0 +#define WINT_MAX ((wint_t)-1) /* UINT16_MAX */ + +#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */ + + +/* 7.18.4 Macros for integer constants */ +#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS) + +/* 7.18.4.1 Macros for minimum-width integer constants + + Accoding to Douglas Gwyn : +"This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC +9899:1999 as initially published, the expansion was required +to be an integer constant of precisely matching type, which +is impossible to accomplish for the shorter types on most +platforms, because C99 provides no standard way to designate +an integer constant with width less than that of type int. +TC1 changed this to require just an integer constant +*expression* with *promoted* type." +*/ + +#define INT8_C(val) ((int8_t) + (val)) +#define UINT8_C(val) ((uint8_t) + (val##U)) +#define INT16_C(val) ((int16_t) + (val)) +#define UINT16_C(val) ((uint16_t) + (val##U)) + +#define INT32_C(val) val##L +#define UINT32_C(val) val##UL +#define INT64_C(val) (PASTE( val, __STDINT_LONGLONG_SUFFIX)) +#define UINT64_C(val)(PASTE( PASTE( val, U), __STDINT_LONGLONG_SUFFIX)) + +/* 7.18.4.2 Macros for greatest-width integer constants */ +#define INTMAX_C(val) INT64_C(val) +#define UINTMAX_C(val) UINT64_C(val) + +#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */ + +#endif diff --git a/unitree_SDK/include/ddscxx/dds/core/detail/ref_traits.hpp b/unitree_SDK/include/ddscxx/dds/core/detail/ref_traits.hpp new file mode 100644 index 0000000..04f2b1c --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/detail/ref_traits.hpp @@ -0,0 +1,56 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_DETAIL_REF_TRAITS_HPP_ +#define CYCLONEDDS_DDS_CORE_DETAIL_REF_TRAITS_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include + +#include +#include + +template +struct dds::core::is_base_of : public ::std::is_base_of { }; + +template +struct dds::core::is_same : public ::std::is_same { }; + +template +struct dds::core::smart_ptr_traits +{ + typedef ::std::shared_ptr ref_type; + typedef ::std::weak_ptr weak_ref_type; +}; + +template +TO dds::core::polymorphic_cast(FROM& from) +{ + typename TO::DELEGATE_REF_T dr = + ::std::dynamic_pointer_cast< typename TO::DELEGATE_T>(from.delegate()); + TO to(dr); + + if(to == dds::core::null) + { + throw dds::core::InvalidDowncastError("Attempted invalid downcast."); + } + return to; +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_DETAIL_REF_TRAITS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/macros.hpp b/unitree_SDK/include/ddscxx/dds/core/macros.hpp new file mode 100644 index 0000000..b478087 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/macros.hpp @@ -0,0 +1,73 @@ +#ifndef OMG_DDS_CORE_MACROS_HPP_ +#define OMG_DDS_CORE_MACROS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +// == Static Assert ========================================================= +#define OMG_DDS_STATIC_ASSERT OMG_DDS_STATIC_ASSERT_DETAIL +// ========================================================================== + + +// == Logging Macros ======================================================== +#define OMG_DDS_LOG(kind, msg) OMG_DDS_LOG_DETAIL(kind, msg) +// ========================================================================== + + +// == State Width Constants ================================================= +/* By default, there can be up to 32 unique statuses. However, a + * DDS implementation may extend this number if necessary. + */ +#define OMG_DDS_DEFAULT_STATE_BIT_COUNT OMG_DDS_DEFAULT_STATE_BIT_COUNT_DETAIL +#define OMG_DDS_DEFAULT_STATUS_COUNT OMG_DDS_DEFAULT_STATUS_COUNT_DETAIL + +#ifndef OMG_DDS_STATE_BIT_COUNT +#define OMG_DDS_STATE_BIT_COUNT OMG_DDS_DEFAULT_STATE_BIT_COUNT +#endif // !defined(OMG_DDS_STATE_BIT_COUNT) + +#ifndef OMG_DDS_STATUS_COUNT +#define OMG_DDS_STATUS_COUNT OMG_DDS_DEFAULT_STATUS_COUNT +#endif // !defined(OMG_DDS_STATUS_COUNT) +// ========================================================================== + + +// == DLL Export Macros ===================================================== +#define OMG_DDS_API OMG_DDS_API_DETAIL +// ========================================================================== + +#define TEMP_TYPE void* + +#define OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(TYPE) \ +public:\ + virtual ~TYPE() = default;\ + TYPE(const TYPE& tocopy) = default;\ + TYPE(TYPE&& tomove) = default;\ + virtual TYPE& operator=(const TYPE& tocopy) = default;\ + virtual TYPE& operator=(TYPE&& tomove) { if (this != &tomove) *this = tomove; return *this;} + +#define OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_EXPLICIT(TYPE) \ +public:\ + virtual ~TYPE() {}\ + TYPE(const TYPE& tocopy): dds::core::Reference(dynamic_cast& >(tocopy)) {}\ + TYPE(TYPE&& tomove): dds::core::Reference(dynamic_cast&& >(tomove)) {}\ + virtual TYPE& operator=(const TYPE& tocopy) {this->dds::core::Reference::operator=(dynamic_cast& >(tocopy)); return *this;}\ + virtual TYPE& operator=(TYPE&& tomove) { if (this != &tomove) this->dds::core::Reference::operator=(dynamic_cast&& >(tomove)); return *this;} + +#endif /* OMG_DDS_CORE_MACROS_HPP_*/ diff --git a/unitree_SDK/include/ddscxx/dds/core/policy/CorePolicy.hpp b/unitree_SDK/include/ddscxx/dds/core/policy/CorePolicy.hpp new file mode 100644 index 0000000..09a1494 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/policy/CorePolicy.hpp @@ -0,0 +1,201 @@ +#ifndef OMG_DDS_CORE_POLICY_CORE_POLICY_HPP_ +#define OMG_DDS_CORE_POLICY_CORE_POLICY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + + + +//============================================================================== +// MACROS +// +#define OMG_DDS_POLICY_TRAITS(POLICY, ID) \ + template <> \ + class OMG_DDS_API policy_id { \ + public: \ + static const dds::core::policy::QosPolicyId value = ID; \ + }; \ + template <> \ + class OMG_DDS_API policy_name { \ + public:\ + static const std::string& name(); \ + }; + +#define OMG_DDS_DEFINE_POLICY_TRAITS(POLICY, NAME) \ + const std::string& dds::core::policy::policy_name::name() { \ + static std::string name = #NAME; \ + return name; \ + } + + +namespace dds +{ +namespace core +{ +namespace policy +{ + +//============================================================================== +// Policy Trait Classes + +template +class policy_id { }; + +template +class policy_name { }; + + + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +typedef dds::core::policy::detail::DataRepresentation +DataRepresentation; +#endif //OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +typedef dds::core::policy::detail::Deadline +Deadline; + +typedef dds::core::policy::detail::DestinationOrder +DestinationOrder; + +typedef dds::core::policy::detail::Durability +Durability; + +typedef dds::core::policy::detail::EntityFactory +EntityFactory; + +typedef dds::core::policy::detail::GroupData +GroupData; + +typedef dds::core::policy::detail::History +History; + +typedef dds::core::policy::detail::LatencyBudget +LatencyBudget; + +typedef dds::core::policy::detail::Lifespan +Lifespan; + +typedef dds::core::policy::detail::Liveliness +Liveliness; + +typedef dds::core::policy::detail::Ownership +Ownership; + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT +typedef dds::core::policy::detail::OwnershipStrength +OwnershipStrength; +#endif // OMG_DDS_OWNERSHIP_SUPPORT + +typedef dds::core::policy::detail::Partition +Partition; + +template +class policy_id; + +template +class policy_name; + +typedef dds::core::policy::detail::Presentation +Presentation; + +typedef ::dds::core::policy::detail::QosPolicyCount QosPolicyCount; + +typedef std::vector QosPolicyCountSeq; + +typedef uint32_t QosPolicyId; + +typedef dds::core::policy::detail::ReaderDataLifecycle +ReaderDataLifecycle; + +typedef dds::core::policy::detail::Reliability +Reliability; + +typedef dds::core::policy::detail::ResourceLimits +ResourceLimits; + +typedef dds::core::policy::detail::TimeBasedFilter +TimeBasedFilter; + +typedef dds::core::policy::detail::TopicData +TopicData; + +typedef dds::core::policy::detail::TransportPriority +TransportPriority; + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +typedef dds::core::policy::detail::TypeConsistencyEnforcement +TypeConsistencyEnforcement; +#endif //OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +typedef dds::core::policy::detail::UserData +UserData; + +typedef dds::core::policy::detail::WriterDataLifecycle +WriterDataLifecycle; + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT +typedef ::dds::core::policy::detail::DurabilityService +DurabilityService; +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + +OMG_DDS_POLICY_TRAITS(UserData, 1) +OMG_DDS_POLICY_TRAITS(Durability, 2) +OMG_DDS_POLICY_TRAITS(Presentation, 3) +OMG_DDS_POLICY_TRAITS(Deadline, 4) +OMG_DDS_POLICY_TRAITS(LatencyBudget, 5) +OMG_DDS_POLICY_TRAITS(Ownership, 6) + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT +OMG_DDS_POLICY_TRAITS(OwnershipStrength, 7) +#endif // OMG_DDS_OWNERSHIP_SUPPORT + +OMG_DDS_POLICY_TRAITS(Liveliness, 8) +OMG_DDS_POLICY_TRAITS(TimeBasedFilter, 9) +OMG_DDS_POLICY_TRAITS(Partition, 10) +OMG_DDS_POLICY_TRAITS(Reliability, 11) +OMG_DDS_POLICY_TRAITS(DestinationOrder, 12) +OMG_DDS_POLICY_TRAITS(History, 13) +OMG_DDS_POLICY_TRAITS(ResourceLimits, 14) +OMG_DDS_POLICY_TRAITS(EntityFactory, 15) +OMG_DDS_POLICY_TRAITS(WriterDataLifecycle, 16) +OMG_DDS_POLICY_TRAITS(ReaderDataLifecycle, 17) +OMG_DDS_POLICY_TRAITS(TopicData, 18) +OMG_DDS_POLICY_TRAITS(GroupData, 19) +OMG_DDS_POLICY_TRAITS(TransportPriority, 20) +OMG_DDS_POLICY_TRAITS(Lifespan, 21) + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT +OMG_DDS_POLICY_TRAITS(DurabilityService, 22) +#endif // OMG_DDS_PERSISTENCE_SUPPORT + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +OMG_DDS_POLICY_TRAITS(DataRepresentation, 23) +OMG_DDS_POLICY_TRAITS(TypeConsistencyEnforcement, 24) +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +} +} +} + + +#endif /* OMG_DDS_CORE_POLICY_CORE_POLICY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/policy/PolicyKind.hpp b/unitree_SDK/include/ddscxx/dds/core/policy/PolicyKind.hpp new file mode 100644 index 0000000..cda281e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/policy/PolicyKind.hpp @@ -0,0 +1,260 @@ +#ifndef OMG_DDS_CORE_POLICY_POLICYKIND_HPP_ +#define OMG_DDS_CORE_POLICY_POLICYKIND_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include + +namespace dds +{ +namespace core +{ +namespace policy +{ + +#if defined (__SUNPRO_CC) && defined(SHARED) +# undef SHARED +#endif +struct OwnershipKind_def +{ + enum Type + { + SHARED /**< The same instance can be written by + * multiple DataWriter objects. All updates will be made available to the + * DataReader objects. In other words it does not have a specific owner. + */ + #ifdef OMG_DDS_OWNERSHIP_SUPPORT + , + EXCLUSIVE /**< The instance will only be accepted from one + DataWriter which is the only one whose modifications will be visible to the + DataReader objects. + */ + #endif // OMG_DDS_OWNERSHIP_SUPPORT + }; +}; + +typedef dds::core::safe_enum OwnershipKind; + +struct DataRepresentationId_def +{ + enum Type: std::int16_t + { + XCDR1 = 0, /**< Old style CDR serialization, does NOT support extensible types.*/ + XML = 1, /**< XML representation, not supported by writers at this moment.*/ + XCDR2 = 2 /**< New style CDR serialization, DOES support extensible types.*/ + }; +}; + +typedef dds::core::safe_enum DataRepresentationId; +typedef std::vector DataRepresentationIdSeq; + +struct DurabilityKind_def +{ + enum Type + { + VOLATILE, /**< The samples are not available to late-joining + * DataReaders. In other words, only DataReaders, which were present at the + * time of the writing and have subscribed to this Topic, will receive the sample. + * When a DataReader subscribes afterwards (late-joining), it will only be able to + * read the next written sample. This setting is typically used for data, which is + * updated quickly. + */ + TRANSIENT_LOCAL /**< Currently behaves identically to the + * TRANSIENT_DURABILITY_QOS, except for its RxO properties. The desired + * behaviour of TRANSIENT_LOCAL_DURABILITY_QOS can be achieved from the + * TRANSIENT_DURABILITY_QOS with the default (TRUE) setting of the + * autodispose_unregistered_instances flag on the DataWriter and the + * service_cleanup_delay set to 0 on the durability service. This is because for + * TRANSIENT_LOCAL, the data should only remain available for late-joining + * readers during the lifetime of its source writer, so it is not required to survive after + * its source writer has been deleted. Since the deletion of a writer implicitly + * unregisters all its instances, an autodispose_unregistered_instances + * value of TRUE will also dispose the affected data from the durability store, and + * thus prevent it from remaining available to late joining readers. + */ + #ifdef OMG_DDS_PERSISTENCE_SUPPORT + , + TRANSIENT, /**< Some samples are available to late-joining + * DataReaders (stored in memory). This means that the late-joining + * DataReaders are able to read these previously written samples. The + * DataReader does not necessarily have to exist at the time of writing. Not all + * samples are stored (depending on QosPolicy History and QosPolicy + * resource_limits). The storage does not depend on the DataWriter and will + * outlive the DataWriter. This may be used to implement reallocation of + * applications because the data is saved in the Data Distribution Service (not in the + * DataWriter). This setting is typically used for state related information of an + * application. In this case also the DurabilityServiceQosPolicy settings are + * relevant for the behaviour of the Data Distribution Service. + */ + PERSISTENT /**< The data is stored in permanent storage (e.g. + * hard disk). This means that the samples are also available after a system restart. + * The samples not only outlives the DataWriters, but even the Data Distribution + * Service and the system. This setting is typically used for attributes and settings for + * an application or the system. In this case also the + * DurabilityServiceQosPolicy settings are relevant for the behaviour of the + * Data Distribution Service. + */ + #endif // #ifdef OMG_DDS_PERSISTENCE_SUPPORT + }; +}; +typedef dds::core::safe_enum DurabilityKind; + +struct PresentationAccessScopeKind_def +{ + enum Type + { + INSTANCE, /**< Presentation Access Scope is per instance. */ + TOPIC /**< Presentation Access Scope is per topic. */ + + #ifdef OMG_DDS_OBJECT_MODEL_SUPPORT + , + GROUP /**< Presentation Access Scope is per group. */ + #endif // OMG_DDS_OBJECT_MODEL_SUPPORT + }; +}; +typedef dds::core::safe_enum PresentationAccessScopeKind; + + +struct ReliabilityKind_def +{ + enum Type + { + BEST_EFFORT, /**< The Data Distribution Service will only + * attempt to deliver the data; no arrival-checks are being performed and any lost + * data is not re-transmitted (non-reliable). Presumably new values for the samples + * are generated often enough by the application so that it is not necessary to resent + * or acknowledge any samples. + */ + RELIABLE /**< The Data Distribution Service will attempt to + * deliver all samples in the DataWriters history; arrival-checks are performed + * and data may get re-transmitted in case of lost data. In the steady-state (no + * modifications communicated via the DataWriter) the Data Distribution Service + * guarantees that all samples in the DataWriter history will eventually be + * delivered to the all DataReader objects. Outside the steady-state the + * HistoryQosPolicy and ResourceLimitsQosPolicy determine how + * samples become part of the history and whether samples can be discarded from it. + * In this case also the max_blocking_time must be set. + */ + }; +}; +typedef dds::core::safe_enum ReliabilityKind; + + +struct DestinationOrderKind_def +{ + enum Type + { + BY_RECEPTION_TIMESTAMP, /**< The order is based on the timestamp, at the moment the sample was + * received by the DataReader. + */ + BY_SOURCE_TIMESTAMP /**< The order is based on the timestamp, which was set by the + * DataWriter. This means that the system needs some time synchronization. + */ + }; +}; + +typedef dds::core::safe_enum DestinationOrderKind; + +struct HistoryKind_def +{ + enum Type + { + KEEP_LAST, /**< The Data Distribution Service will only attempt to + * keep the latest values of the instance and discard the older ones. The attribute + * “depth” determines how many samples in history will be stored. In other words, + * only the most recent samples in history are stored. On the publishing side, the + * Data Distribution Service will only keep the most recent “depth” samples of each + * instance of data (identified by its key) managed by the DataWriter. On the + * subscribing side, the DataReader will only keep the most recent “depth” + * samples received for each instance (identified by its key) until the application + * “takes” them via the DataReader::take operation. + * KEEP_LAST_HISTORY_QOS - is the default kind. The default value of depth is + * 1, indicating that only the most recent value should be delivered. If a depth other + * than 1 is specified, it should be compatible with the settings of the + * ResourcelimitsQosPolicy max_samples_per_instance. For these two + * QosPolicy settings to be compatible, they must verify that depth <= + * max_samples_per_instance, otherwise a + * RETCODE_INCONSISTENT_POLICY is generated on relevant operations. + */ + KEEP_ALL /**< All samples are stored, provided, the resources are + * available. On the publishing side, the Data Distribution Service will attempt to + * keep all samples (representing each value written) of each instance of data + * (identified by its key) managed by the DataWriter until they can be delivered to + * all subscribers. On the subscribing side, the Data Distribution Service will + * attempt to keep all samples of each instance of data (identified by its key) + * managed by the DataReader. These samples are kept until the application + * “takes” them from the Data Distribution Service via the DataReader::take + * operation. The setting of depth has no effect. Its implied value is + * LENGTH_UNLIMITED. The resources that the Data Distribution Service can use to + * keep this history are limited by the settings of the ResourceLimitsQosPolicy. + * If the limit is reached, the behaviour of the Data Distribution Service will depend + * on the ReliabilityQosPolicy. If the ReliabilityQosPolicy is + * BEST_EFFORT_RELIABILITY_QOS, the old values are discarded. If + * ReliabilityQosPolicy is RELIABLE_RELIABILITY_QOS, the Data + * Distribution Service will block the DataWriter until it can deliver the necessary + * old values to all subscribers. + */ + }; +}; + +typedef dds::core::safe_enum HistoryKind; + +struct LivelinessKind_def +{ + enum Type + { + AUTOMATIC, /**< The Data Distribution Service will take care of + * reporting the Liveliness automatically with a rate determined by the + * lease_duration. + */ + MANUAL_BY_PARTICIPANT, /**< The application must take care + * of reporting the liveliness before the lease_duration expires. If an Entity + * reports its liveliness, all Entities within the same DomainParticipant that + * have their liveliness kind set to MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, + * can be considered alive by the Data Distribution Service. Liveliness can reported + * explicitly by calling the operation assert_liveliness on the + * DomainParticipant or implicitly by writing some data. + */ + MANUAL_BY_TOPIC /**< The application must take care of + * reporting the liveliness before the lease_duration expires. This can explicitly + * be done by calling the operation assert_liveliness on the DataWriter or + * implicitly by writing some data. + */ + }; +}; +typedef dds::core::safe_enum LivelinessKind; + +struct TypeConsistencyKind_def +{ + enum Type + { + DISALLOW_TYPE_COERCION, + ALLOW_TYPE_COERCION + }; +}; + +typedef dds::core::safe_enum TypeConsistencyKind; + +} +} +} +#endif /* OMG_DDS_CORE_POLICY_POLICYKIND_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/policy/QosPolicyCount.hpp b/unitree_SDK/include/ddscxx/dds/core/policy/QosPolicyCount.hpp new file mode 100644 index 0000000..b1a1e5d --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/policy/QosPolicyCount.hpp @@ -0,0 +1,35 @@ +#ifndef OMG_DDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_ +#define OMG_DDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace core +{ +namespace policy +{ +typedef dds::core::policy::detail::QosPolicyCount QosPolicyCount; +} +} +} + +#endif /* !defined(OMG_DDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_) */ diff --git a/unitree_SDK/include/ddscxx/dds/core/policy/TCorePolicy.hpp b/unitree_SDK/include/ddscxx/dds/core/policy/TCorePolicy.hpp new file mode 100644 index 0000000..9bdb220 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/policy/TCorePolicy.hpp @@ -0,0 +1,1835 @@ +#ifndef OMG_TDDS_CORE_POLICY_CORE_POLICY_HPP_ +#define OMG_TDDS_CORE_POLICY_CORE_POLICY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include + +//============================================================================== +// DDS Policy Classes +namespace dds +{ +namespace core +{ +namespace policy +{ + +//============================================================================== +/** + * \copydoc DCPS_QoS_UserData + */ +template +class TUserData : public dds::core::Value +{ +public: + /** + * Creates a UserData QoS instance with an empty UserData + */ + TUserData(); + + /** + * Creates a UserData QoS instance + * + * @param sequence the sequence of octets + */ + explicit TUserData(const dds::core::ByteSeq& sequence); + + /** + * Creates a UserData QoS instance + * + * @param value_begin a pointer to the beginning of a sequence + * of octets + * @param value_end a pointer to the end of a sequence + * of octets + */ + TUserData(const uint8_t* value_begin, const uint8_t* value_end); + + /** + * Copies a UserData QoS instance + * + * @param other the UserData QoS instance to copy + */ + TUserData(const TUserData& other); + + /** + * Copies a UserData QoS instance + * + * @param other the UserData QoS instance to copy + * + * @return Reference to the Userdata QoS instance that was copied to + */ + TUserData& operator=(const TUserData& other) = default; + +public: + /** + * Sets the sequence + * + * @param sequence a sequence of octets + */ + TUserData& value(const dds::core::ByteSeq& sequence); + + /** + * Sets the sequence + * + * @param begin an iterator pointing to the beginning of a sequence + * of octets + * @param end an iterator pointing to the end of a sequence of octets + */ + template + TUserData& value(OCTET_ITER begin, OCTET_ITER end); + + /** + * Gets the sequence + * + * @return a sequence of octets + */ + const dds::core::ByteSeq value() const; + + /** + * Gets a pointer to the first octet in the sequence + * + * @return a pointer to the first octet in the sequence + */ + const uint8_t* begin() const; + + /** + * Gets a pointer to the last octet in the sequence + * + * @return a pointer to the first octet in the sequence + */ + const uint8_t* end() const; +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_GroupData + */ +template +class TGroupData : public dds::core::Value +{ +public: + /** + * Creates a GroupData QoS instance + */ + TGroupData(); + + /** + * Creates a GroupData QoS instance + * + * @param sequence the sequence of octets representing the GroupData + */ + explicit TGroupData(const dds::core::ByteSeq& sequence); + + /** + * Copies a GroupData QoS instance + * + * @param other the GroupData QoS instance to copy + */ + TGroupData(const TGroupData& other); + + /** + * Copies a GroupData QoS instance + * + * @param other the GroupData QoS instance to copy + * + * @return Reference to the GroupData QoS instance that was copied to + */ + TGroupData& operator=(const TGroupData& other) = default; + + /** + * Creates a GroupData QoS instance + * + * @param value_begin a pointer to the beginning of a sequence + * of octets + * @param value_end a pointer to the end of a sequence + * of octets + */ + TGroupData(const uint8_t* value_begin, const uint8_t* value_end); + +public: + /** + * Set the sequence + * + * @param sequence a sequence of octets + */ + TGroupData& value(const dds::core::ByteSeq& sequence); + + /** + * Set the sequence + * + * @param begin an iterator pointing to the beginning of a sequence + * of octets + * @param end an iterator pointing to the end of a sequence of octets + */ + template + TGroupData& value(OCTET_ITER begin, OCTET_ITER end); + + /** + * Get the sequence + * + * @return a sequence of octets + */ + const dds::core::ByteSeq value() const; + + /** + * Gets a pointer to the first octet in the sequence + * + * @return a pointer to the first octet in the sequence + */ + const uint8_t* begin() const; + + /** + * Gets a pointer to the last octet in the sequence + * + * @return a pointer to the last octet in the sequence + */ + const uint8_t* end() const; +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_TopicData + */ +template +class TTopicData : public dds::core::Value +{ +public: + /** + * Creates a TopicData QoS instance + */ + TTopicData(); + + /** + * Creates a TopicData QoS instance + * + * @param sequence the sequence of octets representing the TopicData + */ + explicit TTopicData(const dds::core::ByteSeq& sequence); + + /** + * Copies a TopicData QoS instance + * + * @param other the TopicData QoS instance to copy + */ + TTopicData(const TTopicData& other); + + /** + * Creates a TopicData QoS instance + * + * @param value_begin a pointer to the beginning of a sequence + * of octets + * @param value_end a pointer to the end of a sequence + * of octets + */ + TTopicData(const uint8_t* value_begin, const uint8_t* value_end); + + /** + * Copies a TopicData QoS instance + * + * @param other the TopicData QoS instance to copy + * + * @return Reference to the TopicData QoS instance that was copied to + */ + TTopicData& operator=(const TTopicData& other) = default; + +public: + /** + * Set the sequence + * + * @param sequence a sequence of octets + */ + TTopicData& value(const dds::core::ByteSeq& sequence); + + /** + * Set the sequence + * + * @param begin an iterator pointing to the beginning of a sequence + * of octets + * @param end an iterator pointing to the end of a sequence of octets + */ + template + TTopicData& value(OCTET_ITER begin, OCTET_ITER end); + + /** + * Get the sequence + * + * @return a sequence of octets + */ + const dds::core::ByteSeq value() const; + + /** + * Gets a pointer to the first octet in the sequence + * + * @return a pointer to the first octet in the sequence + */ + const uint8_t* begin() const; + + /** + * Gets a pointer to the last octet in the sequence + * + * @return a pointer to the last octet in the sequence + */ + const uint8_t* end() const; +}; + + +//============================================================================== + +/** + * \copydoc DCPS_QoS_EntityFactory + */ +template +class TEntityFactory : public dds::core::Value +{ +public: + /** + * Creates an EntityFactory QoS instance + * + * @param autoenable_created_entities boolean indicating whether + * created Entities should be automatically enabled + */ + explicit TEntityFactory(bool autoenable_created_entities = true); + + /** + * Copies an EntityFactory QoS instance + * + * @param other the EntityFactory QoS instance to copy + */ + TEntityFactory(const TEntityFactory& other); + + /** + * Copies an EntityFactory QoS instance + * + * @param other the EntityFactory QoS instance to copy + * + * @return Reference to the EntityFactory QoS instance that was copied to + */ + TEntityFactory& operator=(const TEntityFactory& other) = default; + +public: + /** + * Sets a boolean indicating whether created Entities should be + * automatically enabled + * + * @param autoenable_created_entities boolean indicating whether + * created Entities should be automatically enabled + */ + TEntityFactory& autoenable_created_entities(bool autoenable_created_entities); + + /** + * Gets a boolean indicating whether Entities should be automatically enabled + * + * @return boolean indicating whether created Entities should be automatically + * enabled + */ + bool autoenable_created_entities() const; + +public: + /** + * @return an EntityFactory QoS instance with autoenable_created_entities + * set to true + */ + static TEntityFactory AutoEnable(); + + /** + * @return an EntityFactory QoS instance with autoenable_created_entities + * set to false + */ + static TEntityFactory ManuallyEnable(); +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_TransportPriority + */ +template +class TTransportPriority : public dds::core::Value +{ +public: + /** + * Creates a TransportPriority QoS instance + * + * @param priority the priority value + */ + explicit TTransportPriority(int32_t priority = 0); + + /** + * Copies a TransportPriority QoS instance + * + * @param other the TransportPriority QoS instance to copy + */ + TTransportPriority(const TTransportPriority& other); + + /** + * Copies a TransportPriority QoS instance + * + * @param other the TransportPriority QoS instance to copy + * + * @return Reference to the TransportPriority QoS instance that was copied to + */ + TTransportPriority& operator=(const TTransportPriority& other) = default; + +public: + /** + * Sets the priority value + * + * @param priority the priority value + */ + TTransportPriority& value(int32_t priority); + + /** + * Gets the priority value + * + * @return the priority value + */ + int32_t value() const; +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_Lifespan + */ +template +class TLifespan : public dds::core::Value +{ +public: + /** + * Creates a Lifespan QoS instance + * + * @param duration Lifespan expiration duration + */ + explicit TLifespan(const dds::core::Duration& duration = dds::core::Duration::infinite()); + + /** + * Copies a Lifespan QoS instance + * + * @param other the Lifespan QoS instance to copy + */ + TLifespan(const TLifespan& other); + + /** + * Copies a Lifespan QoS instance + * + * @param other the Lifespan QoS instance to copy + * + * @return Reference to the Lifespan QoS instance that was copied to + */ + TLifespan& operator=(const TLifespan& other) = default; + +public: + /** + * Sets the expiration duration + * + * @param duration expiration duration + */ + TLifespan& duration(const dds::core::Duration& duration); + + /** + * Gets the expiration duration + * + * @return expiration duration + */ + const dds::core::Duration duration() const; +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_Deadline + */ +template +class TDeadline : public dds::core::Value +{ +public: + /** + * Creates a Deadline QoS instance + * + * @param period deadline period + */ + explicit TDeadline(const dds::core::Duration& period = dds::core::Duration::infinite()); + + /** + * Copies a Deadline QoS instance + * + * @param other the Deadline QoS instance to copy + */ + TDeadline(const TDeadline& other); + + /** + * Copies a Deadline QoS instance + * + * @param other the Deadline QoS instance to copy + * + * @return reference to the Deadline QoS instance that was copied to + */ + TDeadline& operator=(const TDeadline& other) = default; + +public: + /** + * Sets the deadline period + * + * @param period deadline period + */ + TDeadline& period(const dds::core::Duration& period); + + /** + * Gets the deadline period + * + * @return deadline period + */ + const dds::core::Duration period() const; +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_LatencyBudget + */ +template +class TLatencyBudget : public dds::core::Value +{ +public: + /** + * Creates a LatencyBudget QoS instance + * + * @param duration duration + */ + explicit TLatencyBudget(const dds::core::Duration& duration = dds::core::Duration::zero()); + + /** + * Copies a LatencyBudget QoS instance + * + * @param other the LatencyBudget QoS instance to copy + */ + TLatencyBudget(const TLatencyBudget& other); + + /** + * Copies a LatencyBudget QoS instance + * + * @param other the LatencyBudget QoS instance to copy + * + * @return reference to the LatencyBudget QoS instance that was copied to + */ + TLatencyBudget& operator=(const TLatencyBudget& other) = default; + +public: + /** + * Sets the duration + * + * @param duration duration + */ + TLatencyBudget& duration(const dds::core::Duration& duration); + + /** + * Gets the duration + * + * @return duration + */ + const dds::core::Duration duration() const; +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_TimeBasedFilter + */ +template +class TTimeBasedFilter : public dds::core::Value +{ +public: + /** + * Creates a TimeBasedFilter QoS instance + * + * @param period minimum separation period + */ + explicit TTimeBasedFilter( + const dds::core::Duration& period = dds::core::Duration::zero()); + + /** + * Copies a TimeBasedFilter QoS instance + * + * @param other the TimeBasedFilter QoS instance to copy + */ + TTimeBasedFilter(const TTimeBasedFilter& other); + + /** + * Copies a TimeBasedFilter QoS instance + * + * @param other the TimeBasedFilter QoS instance to copy + * + * @return reference to the TimeBasedFilter QoS instance that was copied to + */ + TTimeBasedFilter& operator=(const TTimeBasedFilter& other) = default; + +public: + /** + * Sets the minimum separation period + * + * @param period minimum separation period + */ + TTimeBasedFilter& minimum_separation(const dds::core::Duration& period); + + /** + * Gets the minimum separation period + * + * @return minimum separation period + */ + const dds::core::Duration minimum_separation() const; +}; + + +//============================================================================== + +/** + * \copydoc DCPS_QoS_Partition + */ +template +class TPartition : public dds::core::Value +{ +public: + /** + * Creates a Partition QoS instance + * + * @param name partition name + */ + explicit TPartition(const std::string& name = ""); + + /** + * Creates a Partition QoS instance + * + * @param names a sequence containing multiple partition names + */ + explicit TPartition(const dds::core::StringSeq& names); + + /** + * Copies a Partition QoS instance + * + * @param other the Partition QoS instance to copy + */ + TPartition(const TPartition& other); + + /** + * Copies a Partition QoS instance + * + * @param other the Partition QoS instance to copy + * + * @return reference to the Partition QoS instance that was copied to + */ + TPartition& operator=(const TPartition& other) = default; + +public: + /** + * Sets the partition name + * + * @param name the partition name + */ + TPartition& name(const std::string& name); + + /** + * Sets multiple partition names + * + * @param names a sequence containing multiple partition names + */ + TPartition& name(const dds::core::StringSeq& names); + + /** + * Gets the partition names + * + * @return a sequence containing the partition names + */ + const dds::core::StringSeq name() const; +}; + +//============================================================================== +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + +/** + * \copydoc DCPS_QoS_Ownership + */ +template +class TOwnership : public dds::core::Value +{ +public: + # if defined (__SUNPRO_CC) && defined(SHARED) +# undef SHARED + # endif + /** + * Creates an Ownership QoS instance + * + * @param kind the kind + */ + explicit TOwnership( + dds::core::policy::OwnershipKind::Type kind = dds::core::policy::OwnershipKind::SHARED); + + /** + * Copies an Ownership QoS instance + * + * @param other the Ownership QoS instance to copy + */ + TOwnership(const TOwnership& other); + + /** + * Copies an Ownership QoS instance + * + * @param other the Ownership QoS instance to copy + * + * @return reference to the Ownership QoS instance that was copied to + */ + TOwnership& operator=(const TOwnership& other) = default; + +public: + /** + * Set the kind + * + * @param kind the kind to set + * + * @return the kind that was set + */ + TOwnership& kind(dds::core::policy::OwnershipKind::Type kind); + + /** + * Get the kind + * + * @return the kind + */ + dds::core::policy::OwnershipKind::Type kind() const; + +public: + /** + * @return an Ownership QoS instance with the kind set to EXCLUSIVE + */ + static TOwnership Exclusive(); + + /** + * @return an Ownership QoS instance with the kind set to SHARED + */ + static TOwnership Shared(); +}; + + +//============================================================================== + +/** + * \copydoc DCPS_QoS_OwnershipStrength + */ +template +class TOwnershipStrength : public dds::core::Value +{ +public: + /** + * Creates an OwnershipStrength QoS instance + * + * @param strength ownership strength + */ + explicit TOwnershipStrength(int32_t strength = 0); + + /** + * Copies an OwnershipStrength QoS instance + * + * @param other the OwnershipStrength QoS instance to copy + */ + TOwnershipStrength(const TOwnershipStrength& other); + + /** + * Copies an OwnershipStrength QoS instance + * + * @param other the OwnershipStrength QoS instance to copy + * + * @return reference to the OwnershipStrength QoS instance that was copied to + */ + TOwnershipStrength& operator=(const TOwnershipStrength& other) = default; + +public: + /** + * Gets the ownership strength value + * + * @return the ownership strength value + */ + int32_t value() const; + + /** + * Sets the ownership strength value + * + * @param strength the ownership strength value + */ + TOwnershipStrength& value(int32_t strength); +}; + +#endif // OMG_DDS_OWNERSHIP_SUPPORT +//============================================================================== + +/** + * \copydoc DCPS_QoS_WriterDataLifecycle + */ +template +class TWriterDataLifecycle : public dds::core::Value +{ +public: + /** + * Creates a WriterDataLifecycle QoS instance + * + * @param autodispose_unregistered_instances a boolean indicating if unregistered + * instances should be autodisposed + */ + explicit TWriterDataLifecycle(bool autodispose_unregistered_instances = true); + + /** + * Copies a WriterDataLifecycle QoS instance + * + * @param other the WriterDataLifecycle QoS instance to copy + */ + TWriterDataLifecycle(const TWriterDataLifecycle& other); + + /** + * Copies a WriterDataLifecycle QoS instance + * + * @param other the WriterDataLifecycle QoS instance to copy + * + * @return reference to the WriterDataLifecycle QoS instance that was copied to + */ + TWriterDataLifecycle& operator=(const TWriterDataLifecycle& other) = default; + +public: + /** + * Gets a boolean indicating if unregistered instances should be autodisposed + * + * @return a boolean indicating if unregistered instances should be autodisposed + */ + bool autodispose_unregistered_instances() const; + + /** + * Sets a boolean indicating if unregistered instances should be autodisposed + * + * @param autodispose_unregistered_instances a boolean indicating if unregistered + * instances should be autodisposed + */ + TWriterDataLifecycle& autodispose_unregistered_instances( + bool autodispose_unregistered_instances); + +public: + /** + * @return a WriterDataLifecycle QoS instance with autodispose_unregistered_instances + * set to true + */ + static TWriterDataLifecycle AutoDisposeUnregisteredInstances(); + + /** + * @return a WriterDataLifecycle QoS instance with autodispose_unregistered_instances + * set to false + */ + static TWriterDataLifecycle ManuallyDisposeUnregisteredInstances(); + +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_ReaderDataLifecycle + */ +template +class TReaderDataLifecycle : public dds::core::Value +{ +public: + /** + * Creates a ReaderDataLifecycle QoS instance + * + * @param autopurge_nowriter_samples_delay the autopurge nowriter samples delay + * @param autopurge_disposed_samples_delay the autopurge disposed samples delay + */ + TReaderDataLifecycle( + const dds::core::Duration& autopurge_nowriter_samples_delay = dds::core::Duration::infinite(), + const dds::core::Duration& autopurge_disposed_samples_delay = dds::core::Duration::infinite()); + + /** + * Copies a ReaderDataLifecycle QoS instance + * + * @param other the ReaderDataLifecycle QoS instance to copy + */ + TReaderDataLifecycle(const TReaderDataLifecycle& other); + + /** + * Copies a ReaderDataLifecycle QoS instance + * + * @param other the ReaderDataLifecycle QoS instance to copy + * + * @return reference to the ReaderDataLifecycle QoS that was copied to + */ + TReaderDataLifecycle& operator=(const TReaderDataLifecycle& other) = default; +public: + /** + * Gets the autopurge nowriter samples delay + * + * @return the autopurge nowriter samples delay + */ + const dds::core::Duration autopurge_nowriter_samples_delay() const; + + /** + * Sets the autopurge nowriter samples delay + * + * @param autopurge_nowriter_samples_delay the autopurge nowriter samples delay + */ + TReaderDataLifecycle& autopurge_nowriter_samples_delay( + const dds::core::Duration& autopurge_nowriter_samples_delay); + + /** + * Gets the autopurge_disposed_samples_delay + * + * @return the autopurge disposed samples delay + */ + const dds::core::Duration autopurge_disposed_samples_delay() const; + + /** + * Sets the autopurge_disposed_samples_delay + * + * @return the autopurge disposed samples delay + */ + TReaderDataLifecycle& autopurge_disposed_samples_delay( + const dds::core::Duration& autopurge_disposed_samples_delay); + +public: + /** + * @return a ReaderDataLifecycle QoS instance which will not autopurge disposed + * samples + */ + static TReaderDataLifecycle NoAutoPurgeDisposedSamples(); + + /** + * @param autopurge_disposed_samples_delay the autopurge disposed samples delay + * @return a ReaderDataLifecycle QoS instance with autopurge_disposed_samples_delay + * set to a specified value + */ + static TReaderDataLifecycle AutoPurgeDisposedSamples( + const dds::core::Duration& autopurge_disposed_samples_delay); + +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_Durability + */ +template +class TDurability : public dds::core::Value +{ +public: + /** + * Creates a Durability QoS instance + * + * @param kind the kind + */ + explicit TDurability( + dds::core::policy::DurabilityKind::Type kind = dds::core::policy::DurabilityKind::VOLATILE); + + /** + * Copies a Durability QoS instance + * + * @param other the Durability QoS instance to copy + */ + TDurability(const TDurability& other); + + /** + * Copies a Durability QoS instance + * + * @param other the Durability QoS instance to copy + * + * @return reference to the Durability QoS that was copied to + */ + TDurability& operator=(const TDurability& other) = default; + +public: + /** + * Set the kind + * + * @param kind the kind to set + * + * @return the kind that was set + */ + TDurability& kind(dds::core::policy::DurabilityKind::Type kind); + + /** + * Get the kind + * + * @return the kind + */ + dds::core::policy::DurabilityKind::Type kind() const; + +public: + /** + * @return a Durability QoS instance with the kind set to VOLATILE + */ + static TDurability Volatile(); + + /** + * @return a Durability QoS instance with the kind set to TRANSIENT_LOCAL + */ + static TDurability TransientLocal(); + + /** + * @return a Durability QoS instance with the kind set to TRANSIENT + */ + static TDurability Transient(); + + /** + * @return a Durability QoS instance with the kind set to PERSISTENT + */ + static TDurability Persistent(); +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_Presentation + */ +template +class TPresentation : public dds::core::Value +{ +public: + /** + * Creates a Presentation QoS instance + * + * @param access_scope the access_scope kind + * @param coherent_access the coherent_access setting + * @param ordered_access the ordered_access setting + */ + TPresentation( + dds::core::policy::PresentationAccessScopeKind::Type access_scope + = dds::core::policy::PresentationAccessScopeKind::INSTANCE, + bool coherent_access = false, + bool ordered_access = false); + + /** + * Copies a Presentation QoS instance + * + * @param other the Presentation QoS instance to copy + */ + TPresentation(const TPresentation& other); + + /** + * Copies a Presentation QoS instance + * + * @param other the Presentation QoS instance to copy + * + * @return reference to the Presentation QoS that was copied to + */ + TPresentation& operator=(const TPresentation& other) = default; + +public: + /** + * Sets the access_scope kind + * + * @param access_scope the access_scope kind + */ + TPresentation& access_scope(dds::core::policy::PresentationAccessScopeKind::Type access_scope); + + /** + * Gets the access_scope kind + * + * @return the access_scope kind + */ + dds::core::policy::PresentationAccessScopeKind::Type access_scope() const; + + /** + * Sets the coherent_access setting + * + * @param coherent_access the coherent_access setting + */ + TPresentation& coherent_access(bool coherent_access); + + /** + * Gets the coherent_access setting + * + * @return the coherent_access setting + */ + bool coherent_access() const; + + /** + * Sets the ordered_access setting + * + * @param ordered_access the ordered_access setting + */ + TPresentation& ordered_access(bool ordered_access); + + /** + * Gets the ordered_access setting + * + * @return the ordered_access setting + */ + bool ordered_access() const; + +public: + /** + * @param coherent_access the coherent_access setting + * @param ordered_access the ordered_access setting + * + * @return a Presentation QoS instance with a GROUP access_score and coherent_access + * and ordered_access set to the specified values + */ + static TPresentation GroupAccessScope(bool coherent_access = false, bool ordered_access = false); + + /** + * @param coherent_access the coherent_access setting + * @param ordered_access the ordered_access setting + * + * @return a Presentation QoS instance with a INSTANCE access_score and coherent_access + * and ordered_access set to the specified values + */ + static TPresentation InstanceAccessScope(bool coherent_access = false, bool ordered_access = false); + + /** + * @param coherent_access the coherent_access setting + * @param ordered_access the ordered_access setting + * + * @return a Presentation QoS instance with a TOPIC access_score and coherent_access + * and ordered_access set to the specified values + */ + static TPresentation TopicAccessScope(bool coherent_access = false, bool ordered_access = false); +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_Reliability + */ +template +class TReliability : public dds::core::Value +{ +public: + /** + * Creates a Reliability QoS instance + * + * @param kind the kind + * @param max_blocking_time the max_blocking_time + */ + TReliability( + dds::core::policy::ReliabilityKind::Type kind = dds::core::policy::ReliabilityKind::BEST_EFFORT, + const dds::core::Duration& max_blocking_time = dds::core::Duration::from_millisecs(100)); + + /** + * Copies a Reliability QoS instance + * + * @param other the Reliability QoS instance to copy + */ + TReliability(const TReliability& other); + + /** + * Copies a Reliability QoS instance + * + * @param other the Reliability QoS instance to copy + * + * @return reference to the Reliability QoS that was copied to + */ + TReliability& operator=(const TReliability& other) = default; + +public: + /** + * Sets the kind + * + * @param kind the kind + */ + TReliability& kind(dds::core::policy::ReliabilityKind::Type kind); + + /** + * Gets the kind + * + * @return the kind + */ + dds::core::policy::ReliabilityKind::Type kind() const; + + /** + * Sets the max_blocking_time + * + * @param max_blocking_time the max_blocking_time + */ + TReliability& max_blocking_time(const dds::core::Duration& max_blocking_time); + + /** + * Gets the max_blocking_time + * + * @return the max_blocking_time + */ + const dds::core::Duration max_blocking_time() const; + +public: + /** + * @param max_blocking_time the max blocking time + * @return a Reliability QoS instance with the kind set to RELIABLE and the max_blocking_time + * set to the supplied value + */ + static TReliability Reliable(const dds::core::Duration& max_blocking_time = dds::core::Duration::from_millisecs(100)); + + /** + * @return a Reliability QoS instance with the kind set to BEST_EFFORT + */ + static TReliability BestEffort(const dds::core::Duration& max_blocking_time = dds::core::Duration::from_millisecs(100)); + +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_DestinationOrder + */ +template +class TDestinationOrder : public dds::core::Value +{ +public: + /** + * Creates a DestinationOrder QoS instance + * + * @param kind the kind + */ + explicit TDestinationOrder( + dds::core::policy::DestinationOrderKind::Type kind + = dds::core::policy::DestinationOrderKind::BY_RECEPTION_TIMESTAMP); + + /** + * Copies a DestinationOrder QoS instance + * + * @param other the DestinationOrder QoS instance to copy + */ + TDestinationOrder(const TDestinationOrder& other); + + /** + * Copies a DestinationOrder QoS instance + * + * @param other the DestinationOrder QoS instance to copy + * + * @return reference to the DestinationOrder QoS that was copied to + */ + TDestinationOrder& operator=(const TDestinationOrder& other) = default; + +public: + /** + * Sets the kind + * + * @param kind the kind + */ + TDestinationOrder& kind(dds::core::policy::DestinationOrderKind::Type kind); + + /** + * Gets the kind + * + * @return the kind + */ + dds::core::policy::DestinationOrderKind::Type kind() const; + +public: + /** + * @return a DestinationOrder QoS instance with the kind set to BY_SOURCE_TIMESTAMP + */ + static TDestinationOrder SourceTimestamp(); + + /** + * @return a DestinationOrder QoS instance with the kind set to BY_RECEPTION_TIMESTAMP + */ + static TDestinationOrder ReceptionTimestamp(); +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_History + */ +template +class THistory : public dds::core::Value +{ +public: + /** + * Creates a History QoS instance + * + * @param kind the kind + * @param depth the history depth + */ + THistory(dds::core::policy::HistoryKind::Type kind = dds::core::policy::HistoryKind::KEEP_LAST, + int32_t depth = 1); + + /** + * Copies a History QoS instance + * + * @param other the History QoS instance to copy + */ + THistory(const THistory& other); + + /** + * Copies a History QoS instance + * + * @param other the History QoS instance to copy + * + * @return reference to the History QoS that was copied to + */ + THistory& operator=(const THistory& other) = default; + +public: + /** + * Gets the kind + * + * @return the kind + */ + dds::core::policy::HistoryKind::Type kind() const; + + /** + * Sets the kind + * + * @param kind the kind + */ + THistory& kind(dds::core::policy::HistoryKind::Type kind); + + /** + * Gets the history depth + * + * @return the history depth + */ + int32_t depth() const; + + /** + * Sets the history depth + * + * @param depth the history depth to set + * + * @return the history depth that was set + */ + THistory& depth(int32_t depth); + +public: + /** + * @return a History QoS instance with the kind set to KEEP_ALL + */ + static THistory KeepAll(); + + /** + * @param depth the history depth + * @return a History QoS instance with the kind set to KEEP_LAST and the + * depth set to the supplied value + */ + static THistory KeepLast(uint32_t depth); +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_ResourceLimits + */ +template +class TResourceLimits : public dds::core::Value +{ +public: + /** + * Creates a ResourceLimits QoS instance + * + * @param max_samples the max_samples value + * @param max_instances the max_instances value + * @param max_samples_per_instance the max_samples_per_instance value + */ + TResourceLimits(int32_t max_samples = dds::core::LENGTH_UNLIMITED, + int32_t max_instances = dds::core::LENGTH_UNLIMITED, + int32_t max_samples_per_instance = dds::core::LENGTH_UNLIMITED); + + /** + * Copies a ResourceLimits QoS instance + * + * @param other the ResourceLimits QoS instance to copy + */ + TResourceLimits(const TResourceLimits& other); + + /** + * Copies a ResourceLimits QoS instance + * + * @param other the ResourceLimits QoS instance to copy + * + * @return reference to the ResourceLimits QoS that was copied to + */ + TResourceLimits& operator=(const TResourceLimits& other) = default; + +public: + /** + * Sets the max_samples value + * + * @param max_samples the max_samples value + */ + TResourceLimits& max_samples(int32_t max_samples); + + /** + * Gets the max_samples value + * + * @return the max_samples value + */ + int32_t max_samples() const; + + /** + * Sets the max_instances value + * + * @param max_instances the max_instances value + */ + TResourceLimits& max_instances(int32_t max_instances); + + /** + * Gets the max_instances value + * + * @return the max_instances value + */ + int32_t max_instances() const; + + /** + * Sets the max_samples_per_instance value + * + * @param max_samples_per_instance the max_samples_per_instance value + */ + TResourceLimits& max_samples_per_instance(int32_t max_samples_per_instance); + + /** + * Gets the max_samples_per_instance value + * + * @return the max_samples_per_instance value + */ + int32_t max_samples_per_instance() const; +}; + +//============================================================================== + +/** + * \copydoc DCPS_QoS_Liveliness + */ +template +class TLiveliness : public dds::core::Value +{ +public: + /** + * Creates a Liveliness QoS instance + * + * @param kind the kind + * @param lease_duration the lease_duration + */ + TLiveliness( + dds::core::policy::LivelinessKind::Type kind = dds::core::policy::LivelinessKind::AUTOMATIC, + const dds::core::Duration& lease_duration = dds::core::Duration::infinite()); + + /** + * Copies a Liveliness QoS instance + * + * @param other the Liveliness QoS instance to copy + */ + TLiveliness(const TLiveliness& other); + + /** + * Copies a Liveliness QoS instance + * + * @param other the Liveliness QoS instance to copy + * + * @return reference to the Liveliness QoS that was copied to + */ + TLiveliness& operator=(const TLiveliness& other) = default; + +public: + /** + * Sets the kind + * + * @param kind the kind + */ + TLiveliness& kind(dds::core::policy::LivelinessKind::Type kind); + + /** + * Gets the kind + * + * @return the kind + */ + dds::core::policy::LivelinessKind::Type kind() const; + + /** + * Sets the lease_duration + * + * @return the lease_duration + */ + TLiveliness& lease_duration(const dds::core::Duration& lease_duration); + + /** + * Gets the lease_duration + * + * @return the lease_duration + */ + const dds::core::Duration lease_duration() const; + +public: + /** + * @return a Liveliness QoS instance with the kind set to AUTOMATIC + * and the lease_duration set to the supplied value + */ + static TLiveliness Automatic(const dds::core::Duration& lease_duration = dds::core::Duration::infinite()); + + /** + * @return a Liveliness QoS instance with the kind set to MANUAL_BY_PARTICIPANT + * and the lease_duration set to the supplied value + */ + static TLiveliness ManualByParticipant(const dds::core::Duration& lease_duration = dds::core::Duration::infinite()); + + /** + * @return a Liveliness QoS instance with the kind set to MANUAL_BY_TOPIC + * and the lease_duration set to the supplied value + */ + static TLiveliness ManualByTopic(const dds::core::Duration& lease_duration = dds::core::Duration::infinite()); +}; + + +//============================================================================== +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + +/** + * \copydoc DCPS_QoS_DurabilityService + */ +template +class TDurabilityService : public dds::core::Value +{ +public: + /** + * Creates a DurabilityService QoS instance + * + * @param service_cleanup_delay the service_cleanup_delay + * @param history_kind the history_kind value + * @param history_depth the history_depth value + * @param max_samples the max_samples value + * @param max_instances the max_instances value + * @param max_samples_per_instance the max_samples_per_instance value + */ + TDurabilityService( + const dds::core::Duration& service_cleanup_delay = dds::core::Duration::zero(), + dds::core::policy::HistoryKind::Type history_kind = dds::core::policy::HistoryKind::KEEP_LAST, + int32_t history_depth = 1, + int32_t max_samples = dds::core::LENGTH_UNLIMITED, + int32_t max_instances = dds::core::LENGTH_UNLIMITED, + int32_t max_samples_per_instance = dds::core::LENGTH_UNLIMITED); + + /** + * Copies a DurabilityService QoS instance + * + * @param other the DurabilityService QoS instance to copy + */ + TDurabilityService(const TDurabilityService& other); + + /** + * Copies a DurabilityService QoS instance + * + * @param other the DurabilityService QoS instance to copy + */ + TDurabilityService& operator=(const TDurabilityService& other) = default; + +public: + /** + * Sets the service_cleanup_delay value + * + * @param service_cleanup_delay the service_cleanup_delay value + */ + TDurabilityService& service_cleanup_delay(const dds::core::Duration& service_cleanup_delay); + + /** + * Gets the service_cleanup_delay value + * + * @return the service_cleanup_delay + */ + const dds::core::Duration service_cleanup_delay() const; + + /** + * Sets the history_kind + * + * @param history_kind the history kind to set + * + * @return the history kind that was set + */ + TDurabilityService& history_kind(dds::core::policy::HistoryKind::Type history_kind); + + /** + * Gets the history_kind + * + * @return history_kind + */ + dds::core::policy::HistoryKind::Type history_kind() const; + + /** + * Sets the history_depth value + * + * @param history_depth the history_depth value + */ + TDurabilityService& history_depth(int32_t history_depth); + + /** + * Gets the history_depth value + * + * @return history_depth + */ + int32_t history_depth() const; + + /** + * Sets the max_samples value + * + * @param max_samples the max_samples value + */ + TDurabilityService& max_samples(int32_t max_samples); + + /** + * Gets the max_samples value + * + * @return the max_samples value + */ + int32_t max_samples() const; + + /** + * Sets the max_instances value + * + * @param max_instances the max_instances value + */ + TDurabilityService& max_instances(int32_t max_instances); + + /** Gets the max_instances value + * + * @return the max_instances value + */ + int32_t max_instances() const; + + /** + * Sets the max_samples_per_instance value + * + * @param max_samples_per_instance the max_samples_per_instance value + */ + TDurabilityService& max_samples_per_instance(int32_t max_samples_per_instance); + + /** + * Gets the max_samples_per_instance value + * + * @return the max_samples_per_instance value + */ + int32_t max_samples_per_instance() const; +}; + +#endif // OMG_DDS_PERSISTENCE_SUPPORT + +//============================================================================== + +//============================================================================ + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +/** + * \copydoc DCPS_QoS_DataRepresentation + */ +template +class TDataRepresentation : public dds::core::Value +{ +public: + /** + * Creates a TDataRepresentation QoS instance + * + * @param value the representations supported + */ + explicit TDataRepresentation( + const dds::core::policy::DataRepresentationIdSeq &value = { }); + + /** + * Copies a TDataRepresentation QoS instance + * + * @param other the TDataRepresentation QoS instance to copy + */ + TDataRepresentation(const TDataRepresentation& other); + + /** + * Copies a TDataRepresentation QoS instance + * + * @param other the TDataRepresentation QoS instance to copy + * + * @return reference to the TDataRepresentation QoS instance that was copied to + */ + TDataRepresentation& operator=(const TDataRepresentation& other) = default; + +public: + /** + * Set the supported representations + * + * @param value the representations to set + * + * @return the representations that were set + */ + TDataRepresentation& value(const dds::core::policy::DataRepresentationIdSeq &value); + + /** + * Get the supported representations + * + * @return the supported representations + */ + const dds::core::policy::DataRepresentationIdSeq& value() const; +}; + +#endif // defined(OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT) + + +//============================================================================ + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +/** + * \copydoc DCPS_QoS_TypeConsistencyEnforcement + */ +template +class TTypeConsistencyEnforcement : public dds::core::Value +{ +public: + /** + * Constructs a copy of a TTypeConsistencyEnforcement QoS instance + * + * @param other The instance to copy. + */ + TTypeConsistencyEnforcement(const TTypeConsistencyEnforcement& other); + + /** + * Constructs an initialized TTypeConsistencyEnforcement QoS instance + * + * @param kind the kind of type consistency + * @param ignore_sequence_bounds whether to ignore sequence bounds + * @param ignore_string_bounds whether to string bounds + * @param ignore_member_names whether to ignore members names + * @param prevent_type_widening whether to prevent type widening + * @param force_type_validation whether to force type validation + */ + explicit TTypeConsistencyEnforcement( + dds::core::policy::TypeConsistencyKind::Type kind = dds::core::policy::TypeConsistencyKind::DISALLOW_TYPE_COERCION, + bool ignore_sequence_bounds = false, + bool ignore_string_bounds = false, + bool ignore_member_names = false, + bool prevent_type_widening = true, + bool force_type_validation = false); + + /** + * Copies a TTypeConsistencyEnforcement QoS instance + * + * @param other the instance to copy + */ + TTypeConsistencyEnforcement& operator=(const TTypeConsistencyEnforcement& other) = default; + +public: + /** + * Set the kind of type consistency enforcement + * + * @param kind the kind of enforcement to set + * + * @return the type consistency enforcement that was changed + */ + TTypeConsistencyEnforcement& kind(dds::core::policy::TypeConsistencyKind::Type kind); + + /** + * Get the kind of type consistency enforcement + * + * @return the kind of type consistency enforcement + */ + dds::core::policy::TypeConsistencyKind::Type kind() const; + + /** + * Sets whether sequence bounds can be ignored in type consistency + * + * @param ignore_sequence_bounds whether to ignore sequence bounds + * + * @return the type consistency enforcement that was changed + */ + TTypeConsistencyEnforcement& ignore_sequence_bounds(bool ignore_sequence_bounds); + + /** + * Get whether sequence bounds are to be ignored + * + * @return whether sequence bounds are ignored + */ + bool ignore_sequence_bounds() const; + + /** + * Sets whether string bounds can be ignored in type consistency + * + * @param ignore_string_bounds whether to ignore string bounds + * + * @return the type consistency enforcement that was changed + */ + TTypeConsistencyEnforcement& ignore_string_bounds(bool ignore_string_bounds); + + /** + * Get whether string bounds are to be ignored + * + * @return whether string bounds are ignored + */ + bool ignore_string_bounds() const; + + /** + * Sets whether member names can be ignored in type consistency + * + * @param ignore_member_names whether to ignore member names + * + * @return the type consistency enforcement that was changed + */ + TTypeConsistencyEnforcement& ignore_member_names(bool ignore_member_names); + + /** + * Get whether member names are to be ignored + * + * @return whether member names are ignored + */ + bool ignore_member_names() const; + + /** + * Sets whether type widening is to be prevented in type consistency + * + * @param prevent_type_widening whether to prevent type widening + * + * @return the type consistency enforcement that was changed + */ + TTypeConsistencyEnforcement& prevent_type_widening(bool prevent_type_widening); + + /** + * Get whether type widening is to be prevented + * + * @return type widening is to be prevented + */ + bool prevent_type_widening() const; + + /** + * Sets whether type validation is to be forced in type consistency + * + * @param force_type_validation whether to force type validation + * + * @return the type consistency enforcement that was changed + */ + TTypeConsistencyEnforcement& force_type_validation(bool force_type_validation); + + /** + * Get whether type validation is to be forced + * + * @return whether type validation is to be forced + */ + bool force_type_validation() const; +}; + +#endif // defined(OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT) + + +//============================================================================== + + +} +} +} + +#endif /* OMG_TDDS_CORE_POLICY_CORE_POLICY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/policy/TQosPolicyCount.hpp b/unitree_SDK/include/ddscxx/dds/core/policy/TQosPolicyCount.hpp new file mode 100644 index 0000000..745d340 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/policy/TQosPolicyCount.hpp @@ -0,0 +1,94 @@ +#ifndef OMG_TDDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_ +#define OMG_TDDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace core +{ +namespace policy +{ + +#if defined(__GNUC__) && (__GNUC__ >= 10) +_Pragma("GCC diagnostic push") +_Pragma("GCC diagnostic ignored \"-Wanalyzer-null-dereference\"") +#endif + +/** + * The QosPolicyCount object shows, for a QosPolicy, the total number of + * times that the concerned DataWriter discovered a DataReader for the + * same Topic and a requested DataReaderQos that is incompatible with + * the one offered by the DataWriter. + */ +template +class TQosPolicyCount : public dds::core::Value +{ +public: + /** + * Creates a QosPolicyCount instance + * + * @param policy_id the policy_id + * @param count the count + */ + TQosPolicyCount(QosPolicyId policy_id, int32_t count); + + /** + * Copies a QosPolicyCount instance + * + * @param other the QosPolicyCount instance to copy + */ + TQosPolicyCount(const TQosPolicyCount& other); + + /** + * Copies a QosPolicyCount instance + * + * @param other the QosPolicyCount instance to copy + * + * @return a reference to the QosPolicyCount that was copied to + */ + TQosPolicyCount& operator=(const TQosPolicyCount& other) = default; + +public: + /** + * Gets the policy_id + * + * @return the policy_id + */ + QosPolicyId policy_id() const; + + /** + * Gets the count + * + * @return the count + */ + int32_t count() const; +}; + +} +} +} + +#if defined(__GNUC__) && (__GNUC__ >= 10) +_Pragma("GCC diagnostic pop") +#endif + +#endif // !defined(OMG_TDDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_) diff --git a/unitree_SDK/include/ddscxx/dds/core/policy/detail/CorePolicy.hpp b/unitree_SDK/include/ddscxx/dds/core/policy/detail/CorePolicy.hpp new file mode 100644 index 0000000..1955eb6 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/policy/detail/CorePolicy.hpp @@ -0,0 +1,111 @@ +#ifndef OMG_DDS_CORE_POLICY_DETAIL_CORE_POLICY_HPP_ +#define OMG_DDS_CORE_POLICY_DETAIL_CORE_POLICY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +#include +#include +#include + + +namespace dds { namespace core { namespace policy { namespace detail { +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + typedef dds::core::policy::TDataRepresentation + DataRepresentation; +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + + typedef dds::core::policy::TDeadline + Deadline; + + typedef dds::core::policy::TDestinationOrder + DestinationOrder; + + typedef dds::core::policy::TDurability + Durability; + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + typedef dds::core::policy::TDurabilityService + DurabilityService; +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + typedef dds::core::policy::TEntityFactory + EntityFactory; + + typedef dds::core::policy::TGroupData + GroupData; + + typedef dds::core::policy::THistory + History; + + typedef dds::core::policy::TLatencyBudget + LatencyBudget; + + typedef dds::core::policy::TLifespan + Lifespan; + + typedef dds::core::policy::TLiveliness + Liveliness; + + typedef dds::core::policy::TOwnership + Ownership; + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + typedef dds::core::policy::TOwnershipStrength + OwnershipStrength; +#endif // OMG_DDS_OWNERSHIP_SUPPORT + + typedef dds::core::policy::TPartition + Partition; + + typedef dds::core::policy::TPresentation + Presentation; + + typedef dds::core::policy::TReaderDataLifecycle + ReaderDataLifecycle; + + typedef dds::core::policy::TReliability + Reliability; + + typedef dds::core::policy::TResourceLimits + ResourceLimits; + + typedef dds::core::policy::TTimeBasedFilter + TimeBasedFilter; + + typedef dds::core::policy::TTopicData + TopicData; + + typedef dds::core::policy::TTransportPriority + TransportPriority; + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + typedef dds::core::policy::TTypeConsistencyEnforcement + TypeConsistencyEnforcement; +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + + typedef dds::core::policy::TUserData + UserData; + + typedef dds::core::policy::TWriterDataLifecycle + WriterDataLifecycle; +} } } } // namespace dds::core::policy::detail + + +#endif /* OMG_DDS_CORE_POLICY_DETAIL_CORE_POLICY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/policy/detail/QosPolicyCount.hpp b/unitree_SDK/include/ddscxx/dds/core/policy/detail/QosPolicyCount.hpp new file mode 100644 index 0000000..8270444 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/policy/detail/QosPolicyCount.hpp @@ -0,0 +1,29 @@ +#ifndef OMG_DDS_CORE_POLICY_DETAIL_QOS_POLICY_COUNT_HPP_ +#define OMG_DDS_CORE_POLICY_DETAIL_QOS_POLICY_COUNT_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds { namespace core { namespace policy { namespace detail { + typedef dds::core::policy::TQosPolicyCount QosPolicyCount; +} } } } + +#endif /* !defined(OMG_DDS_CORE_POLICY_DETAIL_QOS_POLICY_COUNT_HPP_) */ diff --git a/unitree_SDK/include/ddscxx/dds/core/policy/detail/TCorePolicyImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/policy/detail/TCorePolicyImpl.hpp new file mode 100644 index 0000000..d9c218e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/policy/detail/TCorePolicyImpl.hpp @@ -0,0 +1,1124 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_POLICY_TCOREPOLICY_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_POLICY_TCOREPOLICY_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include + +// Implementation + +namespace dds +{ +namespace core +{ +namespace policy +{ + +//TUserData + +template +TUserData::TUserData() : dds::core::Value() { } + +template +TUserData::TUserData(const dds::core::ByteSeq& sequence) : dds::core::Value(sequence) { } + +/** @internal @bug OSPL-1746 No implementation + * @todo Implementation required - see OSPL-1746 + * @see http://jira.prismtech.com:8080/browse/OSPL-1746 */ +template +TUserData::TUserData(const uint8_t* value_begin, const uint8_t* value_end) +{ + (void)value_begin; + (void)value_end; + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); +} + +template +TUserData::TUserData(const TUserData& other) : dds::core::Value(other.delegate()) { } + +template +TUserData& TUserData::value(const dds::core::ByteSeq& sequence) +{ + this->delegate().value(sequence); + return *this; +} + +/** @internal @bug OSPL-1746 No implementation + * @todo Implementation required - see OSPL-1746 + * @see http://jira.prismtech.com:8080/browse/OSPL-1746 */ +template +template +TUserData& TUserData::value(OCTET_ITER begin, OCTET_ITER end) +{ + (void)begin; + (void)end; + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); + return *this; +} + +template +const dds::core::ByteSeq TUserData::value() const +{ + return this->delegate().value(); +} + +/** @internal @bug OSPL-1746 No implementation + * @todo Implementation required - see OSPL-1746 + * @see http://jira.prismtech.com:8080/browse/OSPL-1746 */ +template +const uint8_t* TUserData::begin() const +{ + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); + return NULL; +} + +/** @internal @bug OSPL-1746 No implementation + * @todo Implementation required - see OSPL-1746 + * @see http://jira.prismtech.com:8080/browse/OSPL-1746 */ +template +const uint8_t* TUserData::end() const +{ + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); + return NULL; +} + +//TGroupData + +template +TGroupData::TGroupData() : dds::core::Value() { } + +template +TGroupData::TGroupData(const dds::core::ByteSeq& sequence) : dds::core::Value(sequence) { } + +template +TGroupData::TGroupData(const TGroupData& other) : dds::core::Value(other.delegate()) { } + +template +TGroupData::TGroupData(const uint8_t* value_begin, const uint8_t* value_end) +{ + (void)value_begin; + (void)value_end; + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); +} + +template +TGroupData& TGroupData::value(const dds::core::ByteSeq& sequence) +{ + this->delegate().value(sequence); + return *this; +} + +/** @internal @bug OSPL-1746 No implementation + * @todo Implementation required - see OSPL-1746 + * @see http://jira.prismtech.com:8080/browse/OSPL-1746 */ +template +template +TGroupData& TGroupData::value(OCTET_ITER begin, OCTET_ITER end) +{ + (void)begin; + (void)end; + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); + return *this; +} + +template +const dds::core::ByteSeq TGroupData::value() const +{ + return this->delegate().value(); +} + +/** @internal @bug OSPL-1746 No implementation + * @todo Implementation required - see OSPL-1746 + * @see http://jira.prismtech.com:8080/browse/OSPL-1746 */ +template +const uint8_t* TGroupData::begin() const +{ + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); + return NULL; +} + +/** @internal @bug OSPL-1746 No implementation + * @todo Implementation required - see OSPL-1746 + * @see http://jira.prismtech.com:8080/browse/OSPL-1746 */ +template +const uint8_t* TGroupData::end() const +{ + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); + return NULL; +} + +//TTopicData + +template +TTopicData::TTopicData() : dds::core::Value() { } + +template +TTopicData::TTopicData(const dds::core::ByteSeq& sequence) : dds::core::Value(sequence) { } + +template +TTopicData::TTopicData(const TTopicData& other) : dds::core::Value(other.delegate()) { } + +/** @internal @bug OSPL-1746 No implementation + * @todo Implementation required - see OSPL-1746 + * @see http://jira.prismtech.com:8080/browse/OSPL-1746 */ +template +TTopicData::TTopicData(const uint8_t* value_begin, const uint8_t* value_end) +{ + (void)value_begin; + (void)value_end; + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); +} + +template +TTopicData& TTopicData::value(const dds::core::ByteSeq& sequence) +{ + this->delegate().value(sequence); + return *this; +} + +/** @internal @bug OSPL-1746 No implementation + * @todo Implementation required - see OSPL-1746 + * @see http://jira.prismtech.com:8080/browse/OSPL-1746 */ +template +template +TTopicData& TTopicData::value(OCTET_ITER begin, OCTET_ITER end) +{ + (void)begin; + (void)end; + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); + return *this; +} + +template +const dds::core::ByteSeq TTopicData::value() const +{ + return this->delegate().value(); +} + +/** @internal @bug OSPL-1746 No implementation + * @todo Implementation required - see OSPL-1746 + * @see http://jira.prismtech.com:8080/browse/OSPL-1746 */ +template +const uint8_t* TTopicData::begin() const +{ + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); + return NULL; +} + +/** @internal @bug OSPL-1746 No implementation + * @todo Implementation required - see OSPL-1746 + * @see http://jira.prismtech.com:8080/browse/OSPL-1746 */ +template +const uint8_t* TTopicData::end() const +{ + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Function not currently supported"); + return NULL; +} + +//TEntityFactory + +template +TEntityFactory::TEntityFactory(bool autoenable_created_entities) : dds::core::Value(autoenable_created_entities) { } + +template +TEntityFactory::TEntityFactory(const TEntityFactory& other) : dds::core::Value(other.delegate()) { } + +template +TEntityFactory& TEntityFactory::autoenable_created_entities(bool autoenable_created_entities) +{ + this->delegate().auto_enable(autoenable_created_entities); + return *this; +} + +template +bool TEntityFactory::autoenable_created_entities() const +{ + return this->delegate().auto_enable(); +} + +template +TEntityFactory TEntityFactory::AutoEnable() +{ + return TEntityFactory(true); +} + +template +TEntityFactory TEntityFactory::ManuallyEnable() +{ + return TEntityFactory(false); +} + +//TTransportPriority + +template +TTransportPriority::TTransportPriority(int32_t priority) : dds::core::Value(priority) { } + +template +TTransportPriority::TTransportPriority(const TTransportPriority& other) : dds::core::Value(other.delegate()) { } + +template +TTransportPriority& TTransportPriority::value(int32_t priority) +{ + this->delegate().value(priority); + return *this; +} + +template +int32_t TTransportPriority::value() const +{ + return this->delegate().value(); +} + +//TLifeSpan + +template +TLifespan::TLifespan(const dds::core::Duration& duration) : dds::core::Value(duration) { } + +template +TLifespan::TLifespan(const TLifespan& other) : dds::core::Value(other.delegate()) { } + +template +TLifespan& TLifespan::duration(const dds::core::Duration& duration) +{ + this->delegate().duration(duration); + return *this; +} + +template +const dds::core::Duration TLifespan::duration() const +{ + return this->delegate().duration(); +} + +//TDeadline + +template +TDeadline::TDeadline(const dds::core::Duration& period) : dds::core::Value(period) { } + +template +TDeadline::TDeadline(const TDeadline& other) : dds::core::Value(other.delegate()) { } + +template +TDeadline& TDeadline::period(const dds::core::Duration& period) +{ + this->delegate().period(period); + return *this; +} + +template +const dds::core::Duration TDeadline::period() const +{ + return this->delegate().period(); +} + +//TLatencyBudget + +template +TLatencyBudget::TLatencyBudget(const dds::core::Duration& duration) : dds::core::Value(duration) { } + +template +TLatencyBudget::TLatencyBudget(const TLatencyBudget& other) : dds::core::Value(other.delegate()) { } + +template +TLatencyBudget& TLatencyBudget::duration(const dds::core::Duration& duration) +{ + this->delegate().duration(duration); + return *this; +} + +template +const dds::core::Duration TLatencyBudget::duration() const +{ + return this->delegate().duration(); +} + +//TTimeBasedFilter +template +TTimeBasedFilter::TTimeBasedFilter(const dds::core::Duration& minimum_separation) : dds::core::Value(minimum_separation) { } + +template +TTimeBasedFilter::TTimeBasedFilter(const TTimeBasedFilter& other) : dds::core::Value(other.delegate()) { } + +template +TTimeBasedFilter& TTimeBasedFilter::minimum_separation(const dds::core::Duration& minimum_separation) +{ + this->delegate().min_separation(minimum_separation); + return *this; +} + +template +const dds::core::Duration TTimeBasedFilter::minimum_separation() const +{ + return this->delegate().min_separation(); +} + +//TPartition + +template +TPartition::TPartition(const std::string& name) : dds::core::Value(name) +{ + +} + +template +TPartition::TPartition(const dds::core::StringSeq& names) : dds::core::Value(names) +{ + +} + +template +TPartition::TPartition(const TPartition& other) : dds::core::Value(other.delegate()) +{ + +} + +template +TPartition& +TPartition::name(const std::string& name) +{ + this->delegate().name(name); + return *this; +} + +template +TPartition& +TPartition::name(const dds::core::StringSeq& names) +{ + this->delegate().name(names); + return *this; +} + +template +const dds::core::StringSeq +TPartition::name() const +{ + return this->delegate().name(); +} + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + +//TOwnership + +template +TOwnership::TOwnership(dds::core::policy::OwnershipKind::Type kind) : dds::core::Value(kind) { } + +template +TOwnership::TOwnership(const TOwnership& other) : dds::core::Value(other.delegate()) { } + +template +TOwnership& TOwnership::kind(dds::core::policy::OwnershipKind::Type kind) +{ + this->delegate().kind(kind); + return *this; +} + +template +dds::core::policy::OwnershipKind::Type TOwnership::kind() const +{ + return this->delegate().kind(); +} + +template +TOwnership TOwnership::Exclusive() +{ + return TOwnership(dds::core::policy::OwnershipKind::EXCLUSIVE); +} + +template +TOwnership TOwnership::Shared() +{ + return TOwnership(dds::core::policy::OwnershipKind::SHARED); +} + +//TOwnershipStrength +template +TOwnershipStrength::TOwnershipStrength(int32_t strength) : dds::core::Value(strength) { } + +template +TOwnershipStrength::TOwnershipStrength(const TOwnershipStrength& other) : dds::core::Value(other.delegate()) { } + +template +int32_t TOwnershipStrength::value() const +{ + return this->delegate().strength(); +} + +template +TOwnershipStrength& TOwnershipStrength::value(int32_t strength) +{ + this->delegate().strength(strength); + return *this; +} + +#endif // OMG_DDS_OWNERSHIP_SUPPORT + +//TWriterDataLifeCycle +template +TWriterDataLifecycle::TWriterDataLifecycle(bool autodispose_unregistered_instances) : dds::core::Value(autodispose_unregistered_instances) { } + +template +TWriterDataLifecycle::TWriterDataLifecycle(const TWriterDataLifecycle& other) : dds::core::Value(other.delegate()) { } + +template +bool TWriterDataLifecycle::autodispose_unregistered_instances() const +{ + return this->delegate().autodispose(); +} + +template +TWriterDataLifecycle& TWriterDataLifecycle::autodispose_unregistered_instances(bool autodispose_unregistered_instances) +{ + this->delegate().autodispose(autodispose_unregistered_instances); + return *this; +} + +template +TWriterDataLifecycle TWriterDataLifecycle::AutoDisposeUnregisteredInstances() +{ + return TWriterDataLifecycle(true); +} + +template +TWriterDataLifecycle TWriterDataLifecycle::ManuallyDisposeUnregisteredInstances() +{ + return TWriterDataLifecycle(false); +} + +//TReaderDataLifecycle +template +TReaderDataLifecycle::TReaderDataLifecycle(const dds::core::Duration& autopurge_nowriter_samples_delay, const dds::core::Duration& autopurge_disposed_samples_delay) + : dds::core::Value(autopurge_nowriter_samples_delay, autopurge_disposed_samples_delay) { } + +template +TReaderDataLifecycle::TReaderDataLifecycle(const TReaderDataLifecycle& other) + : dds::core::Value(other.delegate()) { } + +template +const dds::core::Duration TReaderDataLifecycle::autopurge_nowriter_samples_delay() const +{ + return this->delegate().autopurge_nowriter_samples_delay(); +} + +template +TReaderDataLifecycle& TReaderDataLifecycle::autopurge_nowriter_samples_delay(const dds::core::Duration& autopurge_nowriter_samples_delay) +{ + this->delegate().autopurge_nowriter_samples_delay(autopurge_nowriter_samples_delay); + return *this; +} + +template +const dds::core::Duration TReaderDataLifecycle::autopurge_disposed_samples_delay() const +{ + return this->delegate().autopurge_disposed_samples_delay(); +} + +template +TReaderDataLifecycle& TReaderDataLifecycle::autopurge_disposed_samples_delay(const dds::core::Duration& autopurge_disposed_samples_delay) +{ + this->delegate().autopurge_disposed_samples_delay(autopurge_disposed_samples_delay); + return *this; +} + +template +TReaderDataLifecycle TReaderDataLifecycle::NoAutoPurgeDisposedSamples() +{ + return TReaderDataLifecycle(); +} + +template +TReaderDataLifecycle TReaderDataLifecycle::AutoPurgeDisposedSamples(const dds::core::Duration& autopurge_disposed_samples_delay) +{ + return TReaderDataLifecycle().autopurge_disposed_samples_delay(autopurge_disposed_samples_delay); +} + +//TDurability + +template +TDurability::TDurability(dds::core::policy::DurabilityKind::Type kind) : dds::core::Value(kind) { } + +template +TDurability::TDurability(const TDurability& other) : dds::core::Value(other.delegate()) { } + +template +TDurability& TDurability::kind(dds::core::policy::DurabilityKind::Type kind) +{ + this->delegate().kind(kind); + return *this; +} + +template +dds::core::policy::DurabilityKind::Type TDurability::kind() const +{ + return this->delegate().kind(); +} + +template +TDurability TDurability::Volatile() +{ + return TDurability(dds::core::policy::DurabilityKind::VOLATILE); +} + +template +TDurability TDurability::TransientLocal() +{ + return TDurability(dds::core::policy::DurabilityKind::TRANSIENT_LOCAL); +} + +template +TDurability TDurability::Transient() +{ + return TDurability(dds::core::policy::DurabilityKind::TRANSIENT); +} + +template +TDurability TDurability::Persistent() +{ + return TDurability(dds::core::policy::DurabilityKind::PERSISTENT); +} + +//TPresentation +template +TPresentation::TPresentation(dds::core::policy::PresentationAccessScopeKind::Type access_scope, bool coherent_access, bool ordered_access) + : dds::core::Value(access_scope, coherent_access, ordered_access) { } + +template +TPresentation::TPresentation(const TPresentation& other) + : dds::core::Value(other.delegate()) { } + +template +TPresentation& TPresentation::access_scope(dds::core::policy::PresentationAccessScopeKind::Type access_scope) +{ + this->delegate().access_scope(access_scope); + return *this; +} + +template +dds::core::policy::PresentationAccessScopeKind::Type TPresentation::access_scope() const +{ + return this->delegate().access_scope(); +} + +template +TPresentation& TPresentation::coherent_access(bool coherent_access) +{ + this->delegate().coherent_access(coherent_access); + return *this; +} + +template +bool TPresentation::coherent_access() const +{ + return this->delegate().coherent_access(); +} + +template +TPresentation& TPresentation::ordered_access(bool ordered_access) +{ + this->delegate().ordered_access(ordered_access); + return *this; +} + +template +bool TPresentation::ordered_access() const +{ + return this->delegate().ordered_access(); +} + +template +TPresentation TPresentation::GroupAccessScope(bool coherent_access, bool ordered_access) +{ + return TPresentation(dds::core::policy::PresentationAccessScopeKind::GROUP, coherent_access, ordered_access); +} + +template +TPresentation TPresentation::InstanceAccessScope(bool coherent_access, bool ordered_access) +{ + return TPresentation(dds::core::policy::PresentationAccessScopeKind::INSTANCE, coherent_access, ordered_access); +} + +template +TPresentation TPresentation::TopicAccessScope(bool coherent_access, bool ordered_access) +{ + return TPresentation(dds::core::policy::PresentationAccessScopeKind::TOPIC, coherent_access, ordered_access); +} + +//TReliability +template +TReliability::TReliability(dds::core::policy::ReliabilityKind::Type kind, const dds::core::Duration& max_blocking_time) + : dds::core::Value(kind, max_blocking_time) { } + +template +TReliability::TReliability(const TReliability& other) + : dds::core::Value(other.delegate()) { } + +template +TReliability& TReliability::kind(dds::core::policy::ReliabilityKind::Type kind) +{ + this->delegate().kind(kind); + return *this; +} + +template +dds::core::policy::ReliabilityKind::Type TReliability::kind() const +{ + return this->delegate().kind(); +} + +template +TReliability& TReliability::max_blocking_time(const dds::core::Duration& max_blocking_time) +{ + this->delegate().max_blocking_time(max_blocking_time); + return *this; +} + +template +const dds::core::Duration TReliability::max_blocking_time() const +{ + return this->delegate().max_blocking_time(); +} + +template +TReliability TReliability::Reliable(const dds::core::Duration& max_blocking_time) +{ + return TReliability(dds::core::policy::ReliabilityKind::RELIABLE, max_blocking_time); +} + +template +TReliability TReliability::BestEffort(const dds::core::Duration& max_blocking_time) +{ + return TReliability(dds::core::policy::ReliabilityKind::BEST_EFFORT, max_blocking_time); +} + +//TDestinationOrder + +template +TDestinationOrder::TDestinationOrder(dds::core::policy::DestinationOrderKind::Type kind) + : dds::core::Value(kind) { } + +template +TDestinationOrder::TDestinationOrder(const TDestinationOrder& other) : dds::core::Value(other.delegate()) { } + +template +TDestinationOrder& TDestinationOrder::kind(dds::core::policy::DestinationOrderKind::Type kind) +{ + this->delegate().kind(kind); + return *this; +} + +template +dds::core::policy::DestinationOrderKind::Type TDestinationOrder::kind() const +{ + return this->delegate().kind(); +} + +template +TDestinationOrder TDestinationOrder::SourceTimestamp() +{ + return TDestinationOrder(dds::core::policy::DestinationOrderKind::BY_SOURCE_TIMESTAMP); +} + +template +TDestinationOrder TDestinationOrder::ReceptionTimestamp() +{ + return TDestinationOrder(dds::core::policy::DestinationOrderKind::BY_RECEPTION_TIMESTAMP); +} + +//THistory +template +THistory::THistory(dds::core::policy::HistoryKind::Type kind, int32_t depth) + : dds::core::Value(kind, depth) { } + +template +THistory::THistory(const THistory& other) : dds::core::Value(other.delegate()) { } + +template +dds::core::policy::HistoryKind::Type THistory::kind() const +{ + return this->delegate().kind(); +} + +template +THistory& THistory::kind(dds::core::policy::HistoryKind::Type kind) +{ + this->delegate().kind(kind); + return *this; +} + +template +int32_t THistory::depth() const +{ + return this->delegate().depth(); +} + +template +THistory& THistory::depth(int32_t depth) +{ + this->delegate().depth(depth); + return *this; +} + +template +THistory THistory::KeepAll() +{ + return THistory(dds::core::policy::HistoryKind::KEEP_ALL, 1); +} + +template +THistory THistory::KeepLast(uint32_t depth) +{ + return THistory(dds::core::policy::HistoryKind::KEEP_LAST, + static_cast(depth)); +} + +//TResourceLimits +template +TResourceLimits::TResourceLimits(int32_t max_samples, int32_t max_instances, int32_t max_samples_per_instance) + : dds::core::Value(max_samples, max_instances, max_samples_per_instance) { } + +template +TResourceLimits::TResourceLimits(const TResourceLimits& other) + : dds::core::Value(other.delegate()) { } + +template +TResourceLimits& TResourceLimits::max_samples(int32_t max_samples) +{ + this->delegate().max_samples(max_samples); + return *this; +} + +template +int32_t TResourceLimits::max_samples() const +{ + return this->delegate().max_samples(); +} + +template +TResourceLimits& TResourceLimits::max_instances(int32_t max_instances) +{ + this->delegate().max_instances(max_instances); + return *this; +} + +template +int32_t TResourceLimits::max_instances() const +{ + return this->delegate().max_instances(); +} + +template +TResourceLimits& TResourceLimits::max_samples_per_instance(int32_t max_samples_per_instance) +{ + this->delegate().max_samples_per_instance(max_samples_per_instance); + return *this; +} + +template +int32_t TResourceLimits::max_samples_per_instance() const +{ + return this->delegate().max_samples_per_instance(); +} + +//TLiveliness +template +TLiveliness::TLiveliness(dds::core::policy::LivelinessKind::Type kind, const dds::core::Duration& lease_duration) + : dds::core::Value(kind, lease_duration) { } + +template +TLiveliness::TLiveliness(const TLiveliness& other) : dds::core::Value(other.delegate()) { } + +template +TLiveliness& TLiveliness::kind(dds::core::policy::LivelinessKind::Type kind) +{ + this->delegate().kind(kind); + return *this; +} + +template +dds::core::policy::LivelinessKind::Type TLiveliness::kind() const +{ + return this->delegate().kind(); +} + +template +TLiveliness& TLiveliness::lease_duration(const dds::core::Duration& lease_duration) +{ + this->delegate().lease_duration(lease_duration); + return *this; +} + +template +const dds::core::Duration TLiveliness::lease_duration() const +{ + return this->delegate().lease_duration(); +} + +template +TLiveliness TLiveliness::Automatic(const dds::core::Duration& lease_duration) +{ + return TLiveliness(dds::core::policy::LivelinessKind::AUTOMATIC, lease_duration); +} + +template +TLiveliness TLiveliness::ManualByParticipant(const dds::core::Duration& lease_duration) +{ + return TLiveliness(dds::core::policy::LivelinessKind::MANUAL_BY_PARTICIPANT, lease_duration); +} + +template +TLiveliness TLiveliness::ManualByTopic(const dds::core::Duration& lease_duration) +{ + return TLiveliness(dds::core::policy::LivelinessKind::MANUAL_BY_TOPIC, lease_duration); +} + + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + +//TDurabilityService + +template +TDurabilityService::TDurabilityService( + const dds::core::Duration& service_cleanup_delay, + dds::core::policy::HistoryKind::Type history_kind, + int32_t history_depth, + int32_t max_samples, + int32_t max_instances, + int32_t max_samples_per_instance) + : dds::core::Value(service_cleanup_delay, + history_kind, + history_depth, + max_samples, + max_instances, + max_samples_per_instance) { } + +template +TDurabilityService::TDurabilityService(const TDurabilityService& other) + : dds::core::Value(other.delegate()) { } + +template +TDurabilityService& TDurabilityService::service_cleanup_delay(const dds::core::Duration& service_cleanup_delay) +{ + this->delegate().service_cleanup_delay(service_cleanup_delay); + return *this; +} + +template +const dds::core::Duration TDurabilityService::service_cleanup_delay() const +{ + return this->delegate().service_cleanup_delay(); +} + +template +TDurabilityService& TDurabilityService::history_kind(dds::core::policy::HistoryKind::Type kind) +{ + this->delegate().history_kind(kind); + return *this; +} + +template +dds::core::policy::HistoryKind::Type TDurabilityService::history_kind() const +{ + return this->delegate().history_kind(); +} + +template +TDurabilityService& TDurabilityService::history_depth(int32_t history_depth) +{ + this->delegate().history_depth(history_depth); + return *this; +} + +template +int32_t TDurabilityService::history_depth() const +{ + return this->delegate().history_depth(); +} + +template +TDurabilityService& TDurabilityService::max_samples(int32_t max_samples) +{ + this->delegate().max_samples(max_samples); + return *this; +} + +template +int32_t TDurabilityService::max_samples() const +{ + return this->delegate().max_samples(); +} + +template +TDurabilityService& TDurabilityService::max_instances(int32_t max_instances) +{ + this->delegate().max_instances(max_instances); + return *this; +} + +template +int32_t TDurabilityService::max_instances() const +{ + return this->delegate().max_instances(); +} + +template +TDurabilityService& TDurabilityService::max_samples_per_instance(int32_t max_samples_per_instance) +{ + this->delegate().max_samples_per_instance(max_samples_per_instance); + return *this; +} + +template +int32_t TDurabilityService::max_samples_per_instance() const +{ + return this->delegate().max_samples_per_instance(); +} + +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +//TDataRepresentation + +template +TDataRepresentation::TDataRepresentation(const dds::core::policy::DataRepresentationIdSeq& value) : dds::core::Value(value) { } + +template +TDataRepresentation::TDataRepresentation(const TDataRepresentation& other) : dds::core::Value(other.delegate()) { } + +template +const dds::core::policy::DataRepresentationIdSeq& TDataRepresentation::value() const +{ + return this->delegate().value(); +} + +template +TDataRepresentation& TDataRepresentation::value(const dds::core::policy::DataRepresentationIdSeq &value) +{ + this->delegate().value(value); + return *this; +} + +#endif // defined(OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT) + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +//TTypeConsistencyEnforcement + +template +TTypeConsistencyEnforcement::TTypeConsistencyEnforcement( + dds::core::policy::TypeConsistencyKind::Type kind, + bool ignore_sequence_bounds, + bool ignore_string_bounds, + bool ignore_member_names, + bool prevent_type_widening, + bool force_type_validation) : dds::core::Value(kind, ignore_sequence_bounds, ignore_string_bounds, ignore_member_names, prevent_type_widening, force_type_validation) { } + +template +TTypeConsistencyEnforcement::TTypeConsistencyEnforcement(const TTypeConsistencyEnforcement& other) : dds::core::Value(other.delegate()) { } + +template +TTypeConsistencyEnforcement& TTypeConsistencyEnforcement::kind(dds::core::policy::TypeConsistencyKind::Type kind) +{ + this->delegate().kind(kind); + return *this; +} + +template +dds::core::policy::TypeConsistencyKind::Type TTypeConsistencyEnforcement::kind() const +{ + return this->delegate().kind(); +} + +template +TTypeConsistencyEnforcement& TTypeConsistencyEnforcement::ignore_sequence_bounds(bool ignore_sequence_bounds) +{ + this->delegate().ignore_sequence_bounds(ignore_sequence_bounds); + return *this; +} + +template +bool TTypeConsistencyEnforcement::ignore_sequence_bounds() const +{ + return this->delegate().ignore_sequence_bounds(); +} + +template +TTypeConsistencyEnforcement& TTypeConsistencyEnforcement::ignore_string_bounds(bool ignore_string_bounds) +{ + this->delegate().ignore_string_bounds(ignore_string_bounds); + return *this; +} + +template +bool TTypeConsistencyEnforcement::ignore_string_bounds() const +{ + return this->delegate().ignore_string_bounds(); +} + +template +TTypeConsistencyEnforcement& TTypeConsistencyEnforcement::ignore_member_names(bool ignore_member_names) +{ + this->delegate().ignore_member_names(ignore_member_names); + return *this; +} + +template +bool TTypeConsistencyEnforcement::ignore_member_names() const +{ + return this->delegate().ignore_member_names(); +} + +template +TTypeConsistencyEnforcement& TTypeConsistencyEnforcement::prevent_type_widening(bool prevent_type_widening) +{ + this->delegate().prevent_type_widening(prevent_type_widening); + return *this; +} + +template +bool TTypeConsistencyEnforcement::prevent_type_widening() const +{ + return this->delegate().prevent_type_widening(); +} + +template +TTypeConsistencyEnforcement& TTypeConsistencyEnforcement::force_type_validation(bool force_type_validation) +{ + this->delegate().force_type_validation(force_type_validation); + return *this; +} + +template +bool TTypeConsistencyEnforcement::force_type_validation() const +{ + return this->delegate().force_type_validation(); +} + +#endif // defined(OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT) + +} +} +} + +// End of implementation +// OMG PSM class declaration + +#endif /* CYCLONEDDS_DDS_CORE_POLICY_TCOREPOLICY_IMPL_HPP_ */ +// OMG PSM class declaration diff --git a/unitree_SDK/include/ddscxx/dds/core/policy/detail/TQosPolicyCountImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/policy/detail/TQosPolicyCountImpl.hpp new file mode 100644 index 0000000..cfad737 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/policy/detail/TQosPolicyCountImpl.hpp @@ -0,0 +1,65 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_POLICY_TQOSPOLICYCOUNT_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_POLICY_TQOSPOLICYCOUNT_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace core +{ +namespace policy +{ + +template +TQosPolicyCount::TQosPolicyCount(QosPolicyId policy_id, int32_t count) : dds::core::Value(policy_id, count) { } + +#if defined(__GNUC__) && (__GNUC__ >= 10) +_Pragma("GCC diagnostic push") +_Pragma("GCC diagnostic ignored \"-Wanalyzer-null-dereference\"") +#endif + +template +TQosPolicyCount::TQosPolicyCount(const TQosPolicyCount& other) : dds::core::Value(other.policy_id(), other.count()) { } + +#if defined(__GNUC__) && (__GNUC__ >= 10) +_Pragma("GCC diagnostic pop") +#endif + +template QosPolicyId TQosPolicyCount::policy_id() const +{ + return this->delegate().policy_id(); +} + +template +int32_t TQosPolicyCount::count() const +{ + return this->delegate().count(); +} + +} +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_POLICY_TQOSPOLICYCOUNT_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/ref_traits.hpp b/unitree_SDK/include/ddscxx/dds/core/ref_traits.hpp new file mode 100644 index 0000000..104186a --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/ref_traits.hpp @@ -0,0 +1,55 @@ +#ifndef OMG_DDS_CORE_REF_TRAITS_H_ +#define OMG_DDS_CORE_REF_TRAITS_H_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +namespace dds +{ +namespace core +{ + +/** @cond + * These traits must be provided by compliant implementations + * to enable safe polymorphic casts. + */ + +template +struct is_base_of; + +template +struct is_same; + +template +struct smart_ptr_traits; + +template +TO polymorphic_cast(FROM& from); + +/** @endcond */ + +} +} /* namespace dds / namespace core */ + + +// This include should stay here as it provides implementations +// for the declaration immediately above. +#include + +#endif /* OMG_DDS_CORE_REF_TRAITS_H_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/refmacros.hpp b/unitree_SDK/include/ddscxx/dds/core/refmacros.hpp new file mode 100644 index 0000000..babaaf3 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/refmacros.hpp @@ -0,0 +1,190 @@ +#ifndef OMG_DDS_CORE_REFMACROS_HPP_ +#define OMG_DDS_CORE_REFMACROS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +//////////////////////////////////////////////////////////////////////////////// +// Macros +//////////////////////////////////////////////////////////////////////////////// + +#define DECLARE_TYPE_TRAITS(TYPE) \ + typedef TYPE TYPE##_T;\ + typedef typename ::dds::core::smart_ptr_traits::ref_type TYPE##_REF_T;\ + typedef typename ::dds::core::smart_ptr_traits::weak_ref_type TYPE##_WEAK_REF_T; + + +/* + * This macro defines all the functions that Reference Types have to implement. + */ +/* + * + * + */ +//////////////////////////////////////////////////////////////////////////////// +// Defines all the types, functions and attributes required for a Reference type +// without default ctor. +// + +#define OMG_DDS_REF_TYPE_BASE(TYPE, BASE, DELEGATE) \ + public: \ + typedef typename ::dds::core::smart_ptr_traits< DELEGATE >::ref_type DELEGATE_REF_T; \ + typedef typename ::dds::core::smart_ptr_traits< DELEGATE >::weak_ref_type DELEGATE_WEAK_REF_T; \ + \ + private:\ + const typename ::dds::core::Reference< DELEGATE >::DELEGATE_REF_T& impl() const \ + { return ::dds::core::Reference< DELEGATE >::impl_; }\ + typename ::dds::core::Reference< DELEGATE >::DELEGATE_REF_T& impl() \ + { return ::dds::core::Reference< DELEGATE >::impl_; }\ + \ + public: \ + typedef BASE< DELEGATE > BASE_T;\ + \ + public: \ + TYPE(const dds::core::null_type&) : dds::core::Reference< DELEGATE >(static_cast(NULL)) { } \ + \ + TYPE& operator=(const dds::core::null_type& rhs) {\ + (void)rhs; \ + *this = TYPE(dds::core::null); \ + return *this; \ + } \ + \ + public:\ + TYPE(const DELEGATE_REF_T& ref) \ + : dds::core::Reference< DELEGATE >(ref)\ + { } + +#define OMG_DDS_IMPLICIT_REF_BASE(TYPE) \ + public:\ + template \ + TYPE(const H__& h) \ + { \ + if (h.is_nil()) { \ + /* We got a null object and are not really able to do a typecheck here. */ \ + /* So, just set a null object. */ \ + *this = dds::core::null; \ + } else { \ + this->::dds::core::Reference< DELEGATE_T >::impl_ = ::std::dynamic_pointer_cast< DELEGATE_T >(h.delegate()); \ + if (h.delegate() != this->::dds::core::Reference< DELEGATE_T >::impl_) { \ + throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name()); \ + } \ + } \ + }\ + \ + template \ + TYPE& \ + operator=(const T__& rhs) { \ + const TYPE &t = rhs; \ + if (this != &t) { \ + if (rhs.is_nil()) { \ + /* We got a null object and are not really able to do a typecheck here. */ \ + /* So, just set a null object. */ \ + *this = dds::core::null; \ + } else { \ + TYPE other(rhs); \ + /* Dont have to copy when the delegate impl is the same. */ \ + if (other.delegate() != this->::dds::core::Reference< DELEGATE_T >::impl_) { \ + *this = other; \ + } \ + } \ + } \ + return *this; \ + } + +#define OMG_DDS_EXPLICIT_REF_BASE_DECL(TYPE, FROM) \ + public:\ + TYPE(const FROM& h); \ + \ + TYPE& \ + operator=(const FROM& rhs); + +#define OMG_DDS_EXPLICIT_REF_BASE(TYPE, FROM) \ + public:\ + /* We need to support both const and non-const conversion explicitly, because it could */ \ + /* be that the class has a constructor that takes a single non-const template argument. */ \ + /* That non-const templated constructor is a closer match than TYPE(const FROM& h); when */ \ + /* creating the TYPE class from a non-const FROM object. */ \ + TYPE(FROM& h) { this->explicit_conversion(const_cast(h)); } \ + TYPE(const FROM& h) { this->explicit_conversion(h); } \ + private:\ + void explicit_conversion(const FROM& h) \ + { \ + if (h.is_nil()) { \ + /* We got a null object and are not really able to do a typecheck here. */ \ + /* So, just set a null object. */ \ + *this = dds::core::null; \ + } else { \ + this->::dds::core::Reference::impl_ = ::std::dynamic_pointer_cast(h.delegate()); \ + if (h.delegate() != this->::dds::core::Reference< DELEGATE_T >::impl_) { \ + throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name()); \ + } \ + } \ + }\ + \ + public:\ + TYPE& \ + operator=(const FROM& rhs) { \ + const TYPE &t = rhs; \ + if (this != &t) { \ + if (rhs.is_nil()) { \ + /* We got a null object and are not really able to do a typecheck here. */ \ + /* So, just set a null object. */ \ + *this = dds::core::null; \ + } else { \ + TYPE other(rhs); \ + /* Dont have to copy when the delegate is the same. */ \ + if (other.delegate() != this->::dds::core::Reference< DELEGATE_T >::impl_) { \ + *this = other; \ + } \ + } \ + } \ + return *this; \ + } + + +//////////////////////////////////////////////////////////////////////////////// +// Declares a reference type equipped with a default ctor. +// +#define OMG_DDS_REF_TYPE_PROTECTED_DC(TYPE, BASE, DELEGATE) \ +public: \ + typedef DELEGATE DELEGATE_T; \ + OMG_DDS_REF_TYPE_BASE(TYPE, BASE, DELEGATE_T) \ +protected: \ + TYPE() { } + +#define OMG_DDS_REF_TYPE_PROTECTED_DC_T(TYPE, BASE, T_PARAM, DELEGATE) \ +public: \ + typedef DELEGATE DELEGATE_T; \ + OMG_DDS_REF_TYPE_BASE(TYPE, BASE, DELEGATE_T) \ + protected: \ + TYPE() { } + +#define OMG_DDS_REF_TYPE_NO_DC(TYPE, BASE, DELEGATE) \ +public: \ + typedef DELEGATE DELEGATE_T; \ + OMG_DDS_REF_TYPE_BASE(TYPE, BASE, DELEGATE_T) + +#define OMG_DDS_REF_TYPE_DELEGATE_C(TYPE, BASE, DELEGATE) \ + OMG_DDS_REF_TYPE_PROTECTED_DC(TYPE, BASE, DELEGATE) \ + public: \ + TYPE(DELEGATE_T *impl) : dds::core::Reference< DELEGATE_T >(impl) { } + +#endif /* OMG_DDS_CORE_REFMACROS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/status/State.hpp b/unitree_SDK/include/ddscxx/dds/core/status/State.hpp new file mode 100644 index 0000000..5f7d583 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/status/State.hpp @@ -0,0 +1,376 @@ +#ifndef OMG_DDS_CORE_STATUS_STATE_HPP_ +#define OMG_DDS_CORE_STATUS_STATE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + + +namespace dds +{ +namespace core +{ +namespace status +{ + +/** + * @brief + * Class to contain the statistics about samples that have been rejected. + * + * @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo" + */ +class OMG_DDS_API SampleRejectedState : public std::bitset +{ +public: + /** + * Convenience typedef for std::bitset. + */ + typedef std::bitset MaskType; + +public: + /** + * Construct an empty SampleRejectedState. + */ + SampleRejectedState(); + + /** + * Copy constructor. + * + * Construct an SampleRejectedState with existing SampleRejectedState. + * + * @param src the SampleRejectedState to copy from + */ + SampleRejectedState(const SampleRejectedState& src); + + /** + * Construct a SampleRejectedState with existing MaskType. + * + * @param src the MaskType to copy from + */ + SampleRejectedState(const MaskType& src); + + /** + * Copy assignment operator. + * + * Copies the data from src to the current instance. + * + * @param src the SampleRejectedState to copy from + * + * @return reference to the SampleRejectedState that was copied to + */ + SampleRejectedState& operator=(const SampleRejectedState&) = default; +public: + /** + * Get the NOT_REJECTED. + * + *not_rejected + * - No sample has been rejected yet. + * + * @return the not_rejected SampleRejectedState + */ + inline static SampleRejectedState not_rejected() + { + return SampleRejectedState(0u); + } + + /** + * Get the REJECTED_BY_SAMPLES_LIMIT. + * + *rejected_by_samples_limit + * - The sample was rejected because it would + * exceed the maximum number of samples set by the ResourceLimits + * QosPolicy. + * + * @return the rejected_by_samples_limit SampleRejectedState + */ + inline static SampleRejectedState rejected_by_samples_limit() + { + return SampleRejectedState(0x0001 << 1u); + } + + /** + * Get the REJECTED_BY_INSTANCES_LIMIT. + * + *rejected_by_instances_limit + * - The sample was rejected because it would + * exceed the maximum number of instances set by the + * ResourceLimits QosPolicy. + * + * @return the rejected_by_instances_limit SampleRejectedState + */ + inline static SampleRejectedState rejected_by_instances_limit() + { + return SampleRejectedState(0x0001 << 0u); + } + + /** + * Get the REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT. + * + *rejected_by_samples_per_instance_limit + * - The sample was rejected + * because it would exceed the maximum number of samples per + * instance set by the ResourceLimits QosPolicy. + * + * @return the rejected_by_samples_per_instance_limit SampleRejectedState + */ + inline static SampleRejectedState rejected_by_samples_per_instance_limit() + { + return SampleRejectedState(0x0001 << 2u); + } + +private: + SampleRejectedState(uint32_t s); +}; + +/** + * @brief + * StatusMask is a bitmap or bitset field. + * + * This bitset is used to: + * - determine which listener functions to call + * - set conditions in dds::core::cond::StatusCondition + * - indicate status changes when calling dds::core::Entity::status_changes + * + * @see for more information: @ref DCPS_Modules_Infrastructure_Status "Status concept" + */ +class OMG_DDS_API StatusMask : public std::bitset +{ +public: + /** + * Convenience typedef for std::bitset. + */ + typedef std::bitset MaskType; + +public: + /** + * Construct an StatusMask with no flags set. + */ + StatusMask(); + + /** + * Construct an StatusMask with an uint32_t bit mask. + * + * @param mask the bit array to initialize the bitset with + */ + explicit StatusMask(uint32_t mask); + + /** + * Copy constructor. + * + * Construct an StatusMask with existing StatusMask. + * + * @param other the StatusMask to copy from + */ + StatusMask(const StatusMask& other); + + /** + * Copy assignment operator. + * + * Copies the contents from one StatusMask to another. + * + * @param other the StatusMask to copy from + * + * @return reference to the StatusMask that was copied to + */ + StatusMask& operator=(const StatusMask& other) = default; + + /** @cond */ + ~StatusMask(); + /** @endcond */ + +public: + /** + * Shift (merge) given StatusMask bits into this StatusMask bitset. + * + * @return StatusMask this + */ + inline StatusMask& operator << (const dds::core::status::StatusMask& mask) + { + *this |= mask; + return *this; + } + + inline StatusMask operator | (const dds::core::status::StatusMask& mask) const + { + auto res = StatusMask(*this); + res |= mask; + return res; + } + + /** + * Get all StatusMasks + * + * @return StatusMask all + */ + inline static StatusMask all() + { + return StatusMask(0x80007fe7u); + } + + /** + * Get no StatusMasks + * + * @return StatusMask none + */ + inline static StatusMask none() + { + return StatusMask(0u); + } + +public: + /** + * Get the StatusMask associated with dds::core::status::InconsistentTopicStatus + * + * @return StatusMask inconsistent_topic + */ + inline static StatusMask inconsistent_topic() + { + return StatusMask(0x00000001 << 0u); + } + + /** + * Get the StatusMask associated with dds::core::status::OfferedDeadlineMissedStatus + * + * @return StatusMask offered_deadline_missed + */ + inline static StatusMask offered_deadline_missed() + { + return StatusMask(0x00000001 << 1u); + } + + /** + * Get the StatusMask associated with dds::core::status::RequestedDeadlineMissedStatus + * + * @return StatusMask requested_deadline_missed + */ + inline static StatusMask requested_deadline_missed() + { + return StatusMask(0x00000001 << 2u); + } + + /** + * Get the StatusMask associated with dds::core::status::OfferedIncompatibleQosStatus + * + * @return StatusMask offered_incompatible_qos + */ + inline static StatusMask offered_incompatible_qos() + { + return StatusMask(0x00000001 << 5u); + } + + /** + * Get the StatusMask associated with dds::core::status::RequestedIncompatibleQosStatus + * + * @return StatusMask requested_incompatible_qos + */ + inline static StatusMask requested_incompatible_qos() + { + return StatusMask(0x00000001 << 6u); + } + + /** + * Get the StatusMask associated with dds::core::status::SampleLostStatus + * + * @return StatusMask sample_lost + */ + inline static StatusMask sample_lost() + { + return StatusMask(0x00000001 << 7u); + } + + /** + * Get the StatusMask associated with dds::core::status::SampleRejectedStatus + * + * @return StatusMask sample_rejected + */ + inline static StatusMask sample_rejected() + { + return StatusMask(0x00000001 << 8u); + } + + /** + * Get the StatusMask associated with dds::core::status::data_on_readers + * + * @return StatusMask data_on_readers + */ + inline static StatusMask data_on_readers() + { + return StatusMask(0x00000001 << 9u); + } + + /** + * get the statusmask associated with dds::core::status::data_available + * + * @return statusmask data_available + */ + inline static StatusMask data_available() + { + return StatusMask(0x00000001 << 10u); + } + + /** + * Get the StatusMask associated with dds::core::status::LivelinessLostStatus + * + * @return StatusMask liveliness_lost + */ + inline static StatusMask liveliness_lost() + { + return StatusMask(0x00000001 << 11u); + } + + /** + * Get the StatusMask associated with dds::core::status::LivelinessChangedStatus + * + * @return StatusMask liveliness_changed + */ + inline static StatusMask liveliness_changed() + { + return StatusMask(0x00000001 << 12u); + } + + /** + * Get the statusmask associated with dds::core::status::PublicationMatchedStatus + * + * @return StatusMask publication_matched + */ + inline static StatusMask publication_matched() + { + return StatusMask(0x00000001 << 13u); + } + + /** + * Get the statusmask associated with dds::core::status::SubscriptionMatchedStatus + * + * @return StatusMask subscription_matched + */ + inline static StatusMask subscription_matched() + { + return StatusMask(0x00000001 << 14u); + } + +}; + +} +} +} /* namespace dds / core / status*/ + + +#endif /* OMG_DDS_CORE_STATUS_STATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/status/Status.hpp b/unitree_SDK/include/ddscxx/dds/core/status/Status.hpp new file mode 100644 index 0000000..001e23d --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/status/Status.hpp @@ -0,0 +1,87 @@ +#ifndef OMG_DDS_CORE_STATUS_STATUS_HPP_ +#define OMG_DDS_CORE_STATUS_STATUS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds +{ +namespace core +{ +namespace status +{ + +class DataAvailableStatus +{ + // empty +}; + + +class DataOnReadersStatus +{ + // empty +}; + +// This trait is used to get the state associated with each status +template +StatusMask get_status(); + +typedef ::dds::core::status::detail::InconsistentTopicStatus +InconsistentTopicStatus; + +typedef ::dds::core::status::detail::LivelinessChangedStatus +LivelinessChangedStatus; + +typedef ::dds::core::status::detail::LivelinessLostStatus +LivelinessLostStatus; + +typedef ::dds::core::status::detail::OfferedDeadlineMissedStatus +OfferedDeadlineMissedStatus; + +typedef ::dds::core::status::detail::OfferedIncompatibleQosStatus +OfferedIncompatibleQosStatus; + +typedef ::dds::core::status::detail::PublicationMatchedStatus +PublicationMatchedStatus; + +class SampleRejectedState; + +typedef ::dds::core::status::detail::SampleRejectedStatus +SampleRejectedStatus; + +typedef ::dds::core::status::detail::RequestedDeadlineMissedStatus +RequestedDeadlineMissedStatus; + +typedef ::dds::core::status::detail::RequestedIncompatibleQosStatus +RequestedIncompatibleQosStatus; + +typedef ::dds::core::status::detail::SampleLostStatus +SampleLostStatus; + +class StatusMask; + +typedef ::dds::core::status::detail::SubscriptionMatchedStatus +SubscriptionMatchedStatus; +} +} +} + +#endif /* OMG_DDS_CORE_STATUS_STATUS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/status/TStatus.hpp b/unitree_SDK/include/ddscxx/dds/core/status/TStatus.hpp new file mode 100644 index 0000000..e993c29 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/status/TStatus.hpp @@ -0,0 +1,442 @@ +#ifndef OMG_TDDS_CORE_STATUS_STATUS_HPP_ +#define OMG_TDDS_CORE_STATUS_STATUS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include +#include + +namespace dds +{ +namespace core +{ +namespace status +{ + +/** + * \copydoc DCPS_Status_InconsistentTopic + */ +template +class TInconsistentTopicStatus : public dds::core::Value +{ +public: + TInconsistentTopicStatus(); + +public: + /** + * @return Total cumulative count of all inconsistent topics detected. + */ + int32_t total_count() const; + + /** + * @return The incremental number of inconsistent topics since the last time + * the listener was called or the status was read. + */ + int32_t total_count_change() const; +}; + +/** + * \copydoc DCPS_Status_SampleLost + */ +template +class TSampleLostStatus : public dds::core::Value +{ +public: + TSampleLostStatus(); + +public: + /** + * @return Total cumulative count of all samples lost across of instances of data + * published under the Topic. + */ + int32_t total_count() const; + + /** + * @return The incremental number of samples lost since the last time the listener + * was called or the status was read. + */ + int32_t total_count_change() const; +}; + + +/** + * \copydoc DCPS_Status_SampleRejected + */ +template +class TSampleRejectedStatus : public dds::core::Value +{ +public: + TSampleRejectedStatus(); + +public: + /** + * @return Total cumulative count of samples rejected by the DataReader. + */ + int32_t total_count() const; + + /** + * @return The incremental number of samples rejected since the last time the + * listener was called or the status was read. + */ + int32_t total_count_change() const; + + /** + * @return Reason for rejecting the last sample rejected. If no samples have been + * rejected, the reason is the special value NOT_REJECTED. + */ + const dds::core::status::SampleRejectedState last_reason() const; + + /** + * @return Handle to the instance being updated by the last sample that was + * rejected. + */ + const dds::core::InstanceHandle last_instance_handle() const; +}; + +/** + * \copydoc DCPS_Status_LivelinessLost + */ +template +class TLivelinessLostStatus : public dds::core::Value +{ +public: + TLivelinessLostStatus(); + +public: + /** + * @return Total cumulative number of times that a previously-alive DataWriter + * became 'not alive' due to a failure to actively signal its liveliness within + * its offered liveliness period. This count does not change when an + * already not alive DataWriter simply remains not alive for another + * liveliness period. + */ + int32_t total_count() const; + + /** + * @return The change in total_count since the last time the listener was called or + * the status was read. + */ + int32_t total_count_change() const; +}; + +/** + * \copydoc DCPS_Status_LivelinessChanged + */ +template +class TLivelinessChangedStatus : public dds::core::Value +{ +public: + TLivelinessChangedStatus(); + +public: + /** + * @return The total number of currently active DataWriters that write the Topic + * read by the DataReader. This count increases when a newly-matched + * DataWriter asserts its liveliness for the first time or when a DataWriter + * previously considered to be not alive reasserts its liveliness. The count + * decreases when a DataWriter considered alive fails to assert its + * liveliness and becomes not alive, whether because it was deleted + * normally or for some other reason. + */ + int32_t alive_count() const; + + /** + * @return The total count of currently DataWriters that write the Topic read by + * the DataReader that are no longer asserting their liveliness. This count + * increases when a DataWriter considered alive fails to assert its + * liveliness and becomes not alive for some reason other than the normal + * deletion of that DataWriter. It decreases when a previously not alive + * DataWriter either reasserts its liveliness or is deleted normally. + */ + int32_t not_alive_count() const; + + /** + * @return The change in the alive_count since the last time the listener was + * called or the status was read. + */ + int32_t alive_count_change() const; + + /** + * @return The change in the not_alive_count since the last time the listener was + * called or the status was read. + */ + int32_t not_alive_count_change() const; + + /** + * @return Handle to the last DataWriter whose change in liveliness caused this + * status to change. + */ + const dds::core::InstanceHandle last_publication_handle() const; +}; + +/** + * \copydoc DCPS_Status_OfferedDeadlineMissed + */ +template +class TOfferedDeadlineMissedStatus : public dds::core::Value +{ +public: + TOfferedDeadlineMissedStatus(); + +public: + /** + * @return Total cumulative number of offered deadline periods elapsed during + * which a DataWriter failed to provide data. Missed deadlines + * accumulate; that is, each deadline period the total_count will be + * incremented by one. + */ + int32_t total_count() const; + + /** + * @return The change in total_count since the last time the listener was called or + * the status was read. + */ + int32_t total_count_change() const; + + /** + * @return Handle to the last instance in the DataWriter for which an offered + * deadline was missed. + */ + const dds::core::InstanceHandle last_instance_handle() const; +}; + +/** + * \copydoc DCPS_Status_RequestedDeadlineMissed + */ +template +class TRequestedDeadlineMissedStatus : public dds::core::Value +{ +public: + TRequestedDeadlineMissedStatus(); +public: + + /** + * @return Total cumulative number of missed deadlines detected for any instance + * read by the DataReader. Missed deadlines accumulate; that is, each + * deadline period the total_count will be incremented by one for each + * instance for which data was not received. + */ + int32_t total_count() const; + + /** + * @return The incremental number of deadlines detected since the last time the + * listener was called or the status was read. + */ + int32_t total_count_change() const; + + /** + * @return Handle to the last instance in the DataReader for which a deadline was + * detected. + */ + const dds::core::InstanceHandle last_instance_handle() const; +}; + + +/** + * \copydoc DCPS_Status_OfferedIncompatibleQoS + */ +template +class TOfferedIncompatibleQosStatus : public dds::core::Value +{ +public: + TOfferedIncompatibleQosStatus(); + +public: + /** + * @return Total cumulative number of times the concerned DataWriter + * discovered a DataReader for the same Topic with a requested QoS that + * is incompatible with that offered by the DataWriter. + */ + int32_t total_count() const; + + /** + * @return The change in total_count since the last time the listener was called or + * the status was read. + */ + int32_t total_count_change() const; + + /** + * @return The PolicyId of one of the policies that was found to be + * incompatible the last time an incompatibility was detected. + */ + dds::core::policy::QosPolicyId last_policy_id() const; + + /** + * @return A list containing for each policy the total number of times that the + * concerned DataWriter discovered a DataReader for the same Topic + * with a requested QoS that is incompatible with that offered by the + * DataWriter. + */ + const dds::core::policy::QosPolicyCountSeq policies() const; + + /** + * @return A list containing for each policy the total number of times that the + * concerned DataWriter discovered a DataReader for the same Topic + * with a requested QoS that is incompatible with that offered by the + * DataWriter. + * + * @param dst The destination QosPolicyCountSeq the policies will be returned to + */ + const dds::core::policy::QosPolicyCountSeq& + policies(dds::core::policy::QosPolicyCountSeq& dst) const; +}; + +/** + * \copydoc DCPS_Status_RequestedIncompatibleQoS + */ +template +class TRequestedIncompatibleQosStatus : public dds::core::Value +{ +public: + TRequestedIncompatibleQosStatus(); + +public: + /** + * @return Total cumulative number of times the concerned DataReader + * discovered a DataWriter for the same Topic with an offered QoS that + * was incompatible with that requested by the DataReader. + */ + int32_t total_count() const; + + /** + * @return The change in total_count since the last time the listener was called or + * the status was read. + */ + int32_t total_count_change() const; + + /** + * @return The QosPolicyId of one of the policies that was found to be + * incompatible the last time an incompatibility was detected. + */ + dds::core::policy::QosPolicyId last_policy_id() const; + + /** + * @return A list containing for each policy the total number of times that the + * concerned DataReader discovered a DataWriter for the same Topic + * with an offered QoS that is incompatible with that requested by the + * DataReader. + */ + const dds::core::policy::QosPolicyCountSeq policies() const; + + /** + * @return A list containing for each policy the total number of times that the + * concerned DataReader discovered a DataWriter for the same Topic + * with an offered QoS that is incompatible with that requested by the + * DataReader. + * + * @param dst The destination QosPolicyCountSeq the policies will be returned to + */ + const dds::core::policy::QosPolicyCountSeq& + policies(dds::core::policy::QosPolicyCountSeq& dst) const; +}; + +/** + * \copydoc DCPS_Status_PublicationMatched + */ +template +class TPublicationMatchedStatus : public dds::core::Value +{ +public: + TPublicationMatchedStatus(); + +public: + /** + * @return Total cumulative count the concerned DataWriter discovered a + * "match" with a DataReader. That is, it found a DataReader for the + * same Topic with a requested QoS that is compatible with that offered + * by the DataWriter. + */ + int32_t total_count() const; + + /** + * @return The change in total_count since the last time the listener was called or + * the status was read. + */ + int32_t total_count_change() const; + + /** + * @return The number of DataReaders currently matched to the concerned + * DataWriter. + */ + int32_t current_count() const; + + /** + * @return The change in current_count since the last time the listener was called + * or the status was read. + */ + int32_t current_count_change() const; + + /** + * @return Handle to the last DataReader that matched the DataWriter causing the + * status to change. + */ + const dds::core::InstanceHandle last_subscription_handle() const; +}; + +/** + * \copydoc DCPS_Status_SubscriptionMatched + */ +template +class TSubscriptionMatchedStatus : public dds::core::Value +{ +public: + TSubscriptionMatchedStatus(); + +public: + /** + * @return Total cumulative count the concerned DataReader discovered a + * "match" with a DataWriter. That is, it found a DataWriter for the same + * Topic with a requested QoS that is compatible with that offered by the + * DataReader. + */ + int32_t total_count() const; + + /** + * @return The change in total_count since the last time the listener was called or + * the status was read. + */ + int32_t total_count_change() const; + + /** + * @return The number of DataWriters currently matched to the concerned + * DataReader. + */ + int32_t current_count() const; + + /** + * @return The change in current_count since the last time the listener was called + * or the status was read. + */ + int32_t current_count_change() const; + + /** + * @return Handle to the last DataWriter that matched the DataReader causing the + * status to change. + */ + const dds::core::InstanceHandle last_publication_handle() const; +}; + +} +} +}/* namespace dds::core::status */ + +#endif /* OMG_TDDS_CORE_STATUS_STATUS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/status/detail/Status.hpp b/unitree_SDK/include/ddscxx/dds/core/status/detail/Status.hpp new file mode 100644 index 0000000..937151c --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/status/detail/Status.hpp @@ -0,0 +1,62 @@ +#ifndef OMG_DDS_CORE_STATUS_DETAIL_STATUS_HPP_ +#define OMG_DDS_CORE_STATUS_DETAIL_STATUS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + + +namespace dds { namespace core { namespace status { namespace detail { + typedef dds::core::status::TInconsistentTopicStatus< org::eclipse::cyclonedds::core::InconsistentTopicStatusDelegate > + InconsistentTopicStatus; + + typedef dds::core::status::TLivelinessChangedStatus + LivelinessChangedStatus; + + typedef dds::core::status::TLivelinessLostStatus + LivelinessLostStatus; + + typedef dds::core::status::TOfferedDeadlineMissedStatus + OfferedDeadlineMissedStatus; + + typedef dds::core::status::TOfferedIncompatibleQosStatus + OfferedIncompatibleQosStatus; + + typedef dds::core::status::TPublicationMatchedStatus + PublicationMatchedStatus; + + typedef dds::core::status::TSampleRejectedStatus< org::eclipse::cyclonedds::core::SampleRejectedStatusDelegate > + SampleRejectedStatus; + + typedef dds::core::status::TRequestedDeadlineMissedStatus + RequestedDeadlineMissedStatus; + + typedef dds::core::status::TRequestedIncompatibleQosStatus + RequestedIncompatibleQosStatus; + + typedef dds::core::status::TSampleLostStatus + SampleLostStatus; + + typedef dds::core::status::TSubscriptionMatchedStatus + SubscriptionMatchedStatus; +} } } } // namespace dds::core::status::detail + + +#endif /* OMG_DDS_CORE_STATUS_DETAIL_STATUS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/status/detail/TStatusImpl.hpp b/unitree_SDK/include/ddscxx/dds/core/status/detail/TStatusImpl.hpp new file mode 100644 index 0000000..a06383f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/status/detail/TStatusImpl.hpp @@ -0,0 +1,337 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_STATUS_TSTATUS_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_STATUS_TSTATUS_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +// Implementation + +namespace dds +{ +namespace core +{ +namespace status +{ + +//TInconsistentTopicStatus + +template +TInconsistentTopicStatus::TInconsistentTopicStatus() : dds::core::Value() { } + +template +int32_t TInconsistentTopicStatus::total_count() const +{ + return this->delegate().total_count(); +} + +template +int32_t TInconsistentTopicStatus::total_count_change() const +{ + return this->delegate().total_count_change(); +} + +//TSampleLostStatus + +template +TSampleLostStatus::TSampleLostStatus() : dds::core::Value() {} + +template +int32_t TSampleLostStatus::total_count() const +{ + return this->delegate().total_count(); +} + +template +int32_t TSampleLostStatus::total_count_change() const +{ + return this->delegate().total_count_change(); +} + +//TSampleRejectedStatus + +template +TSampleRejectedStatus::TSampleRejectedStatus() : dds::core::Value() { } + +template +int32_t TSampleRejectedStatus::total_count() const +{ + return this->delegate().total_count(); +} + +template +int32_t TSampleRejectedStatus::total_count_change() const +{ + return this->delegate().total_count_change(); +} + +template +const dds::core::status::SampleRejectedState TSampleRejectedStatus::last_reason() const +{ + return this->delegate().last_reason(); +} + +template +const dds::core::InstanceHandle TSampleRejectedStatus::last_instance_handle() const +{ + return this->delegate().last_instance_handle(); +} +//TLivelinessLostStatus +template +TLivelinessLostStatus::TLivelinessLostStatus() : dds::core::Value() { } + +template +int32_t TLivelinessLostStatus::total_count() const +{ + return this->delegate().total_count(); +} + +template +int32_t TLivelinessLostStatus::total_count_change() const +{ + return this->delegate().total_count_change(); +} + +//TLivelinessChangedStatus + +template +TLivelinessChangedStatus::TLivelinessChangedStatus() : dds::core::Value() { } + +template +int32_t TLivelinessChangedStatus::alive_count() const +{ + return this->delegate().alive_count(); +} + +template +int32_t TLivelinessChangedStatus::not_alive_count() const +{ + return this->delegate().not_alive_count(); +} + +template +int32_t TLivelinessChangedStatus::alive_count_change() const +{ + return this->delegate().alive_count_change(); +} + +template +int32_t TLivelinessChangedStatus::not_alive_count_change() const +{ + return this->delegate().not_alive_count_change(); +} + +template +const dds::core::InstanceHandle TLivelinessChangedStatus::last_publication_handle() const +{ + return this->delegate().last_publication_handle(); +} + +//TOfferedDeadlineMissedStatus + +template +TOfferedDeadlineMissedStatus::TOfferedDeadlineMissedStatus() : dds::core::Value() { } + +template +int32_t TOfferedDeadlineMissedStatus::total_count() const +{ + return this->delegate().total_count(); +} + +template +int32_t TOfferedDeadlineMissedStatus::total_count_change() const +{ + return this->delegate().total_count_change(); +} + +template +const dds::core::InstanceHandle TOfferedDeadlineMissedStatus::last_instance_handle() const +{ + return this->delegate().last_instance_handle(); +} + +//TRequestedDeadlineMissedStatus + +template +TRequestedDeadlineMissedStatus::TRequestedDeadlineMissedStatus() : dds::core::Value() { } + +template +int32_t TRequestedDeadlineMissedStatus::total_count() const +{ + return this->delegate().total_count(); +} + +template +int32_t TRequestedDeadlineMissedStatus::total_count_change() const +{ + return this->delegate().total_count_change(); +} + +template +const dds::core::InstanceHandle TRequestedDeadlineMissedStatus::last_instance_handle() const +{ + return this->delegate().last_instance_handle(); +} + +//TOfferedIncompatibleQosStatus + +template +TOfferedIncompatibleQosStatus::TOfferedIncompatibleQosStatus() : dds::core::Value() { } + +template +int32_t TOfferedIncompatibleQosStatus::total_count() const +{ + return this->delegate().total_count(); +} + +template +int32_t TOfferedIncompatibleQosStatus::total_count_change() const +{ + return this->delegate().total_count_change(); +} + +template +dds::core::policy::QosPolicyId TOfferedIncompatibleQosStatus::last_policy_id() const +{ + return this->delegate().last_policy_id(); +} + +template +const dds::core::policy::QosPolicyCountSeq TOfferedIncompatibleQosStatus::policies() const +{ + return this->delegate().policies(); +} + +template +const dds::core::policy::QosPolicyCountSeq& TOfferedIncompatibleQosStatus::policies(dds::core::policy::QosPolicyCountSeq& dst) const +{ + return this->delegate().policies(dst); +} + +//TRequestedIncompatibleQosStatus + +template +TRequestedIncompatibleQosStatus::TRequestedIncompatibleQosStatus() : dds::core::Value() { } + +template +int32_t TRequestedIncompatibleQosStatus::total_count() const +{ + return this->delegate().total_count(); +} + +template +int32_t TRequestedIncompatibleQosStatus::total_count_change() const +{ + return this->delegate().total_count_change(); +} + +template +dds::core::policy::QosPolicyId TRequestedIncompatibleQosStatus::last_policy_id() const +{ + return this->delegate().last_policy_id(); +} + +template +const dds::core::policy::QosPolicyCountSeq TRequestedIncompatibleQosStatus::policies() const +{ + return this->delegate().policies(); +} + +template +const dds::core::policy::QosPolicyCountSeq& TRequestedIncompatibleQosStatus::policies(dds::core::policy::QosPolicyCountSeq& dst) const +{ + return this->delegate().policies(dst); +} + +//TPublicationMatchedStatus + +template +TPublicationMatchedStatus::TPublicationMatchedStatus() : dds::core::Value() { } + +template +int32_t TPublicationMatchedStatus::total_count() const +{ + return this->delegate().total_count(); +} + +template +int32_t TPublicationMatchedStatus::total_count_change() const +{ + return this->delegate().total_count_change(); +} + +template +int32_t TPublicationMatchedStatus::current_count() const +{ + return this->delegate().current_count(); +} + +template +int32_t TPublicationMatchedStatus::current_count_change() const +{ + return this->delegate().current_count_change(); +} + +template +const dds::core::InstanceHandle TPublicationMatchedStatus::last_subscription_handle() const +{ + return this->delegate().last_subscription_handle(); +} + +//TSubscriptionMatchedStatus + +template +TSubscriptionMatchedStatus::TSubscriptionMatchedStatus() : dds::core::Value() { } + +template +int32_t TSubscriptionMatchedStatus::total_count() const +{ + return this->delegate().total_count(); +} + +template +int32_t TSubscriptionMatchedStatus::total_count_change() const +{ + return this->delegate().total_count_change(); +} + +template +int32_t TSubscriptionMatchedStatus::current_count() const +{ + return this->delegate().current_count(); +} + +template +int32_t TSubscriptionMatchedStatus::current_count_change() const +{ + return this->delegate().current_count_change(); +} + +template +const dds::core::InstanceHandle TSubscriptionMatchedStatus::last_publication_handle() const +{ + return this->delegate().last_publication_handle(); +} + +} +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_STATUS_TSTATUS_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/types.hpp b/unitree_SDK/include/ddscxx/dds/core/types.hpp new file mode 100644 index 0000000..c1d2675 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/types.hpp @@ -0,0 +1,75 @@ +#ifndef OMG_DDS_CORE_TYPES_HPP_ +#define OMG_DDS_CORE_TYPES_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +// ISO C++ Includes +#include +#include + +// DDS Includes +#include +#include +#include + +namespace dds +{ +namespace core +{ +/** + * Use a std::vector to hold a sequence of bytes. + */ +typedef std::vector ByteSeq; + +/** + * Use a std::vector to hold a sequence of bytes. + */ +typedef std::vector StringSeq; + +// DDS Null-Reference +/** + * @brief This class is used to create dds::core::null objects. + */ +class OMG_DDS_API null_type { }; +/** + * This is the DDS Null-Reference.
      + * A dds reference object that doesn't reference to anything can be compared with this object. + * @code{.cpp} + * dds::domain::DomainParticipant participant = dds::core::null; + * ... + * if (participant == dds::core::null) { + * // The participant is not yet properly created. + * // Using it now will trigger the dds::core::NullReferenceError exception. + * } + * @endcode + */ +extern const null_type OMG_DDS_API null; + +/** @cond + * Duplicate in CorePolicy.hpp. Why? + */ +namespace policy +{ +typedef uint32_t QosPolicyId; +} +/** @endcond */ +} +} + +#endif /* OMG_DDS_CORE_TYPES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/Annotations.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/Annotations.hpp new file mode 100644 index 0000000..d30435b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/Annotations.hpp @@ -0,0 +1,72 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_ANNOTATIONS_HPP_ +#define OMG_DDS_CORE_XTYPES_ANNOTATIONS_HPP_ + +#include +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +typedef TAnnotation Annotation; + + +typedef TIdAnnotation IdAnnotation; + +typedef TKeyAnnotation KeyAnnotation; + +typedef TSharedAnnotation SharedAnnotation; + +typedef TNestedAnnotation NestedAnnotation; + +typedef TExtensibilityAnnotation ExtensibilityAnnotation; + +typedef TMustUnderstandAnnotation MustUnderstandAnnotation; + +typedef TVerbatimAnnotation VerbatimAnnotation; + +typedef TBitsetAnnotation BitsetAnnotation; + +typedef TBitBoundAnnotation BitBoundAnnotation; + +namespace annotation +{ +// These functions can be used to get cached instances, +// to avoid the proliferation of small annotation objects. +dds::core::xtypes::IdAnnotation Id(uint32_t); +dds::core::xtypes::KeyAnnotation Key(); +dds::core::xtypes::SharedAnnotation Shared(); +dds::core::xtypes::NestedAnnotation Nested(); +dds::core::xtypes::ExtensibilityAnnotation Extensibility(dds::core::xtypes::ExtensibilityAnnotation::ExtensibilityKind kind); +dds::core::xtypes::ExtensibilityAnnotation Final(); +dds::core::xtypes::ExtensibilityAnnotation Extensible(); +dds::core::xtypes::ExtensibilityAnnotation Mutable(); +dds::core::xtypes::MustUnderstandAnnotation MustUnderstand(); +dds::core::xtypes::VerbatimAnnotation Verbatim(const std::string& text); +dds::core::xtypes::BitsetAnnotation Bitset(); +dds::core::xtypes::BitsetAnnotation BitBound(uint32_t bound); + +} +} +} +} +#endif /* OMG_DDS_CORE_XTYPES_ANNOTATIONS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/CollectionTypes.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/CollectionTypes.hpp new file mode 100644 index 0000000..fc0bb86 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/CollectionTypes.hpp @@ -0,0 +1,42 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_COLLECTION_TYPES_HPP_ +#define OMG_DDS_CORE_XTYPES_COLLECTION_TYPES_HPP_ + +#include +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +typedef TCollectionType CollectionType; + +typedef TMapType MapType; + +typedef TSequenceType SequenceType; + +template class DELEGATE = detail::StringType> +class TStringType; +} +} +} + +#endif /* OMG_DDS_CORE_XTYPES_COLLECTION_TYPES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/DynamicData.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/DynamicData.hpp new file mode 100644 index 0000000..254d65b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/DynamicData.hpp @@ -0,0 +1,39 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_DYNAMICDATA_HPP_ +#define OMG_DDS_CORE_XTYPES_DYNAMICDATA_HPP_ + +#include +#include + + +namespace dds +{ +namespace core +{ +namespace xtypes +{ + +typedef TDynamicData DynamicData; + +} +} +} + + +#endif /* OMG_DDS_CORE_XTYPES_DYNAMICDATA_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/DynamicType.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/DynamicType.hpp new file mode 100644 index 0000000..9bb24f5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/DynamicType.hpp @@ -0,0 +1,38 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_DYNAMIC_TYPE_HPP_ +#define OMG_DDS_CORE_XTYPES_DYNAMIC_TYPE_HPP_ + +#include +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +template +class TDynamicType; + +typedef TDynamicType DynamicType; +} +} +} + +#endif /* OMG_DDS_CORE_XTYPES_DYNAMIC_TYPE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/MemberType.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/MemberType.hpp new file mode 100644 index 0000000..66b4761 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/MemberType.hpp @@ -0,0 +1,35 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_MEMBER_TYPE_HPP +#define OMG_DDS_CORE_XTYPES_MEMBER_TYPE_HPP + +#include +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +typedef TMemberType MemberType; +} +} +} + +#endif /* OMG_DDS_CORE_XTYPES_MEMBER_TYPE_HPP */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/PrimitiveTypes.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/PrimitiveTypes.hpp new file mode 100644 index 0000000..4894845 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/PrimitiveTypes.hpp @@ -0,0 +1,71 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_PRIMITIVE_TYPES_HPP_ +#define OMG_DDS_CORE_XTYPES_PRIMITIVE_TYPES_HPP_ + +#include +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +template +class TPrimitiveType; + +template +struct dynamic_type_traits +{ + static const TypeKind TYPE_ID = TypeKind::NO_TYPE; + static const std::string NAME; +}; + +/** + * Primitive type constructor. This function can be used + * as follows: + * + * DynamicType int16Type = PrimitiveType(); + */ +template +TPrimitiveType PrimitiveType(); +} +} +} + +template +class dds::core::xtypes::TPrimitiveType : public dds::core::xtypes::DynamicType +{ +public: + TPrimitiveType() : DynamicType(dynamic_type_traits::TYPE_ID, dynamic_type_traits::NAME) { } +}; + +template +dds::core::xtypes::TPrimitiveType +dds::core::xtypes::PrimitiveType() +{ + static dds::core::xtypes::TPrimitiveType t(); + return t; +} + +// This include should be at the end since it provides +// template specializations. +#include + +#endif /* OMG_DDS_CORE_XTYPES_PRIMITIVE_TYPES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/StructType.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/StructType.hpp new file mode 100644 index 0000000..e022df5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/StructType.hpp @@ -0,0 +1,37 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_STRUCT_TYPE_HPP_ +#define OMG_DDS_CORE_XTYPES_STRUCT_TYPE_HPP_ + +#include +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +typedef TStructType StructType; +} +} +} + + + +#endif /* OMG_DDS_CORE_XTYPES_STRUCT_TYPE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/TAnnotation.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/TAnnotation.hpp new file mode 100644 index 0000000..70c6589 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/TAnnotation.hpp @@ -0,0 +1,177 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_TANNOTATIONS_HPP_ +#define OMG_DDS_CORE_XTYPES_TANNOTATIONS_HPP_ + +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ + +struct AnnotationKind_def +{ + enum type + { + ID_ANNOTATION_TYPE, + OPTIONAL_ANNOTATION_TYPE, + KEY_ANNOTATION_TYPE, + SHARED_ANNOTATION_TYPE, + NESTED_ANNOTATION_TYPE, + EXTENSIBILITY_ANNOTATION_TYPE, + MUST_UNDERSTAND_ANNOTATION_TYPE, + VERBATIM_ANNOTATION_TYPE, + BITSET_ANNOTATION_TYPE + }; +}; + +typedef dds::core::safe_enum AnnotationKind; + +struct ExtensibilityKind_def +{ + enum type + { + FINAL, + EXTENSIBLE, + MUTABLE + }; +}; +typedef dds::core::safe_enum ExtensibilityKind; + + +template +class TAnnotation; + +template +class TIdAnnotation; + +template +class TKeyAnnotation; + +template +class TSharedAnnotation; + +template +class TNestedAnnotation; + +template +class TExtensibilityAnnotation; + +template +class TMustUnderstandAnnotation; + +template +class TVerbatimAnnotation; + +template +class TBitsetAnnotation; + +template +class TBitBoundAnnotation; + +} +} +} + +template +class dds::core::xtypes::TAnnotation : public dds::core::Reference +{ +public: + OMG_DDS_REF_TYPE(TAnnotation, dds::core::Reference, DELEGATE) + +public: + TAnnotation(); +protected: + TAnnotation(const TypeKind& kind); +public: + TypeKind kind() const; +}; +template +class dds::core::xtypes::TIdAnnotation : public dds::core::xtypes::TAnnotation +{ +public: + TIdAnnotation(uint32_t id); +public: + uint32_t id() const; +}; +template +class dds::core::xtypes::TKeyAnnotation : public dds::core::xtypes::TAnnotation +{ +public: + TKeyAnnotation(); +}; +template +class dds::core::xtypes::TSharedAnnotation : public dds::core::xtypes::TAnnotation +{ +public: + TSharedAnnotation(); +}; +template +class dds::core::xtypes::TNestedAnnotation : public dds::core::xtypes::TAnnotation +{ +public: + TNestedAnnotation(); +}; + +template +class dds::core::xtypes::TExtensibilityAnnotation : public dds::core::xtypes::TAnnotation +{ + +public: + TExtensibilityAnnotation(ExtensibilityKind xkind); + +public: + ExtensibilityKind extensibility_kind() const; +}; + +template +class dds::core::xtypes::TMustUnderstandAnnotation : public dds::core::xtypes::TAnnotation +{ +public: + TMustUnderstandAnnotation(); +}; + +template +class dds::core::xtypes::TVerbatimAnnotation : public dds::core::xtypes::TAnnotation +{ +public: + TVerbatimAnnotation(const std::string& text); +public: + const std::string& verbatim_text() const; +}; + +template +class dds::core::xtypes::TBitsetAnnotation : public dds::core::xtypes::TAnnotation +{ +public: + TBitsetAnnotation(); + +}; + +template +class dds::core::xtypes::TBitBoundAnnotation : public dds::core::xtypes::TAnnotation +{ +public: + TBitBoundAnnotation(uint32_t bound); +}; + + +#endif /* OMG_DDS_CORE_XTYPES_TANNOTATIONS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/TCollectionTypes.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/TCollectionTypes.hpp new file mode 100644 index 0000000..f8ba67a --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/TCollectionTypes.hpp @@ -0,0 +1,100 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_T_COLLECTION_TYPES_HPP_ +#define OMG_DDS_CORE_XTYPES_T_COLLECTION_TYPES_HPP_ + +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ + +template +class TCollectionType; + +template +class TMapType; + +template +class TSequenceType; + +template class DELEGATE> +class TStringType; +} +} +} + +template +class dds::core::xtypes::TCollectionType : public dds::core::xtypes::TDynamicType +{ +public: + const uint32_t UNBOUNDED = 0xFFFFFFFF; + +protected: + TCollectionType(const std::string& name, TypeKind kind); +public: + uint32_t bounds() const; +}; + + +template +class dds::core::xtypes::TMapType : public dds::core::xtypes::TCollectionType +{ +public: + /** + * Create an unbounded Map with the given key/value type. + */ + TMapType(const DyanmicType& key_type, const DynamicType& value_type); + /** + * Create an bounded Map with the given key/value type. + */ + TMapType(const DyanmicType& key_type, const DynamicType& value_type, uint32_t bounds); +public: + const DyanmicType& key_type(); + const DynamicType& value_type(); +}; + +template +class dds::core::xtypes::TSequenceType : public dds::core::xtypes::TCollectionType +{ +public: + /** + * Create an unbounded sequence for the given type. + */ + TSequenceType(const DynamicType& type); + + /** + * Create a bounded sequence for the given type. + */ + TSequenceType(const DynamicType& type, uint32_t bounds); +public: + const DyanmicType& key_type() const; +}; + +template class DELEGATE> +class dds::core::xtypes::TStringType : public dds::core::xtypes::TCollectionType +{ +public: + TStringType(uint32_t bounds); +}; + + +#endif /* OMG_DDS_CORE_XTYPES_T_COLLECTION_TYPES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/TDynamicData.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/TDynamicData.hpp new file mode 100644 index 0000000..4e8e66d --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/TDynamicData.hpp @@ -0,0 +1,86 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_TDYNAMICDATA_HPP_ +#define OMG_DDS_CORE_XTYPES_TDYNAMICDATA_HPP_ + +#include +#include +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +template +class TDynamicData; + +template +void value(DDT& dd, uint32_t mid, const T& v); + +template +T value(const DDT& dd, const std::string& mid, const T& v); + +template +T value(const DDT& dd, uint32_t mid); + +template +T value(const DDT& dd, const std::string& mid); + + +} +} +} + +/** + * This class is used to read/write data for DynamicTypes. It allows reading and + * writing of samples in a type-safe manner but without any compile-time knowledge + * of the type being read or written. + */ +template +class dds::core::xtypes::TDynamicData : dds::core::Reference +{ +public: + OMG_DDS_REF_TYPE(TDynamicData, dds::core::Reference, DELEGATE) +public: + TDynamicData(const DynamicType& type); + +public: + template + void value(uint32_T mid, const T& v) const; + + template + T value(const std::string& mid, const T& v) const; + + template + T value(uint32_T mid) const; + + template + T value(const std::string& mid) const; + + DynamicType type() const; + + MemberType member_type(uint32_t id) const; + MemberType member_type(const std::string& name) const; + + uint32_t member_id(const std::string& name) const; +}; + + +#endif /* OMG_DDS_CORE_XTYPES_TDYNAMICDATA_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/TDynamicType.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/TDynamicType.hpp new file mode 100644 index 0000000..ef45200 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/TDynamicType.hpp @@ -0,0 +1,94 @@ +#ifndef OMG_DDS_CORE_XTYPES_T_DYNAMIC_TYPE_HPP_ +#define OMG_DDS_CORE_XTYPES_T_DYNAMIC_TYPE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include +#include + +#if defined (OMG_DDS_X_TYPES_DYNANIC_TYPE_SUPPORT) + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +template +class TDynamicType; + +template +bool isPrimitiveType(const TDynamicType& t); + +template +bool isConstructedType(const TDynamicType& t); + +template +bool isCollectionType(const TDynamicType& t); + +template +bool isAggregationType(const TDynamicType& t); +} +} +} + + +/** + * Base class for all dynamic types. + */ +template +class dds::core::xtypes::TDynamicType : public dds::core::Reference +{ +public: + OMG_DDS_REF_TYPE(TDynamicType, dds::core::Reference, DELEGATE) + +protected: + TDynamicType(const std::string& name, TypeKind kind); + TDynamicType(const std::string& name, TypeKind kind, const Annotation& annotation); + TDynamicType(const std::string& name, TypeKind kind, const std::vector& annotations); + template + TDynamicType(const std::string& name, TypeKind kind, const FWI& annotation_begin, const FWI& annotation_end); + TDynamicType(const DyamicType& other); + ~TDynamicType(); +public: + /** + * Get the type kind. + */ + TypeKind kind() const; + + /** + * Get the type name. + */ + const std::string& name() const; + + const std::vector& annotations() const; + +public: + bool operator == (const DynamicType& that) const; + +}; + + +#endif // defined(OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT) + + +#endif // !defined(OMG_DDS_CORE_XTYPES_T_DYNAMIC_TYPE_HPP_) diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/TMemberType.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/TMemberType.hpp new file mode 100644 index 0000000..b2778ed --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/TMemberType.hpp @@ -0,0 +1,98 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_TMEMBER_TYPE_HPP +#define OMG_DDS_CORE_XTYPES_TMEMBER_TYPE_HPP + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +template +class TMemberType; + +template +bool isOptional(const TMemberType& m); + +template +bool isShared(const TMemberType& m); + +template +bool isKey(const TMemberType& m); + +template +bool isMustUnderstand(const TMemberType& m); + +template +bool isBitset(const TMemberType& m); + +template +bool hasBitbound(const TMemberType& m); + +template +int32_t getBitbound(const TMemberType& m); + +template +bool hasId(const TMemberType& m); + +template +int32_t getId(const TMemberType& m); +} +} +} + +/** + * This class represents a dynamic type member. + */ +template +class dds::core::xtypes::TMemberType : public dds::core::Reference +{ +public: + OMG_DDS_REF_TYPE(TMemberType, dds::core::Reference, DELEGATE) + +public: + TMemberType(const std::string& name, const dds::core::xtypes::DynamicType& type); + + TMemberType(const std::string& name, + const dds::core::xtypes::DynamicType& type, + const Annotation& annotation + ); + + template + TMemberType(const std::string& name, + const dds::core::xtypes::DynamicType& type, + const AnnotationIter& begin, + const AnnotationIter& end); + + + TMemberType(const std::string& name, + const dds::core::xtypes::DynamicType& type, + const std::vector& annotations + ); + +public: + const std::string& name() const; + const dds::core::xtypes::DynamicType& type() const; + +public: + TMemberType add_annotation(const Annotation& annotation); + TMemberType remove_annotation(const Annotation& annotation); +}; + +#endif /* OMG_DDS_CORE_XTYPES_TMEMBER_TYPE_HPP */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/TStructType.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/TStructType.hpp new file mode 100644 index 0000000..9356ae3 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/TStructType.hpp @@ -0,0 +1,122 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_T_STRUCT_TYPE_HPP_ +#define OMG_DDS_CORE_XTYPES_T_STRUCT_TYPE_HPP_ + +#include +#include +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +template +class TStructType; + +template +class TStructForwardDeclaration; + +template +bool isFinal(const TStructType& s); + +template +bool isExtensible(const TStructType& s); + +template +bool isMutable(const TStructType& s); + +template +bool isNested(const TStructType& s); +} +} +} + +/** + * Declares a forward declaration for a struct type. + */ +template +class dds::core::xtypes::TStructForwardDeclaration : public dds::core::xtypes::DynamicType +{ +public: + TStructForwardDeclaration(const std::string& name); +}; + +/** + * Create a dynamic structure type. If the members don't have Id associated + * explicitly, then their ID will be the same as the ordinal position on the + * members vector. + */ +template +class dds::core::xtypes::TStructType : public dds::core::xtypes::DynamicType +{ +public: + + TStructType(const std::string& name); + + TStructType( + const std::string& name, + const TStructType& parent, + const std::vector& members); + + template + TStructType( + const std::string& name, + const TStructType& parent, + const MemberIter& begin, + const MemberIter& end); + + TStructType( + const std::string& name, + const TStructType& parent, + const std::vector& members, + const Annotation& annotation); + + TStructType( + const std::string& name, + const TStructType& parent, + const std::vector& members, + const std::vector& annotations); + + template + TStructType( + const std::string& name, + const TStructType& parent, + const MemberIter& begin, + const MemberIter& end, + const AnnotationIter& begin, + const AnnotationIter& end); +public: + TStructType parent() const; + const std::vector& members() const; + const MemberType& member(uint32_t id) const; + const MemberType& member(const std::string& name) const; + + const std::vector& annotations() const; + + TStructType add_member(const MemberType& member) const ; + TStructType remove_member(const MemberType& member) const; + + TStructType add_annotation(const Annotation& annotation) const; + TStructType remove_annotation(const Annotation& annotation) const; +}; + + +#endif /* OMG_DDS_CORE_XTYPES_T_STRUCT_TYPE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/TTypeProvider.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/TTypeProvider.hpp new file mode 100644 index 0000000..b1c698f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/TTypeProvider.hpp @@ -0,0 +1,63 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_T_TYPE_PROVIDER_HPP_ +#define OMG_DDS_CORE_XTYPES_T_TYPE_PROVIDER_HPP_ + +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ + +template +class TTypeProvider; + +} +} +} + +/** + * TypeProvider that allows creation of types from external representations. + */ +template +class dds::core::xtypes::TTypeProvider +{ +public: + /** + * Load a type from the specified URI. If multiple types are defined + * only the first one is returned. + */ + static DynamicType load_type(const std::string& uri); + + /** + * Load a type from the specified URI. If multiple types are defined + * only the first one is returned. + */ + static std::vector load_types(const std::string& uri); + + /** + * Load a named type from the specified URI. + */ + static DynamicType load_type(const std::string& uri, const std::string& name); +}; + + +#endif /* OMG_DDS_CORE_XTYPES_T_TYPE_PROVIDER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/TypeKind.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/TypeKind.hpp new file mode 100644 index 0000000..d2b53ac --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/TypeKind.hpp @@ -0,0 +1,88 @@ +#ifndef OMG_DDS_XTYPE_ +#define OMG_DDS_TYPE_OBJECT_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + + + +#if defined(OMG_DDS_X_TYPES_DYNANIC_TYPE_SUPPORT) + + +// --- Shared meta-data: ------------------------------------------------- + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +struct TypeKind_def +{ + enum type + { + NO_TYPE = 0, // sentinel indicating "null" value + PRIMITIVE_TYPE = 0x4000, + CONSTRUCTED_TYPE = 0x8000, + COLLECTION_TYPE = 0x0200, + AGGREGATION_TYPE = 0x0100, + ANNOTATION_TYPE = 0x0080, + + BOOLEAN_TYPE = PRIMITIVE_TYPE | 0x0001, + UINT_8_TYPE = PRIMITIVE_TYPE | 0x0002, + INT_16_TYPE = PRIMITIVE_TYPE | 0x0003, + UINT_16_TYPE = PRIMITIVE_TYPE | 0x0004, + INT_32_TYPE = PRIMITIVE_TYPE | 0x0005, + UINT_32_TYPE = PRIMITIVE_TYPE | 0x0006, + INT_64_TYPE = PRIMITIVE_TYPE | 0x0007, + UINT_64_TYPE = PRIMITIVE_TYPE | 0x0008, + FLOAT_32_TYPE = PRIMITIVE_TYPE | 0x0009, + FLOAT_64_TYPE = PRIMITIVE_TYPE | 0x000A, + FLOAT_128_TYPE = PRIMITIVE_TYPE | 0x000B, + CHAR_8_TYPE = PRIMITIVE_TYPE | 0x000C, + CHAR_32_TYPE = PRIMITIVE_TYPE | 0x000D, + + ENUMERATION_TYPE = CONSTRUCTED_TYPE | 0x0001, + BITSET_TYPE = CONSTRUCTED_TYPE | 0x0002, + ALIAS_TYPE = CONSTRUCTED_TYPE | 0x0003, + + ARRAY_TYPE = CONSTRUCTED_TYPE | COLLECTION_TYPE | 0x0004, + SEQUENCE_TYPE = CONSTRUCTED_TYPE | COLLECTION_TYPE | 0x0005, + STRING_TYPE = CONSTRUCTED_TYPE | COLLECTION_TYPE | 0x0006, + MAP_TYPE = CONSTRUCTED_TYPE | COLLECTION_TYPE | 0x0007, + + UNION_TYPE = CONSTRUCTED_TYPE | AGGREGATION_TYPE | 0x0008, + STRUCTURE_TYPE = CONSTRUCTED_TYPE | AGGREGATION_TYPE | 0x0009, + UNION_FWD_DECL_TYPE = CONSTRUCTED_TYPE | AGGREGATION_TYPE | 0x000A, + STRUCTURE_FWD_DECL_TYPE = CONSTRUCTED_TYPE | AGGREGATION_TYPE | 0x000B + }; +}; + +typedef dds::core::safe_enum TypeKind; +} +} +} + +#endif // OMG_DDS_X_TYPES_DYNANIC_TYPE_SUPPORT + + +#endif // !defined(OMG_DDS_TYPE_OBJECT_HPP_) diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/TypeProvider.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/TypeProvider.hpp new file mode 100644 index 0000000..84a33f9 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/TypeProvider.hpp @@ -0,0 +1,35 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_TYPE_PROVIDER_HPP_ +#define OMG_DDS_CORE_XTYPES_TYPE_PROVIDER_HPP_ + +#include +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +typedef TTypeProvider TypeProvider; +} +} +} + +#endif /* OMG_DDS_CORE_XTYPES_TYPE_PROVIDER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/UnionCase.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/UnionCase.hpp new file mode 100644 index 0000000..137a660 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/UnionCase.hpp @@ -0,0 +1,59 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +/* + * TUnionCase.hpp + * + * Created on: Oct 24, 2012 + * Author: angelo + */ + +#ifndef OMG_DDS_CORE_XTYPES_UNION_CASE_HPP_ +#define OMG_DDS_CORE_XTYPES_UNION_CASE_HPP_ + +#include +#include +#include + +/** @cond */ +namespace dds +{ +namespace core +{ +namespace xtypes +{ +template class DELEGATE = detail::UnionCase> +class UnionCase; +} +} +} +/** @endcond */ + +template class DELEGATE> +class dds::core::xtypes::UnionCase : public dds::core::Reference< DELEGATE > +{ +public: + // Nil case + UnionCase(); +public: + UnionCase(T discriminator, const MemberType& member); +public: + T discriminator(); + const MemberType& member(); +}; + +#endif /* OMG_DDS_CORE_XTYPES_T_UNION_CASE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/UnionType.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/UnionType.hpp new file mode 100644 index 0000000..4482d0c --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/UnionType.hpp @@ -0,0 +1,90 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_CORE_XTYPES_T_UNION_TYPE_HPP_ +#define OMG_DDS_CORE_XTYPES_T_UNION_TYPE_HPP_ + +#include +#include +#include +#include +#include + +namespace dds +{ +namespace core +{ +namespace xtypes +{ +template +class TUnionForwardDeclaration; + +template class DELEGATE = detail::UnionType > +class UnionType; +} +} +} + +/** + * Declares a forward declaration for a union type. + */ +template +class dds::core::xtypes::TUnionForwardDeclaration : public dds::core::xtypes::DynamicType +{ +public: + TUnionForwardDeclaration(const std::string& name); +}; + +template +class dds::core::xtypes::UnionType : public dds::core::xtypes::DynamicType > +{ +public: + + UnionType( + const std::string& name, + const TPrimitiveType& discriminator_type, + const std::vector >& cases); + + UnionType( + const std::string& name, + const TPrimitiveType& discriminator_type, + const std::vector >& cases, + const Annotation& annotation); + + UnionType( + const std::string& name, + const TPrimitiveType& discriminator_type, + const std::vector >& cases, + const std::vector& annotations); + +public: + + const std::vector >& members() const; + const MemberType& member(uint32_t id) const; + const MemberType& member(const std::string& name) const; + + const std::vector& annotations() const; + + UnionType add_member(const UnionCase& member) const; + UnionType remove_member(const UnionCase& member) const; + + UnionType add_annotation(const Annotation& annotation) const; + UnionType remove_annotation(const Annotation& annotation) const; + +}; + +#endif /* OMG_DDS_CORE_XTYPES_T_STRUCT_TYPE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/Annotation.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/Annotation.hpp new file mode 100644 index 0000000..a34ea85 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/Annotation.hpp @@ -0,0 +1,42 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_CORE_XTYPES_DETAIL_ANNOTATIONS_HPP_ +#define OMG_DDS_CORE_XTYPES_DETAIL_ANNOTATIONS_HPP_ + +namespace dds { + namespace core { + namespace xtypes { + namespace detail { + class Annotation { }; + + class IdAnnotation : public Annotation { }; + + class KeyAnnotation : public Annotation { }; + + class SharedAnnotation : public Annotation { }; + + class NestedAnnotation : public Annotation { }; + + class ExtensibilityAnnotation : public Annotation { }; + + class MustUnderstandAnnotation : public Annotation { }; + + class VerbatimAnnotation : public Annotation { }; + + class BitsetAnnotation : public Annotation { }; + + class BitBoundAnnotation : public Annotation { }; + } + } + } +} +#endif /* OMG_DDS_CORE_XTYPES_DETAIL_ANNOTATIONS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/CollectionTypes.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/CollectionTypes.hpp new file mode 100644 index 0000000..95b3b6a --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/CollectionTypes.hpp @@ -0,0 +1,34 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_CORE_XTYPES_DETAIL_COLLECTION_TYPES_HPP_ +#define OMG_DDS_CORE_XTYPES_DETAIL_COLLECTION_TYPES_HPP_ + + +namespace dds { + namespace core { + namespace xtypes { + namespace detail { + + class CollectionType { }; + + class MapType { }; + + class SequenceType { }; + + template + class StringType { }; + } + } + } +} + +#endif /* OMG_DDS_CORE_XTYPES_DETAIL_COLLECTION_TYPES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/DynamicData.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/DynamicData.hpp new file mode 100644 index 0000000..48d8190 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/DynamicData.hpp @@ -0,0 +1,26 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_CORE_XTYPES_DETAIL_TDYNAMICDATA_HPP_ +#define OMG_DDS_CORE_XTYPES_DETAIL_TDYNAMICDATA_HPP_ + +namespace dds { + namespace code { + namespace xtypes { + namespace detail { + class DynamicData; + } + } + } +} + + +#endif /* OMG_DDS_CORE_XTYPES_DETAIL_TDYNAMICDATA_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/DynamicType.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/DynamicType.hpp new file mode 100644 index 0000000..d54949a --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/DynamicType.hpp @@ -0,0 +1,24 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_CORE_DETAIL_XTYPES_DYNAMIC_TYPE_HPP_ +#define OMG_DDS_CORE_DETAIL_XTYPES_DYNAMIC_TYPE_HPP_ + +namespace dds { + namespace core { + namespace xtypes { + namespace detail { + class DynamicType { }; + } + } + } +} +#endif /* OMG_DDS_CORE_DETAIL_XTYPES_DYNAMIC_TYPE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/MemberType.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/MemberType.hpp new file mode 100644 index 0000000..0eef804 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/MemberType.hpp @@ -0,0 +1,25 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_CORE_XTYPES_DETAIL_TMEMBER_TYPE_HPP +#define OMG_DDS_CORE_XTYPES_DETAIL_TMEMBER_TYPE_HPP + +namespace dds { + namespace core { + namespace xtypes { + namespace detail { + class MemberType; + } + } + } +} + +#endif /* OMG_DDS_CORE_XTYPES_DETAIL_TMEMBER_TYPE_HPP */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/PrimitiveTypes.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/PrimitiveTypes.hpp new file mode 100644 index 0000000..d0cd638 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/PrimitiveTypes.hpp @@ -0,0 +1,61 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_CORE_XTYPES_DETAIL_PRIMITIVE_TYPES_HPP_ +#define OMG_DDS_CORE_XTYPES_DETAIL_PRIMITIVE_TYPES_HPP_ + +#include + +// This template specialization have the intent to provide guidelines +// implementors of this specification. Notice that this define only a subset +// of primitive types, thus more work for you to do... +namespace dds { + namespace core { + namespace xtypes { + // Notice that const char* const is used instead of std::string + // to limit initialization issues with ctors. + template<> + struct dynamic_type_traits { + static const TypeKind TYPE_ID = TypeKind::UINT_8_TYPE; + static const char* const NAME; // "uint8_t" + }; + + template<> + struct dynamic_type_traits { + static const TypeKind TYPE_ID = TypeKind::INT_16_TYPE; + static const char* const NAME; // "uint16_t" + }; + + + template<> + struct dynamic_type_traits { + static const TypeKind TYPE_ID = TypeKind::UINT_16_TYPE; + static const char* const NAME; // "int16_t" + }; + + template<> + struct dynamic_type_traits { + static const TypeKind TYPE_ID = TypeKind::INT_32_TYPE; + static const char* const NAME; // "int16_t" + }; + + template<> + struct dynamic_type_traits { + static const TypeKind TYPE_ID = TypeKind::UINT_32_TYPE; + static const char* const NAME; // "uint32_t" + }; + + } + } +} + + +#endif /* OMG_DDS_CORE_XTYPES_DETAIL_PRIMITIVE_TYPES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/StructType.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/StructType.hpp new file mode 100644 index 0000000..75b2578 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/StructType.hpp @@ -0,0 +1,41 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_CORE_XTYPES_DETAIL_STRUCT_TYPE_HPP_ +#define OMG_DDS_CORE_XTYPES_DETAIL_STRUCT_TYPE_HPP_ + + +namespace dds { + namespace core { + namespace xtypes { + namespace detail { + + + class StructType { }; + template + bool isFinal(const TStructType& s) { return false; } + + template + bool isExtensible(const TStructType& s) { return false; } + + template + bool isMutable(const TStructType& s) { return false; } + + template + bool isNested(const TStructType& s) { return false; } + } + } + } +} + + + +#endif /* OMG_DDS_CORE_XTYPES_DETAIL_STRUCT_TYPE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/TypeProvider.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/TypeProvider.hpp new file mode 100644 index 0000000..904dcfd --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/TypeProvider.hpp @@ -0,0 +1,25 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_CORE_XTYPES_DETAIL_TYPE_PROVIDER_HPP_ +#define OMG_DDS_CORE_XTYPES_DETAIL_TYPE_PROVIDER_HPP_ + +namespace dds { + namespace core { + namespace xtypes { + namespace detail { + class TypeProvider {}; + } + } + } +} + +#endif /* OMG_DDS_CORE_XTYPES_DETAIL_TYPE_PROVIDER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/UnionCase.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/UnionCase.hpp new file mode 100644 index 0000000..4b63d46 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/UnionCase.hpp @@ -0,0 +1,26 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_CORE_XTYPES_DETAIL_UNION_CASE_HPP_ +#define OMG_DDS_CORE_XTYPES_DETAIL_UNION_CASE_HPP_ + +namespace dds { + namespace core { + namespace xtypes { + namespace detail { + template + class UnionCase { }; + } + } + } +} + +#endif /* OMG_DDS_CORE_XTYPES_DELEGATE_UNION_CASE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/UnionType.hpp b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/UnionType.hpp new file mode 100644 index 0000000..ab7d00d --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/core/xtypes/detail/UnionType.hpp @@ -0,0 +1,26 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_CORE_XTYPES_DETAIL_UNION_TYPE_HPP_ +#define OMG_DDS_CORE_XTYPES_DETAIL_UNION_TYPE_HPP_ + +namespace dds { + namespace core { + namespace xtypes { + namespace detail { + template + class UnionType { }; + } + } + } +} + +#endif /* OMG_DDS_CORE_XTYPES_DETAIL_UNION_TYPE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/dds.hpp b/unitree_SDK/include/ddscxx/dds/dds.hpp new file mode 100644 index 0000000..6e4d69f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/dds.hpp @@ -0,0 +1,48 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef __OMG_DDS_DDS_HPP__ +#define __OMG_DDS_DDS_HPP__ + +/** + * @file + * This utility header includes the headers of all the DDS DCPS modules. + */ + +#ifdef _WIN32 +#pragma warning( push ) +#pragma warning( disable : 4250 ) +#pragma warning( disable : 4251 ) +#pragma warning( disable : 4702 ) +#endif + +#include +#include +#include + +#include +#include + +#include + +#ifdef _WIN32 +#pragma warning ( pop ) +#pragma warning( push ) +#pragma warning( disable : 4250 ) +#endif + +#endif /* __OMG_DDS_DDS_HPP__ */ diff --git a/unitree_SDK/include/ddscxx/dds/domain/DomainParticipant.hpp b/unitree_SDK/include/ddscxx/dds/domain/DomainParticipant.hpp new file mode 100644 index 0000000..1995e59 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/domain/DomainParticipant.hpp @@ -0,0 +1,32 @@ +#ifndef OMG_DDS_DOMAIN_DOMAINPARTICIPANT_HPP_ +#define OMG_DDS_DOMAIN_DOMAINPARTICIPANT_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace domain +{ +typedef dds::domain::detail::DomainParticipant DomainParticipant; +} +} + +#endif /* OMG_DDS_DOMAIN_DOMAINPARTICIPANT_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/domain/DomainParticipantListener.hpp b/unitree_SDK/include/ddscxx/dds/domain/DomainParticipantListener.hpp new file mode 100644 index 0000000..b6cd779 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/domain/DomainParticipantListener.hpp @@ -0,0 +1,208 @@ +#ifndef OMG_DDS_DOMAIN_DOMAINPARTICIPANT_LISTENER_HPP_ +#define OMG_DDS_DOMAIN_DOMAINPARTICIPANT_LISTENER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + + +namespace dds +{ +namespace domain +{ + +DDSCXX_WARNING_MSVC_OFF(4250) + +/** + * @brief + * DomainParticipant events Listener + * + * Since a DomainParticipant is an Entity, it has the ability to have a Listener + * associated with it. In this case, the associated Listener should be of type + * DomainParticipantListener. This interface must be implemented by the + * application. A user-defined class must be provided by the application which must + * extend from the DomainParticipantListener class. + * + * + * All operations for this interface must be implemented in the user-defined class, it is + * up to the application whether an operation is empty or contains some functionality. + * + * + * The DomainParticipantListener provides a generic mechanism (actually a + * callback function) for the Data Distribution Service to notify the application of + * relevant asynchronous status change events, such as a missed deadline, violation of + * a QosPolicy setting, etc. The DomainParticipantListener is related to + * changes in communication status StatusConditions. + * + * @code{.cpp} + * // Application example listener + * class ExampleListener : + * public virtual dds::domain::DomainParticipantListener + * { + * public: + * virtual void on_inconsistent_topic ( + * dds::topic::AnyTopic& topic, + * const dds::core::status::InconsistentTopicStatus& status) + * { + * std::cout << "on_inconsistent_topic" << std::endl; + * } + * + * virtual void on_offered_deadline_missed ( + * dds::pub::AnyDataWriter& writer, + * const dds::core::status::OfferedDeadlineMissedStatus& status) + * { + * std::cout << "on_offered_deadline_missed" << std::endl; + * } + * + * virtual void on_offered_incompatible_qos ( + * dds::pub::AnyDataWriter& writer, + * const dds::core::status::OfferedIncompatibleQosStatus& status) + * { + * std::cout << "on_offered_incompatible_qos" << std::endl; + * } + * + * virtual void on_liveliness_lost ( + * dds::pub::AnyDataWriter& writer, + * const dds::core::status::LivelinessLostStatus& status) + * { + * std::cout << "on_liveliness_lost" << std::endl; + * } + * + * virtual void on_publication_matched ( + * dds::pub::AnyDataWriter& writer, + * const dds::core::status::PublicationMatchedStatus& status) + * { + * std::cout << "on_publication_matched" << std::endl; + * } + * + * virtual void on_requested_deadline_missed ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::RequestedDeadlineMissedStatus & status) + * { + * std::cout << "on_requested_deadline_missed" << std::endl; + * } + * + * virtual void on_requested_incompatible_qos ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::RequestedIncompatibleQosStatus & status) + * { + * std::cout << "on_requested_incompatible_qos" << std::endl; + * } + * + * virtual void on_sample_rejected ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::SampleRejectedStatus & status) + * { + * std::cout << "on_sample_rejected" << std::endl; + * } + * + * virtual void on_liveliness_changed ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::LivelinessChangedStatus & status) + * { + * std::cout << "on_liveliness_changed" << std::endl; + * } + * + * virtual void on_data_available ( + * dds::sub::AnyDataReader& reader) + * { + * std::cout << "on_data_available" << std::endl; + * } + * + * virtual void on_subscription_matched ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::SubscriptionMatchedStatus & status) + * { + * std::cout << "on_subscription_matched" << std::endl; + * } + * + * virtual void on_sample_lost ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::SampleLostStatus & status) + * { + * std::cout << "on_sample_lost" << std::endl; + * } + * + * virtual void on_data_on_readers ( + * dds::sub::Subscriber& subs) + * { + * std::cout << "on_data_on_readers" << std::endl; + * } + * }; + * + * // Create DomainParticipant with the listener + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id(), + * dds::domain::DomainParticipant::default_participant_qos(), + * new ExampleListener(), + * dds::core::status::StatusMask::all()); + * + * @endcode + * + * @see for more information: @ref DCPS_Modules_DomainParticipant "Domain Participant" + * @see for more information: @ref DCPS_Modules_Infrastructure_Listener "Listener information" + */ +class OMG_DDS_API DomainParticipantListener : + public virtual dds::pub::PublisherListener, + public virtual dds::sub::SubscriberListener, + public virtual dds::topic::AnyTopicListener +{ +public: + /** @cond */ + virtual ~DomainParticipantListener() { } + /** @endcond */ +}; + + +/** + * @brief + * DomainParticipant events Listener + * + * This listener is just like DomainParticipantListener, except + * that the application doesn't have to implement all operations. + * + * @code{.cpp} + * class ExampleListener : + * public virtual dds::domain::NoOpDomainParticipantListener + * { + * // Not necessary to implement any Listener operations. + * }; + * @endcode + * + * @see dds::domain::DomainParticipantListener + */ +class OMG_DDS_API NoOpDomainParticipantListener : + public virtual DomainParticipantListener, + public virtual dds::pub::NoOpPublisherListener, + public virtual dds::sub::NoOpSubscriberListener, + public virtual dds::topic::NoOpAnyTopicListener +{ +public: + /** @cond */ + virtual ~NoOpDomainParticipantListener() { } + /** @endcond */ +}; + +DDSCXX_WARNING_MSVC_ON(4250) + +} +} + +#endif /* OMG_DDS_DOMAIN_DOMAINPARTICIPANT_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/domain/TDomainParticipant.hpp b/unitree_SDK/include/ddscxx/dds/domain/TDomainParticipant.hpp new file mode 100644 index 0000000..1ebb56f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/domain/TDomainParticipant.hpp @@ -0,0 +1,521 @@ +#ifndef OMG_TDDS_DOMAIN_DOMAIN_PARTICIPANT_HPP_ +#define OMG_TDDS_DOMAIN_DOMAIN_PARTICIPANT_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +#include +#include +#include +#include +#include +//#include +#include + +#include + +#include +#include + + +namespace dds +{ +namespace domain +{ + +template +class TDomainParticipant; + +class DomainParticipantListener; +} +} + +/** + * @brief + * A DomainParticipant represents the local membership of the application in a + * Domain. + * + * The DomainParticipant represents the participation of the application on + * a communication plane that isolates applications running on the same + * set of physical computers from each other. A domain establishes a virtual + * network linking all applications that share the same domainId and isolating + * them from applications running on different domains. In this way, several + * independent distributed applications can coexist in the same physical + * network without interfering, or even being aware of each other. + * + * @see for more information: @ref DCPS_Modules_DomainParticipant "Domain Participant" + */ +template +class dds::domain::TDomainParticipant : public ::dds::core::TEntity +{ +public: + /** + * Local representation of the dds::domain::DomainParticipantListener + */ + typedef dds::domain::DomainParticipantListener Listener; + +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TDomainParticipant, dds::core::TEntity, DELEGATE) + OMG_DDS_EXPLICIT_REF_BASE(TDomainParticipant, dds::core::Entity) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(TDomainParticipant) + +public: + /** + * Creates a new DomainParticipant object. The DomainParticipant signifies + * that the calling application intends to join the Domain identified by + * the domain_id argument. + * + * The DomainParticipant will be created with the QoS values specified on the last + * successful call to + * @link dds::domain::DomainParticipant::default_participant_qos(const ::dds::domain::qos::DomainParticipantQos& qos) + * DomainParticipant::default_publisher_qos(qos) @endlink or, if the call was never + * made, the @ref anchor_dds_domain_domainparticipant_qos_defaults "default" values. + * + * @param id the id of the domain joined by the new DomainParticipant + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + TDomainParticipant(uint32_t id); + + /** + * Creates a new DomainParticipant object. The DomainParticipant signifies + * that the calling application intends to join the Domain identified by + * the domain_id argument. + * + * The DomainParticipant will be created with the DomainParticipantQos + * passed as an argument. + * + * It is possible to provide a specific configuration. + * Please be aware that the given domain_id always takes precedence over + * the configuration. Also, if a domain with the same ID was created + * previously (either through the config argument, environment var or + * default), that configuration is used. + * + * | id | config | in config | previous | result | + * +----+--------+-----------+----------+-------------------------------+ + * | n | no | n.a. | no | n, environment/default config | + * | n | no | n.a. | yes | n, previous config | + * | n | yes | no | no | n, default config (with n id) | + * | n | yes | yes/any | no | n, given config | + * | n | yes | no | yes | n, previous config | + * | n | yes | yes/any | yes | n, previous config | + * + * @param id the id of the domain joined by the new DomainParticipant + * @param qos the QoS settings for the new DomainParticipant + * @param listener the listener + * @param event_mask the mask defining the events for which the listener + * will be notified. + * @param config when not empty, the value is used as either the name + * of the file containing the configuration or, when it + * starts with '<', taken to be the XML representation + * of the configuration. When not empty, the id argument of + * this constructor has to have a specific value and can not + * be org::eclipse::cyclonedds::domain::default_id(). + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + TDomainParticipant(uint32_t id, + const dds::domain::qos::DomainParticipantQos& qos, + dds::domain::DomainParticipantListener* listener = NULL, + const dds::core::status::StatusMask& event_mask = dds::core::status::StatusMask::none(), + const std::string& config = std::string()); + + TDomainParticipant(uint32_t id, + const dds::domain::qos::DomainParticipantQos& qos, + dds::domain::DomainParticipantListener* listener, + const dds::core::status::StatusMask& event_mask, + const ddsi_config& config); + +public: + + /** + * Register a listener with the DomainParticipant. + * + * The notifications received by the listener depend on the + * status mask with which it was registered. + * + * Listener un-registration is performed by setting the listener to NULL. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @param listener the listener + * @param event_mask the mask defining the events for which the listener + * will be notified. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * A status was selected that cannot be supported because + * the infrastructure does not maintain the required connectivity information. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void listener(Listener* listener, + const ::dds::core::status::StatusMask& event_mask); + + /** + * Get the listener of this DomainParticipant. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @return the listener + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + */ + Listener* listener() const; + + /** + * Gets the DomainParticipantQos setting for this instance. + * + * @return the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + const dds::domain::qos::DomainParticipantQos& qos() const; + + /** + * Sets the DomainParticipantQos setting for this instance. + * + * @param qos the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void qos(const dds::domain::qos::DomainParticipantQos& qos); + + /** + * This operation retrieves the domain_id used to create the + * DomainParticipant. The domain_id identifies the DDS domain + * to which the DomainParticipant belongs. + * + * Each DDS domain represents a separate data communication + * plane isolated from other domains. + * + * @return the domain id + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + uint32_t domain_id() const; + + + /** + * This operation will manually assert the liveliness for the DomainParticipant. + * + * This way, the Data Distribution Service is informed that the DomainParticipant + * is still alive. This operation only needs to be used when the DomainParticipant + * contains DataWriters with the dds:core::policy::LivelinessQosPolicy::ManualByParticipant(), + * and it will only affect the liveliness of those DataWriters. + * + * Writing data via the write operation of a DataWriter will assert the liveliness on + * the DataWriter itself and its DomainParticipant. Therefore, + * assert_liveliness is only needed when not writing regularly. + * The liveliness should be asserted by the application, depending on the + * LivelinessQosPolicy. + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + void assert_liveliness(); + + + /** + * This operation checks whether or not the given handle represents + * an Entity that was created by using this DomainParticipant. + * + * The containment applies recursively. That is, it applies both to + * entities (TopicDescription, Publisher, or Subscriber) created directly + * using the DomainParticipant as well as entities created using a + * contained Publisher, or Subscriber as the factory, and so forth. + * + * @param handle the instance handle for which the containement + * relationship has to be checked + * @return true if the handle belongs to an Entity belonging + * to this DomainParticipant + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + bool contains_entity(const ::dds::core::InstanceHandle& handle); + + /** + * This operation returns the current value of the time that the service + * uses to time-stamp data writes and to set the reception timestamp + * for the data updates it receives. + * + * @return the current time + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + dds::core::Time current_time() const; + + /** @copydoc dds::domain::DomainParticipant::qos(const dds::domain::qos::DomainParticipantQos& qos) */ + TDomainParticipant& operator << (const dds::domain::qos::DomainParticipantQos& qos); + + /** @copydoc dds::domain::DomainParticipant::qos() */ + const TDomainParticipant& operator >> (dds::domain::qos::DomainParticipantQos& qos) const; + +public: + /** + * Gets the default DomainParticipantQos. + * + * This operation gets an object with the default global DomainParticipant + * QosPolicy settings which is used for newly + * created DomainParticipant objects, in case no QoS was provided during the creation. + * + * The values retrieved by this operation match the set of values specified on the last + * successful call to + * dds::domain::DomainParticipant::default_participant_qos(const ::dds::domain::qos::DomainParticipantQos& qos), + * or, if the call was never made, the @ref anchor_dds_domain_domainparticipant_qos_defaults "default" values. + * + * @return the default DomainParticipantQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + static dds::domain::qos::DomainParticipantQos default_participant_qos(); + + /** + * Sets the default DomainParticipantQos. + * + * This QoS will be used by all following DomainParticipant creations when no + * QoS was given during those creations or the QoS is given that was returned + * by dds::domain::DomainParticipant::default_participant_qos(). + * + * @param qos the default DomainParticipantQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + static void default_participant_qos(const ::dds::domain::qos::DomainParticipantQos& qos); + + /** + * Gets the default PublisherQos of the DomainParticipant. + * + * This operation gets an object with the default Publisher QosPolicy settings of + * the DomainParticipant (that is the PublisherQos) which is used for newly + * created Publisher objects, in case no QoS was provided during the creation. + * + * The values retrieved by this operation match the set of values specified on the last + * successful call to + * dds::domain::DomainParticipant::default_publisher_qos(const ::dds::pub::qos::PublisherQos& qos), + * or, if the call was never made, the @ref anchor_dds_pub_publisher_qos_defaults "default" values. + * + * @return the default PublisherQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::pub::qos::PublisherQos default_publisher_qos() const; + + /** + * Sets the default PublisherQos of the DomainParticipant. + * + * This operation sets the default PublisherQos of the DomainParticipant which + * is used for newly created Publisher objects, when no QoS is provided. + * + * The PublisherQos is always self consistent, because its policies do not depend on each + * other. This means that this operation never throws dds::core::InconsistentPolicyError. + * + * The values set by this operation are returned by dds::domain::DomainParticipant::default_publisher_qos(). + * + * @param qos the default PublisherQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * One or more of the selected QosPolicy values are + * currently not supported by OpenSplice. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + TDomainParticipant& default_publisher_qos(const ::dds::pub::qos::PublisherQos& qos); + + /** + * Gets the default SubscriberQos of the DomainParticipant. + * + * This operation gets an object with the default Subscriber QosPolicy settings of + * the DomainParticipant (that is the SubscriberQos) which is used for newly + * created Subscriber objects, in case no QoS was provided during the creation. + * + * The values retrieved by this operation match the set of values specified on the last + * successful call to + * dds::domain::DomainParticipant::default_subscriber_qos(const :dds::sub::qos::SubscriberQos& qos), + * or, if the call was never made, the @ref anchor_dds_sub_subscriber_qos_defaults "default" values. + * + * @return the default SubscriberQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::sub::qos::SubscriberQos default_subscriber_qos() const; + + /** + * Sets the default SubscriberQos of the DomainParticipant. + * + * This operation sets the default SubscriberQos of the DomainParticipant which + * is used for newly created Subscriber objects, when no QoS is provided. + * + * The SubscriberQos is always self consistent, because its policies do not depend on each + * other. This means that this operation never throws dds::core::InconsistentPolicyError. + * + * The values set by this operation are returned by dds::domain::DomainParticipant::default_subscriber_qos(). + * + * @param qos the default SubscriberQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * One or more of the selected QosPolicy values are + * currently not supported by OpenSplice. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + TDomainParticipant& default_subscriber_qos(const ::dds::sub::qos::SubscriberQos& qos); + + /** + * Gets the default TopicQos of the DomainParticipant. + * + * This operation gets an object with the default Topic QosPolicy settings of + * the DomainParticipant (that is the TopicQos) which is used for newly + * created Topic objects, in case no QoS was provided during the creation. + * + * The values retrieved by this operation match the set of values specified on the last + * successful call to + * dds::domain::DomainParticipant::default_topic_qos(const dds::topic::qos::TopicQos& qos), + * or, if the call was never made, the @ref anchor_dds_topic_qos_defaults "default" values. + * + * @return the default TopicQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::topic::qos::TopicQos default_topic_qos() const; + + /** + * Sets the default TopicQos of the DomainParticipant. + * + * This operation sets the default SubscriberQos of the DomainParticipant which + * is used for newly created Subscriber objects, when no QoS is provided. + * + * This operation checks if the TopicQos is self consistent. If it is not, the + * operation has no effect and throws dds::core::InconsistentPolicyError. + * + * The values set by this operation are returned by dds::domain::DomainParticipant::default_topic_qos(). + * + * @param qos the default TopicQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * One or more of the selected QosPolicy values are + * currently not supported by OpenSplice. + * @throws dds::core::InconsistentPolicyError + * The parameter qos contains conflicting QosPolicy settings, + * e.g. a history depth that is higher than the specified resource limits. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + TDomainParticipant& default_topic_qos(const dds::topic::qos::TopicQos& qos); + + //============================================================================= +}; + + +#endif /* OMG_TDDS_DOMAIN_DOMAIN_PARTICIPANT_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/domain/ddsdomain.hpp b/unitree_SDK/include/ddscxx/dds/domain/ddsdomain.hpp new file mode 100644 index 0000000..06a6466 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/domain/ddsdomain.hpp @@ -0,0 +1,27 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_DOMAIN_PACKAGE_INCLUDE_HPP_ +#define OMG_DDS_DOMAIN_PACKAGE_INCLUDE_HPP_ + +#include +#include +#include + +#include + +#endif /* OMG_DDS_DOMAIN_PACKAGE_INCLUDE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/domain/detail/DomainParticipant.hpp b/unitree_SDK/include/ddscxx/dds/domain/detail/DomainParticipant.hpp new file mode 100644 index 0000000..558b370 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/domain/detail/DomainParticipant.hpp @@ -0,0 +1,35 @@ +#ifndef OMG_DDS_DOMAIN_DETAIL_DOMAINPARTICIPANT_HPP_ +#define OMG_DDS_DOMAIN_DETAIL_DOMAINPARTICIPANT_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +//#include +//#include + +namespace dds { + namespace domain { + namespace detail { + typedef dds::domain::TDomainParticipant< org::eclipse::cyclonedds::domain::DomainParticipantDelegate > + DomainParticipant; + } + } +} + +#endif /* OMG_DDS_DOMAIN_DETAIL_DOMAINPARTICIPANT_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/domain/detail/TDomainParticipantImpl.hpp b/unitree_SDK/include/ddscxx/dds/domain/detail/TDomainParticipantImpl.hpp new file mode 100644 index 0000000..ec763f2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/domain/detail/TDomainParticipantImpl.hpp @@ -0,0 +1,193 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_DOMAIN_TDOMAINPARTICIPANT_IMPL_HPP_ +#define CYCLONEDDS_DDS_DOMAIN_TDOMAINPARTICIPANT_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include +#include +#include + + +// Implementation + +namespace dds +{ +namespace domain +{ + +template +TDomainParticipant::TDomainParticipant(uint32_t did): + ::dds::core::Reference( + new DELEGATE(did, + org::eclipse::cyclonedds::domain::DomainParticipantDelegate::default_participant_qos(), + NULL, + dds::core::status::StatusMask::none(), + std::string())) +{ + this->delegate()->init(this->impl_); + org::eclipse::cyclonedds::domain::DomainParticipantRegistry::insert(*this); +} + +template +TDomainParticipant::TDomainParticipant(uint32_t id, + const dds::domain::qos::DomainParticipantQos& qos, + dds::domain::DomainParticipantListener* listener, + const dds::core::status::StatusMask& mask, + const std::string& config) : + ::dds::core::Reference(new DELEGATE(id, qos, listener, mask, config)) +{ + this->delegate()->init(this->impl_); + org::eclipse::cyclonedds::domain::DomainParticipantRegistry::insert(*this); +} + +template +TDomainParticipant::TDomainParticipant(uint32_t id, + const dds::domain::qos::DomainParticipantQos& qos, + dds::domain::DomainParticipantListener* listener, + const dds::core::status::StatusMask& mask, + const ddsi_config& config) : + ::dds::core::Reference(new DELEGATE(id, qos, listener, mask, config)) +{ + this->delegate()->init(this->impl_); + org::eclipse::cyclonedds::domain::DomainParticipantRegistry::insert(*this); +} + +template +void TDomainParticipant::listener(Listener* listener, + const ::dds::core::status::StatusMask& event_mask) +{ + this->delegate()->listener(listener, event_mask); +} + +template +typename TDomainParticipant::Listener* TDomainParticipant::listener() const +{ + return this->delegate()->listener(); +} + +template +const dds::domain::qos::DomainParticipantQos& +TDomainParticipant::qos() const +{ + return this->delegate()->qos(); +} + +template +void TDomainParticipant::qos(const dds::domain::qos::DomainParticipantQos& qos) +{ + this->delegate()->qos(qos); +} + +template +uint32_t TDomainParticipant::domain_id() const +{ + return this->delegate()->domain_id(); +} + +template +void TDomainParticipant::assert_liveliness() +{ + this->delegate()->assert_liveliness(); +} + +template +bool TDomainParticipant::contains_entity(const ::dds::core::InstanceHandle& handle) +{ + return this->delegate()->contains_entity(handle); +} + +template +dds::core::Time TDomainParticipant::current_time() const +{ + return this->delegate()->current_time(); +} + +template +dds::domain::qos::DomainParticipantQos TDomainParticipant::default_participant_qos() +{ + return DELEGATE::default_participant_qos(); +} + +template +void TDomainParticipant::default_participant_qos(const ::dds::domain::qos::DomainParticipantQos& qos) +{ + DELEGATE::default_participant_qos(qos); +} + +template +dds::pub::qos::PublisherQos TDomainParticipant::default_publisher_qos() const +{ + return this->delegate()->default_publisher_qos(); +} + +template +TDomainParticipant& TDomainParticipant::default_publisher_qos( + const ::dds::pub::qos::PublisherQos& qos) +{ + this->delegate()->default_publisher_qos(qos); + return *this; +} + +template +dds::sub::qos::SubscriberQos TDomainParticipant::default_subscriber_qos() const +{ + return this->delegate()->default_subscriber_qos(); +} + +template +TDomainParticipant& TDomainParticipant::default_subscriber_qos( + const ::dds::sub::qos::SubscriberQos& qos) +{ + this->delegate()->default_subscriber_qos(qos); + return *this; +} + +template +dds::topic::qos::TopicQos TDomainParticipant::default_topic_qos() const +{ + return this->delegate()->default_topic_qos(); +} + +template +TDomainParticipant& TDomainParticipant::default_topic_qos(const dds::topic::qos::TopicQos& qos) +{ + this->delegate()->default_topic_qos(qos); + return *this; +} + +template +TDomainParticipant& TDomainParticipant::operator << (const dds::domain::qos::DomainParticipantQos& qos) +{ + this->qos(qos); + return *this; +} + +template +const TDomainParticipant& TDomainParticipant::operator >> (dds::domain::qos::DomainParticipantQos& qos) const +{ + qos = this->qos(); + return *this; +} + +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_DOMAIN_TDOMAINPARTICIPANT_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/domain/detail/ddsdomain.hpp b/unitree_SDK/include/ddscxx/dds/domain/detail/ddsdomain.hpp new file mode 100644 index 0000000..251e3e5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/domain/detail/ddsdomain.hpp @@ -0,0 +1,17 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_DOMAIN_PACKAGE_DETAIL_INCLUDE_HPP_ +#define OMG_DDS_DOMAIN_PACKAGE_DETAIL_INCLUDE_HPP_ + +/* Nothing to 'post' include. */ + +#endif /* OMG_DDS_DOMAIN_PACKAGE_DETAIL_INCLUDE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/domain/discovery.hpp b/unitree_SDK/include/ddscxx/dds/domain/discovery.hpp new file mode 100644 index 0000000..b844abf --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/domain/discovery.hpp @@ -0,0 +1,70 @@ +#ifndef OMG_DDS_DOMAIN_DISCOVERY_HPP_ +#define OMG_DDS_DOMAIN_DISCOVERY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +#include +#include + + +namespace dds +{ +namespace domain +{ + +/** + * This function enables you to ignore the entity + * represented by the given InstanceHandle for the specific + * DomainParticipant. + * + * This operation is not yet implemented. It is scheduled for a future release. + * + * @param dp the DomainParticipant for which the remote + * entity will be ignored + * + * @param handle the InstanceHandle of the remote entity that + * has to be ignored + * + */ +void OMG_DDS_API ignore(const dds::domain::DomainParticipant& dp, const dds::core::InstanceHandle& handle); + +/** + * This function enables you to ignore a series of entities + * whose instance handles are made available via the provided iterators. + * + * This operation is not yet implemented. It is scheduled for a future release. + * + * @param dp the DomainParticipant for which the remote + * entity will be ignored + * + * @param begin the begin iterator for the InstanceHandle + * to ignore + * + * @param end the end iterator for the InstanceHandle + * to ignore + * + */ +template +void ignore(const dds::domain::DomainParticipant& dp, FwdIterator begin, FwdIterator end); + + +} +} +#endif /* OMG_DDS_DOMAIN_DISCOVERY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/domain/find.hpp b/unitree_SDK/include/ddscxx/dds/domain/find.hpp new file mode 100644 index 0000000..f75b249 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/domain/find.hpp @@ -0,0 +1,43 @@ +#ifndef OMG_DDS_DOMAIN_FIND_HPP_ +#define OMG_DDS_DOMAIN_FIND_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace domain +{ + + +/** + * This operation retrieves a previously-created DomainParticipant + * belonging to the specified domain_id. If no such DomainParticipant + * exists, the operation will return a dds::core::null DomainParticipant. + * + * @param id the domain id + */ +OMG_DDS_API +DomainParticipant find(uint32_t id); + +} +} + +#endif /* OMG_DDS_DOMAIN_FIND_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/domain/qos/DomainParticipantQos.hpp b/unitree_SDK/include/ddscxx/dds/domain/qos/DomainParticipantQos.hpp new file mode 100644 index 0000000..21d42b4 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/domain/qos/DomainParticipantQos.hpp @@ -0,0 +1,35 @@ +#ifndef OMG_DDS_DOMAIN_QOS_DOMAINPARTICIPANTQOS_HPP_ +#define OMG_DDS_DOMAIN_QOS_DOMAINPARTICIPANTQOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace domain +{ +namespace qos +{ +typedef dds::domain::qos::detail::DomainParticipantQos DomainParticipantQos; +} +} +} + +#endif /* OMG_DDS_DOMAIN_QOS_DOMAINPARTICIPANTQOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/domain/qos/detail/DomainParticipantQos.hpp b/unitree_SDK/include/ddscxx/dds/domain/qos/detail/DomainParticipantQos.hpp new file mode 100644 index 0000000..fbf1527 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/domain/qos/detail/DomainParticipantQos.hpp @@ -0,0 +1,89 @@ +#ifndef OMG_DDS_DOMAIN_QOS_DETAIL_DOMAINPARTICIPANTQOS_HPP_ +#define OMG_DDS_DOMAIN_QOS_DETAIL_DOMAINPARTICIPANTQOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +#include +#include + +#ifdef DOXYGEN_FOR_ISOCPP +/* The above macro is never (and must never) be defined in normal compilation. + * + * The class below is just used to create informative API documentation. + * The predoxygen.py script will copy this over the QoS API header file. + */ + +/** + * @brief + * This class provides the basic mechanism for an application to specify Quality of + * Service attributes for a DomainParticipant. + * + * @par Attributes + * @anchor anchor_dds_domain_domainparticipant_qos_defaults + * QosPolicy | Desciption | Default Value + * --------------------------------------------------- | -------------------------------------------------------| -------------------- + * dds::core::policy::UserData | Additional information (@ref DCPS_QoS_UserData "info") | UserData::UserData(empty) + * dds::core::policy::EntityFactory | Create enabled (@ref DCPS_QoS_EntityFactory "info") | EntityFactory::AutoEnable() + * + * A QosPolicy can be set when the DomainParticipant is created or modified with the + * set qos operations. + * Both operations take the DomainParticipantQos object as a parameter. There may be + * cases where several policies are in conflict. Consistency checking is performed each + * time the policies are modified when they are being created and, in case they are + * already enabled, via the set qos operation. + * + * Some QosPolicy have "immutable" semantics meaning that they can only be + * specified either at DomainParticipant creation time or prior to calling the enable + * operation on the DomainParticipant. + * + * @see for more information: @ref DCPS_QoS + */ +class dds::domain::qos::DomainParticipantQos : public ::dds::core::EntityQos +{ +public: + /** + * Create @ref anchor_dds_domain_domainparticipant_qos_defaults "default" QoS. + */ + DomainParticipantQos() {} + + /** + * Create QoS with policies copied from the given QoS. + * + * @param qos the QoS to copy policies from. + */ + DomainParticipantQos(const DomainParticipantQos& qos); +}; + +#else /* DOXYGEN_FOR_ISOCPP */ + +namespace dds { + namespace domain { + namespace qos { + namespace detail { + typedef ::dds::core::TEntityQos< ::org::eclipse::cyclonedds::domain::qos::DomainParticipantQosDelegate > + DomainParticipantQos; + } + } + } +} + +#endif /* DOXYGEN_FOR_ISOCPP */ + +#endif /* OMG_DDS_DOMAIN_QOS_DETAIL_DOMAINPARTICIPANTQOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/features.hpp b/unitree_SDK/include/ddscxx/dds/features.hpp new file mode 100644 index 0000000..c7bf816 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/features.hpp @@ -0,0 +1,16 @@ +#ifndef __OMG_DDS_DDSCXX_FEATURES_HPP__ +#define __OMG_DDS_DDSCXX_FEATURES_HPP__ + +/* Whether or not support for shared memory is included */ +/* #undef DDSCXX_HAS_SHM */ + +/* Whether or not support for type discovery is included */ +#define DDSCXX_HAS_TYPE_DISCOVERY 1 + +/* Whether or not support for topic discovery is included */ +#define DDSCXX_HAS_TOPIC_DISCOVERY 1 + +/* Whether to use boost for c++11 compatibility or not */ +/* #undef DDSCXX_USE_BOOST */ + +#endif /* __OMG_DDS_DDSCXX_FEATURES_HPP__ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/AnyDataWriter.hpp b/unitree_SDK/include/ddscxx/dds/pub/AnyDataWriter.hpp new file mode 100644 index 0000000..2cb049b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/AnyDataWriter.hpp @@ -0,0 +1,32 @@ +#ifndef OMG_DDS_PUB_ANY_DATA_WRITER_HPP_ +#define OMG_DDS_PUB_ANY_DATA_WRITER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace pub +{ +typedef ::dds::pub::detail::AnyDataWriter AnyDataWriter; +} +} + +#endif /* OMG_DDS_PUB_ANY_DATA_WRITER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/AnyDataWriterListener.hpp b/unitree_SDK/include/ddscxx/dds/pub/AnyDataWriterListener.hpp new file mode 100644 index 0000000..380201f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/AnyDataWriterListener.hpp @@ -0,0 +1,120 @@ +#ifndef OMG_DDS_PUB_ANY_DATA_WRITER_LISTENER_HPP_ +#define OMG_DDS_PUB_ANY_DATA_WRITER_LISTENER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace pub +{ +class AnyDataWriterListener; +class NoOpAnyDataWriterListener; +} +} + + +/** + * @brief + * AnyDataWriter events Listener + * + * Because Publisher and DomainParticipant do not have knowledge of data types, + * they have to use non-data-type-listeners. In other words Any* listeners. + * + * + * All operations for this interface must be implemented in the user-defined class, it is + * up to the application whether an operation is empty or contains some functionality. + * + * This class is used as a base for other listeners and is not used on its own. + * + * + * @see dds::pub::PublisherListener + * @see dds::domain::DomainParticipantListener + */ +class OMG_DDS_API dds::pub::AnyDataWriterListener +{ +public: + /** @cond */ + virtual ~AnyDataWriterListener() { } + /** @endcond */ + +public: + /** @copydoc dds::pub::DataWriterListener::on_offered_deadline_missed() */ + virtual void on_offered_deadline_missed(dds::pub::AnyDataWriter& writer, + const ::dds::core::status::OfferedDeadlineMissedStatus& status) = 0; + + /** @copydoc dds::pub::DataWriterListener::on_offered_incompatible_qos() */ + virtual void on_offered_incompatible_qos(dds::pub::AnyDataWriter& writer, + const ::dds::core::status::OfferedIncompatibleQosStatus& status) = 0; + + /** @copydoc dds::pub::DataWriterListener::on_liveliness_lost() */ + virtual void on_liveliness_lost(dds::pub::AnyDataWriter& writer, + const ::dds::core::status::LivelinessLostStatus& status) = 0; + + /** @copydoc dds::pub::DataWriterListener::on_publication_matched() */ + virtual void on_publication_matched(dds::pub::AnyDataWriter& writer, + const ::dds::core::status::PublicationMatchedStatus& status) = 0; + +}; + + +/** + * @brief + * AnyDataWriter events Listener + * + * This listener is just like AnyDataWriterListener, except + * that the application doesn't have to implement all operations. + * + * This class is used as a base for other listeners and is not used on its own. + * + * @see dds::pub::AnyDataWriterListener + * @see dds::pub::NoOpPublisherListener + * @see dds::domain::NoOpDomainParticipantListener + */ +class OMG_DDS_API dds::pub::NoOpAnyDataWriterListener : public virtual dds::pub::AnyDataWriterListener +{ +/** @cond + * All these functions have already been documented in the non-NoOp listener. + * Ignore these functions for the doxygen API documentation for clarity. + */ +public: + virtual ~NoOpAnyDataWriterListener() { } + +public: + virtual void on_offered_deadline_missed( + dds::pub::AnyDataWriter&, + const ::dds::core::status::OfferedDeadlineMissedStatus&) { } + + virtual void on_offered_incompatible_qos( + dds::pub::AnyDataWriter&, + const ::dds::core::status::OfferedIncompatibleQosStatus&) { } + + virtual void on_liveliness_lost( + dds::pub::AnyDataWriter&, + const ::dds::core::status::LivelinessLostStatus&) { } + + virtual void on_publication_matched( + dds::pub::AnyDataWriter&, + const ::dds::core::status::PublicationMatchedStatus&) { } +/** @endcond */ +}; + + +#endif /* OMG_DDS_PUB_ANY_DATA_WRITER_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/CoherentSet.hpp b/unitree_SDK/include/ddscxx/dds/pub/CoherentSet.hpp new file mode 100644 index 0000000..2dc37c8 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/CoherentSet.hpp @@ -0,0 +1,32 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_PUB_COHERENT_SET_HPP_ +#define OMG_DDS_PUB_COHERENT_SET_HPP_ + +#include + +namespace dds +{ +namespace pub +{ +typedef dds::pub::detail::CoherentSet CoherentSet; +} +} + + +#endif /* OMG_DDS_PUB_COHERENT_SET_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/DataWriter.hpp b/unitree_SDK/include/ddscxx/dds/pub/DataWriter.hpp new file mode 100644 index 0000000..539cfef --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/DataWriter.hpp @@ -0,0 +1,1534 @@ +#ifndef OMG_DDS_PUB_DATA_WRITER_HPP_ +#define OMG_DDS_PUB_DATA_WRITER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +//#include +#include +#include + +#include + +/** @cond */ +namespace dds +{ +namespace pub +{ +template class DELEGATE = dds::pub::detail::DataWriter > +class DataWriter; + +template class DataWriterListener; +} +} +/** @endcond */ + +/** + * @brief + * DataWriter allows the application to set the value of the sample to be published + * under a given Topic. + * + * A DataWriter is attached to exactly one Publisher. + * + * A DataWriter is bound to exactly one Topic and therefore to exactly one data + * type. The Topic must exist prior to the DataWriter's creation. + * DataWriter is an abstract class. It must be specialized for each particular + * application data type. For a fictional application data type Bar (defined in the + * module Foo) the specialized class would be dds::pub::DataWriter. + * + * The pre-processor generates from IDL type descriptions the application + * DataWriter classes. For each application data type that is used as Topic + * data type, a typed class DataWriter is derived from the AnyDataWriter + * class. + * + * For instance, for an application, the definitions are located in the Foo.idl file. + * The pre-processor will generate a ccpp_Foo.h include file. + * + * General note: The name ccpp_Foo.h is derived from the IDL file Foo.idl, + * that defines Foo::Bar, for all relevant DataWriter operations. + * + * @note Apart from idl files, Google protocol buffers are also supported. For the + * API itself, it doesn't matter if the type header files were generated from + * idl or protocol buffers. The resulting API usage and includes remain the same. + * + * @code{.cpp} + * // Default creation of a DataWriter + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::pub::Publisher publisher(participant); + * dds::pub::DataWriter writer(publisher, topic); + * + * // Default write of a sample on the DataWriter + * Foo::Bar sample; + * writer.write(sample); + * @endcode + * + * @see for more information: @ref DCPS_Modules_Publication "Publication concept" + * @see for more information: @ref DCPS_Modules_Publication_DataWriter "DataWriter concept" + */ +template class DELEGATE> +class dds::pub::DataWriter : public ::dds::pub::TAnyDataWriter< DELEGATE > +{ + +public: + /** + * Local convenience typedef for dds::pub::DataWriterListener. + */ + typedef dds::pub::DataWriterListener Listener; + +public: + OMG_DDS_REF_TYPE_PROTECTED_DC_T(DataWriter, dds::pub::TAnyDataWriter, T, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(DataWriter) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(DataWriter) + +public: + + /** + * Create a new DataWriter for the desired Topic, using the given Publisher. + * + * The DataWriter will be created with the QoS values specified on the last + * successful call to @link dds::pub::Publisher::default_datawriter_qos(const dds::pub::qos::DataWriterQos& qos) + * pub.default_datawriter_qos(qos) @endlink or, if the call was never made, the + * @ref anchor_dds_pub_datawriter_qos_defaults "default" values. + * + * @param pub the Publisher that will contain this DataWriter + * @param topic the Topic associated with this DataWriter + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + DataWriter(const dds::pub::Publisher& pub, + const ::dds::topic::Topic& topic); + + /** + * Create a new DataWriter for the desired Topic, using the given Publisher and + * DataWriterQos and attaches the optionally specified DataWriterListener to it. + * + * QoS
      + * A possible application pattern to construct the DataWriterQos for the + * DataWriter is to: + * @code{.cpp} + * // 1) Retrieve the QosPolicy settings on the associated Topic + * dds::topic::qos::TopicQos topicQos = topic.qos(); + * // 2) Retrieve the default DataWriterQos from the related Publisher + * dds::pub::qos::DataWriterQos writerQos = publisher.default_datawriter_qos(); + * // 3) Combine those two lists of QosPolicy settings by overwriting DataWriterQos + * // policies that are also present TopicQos + * writerQos = topicQos; + * // 4) Selectively modify QosPolicy settings as desired. + * writerQos << dds::core::policy::WriterDataLifecycle::ManuallyDisposeUnregisteredInstances(); + * // 5) Use the resulting QoS to construct the DataWriter. + * dds::pub::DataWriter writer(publisher, topic, writerQos); + * @endcode + * + * Listener
      + * The following statuses are applicable to the DataWriterListener: + * - dds::core::status::StatusMask::offered_deadline_missed() + * - dds::core::status::StatusMask::offered_incompatible_qos() + * - dds::core::status::StatusMask::liveliness_lost() + * - dds::core::status::StatusMask::publication_matched() + * + * See @ref DCPS_Modules_Infrastructure_Listener "listener concept", + * @ref anchor_dds_pub_datawriter_commstatus "communication status" and + * @ref anchor_dds_pub_datawriter_commpropagation "communication propagation" + * for more information. + * + * @param pub the Publisher that will contain this DataWriter + * @param topic the Topic associated with this DataWriter + * @param qos the DataWriter qos. + * @param listener the DataWriter listener. + * @param mask the listener event mask. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::InconsistentPolicyError + * The parameter qos contains conflicting QosPolicy settings. + */ + DataWriter(const dds::pub::Publisher& pub, + const ::dds::topic::Topic& topic, + const dds::pub::qos::DataWriterQos& qos, + dds::pub::DataWriterListener* listener = NULL, + const dds::core::status::StatusMask& mask = ::dds::core::status::StatusMask::none()); + + +public: + //========================================================================== + //== Write API + + /** + * This operation modifies the value of a data instance. + * + * Detailed Description
      + * This operation modifies the value of a data instance. When this operation is used, + * the Data Distribution Service will automatically supply the value of the + * source_timestamp that is made available to connected DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * @anchor anchor_dds_pub_datawriter_write_blocking + * Blocking
      + * If the dds::core::policy::History QosPolicy is set to KEEP_ALL, the write + * operation on the DataWriter may block if the modification would cause data to be + * lost because one of the limits, specified in the dds::core::policy::ResourceLimits, is + * exceeded. In case the synchronous attribute value of the + * dds::core::policy::Reliability is set to TRUE for communicating DataWriters and + * DataReaders then the DataWriter will wait until all synchronous + * DataReaders have acknowledged the data. Under these circumstances, the + * max_blocking_time attribute of the dds::core::policy::Reliability configures the + * maximum time the write operation may block (either waiting for space to become + * available or data to be acknowledged). If max_blocking_time elapses before the + * DataWriter is able to store the modification without exceeding the limits and all + * expected acknowledgements are received, the write operation will fail and throw + * TimeoutError. + * + * @param sample the sample to be written + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + void write(const T& sample); + + /** + * This operation modifies the value of a data instance and provides a value for the + * source_timestamp explicitly. + * + * Detailed Description
      + * It modifies the values of the given data instances. When this operation is used, + * the application provides the value for the parameter source_timestamp that is made + * available to connected DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_write_blocking "write blocking"). + * + * @param sample the sample to be written + * @param timestamp the timestamp used for this sample + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + void write(const T& sample, const dds::core::Time& timestamp); + + /** + * This operation modifies the value of a data instance. + * + * Detailed Description
      + * This operation modifies the value of a data instance. When this operation is used, + * the Data Distribution Service will automatically supply the value of the + * source_timestamp that is made available to connected DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Before writing data to an instance, the instance may be registered with the + * @ref dds::pub::DataWriter::register_instance(const T& key) "\"register_instance\"" or + * @ref dds::pub::DataWriter::register_instance(const T& key, const dds::core::Time& timestamp) "\"register_instance_w_timestamp\"" + * The handle returned by one of the register_instance operations can be supplied to + * the parameter handle of the write operation. However, it is also possible to + * supply a default InstanceHandle (InstanceHandle.is_nil() == true), which means + * that the identity of the instance is automatically deduced from the instance_data + * (identified by the key). + * + * @anchor anchor_dds_pub_datawriter_write_instance_handle + * Instance Handle
      + * The default InstanceHandle (InstanceHandle.is_nil() == true) can be used for the + * parameter handle. This indicates the identity of the instance is automatically deduced + * from the instance_data (by means of the key). + * + * If handle is not nil, it must correspond to the value returned by + * @ref dds::pub::DataWriter::register_instance(const T& key) "\"register_instance\"" or + * @ref dds::pub::DataWriter::register_instance(const T& key, const dds::core::Time& timestamp) "\"register_instance_w_timestamp\"" + * when the instance (identified by its key) was registered. Passing such a registered + * handle helps the Data Distribution Service to process the sample more efficiently.
      + * If there is no correspondence between handle and sample, the result of the operation + * is unspecified. + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_write_blocking "write blocking"). + * + * @param sample the sample to be written + * @param instance the handle representing the instance written + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + void write(const T& sample, const ::dds::core::InstanceHandle& instance); + + /** + * This operation modifies the value of a data instance and provides a value for the + * source_timestamp explicitly. + * + * Detailed Description
      + * It modifies the values of the given data instances. When this operation is used, + * the application provides the value for the parameter source_timestamp that is made + * available to connected DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Instance Handle
      + * See @ref anchor_dds_pub_datawriter_write_instance_handle "write instance handle". + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_write_blocking "write blocking"). + * + * @param data the sample to be written + * @param instance the handle representing the instance written + * @param timestamp the timestamp to use for this sample + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + void write(const T& data, + const ::dds::core::InstanceHandle& instance, + const dds::core::Time& timestamp); + + + /** + * This operation modifies the value of a data instance. + * + * Detailed Description
      + * This operation modifies the value of a data instance. When this operation is used, + * the Data Distribution Service will automatically supply the value of the + * source_timestamp that is made available to connected DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Topic Instance
      + * A TopicInstance encapsulates a sample and its associated + * @ref anchor_dds_pub_datawriter_write_instance_handle "instance handle". + * + * + * @param i the instance to write + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + void write(const dds::topic::TopicInstance& i); + + /** + * This operation modifies the value of a data instance and provides a value for the + * source_timestamp explicitly. + * + * Detailed Description
      + * It modifies the values of the given data instances. When this operation is used, + * the application provides the value for the parameter source_timestamp that is made + * available to connected DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Topic Instance
      + * A TopicInstance encapsulates a sample and its associated + * @ref anchor_dds_pub_datawriter_write_instance_handle "instance handle". + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_write_blocking "write blocking"). + * + * @param i the instance to write + * @param timestamp the timestamp for this sample + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + void write(const dds::topic::TopicInstance& i, + const dds::core::Time& timestamp); + + /** + * This operation writes a series of typed Samples or TopicInstances. + * + * Detailed Description
      + * This operation takes a sequence of typed Samples or TopicInstances, which + * is determined by the template specialization. + * + * It modifies the values of the given data instances. When this operation is used, + * the Data Distribution Service will automatically supply the value of the + * source_timestamp that is made available to connected DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Topic Instance
      + * A TopicInstance encapsulates a typed Sample and its associated + * @ref anchor_dds_pub_datawriter_write_instance_handle "instance handle". + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_write_blocking "write blocking"). + * + * @param begin An iterator pointing to the beginning of a sequence of + * Samples or a sequence of TopicInstances + * @param end An iterator pointing to the end of a sequence of + * Samples or a sequence of TopicInstances + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + template + void write(const FWIterator& begin, const FWIterator& end); + + /** + * This operation writes a series of typed Samples or TopicInstances and provides + * a value for the source_timestamp for these samples explicitly. + * + * Detailed Description
      + * This operation takes a sequence of typed Samples or TopicInstances, which + * is determined by the template specialization. + * + * It modifies the values of the given data instances. When this operation is used, + * the application provides the value for the parameter source_timestamp that is made + * available to connected DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Topic Instance
      + * A TopicInstance encapsulates a sample and its associated + * @ref anchor_dds_pub_datawriter_write_instance_handle "instance handle". + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_write_blocking "write blocking"). + * + * @param begin an iterator pointing to the beginning of a sequence of + * TopicInstances + * @param end an iterator pointing to the end of a sequence of + * TopicInstances + * @param timestamp the time stamp + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + template + void write(const FWIterator& begin, const FWIterator& end, + const dds::core::Time& timestamp); + + /** + * This operation writes a series of typed Samples and their parallel instance handles. + * + * Detailed Description
      + * It modifies the values of the given data instances. When this operation is used, + * the Data Distribution Service will automatically supply the value of the + * source_timestamp that is made available to connected DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Instance Handle
      + * See @ref anchor_dds_pub_datawriter_write_instance_handle "write instance handle". + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_write_blocking "write blocking"). + * + * @param data_begin an iterator pointing to the beginning of a sequence of samples + * @param data_end an iterator pointing to the end of a sequence of samples + * @param handle_begin an iterator pointing to the beginning of a sequence of InstanceHandles + * @param handle_end an iterator pointing to the end of a sequence of InstanceHandles + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + template + void write(const SamplesFWIterator& data_begin, + const SamplesFWIterator& data_end, + const HandlesFWIterator& handle_begin, + const HandlesFWIterator& handle_end); + + /** + * This operation writes a series of typed Samples or TopicInstances and provides + * a value for the source_timestamp for these samples explicitly. + * + * Detailed Description
      + * It modifies the values of the given data instances. When this operation is used, + * the application provides the value for the parameter source_timestamp that is made + * available to connected DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Instance Handle
      + * See @ref anchor_dds_pub_datawriter_write_instance_handle "write instance handle". + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_write_blocking "write blocking"). + * + * @param data_begin an iterator pointing to the beginning of a sequence of samples + * @param data_end an iterator pointing to the end of a sequence of samples + * @param handle_begin an iterator pointing to the beginning of a sequence of InstanceHandles + * @param handle_end an iterator pointing to the end of a sequence of InstanceHandles + * @param timestamp the time stamp + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + template + void write(const SamplesFWIterator& data_begin, + const SamplesFWIterator& data_end, + const HandlesFWIterator& handle_begin, + const HandlesFWIterator& handle_end, + const dds::core::Time& timestamp); + + + /** @copydoc dds::pub::DataWriter::write(const T& data) */ + DataWriter& operator << (const T& data); + + /** @copydoc dds::pub::DataWriter::write(const T& sample, const dds::core::Time& timestamp) */ + DataWriter& operator << (const std::pair& data); + + /** @copydoc dds::pub::DataWriter::write(const T& sample, const ::dds::core::InstanceHandle& instance) */ + DataWriter& operator << (const std::pair& data); + + /** @cond + * This can be useful for the DataReader (see fi MaxSamplesManipulatorFunctor), but not + * really for the DataWriter. Leave it from the API documentation for clarity. + */ + DataWriter& operator <<(DataWriter & (*manipulator)(DataWriter&)); + /** @endcond */ + + //========================================================================== + //== Instance Management + + /** + * This operation informs the Data Distribution Service that the application will be + * modifying a particular instance. + * + * Detailed Description
      + * This operation informs the Data Distribution Service that the application will be + * modifying a particular instance. This operation may be invoked prior to calling any + * operation that modifies the instance, such as write, unregister_instance or + * dispose_instance.
      + * When the application does register the instance before modifying, the Data + * Distribution Service will handle the instance more efficiently. It takes as a parameter + * (instance_data) an instance (to get the key value) and returns a handle that can + * be used in successive DataWriter operations. In case of an error, a HANDLE_NIL + * handle (InstanceHandle.is_nil() == true) is returned. + * + * The explicit use of this operation is optional as the application can directly call the + * write, unregister_instance or dispose_instance operations without InstanceHandle, + * which indicate that the sample should be examined to identify the instance. + * + * When this operation is used, the Data Distribution Service will automatically supply + * the value of the source_timestamp that is made available to connected + * DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * @anchor anchor_dds_pub_datawriter_register_blocking + * Blocking
      + * If the dds::core::policy::History QosPolicy is set to KEEP_ALL, the register_instance + * operation on the DataWriter may block if the modification would cause data to be + * lost because one of the limits, specified in the dds::core::policy::ResourceLimits, is + * exceeded. In case the synchronous attribute value of the + * dds::core::policy::Reliability is set to TRUE for communicating DataWriters and + * DataReaders then the DataWriter will wait until all synchronous + * DataReaders have acknowledged the data. Under these circumstances, the + * max_blocking_time attribute of the dds::core::policy::Reliability configures the + * maximum time the register operation may block (either waiting for space to become + * available or data to be acknowledged). If max_blocking_time elapses before the + * DataWriter is able to store the modification without exceeding the limits and all + * expected acknowledgements are received, the register_instance operation will fail + * will return a nil InstanceHandle. + * + * Multiple Calls
      + * If this operation is called for an already registered instance, it just returns the already + * allocated instance handle. This may be used to look up and retrieve the handle + * allocated to a given instance. + * + * Key
      + * The key is a typed Sample of which the key fields are set so that the instance + * can be identified. + * + * @param key the key of the instance to register + * @return the instance handle + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + */ + const ::dds::core::InstanceHandle register_instance(const T& key); + + /** + * This operation will inform the Data Distribution Service that the application will be + * modifying a particular instance and provides a value for the source_timestamp + * explicitly. + * + * Detailed Description
      + * This operation informs the Data Distribution Service that the application will be + * modifying a particular instance. This operation may be invoked prior to calling any + * operation that modifies the instance, such as write, unregister_instance or + * dispose_instance.
      + * When the application does register the instance before modifying, the Data + * Distribution Service will handle the instance more efficiently. It takes as a parameter + * (instance_data) an instance (to get the key value) and returns a handle that can + * be used in successive DataWriter operations. In case of an error, a HANDLE_NIL + * handle (InstanceHandle.is_nil() == true) is returned. + * + * The explicit use of this operation is optional as the application can directly call the + * write, unregister_instance or dispose_instance operations without InstanceHandle, + * which indicate that the sample should be examined to identify the instance. + * + * When this operation is used, the application provides the value for the parameter + * source_timestamp that is made available to connected DataReader objects.
      + * This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_register_blocking "register blocking"). + * + * Multiple Calls
      + * If this operation is called for an already registered instance, it just returns the already + * allocated instance handle. The source_timestamp is ignored in that case. + * + * Key
      + * The key is a typed Sample of which the key fields are set so that the instance + * can be identified. + * + * @param key the key of the instance to register + * @param timestamp the timestamp used for registration + * @return the instance handle + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + */ + const ::dds::core::InstanceHandle register_instance(const T& key, + const dds::core::Time& timestamp); + + /** + * This operation informs the Data Distribution Service that the application will not be + * modifying a particular instance any more. + * + * Detailed Description
      + * This operation informs the Data Distribution Service that the application will not be + * modifying a particular instance any more. Therefore, this operation reverses the + * action of @ref dds::pub::DataWriter::register_instance(const T& key) "\"register_instance\"" or + * @ref dds::pub::DataWriter::register_instance(const T& key, const dds::core::Time& timestamp) "\"register_instance_w_timestamp\"". + * register_instance or register_instance_w_timestamp.
      + * It should only be called on an instance that is currently registered. This operation + * should be called just once per instance, regardless of how many times + * @ref dds::pub::DataWriter::register_instance(const T& key) "register_instance" was called + * for that instance.
      + * This operation also indicates + * that the Data Distribution Service can locally remove all information regarding that + * instance. The application should not attempt to use the handle, previously + * allocated to that instance, after calling this operation. + * + * When this operation is used, the Data Distribution Service will automatically supply + * the value of the source_timestamp that is made available to connected + * DataReader objects. This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * @anchor anchor_dds_pub_datawriter_unregister_effects + * Effects
      + * If, after unregistering, the application wants to modify (write or dispose) the + * instance, it has to register the instance again, or it has to use the default + * instance handle (InstanceHandle.is_nil() == true). + * This operation does not indicate that the instance should be deleted (that is the + * purpose of the @ref dds::pub::DataWriter::dispose_instance(const T& key) "dispose". + * This operation just indicates that the DataWriter no longer + * has “anything to say” about the instance. If there is no other DataWriter that + * has registered the instance as well, then the dds::sub::status::InstanceState in all + * connected DataReaders will be changed to not_alive_no_writers, provided this + * InstanceState was not already set to not_alive_disposed. In the last case the + * InstanceState will not be effected by the unregister_instance call, + * see also @ref DCPS_Modules_Subscription_SampleInfo "Sample info concept". + * + * This operation can affect the ownership of the data instance. If the + * DataWriter was the exclusive owner of the instance, calling this operation will + * release that ownership, meaning ownership may be transferred to another, + * possibly lower strength, DataWriter. + * + * The operation must be called only on registered instances. Otherwise the operation + * trow PreconditionNotMetError. + * + * @anchor anchor_dds_pub_datawriter_unregister_blocking + * Blocking
      + * If the dds::core::policy::History QosPolicy is set to KEEP_ALL, the unregister_instance + * operation on the DataWriter may block if the modification would cause data to be + * lost because one of the limits, specified in the dds::core::policy::ResourceLimits, is + * exceeded. In case the synchronous attribute value of the + * dds::core::policy::Reliability is set to TRUE for communicating DataWriters and + * DataReaders then the DataWriter will wait until all synchronous + * DataReaders have acknowledged the data. Under these circumstances, the + * max_blocking_time attribute of the dds::core::policy::Reliability configures the + * maximum time the unregister operation may block (either waiting for space to become + * available or data to be acknowledged). If max_blocking_time elapses before the + * DataWriter is able to store the modification without exceeding the limits and all + * expected acknowledgements are received, the unregister_instance operation will fail + * and throw TimeoutError. + * + * @param i the instance to unregister + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + DataWriter& unregister_instance(const ::dds::core::InstanceHandle& i); + + /** + * This operation will inform the Data Distribution Service that the application will not + * be modifying a particular instance any more and provides a value for the + * source_timestamp explicitly. + * + * Detailed Description
      + * This operation informs the Data Distribution Service that the application will not be + * modifying a particular instance any more. Therefore, this operation reverses the + * action of @ref dds::pub::DataWriter::register_instance(const T& key) "\"register_instance\"" or + * @ref dds::pub::DataWriter::register_instance(const T& key, const dds::core::Time& timestamp) "\"register_instance_w_timestamp\"". + * register_instance or register_instance_w_timestamp.
      + * It should only be called on an instance that is currently registered. This operation + * should be called just once per instance, regardless of how many times + * @ref dds::pub::DataWriter::register_instance(const T& key) "register_instance" was called + * for that instance.
      + * This operation also indicates + * that the Data Distribution Service can locally remove all information regarding that + * instance. The application should not attempt to use the handle, previously + * allocated to that instance, after calling this operation. + * + * When this operation is used, the application itself supplied + * the value of the source_timestamp that is made available to connected + * DataReader objects. This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * Effects
      + * See @ref anchor_dds_pub_datawriter_unregister_effects "here" for the unregister effects. + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_unregister_blocking "unregister blocking"). + * + * @param i the instance to unregister + * @param timestamp the timestamp + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + DataWriter& unregister_instance(const ::dds::core::InstanceHandle& i, + const dds::core::Time& timestamp); + + /** + * This operation informs the Data Distribution Service that the application will not be + * modifying a particular instance any more. + * + * Detailed Description
      + * This operation informs the Data Distribution Service that the application will not be + * modifying a particular instance any more. Therefore, this operation reverses the + * action of @ref dds::pub::DataWriter::register_instance(const T& key) "\"register_instance\"" or + * @ref dds::pub::DataWriter::register_instance(const T& key, const dds::core::Time& timestamp) "\"register_instance_w_timestamp\"". + * register_instance or register_instance_w_timestamp.
      + * It should only be called on an instance that is currently registered. This operation + * should be called just once per instance, regardless of how many times + * @ref dds::pub::DataWriter::register_instance(const T& key) "register_instance" was called + * for that instance.
      + * This operation also indicates + * that the Data Distribution Service can locally remove all information regarding that + * instance. The application should not attempt to use the handle, previously + * allocated to that instance, after calling this operation. + * + * When this operation is used, the Data Distribution Service will automatically supply + * the value of the source_timestamp that is made available to connected + * DataReader objects. This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * Effects
      + * See @ref anchor_dds_pub_datawriter_unregister_effects "here" for the unregister effects. + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_unregister_blocking "unregister blocking"). + * + * Instance
      + * The instance is identified by the key fields of the given typed data sample, instead + * of an InstanceHandle. + * + * @param key sample of the instance to dispose + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + DataWriter& unregister_instance(const T& key); + + /** + * This operation will inform the Data Distribution Service that the application will not + * be modifying a particular instance any more and provides a value for the + * source_timestamp explicitly. + * + * Detailed Description
      + * This operation informs the Data Distribution Service that the application will not be + * modifying a particular instance any more. Therefore, this operation reverses the + * action of @ref dds::pub::DataWriter::register_instance(const T& key) "\"register_instance\"" or + * @ref dds::pub::DataWriter::register_instance(const T& key, const dds::core::Time& timestamp) "\"register_instance_w_timestamp\"". + * register_instance or register_instance_w_timestamp.
      + * It should only be called on an instance that is currently registered. This operation + * should be called just once per instance, regardless of how many times + * @ref dds::pub::DataWriter::register_instance(const T& key) "register_instance" was called + * for that instance.
      + * This operation also indicates + * that the Data Distribution Service can locally remove all information regarding that + * instance. The application should not attempt to use the handle, previously + * allocated to that instance, after calling this operation. + * + * When this operation is used, the application itself supplied + * the value of the source_timestamp that is made available to connected + * DataReader objects. This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * Effects
      + * See @ref anchor_dds_pub_datawriter_unregister_effects "here" for the unregister effects. + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_unregister_blocking "unregister blocking"). + * + * Instance
      + * The instance is identified by the key fields of the given typed data sample, instead + * of an InstanceHandle. + * + * @param key sample of the instance to dispose + * @param timestamp the timestamp + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + DataWriter& unregister_instance(const T& key, + const dds::core::Time& timestamp); + + /** + * This operation requests the Data Distribution Service to mark the instance for + * deletion. + * + * Detailed Description
      + * This operation requests the Data Distribution Service to mark the instance for + * deletion. Copies of the instance and its corresponding samples, which are stored in + * every connected DataReader and, dependent on the QosPolicy settings, also in + * the Transient and Persistent stores, will be marked for deletion by setting their + * dds::sub::status::InstanceState to not_alive_disposed state. + * + * When this operation is used, the Data Distribution Service will automatically supply + * the value of the source_timestamp that is made available to connected + * DataReader objects. This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * @anchor anchor_dds_pub_datawriter_dispose_effect_readers + * Effects on DataReaders
      + * Actual deletion of the instance administration in a connected DataReader will be + * postponed until the following conditions have been met: + * - the instance must be unregistered (either implicitly or explicitly) by all connected + * DataWriters that have previously registered it. + * - A DataWriter can register an instance explicitly by using the special + * register_instance operations. + * - A DataWriter can register an instance implicitly by using no or the default (nil) + * InstanceHandle in any of the other DataWriter operations. + * - A DataWriter can unregister an instance explicitly by using one of the special + * unregister_instance operations. + * - A DataWriter will unregister all its contained instances implicitly when it is + * deleted. + * - When a DataReader detects a loss of liveliness in one of its connected + * DataWriters, it will consider all instances registered by that DataWriter as + * being implicitly unregistered. + * - and the application must have consumed all samples belonging to the instance, + * either implicitly or explicitly. + * - An application can consume samples explicitly by invoking the take operation, + * or one of its variants, on its DataReaders. + * - The DataReader can consume disposed samples implicitly when the + * autopurge_disposed_samples_delay of the ReaderData + * Lifecycle QosPolicy has expired. + * + * The DataReader may also remove instances that haven’t been disposed first: this + * happens when the autopurge_nowriter_samples_delay of the + * ReaderDataLifecycle QosPolicy has expired after the instance is considered + * unregistered by all connected DataWriters (i.e. when it has a + * InstanceState of not_alive_no_writers.
      + * See also dds::core::policy::ReaderDataLifecycle QosPolicy. + * + * @anchor anchor_dds_pub_datawriter_dispose_effect_stores + * Effects on Transient/Persistent Stores
      + * Actual deletion of the instance administration in the connected Transient and + * Persistent stores will be postponed until the following conditions have been met: + * - the instance must be unregistered (either implicitly or explicitly) by all connected + * DataWriters that have previously registered it. (See above.) + * - and the period of time specified by the service_cleanup_delay attribute in + * the DurabilityServiceQosPolicy on the Topic must have elapsed after the + * instance is considered unregistered by all connected DataWriters. + * + * See also dds::core::policy::Durability QosPolicy. + * + * Instance Handle
      + * If handle is not nil, it must correspond to the value returned by + * @ref dds::pub::DataWriter::register_instance(const T& key) "\"register_instance\"" or + * @ref dds::pub::DataWriter::register_instance(const T& key, const dds::core::Time& timestamp) "\"register_instance_w_timestamp\"" + * when the instance (identified by its key) was registered. Passing such a registered + * handle helps the Data Distribution Service to process the sample more efficiently. + * + * @anchor anchor_dds_pub_datawriter_dispose_blocking + * Blocking
      + * If the dds::core::policy::History QosPolicy is set to KEEP_ALL, the dispose + * operation on the DataWriter may block if the modification would cause data to be + * lost because one of the limits, specified in the dds::core::policy::ResourceLimits, is + * exceeded. In case the synchronous attribute value of the + * dds::core::policy::Reliability is set to TRUE for communicating DataWriters and + * DataReaders then the DataWriter will wait until all synchronous + * DataReaders have acknowledged the data. Under these circumstances, the + * max_blocking_time attribute of the dds::core::policy::Reliability configures the + * maximum time the dispose operation may block (either waiting for space to become + * available or data to be acknowledged). If max_blocking_time elapses before the + * DataWriter is able to store the modification without exceeding the limits and all + * expected acknowledgements are received, the dispose operation will fail and throw + * TimeoutError. + * + * @param i the instance to dispose + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + DataWriter& dispose_instance(const ::dds::core::InstanceHandle& i); + + /** + * This operation requests the Data Distribution Service to mark the instance for + * deletion and provides a value for the source_timestamp explicitly. + * + * Detailed Description
      + * This operation requests the Data Distribution Service to mark the instance for + * deletion. Copies of the instance and its corresponding samples, which are stored in + * every connected DataReader and, dependent on the QosPolicy settings, also in + * the Transient and Persistent stores, will be marked for deletion by setting their + * dds::sub::status::InstanceState to not_alive_disposed state. + * + * When this operation is used, the application explicitly supplies + * the value of the source_timestamp that is made available to connected + * DataReader objects. This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Effects
      + * This operation @ref anchor_dds_pub_datawriter_dispose_effect_readers "effects DataReaders" + * and @ref anchor_dds_pub_datawriter_dispose_effect_stores "effects Transient/Persistent Stores". + * + * Instance Handle
      + * If handle is not nil, it must correspond to the value returned by + * @ref dds::pub::DataWriter::register_instance(const T& key) "\"register_instance\"" or + * @ref dds::pub::DataWriter::register_instance(const T& key, const dds::core::Time& timestamp) "\"register_instance_w_timestamp\"" + * when the instance (identified by its key) was registered. Passing such a registered + * handle helps the Data Distribution Service to process the sample more efficiently. + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_dispose_blocking "dispose blocking"). + * + * + * @param i the instance to dispose + * @param timestamp the timestamp + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + DataWriter& dispose_instance(const ::dds::core::InstanceHandle& i, + const dds::core::Time& timestamp); + + /** + * This operation requests the Data Distribution Service to mark the instance for + * deletion. + * + * Detailed Description
      + * This operation requests the Data Distribution Service to mark the instance for + * deletion. Copies of the instance and its corresponding samples, which are stored in + * every connected DataReader and, dependent on the QosPolicy settings, also in + * the Transient and Persistent stores, will be marked for deletion by setting their + * dds::sub::status::InstanceState to not_alive_disposed state. + * + * When this operation is used, the Data Distribution Service will automatically supply + * the value of the source_timestamp that is made available to connected + * DataReader objects. This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Effects
      + * This operation @ref anchor_dds_pub_datawriter_dispose_effect_readers "effects DataReaders" + * and @ref anchor_dds_pub_datawriter_dispose_effect_stores "effects Transient/Persistent Stores". + * + * Instance
      + * The instance is identified by the key fields of the given typed data sample, instead + * of an InstanceHandle. + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_dispose_blocking "dispose blocking"). + * + * @param key sample of the instance to dispose + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + DataWriter& dispose_instance(const T& key); + + /** + * This operation requests the Data Distribution Service to mark the instance for + * deletion and provides a value for the source_timestamp explicitly. + * + * Detailed Description
      + * This operation requests the Data Distribution Service to mark the instance for + * deletion. Copies of the instance and its corresponding samples, which are stored in + * every connected DataReader and, dependent on the QosPolicy settings, also in + * the Transient and Persistent stores, will be marked for deletion by setting their + * dds::sub::status::InstanceState to not_alive_disposed state. + * + * When this operation is used, the application explicitly supplies + * the value of the source_timestamp that is made available to connected + * DataReader objects. This timestamp is important for the interpretation of the + * dds::core::policy::DestinationOrder QosPolicy. + * + * As a side effect, this operation asserts liveliness on the DataWriter itself and on + * the containing DomainParticipant. + * + * Effects
      + * This operation @ref anchor_dds_pub_datawriter_dispose_effect_readers "effects DataReaders" + * and @ref anchor_dds_pub_datawriter_dispose_effect_stores "effects Transient/Persistent Stores". + * + * Instance
      + * The instance is identified by the key fields of the given typed data sample, instead + * of an InstanceHandle. + * + * Blocking
      + * This operation can be blocked (see @ref anchor_dds_pub_datawriter_dispose_blocking "dispose blocking"). + * + * @param key sample of the instance to dispose + * @param timestamp the timestamp + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + * @throws dds::core::TimeoutError + * Either the current action overflowed the available resources + * as specified by the combination of the Reliability QosPolicy, + * History QosPolicy and ResourceLimits QosPolicy, or the current action + * was waiting for data delivery acknowledgement by synchronous DataReaders. + * This caused blocking of the write operation, which could not be resolved before + * max_blocking_time of the Reliability QosPolicy elapsed. + */ + DataWriter& dispose_instance(const T& key, + const dds::core::Time& timestamp); + + /** + * This operation retrieves the key value of a specific instance. + * + * This operation can be used to retrieve the instance key that corresponds + * to an instance_handle. The operation will only fill the fields that form + * the key inside the sample instance. + * + * This operation may raise a InvalidArgumentError exception if the InstanceHandle + * does not correspond to an existing data-object known to the DataWriter. + * If the implementation is not able to check invalid handles, then the + * result in this situation is unspecified. + * + * The TopicInstance is added as parameter to be able to overload this operation. + * + * @param[out] i A topic instance to set the handle and sample key fields of + * @param[in] h The instance handle + * @return The given topic instance with the handle and key fields set + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::InvalidArgumentError + * The InstanceHandle is not a valid handle. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + */ + dds::topic::TopicInstance& key_value(dds::topic::TopicInstance& i, + const ::dds::core::InstanceHandle& h); + + /** + * This operation retrieves the key value of a specific instance. + * + * This operation can be used to retrieve the instance key that corresponds + * to an instance_handle. The operation will only fill the fields that form + * the key inside the sample instance. + * + * This operation may raise a InvalidArgumentError exception if the InstanceHandle + * does not correspond to an existing data-object known to the DataWriter. + * If the implementation is not able to check invalid handles, then the + * result in this situation is unspecified. + * + * The Sample is added as parameter to be able to overload this operation. + * + * @param[out] sample A sample to set the key fields of + * @param[in] h The instance handle + * @return The given sample with the key fields set + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::InvalidArgumentError + * The InstanceHandle is not a valid handle. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataWriter. + */ + T& key_value(T& sample, const ::dds::core::InstanceHandle& h); + + /** + * This operation returns the value of the instance handle which corresponds + * to the instance_data. + * + * The instance_data parameter is only used for the purpose of + * examining the fields that define the key. The instance handle can be used in any + * write, dispose or unregister operations (or their time stamped variants) that + * operate on a specific instance. Note that DataWriter instance handles are local, + * and are not interchangeable with DataReader instance handles nor with instance + * handles of an other DataWriter. + * + * This operation does not register the instance in question. If the instance has not been + * previously registered or if for any other + * reason the Service is unable to provide an instance handle, the Service will return + * the default nil handle (InstanceHandle.is_nil() == true). + * + * @param key the sample + * @return the instance handle + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + dds::core::InstanceHandle lookup_instance(const T& key); + + //========================================================================== + //== QoS Management + + /** @copydoc dds::pub::TAnyDataWriter::qos(const dds::pub::qos::DataWriterQos& qos) */ + DataWriter& operator <<(const ::dds::pub::qos::DataWriterQos& qos); + + + //========================================================================== + //== Entity Navigation + + /** + * Get the Topic associated with this DataWriter. + * + * @return the Topic + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + const dds::topic::Topic& topic() const; + + //========================================================================== + //== Listeners Management + + /** + * Register a listener with the DataWriter. + * + * This operation attaches a DataWriterListener to the DataWriter. Only one + * DataWriterListener can be attached to each DataWriter. If a + * DataWriterListener was already attached, the operation will replace it with the + * new one. When the listener is the NULL pointer, it represents a listener that is + * treated as a NOOP for all statuses activated in the bit mask. + * + * Listener un-registration is performed by setting the listener to NULL and mask none(). + * + * @anchor anchor_dds_pub_datawriter_commstatus + * Communication Status
      + * For each communication status, the StatusChangedFlag flag is initially set to + * FALSE. It becomes TRUE whenever that communication status changes. For each + * communication status activated in the mask, the associated DataWriterListener + * operation is invoked and the communication status is reset to FALSE, as the listener + * implicitly accesses the status which is passed as a parameter to that operation. The + * status is reset prior to calling the listener, so if the application calls the + * get__status from inside the listener it will see the status + * already reset. An exception to this rule is the NULL listener, which does not reset the + * communication statuses for which it is invoked. + * + * The following statuses are applicable to the DataWriterListener: + * - dds::core::status::StatusMask::offered_deadline_missed() + * - dds::core::status::StatusMask::offered_incompatible_qos() + * - dds::core::status::StatusMask::liveliness_lost() + * - dds::core::status::StatusMask::publication_matched() + * + * Be aware that the PUBLICATION_MATCHED_STATUS is not applicable when the + * infrastructure does not have the information available to determine connectivity. + * This is the case when OpenSplice is configured not to maintain discovery + * information in the Networking Service. (See the description for the + * NetworkingService/Discovery/enabled property in the Deployment + * Manual for more information about this subject.) In this case the operation will + * throw UnsupportedError. + * + * Status bits are declared as a constant and can be used by the application in an OR + * operation to create a tailored mask. The special constant dds::core::status::StatusMask::none() + * can be used to indicate that the created entity should not respond to any of its available + * statuses. The DDS will therefore attempt to propagate these statuses to its factory. + * The special constant dds::core::status::StatusMask::all() can be used to select all applicable + * statuses specified in the “Data Distribution Service for Real-time Systems Version + * 1.2” specification which are applicable to the PublisherListener. + * + * @anchor anchor_dds_pub_datawriter_commpropagation + * Status Propagation
      + * In case a communication status is not activated in the mask of the + * DataWriterListener, the PublisherListener of the containing Publisher + * is invoked (if attached and activated for the status that occurred). This allows the + * application to set a default behaviour in the PublisherListener of the containing + * Publisher and a DataWriter specific behaviour when needed. In case the + * communication status is not activated in the mask of the PublisherListener as + * well, the communication status will be propagated to the + * DomainParticipantListener of the containing DomainParticipant. In case + * the DomainParticipantListener is also not attached or the communication + * status is not activated in its mask, the application is not notified of the change. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @param listener the listener + * @param mask the mask defining the events for which the listener + * will be notified. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * A status was selected that cannot be supported because + * the infrastructure does not maintain the required connectivity information. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void listener(DataWriterListener* listener, + const ::dds::core::status::StatusMask& mask); + + /** + * Get the listener of this DataWriter. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @return the listener + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + */ + DataWriterListener* listener() const; +}; + +#endif /* OMG_DDS_PUB_DATA_WRITER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/DataWriterListener.hpp b/unitree_SDK/include/ddscxx/dds/pub/DataWriterListener.hpp new file mode 100644 index 0000000..0536752 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/DataWriterListener.hpp @@ -0,0 +1,258 @@ +#ifndef OMG_DDS_PUB_DATA_WRITER_LISTENER_HPP_ +#define OMG_DDS_PUB_DATA_WRITER_LISTENER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +#include + +namespace dds +{ +namespace pub +{ + +/** + * * @brief + * DataWriter events Listener + * + * Since a DataWriter is an Entity, it has the ability to have a Listener + * associated with it. In this case, the associated Listener should be of type + * DataWriterListener. This interface must be implemented by the + * application. A user-defined class must be provided by the application which must + * extend from the DataWriterListener class. + * + * + * All operations for this interface must be implemented in the user-defined class, it is + * up to the application whether an operation is empty or contains some functionality. + * + * + * The DataWriterListener provides a generic mechanism (actually a + * callback function) for the Data Distribution Service to notify the application of + * relevant asynchronous status change events, such as a missed deadline, violation of + * a QosPolicy setting, etc. The DataWriterListener is related to + * changes in communication status StatusConditions. + * + * @code{.cpp} + * // Application example listener + * class ExampleListener : + * public virtual dds::pub::DataWriterListener + * { + * public: + * virtual void on_offered_deadline_missed ( + * dds::pub::DataWriter& writer, + * const dds::core::status::OfferedDeadlineMissedStatus& status) + * { + * std::cout << "on_offered_deadline_missed" << std::endl; + * } + * + * virtual void on_offered_incompatible_qos ( + * dds::pub::DataWriter& writer, + * const dds::core::status::OfferedIncompatibleQosStatus& status) + * { + * std::cout << "on_offered_incompatible_qos" << std::endl; + * } + * + * virtual void on_liveliness_lost ( + * dds::pub::DataWriter& writer, + * const dds::core::status::LivelinessLostStatus& status) + * { + * std::cout << "on_liveliness_lost" << std::endl; + * } + * + * virtual void on_publication_matched ( + * dds::pub::DataWriter& writer, + * const dds::core::status::PublicationMatchedStatus& status) + * { + * std::cout << "on_publication_matched" << std::endl; + * } + * }; + * + * // Create DataWriter with the listener + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::pub::Publisher publisher(participant); + * dds::pub::DataWriter writer(publisher, + * topic, + * publisher.default_datawriter_qos(), + * new ExampleListener(), + * dds::core::status::StatusMask::all()); + * + * @endcode + * + * @see for more information: @ref DCPS_Modules_Publication_DataWriter "Data Writer" + * @see for more information: @ref DCPS_Modules_Infrastructure_Listener "Listener information" + */ +template +class DataWriterListener +{ +public: + /** @cond */ + virtual ~DataWriterListener() { } + /** @endcond */ + +public: + /** + * This operation is called by the Data Distribution Service when the + * OfferedDeadlineMissedStatus changes. + * + * This operation will only be called when + * the relevant DataWriterListener is installed and enabled for the offered + * deadline missed status (StatusMask::offered_deadline_missed()). The + * offered deadline missed status will change when the + * deadline that the DataWriter has committed through its DeadlineQosPolicy + * was not respected for a specific instance. + * + * @param writer contain a pointer to the DataWriter on which + * the OfferedDeadlineMissedStatus has changed (this is an input to the + * application) + * @param status contain the + * OfferedDeadlineMissedStatus object (this is an input to + * the application). + */ + virtual void on_offered_deadline_missed( + dds::pub::DataWriter& writer, + const dds::core::status::OfferedDeadlineMissedStatus& status) = 0; + + /** + * This operation called by the Data Distribution Service when the + * OfferedIncompatibleQosStatus changes. + * + * This operation will only be called when + * the relevant DataWriterListener is installed and enabled for the + * StatusMask::offered_incompatible_qos(). The incompatible Qos status will + * change when a DataReader object has been discovered by the DataWriter with + * the same Topic and a requested DataReaderQos that was incompatible with the + * one offered by the DataWriter. + * + * @param writer contain a pointer to the DataWriter on which + * the OfferedIncompatibleQosStatus has changed (this is an input to + * the application). + * @param status contain the OfferedIncompatibleQosStatus object (this is + * an input to the application). + */ + virtual void on_offered_incompatible_qos( + dds::pub::DataWriter& writer, + const dds::core::status::OfferedIncompatibleQosStatus& status) = 0; + + /** + * This operation is called by the Data Distribution Service when the + * LivelinessLostStatus changes. + * + * This operation will only be called when the relevant + * DataWriterListener is installed and enabled for the liveliness lost status + * (StatusMask::liveliness_lost()). + * The liveliness lost status will change when the liveliness that the DataWriter has + * committed through its LivelinessQosPolicy was not respected. In other words, + * the DataWriter failed to actively signal its liveliness within the offered liveliness + * period. As a result, the DataReader objects will consider the DataWriter as no + * longer “alive”. + * + * @param writer contains a pointer to the DataWriter on which + * the LivelinessLostStatus has changed (this is an input to + * the application). + * @param status contains the LivelinessLostStatus object (this is an input + * to the application). + */ + virtual void on_liveliness_lost( + dds::pub::DataWriter& writer, + const dds::core::status::LivelinessLostStatus& status) = 0; + + /** + * This operation is called by the Data + * Distribution Service when a new match has been discovered for the current + * publication, or when an existing match has ceased to exist. + * + * Usually this means that a + * new DataReader that matches the Topic and that has compatible Qos as the current + * DataWriter has either been discovered, or that a previously discovered + * DataReader has ceased to be matched to the current DataWriter. A DataReader + * may cease to match when it gets deleted, when it changes its Qos to a value that is + * incompatible with the current DataWriter or when either the DataWriter or the + * DataReader has chosen to put its matching counterpart on its ignore-list using the + * dds::sub::ignore or dds::pub::ignore operations. + * + * it will only be called when the relevant DataWriterListener is installed and enabled + * for the StatusMask::publication_matched(). + * + * @param writer contains a pointer to the DataWriter for which + * a match has been discovered (this is an input to the application provided by the + * Data Distribution Service). + * @param status contains the + * PublicationMatchedStatus object (this is an input to the application + * provided by the Data Distribution Service). + */ + virtual void on_publication_matched( + dds::pub::DataWriter& writer, + const dds::core::status::PublicationMatchedStatus& status) = 0; +}; + + +/** + * @brief + * DataWriter events Listener + * + * This listener is just like DataWriterListener, except + * that the application doesn't have to implement all operations. + * + * @code{.cpp} + * class ExampleListener : public virtual dds::pub::NoOpDataWriterListener + * { + * // Not necessary to implement any Listener operations. + * }; + * @endcode + * + * @see dds::pub::DataWriterListener + */ +template +class NoOpDataWriterListener : public virtual DataWriterListener +{ +/** @cond + * All these functions have already been documented in the non-NoOp listener. + * Ignore these functions for the doxygen API documentation for clarity. + */ +public: + virtual ~NoOpDataWriterListener() { } + +public: + virtual void + on_offered_deadline_missed( + dds::pub::DataWriter&, + const dds::core::status::OfferedDeadlineMissedStatus&) { } + + virtual void + on_offered_incompatible_qos( + dds::pub::DataWriter&, + const dds::core::status::OfferedIncompatibleQosStatus&) { } + + virtual void + on_liveliness_lost( + dds::pub::DataWriter&, + const dds::core::status::LivelinessLostStatus&) { } + + virtual void + on_publication_matched( + dds::pub::DataWriter&, + const dds::core::status::PublicationMatchedStatus&) { } +/** @endcond */ +}; + +} +} + +#endif /* OMG_DDS_PUB_DATA_WRITER_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/Publisher.hpp b/unitree_SDK/include/ddscxx/dds/pub/Publisher.hpp new file mode 100644 index 0000000..1019c72 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/Publisher.hpp @@ -0,0 +1,32 @@ +#ifndef OMG_DDS_PUB_PUBLISHER_HPP_ +#define OMG_DDS_PUB_PUBLISHER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace pub +{ +typedef dds::pub::detail::Publisher Publisher; +} +} + +#endif /* OMG_DDS_PUB_PUBLISHER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/PublisherListener.hpp b/unitree_SDK/include/ddscxx/dds/pub/PublisherListener.hpp new file mode 100644 index 0000000..2b04d7f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/PublisherListener.hpp @@ -0,0 +1,141 @@ +#ifndef OMG_DDS_PUB_PUBLISHER_LISTENER_HPP_ +#define OMG_DDS_PUB_PUBLISHER_LISTENER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + + +namespace dds +{ +namespace pub +{ +class PublisherListener; +class NoOpPublisherListener; +} +} + +DDSCXX_WARNING_MSVC_OFF(4250) + +/** + * @brief + * Publisher events Listener + * + * Since a Publisher is an Entity, it has the ability to have a Listener + * associated with it. In this case, the associated Listener should be of type + * PublisherListener. This interface must be implemented by the + * application. A user-defined class must be provided by the application which must + * extend from the PublisherListener class. + * + * + * All operations for this interface must be implemented in the user-defined class, it is + * up to the application whether an operation is empty or contains some functionality. + * + * + * The PublisherListener provides a generic mechanism (actually a + * callback function) for the Data Distribution Service to notify the application of + * relevant asynchronous status change events, such as a missed deadline, violation of + * a QosPolicy setting, etc. The PublisherListener is related to + * changes in communication status StatusConditions. + * + * @code{.cpp} + * // Application example listener + * class ExampleListener : + * public virtual dds::pub::PublisherListener + * { + * public: + * virtual void on_offered_deadline_missed ( + * dds::pub::AnyDataWriter& writer, + * const dds::core::status::OfferedDeadlineMissedStatus& status) + * { + * std::cout << "on_offered_deadline_missed" << std::endl; + * } + * + * virtual void on_offered_incompatible_qos ( + * dds::pub::AnyDataWriter& writer, + * const dds::core::status::OfferedIncompatibleQosStatus& status) + * { + * std::cout << "on_offered_incompatible_qos" << std::endl; + * } + * + * virtual void on_liveliness_lost ( + * dds::pub::AnyDataWriter& writer, + * const dds::core::status::LivelinessLostStatus& status) + * { + * std::cout << "on_liveliness_lost" << std::endl; + * } + * + * virtual void on_publication_matched ( + * dds::pub::AnyDataWriter& writer, + * const dds::core::status::PublicationMatchedStatus& status) + * { + * std::cout << "on_publication_matched" << std::endl; + * } + * }; + * + * // Create Publisher with the listener + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::pub::Publisher publisher(participant, + * participant.default_publisher_qos(), + * new ExampleListener(), + * dds::core::status::StatusMask::all()); + * + * @endcode + * + * @see for more information: @ref DCPS_Modules_Publisher "Publisher" + * @see for more information: @ref DCPS_Modules_Infrastructure_Listener "Listener information" + */ +class OMG_DDS_API dds::pub::PublisherListener : public virtual dds::pub::AnyDataWriterListener +{ +public: + /** @cond */ + virtual ~PublisherListener() { } + /** @endcond */ +}; + + +/** + * @brief + * Publisher events Listener + * + * This listener is just like PublisherListener, except + * that the application doesn't have to implement all operations. + * + * @code{.cpp} + * class ExampleListener : public virtual dds::pub::NoOpPublisherListener + * { + * // Not necessary to implement any Listener operations. + * }; + * @endcode + * + * @see dds::pub::PublisherListener + */ +class OMG_DDS_API dds::pub::NoOpPublisherListener : + public virtual dds::pub::PublisherListener, + public virtual dds::pub::NoOpAnyDataWriterListener +{ +public: + /** @cond */ + virtual ~NoOpPublisherListener() { } + /** @endcond */ +}; + +DDSCXX_WARNING_MSVC_ON(4250) + +#endif /* OMG_DDS_PUB_PUBLISHER_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/SuspendedPublication.hpp b/unitree_SDK/include/ddscxx/dds/pub/SuspendedPublication.hpp new file mode 100644 index 0000000..fc1170e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/SuspendedPublication.hpp @@ -0,0 +1,32 @@ +#ifndef OMG_DDS_PUB_SUSPENDED_PUBLICATION_HPP_ +#define OMG_DDS_PUB_SUSPENDED_PUBLICATION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace pub +{ +typedef dds::pub::detail::SuspendedPublication SuspendedPublication; +} +} + +#endif /* OMG_DDS_PUB_SUSPENDED_PUBLICATION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/TAnyDataWriter.hpp b/unitree_SDK/include/ddscxx/dds/pub/TAnyDataWriter.hpp new file mode 100644 index 0000000..a14c382 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/TAnyDataWriter.hpp @@ -0,0 +1,354 @@ +#ifndef OMG_TDDS_PUB_ANY_DATA_WRITER_HPP_ +#define OMG_TDDS_PUB_ANY_DATA_WRITER_HPP_ +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include + +namespace dds +{ +namespace pub +{ +template +class TAnyDataWriter; +} +} + +/** + * @brief + * Typeless base class for the typed DataWriter. + * + * DataWriters are created type specific (fi DataWriter writer). However, there + * are many places in the API (and possibly application) where the type can not be known + * while still some DataWriter has to be passed around, stored or even typeless functionality + * called.
      + * Main examples in the API that need typeless DataWriter are: Publisher, PublisherListener + * and DomainParticipantListener. + * + */ +template +class dds::pub::TAnyDataWriter : public dds::core::TEntity +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TAnyDataWriter, dds::core::TEntity, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(TAnyDataWriter) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(TAnyDataWriter) + + //========================================================================== + //== Entity Navigation + + /** + * Get the Publisher that owns this DataWriter. + * + * @return the Publisher + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + const dds::pub::Publisher& publisher() const; + + /** + * Get the TopicDescription associated with this DataWriter. + * + * @return the TopicDescription + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + const dds::topic::TopicDescription& topic_description() const; + + + + //========================================================================== + //== QoS Management + + /** + * Gets the DataWriterQos setting for this instance. + * + * @return the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::pub::qos::DataWriterQos + qos() const; + + /** + * This operation replaces the existing set of QosPolicy settings for a DataWriter. + * + * The parameter qos contains the object with the QosPolicy settings which is + * checked for self-consistency and mutability. + * + * When the application tries to change a + * QosPolicy setting for an enabled DataWriter, which can only be set before the + * DataWriter is enabled, the operation will fail and a + * ImmutablePolicyError is thrown. In other words, the application must + * provide the presently set QosPolicy settings in case of the immutable QosPolicy + * settings. Only the mutable QosPolicy settings can be changed. + * + * When the qos contains conflicting QosPolicy settings (not self-consistent), + * the operation will fail and an InconsistentPolicyError is thrown. + * + * @param qos the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::ImmutablePolicyError + * The parameter qos contains an immutable QosPolicy setting with a + * different value than set during enabling of the DataWriter. + * @throws dds::core::InconsistentPolicyError + * The parameter qos contains conflicting QosPolicy settings, + */ + void qos(const dds::pub::qos::DataWriterQos& qos); + + /** @copydoc dds::pub::TAnyDataWriter::qos(const dds::pub::qos::DataWriterQos& qos) */ + TAnyDataWriter& operator << (const dds::pub::qos::DataWriterQos& qos); + + /** @copydoc dds::pub::TAnyDataWriter::qos() */ + const TAnyDataWriter& operator >> (dds::pub::qos::DataWriterQos& qos) const; + + + //========================================================================== + //== ACKs + + /** + * This operation blocks the calling thread until either all data written + * by the DataWriter is acknowledged by the local infrastructure, or until + * the duration specified by the timeout parameter elapses, + * whichever happens first. + * + * Data is acknowledged by the local infrastructure when it does not need to be stored + * in its DataWriter’s local history. When a locally-connected subscription (including + * the networking service) has no more resources to store incoming samples it will start + * to reject these samples, resulting in their source DataWriters to store them + * temporarily in their own local history to be retransmitted at a later moment in time.
      + * In such scenarios, the wait_for_acknowledgments operation will block until the + * DataWriter has retransmitted its entire history, which is therefore effectively + * empty, or until the timeout expires, whichever happens first. In the latter + * case, this operation will throw a TimeoutError. + * + * + * Be aware that in case the operation returns normally, the data has only been + * acknowledged by the local infrastructure: it does not mean all remote subscriptions + * have already received the data. However, delivering the data to remote nodes is then + * the sole responsibility of the networking service: even when the publishing + * application would terminate, all data that has not yet been received may be + * considered ‘on-route’ and will therefore eventually arrive (unless the networking + * service itself will crash). In contrast, if a DataWriter would still have data in it’s + * local history buffer when it terminates, this data is considered ‘lost’. + * + * + * This operation is intended to be used only if one or more of the contained + * DataWriters has its ReliabilityQosPolicyKind set to RELIABLE. + * Otherwise the operation will return immediately, since best-effort DataWriters will + * never store rejected samples in their local history: + * they will just drop them and continue business as usual. + * + * @param timeout the time out duration + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::TimeoutError + * Not all data is acknowledged before timeout elapsed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void wait_for_acknowledgments(const dds::core::Duration& timeout); + + //========================================================================== + //== Status Management + + /** + * This operation obtains the LivelinessLostStatus object of the DataWriter. + * + * The LivelinessLostStatus contains the information whether the liveliness (that the + * DataWriter has committed through its Liveliness QosPolicy) was respected. + * This means that the status represents whether the DataWriter failed to actively + * signal its liveliness within the offered liveliness period. If the liveliness is lost, the + * DataReader objects will consider the DataWriter as no longer “alive”. + * + * The LivelinessLostStatus can also be monitored using a + * DataWriterListener or by using the associated StatusCondition. + * + * @return the LivelinessLostStatus + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + const dds::core::status::LivelinessLostStatus liveliness_lost_status(); + + /** + * This operation obtains the OfferedDeadlineMissedStatus object of the DataWriter. + * + * The OfferedDeadlineMissedStatus contains the information whether the deadline (that the + * DataWriter has committed through its Deadline QosPolicy) was respected for + * each instance. + * + * The OfferedDeadlineMissedStatus can also be monitored using a + * DataWriterListener or by using the associated StatusCondition. + * + * @return the OfferedDeadlineMissedStatus + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + const dds::core::status::OfferedDeadlineMissedStatus offered_deadline_missed_status(); + + /** + * This operation obtains the OfferedIncompatibleQosStatus object of the DataWriter. + * + * The OfferedIncompatibleQosStatus contains the information whether a QosPolicy setting + * was incompatible with the requested QosPolicy setting. + * + * This means that the status represents whether a DataReader object has been + * discovered by the DataWriter with the same Topic and a requested + * DataReaderQos that was incompatible with the one offered by the DataWriter. + * + * The OfferedIncompatibleQosStatus can also be monitored using a + * DataWriterListener or by using the associated StatusCondition. + * + * @return the OfferedIncompatibleQosStatus + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + const dds::core::status::OfferedIncompatibleQosStatus offered_incompatible_qos_status(); + + /** + * This operation obtains the PublicationMatchedStatus object of the DataWriter. + * + * The PublicationMatchedStatus contains the information whether a new match has been + * discovered for the current publication, or whether an existing match has ceased to + * exist. + * + * This means that the status represents that either a DataReader object has been + * discovered by the DataWriter with the same Topic and a compatible Qos, or that a + * previously discovered DataReader has ceased to be matched to the current + * DataWriter. A DataReader may cease to match when it gets deleted, when it + * changes its Qos to a value that is incompatible with the current DataWriter or + * when either the DataWriter or the DataReader has chosen to put its matching + * counterpart on its ignore-list using the dds::sub::ignore or + * dds::pub::ignore operations. + * + * The operation may fail if the infrastructure does not hold the information necessary + * to fill in the PublicationMatchedStatus. This is the case when OpenSplice is + * configured not to maintain discovery information in the Networking Service. (See + * the description for the NetworkingService/Discovery/enabled property in + * the Deployment Manual for more information about this subject.) In this case the + * operation will throw UnsupportedError. + * + * The PublicationMatchedStatus can also be monitored using a + * DataWriterListener or by using the associated StatusCondition. + * + * @return the PublicationMatchedStatus + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::UnsupportedError + * OpenSplice is configured not to maintain the information + * about “associated” subscriptions. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + const dds::core::status::PublicationMatchedStatus publication_matched_status(); + + + //========================================================================== + //== Liveliness Management + + /** + * This operation asserts the liveliness for the DataWriter. + * + * This operation will manually assert the liveliness for the DataWriter. This way, + * the Data Distribution Service is informed that the corresponding DataWriter is + * still alive. This operation is used in combination with the Liveliness QosPolicy + * set to Liveliness::ManualByParticipant or Liveliness::ManualByTopic. + * + * Writing data via the write operation of a DataWriter will assert the liveliness on + * the DataWriter itself and its containing DomainParticipant. Therefore, + * assert_liveliness is only needed when not writing regularly. + * + * The liveliness should be asserted by the application, depending on the + * LivelinessQosPolicy. Asserting the liveliness for this DataWriter can also + * be achieved by asserting the liveliness to the DomainParticipant. + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The entity has not yet been enabled. + */ + void assert_liveliness(); + +}; + + +#endif /* OMG_TDDS_PUB_ANY_DATA_WRITER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/TCoherentSet.hpp b/unitree_SDK/include/ddscxx/dds/pub/TCoherentSet.hpp new file mode 100644 index 0000000..f609a2b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/TCoherentSet.hpp @@ -0,0 +1,129 @@ +#ifndef OMG_TDDS_PUB_COHERENT_SET_HPP_ +#define OMG_TDDS_PUB_COHERENT_SET_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace pub +{ +template +class TCoherentSet; +} +} + + +/** + * @brief + * Class for RAII way of beginning/ending coherent publication sets. + * + * A coherent set is a set of modifications that must be + * propagated in such a way that they are interpreted at the + * receivers' side as a consistent set of modifications; that + * is, the receiver will only be able to access the data after + * all the modifications in the set are available at the + * receiver end. + * + * A connectivity change may occur in the middle + * of a set of coherent changes; for example, the set of + * partitions used by the Publisher or one of its Subscribers + * may change, a late-joining DataReader may appear on the + * network, or a communication failure may occur. In the event + * that such a change prevents an entity from receiving the + * entire set of coherent changes, that entity must behave as if + * it had received none of the set. + * + * The support for + * coherent changes enables a publishing application to change + * the value of several data-instances that could belong to the + * same or different topics and have those changes be seen + * atomically by the readers. This is useful in cases where + * the values are inter-related. For example, if there are two + * data instances representing the altitude and velocity + * vector of the same aircraft and both are changed, it may be + * useful to communicate those values in such a way the reader + * can see both together; otherwise, it may, for example, + * erroneously interpret that the aircraft is on a collision course. + * + * @see for more information: @ref DCPS_Modules_Publication "Publication" + * @see dds::pub::Publisher + */ +template +class dds::pub::TCoherentSet : public dds::core::Value +{ +public: + /** + * Creating a CoherentSet object, which will begin a ‘coherent set’ of + * modifications using DataWriter objects attached to this Publisher. + * + * A precondition for making coherent changes is that the PresentationQos of the + * Publisher has its coherent_access attribute set to TRUE. If this is not the case, + * the Publisher will not accept any coherent start requests and throw + * dds::core::PreconditionNotMetError. + * + * @param pub The publisher to supsend publications on. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The Publisher has already been closed. + * @throws dds::core::NotEnabledError + * The Publisher has not yet been enabled. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NullReferenceError + * The Publisher was not properly created and references to dds::core::null. + * @throws dds::core::PreconditionNotMetError + * The coherent access attribute of the Publisher's PresentationQos is not set to true. + */ + explicit TCoherentSet(const dds::pub::Publisher& pub); + +public: + /** + * This operation will explicitly end the publication of an coherent set. + * + * If the Publisher already ended its coherent set (by a call to this very + * operation), then a call to this operation will have no effect. + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The Publisher has already been closed. + * @throws dds::core::NotEnabledError + * The Publisher has not yet been enabled. + * @throws dds::core::NullReferenceError + * The Publisher was not properly created and references to dds::core::null. + */ + void end(); + +public: + /** + * The destruction of the CoherentSet will implicitly end the publication + * of a coheren set if not already ended by a call to end(). + * + * When there is a problem with which end() would normally throw an exception, + * then that exception is swallowed. Errors can be found in the logs. + */ + ~TCoherentSet(); +}; + + +#endif /* OMG_TDDS_PUB_COHERENT_SET_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/TPublisher.hpp b/unitree_SDK/include/ddscxx/dds/pub/TPublisher.hpp new file mode 100644 index 0000000..529e3e7 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/TPublisher.hpp @@ -0,0 +1,318 @@ +#ifndef OMG_TDDS_PUB_PUBLISHER_HPP_ +#define OMG_TDDS_PUB_PUBLISHER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include +#include + + + +namespace dds +{ +namespace pub +{ +template +class TPublisher; + +class PublisherListener; +} +} + +/** + * @brief + * The Publisher acts on the behalf of one or several DataWriter objects + * that belong to it. + * + * When it is informed of a change to the data associated + * with one of its DataWriter objects, it decides when it is appropriate + * to actually send the data-update message. In making this decision, it + * considers any extra information that goes with the data (timestamp, + * writer, etc.) as well as the QoS of the Publisher and the DataWriter. + * + * @see for more information: @ref DCPS_Modules_Publisher "Publisher" + */ +template +class dds::pub::TPublisher : public dds::core::TEntity +{ +public: + /** + * Local convenience typedef for dds::pub::PublisherListener. + */ + typedef dds::pub::PublisherListener Listener; + +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TPublisher, dds::core::TEntity, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(TPublisher) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(TPublisher) + + /** + * Create a new Publisher. + * + * The Publisher will be created with the QoS values specified on the last + * successful call to @link dds::domain::DomainParticipant::default_publisher_qos(const ::dds::pub::qos::PublisherQos& qos) + * dp.default_publisher_qos(qos) @endlink or, if the call was never made, the + * @ref anchor_dds_pub_publisher_qos_defaults "default" values. + * + * @param dp the domain participant + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + TPublisher(const dds::domain::DomainParticipant& dp); + + /** + * Create a new Publisher. + * + * The Publisher will be created with the given QosPolicy settings and if + * applicable, attaches the optionally specified PublisherListener to it. + * + * See @ref DCPS_Modules_Infrastructure_Listener "listener" for more information + * about listeners and possible status propagation to other entities. + * + * @param dp the domain participant to create the Publisher with. + * @param qos a collection of QosPolicy settings for the new Publisher. In case + * these settings are not self consistent, no Publisher is created. + * @param listener the publisher listener + * @param mask the mask of events notified to the listener + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::InconsistentPolicyError + * The parameter qos contains conflicting QosPolicy settings. + */ + TPublisher(const dds::domain::DomainParticipant& dp, + const dds::pub::qos::PublisherQos& qos, + dds::pub::PublisherListener* listener = NULL, + const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none()); + + //========================================================================== + + /** + * Gets the PublisherQos setting for this instance. + * + * @return the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + const dds::pub::qos::PublisherQos& qos() const; + + + /** + * Sets the PublisherQos setting for this instance. + * + * @param qos the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void qos(const dds::pub::qos::PublisherQos& qos); + + /** @copydoc dds::pub::Publisher::qos(const dds::pub::qos::PublisherQos& qos) */ + TPublisher& operator <<(const dds::pub::qos::PublisherQos& qos); + + /** @copydoc dds::pub::Publisher::qos() */ + TPublisher& operator >> (dds::pub::qos::PublisherQos& qos); + + /** + * Sets the default DataWriterQos of the Publisher. + * + * This operation sets the default SubscriberQos of the Publisher which + * is used for newly created Subscriber objects, when no QoS is provided. + * + * This operation checks if the DataWriterQos is self consistent. If it is not, the + * operation has no effect and throws dds::core::InconsistentPolicyError. + * + * The values set by this operation are returned by dds::pub::Publisher::default_datawriter_qos(). + * + * @param qos the default DataWriterQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * One or more of the selected QosPolicy values are + * currently not supported by OpenSplice. + * @throws dds::core::InconsistentPolicyError + * The parameter qos contains conflicting QosPolicy settings, + * e.g. a history depth that is higher than the specified resource limits. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + TPublisher& default_datawriter_qos(const dds::pub::qos::DataWriterQos& qos); + + /** + * Gets the default DataWriterQos of the Publisher. + * + * This operation gets an object with the default DataWriter QosPolicy settings of + * the Publisher (that is the DataWriterQos) which is used for newly + * created DataWriter objects, in case no QoS was provided during the creation. + * + * The values retrieved by this operation match the set of values specified on the last + * successful call to + * dds::pub::Publisher::default_datawriter_qos(const dds::pub::qos::DataWriterQos& qos), + * or, if the call was never made, the @ref anchor_dds_pub_datawriter_qos_defaults "default" values. + * + * @return the default DataWriterQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::pub::qos::DataWriterQos default_datawriter_qos() const; + + //========================================================================== + + /** + * Register a listener with the Publisher. + * + * The notifications received by the listener depend on the + * status mask with which it was registered. + * + * Listener un-registration is performed by setting the listener to NULL. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @param plistener the listener + * @param mask the mask defining the events for which the listener + * will be notified. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * A status was selected that cannot be supported because + * the infrastructure does not maintain the required connectivity information. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void listener(Listener* plistener, + const dds::core::status::StatusMask& mask); + + /** + * Get the listener of this Publisher. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @return the listener + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + */ + Listener* listener() const; + + //========================================================================== + + /** + * This operation blocks the calling thread until either all data written + * by the reliable DataWriter entities is acknowledged by all matched + * reliable DataReader entities, or else the duration specified by the + * timeout parameter elapses, whichever happens first. + * + * Data is acknowledged by the local infrastructure when it does not need to be stored + * in its DataWriter’s local history. When a locally-connected subscription (including + * the networking service) has no more resources to store incoming samples it will start + * to reject these samples, resulting in their source DataWriters to store them + * temporarily in their own local history to be retransmitted at a later moment in time.
      + * In such scenarios, the wait_for_acknowledgments operation will block until all + * contained DataWriters have retransmitted their entire history, which is therefore + * effectively empty, or until the max_wait timeout expires, whichever happens first. + * In the latter case it will throw dds::core::TimeoutError. + * + * + * Be aware that in case the operation returns normally, the data has only been + * acknowledged by the local infrastructure: it does not mean all remote subscriptions + * have already received the data. However, delivering the data to remote nodes is then + * the sole responsibility of the networking service: even when the publishing + * application would terminate, all data that has not yet been received may be + * considered ‘on-route’ and will therefore eventually arrive (unless the networking + * service itself will crash). In contrast, if a DataWriter would still have data in it’s + * local history buffer when it terminates, this data is considered ‘lost’. + * + * + * This operation is intended to be used only if one or more of the contained + * DataWriters has its ReliabilityQosPolicyKind set to RELIABLE. + * Otherwise the operation will return immediately, since best-effort DataWriters will + * never store rejected samples in their local history: + * they will just drop them and continue business as usual. + * + * @param timeout the time out duration + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::TimeoutError + * Not all data is acknowledged before timeout elapsed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void wait_for_acknowledgments(const dds::core::Duration& timeout); + + //========================================================================== + + /** + * Return the DomainParticipant that owns this Publisher. + * + * @return the DomainParticipant + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + const dds::domain::DomainParticipant& participant() const; + +}; + + +#endif /* OMG_TDDS_PUB_PUBLISHER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/TSuspendedPublication.hpp b/unitree_SDK/include/ddscxx/dds/pub/TSuspendedPublication.hpp new file mode 100644 index 0000000..cca163e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/TSuspendedPublication.hpp @@ -0,0 +1,133 @@ +#ifndef OMG_TDDS_PUB_SUSPENDED_PUBLICATION_HPP_ +#define OMG_TDDS_PUB_SUSPENDED_PUBLICATION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace pub +{ +template +class TSuspendedPublication; +} +} + +/** + * @brief + * Class for RAII way of suspending/resuming publication. + * + * Suspended publication indicates to the Service that the application is about + * to make multiple modifications using DataWriter objects belonging to + * the Publisher. + * + * It is a hint to the Service so it can optimize its performance by, + * e.g., holding the dissemination of the modifications and then batching + * them. It is not required that the Service use this hint in any way. + * + * When a Suspended publication is started, it must be matched by + * a corresponding call to SuspendedPublication::resume() or the destruction + * of the SuspendedPublication object (which is an implicit resume), + * indicating that the set of modifications has + * completed. If the Publisher is deleted before the resume, + * any suspended updates yet to be published will be discarded. + * + * This object suspends the publication of all DataWriter objects contained by + * the given Publisher. The data written, disposed or unregistered by a DataWriter is + * stored in the history buffer of the DataWriter and therefore, depending on its QoS + * settings, the following operations may block (see the operation descriptions for + * more information): + * - dds::pub::DataWriter.write (and its overloaded counterparts). + * - dds::pub::DataWriter.operator<< (and its overloaded counterparts). + * - dds::pub::DataWriter.unregister_instance (and its overloaded counterparts). + * - dds::pub::DataWriter.dispose_instance (and its overloaded counterparts). + * + * @see for more information: @ref DCPS_Modules_Publication "Publication" + * @see dds::pub::Publisher + */ +template +class dds::pub::TSuspendedPublication : public dds::core::Value +{ +public: + /** + * Creating a SuspendedPublication object, which will suspend the + * dissemination of the publications by all contained DataWriter objects + * of the given Publisher. + * + * @param pub The publisher to supsend publications on. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The Publisher has already been closed. + * @throws dds::core::NotEnabledError + * The Publisher has not yet been enabled. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NullReferenceError + * The Publisher was not properly created and references to dds::core::null. + */ + explicit TSuspendedPublication(const dds::pub::Publisher& pub); + +public: + /** + * This operation will explicitly resume the publication of all + * DataWriter objects contained by the given Publisher at construction. + * + * All data held in the history + * buffer of the DataWriter's is actively published to the consumers. When the + * operation returns all DataWriter's have resumed the publication of suspended + * updates. + * + * If the Publisher already resumed its publication (by a call to this very + * operation), then a call to this operation will have no effect. + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The Publisher has already been closed. + * @throws dds::core::NotEnabledError + * The Publisher has not yet been enabled. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NullReferenceError + * The Publisher was not properly created and references to dds::core::null. + */ + void resume(); + +public: + /** + * The destruction of the SuspendedPublication will implicitly resume + * the publication if not already resumed by a call to resume(). + * + * All data held in the history + * buffer of the DataWriter's is actively published to the consumers. When the + * operation returns all DataWriter's have resumed the publication of suspended + * updates. + * + * When there is a problem with which resume() would normally throw an exception, + * then that exception is swallowed. Errors can be found in the logs. + */ + ~TSuspendedPublication(); +}; + + +#endif /* OMG_TDDS_PUB_SUSPENDED_PUBLICATION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/ddspub.hpp b/unitree_SDK/include/ddscxx/dds/pub/ddspub.hpp new file mode 100644 index 0000000..b174cd8 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/ddspub.hpp @@ -0,0 +1,32 @@ +#ifndef OMG_DDS_PUB_PACKAGE_INCLUDE_HPP_ +#define OMG_DDS_PUB_PACKAGE_INCLUDE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +#include +#include +#include +#include +#include +#include + +#include + +#endif /* OMG_DDS_PUB_PACKAGE_INCLUDE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/AnyDataWriter.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/AnyDataWriter.hpp new file mode 100644 index 0000000..c4ab5ae --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/AnyDataWriter.hpp @@ -0,0 +1,22 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_PUB_DETAIL_ANYDATAWRITER_HPP_ +#define OMG_DDS_PUB_DETAIL_ANYDATAWRITER_HPP_ + +#include +#include + +namespace dds { namespace pub { namespace detail { + typedef dds::pub::TAnyDataWriter AnyDataWriter; +} } } + +#endif /* OMG_DDS_PUB_DETAIL_ANYDATAWRITER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/CoherentSet.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/CoherentSet.hpp new file mode 100644 index 0000000..e685eac --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/CoherentSet.hpp @@ -0,0 +1,26 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_PUB_DETAIL_COHERENT_SET_HPP_ +#define OMG_DDS_PUB_DETAIL_COHERENT_SET_HPP_ + +#include +#include + +namespace dds { + namespace pub { + namespace detail { + typedef dds::pub::TCoherentSet CoherentSet; + } + } +} + +#endif /* OMG_DDS_PUB_DETAIL_COHERENT_SET_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/DataWriter.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/DataWriter.hpp new file mode 100644 index 0000000..4005838 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/DataWriter.hpp @@ -0,0 +1,195 @@ +#ifndef OMG_DDS_PUB_DETAIL_DATA_WRITER_HPP_ +#define OMG_DDS_PUB_DETAIL_DATA_WRITER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace dds { + namespace pub { + + template + class DataWriterListener; + + namespace detail { + template + class DataWriter; + } + + template class DELEGATE> + class DataWriter; + } +} + + + +/*************************************************************************** + * + * dds/pub/detail/DataWriter<> DELEGATE declaration. + * Implementation can be found in dds/pub/detail/DataWriterImpl.hpp + * + ***************************************************************************/ +template +class dds::pub::detail::DataWriter : public ::org::eclipse::cyclonedds::pub::AnyDataWriterDelegate { +public: + + typedef typename ::dds::core::smart_ptr_traits< DataWriter >::ref_type ref_type; + typedef typename ::dds::core::smart_ptr_traits< DataWriter >::weak_ref_type weak_ref_type; + + DataWriter(const dds::pub::Publisher& pub, + const ::dds::topic::Topic& topic, + const dds::pub::qos::DataWriterQos& qos, + dds::pub::DataWriterListener* listener, + const dds::core::status::StatusMask& mask); + + virtual ~DataWriter(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + bool is_loan_supported(); + + T& loan_sample(); + + void return_loan(T& sample); + + void write_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample); + + void write_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample, const dds::core::Time& timestamp); + + void dispose_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample); + + void dispose_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample, const dds::core::Time& timestamp); + + void unregister_instance_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample); + + void unregister_instance_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample, const dds::core::Time& timestamp); + + void write(const T& sample); + + void write(const T& sample, const dds::core::Time& timestamp); + + void write(const T& sample, const ::dds::core::InstanceHandle& instance); + + void write(const T& sample, + const ::dds::core::InstanceHandle& instance, + const dds::core::Time& timestamp); + + void write(const dds::topic::TopicInstance& i); + + void write(const dds::topic::TopicInstance& i, + const dds::core::Time& timestamp); + + void writedispose(const T& sample); + + void writedispose(const T& sample, const dds::core::Time& timestamp); + + void writedispose(const T& sample, const ::dds::core::InstanceHandle& instance); + + void writedispose(const T& sample, + const ::dds::core::InstanceHandle& instance, + const dds::core::Time& timestamp); + + void writedispose(const dds::topic::TopicInstance& i); + + void writedispose(const dds::topic::TopicInstance& i, + const dds::core::Time& timestamp); + + template + void writedispose(const FWIterator& begin, const FWIterator& end); + + template + void writedispose(const FWIterator& begin, const FWIterator& end, + const dds::core::Time& timestamp); + + template + void writedispose(const SamplesFWIterator& data_begin, + const SamplesFWIterator& data_end, + const HandlesFWIterator& handle_begin, + const HandlesFWIterator& handle_end); + + template + void writedispose(const SamplesFWIterator& data_begin, + const SamplesFWIterator& data_end, + const HandlesFWIterator& handle_begin, + const HandlesFWIterator& handle_end, + const dds::core::Time& timestamp); + + const ::dds::core::InstanceHandle register_instance(const T& key, + const dds::core::Time& timestamp); + + void unregister_instance(const ::dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void unregister_instance(const T& sample, + const dds::core::Time& timestamp); + + void dispose_instance(const ::dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void dispose_instance(const T& sample, + const dds::core::Time& timestamp); + + dds::topic::TopicInstance& key_value(dds::topic::TopicInstance& i, + const ::dds::core::InstanceHandle& h); + + T& key_value(T& sample, const ::dds::core::InstanceHandle& h); + + dds::core::InstanceHandle lookup_instance(const T& key); + + const dds::topic::Topic& topic() const; + + virtual const dds::pub::Publisher& publisher() const; + + void listener(DataWriterListener* listener, + const ::dds::core::status::StatusMask& mask); + + DataWriterListener* listener() const; + + virtual void close(); + + dds::pub::DataWriter wrapper(); + + void on_offered_deadline_missed(dds_entity_t, + org::eclipse::cyclonedds::core::OfferedDeadlineMissedStatusDelegate &sd); + + void on_offered_incompatible_qos(dds_entity_t, + org::eclipse::cyclonedds::core::OfferedIncompatibleQosStatusDelegate &sd); + + void on_liveliness_lost(dds_entity_t, + org::eclipse::cyclonedds::core::LivelinessLostStatusDelegate &sd); + + void on_publication_matched(dds_entity_t, + org::eclipse::cyclonedds::core::PublicationMatchedStatusDelegate &sd); + +private: + dds::pub::Publisher pub_; + dds::topic::Topic topic_; +}; + + + + +#endif /* OMG_DDS_PUB_DETAIL_DATA_WRITER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/DataWriterImpl.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/DataWriterImpl.hpp new file mode 100644 index 0000000..47e5ce3 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/DataWriterImpl.hpp @@ -0,0 +1,982 @@ +#ifndef OMG_DDS_PUB_DATA_WRITER_IMPL_HPP_ +#define OMG_DDS_PUB_DATA_WRITER_IMPL_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + + + +/*************************************************************************** + * + * dds/pub/DataWriter<> WRAPPER implementation. + * Declaration can be found in dds/pub/DataWriter.hpp + * + ***************************************************************************/ + +#include +#include +#include +#include + +namespace dds +{ +namespace pub +{ + +template class DELEGATE> +DataWriter::DataWriter( + const dds::pub::Publisher& pub, + const dds::topic::Topic& topic) : + dds::core::Reference< DELEGATE >( + new DELEGATE(pub, topic, pub.default_datawriter_qos(), NULL, dds::core::status::StatusMask::none())) +{ + this->delegate()->init(this->impl_); +} + +template class DELEGATE> +DataWriter::DataWriter(const dds::pub::Publisher& pub, + const ::dds::topic::Topic& topic, + const dds::pub::qos::DataWriterQos& qos, + dds::pub::DataWriterListener* listener, + const dds::core::status::StatusMask& mask) : + dds::core::Reference< DELEGATE >( + new DELEGATE(pub, topic, qos, listener, mask)) +{ + this->delegate()->init(this->impl_); +} + +template class DELEGATE> +void +DataWriter::write(const T& sample) +{ + this->delegate()->write(sample); +} + +template class DELEGATE> +void +DataWriter::write(const T& sample, const dds::core::Time& timestamp) +{ + this->delegate()->write(sample, timestamp); +} + +template class DELEGATE> +void +DataWriter::write(const T& sample, const ::dds::core::InstanceHandle& instance) +{ + this->delegate()->write(sample, instance); +} + +template class DELEGATE> +void +DataWriter::write(const T& sample, + const ::dds::core::InstanceHandle& instance, + const dds::core::Time& timestamp) +{ + this->delegate()->write(sample, instance, timestamp); +} + +template class DELEGATE> +void +DataWriter::write(const dds::topic::TopicInstance& i) +{ + this->delegate()->write(i); +} + +template class DELEGATE> +void +DataWriter::write(const dds::topic::TopicInstance& i, + const dds::core::Time& timestamp) +{ + this->delegate()->write(i, timestamp); +} + +template class DELEGATE> +template +void +DataWriter::write(const FWIterator& begin, const FWIterator& end) +{ + FWIterator b = begin; + while(b != end) + { + this->delegate()->write(*b); + ++b; + } +} + +template class DELEGATE> +template +void +DataWriter::write(const FWIterator& begin, const FWIterator& end, + const dds::core::Time& timestamp) +{ + FWIterator b = begin; + while(b != end) + { + this->delegate()->write(*b, timestamp); + ++b; + } +} + +template class DELEGATE> +template +void +DataWriter::write(const SamplesFWIterator& data_begin, + const SamplesFWIterator& data_end, + const HandlesFWIterator& handle_begin, + const HandlesFWIterator& handle_end) +{ + SamplesFWIterator data = data_begin; + HandlesFWIterator handle = handle_begin; + + while(data != data_end && handle != handle_end) + { + this->delegate()->write(*data, *handle); + ++data; + ++handle; + } +} + +template class DELEGATE> +template +void +DataWriter::write(const SamplesFWIterator& data_begin, + const SamplesFWIterator& data_end, + const HandlesFWIterator& handle_begin, + const HandlesFWIterator& handle_end, + const dds::core::Time& timestamp) +{ + SamplesFWIterator data = data_begin; + HandlesFWIterator handle = handle_begin; + + while(data != data_end && handle != handle_end) + { + this->delegate()->write(*data, *handle, timestamp); + ++data; + ++handle; + } +} + +template class DELEGATE> +DataWriter& +DataWriter::operator <<(const ::dds::pub::qos::DataWriterQos& qos) +{ + this->delegate()->qos(qos); + return *this; +} + +template class DELEGATE> +DataWriter& +DataWriter::operator << (const T& data) +{ + this->write(data); + return *this; +} + +template class DELEGATE> +DataWriter& +DataWriter::operator << (const std::pair& data) +{ + this->write(data.first, data.second); + return *this; +} + +template class DELEGATE> +DataWriter& +DataWriter::operator << (const std::pair& data) +{ + this->write(data.first, data.second); + return *this; +} + +template class DELEGATE> +DataWriter& +DataWriter::operator <<(DataWriter & (*manipulator)(DataWriter&)) +{ + return manipulator(*this); +} + +template class DELEGATE> +const dds::core::InstanceHandle +DataWriter::register_instance(const T& key) +{ + /* Invalid time will be used as current time. */ + return this->delegate()->register_instance(key, dds::core::Time::invalid()); +} + +template class DELEGATE> +const dds::core::InstanceHandle +DataWriter::register_instance(const T& key, + const dds::core::Time& timestamp) +{ + return this->delegate()->register_instance(key, timestamp); +} + +template class DELEGATE> +DataWriter& +DataWriter::unregister_instance(const ::dds::core::InstanceHandle& i) +{ + /* Invalid time will be used as current time. */ + this->delegate()->unregister_instance(i, dds::core::Time::invalid()); + return *this; +} + +template class DELEGATE> +DataWriter& +DataWriter::unregister_instance(const ::dds::core::InstanceHandle& i, + const dds::core::Time& timestamp) +{ + this->delegate()->unregister_instance(i, timestamp); + return *this; +} + +template class DELEGATE> +DataWriter& +DataWriter::unregister_instance(const T& key) +{ + /* Invalid time will be used as current time. */ + this->delegate()->unregister_instance(key, dds::core::Time::invalid()); + return *this; +} + +template class DELEGATE> +DataWriter& +DataWriter::unregister_instance(const T& key, + const dds::core::Time& timestamp) +{ + this->delegate()->unregister_instance(key, timestamp); + return *this; +} + +template class DELEGATE> +DataWriter& +DataWriter::dispose_instance(const ::dds::core::InstanceHandle& i) +{ + /* Invalid time will be used as current time. */ + this->delegate()->dispose_instance(i, dds::core::Time::invalid()); + return *this; +} + +template class DELEGATE> +DataWriter& +DataWriter::dispose_instance(const ::dds::core::InstanceHandle& i, + const dds::core::Time& timestamp) +{ + this->delegate()->dispose_instance(i, timestamp); + return *this; +} + +template class DELEGATE> +DataWriter& +DataWriter::dispose_instance(const T& key) +{ + /* Invalid time will be used as current time. */ + this->delegate()->dispose_instance(key, dds::core::Time::invalid()); + return *this; +} + +template class DELEGATE> +DataWriter& +DataWriter::dispose_instance(const T& key, + const dds::core::Time& timestamp) +{ + this->delegate()->dispose_instance(key, timestamp); + return *this; +} + +template class DELEGATE> +dds::topic::TopicInstance& +DataWriter::key_value(dds::topic::TopicInstance& i, + const ::dds::core::InstanceHandle& h) +{ + return this->delegate()->key_value(i, h); +} + +template class DELEGATE> +T& +DataWriter::key_value(T& sample, const ::dds::core::InstanceHandle& h) +{ + return this->delegate()->key_value(sample, h); +} + +template class DELEGATE> +dds::core::InstanceHandle +DataWriter::lookup_instance(const T& key) +{ + return this->delegate()->lookup_instance(key); +} + +template class DELEGATE> +const dds::topic::Topic& +DataWriter::topic() const +{ + return this->delegate()->topic(); +} + +template class DELEGATE> +void +DataWriter::listener(DataWriterListener* listener, + const ::dds::core::status::StatusMask& mask) +{ + this->delegate()->listener(listener, mask); +} + +template class DELEGATE> +DataWriterListener* +DataWriter::listener() const +{ + return this->delegate()->listener(); +} + +} +} + + + + +/*************************************************************************** + * + * dds/pub/detail/DataWriter<> DELEGATE implementation. + * Declaration can be found in dds/pub/detail/DataWriter.hpp + * + * Implementation and declaration have been separated because some circular + * dependencies, like with DataWriterListener and AnyDataWriter. + * + ***************************************************************************/ + +#include +#include +#include + +template +dds::pub::detail::DataWriter::DataWriter( + const dds::pub::Publisher& pub, + const ::dds::topic::Topic& topic, + const dds::pub::qos::DataWriterQos& qos, + dds::pub::DataWriterListener* listener, + const dds::core::status::StatusMask& mask) + : ::org::eclipse::cyclonedds::pub::AnyDataWriterDelegate(qos, topic), pub_(pub), topic_(topic) +{ + DDSCXX_WARNING_MSVC_OFF(6326) + if (dds::topic::is_topic_type::value == 0) { + ISOCPP_THROW_EXCEPTION(ISOCPP_PRECONDITION_NOT_MET_ERROR, "DataWriter cannot be created, topic information not found"); + } + DDSCXX_WARNING_MSVC_ON(6326) + + org::eclipse::cyclonedds::pub::qos::DataWriterQosDelegate dwQos = qos.delegate(); + + dds_entity_t ddsc_pub = static_cast(pub.delegate()->get_ddsc_entity()); + dds_entity_t ddsc_topic = static_cast(topic.delegate()->get_ddsc_entity()); + + // get and validate the ddsc qos + dwQos.check(); + dds_qos_t *ddsc_qos = dwQos.ddsc_qos(); + + std::string name = topic.name() + "_datawriter"; + + dds_entity_t ddsc_writer = dds_create_writer (ddsc_pub, ddsc_topic, ddsc_qos, NULL); + dds_delete_qos(ddsc_qos); + ISOCPP_DDSC_RESULT_CHECK_AND_THROW(ddsc_writer, "Could not create DataWriter."); + topic_.delegate()->incrNrDependents(); + + this->set_ddsc_entity(ddsc_writer); + + this->listener(listener, mask); +} + +template +dds::pub::detail::DataWriter::~DataWriter() +{ + if (!this->closed) { + try { + this->close(); + } catch (...) { + /* Empty: the exception throw should have already traced an error. */ + } + } +} + +template +void +dds::pub::detail::DataWriter::init(ObjectDelegate::weak_ref_type weak_ref) +{ + /* Set weak_ref before passing ourselves to other isocpp objects. */ + this->set_weak_ref(weak_ref); + /* Add weak_ref to the map of entities */ + this->add_to_entity_map(weak_ref); + /* Register writer at publisher. */ + this->pub_.delegate()->add_datawriter(*this); + + // Because listeners are added after writer is created (which is in enabled state, because + // disabled state is not yet supported), events could have occured before listeners were + // registered. Therefore the event handlers for those events are called here. + if (this->listener_get()) { + dds::core::status::StatusMask writerStatus = status_changes(); + + if (listener_mask.to_ulong() & dds::core::status::StatusMask::liveliness_lost().to_ulong() + && writerStatus.test(DDS_LIVELINESS_LOST_STATUS_ID)) + { + dds::core::status::LivelinessLostStatus status = liveliness_lost_status(); + on_liveliness_lost(this->ddsc_entity, status); + } + if (listener_mask.to_ulong() & dds::core::status::StatusMask::offered_deadline_missed().to_ulong() + && writerStatus.test(DDS_OFFERED_DEADLINE_MISSED_STATUS_ID)) + { + dds::core::status::OfferedDeadlineMissedStatus status = offered_deadline_missed_status(); + on_offered_deadline_missed(this->ddsc_entity, status); + } + if (listener_mask.to_ulong() & dds::core::status::StatusMask::offered_incompatible_qos().to_ulong() + && writerStatus.test(DDS_OFFERED_INCOMPATIBLE_QOS_STATUS_ID)) + { + dds::core::status::OfferedIncompatibleQosStatus status = offered_incompatible_qos_status(); + on_offered_incompatible_qos(this->ddsc_entity, status); + } + if (listener_mask.to_ulong() & dds::core::status::StatusMask::publication_matched().to_ulong() + && writerStatus.test(DDS_PUBLICATION_MATCHED_STATUS_ID)) + { + dds::core::status::PublicationMatchedStatus status = publication_matched_status(); + on_publication_matched(this->ddsc_entity, status); + } + } + + /* Enable when needed. */ + if (this->pub_.delegate()->is_auto_enable()) { + this->enable(); + } +} + +template +bool +dds::pub::detail::DataWriter::is_loan_supported() +{ + this->check(); + return AnyDataWriterDelegate::is_loan_supported(static_cast(this->ddsc_entity)); +} + +template +T& +dds::pub::detail::DataWriter::loan_sample() +{ + T *sample; + this->check(); + AnyDataWriterDelegate::loan_sample(static_cast(this->ddsc_entity), reinterpret_cast(&sample)); + return *sample; +} + +template +void +dds::pub::detail::DataWriter::return_loan(T& sample) +{ + this->check(); + AnyDataWriterDelegate::return_loan(static_cast(this->ddsc_entity), &sample); +} + +template +void +dds::pub::detail::DataWriter::write_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample) +{ + this->check(); + AnyDataWriterDelegate::write_cdr(static_cast(this->ddsc_entity), + &sample, + dds::core::InstanceHandle(dds::core::null), + dds::core::Time::invalid()); +} + +template +void +dds::pub::detail::DataWriter::write_cdr( + const org::eclipse::cyclonedds::topic::CDRBlob& sample, + const dds::core::Time& timestamp) +{ + this->check(); + AnyDataWriterDelegate::write_cdr(static_cast(this->ddsc_entity), + &sample, + dds::core::InstanceHandle(dds::core::null), + timestamp); +} + +template +void +dds::pub::detail::DataWriter::dispose_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample) +{ + this->check(); + AnyDataWriterDelegate::dispose_cdr(static_cast(this->ddsc_entity), + &sample, + dds::core::InstanceHandle(dds::core::null), + dds::core::Time::invalid()); +} + +template +void +dds::pub::detail::DataWriter::dispose_cdr( + const org::eclipse::cyclonedds::topic::CDRBlob& sample, + const dds::core::Time& timestamp) +{ + this->check(); + AnyDataWriterDelegate::dispose_cdr(static_cast(this->ddsc_entity), + &sample, + dds::core::InstanceHandle(dds::core::null), + timestamp); +} + +template +void +dds::pub::detail::DataWriter::unregister_instance_cdr(const org::eclipse::cyclonedds::topic::CDRBlob& sample) +{ + this->check(); + AnyDataWriterDelegate::unregister_instance_cdr(static_cast(this->ddsc_entity), + &sample, + dds::core::InstanceHandle(dds::core::null), + dds::core::Time::invalid()); +} + +template +void +dds::pub::detail::DataWriter::unregister_instance_cdr( + const org::eclipse::cyclonedds::topic::CDRBlob& sample, + const dds::core::Time& timestamp) +{ + this->check(); + AnyDataWriterDelegate::unregister_instance_cdr(static_cast(this->ddsc_entity), + &sample, + dds::core::InstanceHandle(dds::core::null), + timestamp); +} + +template +void +dds::pub::detail::DataWriter::write(const T& sample) +{ + this->check(); + AnyDataWriterDelegate::write(static_cast(this->ddsc_entity), + &sample, + dds::core::InstanceHandle(dds::core::null), + dds::core::Time::invalid()); +} + +template +void +dds::pub::detail::DataWriter::write(const T& sample, const dds::core::Time& timestamp) +{ + this->check(); + AnyDataWriterDelegate::write(static_cast(this->ddsc_entity), + &sample, + dds::core::InstanceHandle(dds::core::null), + timestamp); +} + +template +void +dds::pub::detail::DataWriter::write(const T& sample, const ::dds::core::InstanceHandle& instance) +{ + this->check(); + AnyDataWriterDelegate::write(static_cast(this->ddsc_entity), + &sample, + instance, + dds::core::Time::invalid()); +} + +template +void +dds::pub::detail::DataWriter::write(const T& sample, + const ::dds::core::InstanceHandle& instance, + const dds::core::Time& timestamp) +{ + this->check(); + AnyDataWriterDelegate::write(static_cast(this->ddsc_entity), + &sample, + instance, + timestamp); +} + +template +void +dds::pub::detail::DataWriter::write(const dds::topic::TopicInstance& i) +{ + this->check(); + AnyDataWriterDelegate::write(static_cast(this->ddsc_entity), + &i.sample(), + i.handle(), + dds::core::Time::invalid()); +} + +template +void +dds::pub::detail::DataWriter::write(const dds::topic::TopicInstance& i, + const dds::core::Time& timestamp) +{ + this->check(); + AnyDataWriterDelegate::write(static_cast(this->ddsc_entity), + &i.sample(), + i.handle(), + timestamp); +} + +template +void +dds::pub::detail::DataWriter::writedispose(const T& sample) +{ + this->check(); + AnyDataWriterDelegate::writedispose( + static_cast(this->ddsc_entity), + &sample, + dds::core::InstanceHandle(dds::core::null), + dds::core::Time::invalid()); +} + +template +void +dds::pub::detail::DataWriter::writedispose(const T& sample, const dds::core::Time& timestamp) +{ + this->check(); + AnyDataWriterDelegate::writedispose( + static_cast(this->ddsc_entity), + &sample, + dds::core::InstanceHandle(dds::core::null), + timestamp); +} + +template +void +dds::pub::detail::DataWriter::writedispose(const T& sample, const ::dds::core::InstanceHandle& instance) +{ + this->check(); + AnyDataWriterDelegate::writedispose( + static_cast(this->ddsc_entity), + &sample, + instance, + dds::core::Time::invalid()); +} + +template +void +dds::pub::detail::DataWriter::writedispose( + const T& sample, + const ::dds::core::InstanceHandle& instance, + const dds::core::Time& timestamp) +{ + this->check(); + AnyDataWriterDelegate::writedispose( + static_cast(this->ddsc_entity), + &sample, + instance, + timestamp); +} + +template +void +dds::pub::detail::DataWriter::writedispose(const dds::topic::TopicInstance& i) +{ + this->check(); + AnyDataWriterDelegate::writedispose( + static_cast(this->ddsc_entity), + &i.sample(), + i.handle(), + dds::core::Time::invalid()); +} + +template +void +dds::pub::detail::DataWriter::writedispose( + const dds::topic::TopicInstance& i, + const dds::core::Time& timestamp) +{ + this->check(); + AnyDataWriterDelegate::writedispose( + static_cast(this->ddsc_entity), + &i.sample(), + i.handle(), + timestamp); +} + +template +template +void +dds::pub::detail::DataWriter::writedispose(const FWIterator& begin, const FWIterator& end) +{ + FWIterator b = begin; + while(b != end) + { + this->writedispose(*b); + ++b; + } +} + +template +template +void +dds::pub::detail::DataWriter::writedispose(const FWIterator& begin, const FWIterator& end, + const dds::core::Time& timestamp) +{ + FWIterator b = begin; + while(b != end) + { + this->writedispose(*b, timestamp); + ++b; + } +} + +template +template +void +dds::pub::detail::DataWriter::writedispose( + const SamplesFWIterator& data_begin, + const SamplesFWIterator& data_end, + const HandlesFWIterator& handle_begin, + const HandlesFWIterator& handle_end) +{ + SamplesFWIterator data = data_begin; + HandlesFWIterator handle = handle_begin; + + while(data != data_end && handle != handle_end) + { + this->writedispose(*data, *handle); + ++data; + ++handle; + } +} + +template +template +void +dds::pub::detail::DataWriter::writedispose( + const SamplesFWIterator& data_begin, + const SamplesFWIterator& data_end, + const HandlesFWIterator& handle_begin, + const HandlesFWIterator& handle_end, + const dds::core::Time& timestamp) +{ + SamplesFWIterator data = data_begin; + HandlesFWIterator handle = handle_begin; + + while(data != data_end && handle != handle_end) + { + this->writedispose(*data, *handle, timestamp); + ++data; + ++handle; + } +} + +template +const ::dds::core::InstanceHandle +dds::pub::detail::DataWriter::register_instance(const T& key, + const dds::core::Time& timestamp) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + dds::core::InstanceHandle handle(AnyDataWriterDelegate::register_instance(static_cast(this->ddsc_entity), &key, timestamp)); + return handle; +} + +template +void +dds::pub::detail::DataWriter::unregister_instance(const ::dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + AnyDataWriterDelegate::unregister_instance(static_cast(this->ddsc_entity), handle, timestamp); +} + +template +void +dds::pub::detail::DataWriter::unregister_instance(const T& sample, + const dds::core::Time& timestamp) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + AnyDataWriterDelegate::unregister_instance(static_cast(this->ddsc_entity), &sample, timestamp); +} + +template +void +dds::pub::detail::DataWriter::dispose_instance(const ::dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + AnyDataWriterDelegate::dispose_instance(static_cast(this->ddsc_entity), handle, timestamp); +} + +template +void +dds::pub::detail::DataWriter::dispose_instance(const T& sample, + const dds::core::Time& timestamp) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + AnyDataWriterDelegate::dispose_instance(static_cast(this->ddsc_entity), &sample, timestamp); +} + + +template +dds::topic::TopicInstance& +dds::pub::detail::DataWriter::key_value(dds::topic::TopicInstance& i, + const ::dds::core::InstanceHandle& h) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + T sample; + AnyDataWriterDelegate::get_key_value(static_cast(this->ddsc_entity), &sample, h); + i.handle(h); + i.sample(sample); + return i; +} + +template +T& +dds::pub::detail::DataWriter::key_value(T& sample, const ::dds::core::InstanceHandle& h) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + AnyDataWriterDelegate::get_key_value(static_cast(this->ddsc_entity), &sample, h); + return sample; +} + +template +dds::core::InstanceHandle +dds::pub::detail::DataWriter::lookup_instance(const T& key) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + dds::core::InstanceHandle handle(AnyDataWriterDelegate::lookup_instance(static_cast(this->ddsc_entity), &key)); + return handle; +} + +template +const dds::topic::Topic& +dds::pub::detail::DataWriter::topic() const +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + return this->topic_; +} + +template +const dds::pub::Publisher& +dds::pub::detail::DataWriter::publisher() const +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + return this->pub_; +} + +template +void +dds::pub::detail::DataWriter::listener(DataWriterListener* listener, + const ::dds::core::status::StatusMask& mask) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + this->listener_set(listener, mask); +} + +template +dds::pub::DataWriterListener* +dds::pub::detail::DataWriter::listener() const +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->check(); + return reinterpret_cast*>(this->listener_get()); +} + +template +void +dds::pub::detail::DataWriter::close() +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + this->listener_set(NULL, dds::core::status::StatusMask::none()); + + topic_.delegate()->decrNrDependents(); + + this->pub_.delegate()->remove_datawriter(*this); + + org::eclipse::cyclonedds::pub::AnyDataWriterDelegate::close(); + + scopedLock.unlock(); +} + +template +dds::pub::DataWriter +dds::pub::detail::DataWriter::wrapper() +{ + typename DataWriter::ref_type ref = + ::std::dynamic_pointer_cast >(this->get_strong_ref()); + dds::pub::DataWriter writer(ref); + + return writer; +} + +template +void dds::pub::detail::DataWriter::on_offered_deadline_missed(dds_entity_t, + org::eclipse::cyclonedds::core::OfferedDeadlineMissedStatusDelegate &sd) +{ + dds::core::status::OfferedDeadlineMissedStatus s; + s.delegate() = sd; + + dds::pub::DataWriter dw = wrapper(); + + dds::pub::DataWriterListener *l = + reinterpret_cast *>(this->listener_get()); + l->on_offered_deadline_missed(dw, s); +} + +template +void dds::pub::detail::DataWriter::on_offered_incompatible_qos(dds_entity_t, + org::eclipse::cyclonedds::core::OfferedIncompatibleQosStatusDelegate &sd) +{ + dds::core::status::OfferedIncompatibleQosStatus s; + s.delegate() = sd; + + dds::pub::DataWriter dw = wrapper(); + + dds::pub::DataWriterListener *l = + reinterpret_cast *>(this->listener_get()); + l->on_offered_incompatible_qos(dw, s); +} + +template +void dds::pub::detail::DataWriter::on_liveliness_lost(dds_entity_t, + org::eclipse::cyclonedds::core::LivelinessLostStatusDelegate &sd) +{ + dds::core::status::LivelinessLostStatus s; + s.delegate() = sd; + + dds::pub::DataWriter dw = wrapper(); + + dds::pub::DataWriterListener *l = + reinterpret_cast *>(this->listener_get()); + l->on_liveliness_lost(dw, s); +} + +template +void dds::pub::detail::DataWriter::on_publication_matched(dds_entity_t, + org::eclipse::cyclonedds::core::PublicationMatchedStatusDelegate &sd) +{ + dds::core::status::PublicationMatchedStatus s; + s.delegate() = sd; + + dds::pub::DataWriter dw = wrapper(); + + dds::pub::DataWriterListener *l = + reinterpret_cast *>(this->listener_get()); + l->on_publication_matched(dw, s); +} + +#endif /* OMG_DDS_PUB_DATA_WRITER_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/Publisher.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/Publisher.hpp new file mode 100644 index 0000000..53e9648 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/Publisher.hpp @@ -0,0 +1,29 @@ +#ifndef OMG_DDS_PUB_DETAIL_PUBLISHER_HPP_ +#define OMG_DDS_PUB_DETAIL_PUBLISHER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds { namespace pub { namespace detail { + typedef dds::pub::TPublisher Publisher; +} } } + +#endif /* OMG_DDS_PUB_DETAIL_PUBLISHER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/SuspendedPublication.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/SuspendedPublication.hpp new file mode 100644 index 0000000..cd54c69 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/SuspendedPublication.hpp @@ -0,0 +1,22 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_PUB_DETAIL_SUSPENDED_PUBLICATION_HPP_ +#define OMG_DDS_PUB_DETAIL_SUSPENDED_PUBLICATION_HPP_ + +#include +#include + +namespace dds { namespace pub { namespace detail { + typedef dds::pub::TSuspendedPublication SuspendedPublication; +} } } + +#endif /* OMG_DDS_PUB_DETAIL_SUSPENDED_PUBLICATION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/TAnyDataWriterImpl.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/TAnyDataWriterImpl.hpp new file mode 100644 index 0000000..95ac553 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/TAnyDataWriterImpl.hpp @@ -0,0 +1,121 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_PUB_DETAIL_TANYDATAWRITER_HPP_ +#define OMG_DDS_PUB_DETAIL_TANYDATAWRITER_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace pub +{ + +template +const dds::pub::Publisher& +TAnyDataWriter::publisher() const +{ + return this->delegate()->publisher(); +} + +template +const dds::topic::TopicDescription& +TAnyDataWriter::topic_description() const +{ + return this->delegate()->topic_description(); +} + +template +dds::pub::qos::DataWriterQos +TAnyDataWriter::qos() const +{ + return this->delegate()->qos(); +} + +template +void +TAnyDataWriter::qos(const dds::pub::qos::DataWriterQos& qos) +{ + this->delegate()->qos(qos); +} + +template +TAnyDataWriter& +TAnyDataWriter::operator << (const dds::pub::qos::DataWriterQos& qos) +{ + this->delegate()->qos(qos); + return *this; +} + +template +const TAnyDataWriter& +TAnyDataWriter::operator >> (dds::pub::qos::DataWriterQos& qos) const +{ + qos = this->delegate()->qos(); + return *this; +} + +template +void +TAnyDataWriter::wait_for_acknowledgments(const dds::core::Duration& timeout) +{ + this->delegate()->wait_for_acknowledgments(timeout); +} + +template +const ::dds::core::status::LivelinessLostStatus +TAnyDataWriter::liveliness_lost_status() +{ + return this->delegate()->liveliness_lost_status(); +} + +template +const ::dds::core::status::OfferedDeadlineMissedStatus +TAnyDataWriter::offered_deadline_missed_status() +{ + return this->delegate()->offered_deadline_missed_status(); +} + +template +const ::dds::core::status::OfferedIncompatibleQosStatus +TAnyDataWriter::offered_incompatible_qos_status() +{ + return this->delegate()->offered_incompatible_qos_status(); +} + +template +const ::dds::core::status::PublicationMatchedStatus +TAnyDataWriter::publication_matched_status() +{ + return this->delegate()->publication_matched_status(); +} + +template +void +TAnyDataWriter::assert_liveliness() +{ + this->delegate()->assert_liveliness(); +} + +} +} +// End of implementation + +#endif /* OMG_DDS_PUB_DETAIL_TANYDATAWRITER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/TCoherentSetImpl.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/TCoherentSetImpl.hpp new file mode 100644 index 0000000..fa9b320 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/TCoherentSetImpl.hpp @@ -0,0 +1,52 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_PUB_TCOHERENTSET_IMPL_HPP_ +#define CYCLONEDDS_DDS_PUB_TCOHERENTSET_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include + +// Implementation + +namespace dds +{ +namespace pub +{ + +template +TCoherentSet::TCoherentSet(const dds::pub::Publisher& pub) : dds::core::Value(pub) { } + +template +void TCoherentSet::end() +{ + this->delegate().end(); +} + +template +TCoherentSet::~TCoherentSet() +{ + this->delegate().end(); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_PUB_TCOHERENTSET_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/TPublisherImpl.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/TPublisherImpl.hpp new file mode 100644 index 0000000..e571200 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/TPublisherImpl.hpp @@ -0,0 +1,120 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_PUB_TPUBLISHER_IMPL_HPP_ +#define CYCLONEDDS_DDS_PUB_TPUBLISHER_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include + +// Implementation + +namespace dds +{ +namespace pub +{ + +template +TPublisher::TPublisher(const dds::domain::DomainParticipant& dp) + : ::dds::core::Reference(new DELEGATE(dp, + dp.default_publisher_qos(), + NULL, + dds::core::status::StatusMask::none())) +{ + this->delegate()->init(this->impl_); +} + +template +TPublisher::TPublisher(const dds::domain::DomainParticipant& dp, + const dds::pub::qos::PublisherQos& qos, + dds::pub::PublisherListener* listener, + const dds::core::status::StatusMask& mask) + : ::dds::core::Reference(new DELEGATE(dp, qos, listener, mask)) +{ + this->delegate()->init(this->impl_); +} + +template +const dds::pub::qos::PublisherQos& TPublisher::qos() const +{ + return this->delegate()->qos(); +} + +template +void TPublisher::qos(const dds::pub::qos::PublisherQos& pqos) +{ + this->delegate()->qos(pqos); +} + +template +TPublisher& TPublisher::operator <<(const dds::pub::qos::PublisherQos& qos) +{ + this->qos(qos); + return *this; +} + +template +TPublisher& TPublisher::operator >> (dds::pub::qos::PublisherQos& qos) +{ + qos = this->qos(); + return *this; +} + +template +TPublisher& TPublisher::default_datawriter_qos(const dds::pub::qos::DataWriterQos& dwqos) +{ + this->delegate()->default_datawriter_qos(dwqos); + return *this; +} + +template +dds::pub::qos::DataWriterQos TPublisher::default_datawriter_qos() const +{ + return this->delegate()->default_datawriter_qos(); +} + +template +void TPublisher::listener(Listener* plistener, const dds::core::status::StatusMask& event_mask) +{ + this->delegate()->listener(plistener, event_mask); +} + +template +typename TPublisher::Listener* TPublisher::listener() const +{ + return this->delegate()->listener(); +} + +template +void TPublisher::wait_for_acknowledgments(const dds::core::Duration& timeout) +{ + this->delegate()->wait_for_acknowledgments(timeout); +} + +template +const dds::domain::DomainParticipant& TPublisher::participant() const +{ + return this->delegate()->participant(); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_PUB_TPUBLISHER_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/TSuspendedPublicationImpl.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/TSuspendedPublicationImpl.hpp new file mode 100644 index 0000000..776de3f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/TSuspendedPublicationImpl.hpp @@ -0,0 +1,52 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_PUB_TSUSPENDEDPUBLICATION_IMPL_HPP_ +#define CYCLONEDDS_DDS_PUB_TSUSPENDEDPUBLICATION_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include + +// Implementation + +namespace dds +{ +namespace pub +{ + +template +TSuspendedPublication::TSuspendedPublication(const dds::pub::Publisher& pub) : dds::core::Value(pub) { } + +template +void TSuspendedPublication::resume() +{ + this->delegate().resume(); +} + +template +TSuspendedPublication::~TSuspendedPublication() +{ + this->delegate().resume(); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_PUB_TSUSPENDEDPUBLICATION_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/ddspub.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/ddspub.hpp new file mode 100644 index 0000000..626bfb2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/ddspub.hpp @@ -0,0 +1,17 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_PUB_PACKAGE_DETAIL_INCLUDE_HPP_ +#define OMG_DDS_PUB_PACKAGE_DETAIL_INCLUDE_HPP_ + +#include "dds/pub/detail/DataWriterImpl.hpp" + +#endif /* OMG_DDS_PUB_PACKAGE_DETAIL_INCLUDE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/discovery.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/discovery.hpp new file mode 100644 index 0000000..53e6adf --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/discovery.hpp @@ -0,0 +1,62 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DDS_PUB_DETAIL_DISCOVERY_HPP_ +#define CYCLONEDDS_DDS_PUB_DETAIL_DISCOVERY_HPP_ + +#include + +namespace dds +{ +namespace pub +{ + +template +void ignore(const dds::domain::DomainParticipant& dp, FwdIterator begin, FwdIterator end) +{ + (void)dp; + (void)begin; + (void)end; + ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported"); +} + +template +::dds::core::InstanceHandleSeq +matched_subscriptions(const dds::pub::DataWriter& dw) +{ + return dw.delegate()->matched_subscriptions(); +} + +template +uint32_t +matched_subscriptions(const dds::pub::DataWriter& dw, + FwdIterator begin, uint32_t max_size) +{ + return dw.delegate()->matched_subscriptions(begin, max_size); +} + +template +const dds::topic::SubscriptionBuiltinTopicData +matched_subscription_data(const dds::pub::DataWriter& dw, + const ::dds::core::InstanceHandle& h) +{ + return dw.delegate()->matched_subscription_data(h); +} + +} +} +#endif /* CYCLONEDDS_DDS_PUB_DETAIL_DISCOVERY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/detail/find.hpp b/unitree_SDK/include/ddscxx/dds/pub/detail/find.hpp new file mode 100644 index 0000000..ed0423d --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/detail/find.hpp @@ -0,0 +1,81 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DDS_PUB_DETAIL_FIND_HPP_ +#define CYCLONEDDS_DDS_PUB_DETAIL_FIND_HPP_ + +#include + +#include +#include +#include +#include + +namespace dds +{ +namespace pub +{ + +template +uint32_t +find(const dds::pub::Publisher& pub, const std::string& topic_name, + FwdIterator begin, uint32_t max_size) +{ + if(max_size > 0) { + org::eclipse::cyclonedds::pub::AnyDataWriterDelegate::ref_type writer_base = pub.delegate()->find_datawriter(topic_name); + if (writer_base) { + /* Cast base writer to typed delegate: */ + typename WRITER::DELEGATE_REF_T writer_typed = + ::std::dynamic_pointer_cast(writer_base); + WRITER dw(writer_typed); + if(dw != dds::core::null) + { + *begin = dw; + return 1; + } + } + } + return 0; +} + + +template +uint32_t +find(const dds::pub::Publisher& pub, + const std::string& topic_name, + BinIterator begin) +{ + org::eclipse::cyclonedds::pub::AnyDataWriterDelegate::ref_type writer_base = pub.delegate()->find_datawriter(topic_name); + if (writer_base) { + /* Cast base writer to typed delegate: */ + typename WRITER::DELEGATE_REF_T writer_typed = + ::std::dynamic_pointer_cast(writer_base); + WRITER dw(writer_typed); + if(dw != dds::core::null) + { + *begin = dw; + return 1; + } + } + return 0; +} + + +} +} + +#endif /* CYCLONEDDS_DDS_PUB_DETAIL_FIND_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/discovery.hpp b/unitree_SDK/include/ddscxx/dds/pub/discovery.hpp new file mode 100644 index 0000000..a436a58 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/discovery.hpp @@ -0,0 +1,186 @@ +#ifndef OMG_DDS_PUB_DISCOVERY_HPP_ +#define OMG_DDS_PUB_DISCOVERY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include + +namespace dds +{ +namespace pub +{ + +/** + * Ignore publications. + * + * This operation is not yet implemented. It is scheduled for a future release. + * + * @param dp the DomainParticipant for which the remote + * entity will be ignored + * @param handle the InstanceHandle of the remote entity that + * has to be ignored + */ +void OMG_DDS_API ignore(const dds::domain::DomainParticipant& dp, + const dds::core::InstanceHandle& handle); + +/** + * Ignore publications. + * + * This operation is not yet implemented. It is scheduled for a future release. + * + * @param dp the DomainParticipant for which the remote + * entity will be ignored + * @param begin an iterator indicating the beginning of a + * sequence of InstanceHandles of the remote + * Entity that has to be ignored + * @param end an iterator indicating the end of a + * sequence of InstanceHandles of the remote + * Entity that has to be ignored + */ +template +void ignore(const dds::domain::DomainParticipant& dp, FwdIterator begin, FwdIterator end); + +/** + * This operation retrieves the list of subscriptions currently “associated” with the + * DataWriter. That is, subscriptions that have a matching Topic and compatible + * QoS that the application has not indicated should be “ignored” by means of the + * dds::sub::ignore operation on the DomainParticipant class. + * + * The handles returned in the dds::core::InstanceHandleSeq are the ones that + * are used by the DDS implementation to locally identify the corresponding matched + * DataReader entities. You can access more detailed information about a particular + * subscription by passing its subscription_handle to either the + * dds::pub::matched_subscription_data operation or to the read with instance + * operation on the built-in reader for the “DCPSSubscription” topic. + * + * See @ref DCPS_Builtin_Topics "Builtin Topics" for more information. + * + * @param dw the DataWriter + * @return a sequence of handles + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::UnsupportedError + * OpenSplice is configured not to maintain the + * information about “associated” subscriptions. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ +template +::dds::core::InstanceHandleSeq +matched_subscriptions(const dds::pub::DataWriter& dw); + +/** + * This operation retrieves the list of subscriptions currently “associated” with the + * DataWriter. That is, subscriptions that have a matching Topic and compatible + * QoS that the application has not indicated should be “ignored” by means of the + * dds::sub::ignore operation on the DomainParticipant class. + * + * The handles returned in the dds::core::InstanceHandleSeq are the ones that + * are used by the DDS implementation to locally identify the corresponding matched + * DataReader entities. You can access more detailed information about a particular + * subscription by passing its subscription_handle to either the + * dds::pub::matched_subscription_data operation or to the read with instance + * operation on the built-in reader for the “DCPSSubscription” topic. + * + * See @ref DCPS_Builtin_Topics "Builtin Topics" for more information. + * + * @param dw the DataWriter + * @param begin an iterator indicating the beginning of a sequence of + * instance handles in which to put the matched subscriptions + * @param max_size the maximum number of matched subscriptions to return + * @return the number of matched subscriptions returned + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::UnsupportedError + * OpenSplice is configured not to maintain the + * information about “associated” subscriptions. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ +template +uint32_t +matched_subscriptions(const dds::pub::DataWriter& dw, + FwdIterator begin, uint32_t max_size); + +/** + * This operation retrieves information on the specified subscription that is currently + * “associated” with the DataWriter. That is, a subscription with a matching Topic + * and compatible QoS that the application has not indicated should be “ignored” by + * means of the dds::sub::ignore operation on the DomainParticipant + * class. + * + * The subscription_handle must correspond to a subscription currently + * associated with the DataWriter, otherwise the operation will fail and throw + * InvalidArgumentError. The operation dds::pub::matched_subscriptions can + * be used to find the subscriptions that are currently matched with the DataWriter. + * + * The operation may fail if the infrastructure does not locally maintain the + * connectivity information. This is the case when OpenSplice is configured not to + * maintain discovery information in the Networking Service. (See the description for + * the NetworkingService/Discovery/enabled property in the Deployment + * Manual for more information about this subject.) In such cases the operation will + * throw UnsupportedError. + * + * See also @ref DCPS_Builtin_Topics and @ref DCPS_Builtin_Topics_SubscriptionData. + * + * @param dw the DataWriter + * @param h the InstanceHandle + * @return the SubscriptionBuiltinTopicData + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataWriter has not yet been enabled. + * @throws dds::core::UnsupportedError + * OpenSplice is configured not to maintain the + * information about “associated” subscriptions. + * @throws dds::core::InvalidArgumentError + * Subscription not associated with the DataWriter. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ +template +const dds::topic::SubscriptionBuiltinTopicData +matched_subscription_data(const dds::pub::DataWriter& dw, + const ::dds::core::InstanceHandle& h); + +} +} +#endif /* OMG_DDS_PUB_DISCOVERY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/find.hpp b/unitree_SDK/include/ddscxx/dds/pub/find.hpp new file mode 100644 index 0000000..08ce007 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/find.hpp @@ -0,0 +1,74 @@ +#ifndef OMG_DDS_PUB_FIND_HPP_ +#define OMG_DDS_PUB_FIND_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +#include + +namespace dds +{ +namespace pub +{ + +/** + * This function retrieves previously-created DataWriters + * belonging to the Publisher that is attached to a Topic with a + * matching topic_name. If no such DataWriter exists, the operation + * will return an empty container. + * + * @param pub the Publisher to find an associated DataWriter for + * @param topic_name the topic name + * @param begin a iterator for a sequence in which to put found + * DataWriters + * @param max_size the maximum number of DataWriters to return + * @return the total number of elements found. Notice that + * at most max_size will be copied using the provided iterator + * + */ +template +uint32_t +find(const dds::pub::Publisher& pub, const std::string& topic_name, + FwdIterator begin, uint32_t max_size); + +/** + * This function retrieves previously-created DataWriters + * belonging to the Publisher that is attached to a Topic with a + * matching topic_name. If no such DataWriter exists, the operation + * will return an empty container. + * + * @param pub the Publisher to find an associated DataWriter for + * @param topic_name the topic name + * @param begin a back insertion iterator for a sequence in which + * to put found DataWriters + * @return the total number of elements found. Notice that + * at most max_size will be copied using the provided iterator. + * + */ +template +uint32_t +find(const dds::pub::Publisher& pub, const std::string& topic_name, + BinIterator begin); + + +} +} + +#endif /* OMG_DDS_PUB_FIND_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/qos/DataWriterQos.hpp b/unitree_SDK/include/ddscxx/dds/pub/qos/DataWriterQos.hpp new file mode 100644 index 0000000..204d9e0 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/qos/DataWriterQos.hpp @@ -0,0 +1,35 @@ +#ifndef OMG_DDS_QOS_DATA_WRITER_QOS_HPP_ +#define OMG_DDS_QOS_DATA_WRITER_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace pub +{ +namespace qos +{ +typedef dds::pub::qos::detail:: DataWriterQos DataWriterQos; +} +} +} + +#endif /* OMG_DDS_QOS_DATA_WRITER_QOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/qos/PublisherQos.hpp b/unitree_SDK/include/ddscxx/dds/pub/qos/PublisherQos.hpp new file mode 100644 index 0000000..58d97f2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/qos/PublisherQos.hpp @@ -0,0 +1,35 @@ +#ifndef OMG_DDS_QOS_PUBLISER_QOS_HPP_ +#define OMG_DDS_QOS_PUBLISER_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace pub +{ +namespace qos +{ +typedef dds::pub::qos::detail::PublisherQos PublisherQos; +} +} +} + +#endif /* OMG_DDS_QOS_PUBLISER_QOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/qos/detail/DataWriterQos.hpp b/unitree_SDK/include/ddscxx/dds/pub/qos/detail/DataWriterQos.hpp new file mode 100644 index 0000000..ba69afb --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/qos/detail/DataWriterQos.hpp @@ -0,0 +1,152 @@ +#ifndef OMG_DDS_PUB_QOS_DETAIL_DATAWRITER_QOS_HPP_ +#define OMG_DDS_PUB_QOS_DETAIL_DATAWRITER_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +#ifdef DOXYGEN_FOR_ISOCPP +/* The above macro is never (and must never) be defined in normal compilation. + * + * The class below is just used to create informative API documentation. + * The predoxygen.py script will copy this over the QoS API header file. + */ +/** + * @brief + * This object provides the basic mechanism for an application to specify Quality of + * Service attributes for a DataWriter. + * + * @par Attributes + * @anchor anchor_dds_pub_datawriter_qos_defaults + * QosPolicy | Desciption | Default Value + * --------------------------------------- | -------------------------------------------------------------------------- | -------------------- + * dds::core::policy::UserData | Additional information (@ref DCPS_QoS_UserData "info") | UserData::UserData(empty) + * dds::core::policy::Durability | Data storage settings for late joiners (@ref DCPS_QoS_Durability "info") | Durability::Volatile() + * dds::core::policy::Deadline | Period in which new sample is written (@ref DCPS_QoS_Deadline "info") | Deadline::Deadline(infinite) + * dds::core::policy::LatencyBudget | Used for optimization (@ref DCPS_QoS_LatencyBudget "info") | LatencyBudget::LatencyBudget(zero) + * dds::core::policy::Liveliness | Liveliness assertion mechanism (@ref DCPS_QoS_Liveliness "info") | Liveliness::Automatic() + * dds::core::policy::Reliability | Reliability settings (@ref DCPS_QoS_Reliability "info") | Reliability::Reliable() + * dds::core::policy::DestinationOrder | DataReader data order settings (@ref DCPS_QoS_DestinationOrder "info") | DestinationOrder::ReceptionTimestamp() + * dds::core::policy::History | Data storage settings (@ref DCPS_QoS_History "info") | History::KeepLast(depth 1) + * dds::core::policy::ResourceLimits | Maximum resource settings (@ref DCPS_QoS_ResourceLimits "info") | ResourceLimits::ResourceLimits(all unlimited) + * dds::core::policy::TransportPriority | Priority hint for transport layer (@ref DCPS_QoS_TransportPriority "info") | TransportPriority::TTransportPriority(0) + * dds::core::policy::Lifespan | Maximum duration of validity of data (@ref DCPS_QoS_Lifespan "info") | Lifespan::Lifespan(infinite) + * dds::core::policy::Ownership | Exclusive ownership or not (@ref DCPS_QoS_Ownership "info") | Ownership::Shared() + * dds::core::policy::OwnershipStrength | Ownership strenght (@ref DCPS_QoS_OwnershipStrength "info") | OwnershipStrength::OwnershipStrength(0) + * dds::core::policy::WriterDataLifecycle | Dispose with unregister or not (@ref DCPS_QoS_WriterDataLifecycle "info") | WriterDataLifecycle::AutoDisposeUnregisteredInstances() + * dds::core::policy::DataRepresentation | Supported data representation kinds (@ref DCPS_QoS_DataRepresentation "info") | DataRepresentation::DataRepresentation(dds::core::policy::DataRepresentationId::XCDR1) + * dds::core::policy::TypeConsistencyEnforcement | Type consistency enforcement policies (@ref DCPS_QoS_TypeConsistencyEnforcement "info") | dds::core::policy::TypeConsistencyKind::DISALLOW_TYPE_COERCION + * + * A QosPolicy can be set when the DataWriter is created or modified with the set + * qos operation. + * Both operations take the DataWriterQos object as a parameter. There may be cases + * where several policies are in conflict. Consistency checking is performed each time + * the policies are modified when they are being created and, in case they are already + * enabled, via the set qos operation. + * + * Some QosPolicy have "immutable" semantics meaning that they can only be + * specified either at DataWriter creation time or prior to calling the enable + * operation on the DataWriter. + * + * @see for more information: @ref DCPS_QoS + */ +class dds::pub::qos::DataWriterQos : public ::dds::core::EntityQos +{ +public: + /** + * Create @ref anchor_dds_pub_datawriter_qos_defaults "default" QoS. + */ + DataWriterQos() {} + + /** + * Create copied QoS type. + * + * @param qos the QoS to copy policies from. + */ + DataWriterQos(const DataWriterQos& qos); + + /** + * Create a DataWriter QoS from a TopicQos. + * + * This operation will copy the QosPolicy settings from the TopicQos to the + * corresponding QosPolicy settings in the DataWriterQos. The related value + * in DataWriterQos will be repliced, while the other policies will get the + * @ref anchor_dds_pub_datawriter_qos_defaults "default" QoS policies. + * + * This is a "convenience" operation. It can be used to merge + * @ref anchor_dds_pub_datawriter_qos_defaults "default" DataWriter + * QosPolicy settings with the corresponding ones on the Topic. The resulting + * DataWriterQos can then be used to create a new DataWriter, or set its + * DataWriterQos. + * @code{.cpp} + * dds::topic::qos::TopicQos topicQos = topic.qos(); + * dds::pub::qos::DataWriterQos writerQos(topicQos); + * // Policies of the DataWriterQos that are not present in the TopicQos + * // have the default value. + * @endcode + * + * This operation does not check the resulting DataWriterQos for self + * consistency. This is because the "merged" DataWriterQos may not be the + * final one, as the application can still modify some QosPolicy settings prior to + * applying the DataWriterQos to the DataWriter. + * + * @param qos the QoS to copy policies from. + */ + DataWriterQos(const dds::topic::qos::TopicQos& qos); + + /** + * Assign dds::topic::qos::TopicQos policies to the DataWriterQos. + * + * This operation will copy the QosPolicy settings from the TopicQos to the + * corresponding QosPolicy settings in the DataWriterQos (replacing the values, + * if present). + * + * This is a "convenience" operation, useful in combination with the operations + * Publisher::default_datawriter_qos() and dds::topic::Topic::qos(). + * This operation can be used to merge the DataWriter + * QosPolicy settings with the corresponding ones on the Topic. The resulting + * DataWriterQos can then be used to create a new DataWriter, or set its + * DataWriterQos. + * @code{.cpp} + * dds::topic::qos::TopicQos topicQos = topic.qos(); + * dds::pub::qos::DataWriterQos writerQos = publisher.default_datawriter_qos(); + * writerQos = topicQos; + * // Policies of the DataWriterQos that are not present in the TopicQos are untouched. + * @endcode + * + * This operation does not check the resulting DataWriterQos for self + * consistency. This is because the "merged" DataWriterQos may not be the + * final one, as the application can still modify some QosPolicy settings prior to + * applying the DataWriterQos to the DataWriter. + * + * @param qos the QoS to copy policies from. + */ + DataWriterQos& operator= (const dds::topic::qos::TopicQos& other); +}; + +#else /* DOXYGEN_FOR_ISOCPP */ + +namespace dds { namespace pub { namespace qos { namespace detail { + typedef dds::core::TEntityQos DataWriterQos; +} } } } + +#endif /* DOXYGEN_FOR_ISOCPP */ + +#endif /* OMG_DDS_PUB_QOS_DETAIL_DATAWRITER_QOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/pub/qos/detail/PublisherQos.hpp b/unitree_SDK/include/ddscxx/dds/pub/qos/detail/PublisherQos.hpp new file mode 100644 index 0000000..26decda --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/pub/qos/detail/PublisherQos.hpp @@ -0,0 +1,82 @@ +#ifndef OMG_DDS_PUB_QOS_DETAIL_PUBLISER_QOS_HPP_ +#define OMG_DDS_PUB_QOS_DETAIL_PUBLISER_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +#ifdef DOXYGEN_FOR_ISOCPP +/* The above macro is never (and must never) be defined in normal compilation. + * + * The class below is just used to create informative API documentation. + * The predoxygen.py script will copy this over the QoS API header file. + */ +/** + * @brief + * This object provides the basic mechanism for an application to specify Quality of + * Service attributes for a Publisher. + * + * @par Attributes + * @anchor anchor_dds_pub_publisher_qos_defaults + * QosPolicy | Desciption | Default Value + * --------------------------------------- | --------------------------------------------------------------------- | -------------------- + * dds::core::policy::Presentation | Data-instance change dependencies (@ref DCPS_QoS_Presentation "info") | Presentation::InstanceAccessScope(coherent=false, ordered=false) + * dds::core::policy::Partition | Active partitions (@ref DCPS_QoS_Partition "info") | Partition::Partition(empty) + * dds::core::policy::GroupData | Additional information (@ref DCPS_QoS_GroupData "info") | GroupData::GroupData(empty) + * dds::core::policy::EntityFactory | Create enabled (@ref DCPS_QoS_EntityFactory "info") | EntityFactory::AutoEnable() + * + * A QosPolicy can be set when the Publisher is created or modified with the set qos + * operation. + * Both operations take the PublisherQos object as a parameter. There may be cases where + * several policies are in conflict. Consistency checking is performed each time the + * policies are modified when they are being created and, in case they are already + * enabled, via the set qos operation. + * + * Some QosPolicy have "immutable" semantics meaning that they can only be + * specified either at Publisher creation time or prior to calling the enable operation + * on the Publisher. + * + * @see for more information: @ref DCPS_QoS + */ +class dds::pub::qos::PublisherQos : public ::dds::core::EntityQos +{ +public: + /** + * Create @ref anchor_dds_pub_publisher_qos_defaults "default" QoS. + */ + PublisherQos() {} + + /** + * Create copied QoS type. + * + * @param qos the QoS to copy policies from. + */ + PublisherQos(const PublisherQos& qos); +}; + +#else /* DOXYGEN_FOR_ISOCPP */ + +namespace dds { namespace pub { namespace qos { namespace detail { + typedef ::dds::core::TEntityQos< ::org::eclipse::cyclonedds::pub::qos::PublisherQosDelegate> PublisherQos; +} } } } + +#endif /* DOXYGEN_FOR_ISOCPP */ + +#endif /* OMG_DDS_PUB_QOS_DETAIL_PUBLISER_QOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/AnyDataReader.hpp b/unitree_SDK/include/ddscxx/dds/sub/AnyDataReader.hpp new file mode 100644 index 0000000..0d80310 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/AnyDataReader.hpp @@ -0,0 +1,32 @@ +#ifndef OMG_DDS_SUB_ANY_DATA_READER_HPP_ +#define OMG_DDS_SUB_ANY_DATA_READER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace sub +{ +typedef ::dds::sub::detail::AnyDataReader AnyDataReader; +} +} + +#endif /* OMG_DDS_SUB_ANY_DATA_READER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/AnyDataReaderListener.hpp b/unitree_SDK/include/ddscxx/dds/sub/AnyDataReaderListener.hpp new file mode 100644 index 0000000..468180f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/AnyDataReaderListener.hpp @@ -0,0 +1,150 @@ +#ifndef OMG_DDS_SUB_ANY_DATA_READER_LISTENER_HPP_ +#define OMG_DDS_SUB_ANY_DATA_READER_LISTENER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + +namespace dds +{ +namespace sub +{ + + +/** + * @brief + * AnyDataReader events Listener + * + * Because Subscriber and DomainParticipant do not have knowledge of data types, + * they have to use non-data-type-listeners. In other words Any* listeners. + * + * + * All operations for this interface must be implemented in the user-defined class, it is + * up to the application whether an operation is empty or contains some functionality. + * + * This class is used as a base for other listeners and is not used on its own. + * + * + * @see dds::sub::SubscriberListener + * @see dds::domain::DomainParticipantListener + */ +class OMG_DDS_API AnyDataReaderListener +{ +public: + /** @cond */ + typedef ::dds::core::smart_ptr_traits::ref_type ref_type; + /** @endcond */ + +public: + /** @cond */ + virtual ~AnyDataReaderListener() { } + /** @endcond */ + +public: + /** @copydoc dds::sub::DataReaderListener::on_requested_deadline_missed() */ + virtual void on_requested_deadline_missed( + AnyDataReader& reader, + const dds::core::status::RequestedDeadlineMissedStatus& status) = 0; + + /** @copydoc dds::sub::DataReaderListener::on_requested_incompatible_qos() */ + virtual void on_requested_incompatible_qos( + AnyDataReader& reader, + const dds::core::status::RequestedIncompatibleQosStatus& status) = 0; + + /** @copydoc dds::sub::DataReaderListener::on_sample_rejected() */ + virtual void on_sample_rejected( + AnyDataReader& reader, + const dds::core::status::SampleRejectedStatus& status) = 0; + + /** @copydoc dds::sub::DataReaderListener::on_liveliness_changed() */ + virtual void on_liveliness_changed( + AnyDataReader& reader, + const dds::core::status::LivelinessChangedStatus& status) = 0; + + /** @copydoc dds::sub::DataReaderListener::on_data_available() */ + virtual void on_data_available(AnyDataReader& reader) = 0; + + /** @copydoc dds::sub::DataReaderListener::on_subscription_matched() */ + virtual void on_subscription_matched( + AnyDataReader& reader, + const dds::core::status::SubscriptionMatchedStatus& status) = 0; + + /** @copydoc dds::sub::DataReaderListener::on_sample_lost() */ + virtual void on_sample_lost( + AnyDataReader& reader, + const dds::core::status::SampleLostStatus& status) = 0; +}; + + +/** + * @brief + * AnyDataReader events Listener + * + * This listener is just like AnyDataReaderListener, except + * that the application doesn't have to implement all operations. + * + * This class is used as a base for other listeners and is not used on its own. + * + * @see dds::sub::AnyDataReaderListener + * @see dds::sub::NoOpSubscriberListener + * @see dds::domain::NoOpDomainParticipantListener + */ +class OMG_DDS_API NoOpAnyDataReaderListener : public virtual AnyDataReaderListener +{ +/** @cond + * All these functions have already been documented in the non-NoOp listener. + * Ignore these functions for the doxygen API documentation for clarity. + */ +public: + virtual ~NoOpAnyDataReaderListener() { } + +public: + virtual void on_requested_deadline_missed( + AnyDataReader&, + const dds::core::status::RequestedDeadlineMissedStatus&) { } + + virtual void on_requested_incompatible_qos( + AnyDataReader&, + const dds::core::status::RequestedIncompatibleQosStatus&) { } + + virtual void on_sample_rejected( + AnyDataReader&, + const dds::core::status::SampleRejectedStatus&) { } + + virtual void on_liveliness_changed( + AnyDataReader&, + const dds::core::status::LivelinessChangedStatus&) { } + + virtual void on_data_available(AnyDataReader&) { } + + virtual void on_subscription_matched( + AnyDataReader&, + const dds::core::status::SubscriptionMatchedStatus&) { } + + virtual void on_sample_lost( + AnyDataReader&, + const dds::core::status::SampleLostStatus&) { } +/** @endcond */ +}; +} +} + +#endif /* OMG_DDS_SUB_ANY_DATA_READER_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/CoherentAccess.hpp b/unitree_SDK/include/ddscxx/dds/sub/CoherentAccess.hpp new file mode 100644 index 0000000..d6b3002 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/CoherentAccess.hpp @@ -0,0 +1,33 @@ +#ifndef OMG_DDS_SUB_COHERENT_ACCESS_HPP_ +#define OMG_DDS_SUB_COHERENT_ACCESS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace sub +{ +typedef dds::sub::detail::CoherentAccess CoherentAccess; +} +} + + +#endif /* OMG_DDS_SUB_COHERENT_ACCESS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/DataReader.hpp b/unitree_SDK/include/ddscxx/dds/sub/DataReader.hpp new file mode 100644 index 0000000..763c43d --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/DataReader.hpp @@ -0,0 +1,81 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_SUB_DATA_READER_HPP_ +#define OMG_DDS_SUB_DATA_READER_HPP_ + +#include + +namespace dds { + namespace sub { + + template < typename T, + template class DELEGATE = dds::sub::detail::DataReader > + class DataReader; + } +} + +#include + + +// = Manipulators +namespace dds +{ +namespace sub +{ +namespace functors +{ +typedef dds::sub::functors::detail::MaxSamplesManipulatorFunctor MaxSamplesManipulatorFunctor; +typedef dds::sub::functors::detail::ContentFilterManipulatorFunctor ContentFilterManipulatorFunctor; +typedef dds::sub::functors::detail::StateFilterManipulatorFunctor StateFilterManipulatorFunctor; +typedef dds::sub::functors::detail::InstanceManipulatorFunctor InstanceManipulatorFunctor; +typedef dds::sub::functors::detail::NextInstanceManipulatorFunctor NextInstanceManipulatorFunctor; +} +} +} + +namespace dds +{ +namespace sub +{ + +template +SELECTOR& read(SELECTOR& selector); + +template +SELECTOR& take(SELECTOR& selector); + +inline dds::sub::functors::MaxSamplesManipulatorFunctor +max_samples(uint32_t n); + +inline dds::sub::functors::ContentFilterManipulatorFunctor +content(const dds::sub::Query& query); + +inline dds::sub::functors::StateFilterManipulatorFunctor +state(const dds::sub::status::DataState& s); + +inline dds::sub::functors::InstanceManipulatorFunctor +instance(const dds::core::InstanceHandle& h); + +inline dds::sub::functors::NextInstanceManipulatorFunctor +next_instance(const dds::core::InstanceHandle& h); + +} +} + + +#endif /* OMG_DDS_SUB_DATA_READER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/DataReaderListener.hpp b/unitree_SDK/include/ddscxx/dds/sub/DataReaderListener.hpp new file mode 100644 index 0000000..e4a21b5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/DataReaderListener.hpp @@ -0,0 +1,370 @@ +#ifndef OMG_DDS_SUB_DATA_READER_LISTENER_HPP_ +#define OMG_DDS_SUB_DATA_READER_LISTENER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace sub +{ +template +class DataReaderListener; + +template +class NoOpDataReaderListener; +} +} + +/** + * @brief + * DataReader events Listener + * + * Since a DataReader is an Entity, it has the ability to have a Listener + * associated with it. In this case, the associated Listener should be of type + * DataReaderListener. This interface must be implemented by the + * application. A user-defined class must be provided by the application which must + * extend from the DataReaderListener class. + * + * + * All operations for this interface must be implemented in the user-defined class, it is + * up to the application whether an operation is empty or contains some functionality. + * + * + * The DataReaderListener provides a generic mechanism (actually a + * callback function) for the Data Distribution Service to notify the application of + * relevant asynchronous status change events, such as a missed deadline, violation of + * a QosPolicy setting, etc. The DataReaderListener is related to + * changes in communication status StatusConditions. + * + * @code{.cpp} + * // Application example listener + * class ExampleListener : + * public virtual dds::sub::DataReaderListener + * { + * public: + * virtual void on_requested_deadline_missed ( + * dds::sub::DataReader& reader, + * const dds::core::status::RequestedDeadlineMissedStatus & status) + * { + * std::cout << "on_requested_deadline_missed" << std::endl; + * } + * + * virtual void on_requested_incompatible_qos ( + * dds::sub::DataReader& reader, + * const dds::core::status::RequestedIncompatibleQosStatus & status) + * { + * std::cout << "on_requested_incompatible_qos" << std::endl; + * } + * + * virtual void on_sample_rejected ( + * dds::sub::DataReader& reader, + * const dds::core::status::SampleRejectedStatus & status) + * { + * std::cout << "on_sample_rejected" << std::endl; + * } + * + * virtual void on_liveliness_changed ( + * dds::sub::DataReader& reader, + * const dds::core::status::LivelinessChangedStatus & status) + * { + * std::cout << "on_liveliness_changed" << std::endl; + * } + * + * virtual void on_data_available ( + * dds::sub::DataReader& reader) + * { + * std::cout << "on_data_available" << std::endl; + * } + * + * virtual void on_subscription_matched ( + * dds::sub::DataReader& reader, + * const dds::core::status::SubscriptionMatchedStatus & status) + * { + * std::cout << "on_subscription_matched" << std::endl; + * } + * + * virtual void on_sample_lost ( + * dds::sub::DataReader& reader, + * const dds::core::status::SampleLostStatus & status) + * { + * std::cout << "on_sample_lost" << std::endl; + * } + * }; + * + * // Create DataReader with the listener + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, + * topic, + * subscriber.default_datareader_qos(), + * new ExampleListener(), + * dds::core::status::StatusMask::all()); + * + * @endcode + * + * @see for more information: @ref DCPS_Modules_Subscription_DataReader "Data Reader" + * @see for more information: @ref DCPS_Modules_Infrastructure_Listener "Listener information" + */ +template +class dds::sub::DataReaderListener +{ +public: + /** @cond */ + typedef typename ::dds::core::smart_ptr_traits::ref_type ref_type; + /** @endcond */ + +public: + /** @cond */ + virtual ~DataReaderListener() { } + /** @endcond */ + +public: + /** + * This operation called by the Data Distribution Service when the deadline + * that the DataReader was expecting through its DeadlineQosPolicy was not + * respected for a specific instance. + * + * The implementation may be left empty when this + * functionality is not needed. This operation will only be called when the relevant + * DataReaderListener is installed and enabled for the + * StatusMask::requested_deadline_missed(). + * + * @param reader contain a pointer to the DataReader for which + * the deadline was missed (this is an input to the application provided by the Data + * Distribution Service). + * @param status contain the + * RequestedDeadlineMissedStatus object (this is an input to the application + * provided by the Data Distribution Service). + */ + virtual void on_requested_deadline_missed( + DataReader& reader, + const dds::core::status::RequestedDeadlineMissedStatus& status) = 0; + + /** + * This operation is called by the Data Distribution Service when the + * RequestedIncompatibleQosStatus changes. + * + * The implementation may be + * left empty when this functionality is not needed. This operation will only be called + * when the relevant DataReaderListener is installed and enabled for the + * StatusMask::requested_incompatible_qos(). + * + * The Data Distribution Service will provide a reference to the DataReader in the + * parameter reader and the RequestedIncompatibleQosStatus object in the + * parameter status, for use by the application. + * + * When the DataReaderListener on the + * DataReader is not enabled with the StatusMask::requested_incompatible_qos(), + * the RequestedIncompatibleQosStatus change will propagate to the SubscriberListener + * of the Subscriber (if enabled) or to the DomainParticipantListener of the + * DomainParticipant (if enabled). + * + * @param reader the DataReader provided by the Data Distribution Service. + * @param status the RequestedIncompatibleQosStatus object provided by the + * Data Distribution Service. + */ + virtual void on_requested_incompatible_qos( + DataReader& reader, + const dds::core::status::RequestedIncompatibleQosStatus& status) = 0; + + /** + * This operation called by the Data Distribution Service when a (received) + * sample has been rejected. + * + * Samples may be rejected by the DataReader when it + * runs out of resource_limits to store incoming samples. Usually this means that + * old samples need to be ‘consumed’ (for example by ‘taking’ them instead of + * ‘reading’ them) to make room for newly incoming samples. + * + * The implementation may be left empty when this functionality is not needed. This + * operation will only be called when the relevant DataReaderListener is installed + * and enabled with the StatusMask::sample_lost(). + * + * @param reader contains a pointer to the DataReader for which + * a sample has been rejected (this is an input to the application provided by the + * Data Distribution Service). + * @param status contains the + * SampleRejectedStatus object (this is an input to the application provided by + * the Data Distribution Service). + */ + virtual void on_sample_rejected( + DataReader& reader, + const dds::core::status::SampleRejectedStatus& status) = 0; + + /** + * This operation is called by the Data Distribution Service when the liveliness of + * one or more DataWriter objects that were writing instances read through this + * DataReader has changed. + * + * In other words, some DataWriter have become + * “alive” or “not alive”. The implementation may be left empty when this + * functionality is not needed. This operation will only be called when the relevant + * DataReaderListener is installed and enabled for the + * StatusMask::liveliness_changed(). + * + * @param reader contain a pointer to the DataReader for which + * the liveliness of one or more DataWriter objects has changed (this is an input + * to the application provided by the Data Distribution Service). + * @param status contain the + * LivelinessChangedStatus object (this is an input to the application + * provided by the Data Distribution Service). + */ + virtual void on_liveliness_changed( + DataReader& reader, + const dds::core::status::LivelinessChangedStatus& status) = 0; + + /** + * This operation is called by the Data Distribution Service when new data is + * available for this DataReader. + * + * The implementation may be left empty when this + * functionality is not needed. This operation will only be called when the relevant + * DataReaderListener is installed and enabled for the + * StatusMask::data_available(). + * + * The Data Distribution Service will provide a reference to the DataReader in the + * parameter reader for use by the application. + * + * The statuses StatusMask::data_on_readers() and StatusMask::data_available() will + * occur together. In case these status changes occur, the Data Distribution Service will + * look for an attached and activated SubscriberListener or + * DomainParticipantListener (in that order) for the enabled + * StatusMask::data_on_readers(). In case the StatusMask::data_on_readers() can not be + * handled, the Data Distribution Service will look for an attached and activated + * DataReaderListener, SubscriberListener or DomainParticipantListener for the enabled + * StatusMask::data_available() (in that order). + * + * Note that if on_data_on_readers is called, then the Data Distribution Service + * will not try to call on_data_available, however, the application can force a call + * to the DataReader objects that have data by means of the Subscriber::notify_datareaders() + * operation. + * + * @param reader contain a pointer to the DataReader for which + * data is available (this is an input to the application provided by the Data + * Distribution Service). + */ + virtual void on_data_available(DataReader& reader) = 0; + + /** + * This operation is called by the Data + * Distribution Service when a new match has been discovered for the current + * subscription, or when an existing match has ceased to exist. + * + * Usually this means that + * a new DataWriter that matches the Topic and that has compatible Qos as the current + * DataReader has either been discovered, or that a previously discovered DataWriter + * has ceased to be matched to the current DataReader. A DataWriter may cease to + * match when it gets deleted, when it changes its Qos to a value that is incompatible + * with the current DataReader or when either the DataReader or the DataWriter + * has chosen to put its matching counterpart on its ignore-list using the + * dds::sub::ignore or dds::pub::ignore operations. + * + * The implementation of this Listener operation may be left empty when this + * functionality is not needed: it will only be called when the relevant + * DataReaderListener is installed and enabled for the + * StatusMask::subscription_matched(). + * + * @param reader contains a pointer to the DataReader for which + * a match has been discovered (this is an input to the application provided by the + * Data Distribution Service). + * @param status contains the + * SubscriptionMatchedStatus object (this is an input to the application + * provided by the Data Distribution Service). + */ + virtual void on_subscription_matched( + DataReader& reader, + const dds::core::status::SubscriptionMatchedStatus& status) = 0; + + /** + * + * NOTE: This operation is not yet implemented. It is scheduled for a future release. + * + * + * @param reader the DataReader the Listener is applied to + * @param status the SampleLostStatus status + */ + virtual void on_sample_lost( + DataReader& reader, + const dds::core::status::SampleLostStatus& status) = 0; +}; + + +/** + * @brief + * DataReader events Listener + * + * This listener is just like DataReaderListener, except + * that the application doesn't have to implement all operations. + * + * @code{.cpp} + * class ExampleListener : public virtual dds::sub::NoOpDataReaderListener + * { + * // Not necessary to implement any Listener operations. + * }; + * @endcode + * + * @see dds::sub::DataReaderListener + */ +template +class dds::sub::NoOpDataReaderListener : public virtual DataReaderListener +{ +/** @cond + * All these functions have already been documented in the non-NoOp listener. + * Ignore these functions for the doxygen API documentation for clarity. + */ +public: + typedef typename ::dds::core::smart_ptr_traits::ref_type ref_type; + +public: + virtual ~NoOpDataReaderListener() { } + +public: + virtual void on_requested_deadline_missed( + DataReader&, + const dds::core::status::RequestedDeadlineMissedStatus&) { } + + virtual void on_requested_incompatible_qos( + DataReader&, + const dds::core::status::RequestedIncompatibleQosStatus&) { } + + virtual void on_sample_rejected( + DataReader&, + const dds::core::status::SampleRejectedStatus&) { } + + virtual void on_liveliness_changed( + DataReader&, + const dds::core::status::LivelinessChangedStatus&) { } + + virtual void on_data_available( + DataReader&) { } + + virtual void on_subscription_matched( + DataReader&, + const dds::core::status::SubscriptionMatchedStatus&) { } + + virtual void on_sample_lost( + DataReader&, + const dds::core::status::SampleLostStatus&) { } +/** @endcond */ +}; + +#endif /* OMG_DDS_SUB_DATA_READER_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/GenerationCount.hpp b/unitree_SDK/include/ddscxx/dds/sub/GenerationCount.hpp new file mode 100644 index 0000000..09cc5f2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/GenerationCount.hpp @@ -0,0 +1,31 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_SUB_GENERATION_COUNT_HPP_ +#define OMG_DDS_SUB_GENERATION_COUNT_HPP_ + +#include + +namespace dds +{ +namespace sub +{ +typedef detail::GenerationCount GenerationCount; +} +} + +#endif /* OMG_DDS_SUB_GENERATION_COUNT_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/LoanedSamples.hpp b/unitree_SDK/include/ddscxx/dds/sub/LoanedSamples.hpp new file mode 100644 index 0000000..9ecccb2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/LoanedSamples.hpp @@ -0,0 +1,215 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_SUB_TLOANED_SAMPLES_HPP_ +#define OMG_DDS_SUB_TLOANED_SAMPLES_HPP_ + +#include +#include + +#include + +/** @cond */ +namespace dds +{ +namespace sub +{ +template class DELEGATE = dds::sub::detail::LoanedSamples> +class LoanedSamples; + +// Used by C++11 compilers to allow for using LoanedSamples +// and SharedSamples in a range-based for-loop. +template typename T::const_iterator cbegin(const T& t); +template typename T::const_iterator cend(const T& t); +} + +} +/** @endcond */ + +/** + * @brief + * This class encapsulates and automates the management of loaned samples. + * + * It is a container which is used to hold samples which have been read + * or taken by the DataReader. Samples are effectively "loaned" from the + * DataReader to avoid the need to copy the data. When the LoanedSamples + * container goes out of scope the loan is automatically returned. + * + * LoanedSamples maintains a ref count so that the loan will only be + * returned once all copies of the same LoanedSamples have been destroyed. + * + * @anchor anchor_dds_sub_loanedsamples_example + * @code{.cpp} + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * + * // Assume there is data to read + * { + * dds::sub::LoanedSamples samples = reader.read(); + * dds::sub::LoanedSamples::const_iterator it; + * for (it = samples.begin(); it != samples.end(); ++it) { + * const dds::sub::Sample& sample = *it; + * const Foo::Bar& data = sample.data(); + * const dds::sub::SampleInfo& info = sample.info(); + * // Use sample data and meta information. + * } + * + * function(samples); + * } + * // LoanedSamples out of scope. Whether the loan is returned, depends what the reference + * // count of the LoanedSamples is. That again, depends on what the function() did with it. + * // Maybe function() stored the LoanedSamples, maybe not. Whatever the case, LoanedSamples + * // takes care of the loan and resource handling. + * @endcode + * + * @see for more information: @ref DCPS_Modules_Subscription_DataSample "DataSample" + * @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo" + * @see for more information: @ref DCPS_Modules_Subscription "Subscription" + */ +template class DELEGATE> +class dds::sub::LoanedSamples +{ +public: + /** + * Convenience typedef for the type of the data sample. + */ + typedef T DataType; + + /** + * Convenience typedef for the iterator over the loaned samples. + */ + typedef typename DELEGATE::const_iterator const_iterator; + + /** @cond */ + typedef typename dds::core::smart_ptr_traits< DELEGATE >::ref_type DELEGATE_REF_T; + /** @endcond */ + +public: + /** + * Constructs a LoanedSamples instance. + */ + LoanedSamples(); + + /** + * Implicitly return the loan if this is the last object with a reference to the + * contained loan. + */ + ~LoanedSamples(); + + /** + * Copies a LoanedSamples instance. + * + * No actual data samples are copied.
      + * Just references and reference counts are updated. + */ + LoanedSamples(const LoanedSamples& other); + + /** + * Move-constructs a LoanedSamples instance. + * + * No actual data samples are copied.
      + * Just references and reference counts are updated. + */ + LoanedSamples(LoanedSamples&& other); + + /** + * Copy-assigns a LoanedSamples instance to another. + * + * No actual data samples are copied.
      + * Just references and reference counts are updated. + */ + LoanedSamples& operator=(const LoanedSamples& other) = default; + + /** + * Move-assigns a LoanedSamples instance to another. + * + * No actual data samples are copied.
      + * Just references and reference counts are updated. + */ + LoanedSamples& operator=(LoanedSamples&& other) = default; + + +public: + /** + * Gets an iterator pointing to the first sample in the LoanedSamples container. + * + * See @ref anchor_dds_sub_loanedsamples_example "example". + * + * @return an iterator pointing to the first sample + */ + const_iterator begin() const; + + /** + * Gets an iterator pointing to the end of the LoanedSamples container. + * + * See @ref anchor_dds_sub_loanedsamples_example "example". + * + * @return an iterator pointing to the end of the container + */ + const_iterator end() const; + + /** + * @cond + * The delegate part of the LoanedSamples should not be part of the API. + */ + /** + * Gets the delegate. + * + * @return the delegate + */ + const DELEGATE_REF_T& delegate() const; + + /** + * Gets the delegate. + * + * @return the delegate + */ + DELEGATE_REF_T& delegate(); + /** @endcond */ + + /** + * Gets the number of samples within the LoanedSamples container. + * + * @return the number of samples + */ + uint32_t length() const; + +private: + DELEGATE_REF_T delegate_; +}; + +namespace dds +{ +namespace sub +{ +/** + * Move loan and its ownership to a new LoanedSamples object. + * + * @return LoanedSampless + */ +template class D> +LoanedSamples +move(LoanedSamples& a); +} +} + +#include + +#endif /* OMG_DDS_SUB_TLOANED_SAMPLES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/Query.hpp b/unitree_SDK/include/ddscxx/dds/sub/Query.hpp new file mode 100644 index 0000000..63607fd --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/Query.hpp @@ -0,0 +1,32 @@ +#ifndef OMG_DDS_SUB_QUERY_HPP_ +#define OMG_DDS_SUB_QUERY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace sub +{ +typedef dds::sub::detail::Query Query; +} +} + +#endif /* OMG_DDS_SUB_QUERY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/Rank.hpp b/unitree_SDK/include/ddscxx/dds/sub/Rank.hpp new file mode 100644 index 0000000..a55c4e6 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/Rank.hpp @@ -0,0 +1,31 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_SUB_RANK_HPP_ +#define OMG_DDS_SUB_RANK_HPP_ + +#include + +namespace dds +{ +namespace sub +{ +typedef detail::Rank Rank; +} +} + +#endif /* OMG_DDS_SUB_RANK_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/Sample.hpp b/unitree_SDK/include/ddscxx/dds/sub/Sample.hpp new file mode 100644 index 0000000..0c69103 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/Sample.hpp @@ -0,0 +1,40 @@ +#ifndef OMG_DDS_SUB_SAMPLE_HPP_ +#define OMG_DDS_SUB_SAMPLE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace sub +{ +template class DELEGATE = dds::sub::detail::Sample > +class Sample; +} +} + +/** + * @todo RTF Issue - added include here + * @note This include needs to be here to enable MSVC compilation, + * or TSample.hpp must set the above default DELEGATE instead of it being here. + */ +#include + +#endif /* OMG_DDS_SUB_SAMPLE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/SampleInfo.hpp b/unitree_SDK/include/ddscxx/dds/sub/SampleInfo.hpp new file mode 100644 index 0000000..4697e72 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/SampleInfo.hpp @@ -0,0 +1,32 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_SUB_SAMPLE_INFO_HPP_ +#define OMG_DDS_SUB_SAMPLE_INFO_HPP_ + +#include + +namespace dds +{ +namespace sub +{ +typedef detail::SampleInfo SampleInfo; +} +} + + +#endif /* OMG_DDS_SUB_SAMPLE_INFO_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/SampleRef.hpp b/unitree_SDK/include/ddscxx/dds/sub/SampleRef.hpp new file mode 100644 index 0000000..9509a6b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/SampleRef.hpp @@ -0,0 +1,40 @@ +#ifndef OMG_DDS_SUB_SAMPLEREF_HPP_ +#define OMG_DDS_SUB_SAMPLEREF_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace sub +{ +template class DELEGATE = dds::sub::detail::SampleRef > +class SampleRef; +} +} + +/** + * @todo RTF Issue - added include here + * @note This include needs to be here to enable MSVC compilation, + * or TSample.hpp must set the above default DELEGATE instead of it being here. + */ +#include + +#endif /* OMG_DDS_SUB_SAMPLEREF_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/SharedSamples.hpp b/unitree_SDK/include/ddscxx/dds/sub/SharedSamples.hpp new file mode 100644 index 0000000..bef63d8 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/SharedSamples.hpp @@ -0,0 +1,126 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_SUB_SHARED_SAMPLES_HPP_ +#define OMG_DDS_SUB_SHARED_SAMPLES_HPP_ + + +#include +#include +#include +#include + +/** @cond */ +namespace dds +{ +namespace sub +{ +template class DELEGATE = detail::SharedSamples> +class SharedSamples; +} +} +/** @endcond */ + +/** + * @brief + * This class encapsulates and automates the management of loaned samples. + * + * @note The specification of this class is not yet finished. It will possibly + * change in the future. Anyway, this class is basically a copy of LoanedSamples + * when considering its functionality. So, anything you would want to do with this + * class can also be done by the LoanedSamples. + */ +template class DELEGATE> +class dds::sub::SharedSamples +{ +public: + typedef T DataType; + typedef typename DELEGATE::const_iterator const_iterator; + + typedef typename dds::core::smart_ptr_traits< DELEGATE >::ref_type DELEGATE_REF_T; + +public: + /** + * Constructs a SharedSamples instance. + */ + SharedSamples(); + + /** + * Constructs an instance of SharedSamples and + * removes the ownership of the loan from the LoanedSamples. + * As a result the destruction of the LoanedSamples object + * will have no effect on loaned data. Loaned data will be returned + * automatically once the delegate of this reference type will have a + * zero reference count. + * + * @param ls the loaned samples + * + */ + SharedSamples(dds::sub::LoanedSamples ls); + + /** + * Copies a SharedSamples instance. + */ + SharedSamples(const SharedSamples& other); + + ~SharedSamples(); + + +public: + /** + * Gets an iterator pointing to the beginning of the samples. + * + * @return an iterator pointing to the beginning of the samples + */ + const_iterator begin() const; + + /** + * Gets an iterator pointing to the beginning of the samples. + * + * @return an iterator pointing to the beginning of the samples + */ + const_iterator end() const; + + /** + * Gets the delegate. + * + * @return the delegate + */ + const DELEGATE_REF_T& delegate() const; + + /** + * Gets the delegate. + * + * @return the delegate + */ + DELEGATE_REF_T& delegate(); + + /** + * Returns the number of samples. + * + * @return the number of samples + */ + uint32_t length() const; + +private: + DELEGATE_REF_T delegate_; +}; + +#include + +#endif /* OMG_DDS_SUB_SHARED_SAMPLES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/Subscriber.hpp b/unitree_SDK/include/ddscxx/dds/sub/Subscriber.hpp new file mode 100644 index 0000000..96b0131 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/Subscriber.hpp @@ -0,0 +1,32 @@ +#ifndef OMG_DDS_SUB_SUBSCRIBER_HPP_ +#define OMG_DDS_SUB_SUBSCRIBER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +#include + +namespace dds +{ +namespace sub +{ +typedef ::dds::sub::detail::Subscriber Subscriber; +} +} +#endif /* OMG_DDS_SUB_SUBSCRIBER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/SubscriberListener.hpp b/unitree_SDK/include/ddscxx/dds/sub/SubscriberListener.hpp new file mode 100644 index 0000000..489c231 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/SubscriberListener.hpp @@ -0,0 +1,207 @@ +#ifndef OMG_DDS_SUB_SUBSCRIBER_LISTENER_HPP_ +#define OMG_DDS_SUB_SUBSCRIBER_LISTENER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds +{ +namespace sub +{ + +DDSCXX_WARNING_MSVC_OFF(4250) + +/** + * @brief + * Subscriber events Listener + * + * Since a Subscriber is an Entity, it has the ability to have a Listener + * associated with it. In this case, the associated Listener should be of type + * SubscriberListener. This interface must be implemented by the + * application. A user-defined class must be provided by the application which must + * extend from the SubscriberListener class. + * + * + * All operations for this interface must be implemented in the user-defined class, it is + * up to the application whether an operation is empty or contains some functionality. + * + * + * The SubscriberListener provides a generic mechanism (actually a + * callback function) for the Data Distribution Service to notify the application of + * relevant asynchronous status change events, such as a missed deadline, violation of + * a QosPolicy setting, etc. The SubscriberListener is related to + * changes in communication status StatusConditions. + * + * @code{.cpp} + * // Application example listener + * class ExampleListener : + * public virtual dds::sub::SubscriberListener + * { + * public: + * virtual void on_requested_deadline_missed ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::RequestedDeadlineMissedStatus & status) + * { + * std::cout << "on_requested_deadline_missed" << std::endl; + * } + * + * virtual void on_requested_incompatible_qos ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::RequestedIncompatibleQosStatus & status) + * { + * std::cout << "on_requested_incompatible_qos" << std::endl; + * } + * + * virtual void on_sample_rejected ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::SampleRejectedStatus & status) + * { + * std::cout << "on_sample_rejected" << std::endl; + * } + * + * virtual void on_liveliness_changed ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::LivelinessChangedStatus & status) + * { + * std::cout << "on_liveliness_changed" << std::endl; + * } + * + * virtual void on_data_available ( + * dds::sub::AnyDataReader& reader) + * { + * std::cout << "on_data_available" << std::endl; + * } + * + * virtual void on_subscription_matched ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::SubscriptionMatchedStatus & status) + * { + * std::cout << "on_subscription_matched" << std::endl; + * } + * + * virtual void on_sample_lost ( + * dds::sub::AnyDataReader& reader, + * const dds::core::status::SampleLostStatus & status) + * { + * std::cout << "on_sample_lost" << std::endl; + * } + * + * virtual void on_data_on_readers ( + * dds::sub::Subscriber& subs) + * { + * std::cout << "on_data_on_readers" << std::endl; + * } + * }; + * + * // Create Subscriber with the listener + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::sub::Subscriber subscriber(participant, + * participant.default_subscriber_qos(), + * new ExampleListener(), + * dds::core::status::StatusMask::all()); + * + * @endcode + * + * @see for more information: @ref DCPS_Modules_Subscriber "Subscriber" + * @see for more information: @ref DCPS_Modules_Infrastructure_Listener "Listener information" + */ +class OMG_DDS_API SubscriberListener : public virtual AnyDataReaderListener +{ +public: + /** @cond */ + typedef ::dds::core::smart_ptr_traits::ref_type ref_type; + /** @endcond */ + +public: + /** @cond */ + virtual ~SubscriberListener() { } + /** @endcond */ + +public: + /** + * This operation called by the Data Distribution Service when new data is + * available for this Subscriber. + * + * The implementation may be left empty when this + * functionality is not needed. This operation will only be called when the relevant + * SubscriberListener is installed and enabled with the + * StatusMask::data_on_readers(). + * + * The statuses on_data_on_readers() and on_data_available() will + * occur together. In case these status changes occur, the Data Distribution Service will + * look for an attached and activated SubscriberListener or + * DomainParticipantListener (in that order) for the enabled + * StatusMask::data_on_readers(). In case the StatusMask::data_on_readers() can not be + * handled, the Data Distribution Service will look for an attached and activated + * DataReaderListener, SubscriberListener or + * DomainParticipantListener for the enabled StatusMask::data_available() (in that + * order). + * + * Note that if on_data_on_readers() is called, then the Data Distribution Service + * will not try to call on_data_available(), however, the application can force a call + * to the callback function on_data_available of DataReaderListener objects + * that have data by means of the Subscriber::notify_datareaders() operation. + * + * @param sub contain a pointer to the Subscriber for which data is available (this is + * an input to the application provided by the Data Distribution Service). + */ + virtual void on_data_on_readers(Subscriber& sub) = 0; +}; + + +/** + * @brief + * Subscriber events Listener + * + * This listener is just like SubscriberListener, except + * that the application doesn't have to implement all operations. + * + * @code{.cpp} + * class ExampleListener : public virtual dds::sub::NoOpSubscriberListener + * { + * // Not necessary to implement any Listener operations. + * }; + * @endcode + * + * @see dds::sub::SubscriberListener + */ +class OMG_DDS_API NoOpSubscriberListener : + public virtual SubscriberListener, + public virtual NoOpAnyDataReaderListener +{ +/** @cond + * All these functions have already been documented in the non-NoOp listener. + * Ignore these functions for the doxygen API documentation for clarity. + */ +public: + virtual ~NoOpSubscriberListener() { } + +public: + virtual void on_data_on_readers(Subscriber&) { } +/** @endcond */ +}; + +DDSCXX_WARNING_MSVC_ON(4250) + +} +} + +#endif /* OMG_DDS_SUB_SUBSCRIBER_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/TAnyDataReader.hpp b/unitree_SDK/include/ddscxx/dds/sub/TAnyDataReader.hpp new file mode 100644 index 0000000..35295a2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/TAnyDataReader.hpp @@ -0,0 +1,414 @@ +#ifndef OMG_TDDS_SUB_ANY_DATA_READER_HPP_ +#define OMG_TDDS_SUB_ANY_DATA_READER_HPP_ +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include +#include + +namespace dds +{ +namespace sub +{ +template +class TAnyDataReader; + +} +} + +/** + * @brief + * Typeless base class for the typed DataReader. + * + * DataReaders are created type specific (fi DataReader reader). However, there + * are many places in the API (and possibly application) where the type can not be known + * while still some DataReader has to be passed around, stored or even typeless functionality + * called.
      + * Main examples in the API that need typeless DataReader are: Subscriber, SubscriberListener + * and DomainParticipantListener. + * + * @see dds::sub::DataReader + */ +template +class dds::sub::TAnyDataReader : public dds::core::TEntity +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TAnyDataReader, dds::core::TEntity, DELEGATE) +#if 0 + OMG_DDS_IMPLICIT_REF_BASE(TAnyDataReader) +#else +public: +template +TAnyDataReader(const H__& h) +{ + if (h.is_nil()) { + /* We got a null object and are not really able to do a typecheck here. */ + /* So, just set a null object. */ + *this = dds::core::null; + } else { + this->::dds::core::Reference< DELEGATE_T >::impl_ = ::std::dynamic_pointer_cast< DELEGATE_T >(h.delegate()); + if (h.delegate() != this->::dds::core::Reference< DELEGATE_T >::impl_) { + throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name()); + } + } +} + +template +TAnyDataReader& +operator=(const T__& rhs) { + const TAnyDataReader &t = rhs; + if (this != &t) { + if (rhs.is_nil()) { + /* We got a null object and are not really able to do a typecheck here. */ + /* So, just set a null object. */ + *this = dds::core::null; + } else { + TAnyDataReader other(rhs); + /* Dont have to copy when the delegate impl is the same. */ + if (other.delegate() != this->::dds::core::Reference< DELEGATE_T >::impl_) { + *this = other; + } + } + } + return *this; +} +#endif + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(TAnyDataReader) + + //========================================================================== + // -- Entity Navigation API + + /** + * Get the Subscriber that owns this DataReader. + * + * @return the Subscriber + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + const dds::sub::Subscriber& subscriber() const; + + /** + * Get the TopicDescription associated with this DataReader. + * + * @return the TopicDescription + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + const dds::topic::TopicDescription& topic_description() const; + + + + /** + * This operation will block the application thread until all "historical" data is + * received. + * + * This operation behaves differently for DataReader objects which have a + * non-VOLATILE dds::core::policy::Durability QosPolicy and for DataReader + * objects which have a VOLATILE dds::core::policy::Durability QosPolicy. + * + * As soon as an application enables a non-VOLATILE + * DataReader it will start receiving both "historical" data, i.e. the data that was + * written prior to the time the DataReader joined the domain, as well as any new + * data written by the DataWriter objects. There are situations where the application + * logic may require the application to wait until all "historical" data is received. This + * is the purpose of the wait_for_historical_data operation. + * + * As soon as an application enables a VOLATILE DataReader it + * will not start receiving "historical" data but only new data written by the + * DataWriter objects. By calling wait_for_historical_data the DataReader + * explicitly requests the Data Distribution Service to start receiving also the + * "historical" data and to wait until either all "historical" data is received, or the + * duration specified by the max_wait parameter has elapsed, whichever happens + * first. + * + * Thread Blocking
      + * The operation wait_for_historical_data blocks the calling thread until either + * all "historical" data is received, or the duration specified by the max_wait + * parameter elapses, whichever happens first. When the function returns normally, + * indicates that all the "historical" data was received. If the function throws + * TimeoutError, it indicates that max_wait elapsed before all the data was + * received. + * + * @param timeout the time to wait for historical data (can be dds::core::Duration::infinite()) + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The entity has not yet been enabled. + * @throws dds::core::TimeoutError + * Not all data is received before timeout elapsed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void wait_for_historical_data(const dds::core::Duration& timeout); + + + //========================================================================== + // -- QoS Management + + /** + * Gets the DataReaderQos setting for this instance. + * + * @return the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::sub::qos::DataReaderQos + qos() const; + + /** + * This operation replaces the existing set of QosPolicy settings for a DataReader. + * + * The parameter qos contains the object with the QosPolicy settings which is + * checked for self-consistency and mutability. + * + * When the application tries to change a + * QosPolicy setting for an enabled DataReader, which can only be set before the + * DataReader is enabled, the operation will fail and a + * ImmutablePolicyError is thrown. In other words, the application must + * provide the presently set QosPolicy settings in case of the immutable QosPolicy + * settings. Only the mutable QosPolicy settings can be changed. + * + * When the qos contains conflicting QosPolicy settings (not self-consistent), + * the operation will fail and an InconsistentPolicyError is thrown. + * + * @param qos the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::ImmutablePolicyError + * The parameter qos contains an immutable QosPolicy setting with a + * different value than set during enabling of the DataReader. + * @throws dds::core::InconsistentPolicyError + * The parameter qos contains conflicting QosPolicy settings, + */ + void qos(const dds::sub::qos::DataReaderQos& qos); + + /** @copydoc dds::sub::TAnyDataReader::qos(const dds::sub::qos::DataReaderQos& qos) */ + TAnyDataReader& operator << (const dds::sub::qos::DataReaderQos& qos); + + /** @copydoc dds::sub::TAnyDataReader::qos() */ + const TAnyDataReader& operator >> (dds::sub::qos::DataReaderQos& qos) const; + + + //======================================================================== + // -- Status API + /** + * This operation obtains the LivelinessChangedStatus object of the DataReader. + * + * This object contains the information whether the liveliness of one or more + * DataWriter objects that were writing instances read by the DataReader has + * changed. In other words, some DataWriter have become "alive" or "not alive". + * + * The LivelinessChangedStatus can also be monitored using a + * DataReaderListener or by using the associated StatusCondition. + * + * @return the LivelinessChangedStatus + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::core::status::LivelinessChangedStatus + liveliness_changed_status(); + + /** + * This operation obtains the SampleRejectedStatus object of the DataReader. + * + * This object contains the information whether a received sample has been rejected. + * Samples may be rejected by the DataReader when it runs out of + * resource_limits to store incoming samples. Usually this means that old + * samples need to be "onsumed" (for example by "taking" them instead of "reading" + * them) to make room for newly incoming samples. + * + * The SampleRejectedStatus can also be monitored using a + * DataReaderListener or by using the associated StatusCondition. + * + * @return the SampleRejectedStatus + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::core::status::SampleRejectedStatus + sample_rejected_status(); + + /** + * This operation obtains the SampleLostStatus object of the DataReader. + * + * This object contains information whether samples have been lost. This + * only applies when the dds::core::policy::Reliability QosPolicy is set + * to RELIABLE. If the ReliabilityQos Policy is set to BEST_EFFORT, the + * Data Distribution Service will not report the loss of samples. + * + * The SampleLostStatus can also be monitored using a + * DataReaderListener or by using the associated StatusCondition. + * + * @return the SampleLostStatus + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::core::status::SampleLostStatus + sample_lost_status(); + + /** + * This operation obtains the RequestedDeadlineMissedStatus object of the DataReader. + * + * This object contains the information whether the deadline that the DataReader + * was expecting through its dds::core::policy::Deadline QosPolicy was not respected + * for a specific instance. + * + * The RequestedDeadlineMissedStatus can also be monitored using a + * DataReaderListener or by using the associated StatusCondition. + * + * @return the RequestedDeadlineMissedStatus + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::core::status::RequestedDeadlineMissedStatus + requested_deadline_missed_status(); + + /** + * This operation obtains the RequestedIncompatibleQosStatus object of the DataReader. + * + * This object contains the information whether a QosPolicy setting + * was incompatible with the offered QosPolicy setting. + * + * The Request/Offering mechanism is applicable between the DataWriter and the + * DataReader. If the QosPolicy settings between DataWriter and DataReader + * are inconsistent, no communication between them is established. In addition the + * DataWriter will be informed via a REQUESTED_INCOMPATIBLE_QOS status + * change and the DataReader will be informed via an + * OFFERED_INCOMPATIBLE_QOS status change. + * + * The RequestedIncompatibleQosStatus can also be monitored using a + * DataReaderListener or by using the associated StatusCondition. + * + * @return the RequestedIncompatibleQosStatus + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::core::status::RequestedIncompatibleQosStatus + requested_incompatible_qos_status(); + + /** + * This operation obtains the SubscriptionMatchedStatus object of the DataReader. + * + * This object contains the information whether a new match has been + * discovered for the current subscription, or whether an existing match has ceased to + * exist. + * + * This means that the status represents that either a DataWriter object has been + * discovered by the DataReader with the same Topic and a compatible Qos, or that a + * previously discovered DataWriter has ceased to be matched to the current + * DataReader. A DataWriter may cease to match when it gets deleted, when it + * changes its Qos to a value that is incompatible with the current DataReader or + * when either the DataReader or the DataWriter has chosen to put its matching + * counterpart on its ignore-list using the dds::sub::ignore or dds::pub::ignore + * operations on the DomainParticipant. + * + * The operation may fail if the infrastructure does not hold the information necessary + * to fill in the SubscriptionMatchedStatus. This is the case when OpenSplice is + * configured not to maintain discovery information in the Networking Service. (See + * the description for the NetworkingService/Discovery/enabled property in + * the Deployment Manual for more information about this subject.) In this case the + * operation will throw UnsupportedError. + * + * The SubscriptionMatchedStatus can also be monitored using a + * DataReaderListener or by using the associated StatusCondition. + * + * @return the SubscriptionMatchedStatus + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::UnsupportedError + * OpenSplice is configured not to maintain the information + * about "associated" publications. + */ + dds::core::status::SubscriptionMatchedStatus + subscription_matched_status(); + +}; + + +#endif /* OMG_TDDS_SUB_ANY_DATA_READER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/TCoherentAccess.hpp b/unitree_SDK/include/ddscxx/dds/sub/TCoherentAccess.hpp new file mode 100644 index 0000000..5fd96a4 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/TCoherentAccess.hpp @@ -0,0 +1,150 @@ +#ifndef OMG_DDS_SUB_TCOHERENT_ACCESS_HPP_ +#define OMG_DDS_SUB_TCOHERENT_ACCESS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + + +namespace dds +{ +namespace sub +{ +template +class TCoherentAccess; +} +} + +/** + * @brief + * Class for RAII way of beginning/ending coherent access. + * + * Coherent access indicates that the application is about to access + * the data samples in any of the DataReader objects attached to the + * Subscriber. + * + * The application is required to use this operation + * only if Presentation QosPolicy of the Subscriber to which the + * DataReader belongs has the access_scope set to "GROUP". In the + * aforementioned case, the operation must be called + * prior to calling any of the sample-accessing operations, i.e. + * read and take on DataReader. Otherwise the sample-accessing + * operations will throw a PreconditionNotMetError exception. + * + * Once the application has finished accessing the data samples + * it must end the coherent access. It is not required for the + * application to begin or end access if the Presentation QosPolicy + * has the access_scope set to something other than GROUP. Beginning + * or ending access in this case is not considered an error and has + * no effect. Beginning and ending access may be nested. In that + * case, the application end access as many times as it began + * access. + * + * @code{.cpp} + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * + * dds::sub::qos::SubscriberQos sQos sQos = participant.default_subscriber_qos() + * << dds::core::policy::Presentation::TopicAccessScope(false, true); + * dds::sub::Subscriber subscriber(participant, sQos); + * + * { + * std::vector< dds::sub::DataReader > readers; + * // Start coherent access. + * dds::sub::TCoherentAccess coherentAccess(subscriber); + * // Find (previously created with the subscriber) datareaders that now got data. + * dds::sub::find< dds::sub::DataReader >(subscriber, + * dds::sub::status::DataState::any(), + * back_inserter(readers)); + * // Get data from the readers + * for (size_type i = 0; i < rv.size(); i++) { + * dds::sub::LoanedSamples samples = readers[i].read() + * dds::sub::LoanedSamples::const_iterator it; + * for (it = samples.begin(); it != samples.end(); iterator++) { + * const dds::sub::Sample& sample = *it; + * const Foo::Bar& data = sample.data(); + * const dds::sub::SampleInfo& info = sample.info(); + * // Use sample data and meta information. + * } + * } + * } + * // CoherentAccess went out of scope: it is ended implicitly + * @endcode + * + * @see for more information: @ref DCPS_Modules_Subscription "Subscription" + * @see dds::sub::Subscriber + */ +template +class dds::sub::TCoherentAccess : public dds::core::Value +{ +public: + /** + * Creating a CoherentAccess object, which will begin ‘coherent access’ of + * received samples using DataReader objects attached to this Subscriber. + * + * @param sub The Subscriber to begin the coherent access on. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The Subscriber has already been closed. + * @throws dds::core::NotEnabledError + * The Subscriber has not yet been enabled. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NullReferenceError + * The Subscriber was not properly created and references to dds::core::null. + */ + explicit TCoherentAccess(const dds::sub::Subscriber& sub); + +public: + /** + * This operation will explicitly end the coherent access. + * + * If the Subscriber already ended its coherent access (by a call to this very + * operation), then a call to this operation will have no effect. + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::AlreadyClosedError + * The Subscriber has already been closed. + * @throws dds::core::NotEnabledError + * The Subscriber has not yet been enabled. + * @throws dds::core::NullReferenceError + * The Subscriber was not properly created and references to dds::core::null. + */ + void end(); + +public: + /** + * The destruction of the CoherentAccess will implicitly end the coherent + * access if not already ended by a call to end(). + * + * When there is a problem with which end() would normally throw an exception, + * then that exception is swallowed. Errors can be found in the logs. + */ + ~TCoherentAccess(); + +private: + TCoherentAccess(const TCoherentAccess&); + TCoherentAccess& operator=(const TCoherentAccess&); +}; + + +#endif /* OMG_TDDS_SUB_TCOHERENT_ACCESS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/TDataReader.hpp b/unitree_SDK/include/ddscxx/dds/sub/TDataReader.hpp new file mode 100644 index 0000000..433a5d7 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/TDataReader.hpp @@ -0,0 +1,1689 @@ +#ifndef OMG_DDS_SUB_TDATA_READER_HPP_ +#define OMG_DDS_SUB_TDATA_READER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ +#include +#include +#include +#include +#include +#include + + +namespace dds +{ +namespace sub +{ +template class DELEGATE> +class DataReader; + +template +class DataReaderListener; +} +} + +/** + * @brief + * DataReader allows the applicatin to access published sample data. + * + * A DataReader allows the application: + * - to declare the data it wishes to receive (i.e., make a subscription) + * - to access the data received by the attached Subscriber + * + * A DataReader refers to exactly one TopicDescription (either a Topic, a + * ContentFilteredTopic or a MultiTopic) that identifies the samples to be + * read. The Topic must exist prior to the DataReader creation. + * + * A DataReader is attached to exactly one Subscriber which acts as a factory + * for it. + * + * The DataReader may give access to several instances of the data type, which + * are distinguished from each other by their key. + * + * The pre-processor generates from IDL type descriptions the application + * DataReader classes. For each application data type that is used as Topic + * data type, a typed class DataReader is derived from the AnyDataReader + * class. + * + * For instance, for an application, the definitions are located in the Foo.idl file. + * The pre-processor will generate a ccpp_Foo.h include file. + * + * General note: The name ccpp_Foo.h is derived from the IDL file Foo.idl, + * that defines Foo::Bar, for all relevant DataReader operations. + * + * @note Apart from idl files, Google protocol buffers are also supported. For the + * API itself, it doesn't matter if the type header files were generated from + * idl or protocol buffers. The resulting API usage and includes remain the same. + * + * @anchor anchor_dds_sub_datareader_example + * Example + * @code{.cpp} + * // Default creation of a DataReader + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * + * { + * // Default read of a sample on the DataReader + * dds::sub::LoanedSamples samples; + * samples = reader.read(); + * + * // Default way of accessing the loaned samples + * dds::sub::LoanedSamples::const_iterator it; + * for (it = samples.begin(); it != samples.end(); ++it) { + * const dds::sub::Sample& sample = *it; + * const Foo::Bar& data = sample.data(); + * const dds::sub::SampleInfo& info = sample.info(); + * // Use sample data and meta information. + * } + * } + * // Like the name says, the read samples are loans from the DataReader. The loan + * // was automatically returned when the LoanedSamples went out of scope. + * @endcode + * + * @see for more information: @ref DCPS_Modules_Subscription "Subscription concept" + * @see for more information: @ref DCPS_Modules_Subscription_DataReader "DataReader concept" + */ +template class DELEGATE> +class dds::sub::DataReader : public dds::sub::TAnyDataReader< DELEGATE > +{ + +public: + /** + * Local convenience typedef for dds::sub::DataReaderListener. + */ + typedef ::dds::sub::DataReaderListener Listener; + +public: + + /** + * The Selector class is used by the DataReader to compose read operations. + * + * A Selector can perform complex data selections, such as per-instance selection, + * content and status filtering, etc, when reading or taking samples. These settings + * on a Selector can be concatenated. + * + * The DataReader has the select() operation, which can be used to aqcuire the Selector + * functionality on the reader implicitly. + * @code{.cpp} + * // Take a maximum of 3 new samples of a certain instance. + * samples = reader.select() + * .max_samples(3) + * .state(dds::sub::status::DataState::new_data()) + * .instance(someValidInstanceHandle) + * .take(); + * @endcode + * However, this will create and destroy a Selector for every read, which is not + * very performance friendly. + * + * The performance can be increase by creating a Selector up front and doing the + * reading on that Selector directly and re-using it. + * @code{.cpp} + * // Create a Selector as selective reader up front. + * dds::sub::DataReader::Selector selectiveReader(reader); + * // Configure it to take a maximum of 3 new samples of a certain instance + * selectiveReader.max_samples(3); + * selectiveReader.state(dds::sub::status::DataState::new_data()); + * selectiveReader.instance(someValidInstanceHandle); + * + * // Use the configured Selector to -take- a maximum of 3 new samples of a + * // certain instance (which it was configured to do). + * // This can be used in loops for example, reducing the need for creating + * // implicit Selectors for every take. + * samples = selectiveReader.take(); + * @endcode + * + * Defaults + * Element | Default Value + * --------------- | -------------------- + * state | dds::sub::status::DataState::any + * content | Empty dds::sub::Query + * max_samples | dds::core::LENGTH_UNLIMITED + * instance | dds::core::InstanceHandle nil + * + * @see for more information: @link dds::sub::DataReader::select() DataReader select() @endlink + */ + class Selector + { + public: + /** + * Construct a Selector for a DataReader. + * + * @param dr DataReader + */ + Selector(DataReader& dr); + + /** + * Set InstanceHandle to filter with during the read or take. + * + * Example
      + * Read only samples of the given instance. + * @code{.cpp} + * dds::core::InstanceHandle hdl = someValidInstanceHandle; + * + * // Implicit use of Selector + * samples = reader.select().instance(hdl).read(); + * + * // Explicit use of Selector + * dds::sub::DataReader::Selector selectiveReader(reader); + * selectiveReader.instance(hdl); + * samples = selectiveReader.read(); + * @endcode + * See also @link dds::sub::DataReader::select() DataReader select() @endlink operation. + * + * @param handle the InstanceHandle to read/take for + * @return a Selector to be able to concatenate Selector settings. + */ + Selector& instance(const dds::core::InstanceHandle& handle); + + /** + * Set next InstanceHandle to filter with during the read or take. + * + * Example
      + * Read all samples, instance by instance. + * @code{.cpp} + * // Implicit use of Selector + * { + * // Get sample(s) of first instance + * dds::core::InstanceHandle hdl; //nil + * samples = reader.select().next_instance(hdl).read(); + * while (samples.length() > 0) { + * // Handle the sample(s) of this instance (just the first one in this case) + * const dds::sub::Sample& sample = *(samples.begin()); + * // Get sample(s) of the next instance + * hdl = sample.info().instance_handle(); + * samples = reader.select().next_instance(hdl).read(); + * } + * } + * + * // Explicit use of Selector + * { + * // Get sample(s) of first instance + * dds::sub::DataReader::Selector selectiveReader(reader); + * dds::core::InstanceHandle hdl; //nil + * selectiveReader.next_instance(hdl); + * samples = selectiveReader.read(); + * while (samples.length() > 0) { + * // Handle the sample(s) of this instance (just the first one in this case) + * const dds::sub::Sample& sample = *(samples.begin()); + * // Get sample(s) of the next instance + * hdl = sample.info().instance_handle(); + * selectiveReader.next_instance(hdl); + * samples = selectiveReader.read(); + * } + * } + * @endcode + * See also @link dds::sub::DataReader::select() DataReader select() @endlink operation. + * + * @param handle the 'previous' InstanceHandle associated with new the read/take + * @return a Selector to be able to concatenate Selector settings. + */ + Selector& next_instance(const dds::core::InstanceHandle& handle); + + /** + * Set DataState to filter with during the read or take. + * + * Example
      + * Read only new data. + * @code{.cpp} + * // DataState to filter only new data + * dds::sub::status::DataState newData = dds::sub::status::DataState::new_data(); + * + * // Implicit use of Selector + * samples = reader.select().state(newData).read(); + * + * // Explicit use of Selector + * dds::sub::DataReader::Selector selectiveReader(reader); + * selectiveReader.state(newData); + * samples = selectiveReader.read(); + * @endcode + * See also @link dds::sub::DataReader::select() DataReader select() @endlink operation. + * + * @param state the requested DataState of the samples + * @return a Selector to be able to concatenate Selector settings. + */ + Selector& state(const dds::sub::status::DataState& state); + + /** + * Set the Query to filter with during the read or take. + * + * Example
      + * Read only samples that will be filtered according to the given dds::sub::Query. + * @code{.cpp} + * // Assume data type has an element called long_1 + * dds::sub::Query query(reader, "long_1 > 1 and long_1 < 7"); + * + * // Implicit use of Selector + * samples = reader.select().content(query).read(); + * + * // Explicit use of Selector + * dds::sub::DataReader::Selector selectiveReader(reader); + * selectiveReader.content(query); + * samples = selectiveReader.read(); + * @endcode + * See also @link dds::sub::DataReader::select() DataReader select() @endlink operation. + * + * @param query the Query to apply to the selector + * @return a Selector to be able to concatenate Selector settings. + */ + Selector& content(const dds::sub::Query& query); + + /** + * Set max_samples to limit the number of sample to get during the read or take. + * + * Example
      + * Read a maximum of three samples. + * @code{.cpp} + * // Implicit use of Selector + * samples = reader.select().max_samples(3).read(); + * + * // Explicit use of Selector + * dds::sub::DataReader::Selector selectiveReader(reader); + * selectiveReader.max_samples(3); + * samples = selectiveReader.read(); + * @endcode + * See also @link dds::sub::DataReader::select() DataReader select() @endlink operation. + * + * @param maxsamples maximum number of samples to read/take + * @return a Selector to be able to concatenate Selector settings. + */ + Selector& max_samples(uint32_t maxsamples); + + /** + * This operation works the same as the @link DataReader::read() default + * DataReader read() @endlink, except that it is performed on this Selector + * with possible filters set. + * + * @return The samples in the LoanedSamples container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + dds::sub::LoanedSamples read(); + + /** + * This operation works the same as the @link DataReader::take() default + * DataReader take() @endlink, except that it is performed on this Selector + * with possible filters set. + * + * @return The samples in the LoanedSamples container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + dds::sub::LoanedSamples take(); + + // --- Forward Iterators: --- // + /** + * This operation works the same as the @link DataReader::read(SamplesFWIterator sfit, uint32_t max_samples) + * forward iterator DataReader read() @endlink, except that it is performed on this + * Selector with possible filters set. + * + * @param sfit Forward-inserting container iterator + * @param max_samples Maximum samples to read and copy into the given container + * @return The number of samples in the LoanedSamples container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + template + uint32_t + read(SamplesFWIterator sfit, uint32_t max_samples); + + /** + * This operation works the same as the @link DataReader::take(SamplesFWIterator sfit, uint32_t max_samples) + * forward iterator DataReader take() @endlink, except that it is performed on this + * Selector with possible filters set. + * + * @param sfit Forward-inserting container iterator + * @param max_samples Maximum samples to read and copy into the given container + * @return The number of samples in the given container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + template + uint32_t + take(SamplesFWIterator sfit, uint32_t max_samples); + + // --- Back-Inserting Iterators: --- // + /** + * This operation works the same as the @link DataReader::read(SamplesBIIterator sbit) + * backward iterator DataReader read() @endlink, except that it is performed on this + * Selector with possible filters set. + * + * @param sbit Back-inserting container iterator + * @return The number of samples in the given container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + template + uint32_t + read(SamplesBIIterator sbit); + + /** + * This operation works the same as the @link DataReader::take(SamplesBIIterator sbit) + * backward iterator DataReader take() @endlink, except that it is performed on this + * Selector with possible filters set. + * + * @param sbit Back-inserting container iterator + * @return The number of samples in the given container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + template + uint32_t + take(SamplesBIIterator sbit); + + private: + typename DELEGATE::Selector impl_; + }; + + /** + * The ManipulatorSelector class is used by the DataReader to compose streaming + * read operations. + * + * A ManipulatorSelector can perform complex data selections, such as per-instance + * selection, content and status filtering, etc, when reading or taking samples + * through the streaming operator. + * + * Convenience functors
      + * The following convenience functors use a ManipulatorSelector implicitly and can be + * used in the streaming operator: + * - dds::sub::read + * - dds::sub::take + * - dds::sub::max_samples + * - dds::sub::content + * - dds::sub::state + * - dds::sub::instance + * - dds::sub::next_instance + * + * @code{.cpp} + * // Take a maximum of 3 new samples of a certain instance. + * reader >> dds::sub::take + * >> dds::sub::max_samples(3) + * >> dds::sub::state(dds::sub::status::DataState::new_data()) + * >> dds::sub::instance(someValidInstanceHandle) + * >> samples; + * @endcode + * However, this will create and destroy ManipulatorSelectors and Functors for + * every read, which is not very performance friendly. + * + * The performance can be increase by creating a ManipulatorSelector up front and + * doing the reading on that ManipulatorSelector directly and re-using it. + * @code{.cpp} + * // Create a ManipulatorSelector as selective reader up front. + * dds::sub::DataReader::ManipulatorSelector selectiveReader(reader); + * // Configure it to take a maximum of 3 new samples of a certain instance + * selectiveReader.max_samples(3); + * selectiveReader.state(dds::sub::status::DataState::new_data()); + * selectiveReader.instance(someValidInstanceHandle); + * selectiveReader.read_mode(false); // take + * + * // Use the configured ManipulatorSelector to -take- a maximum of 3 samples of a + * // certain instance (which it was configured to do). + * // This can be used in loops for example, reducing the need for creating + * // implicit ManipulatorSelectors for every take. + * selectiveReader >> samples; + * @endcode + * + * Defaults + * Element | Default Value + * --------------- | -------------------- + * read_mode | true (read) + * state | dds::sub::status::DataState::any + * content | Empty dds::sub::Query + * max_samples | dds::core::LENGTH_UNLIMITED + * instance | dds::core::InstanceHandle nil + * + * @see for more information: @link dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) DataReader stream operator>> @endlink + */ + class ManipulatorSelector + { + public: + /** + * Construct a ManipulatorSelector for a DataReader. + * + * See also @link dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) + * DataReader stream operator>> @endlink + * + * @param DataReader + */ + ManipulatorSelector(DataReader& dr); + + /** + * Get the read_mode. + * + * The read_mode specifies if a sample should be read or taken: + * - true = read (default) + * - false = take + * + * @return true if read_mode is set to read + */ + bool read_mode(); + + /** + * Set the read_mode. + * + * The read_mode specifies if a sample should be read or taken: + * - true = read (default) + * - false = take + * + * Convenience Functor: dds::sub::read
      + * Convenience Functor: dds::sub::take + * + * Example
      + * Determine to read or take samples. + * @code{.cpp} + * // No usage of ManipulatorSelector, means a read iso take as default. + * reader >> samples; + * + * // Implicit use of ManipulatorSelector + * reader >> dds::sub::read >> samples; + * reader >> dds::sub::take >> samples; + * + * // Explicit use of ManipulatorSelector + * dds::sub::DataReader::ManipulatorSelector readingReader(reader); + * readingReader.read_mode(true); // Read, which is already the default. + * readingReader >> samples; + * + * dds::sub::DataReader::ManipulatorSelector takingReader(reader); + * takingReader.read_mode(false); // Take. + * takingReader >> samples; + * @endcode + * See also @link dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) + * DataReader stream operator>> @endlink + * + * @param readmode the read mode of the DataReader + */ + void read_mode(bool readmode); + + /** + * Set max_samples to limit the number of sample to get during the read or take. + * + * Convenience Functor: dds::sub::max_samples + * + * Example
      + * Read a maximum of three samples. + * @code{.cpp} + * // Implicit use of ManipulatorSelector + * reader >> dds::sub::max_samples(3) >> samples; + * + * // Explicit use of ManipulatorSelector + * dds::sub::DataReader::ManipulatorSelector selectiveReader(reader); + * selectiveReader.max_samples(3); + * selectiveReader >> samples; + * @endcode + * See also @link dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) + * DataReader stream operator>> @endlink + * + * @param n maximum number of samples + */ + ManipulatorSelector& max_samples(uint32_t n); + + /** + * Set InstanceHandle to filter with during the read or take. + * + * Convenience Functor: dds::sub::instance + * + * Example
      + * Read only samples of the given instance. + * @code{.cpp} + * dds::core::InstanceHandle hdl = someValidInstanceHandle; + * + * // Implicit use of ManipulatorSelector + * reader >> dds::sub::instance(hdl) >> samples; + * + * // Explicit use of ManipulatorSelector + * dds::sub::DataReader::ManipulatorSelector selectiveReader(reader); + * selectiveReader.instance(hdl); + * selectiveReader >> samples; + * @endcode + * See also @link dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) + * DataReader stream operator>> @endlink + * + * @param handle the InstanceHandle for the read/take + */ + ManipulatorSelector& instance(const dds::core::InstanceHandle& handle); + + /** + * Set next InstanceHandle to filter with during the read or take. + * + * Convenience Functor: dds::sub::next_instance + * + * Example
      + * Read all samples, instance by instance. + * @code{.cpp} + * // Implicit use of ManipulatorSelector + * { + * // Get sample(s) of first instance + * dds::core::InstanceHandle hdl; //nil + * reader >> dds::sub::next_instance(hdl) >> samples; + * while (samples.length() > 0) { + * // Handle the sample(s) of this instance (just the first one in this case) + * const dds::sub::Sample& sample = *(samples.begin()); + * // Get sample(s) of the next instance + * hdl = sample.info().instance_handle(); + * reader >> dds::sub::next_instance(hdl) >> samples; + * } + * } + * + * // Explicit use of ManipulatorSelector + * { + * // Get sample(s) of first instance + * dds::sub::DataReader::ManipulatorSelector selectiveReader(reader); + * dds::core::InstanceHandle hdl; //nil + * selectiveReader.next_instance(hdl); + * selectiveReader >> samples; + * while (samples.length() > 0) { + * // Handle the sample(s) of this instance (just the first one in this case) + * const dds::sub::Sample& sample = *(samples.begin()); + * // Get sample(s) of the next instance + * hdl = sample.info().instance_handle(); + * selectiveReader.next_instance(hdl); + * selectiveReader >> samples; + * } + * } + * @endcode + * See also @link dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) + * DataReader stream operator>> @endlink + * + * @param handle the 'previous' InstanceHandle associated with new the read/take + */ + ManipulatorSelector& next_instance(const dds::core::InstanceHandle& handle); + + /** + * Set DataState to filter with during the read or take. + * + * Convenience Functor: dds::sub::state + * + * Example
      + * Read only new data. + * @code{.cpp} + * // DataState to filter only new data + * dds::sub::status::DataState newData = dds::sub::status::DataState::new_data(); + * + * // Implicit use of ManipulatorSelector + * reader >> dds::sub::state(newData) >> samples; + * + * // Explicit use of ManipulatorSelector + * dds::sub::DataReader::ManipulatorSelector selectiveReader(reader); + * selectiveReader.state(newData); + * selectiveReader.read() >> samples; + * @endcode + * See also @link dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) + * DataReader stream operator>> @endlink + * + * @param state the required DataState of the samples + */ + ManipulatorSelector& state(const dds::sub::status::DataState& state); + + /** + * Set Query to filter with during the read or take. + * + * Convenience Functor: dds::sub::content + * + * Example
      + * Read only samples that will be filtered according to the given dds::sub::Query. + * @code{.cpp} + * // Assume data type has an element called long_1 + * dds::sub::Query query(reader, "long_1 > 1 and long_1 < 7"); + * + * // Implicit use of ManipulatorSelector + * reader >> dds::sub::content(query) >> samples; + * + * // Explicit use of ManipulatorSelector + * dds::sub::DataReader::ManipulatorSelector selectiveReader(reader); + * selectiveReader.content(query); + * selectiveReader >> read; + * @endcode + * See also @link dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) + * DataReader stream operator>> @endlink + * + * @param query The Query to apply to a read/take + */ + ManipulatorSelector& content(const dds::sub::Query& query); + + /** + * This operation works the same as the @link dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) + * DataReader stream operator>> @endlink, except that it is performed on this ManipulatorSelector + * with possible filters set. + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + ManipulatorSelector& + operator >>(dds::sub::LoanedSamples& samples); + + /** + * This operation works the same as the @link dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) + * DataReader stream operator>> @endlink, except that it is performed on this ManipulatorSelector + * with possible filters set. + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + ManipulatorSelector& + operator >> (ManipulatorSelector & (manipulator)(ManipulatorSelector&)); + + /** + * This operation works the same as the @link dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) + * DataReader stream operator>> @endlink, except that it is performed on this ManipulatorSelector + * with possible filters set. + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + template + ManipulatorSelector + operator >> (Functor f); + + private: + typename DELEGATE::ManipulatorSelector impl_; + + }; + +public: + OMG_DDS_REF_TYPE_PROTECTED_DC_T(DataReader, dds::sub::TAnyDataReader, T, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(DataReader) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(DataReader) + +public: + /** + * Create a new DataReader for the desired Topic, ContentFilteredTopic or MultiTopic, + * using the given Subscriber. + * + * QoS
      + * The DataReader will be created with the QoS values specified on the last + * successful call to @link dds::sub::Subscriber::default_datareader_qos(const dds::sub::qos::DataReaderQos& qos) + * sub.default_datareader_qos(qos) @endlink or, if the call was never made, + * the @ref anchor_dds_sub_datareader_qos_defaults "default" values. + * + * @param sub the Subscriber that will contain this DataReader + * @param topic the Topic associated with this DataReader + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + DataReader(const dds::sub::Subscriber& sub, + const ::dds::topic::Topic& topic); + + /** + * Create a new DataReader for the desired Topic, ContentFilteredTopic or MultiTopic, + * using the given Subscriber and DataReaderQos and attaches the optionally specified + * DataReaderListener to it. + * + * QoS
      + * A possible application pattern to construct the DataReaderQos for the + * DataReader is to: + * @code{.cpp} + * // 1) Retrieve the QosPolicy settings on the associated Topic + * dds::topic::qos::TopicQos topicQos = topic.qos(); + * // 2) Retrieve the default DataReaderQos from the related Subscriber + * dds::sub::qos::DataReaderQos readerQos = subscriber.default_datareader_qos(); + * // 3) Combine those two lists of QosPolicy settings by overwriting DataReaderQos + * // policies that are also present TopicQos + * readerQos = topicQos; + * // 4) Selectively modify QosPolicy settings as desired. + * readerQos << dds::core::policy::Durability::Transient(); + * // 5) Use the resulting QoS to construct the DataReader. + * dds::sub::DataReader reader(subscriber, topic, readerQos); + * @endcode + * + * Listener
      + * The following statuses are applicable to the DataReaderListener: + * - dds::core::status::StatusMask::requested_deadline_missed() + * - dds::core::status::StatusMask::requested_incompatible_qos() + * - dds::core::status::StatusMask::sample_lost() + * - dds::core::status::StatusMask::sample_rejected() + * - dds::core::status::StatusMask::data_available() + * - dds::core::status::StatusMask::liveliness_changed() + * - dds::core::status::StatusMask::subscription_matched() + * + * See @ref DCPS_Modules_Infrastructure_Listener "listener concept", + * @ref anchor_dds_sub_datareader_commstatus "communication status" and + * @ref anchor_dds_sub_datareader_commpropagation "communication propagation" + * for more information. + * + * @param sub the Subscriber that will contain this DataReader + * @param topic the Topic, ContentFilteredTopic or MultiTopic associated with this DataReader + * @param qos the DataReader qos. + * @param listener the DataReader listener. + * @param mask the listener event mask. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::InconsistentPolicyError + * The parameter qos contains conflicting QosPolicy settings. + */ + DataReader(const dds::sub::Subscriber& sub, + const ::dds::topic::Topic& topic, + const dds::sub::qos::DataReaderQos& qos, + dds::sub::DataReaderListener* listener = NULL, + const dds::core::status::StatusMask& mask = ::dds::core::status::StatusMask::none()); + + #ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT + + /** @copydoc dds::sub::DataReader::DataReader(const dds::sub::Subscriber& sub, const ::dds::topic::Topic& topic) */ + DataReader(const dds::sub::Subscriber& sub, + const ::dds::topic::ContentFilteredTopic& topic); + + /** @copydoc dds::sub::DataReader::DataReader(const dds::sub::Subscriber& sub, const ::dds::topic::Topic& topic, const dds::sub::qos::DataReaderQos& qos, dds::sub::DataReaderListener* listener, const dds::core::status::StatusMask& mask) */ + DataReader(const dds::sub::Subscriber& sub, + const ::dds::topic::ContentFilteredTopic& topic, + const dds::sub::qos::DataReaderQos& qos, + dds::sub::DataReaderListener* listener = NULL, + const dds::core::status::StatusMask& mask = ::dds::core::status::StatusMask::none()); + #endif /* OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT */ + + #ifdef OMG_DDS_MULTI_TOPIC_SUPPORT + + /** @copydoc dds::sub::DataReader::DataReader(const dds::sub::Subscriber& sub, const ::dds::topic::Topic& topic) */ + DataReader(const dds::sub::Subscriber& sub, + const ::dds::topic::MultiTopic& topic); + + /** @copydoc dds::sub::DataReader::DataReader(const dds::sub::Subscriber& sub, const ::dds::topic::Topic& topic, const dds::sub::qos::DataReaderQos& qos, dds::sub::DataReaderListener* listener, const dds::core::status::StatusMask& mask) */ + DataReader(const dds::sub::Subscriber& sub, + const ::dds::topic::MultiTopic& topic, + const dds::sub::qos::DataReaderQos& qos, + dds::sub::DataReaderListener* listener = NULL, + const dds::core::status::StatusMask& mask = ::dds::core::status::StatusMask::none()); + + #endif /* OMG_DDS_MULTI_TOPIC_SUPPORT */ + +public: + // == ReadState Management + + /** + * Returns the @ref anchor_dds_sub_datareader_defaultstatefilter "default state filter" + * for read/take operations. + * + * The default value of default_filter_state is dds::sub::status::DataState::any(). + * + * @return the default state to filter for + */ + dds::sub::status::DataState default_filter_state(); + + /** + * Set the default state filter for read/take operations. + * + * @anchor anchor_dds_sub_datareader_defaultstatefilter + * Default State Filter
      + * The default_filter_state indicates what the dds::sub::status::DataState of samples + * should be for the read to filter them out of the total data samples pool. + * + * This filter can be overruled by using dds::sub::DataReader::Selector::state or + * dds::sub::DataReader::ManipulatorSelector::state during the actual read action. + * + * @param state the state mask that will be used to read/take samples + */ + DataReader& default_filter_state(const dds::sub::status::DataState& state); + + //== Streaming read/take + + /** + * This operation reads a sequence of typed samples from the DataReader by means + * of the shift operator. + * + * What samples are read depends on what @link dds::sub::DataReader::default_filter_state(const dds::sub::status::DataState& state) + * default state filter @endlink has been set (default any). + * + * This operation reads a sequence of typed samples from the DataReader. The + * data is put into a dds::sub::LoanedSamples, which is basically a sequence of samples, + * which in turn contains the actual data and meta information. + * + * The memory used for storing the sample may be loaned by the middleware thus allowing zero + * copy operations. + * + * If the DataReader has no samples that meet the constraints, the resulting + * dds::sub::LoanedSamples will be empty. + * @code{.cpp} + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * + * { + * dds::sub::LoanedSamples samples; + * reader >> samples; + * } + * // The LoanedSamples went out of scope, meaning the loan was returned. + * @endcode + * + * Take
      + * The default behaviour of the DataReader stream operator>> is to read samples. It can be + * explicitly stated if the operator should do a read or take. + * @code{.cpp} + * reader >> dds::sub::read >> samples; + * reader >> dds::sub::take >> samples; + * @endcode + * These are two of the available convenience manipulators (see next paragraph). + * + * Manipulators
      + * Manipulators are defined externally to make it possible to control which data is read + * and whether the streaming operators reads or takes. + * + * Available convenience stream manipulators: + * - dds::sub::read + * - dds::sub::take + * - dds::sub::max_samples + * - dds::sub::content + * - dds::sub::state + * - dds::sub::instance + * - dds::sub::next_instance + * + * The manipulators can be concatenated: + * @code{.cpp} + * // Take (iso read) a maximum of 3 new samples of a certain instance. + * reader >> dds::sub::take + * >> dds::sub::max_samples(3) + * >> dds::sub::state(dds::sub::status::DataState::new_data()) + * >> dds::sub::instance(someValidInstanceHandle) + * >> samples; + * @endcode + * + * Please be aware that using pre-set filters on the DataReader and then + * call read() or take() on that reader explicitly will perform better than + * having to create Manipulators for every read (which is what essentially + * happens in the code example above). Performance can be increase by creating + * a manipulator up front and using that multiple times + * (see dds::sub::DataReader::ManipulatorSelector). + * + * Invalid Data
      + * Some elements in the returned sequence may not have valid data: the valid_data + * field in the SampleInfo indicates whether the corresponding data value contains + * any meaningful data. If not, the data value is just a ‘dummy’ sample for which only + * the keyfields have been assigned. It is used to accompany the SampleInfo that + * communicates a change in the instance_state of an instance for which there is + * no ‘real’ sample available. + * + * For example, when an application always ‘takes’ all available samples of a + * particular instance, there is no sample available to report the disposal of that + * instance. In such a case the DataReader will insert a dummy sample into the + * data_values sequence to accompany the SampleInfo element in the info_seq + * sequence that communicates the disposal of the instance. + * + * The act of reading a sample sets its sample_state to READ_SAMPLE_STATE. If + * the sample belongs to the most recent generation of the instance, it also sets the + * view_state of the instance to NOT_NEW_VIEW_STATE. It does not affect the + * instance_state of the instance. + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + DataReader& operator>>(dds::sub::LoanedSamples& ls); + + /** @copydoc dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) */ + ManipulatorSelector + operator>> (ManipulatorSelector & (manipulator)(ManipulatorSelector&)); + + /** @copydoc dds::sub::DataReader::operator>>(dds::sub::LoanedSamples& ls) */ + template + ManipulatorSelector + operator>> (Functor f); + + + /////////////////////////////////////////////////////////////////////// +public: + //== Loan Read/Take API ================================================== + + /** + * This operation reads a sequence of typed samples from the DataReader. + * + * What samples are read depends on what @link dds::sub::DataReader::default_filter_state(const dds::sub::status::DataState& state) + * default state filter @endlink has been set (default any). + * + * This operation reads a sequence of typed samples from the DataReader. The + * data is put into a dds::sub::LoanedSamples, which is basically a sequence of samples, + * which in turn contains the actual data and meta information. + * + * The memory used for storing the sample may be loaned by the middleware thus allowing zero + * copy operations. + * + * If the DataReader has no samples that meet the constraints, the resulting + * dds::sub::LoanedSamples will be empty. + * @code{.cpp} + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * + * { + * // Read the available samples. + * dds::sub::LoanedSamples samples; + * samples = reader.read(); + * + * // Access the information. + * dds::sub::LoanedSamples::const_iterator it; + * for (it = samples.begin(); it != samples.end(); ++it) { + * const dds::sub::Sample& sample = *it; + * } + * } + * // The LoanedSamples went out of scope, meaning the loan resources were taken care of. + * @endcode + * + * Selectors
      + * What data is read already depends on the + * @ref anchor_dds_sub_datareader_defaultstatefilter "default state filter". + * But it can be manipulated even more when using dds::sub::DataReader::select() + * operation. + * + * @anchor anchor_dds_sub_datareader_invalidsamples + * Invalid Data
      + * Some elements in the returned sequence may not have valid data: the valid_data + * field in the SampleInfo indicates whether the corresponding data value contains + * any meaningful data. If not, the data value is just a ‘dummy’ sample for which only + * the keyfields have been assigned. It is used to accompany the SampleInfo that + * communicates a change in the instance_state of an instance for which there is + * no ‘real’ sample available. + * + * For example, when an application always ‘takes’ all available samples of a + * particular instance, there is no sample available to report the disposal of that + * instance. In such a case the DataReader will insert a dummy sample into the + * data_values sequence to accompany the SampleInfo element in the info_seq + * sequence that communicates the disposal of the instance. + * + * The act of reading a sample sets its sample_state to READ_SAMPLE_STATE. If + * the sample belongs to the most recent generation of the instance, it also sets the + * view_state of the instance to NOT_NEW_VIEW_STATE. It does not affect the + * instance_state of the instance. + * + * @return The samples in the LoanedSamples container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + LoanedSamples read(); + + /** + * This operation takes a sequence of typed samples from the DataReader. + * + * The behaviour is identical to read except for that the samples are removed + * from the DataReader. + * + * What samples are taken depends on what @link dds::sub::DataReader::default_filter_state(const dds::sub::status::DataState& state) + * default state filter @endlink has been set (default any). + * + * This operation takes a sequence of typed samples from the DataReader. The + * data is put into a dds::sub::LoanedSamples, which is basically a sequence of samples, + * which in turn contains the actual data and meta information. + * + * The memory used for storing the sample may be loaned by the middleware thus allowing zero + * copy operations. + * + * If the DataReader has no samples that meet the constraints, the resulting + * dds::sub::LoanedSamples will be empty. + * @code{.cpp} + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * + * { + * // Take the available samples. + * dds::sub::LoanedSamples samples; + * samples = reader.take(); + * + * // Access the information. + * dds::sub::LoanedSamples::const_iterator it; + * for (it = samples.begin(); it != samples.end(); ++it) { + * const dds::sub::Sample& sample = *it; + * } + * } + * // The LoanedSamples went out of scope, meaning the loan resources were taken care of. + * @endcode + * + * Selectors
      + * What data is taken, already depends on the + * @ref anchor_dds_sub_datareader_defaultstatefilter "default state filter". + * But it can be manipulated even more when using dds::sub::DataReader::select() + * operation. + * + * Invalid Data
      + * Some elements in the returned sequence may not have valid data: the valid_data + * field in the SampleInfo indicates whether the corresponding data value contains + * any meaningful data.
      + * Look @ref anchor_dds_sub_datareader_invalidsamples "here" for more information. + * + * @return The samples in the LoanedSamples container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + LoanedSamples take(); + + //== Copy Read/Take API ================================================== + + // --- Forward Iterators: --- // + + /** + * This operation reads a sequence of typed samples from the DataReader. + * + * What samples are read depends on what @link dds::sub::DataReader::default_filter_state(const dds::sub::status::DataState& state) + * default state filter @endlink has been set (default any). + * + * The samples are copied into the application provided container using the + * forward iterator parameter. + * + * If the DataReader has no samples that meet the constraints, the resulting + * dds::sub::LoanedSamples will be empty. + * @code{.cpp} + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * + * // Prepare container to store samples in + * const uint32_t MAX_SAMPLES (3) + * std::vector > samples(MAX_SAMPLES); + * std::vector >::iterator iter = samples.begin(); + * + * // Read and copy the available samples into the vector by means of the iterator + * uint32_t len = reader.read(iter, MAX_SAMPLES); + * + * // Access the information. + * for (iter = samples.begin(); iter != samples.end(); ++iter) { + * const dds::sub::Sample& sample = *iter; + * } + * @endcode + * + * Selectors
      + * What data is read already depends on the + * @ref anchor_dds_sub_datareader_defaultstatefilter "default state filter". + * But it can be manipulated even more when using dds::sub::DataReader::select() + * operation. + * + * Invalid Data
      + * Some elements in the returned sequence may not have valid data: the valid_data + * field in the SampleInfo indicates whether the corresponding data value contains + * any meaningful data.
      + * Look @ref anchor_dds_sub_datareader_invalidsamples "here" for more information. + * + * @param sfit Forward-inserting container iterator + * @param max_samples Maximum samples to read and copy into the given container + * @return The number of samples in the LoanedSamples container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + template + uint32_t + read(SamplesFWIterator sfit, + uint32_t max_samples); + + /** + * This operation takes a sequence of typed samples from the DataReader. + * + * What samples are take depends on what @link dds::sub::DataReader::default_filter_state(const dds::sub::status::DataState& state) + * default state filter @endlink has been set (default any). + * + * The samples are copied into the application provided container using the + * forward iterator parameter. + * + * If the DataReader has no samples that meet the constraints, the resulting + * dds::sub::LoanedSamples will be empty. + * @code{.cpp} + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * + * // Prepare container to store samples in + * const uint32_t MAX_SAMPLES (3) + * std::vector > samples(MAX_SAMPLES); + * std::vector >::iterator iter = samples.begin(); + * + * // Take and copy the available samples into the vector by means of the iterator + * uint32_t len = reader.take(iter, MAX_SAMPLES); + * + * // Access the information. + * for (iter = samples.begin(); iter != samples.end(); ++iter) { + * const dds::sub::Sample& sample = *iter; + * } + * @endcode + * + * Selectors
      + * What data is taken, already depends on the + * @ref anchor_dds_sub_datareader_defaultstatefilter "default state filter". + * But it can be manipulated even more when using dds::sub::DataReader::select() + * operation. + * + * Invalid Data
      + * Some elements in the returned sequence may not have valid data: the valid_data + * field in the SampleInfo indicates whether the corresponding data value contains + * any meaningful data.
      + * Look @ref anchor_dds_sub_datareader_invalidsamples "here" for more information. + * + * @param sfit Forward-inserting container iterator + * @param max_samples Maximum samples to take and copy into the given container + * @return The number of samples in the given container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + template + uint32_t + take(SamplesFWIterator sfit, + uint32_t max_samples); + + + // --- Back-Inserting Iterators: --- // + + /** + * This operation reads a sequence of typed samples from the DataReader. + * + * What samples are read depends on what @link dds::sub::DataReader::default_filter_state(const dds::sub::status::DataState& state) + * default state filter @endlink has been set (default any). + * + * The samples are copied into the application provided container using a + * back-inserting iterator. Notice that as a consequence of using a back-inserting + * iterator, this operation may allocate memory to resize the underlying container. + * + * If the DataReader has no samples that meet the constraints, the resulting + * dds::sub::LoanedSamples will be empty. + * @code{.cpp} + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * + * // Prepare container to store samples in + * std::vector > samples; + * std::back_insert_iterator< std::vector > > bi(samples); + * + * // Read and copy the available samples into the vector by means of the iterator + * uint32_t len = reader.read(bi); + * + * // Access the information. + * std::vector >::iterator iter = samples.begin(); + * for (iter = samples.begin(); iter != samples.end(); ++iter) { + * const dds::sub::Sample& sample = *iter; + * } + * @endcode + * + * Selectors
      + * What data is read already depends on the + * @ref anchor_dds_sub_datareader_defaultstatefilter "default state filter". + * But it can be manipulated even more when using dds::sub::DataReader::select() + * operation. + * + * Invalid Data
      + * Some elements in the returned sequence may not have valid data: the valid_data + * field in the SampleInfo indicates whether the corresponding data value contains + * any meaningful data.
      + * Look @ref anchor_dds_sub_datareader_invalidsamples "here" for more information. + * + * @param sbit Back-inserting container iterator + * @return The number of samples in the given container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + template + uint32_t + read(SamplesBIIterator sbit); + + /** + * This operation takes a sequence of typed samples from the DataReader. + * + * What samples are take depends on what @link dds::sub::DataReader::default_filter_state(const dds::sub::status::DataState& state) + * default state filter @endlink has been set (default any). + * + * The samples are copied into the application provided container using a + * back-inserting iterator. Notice that as a consequence of using a back-inserting + * iterator, this operation may allocate memory to resize the underlying container. + * + * If the DataReader has no samples that meet the constraints, the resulting + * dds::sub::LoanedSamples will be empty. + * @code{.cpp} + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * + * // Prepare container to store samples in + * std::vector > samples; + * std::back_insert_iterator< std::vector > > bi(samples); + * + * // Take and copy the available samples into the vector by means of the iterator + * uint32_t len = reader.take(bi); + * + * // Access the information. + * std::vector >::iterator iter = samples.begin(); + * for (iter = samples.begin(); iter != samples.end(); ++iter) { + * const dds::sub::Sample& sample = *iter; + * } + * @endcode + * + * Selectors
      + * What data is taken, already depends on the + * @ref anchor_dds_sub_datareader_defaultstatefilter "default state filter". + * But it can be manipulated even more when using dds::sub::DataReader::select() + * operation. + * + * Invalid Data
      + * Some elements in the returned sequence may not have valid data: the valid_data + * field in the SampleInfo indicates whether the corresponding data value contains + * any meaningful data.
      + * Look @ref anchor_dds_sub_datareader_invalidsamples "here" for more information. + * + * @param sbit Back-inserting container iterator + * @return The number of samples in the given container + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + template + uint32_t + take(SamplesBIIterator sbit); +public: + //======================================================================== + //== DSL Method for dealing with instances, content and status filters. + + /** + * Get a dds::sub::DataReader::Selector instance that acts on this DataReader. + * + * The DataReader::read and DataReader::take read all samples that are + * available within the DataReader (provided that the + * @ref anchor_dds_sub_datareader_defaultstatefilter "default state filter" + * hasn't been changed). + * + * Selectors
      + * A Selector can perform complex data selections, such as per-instance selection, + * content and status filtering, etc when reading or taking. Such a selector is + * returned by this operation. Setting filters on the Selector can be concatenated, + * resulting in the following example code. + * @code{.cpp} + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * + * // Take a maximum of 3 new samples of a certain instance. + * { + * dds::sub::LoanedSamples samples; + * samples = reader.select() + * .max_samples(3) + * .state(dds::sub::status::DataState::new_data()) + * .instance(someValidInstanceHandle) + * .take(); + * } + * @endcode + * + * Please be aware that using pre-set filters on the DataReader and then + * call read() or take() on that reader explicitly will perform better than + * having to create Selectors for every read (which is what essentially + * happens in the code example above). Performance can be increase by creating + * a selector up front and using that multiple times + * (see dds::sub::DataReader::Selector). + * + * @return A Selector that acts on the DataReader + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + */ + Selector select(); + + //======================================================================== + //== Instance Management +public: + /** + * This operation retrieves the key value of a specific instance. + * + * This operation can be used to retrieve the instance key that corresponds + * to an instance_handle. The operation will only fill the fields that form + * the key inside the sample instance. + * + * This operation may raise a InvalidArgumentError exception if the InstanceHandle + * does not correspond to an existing data-object known to the DataReader. + * If the implementation is not able to check invalid handles, then the + * result in this situation is unspecified. + * + * @param h The instance handle + * @return A topic instance with the handle and key fields set + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::InvalidArgumentError + * The InstanceHandle is not a valid handle. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataReader. + */ + dds::topic::TopicInstance key_value(const dds::core::InstanceHandle& h); + + /** + * This operation retrieves the key value of a specific instance. + * + * This operation can be used to retrieve the instance key that corresponds + * to an instance_handle. The operation will only fill the fields that form + * the key inside the sample instance. + * + * This operation may raise a InvalidArgumentError exception if the InstanceHandle + * does not correspond to an existing data-object known to the DataReader. + * If the implementation is not able to check invalid handles, then the + * result in this situation is unspecified. + * + * The Sample is added as parameter to be able to overload this operation. + * + * @param[out] sample A sample to set the key fields of + * @param[in] h The instance handle + * @return The given sample with the key fields set + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::InvalidArgumentError + * The InstanceHandle is not a valid handle. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + * @throws dds::core::PreconditionNotMetError + * The handle has not been registered with this DataReader. + */ + T& key_value(T& sample, const dds::core::InstanceHandle& h); + + /** + * This operation returns the value of the instance handle which corresponds + * to the instance_data. + * + * The instance handle can be used in read operations that operate + * on a specific instance. Note that DataReader instance handles are local, and are + * not interchangeable with DataWriter instance handles nor with instance handles + * of an other DataReader. + * + * This operation does not register the instance in question. If the instance has not been + * previously registered or if for any other + * reason the Service is unable to provide an instance handle, the Service will return + * the default nil handle (InstanceHandle.is_nil() == true). + * + * @param key the sample + * @return the instance handle + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + const dds::core::InstanceHandle + lookup_instance(const T& key) const; + +public: + + /** + * Register a listener with the DataReader. + * + * This operation attaches a DataReaderListener to the DataReader. Only one + * DataReaderListener can be attached to each DataReader. If a + * DataReaderListener was already attached, the operation will replace it with the + * new one. When the listener is the NULL pointer, it represents a listener that is + * treated as a NOOP for all statuses activated in the bit mask. + * + * Listener un-registration is performed by setting the listener to NULL and mask none(). + * + * @anchor anchor_dds_sub_datareader_commstatus + * Communication Status
      + * For each communication status, the StatusChangedFlag flag is initially set to + * FALSE. It becomes TRUE whenever that communication status changes. For each + * communication status activated in the mask, the associated DataReaderListener + * operation is invoked and the communication status is reset to FALSE, as the listener + * implicitly accesses the status which is passed as a parameter to that operation. The + * status is reset prior to calling the listener, so if the application calls the + * get__status from inside the listener it will see the status + * already reset. An exception to this rule is the NULL listener, which does not reset the + * communication statuses for which it is invoked. + * + * The following statuses are applicable to the DataReaderListener: + * - dds::core::status::StatusMask::requested_deadline_missed() + * - dds::core::status::StatusMask::requested_incompatible_qos() + * - dds::core::status::StatusMask::sample_lost() + * - dds::core::status::StatusMask::sample_rejected() + * - dds::core::status::StatusMask::data_available() + * - dds::core::status::StatusMask::liveliness_changed() + * - dds::core::status::StatusMask::subscription_matched() + * + * Be aware that the SUBSCRIPTION_MATCHED_STATUS is not applicable when the + * infrastructure does not have the information available to determine connectivity. + * This is the case when OpenSplice is configured not to maintain discovery + * information in the Networking Service. (See the description for the + * NetworkingService/Discovery/enabled property in the Deployment + * Manual for more information about this subject.) In this case the operation will + * throw UnsupportedError. + * + * Status bits are declared as a constant and can be used by the application in an OR + * operation to create a tailored mask. The special constant dds::core::status::StatusMask::none() + * can be used to indicate that the created entity should not respond to any of its available + * statuses. The DDS will therefore attempt to propagate these statuses to its factory. + * The special constant dds::core::status::StatusMask::all() can be used to select all applicable + * statuses specified in the "Data Distribution Service for Real-time Systems Version + * 1.2" specification which are applicable to the PublisherListener. + * + * @anchor anchor_dds_sub_datareader_commpropagation + * Status Propagation
      + * In case a communication status is not activated in the mask of the + * DataReaderListener, the SubscriberListener of the containing Subscriber + * is invoked (if attached and activated for the status that occurred). This allows the + * application to set a default behaviour in the SubscriberListener of the containing + * Subscriber and a DataReader specific behaviour when needed. In case the + * communication status is not activated in the mask of the SubscriberListener as + * well, the communication status will be propagated to the + * DomainParticipantListener of the containing DomainParticipant. In case + * the DomainParticipantListener is also not attached or the communication + * status is not activated in its mask, the application is not notified of the change. + * + * The statuses DATA_ON_READERS_STATUS and DATA_AVAILABLE_STATUS are + * "Read Communication Statuses" and are an exception to all other plain + * communication statuses: they have no corresponding status structure that can be + * obtained with a get__status operation and they are mutually + * exclusive. When new information becomes available to a DataReader, the Data + * Distribution Service will first look in an attached and activated + * SubscriberListener or DomainParticipantListener (in that order) for the + * DATA_ON_READERS_STATUS. In case the DATA_ON_READERS_STATUS can not be + * handled, the Data Distribution Service will look in an attached and activated + * DataReaderListener, SubscriberListener or DomainParticipant + * Listener for the DATA_AVAILABLE_STATUS (in that order). + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @param listener the listener + * @param event_mask the mask defining the events for which the listener + * will be notified. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * A status was selected that cannot be supported because + * the infrastructure does not maintain the required connectivity information. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void listener(Listener* listener, + const dds::core::status::StatusMask& event_mask); + + /** + * Get the listener of this DataReader. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @return the listener + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + */ + Listener* listener() const; +}; + + +#endif /* OMG_DDS_SUB_TDATA_READER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/TGenerationCount.hpp b/unitree_SDK/include/ddscxx/dds/sub/TGenerationCount.hpp new file mode 100644 index 0000000..e29c868 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/TGenerationCount.hpp @@ -0,0 +1,107 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_SUB_T_GENERATION_COUNT_HPP_ +#define OMG_DDS_SUB_T_GENERATION_COUNT_HPP_ + +#include + +namespace dds +{ +namespace sub +{ +template +class TGenerationCount; +} +} + +/** + * @brief + * Class to hold sample GenerationCount information and is part of dds::sub::SampleInfo. + * + * Generations + * A generation is defined as: ‘the number of times an instance has become alive (with + * instance_state==ALIVE) at the time the sample was + * received’. Note that the generation counters are initialized to zero when a + * DataReader first detects a never-seen-before instance. + * + * For each instance the middleware internally maintains two counts: the + * disposed_generation_count and no_writers_generation_count, relative to + * each DataReader: + * + * Two types of generations are distinguished: disposed_generation_count and + * no_writers_generation_count.
      + * - The disposed_generation_count and no_writers_generation_count are + * initialized to zero when the DataReader first detects the presence of + * a never-seen-before instance. + * - The disposed_generation_count is incremented each time the instance_state + * of the corresponding instance changes from not_alive_disposed to alive. + * - The no_writers_generation_count is incremented each time the instance_state + * of the corresponding instance changes from not_alive_no_writers to alive. + * + * The disposed_generation_count and no_writers_generation_count associated with + * the SampleInfo capture a snapshot of the corresponding counters at the time + * the sample was received. + * + * @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo" + */ +template +class dds::sub::TGenerationCount : public dds::core::Value +{ +public: + /** @cond + * Create an empty GenerationCount. + * This constructor is required for containers. + * An application would normally not create a GenerationCount itself. + * So, do not put the creation in the API documentation for clarity. + */ + TGenerationCount(); + + /** + * Create a GenerationCount instance. + * An application would normally not create a GenerationCount itself. + * So, do not put the creation in the API documentation for clarity. + */ + TGenerationCount(int32_t disposed_generation_count, int32_t no_writers_generation_count); + /** @endcond */ + +public: + /** + * Gets the disposed_generation_count. + * + * The disposed_generation_count is initialized at zero and is incremented + * each time the instance_state, of the corresponding instance, changes from + * not_alive_disposed to alive. + * + * @return the disposed_generation_count + */ + int32_t disposed() const; + + /** + * Gets the no_writers_generation_count. + * + * The no_writers_generation_count is initialized at zero and is incremented + * each time the instance_state, of the corresponding instance, changes from + * not_alive_no_writers to alive. + * + * @return the no_writers_generation_count + */ + inline int32_t no_writers() const; + +}; + +#endif /* OMG_DDS_SUB_T_GENERATION_COUNT_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/TQuery.hpp b/unitree_SDK/include/ddscxx/dds/sub/TQuery.hpp new file mode 100644 index 0000000..987b66c --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/TQuery.hpp @@ -0,0 +1,215 @@ +#ifndef DDS_CORE_TQUERY_HPP_ +#define DDS_CORE_TQUERY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + +namespace dds +{ +namespace sub +{ +template +class TQuery; +} +} + +/** + * @brief + * Query objects contain expressions that allow the application to specify + * a filter on the locally available data. + * + * A Query is used in a QueryCondition or DataReader::Selector and is + * associated with one DataReader. + * + * @anchor anchor_dds_sub_query_expression + * \par SQL Expression + * The SQL query string is set by expression which must be a subset of the + * SQL query language. In this query expression, parameters may be used, which must + * be set in the sequence of strings defined by the parameter query_parameters. A + * parameter is a string which can define an integer, float, string or enumeration. The + * number of values in query_parameters must be equal or greater than the highest + * referenced %n token in the query_expression (e.g. if %1 and %8 are used as + * parameters in the query_expression, the query_parameters should at least + * contain n+1 = 9 values).
      + * Look @ref DCPS_Queries_and_Filters "here" for the specific query expression syntax. + * + * @see dds::sub::cond::QueryCondition + * @see dds::sub::DataReader::Selector + * @see dds::sub::DataReader::ManipulatorSelector + * @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "Subscription concept" + */ +template +class dds::sub::TQuery: public virtual dds::core::Reference { +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TQuery, dds::core::Reference, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(TQuery) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_EXPLICIT(TQuery) + +public: + /** + * Iterator for the query expression parameters. + */ + typedef typename DELEGATE::iterator iterator; + + /** + * Iterator for the query expression parameters. + */ + typedef typename DELEGATE::const_iterator const_iterator; + +public: + /** + * Create a dds::sub::Query associated with an dds::sub::AnyDataReader. + * + * @param dr The AnyDataReader to associate with the Query. + * @param expression an @ref anchor_dds_sub_query_expression "SQL expression" + * @throw dds::core::Exception + */ + TQuery(const dds::sub::AnyDataReader& dr, const std::string& expression); + + /** + * Create a dds::sub::Query associated with an dds::sub::AnyDataReader. + * + * @param dr The AnyDataReader to associate with the Query. + * @param expression an @ref anchor_dds_sub_query_expression "SQL expression" + * @param params_begin Iterator pointing to the beginning of the parameters to set + * @param params_end Iterator pointing to the end of the parameters to set + * @throw dds::core::Exception + */ + template + TQuery(const dds::sub::AnyDataReader& dr, const std::string& expression, + const FWIterator& params_begin, const FWIterator& params_end); + + /** + * Create a dds::sub::Query associated with an dds::sub::AnyDataReader. + * + * @param dr The AnyDataReader to associate with the Query. + * @param expression an @ref anchor_dds_sub_query_expression "SQL expression" + * @param params Vector containing SQL expression parameters + * @throw dds::core::Exception + */ + TQuery(const dds::sub::AnyDataReader& dr, const std::string& expression, + const std::vector& params); + + /** + * Get expression. + * + * @return std::string The @ref anchor_dds_sub_query_expression "SQL expression". + * @throw dds::core::Exception + */ + const std::string& expression() const; + + /** + * Set new expression. + * + * @param expr an ref anchor_dds_sub_query_expression "SQL expression" + * @throw dds::core::Exception + */ + void expression(const std::string& expr); + + /** + * Provides the begin iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @return dds::sub::Query::const_iterator + * The begin iterator + * @throw dds::core::Exception + */ + const_iterator begin() const; + + /** + * The end iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @return dds::sub::Query::const_iterator + * The end iterator + * @throw dds::core::Exception + */ + const_iterator end() const; + + /** + * Provides the begin iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @return dds::sub::Query::iterator + * The begin iterator + * @throw dds::core::Exception + */ + iterator begin(); + + /** + * The end iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @return dds::sub::TQuery::iterator + * The end iterator + * @throw dds::core::Exception + */ + iterator end(); + + /** + * Sets the query parameters. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @param begin Iterator pointing to the beginning of the parameters to set + * @param end Iterator pointing to the end of the parameters to set + * @throw dds::core::Exception + */ + template + void parameters(const FWIterator& begin, const FWIterator end); + + /** + * Adds a parameter to the query. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @param param The parameter to add + * @throw dds::core::Exception + */ + void add_parameter(const std::string& param); + + /** + * Gets the number of parameters in the query. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @return uint32_t The number of parameters in the query + * @throw dds::core::Exception + */ + uint32_t parameters_length() const; + + /** + * This operation returns the DataReader associated with the Query. + * + * Note that there is exactly one DataReader associated with each Query. + * + * @return dds::sub::AnyDataReader The associated DataReader + * @throw dds::core::Exception + */ + const AnyDataReader& data_reader() const; +}; + +#endif /* DDS_CORE_TQUERY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/TRank.hpp b/unitree_SDK/include/ddscxx/dds/sub/TRank.hpp new file mode 100644 index 0000000..7fa3ed5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/TRank.hpp @@ -0,0 +1,134 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_SUB_TRANK_HPP_ +#define OMG_DDS_SUB_TRANK_HPP_ + +#include + +namespace dds +{ +namespace sub +{ +template +class TRank; +} +} + +/** + * @brief + * Class to hold sample Rank information and is part of dds::sub::SampleInfo. + * + * The sample_rank and generation_rank available in dds::sub::Rank are + * computed based solely on the actual samples in the ordered collection + * returned by read or take. + * - The sample_rank indicates the number of samples of the same instance + * that follow the current one in the collection. + * - The generation_rank indicates the difference + * in 'generations' between the sample (S) and the Most Recent Sample of the + * same instance that appears In the returned Collection (MRSIC). That is, it + * counts the number of times the instance transitioned from not-alive to + * alive in the time from the reception of the S to the reception of MRSIC. + * + * The generation_rank is computed using the formula:
      + * generation_rank = + * (MRSIC.disposed_generation_count + MRSIC.no_writers_generation_count) - + * (S.disposed_generation_count + S.no_writers_generation_count) + * + * The absolute_generation_rank indicates the + * difference in 'generations' between the sample (S) and the Most Recent + * Sample of the same instance that the middleware has received (MRS). That is, + * it counts the number of times the instance transitioned from not-alive to + * alive in the time from the reception of the S to the time when the read or + * take was called. + * + * The absolute_generation_rank is computed using the formula:
      + * absolute_generation_rank = + * (MRS.disposed_generation_count + MRS.no_writers_generation_count) - + * (S.disposed_generation_count + S.no_writers_generation_count) + * + * @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo" + */ +template +class dds::sub::TRank : public dds::core::Value +{ +public: + /** @cond + * Create an empty Rank. + * This constructor is required for containers. + * An application would normally not create a Rank itself. + * So, do not put the creation in the API documentation for clarity. + */ + TRank(); + + /** + * Create a Rank instance. + * An application would normally not create a Rank itself. + * So, do not put the creation in the API documentation for clarity. + */ + TRank(int32_t sample_rank, int32_t generation_rank, int32_t absolute_generation_rank); + /** @endcond */ + + /** + * Gets the absolute_generation_rank. + * + * The absolute_generation_rank indicates the + * difference in 'generations' between the sample (S) and the Most Recent + * Sample of the same instance that the middleware has received (MRS). That is, + * it counts the number of times the instance transitioned from not-alive to + * alive in the time from the reception of the S to the time when the read or + * take was called. + * + * The absolute_generation_rank is computed using the formula:
      + * absolute_generation_rank = + * (MRS.disposed_generation_count + MRS.no_writers_generation_count) - + * (S.disposed_generation_count + S.no_writers_generation_count) + * + * @return the absolute_generation_rank + */ + int32_t absolute_generation() const; + + /** + * Gets the generation_rank. + * + * The generation_rank indicates the difference + * in 'generations' between the sample (S) and the Most Recent Sample of the + * same instance that appears In the returned Collection (MRSIC). That is, it + * counts the number of times the instance transitioned from not-alive to + * alive in the time from the reception of the S to the reception of MRSIC. + * + * The generation_rank is computed using the formula:
      + * generation_rank = + * (MRSIC.disposed_generation_count + MRSIC.no_writers_generation_count) - + * (S.disposed_generation_count + S.no_writers_generation_count) + * + * @return the generation_rank + */ + inline int32_t generation() const; + + /** + * Gets the sample_rank. + * + * The sample_rank indicates the number of samples of the same instance + * that follow the current one in the collection. + * + * @return the sample_rank + */ + inline int32_t sample() const; +}; + +#endif /* OMG_DDS_SUB_TRANK_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/TSample.hpp b/unitree_SDK/include/ddscxx/dds/sub/TSample.hpp new file mode 100644 index 0000000..c1b99c1 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/TSample.hpp @@ -0,0 +1,124 @@ +#ifndef OMG_DDS_SUB_TSAMPLE_HPP_ +#define OMG_DDS_SUB_TSAMPLE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds +{ +namespace sub +{ +template class DELEGATE> +class Sample; +} +} + +/** + * @brief + * This class encapsulates the data and info meta-data associated with + * DDS samples. + * + * It is normally used with dds::sub::LoanedSamples: + * @code{.cpp} + * dds::sub::LoanedSamples samples = reader.read(); + * dds::sub::LoanedSamples::const_iterator it; + * for (it = samples.begin(); it != samples.end(); ++it) { + * const dds::sub::Sample& sample = *it; + * const Foo::Bar& data = sample.data(); + * const dds::sub::SampleInfo& info = sample.info(); + * // Use sample data and meta information. + * } + * @endcode + * Or more implicitly: + * @code{.cpp} + * dds::sub::LoanedSamples samples = reader.read(); + * dds::sub::LoanedSamples::const_iterator it; + * for (it = samples.begin(); it != samples.end(); ++it) { + * const Foo::Bar& data = it->data(); + * const dds::sub::SampleInfo& info = it->info(); + * // Use sample data and meta information. + * } + * @endcode + * + * @see for more information: @ref DCPS_Modules_Subscription_DataSample "DataSample" + * @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo" + * @see for more information: @ref DCPS_Modules_Subscription "Subscription" + */ +template class DELEGATE> +class dds::sub::Sample : public dds::core::Value< DELEGATE > +{ +public: + /** + * Convenience typedef for the type of the data sample. + */ + typedef T DataType; + +public: + /** + * Create a sample with invalid data. + */ + Sample(); + + /** + * Creates a Sample instance. + * + * @param data the data + * @param info the sample info + */ + Sample(const T& data, const SampleInfo& info); + + /** + * Copies a sample instance. + * + * @param other the sample instance to copy + */ + Sample(const Sample& other); + + /** + * Gets the data. + * + * @return the data + */ + const DataType& data() const; + + /** + * Sets the data. + * + * @param data the data + */ + void data(const DataType& data); + + /** + * Gets the info. + * + * @return the info + */ + const SampleInfo& info() const; + + /** + * Sets the info. + * + * @param info the info + */ + void info(const SampleInfo& info); +}; + +#endif /* OMG_DDS_SUB_TSAMPLE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/TSampleInfo.hpp b/unitree_SDK/include/ddscxx/dds/sub/TSampleInfo.hpp new file mode 100644 index 0000000..36e31eb --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/TSampleInfo.hpp @@ -0,0 +1,146 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_SUB_TSAMPLE_INFO_HPP_ +#define OMG_DDS_SUB_TSAMPLE_INFO_HPP_ + +#include +#include +#include +#include +#include +#include + +namespace dds +{ +namespace sub +{ +template +class TSampleInfo; +} +} + +/** + * @brief + * The SampleInfo contains information pertaining to the associated Data value. + * + * The SampleInfo contains information pertaining to the associated Data value: + * - The data state (dds::sub::status::DataState). + * - The sample_state of the Data value (i.e., if the sample has already been READ or NOT_READ by that same DataReader). + * - The view_state of the related instance (i.e., if the instance is NEW, or NOT_NEW for that DataReader). + * - The instance_state of the related instance (i.e., if the instance is ALIVE, NOT_ALIVE_DISPOSED, or NOT_ALIVE_NO_WRITERS). + * - The valid data flag. This flag indicates whether there is data associated with the sample. Some samples do not contain data indicating only a change on the instance_state of the corresponding instance. + * - The generation counts (dds::sub::GenerationCount) for the related instance at the time the sample was received. These counters indicate the number of times the instance had become ALIVE. + * - The disposed generation count + * - The no_writer generation count + * - The rank information (dds::sub::Rank). + * - The sample rank. This rank provides a preview of the samples that follow within the sequence returned by the read or take operations. + * - The generation rank. This rank provides a preview of the samples that follow within the sequence returned by the read or take operations. + * - The absolute_generation rank. This is the timestamp provided by the DataWriter at the time the sample was produced. + * - The source timestamp of the sample. This is the timestamp provided by the DataWriter at the time the sample was produced. + * - The InstanceHandle of the associated data Sample. + * - The InstanceHandle of the associated publication. + * + * @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo" + */ +template +class dds::sub::TSampleInfo : public dds::core::Value +{ + +public: + /** @cond + * Create an empty SampleInfo. + * This constructor is required for containers. + * An application would normally not create a SampleInfo itself. + * So, do not put the creation in the API documentation for clarity. + */ + TSampleInfo(); + /** @endcond */ + +public: + /** + * Gets the timestamp of the sample. + * + * This is the timestamp provided by the DataWriter at the time the sample was produced. + * + * @return the timestamp + */ + const dds::core::Time timestamp() const; + + /** + * Gets the DataState of the sample. + * + * The data state (dds::sub::status::DataState). + * - The sample_state of the Data value (i.e., if the sample has already been READ or NOT_READ by that same DataReader). + * - The view_state of the related instance (i.e., if the instance is NEW, or NOT_NEW for that DataReader). + * - The instance_state of the related instance (i.e., if the instance is ALIVE, NOT_ALIVE_DISPOSED, or NOT_ALIVE_NO_WRITERS). + * + * @return the DataState + */ + const dds::sub::status::DataState state() const; + + /** + * Gets the GenerationCount of the sample. + * + * The generation counts (dds::sub::GenerationCount) for the related instance at the time the sample was received. + * These counters indicate the number of times the instance had become ALIVE. + * - The disposed generation count + * - The no_writer generation count + * + * @return the GenerationCount + */ + dds::sub::GenerationCount generation_count() const; + + /** + * Gets the Rank of the sample. + * + * The rank information (dds::sub::Rank). + * - The sample rank. This rank provides a preview of the samples that follow within the sequence returned by the read or take operations. + * - The generation rank. This rank provides a preview of the samples that follow within the sequence returned by the read or take operations. + * - The absolute_generation rank. This is the timestamp provided by the DataWriter at the time the sample was produced. + * + * @return the Rank + */ + dds::sub::Rank rank() const; + + /** + * Gets the valid_data flag. + * + * This flag indicates whether there is data + * associated with the sample. Some samples do not contain data, indicating + * only a change on the instance_state of the corresponding instance. + * + * @return the valid_data flag + */ + bool valid() const; + + /** + * Gets the InstanceHandle of the associated data Sample. + * + * @return the InstanceHandle of the sample + */ + dds::core::InstanceHandle instance_handle() const; + + /** + * Gets the InstanceHandle of the associated publication. + * + * @return the publication_handle + */ + dds::core::InstanceHandle publication_handle() const; +}; + +#endif /* OMG_DDS_SUB_TSAMPLE_INFO_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/TSampleRef.hpp b/unitree_SDK/include/ddscxx/dds/sub/TSampleRef.hpp new file mode 100644 index 0000000..7d40951 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/TSampleRef.hpp @@ -0,0 +1,110 @@ +#ifndef OMG_DDS_SUB_TSAMPLEREF_HPP_ +#define OMG_DDS_SUB_TSAMPLEREF_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds +{ +namespace sub +{ +template class DELEGATE> +class SampleRef; +} +} + +/** + * @brief + * This class encapsulates a reference to the data and info meta-data + * associated with DDS samples. + * + * It is normally used with dds::sub::LoanedSamples: + * @code{.cpp} + * dds::sub::LoanedSamples samples = reader.read(); + * dds::sub::LoanedSamples::const_iterator it; + * for (it = samples.begin(); it != samples.end(); ++it) { + * const dds::sub::Sample& sample = *it; + * const Foo::Bar& data = sample.data(); + * const dds::sub::SampleInfo& info = sample.info(); + * // Use sample data and meta information. + * } + * @endcode + * Or more implicitly: + * @code{.cpp} + * dds::sub::LoanedSamples samples = reader.read(); + * dds::sub::LoanedSamples::const_iterator it; + * for (it = samples.begin(); it != samples.end(); ++it) { + * const Foo::Bar& data = it->data(); + * const dds::sub::SampleInfo& info = it->info(); + * // Use sample data and meta information. + * } + * @endcode + * + * @see for more information: @ref DCPS_Modules_Subscription_DataSample "DataSample" + * @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo" + * @see for more information: @ref DCPS_Modules_Subscription "Subscription" + */ +template class DELEGATE> +class dds::sub::SampleRef : public dds::core::Value< DELEGATE > +{ +public: + /** + * Convenience typedef for the type of the data sample. + */ + typedef T DataType; + +public: + /** + * Create a sample with invalid data. + */ + SampleRef(); + + /** + * Creates a Sample instance. + * + * @param data the data + * @param info the sample info + */ + SampleRef(const T& data, const SampleInfo& info); + + /** + * Copies a sample instance. + * + * @param other the sample instance to copy + */ + SampleRef(const SampleRef& other); + + /** + * Gets the data. + * + * @return the data + */ + const DataType& data() const; + + /** + * Gets the info. + * + * @return the info + */ + const SampleInfo& info() const; +}; + +#endif /* OMG_DDS_SUB_TSAMPLEREF_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/TSubscriber.hpp b/unitree_SDK/include/ddscxx/dds/sub/TSubscriber.hpp new file mode 100644 index 0000000..6004683 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/TSubscriber.hpp @@ -0,0 +1,290 @@ +#ifndef OMG_TDDS_SUB_SUBSCRIBER_HPP_ +#define OMG_TDDS_SUB_SUBSCRIBER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + +namespace dds +{ +namespace sub +{ +template +class TSubscriber; + +class SubscriberListener; +} +} + +/** + * @brief + * A Subscriber is the object responsible for the actual reception of the + * data resulting from its subscriptions. + * + * A Subscriber acts on the behalf of one or several DataReader objects + * that are related to it. When it receives data (from the other parts of + * the system), it builds the list of concerned DataReader objects, and then + * indicates to the application that data is available, through its listener + * or by enabling related conditions. The application can access the list of + * concerned DataReader objects through the operation get_datareaders and + * then access the data available through operations on the DataReader. + * + * @see for more information: @ref DCPS_Modules_Subscriber "Subscriber" + */ +template +class dds::sub::TSubscriber : public dds::core::TEntity +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TSubscriber, dds::core::TEntity, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(TSubscriber) + +public: + /** + * Local convenience typedef for dds::sub::SubscriberListener. + */ + typedef dds::sub::SubscriberListener Listener; + +public: + /** + * Create a new Subscriber. + * + * The Subscriber will be created with the QoS values specified on the last + * successful call to @link dds::domain::DomainParticipant::default_subscriber_qos(const ::dds::sub::qos::SubscriberQos& qos) + * dp.default_subscriber_qos(qos) @endlink or, if the call was never made, the + * @ref anchor_dds_sub_subscriber_qos_defaults "default" values. + * + * @param dp the domain participant + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + TSubscriber(const ::dds::domain::DomainParticipant& dp); + + /** + * Create a new Subscriber. + * + * The Subscriber will be created with the given QosPolicy settings and if + * applicable, attaches the optionally specified SubscriberListener to it. + * + * See @ref DCPS_Modules_Infrastructure_Listener "listener" for more information + * about listeners and possible status propagation to other entities. + * + * @param dp the domain participant to create the Subscriber with. + * @param qos a collection of QosPolicy settings for the new Subscriber. In case + * these settings are not self consistent, no Subscriber is created. + * @param listener the subscriber listener + * @param mask the mask of events notified to the listener + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::InconsistentPolicyError + * The parameter qos contains conflicting QosPolicy settings. + */ + TSubscriber(const ::dds::domain::DomainParticipant& dp, + const dds::sub::qos::SubscriberQos& qos, + dds::sub::SubscriberListener* listener = NULL, + const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none()); + +public: + /** + * This operation invokes the on_data_available operation on + * DataReaderListener objects which are attached to the contained DataReader + * entities having new, available data. + * + * The notify_datareaders operation ignores the bit mask value of individual + * DataReaderListener objects, even when the dds::core::status::StatusMask::data_available() + * has not been set on a DataReader that has new, available data. The + * on_data_available operation will still be invoked, when the + * dds::core::status::StatusMask::data_available() bit has not been set on a DataReader, + * but will not propagate to the DomainParticipantListener. + * + * When the DataReader has attached a NULL listener, the event will be consumed + * and will not propagate to the DomainParticipantListener. (Remember that a + * NULL listener is regarded as a listener that handles all its events as a NOOP). + * + * Look @ref DCPS_Modules_Infrastructure_Status "here" for Status change information.
      + * Look @ref DCPS_Modules_Infrastructure_Listener "here" for Listener information.
      + * + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void notify_datareaders(); + + /** + * Register a listener with the Subscriber. + * + * The notifications received by the listener depend on the + * status mask with which it was registered. + * + * Listener un-registration is performed by setting the listener to NULL. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @param listener the listener + * @param event_mask the mask defining the events for which the listener + * will be notified. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * A status was selected that cannot be supported because + * the infrastructure does not maintain the required connectivity information. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void listener(Listener* listener, + const dds::core::status::StatusMask& event_mask); + + /** + * Get the listener of this Subscriber. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @return the listener + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + */ + Listener* listener() const; + + /** + * Gets the SubscriberQos setting for this instance. + * + * @return the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + const dds::sub::qos::SubscriberQos& qos() const; + + /** + * Sets the SubscriberQos setting for this instance. + * + * @param sqos the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void qos(const dds::sub::qos::SubscriberQos& sqos); + + /** + * Gets the default DataReaderQos of the Subscriber. + * + * This operation gets an object with the default DataReader QosPolicy settings of + * the Subscriber (that is the DataReaderQos) which is used for newly + * created DataReader objects, in case no QoS was provided during the creation. + * + * The values retrieved by this operation match the set of values specified on the last + * successful call to + * dds::sub::Subscriber::default_datareader_qos(const dds::sub::qos::DataReaderQos& qos), + * or, if the call was never made, the @ref anchor_dds_sub_datareader_qos_defaults "default" values. + * + * @return the default DataReaderQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::sub::qos::DataReaderQos default_datareader_qos() const; + + /** + * Sets the default DataReaderQos of the Subscriber. + * + * This operation sets the default SubscriberQos of the Subscriber which + * is used for newly created Subscriber objects, when no QoS is provided. + * + * This operation checks if the DataReaderQos is self consistent. If it is not, the + * operation has no effect and throws dds::core::InconsistentPolicyError. + * + * The values set by this operation are returned by dds::sub::Subscriber::default_datareader_qos(). + * + * @param qos the default DataReaderQos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * One or more of the selected QosPolicy values are + * currently not supported by OpenSplice. + * @throws dds::core::InconsistentPolicyError + * The parameter qos contains conflicting QosPolicy settings, + * e.g. a history depth that is higher than the specified resource limits. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + TSubscriber& default_datareader_qos(const dds::sub::qos::DataReaderQos& qos); + + /** + * Return the DomainParticipant that owns this Subscriber. + * + * @return the DomainParticipant + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + */ + const dds::domain::DomainParticipant& participant() const; + + /** @copydoc dds::sub::Subscriber::qos(const dds::sub::qos::SubscriberQos& qos) */ + TSubscriber& operator << (const dds::sub::qos::SubscriberQos& qos); + + /** @copydoc dds::sub::Subscriber::qos() */ + const TSubscriber& operator >> (dds::sub::qos::SubscriberQos& qos) const; +}; + + +#endif /* OMG_TDDS_SUB_SUBSCRIBER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/cond/QueryCondition.hpp b/unitree_SDK/include/ddscxx/dds/sub/cond/QueryCondition.hpp new file mode 100644 index 0000000..8c4eab9 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/cond/QueryCondition.hpp @@ -0,0 +1,42 @@ +#ifndef OMG_DDS_SUB_COND_QUERY_CONDITION_HPP_ +#define OMG_DDS_SUB_COND_QUERY_CONDITION_HPP_ + + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + +#ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT + +namespace dds +{ +namespace sub +{ +namespace cond +{ +typedef dds::sub::cond::detail::QueryCondition QueryCondition; +} +} +} + +#endif // OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT + +#endif /* OMG_DDS_SUB_COND_QUERY_CONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/cond/ReadCondition.hpp b/unitree_SDK/include/ddscxx/dds/sub/cond/ReadCondition.hpp new file mode 100644 index 0000000..613f684 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/cond/ReadCondition.hpp @@ -0,0 +1,37 @@ +#ifndef OMG_DDS_SUB_COND_READ_CONDITION_HPP_ +#define OMG_DDS_SUB_COND_READ_CONDITION_HPP_ + + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds +{ +namespace sub +{ +namespace cond +{ +typedef dds::sub::cond::detail::ReadCondition ReadCondition; +} +} +} + +#endif /* OMG_DDS_SUB_COND_READ_CONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/cond/TQueryCondition.hpp b/unitree_SDK/include/ddscxx/dds/sub/cond/TQueryCondition.hpp new file mode 100644 index 0000000..396f606 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/cond/TQueryCondition.hpp @@ -0,0 +1,301 @@ +#ifndef OMG_DDS_SUB_TQUERY_CONDITION_HPP_ +#define OMG_DDS_SUB_TQUERY_CONDITION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + + +#ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT + +namespace dds +{ +namespace sub +{ +namespace cond +{ +template +class TQueryCondition; +} +} +} + +/** + * @brief + * QueryCondition objects are specialized ReadCondition objects that allow + * the application to also specify a filter on the locally available data. + * + * The query (query_expression) is similar to an SQL WHERE clause can be + * parameterized by arguments. See dds::sub::Query for more query information. + * + * See the @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" for some examples.
      + * Although the WaitSet examples use the StatusCondition, the basic usage of this Condition + * with a WaitSet is the same. + * + * @see dds::sub::Query + * @see dds::core::cond::Condition + * @see dds::sub::cond::ReadCondition + * @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept" + * @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "Subscription concept" + * @see for more information: @ref anchor_dds_sub_query_expression "SQL expression info" + * @see for more information: @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" + */ +template +class dds::sub::cond::TQueryCondition : + public dds::sub::cond::TReadCondition, + public dds::sub::TQuery +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TQueryCondition, dds::sub::cond::TReadCondition, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(TQueryCondition) + +public: + // Random access iterators + /** + * Iterator for the query expression parameters. + */ + typedef typename DELEGATE::iterator iterator; + + /** + * Iterator for the query expression parameters. + */ + typedef typename DELEGATE::const_iterator const_iterator; + +public: + /** + * Creates a QueryCondition instance. + * + * This will create an QueryCondition that is associated with a dds::sub::Query, + * which is again associated with a dds::sub::DataReader. + * + * + * @param query The query to filter on the locally available data. + * @param status A mask, which selects only those samples with the desired + * sample/view/instance states. + * @throw dds::core::Exception + */ + TQueryCondition(const dds::sub::Query& query, + const dds::sub::status::DataState& status); + + /** + * Creates a QueryCondition instance. + * + * This will create an QueryCondition that is associated with a dds::sub::Query, + * which is again associated with a dds::sub::DataReader. + * + * The supplied functor will be called when this QueryCondition is triggered + * and either the inherited dds::core::cond::Condition::dispatch() is called or the + * dds::core::cond::WaitSet::dispatch() on the WaitSet to which this QueryCondition is + * attached to. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info"
      + * See @ref anchor_dds_sub_cond_readcondition_state_mask "State mask info" in ReadCondition. + * + * @param query The query to filter on the locally available data. + * @param status A mask, which selects only those samples with the desired + * sample/view/instance states. + * @param functor The functor to be called when the QueryCondition triggers. + * @throw dds::core::Exception + */ + template + TQueryCondition(const dds::sub::Query& query, + const dds::sub::status::DataState& status, FUN functor); + + /** + * Creates a QueryCondition instance. + * + * This will create an QueryCondition that is associated with an dds::sub::AnyDataReader, + * with parameters that essentially represent a query. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info"
      + * See @ref anchor_dds_sub_cond_readcondition_state_mask "State mask info" in ReadCondition. + * + * @param dr Query associated DataReader. + * @param expression for more information: @ref anchor_dds_sub_query_expression "Query expression" + * @param params for more information: @ref anchor_dds_sub_query_expression "Query expression parameters" + * @param status A mask, which selects only those samples with the desired + * sample/view/instance states. + * @throw dds::core::Exception + */ + TQueryCondition(const dds::sub::AnyDataReader& dr, + const std::string& expression, + const std::vector& params, + const dds::sub::status::DataState& status); + + /** + * Creates a QueryCondition instance. + * + * This will create an QueryCondition that is associated with an dds::sub::AnyDataReader, + * with parameters that essentially represent a query. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info"
      + * See @ref anchor_dds_sub_cond_readcondition_state_mask "State mask info" in ReadCondition. + * + * @param dr Query associated DataReader. + * @param status A mask, which selects only those samples with the desired + * sample/view/instance states. + * @throw dds::core::Exception + */ + TQueryCondition(const dds::sub::AnyDataReader& dr, + const dds::sub::status::DataState& status); + /** + * Creates a QueryCondition instance. + * + * This will create an QueryCondition that is associated with an dds::sub::AnyDataReader, + * with parameters that essentially represent a query. + * + * The supplied functor will be called when this QueryCondition is triggered + * and either the inherited dds::core::cond::Condition::dispatch() is called or the + * dds::core::cond::WaitSet::dispatch() on the WaitSet to which this QueryCondition is + * attached to. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info"
      + * See @ref anchor_dds_sub_cond_readcondition_state_mask "State mask info" in ReadCondition. + * + * @param dr Query associated DataReader. + * @param expression for more information: @ref anchor_dds_sub_query_expression "Query expression" + * @param params for more information: @ref anchor_dds_sub_query_expression "Query expression parameters" + * @param status A mask, which selects only those samples with the desired + * sample/view/instance states. + * @throw dds::core::Exception + */ + template + TQueryCondition(const dds::sub::AnyDataReader& dr, + const std::string& expression, + const std::vector& params, + const dds::sub::status::DataState& status, + FUN functor); + +public: + /** + * Set the Query expression. + * + * @param expr for more information: @ref anchor_dds_sub_query_expression "SQL expression" + * @throw dds::core::Exception + */ + void expression(const std::string& expr); + + /** + * Get the Query expression. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @return std::string The query expression + * @throw dds::core::Exception + */ + const std::string& expression(); + + /** + * Provides the beginning iterator of the query parameter list. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @return dds::sub::cond::TQueryCondition::const_iterator + * The beginning iterator + * @throw dds::core::Exception + */ + const_iterator begin() const; + + /** + * Provides the end iterator of the query parameter list. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @return dds::sub::cond::TQueryCondition::const_iterator + * The end iterator + * @throw dds::core::Exception + */ + const_iterator end() const; + + /** + * Provides the beginning iterator of the query parameter list. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @return dds::sub::cond::TQueryCondition::iterator + * The beginning iterator + * @throw dds::core::Exception + */ + iterator begin(); + + /** + * Provides the end iterator of the query parameter list. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @return dds::sub::cond::TQueryCondition::iterator + * The end iterator + * @throw dds::core::Exception + */ + iterator end(); + + /** + * Sets the query parameters. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @param begin Iterator pointing to the beginning of the parameters to set + * @param end Iterator pointing to the end of the parameters to set + * @throw dds::core::Exception + */ + template + void parameters(const FWIterator& begin, const FWIterator end); + + /** + * Adds a parameter to the query. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @param param The parameter to add + * @throw dds::core::Exception + */ + void add_parameter(const std::string& param); + + /** + * Gets the number of parameters in the query. + * + * See @ref anchor_dds_sub_query_expression "SQL expression info" + * + * @return uint32_t The number of parameters in the query + * @throw dds::core::Exception + */ + uint32_t parameters_length() const; + + /** + * This operation returns the DataReader associated with the QueryCondition. + * + * Note that there is exactly one DataReader associated with each QueryCondition. + * + * @cond + * Note also that since QueryCondition overrides this call since it inherits + * two different implementations from its two different parents. Not offering + * an implementation here would results in an ambiguity. + * @endcond + * + * @return dds::sub::AnyDataReader The associated DataReader + * @throw dds::core::Exception + */ + const dds::sub::AnyDataReader& data_reader() const; +}; + +#endif // OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT + +#endif /* OMG_DDS_SUB_TQUERY_CONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/cond/TReadCondition.hpp b/unitree_SDK/include/ddscxx/dds/sub/cond/TReadCondition.hpp new file mode 100644 index 0000000..e6810c7 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/cond/TReadCondition.hpp @@ -0,0 +1,143 @@ +#ifndef OMG_DDS_SUB_TCOND_READ_CONDITION_HPP_ +#define OMG_DDS_SUB_TCOND_READ_CONDITION_HPP_ + + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + +namespace dds +{ +namespace sub +{ +namespace cond +{ +template +class TReadCondition; +} +} +} + +/** + * @brief + * ReadCondition objects are conditions specifically dedicated + * to read operations and attached to one DataReader. + * + * ReadCondition objects allow an application to specify the data samples + * it is interested in (by specifying the desired sample states, view states, + * and instance states). (See the parameter definitions for DataReader's + * read/take operations.) This allows the middle-ware to enable the condition + * only when suitable information is available. They are to be used in + * conjunction with a WaitSet as normal conditions. More than one + * ReadCondition may be attached to the same DataReader. + * + * See the @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" for some examples.
      + * Although the WaitSet examples use the StatusCondition, the basic usage of this Condition + * with a WaitSet is the same. + * + * @see dds::core::cond::Condition + * @see for more information: @ref DCPS_Modules_Infrastructure_Status "Status concept" + * @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept" + * @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "Subscription concept" + * @see for more information: @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" + */ +template +class dds::sub::cond::TReadCondition : public dds::core::cond::TCondition +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TReadCondition, dds::core::cond::TCondition, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(TReadCondition) + +public: + /** + * Create a dds::sub::cond::ReadCondition associated with a DataReader. + * + * The ReadCondition can then be added to a dds::core::cond::WaitSet so that the + * application can wait for specific status changes that affect the Entity. + * + * @anchor anchor_dds_sub_cond_readcondition_state_mask + * State Masks.
      + * The result of the ReadCondition depends on the selection of samples determined by + * three masks: + * - DataState::sample_state() is the mask, which selects only those samples with the desired + * sample states SampleState::read(), SampleState::not_read() or SampleState::any(). + * - DataState::view_state() is the mask, which selects only those samples with the desired + * view states ViewState::new_view(), ViewState::not_new_view() or ViewState::any(). + * - DataState::instance_state() is the mask, which selects only those samples with the desired + * view states InstanceState::alive(), InstanceState::not_alive_disposed(), + * InstanceState::not_alive_no_writers(), InstanceState::not_alive_mask() or InstanceState::any(). + * See also @ref DCPS_Modules_Infrastructure_Status "Status Concept". + * + * @param dr The DataReader to associate with the ReadCondition. + * @param status A mask, which selects only those samples with the desired + * sample/view/instance states. + * @throw dds::core::Exception + */ + TReadCondition(const dds::sub::AnyDataReader& dr, const dds::sub::status::DataState& status); + + /** + * Create a dds::sub::cond::ReadCondition associated with a DataReader. + * + * The ReadCondition can then be added to a dds::core::cond::WaitSet so that the + * application can wait for specific status changes that affect the Entity. + * + * The supplied functor will be called when this ReadCondition is triggered + * and either the inherited dds::core::cond::Condition::dispatch() is called or the + * dds::core::cond::WaitSet::dispatch() on the WaitSet to which this ReadCondition is + * attached to. + * + * See @ref anchor_dds_sub_cond_readcondition_state_mask "State mask info". + * + * @param dr The DataReader to associate with the ReadCondition. + * @param status A mask, which selects only those samples with the desired + * sample/view/instance states. + * @param functor The functor to be called when the ReadCondition triggers. + * @throw dds::core::Exception + */ + template + TReadCondition(const dds::sub::AnyDataReader& dr, const dds::sub::status::DataState& status, FUN functor); + +public: + /** + * This operation returns the set of data-states that are taken into + * account to determine the trigger_value of the ReadCondition. + * + * These are data-states specified when the ReadCondition was created. + * + * @return dds::sub::status::DataState The data state. + * @throw dds::core::Exception + */ + const dds::sub::status::DataState state_filter() const; + + /** + * This operation returns the DataReader associated with the ReadCondition. + * + * Note that there is exactly one DataReader associated with each ReadCondition. + * + * @return dds::sub::AnyDataReader The associated DataReader + * @throw dds::core::Exception + */ + const dds::sub::AnyDataReader& data_reader() const; + +}; + + +#endif /* OMG_DDS_SUB_TCOND_READ_CONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/cond/detail/QueryCondition.hpp b/unitree_SDK/include/ddscxx/dds/sub/cond/detail/QueryCondition.hpp new file mode 100644 index 0000000..26d3582 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/cond/detail/QueryCondition.hpp @@ -0,0 +1,57 @@ +#ifndef OMG_DDS_SUB_DETAIL_QUERY_CONDITION_HPP_ +#define OMG_DDS_SUB_DETAIL_QUERY_CONDITION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +namespace cond +{ +class QueryConditionDelegate; +} +} +} +} +} + +namespace dds +{ +namespace sub +{ +namespace cond +{ + +template +class TQueryCondition; + +namespace detail +{ +typedef dds::sub::cond::TQueryCondition QueryCondition; +} +} +} +} + +#endif /* OMG_DDS_SUB_DETAIL_QUERY_CONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/cond/detail/ReadCondition.hpp b/unitree_SDK/include/ddscxx/dds/sub/cond/detail/ReadCondition.hpp new file mode 100644 index 0000000..d3c2d28 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/cond/detail/ReadCondition.hpp @@ -0,0 +1,50 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_SUB_DETAIL_READ_CONDITION_HPP_ +#define OMG_DDS_SUB_DETAIL_READ_CONDITION_HPP_ + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +namespace cond +{ +class ReadConditionDelegate; +} +} +} +} +} + +namespace dds +{ +namespace sub +{ +namespace cond +{ + +template +class TReadCondition; + +namespace detail +{ +typedef dds::sub::cond::TReadCondition ReadCondition; +} +} +} +} + +#endif /* OMG_DDS_SUB_DETAIL_READ_CONDITION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/cond/detail/TQueryConditionImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/cond/detail/TQueryConditionImpl.hpp new file mode 100644 index 0000000..e4a6f59 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/cond/detail/TQueryConditionImpl.hpp @@ -0,0 +1,202 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_COND_TQUERYCONDITION_IMPL_HPP_ +#define CYCLONEDDS_DDS_SUB_COND_TQUERYCONDITION_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include + +// Implementation + +namespace dds +{ +namespace sub +{ +namespace cond +{ + +template +TQueryCondition::TQueryCondition( + const dds::sub::Query& query, + const dds::sub::status::DataState& status) +{ + this->set_ref(new DELEGATE(query.data_reader(), + query.expression(), query.delegate()->parameters(), status)); + this->delegate()->init(this->impl_); +} + +template +template +TQueryCondition::TQueryCondition( + const dds::sub::Query& query, + const dds::sub::status::DataState& status, FUN functor) +{ + this->set_ref(new DELEGATE(query.data_reader(), + query.expression(), query.delegate()->parameters(), status)); + this->delegate()->set_handler(functor); + this->delegate()->init(this->impl_); +} + +template +TQueryCondition::TQueryCondition( + const dds::sub::AnyDataReader& dr, + const std::string& expression, + const std::vector& params, + const dds::sub::status::DataState& status) +{ + this->set_ref(new DELEGATE(dr, expression, params, status)); + this->delegate()->init(this->impl_); +} + +template +TQueryCondition::TQueryCondition( + const dds::sub::AnyDataReader& dr, + const dds::sub::status::DataState& status) +{ + this->set_ref(new DELEGATE(dr, status)); + this->delegate()->init(this->impl_); +} + +template +template +TQueryCondition::TQueryCondition( + const dds::sub::AnyDataReader& dr, + const std::string& expression, + const std::vector& params, + const dds::sub::status::DataState& status, + FUN functor) +{ + this->set_ref(new DELEGATE(dr, expression, params, status)); + this->delegate()->set_handler(functor); + this->delegate()->init(this->impl_); +} + +template +template +void TQueryCondition::parameters(const FWIterator& begin, const FWIterator end) +{ + std::vector params(begin, end); + this->delegate()->parameters(params); +} + +template +void TQueryCondition::expression( + const std::string& expr) +{ + this->delegate()->expression(expr); +} + +template +const std::string& TQueryCondition::expression() +{ + return this->delegate()->expression(); +} + +template +typename TQueryCondition::const_iterator TQueryCondition::begin() const +{ + return this->delegate()->begin(); +} + +template +typename TQueryCondition::const_iterator TQueryCondition::end() const +{ + return this->delegate()->end(); +} + +template +typename TQueryCondition::iterator TQueryCondition::begin() +{ + return this->delegate()->begin(); +} + +template +typename TQueryCondition::iterator TQueryCondition::end() +{ + return this->delegate()->end(); +} + +template +void TQueryCondition::add_parameter( + const std::string& param) +{ + this->delegate()->add_parameter(param); +} + +template +uint32_t TQueryCondition::parameters_length() const +{ + return this->delegate()->parameters_length(); +} + +template +const AnyDataReader& TQueryCondition::data_reader() const +{ + return this->delegate()->data_reader(); +} + +} +} + +namespace core +{ +namespace cond +{ +template +TCondition::TCondition(const dds::sub::cond::TQueryCondition& h) +{ + if (h.is_nil()) { + /* We got a null object and are not really able to do a typecheck here. */ + /* So, just set a null object. */ + *this = dds::core::null; + } else { + this->::dds::core::Reference::impl_ = ::std::dynamic_pointer_cast(h.delegate()); + if (h.delegate() != this->::dds::core::Reference::impl_) { + throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name()); + } + } +} + +template +TCondition& +TCondition::operator=(const dds::sub::cond::TQueryCondition& rhs) +{ + if (this != static_cast(&rhs)) { + if (rhs.is_nil()) { + /* We got a null object and are not really able to do a typecheck here. */ + /* So, just set a null object. */ + *this = dds::core::null; + } else { + TCondition other(rhs); + /* Dont have to copy when the delegate is the same. */ + if (other.delegate() != this->::dds::core::Reference::impl_) { + *this = other; + } + } + } + return *this; +} + + +} +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_SUB_COND_TQUERYCONDITION_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/cond/detail/TReadConditionImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/cond/detail/TReadConditionImpl.hpp new file mode 100644 index 0000000..c3ce7ad --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/cond/detail/TReadConditionImpl.hpp @@ -0,0 +1,113 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_CORE_COND_TREADCONDITION_IMPL_HPP_ +#define CYCLONEDDS_DDS_CORE_COND_TREADCONDITION_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include + +// Implementation + +namespace dds +{ +namespace sub +{ +namespace cond +{ + +template +TReadCondition::TReadCondition( + const dds::sub::AnyDataReader& dr, + const dds::sub::status::DataState& status) +{ + this->set_ref(new DELEGATE(dr, status)); + this->delegate()->init(this->impl_); +} + +template +template +TReadCondition::TReadCondition( + const dds::sub::AnyDataReader& dr, + const dds::sub::status::DataState& status, + FUN functor) +{ + this->set_ref(new DELEGATE(dr, status)); + this->delegate()->init(this->impl_); + this->delegate()->set_handler(functor); +} + +template +const dds::sub::status::DataState TReadCondition::state_filter() const +{ + return this->delegate()->state_filter(); +} + +template +const AnyDataReader& TReadCondition::data_reader() const +{ + return this->delegate()->data_reader(); +} + +} +} +namespace core +{ +namespace cond +{ +template +TCondition::TCondition(const dds::sub::cond::TReadCondition& h) +{ + if (h.is_nil()) { + /* We got a null object and are not really able to do a typecheck here. */ + /* So, just set a null object. */ + *this = dds::core::null; + } else { + this->::dds::core::Reference::impl_ = ::std::dynamic_pointer_cast(h.delegate()); + if (h.delegate() != this->::dds::core::Reference::impl_) { + throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name()); + } + } +} + +template +TCondition& +TCondition::operator=(const dds::sub::cond::TReadCondition& rhs) +{ + const TCondition &t = rhs; + if (this != &t) { + if (rhs.is_nil()) { + /* We got a null object and are not really able to do a typecheck here. */ + /* So, just set a null object. */ + *this = dds::core::null; + } else { + TCondition other(rhs); + /* Dont have to copy when the delegate is the same. */ + if (other.delegate() != this->::dds::core::Reference::impl_) { + *this = other; + } + } + } + return *this; +} +} +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_CORE_COND_TREADCONDITION_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/ddssub.hpp b/unitree_SDK/include/ddscxx/dds/sub/ddssub.hpp new file mode 100644 index 0000000..335639c --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/ddssub.hpp @@ -0,0 +1,129 @@ +#ifndef OMG_DDS_SUB_PACKAGE_INCLUDE_HPP_ +#define OMG_DDS_SUB_PACKAGE_INCLUDE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +/* Depends on: + * + * + * + * + */ +#include + +///////////////////////////////////////////////////////////////////////////// +// -- Status Includes +#include + + +///////////////////////////////////////////////////////////////////////////// +// -- QoS Includes +#include +#include + +///////////////////////////////////////////////////////////////////////////// +// -- Sub Includes + +#include +#include + +/* Depends on: + * Forward declaration of AnyDataReader + */ +#include + + +/* + * Depends on: + * + * + */ + +#include + +#include +#include + +/* Depends on: + * + * + */ +#include + + +/* Depends on: + * + */ +#include + +/* Depends on: + * + * + */ +#include + + +/* Depends on: + * + */ +#include + +/* Depends on: + * + * + */ +#include + +///////////////////////////////////////////////////////////////////////////// +// -- Condition Includes +/* Depends on: + * + */ +#include +#include + +/* Depends on: + * + * + * + */ +#include + +/* Depends on: + * + * + */ +#include +#include + +// +// Pretty Print Utilities +// +// #if (OMG_DDS_HAS_PRETTY_PRINT_COUT == 1) +std::ostream& operator << (std::ostream& os, const dds::sub::status::DataState& s); +std::ostream& operator << (std::ostream& os, const dds::sub::Rank& r); +std::ostream& operator << (std::ostream& os, const dds::sub::SampleInfo& si); + +#include + +// #endif + +#endif /* OMG_DDS_SUB_PACKAGE_INCLUDE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/AnyDataReader.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/AnyDataReader.hpp new file mode 100644 index 0000000..165166b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/AnyDataReader.hpp @@ -0,0 +1,22 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_DETAIL_ANYDATAREADER_HPP_ +#define CYCLONEDDS_DDS_SUB_DETAIL_ANYDATAREADER_HPP_ + +#include +#include + +namespace dds { namespace sub { namespace detail { + typedef dds::sub::TAnyDataReader AnyDataReader; +} } } + +#endif /* CYCLONEDDS_DDS_SUB_DETAIL_ANYDATAREADER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/CoherentAccess.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/CoherentAccess.hpp new file mode 100644 index 0000000..242cd31 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/CoherentAccess.hpp @@ -0,0 +1,22 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_SUB_DETAIL_COHERENT_ACCESS_HPP_ +#define OMG_DDS_SUB_DETAIL_COHERENT_ACCESS_HPP_ + +#include +#include + +namespace dds { namespace sub { namespace detail { + typedef ::dds::sub::TCoherentAccess CoherentAccess; +} } } + +#endif /* OMG_DDS_SUB_DETAIL_COHERENT_ACCESS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/DataReader.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/DataReader.hpp new file mode 100644 index 0000000..41a8183 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/DataReader.hpp @@ -0,0 +1,234 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_SUB_DETAIL_DATA_READER_HPP_ +#define OMG_DDS_SUB_DETAIL_DATA_READER_HPP_ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +/*************************************************************************** + * + * dds/sub/detail/DataReader<> DELEGATE declaration. + * Implementation can be found in dds/sub/detail/TDataReaderImpl.hpp + * + ***************************************************************************/ +template +class dds::sub::detail::DataReader : public ::org::eclipse::cyclonedds::sub::AnyDataReaderDelegate +{ +public: + + typedef typename ::dds::core::smart_ptr_traits< DataReader >::ref_type ref_type; + typedef typename ::dds::core::smart_ptr_traits< DataReader >::weak_ref_type weak_ref_type; + + DataReader(const dds::sub::Subscriber& sub, + const dds::topic::Topic& topic, + const dds::sub::qos::DataReaderQos& qos, + dds::sub::DataReaderListener* listener = NULL, + const dds::core::status::StatusMask& mask = ::dds::core::status::StatusMask::none()); + + DataReader(const dds::sub::Subscriber& sub, + const dds::topic::ContentFilteredTopic& topic, + const dds::sub::qos::DataReaderQos& qos, + dds::sub::DataReaderListener* listener = NULL, + const dds::core::status::StatusMask& mask = ::dds::core::status::StatusMask::none()); + + void common_constructor(dds::sub::DataReaderListener* listener, + const dds::core::status::StatusMask& mask); + + virtual ~DataReader(); + + void copy_samples( + dds::sub::detail::SamplesHolder& samples, + void**& c_sample_pointers, + dds_sample_info_t*& c_sample_infos, + int num_read); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + dds::sub::status::DataState default_filter_state(); + void default_filter_state(const dds::sub::status::DataState& state); + + bool is_loan_supported(); + + dds::sub::LoanedSamples read_cdr(); + dds::sub::LoanedSamples take_cdr(); + + dds::sub::LoanedSamples read(); + dds::sub::LoanedSamples take(); + + template + uint32_t read(SamplesFWIterator samples, uint32_t max_samples); + template + uint32_t take(SamplesFWIterator samples, uint32_t max_samples); + + template + uint32_t read(SamplesBIIterator samples); + template + uint32_t take(SamplesBIIterator samples); + + dds::topic::TopicInstance key_value(const dds::core::InstanceHandle& h); + T& key_value(T& key, const dds::core::InstanceHandle& h); + + const dds::core::InstanceHandle lookup_instance(const T& key) const; + + virtual const dds::sub::Subscriber& subscriber() const; + + void close(); + + dds::sub::DataReaderListener* listener(); + void listener(dds::sub::DataReaderListener* l, + const dds::core::status::StatusMask& event_mask); + + dds::sub::DataReader wrapper(); + + void on_requested_deadline_missed(dds_entity_t, + org::eclipse::cyclonedds::core::RequestedDeadlineMissedStatusDelegate &); + + void on_requested_incompatible_qos(dds_entity_t, + org::eclipse::cyclonedds::core::RequestedIncompatibleQosStatusDelegate &); + + void on_sample_rejected(dds_entity_t, + org::eclipse::cyclonedds::core::SampleRejectedStatusDelegate &); + + void on_liveliness_changed(dds_entity_t, + org::eclipse::cyclonedds::core::LivelinessChangedStatusDelegate &); + + void on_data_available(dds_entity_t); + + void on_subscription_matched(dds_entity_t, + org::eclipse::cyclonedds::core::SubscriptionMatchedStatusDelegate &); + + void on_sample_lost(dds_entity_t, + org::eclipse::cyclonedds::core::SampleLostStatusDelegate &); + +private: + dds::sub::Subscriber sub_; + dds::sub::status::DataState status_filter_; + + +//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +private: + enum SelectMode { + SELECT_MODE_READ, + SELECT_MODE_READ_INSTANCE, + SELECT_MODE_READ_NEXT_INSTANCE, + SELECT_MODE_READ_WITH_CONDITION, + SELECT_MODE_READ_INSTANCE_WITH_CONDITION, + SELECT_MODE_READ_NEXT_INSTANCE_WITH_CONDITION + }; + + +public: + + class Selector + { + public: + Selector(typename DataReader::ref_type dr); + + Selector& instance(const dds::core::InstanceHandle& h); + Selector& next_instance(const dds::core::InstanceHandle& h); + Selector& filter_state(const dds::sub::status::DataState& s); + Selector& max_samples(uint32_t n); + Selector& filter_content(const dds::sub::Query& query); + + dds::sub::LoanedSamples read(); + dds::sub::LoanedSamples take(); + + // --- Forward Iterators: --- // + template + uint32_t read(SamplesFWIterator sfit, uint32_t max_samples); + template + uint32_t take(SamplesFWIterator sfit, uint32_t max_samples); + + // --- Back-Inserting Iterators: --- // + template + uint32_t read(SamplesBIIterator sbit); + template + uint32_t take(SamplesBIIterator sbit); + + SelectMode get_mode() const; + + private: + friend class DataReader; + SelectMode mode; + typename DataReader::ref_type reader; + dds::sub::status::DataState state_filter_; + bool state_filter_is_set_; + dds::core::InstanceHandle handle; + uint32_t max_samples_; + dds::sub::Query query_; + }; + + + class ManipulatorSelector: public Selector + { + public: + //ManipulatorSelector(DataReader* dr); + ManipulatorSelector(typename DataReader::ref_type dr); + + bool read_mode(); + void read_mode(bool b); + + ManipulatorSelector& + operator >>(dds::sub::LoanedSamples& samples); + + private: + bool read_mode_; + }; + + +private: + // ============================================================== + // == Selector Read/Take API + + dds::sub::LoanedSamples read(const Selector& selector); + + dds::sub::LoanedSamples take(const Selector& selector); + + // --- Forward Iterators: --- // + template + uint32_t read(SamplesFWIterator samples, + uint32_t max_samples, const Selector& selector); + + template + uint32_t take(SamplesFWIterator samples, + uint32_t max_samples, const Selector& selector); + + // --- Back-Inserting Iterators: --- // + template + uint32_t read(SamplesBIIterator samples, const Selector& selector); + + template + uint32_t take(SamplesBIIterator samples, const Selector& selector); + + private: + T typed_sample_; + +}; + + +#endif /* OMG_TDDS_SUB_DETAIL_DATA_READER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/GenerationCount.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/GenerationCount.hpp new file mode 100644 index 0000000..dc14fdb --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/GenerationCount.hpp @@ -0,0 +1,26 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_SUB_DETAIL_GENERATION_COUNT_HPP_ +#define OMG_DDS_SUB_DETAIL_GENERATION_COUNT_HPP_ + +#include +#include + +namespace dds { + namespace sub { + namespace detail { + typedef dds::sub::TGenerationCount< org::eclipse::cyclonedds::sub::GenerationCountImpl > GenerationCount; + } + } +} + +#endif /* OMG_DDS_SUB_DETAIL_GENERATION_COUNT_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/LoanedSamples.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/LoanedSamples.hpp new file mode 100644 index 0000000..b2c2eb1 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/LoanedSamples.hpp @@ -0,0 +1,152 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_SUB_DETAIL_LOANED_SAMPLES_IMPL_HPP_ +#define OMG_SUB_DETAIL_LOANED_SAMPLES_IMPL_HPP_ + +namespace dds +{ +namespace sub +{ +namespace detail +{ + +template +class LoanedSamples +{ +public: + + typedef std::vector< dds::sub::SampleRef > LoanedSamplesContainer; + typedef typename std::vector< dds::sub::SampleRef >::iterator iterator; + typedef typename std::vector< dds::sub::SampleRef >::const_iterator const_iterator; + +public: + LoanedSamples() { } + + ~LoanedSamples() + { + + } + +public: + + iterator mbegin() + { + return samples_.begin(); + } + + const_iterator begin() const + { + return samples_.begin(); + } + + const_iterator end() const + { + return samples_.end(); + } + + uint32_t length() const + { + return static_cast(samples_.size()); + } + + void reserve(uint32_t s) + { + samples_.reserve(s); + } + + void resize(uint32_t s) + { + samples_.resize(s); + } + + dds::sub::SampleRef& operator[] (uint32_t i) + { + return this->samples_[i]; + } + + dds::sub::SampleRef * get_buffer() { + return this->samples_.data(); + } + + +private: + LoanedSamplesContainer samples_; +}; + +template <> +class LoanedSamples +{ +public: + + typedef std::vector< dds::sub::Sample > LoanedSamplesContainer; + typedef typename std::vector< dds::sub::Sample >::iterator iterator; + typedef typename std::vector< dds::sub::Sample >::const_iterator const_iterator; + +public: + LoanedSamples() { } + + ~LoanedSamples() + { + + } + +public: + + iterator mbegin() + { + return samples_.begin(); + } + + const_iterator begin() const + { + return samples_.begin(); + } + + const_iterator end() const + { + return samples_.end(); + } + + uint32_t length() const + { + return static_cast(samples_.size()); + } + + void reserve(uint32_t s) + { + samples_.reserve(s); + } + + void resize(uint32_t s) + { + samples_.resize(s); + } + + dds::sub::Sample& operator[] (uint32_t i) + { + return this->samples_[i]; + } + + dds::sub::Sample * get_buffer() { + return this->samples_.data(); + } + + +private: + LoanedSamplesContainer samples_; +}; + + +} +} +} +#endif /* OMG_SUB_DETAIL_LOANED_SAMPLES_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/LoanedSamplesImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/LoanedSamplesImpl.hpp new file mode 100644 index 0000000..2860b96 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/LoanedSamplesImpl.hpp @@ -0,0 +1,83 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_DETAIL_LOANED_SAMPLES_IMPL_HPP_ +#define CYCLONEDDS_DDS_SUB_DETAIL_LOANED_SAMPLES_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ + +// Implementation + +namespace dds +{ +namespace sub +{ + +template class DELEGATE> +LoanedSamples::LoanedSamples() : delegate_(new DELEGATE()) { } + +template class DELEGATE> +LoanedSamples::~LoanedSamples() { } + +template class DELEGATE> +LoanedSamples::LoanedSamples(const LoanedSamples& other): delegate_(other.delegate_) +{ + +} + +template class DELEGATE> +LoanedSamples::LoanedSamples(LoanedSamples&& other): delegate_(other.delegate_) +{ + +} + +template class DELEGATE> +typename LoanedSamples::const_iterator LoanedSamples::begin() const +{ + return delegate()->begin(); +} + +template class DELEGATE> +typename LoanedSamples::const_iterator LoanedSamples::end() const +{ + return delegate()->end(); +} + +template class DELEGATE> +const typename LoanedSamples::DELEGATE_REF_T& LoanedSamples::delegate() const +{ + return delegate_; +} + +template class DELEGATE> +typename LoanedSamples::DELEGATE_REF_T& LoanedSamples::delegate() +{ + return delegate_; +} + +template class DELEGATE> +uint32_t LoanedSamples::length() const +{ + return delegate_->length(); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_SUB_DETAIL_LOANED_SAMPLES_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/Manipulators.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/Manipulators.hpp new file mode 100644 index 0000000..744a06a --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/Manipulators.hpp @@ -0,0 +1,125 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_DETAIL_MANIPULATOR_HPP_ +#define CYCLONEDDS_DDS_SUB_DETAIL_MANIPULATOR_HPP_ + +/** + * @file + */ + +#include + +namespace dds +{ +namespace sub +{ +namespace functors +{ +namespace detail +{ + +class MaxSamplesManipulatorFunctor +{ +public: + MaxSamplesManipulatorFunctor(uint32_t n) : + n_(n) + { + } + + template + void operator()(S& s) + { + s.max_samples(n_); + } +private: + uint32_t n_; +}; + +class ContentFilterManipulatorFunctor +{ +public: + ContentFilterManipulatorFunctor(const dds::sub::Query& q) : + query_(q) + { + } + + template + void operator()(S& s) + { + s.content(query_); + } +private: + const dds::sub::Query query_; +}; + +class StateFilterManipulatorFunctor +{ +public: + StateFilterManipulatorFunctor( + const dds::sub::status::DataState& s) : + state_(s) + { + } + + template + void operator()(S& s) + { + s.state(state_); + } +private: + dds::sub::status::DataState state_; +}; + +class InstanceManipulatorFunctor +{ +public: + InstanceManipulatorFunctor(const dds::core::InstanceHandle& h) : + handle_(h) + { + } + + template + void operator()(S& s) + { + s.instance(handle_); + } +private: + dds::core::InstanceHandle handle_; +}; + +class NextInstanceManipulatorFunctor +{ +public: + NextInstanceManipulatorFunctor( + const dds::core::InstanceHandle& h) : + handle_(h) + { + } + + template + void operator()(S& s) + { + s.next_instance(handle_); + } +private: + dds::core::InstanceHandle handle_; +}; + + +} +} +} +} + + + +#endif /* CYCLONEDDS_DDS_SUB_DETAIL_MANIPULATOR_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/Query.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/Query.hpp new file mode 100644 index 0000000..89887c1 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/Query.hpp @@ -0,0 +1,32 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +#ifndef DDS_SUB_DETAIL_QUERY_HPP_ +#define DDS_SUB_DETAIL_QUERY_HPP_ + +#include +#include + + +namespace dds +{ +namespace sub +{ +namespace detail +{ +typedef dds::sub::TQuery Query; +} +} +} + + +#endif /* DDS_SUB_DETAIL_QUERY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/Rank.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/Rank.hpp new file mode 100644 index 0000000..d6833d2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/Rank.hpp @@ -0,0 +1,22 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_SUB_DETAIL_RANK_HPP +#define OMG_DDS_SUB_DETAIL_RANK_HPP + +#include +#include + +namespace dds { namespace sub { namespace detail { + typedef dds::sub::TRank< org::eclipse::cyclonedds::sub::RankImpl > Rank; +} } } + +#endif /* OMG_DDS_SUB_DETAIL_RANK_HPP */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/Sample.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/Sample.hpp new file mode 100644 index 0000000..d433b9f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/Sample.hpp @@ -0,0 +1,123 @@ +#ifndef OMG_DDS_PUB_DETAIL_SAMPLE_HPP_ +#define OMG_DDS_PUB_DETAIL_SAMPLE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +namespace dds +{ +namespace sub +{ +namespace detail +{ +template +class Sample; +}}} + +#include +//#include + +namespace dds +{ +namespace sub +{ +namespace detail +{ +template +class Sample +{ +public: + Sample() { } + + Sample(const T& d, const dds::sub::SampleInfo& i) + { + this->data_ = d; + this->info_ = i; + } + + Sample(const Sample& other) + { + copy(other); + } + + Sample& operator=(const Sample& other) + { + return copy(other); + } + + Sample& copy(const Sample& other) + { + this->data_ = other.data_; + this->info_ = other.info_; + + return *this; + } + +public: + const T& data() const + { + return data_; + } + + T& data() + { + return data_; + } + + void data(const T& d) + { + data_ = d; + } + + const dds::sub::SampleInfo& info() const + { + return info_; + } + + dds::sub::SampleInfo& info() + { + return info_; + } + + void info(const dds::sub::SampleInfo& i) + { + info_ = i; + } + + bool operator ==(const Sample& other) const + { + (void)other; + return false; + } + + T* data_ptr() + { + return &this->data_; + } + +private: + T data_; + dds::sub::SampleInfo info_; +}; + +} +} +} + +#endif /* OMG_DDS_PUB_DETAIL_SAMPLE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/SampleInfo.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/SampleInfo.hpp new file mode 100644 index 0000000..df5c1a5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/SampleInfo.hpp @@ -0,0 +1,22 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_SUB_DETAIL_SAMPLE_INFO_HPP_ +#define OMG_DDS_SUB_DETAIL_SAMPLE_INFO_HPP_ + +#include +#include + +namespace dds { namespace sub { namespace detail { + typedef dds::sub::TSampleInfo SampleInfo; +} } } + +#endif /* OMG_DDS_SUB_DETAIL_SAMPLE_INFO_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/SampleRef.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/SampleRef.hpp new file mode 100644 index 0000000..13a5d7c --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/SampleRef.hpp @@ -0,0 +1,130 @@ +#ifndef OMG_DDS_PUB_DETAIL_SAMPLEREF_HPP_ +#define OMG_DDS_PUB_DETAIL_SAMPLEREF_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +namespace dds +{ +namespace sub +{ +namespace detail +{ +template +class SampleRef; +}}} + +#include +#include + +namespace dds +{ +namespace sub +{ +namespace detail +{ +template +class SampleRef +{ +public: + SampleRef() + { + this->data_ = nullptr; + } + + SampleRef(ddscxx_serdata* d, const dds::sub::SampleInfo& i) + { + this->data_ = d; + this->info_ = i; + } + + SampleRef(const SampleRef& other) + { + copy(other); + } + + virtual ~SampleRef() + { + if (data_ != nullptr) { + ddsi_serdata_unref(reinterpret_cast(data_)); + } + } + + SampleRef& operator=(const SampleRef& other) + { + if (this != &other) + { + copy(other); + } + return *this; + } + +public: + const T& data() const + { + if (data_ == nullptr) + { + throw dds::core::Error("Data is Null"); + } + return *data_->getT(); + } + + const dds::sub::SampleInfo& info() const + { + return info_; + } + + dds::sub::SampleInfo& info() + { + return info_; + } + + bool operator ==(const SampleRef& other) const + { + (void)other; + return false; + } + + ddscxx_serdata* &data_ptr() + { + return this->data_; + } + + +private: + void copy(const SampleRef& other) + { + if (other.data_ == nullptr) + { + throw dds::core::Error("Other data is Null"); + } + static_cast(ddsi_serdata_ref(reinterpret_cast(other.data_))); + this->data_ = other.data_; + this->info_ = other.info_; + } + + ddscxx_serdata* data_; + dds::sub::SampleInfo info_; +}; + +} +} +} + +#endif /* OMG_DDS_PUB_DETAIL_SAMPLEREF_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/SamplesHolder.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/SamplesHolder.hpp new file mode 100644 index 0000000..951304b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/SamplesHolder.hpp @@ -0,0 +1,373 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_DETAIL_SAMPLES_HOLDER_HPP_ +#define CYCLONEDDS_DDS_SUB_DETAIL_SAMPLES_HOLDER_HPP_ + +/** + * @file + */ + +#include +#include "org/eclipse/cyclonedds/sub/AnyDataReaderDelegate.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace dds +{ +namespace sub +{ +namespace detail +{ + +template +class LoanedSamplesHolder : public SamplesHolder +{ +public: + LoanedSamplesHolder(dds::sub::LoanedSamples& samples) : samples_(samples), index_(0) + { + } + + void set_length(uint32_t len) { + this->samples_.delegate()->resize(len); + } + + uint32_t get_length() const { + return this->index_; + } + + SamplesHolder& operator++(int) + { + this->index_++; + return *this; + } + + void *data() + { + return (*this->samples_.delegate())[this->index_].delegate().data_ptr(); + } + + detail::SampleInfo& info() + { + return (*this->samples_.delegate())[this->index_].delegate().info(); + } + + void **cpp_sample_pointers(size_t length) + { + + return new void * [length]; + } + + dds_sample_info_t *cpp_info_pointers(size_t length) + { + return new dds_sample_info_t[length]; + } + + void set_sample_contents(void** c_sample_pointers, dds_sample_info_t *info) + { + uint32_t cpp_sample_size = this->samples_.delegate()->length(); + auto tmp_iterator = samples_.delegate()->mbegin(); + for (uint32_t i = 0; i < cpp_sample_size; ++i, ++tmp_iterator) { + /* Transfer ownership for ddscxx_serdata from c_sample_pointers to SampleRef objects. */ + tmp_iterator->delegate().data_ptr() = static_cast*>(c_sample_pointers[i]); + org::eclipse::cyclonedds::sub::AnyDataReaderDelegate::copy_sample_infos(info[i], tmp_iterator->delegate().info()); + } + } + + void fini_samples_buffers(void**& c_sample_pointers, dds_sample_info_t*& c_sample_infos) + { + delete [] c_sample_pointers; + delete [] c_sample_infos; + } + +private: + dds::sub::LoanedSamples& samples_; + uint32_t index_; +}; + +class CDRSamplesHolder : public SamplesHolder +{ +public: + CDRSamplesHolder(dds::sub::LoanedSamples& samples) : samples_(samples), index_(0) + { + } + + void set_length(uint32_t len) { + this->samples_.delegate()->resize(len); + } + + uint32_t get_length() const { + return this->index_; + } + + SamplesHolder& operator++(int) + { + this->index_++; + return *this; + } + + void *data() + { + return (*this->samples_.delegate())[this->index_].delegate().data_ptr(); + } + + detail::SampleInfo& info() + { + return (*this->samples_.delegate())[this->index_].delegate().info(); + } + + void **cpp_sample_pointers(size_t length) + { + return new void * [length]; + } + + dds_sample_info_t *cpp_info_pointers(size_t length) + { + return new dds_sample_info_t[length]; + } + + void set_sample_contents(void** c_sample_pointers, dds_sample_info_t *info) + { + struct ddsi_serdata **cdr_blobs = reinterpret_cast(c_sample_pointers); + const uint32_t cpp_sample_size = this->samples_.delegate()->length(); + for (uint32_t i = 0; i < cpp_sample_size; ++i) + { + struct ddsi_serdata * current_blob = cdr_blobs[i]; + org::eclipse::cyclonedds::topic::CDRBlob &sample_data = (*this->samples_.delegate())[i].delegate().data(); + // update the data kind + sample_data.kind(static_cast(current_blob->kind)); + + // if data is transferred using SHM, update the CDRBlob with iox_chunk + if(!update_cdrblob_from_iox_chunk(*current_blob, sample_data)) { + ddsrt_iovec_t blob_content; + ddsi_serdata_to_ser_ref(current_blob, 0, ddsi_serdata_size(current_blob), &blob_content); + copy_buffer_to_cdr_blob(reinterpret_cast(blob_content.iov_base), + blob_content.iov_len, sample_data.kind(), sample_data); + ddsi_serdata_to_ser_unref(current_blob, &blob_content); + ddsi_serdata_unref(current_blob); + } + // copy sample infos + org::eclipse::cyclonedds::sub::AnyDataReaderDelegate::copy_sample_infos(info[i], (*samples_.delegate())[i].delegate().info()); + } + } + + void fini_samples_buffers(void**& c_sample_pointers, dds_sample_info_t*& c_sample_infos) + { + delete [] c_sample_pointers; + delete [] c_sample_infos; + } + +private: + dds::sub::LoanedSamples& samples_; + uint32_t index_; + + void copy_buffer_to_cdr_blob(const uint8_t * buffer, const size_t size, + const org::eclipse::cyclonedds::topic::BlobKind data_kind, + org::eclipse::cyclonedds::topic::CDRBlob & cdr_blob) const + { + // update the CDR header + memcpy(cdr_blob.encoding().data(), buffer, CDR_HEADER_SIZE); + // if the data kind is not empty + if (data_kind != org::eclipse::cyclonedds::topic::BlobKind::Empty) { + // get the actual data from the buffer + cdr_blob.payload().assign(buffer + CDR_HEADER_SIZE, buffer + size); + } + } + + bool update_cdrblob_from_iox_chunk (ddsi_serdata & current_blob, + org::eclipse::cyclonedds::topic::CDRBlob &sample_data) { +#ifdef DDSCXX_HAS_SHM + // if the data is available on SHM + if (current_blob.iox_chunk && current_blob.iox_subscriber) { + // get the user iox header + auto iox_header = iceoryx_header_from_chunk(current_blob.iox_chunk); + // if the iox chunk has the data in serialized form + if (iox_header->shm_data_state == IOX_CHUNK_CONTAINS_SERIALIZED_DATA) { + copy_buffer_to_cdr_blob(reinterpret_cast(current_blob.iox_chunk), + iox_header->data_size, sample_data.kind(), sample_data); + } else if (iox_header->shm_data_state == IOX_CHUNK_CONTAINS_RAW_DATA) { + // serialize the data + auto serialized_size = ddsi_sertype_get_serialized_size(current_blob.type, + current_blob.iox_chunk); + // create a buffer to serialize + std::vector buffer(serialized_size); + // serialize into the buffer + ddsi_sertype_serialize_into(current_blob.type, current_blob.iox_chunk, buffer.data(), + serialized_size); + // update the CDR blob with the serialized data + copy_buffer_to_cdr_blob(buffer.data(), serialized_size, sample_data.kind(), sample_data); + } else { + // this shouldn't never happen + ISOCPP_THROW_EXCEPTION(ISOCPP_PRECONDITION_NOT_MET_ERROR, + "The received sample over SHM is not initialized"); + } + // release the chunk + free_iox_chunk(static_cast(current_blob.iox_subscriber), ¤t_blob.iox_chunk); + return true; + } else { + return false; + } +#else + (void) current_blob; + (void) sample_data; + return false; +#endif // DDSCXX_HAS_SHM + } +}; + +template +class SamplesFWInteratorHolder : public SamplesHolder +{ +public: + SamplesFWInteratorHolder(SamplesFWIterator& it) : iterator(it), size(0) + { + } + + void set_length(uint32_t len) { + this->size = len; + + } + + uint32_t get_length() const { + return this->size; + } + + SamplesHolder& operator++(int) + { + ++this->iterator; + return *this; + } + + void *data() + { + return (*iterator).delegate().data_ptr(); + } + + detail::SampleInfo& info() + { + return (*iterator).delegate().info(); + } + + void **cpp_sample_pointers(size_t length) + { + void **c_sample_pointers = new void * [length]; + SamplesFWIterator tmp_iterator = iterator; + for (uint32_t i = 0; i < length; ++i, ++tmp_iterator) { + c_sample_pointers[i] = (*tmp_iterator).delegate().data_ptr(); + } + return c_sample_pointers; + } + + dds_sample_info_t *cpp_info_pointers(size_t length) + { + return new dds_sample_info_t[length]; + } + + void set_sample_contents(void**, dds_sample_info_t *info) + { + /* Samples have already been deserialized in their containers during the read/take call. */ + SamplesFWIterator tmp_iterator = iterator; + for (uint32_t i = 0; i < size; ++i, ++tmp_iterator) { + org::eclipse::cyclonedds::sub::AnyDataReaderDelegate::copy_sample_infos(info[i], tmp_iterator->delegate().info()); + } + } + + void fini_samples_buffers(void**& c_sample_pointers, dds_sample_info_t*& c_sample_infos) + { + delete [] c_sample_infos; + delete [] c_sample_pointers; + } + +private: + SamplesFWIterator& iterator; + uint32_t size; + +}; + +template +class SamplesBIIteratorHolder : public SamplesHolder +{ +public: + SamplesBIIteratorHolder(SamplesBIIterator& it) : iterator(it), size(0) + { + } + + void set_length(uint32_t len) { + this->size = len; + samples.resize(len); + } + + uint32_t get_length() const { + return this->size; + } + + SamplesHolder& operator++(int) + { + ++this->iterator; + return *this; + } + + void *data() + { + return this->samples[0].delegate().data_ptr(); + } + + detail::SampleInfo& info() + { + return this->samples[0].delegate().info(); + } + + void **cpp_sample_pointers(size_t length) + { + set_length(static_cast(length)); + void **c_sample_pointers = new void*[length]; + for (uint32_t i = 0; i < length; ++i) { + c_sample_pointers[i] = samples[i].delegate().data_ptr(); + } + return c_sample_pointers; + } + + dds_sample_info_t *cpp_info_pointers(size_t length) + { + dds_sample_info_t *c_info_pointers = new dds_sample_info_t[length]; + return c_info_pointers; + } + + void set_sample_contents(void**, dds_sample_info_t *info) + { + /* Samples have already been deserialized in their containers during the read/take call. */ + for (uint32_t i = 0; i < size; ++i) { + org::eclipse::cyclonedds::sub::AnyDataReaderDelegate::copy_sample_infos(info[i], samples[i].delegate().info()); + this->iterator = std::move(samples[i]); + this->iterator++; + } + } + + void fini_samples_buffers(void**& c_sample_pointers, dds_sample_info_t*& c_sample_infos) + { + delete [] c_sample_infos; + delete [] c_sample_pointers; + } + +private: + SamplesBIIterator& iterator; + std::vector< dds::sub::Sample > samples; + uint32_t size; + +}; + +} +} +} + + + + +#endif /* CYCLONEDDS_DDS_SUB_DETAIL_SAMPLES_HOLDER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/SharedSamples.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/SharedSamples.hpp new file mode 100644 index 0000000..140562f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/SharedSamples.hpp @@ -0,0 +1,86 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_DETAIL_SHARED_SAMPLES_HPP_ +#define CYCLONEDDS_DDS_SUB_DETAIL_SHARED_SAMPLES_HPP_ + +/** + * @file + */ + +#include + +// Implementation + +namespace dds +{ +namespace sub +{ +namespace detail +{ + +template +class SharedSamples +{ +public: + typedef typename std::vector< dds::sub::Sample >::iterator iterator; + typedef typename std::vector< dds::sub::Sample >::const_iterator const_iterator; + +public: + SharedSamples() { } + + SharedSamples(dds::sub::LoanedSamples ls) : samples_(ls) { } + + ~SharedSamples() + { + + } + +public: + + iterator mbegin() + { + return samples_->begin(); + } + + const_iterator begin() const + { + return samples_.begin(); + } + + const_iterator end() const + { + return samples_.end(); + } + + uint32_t length() const + { + /** @internal @todo Possible RTF size issue ? */ + return static_cast(samples_.length()); + } + + void resize(uint32_t s) + { + samples_.resize(s); + } + +private: + dds::sub::LoanedSamples samples_; +}; + +} +} +} + + +// End of implementation + +#endif /* CYCLONEDDS_DDS_SUB_DETAIL_SHARED_SAMPLES_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/SharedSamplesImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/SharedSamplesImpl.hpp new file mode 100644 index 0000000..06df1bc --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/SharedSamplesImpl.hpp @@ -0,0 +1,80 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_SHARED_SAMPLES_IMPL_HPP_ +#define CYCLONEDDS_DDS_SUB_SHARED_SAMPLES_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ + +// Implementation + +namespace dds +{ +namespace sub +{ + +template class DELEGATE> +SharedSamples::SharedSamples() : delegate_(new DELEGATE()) { } + +template class DELEGATE> +SharedSamples::SharedSamples(dds::sub::LoanedSamples ls) : delegate_(new DELEGATE(ls)) { } + +template class DELEGATE> +SharedSamples::~SharedSamples() { } + +template class DELEGATE> +SharedSamples::SharedSamples(const SharedSamples& other) +{ + delegate_ = other.delegate_; +} + +template class DELEGATE> +typename SharedSamples::const_iterator SharedSamples::begin() const +{ + return delegate()->begin(); +} + +template class DELEGATE> +typename SharedSamples::const_iterator SharedSamples::end() const +{ + return delegate()->end(); +} + +template class DELEGATE> +const typename SharedSamples::DELEGATE_REF_T& SharedSamples::delegate() const +{ + return delegate_; +} + +template class DELEGATE> +typename SharedSamples::DELEGATE_REF_T& SharedSamples::delegate() +{ + return delegate_; +} + +template class DELEGATE> +uint32_t SharedSamples::length() const +{ + return delegate_->length(); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_SUB_SHARED_SAMPLES_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/Subscriber.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/Subscriber.hpp new file mode 100644 index 0000000..b90fd36 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/Subscriber.hpp @@ -0,0 +1,29 @@ +#ifndef OMG_DDS_SUB_DETAIL_SUBSCRIBER_HPP_ +#define OMG_DDS_SUB_DETAIL_SUBSCRIBER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds { namespace sub { namespace detail { + typedef dds::sub::TSubscriber Subscriber; +} } } + +#endif /* OMG_DDS_SUB_DETAIL_SUBSCRIBER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/TAnyDataReaderImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/TAnyDataReaderImpl.hpp new file mode 100644 index 0000000..b69ced1 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/TAnyDataReaderImpl.hpp @@ -0,0 +1,132 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_SUB_DETAIL_TANYDATAREADER_HPP_ +#define OMG_DDS_SUB_DETAIL_TANYDATAREADER_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ + +#include +#include + +// Implementation + +namespace dds +{ +namespace sub +{ + +template +const dds::sub::Subscriber& +TAnyDataReader::subscriber() const +{ + return this->delegate()->subscriber(); +} + +template +const dds::topic::TopicDescription& +TAnyDataReader::topic_description() const +{ + return this->delegate()->topic_description(); +} + +template +void +TAnyDataReader::wait_for_historical_data(const dds::core::Duration& timeout) +{ + this->delegate()->wait_for_historical_data(timeout); +} + + +template +dds::sub::qos::DataReaderQos +TAnyDataReader::qos() const +{ + return this->delegate()->qos(); +} + +template +void +TAnyDataReader::qos(const dds::sub::qos::DataReaderQos& qos) +{ + this->delegate()->qos(qos); +} + +template +TAnyDataReader& +TAnyDataReader::operator << (const dds::sub::qos::DataReaderQos& qos) +{ + this->delegate()->qos(qos); + return *this; +} + +template +const TAnyDataReader& +TAnyDataReader::operator >> (dds::sub::qos::DataReaderQos& qos) const +{ + qos = this->delegate()->qos(); + return *this; +} + + +template +dds::core::status::LivelinessChangedStatus +TAnyDataReader::liveliness_changed_status() +{ + return this->delegate()->liveliness_changed_status(); +} + +template +dds::core::status::SampleRejectedStatus +TAnyDataReader::sample_rejected_status() +{ + return this->delegate()->sample_rejected_status(); +} + +template +dds::core::status::SampleLostStatus +TAnyDataReader::sample_lost_status() +{ + return this->delegate()->sample_lost_status(); +} + +template +dds::core::status::RequestedDeadlineMissedStatus +TAnyDataReader::requested_deadline_missed_status() +{ + return this->delegate()->requested_deadline_missed_status(); +} + +template +dds::core::status::RequestedIncompatibleQosStatus +TAnyDataReader::requested_incompatible_qos_status() +{ + return this->delegate()->requested_incompatible_qos_status(); +} + +template +dds::core::status::SubscriptionMatchedStatus +TAnyDataReader::subscription_matched_status() +{ + return this->delegate()->subscription_matched_status(); +} + +} +} +// End of implementation + +#endif /* OMG_DDS_SUB_DETAIL_TANYDATAREADER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/TCoherentAccessImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/TCoherentAccessImpl.hpp new file mode 100644 index 0000000..f8766c8 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/TCoherentAccessImpl.hpp @@ -0,0 +1,51 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_TCOHERENTACCESS_IMPL_HPP_ +#define CYCLONEDDS_DDS_SUB_TCOHERENTACCESS_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace sub +{ + +template +TCoherentAccess::TCoherentAccess(const dds::sub::Subscriber& sub) : dds::core::Value(sub) { } + +template +void TCoherentAccess::end() +{ + this->delegate().end(); +} + +template +TCoherentAccess::~TCoherentAccess() +{ + this->delegate().end(); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_SUB_TCOHERENTACCESS_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/TDataReaderImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/TDataReaderImpl.hpp new file mode 100644 index 0000000..a18b88f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/TDataReaderImpl.hpp @@ -0,0 +1,1444 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_TDATAREADER_IMPL_HPP_ +#define CYCLONEDDS_DDS_SUB_TDATAREADER_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include +#include +#include +#include "dds/core/macros.hpp" + + + + +/*************************************************************************** + * + * dds/sub/DataReader<> WRAPPER implementation. + * Declaration can be found in dds/sub/TDataReader.hpp + * + ***************************************************************************/ + +// Implementation + +namespace dds +{ +namespace sub +{ + +//-------------------------------------------------------------------------------- +// DATAREADER +//-------------------------------------------------------------------------------- + +template class DELEGATE> +DataReader::Selector::Selector(DataReader& dr) : impl_(dr.delegate()) +{ +} + +template class DELEGATE> +typename DataReader::Selector& +DataReader::Selector::instance(const dds::core::InstanceHandle& h) +{ + impl_.instance(h); + return *this; +} + +template class DELEGATE> +typename DataReader::Selector& +DataReader::Selector::next_instance(const dds::core::InstanceHandle& h) +{ + impl_.next_instance(h); + return *this; +} + +template class DELEGATE> +typename DataReader::Selector& +DataReader::Selector::state(const dds::sub::status::DataState& s) +{ + impl_.filter_state(s); + return *this; +} + +template class DELEGATE> +typename DataReader::Selector& +DataReader::Selector::content(const dds::sub::Query& query) +{ + impl_.filter_content(query); + return *this; +} + +template class DELEGATE> +typename DataReader::Selector& +DataReader::Selector::max_samples(uint32_t n) +{ + impl_.max_samples(n); + return *this; +} + +template class DELEGATE> +dds::sub::LoanedSamples +DataReader::Selector::read() +{ + return impl_.read(); +} + +template class DELEGATE> +dds::sub::LoanedSamples +DataReader::Selector::take() +{ + return impl_.take(); +} + +template class DELEGATE> +template +uint32_t +DataReader::Selector::read(SamplesFWIterator sfit, uint32_t max_samples) +{ + return impl_.read(sfit, max_samples); +} + +template class DELEGATE> +template +uint32_t +DataReader::Selector::take(SamplesFWIterator sfit, uint32_t max_samples) +{ + return impl_.take(sfit, max_samples); +} + +template class DELEGATE> +template +uint32_t +DataReader::Selector::read(SamplesBIIterator sbit) +{ + return impl_.read(sbit); +} + +template class DELEGATE> +template +uint32_t +DataReader::Selector::take(SamplesBIIterator sbit) +{ + return impl_.take(sbit); +} + +//-------------------------------------------------------------------------------- +// DATAREADER::MANIPULATORSELECTOR +//-------------------------------------------------------------------------------- +template class DELEGATE> +DataReader::ManipulatorSelector:: +ManipulatorSelector(DataReader& dr) : impl_(dr.delegate()) {} + +template class DELEGATE> +bool +DataReader::ManipulatorSelector::read_mode() +{ + return impl_.read_mode(); +} + +template class DELEGATE> +void +DataReader::ManipulatorSelector::read_mode(bool b) +{ + impl_.read_mode(b); +} + +template class DELEGATE> +typename DataReader::ManipulatorSelector& +DataReader::ManipulatorSelector::instance(const dds::core::InstanceHandle& h) +{ + impl_.instance(h); + return *this; +} + +template class DELEGATE> +typename DataReader::ManipulatorSelector& +DataReader::ManipulatorSelector::next_instance(const dds::core::InstanceHandle& h) +{ + impl_.next_instance(h); + return *this; +} + +template class DELEGATE> +typename DataReader::ManipulatorSelector& +DataReader::ManipulatorSelector::operator >>(dds::sub::LoanedSamples& samples) +{ + impl_ >> samples; + return *this; +} + +template class DELEGATE> +typename DataReader::ManipulatorSelector& +DataReader::ManipulatorSelector::operator >> (ManipulatorSelector & (manipulator)(ManipulatorSelector&)) +{ + manipulator(*this); + return *this; +} + +template class DELEGATE> +template +typename DataReader::ManipulatorSelector +DataReader::ManipulatorSelector::operator >> (Functor f) +{ + f(*this); + return *this; +} + +template class DELEGATE> +typename DataReader::ManipulatorSelector& +DataReader::ManipulatorSelector::state(const dds::sub::status::DataState& s) +{ + impl_.filter_state(s); + return *this; +} + +template class DELEGATE> +typename DataReader::ManipulatorSelector& +DataReader::ManipulatorSelector::content(const dds::sub::Query& query) +{ + impl_.filter_content(query); + return *this; +} + +template class DELEGATE> +typename DataReader::ManipulatorSelector& +DataReader::ManipulatorSelector::max_samples(uint32_t n) +{ + impl_.max_samples(n); + return *this; +} + +template class DELEGATE> +DataReader::DataReader( + const dds::sub::Subscriber& sub, + const dds::topic::Topic& topic): + ::dds::core::Reference< DELEGATE >(new DELEGATE(sub, topic, sub->default_datareader_qos())) +{ + this->delegate()->init(this->impl_); +} + +template class DELEGATE> +DataReader::DataReader( + const dds::sub::Subscriber& sub, + const ::dds::topic::Topic& topic, + const dds::sub::qos::DataReaderQos& qos, + dds::sub::DataReaderListener* listener, + const dds::core::status::StatusMask& mask) : + ::dds::core::Reference< DELEGATE >(new DELEGATE(sub, topic, qos, listener, mask)) +{ + this->delegate()->init(this->impl_); +} + +#ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT +template class DELEGATE> +DataReader::DataReader( + const dds::sub::Subscriber& sub, + const dds::topic::ContentFilteredTopic& topic) : + ::dds::core::Reference< DELEGATE >(new DELEGATE(sub, topic, sub.default_datareader_qos())) +{ + this->delegate()->init(this->impl_); +} + +template class DELEGATE> +DataReader::DataReader( + const dds::sub::Subscriber& sub, + const ::dds::topic::ContentFilteredTopic& topic, + const dds::sub::qos::DataReaderQos& qos, + dds::sub::DataReaderListener* listener, + const dds::core::status::StatusMask& mask) : + ::dds::core::Reference< DELEGATE >(new DELEGATE(sub, topic, qos, listener, mask)) +{ + this->delegate()->init(this->impl_); +} +#endif /* OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT */ + +#ifdef OMG_DDS_MULTI_TOPIC_SUPPORT +template class DELEGATE> +DataReader::DataReader( + const dds::sub::Subscriber& sub, + const dds::topic::MultiTopic& topic) : + ::dds::core::Reference< DELEGATE >(new DELEGATE(sub, topic)) +{ + this->delegate()->init(this->impl_); +} + +template class DELEGATE> +DataReader::DataReader( + const dds::sub::Subscriber& sub, + const ::dds::topic::MultiTopic& topic, + const dds::sub::qos::DataReaderQos& qos, + dds::sub::DataReaderListener* listener, + const dds::core::status::StatusMask& mask) : + ::dds::core::Reference< DELEGATE >(new DELEGATE(sub, topic, qos, listener, mask)) +{ + this->delegate()->init(this->impl_); +} +#endif /* OMG_DDS_MULTI_TOPIC_SUPPORT */ + +template class DELEGATE> +dds::sub::status::DataState +DataReader::default_filter_state() +{ + return this->delegate()->default_filter_state(); +} + +template class DELEGATE> +DataReader& DataReader::default_filter_state(const dds::sub::status::DataState& status) +{ + this->delegate()->default_filter_state(status); + return *this; +} + +template class DELEGATE> +DataReader& DataReader::operator >>(dds::sub::LoanedSamples& ls) +{ + ls = this->read(); + return *this; +} + +template class DELEGATE> +typename DataReader::ManipulatorSelector +DataReader::operator >> (ManipulatorSelector& (manipulator)(ManipulatorSelector&)) +{ + ManipulatorSelector selector(*this); + manipulator(selector); + return selector; +} + +template class DELEGATE> +template +typename DataReader::ManipulatorSelector +DataReader::operator >> (Functor f) +{ + ManipulatorSelector selector(*this); + f(selector); + return selector; +} + +template class DELEGATE> +LoanedSamples +DataReader::read() +{ + return this->delegate()->read(); +} + +template class DELEGATE> +LoanedSamples +DataReader::take() +{ + return this->delegate()->take(); +} + + +template class DELEGATE> +template +uint32_t +DataReader::read(SamplesFWIterator sfit, uint32_t max_samples) +{ + return this->delegate()->read(sfit, max_samples); +} + +template class DELEGATE> +template +uint32_t +DataReader::take(SamplesFWIterator sfit, uint32_t max_samples) +{ + return this->delegate()->take(sfit, max_samples); +} + +template class DELEGATE> +template +uint32_t +DataReader::read(SamplesBIIterator sbit) +{ + return this->delegate()->read(sbit); +} + +template class DELEGATE> +template +uint32_t +DataReader::take(SamplesBIIterator sbit) +{ + return this->delegate()->take(sbit); +} + +template class DELEGATE> +typename DataReader::Selector +DataReader::select() +{ + Selector selector(*this); + return selector; +} + +template class DELEGATE> +dds::topic::TopicInstance +DataReader::key_value(const dds::core::InstanceHandle& h) +{ + return this->delegate()->key_value(h); +} + +template class DELEGATE> +T& +DataReader::key_value(T& sample, const dds::core::InstanceHandle& h) +{ + return this->delegate()->key_value(sample, h); +} + +template class DELEGATE> +const dds::core::InstanceHandle +DataReader::lookup_instance(const T& key) const +{ + return this->delegate()->lookup_instance(key); +} + +template class DELEGATE> +void +DataReader::listener( + Listener* listener, + const dds::core::status::StatusMask& event_mask) +{ + this->delegate()->listener(listener, event_mask); +} + +template class DELEGATE> +typename DataReader::Listener* +DataReader::listener() const +{ + return this->delegate()->listener(); +} + +} +} + + + + +/*************************************************************************** + * + * dds/sub/detail/DataReader<> DELEGATE implementation. + * Declaration can be found in dds/sub/detail/DataReader.hpp + * + * Implementation and declaration have been separated because some circular + * dependencies, like with DataReaderListener and AnyDataReader. + * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include + + +template +dds::sub::detail::DataReader::DataReader(const dds::sub::Subscriber& sub, + const dds::topic::Topic& topic, + const dds::sub::qos::DataReaderQos& qos, + dds::sub::DataReaderListener* listener, + const dds::core::status::StatusMask& mask) + : ::org::eclipse::cyclonedds::sub::AnyDataReaderDelegate(qos, topic), sub_(sub), + typed_sample_() +{ + common_constructor(listener, mask); +} + +template +dds::sub::detail::DataReader::DataReader(const dds::sub::Subscriber& sub, + const dds::topic::ContentFilteredTopic& topic, + const dds::sub::qos::DataReaderQos& qos, + dds::sub::DataReaderListener* listener, + const dds::core::status::StatusMask& mask) + : ::org::eclipse::cyclonedds::sub::AnyDataReaderDelegate(qos, topic), sub_(sub), + typed_sample_() + +{ + common_constructor(listener, mask); +} + +template +void +dds::sub::detail::DataReader::common_constructor( + dds::sub::DataReaderListener* listener, + const dds::core::status::StatusMask& mask) +{ + DDSCXX_WARNING_MSVC_OFF(4127) + DDSCXX_WARNING_MSVC_OFF(6326) + if (dds::topic::is_topic_type::value == 0) { + ISOCPP_THROW_EXCEPTION(ISOCPP_PRECONDITION_NOT_MET_ERROR, "DataReader cannot be created, topic information not found"); + } + DDSCXX_WARNING_MSVC_ON(6326) + DDSCXX_WARNING_MSVC_ON(4127) + + org::eclipse::cyclonedds::sub::qos::DataReaderQosDelegate drQos = qos_.delegate(); + + dds_entity_t ddsc_sub = sub_.delegate()->get_ddsc_entity(); + dds_entity_t ddsc_top = this->AnyDataReaderDelegate::td_.delegate()->get_ddsc_entity(); + + // get and validate the ddsc qos + drQos.check(); + dds_qos_t* ddsc_qos = drQos.ddsc_qos(); + +#if 0 + std::string expression = this->AnyDataReaderDelegate::td_.delegate()->reader_expression(); + c_value *params = this->AnyDataReaderDelegate::td_.delegate()->reader_parameters(); +#endif + + dds_entity_t ddsc_reader = dds_create_reader(ddsc_sub, ddsc_top, ddsc_qos, NULL); + dds_delete_qos(ddsc_qos); + ISOCPP_DDSC_RESULT_CHECK_AND_THROW(ddsc_reader, "Could not create DataReader."); + + this->AnyDataReaderDelegate::td_.delegate()->incrNrDependents(); + + this->AnyDataReaderDelegate::setSample(&this->typed_sample_); + this->set_ddsc_entity(ddsc_reader); + this->listener(listener, mask); +} + +template +dds::sub::detail::DataReader::~DataReader() +{ + if (!this->closed) { + try { + close(); + } catch (...) { + + } + } +} + +template +void +dds::sub::detail::DataReader::init(ObjectDelegate::weak_ref_type weak_ref) +{ + /* Set weak_ref before passing ourselves to other isocpp objects. */ + this->set_weak_ref(weak_ref); + /* Add weak_ref to the map of entities */ + this->add_to_entity_map(weak_ref); + /* Add the datareader to the datareader set of the subscriber */ + this->sub_.delegate()->add_datareader(*this); + + // Because listeners are added after reader is created (which is in enabled state, because + // disabled state is not yet supported), events could have occured before listeners were + // registered. Therefore the event handlers for those events are called here. + if (this->listener_get()) { + dds::core::status::StatusMask readerStatus = status_changes(); + + if (listener_mask.to_ulong() & dds::core::status::StatusMask::data_available().to_ulong() + && readerStatus.test(DDS_DATA_AVAILABLE_STATUS_ID)) + { + on_data_available(this->ddsc_entity); + } + if (listener_mask.to_ulong() & dds::core::status::StatusMask::liveliness_changed().to_ulong() + && readerStatus.test(DDS_LIVELINESS_CHANGED_STATUS_ID)) + { + dds::core::status::LivelinessChangedStatus status = liveliness_changed_status(); + on_liveliness_changed(this->ddsc_entity, status); + } + if (listener_mask.to_ulong() & dds::core::status::StatusMask::requested_deadline_missed().to_ulong() + && readerStatus.test(DDS_REQUESTED_DEADLINE_MISSED_STATUS_ID)) + { + dds::core::status::RequestedDeadlineMissedStatus status = requested_deadline_missed_status(); + on_requested_deadline_missed(this->ddsc_entity, status); + } + if (listener_mask.to_ulong() & dds::core::status::StatusMask::requested_incompatible_qos().to_ulong() + && readerStatus.test(DDS_REQUESTED_INCOMPATIBLE_QOS_STATUS_ID)) + { + dds::core::status::RequestedIncompatibleQosStatus status = requested_incompatible_qos_status(); + on_requested_incompatible_qos(this->ddsc_entity, status); + } + if (listener_mask.to_ulong() & dds::core::status::StatusMask::sample_lost().to_ulong() + && readerStatus.test(DDS_SAMPLE_LOST_STATUS_ID)) + { + dds::core::status::SampleLostStatus status = sample_lost_status(); + on_sample_lost(this->ddsc_entity, status); + } + if (listener_mask.to_ulong() & dds::core::status::StatusMask::sample_rejected().to_ulong() + && readerStatus.test(DDS_SAMPLE_REJECTED_STATUS_ID)) + { + dds::core::status::SampleRejectedStatus status = sample_rejected_status(); + on_sample_rejected(this->ddsc_entity, status); + } + if (listener_mask.to_ulong() & dds::core::status::StatusMask::subscription_matched().to_ulong() + && readerStatus.test(DDS_SUBSCRIPTION_MATCHED_STATUS_ID)) + { + dds::core::status::SubscriptionMatchedStatus status = subscription_matched_status(); + on_subscription_matched(this->ddsc_entity, status); + } + } + + this->enable(); +} + +template +dds::sub::status::DataState +dds::sub::detail::DataReader::default_filter_state() +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + dds::sub::status::DataState state = this->status_filter_; + + scopedLock.unlock(); + + return state; +} + +template +void +dds::sub::detail::DataReader::default_filter_state(const dds::sub::status::DataState& state) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + this->status_filter_ = state; + + scopedLock.unlock(); +} + +template +bool +dds::sub::detail::DataReader::is_loan_supported() +{ + this->check(); + return this->AnyDataReaderDelegate::is_loan_supported(static_cast(this->ddsc_entity)); +} + +template +dds::sub::LoanedSamples +dds::sub::detail::DataReader::read_cdr() +{ + dds::sub::LoanedSamples samples; + dds::sub::detail::CDRSamplesHolder holder(samples); + + this->AnyDataReaderDelegate::read_cdr(static_cast(this->ddsc_entity), this->status_filter_, holder, static_cast(dds::core::LENGTH_UNLIMITED)); + + return samples; +} + +template +dds::sub::LoanedSamples +dds::sub::detail::DataReader::take_cdr() +{ + dds::sub::LoanedSamples samples; + dds::sub::detail::CDRSamplesHolder holder(samples); + + this->AnyDataReaderDelegate::take_cdr(static_cast(this->ddsc_entity), this->status_filter_, holder, static_cast(dds::core::LENGTH_UNLIMITED)); + + return samples; +} + +template +dds::sub::LoanedSamples +dds::sub::detail::DataReader::read() +{ + dds::sub::LoanedSamples samples; + dds::sub::detail::LoanedSamplesHolder holder(samples); + + this->AnyDataReaderDelegate::loaned_read(static_cast(this->ddsc_entity), this->status_filter_, holder, static_cast(dds::core::LENGTH_UNLIMITED)); + + return samples; +} + +template +dds::sub::LoanedSamples +dds::sub::detail::DataReader::take() +{ + dds::sub::LoanedSamples samples; + dds::sub::detail::LoanedSamplesHolder holder(samples); + + this->AnyDataReaderDelegate::loaned_take(static_cast(this->ddsc_entity), this->status_filter_, holder, static_cast(dds::core::LENGTH_UNLIMITED)); + + return samples; +} + +template +template +uint32_t +dds::sub::detail::DataReader::read(SamplesFWIterator samples, uint32_t max_samples) +{ + dds::sub::detail::SamplesFWInteratorHolder holder(samples); + + this->AnyDataReaderDelegate::read(static_cast(this->ddsc_entity), this->status_filter_, holder, max_samples); + + return holder.get_length(); +} + +template +template +uint32_t +dds::sub::detail::DataReader::take(SamplesFWIterator samples, uint32_t max_samples) +{ + dds::sub::detail::SamplesFWInteratorHolder holder(samples); + + this->AnyDataReaderDelegate::take(static_cast(this->ddsc_entity), this->status_filter_, holder, max_samples); + + return holder.get_length(); +} + +template +template +uint32_t +dds::sub::detail::DataReader::read(SamplesBIIterator samples) +{ + dds::sub::detail::SamplesBIIteratorHolder holder(samples); + + this->AnyDataReaderDelegate::read(static_cast(this->ddsc_entity), this->status_filter_, holder, static_cast(dds::core::LENGTH_UNLIMITED)); + + return holder.get_length(); +} + +template +template +uint32_t +dds::sub::detail::DataReader::take(SamplesBIIterator samples) +{ + dds::sub::detail::SamplesBIIteratorHolder holder(samples); + + this->AnyDataReaderDelegate::take(static_cast(this->ddsc_entity), this->status_filter_, holder, static_cast(dds::core::LENGTH_UNLIMITED)); + + return holder.get_length(); +} + +template +dds::topic::TopicInstance +dds::sub::detail::DataReader::key_value(const dds::core::InstanceHandle& h) +{ + T key_holder; + + this->AnyDataReaderDelegate::get_key_value(static_cast(this->ddsc_entity), h, &key_holder); + + return dds::topic::TopicInstance(h, key_holder); +} + +template +T& +dds::sub::detail::DataReader::key_value(T& key, const dds::core::InstanceHandle& h) +{ + this->AnyDataReaderDelegate::get_key_value(static_cast(this->ddsc_entity), h, &key); + + return key; +} + +template +const dds::core::InstanceHandle +dds::sub::detail::DataReader::lookup_instance(const T& key) const +{ + dds::core::InstanceHandle handle(this->AnyDataReaderDelegate::lookup_instance(static_cast(this->ddsc_entity), &key)); + + return handle; +} + +template +const dds::sub::Subscriber& +dds::sub::detail::DataReader::subscriber() const +{ + this->check(); + + return sub_; +} + +template +void +dds::sub::detail::DataReader::close() +{ + this->prevent_callbacks(); + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + this->listener_set(NULL, dds::core::status::StatusMask::none()); + + this->sub_.delegate()->remove_datareader(*this); + + // Remove our dependency on the topicdescription, and drop our reference to it, + // so that it can become garbage collected. + // It is important that we also drop our reference to the topicdescription, since + // subsequent dependencies between for example ContentFilteredTopic to Topic can + // only be dropped by the destructor of the ContentFilteredTopic. + this->AnyDataReaderDelegate::td_.delegate()->decrNrDependents(); + this->AnyDataReaderDelegate::td_ = dds::topic::TopicDescription(dds::core::null); + + org::eclipse::cyclonedds::sub::AnyDataReaderDelegate::close(); + + scopedLock.unlock(); +} + + +template +dds::sub::DataReaderListener* +dds::sub::detail::DataReader::listener() +{ + this->check(); + return reinterpret_cast*>(this->listener_get()); +} + +template +void +dds::sub::detail::DataReader::listener( + dds::sub::DataReaderListener* l, + const dds::core::status::StatusMask& event_mask) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->listener_set( l, event_mask ) ; + scopedLock.unlock(); +} + +template +dds::sub::DataReader +dds::sub::detail::DataReader::wrapper() +{ + typename DataReader::ref_type ref = + ::std::dynamic_pointer_cast >(this->get_strong_ref()); + dds::sub::DataReader reader(ref); + + return reader; +} + +template +dds::sub::detail::DataReader::Selector::Selector(typename DataReader::ref_type dr) + : mode(SELECT_MODE_READ), reader(dr), state_filter_is_set_(false), + max_samples_(static_cast(dds::core::LENGTH_UNLIMITED)), query_(dds::core::null) +{ +} + +template +typename dds::sub::detail::DataReader::Selector& +dds::sub::detail::DataReader::Selector::instance(const dds::core::InstanceHandle& h) +{ + this->handle = h; + switch (this->mode) { + case SELECT_MODE_READ: + case SELECT_MODE_READ_INSTANCE: + case SELECT_MODE_READ_NEXT_INSTANCE: + this->mode = SELECT_MODE_READ_INSTANCE; + break; + case SELECT_MODE_READ_WITH_CONDITION: + case SELECT_MODE_READ_INSTANCE_WITH_CONDITION: + case SELECT_MODE_READ_NEXT_INSTANCE_WITH_CONDITION: + this->mode = SELECT_MODE_READ_INSTANCE_WITH_CONDITION; + break; + } + + return *this; +} + +template +typename dds::sub::detail::DataReader::Selector& +dds::sub::detail::DataReader::Selector::next_instance(const dds::core::InstanceHandle& h) +{ + this->handle = h; + switch (this->mode) { + case SELECT_MODE_READ: + case SELECT_MODE_READ_INSTANCE: + case SELECT_MODE_READ_NEXT_INSTANCE: + this->mode = SELECT_MODE_READ_NEXT_INSTANCE; + break; + case SELECT_MODE_READ_WITH_CONDITION: + case SELECT_MODE_READ_INSTANCE_WITH_CONDITION: + case SELECT_MODE_READ_NEXT_INSTANCE_WITH_CONDITION: + this->mode = SELECT_MODE_READ_NEXT_INSTANCE_WITH_CONDITION; + break; + } + + return *this; +} + +template +typename dds::sub::detail::DataReader::Selector& +dds::sub::detail::DataReader::Selector::filter_state(const dds::sub::status::DataState& s) +{ + this->state_filter_ = s; + this->state_filter_is_set_ = true; + + if ((this->mode == SELECT_MODE_READ_WITH_CONDITION) || + (this->mode == SELECT_MODE_READ_INSTANCE_WITH_CONDITION) || + (this->mode == SELECT_MODE_READ_NEXT_INSTANCE_WITH_CONDITION)) { + if (!this->query_.delegate()->modify_state_filter(this->state_filter_)) { + dds::sub::Query q(this->query_.data_reader(), this->query_.expression(), this->query_.delegate()->parameters()); + q.delegate()->state_filter(this->state_filter_); + this->query_ = q; + } + } + + return *this; +} + +template +typename dds::sub::detail::DataReader::Selector& +dds::sub::detail::DataReader::Selector::max_samples(uint32_t n) +{ + this->max_samples_ = n; + return *this; +} + +template +typename dds::sub::detail::DataReader::Selector& +dds::sub::detail::DataReader::Selector::filter_content( + const dds::sub::Query& query) +{ + ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Read with queries not currently supported"); + this->query_ = query; + switch (this->mode) { + case SELECT_MODE_READ: + case SELECT_MODE_READ_INSTANCE: + case SELECT_MODE_READ_NEXT_INSTANCE: + this->mode = SELECT_MODE_READ_WITH_CONDITION; + break; + default: + break; + } + return *this; +} + +template +dds::sub::LoanedSamples +dds::sub::detail::DataReader::Selector::read() +{ + return this->reader->read(*this); +} + +template +dds::sub::LoanedSamples +dds::sub::detail::DataReader::Selector::take() +{ + return this->reader->take(*this); +} + +// --- Forward Iterators: --- // + +template +template +uint32_t +dds::sub::detail::DataReader::Selector::read(SamplesFWIterator sfit, uint32_t max_samples) +{ + return this->reader->read(sfit, max_samples, *this); +} + +template +template +uint32_t +dds::sub::detail::DataReader::Selector::take(SamplesFWIterator sfit, uint32_t max_samples) +{ + return this->reader->take(sfit, max_samples, *this); +} + +// --- Back-Inserting Iterators: --- // + +template +template +uint32_t +dds::sub::detail::DataReader::Selector::read(SamplesBIIterator sbit) +{ + return this->reader->read(sbit, *this); +} + +template +template +uint32_t +dds::sub::detail::DataReader::Selector::take(SamplesBIIterator sbit) +{ + return this->reader->take(sbit, *this); +} + +template +typename dds::sub::detail::DataReader::SelectMode +dds::sub::detail::DataReader::Selector::get_mode() const +{ + return this->mode; +} + +template +dds::sub::detail::DataReader::ManipulatorSelector::ManipulatorSelector(typename DataReader::ref_type dr) : + Selector(dr), read_mode_(true) +{ +} + +template +bool +dds::sub::detail::DataReader::ManipulatorSelector::read_mode() +{ + return read_mode_; +} + +template +void +dds::sub::detail::DataReader::ManipulatorSelector::read_mode(bool b) +{ + read_mode_ = b; +} + +template +typename dds::sub::detail::DataReader::ManipulatorSelector& +dds::sub::detail::DataReader::ManipulatorSelector::operator >>(dds::sub::LoanedSamples& samples) +{ + if(read_mode_) + { + samples = this->Selector::read(); + } + else + { + samples = this->Selector::take(); + } + return *this; +} + + +template +dds::sub::LoanedSamples +dds::sub::detail::DataReader::read(const Selector& selector) +{ + dds::sub::LoanedSamples samples; + dds::sub::detail::LoanedSamplesHolder holder(samples); + + switch(selector.mode) { + case SELECT_MODE_READ: + this->AnyDataReaderDelegate::loaned_read(static_cast(this->ddsc_entity), + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_INSTANCE: + this->AnyDataReaderDelegate::loaned_read_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_NEXT_INSTANCE: + this->AnyDataReaderDelegate::loaned_read_next_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_NEXT_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + } + + return samples; +} + +template +dds::sub::LoanedSamples +dds::sub::detail::DataReader::take(const Selector& selector) +{ + dds::sub::LoanedSamples samples; + dds::sub::detail::LoanedSamplesHolder holder(samples); + + switch(selector.mode) { + case SELECT_MODE_READ: + this->AnyDataReaderDelegate::loaned_take(static_cast(this->ddsc_entity), + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_INSTANCE: + this->AnyDataReaderDelegate::loaned_take_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_NEXT_INSTANCE: + this->AnyDataReaderDelegate::loaned_take_next_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_NEXT_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + } + + return samples; +} + +// --- Forward Iterators: --- // + +template +template +uint32_t +dds::sub::detail::DataReader::read(SamplesFWIterator samples, + uint32_t max_samples, const Selector& selector) +{ + dds::sub::detail::SamplesFWInteratorHolder holder(samples); + max_samples = std::min(max_samples, selector.max_samples_); + + switch(selector.mode) { + case SELECT_MODE_READ: + this->AnyDataReaderDelegate::read(static_cast(this->ddsc_entity), + selector.state_filter_, + holder, + max_samples); + break; + case SELECT_MODE_READ_INSTANCE: + this->AnyDataReaderDelegate::read_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + max_samples); + break; + case SELECT_MODE_READ_NEXT_INSTANCE: + this->AnyDataReaderDelegate::read_next_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + max_samples); + break; + case SELECT_MODE_READ_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_NEXT_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + } + + return holder.get_length(); +} + +template +template +uint32_t +dds::sub::detail::DataReader::take(SamplesFWIterator samples, + uint32_t max_samples, const Selector& selector) +{ + dds::sub::detail::SamplesFWInteratorHolder holder(samples); + max_samples = std::min(max_samples, selector.max_samples_); + + switch(selector.mode) { + case SELECT_MODE_READ: + this->AnyDataReaderDelegate::take(static_cast(this->ddsc_entity), + selector.state_filter_, + holder, + max_samples); + break; + case SELECT_MODE_READ_INSTANCE: + this->AnyDataReaderDelegate::take_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + max_samples); + break; + case SELECT_MODE_READ_NEXT_INSTANCE: + this->AnyDataReaderDelegate::take_next_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + max_samples); + break; + case SELECT_MODE_READ_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_NEXT_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + } + + return holder.get_length(); +} + +// --- Back-Inserting Iterators: --- // + +template +template +uint32_t +dds::sub::detail::DataReader::read(SamplesBIIterator samples, const Selector& selector) +{ + dds::sub::detail::SamplesBIIteratorHolder holder(samples); + + switch(selector.mode) { + case SELECT_MODE_READ: + this->AnyDataReaderDelegate::read(static_cast(this->ddsc_entity), + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_INSTANCE: + this->AnyDataReaderDelegate::read_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_NEXT_INSTANCE: + this->AnyDataReaderDelegate::read_next_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_NEXT_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + } + + return holder.get_length(); +} + +template +template +uint32_t +dds::sub::detail::DataReader::take(SamplesBIIterator samples, const Selector& selector) +{ + dds::sub::detail::SamplesBIIteratorHolder holder(samples); + + switch(selector.mode) { + case SELECT_MODE_READ: + this->AnyDataReaderDelegate::take(static_cast(this->ddsc_entity), + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_INSTANCE: + this->AnyDataReaderDelegate::take_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_NEXT_INSTANCE: + this->AnyDataReaderDelegate::take_next_instance(static_cast(this->ddsc_entity), + selector.handle, + selector.state_filter_, + holder, + selector.max_samples_); + break; + case SELECT_MODE_READ_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + case SELECT_MODE_READ_NEXT_INSTANCE_WITH_CONDITION: + /* When SQL queries and QueryContitions are supported, then + * create a QueryContitions from the Query and Reader status_filter_. + * Use the resulting condition entity to read. */ + break; + } + + return holder.get_length(); +} + + +namespace dds +{ +namespace sub +{ + +template +SELECTOR& read(SELECTOR& selector) +{ + selector.read_mode(true); + return selector; +} + +template +SELECTOR& take(SELECTOR& selector) +{ + selector.read_mode(false); + return selector; +} + +inline dds::sub::functors::MaxSamplesManipulatorFunctor +max_samples(uint32_t n) +{ + return dds::sub::functors::MaxSamplesManipulatorFunctor(n); +} + +inline dds::sub::functors::ContentFilterManipulatorFunctor +content(const dds::sub::Query& query) +{ + return dds::sub::functors::ContentFilterManipulatorFunctor(query); +} + +inline dds::sub::functors::StateFilterManipulatorFunctor +state(const dds::sub::status::DataState& s) +{ + return dds::sub::functors::StateFilterManipulatorFunctor(s); +} + +inline dds::sub::functors::InstanceManipulatorFunctor +instance(const dds::core::InstanceHandle& h) +{ + return dds::sub::functors::InstanceManipulatorFunctor(h); +} + +inline dds::sub::functors::NextInstanceManipulatorFunctor +next_instance(const dds::core::InstanceHandle& h) +{ + return dds::sub::functors::NextInstanceManipulatorFunctor(h); +} + +} +} + +template +void dds::sub::detail::DataReader::on_requested_deadline_missed(dds_entity_t, + org::eclipse::cyclonedds::core::RequestedDeadlineMissedStatusDelegate &sd) +{ + dds::core::status::RequestedDeadlineMissedStatus s; + s.delegate() = sd; + + dds::sub::DataReader dr = wrapper(); + + dds::sub::DataReaderListener *l = + reinterpret_cast *>(this->listener_get()); + l->on_requested_deadline_missed(dr, s); +} + +template +void dds::sub::detail::DataReader::on_requested_incompatible_qos(dds_entity_t, + org::eclipse::cyclonedds::core::RequestedIncompatibleQosStatusDelegate &sd) +{ + dds::core::status::RequestedIncompatibleQosStatus s; + s.delegate() = sd; + + dds::sub::DataReader dr = wrapper(); + + dds::sub::DataReaderListener *l = + reinterpret_cast *>(this->listener_get()); + l->on_requested_incompatible_qos(dr, s); +} + +template +void dds::sub::detail::DataReader::on_sample_rejected(dds_entity_t, + org::eclipse::cyclonedds::core::SampleRejectedStatusDelegate &sd) +{ + dds::core::status::SampleRejectedStatus s; + s.delegate() = sd; + + dds::sub::DataReader dr = wrapper(); + + dds::sub::DataReaderListener *l = + reinterpret_cast *>(this->listener_get()); + l->on_sample_rejected(dr, s); +} + + +template +void dds::sub::detail::DataReader::on_liveliness_changed(dds_entity_t, + org::eclipse::cyclonedds::core::LivelinessChangedStatusDelegate &sd) +{ + dds::core::status::LivelinessChangedStatus s; + s.delegate() = sd; + + dds::sub::DataReader dr = wrapper(); + + dds::sub::DataReaderListener *l = + reinterpret_cast *>(this->listener_get()); + l->on_liveliness_changed(dr, s); +} + +template +void dds::sub::detail::DataReader::on_data_available(dds_entity_t) +{ + dds::sub::DataReader dr = wrapper(); + + dds::sub::DataReaderListener *l = + reinterpret_cast *>(this->listener_get()); + l->on_data_available(dr); +} + +template +void dds::sub::detail::DataReader::on_subscription_matched(dds_entity_t, + org::eclipse::cyclonedds::core::SubscriptionMatchedStatusDelegate &sd) +{ + dds::core::status::SubscriptionMatchedStatus s; + s.delegate() = sd; + + dds::sub::DataReader dr = wrapper(); + + dds::sub::DataReaderListener *l = + reinterpret_cast *>(this->listener_get()); + l->on_subscription_matched(dr, s); +} + +template +void dds::sub::detail::DataReader::on_sample_lost(dds_entity_t, + org::eclipse::cyclonedds::core::SampleLostStatusDelegate &sd) +{ + dds::core::status::SampleLostStatus s; + s.delegate() = sd; + + dds::sub::DataReader dr = wrapper(); + + dds::sub::DataReaderListener *l = + reinterpret_cast *>(this->listener_get()); + l->on_sample_lost(dr, s); +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_SUB_TDATAREADER_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/TGenerationCountImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/TGenerationCountImpl.hpp new file mode 100644 index 0000000..5240033 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/TGenerationCountImpl.hpp @@ -0,0 +1,55 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_DETAIL_TGENERATIONCOUNT_IMPL_HPP_ +#define CYCLONEDDS_DDS_SUB_DETAIL_TGENERATIONCOUNT_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace sub +{ + +template +TGenerationCount::TGenerationCount() { } + +template +TGenerationCount::TGenerationCount(int32_t dgc, int32_t nwgc) + : dds::core::Value(dgc, nwgc) { } + +template +int32_t TGenerationCount::disposed() const +{ + return this->delegate().disposed(); +} + +template +inline int32_t TGenerationCount::no_writers() const +{ + return this->delegate().no_writers(); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_SUB_DETAIL_TGENERATIONCOUNT_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/TQueryImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/TQueryImpl.hpp new file mode 100644 index 0000000..10085af --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/TQueryImpl.hpp @@ -0,0 +1,136 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_DETAIL_QUERY_IMPL_HPP_ +#define CYCLONEDDS_DDS_SUB_DETAIL_QUERY_IMPL_HPP_ + +/** + * @file + */ + +// Implementation +#include + +template +dds::sub::TQuery::TQuery( + const dds::sub::AnyDataReader& dr, + const std::string& expression) : + dds::core::Reference(new DELEGATE(AnyDataReader(dr), expression)) +{ +} + +template +template +dds::sub::TQuery::TQuery( + const dds::sub::AnyDataReader& dr, + const std::string& expression, + const FWIterator& params_begin, + const FWIterator& params_end) : + dds::core::Reference(new DELEGATE(AnyDataReader(dr), expression)) +{ + for (FWIterator it = params_begin; it != params_end; ++it) { + add_parameter(*it); + } +} + +template +dds::sub::TQuery::TQuery( + const dds::sub::AnyDataReader& dr, + const std::string& expression, + const std::vector& params) : + dds::core::Reference(new DELEGATE(AnyDataReader(dr), expression, params)) +{ + +} + +template +const std::string& dds::sub::TQuery::expression() const +{ + return this->delegate()->expression(); +} + +template +void dds::sub::TQuery::expression(const std::string& expr) +{ + this->delegate()->expression(expr); +} + +/** + * Provides the begin iterator to the parameter list. + */ +template +typename dds::sub::TQuery::const_iterator dds::sub::TQuery::begin() const +{ + return this->delegate()->begin(); +} + +/** + * The end iterator to the parameter list. + */ +template +typename dds::sub::TQuery::const_iterator dds::sub::TQuery::end() const +{ + return this->delegate()->end(); +} + +/** + * Provides the begin iterator to the parameter list. + */ +template +typename dds::sub::TQuery::iterator dds::sub::TQuery::begin() +{ + return this->delegate()->begin(); +} + +/** + * The end iterator to the parameter list. + */ +template +typename dds::sub::TQuery::iterator dds::sub::TQuery::end() +{ + return this->delegate()->end(); +} + +template +template +void dds::sub::TQuery::parameters( + const FWIterator& begin, + const FWIterator end) +{ + for (FWIterator it = begin; it != end; ++it) { + add_parameter(*it); + } +} + +template +void dds::sub::TQuery::add_parameter( + const std::string& param) +{ + this->delegate()->add_parameter(param); +} + +template +uint32_t dds::sub::TQuery::parameters_length() const +{ + return this->delegate()->parameters_length(); +} + +template +const dds::sub::AnyDataReader& +dds::sub::TQuery::data_reader() const +{ + return this->delegate()->data_reader(); +} + + + + +#endif /* CYCLONEDDS_DDS_SUB_DETAIL_QUERY_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/TRankImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/TRankImpl.hpp new file mode 100644 index 0000000..b805c84 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/TRankImpl.hpp @@ -0,0 +1,59 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_DETAIL_TRANK_IMPL_HPP_ +#define CYCLONEDDS_DDS_SUB_DETAIL_TRANK_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace sub +{ + +template +TRank::TRank() { } + +template +TRank::TRank(int32_t s, int32_t a, int32_t ag) + : dds::core::Value(s, a, ag) { } + +template +int32_t TRank::absolute_generation() const +{ + return this->delegate().absolute_generation(); +} + +template +inline int32_t TRank::generation() const +{ + return this->delegate().generation(); +} + +template +inline int32_t TRank::sample() const +{ + return this->delegate().sample(); +} + +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_SUB_DETAIL_TRANK_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/TSampleImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/TSampleImpl.hpp new file mode 100644 index 0000000..cda3d41 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/TSampleImpl.hpp @@ -0,0 +1,66 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_TSAMPLE_HPP_ +#define CYCLONEDDS_DDS_SUB_TSAMPLE_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace sub +{ + +template class DELEGATE> +Sample::Sample() : dds::core::Value< DELEGATE >() {} + +template class DELEGATE> +Sample::Sample(const T& data, const SampleInfo& info) : dds::core::Value< DELEGATE >(data, info) { } + +template class DELEGATE> +Sample::Sample(const Sample& other) : dds::core::Value< DELEGATE >(other.delegate()) { } + +template class DELEGATE> +const typename Sample::DataType& Sample::data() const +{ + return this->delegate().data(); +} + +template class DELEGATE> +void Sample::data(const DataType& d) +{ + this->delegate().data(d); +} + +template class DELEGATE> +const SampleInfo& Sample::info() const +{ + return this->delegate().info(); +} + +template class DELEGATE> +void Sample::info(const SampleInfo& i) +{ + this->delegate().info(i); +} + +} +} +// End of implementation +#endif /* CYCLONEDDS_DDS_SUB_TSAMPLE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/TSampleInfoImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/TSampleInfoImpl.hpp new file mode 100644 index 0000000..08a5e02 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/TSampleInfoImpl.hpp @@ -0,0 +1,78 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_DETAIL_TSAMPLEINFO_IMPL_HPP_ +#define CYCLONEDDS_DDS_SUB_DETAIL_TSAMPLEINFO_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace sub +{ + +template +TSampleInfo::TSampleInfo() { } + +template +const dds::core::Time TSampleInfo::timestamp() const +{ + return this->delegate().timestamp(); +} + +template +const dds::sub::status::DataState TSampleInfo::state() const +{ + return this->delegate().state(); +} + +template +dds::sub::GenerationCount TSampleInfo::generation_count() const +{ + return this->delegate().generation_count(); +} + +template +dds::sub::Rank TSampleInfo::rank() const +{ + return this->delegate().rank(); +} + +template +bool TSampleInfo::valid() const +{ + return this->delegate().valid(); +} + +template +dds::core::InstanceHandle TSampleInfo::instance_handle() const +{ + return this->delegate().instance_handle(); +} + +template +dds::core::InstanceHandle TSampleInfo::publication_handle() const +{ + return this->delegate().publication_handle(); +} +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_SUB_DETAIL_TSAMPLEINFO_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/TSampleRefImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/TSampleRefImpl.hpp new file mode 100644 index 0000000..fbf9199 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/TSampleRefImpl.hpp @@ -0,0 +1,54 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_TSAMPLEREF_HPP_ +#define CYCLONEDDS_DDS_SUB_TSAMPLEREF_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace sub +{ + +template class DELEGATE> +SampleRef::SampleRef() : dds::core::Value< DELEGATE >() {} + +template class DELEGATE> +SampleRef::SampleRef(const T& data, const SampleInfo& info) : dds::core::Value< DELEGATE >(data, info) { } + +template class DELEGATE> +SampleRef::SampleRef(const SampleRef& other) : dds::core::Value< DELEGATE >(other.delegate()) { } + +template class DELEGATE> +const typename SampleRef::DataType& SampleRef::data() const +{ + return this->delegate().data(); +} + +template class DELEGATE> +const SampleInfo& SampleRef::info() const +{ + return this->delegate().info(); +} + +} +} +// End of implementation +#endif /* CYCLONEDDS_DDS_SUB_TSAMPLEREF_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/TSubscriberImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/TSubscriberImpl.hpp new file mode 100644 index 0000000..aa4731b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/TSubscriberImpl.hpp @@ -0,0 +1,121 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_TSUBSCRIBER_IMPL_HPP_ +#define CYCLONEDDS_DDS_SUB_TSUBSCRIBER_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace sub +{ + +template +TSubscriber::TSubscriber(const ::dds::domain::DomainParticipant& dp) + : ::dds::core::Reference(new DELEGATE(dp, + dp.default_subscriber_qos(), + NULL, + dds::core::status::StatusMask::none())) +{ + this->delegate()->init(this->impl_); +} + +template +TSubscriber::TSubscriber(const ::dds::domain::DomainParticipant& dp, + const dds::sub::qos::SubscriberQos& qos, + dds::sub::SubscriberListener* listener, + const dds::core::status::StatusMask& mask) + : ::dds::core::Reference(new DELEGATE(dp, qos, listener, mask)) +{ + this->delegate()->init(this->impl_); +} + +template +void TSubscriber::notify_datareaders() +{ + this->delegate()->notify_datareaders(); +} + +template +void TSubscriber::listener(Listener* listener, + const dds::core::status::StatusMask& event_mask) +{ + return this->delegate()->listener(listener, event_mask); +} + +template +typename TSubscriber::Listener* TSubscriber::listener() const +{ + return this->delegate()->listener(); +} + + +template +const dds::sub::qos::SubscriberQos& TSubscriber::qos() const +{ + return this->delegate()->qos(); +} + +template +void TSubscriber::qos(const dds::sub::qos::SubscriberQos& sqos) +{ + this->delegate()->qos(sqos); +} + +template +dds::sub::qos::DataReaderQos TSubscriber::default_datareader_qos() const +{ + return this->delegate()->default_datareader_qos(); +} + +template +TSubscriber& TSubscriber::default_datareader_qos( + const dds::sub::qos::DataReaderQos& qos) +{ + this->delegate()->default_datareader_qos(qos); + return *this; +} + +template +const dds::domain::DomainParticipant& TSubscriber::participant() const +{ + return this->delegate()->participant(); +} + +template +TSubscriber& TSubscriber::operator << (const dds::sub::qos::SubscriberQos& qos) +{ + this->qos(qos); + return *this; +} + +template +const TSubscriber& TSubscriber::operator >> (dds::sub::qos::SubscriberQos& qos) const +{ + qos = this->qos(); + return *this; +} + +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_SUB_TSUBSCRIBER_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/ddssub.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/ddssub.hpp new file mode 100644 index 0000000..e9e09d4 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/ddssub.hpp @@ -0,0 +1,21 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_SUB_PACKAGE_DETAIL_INCLUDE_HPP_ +#define OMG_DDS_SUB_PACKAGE_DETAIL_INCLUDE_HPP_ + +#include "dds/sub/detail/TDataReaderImpl.hpp" +#include "dds/sub/detail/TQueryImpl.hpp" +#include "dds/sub/detail/TSampleImpl.hpp" +#include "dds/sub/detail/TSampleRefImpl.hpp" +#include "dds/sub/cond/detail/TQueryConditionImpl.hpp" + +#endif /* OMG_DDS_SUB_PACKAGE_DETAIL_INCLUDE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/discovery.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/discovery.hpp new file mode 100644 index 0000000..f0dea5b --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/discovery.hpp @@ -0,0 +1,62 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DDS_SUB_DETAIL_DISCOVERY_HPP_ +#define CYCLONEDDS_DDS_SUB_DETAIL_DISCOVERY_HPP_ + +#include + +namespace dds +{ +namespace sub +{ + +template +void ignore(const dds::domain::DomainParticipant& dp, FwdIterator begin, FwdIterator end) +{ + (void)dp; + (void)begin; + (void)end; + ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported"); +} + +template +::dds::core::InstanceHandleSeq + matched_publications(const dds::sub::DataReader& dr) +{ + return dr.delegate()->matched_publications(); +} + +template +uint32_t +matched_publications(const dds::sub::DataReader& dr, + FwdIterator begin, uint32_t max_size) +{ + return dr.delegate()->matched_publications(begin, max_size); +} + +template +const dds::topic::PublicationBuiltinTopicData +matched_publication_data(const dds::sub::DataReader& dr, + const ::dds::core::InstanceHandle& h) +{ + return dr.delegate()->matched_publication_data(h); +} + +} +} +#endif /* CYCLONEDDS_DDS_SUB_DETAIL_DISCOVERY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/detail/find.hpp b/unitree_SDK/include/ddscxx/dds/sub/detail/find.hpp new file mode 100644 index 0000000..75447d4 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/detail/find.hpp @@ -0,0 +1,218 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_DETAIL_FIND_HPP_ +#define CYCLONEDDS_DDS_SUB_DETAIL_FIND_HPP_ + +/** + * @file + */ + +// Implementation +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +namespace dds +{ +namespace sub +{ + + + +namespace detail +{ + + +/********************************************************************* + * To be able to properly copy found readers into the given iterators + * (which are related to typed DataReaders or AnyDataReaders), we have + * to specialize the find() template functions. + * But template functions specialization is not supported by C++. So, + * we have to use these helper classes to get the specialization. + *********************************************************************/ + +typedef std::vector base_readers_vector; +typedef std::vector::iterator base_readers_iterator; + +/* + * Copy helper class for typed readers. + */ +template +class ReadersCopySpecialization +{ +public: + static + bool copy(base_readers_iterator base_iter, ITERATOR typed_iter) { + bool copied = false; + try { + /* Cast base reader to typed delegate: */ + typename READER::DELEGATE_REF_T reader_typed = + ::std::dynamic_pointer_cast(*base_iter); + READER dr(reader_typed); + if(dr != dds::core::null) + { + *typed_iter = dr; + copied = true; + } + } catch (...) { + /* Ignore, because subscriber can have returned readers that are of + * different types. */ + } + return copied; + } +}; + +/* + * Copy helper class for any readers. + */ +template +class ReadersCopySpecialization +{ +public: + static + bool copy(base_readers_iterator base_iter, ITERATOR any_iter) { + *any_iter = (*base_iter)->wrapper_to_any(); + return true; + } +}; + + +/* + * Copy helper class for list of readers. + */ +template +class ReadersCopy +{ +public: + static + uint32_t copy(base_readers_vector base_readers, + ITERATOR begin, + uint32_t max_size) + { + uint32_t size = 0; + base_readers_iterator iter; + for (iter = base_readers.begin(); (size < max_size) && (iter != base_readers.end()); ++iter) { + if (ReadersCopySpecialization::copy(iter, begin)) { + begin++; + size++; + } + } + return size; + } + + static + uint32_t copy(base_readers_vector base_readers, + ITERATOR begin) + { + uint32_t size = 0; + base_readers_iterator iter; + for (iter = base_readers.begin(); iter != base_readers.end(); ++iter) { + if (ReadersCopySpecialization::copy(iter, begin)) { + begin++; + size++; + } + } + return size; + } +}; + +} /* namespace detail */ + + + +template +uint32_t +find(const dds::sub::Subscriber& sub, + const std::string &topic_name, + FwdIterator begin, uint32_t max_size) +{ + uint32_t size = 0; + if (max_size > 0) { + detail::base_readers_vector base_readers; + base_readers = sub.delegate()->find_datareaders(topic_name); + size = detail::ReadersCopy::copy(base_readers, begin, max_size); + } + return size; +} + +template +uint32_t +find(const dds::sub::Subscriber& sub, + const std::string &topic_name, + BinIterator begin) +{ + uint32_t size = 0; + detail::base_readers_vector base_readers; + base_readers = sub.delegate()->find_datareaders(topic_name); + size = detail::ReadersCopy::copy(base_readers, begin); + return size; +} + +template +uint32_t +find(const dds::sub::Subscriber& sub, + const dds::topic::TopicDescription& topic_description, + FwdIterator begin, uint32_t max_size) +{ + return find(sub, topic_description.name(), begin, max_size); +} + +template +uint32_t +find(const dds::sub::Subscriber& sub, + const dds::topic::TopicDescription& topic_description, + BinIterator begin) +{ + return find(sub, topic_description.name(), begin); +} + +template +uint32_t +find(const dds::sub::Subscriber& sub, + const dds::sub::status::DataState& rs, + FwdIterator begin, uint32_t max_size) +{ + uint32_t size = 0; + if (max_size > 0) { + detail::base_readers_vector base_readers; + base_readers = sub.delegate()->get_datareaders(rs); + size = detail::ReadersCopy::copy(base_readers, begin, max_size); + } + return size; +} + +template +uint32_t +find(const dds::sub::Subscriber& sub, + const dds::sub::status::DataState& rs, + BinIterator begin) +{ + uint32_t size = 0; + detail::base_readers_vector base_readers; + base_readers = sub.delegate()->get_datareaders(rs); + size = detail::ReadersCopy::copy(base_readers, begin); + return size; +} + +} +} + +#endif /* CYCLONEDDS_DDS_SUB_DETAIL_FIND_HPP_ */ + diff --git a/unitree_SDK/include/ddscxx/dds/sub/discovery.hpp b/unitree_SDK/include/ddscxx/dds/sub/discovery.hpp new file mode 100644 index 0000000..822e9fd --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/discovery.hpp @@ -0,0 +1,186 @@ +#ifndef OMG_DDS_SUB_DISCOVERY_HPP_ +#define OMG_DDS_SUB_DISCOVERY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include + +namespace dds +{ +namespace sub +{ + +/** + * Ignore subscriptions. + * + * This operation is not yet implemented. It is scheduled for a future release. + * + * @param dp the DomainParticipant for which the remote + * entity will be ignored + * + * @param handle the InstanceHandle of the remote entity that + * has to be ignored + */ +void OMG_DDS_API ignore(const dds::domain::DomainParticipant& dp, + const dds::core::InstanceHandle& handle); + +/** + * Ignore subscriptions. + * + * This operation is not yet implemented. It is scheduled for a future release. + * + * @param dp the DomainParticipant for which the remote + * entity will be ignored + * + * @param begin the start of the range to be ignored + * + * @param end the end of the range to be ignored + */ +template +void ignore(const dds::domain::DomainParticipant& dp, FwdIterator begin, FwdIterator end); + + +//========================================================================== +//== Discovery Management +/** + * This operation retrieves the list of publications currently "associated" with the + * DataReader. That is, subscriptions that have a matching Topic and compatible + * QoS that the application has not indicated should be “ignored” by means of the + * ignore_publication operation on the DomainParticipant. + * + * The handles returned in the dds::core::InstanceHandleSeq are the ones that are + * used by the DDS implementation to locally identify the corresponding matched + * DataWriter entities. You can access more detailed information about a particular + * publication by passing its publication_handle to either the + * dds::sub::matched_publication_data operation or to the read with instance + * operation on the built-in reader for the “DCPSPublication” topic. + * + * See @ref DCPS_Builtin_Topics "Builtin Topics" for more information. + * + * @param dr the DataReader + * @return a sequence of handles + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + * @throws dds::core::UnsupportedError + * OpenSplice is configured not to maintain the + * information about “associated” subscriptions. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ +template +::dds::core::InstanceHandleSeq +matched_publications(const dds::sub::DataReader& dr); + +/** + * This operation retrieves the list of publications currently "associated" with the + * DataReader. That is, subscriptions that have a matching Topic and compatible + * QoS that the application has not indicated should be “ignored” by means of the + * ignore_publication operation on the DomainParticipant. + * + * The handles returned in the dds::core::InstanceHandleSeq are the ones that are + * used by the DDS implementation to locally identify the corresponding matched + * DataWriter entities. You can access more detailed information about a particular + * publication by passing its publication_handle to either the + * dds::sub::matched_publication_data operation or to the read with instance + * operation on the built-in reader for the “DCPSPublication” topic. + * + * See @ref DCPS_Builtin_Topics "Builtin Topics" for more information. + * + * @param dr the DataReader + * @param begin an iterator indicating the beginning of a sequence of + * instance handles in which to put the matched subscriptions + * @param max_size the maximum number of matched subscriptions to return + * @return the number of matched subscriptions returned + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + * @throws dds::core::UnsupportedError + * OpenSplice is configured not to maintain the + * information about “associated” subscriptions. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ +template +uint32_t +matched_publications(const dds::sub::DataReader& dr, + FwdIterator begin, uint32_t max_size); + +/** + * This operation retrieves information on the specified publication that is currently + * “associated” with the DataReader. That is, a publication with a matching Topic + * and compatible QoS that the application has not indicated should be “ignored” by + * means of the ignore_publication operation on the DomainParticipant. + * The publication_handle must correspond to a publication currently associated + * with the DataReader, otherwise the operation will fail and throw + * InvalidArgumentError. The operation dds::sub::matched_publications can + * be used to find the publications that are currently matched with the DataReader. + * + * The operation may fail if the infrastructure does not locally maintain the + * connectivity information. This is the case when OpenSplice is configured not to + * maintain discovery information in the Networking Service. (See the description for + * the NetworkingService/Discovery/enabled property in the Deployment + * Manual for more information about this subject.) In such cases the operation will + * throw UnsupportedError. + * + * See also @ref DCPS_Builtin_Topics and @ref DCPS_Builtin_Topics_PublicationData. + * + * @param dr the DataReader + * @param h the InstanceHandle + * @return the PublicationBuiltinTopicData + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::NotEnabledError + * The DataReader has not yet been enabled. + * @throws dds::core::UnsupportedError + * OpenSplice is configured not to maintain the + * information about “associated” subscriptions. + * @throws dds::core::InvalidArgumentError + * Publication not associated with the DataReader. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ +template +const dds::topic::PublicationBuiltinTopicData +matched_publication_data(const dds::sub::DataReader& dr, + const ::dds::core::InstanceHandle& h); + +} +} +#endif /* OMG_DDS_SUB_DISCOVERY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/find.hpp b/unitree_SDK/include/ddscxx/dds/sub/find.hpp new file mode 100644 index 0000000..b4a69ca --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/find.hpp @@ -0,0 +1,217 @@ +#ifndef OMG_DDS_SUB_FIND_HPP_ +#define OMG_DDS_SUB_FIND_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +#include + +namespace dds +{ +namespace sub +{ + +/** + * This operation returns the built-in Subscriber associated with the given + * given DomainParticipant. + * + * Each DomainParticipant contains several built-in + * Topic objects. The built-in Subscriber contains the corresponding DataReader + * objects to access them. All these DataReader objects belong to a single built-in + * Subscriber. Note that there is exactly one built-in Subscriber associated with + * each DomainParticipant. + * + * See @ref DCPS_Builtin_Topics "Builtin Topics" for more information. + * + * @param dp the domain participant + * @return the built-in Subscriber + */ +const dds::sub::Subscriber OMG_DDS_API +builtin_subscriber(const dds::domain::DomainParticipant& dp); + +/** + * This function retrieves a previously-created DataReader + * belonging to the Subscriber that is attached to a Topic with a + * matching topic_name. If no such DataReader exists, the operation + * will return an empty container. + * + * The use of this + * operation on the built-in Subscriber allows access to the + * built-in DataReader entities for the built-in topics + * (see @ref DCPS_Builtin_Topics "Builtin Topics"). + * + * @param sub the Subscriber for which to find a DataReader + * @param topic_name the topic name to find + * @param begin a forward iterator pointing to the start of a + * container in which to put the DataReaders + * @param max_size the number of DataReaders to return + * @return the total number of elements returned. Notice that + * at most max_size will be copied using the provided iterator + * + */ +template +uint32_t +find(const dds::sub::Subscriber& sub, + const std::string &topic_name, + FwdIterator begin, uint32_t max_size); + +/** + * This function retrieves a previously-created DataReader + * belonging to the Subscriber that is attached to a Topic with a + * matching topic_name. If no such DataReader exists, the operation + * will return an empty container. + * + * The use of this + * operation on the built-in Subscriber allows access to the + * built-in DataReader entities for the built-in topics + * (see @ref DCPS_Builtin_Topics "Builtin Topics"). + * + * @param sub the Subscriber for which to find a DataReader + * @param topic_name the topic name to find + * @param begin a back inserting iterator pointing to the start of a + * container in which to put the DataReaders + * @return the total number of elements returned + */ +template +uint32_t +find(const dds::sub::Subscriber& sub, + const std::string &topic_name, + BinIterator begin); + +/** + * This function retrieves a previously-created DataReader + * belonging to the Subscriber that is attached to a Topic with a + * matching topic_name. If no such DataReader exists, the operation + * will return an empty container. + * + * The use of this + * operation on the built-in Subscriber allows access to the + * built-in DataReader entities for the built-in topics + * (see @ref DCPS_Builtin_Topics "Builtin Topics"). + * + * @param sub the Subscriber for which to find a DataReader + * @param topic_description the topic description to find + * @param begin a forward iterator pointing to the start of a + * container in which to put the DataReaders + * @param max_size the number of DataReaders to return + * @return the total number of elements returned. Notice that + * at most max_size will be copied using the provided iterator + */ +template +uint32_t +find(const dds::sub::Subscriber& sub, + const dds::topic::TopicDescription& topic_description, + FwdIterator begin, uint32_t max_size); + +/** + * This function retrieves a previously-created DataReader + * belonging to the Subscriber that is attached to a Topic with a + * matching topic_name. If no such DataReader exists, the operation + * will return an empty container. + * + * The use of this + * operation on the built-in Subscriber allows access to the + * built-in DataReader entities for the built-in topics + * (see @ref DCPS_Builtin_Topics "Builtin Topics"). + * + * @param sub the Subscriber for which to find a DataReader + * @param topic_description the topic description to find + * @param begin a back inserting iterator pointing to the start of a + * container in which to put the DataReaders + * @return the total number of elements returned + */ +template +uint32_t +find(const dds::sub::Subscriber& sub, + const dds::topic::TopicDescription& topic_description, + BinIterator begin); + +/** + * This operation allows the application to access the DataReader objects that contain + * samples with the specified sample_states, view_states, and + * instance_states. + * + * If the Presentation QosPolicy of the Subscriber to which the DataReader + * belongs has the access_scope set to ‘GROUP’, this operation should only be + * invoked inside a begin_access/end_access block. Otherwise it will throw + * error PreconditionNotMetError. + * + * Depending on the setting of the dds::core::policy::Presentation QoSPolicy, + * the returned collection of DataReader objects may be: + * - a ‘set’ containing each DataReader at most once in no specified order, + * - a ‘list’ containing each DataReader one or more times in a specific order. + * + * This difference is due to the fact that, in the second situation it is required to access + * samples belonging to different DataReader objects in a particular order. In this case, + * the application should process each DataReader in the same order it appears in the + * ‘list’ and read or take exactly one sample from each DataReader. The patterns that + * an application should use to access data is fully described in dds::core::policy::Presentation. + * + * @param sub the Subscriber for which to find a DataReader + * @param data_state the data_state to find + * @param begin a forward iterator pointing to the start of a + * container in which to put the DataReaders + * @param max_size the number of DataReaders to return + * @return the total number of elements returned. Notice that + * at most max_size will be copied using the provided iterator + */ +template +uint32_t +find(const dds::sub::Subscriber& sub, + const dds::sub::status::DataState& data_state, + FwdIterator begin, uint32_t max_size); + +/** + * This operation allows the application to access the DataReader objects that contain + * samples with the specified sample_states, view_states, and + * instance_states. + * + * If the Presentation QosPolicy of the Subscriber to which the DataReader + * belongs has the access_scope set to ‘GROUP’, this operation should only be + * invoked inside a begin_access/end_access block. Otherwise it will throw + * error PreconditionNotMetError. + * + * Depending on the setting of the dds::core::policy::Presentation QoSPolicy, + * the returned collection of DataReader objects may be: + * - a ‘set’ containing each DataReader at most once in no specified order, + * - a ‘list’ containing each DataReader one or more times in a specific order. + * + * This difference is due to the fact that, in the second situation it is required to access + * samples belonging to different DataReader objects in a particular order. In this case, + * the application should process each DataReader in the same order it appears in the + * ‘list’ and read or take exactly one sample from each DataReader. The patterns that + * an application should use to access data is fully described in dds::core::policy::Presentation. + * + * @param sub the Subscriber for which to find a DataReader + * @param rs the data_state to find + * @param begin a back inserting iterator pointing to the start + * of a container in which to put the DataReaders + * @return the total number of elements returned + */ +template +uint32_t +find(const dds::sub::Subscriber& sub, + const dds::sub::status::DataState& rs, + BinIterator begin); + +} +} + +#endif /* OMG_DDS_SUB_FIND_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/qos/DataReaderQos.hpp b/unitree_SDK/include/ddscxx/dds/sub/qos/DataReaderQos.hpp new file mode 100644 index 0000000..f102264 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/qos/DataReaderQos.hpp @@ -0,0 +1,35 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_SUB_QOS_DATA_READER_QOS_HPP_ +#define OMG_DDS_SUB_QOS_DATA_READER_QOS_HPP_ + +#include + +namespace dds +{ +namespace sub +{ +namespace qos +{ +typedef dds::sub::qos::detail::DataReaderQos DataReaderQos; +} +} +} + + +#endif /* OMG_DDS_SUB_QOS_DATA_READER_QOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/qos/SubscriberQos.hpp b/unitree_SDK/include/ddscxx/dds/sub/qos/SubscriberQos.hpp new file mode 100644 index 0000000..6d0d9bc --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/qos/SubscriberQos.hpp @@ -0,0 +1,36 @@ +#ifndef OMG_DDS_SUB_QOS_SUBSCRIBER_QOS_HPP_ +#define OMG_DDS_SUB_QOS_SUBSCRIBER_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace sub +{ +namespace qos +{ +typedef dds::sub::qos::detail::SubscriberQos SubscriberQos; +} +} +} + + +#endif /* OMG_DDS_SUB_QOS_SUBSCRIBER_QOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/qos/detail/DataReaderQos.hpp b/unitree_SDK/include/ddscxx/dds/sub/qos/detail/DataReaderQos.hpp new file mode 100644 index 0000000..33170b6 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/qos/detail/DataReaderQos.hpp @@ -0,0 +1,150 @@ +#ifndef OMG_DDS_SUB_QOS_DETAIL_DATA_READER_QOS_HPP_ +#define OMG_DDS_SUB_QOS_DETAIL_DATA_READER_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +#ifdef DOXYGEN_FOR_ISOCPP +/* The above macro is never (and must never) be defined in normal compilation. + * + * The class below is just used to create informative API documentation. + * The predoxygen.py script will copy this over the QoS API header file. + */ +/** + * @brief + * This class provides the basic mechanism for an application to specify Quality of + * Service attributes for a DataReader. + * + * @par Attributes + * @anchor anchor_dds_sub_datareader_qos_defaults + * QosPolicy | Desciption | Default Value + * ---------------------------------------------- | ----------------------------------------------------------------------------------- | -------------------- + * dds::core::policy::Durability | Data storage settings for late joiners (@ref DCPS_QoS_Durability "info") | Durability::Volatile() + * dds::core::policy::Deadline | Period in which new sample is written (@ref DCPS_QoS_Deadline "info") | Deadline::Deadline(infinite) + * dds::core::policy::LatencyBudget | Used for optimization (@ref DCPS_QoS_LatencyBudget "info") | LatencyBudget::LatencyBudget(zero) + * dds::core::policy::Liveliness | Liveliness assertion mechanism (@ref DCPS_QoS_Liveliness "info") | Liveliness::Automatic() + * dds::core::policy::Reliability | Reliability settings (@ref DCPS_QoS_Reliability "info") | Reliability::BestEffort() + * dds::core::policy::DestinationOrder | DataReader data order settings (@ref DCPS_QoS_DestinationOrder "info") | DestinationOrder::ReceptionTimestamp() + * dds::core::policy::History | Data storage settings (@ref DCPS_QoS_History "info") | History::KeepLast(depth 1) + * dds::core::policy::ResourceLimits | Maximum resource settings (@ref DCPS_QoS_ResourceLimits "info") | ResourceLimits::ResourceLimits(all unlimited) + * dds::core::policy::UserData | Additional information (@ref DCPS_QoS_UserData "info") | UserData::UserData(empty) + * dds::core::policy::Ownership | Exclusive ownership or not (@ref DCPS_QoS_Ownership "info") | Ownership::Shared() + * dds::core::policy::TimeBasedFilter | Maximum data rate (@ref DCPS_QoS_TimeBasedFilter "info") | TimeBasedFilter::TimeBasedFilter(0) + * dds::core::policy::ReaderDataLifecycle | Instance state changes and notifications (@ref DCPS_QoS_ReaderDataLifecycle "info") | ReaderDataLifecycle::NoAutoPurgeDisposedSamples() + * dds::core::policy::DataRepresentation | Supported data representation kinds (@ref DCPS_QoS_DataRepresentation "info") | DataRepresentation::DataRepresentation(dds::core::policy::DataRepresentationId::XCDR1) + * dds::core::policy::TypeConsistencyEnforcement | Type consistency enforcement policies (@ref DCPS_QoS_TypeConsistencyEnforcement "info") | dds::core::policy::TypeConsistencyKind::DISALLOW_TYPE_COERCION + * + * A QosPolicy can be set when the DataReader is created or modified with the set + * qos operation. + * Both operations take the DataReaderQos object as a parameter. There may be cases + * where several policies are in conflict. Consistency checking is performed each time + * the policies are modified when they are being created and, in case they are already + * enabled, via the set qos operation. + * + * Some QosPolicy have "immutable" semantics meaning that they can only be + * specified either at DataReader creation time or prior to calling the enable + * operation on the DataReader. + * + * @see for more information: @ref DCPS_QoS + */ +class dds::sub::qos::DataReaderQos : public ::dds::core::EntityQos +{ +public: + /** + * Create a @ref anchor_dds_sub_datareader_qos_defaults "default" QoS. + */ + DataReaderQos() {} + + /** + * Create copied QoS. + * + * @param qos the QoS to copy policies from. + */ + DataReaderQos(const DataReaderQos& qos); + + /** + * Create a DataReader QoS from a TopicQos. + * + * This operation will copy the QosPolicy settings from the TopicQos to the + * corresponding QosPolicy settings in the DataReaderQos. The related value + * in DataReaderQos will be repliced, while the other policies will get the + * @ref anchor_dds_sub_datareader_qos_defaults "default" QoS policies. + * + * This is a "convenience" operation. It can be used to merge + * @ref anchor_dds_sub_datareader_qos_defaults "default" DataReader + * QosPolicy settings with the corresponding ones on the Topic. The resulting + * DataReaderQos can then be used to create a new DataReader, or set its + * DataReaderQos. + * @code{.cpp} + * dds::topic::qos::TopicQos topicQos = topic.qos(); + * dds::sub::qos::DataReaderQos readerQos(topicQos); + * // Policies of the DataReaderQos that are not present in the TopicQos + * // have the default value. + * @endcode + * + * This operation does not check the resulting DataReaderQos for self + * consistency. This is because the "merged" DataReaderQos may not be the + * final one, as the application can still modify some QosPolicy settings prior to + * applying the DataReaderQos to the DataReader. + * + * @param qos the QoS to copy policies from. + */ + DataReaderQos(const dds::topic::qos::TopicQos& qos); + + /** + * Assign dds::topic::qos::TopicQos policies to the DataReaderQos. + * + * This operation will copy the QosPolicy settings from the TopicQos to the + * corresponding QosPolicy settings in the DataReaderQos (replacing the values, + * if present). + * + * This is a "convenience" operation, useful in combination with the operations + * Subscriber::default_datareader_qos() and dds::topic::Topic::qos(). + * This operation can be used to merge the DataReader + * QosPolicy settings with the corresponding ones on the Topic. The resulting + * DataReaderQos can then be used to create a new DataReader, or set its + * DataReaderQos. + * @code{.cpp} + * dds::topic::qos::TopicQos topicQos = topic.qos(); + * dds::sub::qos::DataReaderQos readerQos = subscriber.default_datareader_qos(); + * readerQos = topicQos; + * // Policies of the DataReaderQos that are not present in the TopicQos are untouched. + * @endcode + * + * This operation does not check the resulting DataReaderQos for self + * consistency. This is because the "merged" DataReaderQos may not be the + * final one, as the application can still modify some QosPolicy settings prior to + * applying the DataReaderQos to the DataReader. + * + * @param qos the QoS to copy policies from. + */ + DataReaderQos& operator= (const dds::topic::qos::TopicQos& other); +}; + +#else /* DOXYGEN_FOR_ISOCPP */ + +namespace dds { namespace sub { namespace qos { namespace detail { + typedef ::dds::core::TEntityQos< ::org::eclipse::cyclonedds::sub::qos::DataReaderQosDelegate > DataReaderQos; +} } } } + +#endif /* DOXYGEN_FOR_ISOCPP */ + +#endif /* OMG_DDS_SUB_QOS_DETAIL_DATA_READER_QOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/qos/detail/SubscriberQos.hpp b/unitree_SDK/include/ddscxx/dds/sub/qos/detail/SubscriberQos.hpp new file mode 100644 index 0000000..5c3953f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/qos/detail/SubscriberQos.hpp @@ -0,0 +1,82 @@ +#ifndef OMG_DDS_SUB_QOS_DETAIL_SUBSCRIBER_QOS_HPP_ +#define OMG_DDS_SUB_QOS_DETAIL_SUBSCRIBER_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +#ifdef DOXYGEN_FOR_ISOCPP +/* The above macro is never (and must never) be defined in normal compilation. + * + * The class below is just used to create informative API documentation. + * The predoxygen.py script will copy this over the QoS API header file. + */ +/** + * @brief + * This class provides the basic mechanism for an application to specify Quality of + * Service attributes for a Subscriber. + * + * @par Attributes + * @anchor anchor_dds_sub_subscriber_qos_defaults + * QosPolicy | Desciption | Default Value + * ------------------------------------ | --------------------------------------------------------------------- | -------------------- + * dds::core::policy::Presentation | Data-instance change dependencies (@ref DCPS_QoS_Presentation "info") | Presentation::InstanceAccessScope(coherent=false, ordered=false) + * dds::core::policy::Partition | Active partitions (@ref DCPS_QoS_Partition "info") | Partition::Partition(empty) + * dds::core::policy::GroupData | Additional information (@ref DCPS_QoS_GroupData "info") | GroupData::GroupData(empty) + * dds::core::policy::EntityFactory | Create enabled (@ref DCPS_QoS_EntityFactory "info") | EntityFactory::AutoEnable() + * + * A QosPolicy can be set when the Subscriber is created or modified with the set qos + * operation. + * Both operations take the SubscriberQos object as a parameter. There may be cases where + * several policies are in conflict. Consistency checking is performed each time the + * policies are modified when they are being created and, in case they are already + * enabled, via the set qos operation. + * + * Some QosPolicy have "immutable" semantics meaning that they can only be + * specified either at Subscriber creation time or prior to calling the enable operation + * on the Subscriber. + * + * @see for more information: @ref DCPS_QoS + */ +class dds::sub::qos::SubscriberQos : public ::dds::core::EntityQos +{ +public: + /** + * Create @ref anchor_dds_sub_subscriber_qos_defaults "default" QoS. + */ + SubscriberQos() {} + + /** + * Create copied QoS type. + * + * @param qos the QoS to copy policies from. + */ + SubscriberQos(const SubscriberQos& qos); +}; + +#else /* DOXYGEN_FOR_ISOCPP */ + +namespace dds { namespace sub { namespace qos { namespace detail { + typedef ::dds::core::TEntityQos< ::org::eclipse::cyclonedds::sub::qos::SubscriberQosDelegate> SubscriberQos; +} } } } + +#endif /* DOXYGEN_FOR_ISOCPP */ + +#endif /* OMG_DDS_SUB_QOS_DETAIL_SUBSCRIBER_QOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/status/DataState.hpp b/unitree_SDK/include/ddscxx/dds/sub/status/DataState.hpp new file mode 100644 index 0000000..d17f020 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/status/DataState.hpp @@ -0,0 +1,711 @@ +#ifndef OMG_DDS_SUB_DATA_STATE_HPP_ +#define OMG_DDS_SUB_DATA_STATE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +#include + + +namespace dds +{ +namespace sub +{ +namespace status +{ +class SampleState; +class ViewState; +class InstanceState; +class DataState; +} +} +} + +/** + * @brief + * Class to hold SampleState information. + * + * For each sample, the Data Distribution Service internally maintains a + * sample_state specific to each DataReader. The sample_state can either be + * READ_SAMPLE_STATE or NOT_READ_SAMPLE_STATE. + * - read + * - The DataReader has already accessed that + * sample by means of read. Had the sample been accessed by take it would + * no longer be available to the DataReader. + * - not_read + * - The DataReader has not accessed that sample before. + * + * @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo" + */ +class OMG_DDS_API dds::sub::status::SampleState : public std::bitset +{ +public: + /** + * Convenience typedef for std::bitset. + */ + typedef std::bitset MaskType; + +public: + /** + * Construct a SampleState with default MaskType. + */ + SampleState(); + + /** + * Construct a SampleState with MaskType of i. + * + * @param i MaskType + */ + explicit SampleState(uint32_t i); + + /** + * Copy constructor. + * Construct a SampleState with existing SampleState. + * + * @param src the SampleState to copy from + */ + SampleState(const SampleState& src); + + /** + * Copy assignment operator. + * + * Copy the contents from one SampleState to another. + * + * @param src the SampleState to copy from + * + * @return reference to the SampleState instance that was copied to + */ + SampleState& operator=(const SampleState& src) = default; + + /** + * Construct a SampleState with existing MaskType. + * + * @param src the MaskType to copy from + */ + SampleState(const MaskType& src); + +public: + /** + * Get the READ_SAMPLE_STATE. + * + * read + * - The DataReader has already accessed that + * sample by means of read. Had the sample been accessed by take it would + * no longer be available to the DataReader. + * + * @return the read SampleState + */ + inline static const SampleState read(); + + /** + * Get the NOT_READ_SAMPLE_STATE. + * + *not_read + * - The DataReader has not accessed that sample before. + * + * @return the not_read SampleState + */ + inline static const SampleState not_read(); + + /** + * Get any SampleState. + * + * Either the sample has already been read or not read. + * + * @return any SampleState + */ + inline static const SampleState any(); +}; + + + +/** + * @brief + * Class to hold sample ViewState information. + * + * For each instance (identified by the key), the Data Distribution Service internally + * maintains a view_state relative to each DataReader. The ViewSate can + * either be NEW_VIEW_STATE or NOT_NEW_VIEW_STATE. + * - new_view + * - Either this is the first time that the DataReader + * has ever accessed samples of that instance, or else that the DataReader has + * accessed previous samples of the instance, but the instance has since been reborn + * (i.e. become not-alive and then alive again). + * - not_new_view + * - The DataReader has already accessed + * samples of the same instance and that the instance has not been reborn since. + * + * @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo" + */ +class OMG_DDS_API dds::sub::status::ViewState : public std::bitset +{ +public: + /** + * Convenience typedef for std::bitset. + */ + typedef std::bitset MaskType; + +public: + /** + * Construct a ViewState with default MaskType. + */ + ViewState(); + + /** + * Construct a ViewState with MaskType of i. + * + * @param m the MaskType + */ + explicit ViewState(uint32_t m); + + /** + * Copy constructor. + * + * Construct a ViewState with existing ViewState. + * + * @param src the ViewState to copy from + */ + ViewState(const ViewState& src); + + /** + * Copy assignment operator. + * + * Copy the contents from one ViewState to another. + * + * @param src the ViewState to copy from + * + * @return reference to the ViewState instance that was copied to + */ + ViewState& operator=(const ViewState& src) = default; + + /** + * Construct a ViewState with existing MaskType. + * + * @param src the MaskType to copy from + */ + ViewState(const MaskType& src); + +public: + /** + * Get the NEW_VIEW_STATE. + * + * new_view + * - Either this is the first time that the DataReader + * has ever accessed samples of that instance, or else that the DataReader has + * accessed previous samples of the instance, but the instance has since been reborn + * (i.e. become not-alive and then alive again). + * + * @return the new_view ViewState + */ + inline static const ViewState new_view(); + + /** + * Get the NOT_NEW_VIEW_STATE. + * + * not_new_view + * - The DataReader has already accessed + * samples of the same instance and that the instance has not been reborn since. + * + * @return the not_new_view ViewState + */ + inline static const ViewState not_new_view(); + + /** + * Get any ViewState. + * + * Either the sample has already been seen or not seen. + * + * @return the any ViewState + */ + inline static const ViewState any(); + +}; + + + +/** + * @brief + * Class to hold sample InstanceState information. + * + * For each instance the Data Distribution Service internally maintains an + * InstanceState. The InstanceState can be: + * - alive, which indicates that + * - samples have been received for the instance + * - there are live DataWriter objects writing the instance + * - the instance has not been explicitly disposed of (or else samples have been + * received after it was disposed of) + * - not_alive_disposed, which indicates that + * - the instance was disposed + * of by a DataWriter, either explicitly by means of the dispose operation or + * implicitly in case the autodispose_unregistered_instances field of the + * WriterDataLyfecycle QosPolicy equals TRUE when the instance gets + * unregistered, WriterDataLifecycle QosPolicy and no new + * samples for that instance have been written afterwards. + * - not_alive_no_writers, which indicates that + * - the instance has been + * declared as not-alive by the DataReader because it detected that there are no live + * DataWriter objects writing that instance. + * + * @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo" + */ +class OMG_DDS_API dds::sub::status::InstanceState : public std::bitset +{ +public: + /** + * Convenience typedef for std::bitset. + */ + typedef std::bitset MaskType; + +public: + /** + * Construct an InstanceState with no state flags set. + */ + InstanceState(); + + /** + * Construct an InstanceState with an uint32_t m, representing a bit array. + * + * @param m the bit array to initialize the bitset with + */ + explicit InstanceState(uint32_t m); + + /** + * Copy constructor. + * + * Construct an InstanceState with existing InstanceState. + * + * @param src the InstanceState to copy from + */ + InstanceState(const InstanceState& src); + + /** + * Copy assignment operator. + * + * Copy the contents from one InstanceState to another. + * + * @param src the InstanceState to copy from + * + * @return reference to the InstanceState instance that was copied to + */ + InstanceState& operator=(const InstanceState& src) = default; + + /** + * Construct an InstanceState with existing MaskType. + * + * @param src the bitset to copy from + */ + InstanceState(const MaskType& src); + +public: + /** + * Get ALIVE_INSTANCE_STATE. + * + * alive, which indicates that + * - samples have been received for the instance + * - there are live DataWriter objects writing the instance + * - the instance has not been explicitly disposed of (or else samples have been + * received after it was disposed of) + * + * @return the alive InstanceState + */ + inline static const InstanceState alive(); + + /** + * Get NOT_ALIVE_DISPOSED_INSTANCE_STATE. + * + * not_alive_disposed, which indicates that + * - the instance was disposed + * of by a DataWriter, either explicitly by means of the dispose operation or + * implicitly in case the autodispose_unregistered_instances field of the + * WriterDataLyfecycle QosPolicy equals TRUE when the instance gets + * unregistered, WriterDataLifecycle QosPolicy and no new + * samples for that instance have been written afterwards. + * + * @return the not_alive_disposed InstanceState + */ + inline static const InstanceState not_alive_disposed(); + + /** + * Get NOT_ALIVE_NO_WRITERS_INSTANCE_STATE. + * + * not_alive_no_writers, which indicates that + * - the instance has been + * declared as not-alive by the DataReader because it detected that there are no live + * DataWriter objects writing that instance. + * + * @return the not_alive_no_writers InstanceState + */ + inline static const InstanceState not_alive_no_writers(); + + /** + * Get not_alive mask + * + * not_alive = not_alive_disposed | not_alive_no_writers: + * - not_alive_disposed, which indicates that + * - the instance was disposed + * of by a DataWriter, either explicitly by means of the dispose operation or + * implicitly in case the autodispose_unregistered_instances field of the + * WriterDataLyfecycle QosPolicy equals TRUE when the instance gets + * unregistered, WriterDataLifecycle QosPolicy and no new + * samples for that instance have been written afterwards. + * - not_alive_no_writers, which indicates that + * - the instance has been + * declared as not-alive by the DataReader because it detected that there are no live + * DataWriter objects writing that instance. + * + * @return the not_alive_mask InstanceState + */ + inline static const InstanceState not_alive_mask(); + + /** + * Get any InstanceState. + * + * This Instance is either in existence or not in existence. + * + * @return the any InstanceState + */ + inline static const InstanceState any(); + +}; + + + +/** + * @brief + * Class to hold sample DataState information. + * + * The DataState is part of dds::sub::SampleInfo but can also be used as data filter for + * @ref dds::sub::DataReader "DataReaders". + * + * The DataState contains the following: + * - The sample_state of the Data value (i.e., if the sample has already been READ or NOT_READ by that same DataReader). + * - The view_state of the related instance (i.e., if the instance is NEW, or NOT_NEW for that DataReader). + * - The instance_state of the related instance (i.e., if the instance is ALIVE, NOT_ALIVE_DISPOSED, or NOT_ALIVE_NO_WRITERS). + * + * @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo" + */ +class OMG_DDS_API dds::sub::status::DataState +{ +public: + /** + * Create a DataState instance. + * + * Construct a DataState with: + * - SampleState::any + * - ViewState::any + * - InstanceState::any + * + */ + DataState() + : ss_(dds::sub::status::SampleState::any()), + vs_(dds::sub::status::ViewState::any()), + is_(dds::sub::status::InstanceState::any()) + { } + + /** + * Create a DataState instance. + * + * Construct a DataState with: + * - Given SampleState ss + * - ViewState::any + * - InstanceState::any + * + * @param ss the SampleState to construct DataState from + */ + /* implicit */ DataState(const dds::sub::status::SampleState& ss) + : ss_(ss), + vs_(dds::sub::status::ViewState::any()), + is_(dds::sub::status::InstanceState::any()) + { } + + /** + * Create a DataState instance. + * + * Construct a DataState with: + * - SampleState::any + * - Given ViewState vs + * - InstanceState::any + * + * @param vs the ViewState to construct DataState from + */ + /* implicit */ DataState(const dds::sub::status::ViewState& vs) + : ss_(dds::sub::status::SampleState::any()), + vs_(vs), + is_(dds::sub::status::InstanceState::any()) + { } + + /** + * Create a DataState instance. + * + * Construct a DataState with: + * - SampleState::any + * - ViewState::any + * - Given InstanceState is + * + * @param is InstanceState to construct DataState from + */ + /* implicit */ DataState(const dds::sub::status::InstanceState& is) + : ss_(dds::sub::status::SampleState::any()), + vs_(dds::sub::status::ViewState::any()), + is_(is) + { } + + /** + * Create a DataState instance. + * + * Construct a DataState with: + * - Given SampleState ss + * - Given ViewState vs + * - Given InstanceState is + * + * @param ss SampleState + * @param vs ViewState + * @param is InstanceState + */ + DataState(const dds::sub::status::SampleState& ss, + const dds::sub::status::ViewState& vs, + const dds::sub::status::InstanceState& is) + : ss_(ss), vs_(vs), is_(is) + { } + + /** + * Set SampleState. + * + * @param ss SampleState + */ + DataState& operator << (const dds::sub::status::SampleState& ss) + { + ss_ = ss; + return *this; + } + + /** + * Set InstanceState. + * + * @param is InstanceState + */ + DataState& operator << (const dds::sub::status::InstanceState& is) + { + is_ = is; + return *this; + } + + /** + * Set ViewState. + * + * @param vs ViewState + */ + DataState& operator << (const dds::sub::status::ViewState& vs) + { + vs_ = vs; + return *this; + } + + /** + * Get SampleState. + * + * @param ss SampleState + * @return the DataState + */ + const DataState& operator >> (dds::sub::status::SampleState& ss) const + { + ss = ss_; + return *this; + } + + /** + * Get InstanceState. + * + * @param is InstanceState + * @return the DataState + */ + const DataState& operator >> (dds::sub::status::InstanceState& is) const + { + is = is_; + return *this; + } + + /** + * Get ViewState. + * + * @param vs ViewState + * @return the DataState + */ + const DataState& operator >> (dds::sub::status::ViewState& vs) const + { + vs = vs_; + return *this; + } + + /** + * Check if this DataState is equal with another + * + * @return true if equal + */ + bool operator ==(const DataState& o) const + { + return ((ss_ == o.ss_) && (vs_ == o.vs_) && (is_ == o.is_)); + } + + /** + * Check if this DataState is not equal with another + * + * @return true if not equal + */ + bool operator !=(const DataState& o) const + { + return !operator==(o); + } + + /** + * Get SampleState. + * + * @return the SampleState + */ + const dds::sub::status::SampleState& sample_state() const + { + return ss_; + } + + /** + * Set SampleState. + * + * @param ss SampleState + */ + void sample_state(const dds::sub::status::SampleState& ss) + { + *this << ss; + } + + /** + * Get InstanceState. + * + * @return the InstanceState + */ + const dds::sub::status::InstanceState& instance_state() const + { + return is_; + } + + /** + * Set InstanceState. + * + * @param is InstanceState + */ + void instance_state(const dds::sub::status::InstanceState& is) + { + *this << is; + } + + /** + * Get ViewState. + * + * @return the ViewState + */ + const dds::sub::status::ViewState& view_state() const + { + return vs_; + } + + /** + * Set ViewState. + * + * @param vs ViewState + */ + void view_state(const dds::sub::status::ViewState& vs) + { + *this << vs; + } + + /** + * Create a DataState instance. + * + * Return a DataState with: + * - SampleState::any + * - ViewState::any + * - InstanceState::any + * + * @return the any DataState + */ + static DataState any() + { + return DataState(dds::sub::status::SampleState::any(), + dds::sub::status::ViewState::any(), + dds::sub::status::InstanceState::any()); + } + + /** + * Create a DataState instance. + * + * Return a DataState with: + * - SampleState::not_read + * - ViewState::any + * - InstanceState::alive + * + * @return the new_data DataState + */ + static DataState new_data() + { + return DataState(dds::sub::status::SampleState::not_read(), + dds::sub::status::ViewState::any(), + dds::sub::status::InstanceState::alive()); + } + + /** + * Create a DataState instance. + * + * Return a DataState with: + * - SampleState::any + * - ViewState::any + * - InstanceState::alive + * + * @return the any_data DataState + */ + static DataState any_data() + { + return DataState(dds::sub::status::SampleState::any(), + dds::sub::status::ViewState::any(), + dds::sub::status::InstanceState::alive()); + } + + /** + * Create a DataState instance. + * + * Return a DataState with: + * - SampleState::any + * - ViewState::new_view + * - InstanceState::alive + * + * @return the new_instance DataState + */ + static DataState new_instance() + { + return DataState(dds::sub::status::SampleState::any(), + dds::sub::status::ViewState::new_view(), + dds::sub::status::InstanceState::alive()); + } +private: + dds::sub::status::SampleState ss_; + dds::sub::status::ViewState vs_; + dds::sub::status::InstanceState is_; + +}; + +#endif /* OMG_DDS_SUB_DATA_STATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/sub/status/detail/DataStateImpl.hpp b/unitree_SDK/include/ddscxx/dds/sub/status/detail/DataStateImpl.hpp new file mode 100644 index 0000000..fab65a1 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/sub/status/detail/DataStateImpl.hpp @@ -0,0 +1,97 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_SUB_STATUS_DATASTATE_IMPL_HPP_ +#define CYCLONEDDS_DDS_SUB_STATUS_DATASTATE_IMPL_HPP_ + +/** + * @file + */ + +#include + +/* + * OMG PSM class declaration + */ + +// Implementation + +namespace dds +{ +namespace sub +{ +namespace status +{ + + +inline const SampleState SampleState::read() +{ + return SampleState(0x0001 << 0u); +} + +inline const SampleState SampleState::not_read() +{ + return SampleState(0x0001 << 1u); +} + +inline const SampleState SampleState::any() +{ + return SampleState(0xffff); +} + +inline const ViewState ViewState::new_view() +{ + return ViewState(0x0001 << 0u); +} + +inline const ViewState ViewState::not_new_view() +{ + return ViewState(0x0001 << 1u); +} + +inline const ViewState ViewState::any() +{ + return ViewState(0xffff); +} + +inline const InstanceState InstanceState::alive() +{ + return InstanceState(0x0001 << 0u); +} + +inline const InstanceState InstanceState::not_alive_disposed() +{ + return InstanceState(0x0001 << 1u); +} + +inline const InstanceState InstanceState::not_alive_no_writers() +{ + return InstanceState(0x0001 << 2u); +} + +inline const InstanceState InstanceState::not_alive_mask() +{ + return not_alive_disposed() | not_alive_no_writers(); +} + +inline const InstanceState InstanceState::any() +{ + return InstanceState(0xffff); +} + + +} /* namespace status */ +} /* namespace sub */ +} /* namespace dds */ + +// End of implementation + +#endif /* CYCLONEDDS_DDS_SUB_STATUS_DATASTATE_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/AnyTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/AnyTopic.hpp new file mode 100644 index 0000000..632f556 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/AnyTopic.hpp @@ -0,0 +1,33 @@ +#ifndef OMG_DDS_TOPIC_ANY_TOPIC_HPP_ +#define OMG_DDS_TOPIC_ANY_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + + +namespace dds +{ +namespace topic +{ +typedef ::dds::topic::detail::AnyTopic AnyTopic; +} +} + +#endif /* OMG_DDS_TOPIC_ANY_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/AnyTopicListener.hpp b/unitree_SDK/include/ddscxx/dds/topic/AnyTopicListener.hpp new file mode 100644 index 0000000..4d00faa --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/AnyTopicListener.hpp @@ -0,0 +1,92 @@ +#ifndef OMG_DDS_TOPIC_ANY_TOPIC_LISTENER_HPP_ +#define OMG_DDS_TOPIC_ANY_TOPIC_LISTENER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace topic +{ + + +/** + * @brief + * AnyTopic events Listener + * + * Because the DomainParticipant does not have knowledge of data types, + * it has to use non-data-type-listeners. In other words Any* listeners. + * + * + * All operations for this interface must be implemented in the user-defined class, it is + * up to the application whether an operation is empty or contains some functionality. + * + * + * This class is used as a base for other listeners and is not used on its own. + * + * @see dds::domain::DomainParticipantListener + */ +class OMG_DDS_API AnyTopicListener +{ +public: + /** @cond */ + virtual ~AnyTopicListener() { } + /** @endcond */ + +public: + /** @copydoc dds::topic::TopicListener::on_inconsistent_topic() */ + virtual void on_inconsistent_topic( + AnyTopic& topic, + const dds::core::status::InconsistentTopicStatus& status) = 0; +}; + + +/** + * @brief + * AnyTopic events Listener + * + * This listener is just like AnyTopicListener, except + * that the application doesn't have to implement all operations. + * + * This class is used as a base for other listeners and is not used on its own. + * + * @see dds::topic::AnyTopicListener + * @see dds::domain::NoOpDomainParticipantListener + */ +class OMG_DDS_API NoOpAnyTopicListener : public virtual AnyTopicListener +{ +/** @cond + * All these functions have already been documented in the non-NoOp listener. + * Ignore these functions for the doxygen API documentation for clarity. + */ +public: + virtual ~NoOpAnyTopicListener() { } + +public: + virtual void on_inconsistent_topic( + AnyTopic&, + const dds::core::status::InconsistentTopicStatus&) { } +/** @endcond */ +}; + +} +} + +#endif /* OMG_DDS_TOPIC_ANY_TOPIC_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/BuiltinTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/BuiltinTopic.hpp new file mode 100644 index 0000000..4918273 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/BuiltinTopic.hpp @@ -0,0 +1,41 @@ +#ifndef OMG_DDS_TOPIC_BUILTIN_TOPIC_HPP_ +#define OMG_DDS_TOPIC_BUILTIN_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace topic +{ + +typedef dds::topic::detail::ParticipantBuiltinTopicData ParticipantBuiltinTopicData; + +typedef dds::topic::detail::TopicBuiltinTopicData TopicBuiltinTopicData; + +typedef dds::topic::detail::PublicationBuiltinTopicData PublicationBuiltinTopicData; + +typedef dds::topic::detail::SubscriptionBuiltinTopicData SubscriptionBuiltinTopicData; + +} +} + + +#endif /* OMG_DDS_TOPIC_BUILTIN_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/BuiltinTopicKey.hpp b/unitree_SDK/include/ddscxx/dds/topic/BuiltinTopicKey.hpp new file mode 100644 index 0000000..c26a626 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/BuiltinTopicKey.hpp @@ -0,0 +1,33 @@ +#ifndef OMG_DDS_TOPIC_BUILTIN_TOPIC_KEY_HPP_ +#define OMG_DDS_TOPIC_BUILTIN_TOPIC_KEY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace topic +{ +typedef dds::topic::detail::BuiltinTopicKey BuiltinTopicKey; +} +} + + +#endif /* OMG_DDS_TOPIC_BUILTIN_TOPIC_KEY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/ContentFilteredTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/ContentFilteredTopic.hpp new file mode 100644 index 0000000..15c4b36 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/ContentFilteredTopic.hpp @@ -0,0 +1,35 @@ +#ifndef OMG_DDS_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ +#define OMG_DDS_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace topic +{ +template class DELEGATE = dds::topic::detail::ContentFilteredTopic> +class ContentFilteredTopic; +} +} + +#include + +#endif /* OMG_DDS_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/Filter.hpp b/unitree_SDK/include/ddscxx/dds/topic/Filter.hpp new file mode 100644 index 0000000..520b5fb --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/Filter.hpp @@ -0,0 +1,39 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +/* + * Filter.hpp + * + * Created on: Oct 10, 2012 + * Author: angelo + */ + +#ifndef DDS_TOPIC_FILTER_HPP_ +#define DDS_TOPIC_FILTER_HPP_ + +#include + +namespace dds +{ +namespace topic +{ +typedef dds::topic::detail::Filter Filter; +} +} + + +#endif /* DDS_TOPIC_FILTER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/MultiTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/MultiTopic.hpp new file mode 100644 index 0000000..9b70457 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/MultiTopic.hpp @@ -0,0 +1,41 @@ +#ifndef OMG_DDS_TOPIC_MULTI_TOPIC_HPP_ +#define OMG_DDS_TOPIC_MULTI_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + + +namespace dds +{ +namespace topic +{ + +#ifdef OMG_DDS_MULTI_TOPIC_SUPPORT +template class DELEGATE = dds::topic::detail::MultiTopic> +class MultiTopic; +#endif // OMG_DDS_MULTI_TOPIC_SUPPORT + +} +} + + +#endif /* OMG_DDS_TOPIC_MULTI_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TAnyTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/TAnyTopic.hpp new file mode 100644 index 0000000..9399298 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TAnyTopic.hpp @@ -0,0 +1,146 @@ +#ifndef OMG_DDS_TOPIC_TANYTOPIC_HPP_ +#define OMG_DDS_TOPIC_TANYTOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include +#include +#include + + +namespace dds +{ +namespace topic +{ +template +class TAnyTopic; +} +} + + +/** + * @brief + * Typeless base class for the typed Topic. + * + * Topics are created type specific (fi Topic topic). However, there + * are a few places in the API (and possibly application) where the type can not be known + * while still some Topic has to be passed around, stored or even typeless functionality + * called.
      + * The main examples in the API that needs typeless Topic is: DomainParticipantListener. + * + * @see dds::topic::Topic + */ +template +class dds::topic::TAnyTopic : + public ::dds::core::TEntity< DELEGATE >, + public ::dds::topic::TTopicDescription< DELEGATE > +{ + OMG_DDS_REF_TYPE_PROTECTED_DC(TAnyTopic, ::dds::topic::TTopicDescription, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(TAnyTopic) + + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(TAnyTopic) + +public: + + //========================================================================== + //== QoS Management + + /** + * Gets the TopicQos setting for this instance. + * + * @return the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + dds::topic::qos::TopicQos qos() const; + + /** + * This operation replaces the existing set of QosPolicy settings for a Topic. + * + * The parameter qos contains the object with the QosPolicy settings which is + * checked for self-consistency and mutability. + * + * When the application tries to change a + * QosPolicy setting for an enabled Topic, which can only be set before the + * Topic is enabled, the operation will fail and a + * ImmutablePolicyError is thrown. In other words, the application must + * provide the presently set QosPolicy settings in case of the immutable QosPolicy + * settings. Only the mutable QosPolicy settings can be changed. + * + * When the qos contains conflicting QosPolicy settings (not self-consistent), + * the operation will fail and an InconsistentPolicyError is thrown. + * + * @param qos the qos + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::ImmutablePolicyError + * The parameter qos contains an immutable QosPolicy setting with a + * different value than set during enabling of the DataReader. + * @throws dds::core::InconsistentPolicyError + * The parameter qos contains conflicting QosPolicy settings, + */ + void qos(const dds::topic::qos::TopicQos& qos); + + /** @copydoc dds::topic::TAnyTopic::qos(const dds::topic::qos::TopicQos& qos) */ + TAnyTopic& operator << (const dds::topic::qos::TopicQos& qos); + + /** @copydoc dds::topic::TAnyTopic::qos() */ + const TAnyTopic& operator >> (dds::topic::qos::TopicQos& qos) const; + + /** + * This operation obtains the InconsistentTopicStatus object of the Topic. + * + * The InconsistentTopicStatus can also be monitored using a + * TopicListener or by using the associated StatusCondition. + * + * @return the SampleRejectedStatus + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + ::dds::core::status::InconsistentTopicStatus + inconsistent_topic_status() const; + +}; + + +#endif /* OMG_DDS_TOPIC_TANYTOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TBuiltinTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/TBuiltinTopic.hpp new file mode 100644 index 0000000..de0c0e4 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TBuiltinTopic.hpp @@ -0,0 +1,487 @@ +#ifndef OMG_TDDS_TOPIC_BUILT_IN_TOPIC_HPP_ +#define OMG_TDDS_TOPIC_BUILT_IN_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include + +namespace dds +{ +namespace topic +{ +template +class TParticipantBuiltinTopicData; + +template +class TTopicBuiltinTopicData; + +template +class TPublicationBuiltinTopicData; + +template +class TSubscriptionBuiltinTopicData; +} +} + +/** + * @brief + * Class that contains information about available DomainParticipants within + * the system. + * + * The DCPSParticipant topic communicates the existence of DomainParticipants + * by means of the ParticipantBuiltinTopicData datatype. Each + * ParticipantBuiltinTopicData sample in a Domain represents a DomainParticipant + * that participates in that Domain: a new ParticipantBuiltinTopicData instance + * is created when a newly-added DomainParticipant is enabled, and it is disposed + * when that DomainParticipant is deleted. An updated ParticipantBuiltinTopicData + * sample is written each time the DomainParticipant modifies its UserDataQosPolicy. + * + * @code{.cpp} + * // Get builtin subscriber + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::sub::Subscriber builtinSubscriber = dds::sub::builtin_subscriber(participant); + * + * // Get DCPSParticipant builtin reader (happy flow) + * string name = "DCPSParticipant"; + * vector > readersVector; + * dds::sub::find, + * back_insert_iterator > > >( + * builtinSubscriber, + * name, + * back_inserter > >(readersVector)); + * dds::sub::DataReader builtinReader = readersVector[0]; + * + * // The builtinReader can now be used just as a normal dds::sub::DataReader to get + * // dds::topic::ParticipantBuiltinTopicData samples. + * @endcode + * + * @see for more information: @ref DCPS_Builtin_Topics + * @see for more information: @ref DCPS_Builtin_Topics_ParticipantData + */ +template +class dds::topic::TParticipantBuiltinTopicData : public ::dds::core::Value +{ +public: + /** + * Globally unique identifier of the participant + */ + const dds::topic::BuiltinTopicKey& key() const; + + /** + * User-defined data attached to the participant via a QosPolicy + */ + const ::dds::core::policy::UserData& user_data() const; +}; + +/** + * @brief + * Class that contains information about available Topics within + * the system. + * + * The DCPSTopic topic communicates the existence of topics by means of the + * TopicBuiltinTopicData datatype. Each TopicBuiltinTopicData sample in + * a Domain represents a Topic in that Domain: a new TopicBuiltinTopicData + * instance is created when a newly-added Topic is enabled. However, the instance is + * not disposed when a Topic is deleted by its participant because a topic lifecycle + * is tied to the lifecycle of a Domain, not to the lifecycle of an individual + * participant. An updated TopicBuiltinTopicData sample is written each time a + * Topic modifies one or more of its QosPolicy values. + * + * @code{.cpp} + * // Get builtin subscriber + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::sub::Subscriber builtinSubscriber = dds::sub::builtin_subscriber(participant); + * + * // Get DCPSTopic builtin reader (happy flow) + * string name = "DCPSTopic"; + * vector > readersVector; + * dds::sub::find, + * back_insert_iterator > > >( + * builtinSubscriber, + * name, + * back_inserter > >(readersVector)); + * dds::sub::DataReader builtinReader = readersVector[0]; + * + * // The builtinReader can now be used just as a normal dds::sub::DataReader to get + * // dds::topic::TopicBuiltinTopicData samples. + * @endcode + * + * @see for more information: @ref DCPS_Builtin_Topics + * @see for more information: @ref DCPS_Builtin_Topics_TopicData + */ +template +class dds::topic::TTopicBuiltinTopicData : public ::dds::core::Value +{ +public: + /** + * Global unique identifier of the Topic + */ + const dds::topic::BuiltinTopicKey& key() const; + + /** + * Name of the Topic + */ + const std::string& name() const; + + /** + * Type name of the Topic (i.e. the fully scoped IDL name) + */ + const std::string& type_name() const; + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::Durability& durability() const; + + #ifdef OMG_DDS_PERSISTENCE_SUPPORT + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::DurabilityService& durability_service() const; + #endif // OMG_DDS_PERSISTENCE_SUPPORT + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::Deadline& deadline() const; + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::LatencyBudget& latency_budget() const; + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::Liveliness& liveliness() const; + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::Reliability& reliability() const; + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::TransportPriority& transport_priority() const; + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::Lifespan& lifespan() const; + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::DestinationOrder& destination_order() const; + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::History& history() const; + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::ResourceLimits& resource_limits() const; + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::Ownership& ownership() const; + + /** + * QosPolicy attached to the Topic + */ + const ::dds::core::policy::TopicData& topic_data() const; +}; + +/** + * @brief + * Class that contains information about available DataWriters within + * the system. + * + * The DCPSPublication topic communicates the existence of datawriters by means + * of the PublicationBuiltinTopicData datatype. Each PublicationBuiltinTopicData + * sample in a Domain represents a datawriter in that Domain: a new + * PublicationBuiltinTopicData instance is created when a newly-added DataWriter + * is enabled, and it is disposed when that DataWriter is deleted. An updated + * PublicationBuiltinTopicData sample is written each time the DataWriter (or + * the Publisher to which it belongs) modifies a QosPolicy that applies to the + * entities connected to it. Also will it be updated when the writer looses or + * regains its liveliness. + * + * @code{.cpp} + * // Get builtin subscriber + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::sub::Subscriber builtinSubscriber = dds::sub::builtin_subscriber(participant); + * + * // Get DCPSPublication builtin reader (happy flow) + * string name = "DCPSPublication"; + * vector > readersVector; + * dds::sub::find, + * back_insert_iterator > > >( + * builtinSubscriber, + * name, + * back_inserter > >(readersVector)); + * dds::sub::DataReader builtinReader = readersVector[0]; + * + * // The builtinReader can now be used just as a normal dds::sub::DataReader to get + * // dds::topic::PublicationBuiltinTopicData samples. + * @endcode + * + * @see for more information: @ref DCPS_Builtin_Topics + * @see for more information: @ref DCPS_Builtin_Topics_PublicationData + */ +template +class dds::topic::TPublicationBuiltinTopicData : public ::dds::core::Value +{ +public: + /** + * Global unique identifier of the DataWriter + */ + const dds::topic::BuiltinTopicKey& key() const; + + /** + * Global unique identifier of the Participant to which the DataWriter belongs + */ + const dds::topic::BuiltinTopicKey& participant_key() const; + + /** + * Name of the Topic used by the DataWriter + */ + const std::string& topic_name() const; + + /** + * Type name of the Topic used by the DataWriter + */ + const std::string& type_name() const; + + /** + * QosPolicy attached to the DataWriter + */ + const ::dds::core::policy::Durability& durability() const; + + #ifdef OMG_DDS_PERSISTENCE_SUPPORT + /** + * QosPolicy attached to the DataWriter + */ + const ::dds::core::policy::DurabilityService& durability_service() const; + #endif // OMG_DDS_PERSISTENCE_SUPPORT + + /** + * QosPolicy attached to the DataWriter + */ + const ::dds::core::policy::Deadline& deadline() const; + + /** + * QosPolicy attached to the DataWriter + */ + const ::dds::core::policy::LatencyBudget& latency_budget() const; + + /** + * QosPolicy attached to the DataWriter + */ + const ::dds::core::policy::Liveliness& liveliness() const; + + /** + * QosPolicy attached to the DataWriter + */ + const ::dds::core::policy::Reliability& reliability() const; + + /** + * QosPolicy attached to the DataWriter + */ + const ::dds::core::policy::Lifespan& lifespan() const; + + /** + * QosPolicy attached to the DataWriter + */ + const ::dds::core::policy::UserData& user_data() const; + + /** + * QosPolicy attached to the DataWriter + */ + const ::dds::core::policy::Ownership& ownership() const; + + #ifdef OMG_DDS_OWNERSHIP_SUPPORT + /** + * QosPolicy attached to the DataWriter + */ + const ::dds::core::policy::OwnershipStrength& ownership_strength() const; + #endif // OMG_DDS_OWNERSHIP_SUPPORT + + /** + * QosPolicy attached to the DataWriter + */ + const ::dds::core::policy::DestinationOrder& destination_order() const; + + /** + * QosPolicy attached to the Publisher to which the DataWriter belongs + */ + const ::dds::core::policy::Presentation& presentation() const; + + /** + * QosPolicy attached to the Publisher to which the DataWriter belongs + */ + const ::dds::core::policy::Partition& partition() const; + + /** + * QosPolicy attached to the Publisher to which the DataWriter belongs + */ + const ::dds::core::policy::TopicData& topic_data() const; + + /** + * QosPolicy attached to the Publisher to which the DataWriter belongs + */ + const ::dds::core::policy::GroupData& group_data() const; + +}; + +/** + * @brief + * Class that contains information about available DataReaders within + * the system. + * + * The DCPSSubscription topic communicates the existence of datareaders by + * means of the SubscriptionBuiltinTopicData datatype. Each + * SubscriptionBuiltinTopicData sample in a Domain represents a datareader + * in that Domain: a new SubscriptionBuiltinTopicData instance is created + * when a newly-added DataReader is enabled, and it is disposed when that + * DataReader is deleted. An updated SubscriptionBuiltinTopicData sample is + * written each time the DataReader (or the Subscriber to which it belongs) + * modifies a QosPolicy that applies to the entities connected to it. + * + * @code{.cpp} + * // Get builtin subscriber + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::sub::Subscriber builtinSubscriber = dds::sub::builtin_subscriber(participant); + * + * // Get DCPSSubscription builtin reader (happy flow) + * string name = "DCPSSubscription"; + * vector > readersVector; + * dds::sub::find, + * back_insert_iterator > > >( + * builtinSubscriber, + * name, + * back_inserter > >(readersVector)); + * dds::sub::DataReader builtinReader = readersVector[0]; + * + * // The builtinReader can now be used just as a normal dds::sub::DataReader to get + * // dds::topic::SubscriptionBuiltinTopicData samples. + * @endcode + * + * @see for more information: @ref DCPS_Builtin_Topics + * @see for more information: @ref DCPS_Builtin_Topics_SubscriptionData + */ +template +class dds::topic::TSubscriptionBuiltinTopicData : public ::dds::core::Value +{ +public: + /** + * Global unique identifier of the DataReader + */ + const dds::topic::BuiltinTopicKey& key() const; + + /** + * Global unique identifier of the Participant to which the DataReader belongs + */ + const dds::topic::BuiltinTopicKey& participant_key() const; + + /** + * Name of the Topic used by the DataReader + */ + const std::string& topic_name() const; + + /** + * Type name of the Topic used by the DataReader + */ + const std::string& type_name() const; + + /** + * QosPolicy attached to the DataReader + */ + const ::dds::core::policy::Durability& durability() const; + + /** + * QosPolicy attached to the DataReader + */ + const ::dds::core::policy::Deadline& deadline() const; + + /** + * QosPolicy attached to the DataReader + */ + const ::dds::core::policy::LatencyBudget& latency_budget() const; + + /** + * QosPolicy attached to the DataReader + */ + const ::dds::core::policy::Liveliness& liveliness() const; + + /** + * QosPolicy attached to the DataReader + */ + const ::dds::core::policy::Reliability& reliability() const; + + /** + * QosPolicy attached to the DataReader + */ + const ::dds::core::policy::Ownership& ownership() const; + + /** + * QosPolicy attached to the DataReader + */ + const ::dds::core::policy::DestinationOrder& destination_order() const; + + /** + * QosPolicy attached to the DataReader + */ + const ::dds::core::policy::UserData& user_data() const; + + /** + * QosPolicy attached to the DataReader + */ + const ::dds::core::policy::TimeBasedFilter& time_based_filter() const; + + /** + * QosPolicy attached to the Subscriber to which the DataReader belongs + */ + const ::dds::core::policy::Presentation& presentation() const; + + /** + * QosPolicy attached to the Subscriber to which the DataReader belongs + */ + const ::dds::core::policy::Partition& partition() const; + + /** + * QosPolicy attached to the Subscriber to which the DataReader belongs + */ + const ::dds::core::policy::TopicData& topic_data() const; + + /** + * QosPolicy attached to the Subscriber to which the DataReader belongs + */ + const ::dds::core::policy::GroupData& group_data() const; + +}; + +#endif /* OMG_TDDS_TOPIC_BUILT_IN_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TBuiltinTopicKey.hpp b/unitree_SDK/include/ddscxx/dds/topic/TBuiltinTopicKey.hpp new file mode 100644 index 0000000..28bdf77 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TBuiltinTopicKey.hpp @@ -0,0 +1,57 @@ +#ifndef OMG_DDS_TOPIC_TBUILTIN_TOPIC_KEY_HPP_ +#define OMG_DDS_TOPIC_TBUILTIN_TOPIC_KEY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + + +#include + +namespace dds +{ +namespace topic +{ +template +class TBuiltinTopicKey; +} +} + +/** + * @brief + * Global unique identifier of the Topic. + */ +template +class dds::topic::TBuiltinTopicKey : public ::dds::core::Value +{ +public: + /** + * Gets the BuiltinTopicKey. + * + * @return the BuiltinTopicKey + */ + const int32_t* value() const; + + /** + * Sets the BuiltinTopicKey. + * + * @param v the value to set + */ + void value(int32_t v[]); +}; + +#endif /* OMG_DDS_TOPIC_TBUILTIN_TOPIC_KEY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TContentFilteredTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/TContentFilteredTopic.hpp new file mode 100644 index 0000000..c6e658e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TContentFilteredTopic.hpp @@ -0,0 +1,160 @@ +#ifndef OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ +#define OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +#include +#include +#include +#include + +#ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT + +namespace dds +{ +namespace topic +{ +template class DELEGATE> +class ContentFilteredTopic; +} +} + + +/** + * @brief + * ContentFilteredTopic is a specialization of TopicDescription that allows + * for content-based subscriptions. + * + * ContentFilteredTopic describes a more sophisticated subscription which + * indicates that the Subscriber does not necessarily want to see all values of each + * instance published under the Topic. Rather, it only wants to see the values whose + * contents satisfy certain criteria. Therefore this class must be used to request + * content-based subscriptions. + * + * The selection of the content is done using the SQL based filter with parameters to + * adapt the filter clause. + * + * Example + * @code{.cpp} + * // Default creation of a Topic + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * + * // Creation of a ContentFilteredTopic (assume Foo::Bar contains long_1 element). + * std::vector params; + * params.push_back("1"); + * dds::topic::Filter filter("long_1=%0", params); + * dds::topic::ContentFilteredTopic cfTopic(topic, + * "ContentFilteredTopicName", + * filter); + * + * // The ContentFilteredTopic can be used to create readers + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, cfTopic); + * @endcode + * + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + */ +template class DELEGATE> +class dds::topic::ContentFilteredTopic : public dds::topic::TTopicDescription< DELEGATE > +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC_T(ContentFilteredTopic, dds::topic::TTopicDescription, T, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(ContentFilteredTopic) + + /** + * Convenience typedef for the type of the data sample. + */ + typedef T DataType; + +public: + /** + * Creates a ContentFilteredTopic be used as to perform content-based + * subscriptions. + * + * The ContentFilteredTopic only relates to samples published under that + * Topic, filtered according to their content. The filtering is done by + * means of evaluating a logical expression that involves the values of + * some of the data-fields in the sample. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @param topic the related Topic + * @param name the name of the ContentFilteredTopic + * @param filter the filter expression + * @throw dds::core::Exception + */ + ContentFilteredTopic(const Topic& topic, const std::string& name, const dds::topic::Filter& filter); + + /** @cond */ + virtual ~ContentFilteredTopic(); + /** @endcond */ + +public: + /** + * Get the filter expression. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return the filter expression + */ + const std::string& filter_expression() const; + + /** + * Get the filter expression parameters. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return the filter parameters as a sequence + */ + const dds::core::StringSeq filter_parameters() const; + + /** + * Sets the query parameters. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @param begin Iterator pointing to the beginning of the parameters to set + * @param end Iterator pointing to the end of the parameters to set + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + */ + template + void filter_parameters(const FWDIterator& begin, const FWDIterator& end); + + /** + * Return the associated Topic. + * + * @return the Topic + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + */ + const dds::topic::Topic& topic() const; +}; + +#endif // OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT + + +#endif /* OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TFilter.hpp b/unitree_SDK/include/ddscxx/dds/topic/TFilter.hpp new file mode 100644 index 0000000..6fae14d --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TFilter.hpp @@ -0,0 +1,186 @@ +#ifndef DDS_TOPIC_TFILTER__HPP_ +#define DDS_TOPIC_TFILTER__HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds +{ +namespace topic +{ +template +class TFilter; +} +} + +/** + * @brief + * Filter objects contain SQL expressions that allow the application to specify + * a filter on the locally available data. + * + * A Filter is used to create a ContentFilteredTopic. + * + * @anchor anchor_dds_topic_filter_expression + * \par SQL Expression + * The SQL query string is set by expression which must be a subset of the + * SQL query language. In this query expression, parameters may be used, which must + * be set in the sequence of strings defined by the parameter query_parameters. A + * parameter is a string which can define an integer, float, string or enumeration. The + * number of values in query_parameters must be equal or greater than the highest + * referenced %n token in the query_expression (e.g. if %1 and %8 are used as + * parameters in the query_expression, the query_parameters should at least + * contain n+1 = 9 values).
      + * Look @ref DCPS_Queries_and_Filters "here" for the specific query expression syntax. + * + * @see dds::topic::ContentFilteredTopic + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + */ +template +class dds::topic::TFilter: public dds::core::Value +{ +public: + /** + * Iterator for the query expression parameters. + */ + typedef typename D::iterator iterator; + + /** + * Iterator for the query expression parameters. + */ + typedef typename D::const_iterator const_iterator; + +public: + /** + * Create a Filter based on a query expression. + * + * @param query_expression an @ref anchor_dds_topic_filter_expression "SQL expression" + * @throw dds::core::Exception + */ + TFilter(const std::string& query_expression); + + /** + * Create a Filter based on a query expression and an iterable parameter container. + * + * @param query_expression an @ref anchor_dds_topic_filter_expression "SQL expression" + * @param params_begin Iterator pointing to the beginning of the parameters to set + * @param params_end Iterator pointing to the end of the parameters to set + * @throw dds::core::Exception + */ + template + TFilter(const std::string& query_expression, const FWIterator& params_begin, + const FWIterator& params_end); + + /** + * Create a Filter based on a query expression and parameter vector. + * + * @param query_expression an @ref anchor_dds_topic_filter_expression "SQL expression" + * @param params Vector containing SQL expression parameters + * @throw dds::core::Exception + */ + TFilter(const std::string& query_expression, + const std::vector& params); + + /** + * Get the query expression. + * + * @return std::string The @ref anchor_dds_topic_filter_expression "SQL expression". + * @throw dds::core::Exception + */ + const std::string& expression() const; + + /** + * Provides the begin iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return dds::topic::Filter::const_iterator + * The begin iterator + * @throw dds::core::Exception + */ + const_iterator begin() const; + + /** + * The end iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return dds::topic::Filter::const_iterator + * The end iterator + * @throw dds::core::Exception + */ + const_iterator end() const; + + /** + * Provides the begin iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return dds::topic::Filter::iterator + * The begin iterator + * @throw dds::core::Exception + */ + iterator begin(); + + /** + * The end iterator to the SQL expression parameter list. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return dds::topic::Filter::iterator + * The end iterator + * @throw dds::core::Exception + */ + iterator end(); + + /** + * Sets the query parameters. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @param begin Iterator pointing to the beginning of the parameters to set + * @param end Iterator pointing to the end of the parameters to set + * @throw dds::core::Exception + */ + template + void parameters(const FWIterator& begin, const FWIterator end); + + /** + * Adds a parameter to the query. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @param param The parameter to add + * @throw dds::core::Exception + */ + void add_parameter(const std::string& param); + + /** + * Gets the number of parameters in the query of the filter. + * + * See @ref anchor_dds_topic_filter_expression "SQL expression info" + * + * @return uint32_t The number of parameters in the query + * @throw dds::core::Exception + */ + uint32_t parameters_length() const; +}; + +#endif /* DDS_TOPIC_TFILTER__HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TMultiTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/TMultiTopic.hpp new file mode 100644 index 0000000..267d9fc --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TMultiTopic.hpp @@ -0,0 +1,74 @@ +#ifndef OMG_DDS_T_TOPIC_MULTI_TOPIC_HPP_ +#define OMG_DDS_T_TOPIC_MULTI_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +#include +#include +#include + +namespace dds +{ +namespace topic +{ + +#ifdef OMG_DDS_MULTI_TOPIC_SUPPORT + +/** + * This operation is not yet implemented. It is scheduled for a future release. + * + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + */ +template class DELEGATE> +class MultiTopic : public TTopicDescription< DELEGATE > +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC_T(MultiTopic, dds::topic::TTopicDescription, T, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(MultiTopic) + +public: + template + MultiTopic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string expression, + const FWDIterator& params_begin, + const FWDIterator& params_end); + + virtual ~MultiTopic(); + +public: + const std::string expression() const; + + template + void expression_parameters(const FWDIterator& params_begin, + const FWDIterator& params_end); + + dds::core::StringSeq void expression_parameters() const; + +}; + +#endif // OMG_DDS_MULTI_TOPIC_SUPPORT + +} +} + + +#endif /* OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/TTopic.hpp new file mode 100644 index 0000000..98575f0 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TTopic.hpp @@ -0,0 +1,429 @@ +#ifndef OMG_DDS_TTOPIC_TOPIC_HPP_ +#define OMG_DDS_TTOPIC_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + + +namespace dds +{ +namespace topic +{ +template class DELEGATE> +class Topic; + +template +class TopicListener; +} +} + + +/** + * @brief + * Topic is the most basic description of the data to be published and + * subscribed. + * + * A Topic is identified by its name, which must be unique in the whole Domain. + * In addition (by virtue of extending TopicDescription) it fully specifies the + * type of the data that can be communicated when publishing or subscribing to + * the Topic. + * + * Topic is the only TopicDescription that can be used for publications and + * therefore associated with a DataWriter. + * + * Example + * @code{.cpp} + * // Default creation of a Topic + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, "TopicName"); + * + * // The Topic can be used to create readers and writers + * // DataReader + * dds::sub::Subscriber subscriber(participant); + * dds::sub::DataReader reader(subscriber, topic); + * // DataWriter + * dds::pub::Publisher publisher(participant); + * dds::pub::DataWriter writer(publisher, topic); + * @endcode + * + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + */ +template class DELEGATE> +class dds::topic::Topic : public dds::topic::TAnyTopic< DELEGATE > +{ +public: + /** + * Convenience typedef for the type of the data sample. + */ + typedef T DataType; + + /** + * Local convenience typedef for dds::topic::TopicListener. + */ + typedef TopicListener Listener; + +public: + OMG_DDS_REF_TYPE_PROTECTED_DC_T(Topic, ::dds::topic::TAnyTopic, T, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(Topic) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(Topic) + +public: + + /** + * Create a new Topic. + * + * This operation creates a reference to a new or existing Topic under the given name, + * for a specific data type. + * + * QoS
      + * The Topic will be created with the QoS values specified on the last + * successful call to @link dds::domain::DomainParticipant::default_topic_qos(const ::dds::topic::qos::TopicQos& qos) + * dp.default_topic_qos(qos) @endlink or, if the call was never made, the + * @ref anchor_dds_topic_qos_defaults "default" values. + * + * Existing Topic Name
      + * Before creating a new Topic, this operation performs a + * lookup_topicdescription for the specified topic_name. When a Topic is + * found with the same name in the current domain, the QoS and type_name of the + * found Topic are matched against the parameters qos and type_name. When they + * are the same, no Topic is created but a new proxy of the existing Topic is returned. + * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. + * + * Local Proxy
      + * Since a Topic is a global concept in the system, access is provided through a local + * proxy. In other words, the reference returned is actually not a reference to a Topic + * but to a locally created proxy. The Data Distribution Service propagates Topics + * and makes remotely created Topics locally available through this proxy. The deletion + * of a Topic object will not delete the Topic from the domain, just the local proxy is + * deleted. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the name of the Topic to be created + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name); + + /** + * Create a new Topic. + * + * This operation creates a reference to a new or existing Topic under the given name, + * for a specific data type and type_name. + * + * QoS
      + * The Topic will be created with the QoS values specified on the last + * successful call to @link dds::domain::DomainParticipant::default_topic_qos(const ::dds::topic::qos::TopicQos& qos) + * dp.default_topic_qos(qos) @endlink or, if the call was never made, the + * @ref anchor_dds_topic_qos_defaults "default" values. + * + * Existing Topic Name
      + * Before creating a new Topic, this operation performs a + * lookup_topicdescription for the specified topic_name. When a Topic is + * found with the same name in the current domain, the QoS and type_name of the + * found Topic are matched against the parameters qos and type_name. When they + * are the same, no Topic is created but a new proxy of the existing Topic is returned. + * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. + * + * Local Proxy
      + * Since a Topic is a global concept in the system, access is provided through a local + * proxy. In other words, the reference returned is actually not a reference to a Topic + * but to a locally created proxy. The Data Distribution Service propagates Topics + * and makes remotely created Topics locally available through this proxy. The deletion + * of a Topic object will not delete the Topic from the domain, just the local proxy is + * deleted. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the topic's name + * @param type_name a local alias of the data type + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const std::string& type_name); + + /** + * Create a new Topic. + * + * This operation creates a reference to a new or existing Topic under the given name, + * for a specific data type. + * + * QoS
      + * A possible application pattern to construct the TopicQos for the + * Topic is to: + * @code{.cpp} + * // 1) Retrieve the QosPolicy settings on the associated DomainParticipant + * dds::topic::qos::TopicQos topicQos = participant.default_datareader_qos(); + * // 2) Selectively modify QosPolicy settings as desired. + * topicQos << dds::core::policy::Durability::Transient(); + * // 3) Use the resulting QoS to construct the DataReader. + * dds::topic::Topic topic(participant, "TopicName", topicQos); + * @endcode + * + * Existing Topic Name
      + * Before creating a new Topic, this operation performs a + * lookup_topicdescription for the specified topic_name. When a Topic is + * found with the same name in the current domain, the QoS and type_name of the + * found Topic are matched against the parameters qos and type_name. When they + * are the same, no Topic is created but a new proxy of the existing Topic is returned. + * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. + * + * Local Proxy
      + * Since a Topic is a global concept in the system, access is provided through a local + * proxy. In other words, the reference returned is actually not a reference to a Topic + * but to a locally created proxy. The Data Distribution Service propagates Topics + * and makes remotely created Topics locally available through this proxy. The deletion + * of a Topic object will not delete the Topic from the domain, just the local proxy is + * deleted. + * + * Listener
      + * The following statuses are applicable to the TopicListener: + * - dds::core::status::StatusMask::inconsistent_topic() + * + * See @ref DCPS_Modules_Infrastructure_Listener "listener concept", + * @ref anchor_dds_topic_listener_commstatus "communication status" and + * @ref anchor_dds_topic_listener_commpropagation "communication propagation" + * for more information. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the topic's name + * @param qos the topic listener + * @param listener the topic listener + * @param mask the listener event mask + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener = NULL, + const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none()); + + /** + * Create a new Topic. + * + * This operation creates a reference to a new or existing Topic under the given name, + * for a specific data type and type_name. + * + * QoS
      + * A possible application pattern to construct the TopicQos for the + * Topic is to: + * @code{.cpp} + * // 1) Retrieve the QosPolicy settings on the associated DomainParticipant + * dds::topic::qos::TopicQos topicQos = participant.default_datareader_qos(); + * // 2) Selectively modify QosPolicy settings as desired. + * topicQos << dds::core::policy::Durability::Transient(); + * // 3) Use the resulting QoS to construct the DataReader. + * dds::topic::Topic topic(participant, "TopicName", "TypeName", topicQos); + * @endcode + * + * Existing Topic Name
      + * Before creating a new Topic, this operation performs a + * lookup_topicdescription for the specified topic_name. When a Topic is + * found with the same name in the current domain, the QoS and type_name of the + * found Topic are matched against the parameters qos and type_name. When they + * are the same, no Topic is created but a new proxy of the existing Topic is returned. + * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. + * + * Local Proxy
      + * Since a Topic is a global concept in the system, access is provided through a local + * proxy. In other words, the reference returned is actually not a reference to a Topic + * but to a locally created proxy. The Data Distribution Service propagates Topics + * and makes remotely created Topics locally available through this proxy. The deletion + * of a Topic object will not delete the Topic from the domain, just the local proxy is + * deleted. + * + * Listener
      + * The following statuses are applicable to the TopicListener: + * - dds::core::status::StatusMask::inconsistent_topic() + * + * See @ref DCPS_Modules_Infrastructure_Listener "listener concept", + * @ref anchor_dds_topic_listener_commstatus "communication status" and + * @ref anchor_dds_topic_listener_commpropagation "communication propagation" + * for more information. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the topic's name + * @param type_name a local alias of the data type + * @param qos the topic listener + * @param listener the topic listener + * @param mask the listener event mask + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener = NULL, + const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none()); + + #if defined (OMG_DDS_X_TYPE_DYNAMIC_TYPES_SUPPORT) + /** + * Create a new topic with a dynamic type description. Notice that in this + * case the data type has to be DynamicData, so the Topic type will be + * Topic. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the topic's name. The QoS will be set to + * dp.default_topic_qos(). + * @param type the topic type + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::xtypes::DynamicType type); + + /** + * Create a new topic with a dynamic type description. Notice that in this + * case the data type has to be DynamicData, so the Topic type will be + * Topic. + * + * @param dp the domain participant on which the topic will be defined + * @param topic_name the topic's name + * @param type the topic type + * @param qos the topic listener + * @param listener the topic listener + * @param mask the listener event mask + * @throws dds::core::Error + * A other Topic with the same name but different type or QoS was + * detected in the current domain or another internal error has occurred. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::xtypes::DynamicType type + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener = NULL, + const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none()); + + #endif /* OMG_DDS_X_TYPE_DYNAMIC_TYPES_SUPPORT */ + +public: + /** + * Register a listener with the Topic. + * + * This operation attaches a TopicListener to the Topic. Only one + * TopicListener can be attached to each Topic. If a + * TopicListener was already attached, the operation will replace it with the + * new one. When the listener is the NULL pointer, it represents a listener that is + * treated as a NOOP for all statuses activated in the bit mask. + * + * Listener un-registration is performed by setting the listener to NULL and mask none(). + * + * @anchor anchor_dds_topic_listener_commstatus + * Communication Status
      + * For each communication status, the StatusChangedFlag flag is initially set to + * FALSE. It becomes TRUE whenever that communication status changes. For each + * communication status activated in the mask, the associated TopicListener + * operation is invoked and the communication status is reset to FALSE, as the listener + * implicitly accesses the status which is passed as a parameter to that operation. The + * status is reset prior to calling the listener, so if the application calls the + * get__status from inside the listener it will see the status + * already reset. An exception to this rule is the NULL listener, which does not reset the + * communication statuses for which it is invoked. + * + * The following statuses are applicable to the TopicListener: + * - dds::core::status::StatusMask::inconsistent_topic() + * + * Status bits are declared as a constant and can be used by the application in an OR + * operation to create a tailored mask. The special constant dds::core::status::StatusMask::none() + * can be used to indicate that the created entity should not respond to any of its available + * statuses. The DDS will therefore attempt to propagate these statuses to its factory. + * The special constant dds::core::status::StatusMask::all() can be used to select all applicable + * statuses specified in the “Data Distribution Service for Real-time Systems Version + * 1.2” specification which are applicable to the PublisherListener. + * + * @anchor anchor_dds_topic_listener_commpropagation + * Status Propagation
      + * In case a communication status is not activated in the mask of the + * TopicListener, the DomainParticipantListener of the containing DomainParticipant + * is invoked (if attached and activated for the status that occurred). This allows the + * application to set a default behaviour in the DomainParticipantListener of the containing + * DomainParticipant and a Topic specific behaviour when needed. In case the + * communication status is not activated in the mask of the DomainParticipantListener as + * well, the application is not notified of the change. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @param listener the listener + * @param event_mask the mask defining the events for which the listener + * will be notified. + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The entity has already been closed. + * @throws dds::core::UnsupportedError + * A status was selected that cannot be supported because + * the infrastructure does not maintain the required connectivity information. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + */ + void listener(Listener* listener, + const ::dds::core::status::StatusMask& event_mask); + + /** + * Get the listener of this Topic. + * + * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". + * + * @return the listener + * @throws dds::core::NullReferenceError + * The entity was not properly created and references to dds::core::null. + */ + Listener* listener() const; + +}; + + +#endif /* OMG_DDS_TTOPIC_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TTopicDescription.hpp b/unitree_SDK/include/ddscxx/dds/topic/TTopicDescription.hpp new file mode 100644 index 0000000..a8906fa --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TTopicDescription.hpp @@ -0,0 +1,85 @@ +#ifndef OMG_DDS_T_TOPIC_TOPIC_DESCRIPTION_HPP_ +#define OMG_DDS_T_TOPIC_TOPIC_DESCRIPTION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include + +namespace dds +{ +namespace topic +{ +template +class TTopicDescription; +} +} + + +/** + * @brief + * This class is the base for Topic, ContentFilteredTopic and MultiTopic. + * + * The TopicDescription attribute type_name defines an unique data type that is + * made available to the Data Distribution Service when a Topic is created with + * that type.
      + * TopicDescription has also a name that allows it to be retrieved locally. + * + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + */ +template +class dds::topic::TTopicDescription : public virtual dds::core::Reference +{ +public: + OMG_DDS_REF_TYPE_PROTECTED_DC(TTopicDescription, dds::core::Reference, DELEGATE) + OMG_DDS_IMPLICIT_REF_BASE(TTopicDescription) + OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_EXPLICIT(TTopicDescription) + +public: + /** + * This operation returns the name used to create the TopicDescription. + * + * @return the TopicDescription name + */ + const std::string& name() const; + + /** + * This operation returns the registered name of the data type associated + * with the TopicDescription. + * + * @return the type_name + */ + const std::string& type_name() const; + + /** + * This operation returns the DomainParticipant associated with the + * TopicDescription. + * + * Note that there is exactly one DomainParticipant associated with + * each TopicDescription. + * + * @return the DomainParticipant + */ + const dds::domain::DomainParticipant& domain_participant() const; + +}; + + +#endif /* OMG_DDS_T_TOPIC_TOPIC_DESCRIPTION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/Topic.hpp b/unitree_SDK/include/ddscxx/dds/topic/Topic.hpp new file mode 100644 index 0000000..51b626e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/Topic.hpp @@ -0,0 +1,41 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_TOPIC_TOPIC_HPP_ +#define OMG_DDS_TOPIC_TOPIC_HPP_ + +#include + +namespace dds +{ +namespace topic +{ +template class DELEGATE = dds::topic::detail::Topic> +class Topic; +} +} + +/** + * @todo RTF Issue - moved include + * @note This include was moved here as MSVC appears to ignore any + * attempt to 're-declare' a template class with a default argument like: + * dds/pub/detail/DataWriter.hpp(54): error C2976: 'dds::topic::Topic' : too few template arguments + * dds/topic/TTopic.hpp(50) : see declaration of 'dds::topic::Topic' + */ +#include + +#endif /* OMG_DDS_TOPIC_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TopicDescription.hpp b/unitree_SDK/include/ddscxx/dds/topic/TopicDescription.hpp new file mode 100644 index 0000000..d2717f3 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TopicDescription.hpp @@ -0,0 +1,33 @@ +#ifndef OMG_DDS_TOPIC_TOPIC_DESCRIPTION_HPP_ +#define OMG_DDS_TOPIC_TOPIC_DESCRIPTION_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + + +namespace dds +{ +namespace topic +{ +typedef ::dds::topic::detail::TopicDescription TopicDescription; +} +} + +#endif /* OMG_DDS_TOPIC_TOPIC_DESCRIPTION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TopicInstance.hpp b/unitree_SDK/include/ddscxx/dds/topic/TopicInstance.hpp new file mode 100644 index 0000000..07df0a5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TopicInstance.hpp @@ -0,0 +1,116 @@ +#ifndef OMG_DDS_TOPIC_TOPIC_INSTANCE_HPP_ +#define OMG_DDS_TOPIC_TOPIC_INSTANCE_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds +{ +namespace topic +{ +template +class TopicInstance; +} +} + +/** + * @brief + * A TopicInstance encapsulates a dds::sub::Sample and its associated + * dds::core::InstanceHandle. + * + * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" + * @see for more information: @ref dds::sub::Sample + * @see for more information: @ref dds::core::InstanceHandle + */ +template +class dds::topic::TopicInstance +{ +public: + /** + * Construct a TopicInstance. + */ + TopicInstance(); + + /** + * Construct a TopicInstance with an InstanceHandle. + * + * @param h the InstanceHandle + */ + explicit TopicInstance(const ::dds::core::InstanceHandle& h); + + /** + * Construct a TopicInstance with an InstanceHandle and a sample type. + * + * @param h the InstanceHandle + * @param sample the + */ + TopicInstance(const ::dds::core::InstanceHandle& h, const T& sample); + +public: + /** + * Conversion operator to get the InstanceHandle. + * + * @return the InstanceHandle for the TopicInstance + */ + operator const ::dds::core::InstanceHandle() const; + + /** + * Get the InstanceHandle. + * + * @return the InstanceHandle for the TopicInstance + */ + const ::dds::core::InstanceHandle handle() const; + + /** + * Set the InstanceHandle. + * + * @param h the InstanceHandle to set to the TopicInstance + */ + void handle(const ::dds::core::InstanceHandle& h); + + /** + * Get the data sample + * + * @return the sample for the TopicInstance + */ + const T& sample() const; + + /** + * Get the data sample + * + * @return the sample for the TopicInstance + */ + T& sample(); + + /** + * Set the data sample + * + * @param sample send a sample for this TopicInstance + */ + void sample(const T& sample); + +private: + ::dds::core::InstanceHandle h_; + T sample_; +}; + + +#endif /* OMG_DDS_TOPIC_TOPIC_INSTANCE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TopicListener.hpp b/unitree_SDK/include/ddscxx/dds/topic/TopicListener.hpp new file mode 100644 index 0000000..adb7a23 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TopicListener.hpp @@ -0,0 +1,144 @@ +#ifndef OMG_DDS_TOPIC_TOPIC_LISTENER_HPP_ +#define OMG_DDS_TOPIC_TOPIC_LISTENER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include "dds/topic/Topic.hpp" + +namespace dds +{ +namespace topic +{ + +/** + * @brief + * Topic events Listener + * + * Since a Topic is an Entity, it has the ability to have a Listener + * associated with it. In this case, the associated Listener should be of type + * TopicListener. This interface must be implemented by the + * application. A user-defined class must be provided by the application which must + * extend from the TopicListener class. + * + * + * All operations for this interface must be implemented in the user-defined class, it is + * up to the application whether an operation is empty or contains some functionality. + * + * + * The TopicListener provides a generic mechanism (actually a + * callback function) for the Data Distribution Service to notify the application of + * relevant asynchronous status change events, such as a missed deadline, violation of + * a QosPolicy setting, etc. The TopicListener is related to + * changes in communication status StatusConditions. + * + * @code{.cpp} + * // Application example listener + * class ExampleListener : + * public virtual dds::topic::TopicListener + * { + * public: + * virtual void on_inconsistent_topic ( + * dds::topic::Topic& topic, + * const dds::core::status::InconsistentTopicStatus& status) + * { + * std::cout << "on_inconsistent_topic" << std::endl; + * } + * }; + * + * // Create Topic with the listener + * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); + * dds::topic::Topic topic(participant, + * "TopicName", + * participant.default_topic_qos(), + * new ExampleListener(), + * dds::core::status::StatusMask::all()); + * + * @endcode + * + * @see for more information: @ref DCPS_Modules_Topic "Topic" + * @see for more information: @ref DCPS_Modules_Infrastructure_Listener "Listener information" + */ +template +class TopicListener +{ +public: + /** @cond */ + virtual ~TopicListener() { } + /** @endcond */ + +public: + /** + * This operation is called by the Data Distribution Service when the + * InconsistentTopicStatus changes. + * + * The implementation may be left empty + * when this functionality is not needed. This operation will only be called when the + * relevant TopicListener is installed and enabled with the + * StatusMask::inconsistent_topic(). The InconsistentTopicStatus will change + * when another Topic exists with the same topic_name but different + * characteristics. + * + * @param topic contain a pointer to the Topic on which the conflict + * occurred (this is an input to the application). + * @param status contain the InconsistentTopicStatus object (this is + * an input to the application). + */ + virtual void on_inconsistent_topic( + Topic& topic, + const dds::core::status::InconsistentTopicStatus& status) = 0; +}; + + +/** + * @brief + * Topic events Listener + * + * This listener is just like TopicListener, except + * that the application doesn't have to implement all operations. + * + * @code{.cpp} + * class ExampleListener : public virtual dds::topic::NoOpTopicListener + * { + * // Not necessary to implement any Listener operations. + * }; + * @endcode + * + * @see dds::topic::TopicListener + */ +template +class NoOpTopicListener : public virtual TopicListener +{ +/** @cond + * All these functions have already been documented in the non-NoOp listener. + * Ignore these functions for the doxygen API documentation for clarity. + */ +public: + virtual ~NoOpTopicListener() { } + +public: + virtual void on_inconsistent_topic( + Topic&, + const dds::core::status::InconsistentTopicStatus&) { } +/** @endcond */ +}; + +} +} + +#endif /* OMG_DDS_TOPIC_TOPIC_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/TopicTraits.hpp b/unitree_SDK/include/ddscxx/dds/topic/TopicTraits.hpp new file mode 100644 index 0000000..048e61c --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/TopicTraits.hpp @@ -0,0 +1,92 @@ +#ifndef OMG_DDS_TOPIC_TOPIC_TRAITS_HPP_ +#define OMG_DDS_TOPIC_TOPIC_TRAITS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +//============================================================================== +namespace dds +{ +namespace topic +{ +template +struct is_topic_type; + +/** @cond */ +template +struct topic_type_support; +/** @endcond */ + +/** + * @brief + * Support functionality to get the default type_name of a Topic type. + * + * @code{.cpp} + * std::string typeName = dds::topic::topic_type_name::value(); + * @endcode + */ +template +struct topic_type_name +{ + static std::string value() + { + return "Undefined"; + } +}; + +} +} + +//============================================================================== +/** + * @brief + * Support functionality to check if a given object type is a Topic. + * + * @code{.cpp} + * if (dds::topic::is_topic_type::value) { + * // Foo::Bar type is considered a Topic + * } else { + * // Foo::Bar type is NOT considered a Topic + * } + * @endcode + */ +template +struct dds::topic::is_topic_type +{ + enum {value = 0 }; +}; + + +/** @cond + * IsoCpp doesn't know the TypeSupport concept. The type is automatically + * registered when an Topic is created. So, what does this function do? + */ +template +struct dds::topic::topic_type_support { }; +/** @endcond */ + + +#define REGISTER_TOPIC_TYPE(TOPIC_TYPE) \ + namespace dds { namespace topic { \ + template<> struct is_topic_type { \ + enum { value = 1 }; \ + }; } } + +#endif /* OMG_DDS_TOPIC_TOPIC_TRAITS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/ddstopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/ddstopic.hpp new file mode 100644 index 0000000..e6007c5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/ddstopic.hpp @@ -0,0 +1,31 @@ +/* Copyright 2010, Object Management Group, Inc. +* Copyright 2010, PrismTech, Corp. +* Copyright 2010, Real-Time Innovations, Inc. +* All rights reserved. +* +* 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. +*/ +#ifndef OMG_DDS_TOPIC_PACKAGE_INCLUDE_HPP_ +#define OMG_DDS_TOPIC_PACKAGE_INCLUDE_HPP_ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#endif /* OMG_DDS_TOPIC_PACKAGE_INCLUDE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/AnyTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/AnyTopic.hpp new file mode 100644 index 0000000..f15998e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/AnyTopic.hpp @@ -0,0 +1,30 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_TOPIC_DETAIL_ANY_TOPIC_HPP_ +#define OMG_DDS_TOPIC_DETAIL_ANY_TOPIC_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include + +namespace dds { namespace topic { namespace detail { + typedef dds::topic::TAnyTopic AnyTopic; +} } } + +// End of implementation + +#endif /* OMG_DDS_TOPIC_DETAIL_ANY_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/BuiltinTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/BuiltinTopic.hpp new file mode 100644 index 0000000..db09d16 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/BuiltinTopic.hpp @@ -0,0 +1,46 @@ +#ifndef OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_HPP_ +#define OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include +#include + +namespace dds { namespace topic { namespace detail { + + typedef dds::topic::TParticipantBuiltinTopicData + ParticipantBuiltinTopicData; + + typedef dds::topic::TTopicBuiltinTopicData + TopicBuiltinTopicData; + + typedef dds::topic::TPublicationBuiltinTopicData + PublicationBuiltinTopicData; + + typedef dds::topic::TSubscriptionBuiltinTopicData + SubscriptionBuiltinTopicData; + +} } } + + + +#endif /* OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/BuiltinTopicKey.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/BuiltinTopicKey.hpp new file mode 100644 index 0000000..47a1b0c --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/BuiltinTopicKey.hpp @@ -0,0 +1,29 @@ +#ifndef OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_KEY_HPP_ +#define OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_KEY_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +namespace dds { namespace topic { namespace detail { + typedef dds::topic::TBuiltinTopicKey BuiltinTopicKey; +} } } + +#endif /* OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_KEY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/ContentFilteredTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/ContentFilteredTopic.hpp new file mode 100644 index 0000000..ce889ac --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/ContentFilteredTopic.hpp @@ -0,0 +1,470 @@ +#ifndef OMG_DDS_TOPIC_DETAIL_CONTENTFILTEREDTOPIC_HPP_ +#define OMG_DDS_TOPIC_DETAIL_CONTENTFILTEREDTOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT + +// Required for C++11 +#if __cplusplus == 201103L +#include +#endif + +// meta-programming helpers +namespace detail +{ +template +struct remove_first_from_tuple; + +template +struct remove_first_from_tuple> +{ + using type = std::tuple; +}; + +template +using remove_first_from_tuple_t = typename remove_first_from_tuple::type; + +template +struct callable_traits; + +template +struct callable_traits +{ + using return_type = R; + + static constexpr std::size_t Arity = sizeof...(Args); + + template < std::size_t N, std::enable_if_t * = nullptr> + struct argument + { + using type = typename std::tuple_element>::type; + }; + + using argument_tuple = std::tuple; +}; + +// function pointer +template +struct callable_traits + : public callable_traits {}; + +// member function pointer +template +struct callable_traits + : public callable_traits {}; + +// const member function pointer +template +struct callable_traits + : public callable_traits {}; + +// member object pointer +template +struct callable_traits + : public callable_traits {}; + +// functor +template +struct callable_traits +{ +private: + using call_type = callable_traits; + +public: + using return_type = typename call_type::return_type; + + static constexpr std::size_t Arity = call_type::Arity - 1; + + template < std::size_t N, std::enable_if_t * = nullptr> + struct argument + { + using type = typename call_type::template argument::type; + }; + + using argument_tuple = remove_first_from_tuple_t; +}; + +template +struct callable_traits + : public callable_traits {}; + +template +struct callable_traits + : public callable_traits {}; + +// Concepts of possible callbacks +template +using sample_only_t = std::enable_if_t>::Arity == 1 && + std::is_same>::template argument<0>::type, + const T &>::value && + std::is_same>::return_type, bool>::value +>; + +template +using sample_info_only_t = std::enable_if_t>::Arity == 1 && + std::is_same>::template argument<0>::type, + const dds::sub::SampleInfo &>::value && + std::is_same>::return_type, bool>::value +>; + +template +using sample_and_sample_info_t = std::enable_if_t>::Arity == 2 && + std::is_same>::template argument<0>::type, + const T &>::value && + std::is_same>::template argument<1>::type, + const dds::sub::SampleInfo &>::value && + std::is_same>::return_type, bool>::value +>; + +} // namespace detail + + +namespace dds { +namespace topic { +namespace detail { + +class FunctorHolderBase +{ +public: + FunctorHolderBase() = default; + virtual ~FunctorHolderBase() = default; + FunctorHolderBase(const FunctorHolderBase &) = default; + FunctorHolderBase & operator=(const FunctorHolderBase &) = default; + FunctorHolderBase(FunctorHolderBase &&) = default; + FunctorHolderBase & operator=(FunctorHolderBase &&) = default; + + virtual bool check_sample(const void * sample, const dds_sample_info_t * sample_info) = 0; + + static bool c99_check_sample(const void *sample, void *arg) + { + auto funcHolder = static_cast(arg); + return funcHolder->check_sample(sample, nullptr); + } + + static bool c99_check_sample_info(const dds_sample_info_t * sampleinfo, void * arg) + { + auto funcHolder = static_cast(arg); + return funcHolder->check_sample(nullptr, sampleinfo); + } + + static bool c99_check_sample_and_sample_info( + const void * sample, + const dds_sample_info_t * sampleinfo, void * arg) + { + auto funcHolder = static_cast(arg); + return funcHolder->check_sample(sample, sampleinfo); + } +}; + +template +class FunctorHolder; + +template +class FunctorHolder>: public FunctorHolderBase +{ +public: + /* Remove const to be able to call non-const functors. */ + FunctorHolder(FUN functor) + : myFunctor(std::move(functor)) {} + + bool check_sample(const void * sample, const dds_sample_info_t *) override + { + return myFunctor(*(reinterpret_cast(sample))); + } + +private: + FUN myFunctor; +}; + +template +class FunctorHolder>: public FunctorHolderBase +{ +public: + /* Remove const to be able to call non-const functors. */ + FunctorHolder(FUN functor) + : myFunctor(std::move(functor)) {} + + bool check_sample(const void *, const dds_sample_info_t * sampleinfo) override + { + dds::sub::SampleInfo cxxSampleInfo; + org::eclipse::cyclonedds::sub::AnyDataReaderDelegate::copy_sample_infos( + *sampleinfo, + cxxSampleInfo); + return myFunctor(cxxSampleInfo); + } + +private: + FUN myFunctor; +}; + +template +class FunctorHolder>: public FunctorHolderBase +{ +public: + /* Remove const to be able to call non-const functors. */ + FunctorHolder(FUN functor) + : myFunctor(std::move(functor)) {} + + bool check_sample(const void * sample, const dds_sample_info_t * sampleinfo) override + { + dds::sub::SampleInfo cxxSampleInfo; + org::eclipse::cyclonedds::sub::AnyDataReaderDelegate::copy_sample_infos(*sampleinfo, + cxxSampleInfo); + return myFunctor(*(reinterpret_cast(sample)), cxxSampleInfo); + } + +private: + FUN myFunctor; +}; + +template +class ContentFilteredTopic : + public virtual org::eclipse::cyclonedds::topic::TopicDescriptionDelegate, + public virtual org::eclipse::cyclonedds::core::DDScObjectDelegate +{ +public: + ContentFilteredTopic( + const dds::topic::Topic& topic, + const std::string& name, + const dds::topic::Filter& filter) + : org::eclipse::cyclonedds::core::DDScObjectDelegate(), + org::eclipse::cyclonedds::topic::TopicDescriptionDelegate(topic.domain_participant(), name, topic.type_name()), + myTopic(topic), + myFilter(filter), + myFunctor(nullptr) + { + topic.delegate()->incrNrDependents(); + this->myParticipant.delegate()->add_cfTopic(*this); + this->ser_type_ = topic->get_ser_type(); + } + + virtual ~ContentFilteredTopic() + { + if (!this->closed) { + try { + this->close(); + } catch (...) { + /* Empty: the exception throw should have already traced an error. */ + } + } + // delete the functor + delete myFunctor; + myFunctor = nullptr; + } + + virtual void close() + { + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + myTopic.delegate()->decrNrDependents(); + + // Remove the ContentFilteredTopic from the list of topics in its participant. + this->myParticipant.delegate()->remove_cfTopic(*this); + + org::eclipse::cyclonedds::core::ObjectDelegate::close(); + } + + void + init(org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type weak_ref) + { + /* Set weak_ref before passing ourselves to other isocpp objects. */ + this->set_weak_ref(weak_ref); + /* Register topic at participant. */ + this->myParticipant.delegate()->add_cfTopic(*this); + } + +private: +#if 0 + void validate_filter() + { + q_expr expr = NULL; + uint32_t length; + c_value *params; + + length = myFilter.parameters_length(); + if (length < 100) { + expr = q_parse(myFilter.expression().c_str()); + if (!expr ) { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "filter_expression '%s' is invalid", myFilter.expression().c_str()); + } + } else { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "Invalid number of filter_parameters '%d', maximum is 99", length); + } + + u_topic uTopic = (u_topic)(myTopic.delegate()->get_user_handle()); + + params = reader_parameters(); + if (!u_topicContentFilterValidate2(uTopic, expr, params)) { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "filter_expression '%s' is invalid.", myFilter.expression().c_str()); + } + q_dispose(expr); + os_free(params); + } +#endif +public: + std::string reader_expression() const + { + std::string rExpr; + + rExpr += "select * from "; + rExpr += myTopic.name(); + rExpr += " where "; + rExpr += myFilter.expression(); + return rExpr; + } +#if 0 + c_value *reader_parameters() const + { + c_value *params = NULL; + uint32_t n, length; + org::eclipse::cyclonedds::topic::FilterDelegate::const_iterator paramIterator; + + length = myFilter.parameters_length(); + params = (c_value *)os_malloc(length * sizeof(struct c_value)); + for (n = 0, paramIterator = myFilter.begin(); n < length; n++, paramIterator++) { + params[n] = c_stringValue(const_cast(paramIterator->c_str())); + } + return params; + } +#endif + /** + * @internal Accessor to return the topic filter. + * @return The dds::topic::Filter in effect on this topic. + */ + const dds::topic::Filter& filter() const + { + return myFilter; + } + + /** + * @internal Sets the filter parameters for this content filtered topic. + * @param begin The iterator holding the first string param + * @param end The last item in the string iteration + */ + template + void filter_parameters(const FWIterator& begin, const FWIterator& end) + { + ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Changing of Filter parameters is currently not supported."); + myFilter.parameters(begin, end); + //@todo validate_filter(); + } + + const dds::topic::Topic& topic() const + { + return myTopic; + } + + const std::string& filter_expression() const + { + return myFilter.expression(); + } + + const dds::core::StringSeq filter_parameters() const + { + return dds::core::StringSeq(myFilter.begin(), myFilter.end()); + } +#if 0 + dds::topic::TTopicDescription clone() + { + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + typename dds::topic::ContentFilteredTopic::DELEGATE_REF_T ref( + new ContentFilteredTopic(this->myTopic, this->myTopicName, this->myFilter)); + ref->init(ref); + + return dds::topic::ContentFilteredTopic(ref); + } +#endif + + template * = nullptr> + void filter_function(Functor && func) + { + dds_topic_filter flt; + flt.mode = DDS_TOPIC_FILTER_SAMPLE_ARG; + flt.f.sample_arg = &FunctorHolderBase::c99_check_sample; + filter_function_internal(std::forward(func), &flt); + } + + template * = nullptr> + void filter_function(Functor && func) + { + dds_topic_filter flt; + flt.mode = DDS_TOPIC_FILTER_SAMPLEINFO_ARG; + flt.f.sampleinfo_arg = &FunctorHolderBase::c99_check_sample_info; + filter_function_internal(std::forward(func), &flt); + } + + template * = nullptr> + void filter_function(Functor && func) + { + dds_topic_filter flt; + flt.mode = DDS_TOPIC_FILTER_SAMPLE_SAMPLEINFO_ARG; + flt.f.sample_sampleinfo_arg = &FunctorHolderBase::c99_check_sample_and_sample_info; + filter_function_internal(std::forward(func), &flt); + } + +private: + template + void filter_function_internal(Functor && func, dds_topic_filter * flt) + { + /* Make a private copy of the topic so my filter doesn't bother the original topic. */ + dds_qos_t* ddsc_qos = myTopic.qos()->ddsc_qos(); + ddsi_sertype *st = org::eclipse::cyclonedds::topic::TopicTraits::getSerType(); + dds_entity_t cfTopic = dds_create_topic_sertype( + myTopic.domain_participant().delegate()->get_ddsc_entity(), myTopic.name().c_str(), &st, ddsc_qos, NULL, NULL); + dds_delete_qos(ddsc_qos); + this->set_ddsc_entity(cfTopic); + + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + if (this->myFunctor) + { + delete this->myFunctor; + } + myFunctor = new FunctorHolder(std::forward(func)); + flt->arg = myFunctor; + dds_set_topic_filter_extended(cfTopic, flt); + } + + dds::topic::Topic myTopic; + dds::topic::Filter myFilter; + FunctorHolderBase *myFunctor; +}; + +} +} +} + +#endif /* OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT */ + +#endif /* OMG_DDS_TOPIC_DETAIL_CONTENTFILTEREDTOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/Filter.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/Filter.hpp new file mode 100644 index 0000000..71173ef --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/Filter.hpp @@ -0,0 +1,25 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDS_TOPIC_DETAIL_QUERY_HPP_ +#define DDS_TOPIC_DETAIL_QUERY_HPP_ + +#include +#include + +namespace dds { +namespace topic { +namespace detail { +typedef ::dds::topic::TFilter< ::org::eclipse::cyclonedds::topic::FilterDelegate > Filter; +} +} +} +#endif /* DDS_TOPIC_DETAIL_QUERY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/MultiTopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/MultiTopic.hpp new file mode 100644 index 0000000..d33b093 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/MultiTopic.hpp @@ -0,0 +1,135 @@ +#ifndef OMG_DDS_TOPIC_DETAIL_MULTI_TOPIC_HPP_ +#define OMG_DDS_TOPIC_DETAIL_MULTI_TOPIC_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +#include +#include +#include +#include + +#ifdef OMG_DDS_MULTI_TOPIC_SUPPORT + +namespace dds { namespace topic { namespace detail { + + +template +class MultiTopic : public org::eclipse::cyclonedds::topic::TopicDescriptionDelegate +{ +public: + MultiTopic( + const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string expression, + const FWDIterator& params_begin, + const FWDIterator& params_end) + : ::dds::core::Reference< DELEGATE >( + new dds::topic::detail::MultiTopic(dp, name, expression, params_begin, params_end)) + { + // Set the correct (IDL) type_name in the TopicDescription. + dds::topic::detail::TopicDescription::myTypeName = org::eclipse::cyclonedds::topic::TopicTraits::getTypeName(); + + //@todo validate_filter(); + } + + virtual ~MultiTopic() + { + // Assume destructor of Filter attribute cleans up itself. + } + +private: +#if 0 + void validate_filter() + { + q_expr expr = NULL; + uint32_t length; + c_value *params; + + length = myFilter.parameters_length(); + if (length < 100) { + expr = q_parse(myFilter.expression().c_str()); + if (!expr ) { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "filter_expression '%s' is invalid", myFilter.expression().c_str()); + } + } else { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "Invalid number of filter_parameters '%d', maximum is 99", length); + } + + params = reader_parameters(); + /* The function below does not exist yet, but probably a function like it will need to be developed. */ + if (!u_topicMultiExprValidate(dp.delegate()->get_user_handle(), myFilter.expression().c_str(), params)) { + ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, + "filter_expression '%s' is invalid.", myFilter.expression().c_str()); + } + q_dispose(expr); + os_free(params); + } +#endif +public: + std::string reader_expression() const + { + return myFilter.expression(); + } +#if 0 + c_value *reader_parameters() const + { + c_value *params = NULL; + uint32_t n, length; + org::eclipse::cyclonedds::topic::FilterDelegate::const_iterator paramIterator; + + length = myFilter.parameters_length(); + params = (c_value *)os_malloc(length * sizeof(struct c_value)); + for (n = 0, paramIterator = myFilter.begin(); n < length; n++, paramIterator++) { + params[n] = c_stringValue(const_cast(paramIterator->c_str())); + } + return params; + } +#endif + const std::string expression() const + { + return myFilter.expression(); + } + + template + void expression_parameters(const FWIterator& params_begin, const FWIterator& params_end) + { + myFilter.parameters(begin, end); + validate_filter(); + } + + const dds::core::StringSeq expression_parameters() const + { + return dds::core::StringSeq(myFilter.begin(), myFilter.end()); + } + +private: + dds::topic::Filter myFilter; +}; + +} +} +} +#endif /* OMG_DDS_MULTI_TOPIC_SUPPORT */ + +#endif /* OMG_DDS_TOPIC_DETAIL_MULTI_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/TAnyTopicImpl.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/TAnyTopicImpl.hpp new file mode 100644 index 0000000..6e2d97e --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/TAnyTopicImpl.hpp @@ -0,0 +1,73 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TANYTOPIC_IMPL_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TANYTOPIC_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace topic +{ + +template +dds::topic::qos::TopicQos +TAnyTopic::qos() const +{ + return this->delegate()->qos(); +} + +template +void +TAnyTopic::qos(const dds::topic::qos::TopicQos& qos) +{ + this->delegate()->qos(qos); +} + +template +TAnyTopic& +TAnyTopic::operator << (const dds::topic::qos::TopicQos& qos) +{ + this->delegate()->qos(qos); + return *this; +} + +template +const TAnyTopic& +TAnyTopic::operator >> (dds::topic::qos::TopicQos& qos) const +{ + qos = this->delegate()->qos(); + return *this; +} + +template +dds::core::status::InconsistentTopicStatus +TAnyTopic::inconsistent_topic_status() const +{ + return this->delegate()->inconsistent_topic_status(); +} + + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TANYTOPIC_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/TBuiltinTopicImpl.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/TBuiltinTopicImpl.hpp new file mode 100644 index 0000000..31544ac --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/TBuiltinTopicImpl.hpp @@ -0,0 +1,580 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TBUILTINTOPIC_IMPL_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TBUILTINTOPIC_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation +namespace dds +{ +namespace topic +{ + +//TParticipantBuiltinTopicData +template +const dds::topic::BuiltinTopicKey& TParticipantBuiltinTopicData::key() const +{ + return this->delegate().key(); +} + +template +const ::dds::core::policy::UserData& TParticipantBuiltinTopicData::user_data() const +{ + return this->delegate().user_data(); +} + +//TTopicBuiltinTopicData +template +const dds::topic::BuiltinTopicKey& TTopicBuiltinTopicData::key() const +{ + return this->delegate().key(); +} + +template +const std::string& TTopicBuiltinTopicData::name() const +{ + return this->delegate().name(); +} + +template +const std::string& TTopicBuiltinTopicData::type_name() const +{ + return this->delegate().type_name(); +} + +template +const ::dds::core::policy::Durability& TTopicBuiltinTopicData::durability() const +{ + return this->delegate().durability(); +} + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT +template +const ::dds::core::policy::DurabilityService& TTopicBuiltinTopicData::durability_service() const +{ + return this->delegate().durability_service(); +} + +#endif // OMG_DDS_PERSISTENCE_SUPPORT + +template +const ::dds::core::policy::Deadline& TTopicBuiltinTopicData::deadline() const +{ + return this->delegate().deadline(); +} + +template +const ::dds::core::policy::LatencyBudget& TTopicBuiltinTopicData::latency_budget() const +{ + return this->delegate().latency_budget(); +} + +template +const ::dds::core::policy::Liveliness& TTopicBuiltinTopicData::liveliness() const +{ + return this->delegate().liveliness(); +} + +template +const ::dds::core::policy::Reliability& TTopicBuiltinTopicData::reliability() const +{ + return this->delegate().reliability(); +} + +template +const ::dds::core::policy::TransportPriority& TTopicBuiltinTopicData::transport_priority() const +{ + return this->delegate().transport_priority(); +} + +template +const ::dds::core::policy::Lifespan& TTopicBuiltinTopicData::lifespan() const +{ + return this->delegate().lifespan(); +} + +template +const ::dds::core::policy::DestinationOrder& TTopicBuiltinTopicData::destination_order() const +{ + return this->delegate().destination_order(); +} + +template +const ::dds::core::policy::History& TTopicBuiltinTopicData::history() const +{ + return this->delegate().history(); +} + +template +const ::dds::core::policy::ResourceLimits& TTopicBuiltinTopicData::resource_limits() const +{ + return this->delegate().resource_limits(); +} + +template +const ::dds::core::policy::Ownership& TTopicBuiltinTopicData::ownership() const +{ + return this->delegate().ownership(); +} + +template +const ::dds::core::policy::TopicData& TTopicBuiltinTopicData::topic_data() const +{ + return this->delegate().topic_data(); +} + +//TPublicationBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TPublicationBuiltinTopicData::key() const +{ + return this->delegate().key(); +} + +template +const dds::topic::BuiltinTopicKey& TPublicationBuiltinTopicData::participant_key() const +{ + return this->delegate().key(); +} + +template +const std::string& TPublicationBuiltinTopicData::topic_name() const +{ + return this->delegate().topic_name(); +} + +template +const std::string& TPublicationBuiltinTopicData::type_name() const +{ + return this->delegate().type_name(); +} + +template +const ::dds::core::policy::Durability& TPublicationBuiltinTopicData::durability() const +{ + return this->delegate().durability(); +} + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + +template +const ::dds::core::policy::DurabilityService& TPublicationBuiltinTopicData::durability_service() const +{ + return this->delegate().durability_service(); +} +#endif // OMG_DDS_PERSISTENCE_SUPPORT + +template +const ::dds::core::policy::Deadline& TPublicationBuiltinTopicData::deadline() const +{ + return this->delegate().deadline(); +} + +template +const ::dds::core::policy::LatencyBudget& TPublicationBuiltinTopicData::latency_budget() const +{ + return this->delegate().latency_budget(); +} + +template +const ::dds::core::policy::Liveliness& TPublicationBuiltinTopicData::liveliness() const +{ + return this->delegate().liveliness(); +} + +template +const ::dds::core::policy::Reliability& TPublicationBuiltinTopicData::reliability() const +{ + return this->delegate().reliability(); +} + + +template +const ::dds::core::policy::Lifespan& TPublicationBuiltinTopicData::lifespan() const +{ + return this->delegate().lifespan(); +} + +template +const ::dds::core::policy::UserData& TPublicationBuiltinTopicData::user_data() const +{ + return this->delegate().user_data(); +} + +template +const ::dds::core::policy::Ownership& TPublicationBuiltinTopicData::ownership() const +{ + return this->delegate().ownership(); +} + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + +template +const ::dds::core::policy::OwnershipStrength& TPublicationBuiltinTopicData::ownership_strength() const +{ + return this->delegate().ownership_strength(); +} +#endif // OMG_DDS_OWNERSHIP_SUPPORT + + +template +const ::dds::core::policy::DestinationOrder& TPublicationBuiltinTopicData::destination_order() const +{ + return this->delegate().destination_order(); +} + +template +const ::dds::core::policy::Presentation& TPublicationBuiltinTopicData::presentation() const +{ + return this->delegate().presentation(); +} + +template +const ::dds::core::policy::Partition& TPublicationBuiltinTopicData::partition() const +{ + return this->delegate().partition(); +} + +template +const ::dds::core::policy::TopicData& TPublicationBuiltinTopicData::topic_data() const +{ + return this->delegate().topic_data(); +} + +template +const ::dds::core::policy::GroupData& TPublicationBuiltinTopicData::group_data() const +{ + return this->delegate().group_data(); +} + + + +template +const dds::topic::BuiltinTopicKey& TSubscriptionBuiltinTopicData::key() const +{ + return this->delegate().key(); +} + +template +const dds::topic::BuiltinTopicKey& TSubscriptionBuiltinTopicData::participant_key() const +{ + return this->delegate().key(); +} + +template +const std::string& TSubscriptionBuiltinTopicData::topic_name() const +{ + return this->delegate().topic_name(); +} + +template +const std::string& TSubscriptionBuiltinTopicData::type_name() const +{ + return this->delegate().type_name(); +} + +template +const ::dds::core::policy::Durability& TSubscriptionBuiltinTopicData::durability() const +{ + return this->delegate().durability(); +} + +template +const ::dds::core::policy::Deadline& TSubscriptionBuiltinTopicData::deadline() const +{ + return this->delegate().deadline(); +} + +template +const ::dds::core::policy::LatencyBudget& TSubscriptionBuiltinTopicData::latency_budget() const +{ + return this->delegate().latency_budget(); +} + +template +const ::dds::core::policy::Liveliness& TSubscriptionBuiltinTopicData::liveliness() const +{ + return this->delegate().liveliness(); +} + +template +const ::dds::core::policy::Reliability& TSubscriptionBuiltinTopicData::reliability() const +{ + return this->delegate().reliability(); +} + +template +const ::dds::core::policy::Ownership& TSubscriptionBuiltinTopicData::ownership() const +{ + return this->delegate().ownership(); +} + +template +const ::dds::core::policy::DestinationOrder& TSubscriptionBuiltinTopicData::destination_order() const +{ + return this->delegate().destination_order(); +} + +template +const ::dds::core::policy::UserData& TSubscriptionBuiltinTopicData::user_data() const +{ + return this->delegate().user_data(); +} + +template +const ::dds::core::policy::TimeBasedFilter& TSubscriptionBuiltinTopicData::time_based_filter() const +{ + return this->delegate().time_based_filter(); +} + +template +const ::dds::core::policy::Presentation& TSubscriptionBuiltinTopicData::presentation() const +{ + return this->delegate().presentation(); +} + +template +const ::dds::core::policy::Partition& TSubscriptionBuiltinTopicData::partition() const +{ + return this->delegate().partition(); +} + +template +const ::dds::core::policy::TopicData& TSubscriptionBuiltinTopicData::topic_data() const +{ + return this->delegate().topic_data(); +} + +template +const ::dds::core::policy::GroupData& TSubscriptionBuiltinTopicData::group_data() const +{ + return this->delegate().group_data(); +} + +#if 0 + +//TCMParticipantBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TCMParticipantBuiltinTopicData::key() const +{ + return ((D)this->delegate()).key(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMParticipantBuiltinTopicData::product() const +{ + return ((D)this->delegate()).product(); +} + +//TCMPublisherBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TCMPublisherBuiltinTopicData::key() const +{ + return ((D)this->delegate()).key(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMPublisherBuiltinTopicData::product() const +{ + return ((D)this->delegate()).product(); +} + +template +const dds::topic::BuiltinTopicKey& TCMPublisherBuiltinTopicData::participant_key() const +{ + return ((D)this->delegate()).participant_key(); +} + +template +const std::string& TCMPublisherBuiltinTopicData::name() const +{ + return ((D)this->delegate()).name(); +} + +template +const ::dds::core::policy::EntityFactory& TCMPublisherBuiltinTopicData::entity_factory() const +{ + return ((D)this->delegate()).entity_factory(); +} + +template +const ::dds::core::policy::Partition& TCMPublisherBuiltinTopicData::partition() const +{ + return ((D)this->delegate()).partition(); +} + +//TCMSubscriberBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TCMSubscriberBuiltinTopicData::key() const +{ + return ((D)this->delegate()).key(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMSubscriberBuiltinTopicData::product() const +{ + return ((D)this->delegate()).product(); +} + +template +const dds::topic::BuiltinTopicKey& TCMSubscriberBuiltinTopicData::participant_key() const +{ + return ((D)this->delegate()).participant_key(); +} + +template +const std::string& TCMSubscriberBuiltinTopicData::name() const +{ + return ((D)this->delegate()).name(); +} + +template +const ::dds::core::policy::EntityFactory& TCMSubscriberBuiltinTopicData::entity_factory() const +{ + return ((D)this->delegate()).entity_factory(); +} + +template +const ::dds::core::policy::Partition& TCMSubscriberBuiltinTopicData::partition() const +{ + return ((D)this->delegate()).partition(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::Share& TCMSubscriberBuiltinTopicData::share() const +{ + return ((D)this->delegate()).share(); +} + +//TCMDataWriterBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TCMDataWriterBuiltinTopicData::key() const +{ + return ((D)this->delegate()).key(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMDataWriterBuiltinTopicData::product() const +{ + return ((D)this->delegate()).product(); +} + +template +const dds::topic::BuiltinTopicKey& TCMDataWriterBuiltinTopicData::publisher_key() const +{ + return ((D)this->delegate()).publisher_key(); +} + +template +const std::string& TCMDataWriterBuiltinTopicData::name() const +{ + return ((D)this->delegate()).name(); +} + +template +const ::dds::core::policy::History& TCMDataWriterBuiltinTopicData::history() const +{ + return ((D)this->delegate()).history(); +} + +template +const ::dds::core::policy::ResourceLimits& TCMDataWriterBuiltinTopicData::resource_limits() const +{ + return ((D)this->delegate()).resource_limits(); +} + +template +const ::dds::core::policy::WriterDataLifecycle& TCMDataWriterBuiltinTopicData::writer_data_lifecycle() const +{ + return ((D)this->delegate()).writer_data_lifecycle(); +} + +//TCMDataReaderBuiltinTopicData + +template +const dds::topic::BuiltinTopicKey& TCMDataReaderBuiltinTopicData::key() const +{ + return ((D)this->delegate()).key(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMDataReaderBuiltinTopicData::product() const +{ + return ((D)this->delegate()).product(); +} + +template +const dds::topic::BuiltinTopicKey& TCMDataReaderBuiltinTopicData::subscriber_key() const +{ + return ((D)this->delegate()).subscriber_key(); +} + +template +const std::string& TCMDataReaderBuiltinTopicData::name() const +{ + return ((D)this->delegate()).name(); +} + +template +const ::dds::core::policy::History& TCMDataReaderBuiltinTopicData::history() const +{ + return ((D)this->delegate()).history(); +} + +template +const ::dds::core::policy::ResourceLimits& TCMDataReaderBuiltinTopicData::resource_limits() const +{ + return ((D)this->delegate()).resource_limits(); +} + +template +const ::dds::core::policy::ReaderDataLifecycle& TCMDataReaderBuiltinTopicData::reader_data_lifecycle() const +{ + return ((D)this->delegate()).reader_data_lifecycle(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::SubscriptionKey& TCMDataReaderBuiltinTopicData::subscription_keys() const +{ + return ((D)this->delegate()).subscription_keys(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::ReaderLifespan& TCMDataReaderBuiltinTopicData::reader_lifespan() const +{ + return ((D)this->delegate()).reader_lifespan(); +} + +template +const ::org::eclipse::cyclonedds::core::policy::Share& TCMDataReaderBuiltinTopicData::share() const +{ + return ((D)this->delegate()).share(); +} +#endif + +} +} +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TBUILTINTOPIC_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/TBuiltinTopicKeyImpl.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/TBuiltinTopicKeyImpl.hpp new file mode 100644 index 0000000..2b56bc3 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/TBuiltinTopicKeyImpl.hpp @@ -0,0 +1,48 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_TBUILTINTOPICKEY_IMPL_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_TBUILTINTOPICKEY_IMPL_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace topic +{ + +template +const int32_t* TBuiltinTopicKey::value() const +{ + return this->delegate().value(); +} + +template +void TBuiltinTopicKey::value(int32_t v[]) +{ + return this->delegate().value(v); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_TBUILTINTOPICKEY_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/TContentFilteredTopicImpl.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/TContentFilteredTopicImpl.hpp new file mode 100644 index 0000000..45382fe --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/TContentFilteredTopicImpl.hpp @@ -0,0 +1,77 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TCONTENTFILTEREDTOPIC_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TCONTENTFILTEREDTOPIC_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace topic +{ +template class DELEGATE> +ContentFilteredTopic::ContentFilteredTopic(const Topic& topic, + const std::string& name, + const dds::topic::Filter& filter) : + ::dds::core::Reference< DELEGATE >( + new dds::topic::detail::ContentFilteredTopic(topic, name, filter)) +{ + this->delegate()->init(::dds::core::Reference< DELEGATE >::impl_); +} + +template class DELEGATE> +ContentFilteredTopic::~ContentFilteredTopic() +{ + // Nothing to be done yet.... +} + +template class DELEGATE> +const std::string& ContentFilteredTopic::filter_expression() const +{ + return this->delegate()->filter_expression(); +} + +template class DELEGATE> +const dds::core::StringSeq ContentFilteredTopic::filter_parameters() const +{ + return this->delegate()->filter_parameters(); +} + +template class DELEGATE> +template +void ContentFilteredTopic::filter_parameters(const FWDIterator& begin, const FWDIterator& end) +{ + this->delegate()->filter_parameters(begin, end); +} + +template class DELEGATE> +const dds::topic::Topic& ContentFilteredTopic::topic() const +{ + return this->delegate()->topic(); +} + + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TCONTENTFILTEREDTOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/TFilterImpl.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/TFilterImpl.hpp new file mode 100644 index 0000000..c346cef --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/TFilterImpl.hpp @@ -0,0 +1,105 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TFILTER_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TFILTER_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace topic +{ + +template +TFilter::TFilter(const std::string& query_expression) : + dds::core::Value(query_expression) +{ +} + +template +template +TFilter::TFilter(const std::string& query_expression, const FWIterator& params_begin, + const FWIterator& params_end) + : dds::core::Value(query_expression, params_begin, params_end) +{ } + +template +TFilter::TFilter(const std::string& query_expression, + const std::vector& params) : + dds::core::Value(query_expression, params.begin(), params.end()) +{ +} + +template +const std::string& TFilter::expression() const +{ + return this->delegate().expression(); +} + +template +typename TFilter::const_iterator TFilter::begin() const +{ + return this->delegate().begin(); +} + +template +typename TFilter::const_iterator TFilter::end() const +{ + return this->delegate().end(); +} + +template +typename TFilter::iterator TFilter::begin() +{ + return this->delegate().begin(); +} + +template +typename TFilter::iterator TFilter::end() +{ + return this->delegate().end(); +} + +template +template +void TFilter::parameters(const FWIterator& begin, const FWIterator end) +{ + this->delegate().parameters(begin, end); +} + +template +void TFilter::add_parameter(const std::string& param) +{ + this->delegate().add_parameter(param); +} + +template +uint32_t TFilter::parameters_length() const +{ + return this->delegate().parameters_length(); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TFILTER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/TTopicDescriptionImpl.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/TTopicDescriptionImpl.hpp new file mode 100644 index 0000000..fa2a6da --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/TTopicDescriptionImpl.hpp @@ -0,0 +1,54 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TTOPICDESCRIPTION_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TTOPICDESCRIPTION_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace topic +{ + +template +const std::string& TTopicDescription::name() const +{ + return this->delegate()->name(); +} + +template +const std::string& TTopicDescription::type_name() const +{ + return this->delegate()->type_name(); +} + +template +const dds::domain::DomainParticipant& TTopicDescription::domain_participant() const +{ + return this->delegate()->domain_participant(); +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TTOPICDESCRIPTION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/TTopicImpl.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/TTopicImpl.hpp new file mode 100644 index 0000000..bfa7424 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/TTopicImpl.hpp @@ -0,0 +1,395 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TTOPIC_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TTOPIC_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include +#include "org/eclipse/cyclonedds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/TopicListener.hpp" + +#include +#include + +#define MAX_TOPIC_NAME_LEN 1024 + +// Implementation + +namespace dds +{ +namespace topic +{ + + +/*************************************************************************** + * + * dds/topic/Topic<> WRAPPER implementation. + * Declaration can be found in dds/topic/TTopic.hpp + * + ***************************************************************************/ + + +template class DELEGATE> +Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name) : + ::dds::core::Reference< DELEGATE >(new DELEGATE( + dp, + topic_name, + "", + dp.default_topic_qos(), + NULL, + dds::core::status::StatusMask::none())) +{ + this->delegate()->init(this->impl_); +} + +template class DELEGATE> +Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const std::string& type_name) : + ::dds::core::Reference< DELEGATE >(new DELEGATE( + dp, + topic_name, + type_name, + dp.default_topic_qos(), + NULL, + dds::core::status::StatusMask::none())), + ::dds::topic::TAnyTopic< DELEGATE >(::dds::core::Reference< DELEGATE >::delegate()) +{ + throw dds::core::UnsupportedError(std::string("Only Topics with default type_names are supported")); + /* this->delegate()->init(this->impl_); */ +} + +template class DELEGATE> +Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener, + const dds::core::status::StatusMask& mask) : + ::dds::core::Reference< DELEGATE >(new DELEGATE( + dp, + topic_name, + "", + qos, + listener, + mask)), + ::dds::topic::TAnyTopic< DELEGATE >(::dds::core::Reference< DELEGATE >::delegate()) +{ + this->delegate()->init(this->impl_); +} + +template class DELEGATE> +Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener, + const dds::core::status::StatusMask& mask) : + ::dds::core::Reference< DELEGATE >(new DELEGATE( + dp, + topic_name, + type_name, + qos, + listener, + mask)), + ::dds::topic::TAnyTopic< DELEGATE >(::dds::core::Reference< DELEGATE >::delegate()) +{ + throw dds::core::UnsupportedError(std::string("Only Topics with default type_names are supported")); + /* this->delegate()->init(this->impl_); */ +} + +/** @internal @todo Relates to OMG_DDS_X_TYPE_DYNAMIC_TYPE_SUPPORT OSPL-1736 no implementation */ +template class DELEGATE> +void Topic::listener(Listener* listener, + const ::dds::core::status::StatusMask& event_mask) +{ + this->delegate()->listener(listener, event_mask); +} + +/** @internal @todo Relates to OMG_DDS_X_TYPE_DYNAMIC_TYPE_SUPPORT OSPL-1736 no implementation */ +template class DELEGATE> +typename Topic::Listener* Topic::listener() const +{ + return this->delegate()->listener(); +} + + +} +} + + + + +/*************************************************************************** + * + * dds/topic/detail/Topic<> DELEGATE implementation. + * Declaration can be found in dds/topic/detail/Topic.hpp + * + * Implementation and declaration have been separated because some circular + * dependencies, like with TopicListener and AnyTopic. + * + ***************************************************************************/ + +#include +#include +#include +//#include +#include +#include + +#include "dds/ddsi/ddsi_sertype.h" + +template +dds::topic::detail::Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener, + const dds::core::status::StatusMask& mask) + : org::eclipse::cyclonedds::topic::TopicDescriptionDelegate(dp, name, type_name), + org::eclipse::cyclonedds::topic::AnyTopicDelegate(qos, dp, name, type_name) +{ + // Set the correct (IDL) type_name in the TopicDescription. + org::eclipse::cyclonedds::topic::TopicDescriptionDelegate::myTypeName = org::eclipse::cyclonedds::topic::TopicTraits::getTypeName(); + + // get and validate the ddsc qos + org::eclipse::cyclonedds::topic::qos::TopicQosDelegate tQos = qos.delegate(); + tQos.check(); + dds_qos_t* ddsc_qos = tQos.ddsc_qos(); + dds_entity_t ddsc_par = dp.delegate()->get_ddsc_entity(); + + ser_type_ = org::eclipse::cyclonedds::topic::TopicTraits::getSerType(); + + dds_entity_t ddsc_topic = dds_create_topic_sertype( + ddsc_par, name.c_str(), &ser_type_, ddsc_qos, NULL, NULL); + + dds_delete_qos(ddsc_qos); + + if (ddsc_topic < 0) { + ddsi_sertype_unref(ser_type_); + ISOCPP_DDSC_RESULT_CHECK_AND_THROW(ddsc_topic, "Could not create topic."); + } + + this->set_ddsc_entity(ddsc_topic); + + this->listener(listener, mask); + + this->AnyTopicDelegate::set_sample(&this->sample_); +} + +template +dds::topic::detail::Topic::Topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds_entity_t ddsc_topic) + : org::eclipse::cyclonedds::topic::TopicDescriptionDelegate(dp, name, type_name), + org::eclipse::cyclonedds::topic::AnyTopicDelegate(qos, dp, name, type_name) +{ + this->set_ddsc_entity(ddsc_topic); + this->listener(NULL, dds::core::status::StatusMask::none()); + + this->AnyTopicDelegate::set_sample(&this->sample_); +} + + +template +dds::topic::detail::Topic::~Topic() +{ + if (!closed) { + try { + close(); + } catch (...) { + + } + } +} + +template +void +dds::topic::detail::Topic::close() +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + if (this->hasDependents()) { + ISOCPP_THROW_EXCEPTION(ISOCPP_PRECONDITION_NOT_MET_ERROR, "Topic still has unclosed dependencies (e.g. Readers/Writers/ContentFilteredTopics)"); + } + + this->listener_set(NULL, dds::core::status::StatusMask::none()); + + this->myParticipant.delegate()->remove_topic(*this); + + org::eclipse::cyclonedds::core::EntityDelegate::close(); +} + +template +void +dds::topic::detail::Topic::init(ObjectDelegate::weak_ref_type weak_ref) +{ + /* Set weak_ref before passing ourselves to other isocpp objects. */ + this->set_weak_ref(weak_ref); + /* Add weak_ref to the map of entities */ + this->add_to_entity_map(weak_ref); + /* Register topic at participant. */ + this->myParticipant.delegate()->add_topic(*this); + + /* Enable when needed. */ + if (this->myParticipant.delegate()->is_auto_enable()) { + this->enable(); + } +} + + +template +void +dds::topic::detail::Topic::listener(TopicListener* listener, + const ::dds::core::status::StatusMask& mask) +{ + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + this->listener_set(listener, mask); + scopedLock.unlock(); +} + + +template +dds::topic::TopicListener* +dds::topic::detail::Topic::listener() +{ + this->check(); + return reinterpret_cast*>(this->listener_get()); +} + +template +dds::topic::Topic +dds::topic::detail::Topic::wrapper() +{ + + typename Topic::ref_type ref = + ::std::dynamic_pointer_cast >(this->get_strong_ref()); + dds::topic::Topic topic(ref); + + return topic; +} + +template +void +dds::topic::detail::Topic::listener_notify( + ObjectDelegate::ref_type source, + uint32_t triggerMask, + void *eventData, + void *l) +{ + (void)source; + (void)triggerMask; + (void)eventData; + (void)l; +} + +template +dds::topic::Topic +dds::topic::detail::Topic::discover_topic( + const dds::domain::DomainParticipant& dp, + const std::string& name, + const dds::core::Duration& timeout) +{ + dds::topic::Topic found = dds::core::null; + std::unique_ptr > + type_info(org::eclipse::cyclonedds::topic::TopicTraits::getTypeInfo(nullptr), + [](dds_typeinfo_t *ti) { static_cast(dds_free_typeinfo(ti)); }); + dds_entity_t ddsc_topic = dp.delegate()->lookup_topic(name, type_info.get(), timeout); + + if (ddsc_topic <= 0) { + return dds::core::null; + } + +#if 0 + /* Add type_name here when non-default ones are supported. */ + size_t slen = MAX_TOPIC_NAME_LEN; + char *ddsc_type_name; + ddsc_type_name = (char *)dds_alloc(slen); + dds_get_type_name(ddsc_topic, ddsc_type_name, slen); + std::string type_name = ddsc_type_name; + dds_free(ddsc_type_name); +#endif + + dds_return_t ret; + dds_qos_t* ddsc_qos = dds_create_qos(); + ret = dds_get_qos(ddsc_topic, ddsc_qos); + dds::topic::qos::TopicQos qos; + if (ret == DDS_RETCODE_OK) { + qos.delegate().ddsc_qos(ddsc_qos); + } + dds_delete_qos(ddsc_qos); + ISOCPP_DDSC_RESULT_CHECK_AND_THROW(ret, "Failed to get the qos from discovered topic"); + + /* + * The found topic could be of the wrong type. This will be indicated + * with a PreconditionNotMetError when we try to create it. + */ + try { + found = dds::topic::Topic(dp, name, qos); + } catch (dds::core::PreconditionNotMetError&) { + /* Ignore; just return dds::core::null */ + } + + return found; +} + + +template +void +dds::topic::detail::Topic::discover_topics( + const dds::domain::DomainParticipant& dp, + std::vector >& topics, + uint32_t max_size) +{ + (void)dp; + (void)topics; + std::vector ddsc_topics; + topics.clear(); + /* + * Unfortunately, DomainParticipantDelegate::lookup_topics() is not + * supported yet and will throw an exception. + */ + dp.delegate()->lookup_topics(topic_type_name::value(), ddsc_topics, max_size); +} + + +template +void dds::topic::detail::Topic::on_inconsistent_topic( + dds_entity_t topic, + org::eclipse::cyclonedds::core::InconsistentTopicStatusDelegate &sd ) +{ + dds::core::status::InconsistentTopicStatus s ; + s.delegate() = sd ; + (void)topic; + dds::topic::Topic t = wrapper() ; + + dds::topic::TopicListener *l = + reinterpret_cast *>(this->listener_get()); + if( (l != NULL) && + (this->get_listener_mask().to_ulong() & + dds::core::status::StatusMask::inconsistent_topic().to_ulong()) ) + { + l->on_inconsistent_topic( t, s ) ; + } +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TTOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/Topic.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/Topic.hpp new file mode 100644 index 0000000..46501e3 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/Topic.hpp @@ -0,0 +1,131 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_TOPIC_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_TOPIC_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +namespace dds +{ +namespace topic +{ +template +class TopicListener; + +} +} + +namespace dds +{ +namespace topic +{ +namespace detail +{ +template +class Topic; +} +} +} + + + +/*************************************************************************** + * + * dds/topic/detail/Topic<> DELEGATE declaration. + * Implementation can be found in dds/topic/detail/TTopicImpl.hpp + * + ***************************************************************************/ +template +class dds::topic::detail::Topic : public org::eclipse::cyclonedds::topic::AnyTopicDelegate +{ +public: + typedef typename ::dds::core::smart_ptr_traits< Topic >::ref_type ref_type; + typedef typename ::dds::core::smart_ptr_traits< Topic >::weak_ref_type weak_ref_type; + + Topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds::topic::TopicListener* listener, + const dds::core::status::StatusMask& mask); + + Topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name, + const dds::topic::qos::TopicQos& qos, + dds_entity_t ddsc_topic); + + virtual ~Topic(); + + virtual void close(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + dds::topic::Topic wrapper(); + + +public: + + void listener(dds::topic::TopicListener* listener, + const ::dds::core::status::StatusMask& mask); + + dds::topic::TopicListener* listener(); + + virtual void listener_notify(ObjectDelegate::ref_type source, + uint32_t triggerMask, + void *eventData, + void *listener); + + dds::topic::TTopicDescription clone(); + + static dds::topic::Topic + discover_topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const dds::core::Duration& timeout); + + static void + discover_topics(const dds::domain::DomainParticipant& dp, + std::vector >& topics, + uint32_t max_size); + + //using ::org::eclipse::cyclonedds::topic::AnyTopicDelegate::on_inconsistent_topic; + + void on_inconsistent_topic( + dds_entity_t topic, + org::eclipse::cyclonedds::core::InconsistentTopicStatusDelegate &s ) ; // !!! + +private: + T sample_; +}; + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/TopicDescription.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/TopicDescription.hpp new file mode 100644 index 0000000..b5ddf27 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/TopicDescription.hpp @@ -0,0 +1,30 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_TOPICDESCRIPTION_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_TOPICDESCRIPTION_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include + +namespace dds { namespace topic { namespace detail { + typedef dds::topic::TTopicDescription TopicDescription; +} } } + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_TOPICDESCRIPTION_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/TopicInstanceImpl.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/TopicInstanceImpl.hpp new file mode 100644 index 0000000..3f142f1 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/TopicInstanceImpl.hpp @@ -0,0 +1,83 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_TOPICINSTANCE_HPP_ +#define CYCLONEDDS_DDS_TOPIC_TOPICINSTANCE_HPP_ + +/** + * @file + */ + +/* + * OMG PSM class declaration + */ +#include + +// Implementation + +namespace dds +{ +namespace topic +{ + +template +TopicInstance::TopicInstance() : h_(dds::core::null) {} + +template +TopicInstance::TopicInstance(const ::dds::core::InstanceHandle& h) + : h_(h), sample_() {} + +template +TopicInstance::TopicInstance(const ::dds::core::InstanceHandle& h, const T& sample) + : h_(h), sample_(sample) { } + +template +TopicInstance::operator const ::dds::core::InstanceHandle() const +{ + return h_; +} + +template +const ::dds::core::InstanceHandle TopicInstance::handle() const +{ + return h_; +} + +template +void TopicInstance::handle(const ::dds::core::InstanceHandle& h) +{ + h_ = h; +} + +template +const T& TopicInstance::sample() const +{ + return sample_; +} + +template +T& TopicInstance::sample() +{ + return sample_; +} + +template +void TopicInstance::sample(const T& sample) +{ + sample_ = sample; +} + +} +} + +// End of implementation + +#endif /* CYCLONEDDS_DDS_TOPIC_TOPICINSTANCE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/ddstopic.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/ddstopic.hpp new file mode 100644 index 0000000..329bdc7 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/ddstopic.hpp @@ -0,0 +1,20 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef OMG_DDS_TOPIC_PACKAGE_DETAIL_INCLUDE_HPP_ +#define OMG_DDS_TOPIC_PACKAGE_DETAIL_INCLUDE_HPP_ + +#include "dds/topic/detail/TTopicDescriptionImpl.hpp" +#include "dds/topic/detail/TTopicImpl.hpp" +#include "dds/topic/detail/TopicInstanceImpl.hpp" +#include "dds/topic/detail/TContentFilteredTopicImpl.hpp" + +#endif /* OMG_DDS_TOPIC_PACKAGE_DETAIL_INCLUDE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/discovery.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/discovery.hpp new file mode 100644 index 0000000..fc08729 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/discovery.hpp @@ -0,0 +1,100 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_DISCOVER_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_DISCOVER_HPP_ + +#include +#include +#include + +#include + + +namespace dds +{ +namespace topic +{ + +template +TOPIC +discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) +{ + TOPIC t = org::eclipse::cyclonedds::topic::lookup_topic::discover(dp, topic_name, timeout); + + return t; +} + + +template +uint32_t +discover( + const dds::domain::DomainParticipant& dp, + FwdIterator begin, + uint32_t max_size) +{ + std::vector list; + + org::eclipse::cyclonedds::topic::lookup_topic::discover(dp, list, max_size); + + FwdIterator fit = begin; + for (typename std::vector::const_iterator it = list.begin(); it != list.end(); ++it) { + *fit++ = *it; + } + + return static_cast(list.size()); +} + +template +uint32_t +discover_all( + const dds::domain::DomainParticipant& dp, + BinIterator begin) +{ + std::vector list; + + org::eclipse::cyclonedds::topic::lookup_topic::discover(dp, list, static_cast(dds::core::LENGTH_UNLIMITED)); + + BinIterator bit = begin; + for (typename std::vector::const_iterator it = list.begin(); it != list.end(); ++it) { + *bit++ = *it; + } + + return list.size(); +} + + +template +void +ignore( + const dds::domain::DomainParticipant& dp, + FwdIterator begin, FwdIterator end) +{ + (void)dp; + (void)begin; + (void)end; + ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported"); +} + +} +} + + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_DISCOVER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/detail/find.hpp b/unitree_SDK/include/ddscxx/dds/topic/detail/find.hpp new file mode 100644 index 0000000..2e8f849 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/detail/find.hpp @@ -0,0 +1,46 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_FIND_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_FIND_HPP_ + + +#include + + +#include + + +namespace dds +{ +namespace topic +{ + +template +TOPIC +find(const dds::domain::DomainParticipant& dp, const std::string& topic_name) +{ + TOPIC t = org::eclipse::cyclonedds::topic::finder::find(dp, topic_name); + + return t; +} + + +} +} + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_FIND_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/discovery.hpp b/unitree_SDK/include/ddscxx/dds/topic/discovery.hpp new file mode 100644 index 0000000..c97e040 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/discovery.hpp @@ -0,0 +1,153 @@ +#ifndef OMG_DDS_TOPIC_DISCOVER_HPP_ +#define OMG_DDS_TOPIC_DISCOVER_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace topic +{ + +/** + * This operation gives access to an specific existing (or ready to exist) enabled + * Topic, ContentFilteredTopic, MultiTopic, AnyTopic or TopicDescription based + * on its topic_name. + * + * Topics that the application has indicated should be 'ignored' (by means of the + * dds::topic::ignore operation) will not appear in this list (note: the ignore + * feature is not yet supported). + * + * If a Topic of the same topic_name already exists, it gives access to this Topic. + * Otherwise it waits (blocks the caller) until another mechanism creates it. This other + * mechanism can be another thread, a configuration tool, or some other Data + * Distribution Service utility. If after the specified timeout the Topic can still not be + * found, the caller gets unblocked and the returned Topic will be dds::core::null. + * + * A Topic that is obtained by means of find_topic in a specific + * DomainParticipant can only be used to create DataReaders and + * DataWriters in that DomainParticipant. + * + * This operation usually results in network look-ups. + * + * For finding only locally created Topics, look + * @link find(const dds::domain::DomainParticipant& dp, const std::string& topic_name) + * here.@endlink + * + * @param dp the DomainParticipant + * @param name the topic name to discover + * @param timeout the time out + * @throws dds::core::Error + * An internal error has occurred. + * @throws dds::core::NullReferenceError + * The DomainParticipant was not properly created and references to dds::core::null. + * @throws dds::core::AlreadyClosedError + * The DomainParticipant has already been closed. + * @throws dds::core::NotEnabledError + * The DomainParticipant has not yet been enabled. + * @throws dds::core::OutOfResourcesError + * The Data Distribution Service ran out of resources to + * complete this operation. + * @throws dds::core::TimeoutError + * No Topics of the given name found within the timeout. + */ +template +TOPIC discover(const dds::domain::DomainParticipant& dp, + const std::string& name, + const dds::core::Duration& timeout = dds::core::Duration::infinite()); + +/** + * This operation retrieves a list of Topics that have been discovered in the domain. + * + * If the max_size of the given list is large enough, all discovered Topics will be + * present in that list. Otherwise, a random sub-set of max_size elements is returned. + * + * Topics that the application has indicated should be 'ignored' (by means of the + * dds::topic::ignore operation) will not appear in this list (note: the ignore + * feature is not yet supported). + * + * Because Topics of various different kinds can be retrieved, the list contains + * AnyTopics. + * + * This operation usually results in network look-ups. + * + * @param dp the DomainParticipant + * @param begin a forward iterator pointing to the beginning of a container + * in which to insert the topics + * @param max_size the maximum number of topics to return + */ +template +uint32_t discover(const dds::domain::DomainParticipant& dp, FwdIterator begin, uint32_t max_size); + +/** + * This operation retrieves a list of all Topics that have been discovered in the domain. + * + * Topics that the application has indicated should be 'ignored' (by means of the + * dds::topic::ignore operation) will not appear in this list (note: the ignore + * feature is not yet supported). + * + * Because Topics of various different kinds can be retrieved, the list contains + * AnyTopics. + * + * This operation usually results in network look-ups. + * + * @param dp the DomainParticipant + * @param begin a back inserting iterator pointing to the beginning of a container + * in which to insert the topics + */ +template +uint32_t discover_all(const dds::domain::DomainParticipant& dp, BinIterator begin); + +/** + * This operation allows an application to instruct the Service to locally ignore + * a remote domain participant. From that point onwards the Service will locally + * behave as if the remote participant did not exist. This means it will ignore any + * Topic, publication, or subscription that originates on that domain participant. + * + * This operation is not yet implemented. It is scheduled for a future release. + * + * @param dp the DomainParticipant + * @param handle the handle of the DomainParticipant to ignore + */ +void OMG_DDS_API ignore(const dds::domain::DomainParticipant& dp, const dds::core::InstanceHandle& handle); + +/** + * This operation allows an application to instruct the Service to locally ignore + * a remote domain participant. From that point onwards the Service will locally + * behave as if the remote participant did not exist. This means it will ignore any + * Topic, publication, or subscription that originates on that domain participant. + * + * This operation is not yet implemented. It is scheduled for a future release. + * + * @param dp the DomainParticipant + * @param begin a forward iterator pointing to the beginning of a sequence of + * InstanceHandles to ignore + * @param end a forward iterator pointing to the end of a sequence of + * InstanceHandles to ignore + */ +template +void ignore(const dds::domain::DomainParticipant& dp, FwdIterator begin, FwdIterator end); + +} +} + +#include + +#endif /* OMG_DDS_TOPIC_DISCOVER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/find.hpp b/unitree_SDK/include/ddscxx/dds/topic/find.hpp new file mode 100644 index 0000000..c22ebbc --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/find.hpp @@ -0,0 +1,53 @@ +#ifndef OMG_DDS_TOPIC_FIND_HPP_ +#define OMG_DDS_TOPIC_FIND_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Inc. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +#include + +namespace dds +{ +namespace topic +{ + +/** + * This operation gives access to a locally-created Topic, ContentFilteredTopic, + * MultiTopic, AnyTopic and TopicDescription with a matching name. + * + * dds::topic::find will never create a Topic but returns a reference to an + * Topic proxy that already exists locally. When no local proxy exists, the + * returned Topic will be a dds::core::null object. The operation never blocks. + * + * For discovering globally available Topics, look + * @link dds::topic::discover(const dds::domain::DomainParticipant&, const std::string&, const dds::core::Duration&) + * here.@endlink + * + * @param dp the DomainParticipant to find the topic on + * @param topic_name the topic name to find + */ +template +TOPIC +find(const dds::domain::DomainParticipant& dp, const std::string& topic_name); + +} +} + +#endif /* OMG_DDS_TOPIC_FIND_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/qos/TopicQos.hpp b/unitree_SDK/include/ddscxx/dds/topic/qos/TopicQos.hpp new file mode 100644 index 0000000..f34b500 --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/qos/TopicQos.hpp @@ -0,0 +1,36 @@ +#ifndef OMG_DDS_TOPIC_QOS_TOPIC_QOS_HPP_ +#define OMG_DDS_TOPIC_QOS_TOPIC_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include + +namespace dds +{ +namespace topic +{ +namespace qos +{ +typedef dds::topic::qos::detail::TopicQos TopicQos; +} +} +} + + +#endif /* OMG_DDS_TOPIC_QOS_TOPIC_QOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/dds/topic/qos/detail/TopicQos.hpp b/unitree_SDK/include/ddscxx/dds/topic/qos/detail/TopicQos.hpp new file mode 100644 index 0000000..251a79f --- /dev/null +++ b/unitree_SDK/include/ddscxx/dds/topic/qos/detail/TopicQos.hpp @@ -0,0 +1,93 @@ +#ifndef OMG_DDS_TOPIC_QOS_DETAIL_TOPIC_QOS_HPP_ +#define OMG_DDS_TOPIC_QOS_DETAIL_TOPIC_QOS_HPP_ + +/* Copyright 2010, Object Management Group, Inc. + * Copyright 2010, PrismTech, Corp. + * Copyright 2010, Real-Time Innovations, Inc. + * All rights reserved. + * + * 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. + */ + +#include +#include + +#ifdef DOXYGEN_FOR_ISOCPP +/* The above macro is never (and must never) be defined in normal compilation. + * + * The class below is just used to create informative API documentation. + * The predoxygen.py script will copy this over the QoS API header file. + */ +/** + * @brief + * This struct provides the basic mechanism for an application to specify Quality of + * Service attributes for a Topic. + * + * @par Attributes + * @anchor anchor_dds_topic_qos_defaults + * QosPolicy | Desciption | Default Value + * ------------------------------------ | -------------------------------------------------------------------------- | -------------------- + * dds::core::policy::TopicData | Additional information (@ref DCPS_QoS_TopicData "info") | TopicData::TopicData(empty) + * dds::core::policy::Durability | Data storage settings for late joiners (@ref DCPS_QoS_Durability "info") | Durability::Volatile() + * dds::core::policy::DurabilityService | Transient/persistent behaviour (@ref DCPS_QoS_DurabilityService "info") | DurabilityService::DurabilityService() + * dds::core::policy::Deadline | Period in which new sample is written (@ref DCPS_QoS_Deadline "info") | Deadline::Deadline(infinite) + * dds::core::policy::LatencyBudget | Used for optimization (@ref DCPS_QoS_LatencyBudget "info") | LatencyBudget::LatencyBudget(zero) + * dds::core::policy::Liveliness | Liveliness assertion mechanism (@ref DCPS_QoS_Liveliness "info") | Liveliness::Automatic() + * dds::core::policy::Reliability | Reliability settings (@ref DCPS_QoS_Reliability "info") | Reliability::Reliable() + * dds::core::policy::DestinationOrder | DataReader data order settings (@ref DCPS_QoS_DestinationOrder "info") | DestinationOrder::ReceptionTimestamp() + * dds::core::policy::History | Data storage settings (@ref DCPS_QoS_History "info") | History::KeepLast(depth 1) + * dds::core::policy::ResourceLimits | Maximum resource settings (@ref DCPS_QoS_ResourceLimits "info") | ResourceLimits::ResourceLimits(all unlimited) + * dds::core::policy::TransportPriority | Priority hint for transport layer (@ref DCPS_QoS_TransportPriority "info") | TransportPriority::TTransportPriority(0) + * dds::core::policy::Lifespan | Maximum duration of validity of data (@ref DCPS_QoS_Lifespan "info") | Lifespan::Lifespan(infinite) + * dds::core::policy::Ownership | Exclusive ownership or not (@ref DCPS_QoS_Ownership "info") | Ownership::Shared() + * dds::core::policy::DataRepresentation | Supported data representation kinds (@ref DCPS_QoS_DataRepresentation "info") | DataRepresentation::DataRepresentation(dds::core::policy::DataRepresentationId::XCDR1) + * dds::core::policy::TypeConsistencyEnforcement | Type consistency enforcement policies (@ref DCPS_QoS_TypeConsistencyEnforcement "info") | dds::core::policy::TypeConsistencyKind::DISALLOW_TYPE_COERCION + * + * A QosPolicy can be set when the Topic is created or modified with the set + * qos operation. + * Both operations take the TopicQos object as a parameter. There may be cases + * where several policies are in conflict. Consistency checking is performed each time + * the policies are modified when they are being created and, in case they are already + * enabled, via the set qos operation. + * + * Some QosPolicy have "immutable" semantics meaning that they can only be + * specified either at Topic creation time or prior to calling the enable + * operation on the Topic. + * + * @see for more information: @ref DCPS_QoS + */ +class dds::topic::qos::TopicQos : public ::dds::core::EntityQos +{ +public: + /** + * Create @ref anchor_dds_topic_qos_defaults "default" QoS. + */ + TopicQos() {} + + /** + * Create copied QoS type. + * + * @param qos the QoS to copy policies from. + */ + TopicQos(const TopicQos& qos); +}; + +#else /* DOXYGEN_FOR_ISOCPP */ + +namespace dds { namespace topic { namespace qos { namespace detail { + typedef ::dds::core::TEntityQos< ::org::eclipse::cyclonedds::topic::qos::TopicQosDelegate > TopicQos; +} } } } + +#endif /* DOXYGEN_FOR_ISOCPP */ + +#endif /* OMG_DDS_TOPIC_QOS_DETAIL_TOPIC_QOS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/ForwardDeclarations.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/ForwardDeclarations.hpp new file mode 100644 index 0000000..5be852a --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/ForwardDeclarations.hpp @@ -0,0 +1,120 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef LITE_FORWARD_DECLARATIONS_HPP_ +#define LITE_FORWARD_DECLARATIONS_HPP_ + +namespace dds +{ + namespace domain + { + class DomainParticipantListener; + + template + class TDomainParticipant; + } + + namespace sub + { + template class DELEGATE> + class DataReader; + + template + class DataReaderListener; + + class SubscriberListener; + + template + class TSubscriber; + + namespace detail + { + template + class DataReader; + + template + class LoanedSamplesHolder; + + template + class SamplesFWInteratorHolder; + + template + class SamplesBIIteratorHolder; + } + } + + namespace pub + { + class PublisherListener; + + template + class TPublisher; + } + + namespace topic + { + template + class TTopicDescription; + + template + class TopicListener; + + template class DELEGATE> + class Topic; + + template class DELEGATE> + class ContentFilteredTopic; + + namespace detail + { + template + class ContentFilteredTopic; + } + } +} + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ + + namespace domain { + class DomainParticipantDelegate; + } + + namespace sub { + class SubscriberDelegate; + } + + namespace pub { + class PublisherDelegate; + } + + namespace topic { + template + class TopicTraits; + + class TopicDescriptionDelegate; + } +} +} +} + +#endif /* LITE_FORWARD_DECLARATIONS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/DDScObjectDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/DDScObjectDelegate.hpp new file mode 100644 index 0000000..684e5a2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/DDScObjectDelegate.hpp @@ -0,0 +1,74 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_USEROBJECT_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_USEROBJECT_DELEGATE_HPP_ + +#include "dds/core/macros.hpp" +#include "dds/core/refmacros.hpp" +#include "org/eclipse/cyclonedds/core/Mutex.hpp" +#include "org/eclipse/cyclonedds/core/ObjectDelegate.hpp" + +#include + +#include "dds/dds.h" + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +DDSCXX_WARNING_MSVC_OFF(4251) + +class OMG_DDS_API DDScObjectDelegate : public virtual org::eclipse::cyclonedds::core::ObjectDelegate +{ +public: + + typedef std::unordered_map entity_map_type; + + DDScObjectDelegate (); + virtual ~DDScObjectDelegate (); + + void close (); + dds_entity_t get_ddsc_entity (); + void set_ddsc_entity (dds_entity_t e); + void add_to_entity_map (org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type weak_ref); + +public: + static ObjectDelegate::ref_type extract_strong_ref(dds_entity_t e); + +protected: + dds_entity_t ddsc_entity; + +private: + void delete_from_entity_map(); + static org::eclipse::cyclonedds::core::DDScObjectDelegate::entity_map_type entity_map; + static Mutex entity_map_mutex; +}; + +DDSCXX_WARNING_MSVC_ON(4251) + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_USEROBJECT_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/EntityDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/EntityDelegate.hpp new file mode 100644 index 0000000..0db0446 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/EntityDelegate.hpp @@ -0,0 +1,140 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_ENTITY_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_ENTITY_DELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +class OMG_DDS_API EntityDelegate : + public virtual ::org::eclipse::cyclonedds::core::DDScObjectDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< EntityDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< EntityDelegate >::weak_ref_type weak_ref_type; + + EntityDelegate(); + virtual ~EntityDelegate(); + + /** + * @internal Enables this entity. + */ + void enable(); + + ::dds::core::status::StatusMask status_changes() const; + + ::dds::core::InstanceHandle instance_handle() const; + + bool contains_entity(const ::dds::core::InstanceHandle& handle); + + ObjectDelegate::ref_type get_statusCondition(); + + virtual void close(); + + virtual void retain(); + + void *listener_get() const; + +protected: + void listener_set(void *listener, + const dds::core::status::StatusMask& mask); + +public: + const dds::core::status::StatusMask get_listener_mask() const ; + + bool obtain_callback_lock() ; + void release_callback_lock() ; + + // Topic callback + virtual void on_inconsistent_topic(dds_entity_t topic, + org::eclipse::cyclonedds::core::InconsistentTopicStatusDelegate &) ; + + + // Writer callbacks + virtual void on_offered_deadline_missed(dds_entity_t writer, + org::eclipse::cyclonedds::core::OfferedDeadlineMissedStatusDelegate &) ; + + virtual void on_offered_incompatible_qos(dds_entity_t writer, + org::eclipse::cyclonedds::core::OfferedIncompatibleQosStatusDelegate &) ; + + virtual void on_liveliness_lost(dds_entity_t writer, + org::eclipse::cyclonedds::core::LivelinessLostStatusDelegate &) ; + + virtual void on_publication_matched(dds_entity_t writer, + org::eclipse::cyclonedds::core::PublicationMatchedStatusDelegate &) ; + + + // Reader callbacks + virtual void on_requested_deadline_missed(dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedDeadlineMissedStatusDelegate &); + + virtual void on_requested_incompatible_qos(dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedIncompatibleQosStatusDelegate &); + + virtual void on_sample_rejected(dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleRejectedStatusDelegate &); + + virtual void on_liveliness_changed(dds_entity_t reader, + org::eclipse::cyclonedds::core::LivelinessChangedStatusDelegate &); + + virtual void on_data_available(dds_entity_t reader); + + virtual void on_subscription_matched(dds_entity_t reader, + org::eclipse::cyclonedds::core::SubscriptionMatchedStatusDelegate &); + + virtual void on_sample_lost(dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleLostStatusDelegate &); + + + // Subscriber callback + virtual void on_data_readers(dds_entity_t subscriber); + +protected: + static volatile unsigned int entityID_; + bool enabled_; + dds::core::status::StatusMask listener_mask; + void prevent_callbacks(); + long callback_count; + dds_listener_t *listener_callbacks; + +private: + void *listener; + ObjectDelegate::weak_ref_type myStatusCondition; + void *callback_mutex; + void *callback_cond; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_ENTITY_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/EntityRegistry.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/EntityRegistry.hpp new file mode 100644 index 0000000..3162c5b --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/EntityRegistry.hpp @@ -0,0 +1,95 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_ENTITY_REGISTRY_HPP_ +#define CYCLONEDDS_CORE_ENTITY_REGISTRY_HPP_ + +#include +#include + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +template +class EntityRegistry +{ +public: + /** + * @internal Inserts a EntityDelegate key, dds::core::Entity value pair into the registry. + * @param key The org::eclipse::cyclonedds::core::Entity to use as a key + * @param val The dds::core::Entity that encapsulates the key + */ + void insert(T key, U& val) + { + mutex.lock(); + registry[key] = dds::core::WeakReference(val); + mutex.unlock(); + } + + /** + * @internal Removes a DDS::Entity from the registry + * @param key Entity to remove + */ + void remove(T key) + { + mutex.lock(); + registry.erase(key); + mutex.unlock(); + } + + /** + * @internal Checks the registry for a dds::core::Entity that wraps the supplied DDS::Entity + * and returns it. If no match is found dds::core::null is returned. + * @param key DDS::Entity to find an encapsulating dds::core:Entity for. + * @return dds::core::Entity if a match is found, dds::core::null if not. + */ + U get(T key) + { + typename std::map >::iterator it; + + mutex.lock(); + it = registry.find(key); + + U entity(dds::core::null); + if(it != registry.end()) + { + entity = it->second.lock(); + } + mutex.unlock(); + + return entity; + } + +private: + std::map > registry; + org::eclipse::cyclonedds::core::Mutex mutex; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_ENTITY_REGISTRY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/EntitySet.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/EntitySet.hpp new file mode 100644 index 0000000..f8c0d8c --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/EntitySet.hpp @@ -0,0 +1,94 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_ENTITY_SET_HPP_ +#define CYCLONEDDS_CORE_ENTITY_SET_HPP_ + +#include + +#include +#include +#include + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +class EntitySet +{ +public: + typedef std::vector::iterator vectorIterator; + typedef std::vector vector; + + /** + * @internal Inserts a EntityDelegate into the set. + * @param entity The org::eclipse::cyclonedds::core::EntityDelegate to store + */ + void insert(org::eclipse::cyclonedds::core::EntityDelegate& entity); + + /** + * @internal Erases a EntityDelegate from the set. + * @param entity The org::eclipse::cyclonedds::core::EntityDelegate to delete + */ + void erase(org::eclipse::cyclonedds::core::EntityDelegate& entity); + + /** + * @internal Check if Entity with specific handle is part of the set. + * @param handle The dds::core::InstanceHandle to search for + */ + bool contains(const dds::core::InstanceHandle& handle); + + /** + * @internal Call close() of all the Entities within the set (outside lock). + */ + void all_close(); + + /** + * @internal Call retain() of all the Entities within the set (outside lock). + */ + void all_retain(); + + /** + * @internal Call enable() of all the Entities within the set (outside lock). + */ + void all_enable(); + + /** + * @internal Copy internal set into a vector. + */ + vector copy(); + +private: + WeakReferenceSet::wset entities; + Mutex mutex; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_ENTITY_SET_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/InstanceHandleDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/InstanceHandleDelegate.hpp new file mode 100644 index 0000000..f4b526e --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/InstanceHandleDelegate.hpp @@ -0,0 +1,71 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_INSTANCE_HANDLE_HPP_ +#define CYCLONEDDS_CORE_INSTANCE_HANDLE_HPP_ + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +class InstanceHandleDelegate; +} +} +} +} + +class OMG_DDS_API org::eclipse::cyclonedds::core::InstanceHandleDelegate +{ +public: + InstanceHandleDelegate(); + InstanceHandleDelegate(dds_instance_handle_t h); +public: + InstanceHandleDelegate(const dds::core::null_type& src); + +public: + bool operator==(const InstanceHandleDelegate& that) const; + + bool operator<(const InstanceHandleDelegate& that) const; + + bool operator>(const InstanceHandleDelegate& that) const; + + InstanceHandleDelegate& operator=(const dds::core::null_type& src); + bool is_nil() const; + +public: + dds_instance_handle_t handle() const; + +private: + dds_instance_handle_t handle_; +}; + +inline std::ostream& +operator << (std::ostream& os, + const org::eclipse::cyclonedds::core::InstanceHandleDelegate& h) +{ + os << h.handle(); + return os; +} +#endif /* CYCLONEDDS_CORE_INSTANCE_HANDLE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ListenerDispatcher.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ListenerDispatcher.hpp new file mode 100644 index 0000000..c83eaf6 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ListenerDispatcher.hpp @@ -0,0 +1,57 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_CORE_LISTENERDISPATCHER_H_ +#define CYCLONEDDS_CORE_LISTENERDISPATCHER_H_ + +#include "dds/dds.h" + +extern "C" +{ + extern OMG_DDS_API void callback_on_inconsistent_topic + (dds_entity_t topic, dds_inconsistent_topic_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_offered_deadline_missed + (dds_entity_t writer, dds_offered_deadline_missed_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_offered_incompatible_qos + (dds_entity_t writer, dds_offered_incompatible_qos_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_liveliness_lost + (dds_entity_t writer, dds_liveliness_lost_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_publication_matched + (dds_entity_t writer, dds_publication_matched_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_requested_deadline_missed + (dds_entity_t reader, dds_requested_deadline_missed_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_requested_incompatible_qos + (dds_entity_t reader, dds_requested_incompatible_qos_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_sample_rejected + (dds_entity_t reader, dds_sample_rejected_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_liveliness_changed + (dds_entity_t reader, dds_liveliness_changed_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_data_available (dds_entity_t reader, void* arg); + + extern OMG_DDS_API void callback_on_subscription_matched + (dds_entity_t reader, dds_subscription_matched_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_sample_lost + (dds_entity_t reader, dds_sample_lost_status_t status, void* arg); + + extern OMG_DDS_API void callback_on_data_readers (dds_entity_t subscriber, void* arg); +} + +#endif /* CYCLONEDDS_CORE_LISTENERDISPATCHER_H_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/MiscUtils.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/MiscUtils.hpp new file mode 100644 index 0000000..0903a84 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/MiscUtils.hpp @@ -0,0 +1,90 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_MISC_UTILS_HPP_ +#define CYCLONEDDS_CORE_MISC_UTILS_HPP_ + +#include +#include +#include "dds/dds.h" + +#define STATUS_MASK_CONTAINS(mask,check) ((mask & check) == check) + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +void +convertByteSeq( + const dds::core::ByteSeq &from, + void*& to, + int32_t size); + +void +convertByteSeq( + const void* from, + const int32_t size, + dds::core::ByteSeq &to); + +void +convertStringSeq( + const dds::core::StringSeq &from, + char **&to); + +void +convertStringSeq( + char **from, + uint32_t size, + dds::core::StringSeq &to); + +dds::core::Duration +convertDuration( + const dds_duration_t &from); + +dds_duration_t +convertDuration( + const dds::core::Duration &from); + +dds::core::Time +convertTime( + const dds_time_t &from); + +dds_time_t +convertTime( + const dds::core::Time &from); + +dds::core::status::StatusMask +convertStatusMask( + const uint32_t from); + +uint32_t +convertStatusMask( + const dds::core::status::StatusMask &from); + +static Mutex gpb_mutex; + +} +} +} +} + +#endif //CYCLONEDDS_CORE_MISC_UTILS_HPP_ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp new file mode 100644 index 0000000..d645466 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hpp @@ -0,0 +1,36 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + + /** + * @file + */ + +#ifndef CYCLONEDDS_CORE_MISSING_HPP_ +#define CYCLONEDDS_CORE_MISSING_HPP_ + +//since these helpers are only introduced from c++14 onwards + +#if __cplusplus < 201402L +namespace std { + template< bool B, class T, class F > + using conditional_t = typename std::conditional::type; + + template + using enable_if_t = typename std::enable_if::type; + + template + using decay_t = typename std::decay::type; +} +#endif /* _cplusplus */ + +#endif /* CYCLONEDDS_CORE_MISSING_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/Mutex.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/Mutex.hpp new file mode 100644 index 0000000..d653d26 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/Mutex.hpp @@ -0,0 +1,51 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_MUTEX_HPP_ +#define CYCLONEDDS_CORE_MUTEX_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +class OMG_DDS_API Mutex +{ +public: + Mutex(); + virtual ~Mutex(); + + void lock() const; + bool try_lock() const; + void unlock() const; +private: + void* mtx; +}; + +} +} +} +} + + +#endif /* CYCLONEDDS_CORE_MUTEX_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ObjectDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ObjectDelegate.hpp new file mode 100644 index 0000000..199cdb6 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ObjectDelegate.hpp @@ -0,0 +1,71 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_OBJECT_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_OBJECT_DELEGATE_HPP_ + +#include "dds/core/macros.hpp" +#include "dds/core/refmacros.hpp" +#include "org/eclipse/cyclonedds/core/Mutex.hpp" + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +DDSCXX_WARNING_MSVC_OFF(4251) + +class OMG_DDS_API ObjectDelegate +{ +public: + + typedef ::dds::core::smart_ptr_traits< ObjectDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< ObjectDelegate >::weak_ref_type weak_ref_type; + + ObjectDelegate (); + virtual ~ObjectDelegate (); + + virtual void close (); + void lock() const; + void unlock() const; + + virtual void init (ObjectDelegate::weak_ref_type weak_ref) = 0; + ObjectDelegate::weak_ref_type get_weak_ref () const; + ObjectDelegate::ref_type get_strong_ref () const; + +protected: + + void check () const; + void set_weak_ref (ObjectDelegate::weak_ref_type weak_ref); + + Mutex mutex; + bool closed; + ObjectDelegate::weak_ref_type myself; +}; + +DDSCXX_WARNING_MSVC_ON(4251) + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_OBJECT_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ObjectSet.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ObjectSet.hpp new file mode 100644 index 0000000..3539c1d --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ObjectSet.hpp @@ -0,0 +1,80 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_OBJECT_SET_HPP_ +#define CYCLONEDDS_CORE_OBJECT_SET_HPP_ + +#include + +#include +#include +#include + +#include +#include +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +class ObjectSet +{ +public: + typedef std::set::iterator setIterator; + typedef std::vector::iterator vectorIterator; + typedef std::vector vector; + + /** + * @internal Inserts a EntityDelegate into the set. + * @param obj The org::eclipse::cyclonedds::core::ObjectDelegate to store + */ + void insert(org::eclipse::cyclonedds::core::ObjectDelegate& obj); + + /** + * @internal Erases a EntityDelegate from the set. + * @param obj The org::eclipse::cyclonedds::core::ObjectDelegate to delete + */ + void erase(org::eclipse::cyclonedds::core::ObjectDelegate& obj); + + /** + * @internal Call close() of all the Objects within the set (outside lock). + */ + void all_close(); + + /** + * @internal Copy internal set into a vector. + */ + vector copy(); + +private: + WeakReferenceSet::wset objects; + Mutex mutex; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_OBJECT_SET_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/QosProviderDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/QosProviderDelegate.hpp new file mode 100644 index 0000000..d1df583 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/QosProviderDelegate.hpp @@ -0,0 +1,81 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_QOSPROVIDERDELEGATE_HPP_ +#define CYCLONEDDS_CORE_QOSPROVIDERDELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include + +#if 0 +C_CLASS(cmn_qosProvider); +C_CLASS(cmn_qosProviderInputAttr); +#endif + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +class QosProviderDelegate; +} +} +} +} + +class OMG_DDS_API org::eclipse::cyclonedds::core::QosProviderDelegate +{ +public: + QosProviderDelegate(const std::string& uri, const std::string& id = ""); + + ~QosProviderDelegate(); + + dds::domain::qos::DomainParticipantQos + participant_qos(const char* id); + + dds::topic::qos::TopicQos + topic_qos(const char* id); + + dds::sub::qos::SubscriberQos + subscriber_qos(const char* id); + + dds::sub::qos::DataReaderQos + datareader_qos(const char* id); + + dds::pub::qos::PublisherQos + publisher_qos(const char* id); + + dds::pub::qos::DataWriterQos + datawriter_qos(const char* id); + +private: + template + static void named_qos__copyOut(void *from, void *to); +#if 0 + cmn_qosProvider qosProvider; + static const C_STRUCT(cmn_qosProviderInputAttr) qosProviderAttr; +#endif +}; + +#endif /* CYCLONEDDS_CORE_QOSPROVIDERDELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ReportUtils.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ReportUtils.hpp new file mode 100644 index 0000000..5e1bfb2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ReportUtils.hpp @@ -0,0 +1,191 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_REPORT_UTILS_HPP_ +#define CYCLONEDDS_CORE_REPORT_UTILS_HPP_ + +#include +#include +#include +#include +#include +#include +#include + +//#define _OS_WARNING 2 +//#define _OS_ERROR 4 + +#define ISOCPP_ERROR org::eclipse::cyclonedds::core::utils::error_code +#define ISOCPP_UNSUPPORTED_ERROR org::eclipse::cyclonedds::core::utils::unsupported_error_code +#define ISOCPP_INVALID_ARGUMENT_ERROR org::eclipse::cyclonedds::core::utils::invalid_argument_code +#define ISOCPP_PRECONDITION_NOT_MET_ERROR org::eclipse::cyclonedds::core::utils::precondition_not_met_error_code +#define ISOCPP_OUT_OF_RESOURCES_ERROR org::eclipse::cyclonedds::core::utils::out_of_resources_error_code +#define ISOCPP_NOT_ENABLED_ERROR org::eclipse::cyclonedds::core::utils::not_enabled_error_code +#define ISOCPP_IMMUTABLE_POLICY_ERROR org::eclipse::cyclonedds::core::utils::immutable_policy_error_code +#define ISOCPP_INCONSISTENT_POLICY_ERROR org::eclipse::cyclonedds::core::utils::inconsistent_policy_error_code +#define ISOCPP_ALREADY_CLOSED_ERROR org::eclipse::cyclonedds::core::utils::already_closed_error_code +#define ISOCPP_TIMEOUT_ERROR org::eclipse::cyclonedds::core::utils::timeout_error_code +#define ISOCPP_NO_DATA_ERROR org::eclipse::cyclonedds::core::utils::no_data_error_code +#define ISOCPP_ILLEGAL_OPERATION_ERROR org::eclipse::cyclonedds::core::utils::illegal_operation_error_code +#define ISOCPP_NULL_REFERENCE_ERROR org::eclipse::cyclonedds::core::utils::null_reference_error_code + +/* \brief OS_FUNCTION provides undecorated function name of current function + * + * Behavior of OS_FUNCTION outside a function is undefined. Note that + * implementations differ across compilers and compiler versions. It might be + * implemented as either a string literal or a constant variable. + */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) +# define OS_FUNCTION __func__ +#elif defined(__cplusplus) && (__cplusplus >= 201103) +# define OS_FUNCTION __func__ +#elif defined(__GNUC__) +# define OS_FUNCTION __FUNCTION__ +#elif defined(__clang__) +# define OS_FUNCTION __FUNCTION__ +#elif defined(__ghs__) +# define OS_FUNCTION __FUNCTION__ +#elif (defined(__SUNPRO_C) || defined(__SUNPRO_CC)) +/* Solaris Studio had support for __func__ before it supported __FUNCTION__. + Compiler flag -features=extensions is required on older versions. */ +# define OS_FUNCTION __func__ +#elif defined(__FUNCTION__) +/* Visual Studio */ +# define OS_FUNCTION __FUNCTION__ +#elif defined(__vxworks) +/* At least versions 2.9.6 and 3.3.4 of the GNU C Preprocessor only define + __GNUC__ if the entire GNU C compiler is in use. VxWorks 5.5 targets invoke + the preprocessor separately resulting in __GNUC__ not being defined. */ +# define OS_FUNCTION __FUNCTION__ +#else +# warning "OS_FUNCTION is not supported" +#endif + +/* \brief OS_PRETTY_FUNCTION provides function signature of current function + * + * See comments on OS_FUNCTION for details. + */ +#if defined(__GNUC__) +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__clang__) +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__ghs__) +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif (defined(__SUNPRO_C) && __SUNPRO_C >= 0x5100) +/* Solaris Studio supports __PRETTY_FUNCTION__ in C since version 12.1 */ +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5120) +/* Solaris Studio supports __PRETTY_FUNCTION__ in C++ since version 12.3 */ +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#elif defined(__FUNCSIG__) +/* Visual Studio */ +# define OS_PRETTY_FUNCTION __FUNCSIG__ +#elif defined(__vxworks) +/* See comments on __vxworks macro above. */ +# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#else +/* Do not warn user about OS_PRETTY_FUNCTION falling back to OS_FUNCTION. +# warning "OS_PRETTY_FUNCTION is not supported, using OS_FUNCTION" +*/ +# define OS_PRETTY_FUNCTION OS_FUNCTION +#endif + +#define ISOCPP_DDSC_RESULT_CHECK_AND_THROW(code, ...) \ + org::eclipse::cyclonedds::core::utils::check_ddsc_result_and_throw_exception( \ + static_cast(code), \ + __FILE__, \ + __LINE__, \ + OS_PRETTY_FUNCTION, \ + __VA_ARGS__) \ + +#define ISOCPP_THROW_EXCEPTION(code, ...) \ + org::eclipse::cyclonedds::core::utils::throw_exception( \ + (code), \ + __FILE__, \ + __LINE__, \ + OS_PRETTY_FUNCTION, \ + __VA_ARGS__) \ + +#define ISOCPP_BOOL_CHECK_AND_THROW(test, code, ...) \ + if (!(test)) { \ + ISOCPP_THROW_EXCEPTION(code, __VA_ARGS__); \ + } + + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace utils +{ + +const int32_t error_code = 1; +const int32_t unsupported_error_code = 2; +const int32_t invalid_argument_code = 3; +const int32_t precondition_not_met_error_code = 4; +const int32_t out_of_resources_error_code = 5; +const int32_t not_enabled_error_code = 6; +const int32_t immutable_policy_error_code = 7; +const int32_t inconsistent_policy_error_code = 8; +const int32_t already_closed_error_code = 9; +const int32_t timeout_error_code = 10; +const int32_t no_data_error_code = 11; +const int32_t illegal_operation_error_code = 12; +const int32_t null_reference_error_code = 13; + + + +OMG_DDS_API void +report( + int32_t code, + int32_t reportType, + const char *file, + int32_t line, + const char *signature, + const char *format, + ...); + +OMG_DDS_API void +throw_exception( + int32_t code, + const char *file, + int32_t line, + const char *signature, + const char *format, + ...); + +OMG_DDS_API void +check_ddsc_result_and_throw_exception( + dds_return_t code, + const char *file, + int32_t line, + const char *signature, + const char *format, + ...); + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_REPORT_UTILS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ScopedLock.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ScopedLock.hpp new file mode 100644 index 0000000..3316f9d --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/ScopedLock.hpp @@ -0,0 +1,103 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_SCOPEDLOCK_HPP_ +#define CYCLONEDDS_CORE_SCOPEDLOCK_HPP_ + +#include +#include + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +template +class OMG_DDS_API ScopedLock +{ +public: + ScopedLock(const LOCKABLE& obj, bool lock = true) + : lockable(obj), + owner(lock) + { + if (lock) { + lockable.lock(); + } + } + + virtual ~ScopedLock() + { + if (owner) { + try { + lockable.unlock(); + } catch (...) { + /* Don't know what to do anymore (it should have never failed)... */ + assert(false); + } + } + } + + void lock() + { + assert(!owner); + lockable.lock(); + owner = true; + } + + bool try_lock() + { + bool locked; + locked = lockable.try_lock(); + if (locked) { + owner = true; + } + return locked; + } + + void unlock() + { + assert(owner); + owner = false; + lockable.unlock(); + } + + bool own() const + { + return owner; + } + +private: + const LOCKABLE& lockable; + bool owner; +}; + +typedef ScopedLock ScopedMutexLock; +typedef ScopedLock ScopedObjectLock; + +} +} +} +} + + +#endif /* CYCLONEDDS_CORE_SCOPEDLOCK_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/TimeHelper.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/TimeHelper.hpp new file mode 100644 index 0000000..0782ed7 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/TimeHelper.hpp @@ -0,0 +1,91 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + * + * Unfortunately, we need this because we can not change the Duration.hpp and Time.hpp + * and we don't want this piece of code repeated in every function within their + * implementation files. + */ + +#ifndef CYCLONEDDS_CORE_TIME_HELPER_HPP_ +#define CYCLONEDDS_CORE_TIME_HELPER_HPP_ + +#include +#include +#include + +#define MS 1000 +#define MiS 1000000 +#define NS 1000000000 + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace timehelper +{ + + +/** +* Check if the TIMEISH value supplied is at all suitable for arithmetic jiggery +* pokery. Invalidity encompasses (but is not restricted to) a -1 seconds part +* an 'infinity' Duration, an 'invalid' Time (or Duration). +* @param t the TIMEISH thing to check +* @return true if the argument is not suitable for doing sums with. +*/ +template +bool is_valid_for_arithmetic(const TIMEISH& t) +{ + return (t.sec() != -1 // Invalid + && t.sec() != 0x7FFFFFFF // Infinity + && t.nanosec() < 1000000000); // Invalid & infinity are > 10^9 +} + +/** +* Check a TIMEISH is valid for doing sums with. +* @param t the TIMEISH thing to check +* @param context Some sort of clue to the receiver about what was +* called or what you were trying to do. Must be a literal or c_str. +* Defaults to "". +* @param function String to be concateneated onto context. +* Must be a literal or c_str. Defaults to "". +* @throws a dds::core::InvalidDataError if not valid. +* @see OSPL_CONTEXT_LITERAL +* @see is_valid_for_arithmetic +*/ +template +void validate(const TIMEISH& t, const char* context = "timehelper", const char* function = "validate") +{ + if(! is_valid_for_arithmetic(t)) + { + std::stringstream message("dds::core::InvalidDataError"); + message << "Value invalid for arithmetic operations" << context << function + << " seconds=" << t.sec() << " (" << std::hex << t.sec() + << ") nanoseconds=" << t.nanosec() << " (" << std::hex << t.nanosec() << ")"; + ISOCPP_THROW_EXCEPTION(ISOCPP_ILLEGAL_OPERATION_ERROR, message.str().c_str()); + } +} + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_TIME_HELPER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/WeakReferenceSet.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/WeakReferenceSet.hpp new file mode 100644 index 0000000..c7ebbc8 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/WeakReferenceSet.hpp @@ -0,0 +1,47 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_WEAK_REFERENCE_SET_HPP_ +#define CYCLONEDDS_CORE_WEAK_REFERENCE_SET_HPP_ + +#include + +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +template +struct WeakReferenceSet +{ + typedef typename std::set > wset; + typedef typename std::set >::iterator iterator; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_CORE_WEAK_REFERENCE_SET_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp new file mode 100644 index 0000000..d212b55 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp @@ -0,0 +1,122 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef BASIC_CDR_SERIALIZATION_HPP_ +#define BASIC_CDR_SERIALIZATION_HPP_ + +#include "cdr_stream.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +/** + * @brief + * Implementation of the basic cdr stream. + * + * This type of cdr stream has a maximum alignment of 8 bytes. + */ +class OMG_DDS_API basic_cdr_stream : public cdr_stream { +public: + /** + * @brief + * Constructor. + * + * Basically a pass through for the cdr_stream base class. + * + * @param[in] end The endianness to set for the data stream, default to the local system endianness. + * @param[in] ignore_faults Bitmask for ignoring faults, can be composed of bit fields from the serialization_status enumerator. + */ + basic_cdr_stream(endianness end = native_endianness(), uint64_t ignore_faults = 0x0) : cdr_stream(end, 8, ignore_faults) { ; } + + /** + * @brief + * Start a new struct. + * + * This function is called by the generated streaming functions, and will start a parameter list, if that is relevant for it. + * + * @param[in, out] props The entity whose members might be represented by a parameter list. + * + * @return Whether the operation was completed succesfully. + */ + bool start_struct(entity_properties_t &props); + +}; + +/** + * @brief + * Enumerated type stream manipulation functions. + * Since enumerated types are represented by a uint32_t in basic CDR streams + * they just loop through to writing uint32_t versions of the enum. + * + * These are "endpoints" for write functions, since compound + * (sequence/array/constructed type) functions will decay to these + * calls. + */ + +/** + * @brief + * Reads the value of the enum from the stream. + * + * @param[in, out] str The stream which is read from. + * @param[out] toread The variable to read into. + * @param[in] N The number of entities to read. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool read(basic_cdr_stream& str, T& toread, size_t N = 1) { + return read_enum_impl(str, toread, N); +} + +/** + * @brief + * Writes the value of the enum to the stream. + * + * @param[in, out] str The stream which is written to. + * @param[in] towrite The variable to write. + * @param[in] N The number of entities to write. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool write(basic_cdr_stream& str, const T& towrite, size_t N = 1) { + return write_enum_impl(str, towrite, N); +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] N The number of entities to move. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool move(basic_cdr_stream& str, const T&, size_t N = 1) { + return move(str, uint32_t(0), N); +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up (maximum size version). + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] N The number of entities at most to move. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool max(basic_cdr_stream& str, const T&, size_t N = 1) { + return max(str, uint32_t(0), N); +} + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ +#endif diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp new file mode 100644 index 0000000..0861d24 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp @@ -0,0 +1,64 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CDR_ENUMS_HPP_ +#define CDR_ENUMS_HPP_ + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +/** + * @brief + * Entity extensibility descriptors. + * + * @enum extensibility Describes the extensibility of entities. + * + * This value is set for entities and their parents. + * + * @var extensibility::ext_final The entity representation is complete, no fields can be added or removed. + * @var extensibility::ext_appendable The entity representation can be extended, no fields can be removed. + * @var extensibility::ext_mutable The entity representation can be modified, fields can be removed or added. + */ +enum class extensibility { + ext_final, + ext_appendable, + ext_mutable +}; + +/** + * @brief + * Encoding version descriptors. + * + * @enum encoding_version Describes the CDR encoding version of entities. + * + * @var encoding_version::basic_cdr Basic CDR encoding, does not support any xtypes functionality. + * @xml encoding_version::xml XML encoding. + * @var encoding_version::xcdr_v1 Version 1 Xtypes CDR encoding (deprecated). + * @var encoding_version::xcdr_v2 Version 2 XTypes CDR encoding. + */ +enum class encoding_version { + basic_cdr, + xml, + xcdr_v1, + xcdr_v2 +}; + +typedef uint32_t allowable_encodings_t; + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ +#endif diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp new file mode 100644 index 0000000..4a0e5a2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/cdr_stream.hpp @@ -0,0 +1,935 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CDR_STREAM_HPP_ +#define CDR_STREAM_HPP_ + +#include "dds/ddsrt/endian.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +/** + * @brief + * Custom stack implementation. + */ +template +class custom_stack { + static_assert(N > 0, "Stack capacity must be larger than 0"); + T data[N]; + size_t sz = 0; + public: + custom_stack() = default; + custom_stack(const T &in) {data[0] = in; sz = 1;} + T &top() {return data[sz-1];} + const T& top() const {return data[sz-1];} + void pop() {sz--;} + void push(const T &in) {data[sz++] = in;} + void reset() {sz = 0;} + size_t size() const {return sz;} +}; + +/** + * @brief + * Enum conversion and validation function template forward declaration. + * + * This function is generated for each enumerated class encountered in the parsed .idl files. + * Converts an integer value to the corresponding enum class value, or its default value + * if there is no enum equivalent to the int. + * + * @param[in] in The integer to convert to the enumerated class. + * + * @return The enumerator representation of in. + */ +template +E enum_conversion(uint32_t in); + +/** + * @brief + * Byte swapping function, is only enabled for arithmetic (base) types. + * + * Determines the number of bytes to swap by the size of the template parameter. + * + * @param[in, out] toswap The entity whose bytes will be swapped. + */ +template::value> > +void byte_swap(T& toswap) { + union { T a; uint16_t u2; uint32_t u4; uint64_t u8; } u; + u.a = toswap; + DDSCXX_WARNING_MSVC_OFF(6326) + switch (sizeof(T)) { + case 1: + break; + case 2: + u.u2 = static_cast((u.u2 & 0xFF00) >> 8) + | static_cast((u.u2 & 0x00FF) << 8); + break; + case 4: + u.u4 = static_cast((u.u4 & 0xFFFF0000) >> 16) + | static_cast((u.u4 & 0x0000FFFF) << 16); + u.u4 = static_cast((u.u4 & 0xFF00FF00) >> 8) + | static_cast((u.u4 & 0x00FF00FF) << 8); + break; + case 8: + u.u8 = static_cast((u.u8 & 0xFFFFFFFF00000000) >> 32) + | static_cast((u.u8 & 0x00000000FFFFFFFF) << 32); + u.u8 = static_cast((u.u8 & 0xFFFF0000FFFF0000) >> 16) + | static_cast((u.u8 & 0x0000FFFF0000FFFF) << 16); + u.u8 = static_cast((u.u8 & 0xFF00FF00FF00FF00) >> 8) + | static_cast((u.u8 & 0x00FF00FF00FF00FF) << 8); + break; + default: + throw std::invalid_argument(std::string("attempted byteswap on variable of invalid size: ") + std::to_string(sizeof(T))); + } + DDSCXX_WARNING_MSVC_ON(6326) + toswap = u.a; +} + +/** + * @brief + * Endianness types. + * + * @enum endianness C++ implementation of cyclonedds's DDSRT_ENDIAN endianness defines + * + * @var endianness::little_endian Little endianness. + * @var endianness::big_endian Big endianness. + */ +enum class endianness { + little_endian = DDSRT_LITTLE_ENDIAN, + big_endian = DDSRT_BIG_ENDIAN +}; + +/** + * @brief + * Returns the endianness of the local system. + * + * Takes the value from the DDSRT_ENDIAN definition and converts it to the c++ enum class value. + * + * @retval little_endian If the system is little endian. + * @retval big_endian If the system is big endian. + */ +constexpr endianness native_endianness() { return endianness(DDSRT_ENDIAN); } + +/** + * @brief + * Serialization status bitmasks. + * + * @enum serialization_status Describes the serialization status of a cdr stream. + * + * These are stored as an bitfields in an int in cdr streams, since more than one serialization fault can be encountered. + * + * @var serialization_status::move_bound_exceeded The serialization has encountered a field which has exceeded the bounds set for it. + * @var serialization_status::write_bound_exceeded The serialization has encountered a field which has exceeded the bounds set for it. + * @var serialization_status::read_bound_exceeded The serialization has encountered a field which has exceeded the bounds set for it. + * @var serialization_status::illegal_field_value The serialization has encountered a field with a value which should never occur in a valid CDR stream. + * @var serialization_status::invalid_pl_entry The serialization has encountered a parameter list id which is illegal (not extended id in reserved for OMG space). + * @var serialization_status::unsupported_xtypes A streamer has attempted to stream a struct requiring xtypes but not supporting it itself. + * @var serialization_status::must_understand_fail A struct being read contains a field that must be understood but does not recognize or have. + */ +enum serialization_status : uint64_t { + move_bound_exceeded = 0x1 << 0, + write_bound_exceeded = 0x1 << 1, + read_bound_exceeded = 0x1 << 2, + invalid_pl_entry = 0x1 << 3, + illegal_field_value = 0x1 << 4, + unsupported_xtypes = 0x1 << 5, + must_understand_fail = 0x1 << 6 +}; + +/** + * @brief + * Base cdr_stream class. + * + * This class implements the base functions which all "real" cdr stream implementations will use. + */ +class OMG_DDS_API cdr_stream { +public: + /** + * @brief + * Constructor. + * + * Sets the stream endianness to end, and maximum alignment to max_align. + * + * @param[in] end The endianness to set for the data stream, default to the local system endianness. + * @param[in] max_align The maximum size that the stream will align CDR primitives to. + * @param[in] ignore_faults Bitmask for ignoring faults, can be composed of bit fields from the serialization_status enumerator. + */ + cdr_stream(endianness end, size_t max_align, uint64_t ignore_faults = 0x0) : m_stream_endianness(end), m_max_alignment(max_align), m_fault_mask(~ignore_faults), m_swap(native_endianness() != m_stream_endianness) { ; } + + /** + * @brief + * Returns the current stream alignment. + * + * @return The current stream alignment. + */ + size_t alignment() const { return m_current_alignment; } + + /** + * @brief + * Sets the new stream alignment. + * + * Also returns the value the alignment has been set to. + * + * @param[in] newalignment The new alignment to set. + * + * @return The value the alignment has been set to. + */ + size_t alignment(size_t newalignment) { return m_current_alignment = newalignment; } + + /** + * @brief + * Checks whether a delimited cdr stream is not being read out of bounds. + * + * This function will return true if N bytes can be read from the stream. + * + * @param[in] N The number of bytes requested. + * @param[in] peek Whether this is true access, or just a "peek". + * + * @return Whether enough bytes are available for another header. + */ + bool bytes_available(size_t N = 1, bool peek = false); + + /** + * @brief + * Returns the current cursor offset. + * + * @retval SIZE_MAX In this case, a maximum size calculation was being done, and the maximum size was determined to be unbounded. + * @return The current cursor offset. + */ + inline size_t position() const { return m_position; } + + /** + * @brief + * Sets the new cursor offset. + * + * Also returs the value the offset has been set to. + * + * @param[in] newposition The new offset to set. + * + * @return The value the offset has been set to. + */ + size_t position(size_t newposition) { return m_position = newposition; } + + /** + * @brief + * Cursor move function. + * + * Moves the current position offset by incr_by if it is not at SIZE_MAX. + * Returns the position value after this operation. + * + * @param[in] incr_by The amount to move the cursor position by. + * + * @return The cursor position after this operation. + */ + size_t incr_position(size_t incr_by) { if (m_position != SIZE_MAX) m_position += incr_by; return m_position; } + + /** + * @brief + * Resets the state of the stream as before streaming began. + * + * Will set the current offset, alignment to 0, clear the stack and fault status. + * Will retain the buffer pointer and size. + */ + virtual void reset(); + + /** + * @brief + * Buffer set function. + * + * Sets the buffer pointer to toset. + * As a side effect, the current position and alignment are reset, since these are not associated with the new buffer. + * + * @param[in] toset The new pointer of the buffer to set. + * @param[in] buffer_size The size of the buffer being set. + */ + void set_buffer(void* toset, size_t buffer_size = SIZE_MAX); + + /** + * @brief + * Gets the current cursor pointer. + * + * If the current position is SIZE_MAX or the buffer pointer is not set, it returns nullptr. + * + * @retval nullptr If the current buffer is not set, or if the cursor offset is not valid. + * @return The current cursor pointer. + */ + inline char* get_cursor() const { return m_buffer + m_position; } + + /** + * @brief + * Const stream endianness getter (const). + * + * This is used to determine whether the data read or written from the stream needs to have their bytes swapped. + * + * @return The stream endianness. + */ + const endianness& stream_endianness() const { return m_stream_endianness; } + + /** + * @brief + * Determines whether the local and stream endianness are the same. + * + * This is used to determine whether the data read or written from the stream needs to have their bytes swapped. + * + * @retval false If the stream endianness DOES match the local endianness. + * @retval true If the stream endianness DOES NOT match the local endianness. + */ + bool swap_endianness() const { return m_swap; } + + /** + * @brief + * Aligns the current stream to a new alignment. + * + * Aligns the current stream to newalignment, moves the cursor be at newalignment. + * Aligns to maximum m_max_alignment (which is stream-type specific). + * Zeroes the bytes the cursor is moved if add_zeroes is true. + * Nothing happens if the stream is already aligned to newalignment. + * + * @param[in] newalignment The new alignment to align the stream to. + * @param[in] add_zeroes Whether the bytes that the cursor moves need to be zeroed. + * + * @return Whether the cursor could be moved by the required amount. + */ + bool align(size_t newalignment, bool add_zeroes); + + /** + * @brief + * Returns the current status of serialization. + * + * Can be a composition of multiple bit fields from serialization_status. + * + * @return The current status of serialization. + */ + uint64_t status() const { return m_status; } + + /** + * @brief + * Serialization status update function. + * + * Adds to the current status of serialization and returns whether abort status has been reached. + * + * @param[in] toadd The serialization status error to add. + * + * @retval false If the serialization status of the stream HAS NOT YET reached one of the serialization errors which it is not set to ignore. + * @retval true If the serialization status of the stream HAS reached one of the serialization errors which it is not set to ignore. + */ + bool status(serialization_status toadd) { m_status |= static_cast(toadd); return abort_status(); } + + /** + * @brief + * Returns true when the stream has encountered an error which it is not set to ignore. + * + * All streaming functions should become NOOPs after this status is encountered. + * + * @retval false If the serialization status of the stream HAS NOT YET reached one of the serialization errors which it is not set to ignore. + * @retval true If the serialization status of the stream HAS reached one of the serialization errors which it is not set to ignore. + */ + inline bool abort_status() const { return m_status & m_fault_mask; } + + /** + * @brief + * Type of streaming operation to be done. + * + * @var stream_mode::unset The stream mode is not set. + * @var stream_mode::read Reads from the stream into an instance. + * @var stream_mode::write Writes from the instance to the stream. + * @var stream_mode::move Moves the cursor by the same amount as would has been done through stream_mode::write, without copying any data to the stream. + * @var stream_mode::max Same as stream_mode::move, but by the maximum amount possible for an entity of that type. + */ + enum class stream_mode { + unset, + read, + write, + move, + max + }; + + /** + * @brief + * Returns whether the streaming is done only over the key values. + * + * @return Whether the streaming is done only over the key values. + */ + inline bool is_key() const {return m_key;} + + /** + * @brief + * Function which sets the current streaming mode. + * + * This will impact which entities will be retrieved from the entity properties list. + * This will also reset the current cursor position. + * + * @param[in] mode The streaming mode to set for the stream. + * @param[in] key The key mode to set for the stream. + */ + void set_mode(stream_mode mode, bool key) {m_mode = mode; m_key = key; reset();} + + /** + * @brief + * Function declaration for starting a new member. + * + * This function is called by next_entity for each entity which is iterated over. + * Depending on the implementation and mode headers may be read from/written to the stream. + * This function can be overridden in cdr streaming implementations. + * + * @param[in] prop Properties of the entity to start. + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + * + * @return Whether the operation was completed succesfully. + */ + virtual bool start_member(entity_properties_t &prop, bool is_set = true) { prop.is_present = is_set; return true;} + + /** + * @brief + * Function declaration for finishing an existing member. + * + * This function is called by next_entity for each entity which is iterated over. + * Depending on the implementation and mode header length fields may be completed. + * This function can be overridden in cdr streaming implementations. + * + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + * + * @return Whether the operation was completed succesfully. + */ + virtual bool finish_member(entity_properties_t &, bool is_set = true) { (void) is_set; return true;} + + /** + * @brief + * Function declaration for retrieving the next entity to be operated on by the streamer. + * + * This function is called by the instance implementation switchbox and will return the next entity to operate on by calling next_prop. + * This will also call the implementation specific push/pop entity functions to write/finish headers where necessary. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The next entity to be processed, or the final entity if the current tree level does not hold more entities. + */ + virtual entity_properties_t* next_entity(entity_properties_t *prop); + + /** + * @brief + * Returns the first entity to be processed at this level. + * + * Depending on the data structure and the streaming mode, either a header is read from the stream, or a + * properties entry is pulled from the tree. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The first entity to be processed, or a nullptr if the current tree level does not hold any entities that match this tree. + */ + virtual entity_properties_t* first_entity(entity_properties_t *prop); + + /** + * @brief + * Function declaration for starting a parameter list. + * + * This function is called by the generated functions for the entity, and will trigger the necessary actions on starting a new struct. + * I.E. starting a new parameter list, writing headers. + * + * @param[in,out] props The entity whose members might be represented by a parameter list. + * + * @return Whether the operation was completed succesfully. + */ + virtual bool start_struct(entity_properties_t &props); + + /** + * @brief + * Function declaration for finishing a parameter list. + * + * This function is called by the generated functions for the entity, and will trigger the necessary actions on finishing the current struct. + * I.E. finishing headers, writing length fields. + * + * @param[in,out] props The entity whose members might be represented by a parameter list. + * + * @return Whether the struct is complete and correct. + */ + virtual bool finish_struct(entity_properties_t &props); + + /** + * @brief + * Function declaration for starting an array or sequence of non-primitive types. + * + * This function is used to keep track of whether delimiters need to be and have been written to the stream. + * This function is an effective no-op for all streamers except xcdr_v2. + * + * @param[in] is_array True when the consecutive entries is an array, false when it is a sequence. + * @param[in] primitive Whether the consecutive entities are primitives (base types, not enums, strings, typedefs and arrays are resolved though) + * + * @return Always true. + */ + virtual bool start_consecutive(bool is_array, bool primitive) { (void) is_array; (void) primitive; return true;} + + /** + * @brief + * Function declaration for finishing an array or sequence of non-primitive types. + * + * This function is an effective no-op for all streamers except xcdr_v2. + * + * @return Always true. + */ + virtual bool finish_consecutive() {return true;} + +protected: + + /** + * @brief Implementation for starting the recording the size and starting offset of a member. + */ + inline void push_member_start() { m_e_sz.push(0); m_e_off.push(static_cast(position())); } + + /** + * @brief Implementation for finishing the recording the size and starting offset of a member. + */ + inline void pop_member_start() { m_e_sz.pop(); m_e_off.pop(); } + + /** + * @brief + * Checks the struct for completeness. + * + * Checks whether all fields which must be understood are present. + * + * @param[in,out] props The struct whose start is recorded. + */ + void check_struct_completeness(entity_properties_t &props); + + /** + * @brief + * Returns the previous entity at the current level (if any). + * + * @param[in] prop Entity to the current entity. + * + * @return Pointer to the previous entity, or nullptr if there is any. + */ + entity_properties_t* previous_entity(entity_properties_t *prop); + + static const size_t m_maximum_depth = 32; /**< the maximum depth of structures in the streamer*/ + + endianness m_stream_endianness; /**< the endianness of the stream*/ + size_t m_position = 0, /**< the current offset position in the stream*/ + m_max_alignment, /**< the maximum bytes that can be aligned to*/ + m_current_alignment = 1, /**< the current alignment*/ + m_buffer_size = 0; /**< the size of the current buffer*/ + char* m_buffer = nullptr; /**< the current buffer in use*/ + uint64_t m_status = 0, /**< the current status of streaming*/ + m_fault_mask; /**< the mask for statuses that will cause streaming + to be aborted*/ + stream_mode m_mode = stream_mode::unset; /**< the current streaming mode*/ + bool m_key = false; /**< the current key mode*/ + bool m_swap = false; /**< whether to swap endianness*/ + + DDSCXX_WARNING_MSVC_OFF(4251) + custom_stack m_buffer_end; /**< the end of reading at the current level*/ + custom_stack m_e_off, /**< the offset of the entity at the current level*/ + m_e_sz; /**< the size of the entity at the current level*/ + DDSCXX_WARNING_MSVC_ON(4251) +}; + +/** + * @brief + * Primitive type stream manipulation functions. + * + * These are "endpoints" for write functions, since composit + * (sequence/array/constructed type) functions will decay to these + * calls. + */ + +/** + * @brief + * Primitive type read function. + * + * Aligns the stream to the alignment of type T. + * Reads the value from the current position of the stream str into + * toread, will swap bytes if necessary. + * Moves the cursor of the stream by the size of T. + * This function is only enabled for arithmetic types and enums. + * + * @param[in, out] str The stream which is read from. + * @param[out] toread The variable to read into. + * @param[in] N The number of entities to read. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && !std::is_enum::value + && std::is_base_of::value, bool> = true > +bool read(S &str, T& toread, size_t N = 1) +{ + if (str.position() == SIZE_MAX + || !str.align(sizeof(T), false) + || !str.bytes_available(sizeof(T)*N)) + return false; + + auto from = reinterpret_cast(str.get_cursor()); + T *to = &toread; + + assert(from); + + if (N == 1) { + toread = *from; + if (str.swap_endianness()) + byte_swap(toread); + } else { + memcpy(to,from,sizeof(T)*N); + if (str.swap_endianness()) { + for (size_t i = 0; i < N; i++, to++) + byte_swap(*to); + } + } + + str.incr_position(sizeof(T)*N); + + return true; +} + +/** + * @brief + * Enum type read function implementation. + * + * Uses the template parameter I to determine the stream-end read type, + * this type is determined by the stream implementation. + * Reads the enums as type I from the stream. + * Each read entity is verified by the enum's conversion version. + * This function is only enabled for enum types. + * + * @param[in, out] str The stream which is read from. + * @param[out] toread The variable to read. + * @param[in] N The number of entities to read. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && std::is_enum::value + && std::is_base_of::value, bool> = true> +bool read_enum_impl(S& str, T& toread, size_t N) +{ + T *ptr = &toread; + I holder = 0; + for (size_t i = 0; i < N; i++, ptr++) + { + if (!read(str, holder)) + return false; + *ptr = enum_conversion(holder); + } + return true; +} + +/** + * @brief + * Primitive type write function. + * + * Aligns str to the type to be written. + * Writes towrite to str. + * Swaps bytes written to str if the endiannesses do not match up. + * Moves the cursor of str by the size of towrite. + * This function is only enabled for arithmetic types. + * + * @param[in, out] str The stream which is written to. + * @param[in] towrite The variable to write. + * @param[in] N The number of entities to write. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && !std::is_enum::value + && std::is_base_of::value, bool> = true > +bool write(S& str, const T& towrite, size_t N = 1) +{ + if (str.position() == SIZE_MAX + || !str.align(sizeof(T), true) + || !str.bytes_available(sizeof(T)*N)) + return false; + + auto to = reinterpret_cast(str.get_cursor()); + + assert(to); + + if (N == 1) { + *to = towrite; + if (str.swap_endianness()) + byte_swap(*to); + } else { + const T *from = &towrite; + memcpy(to,from,sizeof(T)*N); + if (str.swap_endianness()) { + for (size_t i = 0; i < N; i++, to++) + byte_swap(*to); + } + } + + str.incr_position(sizeof(T)*N); + + return true; +} + +/** + * @brief + * Enum type write function implementation. + * + * Uses the template parameter I to determine the stream-end write type, + * this type is determined by the stream implementation. + * Writes the enums as type I to the stream. + * If the enums have the same size as the integer stream type, they are written + * as a block, otherwise they are copied one by one. + * This function is only enabled for enum types. + * + * @param[in, out] str The stream which is written to. + * @param[in] towrite The variable to write. + * @param[in] N The number of entities to write. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && std::is_enum::value + && std::is_base_of::value, bool> = true> +bool write_enum_impl(S& str, const T& towrite, size_t N) +{ + const T *ptr = &towrite; + if (sizeof(T) == sizeof(I)) { + if (!write(str, *reinterpret_cast(ptr), N)) + return false; + } else { + for (size_t i = 0; i < N; i++, ptr++) + if (!write(str, *reinterpret_cast(ptr))) + return false; + } + return true; +} + +/** + * @brief + * Primitive type cursor move function. + * + * Used in determining the size of a type when written to the stream. + * Aligns str to the size of toincr. + * Moves the cursor of str by the size of toincr. + * This function is only enabled for arithmetic types. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] N The number of entities to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && !std::is_enum::value + && std::is_base_of::value, bool> = true > +bool move(S& str, const T&, size_t N = 1) +{ + if (str.position() == SIZE_MAX) + return true; + + if (!str.align(sizeof(T), false)) + return false; + + str.incr_position(sizeof(T)*N); + + return true; +} + +/** + * @brief + * Primitive type max stream move function. + * + * Used in determining the maximum stream size of a constructed type. + * Moves the cursor to the maximum position it could occupy after + * writing max_sz to the stream. + * Is in essence the same as the primitive type cursor move function, + * but additionally checks for whether the cursor it at the "end", + * which may happen if unbounded members (strings/sequences/...) + * are part of the constructed type. + * This function is only enabled for arithmetic types. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] max_sz The variable to move the cursor by, no contents of this variable are used, it is just used to determine the template. + * @param[in] N The number of entities at most to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value + && !std::is_enum::value + && std::is_base_of::value, bool> = true > +bool max(S& str, const T& max_sz, size_t N = 1) +{ + return move(str, max_sz, N); +} + + /** + * @brief + * String type stream manipulation functions + * + * These are "endpoints" for write functions, since compound + * (sequence/array/constructed type) functions will decay to these + * calls. + */ + +/** + * @brief + * Bounded string read function. + * + * Reads the length from str, but then initializes toread with at most N characters from it. + * It does move the cursor by length read, since that is the number of characters in the stream. + * If N is 0, then the string is taken to be unbounded. + * + * @param[in, out] str The stream to read from. + * @param[out] toread The string to read to. + * @param[in] N The maximum number of characters to read from the stream. + * + * @return Whether the operation was completed succesfully. + */ +template::value, bool> = true > +bool read_string(S& str, T& toread, size_t N) +{ + if (str.position() == SIZE_MAX) + return false; + + uint32_t string_length = 0; + + if (!read(str, string_length) + || !str.bytes_available(string_length)) + return false; + + if (string_length == 0 + && str.status(serialization_status::illegal_field_value)) + return false; + + if (N && string_length > N + 1) + return false; + + auto cursor = str.get_cursor(); + toread.assign(cursor, cursor + std::min(string_length - 1, N ? N : SIZE_MAX)); //remove 1 for terminating NULL + + str.incr_position(string_length); + + //aligned to chars + str.alignment(1); + + return true; +} + +/** + * @brief + * Bounded string write function. + * + * Attempts to write the length of towrite to str, where the bound is checked. + * Then writes the contents of towrite to str. + * If N is 0, then the string is taken to be unbounded. + * + * @param[in, out] str The stream to write to. + * @param[in] towrite The string to write. + * @param[in] N The maximum number of characters to write to the stream. + * + * @return Whether the operation was completed succesfully. + */ +template::value, bool> = true > +bool write_string(S& str, const T& towrite, size_t N) +{ + if (str.position() == SIZE_MAX) + return false; + + size_t string_length = towrite.length() + 1; //add 1 extra for terminating NULL + + if (N + && string_length > N + 1 + && str.status(serialization_status::write_bound_exceeded)) + return false; + + if (!write(str, uint32_t(string_length)) + || !str.bytes_available(string_length)) + return false; + + memcpy(str.get_cursor(), towrite.c_str(), string_length); + + str.incr_position(string_length); + + //aligned to chars + str.alignment(1); + + return true; +} + +/** + * @brief + * Bounded string cursor move function. + * + * Attempts to move the cursor for the length field, where the bound is checked. + * Then moves the cursor for the length of the string. + * If N is 0, then the string is taken to be unbounded. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] toincr The string used to move the cursor. + * @param[in] N The maximum number of characters in the string which the stream is moved by. + * + * @return Whether the operation was completed succesfully. + */ +template::value, bool> = true > +bool move_string(S& str, const T& toincr, size_t N) +{ + if (str.position() == SIZE_MAX) + return true; + + size_t string_length = toincr.length() + 1; //add 1 extra for terminating NULL + + if (N + && string_length > N + 1 + && str.status(serialization_status::move_bound_exceeded)) + return false; + + if (!move(str, uint32_t())) + return false; + + str.incr_position(string_length); + + //aligned to chars + str.alignment(1); + + return true; +} + +/** + * @brief + * Bounded string cursor max move function. + * + * Similar to the string move function, with the additional checks that no move + * is done if the cursor is already at its maximum position, and that the cursor + * is set to its maximum position if the bound is equal to 0 (unbounded). + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] max_sz The string used to move the cursor. + * @param[in] N The maximum number of characters in the string which the stream is at most moved by. + * + * @return Whether the operation was completed succesfully. + */ +template::value, bool> = true > +bool max_string(S& str, const T& max_sz, size_t N) +{ + if (N == 0) + str.position(SIZE_MAX); //unbounded string, theoretical length unlimited + else + return move_string(str, max_sz, N); + + return true; +} + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ +#endif diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp new file mode 100644 index 0000000..62c70ae --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/entity_properties.hpp @@ -0,0 +1,265 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef ENTITY_PROPERTIES_HPP_ +#define ENTITY_PROPERTIES_HPP_ + +#include +#include +#include +#include +#include +#include +#include + +#if DDSCXX_USE_BOOST +#include +#define DDSCXX_STD_IMPL boost +#else +#include +#define DDSCXX_STD_IMPL std +#endif + +#include "cdr_enums.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +#define decl_ref_type(x) DDSCXX_STD_IMPL::remove_cv_t> + +/** + * @brief + * Bit bound descriptors. + * + * @enum bit_bound Describes the minimal bit width for enum and bitmask types. + * + * This value is unset for anything other than enums and bitmasks. + * It describes the smallest piece of memory which is able to represent the entire range of values. + * + * @var bit_bound::bb_unset The bit width of the entity is unset. + * @var bit_bound::bb_8_bits The bit width of the entity is at most 8 bits (1 byte). + * @var bit_bound::bb_16_bits The bit width of the entity is at most 16 bits (2 bytes). + * @var bit_bound::bb_32_bits The bit width of the entity is at most 32 bits (4 bytes). + * @var bit_bound::bb_64_bits The bit width of the entity is at most 64 bits (8 bytes). + */ +enum bit_bound { + bb_unset = 0, + bb_8_bits = 1, + bb_16_bits = 2, + bb_32_bits = 4, + bb_64_bits = 8 +}; + +/** + * @brief + * Helper struct to keep track of key endpoints of the a struct + */ +DDSCXX_WARNING_MSVC_OFF(4251) +class OMG_DDS_API key_endpoint: public std::map { +DDSCXX_WARNING_MSVC_ON(4251) + public: + void add_key_endpoint(const std::list &key_indices); + operator bool() const {return !empty();} +}; + +/** + * @brief + * Primitive type/enum get_bit_bound function. + * + * Returns a bb_unset for all primitive types and enums. + * This function will be implemented for all enums with a manually defined bit_bound. + * + * @return The bit bound for the primitive type. + */ +template::value || std::is_enum::value, bool> = true > +bit_bound get_bit_bound() { + switch (sizeof(T)) { + case 1: + return bb_8_bits; + break; + case 2: + return bb_16_bits; + break; + case 4: + return bb_32_bits; + break; + case 8: + return bb_64_bits; + break; + default: + return bb_unset; + } +} + +/** + * @brief + * Generic get_bit_bound fallback function. + * + * Returns a bb_unset for all non-primitive, non-enum types. + * + * @return bb_unset always. + */ +template::value && !std::is_arithmetic::value, bool> = true > +constexpr bit_bound get_bit_bound() { return bb_unset;} + +typedef struct entity_properties entity_properties_t; +typedef std::vector propvec; + +/** + * @brief + * Entity properties struct. + * + * This is a container for data fields inside message classes, both as a representation passed for writing + * as well as headers taken from streams when reading in the appropriate manner. + * Normally these are not used by the end-user, and the streaming functions all interact with these objects + * through the get_type_props function, which is generated for all user supplied message types. + */ +struct OMG_DDS_API entity_properties +{ + entity_properties( + uint32_t _depth = 0, + uint32_t _m_id = 0, + bool _is_optional = false, + bit_bound _bb = bb_unset, + extensibility _ext = extensibility::ext_final, + bool _must_understand = true): + e_ext(_ext), + m_id(_m_id), + depth(_depth), + must_understand(_must_understand), + xtypes_necessary(_ext != extensibility::ext_final || _is_optional), + is_optional(_is_optional), + e_bb(_bb) {;} + + extensibility e_ext = extensibility::ext_final; /**< The extensibility of the entity itself. */ + extensibility p_ext = extensibility::ext_final; /**< The extensibility of the entity's parent. */ + uint32_t m_id = 0; /**< The member id of the entity, it is the global field by which the entity is identified. */ + uint32_t depth = 0; /**< The depth of this entity.*/ + bool must_understand = false; /**< If the reading end cannot parse a field with this header, it must discard the entire object.*/ + bool xtypes_necessary = false; /**< Is set if any of the members of this entity require xtypes support.*/ + bool implementation_extension = false; /**< Can be set in XCDR_v1 stream parameter list headers.*/ + bool ignore = false; /**< Indicates that this field must be ignored.*/ + bool is_optional = false; /**< Indicates that this field can be empty (length 0) for reading/writing purposes.*/ + bool is_key = false; /**< Indicates that this field is a key field.*/ + bool is_present = false; /**< Indicates that this entity is present in the read stream.*/ + bit_bound e_bb = bb_unset; /**< The minimum number of bytes necessary to represent this entity/bitmask.*/ + + entity_properties_t *next_on_level = nullptr, /**< Pointer to the next entity on the same level.*/ + *prev_on_level = nullptr, /**< Pointer to the previous entity on the same level.*/ + *parent = nullptr, /**< Pointer to the parent of this entity.*/ + *first_member = nullptr; /**< Pointer to the first entity which is a member of this entity.*/ + + /** + * @brief + * Reset function. + * + * This function will reset the fields that may have been set through streaming (is_present). + */ + void reset(); + + /** + * @brief + * Print function. + * + * This function write the contents (id, is_key, is_optional, must_understand, xtypes_necessary) of this entity to std::cout. + */ + void print() const; + + /** + * @brief + * Checks whether this entity is not keyless. + * + * This function will check all members (if any) and if any of them has the is_key flag set, this will return true. + * If none have this flag set, it will return false. + * Used in the finish function to finish the entire entity_properties_t tree. + * + * @return true if any of the members have a key, false otherwise. + */ + bool has_keys() const; + + /** + * @brief + * Sets is_key flags on members. + * + * This function will set is_key flags on all members if the entity is keyless + * and will recursively call this on all members with the is_key flag set. + * Used in the finish function to finish the entire entity_properties_t tree. + */ + void set_key_values(); + + /** + * @brief + * Removes all is_key flags from members. + * + * This function will set all is_key flags of members of this entity to false. + * Used in the finish function to finish the entire entity_properties_t tree. + */ + void erase_key_values(); + + /** + * @brief + * Finishes a tree representing an entire datamodel. + * + * This function will set the next_on_level and prev_on_level pointers to create a sub linked list + * of the members of the entity at that level. Also it will set the parent pointer of member entities + * and the first_member pointer of entities which have sub entities (members). + * When all this is done, it will take the key information in the key_endpoint map to (un)set the is_key + * flags on all members. + * + * @param[in, out] props The list of entities representing the datamodel. + * @param[in] keys The map of key indices. + */ + static void finish(propvec &props, const key_endpoint &keys); + + /** + * @brief + * Appends a sub tree to the current tree as a member. + * + * This function will take the contents of toappend, insert them at the end of appendto and increase the + * depth of all entities added. It is used to add a constructed type as a member of another constructed type. + * + * @param[in, out] appendto The tree to append to. + * @param[in] toappend The sub tree to append. + */ + static void append_struct_contents(propvec &appendto, const propvec &toappend); + + /** + * @brief + * Prints the contents of a tree representing a datatype to the screen. + * + * @param[in] in The tree to print. + */ + static void print(const propvec &in); +}; + +/** + * @brief + * Forward declaration for type properties getter function. + * + * This template function is replaced/implemented by the types implemented through IDL generation. + * It generates a static container which is initialized the first time the function is called, + * this is then returned. + * + * @return propvec "Tree" representing the type. + */ +template +propvec& get_type_props(); + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ + +#endif diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp new file mode 100644 index 0000000..e098b84 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp @@ -0,0 +1,344 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef EXTENDED_CDR_SERIALIZATION_V1_HPP_ +#define EXTENDED_CDR_SERIALIZATION_V1_HPP_ + +#include "cdr_stream.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +/** + * @brief + * Implementation of the extended cdr version1 stream. + * + * This type of cdr stream has a maximum alignment of 8 bytes. + */ +class OMG_DDS_API xcdr_v1_stream : public cdr_stream { +public: + /** + * @brief + * Constructor. + * + * Basically a pass through for the cdr_stream base class. + * + * @param[in] end The endianness to set for the data stream, default to the local system endianness. + * @param[in] ignore_faults Bitmask for ignoring faults, can be composed of bit fields from the serialization_status enumerator. + */ + xcdr_v1_stream(endianness end = native_endianness(), uint64_t ignore_faults = 0x0) : cdr_stream(end, 8, ignore_faults) { ; } + + /** + * @brief + * Starts a new member. + * + * Determines whether a header is necessary for this entity through header_necessary, and if it is, handles the header. + * + * @param[in, out] prop Properties of the member to start. + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + * + * @return Whether the operation was completed succesfully. + */ + bool start_member(entity_properties_t &prop, bool is_set = true); + + /** + * @brief + * Finishes a member. + * + * Determines whether a header is necessary for this entity through header_necessary, and if it is, completes the previous header. + * + * @param[in, out] prop Properties of the member to finish. + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + * + * @return Whether the operation was completed succesfully. + */ + bool finish_member(entity_properties_t &prop, bool is_set = true); + + /** + * @brief + * Returns the next entity to be processed at this level. + * + * Depending on the data structure and the streaming mode, either a header is read from the stream, or a + * properties entry is pulled from the tree. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The next entity to be processed, or a nullptr if the current tree level does not hold more entities that match this tree. + */ + entity_properties_t* next_entity(entity_properties_t *prop); + + /** + * @brief + * Returns the first entity to be processed at this level. + * + * Depending on the data structure and the streaming mode, either a header is read from the stream, or a + * properties entry is pulled from the tree. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The first entity to be processed, or a nullptr if the current tree level does not hold any entities that match this tree. + */ + entity_properties_t *first_entity(entity_properties_t *prop); + + /** + * @brief + * Finishes the current struct. + * + * Adds the final parameter list entry if necessary when writing to the stream. + * + * @param[in, out] props The property tree to get the next entity from. + * + * @return Whether the struct is complete and correct. + */ + bool finish_struct(entity_properties_t &props); + +private: + + static const uint16_t pid_mask; /**< the mask for non-extended parameter list ids*/ + static const uint16_t pid_extended; /**< indicating an extended entry*/ + static const uint16_t pid_list_end; /**< guardian entry indicating end of parameter list*/ + static const uint16_t pid_ignore; /**< ignore this entry*/ + static const uint16_t pid_flag_impl_extension; /**< bit flag indicating implementation specific extension*/ + static const uint16_t pid_flag_must_understand; /**< bit flag indicating that this entry must be parsed successfully or the entire sample must be discarded*/ + static const uint32_t pl_extended_mask; /**< mask for extended parameter list ids*/ + static const uint32_t pl_extended_flag_impl_extension; /**< bit flag indicating implementation specific extension*/ + static const uint32_t pl_extended_flag_must_understand; /**< bit flag indicating that this entry must be parsed successfully or the entire sample must be discarded*/ + + /** + * @brief + * Returns the next entity to be processed. + * + * For optional members and members of mutable structures, a parameter list header field is necessary preceding + * the field contents itself. + * + * @param[in] props The properties of the entity. + * + * @return Whether a header is necessary for the entity. + */ + bool header_necessary(const entity_properties_t &props); + + /** + * @brief + * Determines whether a parameter list is necessary. + * + * @param[in] props The entity whose members might be represented by a parameter list. + * + * @return Whether a parameter list is necessary for the entity. + */ + bool list_necessary(const entity_properties_t &props); + + /** + * @brief + * Reads a header field from the stream. + * + * If header_necessary returns true for a field, then this function needs to be called first to read the + * header from stream and to allow the streamer to determine what to do with the field. + * + * @param[out] out The header to read into. + * @param[out] is_final Whether the final field has been read. + * + * @return Whether the header was read succesfully. + */ + bool read_header(entity_properties_t &out, bool &is_final); + + /** + * @brief + * Writes a header field to the stream. + * + * If header_necessary returns true for a field, then this function needs to be called first to write the + * header to the stream before the contents of the field are written. + * + * @param[in, out] props The properties of the entity. + * + * @return Whether the header was read succesfully. + */ + bool write_header(entity_properties_t &props); + + /** + * @brief + * Finishes a header field in the stream. + * + * Goes back to the offset of the length field that was unfinished in + * + * @param[in, out] props The properties of the entity. + * + * @return Whether the header was read succesfully. + */ + bool finish_write_header(entity_properties_t &props); + + /** + * @brief + * Writes the terminating entry in a parameter list. + * + * @return Whether the header was read succesfully. + */ + bool write_final_list_entry(); + + /** + * @brief + * Moves the cursor as if writing the terminating entry in a parameter list. + * + * @return Whether the header was read succesfully. + */ + bool move_final_list_entry(); + + /** + * @brief + * Moves the stream offset by the amount that would have been written by write_header. + * + * This function needs to be called first to move the stream by the same amount the header would + * have taken up, if it would have been written. + * + * @param[in] props The entity to move the cursor by. + * + * @return Whether the header was read succesfully. + */ + bool move_header(const entity_properties_t &props); + + /** + * @brief + * Determines whether to use extended format header. + * + * An extended header is necessary for entities with a size larger than 65535 bytes or entities with + * a member id larger than 16128. + * + * @param[in] props The entity to check. + * + * @return Whether an extended format header is necessary. + */ + static bool extended_header(const entity_properties_t &props); +}; + +/** + * @brief + * Enumerated type stream manipulation functions. + * Depending on the number coverage of the enum, it will be written + * to the stream as an uint8_t, an uint16_t or a uint32_t. + * + * These are "endpoints" for write functions, since compound + * (sequence/array/constructed type) functions will decay to these + * calls. + */ + +/** + * @brief + * Reads the value of the enum from the stream. + * + * @param[in, out] str The stream which is read from. + * @param[out] toread The variable to read into. + * @param[in] N The number of entities to read. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool read(xcdr_v1_stream& str, T& toread, size_t N = 1) +{ + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return read_enum_impl(str, toread, N); + break; + case bb_16_bits: + return read_enum_impl(str, toread, N); + break; + case bb_32_bits: + return read_enum_impl(str, toread, N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Writes the value of the enum to the stream. + * + * @param[in, out] str The stream which is written to. + * @param[in] towrite The variable to write. + * @param[in] N The number of entities to write. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool write(xcdr_v1_stream& str, const T& towrite, size_t N = 1) +{ + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return write_enum_impl(str, towrite, N); + break; + case bb_16_bits: + return write_enum_impl(str, towrite, N); + break; + case bb_32_bits: + return write_enum_impl(str, towrite, N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] N The number of entities to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool move(xcdr_v1_stream& str, const T&, size_t N = 1) +{ + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return move(str, int8_t(0), N); + break; + case bb_16_bits: + return move(str, int16_t(0), N); + break; + case bb_32_bits: + return move(str, int32_t(0), N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up (maximum size version). + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] max_sz The variable to move the cursor by, no contents of this variable are used, it is just used to determine the template. + * @param[in] N The number of entities at most to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool max(xcdr_v1_stream& str, const T& max_sz, size_t N = 1) +{ + return move(str, max_sz, N); +} + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ +#endif diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp new file mode 100644 index 0000000..3645a94 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp @@ -0,0 +1,409 @@ +/* + * Copyright(c) 2021 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef EXTENDED_CDR_SERIALIZATION_V2_HPP_ +#define EXTENDED_CDR_SERIALIZATION_V2_HPP_ + +#include "cdr_stream.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace core { +namespace cdr { + +/** + * @brief + * Implementation of the extended cdr version1 stream. + * + * This type of cdr stream has a maximum alignment of 8 bytes. + */ +class OMG_DDS_API xcdr_v2_stream : public cdr_stream { +public: + /** + * @brief + * Constructor. + * + * Basically a pass through for the cdr_stream base class. + * + * @param[in] end The endianness to set for the data stream, default to the local system endianness. + * @param[in] ignore_faults Bitmask for ignoring faults, can be composed of bit fields from the serialization_status enumerator. + */ + xcdr_v2_stream(endianness end = native_endianness(), uint64_t ignore_faults = 0x0) : cdr_stream(end, 4, ignore_faults) { ; } + + /** + * @brief + * Resets the state of the stream as before streaming began. + * + * Will reset the stack of delimiters in addition to what is reset by cdr_stream::reset. + */ + void reset(); + + /** + * @brief + * Starts a new member. + * + * Determines whether a header is necessary for this entity through em_header_necessary, and if it is, handles the header. + * + * @param[in, out] prop Properties of the member to start. + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + */ + bool start_member(entity_properties_t &prop, bool is_set = true); + + /** + * @brief + * Finishes a member. + * + * Determines whether a header is necessary for this entity through em_header_necessary, and if it is, completes the previous header. + * + * @param[in, out] prop Properties of the member to finish. + * @param[in] is_set Whether the entity represented by prop is present, if it is an optional entity. + * + * @return Whether the operation was completed succesfully. + */ + bool finish_member(entity_properties_t &prop, bool is_set = true); + + /** + * @brief + * Returns the next entity to be processed at this level. + * + * Depending on the data structure and the streaming mode, either a header is read from the stream, or a + * properties entry is pulled from the tree. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The next entity to be processed, or a nullptr if the current tree level does not hold more entities that match this tree. + */ + entity_properties_t* next_entity(entity_properties_t *prop); + + /** + * @brief + * Returns the first entity to be processed at this level. + * + * Depending on the data structure and the streaming mode, either a header is read from the stream, or a + * properties entry is pulled from the tree. + * + * @param[in, out] prop The property tree to get the next entity from. + * + * @return The first entity to be processed, or a nullptr if the current tree level does not hold any entities that match this tree. + */ + entity_properties_t *first_entity(entity_properties_t *prop); + + /** + * @brief + * Start a new struct. + * + * This function is called by the generated streaming functions, and will start a parameter list, if that is relevant for it. + * + * @param[in, out] props The entity whose members might be represented by a parameter list. + * + * @return Whether the operation was completed succesfully. + */ + bool start_struct(entity_properties_t &props); + + /** + * @brief + * Finish the current struct. + * + * This function is called by the generated streaming functions, and will finish the current parameter list, if that is relevant for it. + * + * @param[in, out] props The entity whose members might be represented by a parameter list. + * + * @return Whether the struct is complete and correct. + */ + bool finish_struct(entity_properties_t &props); + + /** + * @brief + * Function declaration for starting an array or sequence of non-primitive types. + * + * This function inserts a d-header placeholder before the start of the consecutive objects. + * + *@param[in] is_array True when the consecutive entries is an array, false when it is a sequence. + *@param[in] primitive Whether the consecutive entities are primitives (base types, not enums, strings, typedefs and arrays are resolved though) + * + * @return Whether the d-header was inserted correctly. + */ + bool start_consecutive(bool is_array, bool primitive); + + /** + * @brief + * Function declaration for finishing an array or sequence of non-primitive types. + * + * This function finishes the d-header placeholder. + * + * @return Whether the d-header was finished correctly. + */ + bool finish_consecutive(); + +private: + typedef struct consecutives { + consecutives(bool is_array = false, bool d_header_present = false) : is_array(is_array), d_header_present(d_header_present) {} + bool is_array; + bool d_header_present; + } consecutives_t; + + static const uint32_t bytes_1; /**< length field code indicating length is 1 byte*/ + static const uint32_t bytes_2; /**< length field code indicating length is 2 bytes*/ + static const uint32_t bytes_4; /**< length field code indicating length is 4 bytes*/ + static const uint32_t bytes_8; /**< length field code indicating length is 8 bytes*/ + static const uint32_t nextint; /**< length field code indicating length is the next integer field*/ + static const uint32_t nextint_times_1; /**< same as nextint*/ + static const uint32_t nextint_times_4; /**< length field code indicating length is the next integer field times 4*/ + static const uint32_t nextint_times_8; /**< length field code indicating length is the next integer field times 8*/ + static const uint32_t lc_mask; /**< mask for length field codes*/ + static const uint32_t id_mask; /**< mask for member ids*/ + static const uint32_t must_understand; /**< must understand member field flag*/ + + DDSCXX_WARNING_MSVC_OFF(4251) + custom_stack m_consecutives; /**< stack of consecutive entries, uses to determine whether or not to finish a d_header*/ + custom_stack m_delimiters; /**< locations of sequence delimiters */ + DDSCXX_WARNING_MSVC_ON(4251) + + /** + * @brief + * Reads a D-header from the stream. + * + * Will put the entity size into the streams m_buffer_end stack + * + * @return Whether the read was succesful. + */ + bool read_d_header(); + + /** + * @brief + * Reads an EM-header from the stream. + * + * @param[out] props The entity to read the EM-header into. + * + * @return Whether the read was succesful. + */ + bool read_em_header(entity_properties_t &props); + + /** + * @brief + * Writes a D-header placeholder to the stream. + * + * This will be filled with the value through the function finish_d_header when the struct is completed. + * + * @return Whether the write was succesful. + */ + bool write_d_header(); + + /** + * @brief + * Adds an optional flag to the stream. + * + * In the case of an optional field, but not a parameter list, the xcdrv2 spec states that this field should + * preceded by a single boolean, indicating its presence or absence. + * + * @param[in] is_set Whether the entity represented by prop is present. + * + * @return Whether the read was succesful. + */ + bool write_optional_tag(bool is_set); + + /** + * @brief + * Moves the stream cursor by the amount of an optional flag. + * + * In the case of an optional field, but not a parameter list, the xcdrv2 spec states that this field should + * preceded by a single boolean, indicating its presence or absence. + * + * @return Whether the read was succesful. + */ + bool move_optional_tag(); + + /** + * @brief + * Writes an EM-header to the stream. + * + * @param[in, out] prop The entity to write the EM-header for. + * + * @return Whether the header was read succesfully. + */ + bool write_em_header(entity_properties_t &prop); + + /** + * @brief + * Moves the stream's position by the amount that it would after writing the D-header. + * + * Moves the cursor by a 4 byte int. + * + * @return Whether the operation was completed succesfully. + */ + bool move_d_header() {return move(*this, uint32_t(0));} + + /** + * @brief + * Moves the stream's position by the amount that it would after writing the EM-header. + * + * @return Whether the header was read succesfully. + */ + bool move_em_header(); + + /** + * @brief + * Finishes the write operation of the D-header. + * + * @return Whether the header was read succesfully. + */ + bool finish_d_header(); + + /** + * @brief + * Finishes the write operation of the EM-header. + * + * @return Whether the header was read succesfully. + */ + bool finish_em_header(); + + /** + * @brief + * Checks whether a D-header is necessary for the indicated entity. + * + * @param[in] props The entity whose properties to check. + * + * @return Whether the entity props needs a D-header + */ + bool d_header_necessary(const entity_properties_t &props); + + /** + * @brief + * Checks whether a EM-header is necessary for the indicated entity. + * + * @param[in] props The entity whose properties to check. + * + * @return Whether the entity props needs a EM-header + */ + bool em_header_necessary(const entity_properties_t &props); + + /** + * @brief + * Determines whether a parameter list is necessary. + * + * This function is called by the next_entity function, to determine whether or not + * to read em headers from the stream. + * + * @param[in] props The entity whose members might be represented by a parameter list. + * + * @return Whether a list is necessary for this entity. + */ + bool list_necessary(const entity_properties_t &props); +}; + +/** + * @brief + * Reads the value of the enum from the stream. + * + * @param[in, out] str The stream which is read from. + * @param[out] toread The variable to read into. + * @param[in] N The number of entities to read. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool read(xcdr_v2_stream& str, T& toread, size_t N = 1) { + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return read_enum_impl(str, toread, N); + break; + case bb_16_bits: + return read_enum_impl(str, toread, N); + break; + case bb_32_bits: + return read_enum_impl(str, toread, N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Writes the value of the enum to the stream. + * + * @param [in, out] str The stream which is written to. + * @param [in] towrite The variable to write. + * @param[in] N The number of entities to write. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool write(xcdr_v2_stream& str, const T& towrite, size_t N = 1) { + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return write_enum_impl(str, towrite, N); + break; + case bb_16_bits: + return write_enum_impl(str, towrite, N); + break; + case bb_32_bits: + return write_enum_impl(str, towrite, N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up. + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] N The number of entities to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool move(xcdr_v2_stream& str, const T&, size_t N = 1) { + switch (str.is_key() ? bb_32_bits : get_bit_bound()) + { + case bb_8_bits: + return move(str, int8_t(0), N); + break; + case bb_16_bits: + return move(str, int16_t(0), N); + break; + case bb_32_bits: + return move(str, int32_t(0), N); + break; + default: + assert(false); + } + return true; +} + +/** + * @brief + * Moves the cursor of the stream by the size the enum would take up (maximum size version). + * + * @param[in, out] str The stream whose cursor is moved. + * @param[in] max_sz The variable to move the cursor by, no contents of this variable are used, it is just used to determine the template. + * @param[in] N The number of entities at most to move. + * + * @return Whether the operation was completed succesfully. + */ +template::value && !std::is_arithmetic::value, bool> = true > +bool max(xcdr_v2_stream& str, const T& max_sz, size_t N = 1) { + return move(str, max_sz, N); +} + +} +} +} +} +} /* namespace org / eclipse / cyclonedds / core / cdr */ +#endif \ No newline at end of file diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp new file mode 100644 index 0000000..1f72ab2 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cdr/fragchain.hpp @@ -0,0 +1,27 @@ +/* + * Copyright(c) 2022 ZettaScale Technology + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CDR_SERIALIZATION_FRAGCHAIN_HPP_ +#define CDR_SERIALIZATION_FRAGCHAIN_HPP_ + +#include //size_t +#include + +// unfortunate namespace pollution from C +struct nn_rdata; + +namespace org { namespace eclipse { namespace cyclone { namespace core { namespace cdr { + +OMG_DDS_API void serdata_from_ser_copyin_fragchain (unsigned char * __restrict cursor, const struct nn_rdata* fragchain, size_t size); + +} } } } } + +#endif diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/ConditionDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/ConditionDelegate.hpp new file mode 100644 index 0000000..bf042ca --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/ConditionDelegate.hpp @@ -0,0 +1,117 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_COND_CONDITION_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_COND_CONDITION_DELEGATE_HPP_ + +#include +#include +#include +#include +#include + +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +template class TCondition; +} +} +} + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + +DDSCXX_WARNING_MSVC_OFF(4251) + +class WaitSetDelegate; + +class OMG_DDS_API ConditionDelegate : + public virtual org::eclipse::cyclonedds::core::DDScObjectDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< ConditionDelegate >::ref_type + ref_type; + typedef ::dds::core::smart_ptr_traits< ConditionDelegate >::weak_ref_type + weak_ref_type; + + ConditionDelegate(); + + ~ConditionDelegate(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void close(); + + virtual bool trigger_value() const = 0; + + template + void set_handler(FUN functor) + { + org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); + + if (this->myFunctor) + { + delete this->myFunctor; + } + myFunctor = + new org::eclipse::cyclonedds::core::cond::FunctorHolder(functor); + } + + void reset_handler(); + + virtual void dispatch(); + + virtual void add_waitset( + const dds::core::cond::TCondition & cond, + org::eclipse::cyclonedds::core::cond::WaitSetDelegate *waitset); + + virtual bool remove_waitset( + org::eclipse::cyclonedds::core::cond::WaitSetDelegate *waitset); + + virtual void detach_from_waitset(const dds_entity_t entity_handle); + virtual void detach_and_close(const dds_entity_t entity_handle); + + dds::core::cond::TCondition wrapper(); + +private: + std::set waitSetList; + org::eclipse::cyclonedds::core::Mutex waitSetListUpdateMutex; + org::eclipse::cyclonedds::core::cond::FunctorHolderBase *myFunctor; +}; + +DDSCXX_WARNING_MSVC_ON(4251) + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_COND_CONDITION_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/FunctorHolder.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/FunctorHolder.hpp new file mode 100644 index 0000000..77c09dd --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/FunctorHolder.hpp @@ -0,0 +1,80 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_COND_FUNCTOR_HOLDER_HPP_ +#define CYCLONEDDS_CORE_COND_FUNCTOR_HOLDER_HPP_ + +namespace dds +{ +namespace core +{ +namespace cond +{ +template class TCondition; +} +} +} + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + +class ConditionDelegate; + +class FunctorHolderBase +{ +public: + FunctorHolderBase() { }; + + virtual ~FunctorHolderBase() { }; + + virtual void dispatch(dds::core::cond::TCondition &condition) = 0; +}; + +template +class FunctorHolder : public FunctorHolderBase +{ +public: + FunctorHolder(FUN functor) : myFunctor(functor) + { + } + + virtual ~FunctorHolder() { }; + + void dispatch(dds::core::cond::TCondition &condition) + { + myFunctor(condition); + } + +private: + FUN myFunctor; +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_COND_FUNCTOR_HOLDER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/GuardConditionDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/GuardConditionDelegate.hpp new file mode 100644 index 0000000..ad01b5e --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/GuardConditionDelegate.hpp @@ -0,0 +1,55 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_GUARD_CONDITION_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_GUARD_CONDITION_DELEGATE_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + +class OMG_DDS_API GuardConditionDelegate : + public org::eclipse::cyclonedds::core::cond::ConditionDelegate +{ +public: + GuardConditionDelegate(); + + ~GuardConditionDelegate(); + + void close(); + + virtual bool trigger_value() const; + + void trigger_value(bool value); +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_GUARD_CONDITION_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/ShadowParticipant.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/ShadowParticipant.hpp new file mode 100644 index 0000000..07ac458 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/ShadowParticipant.hpp @@ -0,0 +1,81 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_COND_SHADOW_PARTICIPANT_HPP_ +#define CYCLONEDDS_CORE_COND_SHADOW_PARTICIPANT_HPP_ + +#include "dds/dds.h" + +#include +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + class ShadowParticipant { + public: + static ShadowParticipant& getInstance() + { + org::eclipse::cyclonedds::core::ScopedMutexLock scopedLock(mutex_); + + if (!instance_) { + // Create shadow participant that is used as parent entity for all waitsets + dds_entity_t ddsc_part = dds_create_participant(DDS_DOMAIN_DEFAULT, NULL, NULL); + instance_ = new ShadowParticipant(ddsc_part); + } + return *instance_; + } + + dds_entity_t get_participant() + { + return ddsc_participant_; + } + + private: + ShadowParticipant(dds_entity_t ddsc_participant) + { + this->ddsc_participant_ = ddsc_participant; + } + + ~ShadowParticipant() + { + dds_delete(this->ddsc_participant_); + } + ShadowParticipant(const ShadowParticipant&); + ShadowParticipant& operator=(const ShadowParticipant&); + + static ShadowParticipant* instance_; + static org::eclipse::cyclonedds::core::Mutex mutex_; + dds_entity_t ddsc_participant_; + }; + +} +} +} +} +} + + +#endif /* CYCLONEDDS_CORE_COND_SHADOW_PARTICIPANT_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/StatusConditionDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/StatusConditionDelegate.hpp new file mode 100644 index 0000000..c20e554 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/StatusConditionDelegate.hpp @@ -0,0 +1,87 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_STATUS_CONDITION_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_STATUS_CONDITION_DELEGATE_HPP_ + +#include +#include +#include + +namespace dds +{ +namespace core +{ +namespace cond +{ +template class TStatusCondition; +} +} +} + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + +class OMG_DDS_API StatusConditionDelegate : + public org::eclipse::cyclonedds::core::cond::ConditionDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits::ref_type + ref_type; + typedef + ::dds::core::smart_ptr_traits::weak_ref_type + weak_ref_type; + + StatusConditionDelegate( + const org::eclipse::cyclonedds::core::EntityDelegate *entity, + dds_entity_t uEntity); + + ~StatusConditionDelegate(); + + virtual void close(); + + void init(org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type weak_ref); + + void enabled_statuses(const dds::core::status::StatusMask& status); + + dds::core::status::StatusMask enabled_statuses() const; + + dds::core::Entity& entity(); + + virtual bool trigger_value() const; + + dds::core::cond::TStatusCondition wrapper(); + +private: + dds::core::Entity myEntity; +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_STATUS_CONDITION_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/WaitSetDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/WaitSetDelegate.hpp new file mode 100644 index 0000000..a4d364f --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/cond/WaitSetDelegate.hpp @@ -0,0 +1,102 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_COND_WAITSET_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_COND_WAITSET_DELEGATE_HPP_ + +#include +#include + +#include +#include +#include +#include + +namespace dds +{ + namespace core + { + namespace cond + { + template class TWaitSet; + } + } +} + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace cond +{ + +DDSCXX_WARNING_MSVC_OFF(4251) + + class OMG_DDS_API WaitSetDelegate : + public org::eclipse::cyclonedds::core::DDScObjectDelegate + { + public: + + typedef ::dds::core::smart_ptr_traits< WaitSetDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< WaitSetDelegate >::weak_ref_type weak_ref_type; + typedef std::vector ConditionSeq; + typedef std::map ConditionMap; + + typedef std::map::iterator ConditionIterator; + + typedef std::map::const_iterator ConstConditionIterator; + + typedef std::pair ConditionEntry; + + WaitSetDelegate (); + virtual ~WaitSetDelegate (); + + void init (ObjectDelegate::weak_ref_type weak_ref); + void close (); + + ConditionSeq& wait (ConditionSeq& triggered, const dds::core::Duration& timeout); + + void dispatch (const dds::core::Duration & timeout); + + void attach_condition (const dds::core::cond::Condition & cond); + bool detach_condition (org::eclipse::cyclonedds::core::cond::ConditionDelegate * cond); + void add_condition_locked(const dds::core::cond::Condition& cond); + void remove_condition_locked(org::eclipse::cyclonedds::core::cond::ConditionDelegate *cond, + const dds_entity_t entity_handle = DDS_HANDLE_NIL); + + ConditionSeq & conditions (ConditionSeq & conds) const; + + private: + ConditionMap conditions_; + }; + +DDSCXX_WARNING_MSVC_ON(4251) + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_COND_WAITSET_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/config.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/config.hpp new file mode 100644 index 0000000..e046506 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/config.hpp @@ -0,0 +1,24 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_CONFIG_HPP_ +#define CYCLONEDDS_CORE_CONFIG_HPP_ + +#include +#include + +#endif /* CYCLONEDDS_CORE_CONFIG_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/Policy.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/Policy.hpp new file mode 100644 index 0000000..d9d1626 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/Policy.hpp @@ -0,0 +1,62 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_POLICY_POLICY_HPP_ +#define CYCLONEDDS_CORE_POLICY_POLICY_HPP_ + + +/****************************************************************************** + * + * PROPRIETARY POLICIES + * + ******************************************************************************/ + +#include +#include + + +/* Use same macro as in dds/core/policy/CorePolicy.hpp, called OMG_DDS_POLICY_TRAITS */ +#define LITE_POLICY_TRAITS(POLICY, ID) \ + template <> \ + class policy_id { \ + public: \ + static const dds::core::policy::QosPolicyId value = ID; \ + };\ + template <> \ + class policy_name { \ + public:\ + static const std::string& name(); \ + }; + +namespace dds +{ +namespace core +{ +namespace policy +{ +template +class policy_id; +template +class policy_name; +} +} +} + + +#undef LITE_POLICY_TRAITS + +#endif /* CYCLONEDDS_CORE_POLICY_POLICY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/PolicyDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/PolicyDelegate.hpp new file mode 100644 index 0000000..1098c81 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/PolicyDelegate.hpp @@ -0,0 +1,983 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_POLICY_POLICY_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_POLICY_POLICY_DELEGATE_HPP_ + +#ifdef _WIN32 +#pragma warning( push ) +#pragma warning( disable : 4251 ) +#endif + +#include +#include +#include +#include +#include + +#include + +//============================================================================== +/* + * Unfortunately, there isn't an ddsc or builtin SubscriptionKey policy that + * is alligned the same as the idl representation. To be able to translate it + * as well, we have to seperately mention it... + */ +struct _DDS_SubscriptionKeyQosPolicy; + + +//============================================================================== +// DDS Policy Classes +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace policy +{ + +//============================================================================== + +class OMG_DDS_API TimeBasedFilterDelegate; + +/** + * @internal This policy is useful for cases where a Topic is expected to have each + * instance updated periodically. On the publishing side this setting + * establishes a contract that the application must meet. On the subscribing + * side the setting establishes a minimum requirement for the remote publishers + * that are expected to supply the data values. When the Service matches a + * DataWriter and a DataReader it checks whether the settings are compatible + * (i.e., offered deadline period<= requested deadline period) if they are not, + * the two entities are informed (via the listener or condition mechanism) + * of the incompatibility of the QoS settings and communication will not occur. + * Assuming that the reader and writer ends have compatible settings, the + * fulfillment of this contract is monitored by the Service and the application + * is informed of any violations by means of the proper listener or condition. + * The value offered is considered compatible with the value requested if and + * only if the inequality offered deadline period <= requested deadline period + * evaluates to TRUE. The setting of the DEADLINE policy must be set + * consistently with that of the TIME_BASED_FILTER. + * For these two policies to be consistent the settings must be such that + * deadline period>= minimum_separation. + */ +class OMG_DDS_API DeadlineDelegate +{ +public: + DeadlineDelegate(const DeadlineDelegate& other); + explicit DeadlineDelegate(const dds::core::Duration& d); + + DeadlineDelegate& operator=(const DeadlineDelegate& other) = default; + + void period(const dds::core::Duration& d); + dds::core::Duration period() const; + + bool operator ==(const DeadlineDelegate& other) const; + + void check() const; + void check_against(const org::eclipse::cyclonedds::core::policy::TimeBasedFilterDelegate& filter) const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration period_; +}; + +//============================================================================== + +class OMG_DDS_API DestinationOrderDelegate +{ + +public: + DestinationOrderDelegate(const DestinationOrderDelegate& other); + explicit DestinationOrderDelegate(dds::core::policy::DestinationOrderKind::Type kind); + + DestinationOrderDelegate& operator=(const DestinationOrderDelegate& other) = default; + + void kind(dds::core::policy::DestinationOrderKind::Type kind); + dds::core::policy::DestinationOrderKind::Type kind() const; + + bool operator ==(const DestinationOrderDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::DestinationOrderKind::Type kind_; +}; + +//============================================================================== + +class OMG_DDS_API DurabilityDelegate +{ +public: + DurabilityDelegate(const DurabilityDelegate& other); + explicit DurabilityDelegate(dds::core::policy::DurabilityKind::Type kind); + + DurabilityDelegate& operator=(const DurabilityDelegate& other) = default; + + void kind(dds::core::policy::DurabilityKind::Type kind); + dds::core::policy::DurabilityKind::Type kind() const; + + bool operator ==(const DurabilityDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +public: + dds::core::policy::DurabilityKind::Type kind_; +}; + +//============================================================================== + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + +class OMG_DDS_API DurabilityServiceDelegate +{ +public: + DurabilityServiceDelegate(const DurabilityServiceDelegate& other); + DurabilityServiceDelegate(const dds::core::Duration& service_cleanup_delay, + dds::core::policy::HistoryKind::Type history_kind, + int32_t history_depth, + int32_t max_samples, + int32_t max_instances, + int32_t max_samples_per_instance); + + DurabilityServiceDelegate& operator=(const DurabilityServiceDelegate& other) = default; + + void service_cleanup_delay(const dds::core::Duration& d); + const dds::core::Duration service_cleanup_delay() const; + + void history_kind(dds::core::policy::HistoryKind::Type kind); + dds::core::policy::HistoryKind::Type history_kind() const; + + void history_depth(int32_t depth); + int32_t history_depth() const; + + void max_samples(int32_t max_samples); + int32_t max_samples() const; + + void max_instances(int32_t max_instances); + int32_t max_instances() const; + + void max_samples_per_instance(int32_t max_samples_per_instance); + int32_t max_samples_per_instance() const; + + bool operator ==(const DurabilityServiceDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration cleanup_delay_; + dds::core::policy::HistoryKind::Type history_kind_; + int32_t history_depth_; + int32_t max_samples_; + int32_t max_instances_; + int32_t max_samples_per_instance_; +}; + +#endif // OMG_DDS_PERSISTENCE_SUPPORT + +//============================================================================== + +/** + * @internal This policy controls the behavior of the Entity as a factory for other + * entities. This policy concerns only DomainParticipant (as factory for + * Publisher, Subscriber, and Topic), Publisher (as factory for DataWriter), + * and Subscriber (as factory for DataReader). This policy is mutable. + * A change in the policy affects only the entities created after the change; + * not the previously created entities. + * The setting of autoenable_created_entities to TRUE indicates that the + * newly created object will be enabled by default. + * A setting of FALSE indicates that the Entity will not be automatically + * enabled. The application will need to enable it explicitly by means of the + * enable operation (see Section 7.1.2.1.1.7, enable). The default setting + * of autoenable_created_entities = TRUE means that, by default, it is not + * necessary to explicitly call enable on newly created entities. + */ +class OMG_DDS_API EntityFactoryDelegate +{ +public: + EntityFactoryDelegate(const EntityFactoryDelegate& other); + explicit EntityFactoryDelegate(bool auto_enable); + + void auto_enable(bool on); + bool auto_enable() const; + + bool operator ==(const EntityFactoryDelegate& other) const; + + EntityFactoryDelegate& operator =(const EntityFactoryDelegate& other) = default; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + bool auto_enable_; +}; + +//============================================================================== + +/** + * @internal The purpose of this QoS is to allow the application to attach additional + * information to the created Publisher or Subscriber. + * The value of the GROUP_DATA is available to the application on the + * DataReader and DataWriter entities and is propagated by means of the + * built-in topics. This QoS can be used by an application combination with + * the DataReaderListener and DataWriterListener to implement matching policies + * similar to those of the PARTITION QoS except the decision can be made based + * on an application-defined policy. + */ +class OMG_DDS_API GroupDataDelegate +{ +public: + /** + * @internal Create a GroupData instance. + */ + GroupDataDelegate(); + + /** + * @internal Create a GroupData instance. + * + * @param other the group data to copy + */ + GroupDataDelegate(const GroupDataDelegate& other); + + /** + * @internal Copies a GroupData instance. + * + * @param other the group data to copy + * + * @return reference to the instance which was copied to + */ + GroupDataDelegate& operator=(const GroupDataDelegate& other) = default; + + /** + * @internal Create a GroupData instance. + * + * @param seq the group data value + */ + explicit GroupDataDelegate(const dds::core::ByteSeq& seq); + + /** + * @internal Set the value for this GroupData + * + * @param seq the group data value + */ + void value(const dds::core::ByteSeq& seq); + + /** + * @internal Get the value for this GroupData + * + * @return the group data value + */ + const dds::core::ByteSeq& value() const; + + bool operator ==(const GroupDataDelegate& other) const; + + /** + * @internal Check if policy is consistent. + */ + void check() const; + + /** + * @internal Set internals by the ddsc policy. + * + * @param qos the ddsc policy + */ + void set_iso_policy(const dds_qos_t* qos); + /** + * @internal Set internals by the ddsc policy. + * + * @param the ddsc policy + */ + //@todo void v_policy(const v_builtinGroupDataPolicy& policy); + + /** + * @internal Get the ddsc policy representation. + * + * @param qos the ddsc policy + */ + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::ByteSeq value_; +}; + +//============================================================================== + +class OMG_DDS_API ResourceLimitsDelegate; + +class OMG_DDS_API HistoryDelegate +{ +public: + HistoryDelegate(const HistoryDelegate& other); + HistoryDelegate(dds::core::policy::HistoryKind::Type kind, int32_t depth); + + HistoryDelegate& operator=(const HistoryDelegate& other) = default; + + dds::core::policy::HistoryKind::Type kind() const; + void kind(dds::core::policy::HistoryKind::Type kind); + + int32_t depth() const; + void depth(int32_t depth); + + bool operator ==(const HistoryDelegate& other) const; + + void check() const; + void check_against(const org::eclipse::cyclonedds::core::policy::ResourceLimitsDelegate& limits) const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::HistoryKind::Type kind_; + int32_t depth_; +}; + +//============================================================================== + +class OMG_DDS_API LatencyBudgetDelegate +{ +public: + LatencyBudgetDelegate(const LatencyBudgetDelegate& other); + explicit LatencyBudgetDelegate(const dds::core::Duration& d); + + LatencyBudgetDelegate& operator=(const LatencyBudgetDelegate& other) = default; + + void duration(const dds::core::Duration& d); + const dds::core::Duration duration() const; + + bool operator ==(const LatencyBudgetDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration duration_; +}; + +//============================================================================== + +/** + * @internal The purpose of this QoS is to avoid delivering stale data to the + * application. Each data sample written by the DataWriter has an associated + * expiration time beyond which the data should not be delivered to any + * application. Once the sample expires, the data will be removed from the + * DataReader caches as well as from the transient and persistent + * information caches. The expiration time of each sample is computed by + * adding the duration specified by the LIFESPAN QoS to the source timestamp. + * As described in Section 7.1.2.4.2.11, write and Section 7.1.2.4.2.12, + * write_w_timestamp the source timestamp is either automatically computed by + * the Service each time the DataWriter write operation is called, or else + * supplied by the application by means of the write_w_timestamp operation. + * + * This QoS relies on the sender and receiving applications having their clocks + * sufficiently synchronized. If this is not the case and the Service can + * detect it, the DataReader is allowed to use the reception timestamp instead + * of the source timestamp in its computation of the expiration time. + */ +class OMG_DDS_API LifespanDelegate +{ +public: + LifespanDelegate(const LifespanDelegate& other); + explicit LifespanDelegate(const dds::core::Duration& d); + LifespanDelegate& operator=(const LifespanDelegate& other) = default; + + void duration(const dds::core::Duration& d); + const dds::core::Duration duration() const; + + bool operator ==(const LifespanDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration duration_; +}; + +//============================================================================== + +class OMG_DDS_API LivelinessDelegate +{ +public: +public: + LivelinessDelegate(const LivelinessDelegate& other); + LivelinessDelegate(dds::core::policy::LivelinessKind::Type kind, + dds::core::Duration lease_duration); + + LivelinessDelegate& operator=(const LivelinessDelegate& other) = default; + + void kind(dds::core::policy::LivelinessKind::Type kind); + dds::core::policy::LivelinessKind::Type kind() const; + + void lease_duration(const dds::core::Duration& lease_duration); + const dds::core::Duration lease_duration() const; + + bool operator ==(const LivelinessDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::LivelinessKind::Type kind_; + dds::core::Duration lease_duration_; +}; + +//============================================================================== + +class OMG_DDS_API OwnershipDelegate +{ +public: + OwnershipDelegate(const OwnershipDelegate& other); + explicit OwnershipDelegate(dds::core::policy::OwnershipKind::Type kind); + OwnershipDelegate& operator=(const OwnershipDelegate& other) = default; + + void kind(dds::core::policy::OwnershipKind::Type kind); + dds::core::policy::OwnershipKind::Type kind() const; + + bool operator ==(const OwnershipDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::OwnershipKind::Type kind_; +}; + +//============================================================================== + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + +class OMG_DDS_API OwnershipStrengthDelegate +{ +public: + OwnershipStrengthDelegate(const OwnershipStrengthDelegate& other); + explicit OwnershipStrengthDelegate(int32_t s); + + OwnershipStrengthDelegate& operator=(const OwnershipStrengthDelegate& other) = default; + + int32_t strength() const; + void strength(int32_t s); + + bool operator ==(const OwnershipStrengthDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + int32_t strength_; +}; + +#endif // OMG_DDS_OWNERSHIP_SUPPORT + +//============================================================================== + +class OMG_DDS_API PartitionDelegate +{ +public: + PartitionDelegate(const PartitionDelegate& other); + explicit PartitionDelegate(const std::string& partition); + explicit PartitionDelegate(const dds::core::StringSeq& partitions); + + PartitionDelegate& operator=(const PartitionDelegate& other) = default; + + void name(const std::string& partition); + void name(const dds::core::StringSeq& partitions); + const dds::core::StringSeq& name() const; + + bool operator ==(const PartitionDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + //@todo void v_policy(const v_builtinPartitionPolicy& policy); + + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::StringSeq name_; +}; + +//============================================================================== + +class OMG_DDS_API PresentationDelegate +{ +public: + PresentationDelegate(const PresentationDelegate& other); + PresentationDelegate(dds::core::policy::PresentationAccessScopeKind::Type access_scope, + bool coherent_access, + bool ordered_access); + PresentationDelegate& operator=(const PresentationDelegate& other) = default; + + void access_scope(dds::core::policy::PresentationAccessScopeKind::Type as); + dds::core::policy::PresentationAccessScopeKind::Type access_scope() const; + + void coherent_access(bool on); + bool coherent_access() const; + + void ordered_access(bool on); + bool ordered_access() const; + + bool operator ==(const PresentationDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::PresentationAccessScopeKind::Type access_scope_; + bool coherent_access_; + bool ordered_access_; +}; + +//============================================================================== + +class OMG_DDS_API ReaderDataLifecycleDelegate +{ +public: + ReaderDataLifecycleDelegate(const ReaderDataLifecycleDelegate& other); + ReaderDataLifecycleDelegate(const dds::core::Duration& nowriter_delay, + const dds::core::Duration& disposed_samples_delay); + + const dds::core::Duration autopurge_nowriter_samples_delay() const; + void autopurge_nowriter_samples_delay(const dds::core::Duration& d); + + const dds::core::Duration autopurge_disposed_samples_delay() const; + void autopurge_disposed_samples_delay(const dds::core::Duration& d); + + bool operator ==(const ReaderDataLifecycleDelegate& other) const; + + ReaderDataLifecycleDelegate& operator =(const ReaderDataLifecycleDelegate& other) = default; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration autopurge_nowriter_samples_delay_; + dds::core::Duration autopurge_disposed_samples_delay_; +}; + +//============================================================================== + +class OMG_DDS_API ReaderLifespanDelegate +{ +public: + ReaderLifespanDelegate(const ReaderLifespanDelegate& other); + explicit ReaderLifespanDelegate(bool used, + const dds::core::Duration& d); + + void duration(const dds::core::Duration& d); + const dds::core::Duration duration() const; + + void used(bool v); + bool used() const; + + bool operator ==(const ReaderLifespanDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + bool used_; + dds::core::Duration duration_; +}; + +//============================================================================== + +class OMG_DDS_API ReliabilityDelegate +{ +public: +public: + ReliabilityDelegate(const ReliabilityDelegate& other); + ReliabilityDelegate(dds::core::policy::ReliabilityKind::Type kind, + const dds::core::Duration& max_blocking_time); + + ReliabilityDelegate& operator=(const ReliabilityDelegate& other) = default; + + void kind(dds::core::policy::ReliabilityKind::Type kind); + dds::core::policy::ReliabilityKind::Type kind() const; + + void max_blocking_time(const dds::core::Duration& d); + const dds::core::Duration max_blocking_time() const; + + bool operator ==(const ReliabilityDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::ReliabilityKind::Type kind_; + dds::core::Duration max_blocking_time_; +}; + +//============================================================================== + +class OMG_DDS_API ResourceLimitsDelegate +{ +public: + ResourceLimitsDelegate(const ResourceLimitsDelegate& other); + ResourceLimitsDelegate(int32_t max_samples, + int32_t max_instances, + int32_t max_samples_per_instance); + + ResourceLimitsDelegate& operator=(const ResourceLimitsDelegate& other) = default; + + void max_samples(int32_t samples); + int32_t max_samples() const; + + void max_instances(int32_t max_instances); + int32_t max_instances() const; + + void max_samples_per_instance(int32_t max_samples_per_instance); + int32_t max_samples_per_instance() const; + + bool operator ==(const ResourceLimitsDelegate& other) const; + + void check() const; + void check_against(const org::eclipse::cyclonedds::core::policy::HistoryDelegate& history) const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + int32_t max_samples_; + int32_t max_instances_; + int32_t max_samples_per_instance_; +}; + +//============================================================================== + +class OMG_DDS_API TimeBasedFilterDelegate +{ +public: + TimeBasedFilterDelegate(const TimeBasedFilterDelegate& other); + explicit TimeBasedFilterDelegate(const dds::core::Duration& min_separation); + TimeBasedFilterDelegate& operator=(const TimeBasedFilterDelegate& other) = default; + + void min_separation(const dds::core::Duration& ms); + const dds::core::Duration min_separation() const; + + bool operator ==(const TimeBasedFilterDelegate& other) const; + + void check() const; + void check_against(const org::eclipse::cyclonedds::core::policy::DeadlineDelegate& deadline) const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::Duration min_sep_; +}; + +//============================================================================== + +/** + * @internal The purpose of this QoS is to allow the application to attach additional + * information to the created Topic such that when a remote application + * discovers their existence it can examine the information and use it in + * an application-defined way. In combination with the listeners on the + * DataReader and DataWriter as well as by means of operations such as + * ignore_topic, these QoS can assist an application to extend the provided QoS. + */ +class OMG_DDS_API TopicDataDelegate +{ +public: + TopicDataDelegate(); + TopicDataDelegate(const TopicDataDelegate& other); + explicit TopicDataDelegate(const dds::core::ByteSeq& seq); + + TopicDataDelegate& operator=(const TopicDataDelegate& other) = default; + + void value(const dds::core::ByteSeq& seq); + const dds::core::ByteSeq& value() const; + + bool operator ==(const TopicDataDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + //@todo void v_policy(const v_builtinTopicDataPolicy& policy); + + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::ByteSeq value_; + +}; + +//============================================================================== + +/** + * @internal The purpose of this QoS is to allow the application to take advantage of + * transports capable of sending messages with different priorities. + * This policy is considered a hint. The policy depends on the ability of the + * underlying transports to set a priority on the messages they send. + * Any value within the range of a 32-bit signed integer may be chosen; + * higher values indicate higher priority. However, any further interpretation + * of this policy is specific to a particular transport and a particular + * implementation of the Service. For example, a particular transport is + * permitted to treat a range of priority values as equivalent to one another. + * It is expected that during transport configuration the application would + * provide a mapping between the values of the TRANSPORT_PRIORITY set on + * DataWriter and the values meaningful to each transport. This mapping would + * then be used by the infrastructure when propagating the data written by + * the DataWriter. + */ +class OMG_DDS_API TransportPriorityDelegate +{ +public: + TransportPriorityDelegate(const TransportPriorityDelegate& other); + TransportPriorityDelegate& operator=(const TransportPriorityDelegate& other) = default; + explicit TransportPriorityDelegate(int32_t prio); + + void value(int32_t prio); + int32_t value() const; + + bool operator ==(const TransportPriorityDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + int32_t value_; +}; + +//============================================================================== + +/** + * @internal The purpose of this QoS is to allow the application to attach additional + * information to the created Entity objects such that when a remote application + * discovers their existence it can access that information and use it for its + * own purposes. One possible use of this QoS is to attach security credentials + * or some other information that can be used by the remote application to + * authenticate the source. In combination with operations such as + * ignore_participant, ignore_publication, ignore_subscription, + * and ignore_topic these QoS can assist an application to define and enforce + * its own security policies. The use of this QoS is not limited to security, + * rather it offers a simple, yet flexible extensibility mechanism. + */ +class OMG_DDS_API UserDataDelegate +{ +public: + /** + * @internal Create a UserData instance with an empty user data. + */ + UserDataDelegate(); + + /** + * @internal Create a UserData instance. + * + * @param other the user data to copy + */ + UserDataDelegate(const UserDataDelegate& other); + + /** + * @internal Copies a UserData instance. + * + * @param other the user data to copy + * + * @return reference to the instance that was copied to + */ + UserDataDelegate& operator=(const UserDataDelegate& other) = default; + + /** + * @internal Create a UserData instance. + * + * @param seq the sequence of octet representing the user data + */ + explicit UserDataDelegate(const dds::core::ByteSeq& seq); + + /** + * @internal Set the value for the user data. + * + * @param seq a sequence of octet representing the user data. + */ + void value(const dds::core::ByteSeq& seq); + + /** + * @internal Get the user data. + * + * @return the sequence of octet representing the user data + */ + const dds::core::ByteSeq value() const; + + bool operator ==(const UserDataDelegate& other) const; + + /** + * @internal Check if policy is consistent. + */ + void check() const; + + /** + * @internal Set internals by the ddsc policy. + * + * @param qos the ddsc policy + */ + void set_iso_policy(const dds_qos_t* qos); + /** + * @internal Set internals by the ddsc policy. + * + * @param the ddsc policy + */ + //@todo void v_policy(const v_builtinUserDataPolicy& policy); + /** + * @internal Get the ddsc policy representation. + */ + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::ByteSeq value_; +}; + +//============================================================================== + +class OMG_DDS_API WriterDataLifecycleDelegate +{ +public: + WriterDataLifecycleDelegate(const WriterDataLifecycleDelegate& other); + explicit WriterDataLifecycleDelegate(bool autodispose); + + bool autodispose() const; + void autodispose(bool b); + + bool operator ==(const WriterDataLifecycleDelegate& other) const; + + WriterDataLifecycleDelegate& operator =(const WriterDataLifecycleDelegate& other) = default; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + bool autodispose_; +}; + + + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +class OMG_DDS_API DataRepresentationDelegate +{ +public: + DataRepresentationDelegate(const DataRepresentationDelegate& other); + explicit DataRepresentationDelegate(const dds::core::policy::DataRepresentationIdSeq& value); + DataRepresentationDelegate& operator=(const DataRepresentationDelegate& other) = default; + + void value(const dds::core::policy::DataRepresentationIdSeq &value); + const dds::core::policy::DataRepresentationIdSeq& value() const; + + bool operator ==(const DataRepresentationDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::DataRepresentationIdSeq value_; +}; + +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +class OMG_DDS_API TypeConsistencyEnforcementDelegate { +public: + TypeConsistencyEnforcementDelegate(const TypeConsistencyEnforcementDelegate& other); + explicit TypeConsistencyEnforcementDelegate(dds::core::policy::TypeConsistencyKind kind, + bool ignore_sequence_bounds, + bool ignore_string_bounds, + bool ignore_member_names, + bool prevent_type_widening, + bool force_type_validation); + TypeConsistencyEnforcementDelegate& operator=(const TypeConsistencyEnforcementDelegate& other) = default; + + void kind(dds::core::policy::TypeConsistencyKind kind); + dds::core::policy::TypeConsistencyKind kind() const; + + void ignore_sequence_bounds(bool ignore_sequence_bounds); + bool ignore_sequence_bounds() const; + + void ignore_string_bounds(bool ignore_string_bounds); + bool ignore_string_bounds() const; + + void ignore_member_names(bool ignore_member_names); + bool ignore_member_names() const; + + void prevent_type_widening(bool prevent_type_widening); + bool prevent_type_widening() const; + + void force_type_validation(bool force_type_validation); + bool force_type_validation() const; + + bool operator ==(const TypeConsistencyEnforcementDelegate& other) const; + + void check() const; + + void set_iso_policy(const dds_qos_t* qos); + void set_c_policy(dds_qos_t* qos) const; + +private: + dds::core::policy::TypeConsistencyKind kind_; + bool ignore_sequence_bounds_; + bool ignore_string_bounds_; + bool ignore_member_names_; + bool prevent_type_widening_; + bool force_type_validation_; +}; + +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +} +} +} +} +} // namespace org::eclipse::cyclonedds::core::policy + +#endif /* CYCLONEDDS_CORE_POLICY_POLICY_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/ProprietaryPolicyKind.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/ProprietaryPolicyKind.hpp new file mode 100644 index 0000000..000efa6 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/ProprietaryPolicyKind.hpp @@ -0,0 +1,76 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_POLICY_PROPRIETARYPOLICYKIND_HPP_ +#define CYCLONEDDS_CORE_POLICY_PROPRIETARYPOLICYKIND_HPP_ + + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace policy +{ + +/* + * Proprietary policy values + */ +struct InvalidSampleVisibility_def +{ + enum Type + { + NO_INVALID_SAMPLES, + MINIMUM_INVALID_SAMPLES, + ALL_INVALID_SAMPLES + }; +}; +typedef dds::core::safe_enum InvalidSampleVisibility; + +struct SchedulingKind_def +{ + enum Type + { + SCHEDULE_DEFAULT, + SCHEDULE_TIMESHARING, + SCHEDULE_REALTIME + }; +}; +typedef dds::core::safe_enum SchedulingKind; + +struct SchedulingPriorityKind_def +{ + enum Type + { + PRIORITY_RELATIVE, + PRIORITY_ABSOLUTE + }; +}; +typedef dds::core::safe_enum SchedulingPriorityKind; + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_POLICY_PROPRIETARYPOLICYKIND_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/QosPolicyCountDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/QosPolicyCountDelegate.hpp new file mode 100644 index 0000000..575fb33 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/QosPolicyCountDelegate.hpp @@ -0,0 +1,86 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_POLICY_QOS_POLICY_COUNT_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_POLICY_QOS_POLICY_COUNT_DELEGATE_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace policy +{ + +class QosPolicyCountDelegate +{ +public: + QosPolicyCountDelegate(dds::core::policy::QosPolicyId id, int32_t count) + : policy_id_(id), + count_(count) + { } + + QosPolicyCountDelegate(const QosPolicyCountDelegate& other) + : policy_id_(other.policy_id()), + count_(other.count()) + { } + + QosPolicyCountDelegate& operator=(const QosPolicyCountDelegate& other) = default; + +public: + dds::core::policy::QosPolicyId policy_id() const + { + return policy_id_; + } + void policy_id(dds::core::policy::QosPolicyId id) + { + policy_id_ = id; + } + + int32_t count() const + { + return count_; + } + void count(int32_t c) + { + count_ = c; + } + + bool operator ==(const QosPolicyCountDelegate& other) const + { + return other.policy_id_ == policy_id_ && + other.count_ == count_; + } + + +private: + dds::core::policy::QosPolicyId policy_id_; + int32_t count_; +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_POLICY_QOS_POLICY_COUNT_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/TPolicy.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/TPolicy.hpp new file mode 100644 index 0000000..fc9efd5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/policy/TPolicy.hpp @@ -0,0 +1,468 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_POLICY_TPOLICY_HPP_ +#define CYCLONEDDS_CORE_POLICY_TPOLICY_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ +namespace policy +{ + + +/** + */ +template +class TShare : public dds::core::Value +{ +public: + /** + * Creates a Share QoS instance + */ + TShare() { } + + /** + * Creates a Share QoS instance + * + * @param name the name + * @param enable state + */ + TShare(const std::string& name, bool enable) : dds::core::Value(name, enable) { } + + /** + * Copies a Share QoS instance + * + * @param other the TShare QoS instance to copy + */ + TShare(const TShare& other) : dds::core::Value(other.delegate()) { } + +public: + /** + * Sets the name + * + * @param name the name + */ + TShare& name(const std::string& name) + { + this->delegate().name(name); + return *this; + } + + /** + * Gets the name + * + * @return the name + */ + std::string name() const + { + return this->delegate().name(); + } + + /** + * Sets enable state + * + * @param enable state + */ + TShare& enable(bool enable) + { + this->delegate().enable(enable); + return *this; + } + + /** + * Gets enable state + * + * @return enable state + */ + bool enable() const + { + return this->delegate().enable(); + } +}; + + + + +template +class TProductData : public dds::core::Value +{ +public: + /** + * Creates a ProductData QoS instance + */ + TProductData() { } + + /** + * Creates a ProductData QoS instance + * + * @param name the name + */ + TProductData(const std::string& name) : dds::core::Value(name) { } + + /** + * Copies a ProductData QoS instance + * + * @param other the TProductData QoS instance to copy + */ + TProductData(const TProductData& other) : dds::core::Value(other.delegate()) { } + +public: + /** + * Sets the name + * + * @param name the name to set + */ + TProductData& name(const std::string& name) + { + this->delegate().name(name); + return *this; + } + + /** + * Gets the name + * + * @return the name + */ + std::string name() const + { + return this->delegate().name(); + } +}; + + +template +class TSubscriptionKey : public dds::core::Value +{ +public: + /** + * Creates a SubscriptionKey QoS instance + */ + TSubscriptionKey() { } + + /** + * Creates a SubscriptionKey QoS instance + * + * @param use_key_list use the key list or not + * @param key a single key + */ + explicit TSubscriptionKey(bool use_key_list, const std::string& key) : + dds::core::Value(use_key_list, key) { } + + /** + * Creates a SubscriptionKey QoS instance + * + * @param use_key_list use the key list or not + * @param keys a sequence containing multiple keys + */ + explicit TSubscriptionKey(bool use_key_list, const dds::core::StringSeq& keys) : + dds::core::Value(use_key_list, keys) { } + + + /** + * Copies a SubscriptionKey QoS instance + * + * @param other the TSubscriptionKey QoS instance to copy + */ + TSubscriptionKey(const TSubscriptionKey& other) : + dds::core::Value(other.delegate()) { } + +public: + /** + * Sets the key + * + * @param key the key + */ + TSubscriptionKey& key(const std::string& key) + { + this->delegate().key(key); + return *this; + } + + /** + * Sets multiple keys + * + * @param keys a sequence containing multiple keys + */ + TSubscriptionKey& key(const dds::core::StringSeq& keys) + { + this->delegate().key(keys); + return *this; + } + + /** + * Gets the keys + * + * @return a sequence containing the keys + */ + const dds::core::StringSeq key() const + { + return this->delegate().key(); + } + + /** + * Sets use_key_list state + * + * @param use_key_list state + */ + TSubscriptionKey& use_key_list(bool use_key_list) + { + this->delegate().use_key_list(use_key_list); + return *this; + } + + /** + * Gets use_key_list state + * + * @return use_key_list state + */ + bool use_key_list() const + { + return this->delegate().use_key_list(); + } +}; + +template +class TReaderLifespan : public dds::core::Value +{ +public: + /** + * Creates a ReaderLifespan QoS instance + */ + TReaderLifespan() { } + + /** + * Creates a ReaderLifespan QoS instance + * + * @param used Indicates ReaderLifespan is used + * @param duration ReaderLifespan expiration duration + */ + explicit TReaderLifespan(bool used, const dds::core::Duration& duration) : + dds::core::Value(used, duration) { } + + /** + * Copies a Lifespan QoS instance + * + * @param other the Lifespan QoS instance to copy + */ + TReaderLifespan(const TReaderLifespan& other) : + dds::core::Value(other.delegate()) { } + + +public: + /** + * Sets the used flag + * + * @param used the state of the flag to set + */ + TReaderLifespan& used(bool used) + { + this->delegate().used(used); + return *this; + } + + /** + * Gets the used flag + * + * @return true if used + */ + bool used() const + { + return this->delegate().used(); + } + + /** + * Sets the expiration duration + * + * @param duration expiration duration + */ + TReaderLifespan& duration(const dds::core::Duration& duration) + { + this->delegate().duration(duration); + return *this; + } + + /** + * Gets the expiration duration + * + * @return expiration duration + */ + const dds::core::Duration duration() const + { + return this->delegate().duration(); + } +}; + + + + +/** + * Base scheduling class + */ +template +class TScheduling : public dds::core::Value +{ +public: + /** + * Creates a Scheduling QoS instance + */ + TScheduling() { } + + /** + * Creates a Scheduling QoS instance + * + * @param scheduling_kind the scheduling kind + * @param scheduling_priority_kind the scheduling priority kind + * @param scheduling_priority the scheduling priority + */ + TScheduling(const org::eclipse::cyclonedds::core::policy::SchedulingKind::Type& scheduling_kind, + const org::eclipse::cyclonedds::core::policy::SchedulingPriorityKind::Type& scheduling_priority_kind, + int32_t scheduling_priority) + : dds::core::Value(scheduling_kind, scheduling_priority_kind, scheduling_priority) + { + } + + /** + * Copies a Scheduling QoS instance + * + * @param other the TProductData QoS instance to copy + */ + TScheduling(const TScheduling& other) + : dds::core::Value(other.delegate()) + { + } + +public: + /** + * Sets the scheduling kind + * + * @param scheduling_kind the scheduling_kind + */ + TScheduling& scheduling_kind(const org::eclipse::cyclonedds::core::policy::SchedulingKind::Type& scheduling_kind) + { + this->delegate().scheduling_kind(scheduling_kind); + return *this; + } + + /** + * Gets the scheduling kind + * + * @return the scheduling_kind + */ + org::eclipse::cyclonedds::core::policy::SchedulingKind::Type scheduling_kind() const + { + return this->delegate().scheduling_kind(); + } + + /** + * Sets the scheduling priority kind + * + * @param scheduling_priority_kind the scheduling_priority_kind + */ + TScheduling& scheduling_kind(const org::eclipse::cyclonedds::core::policy::SchedulingPriorityKind::Type& scheduling_priority_kind) + { + this->delegate().scheduling_priority_kind(scheduling_priority_kind); + return *this; + } + + /** + * Gets the scheduling priority kind + * + * @return the scheduling_priority_kind + */ + org::eclipse::cyclonedds::core::policy::SchedulingPriorityKind::Type scheduling_priority_kind() const + { + return this->delegate().scheduling_priority_kind(); + } + + /** + * Sets the scheduling priority + * + * @param scheduling_priority the scheduling_priority + */ + TScheduling& scheduling_priority(int32_t scheduling_priority) + { + this->delegate().scheduling_priority(scheduling_priority); + return *this; + } + + /** + * Gets the scheduling priority + * + * @return the scheduling_priority + */ + int32_t scheduling_priority() const + { + return this->delegate().scheduling_priority(); + } +}; + + +/** + * Listener specific scheduling class + */ +template +class TListenerScheduling : public org::eclipse::cyclonedds::core::policy::TScheduling +{ +public: + /** + * Creates a ListenerScheduling QoS instance + */ + TListenerScheduling() { } + explicit TListenerScheduling(const org::eclipse::cyclonedds::core::policy::SchedulingKind::Type& scheduling_kind, + const org::eclipse::cyclonedds::core::policy::SchedulingPriorityKind::Type& scheduling_priority_kind, + int32_t scheduling_priority) + : org::eclipse::cyclonedds::core::policy::TScheduling(scheduling_kind, scheduling_priority_kind, scheduling_priority) + { + } +}; + + +/** + * Watchdog specific scheduling class + */ +template +class TWatchdogScheduling : public org::eclipse::cyclonedds::core::policy::TScheduling +{ +public: + /** + * Creates a WatchdogScheduling QoS instance + */ + TWatchdogScheduling() { } + explicit TWatchdogScheduling(const org::eclipse::cyclonedds::core::policy::SchedulingKind::Type& scheduling_kind, + const org::eclipse::cyclonedds::core::policy::SchedulingPriorityKind::Type& scheduling_priority_kind, + int32_t scheduling_priority) + : org::eclipse::cyclonedds::core::policy::TScheduling(scheduling_kind, scheduling_priority_kind, scheduling_priority) + { + } +}; + + +} +} +} +} +} + +#endif /* CYCLONEDDS_CORE_POLICY_TPOLICY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/status/StatusDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/status/StatusDelegate.hpp new file mode 100644 index 0000000..b1ca2e0 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/status/StatusDelegate.hpp @@ -0,0 +1,813 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_CORE_STATUS_STATUS_DELEGATE_HPP_ +#define CYCLONEDDS_CORE_STATUS_STATUS_DELEGATE_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace core +{ + +class InconsistentTopicStatusDelegate +{ +public: + InconsistentTopicStatusDelegate() : total_count_(0), total_count_change_(0) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + bool operator ==(const InconsistentTopicStatusDelegate& other) const + { + return other.total_count() == total_count_ ; + } + +public: + void ddsc_status(const dds_inconsistent_topic_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + } + +protected: + int32_t total_count_; + int32_t total_count_change_; +}; + + +class SampleLostStatusDelegate +{ +public: + SampleLostStatusDelegate() : total_count_(0), total_count_change_(0) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + bool operator ==(const SampleLostStatusDelegate& other) const + { + return other.total_count() == total_count_; + } + +public: + void ddsc_status(const dds_sample_lost_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + } + +protected: + int32_t total_count_; + int32_t total_count_change_; +}; + +class SampleRejectedStatusDelegate +{ +public: + SampleRejectedStatusDelegate() + : total_count_(0), + total_count_change_(0), + last_reason_(dds::core::status::SampleRejectedState::not_rejected()), + last_instance_handle_(dds::core::null) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + dds::core::status::SampleRejectedState last_reason() const + { + return last_reason_; + } + + const dds::core::InstanceHandle last_instance_handle() const + { + return last_instance_handle_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void last_reason(dds::core::status::SampleRejectedState last_reason) + { + last_reason_ = last_reason; + } + + void last_instance_handle(dds::core::InstanceHandle last_instance_handle) + { + last_instance_handle_ = last_instance_handle; + } + + bool operator ==(const SampleRejectedStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.last_reason() == last_reason_ && + other.last_instance_handle() == last_instance_handle_; + } + +public: + void ddsc_status(const dds_sample_rejected_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + switch (from->last_reason) { + case DDS_NOT_REJECTED: + last_reason_ = dds::core::status::SampleRejectedState::not_rejected(); + break; + case DDS_REJECTED_BY_INSTANCES_LIMIT: + last_reason_ = dds::core::status::SampleRejectedState::rejected_by_instances_limit(); + break; + case DDS_REJECTED_BY_SAMPLES_LIMIT: + last_reason_ = dds::core::status::SampleRejectedState::rejected_by_samples_limit(); + break; + case DDS_REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT: + last_reason_ = dds::core::status::SampleRejectedState::rejected_by_samples_per_instance_limit(); + break; + default: + ISOCPP_THROW_EXCEPTION(ISOCPP_ERROR, "Invalid SampleRejectedStatus::last_reason from ddsc"); + break; + } + last_instance_handle_ = dds::core::InstanceHandle(from->last_instance_handle); + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + dds::core::status::SampleRejectedState last_reason_; + dds::core::InstanceHandle last_instance_handle_; +}; + + +class LivelinessLostStatusDelegate +{ +public: + LivelinessLostStatusDelegate() : total_count_(0), total_count_change_(0) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + bool operator ==(const LivelinessLostStatusDelegate& other) const + { + return other.total_count() == total_count_; + } + +public: + void ddsc_status(const dds_liveliness_lost_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + } + +protected: + int32_t total_count_; + int32_t total_count_change_; +}; + + +class LivelinessChangedStatusDelegate +{ +public: + LivelinessChangedStatusDelegate() : + alive_count_(0), + not_alive_count_(0), + alive_count_change_(0), + not_alive_count_change_(0), + last_publication_handle_(dds::core::null) { } + +public: + + int32_t alive_count() const + { + return alive_count_; + } + + int32_t not_alive_count() const + { + return not_alive_count_; + } + + int32_t alive_count_change() const + { + return alive_count_change_; + } + + int32_t not_alive_count_change() const + { + return not_alive_count_change_; + } + + void alive_count(int32_t alive_count) + { + alive_count_ = alive_count; + } + + void not_alive_count(int32_t not_alive_count) + { + not_alive_count_ = not_alive_count; + } + + void alive_count_change(int32_t alive_count_change) + { + alive_count_change_ = alive_count_change; + } + + void not_alive_count_change(int32_t not_alive_count_change) + { + not_alive_count_change_ = not_alive_count_change; + } + + void last_publication_handle(dds::core::InstanceHandle last_publication_handle) + { + last_publication_handle_ = last_publication_handle; + } + + dds::core::InstanceHandle last_publication_handle() const + { + return last_publication_handle_; + } + + bool operator ==(const LivelinessChangedStatusDelegate& other) const + { + return other.alive_count() == alive_count_ && + other.not_alive_count() == not_alive_count_; + } + +public: + void ddsc_status(const dds_liveliness_changed_status_t* from) + { + alive_count_ = static_cast(from->alive_count); + not_alive_count_ = static_cast(from->not_alive_count); + alive_count_change_ = from->alive_count_change; + not_alive_count_change_ = from->not_alive_count_change; + last_publication_handle_ = dds::core::InstanceHandle(from->last_publication_handle); + } + +protected: + int32_t alive_count_; + int32_t not_alive_count_; + int32_t alive_count_change_; + int32_t not_alive_count_change_; + dds::core::InstanceHandle last_publication_handle_; + +}; + +class OfferedDeadlineMissedStatusDelegate +{ +public: + OfferedDeadlineMissedStatusDelegate() : + total_count_(0), + total_count_change_(0), + last_instance_handle_(dds::core::null) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + const dds::core::InstanceHandle last_instance_handle() const + { + return last_instance_handle_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void last_instance_handle(dds::core::InstanceHandle last_instance_handle) + { + last_instance_handle_ = last_instance_handle; + } + + bool operator ==(const OfferedDeadlineMissedStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.last_instance_handle() == last_instance_handle_; + } + +public: + void ddsc_status(const dds_offered_deadline_missed_status* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + last_instance_handle_ = dds::core::InstanceHandle(from->last_instance_handle); + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + dds::core::InstanceHandle last_instance_handle_; +}; + +class RequestedDeadlineMissedStatusDelegate +{ +public: + RequestedDeadlineMissedStatusDelegate() : + total_count_(0), + total_count_change_(0), + last_instance_handle_(dds::core::null) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + const dds::core::InstanceHandle last_instance_handle() const + { + return last_instance_handle_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void last_instance_handle(dds::core::InstanceHandle last_instance_handle) + { + last_instance_handle_ = last_instance_handle; + } + + bool operator ==(const RequestedDeadlineMissedStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.last_instance_handle() == last_instance_handle_; + } + +public: + void ddsc_status(const dds_requested_deadline_missed_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + last_instance_handle_ = dds::core::InstanceHandle(from->last_instance_handle); + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + dds::core::InstanceHandle last_instance_handle_; +}; + + +class OfferedIncompatibleQosStatusDelegate +{ +public: + OfferedIncompatibleQosStatusDelegate() : + total_count_(0), + total_count_change_(0), + last_policy_id_(0) { } + +public : + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + dds::core::policy::QosPolicyId last_policy_id() const + { + return last_policy_id_; + } + + const dds::core::policy::QosPolicyCountSeq policies() const + { + return policies_; + } + + const dds::core::policy::QosPolicyCountSeq& policies(dds::core::policy::QosPolicyCountSeq& dst) const + { + dst = policies_; + return dst; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void last_policy_id(dds::core::policy::QosPolicyId last_policy_id) + { + last_policy_id_ = last_policy_id; + } + + void set_policies(dds::core::policy::QosPolicyCountSeq policies) + { + policies_ = policies; + } + + bool operator ==(const OfferedIncompatibleQosStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.last_policy_id() == last_policy_id_ && + other.policies() == policies_; + } + +public: + void ddsc_status(const dds_offered_incompatible_qos_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + last_policy_id_ = from->last_policy_id; + policies_.clear(); +#if 0 //@todo + for (c_long i = 0; (i < V_POLICY_ID_COUNT) && (i < from->totalCount); i++) + { + if (((c_long*)(from->policyCount))[i] != 0) { + dds::core::policy::QosPolicyCount policy(i, ((c_long*)(from->policyCount))[i]); + policies_->push_back(policy); + } + } +#endif + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + dds::core::policy::QosPolicyId last_policy_id_; + dds::core::policy::QosPolicyCountSeq policies_; +}; + +class RequestedIncompatibleQosStatusDelegate +{ +public: + RequestedIncompatibleQosStatusDelegate() : + total_count_(0), + total_count_change_(0), + last_policy_id_(0) { } + +public : + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + dds::core::policy::QosPolicyId last_policy_id() const + { + return last_policy_id_; + } + + const dds::core::policy::QosPolicyCountSeq policies() const + { + return policies_; + } + + const dds::core::policy::QosPolicyCountSeq& policies(dds::core::policy::QosPolicyCountSeq& dst) const + { + dst = policies_; + return dst; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void last_policy_id(dds::core::policy::QosPolicyId last_policy_id) + { + last_policy_id_ = last_policy_id; + } + + void set_policies(dds::core::policy::QosPolicyCountSeq policies) + { + policies_ = policies; + } + + bool operator ==(const RequestedIncompatibleQosStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.last_policy_id() == last_policy_id_ && + other.policies() == policies_; + } + +public: + void ddsc_status(const dds_requested_incompatible_qos_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + last_policy_id_ = from->last_policy_id; + policies_.clear(); +#if 0 //@todo + for (c_long i = 0; (i < V_POLICY_ID_COUNT) && (i < from->totalCount); i++) + { + if (((c_long*)(from->policyCount))[i] != 0) { + dds::core::policy::QosPolicyCount policy(i, ((c_long*)(from->policyCount))[i]); + policies_.push_back(policy); + } + } +#endif + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + dds::core::policy::QosPolicyId last_policy_id_; + dds::core::policy::QosPolicyCountSeq policies_; + +}; + + +class PublicationMatchedStatusDelegate +{ +public: + PublicationMatchedStatusDelegate() : + total_count_(0), + total_count_change_(0), + current_count_(0), + current_count_change_(0), + last_subscription_handle_(dds::core::null) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + int32_t current_count() const + { + return current_count_; + } + + int32_t current_count_change() const + { + return current_count_change_; + } + + const dds::core::InstanceHandle last_subscription_handle() const + { + return last_subscription_handle_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void current_count(int32_t current_count) + { + current_count_ = current_count; + } + + void current_count_change(int32_t current_count_change) + { + current_count_change_ = current_count_change; + } + + void last_subscription_handle(dds::core::InstanceHandle last_subscription_handle) + { + last_subscription_handle_ = last_subscription_handle; + } + + bool operator ==(const PublicationMatchedStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.current_count() == current_count_ && + other.last_subscription_handle() == last_subscription_handle_; + } + +public: + void ddsc_status(const dds_publication_matched_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + current_count_ = static_cast(from->current_count); + current_count_change_ = from->current_count_change; + last_subscription_handle_ = dds::core::InstanceHandle(from->last_subscription_handle); + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + int32_t current_count_; + int32_t current_count_change_; + dds::core::InstanceHandle last_subscription_handle_; +}; + +class SubscriptionMatchedStatusDelegate +{ +public: + SubscriptionMatchedStatusDelegate() : + total_count_(0), + total_count_change_(0), + current_count_(0), + current_count_change_(0), + last_publication_handle_(dds::core::null) { } + +public: + int32_t total_count() const + { + return total_count_; + } + + int32_t total_count_change() const + { + return total_count_change_; + } + + int32_t current_count() const + { + return current_count_; + } + + int32_t current_count_change() const + { + return current_count_change_; + } + + const dds::core::InstanceHandle last_publication_handle() const + { + return last_publication_handle_; + } + + void total_count(int32_t total_count) + { + total_count_ = total_count; + } + + void total_count_change(int32_t total_count_change) + { + total_count_change_ = total_count_change; + } + + void current_count(int32_t current_count) + { + current_count_ = current_count; + } + + void current_count_change(int32_t current_count_change) + { + current_count_change_ = current_count_change; + } + + void last_publication_handle(dds::core::InstanceHandle last_publication_handle) + { + last_publication_handle_ = last_publication_handle; + } + + bool operator ==(const SubscriptionMatchedStatusDelegate& other) const + { + return other.total_count() == total_count_ && + other.current_count() == current_count_ && + other.last_publication_handle() == last_publication_handle_; + } + +public: + void ddsc_status(const dds_subscription_matched_status_t* from) + { + total_count_ = static_cast(from->total_count); + total_count_change_ = from->total_count_change; + current_count_ = static_cast(from->current_count); + current_count_change_ = from->current_count_change; + last_publication_handle_ = dds::core::InstanceHandle(from->last_publication_handle); + } + +protected: + int32_t total_count_; + int32_t total_count_change_; + int32_t current_count_; + int32_t current_count_change_; + dds::core::InstanceHandle last_publication_handle_; + +}; + +} +} +} +} /* namespace org::eclipse::cyclonedds::core */ + +#endif /* CYCLONEDDS_CORE_STATUS_STATUS_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp new file mode 100644 index 0000000..09646ff --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/core/type_helpers.hpp @@ -0,0 +1,63 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + + /** + * @file + */ + +#ifndef CYCLONEDDS_CORE_TYPE_HELPERS_HPP_ +#define CYCLONEDDS_CORE_TYPE_HELPERS_HPP_ + +#include + +//for c++ < 14 +#if __cplusplus == 201103L +#include +#endif + +//check template for whether a class is a template specification of another +template class Ref> +struct is_specialization : std::false_type {}; + +template class Ref, typename... Args> +struct is_specialization, Ref> : std::true_type {}; + +//check template for whether a class is an STL container +template +struct is_container : std::false_type {}; + +template +struct is_container_helper {}; + +template +struct is_container< + T, + std::conditional_t< + false, + is_container_helper< + typename T::value_type, + typename T::size_type, + typename T::allocator_type, + typename T::iterator, + typename T::const_iterator, + decltype(std::declval().size()), + decltype(std::declval().begin()), + decltype(std::declval().end()), + decltype(std::declval().cbegin()), + decltype(std::declval().cend()) + >, + void + > +> : public std::true_type{}; + +#endif diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/Domain.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/Domain.hpp new file mode 100644 index 0000000..4619ad9 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/Domain.hpp @@ -0,0 +1,39 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_DOMAIN_HPP_ +#define CYCLONEDDS_DOMAIN_DOMAIN_HPP_ + +#include "dds/core/types.hpp" + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace domain +{ +OMG_DDS_API uint32_t any_id(); + +OMG_DDS_API uint32_t default_id(); +} +} +} +} + +#endif /* CYCLONEDDS_DOMAIN_DOMAIN_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantDelegate.hpp new file mode 100644 index 0000000..c10bd20 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantDelegate.hpp @@ -0,0 +1,187 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_PARTICIPANT_DELEGATE_HPP_ +#define CYCLONEDDS_DOMAIN_PARTICIPANT_DELEGATE_HPP_ + + +// DDS-PSM-Cxx Includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Delegate Includes +#include +#include +#include +#include +#include +#include "org/eclipse/cyclonedds/domain/Domain.hpp" +#include "org/eclipse/cyclonedds/domain/DomainWrap.hpp" + +class OMG_DDS_API org::eclipse::cyclonedds::domain::DomainParticipantDelegate : + public ::org::eclipse::cyclonedds::core::EntityDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< DomainParticipantDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< DomainParticipantDelegate >::weak_ref_type weak_ref_type; + + DomainParticipantDelegate(uint32_t id, + const dds::domain::qos::DomainParticipantQos& qos, + dds::domain::DomainParticipantListener *listener, + const dds::core::status::StatusMask& mask, + const std::string& config); + + DomainParticipantDelegate(uint32_t id, + const dds::domain::qos::DomainParticipantQos& qos, + dds::domain::DomainParticipantListener *listener, + const dds::core::status::StatusMask& mask, + const ddsi_config& config); + + virtual ~DomainParticipantDelegate(); + +public: + void init(ObjectDelegate::weak_ref_type weak_ref); + + void listener(dds::domain::DomainParticipantListener *listener, + const ::dds::core::status::StatusMask& mask); + dds::domain::DomainParticipantListener* listener() const; + + const dds::domain::qos::DomainParticipantQos& qos() const; + + void qos(const dds::domain::qos::DomainParticipantQos& qos); + + uint32_t domain_id(); + + void assert_liveliness(); + + bool contains_entity(const ::dds::core::InstanceHandle& handle); + + void close(); + + dds::core::Time current_time() const; + + dds::topic::qos::TopicQos default_topic_qos() const; + void default_topic_qos(const dds::topic::qos::TopicQos& qos); + + dds::pub::qos::PublisherQos default_publisher_qos() const; + void default_publisher_qos(const ::dds::pub::qos::PublisherQos& qos); + + dds::sub::qos::SubscriberQos default_subscriber_qos() const; + void default_subscriber_qos(const ::dds::sub::qos::SubscriberQos& qos); + + static dds::domain::qos::DomainParticipantQos default_participant_qos(); + static void default_participant_qos(const ::dds::domain::qos::DomainParticipantQos& qos); + + static void add_participant(org::eclipse::cyclonedds::core::EntityDelegate& participant); + static void remove_participant(org::eclipse::cyclonedds::core::EntityDelegate& participant); + + void add_publisher(org::eclipse::cyclonedds::core::EntityDelegate& publisher); + void remove_publisher(org::eclipse::cyclonedds::core::EntityDelegate& publisher); + + void add_subscriber(org::eclipse::cyclonedds::core::EntityDelegate& subscriber); + void remove_subscriber(org::eclipse::cyclonedds::core::EntityDelegate& subscriber); + + void add_topic(org::eclipse::cyclonedds::core::EntityDelegate& topic); + void remove_topic(org::eclipse::cyclonedds::core::EntityDelegate& topic); + + void add_cfTopic(org::eclipse::cyclonedds::core::ObjectDelegate& cfTopic); + void remove_cfTopic(org::eclipse::cyclonedds::core::ObjectDelegate& cfTopic); + + org::eclipse::cyclonedds::core::EntityDelegate::ref_type + find_topic(const std::string& topic_name); + + org::eclipse::cyclonedds::core::ObjectDelegate::ref_type + find_cfTopic(const std::string& topic_name); + + dds_entity_t + lookup_topic(const std::string& topic_name, + const dds_typeinfo_t *type_info, + const dds::core::Duration& timeout); + + void + lookup_topics(const std::string& type_name, + std::vector& topics, + uint32_t max_size); + + static org::eclipse::cyclonedds::domain::DomainParticipantDelegate::ref_type + lookup_participant(uint32_t domain_id); + + dds::domain::TDomainParticipant + wrapper(); + + bool is_auto_enable() const; + + void ignore_participant(const ::dds::core::InstanceHandle& handle); + + virtual void + listener_notify(ObjectDelegate::ref_type source, + uint32_t triggerMask, + void *eventData, + void *listener); + + org::eclipse::cyclonedds::core::EntityDelegate::ref_type + builtin_subscriber(); + + void + builtin_subscriber(const org::eclipse::cyclonedds::core::EntityDelegate::ref_type subscriber); + + // Subscriber events + virtual void on_data_readers(dds_entity_t subscriber); + + // Reader events + void on_requested_deadline_missed(dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedDeadlineMissedStatusDelegate &sd); + void on_requested_incompatible_qos(dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedIncompatibleQosStatusDelegate &sd); + void on_sample_rejected(dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleRejectedStatusDelegate &sd); + void on_liveliness_changed(dds_entity_t reader, + org::eclipse::cyclonedds::core::LivelinessChangedStatusDelegate &sd); + void on_data_available(dds_entity_t reader); + void on_subscription_matched(dds_entity_t reader, + org::eclipse::cyclonedds::core::SubscriptionMatchedStatusDelegate &sd); + void on_sample_lost(dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleLostStatusDelegate &sd); + + +private: + static org::eclipse::cyclonedds::core::EntitySet participants; + static dds::domain::qos::DomainParticipantQos default_participant_qos_; + static org::eclipse::cyclonedds::core::Mutex global_participants_lock_; + static org::eclipse::cyclonedds::domain::DomainWrap::map_ref_type domain_registry_; + uint32_t domain_id_; + dds::domain::qos::DomainParticipantQos qos_; + dds::topic::qos::TopicQos default_topic_qos_; + dds::pub::qos::PublisherQos default_pub_qos_; + dds::sub::qos::SubscriberQos default_sub_qos_; + org::eclipse::cyclonedds::core::EntitySet publishers; + org::eclipse::cyclonedds::core::EntitySet subscribers; + org::eclipse::cyclonedds::core::EntitySet topics; + org::eclipse::cyclonedds::core::ObjectSet cfTopics; + org::eclipse::cyclonedds::core::EntityDelegate::weak_ref_type builtin_subscriber_; + org::eclipse::cyclonedds::domain::DomainWrap::ref_type domain_ref_; +}; + +#endif /* CYCLONEDDS_DOMAIN_PARTICIPANT_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantListener.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantListener.hpp new file mode 100644 index 0000000..bb6b725 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantListener.hpp @@ -0,0 +1,60 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_DOMAINPARTICIPANT_LISTENER_HPP_ +#define CYCLONEDDS_DOMAIN_DOMAINPARTICIPANT_LISTENER_HPP_ + +#include +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace domain +{ + +DDSCXX_WARNING_MSVC_OFF(4250) + +class OMG_DDS_API DomainParticipantListener : + public virtual dds::domain::DomainParticipantListener, + public virtual org::eclipse::cyclonedds::topic::AnyTopicListener +{ +public: + virtual ~DomainParticipantListener() { } +}; + + +class OMG_DDS_API NoOpDomainParticipantListener : + public virtual dds::domain::NoOpDomainParticipantListener, + public virtual org::eclipse::cyclonedds::topic::NoOpAnyTopicListener +{ +public: + virtual ~NoOpDomainParticipantListener() { } +}; + +DDSCXX_WARNING_MSVC_ON(4250) + +} +} +} +} + +#endif /* CYCLONEDDS_DOMAIN_DOMAINPARTICIPANT_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantRegistry.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantRegistry.hpp new file mode 100644 index 0000000..c5cebf5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainParticipantRegistry.hpp @@ -0,0 +1,52 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_PARTICIPANT_REGISTRY_HPP_ +#define CYCLONEDDS_DOMAIN_PARTICIPANT_REGISTRY_HPP_ + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace domain +{ + +class OMG_DDS_API DomainParticipantRegistry { +public: + + static void insert(dds::domain::TDomainParticipant& participant); + + static void remove(org::eclipse::cyclonedds::domain::DomainParticipantDelegate *delegate); + +private: + static org::eclipse::cyclonedds::core::EntityRegistry + > registry; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_DOMAIN_PARTICIPANT_REGISTRY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainWrap.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainWrap.hpp new file mode 100644 index 0000000..f7a7a5d --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/DomainWrap.hpp @@ -0,0 +1,70 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_WRAP_HPP_ +#define CYCLONEDDS_DOMAIN_WRAP_HPP_ + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace domain +{ + +/* + * In cyclonedds, you can now create a domain explicitly. A participant will + * attach to that domain automatically if the ids match. If the participant + * can not find a domain, then it'll create one implicitly. + * + * The explicit creation is needed for the 'config by string' feature. + * + * To be able to use that feature in C++, this small 'domain' wrapper class + * is introduced. + * + * It should be created for every new domain (detected during participant + * creation) and should be deleted when the last participant is closed that + * uses the related domain. + * + * Either, this wrapper contains an explicitly created domain or not. + * When not, it's basically just a placeholder. + * When yes, it'll delete the explicitly created domain in its destructor. + */ +class DomainWrap +{ +public: + typedef ::dds::core::smart_ptr_traits< DomainWrap >::ref_type ref_type; + typedef ::std::map map_ref_type; + typedef map_ref_type::iterator map_ref_iter; + +public: + DomainWrap(dds_domainid_t id, const std::string& config); + DomainWrap(dds_domainid_t id, const ddsi_config& config); + ~DomainWrap(); + +private: + dds_entity_t ddsc_domain; +}; + +}}}} /* namespaced */ + +#endif /* CYCLONEDDS_DOMAIN_WRAP_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/qos/DomainParticipantQosDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/qos/DomainParticipantQosDelegate.hpp new file mode 100644 index 0000000..b8827d3 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/domain/qos/DomainParticipantQosDelegate.hpp @@ -0,0 +1,104 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_DOMAIN_QOS_DOMAIN_PARTICIPANT_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_DOMAIN_QOS_DOMAIN_PARTICIPANT_QOS_DELEGATE_HPP_ + +#include + +struct _DDS_NamedDomainParticipantQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace domain +{ +namespace qos +{ + +class OMG_DDS_API DomainParticipantQosDelegate +{ +public: + DomainParticipantQosDelegate(); + DomainParticipantQosDelegate(const DomainParticipantQosDelegate& other); + + ~DomainParticipantQosDelegate(); + + void policy(const dds::core::policy::UserData& ud); + void policy(const dds::core::policy::EntityFactory& efp); + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedDomainParticipantQos &qos); + + void check() const; + + bool operator ==(const DomainParticipantQosDelegate& other) const; + DomainParticipantQosDelegate& operator =(const DomainParticipantQosDelegate& other); + +private: + dds::core::policy::UserData user_data_; + dds::core::policy::EntityFactory entity_factory_; +}; + + + +//============================================================================== + + +template<> +inline const dds::core::policy::UserData& +DomainParticipantQosDelegate::policy () const +{ + return user_data_; +} +template<> +inline dds::core::policy::UserData& +DomainParticipantQosDelegate::policy () +{ + return user_data_; +} + + +template<> +inline const dds::core::policy::EntityFactory& +DomainParticipantQosDelegate::policy () const +{ + return entity_factory_; +} +template<> +inline dds::core::policy::EntityFactory& +DomainParticipantQosDelegate::policy () +{ + return entity_factory_; +} + +} +} +} +} +} + +#endif /* CYCLONEDDS_DOMAIN_QOS_DOMAIN_PARTICIPANT_QOS_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/AnyDataWriterDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/AnyDataWriterDelegate.hpp new file mode 100644 index 0000000..cd1768b --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/AnyDataWriterDelegate.hpp @@ -0,0 +1,203 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_PUB_ANYDATAWRITERDELEGATE_HPP_ +#define CYCLONEDDS_PUB_ANYDATAWRITERDELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace dds { namespace pub { +template +class TAnyDataWriter; +} } + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ + +class OMG_DDS_API AnyDataWriterDelegate : public org::eclipse::cyclonedds::core::EntityDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< AnyDataWriterDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< AnyDataWriterDelegate >::weak_ref_type weak_ref_type; + + virtual ~AnyDataWriterDelegate(); + + void close(); + +public: + /* DDS API mirror. */ + dds::pub::qos::DataWriterQos qos() const; + void qos(const dds::pub::qos::DataWriterQos& qos); + + /* Let DataWriter implement the publisher handling to circumvent circular dependencies. */ + virtual const dds::pub::TPublisher& publisher() const = 0; + + const dds::topic::TopicDescription& topic_description() const; + + void wait_for_acknowledgments(const dds::core::Duration& timeout); + + const ::dds::core::status::LivelinessLostStatus liveliness_lost_status(); + + const ::dds::core::status::OfferedDeadlineMissedStatus offered_deadline_missed_status(); + + const ::dds::core::status::OfferedIncompatibleQosStatus offered_incompatible_qos_status(); + + const ::dds::core::status::PublicationMatchedStatus publication_matched_status(); + + ::dds::core::InstanceHandleSeq + matched_subscriptions(); + + template + uint32_t + matched_subscriptions(FwdIterator begin, uint32_t max_size) + { + ::dds::core::InstanceHandleSeq handleSeq = matched_subscriptions(); + uint32_t seq_size = static_cast(handleSeq.size()); + uint32_t size = (seq_size < max_size ? seq_size : max_size); + for (uint32_t i = 0; i < size; i++, begin++) { + *begin = handleSeq[i]; + } + return size; + } + + const dds::topic::SubscriptionBuiltinTopicData + matched_subscription_data(const ::dds::core::InstanceHandle& h); + + void assert_liveliness(); + +public: + dds::pub::TAnyDataWriter wrapper_to_any(); + void write_flush(); + void set_batch(bool); + +private: + void + write_cdr(dds_entity_t writer, + const org::eclipse::cyclonedds::topic::CDRBlob *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp, + uint32_t statusinfo); + +protected: + AnyDataWriterDelegate(const dds::pub::qos::DataWriterQos& qos, + const dds::topic::TopicDescription& td); + + void + write_cdr(dds_entity_t writer, + const org::eclipse::cyclonedds::topic::CDRBlob *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void + dispose_cdr(dds_entity_t writer, + const org::eclipse::cyclonedds::topic::CDRBlob *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void + unregister_instance_cdr(dds_entity_t writer, + const org::eclipse::cyclonedds::topic::CDRBlob *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + bool + is_loan_supported(const dds_entity_t writer); + + void + loan_sample(dds_entity_t writer, + void **sample); + + void + return_loan(dds_entity_t writer, + void *sample); + + void + write(dds_entity_t writer, + const void *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void + writedispose(dds_entity_t writer, + const void *data, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + dds_instance_handle_t + register_instance(dds_entity_t writer, + const void *data, + const dds::core::Time& timestamp); + + void + unregister_instance(dds_entity_t writer, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void + unregister_instance(dds_entity_t writer, + const void *data, + const dds::core::Time& timestamp); + + void + dispose_instance(dds_entity_t writer, + const dds::core::InstanceHandle& handle, + const dds::core::Time& timestamp); + + void + dispose_instance(dds_entity_t writer, + const void *data, + const dds::core::Time& timestamp); + + void + get_key_value(dds_entity_t writer, + void *data, + const dds::core::InstanceHandle& handle); + + dds_instance_handle_t + lookup_instance(dds_entity_t writer, + const void *data); + +private: + dds::pub::qos::DataWriterQos qos_; + dds::topic::TopicDescription td_; + + //@todo static bool copy_data(c_type t, void *data, void *to); +}; + +} +} +} +} + +#endif /* CYCLONEDDS_PUB_ANYDATAWRITERDELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/CoherentSetDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/CoherentSetDelegate.hpp new file mode 100644 index 0000000..a6a7f23 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/CoherentSetDelegate.hpp @@ -0,0 +1,54 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_PUB_COHERENT_SET_DELEGATE_HPP_ +#define CYCLONEDDS_PUB_COHERENT_SET_DELEGATE_HPP_ + +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ + + +class OMG_DDS_API CoherentSetDelegate +{ +public: + CoherentSetDelegate(const dds::pub::Publisher& pub); + ~CoherentSetDelegate(); + + void end(); + + bool operator ==(const CoherentSetDelegate& other) const; + +private: + dds::pub::Publisher pub; + bool ended; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_PUB_COHERENT_SET_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/PublisherDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/PublisherDelegate.hpp new file mode 100644 index 0000000..2e81ccf --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/PublisherDelegate.hpp @@ -0,0 +1,116 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef OMG_IDDS_PUB_PUBLISHER_DELEGATE_HPP_ +#define OMG_IDDS_PUB_PUBLISHER_DELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ + +class OMG_DDS_API PublisherDelegate : public org::eclipse::cyclonedds::core::EntityDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< PublisherDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< PublisherDelegate >::weak_ref_type weak_ref_type; + + PublisherDelegate(const dds::domain::DomainParticipant& dp, + const dds::pub::qos::PublisherQos& qos, + dds::pub::PublisherListener* listener, + const dds::core::status::StatusMask& event_mask); + + virtual ~PublisherDelegate(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void close(); + + const dds::pub::qos::PublisherQos& qos() const; + void qos(const dds::pub::qos::PublisherQos& pqos); + + void default_datawriter_qos(const dds::pub::qos::DataWriterQos& dwqos); + dds::pub::qos::DataWriterQos default_datawriter_qos() const; + + void suspend_publications(); + void resume_publications(); + + void begin_coherent_changes(); + void end_coherent_changes(); + + void wait_for_acknowledgments(const dds::core::Duration& max_wait); + + void listener(dds::pub::PublisherListener* listener, + const ::dds::core::status::StatusMask& mask); + dds::pub::PublisherListener* listener() const; + + const dds::domain::DomainParticipant& participant() const; + + bool contains_entity(const ::dds::core::InstanceHandle& handle); + + void add_datawriter(org::eclipse::cyclonedds::core::EntityDelegate& datawriter); + void remove_datawriter(org::eclipse::cyclonedds::core::EntityDelegate& datawriter); + org::eclipse::cyclonedds::pub::AnyDataWriterDelegate::ref_type find_datawriter(const std::string& topic_name); + + dds::pub::TPublisher + wrapper(); + + bool is_auto_enable() const; + + void on_offered_deadline_missed(dds_entity_t writer, + org::eclipse::cyclonedds::core::OfferedDeadlineMissedStatusDelegate &sd); + + void on_offered_incompatible_qos(dds_entity_t writer, + org::eclipse::cyclonedds::core::OfferedIncompatibleQosStatusDelegate &sd); + + void on_liveliness_lost(dds_entity_t writer, + org::eclipse::cyclonedds::core::LivelinessLostStatusDelegate &sd); + + void on_publication_matched(dds_entity_t writer, + org::eclipse::cyclonedds::core::PublicationMatchedStatusDelegate &sd); + +private: + dds::domain::DomainParticipant dp_; + dds::pub::qos::PublisherQos qos_; + dds::pub::qos::DataWriterQos default_dwqos_; + + org::eclipse::cyclonedds::core::EntitySet writers; +}; + +} +} +} +} + +#endif /* OMG_IDDS_PUB_PUBLISHER_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/SuspendedPublicationDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/SuspendedPublicationDelegate.hpp new file mode 100644 index 0000000..b621d21 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/SuspendedPublicationDelegate.hpp @@ -0,0 +1,55 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_PUB_SUSPENDED_PUBBLICATIONS_DELEGATE_HPP_ +#define CYCLONEDDS_PUB_SUSPENDED_PUBBLICATIONS_DELEGATE_HPP_ + +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ + + +//class OMG_DDS_API SuspendedPublicationDelegate +class SuspendedPublicationDelegate +{ +public: + SuspendedPublicationDelegate(const dds::pub::Publisher& pub); + ~SuspendedPublicationDelegate(); + + void resume(); + + bool operator ==(const SuspendedPublicationDelegate& other) const; + +private: + dds::pub::Publisher pub; + bool resumed; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_PUB_SUSPENDED_PUBBLICATIONS_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.hpp new file mode 100644 index 0000000..03f76c9 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/qos/DataWriterQosDelegate.hpp @@ -0,0 +1,305 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_PUB_QOS_DATA_WRITER_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_PUB_QOS_DATA_WRITER_QOS_DELEGATE_HPP_ + +#include +#include + +struct _DDS_NamedDataWriterQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ +namespace qos +{ + +class OMG_DDS_API DataWriterQosDelegate +{ +public: + DataWriterQosDelegate(); + DataWriterQosDelegate(const org::eclipse::cyclonedds::topic::qos::TopicQosDelegate& tqos); + + void policy(const dds::core::policy::UserData& user_data); + void policy(const dds::core::policy::Durability& durability); + void policy(const dds::core::policy::Deadline& deadline); + void policy(const dds::core::policy::LatencyBudget& budget); + void policy(const dds::core::policy::Liveliness& liveliness); + void policy(const dds::core::policy::Reliability& reliability); + void policy(const dds::core::policy::DestinationOrder& order); + void policy(const dds::core::policy::History& history); + void policy(const dds::core::policy::ResourceLimits& resources); + void policy(const dds::core::policy::TransportPriority& priority); + void policy(const dds::core::policy::Lifespan& lifespan); + void policy(const dds::core::policy::Ownership& ownership); +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + void policy(const dds::core::policy::OwnershipStrength& strength); +#endif // OMG_DDS_OWNERSHIP_SUPPORT + void policy(const dds::core::policy::WriterDataLifecycle& lifecycle); +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + void policy(const dds::core::policy::DataRepresentation& datarepresentation); + void policy(const dds::core::policy::TypeConsistencyEnforcement& typeconsistencyenforcement); +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedDataWriterQos &qos); + + void check() const; + + bool operator ==(const DataWriterQosDelegate& other) const; + DataWriterQosDelegate& operator =(const org::eclipse::cyclonedds::topic::qos::TopicQosDelegate& tqos); + +private: + dds::core::policy::UserData user_data_; + dds::core::policy::Durability durability_; + dds::core::policy::Deadline deadline_; + dds::core::policy::LatencyBudget budget_; + dds::core::policy::Liveliness liveliness_; + dds::core::policy::Reliability reliability_; + dds::core::policy::DestinationOrder order_; + dds::core::policy::History history_; + dds::core::policy::ResourceLimits resources_; + dds::core::policy::TransportPriority priority_; + dds::core::policy::Lifespan lifespan_; + dds::core::policy::Ownership ownership_; +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + dds::core::policy::OwnershipStrength strength_; +#endif // OMG_DDS_OWNERSHIP_SUPPORT + dds::core::policy::WriterDataLifecycle lifecycle_; +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + dds::core::policy::DataRepresentation datarepresentation_; + dds::core::policy::TypeConsistencyEnforcement typeconsistencyenforcement_; +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +}; + + + +//============================================================================== + + +template<> inline const dds::core::policy::UserData& +DataWriterQosDelegate::policy() const +{ + return user_data_; +} +template<> inline dds::core::policy::UserData& +DataWriterQosDelegate::policy() +{ + return user_data_; +} + + +template<> inline const dds::core::policy::Durability& +DataWriterQosDelegate::policy() const +{ + return durability_; +} +template<> inline dds::core::policy::Durability& +DataWriterQosDelegate::policy() +{ + return durability_; +} + + +template<> inline const dds::core::policy::Deadline& +DataWriterQosDelegate::policy() const +{ + return deadline_; +} +template<> inline dds::core::policy::Deadline& +DataWriterQosDelegate::policy() +{ + return deadline_; +} + + +template<> inline const dds::core::policy::LatencyBudget& +DataWriterQosDelegate::policy() const +{ + return budget_; +} +template<> inline dds::core::policy::LatencyBudget& +DataWriterQosDelegate::policy() +{ + return budget_; +} + + +template<> inline const dds::core::policy::Liveliness& +DataWriterQosDelegate::policy() const +{ + return liveliness_; +} +template<> inline dds::core::policy::Liveliness& +DataWriterQosDelegate::policy() +{ + return liveliness_; +} + + +template<> inline const dds::core::policy::Reliability& +DataWriterQosDelegate::policy() const +{ + return reliability_; +} +template<> inline dds::core::policy::Reliability& +DataWriterQosDelegate::policy() +{ + return reliability_; +} + + +template<> inline const dds::core::policy::DestinationOrder& +DataWriterQosDelegate::policy() const +{ + return order_; +} +template<> inline dds::core::policy::DestinationOrder& +DataWriterQosDelegate::policy() +{ + return order_; +} + + +template<> inline const dds::core::policy::History& +DataWriterQosDelegate::policy() const +{ + return history_; +} +template<> inline dds::core::policy::History& +DataWriterQosDelegate::policy() +{ + return history_; +} + + +template<> inline const dds::core::policy::ResourceLimits& +DataWriterQosDelegate::policy() const +{ + return resources_; +} +template<> inline dds::core::policy::ResourceLimits& +DataWriterQosDelegate::policy() +{ + return resources_; +} + + +template<> inline const dds::core::policy::TransportPriority& +DataWriterQosDelegate::policy() const +{ + return priority_; +} +template<> inline dds::core::policy::TransportPriority& +DataWriterQosDelegate::policy() +{ + return priority_; +} + + +template<> inline const dds::core::policy::Lifespan& +DataWriterQosDelegate::policy() const +{ + return lifespan_; +} +template<> inline dds::core::policy::Lifespan& +DataWriterQosDelegate::policy() +{ + return lifespan_; +} + + +template<> inline const dds::core::policy::Ownership& +DataWriterQosDelegate::policy() const +{ + return ownership_; +} +template<> inline dds::core::policy::Ownership& +DataWriterQosDelegate::policy() +{ + return ownership_; +} + + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT +template<> inline const dds::core::policy::OwnershipStrength& +DataWriterQosDelegate::policy() const +{ + return strength_; +} +template<> inline dds::core::policy::OwnershipStrength& +DataWriterQosDelegate::policy() +{ + return strength_; +} +#endif // OMG_DDS_OWNERSHIP_SUPPORT + + +template<> inline const dds::core::policy::WriterDataLifecycle& +DataWriterQosDelegate::policy() const +{ + return lifecycle_; +} +template<> inline dds::core::policy::WriterDataLifecycle& +DataWriterQosDelegate::policy() +{ + return lifecycle_; +} + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +template<> inline const dds::core::policy::DataRepresentation& +DataWriterQosDelegate::policy() const +{ + return datarepresentation_; +} +template<> inline dds::core::policy::DataRepresentation& +DataWriterQosDelegate::policy() +{ + return datarepresentation_; +} + +template<> inline const dds::core::policy::TypeConsistencyEnforcement& +DataWriterQosDelegate::policy() const +{ + return typeconsistencyenforcement_; +} +template<> inline dds::core::policy::TypeConsistencyEnforcement& +DataWriterQosDelegate::policy() +{ + return typeconsistencyenforcement_; +} +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +} +} +} +} +} + +#endif /* CYCLONEDDS_PUB_QOS_DATA_WRITER_QOS_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/qos/PublisherQosDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/qos/PublisherQosDelegate.hpp new file mode 100644 index 0000000..4391889 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/pub/qos/PublisherQosDelegate.hpp @@ -0,0 +1,136 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_PUB_QOS_PUBLISHER_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_PUB_QOS_PUBLISHER_QOS_DELEGATE_HPP_ + +#include + +struct _DDS_NamedPublisherQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace pub +{ +namespace qos +{ + +class OMG_DDS_API PublisherQosDelegate +{ +public: + PublisherQosDelegate(); + PublisherQosDelegate(const PublisherQosDelegate& other); + + ~PublisherQosDelegate(); + + void policy(const dds::core::policy::Presentation& presentation); + void policy(const dds::core::policy::Partition& partition); + void policy(const dds::core::policy::GroupData& gdata); + void policy(const dds::core::policy::EntityFactory& factory_policy); + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedPublisherQos &qos); + + void check() const; + + bool operator ==(const PublisherQosDelegate& other) const; + PublisherQosDelegate& operator =(const PublisherQosDelegate& other); + +private: + dds::core::policy::Presentation presentation_; + dds::core::policy::Partition partition_; + dds::core::policy::GroupData gdata_; + dds::core::policy::EntityFactory factory_policy_; +}; + + + +//============================================================================== + + +template<> +inline const dds::core::policy::Presentation& +PublisherQosDelegate::policy() const +{ + return presentation_; +} +template<> +inline dds::core::policy::Presentation& +PublisherQosDelegate::policy() +{ + return presentation_; +} + + +template<> +inline const dds::core::policy::Partition& +PublisherQosDelegate::policy() const +{ + return partition_; +} +template<> +inline dds::core::policy::Partition& +PublisherQosDelegate::policy() +{ + return partition_; +} + + +template<> +inline const dds::core::policy::GroupData& +PublisherQosDelegate::policy() const +{ + return gdata_; +} +template<> +inline dds::core::policy::GroupData& +PublisherQosDelegate::policy() +{ + return gdata_; +} + + +template<> +inline const dds::core::policy::EntityFactory& +PublisherQosDelegate::policy() const +{ + return factory_policy_; +} +template<> +inline dds::core::policy::EntityFactory& +PublisherQosDelegate::policy() +{ + return factory_policy_; +} + +} +} +} +} +} + +#endif /* CYCLONEDDS_PUB_QOS_PUBLISHER_QOS_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/AnyDataReaderDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/AnyDataReaderDelegate.hpp new file mode 100644 index 0000000..aaadcae --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/AnyDataReaderDelegate.hpp @@ -0,0 +1,303 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_ANY_DATA_READER_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_ANY_DATA_READER_DELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +namespace dds { namespace sub { +template +class TAnyDataReader; +} } + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +class QueryContainer; +} +} +} +} + +namespace dds +{ +namespace sub +{ +namespace detail +{ + +class SamplesHolder +{ +public: + SamplesHolder() {} + virtual ~SamplesHolder() {} + + virtual void set_length(uint32_t len) = 0; + virtual uint32_t get_length() const = 0; + virtual SamplesHolder& operator++(int) = 0; + virtual void *data() = 0; + virtual detail::SampleInfo& info() = 0; + virtual void **cpp_sample_pointers(size_t length) = 0; + virtual dds_sample_info_t *cpp_info_pointers(size_t length) = 0; + virtual void set_sample_contents(void** c_sample_pointers, dds_sample_info_t *info) = 0; + virtual void fini_samples_buffers(void**& c_sample_pointers, dds_sample_info_t*& c_sample_infos) = 0; +}; + +} +} +} + + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ + +class QueryDelegate; + +class OMG_DDS_API AnyDataReaderDelegate : public org::eclipse::cyclonedds::core::EntityDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< AnyDataReaderDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< AnyDataReaderDelegate >::weak_ref_type weak_ref_type; + + AnyDataReaderDelegate(const dds::sub::qos::DataReaderQos& qos, + const dds::topic::TopicDescription& td); + virtual ~AnyDataReaderDelegate(); + + static void copy_sample_infos( + const dds_sample_info_t &from, + dds::sub::SampleInfo &to); + +public: + /* DDS API mirror. */ + dds::sub::qos::DataReaderQos qos() const; + void qos(const dds::sub::qos::DataReaderQos& qos); + + /* Let DataReader implement the subscriber handling to circumvent circular dependencies. */ + virtual const dds::sub::TSubscriber& subscriber() const = 0; + const dds::topic::TopicDescription& topic_description() const; + + void wait_for_historical_data(const dds::core::Duration& timeout); + + dds::core::status::LivelinessChangedStatus + liveliness_changed_status(); + dds::core::status::SampleRejectedStatus + sample_rejected_status(); + dds::core::status::SampleLostStatus + sample_lost_status(); + dds::core::status::RequestedDeadlineMissedStatus + requested_deadline_missed_status(); + dds::core::status::RequestedIncompatibleQosStatus + requested_incompatible_qos_status(); + dds::core::status::SubscriptionMatchedStatus + subscription_matched_status(); + + ::dds::core::InstanceHandleSeq + matched_publications(); + + template + uint32_t + matched_publications(FwdIterator begin, uint32_t max_size) + { + ::dds::core::InstanceHandleSeq handleSeq = matched_publications(); + uint32_t seq_size = static_cast(handleSeq.size()); + uint32_t size = (seq_size < max_size ? seq_size : max_size); + for (uint32_t i = 0; i < size; i++, begin++) { + *begin = handleSeq[i]; + } + return size; + } + + const dds::topic::PublicationBuiltinTopicData + matched_publication_data(const ::dds::core::InstanceHandle& h); + +public: + /* Internal API. */ + dds::sub::TAnyDataReader wrapper_to_any(); + + static uint32_t get_ddsc_state_mask(const dds::sub::status::DataState& state); + + void reset_data_available(); + + void add_query(org::eclipse::cyclonedds::sub::QueryDelegate& query); + void remove_query(org::eclipse::cyclonedds::sub::QueryDelegate& query); + + void setSample(void* sample); + void* getSample() const; + + bool is_loan_supported(const dds_entity_t reader) const; + + void read_cdr( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void take_cdr( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_read( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_take( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_read_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_take_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_read_next_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void loaned_take_next_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void read( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void take( + const dds_entity_t reader, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void read_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void take_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void read_next_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void take_next_instance( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + const dds::sub::status::DataState& mask, + dds::sub::detail::SamplesHolder& samples, + uint32_t max_samples); + + void get_key_value( + const dds_entity_t reader, + const dds::core::InstanceHandle& handle, + void *key); + + dds_instance_handle_t lookup_instance( + const dds_entity_t reader, + const void *key) const; + + void close(); + +private: + bool init_samples_buffers( + const uint32_t requested_max_samples, + uint32_t& samples_to_read_cnt, + size_t& c_sample_pointers_size, + dds::sub::detail::SamplesHolder& samples, + void**& c_sample_pointers, + dds_sample_info_t*& c_sample_infos); + + void fini_samples_buffers( + void**& c_sample_pointers, + dds_sample_info_t*& c_sample_infos); + +protected: + org::eclipse::cyclonedds::core::ObjectSet queries; + dds::sub::qos::DataReaderQos qos_; + dds::topic::TopicDescription td_; + + void *sample_; + +}; + + +} +} +} +} + +#endif /* CYCLONEDDS_SUB_ANY_DATA_READER_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/BuiltinSubscriberDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/BuiltinSubscriberDelegate.hpp new file mode 100644 index 0000000..3d128b7 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/BuiltinSubscriberDelegate.hpp @@ -0,0 +1,69 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_BUILTIN_SUBSCRIBER_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_BUILTIN_SUBSCRIBER_DELEGATE_HPP_ + +#include +#include + +#include +#include +#include +#include + + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ + +class OMG_DDS_API BuiltinSubscriberDelegate : public org::eclipse::cyclonedds::sub::SubscriberDelegate +{ +public: + BuiltinSubscriberDelegate( + const dds::domain::DomainParticipant& dp, + const dds::sub::qos::SubscriberQos& qos); + + virtual ~BuiltinSubscriberDelegate() {}; + + std::vector + find_datareaders(const std::string& topic_name); + +public: + static SubscriberDelegate::ref_type + get_builtin_subscriber(const dds::domain::DomainParticipant& dp); + + static AnyDataReaderDelegate::ref_type + get_builtin_reader(SubscriberDelegate& subscriber, const std::string& topic_name); + +private: + static org::eclipse::cyclonedds::core::Mutex builtinLock; + +}; + +} +} +} +} + +#endif /* CYCLONEDDS_SUB_BUILTIN_SUBSCRIBER_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/CoherentAccessDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/CoherentAccessDelegate.hpp new file mode 100644 index 0000000..10d48b9 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/CoherentAccessDelegate.hpp @@ -0,0 +1,52 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_COHERENT_ACCESS_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_COHERENT_ACCESS_DELEGATE_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ + +class OMG_DDS_API CoherentAccessDelegate +{ +public: + CoherentAccessDelegate(const dds::sub::Subscriber sub); + ~CoherentAccessDelegate(); + + void end(); + + bool operator==(const CoherentAccessDelegate& other) const; + +private: + dds::sub::Subscriber sub; + bool ended; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_SUB_COHERENT_ACCESS_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/GenerationCountImpl.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/GenerationCountImpl.hpp new file mode 100644 index 0000000..a97a311 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/GenerationCountImpl.hpp @@ -0,0 +1,72 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_GENERATION_COUNT_IMPL_HPP_ +#define CYCLONEDDS_SUB_GENERATION_COUNT_IMPL_HPP_ + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +class GenerationCountImpl; +} +} +} +} + +class org::eclipse::cyclonedds::sub::GenerationCountImpl +{ +public: + GenerationCountImpl() : d_(0), nw_(0) { } + GenerationCountImpl(int32_t d, int32_t nw) : d_(d), nw_(nw) { } + +public: + inline int32_t disposed() const + { + return d_; + } + + inline void disposed(int32_t d) + { + this->d_ = d; + } + + inline int32_t no_writers() const + { + return nw_; + } + + inline void no_writers(int32_t nw) + { + this->nw_ = nw; + } + + + bool operator ==(const GenerationCountImpl& other) const + { + return other.d_ == d_ && other.nw_ == nw_; + } + +private: + int32_t d_, nw_; +}; + +#endif /* CYCLONEDDS_SUB_GENERATION_COUNT_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/QueryDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/QueryDelegate.hpp new file mode 100644 index 0000000..416b795 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/QueryDelegate.hpp @@ -0,0 +1,119 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_SUB_QUERY_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_QUERY_DELEGATE_HPP_ + +/** + * @file + */ + +#include +#include +#include + +#include +#include + + +#include +#include + + + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ + + +class OMG_DDS_API QueryDelegate : public virtual org::eclipse::cyclonedds::core::DDScObjectDelegate +{ +public: + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; + typedef ::dds::core::smart_ptr_traits::ref_type Ref; + typedef ::dds::core::smart_ptr_traits::weak_ref_type WeakRef; + +public: + QueryDelegate(const dds::sub::AnyDataReader& dr, + const dds::sub::status::DataState& state_filter = dds::sub::status::DataState::any()); + + QueryDelegate(const dds::sub::AnyDataReader& dr, + const std::string& query_expression, + const dds::sub::status::DataState& state_filter = dds::sub::status::DataState::any()); + + QueryDelegate(const dds::sub::AnyDataReader& dr, + const std::string& query_expression, + const std::vector& params, + const dds::sub::status::DataState& state_filter = dds::sub::status::DataState::any()); + + virtual ~QueryDelegate(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void close(); + + const std::string& expression() const; + + void expression(const std::string& expr); + + iterator begin(); + + iterator end(); + + const_iterator begin() const; + + const_iterator end() const; + + void add_parameter(const std::string& param); + + uint32_t parameters_length() const; + + void parameters(const std::vector& params); + + std::vector parameters(); + + void clear_parameters(); + + const dds::sub::AnyDataReader& data_reader() const; + + virtual void state_filter(dds::sub::status::DataState& s); + + virtual dds::sub::status::DataState state_filter(); + + virtual bool modify_state_filter(dds::sub::status::DataState& s); + + bool state_filter_equal(dds::sub::status::DataState& s); + +protected: + void deinit(); + +private: + dds::sub::AnyDataReader reader_; + std::string expression_; + std::vector params_; + dds::sub::status::DataState state_filter_; + bool modified_; +}; + + +} +} +} +} + +#endif /* CYCLONEDDS_SUB_QUERY_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/RankImpl.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/RankImpl.hpp new file mode 100644 index 0000000..468f5b6 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/RankImpl.hpp @@ -0,0 +1,68 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_RANK_IMPL_HPP_ +#define CYCLONEDDS_SUB_RANK_IMPL_HPP_ + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +class RankImpl; +} +} +} +} + +class org::eclipse::cyclonedds::sub::RankImpl +{ +public: + RankImpl() : s_(0), g_(0), ag_(0) { } + RankImpl(int32_t s, int32_t g, int32_t ag) : s_(s), g_(g), ag_(ag) { } + +public: + inline int32_t absolute_generation() const + { + return ag_; + } + + inline int32_t generation() const + { + return g_; + } + + inline int32_t sample() const + { + return s_; + } + + bool operator ==(const RankImpl& other) const + { + return other.s_ == s_ && other.g_ == g_ && other.ag_; + } +private: + int32_t s_; + int32_t g_; + int32_t ag_; +}; + + +#endif /* CYCLONEDDS_SUB_RANK_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/SampleInfoImpl.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/SampleInfoImpl.hpp new file mode 100644 index 0000000..462ce25 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/SampleInfoImpl.hpp @@ -0,0 +1,150 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_SAMPLE_INFO_IMPL_HPP_ +#define CYCLONEDDS_SUB_SAMPLE_INFO_IMPL_HPP_ + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +class SampleInfoImpl; +} +} +} +} + + +class org::eclipse::cyclonedds::sub::SampleInfoImpl +{ +public: + SampleInfoImpl() : valid_(false) { } +public: + + inline const dds::core::Time timestamp() const + { + return this->source_timestamp_; + } + + inline void timestamp(const dds::core::Time& t) + { + this->source_timestamp_ = t; + } + + inline const dds::sub::status::DataState state() const + { + return this->state_; + } + + inline void state(const dds::sub::status::DataState& s) + { + this->state_ = s; + } + + inline dds::sub::GenerationCount generation_count() const + { + return this->generation_count_; + } + + inline void generation_count(dds::sub::GenerationCount& c) + { + this->generation_count_ = c; + } + + inline dds::sub::Rank rank() const + { + return this->rank_; + } + + inline void rank(dds::sub::Rank& r) + { + this->rank_ = r; + } + + inline bool valid() const + { + return this->valid_; + } + + inline void valid(bool v) + { + this->valid_ = v; + } + + inline dds::core::InstanceHandle instance_handle() const + { + return this->instance_handle_; + } + + inline void instance_handle(dds::core::InstanceHandle& h) + { + this->instance_handle_ = h; + } + + inline dds::core::InstanceHandle publication_handle() const + { + return this->publication_handle_; + } + + inline void publication_handle(dds::core::InstanceHandle& h) + { + this->publication_handle_ = h; + } + + bool operator==(const SampleInfoImpl& other) const + { + return this->source_timestamp_ == other.timestamp() + && state_is_equal(this->state_, other.state()) + && this->generation_count_ == other.generation_count() + && this->rank_ == other.rank() + && this->valid_ == other.valid() + && this->instance_handle_ == other.instance_handle() + && this->publication_handle_ == other.publication_handle(); + } + + +private: + static bool state_is_equal( + const dds::sub::status::DataState& s1, + const dds::sub::status::DataState& s2) + { + return s1.instance_state() == s1.instance_state() + && s1.view_state() == s2.view_state() + && s1.sample_state() == s2.sample_state(); + } + +private: + dds::core::Time source_timestamp_; + dds::sub::status::DataState state_; + dds::sub::GenerationCount generation_count_; + dds::sub::Rank rank_; + bool valid_; + dds::core::InstanceHandle instance_handle_; + dds::core::InstanceHandle publication_handle_; + +}; + + +#endif /* CYCLONEDDS_SUB_SAMPLE_INFO_IMPL_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/SubscriberDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/SubscriberDelegate.hpp new file mode 100644 index 0000000..3fa209c --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/SubscriberDelegate.hpp @@ -0,0 +1,149 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_SUBSCRIBER_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_SUBSCRIBER_DELEGATE_HPP_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ + +class OMG_DDS_API SubscriberDelegate : public org::eclipse::cyclonedds::core::EntityDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< SubscriberDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< SubscriberDelegate >::weak_ref_type weak_ref_type; + + SubscriberDelegate(const dds::domain::DomainParticipant& dp, + const dds::sub::qos::SubscriberQos& qos, + dds::sub::SubscriberListener* listener, + const dds::core::status::StatusMask& event_mask); + + virtual ~SubscriberDelegate(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void close(); + + const dds::sub::qos::SubscriberQos& qos() const; + void qos(const dds::sub::qos::SubscriberQos& sqos); + + void default_datareader_qos(const dds::sub::qos::DataReaderQos& qos); + dds::sub::qos::DataReaderQos default_datareader_qos() const; + + void begin_coherent_access(); + void end_coherent_access(); + + /** + * @internal This function initialises the delegate as the built in subscriber + */ + //void init_builtin(DDS::Subscriber_ptr sub); + + void listener(dds::sub::SubscriberListener* listener, + const ::dds::core::status::StatusMask& mask); + dds::sub::SubscriberListener* listener() const; + + const dds::domain::DomainParticipant& participant() const; + + /** @internal @todo OSPL-1944 Subscriber Listener should return list of affected DataReaders (on_data_on_readers) **/ + //dds::sub::AnyDataReader get_datareaders(); /* TODO: OSPL-1944? */ + + bool contains_entity( + const ::dds::core::InstanceHandle& handle); + + void add_datareader( + org::eclipse::cyclonedds::core::EntityDelegate& datareader); + + void remove_datareader( + org::eclipse::cyclonedds::core::EntityDelegate& datareader); + + virtual std::vector + find_datareaders( + const std::string& topic_name); + + std::vector + get_datareaders( + const dds::sub::status::DataState& mask); + + void notify_datareaders(); + + dds::sub::TSubscriber + wrapper(); + + bool is_auto_enable() const; + + void reset_data_on_readers(); + + // Subscriber events + void on_data_readers( + dds_entity_t); + + // Reader events + void on_requested_deadline_missed( + dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedDeadlineMissedStatusDelegate &sd); + void on_requested_incompatible_qos( + dds_entity_t reader, + org::eclipse::cyclonedds::core::RequestedIncompatibleQosStatusDelegate &sd); + void on_sample_rejected( + dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleRejectedStatusDelegate &sd); + void on_liveliness_changed( + dds_entity_t reader, + org::eclipse::cyclonedds::core::LivelinessChangedStatusDelegate &sd); + void on_data_available( + dds_entity_t reader); + void on_subscription_matched( + dds_entity_t reader, + org::eclipse::cyclonedds::core::SubscriptionMatchedStatusDelegate &sd); + void on_sample_lost( + dds_entity_t reader, + org::eclipse::cyclonedds::core::SampleLostStatusDelegate &sd); + +private: + dds::domain::DomainParticipant dp_; + dds::sub::qos::SubscriberQos qos_; + dds::sub::qos::DataReaderQos default_dr_qos_; + + org::eclipse::cyclonedds::core::EntitySet readers; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_SUB_SUBSCRIBER_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/cond/QueryConditionDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/cond/QueryConditionDelegate.hpp new file mode 100644 index 0000000..1c8e142 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/cond/QueryConditionDelegate.hpp @@ -0,0 +1,79 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_COND_QUERYCONDITION_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_COND_QUERYCONDITION_DELEGATE_HPP_ + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +namespace cond +{ + +class OMG_DDS_API QueryConditionDelegate : + public org::eclipse::cyclonedds::sub::cond::ReadConditionDelegate +{ +public: + + typedef QueryDelegate::iterator iterator; + typedef QueryDelegate::const_iterator const_iterator; + +public: + QueryConditionDelegate( + const dds::sub::AnyDataReader& dr, + const std::string& query_expression, + const dds::sub::status::DataState& state_filter); + + QueryConditionDelegate( + const dds::sub::AnyDataReader& dr, + const std::string& expression, + const std::vector& params, + const dds::sub::status::DataState& data_state); + + QueryConditionDelegate( + const dds::sub::AnyDataReader& dr, + const dds::sub::status::DataState& data_state); + + ~QueryConditionDelegate(); + + typedef bool (*Filter_fn) (const void * sample); + + void set_filter(Filter_fn filter); + + Filter_fn get_filter(); + + void init(ObjectDelegate::weak_ref_type weak_ref); +protected: + Filter_fn cpp_filter; + + static bool trans_filter(const void *csample, const void *ctx); +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_SUB_COND_QUERYCONDITION_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/cond/ReadConditionDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/cond/ReadConditionDelegate.hpp new file mode 100644 index 0000000..ffd23f3 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/cond/ReadConditionDelegate.hpp @@ -0,0 +1,64 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_COND_READCONDITION_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_COND_READCONDITION_DELEGATE_HPP_ + +#include + +#include +#include + + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +namespace cond +{ + + +class OMG_DDS_API ReadConditionDelegate : + public virtual org::eclipse::cyclonedds::core::cond::ConditionDelegate, + public virtual org::eclipse::cyclonedds::sub::QueryDelegate +{ +public: + ReadConditionDelegate( + const dds::sub::AnyDataReader& dr, + const dds::sub::status::DataState& state_filter); + + ~ReadConditionDelegate(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void close(); + + virtual bool trigger_value() const; +}; + +} +} +} +} +} + +#endif /* CYCLONEDDS_SUB_COND_READCONDITION_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.hpp new file mode 100644 index 0000000..0126858 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/qos/DataReaderQosDelegate.hpp @@ -0,0 +1,285 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_QOS_DATA_READER_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_QOS_DATA_READER_QOS_DELEGATE_HPP_ + +#include +#include + +struct _DDS_NamedDataReaderQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +namespace qos +{ + +class OMG_DDS_API DataReaderQosDelegate +{ +public: + DataReaderQosDelegate(); + DataReaderQosDelegate(const org::eclipse::cyclonedds::topic::qos::TopicQosDelegate& tqos); + + void policy(const dds::core::policy::UserData& user_data); + void policy(const dds::core::policy::Durability& durability); + void policy(const dds::core::policy::Deadline& deadline); + void policy(const dds::core::policy::LatencyBudget& budget); + void policy(const dds::core::policy::Liveliness& liveliness); + void policy(const dds::core::policy::Reliability& reliability); + void policy(const dds::core::policy::DestinationOrder& order); + void policy(const dds::core::policy::History& history); + void policy(const dds::core::policy::ResourceLimits& resources); + void policy(const dds::core::policy::Ownership& ownership); + void policy(const dds::core::policy::TimeBasedFilter& tfilter); + void policy(const dds::core::policy::ReaderDataLifecycle& lifecycle); +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + void policy(const dds::core::policy::DataRepresentation& datarepresentation); + void policy(const dds::core::policy::TypeConsistencyEnforcement& typeconsistencyenforcement); +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedDataReaderQos &qos); + + void check() const; + + bool operator==(const DataReaderQosDelegate& other) const; + DataReaderQosDelegate& operator =(const org::eclipse::cyclonedds::topic::qos::TopicQosDelegate& tqos); + +private: + dds::core::policy::UserData user_data_; + dds::core::policy::Durability durability_; + dds::core::policy::Deadline deadline_; + dds::core::policy::LatencyBudget budget_; + dds::core::policy::Liveliness liveliness_; + dds::core::policy::Reliability reliability_; + dds::core::policy::DestinationOrder order_; + dds::core::policy::History history_; + dds::core::policy::ResourceLimits resources_; + dds::core::policy::Ownership ownership_; + dds::core::policy::TimeBasedFilter tfilter_; + dds::core::policy::ReaderDataLifecycle lifecycle_; +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + dds::core::policy::DataRepresentation datarepresentation_; + dds::core::policy::TypeConsistencyEnforcement typeconsistencyenforcement_; +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +}; + + + +//============================================================================== + + +template<> +inline const dds::core::policy::Durability& +DataReaderQosDelegate::policy() const +{ + return durability_; +} +template<> +inline dds::core::policy::Durability& +DataReaderQosDelegate::policy() +{ + return durability_; +} + + +template<> +inline const dds::core::policy::UserData& +DataReaderQosDelegate::policy() const +{ + return user_data_; +} +template<> +inline dds::core::policy::UserData& +DataReaderQosDelegate::policy() +{ + return user_data_; +} + + +template<> inline const dds::core::policy::Deadline& +DataReaderQosDelegate::policy() const +{ + return deadline_; +} +template<> +inline dds::core::policy::Deadline& +DataReaderQosDelegate::policy() +{ + return deadline_; +} + + +template<> inline const dds::core::policy::LatencyBudget& +DataReaderQosDelegate::policy() const +{ + return budget_; +} +template<> +inline dds::core::policy::LatencyBudget& +DataReaderQosDelegate::policy() +{ + return budget_; +} + + +template<> inline const dds::core::policy::Liveliness& +DataReaderQosDelegate::policy() const +{ + return liveliness_; +} +template<> +inline dds::core::policy::Liveliness& +DataReaderQosDelegate::policy() +{ + return liveliness_; +} + + +template<> inline const dds::core::policy::Reliability& +DataReaderQosDelegate::policy() const +{ + return reliability_; +} +template<> +inline dds::core::policy::Reliability& +DataReaderQosDelegate::policy() +{ + return reliability_; +} + + +template<> inline const dds::core::policy::DestinationOrder& +DataReaderQosDelegate::policy() const +{ + return order_; +} +template<> +inline dds::core::policy::DestinationOrder& +DataReaderQosDelegate::policy() +{ + return order_; +} + + +template<> inline const dds::core::policy::History& +DataReaderQosDelegate::policy() const +{ + return history_; +} +template<> +inline dds::core::policy::History& +DataReaderQosDelegate::policy() +{ + return history_; +} + + +template<> inline const dds::core::policy::ResourceLimits& +DataReaderQosDelegate::policy() const +{ + return resources_; +} +template<> +inline dds::core::policy::ResourceLimits& +DataReaderQosDelegate::policy() +{ + return resources_; +} + + +template<> inline const dds::core::policy::Ownership& +DataReaderQosDelegate::policy() const +{ + return ownership_; +} +template<> +inline dds::core::policy::Ownership& +DataReaderQosDelegate::policy() +{ + return ownership_; +} + + +template<> inline const dds::core::policy::TimeBasedFilter& +DataReaderQosDelegate::policy() const +{ + return tfilter_; +} +template<> +inline dds::core::policy::TimeBasedFilter& +DataReaderQosDelegate::policy() +{ + return tfilter_; +} + + +template<> inline const dds::core::policy::ReaderDataLifecycle& +DataReaderQosDelegate::policy() const +{ + return lifecycle_; +} +template<> +inline dds::core::policy::ReaderDataLifecycle& +DataReaderQosDelegate::policy() +{ + return lifecycle_; +} + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +template<> inline const dds::core::policy::DataRepresentation& +DataReaderQosDelegate::policy() const +{ + return datarepresentation_; +} +template<> inline dds::core::policy::DataRepresentation& +DataReaderQosDelegate::policy() +{ + return datarepresentation_; +} + +template<> inline const dds::core::policy::TypeConsistencyEnforcement& +DataReaderQosDelegate::policy() const +{ + return typeconsistencyenforcement_; +} +template<> inline dds::core::policy::TypeConsistencyEnforcement& +DataReaderQosDelegate::policy() +{ + return typeconsistencyenforcement_; +} +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +} +} +} +} +} + +#endif /* CYCLONEDDS_SUB_QOS_DATA_READER_QOS_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/qos/SubscriberQosDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/qos/SubscriberQosDelegate.hpp new file mode 100644 index 0000000..8c72ae4 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/sub/qos/SubscriberQosDelegate.hpp @@ -0,0 +1,136 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_SUB_QOS_SUBSCRIBER_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_SUB_QOS_SUBSCRIBER_QOS_DELEGATE_HPP_ + +#include + +struct _DDS_NamedSubscriberQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace sub +{ +namespace qos +{ + +class OMG_DDS_API SubscriberQosDelegate +{ +public: + SubscriberQosDelegate(); + SubscriberQosDelegate(const SubscriberQosDelegate& other); + + ~SubscriberQosDelegate(); + + void policy(const dds::core::policy::Presentation& presentation); + void policy(const dds::core::policy::Partition& partition); + void policy(const dds::core::policy::GroupData& grout_data); + void policy(const dds::core::policy::EntityFactory& entity_factory); + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedSubscriberQos &qos); + + void check() const; + + bool operator ==(const SubscriberQosDelegate& other) const; + SubscriberQosDelegate& operator =(const SubscriberQosDelegate& other); + +private: + dds::core::policy::Presentation presentation_; + dds::core::policy::Partition partition_; + dds::core::policy::GroupData group_data_; + dds::core::policy::EntityFactory entity_factory_; +}; + + + +//============================================================================== + + +template<> +inline const dds::core::policy::Presentation& +SubscriberQosDelegate::policy() const +{ + return presentation_; +} +template<> +inline dds::core::policy::Presentation& +SubscriberQosDelegate::policy() +{ + return presentation_; +} + + +template<> +inline const dds::core::policy::Partition& +SubscriberQosDelegate::policy() const +{ + return partition_; +} +template<> +inline dds::core::policy::Partition& +SubscriberQosDelegate::policy() +{ + return partition_; +} + + +template<> +inline const dds::core::policy::GroupData& +SubscriberQosDelegate::policy() const +{ + return group_data_; +} +template<> +inline dds::core::policy::GroupData& +SubscriberQosDelegate::policy() +{ + return group_data_; +} + + +template<> +inline const dds::core::policy::EntityFactory& +SubscriberQosDelegate::policy() const +{ + return entity_factory_; +} +template<> +inline dds::core::policy::EntityFactory& +SubscriberQosDelegate::policy() +{ + return entity_factory_; +} + +} +} +} +} +} + +#endif /* CYCLONEDDS_SUB_QOS_SUBSCRIBER_QOS_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicDelegate.hpp new file mode 100644 index 0000000..ba1b503 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicDelegate.hpp @@ -0,0 +1,113 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_ANYTOPICDELEGATE_HPP_ +#define CYCLONEDDS_TOPIC_ANYTOPICDELEGATE_HPP_ + + +#include +#include +#include +#include + + +namespace dds { namespace topic { +template +class TAnyTopic; +} } + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +DDSCXX_WARNING_MSVC_OFF(4250) + +class OMG_DDS_API AnyTopicDelegate : + public virtual org::eclipse::cyclonedds::core::EntityDelegate, + public virtual org::eclipse::cyclonedds::topic::TopicDescriptionDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< AnyTopicDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< AnyTopicDelegate >::weak_ref_type weak_ref_type; + + AnyTopicDelegate(const dds::topic::qos::TopicQos& qos, + const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name, + dds_entity_t ddsc_topic); + + virtual ~AnyTopicDelegate(); + +public: + /* DDS API mirror. */ + dds::topic::qos::TopicQos qos() const; + void qos(const dds::topic::qos::TopicQos& qos); + + ::dds::core::status::InconsistentTopicStatus inconsistent_topic_status() const; + + std::string reader_expression() const; + + TEMP_TYPE reader_parameters() const; + //@todo c_value *reader_parameters() const; + +public: + dds::topic::TAnyTopic wrapper_to_any(); + + void init(ObjectDelegate::weak_ref_type weak_ref); + + void listener_notify(ObjectDelegate::ref_type, + uint32_t, + void *, + void *) {} + + static dds::topic::TAnyTopic + discover_topic(const dds::domain::DomainParticipant& dp, + const std::string& name, + const dds::core::Duration& timeout); + + static void + discover_topics(const dds::domain::DomainParticipant& dp, + std::vector >& topics, + uint32_t max_size); + + void set_sample(void* sample); + void* get_sample(); + +protected: + AnyTopicDelegate(const dds::topic::qos::TopicQos& qos, + const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name); + + dds::topic::qos::TopicQos qos_; + void* sample_; +}; + +DDSCXX_WARNING_MSVC_ON(4250) + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_ANYTOPICDELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicListener.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicListener.hpp new file mode 100644 index 0000000..14cf9f1 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/AnyTopicListener.hpp @@ -0,0 +1,47 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +#ifndef CYCLONEDDS_TOPIC_ANY_TOPIC_LISTENER_HPP_ +#define CYCLONEDDS_TOPIC_ANY_TOPIC_LISTENER_HPP_ + + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +class OMG_DDS_API AnyTopicListener +{ +public: + virtual ~AnyTopicListener() { } +}; + + +class OMG_DDS_API NoOpAnyTopicListener : public virtual AnyTopicListener +{ +public: + virtual ~NoOpAnyTopicListener() { } +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_ANY_TOPIC_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopic.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopic.hpp new file mode 100644 index 0000000..5fbf102 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopic.hpp @@ -0,0 +1,50 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +#ifndef CYCLONEDDS_TOPIC_BUILTIN_TOPIC_HPP_ +#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_HPP_ + + +#include + + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +typedef TCMParticipantBuiltinTopicData +CMParticipantBuiltinTopicData; + +typedef TCMPublisherBuiltinTopicData +CMPublisherBuiltinTopicData; + +typedef TCMSubscriberBuiltinTopicData +CMSubscriberBuiltinTopicData; + +typedef TCMDataWriterBuiltinTopicData +CMDataWriterBuiltinTopicData; + +typedef TCMDataReaderBuiltinTopicData +CMDataReaderBuiltinTopicData; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicCopy.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicCopy.hpp new file mode 100644 index 0000000..cfa573d --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicCopy.hpp @@ -0,0 +1,19 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +#ifndef CYCLONEDDS_TOPIC_BUILTIN_TOPIC_COPY_HPP_ +#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_COPY_HPP_ + +/* TODO: add builtin topic copyin copyout function declarations. */ + +#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_COPY_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicDelegate.hpp new file mode 100644 index 0000000..600d62f --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicDelegate.hpp @@ -0,0 +1,1122 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_BUILTIN_TOPIC_DELEGATE_HPP +#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_DELEGATE_HPP + +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ +class ParticipantBuiltinTopicDataDelegate; +class TopicBuiltinTopicDataDelegate; +class PublicationBuiltinTopicDataDelegate; +class SubscriptionBuiltinTopicDataDelegate; +class CMParticipantBuiltinTopicDataDelegate; +class CMPublisherBuiltinTopicDataDelegate; +class CMSubscriberBuiltinTopicDataDelegate; +class CMDataWriterBuiltinTopicDataDelegate; +class CMDataReaderBuiltinTopicDataDelegate; +} +} +} +} + +//============================================================================== +// ParticipantBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::ParticipantBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const ::dds::core::policy::UserData& user_data() const + { + return user_data_; + } + + void user_data(const dds_qos_t* policy) + { + user_data_.delegate().set_iso_policy(policy); + } + + bool operator ==(const ParticipantBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ && other.user_data_ == user_data_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + ::dds::core::policy::UserData user_data_; +}; + +class org::eclipse::cyclonedds::topic::TopicBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const std::string& name() const + { + return name_; + } + + void name(const char *name) + { + name_ = name; + } + + const std::string& type_name() const + { + return type_name_; + } + + void type_name(const char *name) + { + type_name_ = name; + } + + const ::dds::core::policy::Durability& durability() const + { + return durability_; + } + + void durability(const dds_qos_t* policy) + { + durability_.delegate().set_iso_policy(policy); + } + + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + + const ::dds::core::policy::DurabilityService& durability_service() const + { + return durability_service_; + } + + void durability_service(const dds_qos_t* policy) + { + durability_service_.delegate().set_iso_policy(policy); + } + +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + + const ::dds::core::policy::Deadline& deadline() const + { + return deadline_; + } + + void deadline(const dds_qos_t* policy) + { + deadline_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::LatencyBudget& latency_budget() const + { + return latency_budget_; + } + + void latency_budget(const dds_qos_t* policy) + { + latency_budget_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Liveliness& liveliness() const + { + return liveliness_; + } + + void liveliness(const dds_qos_t* policy) + { + liveliness_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Reliability& reliability() const + { + return reliability_; + } + + void reliability(const dds_qos_t* policy) + { + reliability_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::TransportPriority& transport_priority() const + { + return transport_priority_; + } + + void transport_priority(const dds_qos_t* policy) + { + transport_priority_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Lifespan& lifespan() const + { + return lifespan_; + } + + void lifespan(const dds_qos_t* policy) + { + lifespan_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::DestinationOrder& destination_order() const + { + return destination_order_; + } + + void destination_order(const dds_qos_t* policy) + { + destination_order_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::History& history() const + { + return history_; + } + + void history(const dds_qos_t* policy) + { + history_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::ResourceLimits& resource_limits() const + { + return resource_limits_; + } + + void resource_limits(const dds_qos_t* policy) + { + resource_limits_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Ownership& ownership() const + { + return ownership_; + } + + void ownership(const dds_qos_t* policy) + { + ownership_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::TopicData& topic_data() const + { + return topic_data_; + } + + void topic_data(const dds_qos_t* policy) + { + topic_data_.delegate().set_iso_policy(policy); + } + + bool operator ==(const TopicBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.name_ == name_ + && other.type_name_ == type_name_ + && other.durability_ == durability_ +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + && other.durability_service_ == durability_service_ +#endif // OMG_DDS_PERSISTENCE_SUPPORT + && other.deadline_ == deadline_ + && other.latency_budget_ == latency_budget_ + && other.liveliness_ == liveliness_ + && other.reliability_ == reliability_ + && other.transport_priority_ == transport_priority_ + && other.lifespan_ == lifespan_ + && other.destination_order_ == destination_order_ + && other.history_ == history_ + && other.resource_limits_ == resource_limits_ + && other.ownership_ == ownership_ + && other.topic_data_ == topic_data_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + std::string name_; + std::string type_name_; + ::dds::core::policy::Durability durability_; + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + ::dds::core::policy::DurabilityService durability_service_; +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + ::dds::core::policy::Deadline deadline_; + ::dds::core::policy::LatencyBudget latency_budget_; + ::dds::core::policy::Liveliness liveliness_; + ::dds::core::policy::Reliability reliability_; + ::dds::core::policy::TransportPriority transport_priority_; + ::dds::core::policy::Lifespan lifespan_; + ::dds::core::policy::DestinationOrder destination_order_; + ::dds::core::policy::History history_; + ::dds::core::policy::ResourceLimits resource_limits_; + ::dds::core::policy::Ownership ownership_; + ::dds::core::policy::TopicData topic_data_; +}; + +//============================================================================== +// PublicationBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::PublicationBuiltinTopicDataDelegate +{ +public: + PublicationBuiltinTopicDataDelegate() : ownership_strength_(0) { } + + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const dds::topic::BuiltinTopicKey& participant_key() const + { + return participant_key_; + } + + void participant_key(const int32_t* key) + { + participant_key_.delegate().value(const_cast(key)); + } + + const std::string& topic_name() const + { + return topic_name_; + } + + void topic_name(const char *name) + { + topic_name_ = name; + } + + const std::string& type_name() const + { + return type_name_; + } + + void type_name(const char *name) + { + type_name_ = name; + } + + const ::dds::core::policy::Durability& durability() const + { + return durability_; + } + + void durability(const dds_qos_t* policy) + { + durability_.delegate().set_iso_policy(policy); + } + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + + const ::dds::core::policy::DurabilityService& durability_service() const + { + return durability_service_; + } + +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + + const ::dds::core::policy::Deadline& deadline() const + { + return deadline_; + } + + void deadline(const dds_qos_t* policy) + { + deadline_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::LatencyBudget& latency_budget() const + { + return latency_budget_; + } + + void latency_budget(const dds_qos_t* policy) + { + latency_budget_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Liveliness& liveliness() const + { + return liveliness_; + } + + void liveliness(const dds_qos_t* policy) + { + liveliness_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Reliability& reliability() const + { + return reliability_; + } + + void reliability(const dds_qos_t* policy) + { + reliability_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Lifespan& lifespan() const + { + return lifespan_; + } + + void lifespan(const dds_qos_t* policy) + { + lifespan_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::DestinationOrder& destination_order() const + { + return destination_order_; + } + + void destination_order(const dds_qos_t* policy) + { + destination_order_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Ownership& ownership() const + { + return ownership_; + } + + void ownership(const dds_qos_t* policy) + { + ownership_.delegate().set_iso_policy(policy); + } + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + + const ::dds::core::policy::OwnershipStrength& ownership_strength() const + { + return ownership_strength_; + } + + void ownership_strength(const dds_qos_t* policy) + { + ownership_strength_.delegate().set_iso_policy(policy); + } + +#endif // OMG_DDS_OWNERSHIP_SUPPORT + + + const ::dds::core::policy::Partition& partition() const + { + return partition_; + } + + void partition(const dds_qos_t* policy) + { + partition_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Presentation& presentation() const + { + return presentation_; + } + + void presentation(const dds_qos_t* policy) + { + presentation_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::TopicData& topic_data() const + { + return topic_data_; + } + + void topic_data(const dds_qos_t* policy) + { + topic_data_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::UserData& user_data() const + { + return user_data_; + } + + void user_data(const dds_qos_t* policy) + { + user_data_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::GroupData& group_data() const + { + return group_data_; + } + + void group_data(const dds_qos_t* policy) + { + group_data_.delegate().set_iso_policy(policy); + } + + + bool operator ==(const PublicationBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.participant_key_ == participant_key_ + && other.topic_name_ == topic_name_ + && other.type_name_ == type_name_ + && other.durability_ == durability_ +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + && other.durability_service_ == durability_service_ +#endif // OMG_DDS_PERSISTENCE_SUPPORT + && other.deadline_ == deadline_ + && other.latency_budget_ == latency_budget_ + && other.liveliness_ == liveliness_ + && other.reliability_ == reliability_ + && other.lifespan_ == lifespan_ + && other.user_data_ == user_data_ + && other.ownership_ == ownership_ +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + && other.ownership_strength_ == ownership_strength_ +#endif // OMG_DDS_OWNERSHIP_SUPPORT + && other.destination_order_ == destination_order_ + && other.topic_data_ == topic_data_ + && other.group_data_ == group_data_; + } + +public: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey participant_key_; + std::string topic_name_; + std::string type_name_; + ::dds::core::policy::Durability durability_; + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + ::dds::core::policy::DurabilityService durability_service_; +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + ::dds::core::policy::Deadline deadline_; + ::dds::core::policy::LatencyBudget latency_budget_; + ::dds::core::policy::Liveliness liveliness_; + ::dds::core::policy::Reliability reliability_; + ::dds::core::policy::Lifespan lifespan_; + ::dds::core::policy::UserData user_data_; + ::dds::core::policy::Ownership ownership_; + +#ifdef OMG_DDS_OWNERSHIP_SUPPORT + ::dds::core::policy::OwnershipStrength ownership_strength_; +#endif // OMG_DDS_OWNERSHIP_SUPPORT + + ::dds::core::policy::DestinationOrder destination_order_; + ::dds::core::policy::Presentation presentation_; + ::dds::core::policy::Partition partition_; + ::dds::core::policy::TopicData topic_data_; + ::dds::core::policy::GroupData group_data_; +}; + +//============================================================================== +// SubscriptionBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::SubscriptionBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const dds::topic::BuiltinTopicKey& participant_key() const + { + return participant_key_; + } + + void participant_key(const int32_t* key) + { + participant_key_.delegate().value(const_cast(key)); + } + + const std::string& topic_name() const + { + return topic_name_; + } + + void topic_name(const char *name) + { + topic_name_ = name; + } + + const std::string& type_name() const + { + return type_name_; + } + + void type_name(const char *name) + { + type_name_ = name; + } + + const ::dds::core::policy::Durability& durability() const + { + return durability_; + } + + void durability(const dds_qos_t* policy) + { + durability_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Deadline& deadline() const + { + return deadline_; + } + + void deadline(const dds_qos_t* policy) + { + deadline_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::LatencyBudget& latency_budget() const + { + return latency_budget_; + } + + void latency_budget(const dds_qos_t* policy) + { + latency_budget_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Liveliness& liveliness() const + { + return liveliness_; + } + + void liveliness(const dds_qos_t* policy) + { + liveliness_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Reliability& reliability() const + { + return reliability_; + } + + void reliability(const dds_qos_t* policy) + { + reliability_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::DestinationOrder& destination_order() const + { + return destination_order_; + } + + void destination_order(const dds_qos_t* policy) + { + destination_order_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::TimeBasedFilter& time_based_filter() const + { + return time_based_filter_; + } + + void time_based_filter(const dds_qos_t* policy) + { + time_based_filter_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Ownership& ownership() const + { + return ownership_; + } + + void ownership(const dds_qos_t* policy) + { + ownership_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::TopicData& topic_data() const + { + return topic_data_; + } + + void topic_data(const dds_qos_t* policy) + { + topic_data_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Partition& partition() const + { + return partition_; + } + + void partition(const dds_qos_t* policy) + { + partition_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Presentation& presentation() const + { + return presentation_; + } + + void presentation(const dds_qos_t* policy) + { + presentation_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::UserData& user_data() const + { + return user_data_; + } + + void user_data(const dds_qos_t* policy) + { + user_data_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::GroupData& group_data() const + { + return group_data_; + } + + void group_data(const dds_qos_t* policy) + { + group_data_.delegate().set_iso_policy(policy); + } + + bool operator ==(const SubscriptionBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.participant_key_ == participant_key_ + && other.topic_name_ == topic_name_ + && other.type_name_ == type_name_ + && other.durability_ == durability_ + && other.deadline_ == deadline_ + && other.latency_budget_ == latency_budget_ + && other.liveliness_ == liveliness_ + && other.reliability_ == reliability_ + && other.ownership_ == ownership_ + && other.destination_order_ == destination_order_ + && other.user_data_ == user_data_ + && other.time_based_filter_ == time_based_filter_ + && other.presentation_ == presentation_ + && other.partition_ == partition_ + && other.topic_data_ == topic_data_ + && other.group_data_ == group_data_; + } + +public: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey participant_key_; + std::string topic_name_; + std::string type_name_; + ::dds::core::policy::Durability durability_; + ::dds::core::policy::Deadline deadline_; + ::dds::core::policy::LatencyBudget latency_budget_; + ::dds::core::policy::Liveliness liveliness_; + ::dds::core::policy::Reliability reliability_; + ::dds::core::policy::Ownership ownership_; + ::dds::core::policy::DestinationOrder destination_order_; + ::dds::core::policy::UserData user_data_; + ::dds::core::policy::TimeBasedFilter time_based_filter_; + ::dds::core::policy::Presentation presentation_; + ::dds::core::policy::Partition partition_; + ::dds::core::policy::TopicData topic_data_; + ::dds::core::policy::GroupData group_data_; +}; + +//============================================================================== +// CMParticipantBuiltinTopicData +//============================================================================== + +class org::eclipse::cyclonedds::topic::CMParticipantBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + bool operator ==(const CMParticipantBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_; + } + +protected: + dds::topic::BuiltinTopicKey key_; +}; + +//============================================================================== +// CMPublisherBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::CMPublisherBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const dds::topic::BuiltinTopicKey& participant_key() const + { + return participant_key_; + } + + void participant_key(const int32_t* key) + { + participant_key_.delegate().value(const_cast(key)); + } + + const std::string& name() const + { + return name_; + } + + void name(const char *name) + { + name_ = name; + } + + const ::dds::core::policy::EntityFactory& entity_factory() const + { + return entity_factory_; + } + + void entity_factory(const dds_qos_t* policy) + { + entity_factory_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Partition& partition() const + { + return partition_; + } + + void partition(const dds_qos_t* policy) + { + partition_.delegate().set_iso_policy(policy); + } + + bool operator ==(const CMPublisherBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.participant_key_ == participant_key_ + && other.name_ == name_ + && other.entity_factory_ == entity_factory_ + && other.partition_ == partition_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey participant_key_; + std::string name_; + ::dds::core::policy::EntityFactory entity_factory_; + ::dds::core::policy::Partition partition_; +}; + +//============================================================================== +// CMSubscriberBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::CMSubscriberBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const dds::topic::BuiltinTopicKey& participant_key() const + { + return participant_key_; + } + + void participant_key(const int32_t* key) + { + participant_key_.delegate().value(const_cast(key)); + } + + const std::string& name() const + { + return name_; + } + + void name(const char *name) + { + name_ = name; + } + + const ::dds::core::policy::EntityFactory& entity_factory() const + { + return entity_factory_; + } + + void entity_factory(const dds_qos_t* policy) + { + entity_factory_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::Partition& partition() const + { + return partition_; + } + + void partition(const dds_qos_t* policy) + { + partition_.delegate().set_iso_policy(policy); + } + + bool operator ==(const CMSubscriberBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.participant_key_ == participant_key_ + && other.name_ == name_ + && other.entity_factory_ == entity_factory_ + && other.partition_ == partition_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey participant_key_; + std::string name_; + ::dds::core::policy::EntityFactory entity_factory_; + ::dds::core::policy::Partition partition_; +}; + +//============================================================================== +// CMDataWriterBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::CMDataWriterBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const dds_qos_t* key) + { + key_.delegate().value(const_cast(reinterpret_cast(key))); + } + + const dds::topic::BuiltinTopicKey& publisher_key() const + { + return publisher_key_; + } + + void publisher_key(const dds_qos_t* key) + { + publisher_key_.delegate().value(const_cast(reinterpret_cast(key))); + } + + const std::string& name() const + { + return name_; + } + + void name(const char *name) + { + name_ = name; + } + + const ::dds::core::policy::History& history() const + { + return history_; + } + + void history(const dds_qos_t* policy) + { + history_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::ResourceLimits& resource_limits() const + { + return resource_limits_; + } + + void resource_limits(const dds_qos_t* policy) + { + resource_limits_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::WriterDataLifecycle& writer_data_lifecycle() const + { + return writer_data_lifecycle_; + } + + void writer_data_lifecycle(const dds_qos_t* policy) + { + writer_data_lifecycle_.delegate().set_iso_policy(policy); + } + + bool operator ==(const CMDataWriterBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.publisher_key_ == publisher_key_ + && other.name_ == name_ + && other.history_ == history_ + && other.resource_limits_ == resource_limits_ + && other.writer_data_lifecycle_ == writer_data_lifecycle_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey publisher_key_; + std::string name_; + ::dds::core::policy::History history_; + ::dds::core::policy::ResourceLimits resource_limits_; + ::dds::core::policy::WriterDataLifecycle writer_data_lifecycle_; +}; + +//============================================================================== +// CMDataReaderBuiltinTopicDataDelegate +//============================================================================== + +class org::eclipse::cyclonedds::topic::CMDataReaderBuiltinTopicDataDelegate +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return key_; + } + + void key(const int32_t* key) + { + key_.delegate().value(const_cast(key)); + } + + const dds::topic::BuiltinTopicKey& subscriber_key() const + { + return subscriber_key_; + } + + void subscriber_key(const int32_t* key) + { + subscriber_key_.delegate().value(const_cast(key)); + } + + const std::string& name() const + { + return name_; + } + + void name(const char *name) + { + name_ = name; + } + + const ::dds::core::policy::History& history() const + { + return history_; + } + + void history(const dds_qos_t* policy) + { + history_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::ResourceLimits& resource_limits() const + { + return resource_limits_; + } + + void resource_limits(const dds_qos_t* policy) + { + resource_limits_.delegate().set_iso_policy(policy); + } + + const ::dds::core::policy::ReaderDataLifecycle& reader_data_lifecycle() const + { + return reader_data_lifecycle_; + } + + void reader_data_lifecycle(const dds_qos_t* policy) + { + reader_data_lifecycle_.delegate().set_iso_policy(policy); + } + + bool operator ==(const CMDataReaderBuiltinTopicDataDelegate& other) const + { + return other.key_ == key_ + && other.subscriber_key_ == subscriber_key_ + && other.name_ == name_ + && other.history_ == history_ + && other.resource_limits_ == resource_limits_ + && other.reader_data_lifecycle_ == reader_data_lifecycle_; + } + +protected: + dds::topic::BuiltinTopicKey key_; + dds::topic::BuiltinTopicKey subscriber_key_; + std::string name_; + ::dds::core::policy::History history_; + ::dds::core::policy::ResourceLimits resource_limits_; + ::dds::core::policy::ReaderDataLifecycle reader_data_lifecycle_; +}; + +#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_DELEGATE_HPP */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicKeyDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicKeyDelegate.hpp new file mode 100644 index 0000000..67f234d --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicKeyDelegate.hpp @@ -0,0 +1,71 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_BUILTIN_TOPIC_KEY_DELEGATE_HPP_ +#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_KEY_DELEGATE_HPP_ + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +class BuiltinTopicKeyDelegate +{ +public: + typedef uint32_t VALUE_T; +public: + BuiltinTopicKeyDelegate() { } + BuiltinTopicKeyDelegate(int32_t v[]) + { + key_[0] = v[0]; + key_[1] = v[1]; + key_[2] = v[2]; + } +public: + const int32_t* value() const + { + return key_; + } + + void value(int32_t v[]) + { + key_[0] = v[0]; + key_[1] = v[1]; + key_[2] = v[2]; + } + + bool operator ==(const BuiltinTopicKeyDelegate& other) const + { + return other.key_[0] == key_[0] + && other.key_[1] == key_[1] + && other.key_[2] == key_[2]; + } + +private: + int32_t key_[3]; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_KEY_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicTraits.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicTraits.hpp new file mode 100644 index 0000000..e6b42ad --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/BuiltinTopicTraits.hpp @@ -0,0 +1,21 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_TOPIC_BUILTIN_TOPIC_TRAITS_HPP +#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_TRAITS_HPP + +#include +#include +#include + +/* TODO: add builtin topic traits. */ + +#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_TRAITS_HPP */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/CDRBlob.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/CDRBlob.hpp new file mode 100644 index 0000000..4c7ada6 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/CDRBlob.hpp @@ -0,0 +1,68 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_TOPIC_CDRBLOB_HPP +#define CYCLONEDDS_TOPIC_CDRBLOB_HPP + +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ +enum class BlobKind +{ + Empty, + KeyOnly, + Data, +}; + +class CDRBlob +{ +private: + std::array encoding_ = { }; + BlobKind kind_ = BlobKind::Empty; + std::vector payload_; + +public: + CDRBlob() = default; + + explicit CDRBlob( + const std::array& encoding, + BlobKind kind, + const std::vector& payload) : + encoding_(encoding), + kind_(kind), + payload_(payload) {} + + const std::array& encoding() const { return this->encoding_; } + std::array& encoding() { return this->encoding_; } + void encoding(const std::array& _val_) { this->encoding_ = _val_; } + void encoding(std::array&& _val_) { this->encoding_ = _val_; } + BlobKind kind() const { return this->kind_; } + BlobKind& kind() { return this->kind_; } + void kind(BlobKind _val_) { this->kind_ = _val_; } + const std::vector& payload() const { return this->payload_; } + std::vector& payload() { return this->payload_; } + void payload(const std::vector& _val_) { this->payload_ = _val_; } + void payload(std::vector&& _val_) { this->payload_ = _val_; } +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_CDRBLOB_HPP */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/FilterDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/FilterDelegate.hpp new file mode 100644 index 0000000..1f7f097 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/FilterDelegate.hpp @@ -0,0 +1,106 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_FILTER_HPP_ +#define CYCLONEDDS_DDS_TOPIC_DETAIL_FILTER_HPP_ + +/** + * @file + */ + +// Implementation + +#include +#include +#include + +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +DDSCXX_WARNING_MSVC_OFF(4251) + +class OMG_DDS_API FilterDelegate +{ +public: + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; + +public: + FilterDelegate(); + FilterDelegate(const std::string& query_expression); + + + template + FilterDelegate(const std::string& query_expression, + const FWIterator& params_begin, const FWIterator& params_end) + : myExpression(query_expression) + { + std::copy(params_begin, params_end, std::back_insert_iterator >(myParams)); + } + + const std::string& expression() const; + + /** + * @internal Provides the begin iterator to the parameter list. + */ + const_iterator begin() const; + + /** + * @internal The const end iterator to the parameter list. + */ + const_iterator end() const; + + /** + * @internal Provides the begin const iterator to the parameter list. + */ + iterator begin(); + + /** + * @internal The end iterator to the parameter list. + */ + iterator end(); + + template + void parameters(const FWIterator& begin, const FWIterator end) + { + myParams.erase(myParams.begin(), myParams.end()); + std::copy(begin, end, std::back_insert_iterator >(myParams)); + } + + void add_parameter(const std::string& param); + + uint32_t parameters_length() const; + + bool operator ==(const FilterDelegate& other) const; + +private: + std::string myExpression; + std::vector myParams; +}; + +DDSCXX_WARNING_MSVC_ON(4251) + +// End of implementation +} +} +} +} + +#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_FILTER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TBuiltinTopic.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TBuiltinTopic.hpp new file mode 100644 index 0000000..1067303 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TBuiltinTopic.hpp @@ -0,0 +1,186 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +#ifndef CYCLONEDDS_TOPIC_TBUILTIN_TOPIC_HPP_ +#define CYCLONEDDS_TOPIC_TBUILTIN_TOPIC_HPP_ + + +#include +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ +template +class TCMParticipantBuiltinTopicData; + +template +class TCMPublisherBuiltinTopicData; + +template +class TCMSubscriberBuiltinTopicData; + +template +class TCMDataWriterBuiltinTopicData; + +template +class TCMDataReaderBuiltinTopicData; +} +} +} +} + +/** + * The CMParticipant topic... + */ +template +class org::eclipse::cyclonedds::topic::TCMParticipantBuiltinTopicData : public ::dds::core::Value +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return this->delegate().key(); + } +}; + +/** + * The CMPublisher topic... + */ +template +class org::eclipse::cyclonedds::topic::TCMPublisherBuiltinTopicData : public ::dds::core::Value +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return this->delegate().key(); + } + const dds::topic::BuiltinTopicKey& participant_key() const + { + return this->delegate().participant_key(); + } + const std::string& name() const + { + return this->delegate().name(); + } + const ::dds::core::policy::EntityFactory& entity_factory() const + { + return this->delegate().entity_factory(); + } + const ::dds::core::policy::Partition& partition() const + { + return this->delegate().partition(); + } +}; + +/** + * The CMSubscriber topic... + */ +template +class org::eclipse::cyclonedds::topic::TCMSubscriberBuiltinTopicData : public ::dds::core::Value +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return this->delegate().key(); + } + const dds::topic::BuiltinTopicKey& participant_key() const + { + return this->delegate().participant_key(); + } + const std::string& name() const + { + return this->delegate().name(); + } + const ::dds::core::policy::EntityFactory& entity_factory() const + { + return this->delegate().entity_factory(); + } + const ::dds::core::policy::Partition& partition() const + { + return this->delegate().partition(); + } +}; + +/** + * The CMDataWriter topic... + */ +template +class org::eclipse::cyclonedds::topic::TCMDataWriterBuiltinTopicData : public ::dds::core::Value +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return this->delegate().key(); + } + const dds::topic::BuiltinTopicKey& publisher_key() const + { + return this->delegate().publisher_key(); + } + const std::string& name() const + { + return this->delegate().name(); + } + const ::dds::core::policy::History& history() const + { + return this->delegate().history(); + } + const ::dds::core::policy::ResourceLimits& resource_limits() const + { + return this->delegate().resource_limits(); + } + const ::dds::core::policy::WriterDataLifecycle& writer_data_lifecycle() const + { + return this->delegate().writer_data_lifecycle(); + } +}; + +/** + * The CMDataReader topic... + */ +template +class org::eclipse::cyclonedds::topic::TCMDataReaderBuiltinTopicData : public ::dds::core::Value +{ +public: + const dds::topic::BuiltinTopicKey& key() const + { + return this->delegate().key(); + } + const dds::topic::BuiltinTopicKey& subscriber_key() const + { + return this->delegate().subscriber_key(); + } + const std::string& name() const + { + return this->delegate().name(); + } + const ::dds::core::policy::History& history() const + { + return this->delegate().history(); + } + const ::dds::core::policy::ResourceLimits& resource_limits() const + { + return this->delegate().resource_limits(); + } + const ::dds::core::policy::ReaderDataLifecycle& reader_data_lifecycle() const + { + return this->delegate().reader_data_lifecycle(); + } +}; + +#endif /* CYCLONEDDS_TOPIC_TBUILTIN_TOPIC_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TopicDescriptionDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TopicDescriptionDelegate.hpp new file mode 100644 index 0000000..0a3b642 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TopicDescriptionDelegate.hpp @@ -0,0 +1,88 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_TOPICDESCRIPTIONDELEGATE_HPP_ +#define CYCLONEDDS_TOPIC_TOPICDESCRIPTIONDELEGATE_HPP_ + +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +class OMG_DDS_API TopicDescriptionDelegate : public virtual org::eclipse::cyclonedds::core::DDScObjectDelegate +{ +public: + typedef ::dds::core::smart_ptr_traits< TopicDescriptionDelegate >::ref_type ref_type; + typedef ::dds::core::smart_ptr_traits< TopicDescriptionDelegate >::weak_ref_type weak_ref_type; + +public: + TopicDescriptionDelegate(const dds::domain::DomainParticipant& dp, + const std::string& name, + const std::string& type_name); + virtual ~TopicDescriptionDelegate(); + +public: + + /** + * @internal Get the name used to create the TopicDescription. + */ + const std::string& name() const; + + /** + * @internal The type_name used to create the TopicDescription. + */ + const std::string& type_name() const; + + /** + * @internal This operation returns the DomainParticipant to which the + * TopicDescription belongs. + */ + const dds::domain::DomainParticipant& domain_participant() const; + + void incrNrDependents(); + + void decrNrDependents(); + + bool hasDependents() const; + + virtual std::string reader_expression() const = 0; + + //@todo virtual c_value *reader_parameters() const = 0; + + ddsi_sertype *get_ser_type() const; + +protected: + dds::domain::DomainParticipant myParticipant; + std::string myTopicName; + std::string myTypeName; + uint32_t nrDependents; + ddsi_sertype *ser_type_; +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_TOPICDESCRIPTIONDELEGATE_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TopicListener.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TopicListener.hpp new file mode 100644 index 0000000..bd8a14e --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TopicListener.hpp @@ -0,0 +1,52 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + +#ifndef CYCLONEDDS_TOPIC_TOPIC_LISTENER_HPP_ +#define CYCLONEDDS_TOPIC_TOPIC_LISTENER_HPP_ + + +#include "dds/topic/TopicListener.hpp" + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +template +class TopicListener : public dds::topic::TopicListener +{ +public: + virtual ~TopicListener() { } +}; + +template +class NoOpTopicListener : public virtual TopicListener +{ +public: + virtual ~NoOpTopicListener() { } + +public: + virtual void on_inconsistent_topic( + dds::topic::Topic&, + const dds::core::status::InconsistentTopicStatus&) { } +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_TOPIC_LISTENER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp new file mode 100644 index 0000000..7d4543b --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/TopicTraits.hpp @@ -0,0 +1,290 @@ +/* + * Copyright(c) 2006 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_TOPICTRAITS_HPP_ +#define CYCLONEDDS_TOPIC_TOPICTRAITS_HPP_ + +#include "dds/ddsrt/heap.h" +#include "dds/ddsi/ddsi_serdata.h" +#include "org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp" +#include "dds/features.hpp" + +//forward declaration of c++ sertype wrapper +template class ddscxx_sertype; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ + +namespace core +{ +namespace cdr +{ +//forward declarations of streamer types +class basic_cdr_stream; +class xcdr_v1_stream; +class xcdr_v2_stream; +} +} + +namespace topic +{ + +using core::cdr::extensibility; +using core::cdr::encoding_version; +using core::cdr::allowable_encodings_t; +using core::cdr::basic_cdr_stream; +using core::cdr::xcdr_v1_stream; +using core::cdr::xcdr_v2_stream; + +template class TopicTraits +{ +public: + + /** + * @brief Returns whether TOPIC contains no key fields. + * + * Used in creating the CycloneDDS writer and equality comparisons with other topics. + * This is one of the traits that is conditionally generated if there are any key fields. + * + * @return Whether TOPIC does not contain any fields marked as key fields. + */ + static constexpr bool isKeyless() + { + return false; + } + + /** + * @brief Returns the name of the type of TOPIC. + * + * Used in creating the correct TopicDescription. + * This trait is always generated for user-defined types, and this function is just a placeholder. + * + * @return The name of the type of TOPIC. + */ + static constexpr const char *getTypeName() + { + return ""; + } + + /** + * @brief Returns an instance of ddsi_sertype for TOPIC. + * + * Used by CycloneDDS-CXX to get a sertype, which contains the functions used by CycloneDDS which are specific to TOPIC. + * + * @param[in] kinds The serialization of the of the sertype to create. + * @return A pointer to a new dssi_sertype. + */ + static ddsi_sertype *getSerType(allowable_encodings_t kinds = allowableEncodings()) + { + if (kinds & allowableEncodings() & DDS_DATA_REPRESENTATION_FLAG_XCDR1) + return static_cast(new ddscxx_sertype()); + else if (kinds & allowableEncodings() & DDS_DATA_REPRESENTATION_FLAG_XCDR2) + return static_cast(new ddscxx_sertype()); + else + return nullptr; + } + + /** + * @brief Returns the size of an instance of TOPIC. + * + * Used by shared memory implementation to determine the size of the block necessary to contain an instance of TOPIC. + * + * @return The size of an instance of TOPIC. + */ + static constexpr size_t getSampleSize() + { + return sizeof(TOPIC); + } + + /** + * @brief Returns whether instances of TOPIC reference memory outside its own declaration. + * + * Used by shared memory implementation. + * This trait will be generated as false if any strings or vectors are found anywhere in TOPIC's member tree. + * + * @return Whether TOPIC is a selfcontained type. + */ + static constexpr bool isSelfContained() + { + return true; + } + + /** + * @brief Returns the allowable encodings for this topic. + * + * Used to determine which encoding type to write in combination with the data representation QoS. + * + * @return The allowable encodings of TOPIC. + */ + static constexpr allowable_encodings_t allowableEncodings() + { + return 0xFFFFFFFFu; + } + + /** + * @brief Returns the xtypes extensibility of TOPIC. + * + * Used to determine which encoding type to write in the CDR header. + * This trait will be generated if the extensibility of TOPIC differs from final. + * + * @return The extensibility of TOPIC. + */ + static constexpr extensibility getExtensibility() + { + return extensibility::ext_final; + } + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY + /** + * @brief Returns the typeid for TOPIC. + * + * Is a simple pass-through for the derivation of the typeid from the type information. + * As C++ keeps the topic type as the template parameter, there is no need to look at the + * sertype for this topic. + * + * @param[in] kind The kind of typeid. + * + * @return A pointer to the typeid of this topic. + */ + static ddsi_typeid_t* getTypeId(const struct ddsi_sertype *, ddsi_typeid_kind_t kind) + { + auto ti = getTypeInfo(NULL); + if (ti) { + auto id = ddsi_typeinfo_typeid(ti, kind); + ddsi_typeinfo_fini(ti); + ddsrt_free(ti); + return id; + } else { + return nullptr; + } + } + + /** + * @brief Returns the type map for TOPIC. + * + * Takes the type map blob for this topic which is part of the generated type traits, and deserializes + * the type map from this blob. + * + * @return A pointer to the typemap for this topic. + */ + static ddsi_typemap_t* getTypeMap(const struct ddsi_sertype *) + { + ddsi_sertype_cdr_data_t cdr{type_map_blob_sz(), const_cast(type_map_blob())}; + return ddsi_typemap_deser(&cdr); + } + + /** + * @brief Returns the type info for TOPIC. + * + * Takes the type info blob for this topic which is part of the generated type traits, and deserializes + * the type info from this blob. + * + * @return A pointer to the typeinfo for this topic. + */ + static ddsi_typeinfo_t* getTypeInfo(const struct ddsi_sertype *) + { + ddsi_sertype_cdr_data_t cdr{type_info_blob_sz(), const_cast(type_info_blob())}; + return ddsi_typeinfo_deser(&cdr); + } + + /** + * @brief Returns size of the blob of the cdr serialized type map. + * + * This function is a placeholder, it will be instantiated for all valid topics. + * + * @return The size of the serialized type map blob. + */ + static constexpr unsigned int type_map_blob_sz() + { + return static_cast(-1); + } + + /** + * @brief Returns size of the blob of the cdr serialized type info. + * + * This function is a placeholder, it will be instantiated for all valid topics. + * + * @return The size of the serialized type info blob. + */ + static constexpr unsigned int type_info_blob_sz() + { + return static_cast(-1); + } + + /** + * @brief Returns pointer to the blob of the cdr serialized type map. + * + * This function is a placeholder, it will be instantiated for all valid topics. + * + * @return Pointer to the serialized type map blob. + */ + static inline const uint8_t * type_map_blob() + { + return nullptr; + } + + /** + * @brief Returns pointer to the blob of the cdr serialized type info. + * + * This function is a placeholder, it will be instantiated for all valid topics. + * + * @return Pointer to the serialized type info blob. + */ + static inline const uint8_t * type_info_blob() + { + return nullptr; + } +#endif //DDSCXX_HAS_TYPE_DISCOVERY + + /** + * @brief Returns a pointer to the derived sertype. + * + * Returns a nullptr if no type can be derived succesfully. + * + * @param[in] data_representation The type of data representation to use. + * + * @return The pointer to the derived sertype. + */ + static struct ddsi_sertype* deriveSertype(const struct ddsi_sertype *, dds_data_representation_id_t data_representation, dds_type_consistency_enforcement_qospolicy_t) + { + struct ddsi_sertype *ptr = nullptr; + switch (data_representation) { + case DDS_DATA_REPRESENTATION_XCDR1: + ptr = getSerType(DDS_DATA_REPRESENTATION_FLAG_XCDR1); + break; + case DDS_DATA_REPRESENTATION_XCDR2: + ptr = getSerType(DDS_DATA_REPRESENTATION_FLAG_XCDR2); + break; + } + if (ptr) { + uint32_t refc = ddsrt_atomic_ld32 (&ptr->flags_refc); + ddsrt_atomic_st32 (&ptr->flags_refc, refc & ~DDSI_SERTYPE_REFC_MASK); + } + return ptr; + } +}; + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_TOPICTRAITS_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp new file mode 100644 index 0000000..5aab9f5 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/datatopic.hpp @@ -0,0 +1,1021 @@ +/* + * Copyright(c) 2020 to 2022 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ +#ifndef DDSCXXDATATOPIC_HPP_ +#define DDSCXXDATATOPIC_HPP_ + +#include +#include +#include +#include +#include + +#include "dds/ddsrt/md5.h" +#include "org/eclipse/cyclonedds/core/cdr/basic_cdr_ser.hpp" +#include "org/eclipse/cyclonedds/core/cdr/extended_cdr_v1_ser.hpp" +#include "org/eclipse/cyclonedds/core/cdr/extended_cdr_v2_ser.hpp" +#include "org/eclipse/cyclonedds/core/cdr/fragchain.hpp" +#include "org/eclipse/cyclonedds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/hash.hpp" + +#ifdef DDSCXX_HAS_SHM +#include "dds/ddsi/ddsi_shm_transport.h" +#endif + +constexpr size_t CDR_HEADER_SIZE = 4U; +#define BO_LITTLE 0X01 +#define PLAIN_CDR 0x00 +#define PL_CDR 0x02 +#define PLAIN_CDR2 0x06 +#define D_CDR 0x08 +#define PL_CDR2 0x0A + +// macro to check if a pointer is nullptr and return false +#define CHECK_FOR_NULL(val) if ((val) == nullptr) return false; + +using org::eclipse::cyclonedds::core::cdr::endianness; +using org::eclipse::cyclonedds::core::cdr::native_endianness; +using org::eclipse::cyclonedds::core::cdr::cdr_stream; +using org::eclipse::cyclonedds::core::cdr::basic_cdr_stream; +using org::eclipse::cyclonedds::core::cdr::xcdr_v1_stream; +using org::eclipse::cyclonedds::core::cdr::xcdr_v2_stream; +using org::eclipse::cyclonedds::core::cdr::extensibility; +using org::eclipse::cyclonedds::core::cdr::encoding_version; +using org::eclipse::cyclonedds::topic::TopicTraits; + +template +bool get_serialized_size(const T& sample, bool as_key, size_t &sz); + +template +bool to_key(const T& tokey, ddsi_keyhash_t& hash) +{ + if (TopicTraits::isKeyless()) + { + memset(&(hash.value), 0x0, sizeof(hash.value)); //just set all key bytes to 0 as all instances have the same hash value, and hashing is pointless + return true; + } else + { + basic_cdr_stream str(endianness::big_endian); + size_t sz = 0; + if (!get_serialized_size(tokey, true, sz)) { + assert(false); + return false; + } + size_t padding = 0; + if (sz < 16) + padding = (16 - sz % 16)%16; + std::vector buffer(sz + padding); + if (padding) + memset(buffer.data() + sz, 0x0, padding); + str.set_buffer(buffer.data(), sz); + if (!write(str, tokey, true)) { + assert(false); + return false; + } + static thread_local bool (*fptr)(const std::vector&, ddsi_keyhash_t&) = NULL; + if (fptr == NULL) + { + max(str, tokey, true); + if (str.position() <= 16) + { + //bind to unmodified function which just copies buffer into the keyhash + fptr = &org::eclipse::cyclonedds::topic::simple_key; + } + else + { + //bind to MD5 hash function + fptr = &org::eclipse::cyclonedds::topic::complex_key; + } + } + return (*fptr)(buffer, hash); + } +} + +static inline void* calc_offset(void* ptr, ptrdiff_t n) +{ + return static_cast(static_cast(ptr) + n); +} + +static inline const void* calc_offset(const void* ptr, ptrdiff_t n) +{ + return static_cast(static_cast(ptr) + n); +} + +template::value, bool> = true > +bool write_header(void *buffer) +{ + CHECK_FOR_NULL(buffer); + memset(buffer, 0x0, 4); + + auto ptr = static_cast(calc_offset(buffer, 1)); + + assert(TopicTraits::getExtensibility() == extensibility::ext_final); + *ptr = PLAIN_CDR; + + if (native_endianness() == endianness::little_endian) + *ptr |= BO_LITTLE; + + return true; +} + +template::value, bool> = true > +bool write_header(void *buffer) +{ + CHECK_FOR_NULL(buffer); + memset(buffer, 0x0, 4); + + auto ptr = static_cast(calc_offset(buffer, 1)); + + switch (TopicTraits::getExtensibility()) { + case extensibility::ext_final: + *ptr = PLAIN_CDR2; + break; + case extensibility::ext_appendable: + *ptr = D_CDR; + break; + case extensibility::ext_mutable: + *ptr = PL_CDR2; + break; + } + + if (native_endianness() == endianness::little_endian) + *ptr |= BO_LITTLE; + + return true; +} + +template::value, bool> = true > +bool write_header(void *buffer) +{ + CHECK_FOR_NULL(buffer); + memset(buffer, 0x0, 4); + + auto ptr = static_cast(calc_offset(buffer, 1)); + + switch (TopicTraits::getExtensibility()) { + case extensibility::ext_final: + case extensibility::ext_appendable: + *ptr = PLAIN_CDR; + break; + case extensibility::ext_mutable: + *ptr = PL_CDR; + break; + } + + if (native_endianness() == endianness::little_endian) + *ptr |= BO_LITTLE; + + return true; +} + +template +bool finish_header(void *buffer, size_t bytes_written) +{ + CHECK_FOR_NULL(buffer); + auto alignbytes = static_cast(4 % (4 - bytes_written % 4)); + auto ptr = static_cast(calc_offset(buffer, 3)); + + *ptr = alignbytes; + + return true; +} + +template +bool read_header(const void *buffer, encoding_version &ver, endianness &end) +{ + CHECK_FOR_NULL(buffer); + auto ptr = static_cast(calc_offset(buffer, 1)); + + if (*ptr & BO_LITTLE) + end = endianness::little_endian; + else + end = endianness::big_endian; + + auto field = *ptr & ~BO_LITTLE; + switch (TopicTraits::getExtensibility()) { + case extensibility::ext_final: + switch (field) { + case PLAIN_CDR: + if (TopicTraits::allowableEncodings() & DDS_DATA_REPRESENTATION_FLAG_XCDR1) + ver = encoding_version::basic_cdr; + else + ver = encoding_version::xcdr_v1; + break; + case PLAIN_CDR2: + ver = encoding_version::xcdr_v2; + break; + default: + return false; + } + break; + case extensibility::ext_appendable: + switch (field) { + case PL_CDR: + ver = encoding_version::xcdr_v1; + break; + case D_CDR: + ver = encoding_version::xcdr_v2; + break; + default: + return false; + } + break; + case extensibility::ext_mutable: + switch (field) { + case PL_CDR: + ver = encoding_version::xcdr_v1; + break; + case PL_CDR2: + ver = encoding_version::xcdr_v2; + break; + default: + return false; + } + break; + default: + return false; + } + + return true; +} + +template +bool get_serialized_fixed_size(const T& sample, size_t &sz) +{ + static thread_local size_t serialized_size = 0; + static thread_local std::mutex mtx; + static thread_local std::atomic_bool initialized {false}; + if (initialized.load(std::memory_order_relaxed)) { + sz = serialized_size; + return true; + } + std::lock_guard lock(mtx); + if (initialized.load(std::memory_order_relaxed)) { + sz = serialized_size; + return true; + } + S str; + if (!move(str, sample, K)) + return false; + serialized_size = str.position(); + initialized.store(true, std::memory_order_release); + sz = serialized_size; + return true; +} + +template +bool get_serialized_size(const T& sample, bool as_key, size_t &sz) +{ + if (TopicTraits::isSelfContained()) { + if ((as_key && !get_serialized_fixed_size(sample, sz)) || + (!as_key && !get_serialized_fixed_size(sample, sz))) + return false; + } else { + S str; + if (!move(str, sample, as_key)) + return false; + sz = str.position(); + } + + return true; +} + +template +bool serialize_into(void *buffer, + size_t buf_sz, + const T &sample, + bool as_key) +{ + CHECK_FOR_NULL(buffer); + assert(buf_sz >= CDR_HEADER_SIZE); + + S str; + str.set_buffer(calc_offset(buffer, CDR_HEADER_SIZE), buf_sz-CDR_HEADER_SIZE); + return (write_header(buffer) + && write(str, sample, as_key) + && finish_header(buffer, buf_sz)); +} + +/// \brief De-serialize the buffer into the sample +/// \param[in] buffer The buffer to be de-serialized +/// \param[out] sample Type to which the buffer will be de-serialized +/// \param[in] data_kind The data kind (data, or key) +/// \tparam T The sample type +/// \return True if the deserialization is successful +/// False if the deserialization failed +template +bool deserialize_sample_from_buffer(void *buffer, + size_t buf_sz, + T &sample, + const ddsi_serdata_kind data_kind=SDK_DATA) +{ + CHECK_FOR_NULL(buffer); + assert(data_kind != SDK_EMPTY); + + encoding_version ver; + endianness end; + if (!read_header(buffer, ver, end)) + return false; + + switch (ver) { + case encoding_version::basic_cdr: + { + basic_cdr_stream str(end); + str.set_buffer(calc_offset(buffer, CDR_HEADER_SIZE), buf_sz-CDR_HEADER_SIZE); + return read(str, sample, data_kind == SDK_KEY); + } + break; + case encoding_version::xcdr_v1: + { + xcdr_v1_stream str(end); + str.set_buffer(calc_offset(buffer, CDR_HEADER_SIZE), buf_sz-CDR_HEADER_SIZE); + return read(str, sample, data_kind == SDK_KEY); + } + break; + case encoding_version::xcdr_v2: + { + xcdr_v2_stream str(end); + str.set_buffer(calc_offset(buffer, CDR_HEADER_SIZE), buf_sz-CDR_HEADER_SIZE); + return read(str, sample, data_kind == SDK_KEY); + } + break; + default: + return false; + } +} + +template class ddscxx_serdata; + +template +bool serdata_eqkey(const ddsi_serdata* a, const ddsi_serdata* b) +{ + auto s_a = static_cast*>(a); + auto s_b = static_cast*>(b); + + return 0 == memcmp(s_a->key().value, s_b->key().value, 16); +} + +template +uint32_t serdata_size(const ddsi_serdata* dcmn) +{ + return static_cast(static_cast*>(dcmn)->size()); +} + +template +ddsi_serdata *serdata_from_ser( + const ddsi_sertype* type, + enum ddsi_serdata_kind kind, + const struct nn_rdata* fragchain, + size_t size) +{ + auto d = new ddscxx_serdata(type, kind); + d->resize(size); + auto cursor = static_cast(d->data()); + org::eclipse::cyclone::core::cdr::serdata_from_ser_copyin_fragchain (cursor, fragchain, size); + + if (d->getT()) + { + d->key_md5_hashed() = to_key(*d->getT(), d->key()); + d->populate_hash(); + } + else + { + delete d; + d = nullptr; + } + + return d; +} + +template +ddsi_serdata *serdata_from_ser_iov( + const ddsi_sertype* type, + enum ddsi_serdata_kind kind, + ddsrt_msg_iovlen_t niov, + const ddsrt_iovec_t* iov, + size_t size) +{ + auto d = new ddscxx_serdata(type, kind); + d->resize(size); + + size_t off = 0; + auto cursor = static_cast(d->data()); + for (ddsrt_msg_iovlen_t i = 0; i < niov && off < size; i++) + { + size_t n_bytes = iov[i].iov_len; + if (n_bytes + off > size) n_bytes = size - off; + memcpy(cursor, iov[i].iov_base, n_bytes); + cursor += n_bytes; + off += n_bytes; + } + + T* ptr = d->getT(); + if (ptr) { + d->key_md5_hashed() = to_key(*ptr, d->key()); + d->populate_hash(); + } else { + delete d; + d = nullptr; + } + + return d; + +} + +template +ddsi_serdata *serdata_from_keyhash( + const ddsi_sertype* type, + const struct ddsi_keyhash* keyhash) +{ + (void)keyhash; + (void)type; + //replace with (if key_size_max <= 16) then populate the data class with the key hash + return nullptr; +} + +template +ddsi_serdata *serdata_from_sample( + const ddsi_sertype* typecmn, + enum ddsi_serdata_kind kind, + const void* sample) +{ + assert(kind != SDK_EMPTY); + auto d = new ddscxx_serdata(typecmn, kind); + const auto& msg = *static_cast(sample); + size_t sz = 0; + + if (!get_serialized_size(msg, kind == SDK_KEY, sz)) + goto failure; + + sz += CDR_HEADER_SIZE; + d->resize(sz); + + if (!serialize_into(d->data(), sz, msg, kind == SDK_KEY)) + goto failure; + + d->key_md5_hashed() = to_key(msg, d->key()); + d->setT(&msg); + d->populate_hash(); + return d; + +failure: + if (d) + delete d; + return nullptr; +} + +template +void serdata_to_ser(const ddsi_serdata* dcmn, size_t off, size_t sz, void* buf) +{ + auto d = static_cast*>(dcmn); + memcpy(buf, calc_offset(d->data(), static_cast(off)), sz); +} + +template +ddsi_serdata *serdata_to_ser_ref( + const ddsi_serdata* dcmn, size_t off, + size_t sz, ddsrt_iovec_t* ref) +{ + auto d = static_cast*>(dcmn); + ref->iov_base = calc_offset(d->data(), static_cast(off)); + ref->iov_len = static_cast(sz); + return ddsi_serdata_ref(d); +} + +template +void serdata_to_ser_unref(ddsi_serdata* dcmn, const ddsrt_iovec_t* ref) +{ + static_cast(ref); // unused + ddsi_serdata_unref(static_cast*>(dcmn)); +} + +template +bool serdata_to_sample( + const ddsi_serdata* dcmn, void* sample, void** bufptr, + void* buflim) +{ + (void)bufptr; + (void)buflim; + + auto typed_sample_ptr = static_cast(sample); + // cast away const, with the reasoning that we don't modify the underlying ddsi_serdata which + // is actually const, we only modify the ddscxx_serdata non const contents + auto d = const_cast*>(static_cast*>(dcmn)); + + auto t_ptr = d->getT(); + if (!t_ptr) + return false; + + *typed_sample_ptr = *t_ptr; + return true; +} + +template +ddsi_serdata *serdata_to_untyped(const ddsi_serdata* dcmn) +{ + /* Cast away const: the serialized ddsi_serdata itself is not touched: only its C++ representation + * in the C++ wrapper may initialized if this was not done before. So conceptually the const for + * ddsi_serdata is not violated. + */ + auto d = const_cast*>(static_cast*>(dcmn)); + auto d1 = new ddscxx_serdata(d->type, SDK_KEY); + d1->type = nullptr; + + auto t = d->getT(); + size_t sz = 0; + if (t == nullptr || !get_serialized_size(*t, true, sz)) + goto failure; + + sz += CDR_HEADER_SIZE; + d1->resize(sz); + + if (!serialize_into(d1->data(), sz, *t, true)) + goto failure; + + d1->key_md5_hashed() = to_key(*t, d1->key()); + d1->hash = d->hash; + + return d1; + +failure: + delete d1; + return nullptr; +} + +template +bool serdata_untyped_to_sample( + const ddsi_sertype* type, + const ddsi_serdata* dcmn, void* sample, + void** bufptr, void* buflim) +{ + (void)type; + (void)bufptr; + (void)buflim; + + auto d = static_cast*>(dcmn); + T* ptr = static_cast(sample); + + return deserialize_sample_from_buffer(d->data(), d->size(), *ptr, SDK_KEY); +} + +template +void serdata_free(ddsi_serdata* dcmn) +{ + auto* d = static_cast*>(dcmn); + +#ifdef DDSCXX_HAS_SHM + if (d->iox_chunk && d->iox_subscriber) + { + // Explicit cast to iox_subscriber is required here, since the C++ binding has no notion of + // iox subscriber, but the underlying C API expects this to be a typed iox_subscriber. + // TODO (Sumanth), Fix this when we cleanup the interfaces to not use iceoryx directly in + // the C++ plugin + free_iox_chunk(static_cast(d->iox_subscriber), &d->iox_chunk); + } +#endif + delete d; +} + +template +size_t serdata_print( + const ddsi_sertype* tpcmn, const ddsi_serdata* dcmn, char* buf, size_t bufsize) +{ + (void)tpcmn; + (void)dcmn; + //implementation to follow!!! + if (bufsize > 0) + buf[0] = 0x0; + return 0; +} + +template +void serdata_get_keyhash( + const ddsi_serdata* d, struct ddsi_keyhash* buf, + bool force_md5) +{ + auto ptr = static_cast*>(d); + assert(buf); + if (force_md5 && !ptr->key_md5_hashed()) + { + ddsrt_md5_state_t md5st; + ddsrt_md5_init(&md5st); + ddsrt_md5_append(&md5st, static_cast(ptr->key().value), 16); + ddsrt_md5_finish(&md5st, static_cast(buf->value)); + } + else + { + memcpy(buf->value, ptr->key().value, 16); + } +} + +#ifdef DDSCXX_HAS_SHM +template +uint32_t serdata_iox_size(const struct ddsi_serdata* d) +{ + assert(sizeof(T) == d->type->iox_size); + return d->type->iox_size; +} + +template +ddsi_serdata * serdata_from_iox_buffer( + const struct ddsi_sertype * typecmn, enum ddsi_serdata_kind kind, + void * sub, void * iox_buffer) +{ + try { + auto d = new ddscxx_serdata(typecmn, kind); + + // serdata from the loaned sample (when using iceoryx) + d->iox_chunk = iox_buffer; + + // Update the iox subscriber, when constructing the serdata in the case of sample received + // from iceoryx + if (sub != nullptr) { + d->iox_subscriber = sub; + } + + // key handling + const auto& msg = *static_cast(d->iox_chunk); + d->key_md5_hashed() = to_key(msg, d->key()); + d->populate_hash(); + + return d; + } + catch (std::exception&) { + return nullptr; + } +} +#endif + +template +struct ddscxx_serdata_ops: public ddsi_serdata_ops { + ddscxx_serdata_ops(): ddsi_serdata_ops { + &serdata_eqkey, + &serdata_size, + &serdata_from_ser, + &serdata_from_ser_iov, + &serdata_from_keyhash, + &serdata_from_sample, + &serdata_to_ser, + &serdata_to_ser_ref, + &serdata_to_ser_unref, + &serdata_to_sample, + &serdata_to_untyped, + &serdata_untyped_to_sample, + &serdata_free, + &serdata_print, + &serdata_get_keyhash +#ifdef DDSCXX_HAS_SHM + , &serdata_iox_size + , &serdata_from_iox_buffer +#endif + } { ; } +}; + +template +class ddscxx_serdata : public ddsi_serdata { + size_t m_size{ 0 }; + std::unique_ptr m_data{ nullptr }; + ddsi_keyhash_t m_key; + bool m_key_md5_hashed = false; + std::atomic m_t{ nullptr }; + +public: + bool hash_populated = false; + ddscxx_serdata(const ddsi_sertype* type, ddsi_serdata_kind kind); + ~ddscxx_serdata() { delete m_t.load(std::memory_order_acquire); } + + void resize(size_t requested_size); + size_t size() const { return m_size; } + void* data() const { return m_data.get(); } + ddsi_keyhash_t& key() { return m_key; } + const ddsi_keyhash_t& key() const { return m_key; } + bool& key_md5_hashed() { return m_key_md5_hashed; } + const bool& key_md5_hashed() const { return m_key_md5_hashed; } + void populate_hash(); + T* setT(const T* toset); + T* getT(); + +private: + void deserialize_and_update_sample(uint8_t * buffer, size_t sz, T *& t); + void update_sample_from_iox_chunk(T *& t); +}; + +template +ddscxx_serdata::ddscxx_serdata(const ddsi_sertype* type, ddsi_serdata_kind kind) + : ddsi_serdata{} +{ + memset(m_key.value, 0x0, 16); + ddsi_serdata_init(this, type, kind); +} + +template +void ddscxx_serdata::resize(size_t requested_size) +{ + if (!requested_size) { + m_size = 0; + m_data.reset(); + return; + } + + /* FIXME: CDR padding in DDSI makes me do this to avoid reading beyond the bounds + when copying data to network. Should fix Cyclone to handle that more elegantly. */ + size_t n_pad_bytes = (0 - requested_size) % 4; + m_data.reset(new unsigned char[requested_size + n_pad_bytes]); + m_size = requested_size + n_pad_bytes; + + // zero the very end. The caller isn't necessarily going to overwrite it. + std::memset(calc_offset(m_data.get(), static_cast(requested_size)), '\0', n_pad_bytes); +} + +template +void ddscxx_serdata::populate_hash() +{ + if (hash_populated) + return; + + key_md5_hashed() = to_key(*getT(), key()); + if (!key_md5_hashed()) + { + ddsi_keyhash_t buf; + ddsrt_md5_state_t md5st; + ddsrt_md5_init(&md5st); + ddsrt_md5_append(&md5st, static_cast(key().value), 16); + ddsrt_md5_finish(&md5st, static_cast(buf.value)); + memcpy(&(hash), buf.value, 4); + } + else + { + memcpy(&(hash), key().value, 4); + } + + hash ^= type->serdata_basehash; + hash_populated = true; +} + +template +T* ddscxx_serdata::setT(const T* toset) +{ + assert(toset); + T* t = m_t.load(std::memory_order_acquire); + if (t == nullptr) { + t = new T(*toset); + T* exp = nullptr; + if (!m_t.compare_exchange_strong(exp, t, std::memory_order_seq_cst)) { + delete t; + t = exp; + } + } else { + *t = *toset; + } + return t; +} + +template +T* ddscxx_serdata::getT() { + // check if m_t is already set + T *t = m_t.load(std::memory_order_acquire); + // if m_t is not set + if (t == nullptr) { + // if the data is available on iox_chunk, update and get the sample + update_sample_from_iox_chunk(t); + // if its not possible to get the sample from iox_chunk + if(t == nullptr) { + // deserialize and get the sample + deserialize_and_update_sample(static_cast(data()), size(), t); + } + } + return t; +} + +template +void ddscxx_serdata::deserialize_and_update_sample(uint8_t * buffer, size_t sz, T *& t) { + t = new T(); + // if deserialization failed + if(!deserialize_sample_from_buffer(buffer, sz, *t, kind)) { + delete t; + t = nullptr; + } + + T* exp = nullptr; + if (!m_t.compare_exchange_strong(exp, t, std::memory_order_seq_cst)) { + delete t; + t = exp; + } +} + +template +void ddscxx_serdata::update_sample_from_iox_chunk(T *& t) { +#ifdef DDSCXX_HAS_SHM + // if data is available on the iox_chunk (and doesn't have a serialized representation) + if (iox_chunk != nullptr && data() == nullptr) { + auto iox_header = iceoryx_header_from_chunk(iox_chunk); + // if the iox chunk has the data in serialized form + if (iox_header->shm_data_state == IOX_CHUNK_CONTAINS_SERIALIZED_DATA) { + deserialize_and_update_sample(static_cast(iox_chunk), iox_header->data_size, t); + } else if (iox_header->shm_data_state == IOX_CHUNK_CONTAINS_RAW_DATA) { + // get the chunk directly without any copy + t = static_cast(this->iox_chunk); + } else { + // Data is in un-initialized state, which shouldn't happen + t = nullptr; + } + } else { + // data is not available on iox_chunk + t = nullptr; + } +#else + t = nullptr; +#endif // DDSCXX_HAS_SHM +} + +template +class ddscxx_sertype; + +template +void sertype_free(ddsi_sertype* tpcmn) +{ + auto tp = static_cast*>(tpcmn); + ddsi_sertype_fini(tpcmn); + delete tp; +} + +template +void sertype_zero_samples(const ddsi_sertype*, void*, size_t) +{ + return; +} + +template +void sertype_realloc_samples( + void** ptrs, const ddsi_sertype*, void*, size_t, size_t) +{ + /* For C++ we make one big assumption about the caller of this function: + * it can only be invoked by the ddsi_sertype_alloc_sample, and will therefore + * never be used to reallocate an existing sample collection. This is caused by + * the fact that the C++ API lets either the user specify the exact dimensions + * of his preallocated collection (in which case there is no need to realloc them), + * or if the user didn't preallocate any memory it peeks at the available + * samples prior to allocating the sample collection that is returned (so that + * again there is no need to reallocate it). + * Because of this, we can safely assume that sertype_realloc_samples can only + * be invoked by ddsi_sertype_alloc_sample, in which case oldCount is always 0, + * count is always 1 and the old pointer is always null. + */ + ptrs[0] = new T(); +} + +template +void sertype_free_samples( + const ddsi_sertype*, void** ptrs, size_t, dds_free_op_t op) +{ + /* For C++ we make one big assumption about the caller of this function: + * it can only be invoked by the ddsi_sertype_free_sample, and will therefore + * never be used to free an existing sample collection. This is caused by + * the fact that the C++ API lets either the user specify the exact dimensions + * of his preallocated collection (in which case there is no need to release + * it in the cyclone code base), or if the user didn't preallocate any memory it + * returns a collection of samples that will be owned by the user (in which case + * cyclone doesn't need to release the collection either). + * Because of this, we can safely assume that sertype_free_samples can only + * be invoked by ddsi_sertype_free_sample, in which case count is always 1, + * and the op flags can either be set to DDS_FREE_ALL_BIT, or to DDS_FREE_CONTENTS_BIT. + */ + T* ptr = reinterpret_cast(ptrs[0]); + if (op & DDS_FREE_ALL_BIT) { + delete ptr; + } else { + assert(op & DDS_FREE_CONTENTS_BIT); + *ptr = T(); + } +} + +template +bool sertype_equal( + const ddsi_sertype* acmn, const ddsi_sertype* bcmn) +{ + /* A bit of a guess: types with the same name & type name are really the same if they have + the same type support identifier as well */ + (void)acmn; + (void)bcmn; + return true; +} + +template +uint32_t sertype_hash(const ddsi_sertype* tpcmn) +{ + (void)tpcmn; + return 0x0; +} + +template +size_t sertype_get_serialized_size(const ddsi_sertype*, const void * sample) +{ + const auto& msg = *static_cast(sample); + + // get the serialized size of the sample (with out serializing) + size_t sz = 0; + if (!get_serialized_size(msg, false, sz)) { + // the max value is treated as an error in the Cyclone core + return SIZE_MAX; + } + + return sz + CDR_HEADER_SIZE; // Include the additional bytes for the CDR header +} + +template +bool sertype_serialize_into(const ddsi_sertype*, + const void * sample, + void * dst_buffer, + size_t sz) +{ + // cast to the type + const auto& msg = *static_cast(sample); + + return serialize_into(dst_buffer, sz, msg, false); +} + +template +struct ddscxx_sertype_ops: public ddsi_sertype_ops { + ddscxx_sertype_ops(): ddsi_sertype_ops { + ddsi_sertype_v0, + nullptr, + sertype_free, + sertype_zero_samples, + sertype_realloc_samples, + sertype_free_samples, + sertype_equal, + sertype_hash, + #ifdef DDSCXX_HAS_TYPE_DISCOVERY + TopicTraits::getTypeId, + TopicTraits::getTypeMap, + TopicTraits::getTypeInfo, + #else + nullptr, + nullptr, + nullptr, + #endif //DDSCXX_HAS_TYPE_DISCOVERY + TopicTraits::deriveSertype, + sertype_get_serialized_size, + sertype_serialize_into + } { ; } +}; + +template +class ddscxx_sertype : public ddsi_sertype { +public: + static const ddscxx_sertype_ops sertype_ops; + static const ddscxx_serdata_ops serdata_ops; + ddscxx_sertype(); +}; + +template +const ddscxx_sertype_ops ddscxx_sertype::sertype_ops; + +template +const ddscxx_serdata_ops ddscxx_sertype::serdata_ops; + +template +ddscxx_sertype::ddscxx_sertype() + : ddsi_sertype{} +{ + uint32_t flags = (TopicTraits::isKeyless() ? DDSI_SERTYPE_FLAG_TOPICKIND_NO_KEY : 0); +#ifdef DDSCXX_HAS_SHM + flags |= (TopicTraits::isSelfContained() ? + DDSI_SERTYPE_FLAG_FIXED_SIZE : 0); +#endif + + ddsi_sertype_init_flags( + static_cast(this), + TopicTraits::getTypeName(), + &sertype_ops, + &serdata_ops, + flags); + + allowed_data_representation = TopicTraits::allowableEncodings(); + +#ifdef DDSCXX_HAS_SHM + // update the size of the type, if its fixed + // this needs to be done after sertype init! TODO need an API in Cyclone DDS to set this + this->iox_size = + static_cast(TopicTraits::getSampleSize()); +#endif +} + +#endif // DDSCXXDATATOPIC_HPP_ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/discovery.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/discovery.hpp new file mode 100644 index 0000000..54dd24b --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/discovery.hpp @@ -0,0 +1,169 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_DISCOVER_HPP_ +#define CYCLONEDDS_TOPIC_DISCOVER_HPP_ + +#include +#include +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + + +template +struct typed_lookup_topic { + template + static inline TOPIC discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout); + + template + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector& list, + uint32_t max_size); +}; + + +template +struct typed_lookup_topic > { + static inline dds::topic::ContentFilteredTopic discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) + { + (void)dp; + (void)topic_name; + (void)timeout; + ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported"); + } + + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector >& list, + uint32_t max_size) + { + (void)dp; + (void)list; + (void)max_size; + ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported"); + } +}; + +template +struct typed_lookup_topic > { + static inline dds::topic::Topic discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) + { + return dds::topic::detail::Topic::discover_topic(dp, topic_name, timeout); + } + + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector >& list, + uint32_t max_size) + { + dds::topic::detail::Topic::discover_topics(dp, list, max_size); + } +}; + + + +template +struct lookup_topic { + static inline TOPIC discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) + { + return org::eclipse::cyclonedds::topic::typed_lookup_topic::discover(dp, topic_name, timeout); + } + + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector& list, + uint32_t max_size) + { + org::eclipse::cyclonedds::topic::typed_lookup_topic::discover(dp, list, max_size); + } +}; + +template <> +struct lookup_topic { + static inline dds::topic::TopicDescription discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) + { + return org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topic(dp, topic_name, timeout); + } + + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector& list, + uint32_t max_size) + { + std::vector anyTopics; + org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topics(dp, anyTopics, max_size); + for (std::vector::iterator it = anyTopics.begin(); it != anyTopics.end(); ++it) { + list.push_back(*it); + } + } +}; + +template <> +struct lookup_topic { + static inline dds::topic::AnyTopic discover( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name, + const dds::core::Duration& timeout) + { + return org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topic(dp, topic_name, timeout); + } + + static inline void discover( + const dds::domain::DomainParticipant& dp, + std::vector& list, + uint32_t max_size) + { + org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topics(dp, list, max_size); + } +}; + + + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_DISCOVER_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/find.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/find.hpp new file mode 100644 index 0000000..e505161 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/find.hpp @@ -0,0 +1,133 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_FIND_HPP_ +#define CYCLONEDDS_TOPIC_FIND_HPP_ + +#include +#include +#include +#include +#include + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ + +OMG_DDS_API dds::topic::TopicDescription +find_topic_description( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name); + +OMG_DDS_API dds::topic::AnyTopic +find_any_topic( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name); + + +template +struct typed_finder { + template + static inline TOPIC find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name); +}; + + +template +struct typed_finder > { + static inline dds::topic::ContentFilteredTopic find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name) + { + dds::topic::ContentFilteredTopic topic = dds::core::null; + + org::eclipse::cyclonedds::core::ObjectDelegate::ref_type entity = dp.delegate()->find_cfTopic(topic_name); + + if (entity) { + typename dds::topic::ContentFilteredTopic::DELEGATE_REF_T topic_typed = + ::std::dynamic_pointer_cast::DELEGATE_T>(entity); + topic = dds::topic::ContentFilteredTopic(topic_typed); + } + return topic; + } +}; + +template +struct typed_finder > { + static inline dds::topic::Topic find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name) + { + dds::topic::Topic topic = dds::core::null; + + org::eclipse::cyclonedds::core::EntityDelegate::ref_type entity = dp.delegate()->find_topic(topic_name); + + if (entity) { + typename dds::topic::Topic::DELEGATE_REF_T topic_typed = + ::std::dynamic_pointer_cast::DELEGATE_T>(entity); + topic = dds::topic::Topic(topic_typed); + } + return topic; + } +}; + + + +template +struct finder { + static inline TOPIC find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name) + { + return org::eclipse::cyclonedds::topic::typed_finder::find(dp, topic_name); + } +}; + +template <> +struct finder { + static inline dds::topic::TopicDescription find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name) + { + return find_topic_description(dp, topic_name); + } +}; + +template <> +struct finder { + static inline dds::topic::AnyTopic find( + const dds::domain::DomainParticipant& dp, + const std::string& topic_name) + { + return find_any_topic(dp, topic_name); + } +}; + + + +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_FIND_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp new file mode 100644 index 0000000..a7a46a4 --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/hash.hpp @@ -0,0 +1,42 @@ +/* + * Copyright(c) 2006 to 2020 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + + /** + * @file + */ + +#ifndef IDLCXX_HASH_HPP_ +#define IDLCXX_HASH_HPP_ + +#include "dds/core/macros.hpp" +#include "dds/ddsi/ddsi_keyhash.h" +#include + +namespace org +{ + + namespace eclipse + { + namespace cyclonedds + { + namespace topic + { + bool OMG_DDS_API simple_key(const std::vector& in, ddsi_keyhash_t& out); + + bool OMG_DDS_API complex_key(const std::vector& in, ddsi_keyhash_t& out); + } + } + } +} + +#endif /* IDLCXX_HASH_HPP_ */ diff --git a/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/qos/TopicQosDelegate.hpp b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/qos/TopicQosDelegate.hpp new file mode 100644 index 0000000..6988deb --- /dev/null +++ b/unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/qos/TopicQosDelegate.hpp @@ -0,0 +1,289 @@ +/* + * Copyright(c) 2006 to 2021 ZettaScale Technology and others + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License + * v. 1.0 which is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + + +/** + * @file + */ + +#ifndef CYCLONEDDS_TOPIC_QOS_TOPIC_QOS_DELEGATE_HPP_ +#define CYCLONEDDS_TOPIC_QOS_TOPIC_QOS_DELEGATE_HPP_ + +#include +#include + +struct _DDS_NamedTopicQos; + +namespace org +{ +namespace eclipse +{ +namespace cyclonedds +{ +namespace topic +{ +namespace qos +{ + +class OMG_DDS_API TopicQosDelegate +{ +public: + TopicQosDelegate(); + + void policy(const dds::core::policy::TopicData& topic_data); + void policy(const dds::core::policy::Durability& durability); +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + void policy(const dds::core::policy::DurabilityService& durability_service); +#endif // OMG_DDS_PERSISTENCE_SUPPORT + void policy(const dds::core::policy::Deadline& deadline); + void policy(const dds::core::policy::LatencyBudget& budget); + void policy(const dds::core::policy::Liveliness& liveliness); + void policy(const dds::core::policy::Reliability& reliability); + void policy(const dds::core::policy::DestinationOrder& order); + void policy(const dds::core::policy::History& history); + void policy(const dds::core::policy::ResourceLimits& resources); + void policy(const dds::core::policy::TransportPriority& priority); + void policy(const dds::core::policy::Lifespan& lifespan); + void policy(const dds::core::policy::Ownership& ownership); +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + void policy(const dds::core::policy::DataRepresentation& datarepresentation); + void policy(const dds::core::policy::TypeConsistencyEnforcement& typeconsistencyenforcement); +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + + template const POLICY& policy() const; + template POLICY& policy(); + + /* The returned ddsc QoS has to be freed. */ + dds_qos_t* ddsc_qos() const; + void ddsc_qos(const dds_qos_t* qos); + + void named_qos(const struct _DDS_NamedTopicQos &qos); + + void check() const; + + bool operator ==(const TopicQosDelegate& other) const; + +private: + dds::core::policy::TopicData topic_data_; + dds::core::policy::Durability durability_; +#ifdef OMG_DDS_PERSISTENCE_SUPPORT + dds::core::policy::DurabilityService durability_service_; +#endif // OMG_DDS_PERSISTENCE_SUPPORT + dds::core::policy::Deadline deadline_; + dds::core::policy::LatencyBudget budget_; + dds::core::policy::Liveliness liveliness_; + dds::core::policy::Reliability reliability_; + dds::core::policy::DestinationOrder order_; + dds::core::policy::History history_; + dds::core::policy::ResourceLimits resources_; + dds::core::policy::TransportPriority priority_; + dds::core::policy::Lifespan lifespan_; + dds::core::policy::Ownership ownership_; +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + dds::core::policy::DataRepresentation datarepresentation_; + dds::core::policy::TypeConsistencyEnforcement typeconsistencyenforcement_; +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +}; + + + +//============================================================================== + + +template<> inline const dds::core::policy::TopicData& +TopicQosDelegate::policy() const +{ + return topic_data_; +} +template<> inline dds::core::policy::TopicData& +TopicQosDelegate::policy() +{ + return topic_data_; +} + + +template<> inline const dds::core::policy::Durability& +TopicQosDelegate::policy() const +{ + return durability_; +} +template<> inline dds::core::policy::Durability& +TopicQosDelegate::policy() +{ + return durability_; +} + + +#ifdef OMG_DDS_PERSISTENCE_SUPPORT +template<> inline const dds::core::policy::DurabilityService& +TopicQosDelegate::policy() const +{ + return durability_service_; +} +template<> inline dds::core::policy::DurabilityService& +TopicQosDelegate::policy() +{ + return durability_service_; +} +#endif // OMG_DDS_PERSISTENCE_SUPPORT + + +template<> inline const dds::core::policy::Deadline& +TopicQosDelegate::policy() const +{ + return deadline_; +} +template<> inline dds::core::policy::Deadline& +TopicQosDelegate::policy() +{ + return deadline_; +} + + +template<> inline const dds::core::policy::LatencyBudget& +TopicQosDelegate::policy() const +{ + return budget_; +} +template<> inline dds::core::policy::LatencyBudget& +TopicQosDelegate::policy() +{ + return budget_; +} + + +template<> inline const dds::core::policy::Liveliness& +TopicQosDelegate::policy() const +{ + return liveliness_; +} +template<> inline dds::core::policy::Liveliness& +TopicQosDelegate::policy() +{ + return liveliness_; +} + + +template<> inline const dds::core::policy::Reliability& +TopicQosDelegate::policy() const +{ + return reliability_; +} +template<> inline dds::core::policy::Reliability& +TopicQosDelegate::policy() +{ + return reliability_; +} + + +template<> inline const dds::core::policy::DestinationOrder& +TopicQosDelegate::policy() const +{ + return order_; +} +template<> inline dds::core::policy::DestinationOrder& +TopicQosDelegate::policy() +{ + return order_; +} + + +template<> inline const dds::core::policy::History& +TopicQosDelegate::policy() const +{ + return history_; +} +template<> inline dds::core::policy::History& +TopicQosDelegate::policy() +{ + return history_; +} + + +template<> inline const dds::core::policy::ResourceLimits& +TopicQosDelegate::policy() const +{ + return resources_; +} +template<> inline dds::core::policy::ResourceLimits& +TopicQosDelegate::policy() +{ + return resources_; +} + + +template<> inline const dds::core::policy::TransportPriority& +TopicQosDelegate::policy() const +{ + return priority_; +} +template<> inline dds::core::policy::TransportPriority& +TopicQosDelegate::policy() +{ + return priority_; +} + + +template<> inline const dds::core::policy::Lifespan& +TopicQosDelegate::policy() const +{ + return lifespan_; +} +template<> inline dds::core::policy::Lifespan& +TopicQosDelegate::policy() +{ + return lifespan_; +} + + +template<> inline const dds::core::policy::Ownership& +TopicQosDelegate::policy() const +{ + return ownership_; +} +template<> inline dds::core::policy::Ownership& +TopicQosDelegate::policy() +{ + return ownership_; +} + +#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT +template<> inline const dds::core::policy::DataRepresentation& +TopicQosDelegate::policy() const +{ + return datarepresentation_; +} +template<> inline dds::core::policy::DataRepresentation& +TopicQosDelegate::policy() +{ + return datarepresentation_; +} + +template<> inline const dds::core::policy::TypeConsistencyEnforcement& +TopicQosDelegate::policy() const +{ + return typeconsistencyenforcement_; +} +template<> inline dds::core::policy::TypeConsistencyEnforcement& +TopicQosDelegate::policy() +{ + return typeconsistencyenforcement_; +} +#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT + +} +} +} +} +} + +#endif /* CYCLONEDDS_TOPIC_QOS_TOPIC_QOS_DELEGATE_HPP_ */ diff --git a/unitree_SDK/include/unitree/common/any.hpp b/unitree_SDK/include/unitree/common/any.hpp new file mode 100644 index 0000000..9fb2bbf --- /dev/null +++ b/unitree_SDK/include/unitree/common/any.hpp @@ -0,0 +1,390 @@ +#ifndef __UT_ANY_HPP__ +#define __UT_ANY_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +class Any +{ +public: + Any() + : mContent(0) + {} + + template + Any(const ValueType& value) + : mContent(new Holder(value)) + {} + + Any(const char* s) + : Any(std::string(s)) + {} + + Any(const char* s, size_t len) + : Any(std::string(s, len)) + {} + + Any(const Any& other) + : mContent(other.mContent ? other.mContent->Clone() : 0) + {} + + ~Any() + { + delete mContent; + mContent = 0; + } + + Any& Swap(Any& other) + { + std::swap(mContent, other.mContent); + return *this; + } + + bool Empty() const + { + return mContent == 0; + } + + const std::type_info& GetTypeInfo() const + { + return mContent ? mContent->GetTypeInfo() : typeid(void); + } + + template + Any& operator=(const ValueType& other) + { + Any(other).Swap(*this); + return *this; + } + + Any& operator=(Any other) + { + other.Swap(*this); + return *this; + } + +public: + class PlaceHolder + { + public: + virtual ~PlaceHolder() + {} + + public: + virtual const std::type_info& GetTypeInfo() const = 0; + virtual PlaceHolder* Clone() const = 0; + }; + + template + class Holder : public PlaceHolder + { + public: + explicit Holder(const ValueType& value) + : mValue(value) + {} + + virtual const std::type_info& GetTypeInfo() const + { + return typeid(ValueType); + } + + virtual PlaceHolder* Clone() const + { + return new Holder(mValue); + } + + public: + ValueType mValue; + }; + +public: + PlaceHolder* mContent; +}; + +/* + * static const Any + */ +static const Any UT_EMPTY_ANY = Any(); + +static inline bool IsBool(const Any& any) +{ + return any.GetTypeInfo() == typeid(bool); +} + +static inline bool IsString(const Any& any) +{ + return any.GetTypeInfo() == typeid(std::string); +} + +static inline bool IsInt8(const Any& any) +{ + return any.GetTypeInfo() == typeid(int8_t); +} + +static inline bool IsUint8(const Any& any) +{ + return any.GetTypeInfo() == typeid(uint8_t); +} + +static inline bool IsInt16(const Any& any) +{ + return any.GetTypeInfo() == typeid(int16_t); +} + +static inline bool IsUint16(const Any& any) +{ + return any.GetTypeInfo() == typeid(uint16_t); +} + +static inline bool IsInt(const Any& any) +{ + return any.GetTypeInfo() == typeid(int32_t); +} + +static inline bool IsUint(const Any& any) +{ + return any.GetTypeInfo() == typeid(uint32_t); +} + +static inline bool IsInt64(const Any& any) +{ + return any.GetTypeInfo() == typeid(int64_t); +} + +static inline bool IsUint64(const Any& any) +{ + return any.GetTypeInfo() == typeid(uint64_t); +} + +static inline bool IsFloat(const Any& any) +{ + return any.GetTypeInfo() == typeid(float); +} + +static inline bool IsDouble(const Any& any) +{ + return any.GetTypeInfo() == typeid(double); +} + +static inline bool IsLongDouble(const Any& any) +{ + return any.GetTypeInfo() == typeid(long double); +} + +static inline bool IsInteger(const Any& any) +{ + return IsInt(any) || IsUint(any) || IsInt64(any) || IsUint64(any) + || IsInt16(any) || IsUint16(any) || IsInt8(any) || IsUint8(any); +} + +static inline bool IsNumber(const Any& any) +{ + return IsBool(any) || IsInteger(any) || IsFloat(any) || IsDouble(any) + || IsLongDouble(any); +} + +static inline bool IsBoolType(const std::type_info& t) +{ + return t == typeid(bool); +} + +static inline bool IsInt8Type(const std::type_info& t) +{ + return t == typeid(int8_t); +} + +static inline bool IsUint8Type(const std::type_info& t) +{ + return t == typeid(uint8_t); +} + +static inline bool IsInt16Type(const std::type_info& t) +{ + return t == typeid(int16_t); +} + +static inline bool IsUint16Type(const std::type_info& t) +{ + return t == typeid(uint16_t); +} + +static inline bool IsIntType(const std::type_info& t) +{ + return t == typeid(int32_t); +} + +static inline bool IsUintType(const std::type_info& t) +{ + return t == typeid(uint32_t); +} + +static inline bool IsInt64Type(const std::type_info& t) +{ + return t == typeid(int64_t); +} + +static inline bool IsUint64Type(const std::type_info& t) +{ + return t == typeid(uint64_t); +} + +static inline bool IsIntegerType(const std::type_info& t) +{ + return IsIntType(t) || IsUintType(t) || IsInt64Type(t) || IsUint64Type(t) || + IsInt8Type(t) || IsUint8Type(t) || IsInt16Type(t) || IsUint16Type(t); +} + +static inline bool IsFloatType(const std::type_info& t) +{ + return t == typeid(float); +} + +static inline bool IsDoubleType(const std::type_info& t) +{ + return t == typeid(double); +} + +static inline bool IsLongDoubleType(const std::type_info& t) +{ + return t == typeid(long double); +} + +static inline bool IsNumberType(const std::type_info& t) +{ + return IsBoolType(t) || IsIntegerType(t) || IsFloatType(t) + || IsDoubleType(t) || IsLongDoubleType(t); +} + +static inline bool IsTypeEqual(const std::type_info& t1, const std::type_info& t2) +{ + return t1 == t2; +} + +template +const ValueType& AnyCast(const Any* operand) +{ + const std::type_info& t1 = typeid(ValueType); + const std::type_info& t2 = operand->GetTypeInfo(); + + if (IsTypeEqual(t1, t2)) + { + return ((Any::Holder*)(operand->mContent))->mValue; + } + + UT_THROW(BadCastException, std::string("AnyCast error. target type is ") + + t1.name() + ", but source type is " + t2.name()); +} + +template +const ValueType& AnyCast(const Any& operand) +{ + return AnyCast(&operand); +} + +template +ValueType AnyNumberCast(const Any* operand) +{ + const std::type_info& t1 = typeid(ValueType); + const std::type_info& t2 = operand->GetTypeInfo(); + + if (IsNumberType(t1) && IsNumberType(t2)) + { + if (IsTypeEqual(t1, t2)) + { + return ((Any::Holder*)(operand->mContent))->mValue; + } + else if (IsFloatType(t2)) + { + return (ValueType)((Any::Holder*)(operand->mContent))->mValue; + } + else if (IsDoubleType(t2)) + { + return (ValueType)((Any::Holder*)(operand->mContent))->mValue; + } + else if (IsLongDoubleType(t2)) + { + return (ValueType)((Any::Holder*)(operand->mContent))->mValue; + } + else if (IsInt8Type(t2)) + { + return (ValueType)((Any::Holder*)(operand->mContent))->mValue; + } + else if (IsUint8Type(t2)) + { + return (ValueType)((Any::Holder*)(operand->mContent))->mValue; + } + else if (IsInt16Type(t2)) + { + return (ValueType)((Any::Holder*)(operand->mContent))->mValue; + } + else if (IsUint16Type(t2)) + { + return (ValueType)((Any::Holder*)(operand->mContent))->mValue; + } + else if (IsIntType(t2)) + { + return (ValueType)((Any::Holder*)(operand->mContent))->mValue; + } + else if (IsUintType(t2)) + { + return (ValueType)((Any::Holder*)(operand->mContent))->mValue; + } + else if (IsInt64Type(t2)) + { + return (ValueType)((Any::Holder*)(operand->mContent))->mValue; + } + else if (IsUint64Type(t2)) + { + return (ValueType)((Any::Holder*)(operand->mContent))->mValue; + } + else + { + UT_THROW(BadCastException, std::string("AnyNumberCast error. unknown number type:", t2.name())); + } + } + + UT_THROW(BadCastException, std::string("AnyNumberCast error. not number type")); +} + +template +ValueType AnyNumberCast(const Any& operand) +{ + return AnyNumberCast(&operand); +} + +static inline const std::string& ToString(const Any& operand) +{ + if (operand.Empty()) + { + return UT_EMPTY_STR; + } + + return AnyCast(operand); +} + +static inline void StringTo(const std::string& s, Any& value) +{ + value = s; +} + +static inline void StringTo(const char* s, Any& value) +{ + value = std::string(s); +} + +static inline void StringTo(const char* s, size_t len, Any& value) +{ + value = std::string(s, len); +} + +static inline void StringTo(const char* s, size_t pos, size_t len, Any& value) +{ + value = std::string(s, pos, len); +} + +} +} +#endif//__UT_ANY_HPP__ diff --git a/unitree_SDK/include/unitree/common/assert.hpp b/unitree_SDK/include/unitree/common/assert.hpp new file mode 100644 index 0000000..b4582a5 --- /dev/null +++ b/unitree_SDK/include/unitree/common/assert.hpp @@ -0,0 +1,149 @@ +#ifndef __UT_ASSERT_HPP__ +#define __UT_ASSERT_HPP__ + +#include + +/* + * Declare assert output + */ +#define UT_ASSERT_OUT(debug, file, func, line, r) \ + if (debug) \ + { \ + std::cout << "[" << ::time(NULL) \ + << "] [" << ::syscall(SYS_gettid) \ + << "] UT_ASSERT DEBUG at __FILE__:" << file \ + << ", __FUNCTION__:" << func \ + << ", __LINE__:" << line \ + << ", r:" << r \ + << ", errno:" << errno \ + << std::endl; \ + } \ + else \ + { \ + std::cout << "[" << ::time(NULL) \ + << "] [" << ::syscall(SYS_gettid) \ + << "] UT_ASSERT ABORT at __FILE__:" << file \ + << ", __FUNCTION__:" << func \ + << ", __LINE__:" << line \ + << ", r:" << r \ + << ", errno:" << errno \ + << std::endl; \ + } + +#define UT_ASSERT_ABORT(debug, file, func, line, r) \ + if (debug) \ + { \ + UT_ASSERT_OUT(1, file, func, line, r); \ + } \ + else \ + { \ + UT_ASSERT_OUT(0, file, func, line, r); \ + abort(); \ + } + +/* + * Declare assert return value + */ +#define UT_ASSERT_EQ(x, r) \ + unitree::common::AssertEqual(x, r, 0, __FILE__, \ + __PRETTY_FUNCTION__, __LINE__) + +#define UT_ASSERT_EQ_DEBUG(x, r) \ + unitree::common::AssertEqual(x, r, 1, __FILE__, \ + __PRETTY_FUNCTION__, __LINE__) + +#define UT_ASSERT_NOT_EQ(x, r) \ + unitree::common::AssertNotEqual(x, r, 0, __FILE__, \ + __PRETTY_FUNCTION__, __LINE__) + +#define UT_ASSERT_NOT_EQ_DEBUG(x, r) \ + unitree::common::AssertNotEqual(x, r, 1, __FILE__, \ + __PRETTY_FUNCTION__, __LINE__) + +/* + * Declare assert return value and errno + */ +#define UT_ASSERT_ENO_EQ(x, r, eno) \ + unitree::common::AssertEqual(x, r, eno, 0, __FILE__, \ + __PRETTY_FUNCTION__, __LINE__) + +#define UT_ASSERT_ENO_EQ_DEBUG(x, r, eno) \ + unitree::common::AssertEqual(x, r, eno, 1, __FILE__, \ + __PRETTY_FUNCTION__, __LINE__) + +#define UT_ASSERT_ENO_EQ_EX(x, r, eno) \ + unitree::common::AssertEqualEx(x, r, eno, 0, __FILE__, \ + __PRETTY_FUNCTION__, __LINE__) + +#define UT_ASSERT_ENO_EQ_EX_DEBUG(x, r, eno) \ + unitree::common::AssertEqualEx(x, r, eno, 1, __FILE__, \ + __PRETTY_FUNCTION__, __LINE__) + +/* + * Declare assert wrapper + */ +#define UT_ASSERT_0(x) \ + UT_ASSERT_EQ(x, 0) + +#define UT_ASSERT_DEBUG_0(x) \ + UT_ASSERT_EQ_DEBUG(x, 0) + +#define UT_ASSERT_ENO_0(x, eno) \ + UT_ASSERT_ENO_EQ(x, 0, eno) + +#define UT_ASSERT_ENO_DEBUG_0(x, eno) \ + UT_ASSERT_ENO_EQ_DEBUG(x, 0, eno) + + +//Declare assert function +namespace unitree +{ +namespace common +{ +inline int AssertEqual(int r, int expectRet, bool debug, + const char* file, const char* func, int line) +{ + if (UT_UNLIKELY(r != expectRet)) + { + UT_ASSERT_ABORT(debug, file, func, line, r); + } + + return r; +} + +inline int AssertNotEqual(int r, int expectRet, bool debug, + const char* file, const char* func, int line) +{ + if (UT_UNLIKELY(r == expectRet)) + { + UT_ASSERT_ABORT(debug, file, func, line, r); + } + + return r; +} + +inline int AssertEqual(int r, int expectRet, int expectErrno, bool debug, + const char* file, const char* func, int line) +{ + if (UT_UNLIKELY(r != expectRet) && UT_UNLIKELY(errno != expectErrno)) + { + UT_ASSERT_ABORT(debug, file, func, line, r); + } + + return r; +} + +inline int AssertEqualEx(int r, int expectRet, int expectErrno, bool debug, + const char* file, const char* func, int line) +{ + if (UT_UNLIKELY(r != 0) && UT_UNLIKELY(r != expectRet) && + UT_UNLIKELY(errno != expectErrno)) + { + UT_ASSERT_ABORT(debug, file, func, line, r); + } + + return r; +} +} +} +#endif//__UT_ASSERT_HPP__ diff --git a/unitree_SDK/include/unitree/common/block_queue.hpp b/unitree_SDK/include/unitree/common/block_queue.hpp new file mode 100644 index 0000000..3a3c0f5 --- /dev/null +++ b/unitree_SDK/include/unitree/common/block_queue.hpp @@ -0,0 +1,137 @@ +#ifndef __UT_BLOCK_QUEUE_HPP__ +#define __UT_BLOCK_QUEUE_HPP__ + +#include +#include + +namespace unitree +{ +namespace common +{ +template +class BlockQueue +{ +public: + BlockQueue(uint64_t maxSize = UT_QUEUE_MAX_LEN) : + mMaxSize(maxSize), mCurSize(0) + { + if (mMaxSize == 0) + { + mMaxSize = UT_QUEUE_MAX_LEN; + } + } + + bool Put(const T& t, bool replace = false, bool putfront = false) + { + /* + * if queue is full or full-replaced occured return false + */ + bool noneReplaced = true; + + LockGuard guard(mMutexCond); + if (mCurSize >= mMaxSize) + { + if (!replace) + { + return false; + } + + noneReplaced = false; + + mQueue.pop_front(); + mCurSize --; + } + + if (putfront) + { + mQueue.emplace_front(t); + } + else + { + mQueue.emplace_back(t); + } + + mCurSize ++; + mMutexCond.Notify(); + + return noneReplaced; + } + + bool Get(T& t, uint64_t microsec = 0) + { + LockGuard guard(mMutexCond); + return GetTimeout(t, microsec); + } + + T Get(uint64_t microsec = 0) + { + LockGuard guard(mMutexCond); + T t; + if (GetTimeout(t, microsec)) + { + return std::move(t); + } + + UT_THROW(TimeoutException, "block queue get timeout or interrupted"); + } + + bool Empty() + { + return mCurSize == 0; + } + + uint64_t Size() + { + return mCurSize; + } + + void Interrupt(bool all = false) + { + LockGuard guard(mMutexCond); + if (all) + { + mMutexCond.NotifyAll(); + } + else + { + mMutexCond.Notify(); + } + } + +private: + bool GetTimeout(T& t, uint64_t microsec = 0) + { + if (mQueue.empty()) + { + if (!mMutexCond.Wait(microsec)) + { + return false; + } + + if (mQueue.empty()) + { + return false; + } + } + + t = mQueue.front(); + mQueue.pop_front(); + + mCurSize--; + + return true; + } + +private: + uint64_t mMaxSize; + uint64_t mCurSize; + std::list mQueue; + MutexCond mMutexCond; +}; + +template +using BlockQueuePtr = std::shared_ptr>; + +} +} +#endif//__UT_BLOCK_QUEUE_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_callback.hpp b/unitree_SDK/include/unitree/common/dds/dds_callback.hpp new file mode 100644 index 0000000..e668b63 --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_callback.hpp @@ -0,0 +1,35 @@ +#ifndef __UT_DDS_CALLBACK_HPP__ +#define __UT_DDS_CALLBACK_HPP__ + +#include + +using DdsMessageHandler = std::function; + +namespace unitree +{ +namespace common +{ +class DdsReaderCallback +{ +public: + DdsReaderCallback(); + DdsReaderCallback(const DdsMessageHandler& handler); + DdsReaderCallback(const DdsReaderCallback& cb); + DdsReaderCallback& operator=(const DdsReaderCallback& cb); + + ~DdsReaderCallback(); + +public: + bool HasMessageHandler() const; + void OnDataAvailable(const void* message); + +private: + DdsMessageHandler mMessageHandler; +}; + +using DdsReaderCallbackPtr = std::shared_ptr; + +} +} + +#endif//__UT_DDS_CALLBACK_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_easy_model.hpp b/unitree_SDK/include/unitree/common/dds/dds_easy_model.hpp new file mode 100644 index 0000000..11b65ba --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_easy_model.hpp @@ -0,0 +1,148 @@ +#ifndef __DDS_EASY_MODEL_HPP__ +#define __DDS_EASY_MODEL_HPP__ + +#include +#include +#include +#include + +#define UT_DDS_PARAMETER_CONFIG_FILENAME "dds_parameter.json" + +namespace unitree +{ +namespace common +{ +class DdsEasyModel +{ +public: + explicit DdsEasyModel(); + ~DdsEasyModel(); + + void Init(uint32_t domainId); + void Init(const std::string& ddsParameterFileName = ""); + void Init(const JsonMap& param); + + template + void SetTopic(const std::string& topic) + { + DdsTopicChannelPtr channel = GetChannel(topic); + if (!channel) + { + channel = DdsTopicChannelPtr(new DdsTopicChannel()); + mChannelMap[topic] = std::static_pointer_cast(channel); + + DdsTopicQos topicQos; + GetTopicQos(topic, topicQos); + channel->SetTopic(mParticipant, topic, topicQos); + } + + DdsWriterPtr writer = channel->GetWriter(); + if (!writer) + { + DdsWriterQos writerQos; + GetWriterQos(topic, writerQos); + channel->SetWriter(GetPublisher(topic), writerQos); + } + else + { + UT_THROW(CommonException, std::string("topic reader is already exist. topic:") + topic); + } + } + + template + void SetTopic(const std::string& topic, const DdsMessageHandler& handler, int32_t queuelen = 0) + { + DdsReaderCallback cb(handler); + SetTopic(topic, cb, queuelen); + } + + template + void SetTopic(const std::string& topic, const DdsReaderCallback& rcb, int32_t queuelen = 0) + { + DdsTopicChannelPtr channel = GetChannel(topic); + if (!channel) + { + channel = DdsTopicChannelPtr(new DdsTopicChannel()); + mChannelMap[topic] = std::static_pointer_cast(channel); + + DdsTopicQos topicQos; + GetTopicQos(topic, topicQos); + channel->SetTopic(mParticipant, topic, topicQos); + } + + DdsReaderPtr reader = channel->GetReader(); + if (!reader) + { + DdsReaderQos readerQos; + GetReaderQos(topic, readerQos); + channel->SetReader(GetSubscriber(topic), readerQos, rcb, queuelen); + } + else + { + UT_THROW(CommonException, std::string("topic reader is already exist. topic:") + topic); + } + } + + template + bool WriteMessage(const std::string topic, const MSG& message, int64_t waitMicrosec = 0) + { + DdsTopicChannelPtr channel = GetChannel(topic); + if (channel == NULL) + { + return false; + } + + return channel->Write(message, waitMicrosec); + } + + bool WriteMessage(const std::string topic, const void* message, int64_t waitMicrosec = 0); + + int64_t GetLastDataAvailableTime(const std::string topic); + +private: + void GetTopicQos(const std::string& topic, DdsTopicQos& qos); + void GetWriterQos(const std::string& topic, DdsWriterQos& qos); + void GetReaderQos(const std::string& topic, DdsReaderQos& qos); + + DdsTopicChannelAbstractPtr GetChannel(const std::string& topic); + + template + DdsTopicChannelPtr GetChannel(const std::string& topic) + { + DdsTopicChannelPtr channel; + + DdsTopicChannelAbstractPtr channelAbstract = GetChannel(topic); + if (channelAbstract) + { + channel = std::static_pointer_cast>(channelAbstract); + } + + return channel; + } + + DdsSubscriberPtr GetSubscriber(const std::string& topic); + DdsSubscriberPtr GetSubscriberDefault(); + + DdsPublisherPtr GetPublisher(const std::string& topic); + DdsPublisherPtr GetPublisherDefault(); + +private: + DdsParameter mDdsParameter; + + DdsParticipantPtr mParticipant; + std::vector mPublisherList; + std::vector mSubscriberList; + DdsPublisherPtr mPublisherDefault; + DdsSubscriberPtr mSubscriberDefault; + + std::map mChannelMap; + + Logger *mLogger; +}; + +using DdsEasyModelPtr = std::shared_ptr; + +} +} + +#endif//__DDS_EASY_MODEL_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_entity.hpp b/unitree_SDK/include/unitree/common/dds/dds_entity.hpp new file mode 100644 index 0000000..9e46958 --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_entity.hpp @@ -0,0 +1,411 @@ +#ifndef __UT_DDS_ENTITY_HPP__ +#define __UT_DDS_ENTITY_HPP__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define __UT_DDS_NULL__ ::dds::core::null + +/* + * dds wait sub/pub matched default time slice. + * default 10000 us + */ +#define __UT_DDS_WAIT_MATCHED_TIME_SLICE 10000 +#define __UT_DDS_WAIT_MATCHED_TIME_MAX 1000000 + +using namespace org::eclipse::cyclonedds; + +namespace unitree +{ +namespace common +{ +class DdsLogger +{ +public: + DdsLogger(); + virtual ~DdsLogger(); + +protected: + Logger* mLogger; +}; + +/* + * @brief: DdsParticipant + */ +class DdsParticipant : public DdsLogger +{ +public: + using NATIVE_TYPE = ::dds::domain::DomainParticipant; + + explicit DdsParticipant(uint32_t domainId, const DdsParticipantQos& qos, const std::string& config = ""); + ~DdsParticipant(); + + const NATIVE_TYPE& GetNative() const; + +private: + NATIVE_TYPE mNative; +}; + +using DdsParticipantPtr = std::shared_ptr; + + +/* + * @brief: DdsPublisher + */ +class DdsPublisher : public DdsLogger +{ +public: + using NATIVE_TYPE = ::dds::pub::Publisher; + + explicit DdsPublisher(const DdsParticipantPtr& participant, const DdsPublisherQos& qos); + ~DdsPublisher(); + + const NATIVE_TYPE& GetNative() const; + +private: + NATIVE_TYPE mNative; +}; + +using DdsPublisherPtr = std::shared_ptr; + + +/* + * @brief: DdsSubscriber + */ +class DdsSubscriber : public DdsLogger +{ +public: + using NATIVE_TYPE = ::dds::sub::Subscriber; + + explicit DdsSubscriber(const DdsParticipantPtr& participant, const DdsSubscriberQos& qos); + ~DdsSubscriber(); + + const NATIVE_TYPE& GetNative() const; + +private: + NATIVE_TYPE mNative; +}; + +using DdsSubscriberPtr = std::shared_ptr; + + +/* + * @brief: DdsTopic + */ +template +class DdsTopic : public DdsLogger +{ +public: + using NATIVE_TYPE = ::dds::topic::Topic; + + explicit DdsTopic(const DdsParticipantPtr& participant, const std::string& name, const DdsTopicQos& qos) : + mNative(__UT_DDS_NULL__) + { + UT_DDS_EXCEPTION_TRY + + auto topicQos = participant->GetNative().default_topic_qos(); + qos.CopyToNativeQos(topicQos); + + mNative = NATIVE_TYPE(participant->GetNative(), name, topicQos); + + UT_DDS_EXCEPTION_CATCH(mLogger, true) + } + + ~DdsTopic() + { + mNative = __UT_DDS_NULL__; + } + + const NATIVE_TYPE& GetNative() const + { + return mNative; + } + +private: + NATIVE_TYPE mNative; +}; + +template +using DdsTopicPtr = std::shared_ptr>; + + +/* + * @brief: DdsWriter + */ +template +class DdsWriter : public DdsLogger +{ +public: + using NATIVE_TYPE = ::dds::pub::DataWriter; + + explicit DdsWriter(const DdsPublisherPtr publisher, const DdsTopicPtr& topic, const DdsWriterQos& qos) : + mNative(__UT_DDS_NULL__) + { + UT_DDS_EXCEPTION_TRY + + auto writerQos = publisher->GetNative().default_datawriter_qos(); + qos.CopyToNativeQos(writerQos); + + mNative = NATIVE_TYPE(publisher->GetNative(), topic->GetNative(), writerQos); + + UT_DDS_EXCEPTION_CATCH(mLogger, true) + } + + ~DdsWriter() + { + mNative = __UT_DDS_NULL__; + } + + const NATIVE_TYPE& GetNative() const + { + return mNative; + } + + bool Write(const MSG& message, int64_t waitMicrosec) + { + if (waitMicrosec > 0) + { + WaitReader(waitMicrosec); + } + + UT_DDS_EXCEPTION_TRY + { + mNative.write(message); + return true; + } + UT_DDS_EXCEPTION_CATCH(mLogger, false) + + return false; + } + +private: + void WaitReader(int64_t waitMicrosec) + { + if (waitMicrosec < __UT_DDS_WAIT_MATCHED_TIME_SLICE) + { + return; + } + + int64_t waitTime = (waitMicrosec / 2); + if (waitTime > __UT_DDS_WAIT_MATCHED_TIME_MAX) + { + waitTime = __UT_DDS_WAIT_MATCHED_TIME_MAX; + } + + while (waitTime > 0 && mNative.publication_matched_status().current_count() == 0) + { + MicroSleep(__UT_DDS_WAIT_MATCHED_TIME_SLICE); + waitTime -=__UT_DDS_WAIT_MATCHED_TIME_SLICE; + } + } + +private: + NATIVE_TYPE mNative; +}; + +template +using DdsWriterPtr = std::shared_ptr>; + + +/* + * @brief: DdsReaderListener + */ +template +class DdsReaderListener : public ::dds::sub::NoOpDataReaderListener, DdsLogger +{ +public: + using NATIVE_TYPE = ::dds::sub::DataReaderListener; + using MSG_PTR = std::shared_ptr; + + explicit DdsReaderListener() : + mHasQueue(false), mQuit(false), mMask(::dds::core::status::StatusMask::none()), mLastDataAvailableTime(0) + {} + + ~DdsReaderListener() + { + if (mHasQueue) + { + mQuit = true; + mDataQueuePtr->Interrupt(false); + mDataQueueThreadPtr->Wait(); + } + } + + void SetCallback(const DdsReaderCallback& cb) + { + if (cb.HasMessageHandler()) + { + mMask |= ::dds::core::status::StatusMask::data_available(); + } + + mCallbackPtr.reset(new DdsReaderCallback(cb)); + } + + void SetQueue(int32_t len) + { + if (len <= 0) + { + return; + } + + mHasQueue = true; + mDataQueuePtr.reset(new BlockQueue(len)); + + auto queueThreadFunc = [this]() { + while (true) + { + if (mCallbackPtr && mCallbackPtr->HasMessageHandler()) + { + break; + } + else + { + MicroSleep(__UT_DDS_WAIT_MATCHED_TIME_SLICE); + } + } + while (!mQuit) + { + MSG_PTR dataPtr; + if (mDataQueuePtr->Get(dataPtr)) + { + if (dataPtr) + { + mCallbackPtr->OnDataAvailable(dataPtr.get()); + } + } + } + return 0; + }; + + mDataQueueThreadPtr = CreateThreadEx("rlsnr", UT_CPU_ID_NONE, queueThreadFunc); + } + + int64_t GetLastDataAvailableTime() const + { + return mLastDataAvailableTime; + } + + NATIVE_TYPE* GetNative() const + { + return (NATIVE_TYPE*)this; + } + + const ::dds::core::status::StatusMask& GetStatusMask() const + { + return mMask; + } + +private: + void on_data_available(::dds::sub::DataReader& reader) + { + ::dds::sub::LoanedSamples samples; + samples = reader.take(); + + if (samples.length() <= 0) + { + return; + } + + typename ::dds::sub::LoanedSamples::const_iterator iter; + for (iter=samples.begin(); iterdata(); + if (iter->info().valid()) + { + mLastDataAvailableTime = GetCurrentMonotonicTimeNanosecond(); + + if (mHasQueue) + { + if (!mDataQueuePtr->Put(MSG_PTR(new MSG(m)), true)) + { + LOG_WARNING(mLogger, "earliest mesage was evicted. type:", DdsGetTypeName(MSG)); + } + } + else + { + mCallbackPtr->OnDataAvailable((const void*)&m); + } + } + } + } + +private: + bool mHasQueue; + volatile bool mQuit; + + ::dds::core::status::StatusMask mMask; + int64_t mLastDataAvailableTime; + + DdsReaderCallbackPtr mCallbackPtr; + BlockQueuePtr mDataQueuePtr; + ThreadPtr mDataQueueThreadPtr; +}; + +template +using DdsReaderListenerPtr = std::shared_ptr>; + + +/* + * @brief: DdsReader + */ +template +class DdsReader : public DdsLogger +{ +public: + using NATIVE_TYPE = ::dds::sub::DataReader; + + explicit DdsReader(const DdsSubscriberPtr& subscriber, const DdsTopicPtr& topic, const DdsReaderQos& qos) : + mNative(__UT_DDS_NULL__) + { + UT_DDS_EXCEPTION_TRY + + auto readerQos = subscriber->GetNative().default_datareader_qos(); + qos.CopyToNativeQos(readerQos); + + mNative = NATIVE_TYPE(subscriber->GetNative(), topic->GetNative(), readerQos); + + UT_DDS_EXCEPTION_CATCH(mLogger, true) + } + + ~DdsReader() + { + mNative = __UT_DDS_NULL__; + } + + const NATIVE_TYPE& GetNative() const + { + return mNative; + } + + void SetListener(const DdsReaderCallback& cb, int32_t qlen) + { + mListener.SetCallback(cb); + mListener.SetQueue(qlen); + mNative.listener(mListener.GetNative(), mListener.GetStatusMask()); + } + + int64_t GetLastDataAvailableTime() const + { + return mListener.GetLastDataAvailableTime(); + } + +private: + NATIVE_TYPE mNative; + DdsReaderListener mListener; +}; + +template +using DdsReaderPtr = std::shared_ptr>; + +} +} + +#endif//__UT_DDS_ENTITY_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_error.hpp b/unitree_SDK/include/unitree/common/dds/dds_error.hpp new file mode 100644 index 0000000..efdaea8 --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_error.hpp @@ -0,0 +1,17 @@ +#ifndef __UT_DDS_ERROR_HPP__ +#define __UT_DDS_ERROR_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +/* + * dds error. + */ +UT_DECL_ERR(UT_ERR_DDS, 2001, "dds error") + +} +} +#endif//__UT_DDS_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_exception.hpp b/unitree_SDK/include/unitree/common/dds/dds_exception.hpp new file mode 100644 index 0000000..b8e6bdb --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_exception.hpp @@ -0,0 +1,58 @@ +#ifndef __UT_DDS_EXCEPTION_HPP__ +#define __UT_DDS_EXCEPTION_HPP__ + +#include +#include + +#define __UT_DDS_EXCEPTION_MESSAGE(e, d) \ + std::string("Catch dds::core exception. Class:") + __UT_STR(d) + ", Message:" + e.what(); + +#define __UT_DDS_EXCEPTION_CATCH(except, l, t) \ +catch (const except & e) \ +{ \ + if (l || t) \ + { \ + std::string __t9b78e5r = __UT_DDS_EXCEPTION_MESSAGE(e, except); \ + if (l) \ + { \ + LOG_ERROR(l, __t9b78e5r); \ + } \ + if (t) \ + { \ + UT_THROW(DdsException, __t9b78e5r); \ + } \ + } \ +} + +#define UT_DDS_EXCEPTION_TRY \ +try \ +{ + +#define UT_DDS_EXCEPTION_CATCH(l, t) \ +} \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::Error, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::InvalidArgumentError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::TimeoutError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::UnsupportedError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::AlreadyClosedError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::IllegalOperationError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::NotEnabledError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::PreconditionNotMetError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::ImmutablePolicyError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::InconsistentPolicyError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::OutOfResourcesError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::InvalidDowncastError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::NullReferenceError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::InvalidDataError, l, t) \ +__UT_DDS_EXCEPTION_CATCH(::dds::core::Exception, l, t) \ +__UT_DDS_EXCEPTION_CATCH(std::exception, l, t) + +namespace unitree +{ +namespace common +{ +UT_DECL_EXCEPTION(DdsException, UT_ERR_DDS, UT_DESC_ERR(UT_ERR_DDS)) +} +} + +#endif//__UT_DDS_EXCEPTION_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_factory_model.hpp b/unitree_SDK/include/unitree/common/dds/dds_factory_model.hpp new file mode 100644 index 0000000..70459ec --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_factory_model.hpp @@ -0,0 +1,62 @@ +#ifndef __UT_DDS_FACTORY_MODEL_HPP__ +#define __UT_DDS_FACTORY_MODEL_HPP__ + +#include +#include + +namespace unitree +{ +namespace common +{ +class DdsFactoryModel +{ +public: + explicit DdsFactoryModel(); + ~DdsFactoryModel(); + + void Init(uint32_t domainId, const std::string& ddsConfig = ""); + void Init(const std::string& ddsParameterFileName = ""); + void Init(const JsonMap& param); + + template + DdsTopicChannelPtr CreateTopicChannel(const std::string& topic) + { + DdsTopicChannelPtr channel = DdsTopicChannelPtr(new DdsTopicChannel()); + channel->SetTopic(mParticipant, topic, mTopicQos); + return channel; + } + + template + void SetWriter(DdsTopicChannelPtr& channelPtr) + { + channelPtr->SetWriter(mPublisher, mWriterQos); + } + + template + void SetReader(DdsTopicChannelPtr& channelPtr, const std::function& handler, int32_t queuelen = 0) + { + DdsReaderCallback cb(handler); + channelPtr->SetReader(mSubscriber, mReaderQos, cb, queuelen); + } + +private: + DdsParticipantPtr mParticipant; + DdsPublisherPtr mPublisher; + DdsSubscriberPtr mSubscriber; + + DdsParticipantQos mParticipantQos; + DdsTopicQos mTopicQos; + DdsPublisherQos mPublisherQos; + DdsSubscriberQos mSubscriberQos; + DdsWriterQos mWriterQos; + DdsReaderQos mReaderQos; + + Logger *mLogger; +}; + +using DdsFactoryModelPtr = std::shared_ptr; + +} +} + +#endif//__UT_DDS_FACTORY_MODEL_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_native.hpp b/unitree_SDK/include/unitree/common/dds/dds_native.hpp new file mode 100644 index 0000000..fe27a53 --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_native.hpp @@ -0,0 +1,37 @@ +#ifndef __UT_DDS_NATIVE_HPP__ +#define __UT_DDS_NATIVE_HPP__ + +namespace unitree +{ +namespace common +{ +template +class DdsNative +{ +public: + using NativeType = NATIVE; + + explicit DdsNative() + {} + + virtual ~DdsNative() + {} + + void SetNative(const NATIVE& native) + { + mNative = native; + } + + const NATIVE& GetNative() const + { + return mNative; + } + +protected: + NATIVE mNative; +}; + +} +} + +#endif// diff --git a/unitree_SDK/include/unitree/common/dds/dds_parameter.hpp b/unitree_SDK/include/unitree/common/dds/dds_parameter.hpp new file mode 100644 index 0000000..02a0144 --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_parameter.hpp @@ -0,0 +1,214 @@ +#ifndef __UT_DDS_PARAMETER_HPP__ +#define __UT_DDS_PARAMETER_HPP__ + +#include +#include + +#define UT_DDS_PARAM_KEY_PARTICIPANT "Participant" +#define UT_DDS_PARAM_KEY_DOMAINID "DomainId" +#define UT_DDS_PARAM_KEY_CONFIG "Config" +#define UT_DDS_PARAM_KEY_NAME "Name" +#define UT_DDS_PARAM_KEY_TOPIC "Topic" +#define UT_DDS_PARAM_KEY_TOPICNAME "TopicName" +#define UT_DDS_PARAM_KEY_PUBLISHER "Publisher" +#define UT_DDS_PARAM_KEY_SUBSCRIBER "Subscriber" +#define UT_DDS_PARAM_KEY_WRITER "Writer" +#define UT_DDS_PARAM_KEY_READER "Reader" +#define UT_DDS_PARAM_KEY_QOS "Qos" + +namespace unitree +{ +namespace common +{ +class DdsQosParameterHolder +{ +public: + DdsQosParameterHolder(); + + virtual ~DdsQosParameterHolder(); + + void SetQos(const DdsQosParameter& qos); + const DdsQosParameter& GetQos() const; + +protected: + DdsQosParameter mQos; +}; + +class DdsParticipantParameter : public DdsQosParameterHolder +{ +public: + DdsParticipantParameter(); + DdsParticipantParameter(uint32_t domainId, const std::string& config = ""); + + ~DdsParticipantParameter(); + + void SetDomainId(int32_t domainId); + uint32_t GetDomainId() const; + + void SetConfig(const std::string& config); + const std::string& GetConfig() const; + +private: + uint32_t mDomainId; + std::string mConfig; +}; + +class DdsTopicParameter : public DdsQosParameterHolder +{ +public: + DdsTopicParameter(); + DdsTopicParameter(const std::string& name); + + ~DdsTopicParameter(); + + void SetName(const std::string& name); + const std::string& GetName() const; + +private: + std::string mName; +}; + +class DdsTopicParameterHolder +{ +public: + DdsTopicParameterHolder(); + DdsTopicParameterHolder(const std::string& topicName); + + virtual ~DdsTopicParameterHolder(); + + void SetTopicName(const std::string& topicName); + const std::string& GetTopicName() const; + +private: + std::string mTopicName; +}; + +class DdsWriterParameter : public DdsTopicParameterHolder, public DdsQosParameterHolder +{ +public: + DdsWriterParameter(); + DdsWriterParameter(const std::string& topicName); + + ~DdsWriterParameter(); +}; + +class DdsWriterParameterHolder +{ +public: + DdsWriterParameterHolder(); + + virtual ~DdsWriterParameterHolder(); + + void SetWriter(const DdsWriterParameter& writer); + const DdsWriterParameter& GetWriter() const; + +private: + DdsWriterParameter mWriter; +}; + +class DdsReaderParameter : public DdsTopicParameterHolder, public DdsQosParameterHolder +{ +public: + DdsReaderParameter(); + DdsReaderParameter(const std::string& topicName); + + virtual ~DdsReaderParameter(); +}; + +class DdsReaderParameterHolder +{ +public: + DdsReaderParameterHolder(); + + virtual ~DdsReaderParameterHolder(); + + void SetReader(const DdsReaderParameter& reader); + const DdsReaderParameter& GetReader() const; + +private: + DdsReaderParameter mReader; +}; + +class DdsPublisherParameter : public DdsQosParameterHolder +{ +public: + DdsPublisherParameter(); + + ~DdsPublisherParameter(); + + void AppendWriter(const DdsWriterParameter& writer); + void SetWriter(const std::vector& writer); + const std::vector& GetWriter() const; + +private: + std::vector mWriter; +}; + +class DdsSubscriberParameter : public DdsQosParameterHolder +{ +public: + DdsSubscriberParameter(); + ~DdsSubscriberParameter(); + + void AppendReader(const DdsReaderParameter& reader); + void SetReader(const std::vector& reader); + const std::vector& GetReader() const; + +private: + std::vector mReader; +}; + +class DdsParameter +{ +public: + DdsParameter(); + DdsParameter(const JsonMap& param); + + ~DdsParameter(); + + void Init(const JsonMap& param); + + uint32_t GetDomainId(); + const std::string& GetConfig() const; + + const DdsParticipantParameter& GetParticipant(); + + void AppendTopic(const DdsTopicParameter& topic); + const std::map& GetTopic() const; + + void AppendPublisher(const DdsPublisherParameter& publisher); + void SetPublisher(const std::vector& publisher); + const std::vector& GetPublisher() const; + + void AppendSubscriber(const DdsSubscriberParameter& subscriber); + void SetSubscriber(const std::vector& subscriber); + const std::vector& GetSubscriber() const; + + const DdsQosParameter& GetParticipantQos() const; + const DdsQosParameter& GetTopicQos() const; + const DdsQosParameter& GetPublisherQos() const; + const DdsQosParameter& GetSubscriberQos() const; + const DdsQosParameter& GetWriterQos() const; + const DdsQosParameter& GetReaderQos() const; + +private: + uint32_t mDomainId; + std::string mConfig; + + DdsQosParameter mParticipantQos; + DdsQosParameter mTopicQos; + DdsQosParameter mPublisherQos; + DdsQosParameter mSubscriberQos; + DdsQosParameter mWriterQos; + DdsQosParameter mReaderQos; + + DdsParticipantParameter mParticipant; + std::map mTopic; + std::vector mPublisher; + std::vector mSubscriber; + +}; + +} +} +#endif//__UT_DDS_PARAMETER_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_qos.hpp b/unitree_SDK/include/unitree/common/dds/dds_qos.hpp new file mode 100644 index 0000000..b4038ea --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_qos.hpp @@ -0,0 +1,71 @@ +#ifndef __UT_DDS_QOS_HPP__ +#define __UT_DDS_QOS_HPP__ + +#include + +using namespace org::eclipse::cyclonedds; + +namespace unitree +{ +namespace common +{ +#define UT_DECL_DDS_QOS(QosType, QosNative) \ +class QosType: public QosNative \ +{ \ +public: \ + using NativeQosType = QosNative::NativeType; \ + explicit QosType() \ + { \ + InitPolicyDefault(); \ + } \ + template \ + void SetPolicy(const POLICY& policy) \ + { \ + mNative.policy(policy.GetNative()); \ + mPolicyNameSet.insert(policy.GetName()); \ + } \ + bool HasPolicy(const std::string& name) const \ + { \ + return mPolicyNameSet.find(name) != mPolicyNameSet.end(); \ + } \ + void CopyToNativeQos(NativeQosType& qos) const; \ +private: \ + void InitPolicyDefault(); \ +private: \ + std::set mPolicyNameSet; \ +}; + +/* + * DdsParticipantQos + */ +UT_DECL_DDS_QOS(DdsParticipantQos, DdsNative<::dds::domain::qos::DomainParticipantQos>) + +/* + * DdsTopicQos + */ +UT_DECL_DDS_QOS(DdsTopicQos, DdsNative<::dds::topic::qos::TopicQos>) + +/* + * DdsPublisherQos + */ +UT_DECL_DDS_QOS(DdsPublisherQos, DdsNative<::dds::pub::qos::PublisherQos>) + +/* + * DdsSubscriberQos + */ +UT_DECL_DDS_QOS(DdsSubscriberQos, DdsNative<::dds::sub::qos::SubscriberQos>) + +/* + * DdsWriterQos + */ +UT_DECL_DDS_QOS(DdsWriterQos, DdsNative<::dds::pub::qos::DataWriterQos>) + +/* + * DdsReaderQos + */ +UT_DECL_DDS_QOS(DdsReaderQos, DdsNative<::dds::sub::qos::DataReaderQos>) + +} +} + +#endif//__UT_DDS_QOS_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_qos_parameter.hpp b/unitree_SDK/include/unitree/common/dds/dds_qos_parameter.hpp new file mode 100644 index 0000000..bffa714 --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_qos_parameter.hpp @@ -0,0 +1,81 @@ +#ifndef __UT_DDS_QOS_PARAMETER_HPP__ +#define __UT_DDS_QOS_PARAMETER_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +class DdsQosParameter +{ +public: + DdsQosParameter(); + ~DdsQosParameter(); + + void Init(const JsonMap& data); + +#define __GET_POLICY(POLICY) \ + const DdsQos##POLICY##PolicyParameter& Get##POLICY() const \ + { \ + return m##POLICY; \ + } + + __GET_POLICY(Deadline) + __GET_POLICY(DestinationOrder) + __GET_POLICY(Durability) + __GET_POLICY(DurabilityService) + __GET_POLICY(EntityFactory) + __GET_POLICY(GroupData) + __GET_POLICY(History) + __GET_POLICY(LatencyBudget) + __GET_POLICY(Lifespan) + __GET_POLICY(Liveliness) + __GET_POLICY(Ownership) + __GET_POLICY(OwnershipStrength) + __GET_POLICY(Partition) + __GET_POLICY(Presentation) + __GET_POLICY(ReaderDataLifecycle) + __GET_POLICY(Reliability) + __GET_POLICY(ResourceLimits) + __GET_POLICY(TimeBasedFilter) + __GET_POLICY(TopicData) + __GET_POLICY(TransportPriority) + __GET_POLICY(WriterDataLifecycle) + __GET_POLICY(UserData) + +#undef __GET_POLICY + + bool Default() const; + +private: + bool mDefault; + + DdsQosDeadlinePolicyParameter mDeadline; + DdsQosDestinationOrderPolicyParameter mDestinationOrder; + DdsQosDurabilityPolicyParameter mDurability; + DdsQosDurabilityServicePolicyParameter mDurabilityService; + DdsQosEntityFactoryPolicyParameter mEntityFactory; + DdsQosGroupDataPolicyParameter mGroupData; + DdsQosHistoryPolicyParameter mHistory; + DdsQosLatencyBudgetPolicyParameter mLatencyBudget; + DdsQosLifespanPolicyParameter mLifespan; + DdsQosLivelinessPolicyParameter mLiveliness; + DdsQosOwnershipPolicyParameter mOwnership; + DdsQosOwnershipStrengthPolicyParameter mOwnershipStrength; + DdsQosPartitionPolicyParameter mPartition; + DdsQosPresentationPolicyParameter mPresentation; + DdsQosReaderDataLifecyclePolicyParameter mReaderDataLifecycle; + DdsQosReliabilityPolicyParameter mReliability; + DdsQosResourceLimitsPolicyParameter mResourceLimits; + DdsQosTimeBasedFilterPolicyParameter mTimeBasedFilter; + DdsQosTopicDataPolicyParameter mTopicData; + DdsQosTransportPriorityPolicyParameter mTransportPriority; + DdsQosWriterDataLifecyclePolicyParameter mWriterDataLifecycle; + DdsQosUserDataPolicyParameter mUserData; +}; + +} +} + +#endif//__UT_DDS_QOS_PARAMETER_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_qos_policy.hpp b/unitree_SDK/include/unitree/common/dds/dds_qos_policy.hpp new file mode 100644 index 0000000..b4c90c3 --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_qos_policy.hpp @@ -0,0 +1,195 @@ +#ifndef __UT_DDS_QOS_POLICY_HPP__ +#define __UT_DDS_QOS_POLICY_HPP__ + +#include +#include + +namespace unitree +{ +namespace common +{ +class DdsQosPolicyName +{ +public: + explicit DdsQosPolicyName(const std::string& name) : + mName(name) + {} + + virtual ~DdsQosPolicyName() + {} + + const std::string& GetName() const + { + return mName; + } + +protected: + std::string mName; +}; + +class DdsDuration : public DdsNative<::dds::core::Duration> +{ +public: + explicit DdsDuration(int64_t nanoSecond); + ~DdsDuration(); +}; + +class DdsQosDeadlinePolicy : public DdsNative<::dds::core::policy::Deadline>, public DdsQosPolicyName +{ +public: + explicit DdsQosDeadlinePolicy(int64_t period); + ~DdsQosDeadlinePolicy(); +}; + +class DdsQosDestinationOrderPolicy : public DdsNative<::dds::core::policy::DestinationOrder>, public DdsQosPolicyName +{ +public: + explicit DdsQosDestinationOrderPolicy(int32_t kind); + ~DdsQosDestinationOrderPolicy(); +}; + +class DdsQosDurabilityPolicy : public DdsNative<::dds::core::policy::Durability>, public DdsQosPolicyName +{ +public: + explicit DdsQosDurabilityPolicy(int32_t kind); + ~DdsQosDurabilityPolicy(); +}; + +class DdsQosDurabilityServicePolicy : public DdsNative<::dds::core::policy::DurabilityService>, public DdsQosPolicyName +{ +public: + explicit DdsQosDurabilityServicePolicy(int64_t cleanupDelay, int32_t historyKind, int32_t historyDepth, + int32_t maxSamples, int32_t maxInstances, int32_t maxSamplesPerInstance); + ~DdsQosDurabilityServicePolicy(); +}; + +class DdsQosEntityFactoryPolicy : public DdsNative<::dds::core::policy::EntityFactory>, public DdsQosPolicyName +{ +public: + explicit DdsQosEntityFactoryPolicy(bool autoEnable); + ~DdsQosEntityFactoryPolicy(); +}; + +class DdsQosGroupDataPolicy : public DdsNative<::dds::core::policy::GroupData>, public DdsQosPolicyName +{ +public: + explicit DdsQosGroupDataPolicy(const std::vector& value); + ~DdsQosGroupDataPolicy(); +}; + +class DdsQosHistoryPolicy : public DdsNative<::dds::core::policy::History>, public DdsQosPolicyName +{ +public: + explicit DdsQosHistoryPolicy(int32_t kind, int32_t depth); + ~DdsQosHistoryPolicy(); +}; + +class DdsQosLatencyBudgetPolicy : public DdsNative<::dds::core::policy::LatencyBudget>, public DdsQosPolicyName +{ +public: + explicit DdsQosLatencyBudgetPolicy(int64_t duration); + ~DdsQosLatencyBudgetPolicy(); +}; + +class DdsQosLifespanPolicy : public DdsNative<::dds::core::policy::Lifespan>, public DdsQosPolicyName +{ +public: + explicit DdsQosLifespanPolicy(int64_t duration); + ~DdsQosLifespanPolicy(); +}; + +class DdsQosLivelinessPolicy : public DdsNative<::dds::core::policy::Liveliness>, public DdsQosPolicyName +{ +public: + explicit DdsQosLivelinessPolicy(int32_t kind, int64_t leaseDuration); + ~DdsQosLivelinessPolicy(); +}; + +class DdsQosOwnershipPolicy : public DdsNative<::dds::core::policy::Ownership>, public DdsQosPolicyName +{ +public: + explicit DdsQosOwnershipPolicy(int32_t kind); + ~DdsQosOwnershipPolicy(); +}; + +class DdsQosOwnershipStrengthPolicy : public DdsNative<::dds::core::policy::OwnershipStrength>, public DdsQosPolicyName +{ +public: + explicit DdsQosOwnershipStrengthPolicy(int32_t strength); + ~DdsQosOwnershipStrengthPolicy(); +}; + +class DdsQosPartitionPolicy : public DdsNative<::dds::core::policy::Partition>, public DdsQosPolicyName +{ +public: + explicit DdsQosPartitionPolicy(const std::string& name); + ~DdsQosPartitionPolicy(); +}; + +class DdsQosPresentationPolicy : public DdsNative<::dds::core::policy::Presentation>, public DdsQosPolicyName +{ +public: + explicit DdsQosPresentationPolicy(int32_t accessScopeKind, bool coherentAccess, bool orderedAccess); + ~DdsQosPresentationPolicy(); +}; + +class DdsQosReaderDataLifecyclePolicy : public DdsNative<::dds::core::policy::ReaderDataLifecycle>, public DdsQosPolicyName +{ +public: + explicit DdsQosReaderDataLifecyclePolicy(int64_t autopurgeNowriterSamplesDelay, int64_t autopurgeDisposedSamplesDelay); + ~DdsQosReaderDataLifecyclePolicy(); +}; + +class DdsQosReliabilityPolicy : public DdsNative<::dds::core::policy::Reliability>, public DdsQosPolicyName +{ +public: + explicit DdsQosReliabilityPolicy(int32_t kind, int64_t maxBlockingTime); + ~DdsQosReliabilityPolicy(); +}; + +class DdsQosResourceLimitsPolicy : public DdsNative<::dds::core::policy::ResourceLimits>, public DdsQosPolicyName +{ +public: + explicit DdsQosResourceLimitsPolicy(int32_t maxSamples, int32_t maxInstances, int32_t maxSamplesPerInstance); + ~DdsQosResourceLimitsPolicy(); +}; + +class DdsQosTimeBasedFilterPolicy : public DdsNative<::dds::core::policy::TimeBasedFilter>, public DdsQosPolicyName +{ +public: + explicit DdsQosTimeBasedFilterPolicy(int64_t minSep); + ~DdsQosTimeBasedFilterPolicy(); +}; + +class DdsQosTopicDataPolicy : public DdsNative<::dds::core::policy::TopicData>, public DdsQosPolicyName +{ +public: + explicit DdsQosTopicDataPolicy(const std::vector& value); + ~DdsQosTopicDataPolicy(); +}; + +class DdsQosTransportPriorityPolicy : public DdsNative<::dds::core::policy::TransportPriority>, public DdsQosPolicyName +{ +public: + explicit DdsQosTransportPriorityPolicy(int32_t value); + ~DdsQosTransportPriorityPolicy(); +}; + +class DdsQosWriterDataLifecyclePolicy : public DdsNative<::dds::core::policy::WriterDataLifecycle>, public DdsQosPolicyName +{ +public: + explicit DdsQosWriterDataLifecyclePolicy(bool autodisposeUnregisteredInstances); + ~DdsQosWriterDataLifecyclePolicy(); +}; + +class DdsQosUserDataPolicy : public DdsNative<::dds::core::policy::UserData>, public DdsQosPolicyName +{ +public: + explicit DdsQosUserDataPolicy(const std::vector& value); + ~DdsQosUserDataPolicy(); +}; + +} +} + +#endif//__UT_DDS_QOS_POLICY_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_qos_policy_parameter.hpp b/unitree_SDK/include/unitree/common/dds/dds_qos_policy_parameter.hpp new file mode 100644 index 0000000..60bb068 --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_qos_policy_parameter.hpp @@ -0,0 +1,607 @@ +#ifndef __UT_DDS_QOS_POLICY_PARAMETER_HPP__ +#define __UT_DDS_QOS_POLICY_PARAMETER_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +/* + *---------------------------- + * Supported Qos policy: + * 1. Deadline + * IDL: + * struct DeadlineQosPolicy { + * Duration_t period; + * }; + * + * 2. DestinationOrder + * IDL: + * enum DestinationOrderQosPolicyKind { + * BY_RECEPTION_TIMESTAMP_DESTINATIONORDER_QOS, + * BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS + * }; + * struct DestinationOrderQosPolicy { + * DestinationOrderQosPolicyKind kind; + * }; + * + * 3. Durability + * IDL: + * enum DurabilityQosPolicyKind { + * VOLATILE_DURABILITY_QOS, // Least Durability + * TRANSIENT_LOCAL_DURABILITY_QOS, + * TRANSIENT_DURABILITY_QOS, + * PERSISTENT_DURABILITY_QOS // Greatest Durability + * }; + * struct DurabilityQosPolicy { + * DurabilityQosPolicyKind kind; + * }; + * + * 4. DurabilityService + * IDL: + * struct DurabilityServiceQosPolicy { + * Duration_t service_cleanup_delay; + * HistoryQosPolicyKind history_kind; + * long history_depth; + * long max_samples; + * long max_instances; + * long max_samples_per_instance; + * }; + * + * 5. EntityFactory + * IDL: + * struct EntityFactoryQosPolicy { + * boolean autoenable_created_entities; + * }; + * + * 6. GroupData + * IDL: + * struct GroupDataQosPolicy { + * sequence value; + * }; + * + * 7. History + * IDL: + * enum HistoryQosPolicyKind { + * KEEP_LAST_HISTORY_QOS, + * KEEP_ALL_HISTORY_QOS + * }; + * struct HistoryQosPolicy { + * HistoryQosPolicyKind kind; + * long depth; + * }; + * 8. LatencyBudget + * IDL: + * struct LatencyBudgetQosPolicy { + * Duration_t duration; + * }; + * + * 9. Lifespan + * IDL: + * struct LifespanQosPolicy { + * Duration_t duration; + * } + * + * 10.Liveliness + * IDL: + * enum LivelinessQosPolicyKind { + * AUTOMATIC_LIVELINESS_QOS, + * MANUAL_BY_PARTICIPANT_LIVELINESS_QOS, + * MANUAL_BY_TOPIC_LIVELINESS_QOS + * }; + * struct LivelinessQosPolicy { + * LivelinessQosPolicyKind kind; + * Duration_t lease_duration; + * }; + * + * 11.Ownership + * IDL: + * enum OwnershipQosPolicyKind { + * SHARED_OWNERSHIP_QOS, + * EXCLUSIVE_OWNERSHIP_QOS + * }; + * struct OwnershipQosPolicy { + * OwnershipQosPolicyKind kind; + * }; + * + * 12.OwnershipStrength + * IDL: + * struct OwnershipStrengthQosPolicy { + * long value; + * }; + * + * 13.Partition + * IDL: + * struct PartitionQosPolicy { + * StringSeq name; + * }; + * + * 14.Presentation + * IDL: + * enum PresentationQosPolicyAccessScopeKind { + * INSTANCE_PRESENTATION_QOS, + * TOPIC_PRESENTATION_QOS, + * GROUP_PRESENTATION_QOS + * }; + * struct PresentationQosPolicy { + * PresentationQosPolicyAccessScopeKind access_scope; + * boolean coherent_access; + * boolean ordered_access; + * }; + * + * 15.ReaderDataLifecycle + * IDL: + * struct ReaderDataLifecycleQosPolicy { + * Duration_t autopurge_nowriter_samples_delay; + * Duration_t autopurge_disposed_samples_delay; + * }; + * + * 16.Reliability + * IDL: + * enum ReliabilityQosPolicyKind { + * BEST_EFFORT_RELIABILITY_QOS, + * RELIABLE_RELIABILITY_QOS + * }; + * struct ReliabilityQosPolicy { + * ReliabilityQosPolicyKind kind; + * Duration_t max_blocking_time; + * }; + * 17.ResourceLimits + * IDL: + * struct ResourceLimitsQosPolicy { + * long max_samples; + * long max_instances; + * long max_samples_per_instance; + * }; + * + * 18.TimeBasedFilter + * IDL: + * struct TimeBasedFilterQosPolicy { + * Duration_t minimum_separation; + * }; + * + * 19.TopicData + * IDL: + * struct TopicDataQosPolicy { + * sequence value; + * }; + * + * 20.TransportPriority + * IDL: + * struct TransportPriorityQosPolicy { + * long value; + * }; + * + * 21.UserData + * IDL: + * struct UserDataQosPolicy { + * sequence value; + * }; + * + * 22.WriterDataLifecycle + * IDL: + * struct WriterDataLifecycleQosPolicy { + * boolean autodispose_unregistered_instances; + * }; + * + *------------------------------------------------------------------------------------------------- + * QoS policis corresponding to entity: + * DomainParticipant: [2] { EntityFactory, UserData } + * Topic: [13] { Deadline, DestinationOrder, Durability, DurabilityService, History, + * LatencyBudget, Lifespan, Liveliness, Ownership, Reliability, + * ResourceLimits, TopicData, TransportPriority } + * Publisher: [4] { EntityFactory, GroupData, Partition, Presentation } + * Subscriber: [4] { EntityFactory, GroupData, Partition, Presentation } + * DataWriter: [14] { Deadline, DestinationOrder, Durability, History, LatencyBudget, + * Lifespan, Liveliness, Ownership, OwnershipStrength, Reliability, + * ResourceLimits, TransportPriority, UserData, WriterDataLifecycle } + * DataReader: [12] { Deadline, DestinationOrder, Durability, History, LatencyBudget + * Liveliness, Ownership, Reliability, ReaderDataLifecycle, ResourceLimits, + * TimeBasedFilter, UserData } + *------------------------------------------------------------------------------------------------- + */ + +/* + * Qos policy name + */ +#define UT_DDS_QOS_POLICY_NAME_DEADLINE "Deadline" +#define UT_DDS_QOS_POLICY_NAME_DESTINATION_ORDER "DestinationOrder" +#define UT_DDS_QOS_POLICY_NAME_DURABILITY "Durability" +#define UT_DDS_QOS_POLICY_NAME_DURABILITY_SERVICE "DurabilityService" +#define UT_DDS_QOS_POLICY_NAME_ENTITY_FACTORY "EntityFactory" +#define UT_DDS_QOS_POLICY_NAME_GROUP_DATA "GroupData" +#define UT_DDS_QOS_POLICY_NAME_HISTORY "History" +#define UT_DDS_QOS_POLICY_NAME_LATENCY_BUDGET "LatencyBudget" +#define UT_DDS_QOS_POLICY_NAME_LIFESPAN "Lifespan" +#define UT_DDS_QOS_POLICY_NAME_LIVELINESS "Liveliness" +#define UT_DDS_QOS_POLICY_NAME_OWNERSHIP "Ownership" +#define UT_DDS_QOS_POLICY_NAME_OWNERSHIP_STRENGTH "OwnershipStrength" +#define UT_DDS_QOS_POLICY_NAME_PARTITION "Partition" +#define UT_DDS_QOS_POLICY_NAME_PRESENTATION "Presentation" +#define UT_DDS_QOS_POLICY_NAME_READER_DATA_LIFECYCLE "ReaderDataLifecycle" +#define UT_DDS_QOS_POLICY_NAME_RELIABILITY "Reliability" +#define UT_DDS_QOS_POLICY_NAME_RESOURCE_LIMITS "ResourceLimits" +#define UT_DDS_QOS_POLICY_NAME_TIME_BASED_FILTER "TimeBasedFilter" +#define UT_DDS_QOS_POLICY_NAME_TOPIC_DATA "TopicData" +#define UT_DDS_QOS_POLICY_NAME_TRANSPORT_PRIORITY "TransportPriority" +#define UT_DDS_QOS_POLICY_NAME_WRITER_DATA_LIFECYCLE "WriterDataLifecycle" +#define UT_DDS_QOS_POLICY_NAME_USER_DATA "UserData" + +/* + * Qos Policy Member Name + */ +#define UT_DDS_QOS_POLICY_MEMBER_NAME_KIND "kind" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_PEROID "peroid" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_CLEANUP_DELAY "service_cleanup_delay" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_HISTORY_KIND "history_kind" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_HISTORY_DEPTH "history_depth" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_MAX_SAMPLES "max_samples" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_MAX_INSTANCES "max_instances" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_MAX_SAMPLES_PER_INSTANCE "max_samples_per_instance" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_AUTO_ENABLE "autoenable_created_entities" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_VALUE "value" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_DEPTH "depth" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_DURATION "duration" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_LEASE_DURATION "lease_duration" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_NAME "name" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_ACCESS_SCOPE "access_scope" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_COHERENT_ACCESS "coherent_access" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_ORDERED_ACCESS "ordered_access" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_MAX_BLOCKING_TIME "max_blocking_time" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_AUTODISPOSE_UNREGISETED_INSTANCES "autodispose_unregistered_instances" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_AUTOPURGE_NOWRITER_SAMPLES_DELAY "autopurge_nowriter_samples_delay" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_AUTOPURGE_DISPOSED_SAMPLES_DELAY "autopurge_disposed_samples_delay" +#define UT_DDS_QOS_POLICY_MEMBER_NAME_MIN_SEP "minimum_separation" + +class DdsQosPolicyParameter +{ +public: + DdsQosPolicyParameter(); + virtual ~DdsQosPolicyParameter(); + + virtual void Init(const JsonMap& data) = 0; + + void Update(); + bool Default() const; + +protected: + bool mDefault; +}; + +class DdsQosDeadlinePolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosDeadlinePolicyParameter(); + ~DdsQosDeadlinePolicyParameter(); + + void Init(const JsonMap& data); + int64_t GetPeriod() const; + +private: + int64_t mPeriod; +}; + +class DdsQosDestinationOrderPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosDestinationOrderPolicyParameter(); + ~DdsQosDestinationOrderPolicyParameter(); + + void Init(const JsonMap& data); + + int32_t GetKind() const; + +private: + int32_t mKind; +}; + +class DdsQosDurabilityPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosDurabilityPolicyParameter(); + ~DdsQosDurabilityPolicyParameter(); + + void Init(const JsonMap& data); + + int32_t GetKind() const; + +private: + int32_t mKind; +}; + +class DdsQosDurabilityServicePolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosDurabilityServicePolicyParameter(); + ~DdsQosDurabilityServicePolicyParameter(); + + void Init(const JsonMap& data); + + int64_t GetCleanupDelay() const; + int32_t GetHistoryKind() const; + int32_t GetHistoryDepth() const; + int32_t GetMaxSamples() const; + int32_t GetMaxInstances() const; + int32_t GetMaxSamplesPerInstance() const; + +private: + int64_t mCleanupDelay; + int32_t mHistoryKind; + int32_t mHistoryDepth; + int32_t mMaxSamples; + int32_t mMaxInstances; + int32_t mMaxSamplesPerInstance; +}; + +class DdsQosEntityFactoryPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosEntityFactoryPolicyParameter(); + ~DdsQosEntityFactoryPolicyParameter(); + + void Init(const JsonMap& data); + + int64_t GetAutoEnable() const; + +private: + bool mAutoEnable; +}; + +class DdsQosGroupDataPolicyParameter: public DdsQosPolicyParameter +{ +public: + DdsQosGroupDataPolicyParameter(); + ~DdsQosGroupDataPolicyParameter(); + + void Init(const JsonMap& data); + const std::vector& GetValue() const; + +private: + std::vector mValue; +}; + +class DdsQosHistoryPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosHistoryPolicyParameter(); + ~DdsQosHistoryPolicyParameter(); + + void Init(const JsonMap& data); + + int32_t GetKind() const; + int32_t GetDepth() const; + +private: + int32_t mKind; + int32_t mDepth; +}; + +class DdsQosLatencyBudgetPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosLatencyBudgetPolicyParameter(); + ~DdsQosLatencyBudgetPolicyParameter(); + + void Init(const JsonMap& data); + + int64_t GetDuration() const; + +private: + int64_t mDuration; +}; + +class DdsQosLifespanPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosLifespanPolicyParameter(); + ~DdsQosLifespanPolicyParameter(); + + void Init(const JsonMap& data); + + int64_t GetDuration() const; + +private: + int64_t mDuration; +}; + +class DdsQosLivelinessPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosLivelinessPolicyParameter(); + ~DdsQosLivelinessPolicyParameter(); + + void Init(const JsonMap& data); + + int32_t GetKind() const; + int64_t GetLeaseDuration() const; + +private: + int32_t mKind; + int64_t mLeaseDuration; +}; + +class DdsQosOwnershipPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosOwnershipPolicyParameter(); + ~DdsQosOwnershipPolicyParameter(); + + void Init(const JsonMap& data); + + int32_t GetKind() const; + +private: + int32_t mKind; +}; + +class DdsQosOwnershipStrengthPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosOwnershipStrengthPolicyParameter(); + ~DdsQosOwnershipStrengthPolicyParameter(); + + void Init(const JsonMap& data); + + int32_t GetValue() const; + +private: + int32_t mValue; +}; + +class DdsQosPartitionPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosPartitionPolicyParameter(); + ~DdsQosPartitionPolicyParameter(); + + void Init(const JsonMap& data); + + const std::string& GetName() const; + +private: + std::string mName; +}; + +class DdsQosPresentationPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosPresentationPolicyParameter(); + ~DdsQosPresentationPolicyParameter(); + + void Init(const JsonMap& data); + + int32_t GetAccessScopeKind() const; + bool GetCoherentAccess() const; + bool GetOrderedAccess() const; + +private: + int32_t mAccessScopeKind; + bool mCoherentAccess; + bool mOrderedAccess; +}; + +class DdsQosReaderDataLifecyclePolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosReaderDataLifecyclePolicyParameter(); + ~DdsQosReaderDataLifecyclePolicyParameter(); + + void Init(const JsonMap& data); + + int64_t GetAutopurgeNowriterSamplesDelay() const; + int64_t GetAutopurgeDisposedSamplesDelay() const; + +private: + int64_t mAutopurgeNowriterSamplesDelay; + int64_t mAutopurgeDisposedSamplesDelay; +}; + +class DdsQosReliabilityPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosReliabilityPolicyParameter(); + ~DdsQosReliabilityPolicyParameter(); + + void Init(const JsonMap& data); + + int32_t GetKind() const; + int64_t GetMaxBlockingTime() const; + +private: + int32_t mKind; + int64_t mMaxBlockingTime; +}; + +class DdsQosResourceLimitsPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosResourceLimitsPolicyParameter(); + ~DdsQosResourceLimitsPolicyParameter(); + + void Init(const JsonMap& data); + + int32_t GetMaxSamples() const; + int32_t GetMaxInstances() const; + int32_t GetMaxSamplesPerInstance() const; + +private: + int32_t mMaxSamples; + int32_t mMaxInstances; + int32_t mMaxSamplesPerInstance; +}; + +class DdsQosTimeBasedFilterPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosTimeBasedFilterPolicyParameter(); + ~DdsQosTimeBasedFilterPolicyParameter(); + + void Init(const JsonMap& data); + + int64_t GetMinSep() const; + +private: + int64_t mMinSep; +}; + +class DdsQosTopicDataPolicyParameter: public DdsQosPolicyParameter +{ +public: + DdsQosTopicDataPolicyParameter(); + ~DdsQosTopicDataPolicyParameter(); + + void Init(const JsonMap& data); + + const std::vector& GetValue() const; + +private: + std::vector mValue; +}; + +class DdsQosTransportPriorityPolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosTransportPriorityPolicyParameter(); + ~DdsQosTransportPriorityPolicyParameter(); + + void Init(const JsonMap& data); + + int32_t GetValue() const; + +private: + int32_t mValue; +}; + +class DdsQosWriterDataLifecyclePolicyParameter : public DdsQosPolicyParameter +{ +public: + DdsQosWriterDataLifecyclePolicyParameter(); + ~DdsQosWriterDataLifecyclePolicyParameter(); + + void Init(const JsonMap& data); + + bool GetAutodisposeUnregisteredInstances() const; + +private: + bool mAutodisposeUnregisteredInstances; +}; + +class DdsQosUserDataPolicyParameter: public DdsQosPolicyParameter +{ +public: + DdsQosUserDataPolicyParameter(); + ~DdsQosUserDataPolicyParameter(); + + void Init(const JsonMap& data); + + const std::vector& GetValue() const; + +private: + std::vector mValue; +}; + +} +} + +#endif//__UT_DDS_QOS_POLICY_PARAMETER_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_qos_realize.hpp b/unitree_SDK/include/unitree/common/dds/dds_qos_realize.hpp new file mode 100644 index 0000000..16a15ea --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_qos_realize.hpp @@ -0,0 +1,26 @@ +#ifndef __UT_DDS_QOS_REALIZE_HPP__ +#define __UT_DDS_QOS_REALIZE_HPP__ + +#include +#include + +namespace unitree +{ +namespace common +{ +void Realize(const DdsQosParameter& parameter, DdsParticipantQos& qos); + +void Realize(const DdsQosParameter& parameter, DdsTopicQos& qos); + +void Realize(const DdsQosParameter& parameter, DdsPublisherQos& qos); + +void Realize(const DdsQosParameter& parameter, DdsSubscriberQos& qos); + +void Realize(const DdsQosParameter& parameter, DdsWriterQos& qos); + +void Realize(const DdsQosParameter& parameter, DdsReaderQos& qos); + +} +} + +#endif//__UT_DDS_QOS_REALIZE_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_topic_channel.hpp b/unitree_SDK/include/unitree/common/dds/dds_topic_channel.hpp new file mode 100644 index 0000000..dd8a61a --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_topic_channel.hpp @@ -0,0 +1,96 @@ +#ifndef __UT_DDS_TOPIC_CHANNEL_HPP__ +#define __UT_DDS_TOPIC_CHANNEL_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +/* + * @brief: DdsTopicChannelAbstract + */ +class DdsTopicChannelAbstract +{ +public: + virtual bool Write(const void* message, int64_t waitMicrosec) = 0; + virtual int64_t GetLastDataAvailableTime() const = 0; +}; + +using DdsTopicChannelAbstractPtr = std::shared_ptr; + +#define UT_DDS_WAIT_MATCHED_TIME_MICRO_SEC 100000 + +/* + * @brief: DdsTopicChannel + */ +template +class DdsTopicChannel : public DdsTopicChannelAbstract +{ +public: + explicit DdsTopicChannel() + {} + + ~DdsTopicChannel() + {} + + void SetTopic(const DdsParticipantPtr& participant, const std::string& name, const DdsTopicQos& qos) + { + mTopic = DdsTopicPtr(new DdsTopic(participant, name, qos)); + } + + void SetWriter(const DdsPublisherPtr& publisher, const DdsWriterQos& qos) + { + mWriter = DdsWriterPtr(new DdsWriter(publisher, mTopic, qos)); + MicroSleep(UT_DDS_WAIT_MATCHED_TIME_MICRO_SEC); + } + + void SetReader(const DdsSubscriberPtr& subscriber, const DdsReaderQos& qos, const DdsReaderCallback& cb, int32_t queuelen) + { + mReader = DdsReaderPtr(new DdsReader(subscriber, mTopic, qos)); + mReader->SetListener(cb, queuelen); + } + + DdsWriterPtr GetWriter() const + { + return mWriter; + } + + DdsReaderPtr GetReader() const + { + return mReader; + } + + bool Write(const void* message, int64_t waitMicrosec) + { + return Write(*(const MSG*)message, waitMicrosec); + } + + bool Write(const MSG& message, int64_t waitMicrosec) + { + return mWriter->Write(message, waitMicrosec); + } + + int64_t GetLastDataAvailableTime() const + { + if (mReader) + { + return mReader->GetLastDataAvailableTime(); + } + + return 0; + } + +private: + DdsTopicPtr mTopic; + DdsWriterPtr mWriter; + DdsReaderPtr mReader; +}; + +template +using DdsTopicChannelPtr = std::shared_ptr>; + +} +} + +#endif//__UT_DDS_TOPIC_CHANNEL_HPP__ diff --git a/unitree_SDK/include/unitree/common/dds/dds_traits.hpp b/unitree_SDK/include/unitree/common/dds/dds_traits.hpp new file mode 100644 index 0000000..cf8e25f --- /dev/null +++ b/unitree_SDK/include/unitree/common/dds/dds_traits.hpp @@ -0,0 +1,18 @@ +#ifndef __UT_DDS_TRAINTS_HPP__ +#define __UT_DDS_TRAINTS_HPP__ + +namespace unitree +{ +namespace common +{ +#include + +#define DdsGetTypeName(TYPE) \ + org::eclipse::cyclonedds::topic::TopicTraits::getTypeName() + +#define DdsIsKeyless(TYPE) \ + org::eclipse::cyclonedds::topic::TopicTraits::isKeyless() + +} +} +#endif//__UT_DDS_TRAINTS_HPP__ diff --git a/unitree_SDK/include/unitree/common/decl.hpp b/unitree_SDK/include/unitree/common/decl.hpp new file mode 100644 index 0000000..5be87f9 --- /dev/null +++ b/unitree_SDK/include/unitree/common/decl.hpp @@ -0,0 +1,92 @@ +#ifndef __UT_DECL_HPP__ +#define __UT_DECL_HPP__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __GLIBC__ +#define UT_UNLIKELY(x) __builtin_expect(!!(x), 0) +#define UT_LIKELY(x) __builtin_expect(!!(x), 1) +#else +#define UT_UNLIKELY(x) (x) +#define UT_LIKELY(x) (x) +#endif//__GLIBC__ + +#define __UT_CAT(x, y) x##y +#define UT_CAT(x, y) __UT_CAT(x, y) + +#define __UT_STR(x) #x +#define UT_STR(x) __UT_STR(x) + +#define UT_QUEUE_MAX_LEN INT_MAX +#define UT_PATH_MAX_LEN 1024 +#define UT_THREAD_NAME_MAX_LEN 16 + +#define UT_DECL_ERR(name, code, desc) \ + const int32_t name = code; const std::string name##_DESC = desc; + +#define UT_DESC_ERR(name) name##_DESC + +#ifndef SYS_gettid +#define SYS_gettid __NR_gettid +#endif//SYS_gettid + +#define UT_SAFE_DEL(x) \ + if ((x) != NULL) { delete (x); (x) = NULL; } + +namespace unitree +{ +namespace common +{ +static const std::string UT_EMPTY_STR = ""; +} +} + +#endif//__UT_DECL_HPP__ diff --git a/unitree_SDK/include/unitree/common/error.hpp b/unitree_SDK/include/unitree/common/error.hpp new file mode 100644 index 0000000..7bff1ef --- /dev/null +++ b/unitree_SDK/include/unitree/common/error.hpp @@ -0,0 +1,25 @@ +#ifndef __UT_ERROR_HPP__ +#define __UT_ERROR_HPP__ + +#include + +namespace unitree +{ +//Declare error +UT_DECL_ERR(UT_OK, 0, "Success") +UT_DECL_ERR(UT_ERR_COMMON, 1001, "common error") +UT_DECL_ERR(UT_ERR_BADCAST, 1002, "Bad cast error") +UT_DECL_ERR(UT_ERR_FUTURE, 1003, "Future error") +UT_DECL_ERR(UT_ERR_FUTURE_FAULT,1004, "Future fault error") +UT_DECL_ERR(UT_ERR_JSON, 1005, "Json data error") +UT_DECL_ERR(UT_ERR_SYSTEM, 1006, "System error") +UT_DECL_ERR(UT_ERR_FILE, 1007, "File operation error") +UT_DECL_ERR(UT_ERR_SOCKET, 1008, "Socket operaton error") +UT_DECL_ERR(UT_ERR_IO, 1009, "IO operaton error") +UT_DECL_ERR(UT_ERR_LOCK, 1010, "Lock operation error") +UT_DECL_ERR(UT_ERR_NETWORK, 1011, "Network error") +UT_DECL_ERR(UT_ERR_TIMEOUT, 1012, "Timeout error") +UT_DECL_ERR(UT_ERR_UNKNOWN, -1, "Unknown error") +} + +#endif//__UT_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/common/exception.hpp b/unitree_SDK/include/unitree/common/exception.hpp new file mode 100644 index 0000000..4a97099 --- /dev/null +++ b/unitree_SDK/include/unitree/common/exception.hpp @@ -0,0 +1,203 @@ +#ifndef __UT_EXCEPTION_HPP__ +#define __UT_EXCEPTION_HPP__ + +#include + +#define UT_MAX_TRACE_ADDR_NUMBER 64 + +namespace unitree +{ +namespace common +{ +class Exception : public std::exception +{ +public: + Exception() throw() + : Exception(UT_ERR_UNKNOWN, UT_DESC_ERR(UT_ERR_UNKNOWN)) + {} + + Exception(int32_t code, const std::string& message) throw() + : mCode(code), mMessage(message), mLine(0) + {} + + virtual ~Exception() + {} + + int32_t GetCode() const + { + return mCode; + } + + const std::string& GetMessage() const + { + return mMessage; + } + + virtual const char* what() const noexcept + { + return mMessage.c_str(); + } + + virtual std::string GetClassName() const + { + return "Exception"; + } + + void Init(const char* file, const char* func, int32_t line) + { + mFile = file; + mFunc = func; + mLine = line; + } + + std::string ToString() const + { + std::ostringstream os; + AddDetail(os); + + return os.str(); + } + + std::string StackTrace() const + { + std::ostringstream os; + AddDetail(os); + AddBackTrace(os); + + return os.str(); + } + +protected: + void AddDetail(std::ostringstream& os) const + { + os << "Catch " << GetClassName() << " code:" << mCode + << ", message:" << mMessage << std::endl; + + if (!mFile.empty() && !mFunc.empty() && mLine > 0) + { + os << " at __FILE__:" << mFile << ", __LINE__:" + << mLine << ", __FUNCTION__:" << mFunc << std::endl; + } + } + + void AddBackTrace(std::ostringstream& os) const + { + os << "Stack:" << std::endl; + + void* addr[UT_MAX_TRACE_ADDR_NUMBER]; + int32_t number = backtrace(addr, UT_MAX_TRACE_ADDR_NUMBER); + + char **info = backtrace_symbols(addr, number); + if(info == NULL) + { + return; + } + + for(int32_t i=0; i + +namespace unitree +{ +namespace common +{ +typedef std::pair DIRENT_INFO; +typedef std::pair SYMLNK_INFO; + +class Directory +{ +public: + Directory(); + Directory(const std::string& dirName); + + ~Directory(); + + void Open(); + void Open(const std::string& dirName); + + bool IsOpen(); + + void ListFile(std::vector& fileNameList, const std::string& regExpress); + void ListFile(std::vector& fileNameList, bool recurse = true, bool absolute = true); + + void ListDir(std::vector& dirNameList, bool recurse = true, bool absolute = true); + + void List(std::list& fileNameList, std::list& dirNameList, + std::list& symlinkList); + + void Cleanup(); + bool CopyTo(const std::string& dirName, bool deeply = false); + + void Close(); + +private: + void CheckOpen(); + void OpenInner(); + +private: + DIR *mDIR; + std::string mDirName; +}; + +typedef std::shared_ptr DirectoryPtr; + +bool ExistDirectory(const std::string& dirName); + +void CreateDirectory(const std::string& dirName, bool recurse = true, + uint32_t mode = UT_OPEN_MODE_RWX); + +void ListDirectory(const std::string& dirName, std::vector& fileNameList, + const std::string& regExpress); + +void ListDirectory(const std::string& dirName, std::vector& fileNameList, bool recurse = true, bool absolute = true); + +void ListChildDirectory(const std::string& dirName, std::vector& dirNameList, bool recurse = true, bool absolute = true); + +void RemoveDirectory(const std::string& dirName, bool recurse = true); + +void CopyDirectory(const std::string& dirName, const std::string& destDirName, bool deeply); + +} +} +#endif//__UT_DIRECTORY_HPP__ diff --git a/unitree_SDK/include/unitree/common/filesystem/file.hpp b/unitree_SDK/include/unitree/common/filesystem/file.hpp new file mode 100644 index 0000000..8ff7901 --- /dev/null +++ b/unitree_SDK/include/unitree/common/filesystem/file.hpp @@ -0,0 +1,127 @@ +#ifndef __UT_FILE_HPP__ +#define __UT_FILE_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +class File +{ +public: + File(); + File(const std::string& fileName); + File(const std::string& fileName, int32_t flag); + File(const std::string& fileName, int32_t flag, uint32_t mode); + + virtual ~File(); + + int32_t GetFd() const; + bool IsOpen() const; + + void Open(); + void Open(int32_t flag, uint32_t mode = UT_OPEN_MODE_NONE); + void Open(const std::string& fileName, int32_t flag = UT_OPEN_FLAG_R, + uint32_t mode = UT_OPEN_MODE_NONE); + + void Append(const char* s, int64_t len); + int64_t Write(const char* s, int64_t len); + int64_t Write(const std::string& s); + + int64_t Read(char* s, int64_t len); + int64_t Read(std::string& s, int64_t len); + int64_t ReadAll(std::string& s); + + void SeekBegin(); + void SeekEnd(); + void Seek(int64_t offset, int64_t whence); + + void Sync(); + void Truncate(int64_t len); + + void Close(); + + int64_t Size() const; + +private: + void CheckOpen(); + void OpenInner(); + +private: + std::string mFileName; + int32_t mFd; + int32_t mFlag; + uint32_t mMode; +}; + +typedef std::shared_ptr FilePtr; + +class MMReadFile +{ +public: + MMReadFile(); + MMReadFile(const std::string& fileName); + + virtual ~MMReadFile(); + + int32_t GetFd() const; + bool IsOpen() const; + + void Open(); + void Open(const std::string& fileName); + + int64_t Size() const; + int64_t Read(char* s, int64_t len); + int64_t Read(std::string& s, int64_t len); + int64_t ReadAll(std::string& s); + + void Seek(int64_t offset); + + void Close(); + +public: + void* MMRead(int64_t len, int64_t& canreadlen); + void MMClose(void* ptr, int64_t len); + +private: + void Init(); + +private: + std::string mFileName; + int32_t mFd; + int64_t mOffset; + int64_t mSize; +}; + +typedef std::shared_ptr MMReadFilePtr; + +//Functions +bool ExistFile(const std::string& fileName); + +std::string LoadFile(const std::string& fileName); +std::string LoadFileEx(const std::string& fileName); + +void SaveFile(const std::string& fileName, const char* s, int64_t len, + uint32_t mode = UT_OPEN_MODE_RW); + +void SaveFile(const std::string& fileName, const std::string& s, + uint32_t mode = UT_OPEN_MODE_RW); + +void AppendFile(const std::string& fileName, const char* s, int64_t len, + uint32_t mode = UT_OPEN_MODE_RW); + +void AppendFile(const std::string& fileName, const std::string& s, + uint32_t mode = UT_OPEN_MODE_RW); + +int64_t GetFileSize(const std::string& fileName); + +void RemoveFile(const std::string& fileName); + +int64_t MMLoadFile(const std::string& fileName, std::string& s); + +bool CopyFile(const std::string& fileName, const std::string& destFileName, bool deeply = false); +} +} + +#endif//__UT_FILE_HPP__ diff --git a/unitree_SDK/include/unitree/common/filesystem/filesystem.hpp b/unitree_SDK/include/unitree/common/filesystem/filesystem.hpp new file mode 100644 index 0000000..cd130a8 --- /dev/null +++ b/unitree_SDK/include/unitree/common/filesystem/filesystem.hpp @@ -0,0 +1,284 @@ +#ifndef __UT_FILE_SYSTEM_HPP__ +#define __UT_FILE_SYSTEM_HPP__ + +#include + +#define UT_FILE_READ_SIZE 65536 //64K +#define UT_FILE_READ_BIGGER_SIZE 262144 //256K + +#define UT_FD_INVALID -1 +#define UT_FD_STDIN STDIN_FILENO +#define UT_FD_STDOUT STDOUT_FILENO +#define UT_FD_STDERR STDERR_FILENO + +#define UT_PATH_DELIM_CHAR '/' +#define UT_PATH_DELIM_STR "/" +#define UT_PATH_TRIM_DELIM_STR " \t\r\n" + +#define NOT_FLAG(f, flag) \ + (((f) & (flag)) != (flag)) + +#define HAS_FLAG(f, flag) \ + (((f) & (flag)) == (flag)) + +#define SET_FLAG(f, flag) \ + (f) |= (flag) + +#define IS_RDONLY_FLAG(f) \ + ((f & O_ACCMODE) == O_RDONLY) + +namespace unitree +{ +namespace common +{ +enum +{ + UT_OPEN_FLAG_R = O_RDONLY, + UT_OPEN_FLAG_W = O_WRONLY, + UT_OPEN_FLAG_RW = O_RDWR, + UT_OPEN_FLAG_T = O_TRUNC, + UT_OPEN_FLAG_A = O_APPEND, + UT_OPEN_FLAG_S = O_SYNC, + UT_OPEN_FLAG_C = O_CREAT, + UT_OPEN_FLAG_CW = O_CREAT | O_WRONLY, + UT_OPEN_FLAG_CWT = O_CREAT | O_WRONLY | O_TRUNC, + UT_OPEN_FLAG_CA = O_CREAT | O_RDWR | O_APPEND, + UT_OPEN_FLAG_CS = O_CREAT | O_RDWR | O_SYNC, + UT_OPEN_FLAG_CAS = O_CREAT | O_RDWR | O_APPEND | O_SYNC, + UT_OPEN_FLAG_CTS = O_CREAT | O_RDWR | O_TRUNC | O_SYNC +}; + +enum +{ + UT_OPEN_MODE_NONE = 0, + UT_OPEN_MODE_RW = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, + UT_OPEN_MODE_RWX = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH +}; + +enum +{ + UT_OPEN_MASK_000 = 0, + UT_OPEN_MASK_022 = 0022 +}; + +typedef struct dirent DIRENT; + +/* + * FileSystemHelper + */ +class FileSystemHelper +{ +public: + static FileSystemHelper* Instance() + { + static FileSystemHelper inst; + return &inst; + } + + /* + * File Functions + */ + int32_t Open(const std::string& fileName, int32_t flag, uint32_t mode = 0); + + int64_t Write(int32_t fd, const char* s, int64_t len); + int64_t Write(int32_t fd, const std::string& s); + + int64_t Read(int32_t fd, char* s, int64_t len); + int64_t Read(int32_t fd, std::string& s, int64_t len); + int64_t ReadAll(int32_t fd, std::string& s); + + int64_t Seek(int32_t fd, int64_t offset, int64_t whence); + + bool Stat(int32_t fd, struct stat& statbuf); + void Truncate(int32_t fd, int64_t len); + void Sync(int32_t fd); + void Close(int32_t fd); + + /* + * Directory Functions + */ + DIR* Opendir(const std::string& dirName); + DIRENT* Readdir(DIR* dir); + void Closedir(DIR* dir); + + void Makedir(const std::string& dirName, uint32_t mode = UT_OPEN_MODE_RWX, + bool ignoreExist = true); + void MakedirRecurse(const std::string& dirName, uint32_t mode = UT_OPEN_MODE_RWX); + + /* + * stat Function + */ + bool Stat(const std::string& name, struct stat& statbuf); + bool StatL(const std::string& name, struct stat& statbuf); + bool IsFile(const struct stat& statbuf); + bool IsDirectory(const struct stat& statbuf); + bool IsSymlink(const struct stat& statbuf); + bool ExistFile(const std::string& name); + bool ExistDirectory(const std::string& name); + bool Exist(const std::string& name); + + int64_t GetFileSize(const std::string& fileName); + + /* + * Symlink Function + */ + std::string GetSymlink(const std::string& symlinkName); + bool Symlink(const std::string& targetFileName, const std::string& symlinkName); + + /* + * Remove and Rename Function + */ + void RemoveFile(const std::string& fileName, bool ignoreNoExist = true); + void RemoveDirectory(const std::string& dirName, bool ignoreNoExist = true); + + void Remove(const std::string& name, bool ignoreNoExist = true); + void Rename(const std::string& oldName, const std::string& newName); + + /* + * Path proccess Function + */ + std::string& NormalizePath(std::string& s, bool withEndDelim = true); + std::string GetFatherDirectory(const std::string& s, bool withEndDelim = true); + std::string GetFileName(const std::string& s); + std::string GetLastName(const std::string& s); + + /* + * Realpath + */ + std::string GetRealName(const std::string& name); + + bool IsSame(const std::string& name1, const std::string& name2); + + /* + * MMap Function + */ + void* MmapRead(int32_t fd, int64_t offset, int64_t len); + void Munmap(void *addr, int64_t len); + + /* + * Mode and Owner + */ + bool Chmod(const std::string& name, mode_t mode); + bool Chown(const std::string& name, uid_t uid, gid_t gid); + + bool ChmodL(const std::string& name, mode_t mode); + bool ChownL(const std::string& name, uid_t uid, gid_t gid); + + bool UTime(const std::string& name, struct utimbuf& times); + bool UTime(const std::string& name, struct timeval times[2]); + + bool Chattr(const std::string& name, const struct stat& statbuf); + + /* + * ParseModeString + * @param s: like "0755", "0666", "766" + * return mode + */ + uint32_t ParseModeString(const std::string& s); + +private: + FileSystemHelper(); + ~FileSystemHelper(); + +private: + int32_t mOldMask; +}; + +/* + * FDCloser + */ +class FDCloser +{ +public: + explicit FDCloser() : + mFd(UT_FD_INVALID) + {} + + explicit FDCloser(int32_t fd) : + mFd(fd) + {} + + ~FDCloser() + { + Close(); + } + + void SetFd(int32_t fd) + { + //close old fd + Close(); + //set new fd + mFd = fd; + } + +private: + void Close() + { + if (mFd > 0) + { + FileSystemHelper::Instance()->Close(mFd); + mFd = UT_FD_INVALID; + } + } + +private: + int32_t mFd; +}; + +/* + * DIRCloser + */ +class DIRCloser +{ +public: + explicit DIRCloser() : + mDIR(NULL) + {} + + explicit DIRCloser(DIR* dir) : + mDIR(dir) + {} + + ~DIRCloser() + { + Close(); + } + + void SetDir(DIR* dir) + { + //close old dir + Close(); + //set new dir + mDIR = dir; + } + +private: + void Close() + { + if (mDIR != NULL) + { + FileSystemHelper::Instance()->Closedir(mDIR); + mDIR = NULL; + } + } + +private: + DIR* mDIR; +}; + +//Function +void Remove(const std::string& name); +void Rename(const std::string& oldName, const std::string& newName); + +std::string NormalizePath(const std::string& s, bool withEndDelim = false); +std::string GetFatherDirectory(const std::string& s, bool withEndDelim = false); +std::string GetFileName(const std::string& s); +std::string GetLastName(const std::string& s); + +void Chattr(const std::string& name, const struct stat& statbuf); +void Copyattr(const std::string& name, const std::string& templateName); +} + +} + +#endif//__UT_FILE_SYSTEM_HPP__ diff --git a/unitree_SDK/include/unitree/common/json/json.hpp b/unitree_SDK/include/unitree/common/json/json.hpp new file mode 100644 index 0000000..adb5911 --- /dev/null +++ b/unitree_SDK/include/unitree/common/json/json.hpp @@ -0,0 +1,39 @@ +#ifndef __UT_JSON_HPP__ +#define __UT_JSON_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +typedef std::map JsonMap; +typedef std::vector JsonArray; + +Any FromJsonString(const std::string& s); + +std::string ToJsonString(const Any& a, bool pretty = false); + +static inline bool IsNull(const Any& a) +{ + return a.Empty(); +} + +static inline bool IsJsonArray(const Any& a) +{ + return a.GetTypeInfo() == typeid(JsonArray); +} + +static inline bool IsJsonMap(const Any& a) +{ + return a.GetTypeInfo() == typeid(JsonMap); +} + +static inline bool IsJsonObject(const Any& a) +{ + return IsJsonMap(a); +} + +} +} +#endif//__UT_JSON_HPP__ diff --git a/unitree_SDK/include/unitree/common/json/json_config.hpp b/unitree_SDK/include/unitree/common/json/json_config.hpp new file mode 100644 index 0000000..5955d22 --- /dev/null +++ b/unitree_SDK/include/unitree/common/json/json_config.hpp @@ -0,0 +1,194 @@ +#ifndef __UT_JSON_CONFIG_HPP__ +#define __UT_JSON_CONFIG_HPP__ + +#include + +#define UT_JSON_CONF_KEY_PARAMETER "Parameter" + +namespace unitree +{ +namespace common +{ +class JsonConfig +{ +public: + JsonConfig(); + virtual ~JsonConfig(); + + JsonConfig(const std::string& configFileName); + + virtual void Parse(const std::string& configFileName); + virtual void ParseContent(const std::string& content); + + //top-level field + bool Has(const std::string& name) const; + + //top-level field + const Any& Get(const std::string& name) const; + + //top-level field + template + const T& Get(const std::string& name) const + { + return AnyCast(Get(name)); + } + + //top-level field + template + T GetNumber(const std::string& name) const + { + return AnyNumberCast(Get(name)); + } + + //top-level field + template + T Get(const std::string& name, const T& defValue) const + { + const Any& a = Get(name); + + if (a.Empty()) + { + return defValue; + } + else + { + return AnyCast(a); + } + } + + //top-level field + template + T GetNumber(const std::string& name, const T& defValue) const + { + const Any& a = Get(name); + + if (a.Empty()) + { + return defValue; + } + else + { + return AnyNumberCast(a); + } + } + + //JsonMap field + bool Has(const JsonMap& jsonMap, const std::string& name) const; + + //JsonMap field + const Any& Get(const JsonMap& jsonMap, const std::string& name) const; + + //JsonMap field + template + const T& Get(const JsonMap& jsonMap, const std::string& name) const + { + return AnyCast(Get(jsonMap, name)); + } + + //JsonMap field + template + T GetNumber(const JsonMap& jsonMap, const std::string& name) const + { + return AnyNumberCast(Get(jsonMap, name)); + } + + //JsonMap field + template + T Get(const JsonMap& jsonMap, const std::string& name, const T& defValue) const + { + const Any& a = Get(jsonMap, name); + + if (a.Empty()) + { + return defValue; + } + else + { + return AnyCast(a); + } + } + + //JsonMap field + template + T GetNumber(const JsonMap& jsonMap, const std::string& name, const T& defValue) const + { + const Any& a = Get(jsonMap, name); + + if (a.Empty()) + { + return defValue; + } + else + { + return AnyNumberCast(a); + } + } + + //top-level field + const Any& GetGlobalParameter(const std::string& name) const; + + //top-level field: Parameter + bool HasParameter(const std::string& name) const; + + //top-level field: Parameter + const JsonMap& GetParameter() const; + + //get field/value from top-level field: Parameter + const Any& GetParameter(const std::string& name) const; + + //get field/value from top-level field: Parameter + template + const T& GetParameter(const std::string& name) const + { + return AnyCast(GetParameter(name)); + } + + //get field/value from top-level field: Parameter + template + T GetNumberParameter(const std::string& name) const + { + return AnyNumberCast(GetParameter(name)); + } + + //get field/value from top-level field: Parameter + template + T GetParameter(const std::string& name, const T& defValue) const + { + const Any& a = GetParameter(name); + + if (a.Empty()) + { + return defValue; + } + else + { + return AnyCast(a); + } + } + + template + T GetNumberParameter(const std::string& name, const T& defValue) const + { + const Any& a = GetParameter(name); + + if (a.Empty()) + { + return defValue; + } + else + { + return AnyNumberCast(a); + } + } + +protected: + JsonMap mParameter; + Any mContent; +}; + +typedef std::shared_ptr JsonConfigPtr; + +} +} + +#endif//__UT_JSON_CONFIG_HPP__ diff --git a/unitree_SDK/include/unitree/common/json/jsonize.hpp b/unitree_SDK/include/unitree/common/json/jsonize.hpp new file mode 100644 index 0000000..9944e5d --- /dev/null +++ b/unitree_SDK/include/unitree/common/json/jsonize.hpp @@ -0,0 +1,275 @@ +#ifndef __UT_JSONIZE_HPP__ +#define __UT_JSONIZE_HPP__ + +#define JN_FROM_WEAK(m, name, value) \ + if (m.find(name) != m.end()){ JN_FROM(m, name, value); } + +#define JN_FROM(m, name, value) \ + unitree::common::FromJson(m[name], value) + +#define JN_TO(m, name, value) \ + unitree::common::ToJson(value, m[name]) + +#include + +namespace unitree +{ +namespace common +{ +template +void FromJson(const Any& a, T& t); + +template +void ToJson(const T& value, Any& a); + +template +void FromJsonString(const std::string& s, T& t) +{ + Any a = FromJsonString(s); + FromJson(a, t); +} + +template +std::string ToJsonString(const T& t, bool pretty = false) +{ + Any a; + ToJson(t, a); + return ToJsonString(a, pretty); +} + +class Jsonize +{ +public: + virtual void toJson(JsonMap& a) const = 0; + virtual void fromJson(JsonMap& a) = 0; +}; + +void FromAny(const Any& a, int8_t& value); + +void FromAny(const Any& a, uint8_t& value); + +void FromAny(const Any& a, int16_t& value); + +void FromAny(const Any& a, uint16_t& value); + +void FromAny(const Any& a, int32_t& value); + +void FromAny(const Any& a, uint32_t& value); + +void FromAny(const Any& a, int64_t& value); + +void FromAny(const Any& a, uint64_t& value); + +void FromAny(const Any& a, float& value); + +void FromAny(const Any& a, double& value); + +void FromAny(const Any& a, bool& value); + +void FromAny(const Any& a, std::string& value); + +void FromAny(const Any& a, JsonMap& value); + +void FromAny(const Any& a, JsonArray& value); + +void FromAny(const Any& a, Jsonize& value); + +template +void FromAny(const Any& a, std::vector& value) +{ + if (a.Empty()) + { + return; + } + + const JsonArray& arr = AnyCast(a); + size_t i, count = arr.size(); + + for (i=0; i(a_in, e); + value.push_back(std::move(e)); + } +} + +template +void FromAny(const Any& a, std::list& value) +{ + if (a.Empty()) + { + return; + } + + const JsonArray& arr = AnyCast(a); + size_t i, count = arr.size(); + + for (i=0; i(a_in, e); + value.push_back(std::move(e)); + } +} + +template +void FromAny(const Any& a, std::set& value) +{ + if (a.Empty()) + { + return; + } + + const JsonArray& arr = AnyCast(a); + size_t i, count = arr.size(); + + for (i=0; i(a_in, e); + value.insert(std::move(e)); + } +} + +template +void FromAny(const Any& a, std::map& value) +{ + if (a.Empty()) + { + return; + } + + const JsonMap& m = AnyCast(a); + JsonMap::const_iterator iter; + + for (iter = m.begin(); iter != m.end(); ++iter) + { + E e; + const std::string& name = iter->first; + const Any& a_in = iter->second; + FromJson(a_in, e); + value[name] = std::move(e); + } +} + +template +void FromJson(const Any& a, T& t) +{ + FromAny(a, t); +} + +void ToAny(const int8_t& value, Any& a); + +void ToAny(const uint8_t& value, Any& a); + +void ToAny(const int16_t& value, Any& a); + +void ToAny(const uint16_t& value, Any& a); + +void ToAny(const int32_t& value, Any& a); + +void ToAny(const uint32_t& value, Any& a); + +void ToAny(const int64_t& value, Any& a); + +void ToAny(const uint64_t& value, Any& a); + +void ToAny(const float& value, Any& a); + +void ToAny(const double& value, Any& a); + +void ToAny(const bool& value, Any& a); + +void ToAny(const std::string& value, Any& a); + +void ToAny(const JsonMap& value, Any& a); + +void ToAny(const JsonArray& value, Any& a); + +void ToAny(const Jsonize& value, Any& a); + +template +void ToAny(const std::vector& value, Any& a) +{ + JsonArray arr; + + size_t i, count = value.size(); + for (i=0; i(e, a_in); + arr.push_back(std::move(a_in)); + } + + a = Any(arr); +} + +template +void ToAny(const std::list& value, Any& a) +{ + JsonArray arr; + + typename std::list::const_iterator iter; + for (iter = value.begin(); iter != value.end(); ++iter) + { + Any a_in; + const E& e = *iter; + + ToJson(e, a_in); + arr.push_back(std::move(a_in)); + } + + a = Any(arr); +} + +template +void ToAny(const std::set& value, Any& a) +{ + JsonArray arr; + + typename std::set::const_iterator iter; + for (iter = value.begin(); iter != value.end(); ++iter) + { + Any a_in; + const E& e = *iter; + + ToJson(e, a_in); + arr.push_back(std::move(a_in)); + } + + a = Any(arr); +} + +template +void ToAny(const std::map& value, Any& a) +{ + JsonMap m; + typename std::map::const_iterator iter; + + for (iter = value.begin(); iter != value.end(); ++iter) + { + Any a_in; + const std::string& name = iter->first; + const E& e = iter->second; + + ToJson(e, a_in); + m[name] = a_in; + } + + a = Any(m); +} + +template +void ToJson(const T& value, Any& a) +{ + //std::cout << typeid(value).name() << std::endl; + ToAny(value, a); +} +} +} +#endif//__UT_JSONIZE_HPP__ diff --git a/unitree_SDK/include/unitree/common/lock/lock.hpp b/unitree_SDK/include/unitree/common/lock/lock.hpp new file mode 100644 index 0000000..df13ae4 --- /dev/null +++ b/unitree_SDK/include/unitree/common/lock/lock.hpp @@ -0,0 +1,198 @@ +#ifndef __UT_LOCK_HPP__ +#define __UT_LOCK_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +enum +{ + UT_LOCK_MODE_READ = 0, + UT_LOCK_MODE_WRITE = 1, + UT_LOCK_MODE_UNLCK = 2 +}; + +enum +{ + UT_LOCK_ENO_INTR = EINTR, + UT_LOCK_ENO_BUSY = EBUSY, + UT_LOCK_ENO_TIMEDOUT = ETIMEDOUT +}; + +class Spinlock +{ +public: + explicit Spinlock(); + ~Spinlock(); + + void Lock(); + void Unlock(); + + bool Trylock(); + + pthread_spinlock_t & GetNative(); + +private: + pthread_spinlock_t mNative; +}; + +class CaspinLock +{ +public: + explicit CaspinLock(); + ~CaspinLock(); + + void Lock(); + void Unlock(); + + bool Trylock(); + +private: + volatile int32_t mData; +}; + +class Mutex +{ +public: + explicit Mutex(); + ~Mutex(); + + void Lock(); + void Unlock(); + + bool Trylock(); + + pthread_mutex_t & GetNative(); + +private: + pthread_mutex_t mNative; +}; + +class Cond +{ +public: + explicit Cond(); + ~Cond(); + + void Wait(Mutex& mutex); + bool Wait(Mutex& mutex, uint64_t microsec); + + void Notify(); + void NotifyAll(); + +private: + pthread_cond_t mNative; +}; + +class MutexCond +{ +public: + explicit MutexCond(); + ~MutexCond(); + + void Lock(); + void Unlock(); + + bool Wait(int64_t microsec = 0); + void Notify(); + void NotifyAll(); + +private: + Mutex mMutex; + Cond mCond; +}; + +class Rwlock +{ +public: + explicit Rwlock(); + ~Rwlock(); + + void Lock(int32_t mode); + void Unlock(); + + bool Trylock(int32_t mode); + + pthread_rwlock_t & GetNative(); + +private: + pthread_rwlock_t mNative; +}; + +class Filelock +{ +public: + explicit Filelock(const std::string& fileName); + explicit Filelock(int32_t fd); + ~Filelock(); + + void Lock(int32_t mode, int64_t start = 0, int64_t len = 0); + void Unlock(); + + bool Trylock(int32_t mode, int64_t start = 0, int64_t len = 0); + +private: + void SetLockMember(int32_t mode, int64_t start, int64_t len); + void SetLockMode(int32_t mode); + +private: + int32_t mFd; + bool mCloseFd; + struct flock mLock; +}; + +template +class LockGuard +{ +public: + explicit LockGuard(LOCK_TYPE& lockPtr) + { + mLockPtr = &lockPtr; + mLockPtr->Lock(); + } + + explicit LockGuard(LOCK_TYPE* lockPtr) + { + mLockPtr = lockPtr; + mLockPtr->Lock(); + } + + ~LockGuard() + { + mLockPtr->Unlock(); + } + +private: + LOCK_TYPE* mLockPtr; +}; + +template +class RwLockGuard +{ +public: + explicit RwLockGuard(LOCK_TYPE& lockPtr, int32_t mode) + { + mLockPtr = &lockPtr; + lockPtr.Lock(mode); + } + + explicit RwLockGuard(LOCK_TYPE* lockPtr, int32_t mode) + { + mLockPtr = lockPtr; + lockPtr->Lock(mode); + } + + ~RwLockGuard() + { + mLockPtr->Unlock(); + } + +private: + LOCK_TYPE* mLockPtr; +}; +} +} + +#endif//__UT_LOCK_HPP__ diff --git a/unitree_SDK/include/unitree/common/log/log.hpp b/unitree_SDK/include/unitree/common/log/log.hpp new file mode 100644 index 0000000..0808044 --- /dev/null +++ b/unitree_SDK/include/unitree/common/log/log.hpp @@ -0,0 +1,6 @@ +#ifndef __UT_LOG_HPP__ +#define __UT_LOG_HPP__ + +#include + +#endif//__UT_LOG_HPP__ diff --git a/unitree_SDK/include/unitree/common/log/log_buffer.hpp b/unitree_SDK/include/unitree/common/log/log_buffer.hpp new file mode 100644 index 0000000..445aa88 --- /dev/null +++ b/unitree_SDK/include/unitree/common/log/log_buffer.hpp @@ -0,0 +1,44 @@ +#ifndef __UT_LOG_BUFFER_HPP__ +#define __UT_LOG_BUFFER_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +class LogBuffer +{ +public: + explicit LogBuffer(); + virtual ~LogBuffer(); + + virtual bool Append(const std::string& s); + virtual bool Get(std::string& s); + virtual bool Empty(); + +protected: + std::string mData; +}; + +typedef std::shared_ptr LogBufferPtr; + +class LogBlockBuffer : public LogBuffer +{ +public: + explicit LogBlockBuffer(); + ~LogBlockBuffer(); + + bool Append(const std::string& s); + bool Get(std::string& s); + bool Empty(); + +private: + Mutex mLock; +}; + +typedef std::shared_ptr LogBlockBufferPtr; +} +} + +#endif//__UT_LOG_BUFFER_HPP__ diff --git a/unitree_SDK/include/unitree/common/log/log_decl.hpp b/unitree_SDK/include/unitree/common/log/log_decl.hpp new file mode 100644 index 0000000..9c09637 --- /dev/null +++ b/unitree_SDK/include/unitree/common/log/log_decl.hpp @@ -0,0 +1,261 @@ +#ifndef __UT_LOG_DECL_HPP__ +#define __UT_LOG_DECL_HPP__ + +#include +#include +#include +#include +#include +#include + +/* + * log buffer size + */ +#define UT_LOG_BUFFER_SIZE 65535 //64K-1 +#define UT_LOG_CRT_BUFFER_SIZE 64512 //63K +#define UT_LOG_MAX_BUFFER_SIZE 4194303 //4M-1 +/* + * log file size + */ +#define UT_LOG_FILE_SIZE 104857600 //100M +#define UT_LOG_MAX_FILE_SIZE 10737418240 //10G +#define UT_LOG_MIN_FILE_SIZE UT_LOG_MAX_BUFFER_SIZE + +/* + * log write interval(micro second) + */ +#define UT_LOG_WRITE_INTER 100000 //100ms +#define UT_LOG_MAX_WRITE_INTER 1000000 //1s +#define UT_LOG_MIN_WRITE_INTER 2000 //2ms + +/* + * log file number + */ +#define UT_LOG_FILE_NUMBER 2 +#define UT_LOG_MAX_FILE_NUMBER 100 +#define UT_LOG_MIN_FILE_NUMBER UT_LOG_FILE_NUMBER + +#define UT_LOG_FILE_EXT ".LOG" + +//write log macro wrapper +#define __UT_LOG(logger, level, ...)\ + do { \ + if (logger != NULL) \ + { \ + logger->Log(level, __VA_ARGS__); \ + } \ + } while (0) + +#define __UT_CRIT_LOG(logger, key, code, ...) \ + do { \ + if (logger != NULL) \ + { \ + logger->CritLog(UT_LOG_CRIT, key, code, __VA_ARGS__);\ + } \ + } while (0) + + +//debug +#define LOG_DEBUG(logger, ...) \ + __UT_LOG(logger, UT_LOG_DEBUG, __VA_ARGS__) + +//info +#define LOG_INFO(logger, ...) \ + __UT_LOG(logger, UT_LOG_INFO, __VA_ARGS__) + +//warning +#define LOG_WARNING(logger, ...) \ + __UT_LOG(logger, UT_LOG_WARNING, __VA_ARGS__) + +//error +#define LOG_ERROR(logger, ...) \ + __UT_LOG(logger, UT_LOG_ERROR, __VA_ARGS__) + +//fatal +#define LOG_FATAL(logger, ...) \ + __UT_LOG(logger, UT_LOG_FATAL, __VA_ARGS__) + +//critical log. the 1st args is CRITICAL KEY +#define CRIT_LOG(logger, ...) \ + __UT_CRIT_LOG(logger, __VA_ARGS__) + +#define CRIT_LOG(logger, ...) \ + __UT_CRIT_LOG(logger, __VA_ARGS__) + +//write log format macro wrapper +/* + * FMT_DEBUG(logger, ("key1", val1)("key2", val2)("keyn", "")); + */ +#define __UT_LOG_FMT(logger, level, keyvalues) \ + do { \ + if (logger != NULL) \ + { \ + logger->LogFormat(level, unitree::common::LogBuilder() keyvalues); \ + } \ + } while (0) + +#define __UT_CRIT_LOG_FMT(logger, key, code, keyvalues) \ + do { \ + if (logger != NULL) \ + { \ + logger->CritLogFormat(UT_LOG_CRIT, key, code, unitree::common::LogBuilder() keyvalues); \ + } \ + } while (0) + +//debug +#define FMT_DEBUG(logger, keyvalues) \ + __UT_LOG_FMT(logger, UT_LOG_DEBUG, keyvalues) + +//info +#define FMT_INFO(logger, keyvalues) \ + __UT_LOG_FMT(logger, UT_LOG_INFO, keyvalues) + +//warning +#define FMT_WARNING(logger, keyvalues) \ + __UT_LOG_FMT(logger, UT_LOG_WARNING, keyvalues) + +//error +#define FMT_ERROR(logger, keyvalues) \ + __UT_LOG_FMT(logger, UT_LOG_ERROR, keyvalues) + +//fatal +#define FMT_FATAL(logger, keyvalues) \ + __UT_LOG_FMT(logger, UT_LOG_FATAL, keyvalues) + +#define CRIT_FMT(logger, critkey, keyvalues) \ + __UT_CRIT_LOG_FMT(logger, critkey, keyvalues) + + +/* +//declare and define log level +#define UT_LOG_DECL_LEVEL(name, level, desc) \ + const int32_t name = level; \ + const std::string name##_DESC = desc; +#define UT_LOG_DESC_LEVEL(name) name##_DESC +*/ + +//declare and define log store type +#define UT_LOG_DECL_STORE_TYPE(name, type, desc)\ + const int32_t name = type; \ + const std::string name##_DESC = desc; +#define UT_LOG_DESC_STORE_TYPE(name) name##_DESC + +//define log level +#define UT_LOG_NONE 0 +#define UT_LOG_CRIT 1 +#define UT_LOG_FATAL 2 +#define UT_LOG_ERROR 3 +#define UT_LOG_WARNING 4 +#define UT_LOG_INFO 5 +#define UT_LOG_DEBUG 6 +#define UT_LOG_ALL 7 + +#define UT_LOG_DESC_NONE "NONE" +#define UT_LOG_DESC_CRIT "CRIT" +#define UT_LOG_DESC_FATAL "FATAL" +#define UT_LOG_DESC_ERROR "ERROR" +#define UT_LOG_DESC_WARNING "WARNING" +#define UT_LOG_DESC_INFO "INFO" +#define UT_LOG_DESC_DEBUG "DEBUG" +#define UT_LOG_DESC_ALL "ALL" + +//define log store type +#define UT_LOG_STORE_FILE_ASYNC 0 +#define UT_LOG_STORE_FILE 1 +#define UT_LOG_STORE_STDOUT 2 +#define UT_LOG_STORE_STDERR 3 + +#define UT_LOG_STORE_DESC_FILE_ASYNC "FILEASYNC" +#define UT_LOG_STORE_DESC_ASYNC_FILE "ASYNCFILE" +#define UT_LOG_STORE_DESC_ASYNC "ASYNC" +#define UT_LOG_STORE_DESC_FILE "FILE" +#define UT_LOG_STORE_DESC_STDOUT "STDOUT" +#define UT_LOG_STORE_DESC_STDERR "STDERR" + +namespace unitree +{ +namespace common +{ +static inline int32_t GetLogLevel(const std::string& desc) +{ + if (desc == UT_LOG_DESC_NONE) { + return UT_LOG_NONE; } + else if (desc == UT_LOG_DESC_CRIT) { + return UT_LOG_CRIT; } + else if (desc == UT_LOG_DESC_FATAL) { + return UT_LOG_FATAL; } + else if (desc == UT_LOG_DESC_ERROR) { + return UT_LOG_ERROR; } + else if (desc == UT_LOG_DESC_WARNING) { + return UT_LOG_WARNING; } + else if (desc == UT_LOG_DESC_INFO) { + return UT_LOG_INFO; } + else if (desc == UT_LOG_DESC_DEBUG) { + return UT_LOG_DEBUG; } + else if (desc == UT_LOG_DESC_ALL) { + return UT_LOG_ALL; } + + UT_THROW(CommonException, std::string("unknown log level desc:") + desc); +} + +static inline const char* GetLogLevelDesc(int32_t level) +{ + switch (level) + { + case UT_LOG_NONE: + return UT_LOG_DESC_NONE; + case UT_LOG_CRIT: + return UT_LOG_DESC_CRIT; + case UT_LOG_FATAL: + return UT_LOG_DESC_FATAL; + case UT_LOG_ERROR: + return UT_LOG_DESC_ERROR; + case UT_LOG_WARNING: + return UT_LOG_DESC_WARNING; + case UT_LOG_INFO: + return UT_LOG_DESC_INFO; + case UT_LOG_DEBUG: + return UT_LOG_DESC_DEBUG; + case UT_LOG_ALL: + return UT_LOG_DESC_ALL; + } + + UT_THROW(CommonException, "unknown log level"); +} + +static inline int32_t GetLogStoreType(const std::string& desc) +{ + if (desc == UT_LOG_STORE_DESC_FILE_ASYNC || + desc == UT_LOG_STORE_DESC_ASYNC_FILE || + desc == UT_LOG_STORE_DESC_ASYNC) { + return UT_LOG_STORE_FILE_ASYNC; } + else if (desc == UT_LOG_STORE_DESC_FILE) { + return UT_LOG_STORE_FILE; } + else if (desc == UT_LOG_STORE_DESC_STDOUT){ + return UT_LOG_STORE_STDOUT; } + else if (desc == UT_LOG_STORE_DESC_STDERR){ + return UT_LOG_STORE_STDERR; } + + UT_THROW(CommonException, std::string("unknown log store type desc:") + desc); +} + +static inline const char* GetLogStoreTypeDesc(int32_t type) +{ + switch (type) + { + case UT_LOG_STORE_FILE_ASYNC: + return UT_LOG_STORE_DESC_FILE_ASYNC; + case UT_LOG_STORE_FILE: + return UT_LOG_STORE_DESC_FILE; + case UT_LOG_STORE_STDOUT: + return UT_LOG_STORE_DESC_STDOUT; + case UT_LOG_STORE_STDERR: + return UT_LOG_STORE_DESC_STDERR; + } + + UT_THROW(CommonException, "unknown log store type"); +} +} +} + +#endif//__UT_LOG_DECL_HPP__ diff --git a/unitree_SDK/include/unitree/common/log/log_initor.hpp b/unitree_SDK/include/unitree/common/log/log_initor.hpp new file mode 100644 index 0000000..9bca833 --- /dev/null +++ b/unitree_SDK/include/unitree/common/log/log_initor.hpp @@ -0,0 +1,44 @@ +#ifndef __UT_LOG_INITOR_HPP__ +#define __UT_LOG_INITOR_HPP__ + +#include +#include +#include + +namespace unitree +{ +namespace common +{ +class LogInitor +{ +public: + explicit LogInitor(); + ~LogInitor(); + + void Init(const std::string& configFileName, bool stdoutDefault = false); + Logger* GetLogger(const std::string& tag); + + void Final(); + + void ParseConf(Any json); + void SetStdoutPolicy(); + void InitLogger(); + +private: + std::set mStoreNames; + std::vector mPolicis; + std::vector mStorePolicis; + std::map mLoggerMap; +}; + +using LogInitorPtr = std::shared_ptr; + +void LogInit(const std::string& configFileName = "", bool stdoutDefault = false); +void LogFinal(); + +Logger* GetLogger(const std::string& tag); + +} +} + +#endif//__UT_LOG_INITOR_HPP__ diff --git a/unitree_SDK/include/unitree/common/log/log_keeper.hpp b/unitree_SDK/include/unitree/common/log/log_keeper.hpp new file mode 100644 index 0000000..75bb54d --- /dev/null +++ b/unitree_SDK/include/unitree/common/log/log_keeper.hpp @@ -0,0 +1,44 @@ +#ifndef __UT_LOG_FILE_KEEPER_H__ +#define __UT_LOG_FILE_KEEPER_H__ + +#include + +namespace unitree +{ +namespace common +{ +class LogKeeper +{ +public: + LogKeeper(LogStorePolicyPtr storePolicyPtr); + ~LogKeeper(); + + LogStorePolicyPtr GetStorePolicy() const; + + bool Append(const std::string& s, bool rotate); + +private: + void Rotate(); + + void AppendFile(const std::string& s); + void OpenFile(); + void CloseFile(); + + void CheckFileSize(); + + std::string MakeRegexExpress(); + +private: + volatile int64_t mFileSize; + std::string mFileName; + std::string mDirectory; + FilePtr mFilePtr; + LogStorePolicyPtr mStorePolicyPtr; +}; + +typedef std::shared_ptr LogKeeperPtr; + +} +} + +#endif//__UT_LOG_FILE_KEEPER_H__ diff --git a/unitree_SDK/include/unitree/common/log/log_logger.hpp b/unitree_SDK/include/unitree/common/log/log_logger.hpp new file mode 100644 index 0000000..7aeb7a7 --- /dev/null +++ b/unitree_SDK/include/unitree/common/log/log_logger.hpp @@ -0,0 +1,139 @@ +#ifndef __UT_LOGGER_HPP__ +#define __UT_LOGGER_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +class LogBuilder +{ +public: + LogBuilder() + {} + + template + LogBuilder& operator()(const std::string& key, const T& value) + { + mOs << "\t" << key << ":" << value; + return *this; + } + + std::ostringstream mOs; +}; + +class Logger +{ +public: + explicit Logger(int32_t level, LogStorePtr storePtr) : + mLevel(level), mStorePtr(storePtr) + {} + + template + void Log(int32_t level, Args&&... args) + { + if (level > mLevel || mStorePtr == NULL) + { + return; + } + + std::ostringstream os; + LogBegin(os, level); + LogPend(os, std::forward(args)...); + LogEnd(os); + + mStorePtr->Append(os.str()); + } + + void LogFormat(int32_t level, LogBuilder& builder) + { + if (level > mLevel || mStorePtr == NULL) + { + return; + } + + std::ostringstream os; + LogBegin(os, level); + LogPendBuilder(os, builder); + LogEnd(os); + + mStorePtr->Append(os.str()); + } + + template + void CritLog(int32_t level, const std::string& key, int32_t code, Args&&... args) + { + if (level > mLevel || mStorePtr == NULL) + { + return; + } + + std::ostringstream os; + LogBegin(os, level); + LogPendCrit(os, key, code); + LogPend(os, std::forward(args)...); + LogEnd(os); + + mStorePtr->Append(os.str()); + } + + void CritLogFormat(int32_t level, const std::string& key, int32_t code, LogBuilder& builder) + { + if (level > mLevel || mStorePtr == NULL) + { + return; + } + + std::ostringstream os; + LogBegin(os, level); + LogPendCrit(os, key, code); + LogPendBuilder(os, builder); + LogEnd(os); + + mStorePtr->Append(os.str()); + } + +private: + void LogPendCrit(std::ostringstream& os, const std::string& key, int32_t code) + { + os << " [__KEY__:" << key << "]"; + os << " [__CODE__:" << code << "]"; + } + + template + void LogPend(std::ostringstream& os, Args&&... args) + { + os << " "; + std::initializer_list{ (os << args, 0)... }; + } + + void LogPendBuilder(std::ostringstream& os, LogBuilder& builder) + { + os << builder.mOs.str(); + } + + void LogBegin(std::ostringstream& os, int32_t level) + { + os << "[" << GetTimeMillisecondString() << "] "; + os << "[" << GetLogLevelDesc(level) << "] "; + os << "[" << OsHelper::Instance()->GetProcessId() << "] "; + os << "[" << OsHelper::Instance()->GetTid() << "]"; + os << std::setprecision(6) << std::fixed; + } + + void LogEnd(std::ostringstream& os) + { + os << std::endl; + } + +private: + int32_t mLevel; + LogStorePtr mStorePtr; +}; + +typedef std::shared_ptr LoggerPtr; +} +} + +#endif//__UT_LOGGER_HPP__ diff --git a/unitree_SDK/include/unitree/common/log/log_policy.hpp b/unitree_SDK/include/unitree/common/log/log_policy.hpp new file mode 100644 index 0000000..def5a0b --- /dev/null +++ b/unitree_SDK/include/unitree/common/log/log_policy.hpp @@ -0,0 +1,52 @@ +#ifndef __UT_LOG_POLICY_HPP__ +#define __UT_LOG_POLICY_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +class LogPolicy +{ +public: + LogPolicy(); + LogPolicy(const std::string& tag, int32_t level, const std::string& store); + + void Dump(); + +public: + std::string mTag; + int32_t mLevel; + std::string mStore; +}; + +typedef std::shared_ptr LogPolicyPtr; + +class LogStorePolicy +{ +public: + LogStorePolicy(); + LogStorePolicy(const std::string& name, int32_t type, int32_t fileNumber, int64_t fileSize, + int64_t fileWriteInter = UT_LOG_WRITE_INTER, int32_t cpuId = UT_CPU_ID_NONE, + const std::string& fileName = "", const std::string& directory = ""); + + void Dump(); + +public: + std::string mName; + int32_t mType; + int32_t mFileNumber; + int64_t mFileSize; + int64_t mFileWriteInter; + int32_t mCpuId; + std::string mFileName; + std::string mDirectory; +}; + +typedef std::shared_ptr LogStorePolicyPtr; + +} +} + +#endif//__UT_LOG_POLICY_HPP__ diff --git a/unitree_SDK/include/unitree/common/log/log_store.hpp b/unitree_SDK/include/unitree/common/log/log_store.hpp new file mode 100644 index 0000000..7243bfc --- /dev/null +++ b/unitree_SDK/include/unitree/common/log/log_store.hpp @@ -0,0 +1,76 @@ +#ifndef __LOG_STORE_HPP__ +#define __LOG_STORE_HPP__ + +#include +#include + +namespace unitree +{ +namespace common +{ +class LogStore +{ +public: + explicit LogStore() + {} + virtual ~LogStore() + { + mWriterPtr.reset(); + } + + virtual void Append(const std::string& s) = 0; + +protected: + LogWriterPtr mWriterPtr; +}; + +typedef std::shared_ptr LogStorePtr; + +class LogStdoutStore : public LogStore +{ +public: + explicit LogStdoutStore(); + ~LogStdoutStore(); + + void Append(const std::string& s); +}; + +typedef std::shared_ptr LogStdoutStorePtr; + +class LogStderrStore : public LogStore +{ +public: + explicit LogStderrStore(); + ~LogStderrStore(); + + void Append(const std::string& s); +}; + +typedef std::shared_ptr LogStderrStorePtr; + +class LogFileStore : public LogStore +{ +public: + explicit LogFileStore(LogKeeperPtr keeperPtr); + ~LogFileStore(); + + void Append(const std::string& s); +}; + +typedef std::shared_ptr LogFileStorePtr; + +class LogFileAsyncStore : public LogStore +{ +public: + explicit LogFileAsyncStore(LogKeeperPtr keeperPtr); + ~LogFileAsyncStore(); + + void Append(const std::string& s); +}; + +typedef std::shared_ptr LogFileAsyncStorePtr; + +} +} + +#endif//__LOG_STORE_HPP__ diff --git a/unitree_SDK/include/unitree/common/log/log_writer.hpp b/unitree_SDK/include/unitree/common/log/log_writer.hpp new file mode 100644 index 0000000..b0c5273 --- /dev/null +++ b/unitree_SDK/include/unitree/common/log/log_writer.hpp @@ -0,0 +1,88 @@ +#ifndef __LOG_WRITER_HPP__ +#define __LOG_WRITER_HPP__ + +#include +#include + +namespace unitree +{ +namespace common +{ +class LogWriter +{ +public: + virtual void Write(const std::string& s) = 0; +}; + +typedef std::shared_ptr LogWriterPtr; + +class LogDirectWriter : public LogWriter +{ +public: + explicit LogDirectWriter(int32_t fd); + virtual ~LogDirectWriter(); + + void Write(const std::string& s); + +private: + Mutex mLock; + int32_t mFd; +}; + +class LogStdoutWriter : public LogDirectWriter +{ +public: + explicit LogStdoutWriter() : + LogDirectWriter(UT_FD_STDOUT) + {} + ~LogStdoutWriter() + {} +}; + +class LogStderrWriter : public LogDirectWriter +{ +public: + explicit LogStderrWriter() : + LogDirectWriter(UT_FD_STDERR) + {} + ~LogStderrWriter() + {} +}; + +class LogBufferWriter : public LogWriter +{ +public: + explicit LogBufferWriter(LogKeeperPtr keeperPtr); + ~LogBufferWriter(); + + void Write(const std::string& s); + +private: + LogBufferPtr mBufferPtr; + LogKeeperPtr mKeeperPtr; + Mutex mLock; +}; + +class LogAsyncBufferWriter : public LogWriter +{ +public: + explicit LogAsyncBufferWriter(LogKeeperPtr keeperPtr); + ~LogAsyncBufferWriter(); + + void Write(const std::string& s); + +private: + void DoWrite(); + +private: + volatile bool mRotate; + std::string mTempBuf; + LogBufferPtr mBufferPtr; + LogKeeperPtr mKeeperPtr; + ThreadPtr mThreadPtr; + Mutex mLock; +}; +} +} + +#endif//__LOG_WRITER_HPP__ diff --git a/unitree_SDK/include/unitree/common/os.hpp b/unitree_SDK/include/unitree/common/os.hpp new file mode 100644 index 0000000..0cc2cd6 --- /dev/null +++ b/unitree_SDK/include/unitree/common/os.hpp @@ -0,0 +1,93 @@ +#ifndef __UT_OS_HPP__ +#define __UT_OS_HPP__ + +#include +#include + +namespace unitree +{ +namespace common +{ +enum UT_SCHED_POLICY +{ + UT_SCHED_POLICY_NORMAL = SCHED_OTHER, + UT_SCHED_POLICY_FIFO = SCHED_FIFO, + UT_SCHED_POLICY_RR = SCHED_RR, + UT_SCHED_POLICY_BATCH = SCHED_BATCH, + UT_SCHED_POLICY_IDLE = SCHED_IDLE, + UT_SCHED_POLICY_DEADLINE = SCHED_DEADLINE +}; + +class OsHelper +{ +public: + static OsHelper* Instance() + { + static OsHelper inst; + return &inst; + } + + uid_t GetUID() const; + gid_t GetGID() const; + std::string GetUser() const; + const struct passwd& GetPasswd() const; + + bool GetPasswd(const std::string& name, struct passwd& pwd); + bool GetUIDAndGID(const std::string& name, uid_t& uid, gid_t& gid); + + int32_t GetProcessorNumber() const; + int32_t GetProcessorNumberConf() const; + + int32_t GetPageSize() const; + + int64_t Align(int64_t len) const; + bool IsAligned(int64_t len) const; + + const std::string& GetHostname() const; + + uint32_t GetProcessId(); + const std::string& GetProcessFileName(); + + std::string GetProcessName(); + std::string GetProcessDirectory(bool withEndDelim = true); + + uint64_t GetThreadId(); + int32_t GetTid(); + + bool GetNetworkInterfaceIps(std::map& networkInterfaceIpMap); + bool GetIps(std::set& ips); + + void CpuSet(const std::string& cpuIds); + void CpuSet(uint64_t threadId, size_t cpuId); + + void SetThreadName(uint64_t threadId, const std::string& name); + + void SetScheduler(int32_t policy, int32_t priority); + void SetScheduler(uint64_t threadId, int32_t policy, int32_t priority); + + void SingletonProcessInstance(); + +private: + OsHelper(); + + void __Getpwuid(); + void __GetProcessor(); + void __GetPageSize(); + void __GetProcessFileName(); + void __GetHostname(); + +private: + uid_t mUID; + struct passwd mPasswd; + int32_t mProcessorNumber; + int32_t mProcessorNumberConf; + int32_t mPageSize; + std::string mHostname; + std::string mProcessFileName; + std::shared_ptr mInstanceLockPtr; +}; + +} +} + +#endif//__UT_OS_HPP__ diff --git a/unitree_SDK/include/unitree/common/service/base/service_application.hpp b/unitree_SDK/include/unitree/common/service/base/service_application.hpp new file mode 100644 index 0000000..96aadfe --- /dev/null +++ b/unitree_SDK/include/unitree/common/service/base/service_application.hpp @@ -0,0 +1,51 @@ +#ifndef __UT_SERVICE_APPLICATION_HPP__ +#define __UT_SERVICE_APPLICATION_HPP__ + +#include + +#define SERVICE_REGISTER(SERVICE) \ +class SERVICE##Register \ +{ \ +public: \ + SERVICE##Register() \ + { \ + unitree::common::ServiceApplication::Instance()->RegistService(); \ + } \ + static SERVICE##Register mRegister; \ +}; \ +SERVICE##Register SERVICE##Register::mRegister = SERVICE##Register(); + +namespace unitree +{ +namespace common +{ +class ServiceApplication +{ +public: + static ServiceApplication* Instance() + { + static ServiceApplication inst; + return &inst; + } + + template + void RegistService() + { + mServicePtr = ServicePtr(new SERVICE()); + } + + void Init(const std::string& configFileName); + void Start(); + void Stop(); + +private: + ServiceApplication(); + +protected: + ServicePtr mServicePtr; +}; + +} +} + +#endif//__UT_SERVICE_APPLICATION_HPP__ diff --git a/unitree_SDK/include/unitree/common/service/base/service_base.hpp b/unitree_SDK/include/unitree/common/service/base/service_base.hpp new file mode 100644 index 0000000..a08b3a3 --- /dev/null +++ b/unitree_SDK/include/unitree/common/service/base/service_base.hpp @@ -0,0 +1,104 @@ +#ifndef __UT_SERVICE_BASE_HPP__ +#define __UT_SERVICE_BASE_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +class ServiceBase +{ +public: + ServiceBase(); + virtual ~ServiceBase(); + + virtual void Parse(const std::string& configFileName); + + virtual void Init(); + + virtual void Register(); + + virtual void Start(); + + virtual void Wait(); + + virtual void Stop(); + +protected: + /* + * Parse config content + */ + virtual void ParseConfigContent(const std::string& content); + + /* + * Get field: ServiceName + */ + const std::string& GetServiceName() const; + + /* + * Get field: CpuIds + */ + const std::string& GetCpuIds() const; + + /* + * Get top-level field/value + */ + const Any& GetGlobalParameter(const std::string& name) const; + + /* + * Get top-level field: Parameter + */ + bool HasParameter(const std::string& name) const; + + /* + * Get top-level field: Parameter + */ + const JsonMap& GetParameter() const; + + /* + * Get field from top-level field: Parameter + */ + const Any& GetParameter(const std::string& name) const; + + /* + * Get field from top-level field: Parameter + */ + template + const T& GetParameter(const std::string& name) const + { + return mConfig.GetParameter(name); + } + + /* + * Get field from top-level field: Parameter + */ + template + T GetNumberParameter(const std::string& name) const + { + return mConfig.GetNumberParameter(name); + } + + /* + * Get field from top-level field: Parameter + */ + template + T GetParameter(const std::string& name, const T& defValue) const + { + return mConfig.GetParameter(name, defValue); + } + + template + T GetNumberParameter(const std::string& name, const T& defValue) const + { + return mConfig.GetNumberParameter(name, defValue); + } + +private: + ServiceConfig mConfig; +}; +typedef std::shared_ptr ServicePtr; + +} +} +#endif//__UT_SERVICE_BASE_HPP__ diff --git a/unitree_SDK/include/unitree/common/service/base/service_config.hpp b/unitree_SDK/include/unitree/common/service/base/service_config.hpp new file mode 100644 index 0000000..93952af --- /dev/null +++ b/unitree_SDK/include/unitree/common/service/base/service_config.hpp @@ -0,0 +1,37 @@ +#ifndef __UT_SERVICE_CONFIG_HPP__ +#define __UT_SERVICE_CONFIG_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +class ServiceConfig : public common::JsonConfig +{ +public: + ServiceConfig(); + virtual ~ServiceConfig(); + + ServiceConfig(const std::string& configFileName); + + virtual void Parse(const std::string& configFileName); + virtual void ParseContent(const std::string& content); + + //top-level field: ServiceName + const std::string& GetServiceName() const; + + //top-level field: CpuIds + const std::string& GetCpuIds() const; + +protected: + std::string mCpuIds; + std::string mServiceName; +}; + +typedef std::shared_ptr ServiceConfigPtr; + +} +} + +#endif//__UT_SERVICE_CONFIG_HPP__ diff --git a/unitree_SDK/include/unitree/common/service/base/service_decl.hpp b/unitree_SDK/include/unitree/common/service/base/service_decl.hpp new file mode 100644 index 0000000..dc7f352 --- /dev/null +++ b/unitree_SDK/include/unitree/common/service/base/service_decl.hpp @@ -0,0 +1,10 @@ +#ifndef __UT_SERVICE_DECL_HPP__ +#define __UT_SERVICE_DECL_HPP__ + +#include +#include +#include +#include +#include + +#endif//__UT_SERVICE_DECL_HPP__ diff --git a/unitree_SDK/include/unitree/common/service/dds_service.hpp b/unitree_SDK/include/unitree/common/service/dds_service.hpp new file mode 100644 index 0000000..f791ef2 --- /dev/null +++ b/unitree_SDK/include/unitree/common/service/dds_service.hpp @@ -0,0 +1,85 @@ +#ifndef __UT_DDS_SERVICE_HPP__ +#define __UT_DDS_SERVICE_HPP__ + +#include +#include +#include + +namespace unitree +{ +namespace common +{ +class DdsService : public ServiceBase +{ +public: + DdsService() + { + mLogger = GetLogger("/unitree/service/dds_service"); + mQuit = false; + } + + virtual ~DdsService() + {} + + virtual void Register() + {} + + virtual void Init() + { + mModel.Init(AnyCast(GetGlobalParameter("DdsParameter"))); + LOG_INFO(mLogger, "parse init dds model success."); + } + + virtual void Start() + {} + + virtual void Wait() + { + while (!mQuit) { sleep(1); } + } + + virtual void Stop() + { + mQuit = true; + } + +public: + virtual void Parse(const std::string& configFileName) + { + ServiceBase::Parse(configFileName); + LOG_INFO(mLogger, "parse config success. filename:", configFileName); + } + +protected: + template + void RegistTopicMessageHandler(const std::string& topic, const DdsMessageHandler& handler) + { + mModel.SetTopic(topic, handler); + LOG_INFO(mLogger, "regist topic reader callback. topic:", topic); + } + + template + void RegistTopic(const std::string& topic) + { + mModel.SetTopic(topic); + LOG_INFO(mLogger, "regist topic. topic:", topic); + } + + /* + * Write message to topic + */ + template + void WriteMessage(const std::string& topic, const MSG& message) + { + mModel.WriteMessage(topic, message); + } + +private: + bool mQuit; + DdsEasyModel mModel; + Logger* mLogger; +}; + +} +} +#endif//__UT_DDS_SERVICE_HPP__ diff --git a/unitree_SDK/include/unitree/common/string_tool.hpp b/unitree_SDK/include/unitree/common/string_tool.hpp new file mode 100644 index 0000000..76bf733 --- /dev/null +++ b/unitree_SDK/include/unitree/common/string_tool.hpp @@ -0,0 +1,77 @@ +#ifndef __UT_STRING_TOOL_HPP__ +#define __UT_STRING_TOOL_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +/* + * trim delim + */ +const char UT_TRIM_DELIM_STR[] = {0x09,0x0A,0x0B,0x0C,0x0D,0x20,0x00}; + +/* + * string cast functions + */ +std::string ToString(const char* s); +std::string ToString(const std::string& s); + +/* + * template ToString + */ +template +std::string ToString(const T& t) +{ + return std::to_string(t); +} + +/* + * string functions + */ +void StringTo(const std::string& s, int32_t& val); +void StringTo(const std::string& s, uint32_t& val); +void StringTo(const std::string& s, int64_t& val); +void StringTo(const std::string& s, uint64_t& val); +void StringTo(const std::string& s, float& val); +void StringTo(const std::string& s, double& val); +void StringTo(const std::string& s, long double& val); + +template +T StringTo(const std::string& s) +{ + T t; + StringTo(s, t); + return t; +} + +/* + * string tool functions + */ +std::string& ToUpper(std::string& s); +std::string& ToLower(std::string& s); + +int32_t Compare(const std::string& s1, const std::string& s2, + bool caseSensitive = true); +int32_t Compare(const std::string& s1, size_t pos, size_t len, + const std::string& s2, bool caseSensitive = true); + +std::string& TrimLeft(std::string& s, const std::string& delim = std::string(UT_TRIM_DELIM_STR)); +std::string& TrimRight(std::string& s, const std::string& delim = std::string(UT_TRIM_DELIM_STR)); +std::string& Trim(std::string& s, const std::string& delim = std::string(UT_TRIM_DELIM_STR)); + +void Split(const std::string& s, std::vector& parts, + const std::string& delim); + +bool StartWith(const std::string& s, const std::string& start, + bool caseSensitive = true); + +bool EndWith(const std::string& s, const std::string& end, + bool caseSensitive = true); + +std::string Replace(const std::string& s, const std::string& partten, + const std::string& target); +} +} +#endif//__UT_STRING_TOOL_HPP__ diff --git a/unitree_SDK/include/unitree/common/thread/future.hpp b/unitree_SDK/include/unitree/common/thread/future.hpp new file mode 100644 index 0000000..f8b00cc --- /dev/null +++ b/unitree_SDK/include/unitree/common/thread/future.hpp @@ -0,0 +1,102 @@ +#ifndef __UT_FUTURE_HPP__ +#define __UT_FUTURE_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +class Future +{ +public: + enum + { + DEFER = 0, + READY = 1, + FAULT = 2 + }; + + Future() + {} + + virtual ~Future() + {} + + bool IsDeferred() + { + return GetState() == DEFER; + } + + bool IsReady() + { + return GetState() == READY; + } + + bool IsFault() + { + return GetState() == FAULT; + } + + virtual int32_t GetState() = 0; + virtual bool Wait(int64_t microsec = 0) = 0; + virtual const Any& GetValue(int64_t microsec = 0) = 0; + virtual const Any& GetFaultMessage() = 0; + +public: + virtual void Ready(const Any& value) = 0; + virtual void Fault(const Any& message) = 0; +}; + +typedef std::shared_ptr FuturePtr; + +class FutureWrapper : public Future +{ +public: + FutureWrapper(); + virtual ~FutureWrapper(); + + virtual int32_t GetState() + { + return mFuturePtr->GetState(); + } + + virtual bool Wait(int64_t microsec = 0) + { + return mFuturePtr->Wait(microsec); + } + + virtual const Any& GetValue(int64_t microsec = 0) + { + return mFuturePtr->GetValue(microsec); + } + + virtual const Any& GetFaultMessage() + { + return mFuturePtr->GetFaultMessage(); + } + + std::shared_ptr GetFuture() + { + return mFuturePtr; + } + +public: + virtual void Ready(const Any& value) + { + return mFuturePtr->Ready(value); + } + + virtual void Fault(const Any& message) + { + return mFuturePtr->Fault(message); + } + +protected: + std::shared_ptr mFuturePtr; +}; + +} +} + +#endif//__UT_FUTURE_HPP__ diff --git a/unitree_SDK/include/unitree/common/thread/recurrent_thread.hpp b/unitree_SDK/include/unitree/common/thread/recurrent_thread.hpp new file mode 100644 index 0000000..a9965f6 --- /dev/null +++ b/unitree_SDK/include/unitree/common/thread/recurrent_thread.hpp @@ -0,0 +1,84 @@ +#ifndef __UT_RECURRENT_THREAD_HPP__ +#define __UT_RECURRENT_THREAD_HPP__ + +#include + +#define UT_THREAD_TIME_INTERVAL_MICROSEC 1000000 + +namespace unitree +{ +namespace common +{ +class RecurrentThread : public Thread +{ +public: + __UT_THREAD_DECL_TMPL_FUNC_ARG__ + explicit RecurrentThread(uint64_t intervalMicrosec, __UT_THREAD_TMPL_FUNC_ARG__) + : mQuit(false), mIntervalMicrosec(intervalMicrosec) + { + //recurrent function + mFunc = std::bind(__UT_THREAD_BIND_FUNC_ARG__); + + //Call Thread::Run for runing thread + if (mIntervalMicrosec == 0) + { + Run(&RecurrentThread::ThreadFunc_0, this); + } + else + { + Run(&RecurrentThread::ThreadFunc, this); + } + } + + __UT_THREAD_DECL_TMPL_FUNC_ARG__ + explicit RecurrentThread(const std::string& name, int32_t cpuId, uint64_t intervalMicrosec, + __UT_THREAD_TMPL_FUNC_ARG__) + : Thread(name, cpuId), mQuit(false), mIntervalMicrosec(intervalMicrosec) + { + //recurrent function + mFunc = std::bind(__UT_THREAD_BIND_FUNC_ARG__); + + //Call Thread::Run for runing thread + if (mIntervalMicrosec == 0) + { + Run(&RecurrentThread::ThreadFunc_0, this); + } + else + { + Run(&RecurrentThread::ThreadFunc, this); + } + } + + virtual ~RecurrentThread(); + + int32_t ThreadFunc(); + int32_t ThreadFunc_0(); + + bool Wait(int64_t microsec = 0); + +private: + volatile bool mQuit; + uint64_t mIntervalMicrosec; + std::function mFunc; +}; + +typedef std::shared_ptr RecurrentThreadPtr; + +__UT_THREAD_DECL_TMPL_FUNC_ARG__ +ThreadPtr CreateRecurrentThread(uint64_t intervalMicrosec, __UT_THREAD_TMPL_FUNC_ARG__) +{ + return ThreadPtr(new RecurrentThread(intervalMicrosec, __UT_THREAD_BIND_FUNC_ARG__)); +} + +__UT_THREAD_DECL_TMPL_FUNC_ARG__ +ThreadPtr CreateRecurrentThreadEx(const std::string& name, int32_t cpuId, uint64_t intervalMicrosec, + __UT_THREAD_TMPL_FUNC_ARG__) +{ + return ThreadPtr(new RecurrentThread(name, cpuId, intervalMicrosec, + __UT_THREAD_BIND_FUNC_ARG__)); +} + +} +} + +#endif//__UT_RECURRENT_THREAD_HPP__ diff --git a/unitree_SDK/include/unitree/common/thread/thread.hpp b/unitree_SDK/include/unitree/common/thread/thread.hpp new file mode 100644 index 0000000..438e840 --- /dev/null +++ b/unitree_SDK/include/unitree/common/thread/thread.hpp @@ -0,0 +1,79 @@ +#ifndef __UT_THREAD_HPP__ +#define __UT_THREAD_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +class Thread : public FutureWrapper +{ +public: + Thread() + : mThreadId(0), mCpuId(UT_CPU_ID_NONE) + {} + + Thread(const std::string& name, int32_t cpuId) + : mThreadId(0), mName(name), mCpuId(cpuId) + {} + + __UT_THREAD_DECL_TMPL_FUNC_ARG__ + explicit Thread(__UT_THREAD_TMPL_FUNC_ARG__) + : Thread() + { + Run(__UT_THREAD_BIND_FUNC_ARG__); + } + + __UT_THREAD_DECL_TMPL_FUNC_ARG__ + explicit Thread(const std::string& name, int32_t cpuId, __UT_THREAD_TMPL_FUNC_ARG__) + : Thread(name, cpuId) + { + Run(__UT_THREAD_BIND_FUNC_ARG__); + } + + virtual ~Thread(); + + uint64_t GetThreadId() const; + + void SetCpu(); + void SetName(); + void SetPriority(int32_t priority); + + void Wrap(); + +protected: + __UT_THREAD_DECL_TMPL_FUNC_ARG__ + void Run(__UT_THREAD_TMPL_FUNC_ARG__) + { + mFunc = std::bind(__UT_THREAD_BIND_FUNC_ARG__); + CreateThreadNative(); + } + + void CreateThreadNative(); + +protected: + pthread_t mThreadId; + std::string mName; + int32_t mCpuId; + std::function mFunc; +}; + +typedef std::shared_ptr ThreadPtr; + +__UT_THREAD_DECL_TMPL_FUNC_ARG__ +static inline ThreadPtr CreateThread(__UT_THREAD_TMPL_FUNC_ARG__) +{ + return ThreadPtr(new Thread(__UT_THREAD_BIND_FUNC_ARG__)); +} + +__UT_THREAD_DECL_TMPL_FUNC_ARG__ +static inline ThreadPtr CreateThreadEx(const std::string& name, int32_t cpuId, __UT_THREAD_TMPL_FUNC_ARG__) +{ + return ThreadPtr(new Thread(name, cpuId, __UT_THREAD_BIND_FUNC_ARG__)); +} + +} +} + +#endif//__UT_THREAD_HPP__ diff --git a/unitree_SDK/include/unitree/common/thread/thread_decl.hpp b/unitree_SDK/include/unitree/common/thread/thread_decl.hpp new file mode 100644 index 0000000..0e2d374 --- /dev/null +++ b/unitree_SDK/include/unitree/common/thread/thread_decl.hpp @@ -0,0 +1,20 @@ +#ifndef __UT_THREAD_DECL_HPP__ +#define __UT_THREAD_DECL_HPP__ + +#include +#include +#include +#include + +#define __UT_THREAD_DECL_TMPL_FUNC_ARG__ \ + template + +#define __UT_THREAD_TMPL_FUNC_ARG__ \ + Func&& func, Args&&... args + +#define __UT_THREAD_BIND_FUNC_ARG__ \ + std::forward(func), std::forward(args)... + +#define UT_CPU_ID_NONE -1 + +#endif//__THREAD_DECL_HPP__ diff --git a/unitree_SDK/include/unitree/common/thread/thread_pool.hpp b/unitree_SDK/include/unitree/common/thread/thread_pool.hpp new file mode 100644 index 0000000..e99d240 --- /dev/null +++ b/unitree_SDK/include/unitree/common/thread/thread_pool.hpp @@ -0,0 +1,98 @@ +#ifndef __UT_THREAD_POOL_HPP__ +#define __UT_THREAD_POOL_HPP__ + +#include +#include +#include +#include + +namespace unitree +{ +namespace common +{ +class ThreadPool +{ +public: + enum + { + /* + * minimum threads can be created. + */ + MIN_THREAD_NUMBER = 1, + /* + * maximum threads can be created. + */ + MAX_THREAD_NUMBER = 1000, + /* + * default timeout get task from blockqueue. + * 1 second + */ + QUEUE_GET_TIMEOUT_MICROSEC = 1000000, + /* + * default max queue size. + * as UT_QUEUE_MAX_LEN + */ + MAX_QUEUE_SIZE = UT_QUEUE_MAX_LEN, + /* + * default in queue time in microsecond. + * 7 days + */ + MAX_QUEUE_MICROSEC = 25200000000 + }; + + explicit ThreadPool(uint32_t threadNumber = MIN_THREAD_NUMBER, + uint32_t queueMaxSize = UT_QUEUE_MAX_LEN, + uint64_t taskMaxQueueMicrosec = MAX_QUEUE_MICROSEC); + + __UT_THREAD_DECL_TMPL_FUNC_ARG__ + bool AddTask(__UT_THREAD_TMPL_FUNC_ARG__) + { + return AddTaskInner(ThreadTaskPtr(new ThreadTask(__UT_THREAD_BIND_FUNC_ARG__))); + } + + __UT_THREAD_DECL_TMPL_FUNC_ARG__ + FuturePtr AddTaskFuture(__UT_THREAD_TMPL_FUNC_ARG__) + { + ThreadTaskFuturePtr taskPtr = ThreadTaskFuturePtr( + new ThreadTaskFuture(__UT_THREAD_BIND_FUNC_ARG__)); + + if (AddTaskInner(std::dynamic_pointer_cast(taskPtr))) + { + return taskPtr->GetFuture(); + } + + return FuturePtr(); + } + + int32_t DoTask(); + uint64_t GetTaskSize(); + + bool IsQuit(); + void Quit(bool waitThreadExit = true); + + bool IsTaskOverdue(uint64_t enqueueTime); + +private: + bool AddTaskInner(ThreadTaskPtr taskptr); + + void InitCreateThread(); + void WaitThreadExit(); + +private: + volatile bool mQuit; + + uint32_t mThreadNumber; + uint32_t mTaskQueueMaxSize; + uint64_t mTaskMaxQueueTime; + + BlockQueue mTaskQueue; + std::vector mThreadList; + + Logger* mLogger; +}; + +typedef std::shared_ptr ThreadPoolPtr; + +} +} +#endif//__UT_THREAD_POOL_HPP__ diff --git a/unitree_SDK/include/unitree/common/thread/thread_task.hpp b/unitree_SDK/include/unitree/common/thread/thread_task.hpp new file mode 100644 index 0000000..ac82341 --- /dev/null +++ b/unitree_SDK/include/unitree/common/thread/thread_task.hpp @@ -0,0 +1,47 @@ +#ifndef __UT_THREAD_TASK_HPP__ +#define __UT_THREAD_TASK_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +class ThreadTask +{ +public: + __UT_THREAD_DECL_TMPL_FUNC_ARG__ + explicit ThreadTask(__UT_THREAD_TMPL_FUNC_ARG__) + { + mFunc = std::bind(__UT_THREAD_BIND_FUNC_ARG__); + } + + virtual void Execute(); + + void SetEnqueueTime(); + uint64_t GetEnqueueTime() const; + +protected: + uint64_t mEnqueueTimeMicrosec; + std::function mFunc; +}; + +typedef std::shared_ptr ThreadTaskPtr; + +class ThreadTaskFuture : public ThreadTask, public FutureWrapper +{ +public: + __UT_THREAD_DECL_TMPL_FUNC_ARG__ + explicit ThreadTaskFuture(__UT_THREAD_TMPL_FUNC_ARG__) + : ThreadTask(__UT_THREAD_BIND_FUNC_ARG__) + {} + + void Execute(); +}; + +typedef std::shared_ptr ThreadTaskFuturePtr; + +} +} + +#endif//__UT_THREAD_TASK_HPP__ diff --git a/unitree_SDK/include/unitree/common/time/sleep.hpp b/unitree_SDK/include/unitree/common/time/sleep.hpp new file mode 100644 index 0000000..739a56a --- /dev/null +++ b/unitree_SDK/include/unitree/common/time/sleep.hpp @@ -0,0 +1,17 @@ +#ifndef __UT_SLEEP_HPP__ +#define __UT_SLEEP_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +void MicroSleep(uint64_t microsecond); +void MilliSleep(uint64_t millisecond); +void Sleep(uint64_t second); + +} +} + +#endif//__UT_SLEEP_HPP__ diff --git a/unitree_SDK/include/unitree/common/time/time_tool.hpp b/unitree_SDK/include/unitree/common/time/time_tool.hpp new file mode 100644 index 0000000..ad40182 --- /dev/null +++ b/unitree_SDK/include/unitree/common/time/time_tool.hpp @@ -0,0 +1,81 @@ +#ifndef __UT_TIME_TOOL_HPP__ +#define __UT_TIME_TOOL_HPP__ + +#include + +namespace unitree +{ +namespace common +{ +#define UT_NUMER_NANO 1000000000 +#define UT_NUMER_MICRO 1000000 +#define UT_NUMER_MILLI 1000 + +//default time format: "YEAR-MON-DAY HOUR:MIN:SEC" +#define UT_TIME_FORMAT_STR "%d-%02d-%02d %02d:%02d:%02d" + +//default precise time format: "YEAR-MON-DAY HOUR:MIN:SEC.[MILLI/MICRO]" +#define UT_TIME_MICROSEC_FORMAT_STR "%d-%02d-%02d %02d:%02d:%02d.%06d" +#define UT_TIME_MILLISEC_FORMAT_STR "%d-%02d-%02d %02d:%02d:%02d.%03d" + +void GetCurrentTimeval(struct timeval& tv); +void GetCurrentTimespec(struct timespec& ts); + +uint64_t GetCurrentTime(); +uint64_t GetCurrentTimeNanosecond(); +uint64_t GetCurrentTimeMicrosecond(); +uint64_t GetCurrentTimeMillisecond(); + +uint64_t GetCurrentCpuTimeNanosecond(); +uint64_t GetCurrentThreadCpuTimeNanosecond(); +uint64_t GetCurrentMonotonicTimeNanosecond(); + +uint64_t GetCurrentCpuTimeMicrosecond(); +uint64_t GetCurrentThreadCpuTimeMicrosecond(); +uint64_t GetCurrentMonotonicTimeMicrosecond(); + +uint64_t TimevalToMicrosecond(const struct timeval& tv); +uint64_t TimevalToMillisecond(const struct timeval& tv); + +uint64_t TimespecToMicrosecond(const struct timespec& ts); +uint64_t TimespecToMillisecond(const struct timespec& ts); + +void MicrosecondToTimeval(uint64_t microsec, struct timeval& tv); +void MillisecondToTimeval(uint64_t millisec, struct timeval& tv); + +void MicrosecondToTimespec(uint64_t microsec, struct timespec& ts); +void MillisecondToTimespec(uint64_t millisec, struct timespec& ts); + +std::string TimeFormatString(struct tm* tmptr, const char* format = UT_TIME_FORMAT_STR); +std::string TimeFormatString(struct tm* tmptr, uint64_t precise, const char* format); +std::string TimeFormatString(uint64_t sec, const char* format = UT_TIME_FORMAT_STR); + +std::string TimeMicrosecondFormatString(const uint64_t& microsec, + const char* format = UT_TIME_MICROSEC_FORMAT_STR); + +std::string TimeMillisecondFormatString(const uint64_t& millisec, + const char* format = UT_TIME_MILLISEC_FORMAT_STR); + +std::string GetTimeString(); +std::string GetTimeMicrosecondString(); +std::string GetTimeMillisecondString(); + +class Timer +{ +public: + Timer(); + ~Timer(); + + void Start(); + void Restart(); + + uint64_t Stop(); + +private: + uint64_t mMicrosecond; +}; + +} +} + +#endif//__UT_TIME_TOOL_HPP__ diff --git a/unitree_SDK/include/unitree/idl/go2/AudioData_.hpp b/unitree_SDK/include/unitree/idl/go2/AudioData_.hpp new file mode 100644 index 0000000..8972dad --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/AudioData_.hpp @@ -0,0 +1,351 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: AudioData_.idl + Source: AudioData_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_AUDIODATA__HPP +#define DDSCXX_UNITREE_IDL_GO2_AUDIODATA__HPP + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class AudioData_ +{ +private: + uint64_t time_frame_ = 0; + std::vector data_; + +public: + AudioData_() = default; + + explicit AudioData_( + uint64_t time_frame, + const std::vector& data) : + time_frame_(time_frame), + data_(data) { } + + uint64_t time_frame() const { return this->time_frame_; } + uint64_t& time_frame() { return this->time_frame_; } + void time_frame(uint64_t _val_) { this->time_frame_ = _val_; } + const std::vector& data() const { return this->data_; } + std::vector& data() { return this->data_; } + void data(const std::vector& _val_) { this->data_ = _val_; } + void data(std::vector&& _val_) { this->data_ = _val_; } + + bool operator==(const AudioData_& _other) const + { + (void) _other; + return time_frame_ == _other.time_frame_ && + data_ == _other.data_; + } + + bool operator!=(const AudioData_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::AudioData_>::getTypeName() +{ + return "unitree_go::msg::dds_::AudioData_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::AudioData_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::AudioData_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::AudioData_>::type_map_blob_sz() { return 270; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::AudioData_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::AudioData_>::type_map_blob() { + static const uint8_t blob[] = { + 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xb3, 0xbd, 0x63, 0xa8, 0xda, 0x34, 0x7d, + 0x95, 0xbc, 0x6d, 0xad, 0xc9, 0xa2, 0xe8, 0x00, 0x38, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x2d, 0x24, 0x8b, 0x17, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, + 0x8d, 0x77, 0x7f, 0x38, 0x8f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x53, 0x16, 0x41, + 0x76, 0x22, 0xff, 0x70, 0xd8, 0x4b, 0x56, 0xaf, 0x39, 0x1a, 0x93, 0x00, 0x77, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x44, 0x61, 0x74, 0x61, + 0x5f, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x74, 0x69, 0x6d, 0x65, + 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x00, + 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xf2, 0x53, 0x16, 0x41, 0x76, 0x22, 0xff, 0x70, 0xd8, 0x4b, 0x56, 0xaf, 0x39, 0x1a, 0x93, 0xf1, + 0xb3, 0xbd, 0x63, 0xa8, 0xda, 0x34, 0x7d, 0x95, 0xbc, 0x6d, 0xad, 0xc9, 0xa2, 0xe8, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::AudioData_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xb3, 0xbd, 0x63, 0xa8, 0xda, 0x34, 0x7d, 0x95, 0xbc, 0x6d, 0xad, + 0xc9, 0xa2, 0xe8, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x53, 0x16, 0x41, 0x76, 0x22, 0xff, 0x70, 0xd8, 0x4b, 0x56, 0xaf, + 0x39, 0x1a, 0x93, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::AudioData_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::AudioData_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::AudioData_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::AudioData_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::AudioData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.time_frame())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!write(streamer, se_1)) + return false; + if (se_1 > 0 && + !write(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::AudioData_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::AudioData_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::AudioData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.time_frame())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!read(streamer, se_1)) + return false; + instance.data().resize(se_1); + if (se_1 > 0 && + !read(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::AudioData_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::AudioData_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::AudioData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.time_frame())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!move(streamer, se_1)) + return false; + if (se_1 > 0 && + !move(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::AudioData_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::AudioData_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::AudioData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.time_frame())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + if (se_1 > 0 && + !max(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::AudioData_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::AudioData_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_AUDIODATA__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/BmsCmd_.hpp b/unitree_SDK/include/unitree/idl/go2/BmsCmd_.hpp new file mode 100644 index 0000000..2648835 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/BmsCmd_.hpp @@ -0,0 +1,321 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: BmsCmd_.idl + Source: BmsCmd_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_BMSCMD__HPP +#define DDSCXX_UNITREE_IDL_GO2_BMSCMD__HPP + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class BmsCmd_ +{ +private: + uint8_t off_ = 0; + std::array reserve_ = { }; + +public: + BmsCmd_() = default; + + explicit BmsCmd_( + uint8_t off, + const std::array& reserve) : + off_(off), + reserve_(reserve) { } + + uint8_t off() const { return this->off_; } + uint8_t& off() { return this->off_; } + void off(uint8_t _val_) { this->off_ = _val_; } + const std::array& reserve() const { return this->reserve_; } + std::array& reserve() { return this->reserve_; } + void reserve(const std::array& _val_) { this->reserve_ = _val_; } + void reserve(std::array&& _val_) { this->reserve_ = _val_; } + + bool operator==(const BmsCmd_& _other) const + { + (void) _other; + return off_ == _other.off_ && + reserve_ == _other.reserve_; + } + + bool operator!=(const BmsCmd_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::BmsCmd_>::getTypeName() +{ + return "unitree_go::msg::dds_::BmsCmd_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::BmsCmd_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::BmsCmd_>::type_map_blob_sz() { return 278; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::BmsCmd_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::BmsCmd_>::type_map_blob() { + static const uint8_t blob[] = { + 0x56, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x3e, 0x8e, 0xb6, 0x7c, 0x25, 0xfd, 0xe0, + 0x7e, 0x52, 0xcf, 0x51, 0xed, 0x4a, 0x23, 0x00, 0x3e, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x32, 0x62, 0xd4, 0x8d, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x02, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0x31, 0xa8, 0x59, 0x24, 0x05, 0x6b, 0x7a, 0xf3, 0xd3, 0xf1, 0x6b, + 0x34, 0x22, 0x33, 0x00, 0x76, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x42, + 0x6d, 0x73, 0x43, 0x6d, 0x64, 0x5f, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x6f, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x31, 0xa8, 0x59, 0x24, 0x05, 0x6b, 0x7a, + 0xf3, 0xd3, 0xf1, 0x6b, 0x34, 0x22, 0x33, 0xf1, 0x3e, 0x8e, 0xb6, 0x7c, 0x25, 0xfd, 0xe0, 0x7e, + 0x52, 0xcf, 0x51, 0xed, 0x4a, 0x23, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::BmsCmd_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x3e, 0x8e, 0xb6, 0x7c, 0x25, 0xfd, 0xe0, 0x7e, 0x52, 0xcf, 0x51, + 0xed, 0x4a, 0x23, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x31, 0xa8, 0x59, 0x24, 0x05, 0x6b, 0x7a, 0xf3, 0xd3, 0xf1, 0x6b, + 0x34, 0x22, 0x33, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::BmsCmd_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::BmsCmd_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::BmsCmd_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::BmsCmd_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::BmsCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.off())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::BmsCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::BmsCmd_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::BmsCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.off())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::BmsCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::BmsCmd_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::BmsCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.off())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::BmsCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::BmsCmd_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::BmsCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.off())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::BmsCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::BmsCmd_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_BMSCMD__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/BmsState_.hpp b/unitree_SDK/include/unitree/idl/go2/BmsState_.hpp new file mode 100644 index 0000000..ea45288 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/BmsState_.hpp @@ -0,0 +1,651 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: BmsState_.idl + Source: BmsState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_BMSSTATE__HPP +#define DDSCXX_UNITREE_IDL_GO2_BMSSTATE__HPP + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class BmsState_ +{ +private: + uint8_t version_high_ = 0; + uint8_t version_low_ = 0; + uint8_t status_ = 0; + uint8_t soc_ = 0; + int32_t current_ = 0; + uint16_t cycle_ = 0; + std::array bq_ntc_ = { }; + std::array mcu_ntc_ = { }; + std::array cell_vol_ = { }; + +public: + BmsState_() = default; + + explicit BmsState_( + uint8_t version_high, + uint8_t version_low, + uint8_t status, + uint8_t soc, + int32_t current, + uint16_t cycle, + const std::array& bq_ntc, + const std::array& mcu_ntc, + const std::array& cell_vol) : + version_high_(version_high), + version_low_(version_low), + status_(status), + soc_(soc), + current_(current), + cycle_(cycle), + bq_ntc_(bq_ntc), + mcu_ntc_(mcu_ntc), + cell_vol_(cell_vol) { } + + uint8_t version_high() const { return this->version_high_; } + uint8_t& version_high() { return this->version_high_; } + void version_high(uint8_t _val_) { this->version_high_ = _val_; } + uint8_t version_low() const { return this->version_low_; } + uint8_t& version_low() { return this->version_low_; } + void version_low(uint8_t _val_) { this->version_low_ = _val_; } + uint8_t status() const { return this->status_; } + uint8_t& status() { return this->status_; } + void status(uint8_t _val_) { this->status_ = _val_; } + uint8_t soc() const { return this->soc_; } + uint8_t& soc() { return this->soc_; } + void soc(uint8_t _val_) { this->soc_ = _val_; } + int32_t current() const { return this->current_; } + int32_t& current() { return this->current_; } + void current(int32_t _val_) { this->current_ = _val_; } + uint16_t cycle() const { return this->cycle_; } + uint16_t& cycle() { return this->cycle_; } + void cycle(uint16_t _val_) { this->cycle_ = _val_; } + const std::array& bq_ntc() const { return this->bq_ntc_; } + std::array& bq_ntc() { return this->bq_ntc_; } + void bq_ntc(const std::array& _val_) { this->bq_ntc_ = _val_; } + void bq_ntc(std::array&& _val_) { this->bq_ntc_ = _val_; } + const std::array& mcu_ntc() const { return this->mcu_ntc_; } + std::array& mcu_ntc() { return this->mcu_ntc_; } + void mcu_ntc(const std::array& _val_) { this->mcu_ntc_ = _val_; } + void mcu_ntc(std::array&& _val_) { this->mcu_ntc_ = _val_; } + const std::array& cell_vol() const { return this->cell_vol_; } + std::array& cell_vol() { return this->cell_vol_; } + void cell_vol(const std::array& _val_) { this->cell_vol_ = _val_; } + void cell_vol(std::array&& _val_) { this->cell_vol_ = _val_; } + + bool operator==(const BmsState_& _other) const + { + (void) _other; + return version_high_ == _other.version_high_ && + version_low_ == _other.version_low_ && + status_ == _other.status_ && + soc_ == _other.soc_ && + current_ == _other.current_ && + cycle_ == _other.cycle_ && + bq_ntc_ == _other.bq_ntc_ && + mcu_ntc_ == _other.mcu_ntc_ && + cell_vol_ == _other.cell_vol_; + } + + bool operator!=(const BmsState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::BmsState_>::getTypeName() +{ + return "unitree_go::msg::dds_::BmsState_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::BmsState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::BmsState_>::type_map_blob_sz() { return 642; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::BmsState_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::BmsState_>::type_map_blob() { + static const uint8_t blob[] = { + 0xde, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xe1, 0x18, 0xaf, 0x07, 0x0b, 0xa2, 0x0b, + 0xc2, 0xe0, 0x37, 0x0c, 0xec, 0x4c, 0xbb, 0x00, 0xc6, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x75, 0x6a, 0xda, 0x84, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x51, 0x99, 0x89, 0x90, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x9a, 0xcb, 0x44, 0x54, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xc7, 0xd5, 0xf8, 0x49, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x43, 0xb5, 0xc9, 0x17, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x9a, 0x4c, 0x07, 0x40, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x2a, 0x42, 0xc9, 0x1e, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x55, 0x65, 0x52, 0x17, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x06, 0x2d, 0x87, + 0xc3, 0x55, 0x00, 0x00, 0x73, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x2e, 0xd8, 0x57, + 0xec, 0xb6, 0xb3, 0x05, 0x79, 0x80, 0x8c, 0x15, 0xfd, 0x14, 0x3d, 0x00, 0x5b, 0x01, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x42, 0x6d, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x69, 0x67, 0x68, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x6f, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x07, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x6f, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x63, 0x79, 0x63, 0x6c, + 0x65, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x62, 0x71, 0x5f, 0x6e, 0x74, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6d, 0x63, 0x75, 0x5f, 0x6e, 0x74, 0x63, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x63, 0x65, 0x6c, 0x6c, 0x5f, 0x76, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0x2e, 0xd8, 0x57, 0xec, 0xb6, 0xb3, 0x05, 0x79, 0x80, 0x8c, 0x15, + 0xfd, 0x14, 0x3d, 0xf1, 0xe1, 0x18, 0xaf, 0x07, 0x0b, 0xa2, 0x0b, 0xc2, 0xe0, 0x37, 0x0c, 0xec, + 0x4c, 0xbb, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::BmsState_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xe1, 0x18, 0xaf, 0x07, 0x0b, 0xa2, 0x0b, 0xc2, 0xe0, 0x37, 0x0c, + 0xec, 0x4c, 0xbb, 0x00, 0xca, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x2e, 0xd8, 0x57, 0xec, 0xb6, 0xb3, 0x05, 0x79, 0x80, 0x8c, 0x15, + 0xfd, 0x14, 0x3d, 0x00, 0x5f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::BmsState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::BmsState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::BmsState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::BmsState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::BmsState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.version_high())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.version_low())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.status())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.soc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.cycle())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.bq_ntc()[0], instance.bq_ntc().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.mcu_ntc()[0], instance.mcu_ntc().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.cell_vol()[0], instance.cell_vol().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::BmsState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::BmsState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::BmsState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.version_high())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.version_low())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.status())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.soc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.cycle())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.bq_ntc()[0], instance.bq_ntc().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.mcu_ntc()[0], instance.mcu_ntc().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.cell_vol()[0], instance.cell_vol().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::BmsState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::BmsState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::BmsState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.version_high())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.version_low())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.status())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.soc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.cycle())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.bq_ntc()[0], instance.bq_ntc().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.mcu_ntc()[0], instance.mcu_ntc().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.cell_vol()[0], instance.cell_vol().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::BmsState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::BmsState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::BmsState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.version_high())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.version_low())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.status())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.soc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.cycle())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.bq_ntc()[0], instance.bq_ntc().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.mcu_ntc()[0], instance.mcu_ntc().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.cell_vol()[0], instance.cell_vol().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::BmsState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::BmsState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_BMSSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/ConfigChangeStatus_.hpp b/unitree_SDK/include/unitree/idl/go2/ConfigChangeStatus_.hpp new file mode 100644 index 0000000..cc00ad6 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/ConfigChangeStatus_.hpp @@ -0,0 +1,309 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: ConfigChangeStatus_.idl + Source: ConfigChangeStatus_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_CONFIGCHANGESTATUS__HPP +#define DDSCXX_UNITREE_IDL_GO2_CONFIGCHANGESTATUS__HPP + +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class ConfigChangeStatus_ +{ +private: + std::string name_; + std::string content_; + +public: + ConfigChangeStatus_() = default; + + explicit ConfigChangeStatus_( + const std::string& name, + const std::string& content) : + name_(name), + content_(content) { } + + const std::string& name() const { return this->name_; } + std::string& name() { return this->name_; } + void name(const std::string& _val_) { this->name_ = _val_; } + void name(std::string&& _val_) { this->name_ = _val_; } + const std::string& content() const { return this->content_; } + std::string& content() { return this->content_; } + void content(const std::string& _val_) { this->content_ = _val_; } + void content(std::string&& _val_) { this->content_ = _val_; } + + bool operator==(const ConfigChangeStatus_& _other) const + { + (void) _other; + return name_ == _other.name_ && + content_ == _other.content_; + } + + bool operator!=(const ConfigChangeStatus_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::ConfigChangeStatus_>::getTypeName() +{ + return "unitree_go::msg::dds_::ConfigChangeStatus_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::ConfigChangeStatus_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::ConfigChangeStatus_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::ConfigChangeStatus_>::type_map_blob_sz() { return 266; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::ConfigChangeStatus_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::ConfigChangeStatus_>::type_map_blob() { + static const uint8_t blob[] = { + 0x4c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x8b, 0xab, 0x72, 0x41, 0x14, 0x34, 0x88, + 0x06, 0xaa, 0x92, 0xd1, 0x55, 0xf0, 0xe9, 0x00, 0x34, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0xb0, 0x68, 0x93, 0x1c, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x9a, 0x03, 0x64, 0xb9, + 0x8e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xb5, 0xf8, 0x3d, 0x36, 0xf2, 0x55, 0x84, + 0x27, 0x72, 0xfc, 0x68, 0x2f, 0x66, 0xf5, 0x00, 0x76, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x70, 0x00, 0x08, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xb5, 0xf8, 0x3d, + 0x36, 0xf2, 0x55, 0x84, 0x27, 0x72, 0xfc, 0x68, 0x2f, 0x66, 0xf5, 0xf1, 0x8b, 0xab, 0x72, 0x41, + 0x14, 0x34, 0x88, 0x06, 0xaa, 0x92, 0xd1, 0x55, 0xf0, 0xe9, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::ConfigChangeStatus_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x8b, 0xab, 0x72, 0x41, 0x14, 0x34, 0x88, 0x06, 0xaa, 0x92, 0xd1, + 0x55, 0xf0, 0xe9, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xb5, 0xf8, 0x3d, 0x36, 0xf2, 0x55, 0x84, 0x27, 0x72, 0xfc, 0x68, + 0x2f, 0x66, 0xf5, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::ConfigChangeStatus_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::ConfigChangeStatus_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::ConfigChangeStatus_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::ConfigChangeStatus_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::ConfigChangeStatus_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.name(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.content(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::ConfigChangeStatus_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::ConfigChangeStatus_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::ConfigChangeStatus_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.name(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.content(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::ConfigChangeStatus_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::ConfigChangeStatus_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::ConfigChangeStatus_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.name(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.content(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::ConfigChangeStatus_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::ConfigChangeStatus_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::ConfigChangeStatus_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.name(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.content(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::ConfigChangeStatus_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::ConfigChangeStatus_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_CONFIGCHANGESTATUS__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/Error_.hpp b/unitree_SDK/include/unitree/idl/go2/Error_.hpp new file mode 100644 index 0000000..c3e761c --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/Error_.hpp @@ -0,0 +1,301 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Error_.idl + Source: Error_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_ERROR__HPP +#define DDSCXX_UNITREE_IDL_GO2_ERROR__HPP + +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class Error_ +{ +private: + uint32_t source_ = 0; + uint32_t state_ = 0; + +public: + Error_() = default; + + explicit Error_( + uint32_t source, + uint32_t state) : + source_(source), + state_(state) { } + + uint32_t source() const { return this->source_; } + uint32_t& source() { return this->source_; } + void source(uint32_t _val_) { this->source_ = _val_; } + uint32_t state() const { return this->state_; } + uint32_t& state() { return this->state_; } + void state(uint32_t _val_) { this->state_ = _val_; } + + bool operator==(const Error_& _other) const + { + (void) _other; + return source_ == _other.source_ && + state_ == _other.state_; + } + + bool operator!=(const Error_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::Error_>::getTypeName() +{ + return "unitree_go::msg::dds_::Error_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::Error_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::Error_>::type_map_blob_sz() { return 254; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::Error_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::Error_>::type_map_blob() { + static const uint8_t blob[] = { + 0x4b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x76, 0x79, 0x56, 0x84, 0x80, 0x73, 0x64, + 0x1f, 0xee, 0x3b, 0xc7, 0x0e, 0xd6, 0x56, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x36, 0xcd, 0x38, 0xf4, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x9e, 0xd3, 0x9e, 0x2e, 0x00, + 0x84, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x8f, 0x76, 0x98, 0x54, 0xc5, 0x14, 0x4a, + 0x4b, 0x4c, 0xbf, 0xbe, 0x7d, 0xd9, 0x1f, 0x00, 0x6c, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xf2, 0x8f, 0x76, 0x98, 0x54, 0xc5, 0x14, 0x4a, 0x4b, 0x4c, 0xbf, 0xbe, 0x7d, 0xd9, 0x1f, 0xf1, + 0x76, 0x79, 0x56, 0x84, 0x80, 0x73, 0x64, 0x1f, 0xee, 0x3b, 0xc7, 0x0e, 0xd6, 0x56, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::Error_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x76, 0x79, 0x56, 0x84, 0x80, 0x73, 0x64, 0x1f, 0xee, 0x3b, 0xc7, + 0x0e, 0xd6, 0x56, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x8f, 0x76, 0x98, 0x54, 0xc5, 0x14, 0x4a, 0x4b, 0x4c, 0xbf, 0xbe, + 0x7d, 0xd9, 0x1f, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::Error_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::Error_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::Error_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::Error_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::Error_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.source())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::Error_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Error_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::Error_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.source())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::Error_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Error_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::Error_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.source())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::Error_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Error_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::Error_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.source())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::Error_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Error_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_ERROR__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/Go2FrontVideoData_.hpp b/unitree_SDK/include/unitree/idl/go2/Go2FrontVideoData_.hpp new file mode 100644 index 0000000..6d3537f --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/Go2FrontVideoData_.hpp @@ -0,0 +1,523 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Go2FrontVideoData_.idl + Source: Go2FrontVideoData_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_GO2FRONTVIDEODATA__HPP +#define DDSCXX_UNITREE_IDL_GO2_GO2FRONTVIDEODATA__HPP + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class Go2FrontVideoData_ +{ +private: + uint64_t time_frame_ = 0; + std::vector video720p_; + std::vector video360p_; + std::vector video180p_; + +public: + Go2FrontVideoData_() = default; + + explicit Go2FrontVideoData_( + uint64_t time_frame, + const std::vector& video720p, + const std::vector& video360p, + const std::vector& video180p) : + time_frame_(time_frame), + video720p_(video720p), + video360p_(video360p), + video180p_(video180p) { } + + uint64_t time_frame() const { return this->time_frame_; } + uint64_t& time_frame() { return this->time_frame_; } + void time_frame(uint64_t _val_) { this->time_frame_ = _val_; } + const std::vector& video720p() const { return this->video720p_; } + std::vector& video720p() { return this->video720p_; } + void video720p(const std::vector& _val_) { this->video720p_ = _val_; } + void video720p(std::vector&& _val_) { this->video720p_ = _val_; } + const std::vector& video360p() const { return this->video360p_; } + std::vector& video360p() { return this->video360p_; } + void video360p(const std::vector& _val_) { this->video360p_ = _val_; } + void video360p(std::vector&& _val_) { this->video360p_ = _val_; } + const std::vector& video180p() const { return this->video180p_; } + std::vector& video180p() { return this->video180p_; } + void video180p(const std::vector& _val_) { this->video180p_ = _val_; } + void video180p(std::vector&& _val_) { this->video180p_ = _val_; } + + bool operator==(const Go2FrontVideoData_& _other) const + { + (void) _other; + return time_frame_ == _other.time_frame_ && + video720p_ == _other.video720p_ && + video360p_ == _other.video360p_ && + video180p_ == _other.video180p_; + } + + bool operator!=(const Go2FrontVideoData_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::Go2FrontVideoData_>::getTypeName() +{ + return "unitree_go::msg::dds_::Go2FrontVideoData_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::Go2FrontVideoData_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::Go2FrontVideoData_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::Go2FrontVideoData_>::type_map_blob_sz() { return 386; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::Go2FrontVideoData_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::Go2FrontVideoData_>::type_map_blob() { + static const uint8_t blob[] = { + 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x75, 0x67, 0x61, 0x59, 0x75, 0x39, 0xc1, + 0x45, 0x05, 0x1d, 0x51, 0xbe, 0x71, 0xb1, 0x00, 0x60, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x2d, 0x24, 0x8b, 0x17, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, + 0xd5, 0x57, 0x60, 0x01, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, + 0x01, 0x00, 0x00, 0x02, 0x1d, 0x38, 0x7d, 0x67, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, 0x04, 0xb8, 0xc7, 0x48, 0xdc, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0xc8, 0x74, 0x27, 0xb8, 0x30, 0xbd, 0x3d, 0x37, 0xbe, 0x7b, 0xec, + 0x40, 0x49, 0xe1, 0x00, 0xc4, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x32, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x47, + 0x6f, 0x32, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x44, 0x61, 0x74, 0x61, + 0x5f, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x74, 0x69, 0x6d, 0x65, + 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x00, + 0x76, 0x69, 0x64, 0x65, 0x6f, 0x37, 0x32, 0x30, 0x70, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x00, + 0x76, 0x69, 0x64, 0x65, 0x6f, 0x33, 0x36, 0x30, 0x70, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x00, + 0x76, 0x69, 0x64, 0x65, 0x6f, 0x31, 0x38, 0x30, 0x70, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0xc8, 0x74, 0x27, 0xb8, 0x30, 0xbd, 0x3d, 0x37, 0xbe, 0x7b, 0xec, + 0x40, 0x49, 0xe1, 0xf1, 0x75, 0x67, 0x61, 0x59, 0x75, 0x39, 0xc1, 0x45, 0x05, 0x1d, 0x51, 0xbe, + 0x71, 0xb1, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::Go2FrontVideoData_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x75, 0x67, 0x61, 0x59, 0x75, 0x39, 0xc1, 0x45, 0x05, 0x1d, 0x51, + 0xbe, 0x71, 0xb1, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xc8, 0x74, 0x27, 0xb8, 0x30, 0xbd, 0x3d, 0x37, 0xbe, 0x7b, 0xec, + 0x40, 0x49, 0xe1, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::Go2FrontVideoData_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::Go2FrontVideoData_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::Go2FrontVideoData_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::Go2FrontVideoData_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::Go2FrontVideoData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.time_frame())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.video720p().size()); + if (!write(streamer, se_1)) + return false; + if (se_1 > 0 && + !write(streamer, instance.video720p()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.video360p().size()); + if (!write(streamer, se_1)) + return false; + if (se_1 > 0 && + !write(streamer, instance.video360p()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.video180p().size()); + if (!write(streamer, se_1)) + return false; + if (se_1 > 0 && + !write(streamer, instance.video180p()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::Go2FrontVideoData_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Go2FrontVideoData_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::Go2FrontVideoData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.time_frame())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.video720p().size()); + if (!read(streamer, se_1)) + return false; + instance.video720p().resize(se_1); + if (se_1 > 0 && + !read(streamer, instance.video720p()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.video360p().size()); + if (!read(streamer, se_1)) + return false; + instance.video360p().resize(se_1); + if (se_1 > 0 && + !read(streamer, instance.video360p()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.video180p().size()); + if (!read(streamer, se_1)) + return false; + instance.video180p().resize(se_1); + if (se_1 > 0 && + !read(streamer, instance.video180p()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::Go2FrontVideoData_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Go2FrontVideoData_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::Go2FrontVideoData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.time_frame())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.video720p().size()); + if (!move(streamer, se_1)) + return false; + if (se_1 > 0 && + !move(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.video360p().size()); + if (!move(streamer, se_1)) + return false; + if (se_1 > 0 && + !move(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.video180p().size()); + if (!move(streamer, se_1)) + return false; + if (se_1 > 0 && + !move(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::Go2FrontVideoData_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Go2FrontVideoData_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::Go2FrontVideoData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.time_frame())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + if (se_1 > 0 && + !max(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + if (se_1 > 0 && + !max(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + if (se_1 > 0 && + !max(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::Go2FrontVideoData_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Go2FrontVideoData_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_GO2FRONTVIDEODATA__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/HeightMap_.hpp b/unitree_SDK/include/unitree/idl/go2/HeightMap_.hpp new file mode 100644 index 0000000..0ac09a6 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/HeightMap_.hpp @@ -0,0 +1,581 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: HeightMap_.idl + Source: HeightMap_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_HEIGHTMAP__HPP +#define DDSCXX_UNITREE_IDL_GO2_HEIGHTMAP__HPP + +#include +#include +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class HeightMap_ +{ +private: + double stamp_ = 0.0; + std::string frame_id_; + float resolution_ = 0.0f; + uint32_t width_ = 0; + uint32_t height_ = 0; + std::array origin_ = { }; + std::vector data_; + +public: + HeightMap_() = default; + + explicit HeightMap_( + double stamp, + const std::string& frame_id, + float resolution, + uint32_t width, + uint32_t height, + const std::array& origin, + const std::vector& data) : + stamp_(stamp), + frame_id_(frame_id), + resolution_(resolution), + width_(width), + height_(height), + origin_(origin), + data_(data) { } + + double stamp() const { return this->stamp_; } + double& stamp() { return this->stamp_; } + void stamp(double _val_) { this->stamp_ = _val_; } + const std::string& frame_id() const { return this->frame_id_; } + std::string& frame_id() { return this->frame_id_; } + void frame_id(const std::string& _val_) { this->frame_id_ = _val_; } + void frame_id(std::string&& _val_) { this->frame_id_ = _val_; } + float resolution() const { return this->resolution_; } + float& resolution() { return this->resolution_; } + void resolution(float _val_) { this->resolution_ = _val_; } + uint32_t width() const { return this->width_; } + uint32_t& width() { return this->width_; } + void width(uint32_t _val_) { this->width_ = _val_; } + uint32_t height() const { return this->height_; } + uint32_t& height() { return this->height_; } + void height(uint32_t _val_) { this->height_ = _val_; } + const std::array& origin() const { return this->origin_; } + std::array& origin() { return this->origin_; } + void origin(const std::array& _val_) { this->origin_ = _val_; } + void origin(std::array&& _val_) { this->origin_ = _val_; } + const std::vector& data() const { return this->data_; } + std::vector& data() { return this->data_; } + void data(const std::vector& _val_) { this->data_ = _val_; } + void data(std::vector&& _val_) { this->data_ = _val_; } + + bool operator==(const HeightMap_& _other) const + { + (void) _other; + return stamp_ == _other.stamp_ && + frame_id_ == _other.frame_id_ && + resolution_ == _other.resolution_ && + width_ == _other.width_ && + height_ == _other.height_ && + origin_ == _other.origin_ && + data_ == _other.data_; + } + + bool operator!=(const HeightMap_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::HeightMap_>::getTypeName() +{ + return "unitree_go::msg::dds_::HeightMap_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::HeightMap_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::HeightMap_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::HeightMap_>::type_map_blob_sz() { return 506; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::HeightMap_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::HeightMap_>::type_map_blob() { + static const uint8_t blob[] = { + 0xac, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x1f, 0x43, 0x34, 0x5b, 0x5b, 0x83, 0xd9, + 0xee, 0xf3, 0x84, 0x90, 0x47, 0xb5, 0x97, 0x00, 0x94, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x96, 0xb8, 0xc7, 0x8d, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x4b, 0xb3, 0x9c, 0x5c, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xb7, 0xe1, 0x64, 0xb3, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xea, 0xae, 0x26, 0xa6, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xb4, 0x35, 0xe2, 0x27, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x09, 0x7c, 0x49, 0xb1, 0x53, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x09, 0x8d, 0x77, 0x7f, 0x38, + 0x1f, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x23, 0x34, 0xab, 0xa3, 0x56, 0x73, 0x67, + 0xe5, 0x4e, 0xb6, 0x6f, 0x87, 0xb9, 0x09, 0x00, 0x07, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x4d, 0x61, 0x70, 0x5f, 0x00, 0x00, 0x00, + 0xcf, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x6f, + 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00, 0x77, 0x69, 0x64, 0x74, + 0x68, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x09, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x09, 0x05, 0x00, 0x00, 0x00, 0x64, 0x61, 0x74, 0x61, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x23, 0x34, 0xab, + 0xa3, 0x56, 0x73, 0x67, 0xe5, 0x4e, 0xb6, 0x6f, 0x87, 0xb9, 0x09, 0xf1, 0x1f, 0x43, 0x34, 0x5b, + 0x5b, 0x83, 0xd9, 0xee, 0xf3, 0x84, 0x90, 0x47, 0xb5, 0x97, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::HeightMap_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x1f, 0x43, 0x34, 0x5b, 0x5b, 0x83, 0xd9, 0xee, 0xf3, 0x84, 0x90, + 0x47, 0xb5, 0x97, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x23, 0x34, 0xab, 0xa3, 0x56, 0x73, 0x67, 0xe5, 0x4e, 0xb6, 0x6f, + 0x87, 0xb9, 0x09, 0x00, 0x0b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::HeightMap_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::HeightMap_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::HeightMap_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::HeightMap_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::HeightMap_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.origin()[0], instance.origin().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!write(streamer, se_1)) + return false; + if (se_1 > 0 && + !write(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::HeightMap_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::HeightMap_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::HeightMap_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.origin()[0], instance.origin().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!read(streamer, se_1)) + return false; + instance.data().resize(se_1); + if (se_1 > 0 && + !read(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::HeightMap_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::HeightMap_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::HeightMap_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.origin()[0], instance.origin().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!move(streamer, se_1)) + return false; + if (se_1 > 0 && + !move(streamer, float(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::HeightMap_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::HeightMap_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::HeightMap_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.origin()[0], instance.origin().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + if (se_1 > 0 && + !max(streamer, float(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::HeightMap_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::HeightMap_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_HEIGHTMAP__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/IMUState_.hpp b/unitree_SDK/include/unitree/idl/go2/IMUState_.hpp new file mode 100644 index 0000000..f2ab6f6 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/IMUState_.hpp @@ -0,0 +1,503 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: IMUState_.idl + Source: IMUState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_IMUSTATE__HPP +#define DDSCXX_UNITREE_IDL_GO2_IMUSTATE__HPP + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class IMUState_ +{ +private: + std::array quaternion_ = { }; + std::array gyroscope_ = { }; + std::array accelerometer_ = { }; + std::array rpy_ = { }; + uint8_t temperature_ = 0; + +public: + IMUState_() = default; + + explicit IMUState_( + const std::array& quaternion, + const std::array& gyroscope, + const std::array& accelerometer, + const std::array& rpy, + uint8_t temperature) : + quaternion_(quaternion), + gyroscope_(gyroscope), + accelerometer_(accelerometer), + rpy_(rpy), + temperature_(temperature) { } + + const std::array& quaternion() const { return this->quaternion_; } + std::array& quaternion() { return this->quaternion_; } + void quaternion(const std::array& _val_) { this->quaternion_ = _val_; } + void quaternion(std::array&& _val_) { this->quaternion_ = _val_; } + const std::array& gyroscope() const { return this->gyroscope_; } + std::array& gyroscope() { return this->gyroscope_; } + void gyroscope(const std::array& _val_) { this->gyroscope_ = _val_; } + void gyroscope(std::array&& _val_) { this->gyroscope_ = _val_; } + const std::array& accelerometer() const { return this->accelerometer_; } + std::array& accelerometer() { return this->accelerometer_; } + void accelerometer(const std::array& _val_) { this->accelerometer_ = _val_; } + void accelerometer(std::array&& _val_) { this->accelerometer_ = _val_; } + const std::array& rpy() const { return this->rpy_; } + std::array& rpy() { return this->rpy_; } + void rpy(const std::array& _val_) { this->rpy_ = _val_; } + void rpy(std::array&& _val_) { this->rpy_ = _val_; } + uint8_t temperature() const { return this->temperature_; } + uint8_t& temperature() { return this->temperature_; } + void temperature(uint8_t _val_) { this->temperature_ = _val_; } + + bool operator==(const IMUState_& _other) const + { + (void) _other; + return quaternion_ == _other.quaternion_ && + gyroscope_ == _other.gyroscope_ && + accelerometer_ == _other.accelerometer_ && + rpy_ == _other.rpy_ && + temperature_ == _other.temperature_; + } + + bool operator!=(const IMUState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::IMUState_>::getTypeName() +{ + return "unitree_go::msg::dds_::IMUState_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::IMUState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::IMUState_>::type_map_blob_sz() { return 498; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::IMUState_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::IMUState_>::type_map_blob() { + static const uint8_t blob[] = { + 0xab, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x4b, 0x1b, 0xf4, 0xaf, 0x32, 0xe5, 0xbc, + 0x67, 0x10, 0xef, 0xc8, 0x29, 0x31, 0x15, 0x00, 0x93, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x75, 0xb9, 0xaa, 0xa0, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x6b, 0x3b, 0x2d, 0x85, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x0e, 0x12, + 0x75, 0x69, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0xb0, 0x7d, 0x92, 0xed, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xee, 0xf4, 0x38, 0xf7, 0x00, + 0x16, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xc4, 0xec, 0xb4, 0x9c, 0xd7, 0xb2, 0x25, + 0xd2, 0x26, 0x28, 0xb6, 0xb7, 0x64, 0xcc, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x49, 0x4d, 0x55, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0xc6, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x71, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x67, 0x79, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x6f, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x72, 0x70, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0xc4, 0xec, 0xb4, 0x9c, 0xd7, 0xb2, 0x25, 0xd2, 0x26, 0x28, 0xb6, + 0xb7, 0x64, 0xcc, 0xf1, 0x4b, 0x1b, 0xf4, 0xaf, 0x32, 0xe5, 0xbc, 0x67, 0x10, 0xef, 0xc8, 0x29, + 0x31, 0x15, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::IMUState_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x4b, 0x1b, 0xf4, 0xaf, 0x32, 0xe5, 0xbc, 0x67, 0x10, 0xef, 0xc8, + 0x29, 0x31, 0x15, 0x00, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xc4, 0xec, 0xb4, 0x9c, 0xd7, 0xb2, 0x25, 0xd2, 0x26, 0x28, 0xb6, + 0xb7, 0x64, 0xcc, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::IMUState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::IMUState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::IMUState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::IMUState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::IMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::IMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::IMUState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::IMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::IMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::IMUState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::IMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::IMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::IMUState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::IMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::IMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::IMUState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_IMUSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/InterfaceConfig_.hpp b/unitree_SDK/include/unitree/idl/go2/InterfaceConfig_.hpp new file mode 100644 index 0000000..c55954f --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/InterfaceConfig_.hpp @@ -0,0 +1,363 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: InterfaceConfig_.idl + Source: InterfaceConfig_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_INTERFACECONFIG__HPP +#define DDSCXX_UNITREE_IDL_GO2_INTERFACECONFIG__HPP + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class InterfaceConfig_ +{ +private: + uint8_t mode_ = 0; + uint8_t value_ = 0; + std::array reserve_ = { }; + +public: + InterfaceConfig_() = default; + + explicit InterfaceConfig_( + uint8_t mode, + uint8_t value, + const std::array& reserve) : + mode_(mode), + value_(value), + reserve_(reserve) { } + + uint8_t mode() const { return this->mode_; } + uint8_t& mode() { return this->mode_; } + void mode(uint8_t _val_) { this->mode_ = _val_; } + uint8_t value() const { return this->value_; } + uint8_t& value() { return this->value_; } + void value(uint8_t _val_) { this->value_ = _val_; } + const std::array& reserve() const { return this->reserve_; } + std::array& reserve() { return this->reserve_; } + void reserve(const std::array& _val_) { this->reserve_ = _val_; } + void reserve(std::array&& _val_) { this->reserve_ = _val_; } + + bool operator==(const InterfaceConfig_& _other) const + { + (void) _other; + return mode_ == _other.mode_ && + value_ == _other.value_ && + reserve_ == _other.reserve_; + } + + bool operator!=(const InterfaceConfig_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::InterfaceConfig_>::getTypeName() +{ + return "unitree_go::msg::dds_::InterfaceConfig_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::InterfaceConfig_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::InterfaceConfig_>::type_map_blob_sz() { return 326; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::InterfaceConfig_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::InterfaceConfig_>::type_map_blob() { + static const uint8_t blob[] = { + 0x66, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x4f, 0x25, 0x85, 0x7b, 0xb1, 0x9a, 0x7b, + 0x3a, 0xaf, 0x05, 0x03, 0xdb, 0x8f, 0xa9, 0x00, 0x4e, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x20, 0x63, 0xc1, 0x60, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x00, 0xae, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0x11, 0x6e, 0x4e, 0x71, 0x6a, 0xb8, 0x9f, 0x44, 0x70, 0x5d, 0xb6, + 0x2b, 0x7d, 0x87, 0x00, 0x96, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x49, + 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x00, + 0x5a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x11, 0x6e, 0x4e, 0x71, 0x6a, 0xb8, 0x9f, + 0x44, 0x70, 0x5d, 0xb6, 0x2b, 0x7d, 0x87, 0xf1, 0x4f, 0x25, 0x85, 0x7b, 0xb1, 0x9a, 0x7b, 0x3a, + 0xaf, 0x05, 0x03, 0xdb, 0x8f, 0xa9, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::InterfaceConfig_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x4f, 0x25, 0x85, 0x7b, 0xb1, 0x9a, 0x7b, 0x3a, 0xaf, 0x05, 0x03, + 0xdb, 0x8f, 0xa9, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x11, 0x6e, 0x4e, 0x71, 0x6a, 0xb8, 0x9f, 0x44, 0x70, 0x5d, 0xb6, + 0x2b, 0x7d, 0x87, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::InterfaceConfig_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::InterfaceConfig_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::InterfaceConfig_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::InterfaceConfig_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::InterfaceConfig_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.value())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::InterfaceConfig_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::InterfaceConfig_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::InterfaceConfig_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.value())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::InterfaceConfig_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::InterfaceConfig_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::InterfaceConfig_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.value())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::InterfaceConfig_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::InterfaceConfig_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::InterfaceConfig_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.value())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::InterfaceConfig_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::InterfaceConfig_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_INTERFACECONFIG__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/LidarState_.hpp b/unitree_SDK/include/unitree/idl/go2/LidarState_.hpp new file mode 100644 index 0000000..7464d60 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/LidarState_.hpp @@ -0,0 +1,1007 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: LidarState_.idl + Source: LidarState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_LIDARSTATE__HPP +#define DDSCXX_UNITREE_IDL_GO2_LIDARSTATE__HPP + +#include +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class LidarState_ +{ +private: + double stamp_ = 0.0; + std::string firmware_version_; + std::string software_version_; + std::string sdk_version_; + float sys_rotation_speed_ = 0.0f; + float com_rotation_speed_ = 0.0f; + uint8_t error_state_ = 0; + uint8_t dirty_percentage_ = 0; + float cloud_frequency_ = 0.0f; + float cloud_packet_loss_rate_ = 0.0f; + uint32_t cloud_size_ = 0; + uint32_t cloud_scan_num_ = 0; + float imu_frequency_ = 0.0f; + float imu_packet_loss_rate_ = 0.0f; + std::array imu_rpy_ = { }; + double serial_recv_stamp_ = 0.0; + uint32_t serial_buffer_size_ = 0; + uint32_t serial_buffer_read_ = 0; + +public: + LidarState_() = default; + + explicit LidarState_( + double stamp, + const std::string& firmware_version, + const std::string& software_version, + const std::string& sdk_version, + float sys_rotation_speed, + float com_rotation_speed, + uint8_t error_state, + uint8_t dirty_percentage, + float cloud_frequency, + float cloud_packet_loss_rate, + uint32_t cloud_size, + uint32_t cloud_scan_num, + float imu_frequency, + float imu_packet_loss_rate, + const std::array& imu_rpy, + double serial_recv_stamp, + uint32_t serial_buffer_size, + uint32_t serial_buffer_read) : + stamp_(stamp), + firmware_version_(firmware_version), + software_version_(software_version), + sdk_version_(sdk_version), + sys_rotation_speed_(sys_rotation_speed), + com_rotation_speed_(com_rotation_speed), + error_state_(error_state), + dirty_percentage_(dirty_percentage), + cloud_frequency_(cloud_frequency), + cloud_packet_loss_rate_(cloud_packet_loss_rate), + cloud_size_(cloud_size), + cloud_scan_num_(cloud_scan_num), + imu_frequency_(imu_frequency), + imu_packet_loss_rate_(imu_packet_loss_rate), + imu_rpy_(imu_rpy), + serial_recv_stamp_(serial_recv_stamp), + serial_buffer_size_(serial_buffer_size), + serial_buffer_read_(serial_buffer_read) { } + + double stamp() const { return this->stamp_; } + double& stamp() { return this->stamp_; } + void stamp(double _val_) { this->stamp_ = _val_; } + const std::string& firmware_version() const { return this->firmware_version_; } + std::string& firmware_version() { return this->firmware_version_; } + void firmware_version(const std::string& _val_) { this->firmware_version_ = _val_; } + void firmware_version(std::string&& _val_) { this->firmware_version_ = _val_; } + const std::string& software_version() const { return this->software_version_; } + std::string& software_version() { return this->software_version_; } + void software_version(const std::string& _val_) { this->software_version_ = _val_; } + void software_version(std::string&& _val_) { this->software_version_ = _val_; } + const std::string& sdk_version() const { return this->sdk_version_; } + std::string& sdk_version() { return this->sdk_version_; } + void sdk_version(const std::string& _val_) { this->sdk_version_ = _val_; } + void sdk_version(std::string&& _val_) { this->sdk_version_ = _val_; } + float sys_rotation_speed() const { return this->sys_rotation_speed_; } + float& sys_rotation_speed() { return this->sys_rotation_speed_; } + void sys_rotation_speed(float _val_) { this->sys_rotation_speed_ = _val_; } + float com_rotation_speed() const { return this->com_rotation_speed_; } + float& com_rotation_speed() { return this->com_rotation_speed_; } + void com_rotation_speed(float _val_) { this->com_rotation_speed_ = _val_; } + uint8_t error_state() const { return this->error_state_; } + uint8_t& error_state() { return this->error_state_; } + void error_state(uint8_t _val_) { this->error_state_ = _val_; } + uint8_t dirty_percentage() const { return this->dirty_percentage_; } + uint8_t& dirty_percentage() { return this->dirty_percentage_; } + void dirty_percentage(uint8_t _val_) { this->dirty_percentage_ = _val_; } + float cloud_frequency() const { return this->cloud_frequency_; } + float& cloud_frequency() { return this->cloud_frequency_; } + void cloud_frequency(float _val_) { this->cloud_frequency_ = _val_; } + float cloud_packet_loss_rate() const { return this->cloud_packet_loss_rate_; } + float& cloud_packet_loss_rate() { return this->cloud_packet_loss_rate_; } + void cloud_packet_loss_rate(float _val_) { this->cloud_packet_loss_rate_ = _val_; } + uint32_t cloud_size() const { return this->cloud_size_; } + uint32_t& cloud_size() { return this->cloud_size_; } + void cloud_size(uint32_t _val_) { this->cloud_size_ = _val_; } + uint32_t cloud_scan_num() const { return this->cloud_scan_num_; } + uint32_t& cloud_scan_num() { return this->cloud_scan_num_; } + void cloud_scan_num(uint32_t _val_) { this->cloud_scan_num_ = _val_; } + float imu_frequency() const { return this->imu_frequency_; } + float& imu_frequency() { return this->imu_frequency_; } + void imu_frequency(float _val_) { this->imu_frequency_ = _val_; } + float imu_packet_loss_rate() const { return this->imu_packet_loss_rate_; } + float& imu_packet_loss_rate() { return this->imu_packet_loss_rate_; } + void imu_packet_loss_rate(float _val_) { this->imu_packet_loss_rate_ = _val_; } + const std::array& imu_rpy() const { return this->imu_rpy_; } + std::array& imu_rpy() { return this->imu_rpy_; } + void imu_rpy(const std::array& _val_) { this->imu_rpy_ = _val_; } + void imu_rpy(std::array&& _val_) { this->imu_rpy_ = _val_; } + double serial_recv_stamp() const { return this->serial_recv_stamp_; } + double& serial_recv_stamp() { return this->serial_recv_stamp_; } + void serial_recv_stamp(double _val_) { this->serial_recv_stamp_ = _val_; } + uint32_t serial_buffer_size() const { return this->serial_buffer_size_; } + uint32_t& serial_buffer_size() { return this->serial_buffer_size_; } + void serial_buffer_size(uint32_t _val_) { this->serial_buffer_size_ = _val_; } + uint32_t serial_buffer_read() const { return this->serial_buffer_read_; } + uint32_t& serial_buffer_read() { return this->serial_buffer_read_; } + void serial_buffer_read(uint32_t _val_) { this->serial_buffer_read_ = _val_; } + + bool operator==(const LidarState_& _other) const + { + (void) _other; + return stamp_ == _other.stamp_ && + firmware_version_ == _other.firmware_version_ && + software_version_ == _other.software_version_ && + sdk_version_ == _other.sdk_version_ && + sys_rotation_speed_ == _other.sys_rotation_speed_ && + com_rotation_speed_ == _other.com_rotation_speed_ && + error_state_ == _other.error_state_ && + dirty_percentage_ == _other.dirty_percentage_ && + cloud_frequency_ == _other.cloud_frequency_ && + cloud_packet_loss_rate_ == _other.cloud_packet_loss_rate_ && + cloud_size_ == _other.cloud_size_ && + cloud_scan_num_ == _other.cloud_scan_num_ && + imu_frequency_ == _other.imu_frequency_ && + imu_packet_loss_rate_ == _other.imu_packet_loss_rate_ && + imu_rpy_ == _other.imu_rpy_ && + serial_recv_stamp_ == _other.serial_recv_stamp_ && + serial_buffer_size_ == _other.serial_buffer_size_ && + serial_buffer_read_ == _other.serial_buffer_read_; + } + + bool operator!=(const LidarState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::LidarState_>::getTypeName() +{ + return "unitree_go::msg::dds_::LidarState_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::LidarState_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::LidarState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::LidarState_>::type_map_blob_sz() { return 1126; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::LidarState_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::LidarState_>::type_map_blob() { + static const uint8_t blob[] = { + 0x57, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x09, 0xd6, 0x30, 0xb6, 0x06, 0x40, 0xe7, + 0xbe, 0x4d, 0xa2, 0xb9, 0x6d, 0x00, 0x8c, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x01, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x96, 0xb8, 0xc7, 0x8d, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0xdf, 0xa1, 0xc7, 0xbd, + 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0xed, 0x06, 0xdc, 0x4c, + 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x57, 0xea, 0x46, 0xbb, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xa9, 0x50, 0xc9, 0xf7, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x47, 0xda, 0x34, 0xb9, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xa7, 0xd8, 0x5b, 0x8a, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x46, 0xa2, 0x96, 0x22, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xee, 0x8b, 0xc3, 0x16, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x96, 0x24, 0x1c, 0x8b, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xf0, 0x35, 0xb6, 0xef, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x77, 0x03, 0x9a, 0x1e, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xb9, 0x6b, 0xc1, 0x8e, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x5f, 0x31, 0xe6, 0x4b, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x50, 0xa7, 0x3f, 0x29, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x88, 0x89, 0x6b, 0x48, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x0e, 0x29, 0x6f, 0xc3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x64, 0xba, 0x33, 0xa1, 0x00, 0xdd, 0x02, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0x19, 0xc9, 0x75, 0x02, 0xb1, 0x96, 0x04, 0x36, 0x08, 0x47, 0x2b, + 0xd0, 0x18, 0x25, 0x00, 0xc5, 0x02, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4c, + 0x69, 0x64, 0x61, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x8d, 0x02, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x11, 0x00, 0x00, 0x00, 0x66, 0x69, 0x72, 0x6d, + 0x77, 0x61, 0x72, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, + 0x1f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x73, 0x64, 0x6b, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x73, 0x79, 0x73, 0x5f, 0x72, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x13, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x6d, 0x5f, + 0x72, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x64, 0x69, 0x72, 0x74, 0x79, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, + 0x74, 0x61, 0x67, 0x65, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x10, 0x00, 0x00, 0x00, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x66, 0x72, + 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x17, 0x00, 0x00, 0x00, 0x63, 0x6c, 0x6f, 0x75, + 0x64, 0x5f, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6c, 0x6f, 0x73, 0x73, 0x5f, 0x72, 0x61, + 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x63, 0x6c, 0x6f, 0x75, 0x64, 0x5f, 0x73, 0x63, + 0x61, 0x6e, 0x5f, 0x6e, 0x75, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x69, 0x6d, 0x75, 0x5f, + 0x66, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x15, 0x00, 0x00, 0x00, 0x69, 0x6d, 0x75, 0x5f, + 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6c, 0x6f, 0x73, 0x73, 0x5f, 0x72, 0x61, 0x74, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x69, 0x6d, 0x75, 0x5f, 0x72, 0x70, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x12, 0x00, 0x00, 0x00, 0x73, 0x65, 0x72, 0x69, + 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x63, 0x76, 0x5f, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x13, 0x00, 0x00, 0x00, 0x73, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x62, + 0x75, 0x66, 0x66, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x19, 0xc9, 0x75, 0x02, 0xb1, 0x96, 0x04, + 0x36, 0x08, 0x47, 0x2b, 0xd0, 0x18, 0x25, 0xf1, 0x09, 0xd6, 0x30, 0xb6, 0x06, 0x40, 0xe7, 0xbe, + 0x4d, 0xa2, 0xb9, 0x6d, 0x00, 0x8c, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::LidarState_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x09, 0xd6, 0x30, 0xb6, 0x06, 0x40, 0xe7, 0xbe, 0x4d, 0xa2, 0xb9, + 0x6d, 0x00, 0x8c, 0x00, 0x43, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x19, 0xc9, 0x75, 0x02, 0xb1, 0x96, 0x04, 0x36, 0x08, 0x47, 0x2b, + 0xd0, 0x18, 0x25, 0x00, 0xc9, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::LidarState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::LidarState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::LidarState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::LidarState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::LidarState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.firmware_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.software_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.sdk_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.sys_rotation_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.com_rotation_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.error_state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.dirty_percentage())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.cloud_frequency())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.cloud_packet_loss_rate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.cloud_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.cloud_scan_num())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.imu_frequency())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.imu_packet_loss_rate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.imu_rpy()[0], instance.imu_rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.serial_recv_stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.serial_buffer_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 17: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.serial_buffer_read())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::LidarState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LidarState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::LidarState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.firmware_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.software_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.sdk_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.sys_rotation_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.com_rotation_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.error_state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.dirty_percentage())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.cloud_frequency())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.cloud_packet_loss_rate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.cloud_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.cloud_scan_num())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.imu_frequency())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.imu_packet_loss_rate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.imu_rpy()[0], instance.imu_rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.serial_recv_stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.serial_buffer_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 17: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.serial_buffer_read())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::LidarState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LidarState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::LidarState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.firmware_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.software_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.sdk_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.sys_rotation_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.com_rotation_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.error_state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.dirty_percentage())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.cloud_frequency())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.cloud_packet_loss_rate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.cloud_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.cloud_scan_num())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.imu_frequency())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.imu_packet_loss_rate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.imu_rpy()[0], instance.imu_rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.serial_recv_stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.serial_buffer_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 17: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.serial_buffer_read())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::LidarState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LidarState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::LidarState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.firmware_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.software_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.sdk_version(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.sys_rotation_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.com_rotation_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.error_state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.dirty_percentage())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.cloud_frequency())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.cloud_packet_loss_rate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.cloud_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.cloud_scan_num())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.imu_frequency())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.imu_packet_loss_rate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.imu_rpy()[0], instance.imu_rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.serial_recv_stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.serial_buffer_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 17: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.serial_buffer_read())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::LidarState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LidarState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_LIDARSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/LowCmd_.hpp b/unitree_SDK/include/unitree/idl/go2/LowCmd_.hpp new file mode 100644 index 0000000..53be66b --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/LowCmd_.hpp @@ -0,0 +1,999 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: LowCmd_.idl + Source: LowCmd_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_LOWCMD__HPP +#define DDSCXX_UNITREE_IDL_GO2_LOWCMD__HPP + +#include "unitree/idl/go2/BmsCmd_.hpp" + +#include "unitree/idl/go2/MotorCmd_.hpp" + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class LowCmd_ +{ +private: + std::array head_ = { }; + uint8_t level_flag_ = 0; + uint8_t frame_reserve_ = 0; + std::array sn_ = { }; + std::array version_ = { }; + uint16_t bandwidth_ = 0; + std::array<::unitree_go::msg::dds_::MotorCmd_, 20> motor_cmd_ = { }; + ::unitree_go::msg::dds_::BmsCmd_ bms_cmd_; + std::array wireless_remote_ = { }; + std::array led_ = { }; + std::array fan_ = { }; + uint8_t gpio_ = 0; + uint32_t reserve_ = 0; + uint32_t crc_ = 0; + +public: + LowCmd_() = default; + + explicit LowCmd_( + const std::array& head, + uint8_t level_flag, + uint8_t frame_reserve, + const std::array& sn, + const std::array& version, + uint16_t bandwidth, + const std::array<::unitree_go::msg::dds_::MotorCmd_, 20>& motor_cmd, + const ::unitree_go::msg::dds_::BmsCmd_& bms_cmd, + const std::array& wireless_remote, + const std::array& led, + const std::array& fan, + uint8_t gpio, + uint32_t reserve, + uint32_t crc) : + head_(head), + level_flag_(level_flag), + frame_reserve_(frame_reserve), + sn_(sn), + version_(version), + bandwidth_(bandwidth), + motor_cmd_(motor_cmd), + bms_cmd_(bms_cmd), + wireless_remote_(wireless_remote), + led_(led), + fan_(fan), + gpio_(gpio), + reserve_(reserve), + crc_(crc) { } + + const std::array& head() const { return this->head_; } + std::array& head() { return this->head_; } + void head(const std::array& _val_) { this->head_ = _val_; } + void head(std::array&& _val_) { this->head_ = _val_; } + uint8_t level_flag() const { return this->level_flag_; } + uint8_t& level_flag() { return this->level_flag_; } + void level_flag(uint8_t _val_) { this->level_flag_ = _val_; } + uint8_t frame_reserve() const { return this->frame_reserve_; } + uint8_t& frame_reserve() { return this->frame_reserve_; } + void frame_reserve(uint8_t _val_) { this->frame_reserve_ = _val_; } + const std::array& sn() const { return this->sn_; } + std::array& sn() { return this->sn_; } + void sn(const std::array& _val_) { this->sn_ = _val_; } + void sn(std::array&& _val_) { this->sn_ = _val_; } + const std::array& version() const { return this->version_; } + std::array& version() { return this->version_; } + void version(const std::array& _val_) { this->version_ = _val_; } + void version(std::array&& _val_) { this->version_ = _val_; } + uint16_t bandwidth() const { return this->bandwidth_; } + uint16_t& bandwidth() { return this->bandwidth_; } + void bandwidth(uint16_t _val_) { this->bandwidth_ = _val_; } + const std::array<::unitree_go::msg::dds_::MotorCmd_, 20>& motor_cmd() const { return this->motor_cmd_; } + std::array<::unitree_go::msg::dds_::MotorCmd_, 20>& motor_cmd() { return this->motor_cmd_; } + void motor_cmd(const std::array<::unitree_go::msg::dds_::MotorCmd_, 20>& _val_) { this->motor_cmd_ = _val_; } + void motor_cmd(std::array<::unitree_go::msg::dds_::MotorCmd_, 20>&& _val_) { this->motor_cmd_ = _val_; } + const ::unitree_go::msg::dds_::BmsCmd_& bms_cmd() const { return this->bms_cmd_; } + ::unitree_go::msg::dds_::BmsCmd_& bms_cmd() { return this->bms_cmd_; } + void bms_cmd(const ::unitree_go::msg::dds_::BmsCmd_& _val_) { this->bms_cmd_ = _val_; } + void bms_cmd(::unitree_go::msg::dds_::BmsCmd_&& _val_) { this->bms_cmd_ = _val_; } + const std::array& wireless_remote() const { return this->wireless_remote_; } + std::array& wireless_remote() { return this->wireless_remote_; } + void wireless_remote(const std::array& _val_) { this->wireless_remote_ = _val_; } + void wireless_remote(std::array&& _val_) { this->wireless_remote_ = _val_; } + const std::array& led() const { return this->led_; } + std::array& led() { return this->led_; } + void led(const std::array& _val_) { this->led_ = _val_; } + void led(std::array&& _val_) { this->led_ = _val_; } + const std::array& fan() const { return this->fan_; } + std::array& fan() { return this->fan_; } + void fan(const std::array& _val_) { this->fan_ = _val_; } + void fan(std::array&& _val_) { this->fan_ = _val_; } + uint8_t gpio() const { return this->gpio_; } + uint8_t& gpio() { return this->gpio_; } + void gpio(uint8_t _val_) { this->gpio_ = _val_; } + uint32_t reserve() const { return this->reserve_; } + uint32_t& reserve() { return this->reserve_; } + void reserve(uint32_t _val_) { this->reserve_ = _val_; } + uint32_t crc() const { return this->crc_; } + uint32_t& crc() { return this->crc_; } + void crc(uint32_t _val_) { this->crc_ = _val_; } + + bool operator==(const LowCmd_& _other) const + { + (void) _other; + return head_ == _other.head_ && + level_flag_ == _other.level_flag_ && + frame_reserve_ == _other.frame_reserve_ && + sn_ == _other.sn_ && + version_ == _other.version_ && + bandwidth_ == _other.bandwidth_ && + motor_cmd_ == _other.motor_cmd_ && + bms_cmd_ == _other.bms_cmd_ && + wireless_remote_ == _other.wireless_remote_ && + led_ == _other.led_ && + fan_ == _other.fan_ && + gpio_ == _other.gpio_ && + reserve_ == _other.reserve_ && + crc_ == _other.crc_; + } + + bool operator!=(const LowCmd_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::LowCmd_>::getTypeName() +{ + return "unitree_go::msg::dds_::LowCmd_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::LowCmd_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::LowCmd_>::type_map_blob_sz() { return 1710; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::LowCmd_>::type_info_blob_sz() { return 196; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::LowCmd_>::type_map_blob() { + static const uint8_t blob[] = { + 0x72, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf1, 0x83, 0x28, 0x76, 0xce, 0xec, 0x97, 0x37, + 0xd6, 0x9f, 0x6e, 0xd6, 0x2a, 0x3f, 0x63, 0x00, 0x63, 0x01, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x01, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x96, 0xe8, 0x9a, 0x29, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xa2, 0x18, 0x71, 0x24, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xf0, 0xd2, 0xa4, 0x1c, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x07, 0xaf, 0xbe, 0x94, 0xcd, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x2a, 0xf7, + 0x2f, 0x10, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x36, + 0x67, 0x6c, 0x2b, 0x00, 0x24, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf1, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0xf1, 0xc8, 0xe5, 0x83, 0x5b, 0x0f, 0x0c, + 0x17, 0x65, 0xbc, 0x23, 0x1d, 0xfa, 0x02, 0xff, 0x5b, 0xcf, 0x19, 0xa4, 0x19, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x3e, 0x8e, 0xb6, 0x7c, 0x25, 0xfd, 0xe0, 0x7e, 0x52, + 0xcf, 0x51, 0xed, 0x4a, 0x23, 0x11, 0x50, 0x97, 0xc7, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x28, 0x02, 0xa8, 0x2f, 0x18, 0xc9, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x0b, 0x98, + 0xf7, 0xbc, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x50, 0xbd, 0x8c, 0x21, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x95, 0x58, 0x71, 0xc9, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xf5, 0xad, 0x59, 0xc5, 0xf1, + 0xc8, 0xe5, 0x83, 0x5b, 0x0f, 0x0c, 0x17, 0x65, 0xbc, 0x23, 0x1d, 0xfa, 0x02, 0xff, 0x00, 0x00, + 0x8e, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x45, 0x80, 0xc2, 0x74, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x26, 0xb5, 0x68, 0xe4, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x87, 0x22, 0x16, 0x52, 0x00, 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x07, 0x9c, 0x3b, + 0x62, 0x94, 0xf1, 0x3e, 0x8e, 0xb6, 0x7c, 0x25, 0xfd, 0xe0, 0x7e, 0x52, 0xcf, 0x51, 0xed, 0x4a, + 0x23, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x32, 0x62, 0xd4, 0x8d, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x02, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x00, 0xce, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0xf2, 0x52, 0xcc, 0x8e, 0xb0, 0xd4, 0x27, 0xd6, 0x92, 0xaa, 0x2b, 0x20, 0xa9, 0x05, 0x40, 0x00, + 0x26, 0x02, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1f, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4c, 0x6f, 0x77, 0x43, 0x6d, + 0x64, 0x5f, 0x00, 0x00, 0xf2, 0x01, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x66, 0x6c, 0x61, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, + 0x1d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x73, 0x6e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x62, 0x61, 0x6e, 0x64, + 0x77, 0x69, 0x64, 0x74, 0x68, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0xf2, 0x42, 0x1f, + 0xa5, 0xb2, 0xdb, 0x2d, 0xef, 0xf5, 0xc0, 0x3f, 0xff, 0x16, 0x30, 0x3b, 0x0a, 0x00, 0x00, 0x00, + 0x6d, 0x6f, 0x74, 0x6f, 0x72, 0x5f, 0x63, 0x6d, 0x64, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x31, 0xa8, 0x59, 0x24, 0x05, 0x6b, 0x7a, 0xf3, 0xd3, + 0xf1, 0x6b, 0x34, 0x22, 0x33, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x62, 0x6d, 0x73, 0x5f, + 0x63, 0x6d, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x77, 0x69, 0x72, 0x65, 0x6c, 0x65, 0x73, 0x73, 0x5f, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x6c, 0x65, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x66, 0x61, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x67, 0x70, 0x69, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x63, 0x72, 0x63, 0x00, 0x00, 0x00, 0xf2, 0x42, 0x1f, 0xa5, 0xb2, 0xdb, + 0x2d, 0xef, 0xf5, 0xc0, 0x3f, 0xff, 0x16, 0x30, 0x3b, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, 0x6f, 0x74, 0x6f, 0x72, 0x43, 0x6d, 0x64, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x74, 0x61, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6b, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x6b, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0xf2, 0x31, + 0xa8, 0x59, 0x24, 0x05, 0x6b, 0x7a, 0xf3, 0xd3, 0xf1, 0x6b, 0x34, 0x22, 0x33, 0x00, 0x00, 0x00, + 0x76, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1f, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x42, 0x6d, 0x73, 0x43, 0x6d, + 0x64, 0x5f, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6f, 0x66, 0x66, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0xf2, 0x52, 0xcc, 0x8e, 0xb0, 0xd4, 0x27, 0xd6, 0x92, 0xaa, 0x2b, 0x20, + 0xa9, 0x05, 0x40, 0xf1, 0x83, 0x28, 0x76, 0xce, 0xec, 0x97, 0x37, 0xd6, 0x9f, 0x6e, 0xd6, 0x2a, + 0x3f, 0x63, 0xf2, 0x42, 0x1f, 0xa5, 0xb2, 0xdb, 0x2d, 0xef, 0xf5, 0xc0, 0x3f, 0xff, 0x16, 0x30, + 0x3b, 0xf1, 0xc8, 0xe5, 0x83, 0x5b, 0x0f, 0x0c, 0x17, 0x65, 0xbc, 0x23, 0x1d, 0xfa, 0x02, 0xff, + 0xf2, 0x31, 0xa8, 0x59, 0x24, 0x05, 0x6b, 0x7a, 0xf3, 0xd3, 0xf1, 0x6b, 0x34, 0x22, 0x33, 0xf1, + 0x3e, 0x8e, 0xb6, 0x7c, 0x25, 0xfd, 0xe0, 0x7e, 0x52, 0xcf, 0x51, 0xed, 0x4a, 0x23, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::LowCmd_>::type_info_blob() { + static const uint8_t blob[] = { + 0xc0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x83, 0x28, 0x76, 0xce, 0xec, 0x97, 0x37, 0xd6, 0x9f, 0x6e, 0xd6, + 0x2a, 0x3f, 0x63, 0x00, 0x67, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xc8, 0xe5, 0x83, 0x5b, 0x0f, 0x0c, 0x17, + 0x65, 0xbc, 0x23, 0x1d, 0xfa, 0x02, 0xff, 0x00, 0x92, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x3e, 0x8e, 0xb6, 0x7c, 0x25, 0xfd, 0xe0, 0x7e, 0x52, 0xcf, 0x51, 0xed, 0x4a, 0x23, 0x00, + 0x42, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x52, 0xcc, 0x8e, 0xb0, 0xd4, 0x27, 0xd6, 0x92, 0xaa, 0x2b, 0x20, + 0xa9, 0x05, 0x40, 0x00, 0x2a, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x42, 0x1f, 0xa5, 0xb2, 0xdb, 0x2d, 0xef, + 0xf5, 0xc0, 0x3f, 0xff, 0x16, 0x30, 0x3b, 0x00, 0xf2, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x31, 0xa8, 0x59, 0x24, 0x05, 0x6b, 0x7a, 0xf3, 0xd3, 0xf1, 0x6b, 0x34, 0x22, 0x33, 0x00, + 0x7a, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::LowCmd_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::LowCmd_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::LowCmd_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::LowCmd_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::LowCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.head()[0], instance.head().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.level_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.frame_reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.sn()[0], instance.sn().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.bandwidth())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_cmd()) { //array depth 1 + if (!write(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.bms_cmd(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.led()[0], instance.led().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.fan()[0], instance.fan().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.gpio())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::LowCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LowCmd_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::LowCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.head()[0], instance.head().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.level_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.frame_reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.sn()[0], instance.sn().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.bandwidth())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (auto & a_1:instance.motor_cmd()) { //array depth 1 + if (!read(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.bms_cmd(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.led()[0], instance.led().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.fan()[0], instance.fan().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.gpio())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::LowCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LowCmd_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::LowCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.head()[0], instance.head().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.level_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.frame_reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.sn()[0], instance.sn().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.bandwidth())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_cmd()) { //array depth 1 + if (!move(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.bms_cmd(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.led()[0], instance.led().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.fan()[0], instance.fan().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.gpio())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::LowCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LowCmd_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::LowCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.head()[0], instance.head().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.level_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.frame_reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.sn()[0], instance.sn().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.bandwidth())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_cmd()) { //array depth 1 + if (!max(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.bms_cmd(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.led()[0], instance.led().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.fan()[0], instance.fan().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.gpio())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::LowCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LowCmd_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_LOWCMD__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/LowState_.hpp b/unitree_SDK/include/unitree/idl/go2/LowState_.hpp new file mode 100644 index 0000000..221871d --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/LowState_.hpp @@ -0,0 +1,1427 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: LowState_.idl + Source: LowState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_LOWSTATE__HPP +#define DDSCXX_UNITREE_IDL_GO2_LOWSTATE__HPP + +#include "unitree/idl/go2/BmsState_.hpp" + +#include "unitree/idl/go2/IMUState_.hpp" + +#include "unitree/idl/go2/MotorState_.hpp" + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class LowState_ +{ +private: + std::array head_ = { }; + uint8_t level_flag_ = 0; + uint8_t frame_reserve_ = 0; + std::array sn_ = { }; + std::array version_ = { }; + uint16_t bandwidth_ = 0; + ::unitree_go::msg::dds_::IMUState_ imu_state_; + std::array<::unitree_go::msg::dds_::MotorState_, 20> motor_state_ = { }; + ::unitree_go::msg::dds_::BmsState_ bms_state_; + std::array foot_force_ = { }; + std::array foot_force_est_ = { }; + uint32_t tick_ = 0; + std::array wireless_remote_ = { }; + uint8_t bit_flag_ = 0; + float adc_reel_ = 0.0f; + uint8_t temperature_ntc1_ = 0; + uint8_t temperature_ntc2_ = 0; + float power_v_ = 0.0f; + float power_a_ = 0.0f; + std::array fan_frequency_ = { }; + uint32_t reserve_ = 0; + uint32_t crc_ = 0; + +public: + LowState_() = default; + + explicit LowState_( + const std::array& head, + uint8_t level_flag, + uint8_t frame_reserve, + const std::array& sn, + const std::array& version, + uint16_t bandwidth, + const ::unitree_go::msg::dds_::IMUState_& imu_state, + const std::array<::unitree_go::msg::dds_::MotorState_, 20>& motor_state, + const ::unitree_go::msg::dds_::BmsState_& bms_state, + const std::array& foot_force, + const std::array& foot_force_est, + uint32_t tick, + const std::array& wireless_remote, + uint8_t bit_flag, + float adc_reel, + uint8_t temperature_ntc1, + uint8_t temperature_ntc2, + float power_v, + float power_a, + const std::array& fan_frequency, + uint32_t reserve, + uint32_t crc) : + head_(head), + level_flag_(level_flag), + frame_reserve_(frame_reserve), + sn_(sn), + version_(version), + bandwidth_(bandwidth), + imu_state_(imu_state), + motor_state_(motor_state), + bms_state_(bms_state), + foot_force_(foot_force), + foot_force_est_(foot_force_est), + tick_(tick), + wireless_remote_(wireless_remote), + bit_flag_(bit_flag), + adc_reel_(adc_reel), + temperature_ntc1_(temperature_ntc1), + temperature_ntc2_(temperature_ntc2), + power_v_(power_v), + power_a_(power_a), + fan_frequency_(fan_frequency), + reserve_(reserve), + crc_(crc) { } + + const std::array& head() const { return this->head_; } + std::array& head() { return this->head_; } + void head(const std::array& _val_) { this->head_ = _val_; } + void head(std::array&& _val_) { this->head_ = _val_; } + uint8_t level_flag() const { return this->level_flag_; } + uint8_t& level_flag() { return this->level_flag_; } + void level_flag(uint8_t _val_) { this->level_flag_ = _val_; } + uint8_t frame_reserve() const { return this->frame_reserve_; } + uint8_t& frame_reserve() { return this->frame_reserve_; } + void frame_reserve(uint8_t _val_) { this->frame_reserve_ = _val_; } + const std::array& sn() const { return this->sn_; } + std::array& sn() { return this->sn_; } + void sn(const std::array& _val_) { this->sn_ = _val_; } + void sn(std::array&& _val_) { this->sn_ = _val_; } + const std::array& version() const { return this->version_; } + std::array& version() { return this->version_; } + void version(const std::array& _val_) { this->version_ = _val_; } + void version(std::array&& _val_) { this->version_ = _val_; } + uint16_t bandwidth() const { return this->bandwidth_; } + uint16_t& bandwidth() { return this->bandwidth_; } + void bandwidth(uint16_t _val_) { this->bandwidth_ = _val_; } + const ::unitree_go::msg::dds_::IMUState_& imu_state() const { return this->imu_state_; } + ::unitree_go::msg::dds_::IMUState_& imu_state() { return this->imu_state_; } + void imu_state(const ::unitree_go::msg::dds_::IMUState_& _val_) { this->imu_state_ = _val_; } + void imu_state(::unitree_go::msg::dds_::IMUState_&& _val_) { this->imu_state_ = _val_; } + const std::array<::unitree_go::msg::dds_::MotorState_, 20>& motor_state() const { return this->motor_state_; } + std::array<::unitree_go::msg::dds_::MotorState_, 20>& motor_state() { return this->motor_state_; } + void motor_state(const std::array<::unitree_go::msg::dds_::MotorState_, 20>& _val_) { this->motor_state_ = _val_; } + void motor_state(std::array<::unitree_go::msg::dds_::MotorState_, 20>&& _val_) { this->motor_state_ = _val_; } + const ::unitree_go::msg::dds_::BmsState_& bms_state() const { return this->bms_state_; } + ::unitree_go::msg::dds_::BmsState_& bms_state() { return this->bms_state_; } + void bms_state(const ::unitree_go::msg::dds_::BmsState_& _val_) { this->bms_state_ = _val_; } + void bms_state(::unitree_go::msg::dds_::BmsState_&& _val_) { this->bms_state_ = _val_; } + const std::array& foot_force() const { return this->foot_force_; } + std::array& foot_force() { return this->foot_force_; } + void foot_force(const std::array& _val_) { this->foot_force_ = _val_; } + void foot_force(std::array&& _val_) { this->foot_force_ = _val_; } + const std::array& foot_force_est() const { return this->foot_force_est_; } + std::array& foot_force_est() { return this->foot_force_est_; } + void foot_force_est(const std::array& _val_) { this->foot_force_est_ = _val_; } + void foot_force_est(std::array&& _val_) { this->foot_force_est_ = _val_; } + uint32_t tick() const { return this->tick_; } + uint32_t& tick() { return this->tick_; } + void tick(uint32_t _val_) { this->tick_ = _val_; } + const std::array& wireless_remote() const { return this->wireless_remote_; } + std::array& wireless_remote() { return this->wireless_remote_; } + void wireless_remote(const std::array& _val_) { this->wireless_remote_ = _val_; } + void wireless_remote(std::array&& _val_) { this->wireless_remote_ = _val_; } + uint8_t bit_flag() const { return this->bit_flag_; } + uint8_t& bit_flag() { return this->bit_flag_; } + void bit_flag(uint8_t _val_) { this->bit_flag_ = _val_; } + float adc_reel() const { return this->adc_reel_; } + float& adc_reel() { return this->adc_reel_; } + void adc_reel(float _val_) { this->adc_reel_ = _val_; } + uint8_t temperature_ntc1() const { return this->temperature_ntc1_; } + uint8_t& temperature_ntc1() { return this->temperature_ntc1_; } + void temperature_ntc1(uint8_t _val_) { this->temperature_ntc1_ = _val_; } + uint8_t temperature_ntc2() const { return this->temperature_ntc2_; } + uint8_t& temperature_ntc2() { return this->temperature_ntc2_; } + void temperature_ntc2(uint8_t _val_) { this->temperature_ntc2_ = _val_; } + float power_v() const { return this->power_v_; } + float& power_v() { return this->power_v_; } + void power_v(float _val_) { this->power_v_ = _val_; } + float power_a() const { return this->power_a_; } + float& power_a() { return this->power_a_; } + void power_a(float _val_) { this->power_a_ = _val_; } + const std::array& fan_frequency() const { return this->fan_frequency_; } + std::array& fan_frequency() { return this->fan_frequency_; } + void fan_frequency(const std::array& _val_) { this->fan_frequency_ = _val_; } + void fan_frequency(std::array&& _val_) { this->fan_frequency_ = _val_; } + uint32_t reserve() const { return this->reserve_; } + uint32_t& reserve() { return this->reserve_; } + void reserve(uint32_t _val_) { this->reserve_ = _val_; } + uint32_t crc() const { return this->crc_; } + uint32_t& crc() { return this->crc_; } + void crc(uint32_t _val_) { this->crc_ = _val_; } + + bool operator==(const LowState_& _other) const + { + (void) _other; + return head_ == _other.head_ && + level_flag_ == _other.level_flag_ && + frame_reserve_ == _other.frame_reserve_ && + sn_ == _other.sn_ && + version_ == _other.version_ && + bandwidth_ == _other.bandwidth_ && + imu_state_ == _other.imu_state_ && + motor_state_ == _other.motor_state_ && + bms_state_ == _other.bms_state_ && + foot_force_ == _other.foot_force_ && + foot_force_est_ == _other.foot_force_est_ && + tick_ == _other.tick_ && + wireless_remote_ == _other.wireless_remote_ && + bit_flag_ == _other.bit_flag_ && + adc_reel_ == _other.adc_reel_ && + temperature_ntc1_ == _other.temperature_ntc1_ && + temperature_ntc2_ == _other.temperature_ntc2_ && + power_v_ == _other.power_v_ && + power_a_ == _other.power_a_ && + fan_frequency_ == _other.fan_frequency_ && + reserve_ == _other.reserve_ && + crc_ == _other.crc_; + } + + bool operator!=(const LowState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::LowState_>::getTypeName() +{ + return "unitree_go::msg::dds_::LowState_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::LowState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::LowState_>::type_map_blob_sz() { return 3184; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::LowState_>::type_info_blob_sz() { return 244; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::LowState_>::type_map_blob() { + static const uint8_t blob[] = { + 0x7e, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf1, 0x85, 0x3a, 0x99, 0xe2, 0x3d, 0x0d, 0xaa, + 0x16, 0x10, 0xb6, 0x5c, 0x52, 0x6b, 0x40, 0x00, 0xff, 0x01, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xef, 0x01, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x96, 0xe8, 0x9a, 0x29, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xa2, 0x18, 0x71, 0x24, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xf0, 0xd2, 0xa4, 0x1c, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x07, 0xaf, 0xbe, 0x94, 0xcd, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x2a, 0xf7, + 0x2f, 0x10, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x36, + 0x67, 0x6c, 0x2b, 0x00, 0x19, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x4b, + 0x1b, 0xf4, 0xaf, 0x32, 0xe5, 0xbc, 0x67, 0x10, 0xef, 0xc8, 0x29, 0x31, 0x15, 0x9e, 0x5f, 0x37, + 0x13, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf1, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0xf1, 0x42, 0xa2, 0x28, 0x8b, 0x79, 0x8a, + 0xf8, 0xdb, 0x05, 0xe1, 0x27, 0x36, 0xb1, 0xbe, 0xb2, 0x1e, 0x53, 0xdc, 0x19, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xe1, 0x18, 0xaf, 0x07, 0x0b, 0xa2, 0x0b, 0xc2, 0xe0, + 0x37, 0x0c, 0xec, 0x4c, 0xbb, 0x7f, 0x6e, 0x62, 0x18, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x04, 0x03, 0x41, 0x56, 0x4b, 0x84, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x03, 0x04, 0x1b, + 0xa1, 0x76, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe5, + 0xe5, 0xc0, 0x75, 0x00, 0x16, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x02, 0xa8, 0x2f, 0x18, 0xc9, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xc8, 0xbc, 0x01, 0x8f, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xc1, 0x0c, 0x98, 0x67, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xb0, 0x29, 0x0b, 0xbb, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xd2, 0x14, 0xc5, 0x1f, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x52, 0xea, 0x3e, 0x50, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x3a, 0x40, 0xba, 0xb9, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x06, 0xa6, 0x69, 0xf7, 0x4e, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xf5, 0xad, 0x59, 0xc5, 0xf1, 0x4b, 0x1b, 0xf4, 0xaf, + 0x32, 0xe5, 0xbc, 0x67, 0x10, 0xef, 0xc8, 0x29, 0x31, 0x15, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x75, 0xb9, 0xaa, 0xa0, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x6b, 0x3b, 0x2d, 0x85, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x0e, 0x12, 0x75, 0x69, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0xb0, 0x7d, + 0x92, 0xed, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xee, + 0xf4, 0x38, 0xf7, 0xf1, 0x42, 0xa2, 0x28, 0x8b, 0x79, 0x8a, 0xf8, 0xdb, 0x05, 0xe1, 0x27, 0x36, + 0xb1, 0xbe, 0x00, 0x00, 0xce, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xe9, 0x16, 0x89, 0x09, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x8a, 0xf7, 0xae, 0xdf, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x6e, 0x96, 0x3d, 0x84, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x30, 0x50, 0xb6, 0xd9, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x4a, 0xe0, 0x48, 0xae, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xee, 0xf4, 0x38, 0xf7, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x1c, 0x9a, 0x44, 0xeb, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0xf1, 0xe1, 0x18, 0xaf, 0x07, 0x0b, 0xa2, 0x0b, 0xc2, 0xe0, + 0x37, 0x0c, 0xec, 0x4c, 0xbb, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x75, 0x6a, 0xda, 0x84, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x51, 0x99, 0x89, 0x90, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x9a, 0xcb, 0x44, 0x54, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xc7, 0xd5, 0xf8, 0x49, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x43, 0xb5, 0xc9, 0x17, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x9a, 0x4c, 0x07, 0x40, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x2a, 0x42, 0xc9, 0x1e, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x55, 0x65, 0x52, 0x17, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x06, 0x2d, 0x87, + 0xc3, 0x55, 0x00, 0x00, 0x67, 0x07, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf2, 0x08, 0xf2, 0x39, + 0xc4, 0x71, 0xd3, 0xa2, 0x7e, 0x67, 0xe7, 0xc7, 0x72, 0x31, 0x84, 0x00, 0x52, 0x03, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4c, 0x6f, 0x77, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, 0x00, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x5f, 0x66, 0x6c, 0x61, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, + 0x1d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x73, 0x6e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x62, 0x61, 0x6e, 0x64, + 0x77, 0x69, 0x64, 0x74, 0x68, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0xc4, 0xec, 0xb4, 0x9c, 0xd7, 0xb2, 0x25, 0xd2, 0x26, 0x28, 0xb6, 0xb7, 0x64, + 0xcc, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x69, 0x6d, 0x75, 0x5f, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf2, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0xf2, 0xd2, 0xbc, 0xfb, 0x97, 0xbe, 0x37, + 0xa8, 0xbc, 0x9c, 0x41, 0xe5, 0x0b, 0xa1, 0xc9, 0x0c, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x74, 0x6f, + 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x2e, 0xd8, 0x57, 0xec, 0xb6, 0xb3, 0x05, 0x79, 0x80, + 0x8c, 0x15, 0xfd, 0x14, 0x3d, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x62, 0x6d, 0x73, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x6f, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x66, 0x6f, 0x6f, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x65, 0x73, 0x74, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x74, 0x69, 0x63, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x28, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x77, 0x69, 0x72, 0x65, 0x6c, 0x65, 0x73, 0x73, + 0x5f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x62, 0x69, 0x74, 0x5f, + 0x66, 0x6c, 0x61, 0x67, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x61, 0x64, 0x63, 0x5f, 0x72, 0x65, 0x65, 0x6c, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x5f, + 0x6e, 0x74, 0x63, 0x31, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x11, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x5f, 0x6e, 0x74, 0x63, 0x32, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x77, 0x65, + 0x72, 0x5f, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x61, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x06, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x66, 0x61, 0x6e, 0x5f, 0x66, 0x72, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x79, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x63, 0x72, 0x63, 0x00, + 0x00, 0x00, 0xf2, 0xc4, 0xec, 0xb4, 0x9c, 0xd7, 0xb2, 0x25, 0xd2, 0x26, 0x28, 0xb6, 0xb7, 0x64, + 0xcc, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x49, + 0x4d, 0x55, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x71, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x67, 0x79, 0x72, 0x6f, + 0x73, 0x63, 0x6f, 0x70, 0x65, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, + 0x0e, 0x00, 0x00, 0x00, 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x72, 0x70, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0xf2, 0xd2, 0xbc, 0xfb, 0x97, 0xbe, 0x37, 0xa8, 0xbc, 0x9c, + 0x41, 0xe5, 0x0b, 0xa1, 0xc9, 0x00, 0x00, 0x00, 0x62, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x4d, 0x6f, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, + 0x2a, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x71, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x64, 0x71, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x74, 0x61, 0x75, 0x5f, 0x65, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x71, 0x5f, 0x72, 0x61, 0x77, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x07, 0x00, 0x00, 0x00, 0x64, 0x71, 0x5f, 0x72, 0x61, 0x77, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x64, 0x64, 0x71, 0x5f, 0x72, 0x61, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x6c, 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0xf2, 0x2e, + 0xd8, 0x57, 0xec, 0xb6, 0xb3, 0x05, 0x79, 0x80, 0x8c, 0x15, 0xfd, 0x14, 0x3d, 0x00, 0x00, 0x00, + 0x5b, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x42, 0x6d, 0x73, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x23, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0d, 0x00, 0x00, 0x00, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x69, 0x67, 0x68, 0x00, 0x00, 0x00, 0x00, + 0x1a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x6f, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x15, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x6f, 0x63, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x63, 0x79, 0x63, 0x6c, 0x65, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x62, 0x71, 0x5f, 0x6e, 0x74, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6d, 0x63, 0x75, 0x5f, + 0x6e, 0x74, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x06, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x63, 0x65, 0x6c, 0x6c, 0x5f, 0x76, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, + 0x7c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf2, 0x08, 0xf2, 0x39, 0xc4, 0x71, 0xd3, 0xa2, + 0x7e, 0x67, 0xe7, 0xc7, 0x72, 0x31, 0x84, 0xf1, 0x85, 0x3a, 0x99, 0xe2, 0x3d, 0x0d, 0xaa, 0x16, + 0x10, 0xb6, 0x5c, 0x52, 0x6b, 0x40, 0xf2, 0xc4, 0xec, 0xb4, 0x9c, 0xd7, 0xb2, 0x25, 0xd2, 0x26, + 0x28, 0xb6, 0xb7, 0x64, 0xcc, 0xf1, 0x4b, 0x1b, 0xf4, 0xaf, 0x32, 0xe5, 0xbc, 0x67, 0x10, 0xef, + 0xc8, 0x29, 0x31, 0x15, 0xf2, 0xd2, 0xbc, 0xfb, 0x97, 0xbe, 0x37, 0xa8, 0xbc, 0x9c, 0x41, 0xe5, + 0x0b, 0xa1, 0xc9, 0xf1, 0x42, 0xa2, 0x28, 0x8b, 0x79, 0x8a, 0xf8, 0xdb, 0x05, 0xe1, 0x27, 0x36, + 0xb1, 0xbe, 0xf2, 0x2e, 0xd8, 0x57, 0xec, 0xb6, 0xb3, 0x05, 0x79, 0x80, 0x8c, 0x15, 0xfd, 0x14, + 0x3d, 0xf1, 0xe1, 0x18, 0xaf, 0x07, 0x0b, 0xa2, 0x0b, 0xc2, 0xe0, 0x37, 0x0c, 0xec, 0x4c, 0xbb, +}; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::LowState_>::type_info_blob() { + static const uint8_t blob[] = { + 0xf0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x85, 0x3a, 0x99, 0xe2, 0x3d, 0x0d, 0xaa, 0x16, 0x10, 0xb6, 0x5c, + 0x52, 0x6b, 0x40, 0x00, 0x03, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x4b, 0x1b, 0xf4, 0xaf, 0x32, 0xe5, 0xbc, + 0x67, 0x10, 0xef, 0xc8, 0x29, 0x31, 0x15, 0x00, 0x97, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x42, 0xa2, 0x28, 0x8b, 0x79, 0x8a, 0xf8, 0xdb, 0x05, 0xe1, 0x27, 0x36, 0xb1, 0xbe, 0x00, + 0xd2, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xe1, 0x18, 0xaf, 0x07, 0x0b, 0xa2, 0x0b, + 0xc2, 0xe0, 0x37, 0x0c, 0xec, 0x4c, 0xbb, 0x00, 0xca, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x08, 0xf2, 0x39, + 0xc4, 0x71, 0xd3, 0xa2, 0x7e, 0x67, 0xe7, 0xc7, 0x72, 0x31, 0x84, 0x00, 0x56, 0x03, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xc4, 0xec, 0xb4, 0x9c, 0xd7, 0xb2, 0x25, 0xd2, 0x26, 0x28, 0xb6, 0xb7, 0x64, 0xcc, 0x00, + 0x02, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd2, 0xbc, 0xfb, 0x97, 0xbe, 0x37, 0xa8, + 0xbc, 0x9c, 0x41, 0xe5, 0x0b, 0xa1, 0xc9, 0x00, 0x66, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x2e, 0xd8, 0x57, 0xec, 0xb6, 0xb3, 0x05, 0x79, 0x80, 0x8c, 0x15, 0xfd, 0x14, 0x3d, 0x00, + 0x5f, 0x01, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::LowState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::LowState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::LowState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::LowState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::LowState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.head()[0], instance.head().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.level_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.frame_reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.sn()[0], instance.sn().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.bandwidth())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_state()) { //array depth 1 + if (!write(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.bms_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.foot_force()[0], instance.foot_force().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.foot_force_est()[0], instance.foot_force_est().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.bit_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.adc_reel())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.temperature_ntc1())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.temperature_ntc2())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 17: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.power_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 18: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.power_a())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 19: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.fan_frequency()[0], instance.fan_frequency().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 20: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 21: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::LowState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LowState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::LowState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.head()[0], instance.head().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.level_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.frame_reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.sn()[0], instance.sn().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.bandwidth())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (auto & a_1:instance.motor_state()) { //array depth 1 + if (!read(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.bms_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.foot_force()[0], instance.foot_force().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.foot_force_est()[0], instance.foot_force_est().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.bit_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.adc_reel())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.temperature_ntc1())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.temperature_ntc2())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 17: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.power_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 18: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.power_a())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 19: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.fan_frequency()[0], instance.fan_frequency().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 20: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 21: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::LowState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LowState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::LowState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.head()[0], instance.head().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.level_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.frame_reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.sn()[0], instance.sn().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.bandwidth())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_state()) { //array depth 1 + if (!move(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.bms_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.foot_force()[0], instance.foot_force().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.foot_force_est()[0], instance.foot_force_est().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.bit_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.adc_reel())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.temperature_ntc1())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.temperature_ntc2())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 17: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.power_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 18: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.power_a())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 19: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.fan_frequency()[0], instance.fan_frequency().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 20: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 21: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::LowState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LowState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::LowState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.head()[0], instance.head().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.level_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.frame_reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.sn()[0], instance.sn().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.bandwidth())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_state()) { //array depth 1 + if (!max(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.bms_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.foot_force()[0], instance.foot_force().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.foot_force_est()[0], instance.foot_force_est().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.bit_flag())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.adc_reel())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.temperature_ntc1())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.temperature_ntc2())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 17: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.power_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 18: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.power_a())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 19: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.fan_frequency()[0], instance.fan_frequency().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 20: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 21: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::LowState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::LowState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_LOWSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/MotorCmd_.hpp b/unitree_SDK/include/unitree/idl/go2/MotorCmd_.hpp new file mode 100644 index 0000000..aa2abee --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/MotorCmd_.hpp @@ -0,0 +1,528 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: MotorCmd_.idl + Source: MotorCmd_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_MOTORCMD__HPP +#define DDSCXX_UNITREE_IDL_GO2_MOTORCMD__HPP + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class MotorCmd_ +{ +private: + uint8_t mode_ = 0; + float q_ = 0.0f; + float dq_ = 0.0f; + float tau_ = 0.0f; + float kp_ = 0.0f; + float kd_ = 0.0f; + std::array reserve_ = { }; + +public: + MotorCmd_() = default; + + explicit MotorCmd_( + uint8_t mode, + float q, + float dq, + float tau, + float kp, + float kd, + const std::array& reserve) : + mode_(mode), + q_(q), + dq_(dq), + tau_(tau), + kp_(kp), + kd_(kd), + reserve_(reserve) { } + + uint8_t mode() const { return this->mode_; } + uint8_t& mode() { return this->mode_; } + void mode(uint8_t _val_) { this->mode_ = _val_; } + float q() const { return this->q_; } + float& q() { return this->q_; } + void q(float _val_) { this->q_ = _val_; } + float dq() const { return this->dq_; } + float& dq() { return this->dq_; } + void dq(float _val_) { this->dq_ = _val_; } + float tau() const { return this->tau_; } + float& tau() { return this->tau_; } + void tau(float _val_) { this->tau_ = _val_; } + float kp() const { return this->kp_; } + float& kp() { return this->kp_; } + void kp(float _val_) { this->kp_ = _val_; } + float kd() const { return this->kd_; } + float& kd() { return this->kd_; } + void kd(float _val_) { this->kd_ = _val_; } + const std::array& reserve() const { return this->reserve_; } + std::array& reserve() { return this->reserve_; } + void reserve(const std::array& _val_) { this->reserve_ = _val_; } + void reserve(std::array&& _val_) { this->reserve_ = _val_; } + + bool operator==(const MotorCmd_& _other) const + { + (void) _other; + return mode_ == _other.mode_ && + q_ == _other.q_ && + dq_ == _other.dq_ && + tau_ == _other.tau_ && + kp_ == _other.kp_ && + kd_ == _other.kd_ && + reserve_ == _other.reserve_; + } + + bool operator!=(const MotorCmd_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::MotorCmd_>::getTypeName() +{ + return "unitree_go::msg::dds_::MotorCmd_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::MotorCmd_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::MotorCmd_>::type_map_blob_sz() { return 478; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::MotorCmd_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::MotorCmd_>::type_map_blob() { + static const uint8_t blob[] = { + 0xa6, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xc8, 0xe5, 0x83, 0x5b, 0x0f, 0x0c, 0x17, + 0x65, 0xbc, 0x23, 0x1d, 0xfa, 0x02, 0xff, 0x00, 0x8e, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x45, 0x80, 0xc2, 0x74, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x26, 0xb5, 0x68, 0xe4, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x87, 0x22, 0x16, 0x52, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x00, 0x06, 0x01, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0x42, 0x1f, 0xa5, 0xb2, 0xdb, 0x2d, 0xef, 0xf5, 0xc0, 0x3f, 0xff, + 0x16, 0x30, 0x3b, 0x00, 0xee, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, + 0x6f, 0x74, 0x6f, 0x72, 0x43, 0x6d, 0x64, 0x5f, 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x74, 0x61, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x6b, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6b, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xf2, 0x42, 0x1f, 0xa5, 0xb2, 0xdb, 0x2d, 0xef, 0xf5, 0xc0, 0x3f, 0xff, 0x16, 0x30, 0x3b, 0xf1, + 0xc8, 0xe5, 0x83, 0x5b, 0x0f, 0x0c, 0x17, 0x65, 0xbc, 0x23, 0x1d, 0xfa, 0x02, 0xff, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::MotorCmd_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xc8, 0xe5, 0x83, 0x5b, 0x0f, 0x0c, 0x17, 0x65, 0xbc, 0x23, 0x1d, + 0xfa, 0x02, 0xff, 0x00, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x42, 0x1f, 0xa5, 0xb2, 0xdb, 0x2d, 0xef, 0xf5, 0xc0, 0x3f, 0xff, + 0x16, 0x30, 0x3b, 0x00, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::MotorCmd_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::MotorCmd_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::MotorCmd_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::MotorCmd_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::MotorCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.tau())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.kp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.kd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::MotorCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorCmd_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::MotorCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.tau())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.kp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.kd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::MotorCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorCmd_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::MotorCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.tau())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.kp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.kd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::MotorCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorCmd_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::MotorCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.tau())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.kp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.kd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::MotorCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorCmd_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_MOTORCMD__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/MotorCmds_.hpp b/unitree_SDK/include/unitree/idl/go2/MotorCmds_.hpp new file mode 100644 index 0000000..50ba74a --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/MotorCmds_.hpp @@ -0,0 +1,348 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: MotorCmds_.idl + Source: MotorCmds_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_MOTORCMDS__HPP +#define DDSCXX_UNITREE_IDL_GO2_MOTORCMDS__HPP + +#include "unitree/idl/go2/MotorCmd_.hpp" + +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class MotorCmds_ +{ +private: + std::vector<::unitree_go::msg::dds_::MotorCmd_> cmds_; + +public: + MotorCmds_() = default; + + explicit MotorCmds_( + const std::vector<::unitree_go::msg::dds_::MotorCmd_>& cmds) : + cmds_(cmds) { } + + const std::vector<::unitree_go::msg::dds_::MotorCmd_>& cmds() const { return this->cmds_; } + std::vector<::unitree_go::msg::dds_::MotorCmd_>& cmds() { return this->cmds_; } + void cmds(const std::vector<::unitree_go::msg::dds_::MotorCmd_>& _val_) { this->cmds_ = _val_; } + void cmds(std::vector<::unitree_go::msg::dds_::MotorCmd_>&& _val_) { this->cmds_ = _val_; } + + bool operator==(const MotorCmds_& _other) const + { + (void) _other; + return cmds_ == _other.cmds_; + } + + bool operator!=(const MotorCmds_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::MotorCmds_>::getTypeName() +{ + return "unitree_go::msg::dds_::MotorCmds_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::MotorCmds_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::MotorCmds_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::MotorCmds_>::type_map_blob_sz() { return 708; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::MotorCmds_>::type_info_blob_sz() { return 148; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::MotorCmds_>::type_map_blob() { + static const uint8_t blob[] = { + 0xf2, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf1, 0x8b, 0xdd, 0x20, 0x7f, 0x54, 0xf9, 0xc2, + 0xac, 0x2e, 0xa6, 0xb2, 0xa0, 0x48, 0x2e, 0x00, 0x36, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf1, 0x01, 0x00, 0x00, 0xf1, + 0xc8, 0xe5, 0x83, 0x5b, 0x0f, 0x0c, 0x17, 0x65, 0xbc, 0x23, 0x1d, 0xfa, 0x02, 0xff, 0xb0, 0x2e, + 0x95, 0x33, 0xf1, 0xc8, 0xe5, 0x83, 0x5b, 0x0f, 0x0c, 0x17, 0x65, 0xbc, 0x23, 0x1d, 0xfa, 0x02, + 0xff, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x45, 0x80, 0xc2, 0x74, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x26, 0xb5, 0x68, 0xe4, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x87, 0x22, 0x16, 0x52, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x00, 0x82, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0xf2, 0x2e, 0xa8, 0x7a, 0x3a, 0xc2, 0x22, 0xec, 0x38, 0x65, 0x96, 0x03, 0x6e, 0xce, 0x43, 0x00, + 0x67, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, 0x6f, 0x74, 0x6f, 0x72, + 0x43, 0x6d, 0x64, 0x73, 0x5f, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf2, 0x01, 0x00, 0x00, 0xf2, + 0x42, 0x1f, 0xa5, 0xb2, 0xdb, 0x2d, 0xef, 0xf5, 0xc0, 0x3f, 0xff, 0x16, 0x30, 0x3b, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x63, 0x6d, 0x64, 0x73, 0x00, 0x00, 0x00, 0xf2, 0x42, 0x1f, 0xa5, 0xb2, + 0xdb, 0x2d, 0xef, 0xf5, 0xc0, 0x3f, 0xff, 0x16, 0x30, 0x3b, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, 0x6f, 0x74, 0x6f, 0x72, 0x43, 0x6d, 0x64, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x74, 0x61, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6b, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x6b, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf2, 0x2e, 0xa8, 0x7a, 0x3a, 0xc2, 0x22, 0xec, + 0x38, 0x65, 0x96, 0x03, 0x6e, 0xce, 0x43, 0xf1, 0x8b, 0xdd, 0x20, 0x7f, 0x54, 0xf9, 0xc2, 0xac, + 0x2e, 0xa6, 0xb2, 0xa0, 0x48, 0x2e, 0xf2, 0x42, 0x1f, 0xa5, 0xb2, 0xdb, 0x2d, 0xef, 0xf5, 0xc0, + 0x3f, 0xff, 0x16, 0x30, 0x3b, 0xf1, 0xc8, 0xe5, 0x83, 0x5b, 0x0f, 0x0c, 0x17, 0x65, 0xbc, 0x23, + 0x1d, 0xfa, 0x02, 0xff, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::MotorCmds_>::type_info_blob() { + static const uint8_t blob[] = { + 0x90, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x8b, 0xdd, 0x20, 0x7f, 0x54, 0xf9, 0xc2, 0xac, 0x2e, 0xa6, 0xb2, + 0xa0, 0x48, 0x2e, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xc8, 0xe5, 0x83, 0x5b, 0x0f, 0x0c, 0x17, + 0x65, 0xbc, 0x23, 0x1d, 0xfa, 0x02, 0xff, 0x00, 0x92, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x2e, 0xa8, 0x7a, + 0x3a, 0xc2, 0x22, 0xec, 0x38, 0x65, 0x96, 0x03, 0x6e, 0xce, 0x43, 0x00, 0x6b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x42, 0x1f, 0xa5, 0xb2, 0xdb, 0x2d, 0xef, 0xf5, 0xc0, 0x3f, 0xff, 0x16, 0x30, 0x3b, 0x00, + 0xf2, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::MotorCmds_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::MotorCmds_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::MotorCmds_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::MotorCmds_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::MotorCmds_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.cmds().size()); + if (!write(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!write(streamer, instance.cmds()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::MotorCmds_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorCmds_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::MotorCmds_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.cmds().size()); + if (!read(streamer, se_1)) + return false; + instance.cmds().resize(se_1); + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!read(streamer, instance.cmds()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::MotorCmds_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorCmds_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::MotorCmds_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.cmds().size()); + if (!move(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!move(streamer, instance.cmds()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::MotorCmds_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorCmds_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::MotorCmds_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!max(streamer, instance.cmds()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::MotorCmds_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorCmds_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_MOTORCMDS__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/MotorState_.hpp b/unitree_SDK/include/unitree/idl/go2/MotorState_.hpp new file mode 100644 index 0000000..bddfc3b --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/MotorState_.hpp @@ -0,0 +1,696 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: MotorState_.idl + Source: MotorState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_MOTORSTATE__HPP +#define DDSCXX_UNITREE_IDL_GO2_MOTORSTATE__HPP + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class MotorState_ +{ +private: + uint8_t mode_ = 0; + float q_ = 0.0f; + float dq_ = 0.0f; + float ddq_ = 0.0f; + float tau_est_ = 0.0f; + float q_raw_ = 0.0f; + float dq_raw_ = 0.0f; + float ddq_raw_ = 0.0f; + uint8_t temperature_ = 0; + uint32_t lost_ = 0; + std::array reserve_ = { }; + +public: + MotorState_() = default; + + explicit MotorState_( + uint8_t mode, + float q, + float dq, + float ddq, + float tau_est, + float q_raw, + float dq_raw, + float ddq_raw, + uint8_t temperature, + uint32_t lost, + const std::array& reserve) : + mode_(mode), + q_(q), + dq_(dq), + ddq_(ddq), + tau_est_(tau_est), + q_raw_(q_raw), + dq_raw_(dq_raw), + ddq_raw_(ddq_raw), + temperature_(temperature), + lost_(lost), + reserve_(reserve) { } + + uint8_t mode() const { return this->mode_; } + uint8_t& mode() { return this->mode_; } + void mode(uint8_t _val_) { this->mode_ = _val_; } + float q() const { return this->q_; } + float& q() { return this->q_; } + void q(float _val_) { this->q_ = _val_; } + float dq() const { return this->dq_; } + float& dq() { return this->dq_; } + void dq(float _val_) { this->dq_ = _val_; } + float ddq() const { return this->ddq_; } + float& ddq() { return this->ddq_; } + void ddq(float _val_) { this->ddq_ = _val_; } + float tau_est() const { return this->tau_est_; } + float& tau_est() { return this->tau_est_; } + void tau_est(float _val_) { this->tau_est_ = _val_; } + float q_raw() const { return this->q_raw_; } + float& q_raw() { return this->q_raw_; } + void q_raw(float _val_) { this->q_raw_ = _val_; } + float dq_raw() const { return this->dq_raw_; } + float& dq_raw() { return this->dq_raw_; } + void dq_raw(float _val_) { this->dq_raw_ = _val_; } + float ddq_raw() const { return this->ddq_raw_; } + float& ddq_raw() { return this->ddq_raw_; } + void ddq_raw(float _val_) { this->ddq_raw_ = _val_; } + uint8_t temperature() const { return this->temperature_; } + uint8_t& temperature() { return this->temperature_; } + void temperature(uint8_t _val_) { this->temperature_ = _val_; } + uint32_t lost() const { return this->lost_; } + uint32_t& lost() { return this->lost_; } + void lost(uint32_t _val_) { this->lost_ = _val_; } + const std::array& reserve() const { return this->reserve_; } + std::array& reserve() { return this->reserve_; } + void reserve(const std::array& _val_) { this->reserve_ = _val_; } + void reserve(std::array&& _val_) { this->reserve_ = _val_; } + + bool operator==(const MotorState_& _other) const + { + (void) _other; + return mode_ == _other.mode_ && + q_ == _other.q_ && + dq_ == _other.dq_ && + ddq_ == _other.ddq_ && + tau_est_ == _other.tau_est_ && + q_raw_ == _other.q_raw_ && + dq_raw_ == _other.dq_raw_ && + ddq_raw_ == _other.ddq_raw_ && + temperature_ == _other.temperature_ && + lost_ == _other.lost_ && + reserve_ == _other.reserve_; + } + + bool operator!=(const MotorState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::MotorState_>::getTypeName() +{ + return "unitree_go::msg::dds_::MotorState_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::MotorState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::MotorState_>::type_map_blob_sz() { return 658; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::MotorState_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::MotorState_>::type_map_blob() { + static const uint8_t blob[] = { + 0xe6, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x42, 0xa2, 0x28, 0x8b, 0x79, 0x8a, 0xf8, + 0xdb, 0x05, 0xe1, 0x27, 0x36, 0xb1, 0xbe, 0x00, 0xce, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xe9, 0x16, 0x89, 0x09, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x8a, 0xf7, 0xae, 0xdf, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x6e, 0x96, 0x3d, 0x84, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x30, 0x50, 0xb6, 0xd9, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x4a, 0xe0, 0x48, 0xae, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xee, 0xf4, 0x38, 0xf7, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x1c, 0x9a, 0x44, 0xeb, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x00, 0x7a, 0x01, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0xd2, 0xbc, 0xfb, 0x97, 0xbe, 0x37, 0xa8, 0xbc, 0x9c, 0x41, 0xe5, + 0x0b, 0xa1, 0xc9, 0x00, 0x62, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, + 0x6f, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x2a, 0x01, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x74, 0x61, 0x75, 0x5f, 0x65, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x06, 0x00, 0x00, 0x00, 0x71, 0x5f, 0x72, 0x61, + 0x77, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x64, 0x71, 0x5f, 0x72, 0x61, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x64, 0x64, 0x71, 0x5f, 0x72, 0x61, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6c, 0x6f, 0x73, 0x74, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0xd2, 0xbc, 0xfb, 0x97, 0xbe, 0x37, 0xa8, 0xbc, 0x9c, 0x41, 0xe5, + 0x0b, 0xa1, 0xc9, 0xf1, 0x42, 0xa2, 0x28, 0x8b, 0x79, 0x8a, 0xf8, 0xdb, 0x05, 0xe1, 0x27, 0x36, + 0xb1, 0xbe, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::MotorState_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x42, 0xa2, 0x28, 0x8b, 0x79, 0x8a, 0xf8, 0xdb, 0x05, 0xe1, 0x27, + 0x36, 0xb1, 0xbe, 0x00, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd2, 0xbc, 0xfb, 0x97, 0xbe, 0x37, 0xa8, 0xbc, 0x9c, 0x41, 0xe5, + 0x0b, 0xa1, 0xc9, 0x00, 0x66, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::MotorState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::MotorState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::MotorState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::MotorState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::MotorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.ddq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.tau_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.q_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.dq_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.ddq_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.lost())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::MotorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::MotorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.ddq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.tau_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.q_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.dq_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.ddq_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.lost())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::MotorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::MotorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.ddq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.tau_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.q_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.dq_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.ddq_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.lost())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::MotorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::MotorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.ddq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.tau_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.q_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.dq_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.ddq_raw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.lost())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::MotorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_MOTORSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/MotorStates_.hpp b/unitree_SDK/include/unitree/idl/go2/MotorStates_.hpp new file mode 100644 index 0000000..4631f1f --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/MotorStates_.hpp @@ -0,0 +1,359 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: MotorStates_.idl + Source: MotorStates_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_MOTORSTATES__HPP +#define DDSCXX_UNITREE_IDL_GO2_MOTORSTATES__HPP + +#include "unitree/idl/go2/MotorState_.hpp" + +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class MotorStates_ +{ +private: + std::vector<::unitree_go::msg::dds_::MotorState_> states_; + +public: + MotorStates_() = default; + + explicit MotorStates_( + const std::vector<::unitree_go::msg::dds_::MotorState_>& states) : + states_(states) { } + + const std::vector<::unitree_go::msg::dds_::MotorState_>& states() const { return this->states_; } + std::vector<::unitree_go::msg::dds_::MotorState_>& states() { return this->states_; } + void states(const std::vector<::unitree_go::msg::dds_::MotorState_>& _val_) { this->states_ = _val_; } + void states(std::vector<::unitree_go::msg::dds_::MotorState_>&& _val_) { this->states_ = _val_; } + + bool operator==(const MotorStates_& _other) const + { + (void) _other; + return states_ == _other.states_; + } + + bool operator!=(const MotorStates_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::MotorStates_>::getTypeName() +{ + return "unitree_go::msg::dds_::MotorStates_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::MotorStates_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::MotorStates_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::MotorStates_>::type_map_blob_sz() { return 888; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::MotorStates_>::type_info_blob_sz() { return 148; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::MotorStates_>::type_map_blob() { + static const uint8_t blob[] = { + 0x32, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf1, 0x13, 0xa0, 0x6c, 0x7a, 0xa8, 0x80, 0x82, + 0x61, 0x7d, 0xd1, 0xe8, 0xed, 0xe0, 0x45, 0x00, 0x36, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf1, 0x01, 0x00, 0x00, 0xf1, + 0x42, 0xa2, 0x28, 0x8b, 0x79, 0x8a, 0xf8, 0xdb, 0x05, 0xe1, 0x27, 0x36, 0xb1, 0xbe, 0x34, 0xd9, + 0x55, 0xa0, 0xf1, 0x42, 0xa2, 0x28, 0x8b, 0x79, 0x8a, 0xf8, 0xdb, 0x05, 0xe1, 0x27, 0x36, 0xb1, + 0xbe, 0x00, 0x00, 0x00, 0xce, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xe9, 0x16, 0x89, 0x09, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x8a, 0xf7, 0xae, 0xdf, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x6e, 0x96, 0x3d, 0x84, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x30, 0x50, 0xb6, 0xd9, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x4a, 0xe0, 0x48, 0xae, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xee, 0xf4, 0x38, 0xf7, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x1c, 0x9a, 0x44, 0xeb, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x00, 0xf6, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0xf2, 0xb9, 0x0a, 0xca, 0x92, 0x86, 0xab, 0x4e, 0x3e, 0xae, 0x76, 0x38, 0xef, 0x5c, 0xa9, 0x00, + 0x69, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, 0x6f, 0x74, 0x6f, 0x72, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x73, 0x5f, 0x00, 0x31, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf2, 0x01, 0x00, 0x00, 0xf2, + 0xd2, 0xbc, 0xfb, 0x97, 0xbe, 0x37, 0xa8, 0xbc, 0x9c, 0x41, 0xe5, 0x0b, 0xa1, 0xc9, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x74, 0x65, 0x73, 0x00, 0x00, 0x00, 0xf2, 0xd2, 0xbc, + 0xfb, 0x97, 0xbe, 0x37, 0xa8, 0xbc, 0x9c, 0x41, 0xe5, 0x0b, 0xa1, 0xc9, 0x62, 0x01, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, 0x6f, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x5f, 0x00, 0x00, 0x2a, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x64, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x74, 0x61, 0x75, 0x5f, 0x65, 0x73, 0x74, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x71, 0x5f, 0x72, 0x61, 0x77, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x07, 0x00, 0x00, 0x00, 0x64, 0x71, 0x5f, 0x72, + 0x61, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x64, 0x64, 0x71, 0x5f, 0x72, 0x61, 0x77, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x6c, 0x6f, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf2, 0xb9, 0x0a, 0xca, + 0x92, 0x86, 0xab, 0x4e, 0x3e, 0xae, 0x76, 0x38, 0xef, 0x5c, 0xa9, 0xf1, 0x13, 0xa0, 0x6c, 0x7a, + 0xa8, 0x80, 0x82, 0x61, 0x7d, 0xd1, 0xe8, 0xed, 0xe0, 0x45, 0xf2, 0xd2, 0xbc, 0xfb, 0x97, 0xbe, + 0x37, 0xa8, 0xbc, 0x9c, 0x41, 0xe5, 0x0b, 0xa1, 0xc9, 0xf1, 0x42, 0xa2, 0x28, 0x8b, 0x79, 0x8a, + 0xf8, 0xdb, 0x05, 0xe1, 0x27, 0x36, 0xb1, 0xbe, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::MotorStates_>::type_info_blob() { + static const uint8_t blob[] = { + 0x90, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x13, 0xa0, 0x6c, 0x7a, 0xa8, 0x80, 0x82, 0x61, 0x7d, 0xd1, 0xe8, + 0xed, 0xe0, 0x45, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x42, 0xa2, 0x28, 0x8b, 0x79, 0x8a, 0xf8, + 0xdb, 0x05, 0xe1, 0x27, 0x36, 0xb1, 0xbe, 0x00, 0xd2, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xb9, 0x0a, 0xca, + 0x92, 0x86, 0xab, 0x4e, 0x3e, 0xae, 0x76, 0x38, 0xef, 0x5c, 0xa9, 0x00, 0x6d, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xd2, 0xbc, 0xfb, 0x97, 0xbe, 0x37, 0xa8, 0xbc, 0x9c, 0x41, 0xe5, 0x0b, 0xa1, 0xc9, 0x00, + 0x66, 0x01, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::MotorStates_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::MotorStates_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::MotorStates_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::MotorStates_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::MotorStates_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.states().size()); + if (!write(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!write(streamer, instance.states()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::MotorStates_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorStates_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::MotorStates_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.states().size()); + if (!read(streamer, se_1)) + return false; + instance.states().resize(se_1); + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!read(streamer, instance.states()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::MotorStates_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorStates_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::MotorStates_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.states().size()); + if (!move(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!move(streamer, instance.states()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::MotorStates_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorStates_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::MotorStates_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!max(streamer, instance.states()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::MotorStates_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::MotorStates_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_MOTORSTATES__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/PathPoint_.hpp b/unitree_SDK/include/unitree/idl/go2/PathPoint_.hpp new file mode 100644 index 0000000..d4ea2e9 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/PathPoint_.hpp @@ -0,0 +1,508 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: PathPoint_.idl + Source: PathPoint_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_PATHPOINT__HPP +#define DDSCXX_UNITREE_IDL_GO2_PATHPOINT__HPP + + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class PathPoint_ +{ +private: + float t_from_start_ = 0.0f; + float x_ = 0.0f; + float y_ = 0.0f; + float yaw_ = 0.0f; + float vx_ = 0.0f; + float vy_ = 0.0f; + float vyaw_ = 0.0f; + +public: + PathPoint_() = default; + + explicit PathPoint_( + float t_from_start, + float x, + float y, + float yaw, + float vx, + float vy, + float vyaw) : + t_from_start_(t_from_start), + x_(x), + y_(y), + yaw_(yaw), + vx_(vx), + vy_(vy), + vyaw_(vyaw) { } + + float t_from_start() const { return this->t_from_start_; } + float& t_from_start() { return this->t_from_start_; } + void t_from_start(float _val_) { this->t_from_start_ = _val_; } + float x() const { return this->x_; } + float& x() { return this->x_; } + void x(float _val_) { this->x_ = _val_; } + float y() const { return this->y_; } + float& y() { return this->y_; } + void y(float _val_) { this->y_ = _val_; } + float yaw() const { return this->yaw_; } + float& yaw() { return this->yaw_; } + void yaw(float _val_) { this->yaw_ = _val_; } + float vx() const { return this->vx_; } + float& vx() { return this->vx_; } + void vx(float _val_) { this->vx_ = _val_; } + float vy() const { return this->vy_; } + float& vy() { return this->vy_; } + void vy(float _val_) { this->vy_ = _val_; } + float vyaw() const { return this->vyaw_; } + float& vyaw() { return this->vyaw_; } + void vyaw(float _val_) { this->vyaw_ = _val_; } + + bool operator==(const PathPoint_& _other) const + { + (void) _other; + return t_from_start_ == _other.t_from_start_ && + x_ == _other.x_ && + y_ == _other.y_ && + yaw_ == _other.yaw_ && + vx_ == _other.vx_ && + vy_ == _other.vy_ && + vyaw_ == _other.vyaw_; + } + + bool operator!=(const PathPoint_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::PathPoint_>::getTypeName() +{ + return "unitree_go::msg::dds_::PathPoint_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::PathPoint_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::PathPoint_>::type_map_blob_sz() { return 454; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::PathPoint_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::PathPoint_>::type_map_blob() { + static const uint8_t blob[] = { + 0x9b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x6d, 0x6e, 0x83, 0x23, 0xe9, 0x1a, 0xd4, + 0x2a, 0x82, 0x33, 0xae, 0xf6, 0xbd, 0xe2, 0x00, 0x83, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xe9, 0x6c, 0x41, 0xab, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x9d, 0xd4, 0xe4, 0x61, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x41, 0x52, 0x90, 0x76, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x92, 0xdd, 0xa6, 0x44, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x76, 0x7f, 0xc7, 0x3d, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x94, 0x95, 0xfa, 0x6c, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x83, 0x29, 0x00, 0xa3, 0x00, + 0xfb, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xd6, 0x62, 0x9a, 0x35, 0x54, 0x6d, 0x9f, + 0xc9, 0xae, 0x65, 0xcf, 0xa2, 0xd4, 0x15, 0x00, 0xe3, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x50, 0x61, 0x74, 0x68, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x00, 0x00, 0x00, + 0xab, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x74, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x79, 0x61, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x76, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x76, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x76, 0x79, 0x61, 0x77, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xd6, 0x62, 0x9a, 0x35, 0x54, 0x6d, 0x9f, + 0xc9, 0xae, 0x65, 0xcf, 0xa2, 0xd4, 0x15, 0xf1, 0x6d, 0x6e, 0x83, 0x23, 0xe9, 0x1a, 0xd4, 0x2a, + 0x82, 0x33, 0xae, 0xf6, 0xbd, 0xe2, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::PathPoint_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x6d, 0x6e, 0x83, 0x23, 0xe9, 0x1a, 0xd4, 0x2a, 0x82, 0x33, 0xae, + 0xf6, 0xbd, 0xe2, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd6, 0x62, 0x9a, 0x35, 0x54, 0x6d, 0x9f, 0xc9, 0xae, 0x65, 0xcf, + 0xa2, 0xd4, 0x15, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::PathPoint_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::PathPoint_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::PathPoint_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::PathPoint_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::PathPoint_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.t_from_start())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.vx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.vy())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.vyaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::PathPoint_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::PathPoint_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::PathPoint_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.t_from_start())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.vx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.vy())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.vyaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::PathPoint_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::PathPoint_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::PathPoint_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.t_from_start())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.vx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.vy())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.vyaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::PathPoint_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::PathPoint_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::PathPoint_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.t_from_start())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.vx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.vy())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.vyaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::PathPoint_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::PathPoint_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_PATHPOINT__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/Req_.hpp b/unitree_SDK/include/unitree/idl/go2/Req_.hpp new file mode 100644 index 0000000..22ab0ca --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/Req_.hpp @@ -0,0 +1,308 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Req_.idl + Source: Req_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_REQ__HPP +#define DDSCXX_UNITREE_IDL_GO2_REQ__HPP + +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class Req_ +{ +private: + std::string uuid_; + std::string body_; + +public: + Req_() = default; + + explicit Req_( + const std::string& uuid, + const std::string& body) : + uuid_(uuid), + body_(body) { } + + const std::string& uuid() const { return this->uuid_; } + std::string& uuid() { return this->uuid_; } + void uuid(const std::string& _val_) { this->uuid_ = _val_; } + void uuid(std::string&& _val_) { this->uuid_ = _val_; } + const std::string& body() const { return this->body_; } + std::string& body() { return this->body_; } + void body(const std::string& _val_) { this->body_ = _val_; } + void body(std::string&& _val_) { this->body_ = _val_; } + + bool operator==(const Req_& _other) const + { + (void) _other; + return uuid_ == _other.uuid_ && + body_ == _other.body_; + } + + bool operator!=(const Req_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::Req_>::getTypeName() +{ + return "unitree_go::msg::dds_::Req_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::Req_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::Req_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::Req_>::type_map_blob_sz() { return 246; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::Req_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::Req_>::type_map_blob() { + static const uint8_t blob[] = { + 0x4c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x65, 0xcc, 0xb2, 0xec, 0x1b, 0x91, 0xab, + 0x31, 0x5f, 0x50, 0x70, 0x86, 0x74, 0x52, 0x00, 0x34, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0xef, 0x7c, 0x87, 0x6f, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x84, 0x1a, 0x2d, 0x68, + 0x7b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x03, 0x02, 0x36, 0x18, 0x03, 0xef, 0x61, + 0x1d, 0xd6, 0x73, 0x0b, 0x4b, 0x4d, 0x57, 0x00, 0x63, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x5f, 0x00, 0x33, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x75, 0x75, 0x69, 0x64, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x70, 0x00, 0x05, 0x00, 0x00, 0x00, 0x62, 0x6f, 0x64, 0x79, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x03, 0x02, 0x36, 0x18, 0x03, 0xef, 0x61, + 0x1d, 0xd6, 0x73, 0x0b, 0x4b, 0x4d, 0x57, 0xf1, 0x65, 0xcc, 0xb2, 0xec, 0x1b, 0x91, 0xab, 0x31, + 0x5f, 0x50, 0x70, 0x86, 0x74, 0x52, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::Req_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x65, 0xcc, 0xb2, 0xec, 0x1b, 0x91, 0xab, 0x31, 0x5f, 0x50, 0x70, + 0x86, 0x74, 0x52, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x03, 0x02, 0x36, 0x18, 0x03, 0xef, 0x61, 0x1d, 0xd6, 0x73, 0x0b, + 0x4b, 0x4d, 0x57, 0x00, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::Req_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::Req_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::Req_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::Req_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::Req_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.uuid(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.body(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::Req_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Req_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::Req_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.uuid(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.body(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::Req_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Req_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::Req_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.uuid(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.body(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::Req_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Req_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::Req_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.uuid(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.body(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::Req_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Req_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_REQ__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/Res_.hpp b/unitree_SDK/include/unitree/idl/go2/Res_.hpp new file mode 100644 index 0000000..af04529 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/Res_.hpp @@ -0,0 +1,395 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Res_.idl + Source: Res_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_RES__HPP +#define DDSCXX_UNITREE_IDL_GO2_RES__HPP + +#include +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class Res_ +{ +private: + std::string uuid_; + std::vector data_; + std::string body_; + +public: + Res_() = default; + + explicit Res_( + const std::string& uuid, + const std::vector& data, + const std::string& body) : + uuid_(uuid), + data_(data), + body_(body) { } + + const std::string& uuid() const { return this->uuid_; } + std::string& uuid() { return this->uuid_; } + void uuid(const std::string& _val_) { this->uuid_ = _val_; } + void uuid(std::string&& _val_) { this->uuid_ = _val_; } + const std::vector& data() const { return this->data_; } + std::vector& data() { return this->data_; } + void data(const std::vector& _val_) { this->data_ = _val_; } + void data(std::vector&& _val_) { this->data_ = _val_; } + const std::string& body() const { return this->body_; } + std::string& body() { return this->body_; } + void body(const std::string& _val_) { this->body_ = _val_; } + void body(std::string&& _val_) { this->body_ = _val_; } + + bool operator==(const Res_& _other) const + { + (void) _other; + return uuid_ == _other.uuid_ && + data_ == _other.data_ && + body_ == _other.body_; + } + + bool operator!=(const Res_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::Res_>::getTypeName() +{ + return "unitree_go::msg::dds_::Res_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::Res_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::Res_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::Res_>::type_map_blob_sz() { return 294; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::Res_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::Res_>::type_map_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x69, 0xfa, 0xd9, 0x7e, 0x47, 0x4e, 0xa0, + 0x13, 0x2b, 0xc3, 0x64, 0xa3, 0xd8, 0xca, 0x00, 0x48, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0xef, 0x7c, 0x87, 0x6f, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, + 0x8d, 0x77, 0x7f, 0x38, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x84, 0x1a, 0x2d, 0x68, 0x97, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xd1, 0x28, 0xe7, + 0x14, 0xf2, 0x86, 0x5c, 0xb5, 0xdb, 0x4d, 0x4f, 0x9b, 0x8d, 0x01, 0x00, 0x7f, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x73, 0x5f, 0x00, 0x4f, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x75, 0x75, 0x69, 0x64, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x00, + 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x70, 0x00, 0x05, 0x00, 0x00, 0x00, 0x62, 0x6f, 0x64, 0x79, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xd1, 0x28, 0xe7, 0x14, 0xf2, 0x86, 0x5c, + 0xb5, 0xdb, 0x4d, 0x4f, 0x9b, 0x8d, 0x01, 0xf1, 0x69, 0xfa, 0xd9, 0x7e, 0x47, 0x4e, 0xa0, 0x13, + 0x2b, 0xc3, 0x64, 0xa3, 0xd8, 0xca, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::Res_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x69, 0xfa, 0xd9, 0x7e, 0x47, 0x4e, 0xa0, 0x13, 0x2b, 0xc3, 0x64, + 0xa3, 0xd8, 0xca, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd1, 0x28, 0xe7, 0x14, 0xf2, 0x86, 0x5c, 0xb5, 0xdb, 0x4d, 0x4f, + 0x9b, 0x8d, 0x01, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::Res_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::Res_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::Res_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::Res_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::Res_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.uuid(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!write(streamer, se_1)) + return false; + if (se_1 > 0 && + !write(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.body(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::Res_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Res_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::Res_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.uuid(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!read(streamer, se_1)) + return false; + instance.data().resize(se_1); + if (se_1 > 0 && + !read(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.body(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::Res_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Res_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::Res_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.uuid(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!move(streamer, se_1)) + return false; + if (se_1 > 0 && + !move(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.body(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::Res_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Res_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::Res_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.uuid(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + if (se_1 > 0 && + !max(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.body(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::Res_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::Res_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_RES__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/SportModeCmd_.hpp b/unitree_SDK/include/unitree/idl/go2/SportModeCmd_.hpp new file mode 100644 index 0000000..1295e62 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/SportModeCmd_.hpp @@ -0,0 +1,819 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: SportModeCmd_.idl + Source: SportModeCmd_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_SPORTMODECMD__HPP +#define DDSCXX_UNITREE_IDL_GO2_SPORTMODECMD__HPP + +#include "unitree/idl/go2/BmsCmd_.hpp" + +#include "unitree/idl/go2/PathPoint_.hpp" + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class SportModeCmd_ +{ +private: + uint8_t mode_ = 0; + uint8_t gait_type_ = 0; + uint8_t speed_level_ = 0; + float foot_raise_height_ = 0.0f; + float body_height_ = 0.0f; + std::array position_ = { }; + std::array euler_ = { }; + std::array velocity_ = { }; + float yaw_speed_ = 0.0f; + ::unitree_go::msg::dds_::BmsCmd_ bms_cmd_; + std::array<::unitree_go::msg::dds_::PathPoint_, 30> path_point_ = { }; + +public: + SportModeCmd_() = default; + + explicit SportModeCmd_( + uint8_t mode, + uint8_t gait_type, + uint8_t speed_level, + float foot_raise_height, + float body_height, + const std::array& position, + const std::array& euler, + const std::array& velocity, + float yaw_speed, + const ::unitree_go::msg::dds_::BmsCmd_& bms_cmd, + const std::array<::unitree_go::msg::dds_::PathPoint_, 30>& path_point) : + mode_(mode), + gait_type_(gait_type), + speed_level_(speed_level), + foot_raise_height_(foot_raise_height), + body_height_(body_height), + position_(position), + euler_(euler), + velocity_(velocity), + yaw_speed_(yaw_speed), + bms_cmd_(bms_cmd), + path_point_(path_point) { } + + uint8_t mode() const { return this->mode_; } + uint8_t& mode() { return this->mode_; } + void mode(uint8_t _val_) { this->mode_ = _val_; } + uint8_t gait_type() const { return this->gait_type_; } + uint8_t& gait_type() { return this->gait_type_; } + void gait_type(uint8_t _val_) { this->gait_type_ = _val_; } + uint8_t speed_level() const { return this->speed_level_; } + uint8_t& speed_level() { return this->speed_level_; } + void speed_level(uint8_t _val_) { this->speed_level_ = _val_; } + float foot_raise_height() const { return this->foot_raise_height_; } + float& foot_raise_height() { return this->foot_raise_height_; } + void foot_raise_height(float _val_) { this->foot_raise_height_ = _val_; } + float body_height() const { return this->body_height_; } + float& body_height() { return this->body_height_; } + void body_height(float _val_) { this->body_height_ = _val_; } + const std::array& position() const { return this->position_; } + std::array& position() { return this->position_; } + void position(const std::array& _val_) { this->position_ = _val_; } + void position(std::array&& _val_) { this->position_ = _val_; } + const std::array& euler() const { return this->euler_; } + std::array& euler() { return this->euler_; } + void euler(const std::array& _val_) { this->euler_ = _val_; } + void euler(std::array&& _val_) { this->euler_ = _val_; } + const std::array& velocity() const { return this->velocity_; } + std::array& velocity() { return this->velocity_; } + void velocity(const std::array& _val_) { this->velocity_ = _val_; } + void velocity(std::array&& _val_) { this->velocity_ = _val_; } + float yaw_speed() const { return this->yaw_speed_; } + float& yaw_speed() { return this->yaw_speed_; } + void yaw_speed(float _val_) { this->yaw_speed_ = _val_; } + const ::unitree_go::msg::dds_::BmsCmd_& bms_cmd() const { return this->bms_cmd_; } + ::unitree_go::msg::dds_::BmsCmd_& bms_cmd() { return this->bms_cmd_; } + void bms_cmd(const ::unitree_go::msg::dds_::BmsCmd_& _val_) { this->bms_cmd_ = _val_; } + void bms_cmd(::unitree_go::msg::dds_::BmsCmd_&& _val_) { this->bms_cmd_ = _val_; } + const std::array<::unitree_go::msg::dds_::PathPoint_, 30>& path_point() const { return this->path_point_; } + std::array<::unitree_go::msg::dds_::PathPoint_, 30>& path_point() { return this->path_point_; } + void path_point(const std::array<::unitree_go::msg::dds_::PathPoint_, 30>& _val_) { this->path_point_ = _val_; } + void path_point(std::array<::unitree_go::msg::dds_::PathPoint_, 30>&& _val_) { this->path_point_ = _val_; } + + bool operator==(const SportModeCmd_& _other) const + { + (void) _other; + return mode_ == _other.mode_ && + gait_type_ == _other.gait_type_ && + speed_level_ == _other.speed_level_ && + foot_raise_height_ == _other.foot_raise_height_ && + body_height_ == _other.body_height_ && + position_ == _other.position_ && + euler_ == _other.euler_ && + velocity_ == _other.velocity_ && + yaw_speed_ == _other.yaw_speed_ && + bms_cmd_ == _other.bms_cmd_ && + path_point_ == _other.path_point_; + } + + bool operator!=(const SportModeCmd_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::SportModeCmd_>::getTypeName() +{ + return "unitree_go::msg::dds_::SportModeCmd_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::SportModeCmd_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::SportModeCmd_>::type_map_blob_sz() { return 1506; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::SportModeCmd_>::type_info_blob_sz() { return 196; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::SportModeCmd_>::type_map_blob() { + static const uint8_t blob[] = { + 0x13, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf1, 0x4b, 0xbc, 0x00, 0xba, 0x9a, 0x8c, 0x2d, + 0x02, 0x68, 0x52, 0x1d, 0xd0, 0xd4, 0xb6, 0x00, 0x10, 0x01, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xe2, 0xc7, 0x6d, 0x1e, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x3b, 0xbb, 0xc1, 0x77, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xb5, 0x46, 0x7f, 0xa0, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xe0, 0x34, 0x4c, 0x32, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x09, 0x47, 0x57, 0xfe, 0x07, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0xbc, 0x64, 0x6b, 0xe3, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x09, 0xac, 0x1a, + 0x45, 0x3d, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x25, + 0xcf, 0xab, 0x66, 0x00, 0x19, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x3e, + 0x8e, 0xb6, 0x7c, 0x25, 0xfd, 0xe0, 0x7e, 0x52, 0xcf, 0x51, 0xed, 0x4a, 0x23, 0x11, 0x50, 0x97, + 0xc7, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf1, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1e, 0xf1, 0x6d, 0x6e, 0x83, 0x23, 0xe9, 0x1a, + 0xd4, 0x2a, 0x82, 0x33, 0xae, 0xf6, 0xbd, 0xe2, 0xdc, 0x56, 0xb6, 0x0a, 0xf1, 0x3e, 0x8e, 0xb6, + 0x7c, 0x25, 0xfd, 0xe0, 0x7e, 0x52, 0xcf, 0x51, 0xed, 0x4a, 0x23, 0x00, 0x3e, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x32, + 0x62, 0xd4, 0x8d, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x02, 0x9c, 0x3b, 0x62, 0x94, 0xf1, 0x6d, + 0x6e, 0x83, 0x23, 0xe9, 0x1a, 0xd4, 0x2a, 0x82, 0x33, 0xae, 0xf6, 0xbd, 0xe2, 0x00, 0x00, 0x00, + 0x83, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x73, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0xe9, 0x6c, 0x41, 0xab, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x92, 0xdd, 0xa6, 0x44, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x76, 0x7f, 0xc7, 0x3d, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x94, 0x95, 0xfa, 0x6c, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x83, 0x29, 0x00, 0xa3, 0x00, 0x63, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0xf2, 0xbb, 0xbb, 0x27, 0xfd, 0xc5, 0x19, 0x66, 0x1a, 0x6a, 0xcc, 0x38, 0x22, 0x2e, 0x2f, 0x00, + 0xc9, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x53, 0x70, 0x6f, 0x72, 0x74, + 0x4d, 0x6f, 0x64, 0x65, 0x43, 0x6d, 0x64, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x01, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x67, 0x61, 0x69, 0x74, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x73, 0x70, 0x65, 0x65, 0x64, 0x5f, 0x6c, 0x65, + 0x76, 0x65, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x12, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x6f, 0x74, 0x5f, 0x72, 0x61, 0x69, + 0x73, 0x65, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x62, 0x6f, 0x64, 0x79, + 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x65, 0x75, 0x6c, 0x65, 0x72, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x09, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x76, 0x65, 0x6c, 0x6f, 0x63, 0x69, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x79, 0x61, 0x77, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x31, 0xa8, 0x59, 0x24, 0x05, 0x6b, 0x7a, 0xf3, 0xd3, + 0xf1, 0x6b, 0x34, 0x22, 0x33, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x62, 0x6d, 0x73, 0x5f, + 0x63, 0x6d, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1e, 0xf2, 0xd6, 0x62, + 0x9a, 0x35, 0x54, 0x6d, 0x9f, 0xc9, 0xae, 0x65, 0xcf, 0xa2, 0xd4, 0x15, 0x0b, 0x00, 0x00, 0x00, + 0x70, 0x61, 0x74, 0x68, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x00, 0x00, 0x00, 0xf2, 0x31, 0xa8, + 0x59, 0x24, 0x05, 0x6b, 0x7a, 0xf3, 0xd3, 0xf1, 0x6b, 0x34, 0x22, 0x33, 0x76, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x42, 0x6d, 0x73, 0x43, 0x6d, 0x64, 0x5f, 0x00, 0x00, + 0x42, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x6f, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0xf2, 0xd6, 0x62, 0x9a, 0x35, 0x54, 0x6d, 0x9f, 0xc9, 0xae, + 0x65, 0xcf, 0xa2, 0xd4, 0x15, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x50, 0x61, 0x74, 0x68, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x00, 0x00, 0x00, + 0xab, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x74, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x79, 0x61, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x76, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x76, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x05, 0x00, 0x00, 0x00, 0x76, 0x79, 0x61, 0x77, 0x00, 0x00, 0x00, 0x00, + 0x5e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf2, 0xbb, 0xbb, 0x27, 0xfd, 0xc5, 0x19, 0x66, + 0x1a, 0x6a, 0xcc, 0x38, 0x22, 0x2e, 0x2f, 0xf1, 0x4b, 0xbc, 0x00, 0xba, 0x9a, 0x8c, 0x2d, 0x02, + 0x68, 0x52, 0x1d, 0xd0, 0xd4, 0xb6, 0xf2, 0x31, 0xa8, 0x59, 0x24, 0x05, 0x6b, 0x7a, 0xf3, 0xd3, + 0xf1, 0x6b, 0x34, 0x22, 0x33, 0xf1, 0x3e, 0x8e, 0xb6, 0x7c, 0x25, 0xfd, 0xe0, 0x7e, 0x52, 0xcf, + 0x51, 0xed, 0x4a, 0x23, 0xf2, 0xd6, 0x62, 0x9a, 0x35, 0x54, 0x6d, 0x9f, 0xc9, 0xae, 0x65, 0xcf, + 0xa2, 0xd4, 0x15, 0xf1, 0x6d, 0x6e, 0x83, 0x23, 0xe9, 0x1a, 0xd4, 0x2a, 0x82, 0x33, 0xae, 0xf6, + 0xbd, 0xe2, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::SportModeCmd_>::type_info_blob() { + static const uint8_t blob[] = { + 0xc0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x4b, 0xbc, 0x00, 0xba, 0x9a, 0x8c, 0x2d, 0x02, 0x68, 0x52, 0x1d, + 0xd0, 0xd4, 0xb6, 0x00, 0x14, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x3e, 0x8e, 0xb6, 0x7c, 0x25, 0xfd, 0xe0, + 0x7e, 0x52, 0xcf, 0x51, 0xed, 0x4a, 0x23, 0x00, 0x42, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x6d, 0x6e, 0x83, 0x23, 0xe9, 0x1a, 0xd4, 0x2a, 0x82, 0x33, 0xae, 0xf6, 0xbd, 0xe2, 0x00, + 0x87, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xbb, 0xbb, 0x27, 0xfd, 0xc5, 0x19, 0x66, 0x1a, 0x6a, 0xcc, 0x38, + 0x22, 0x2e, 0x2f, 0x00, 0xcd, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x31, 0xa8, 0x59, 0x24, 0x05, 0x6b, 0x7a, + 0xf3, 0xd3, 0xf1, 0x6b, 0x34, 0x22, 0x33, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xd6, 0x62, 0x9a, 0x35, 0x54, 0x6d, 0x9f, 0xc9, 0xae, 0x65, 0xcf, 0xa2, 0xd4, 0x15, 0x00, + 0xe7, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::SportModeCmd_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::SportModeCmd_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::SportModeCmd_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::SportModeCmd_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::SportModeCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.gait_type())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.speed_level())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.foot_raise_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.body_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.position()[0], instance.position().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.euler()[0], instance.euler().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.velocity()[0], instance.velocity().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.yaw_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.bms_cmd(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.path_point()) { //array depth 1 + if (!write(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::SportModeCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::SportModeCmd_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::SportModeCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.gait_type())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.speed_level())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.foot_raise_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.body_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.position()[0], instance.position().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.euler()[0], instance.euler().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.velocity()[0], instance.velocity().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.yaw_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.bms_cmd(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (auto & a_1:instance.path_point()) { //array depth 1 + if (!read(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::SportModeCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::SportModeCmd_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::SportModeCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.gait_type())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.speed_level())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.foot_raise_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.body_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.position()[0], instance.position().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.euler()[0], instance.euler().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.velocity()[0], instance.velocity().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.yaw_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.bms_cmd(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.path_point()) { //array depth 1 + if (!move(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::SportModeCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::SportModeCmd_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::SportModeCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.gait_type())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.speed_level())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.foot_raise_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.body_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.position()[0], instance.position().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.euler()[0], instance.euler().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.velocity()[0], instance.velocity().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.yaw_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.bms_cmd(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.path_point()) { //array depth 1 + if (!max(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::SportModeCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::SportModeCmd_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_SPORTMODECMD__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/SportModeState_.hpp b/unitree_SDK/include/unitree/idl/go2/SportModeState_.hpp new file mode 100644 index 0000000..d35e6e4 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/SportModeState_.hpp @@ -0,0 +1,1121 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: SportModeState_.idl + Source: SportModeState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_SPORTMODESTATE__HPP +#define DDSCXX_UNITREE_IDL_GO2_SPORTMODESTATE__HPP + +#include "unitree/idl/go2/IMUState_.hpp" + +#include "unitree/idl/go2/PathPoint_.hpp" + +#include "unitree/idl/go2/TimeSpec_.hpp" + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class SportModeState_ +{ +private: + ::unitree_go::msg::dds_::TimeSpec_ stamp_; + uint32_t error_code_ = 0; + ::unitree_go::msg::dds_::IMUState_ imu_state_; + uint8_t mode_ = 0; + float progress_ = 0.0f; + uint8_t gait_type_ = 0; + float foot_raise_height_ = 0.0f; + std::array position_ = { }; + float body_height_ = 0.0f; + std::array velocity_ = { }; + float yaw_speed_ = 0.0f; + std::array range_obstacle_ = { }; + std::array foot_force_ = { }; + std::array foot_position_body_ = { }; + std::array foot_speed_body_ = { }; + std::array<::unitree_go::msg::dds_::PathPoint_, 10> path_point_ = { }; + +public: + SportModeState_() = default; + + explicit SportModeState_( + const ::unitree_go::msg::dds_::TimeSpec_& stamp, + uint32_t error_code, + const ::unitree_go::msg::dds_::IMUState_& imu_state, + uint8_t mode, + float progress, + uint8_t gait_type, + float foot_raise_height, + const std::array& position, + float body_height, + const std::array& velocity, + float yaw_speed, + const std::array& range_obstacle, + const std::array& foot_force, + const std::array& foot_position_body, + const std::array& foot_speed_body, + const std::array<::unitree_go::msg::dds_::PathPoint_, 10>& path_point) : + stamp_(stamp), + error_code_(error_code), + imu_state_(imu_state), + mode_(mode), + progress_(progress), + gait_type_(gait_type), + foot_raise_height_(foot_raise_height), + position_(position), + body_height_(body_height), + velocity_(velocity), + yaw_speed_(yaw_speed), + range_obstacle_(range_obstacle), + foot_force_(foot_force), + foot_position_body_(foot_position_body), + foot_speed_body_(foot_speed_body), + path_point_(path_point) { } + + const ::unitree_go::msg::dds_::TimeSpec_& stamp() const { return this->stamp_; } + ::unitree_go::msg::dds_::TimeSpec_& stamp() { return this->stamp_; } + void stamp(const ::unitree_go::msg::dds_::TimeSpec_& _val_) { this->stamp_ = _val_; } + void stamp(::unitree_go::msg::dds_::TimeSpec_&& _val_) { this->stamp_ = _val_; } + uint32_t error_code() const { return this->error_code_; } + uint32_t& error_code() { return this->error_code_; } + void error_code(uint32_t _val_) { this->error_code_ = _val_; } + const ::unitree_go::msg::dds_::IMUState_& imu_state() const { return this->imu_state_; } + ::unitree_go::msg::dds_::IMUState_& imu_state() { return this->imu_state_; } + void imu_state(const ::unitree_go::msg::dds_::IMUState_& _val_) { this->imu_state_ = _val_; } + void imu_state(::unitree_go::msg::dds_::IMUState_&& _val_) { this->imu_state_ = _val_; } + uint8_t mode() const { return this->mode_; } + uint8_t& mode() { return this->mode_; } + void mode(uint8_t _val_) { this->mode_ = _val_; } + float progress() const { return this->progress_; } + float& progress() { return this->progress_; } + void progress(float _val_) { this->progress_ = _val_; } + uint8_t gait_type() const { return this->gait_type_; } + uint8_t& gait_type() { return this->gait_type_; } + void gait_type(uint8_t _val_) { this->gait_type_ = _val_; } + float foot_raise_height() const { return this->foot_raise_height_; } + float& foot_raise_height() { return this->foot_raise_height_; } + void foot_raise_height(float _val_) { this->foot_raise_height_ = _val_; } + const std::array& position() const { return this->position_; } + std::array& position() { return this->position_; } + void position(const std::array& _val_) { this->position_ = _val_; } + void position(std::array&& _val_) { this->position_ = _val_; } + float body_height() const { return this->body_height_; } + float& body_height() { return this->body_height_; } + void body_height(float _val_) { this->body_height_ = _val_; } + const std::array& velocity() const { return this->velocity_; } + std::array& velocity() { return this->velocity_; } + void velocity(const std::array& _val_) { this->velocity_ = _val_; } + void velocity(std::array&& _val_) { this->velocity_ = _val_; } + float yaw_speed() const { return this->yaw_speed_; } + float& yaw_speed() { return this->yaw_speed_; } + void yaw_speed(float _val_) { this->yaw_speed_ = _val_; } + const std::array& range_obstacle() const { return this->range_obstacle_; } + std::array& range_obstacle() { return this->range_obstacle_; } + void range_obstacle(const std::array& _val_) { this->range_obstacle_ = _val_; } + void range_obstacle(std::array&& _val_) { this->range_obstacle_ = _val_; } + const std::array& foot_force() const { return this->foot_force_; } + std::array& foot_force() { return this->foot_force_; } + void foot_force(const std::array& _val_) { this->foot_force_ = _val_; } + void foot_force(std::array&& _val_) { this->foot_force_ = _val_; } + const std::array& foot_position_body() const { return this->foot_position_body_; } + std::array& foot_position_body() { return this->foot_position_body_; } + void foot_position_body(const std::array& _val_) { this->foot_position_body_ = _val_; } + void foot_position_body(std::array&& _val_) { this->foot_position_body_ = _val_; } + const std::array& foot_speed_body() const { return this->foot_speed_body_; } + std::array& foot_speed_body() { return this->foot_speed_body_; } + void foot_speed_body(const std::array& _val_) { this->foot_speed_body_ = _val_; } + void foot_speed_body(std::array&& _val_) { this->foot_speed_body_ = _val_; } + const std::array<::unitree_go::msg::dds_::PathPoint_, 10>& path_point() const { return this->path_point_; } + std::array<::unitree_go::msg::dds_::PathPoint_, 10>& path_point() { return this->path_point_; } + void path_point(const std::array<::unitree_go::msg::dds_::PathPoint_, 10>& _val_) { this->path_point_ = _val_; } + void path_point(std::array<::unitree_go::msg::dds_::PathPoint_, 10>&& _val_) { this->path_point_ = _val_; } + + bool operator==(const SportModeState_& _other) const + { + (void) _other; + return stamp_ == _other.stamp_ && + error_code_ == _other.error_code_ && + imu_state_ == _other.imu_state_ && + mode_ == _other.mode_ && + progress_ == _other.progress_ && + gait_type_ == _other.gait_type_ && + foot_raise_height_ == _other.foot_raise_height_ && + position_ == _other.position_ && + body_height_ == _other.body_height_ && + velocity_ == _other.velocity_ && + yaw_speed_ == _other.yaw_speed_ && + range_obstacle_ == _other.range_obstacle_ && + foot_force_ == _other.foot_force_ && + foot_position_body_ == _other.foot_position_body_ && + foot_speed_body_ == _other.foot_speed_body_ && + path_point_ == _other.path_point_; + } + + bool operator!=(const SportModeState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::SportModeState_>::getTypeName() +{ + return "unitree_go::msg::dds_::SportModeState_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::SportModeState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::SportModeState_>::type_map_blob_sz() { return 2316; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::SportModeState_>::type_info_blob_sz() { return 244; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::SportModeState_>::type_map_blob() { + static const uint8_t blob[] = { + 0x33, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf1, 0x9f, 0xa6, 0xcc, 0xdc, 0x5c, 0xaf, 0xde, + 0xaa, 0xb8, 0xa7, 0x62, 0xe3, 0x10, 0x44, 0x00, 0x94, 0x01, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, + 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, 0x8d, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x8e, 0x95, 0xbd, 0x42, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x4b, 0x1b, 0xf4, 0xaf, 0x32, + 0xe5, 0xbc, 0x67, 0x10, 0xef, 0xc8, 0x29, 0x31, 0x15, 0x9e, 0x5f, 0x37, 0x13, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x3c, 0x70, 0x9b, 0x10, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xe2, 0xc7, 0x6d, 0x1e, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xb5, 0x46, 0x7f, 0xa0, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x47, 0x57, 0xfe, 0x07, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xe0, 0x34, 0x4c, 0x32, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0xac, 0x1a, 0x45, 0x3d, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x25, 0xcf, 0xab, 0x66, 0x00, 0x16, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0xcd, 0x43, + 0x62, 0x2f, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x03, 0x41, 0x56, 0x4b, 0x84, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0xb3, 0x0f, 0x21, 0x66, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x0e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0c, 0x09, 0x43, 0x94, 0x9e, 0x02, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf1, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0xf1, 0x6d, 0x6e, + 0x83, 0x23, 0xe9, 0x1a, 0xd4, 0x2a, 0x82, 0x33, 0xae, 0xf6, 0xbd, 0xe2, 0xdc, 0x56, 0xb6, 0x0a, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0xf1, 0x4b, 0x1b, 0xf4, 0xaf, 0x32, 0xe5, 0xbc, 0x67, + 0x10, 0xef, 0xc8, 0x29, 0x31, 0x15, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x75, 0xb9, 0xaa, 0xa0, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x6b, 0x3b, 0x2d, 0x85, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x0e, 0x12, + 0x75, 0x69, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0xb0, 0x7d, 0x92, 0xed, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xee, 0xf4, 0x38, 0xf7, 0xf1, + 0x6d, 0x6e, 0x83, 0x23, 0xe9, 0x1a, 0xd4, 0x2a, 0x82, 0x33, 0xae, 0xf6, 0xbd, 0xe2, 0x00, 0x00, + 0x83, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x73, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0xe9, 0x6c, 0x41, 0xab, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x92, 0xdd, 0xa6, 0x44, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x76, 0x7f, 0xc7, 0x3d, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x94, 0x95, 0xfa, 0x6c, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x83, 0x29, 0x00, 0xa3, 0x00, 0x4f, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xf2, 0xe5, 0x97, 0x49, 0x63, 0x0f, 0xff, 0x75, 0xcc, 0x17, 0x0a, 0xfb, 0x23, 0x87, 0x83, 0x00, + 0xa9, 0x02, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x27, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x53, 0x70, 0x6f, 0x72, 0x74, + 0x4d, 0x6f, 0x64, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x6d, 0x02, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x61, + 0x24, 0x29, 0x6f, 0x59, 0x45, 0x9b, 0xa9, 0x0b, 0xe9, 0x24, 0xc9, 0x35, 0xcc, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x65, 0x72, 0x72, 0x6f, + 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xc4, 0xec, 0xb4, 0x9c, 0xd7, 0xb2, 0x25, 0xd2, 0x26, + 0x28, 0xb6, 0xb7, 0x64, 0xcc, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x69, 0x6d, 0x75, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x70, 0x72, 0x6f, 0x67, 0x72, 0x65, 0x73, 0x73, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x67, 0x61, 0x69, 0x74, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x12, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x6f, 0x74, 0x5f, 0x72, 0x61, 0x69, + 0x73, 0x65, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x62, 0x6f, 0x64, 0x79, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x76, 0x65, 0x6c, 0x6f, 0x63, 0x69, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x79, 0x61, 0x77, 0x5f, + 0x73, 0x70, 0x65, 0x65, 0x64, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x6f, 0x62, 0x73, 0x74, 0x61, 0x63, + 0x6c, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x03, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x6f, 0x74, 0x5f, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x66, 0x6f, 0x6f, 0x74, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x6f, + 0x64, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x66, 0x6f, 0x6f, 0x74, 0x5f, 0x73, 0x70, 0x65, 0x65, 0x64, 0x5f, 0x62, + 0x6f, 0x64, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0xf2, 0xd6, 0x62, + 0x9a, 0x35, 0x54, 0x6d, 0x9f, 0xc9, 0xae, 0x65, 0xcf, 0xa2, 0xd4, 0x15, 0x0b, 0x00, 0x00, 0x00, + 0x70, 0x61, 0x74, 0x68, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x00, 0x00, 0x00, 0xf2, 0x61, 0x24, + 0x29, 0x6f, 0x59, 0x45, 0x9b, 0xa9, 0x0b, 0xe9, 0x24, 0xc9, 0x35, 0xcc, 0x6e, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x70, 0x65, 0x63, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0xf2, 0xc4, + 0xec, 0xb4, 0x9c, 0xd7, 0xb2, 0x25, 0xd2, 0x26, 0x28, 0xb6, 0xb7, 0x64, 0xcc, 0x00, 0x00, 0x00, + 0xfe, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x49, 0x4d, 0x55, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x71, 0x75, 0x61, 0x74, + 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x67, 0x79, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x72, 0x70, 0x79, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, + 0x00, 0x00, 0xf2, 0xd6, 0x62, 0x9a, 0x35, 0x54, 0x6d, 0x9f, 0xc9, 0xae, 0x65, 0xcf, 0xa2, 0xd4, + 0x15, 0x00, 0x00, 0x00, 0xe3, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2a, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, + 0x61, 0x74, 0x68, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x00, 0x00, 0x00, 0xab, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x0d, 0x00, 0x00, 0x00, 0x74, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x79, 0x61, 0x77, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x76, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x76, 0x79, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x76, 0x79, 0x61, 0x77, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x97, 0x49, 0x63, 0x0f, 0xff, 0x75, 0xcc, 0x17, 0x0a, 0xfb, + 0x23, 0x87, 0x83, 0xf1, 0x9f, 0xa6, 0xcc, 0xdc, 0x5c, 0xaf, 0xde, 0xaa, 0xb8, 0xa7, 0x62, 0xe3, + 0x10, 0x44, 0xf2, 0x61, 0x24, 0x29, 0x6f, 0x59, 0x45, 0x9b, 0xa9, 0x0b, 0xe9, 0x24, 0xc9, 0x35, + 0xcc, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, + 0xf2, 0xc4, 0xec, 0xb4, 0x9c, 0xd7, 0xb2, 0x25, 0xd2, 0x26, 0x28, 0xb6, 0xb7, 0x64, 0xcc, 0xf1, + 0x4b, 0x1b, 0xf4, 0xaf, 0x32, 0xe5, 0xbc, 0x67, 0x10, 0xef, 0xc8, 0x29, 0x31, 0x15, 0xf2, 0xd6, + 0x62, 0x9a, 0x35, 0x54, 0x6d, 0x9f, 0xc9, 0xae, 0x65, 0xcf, 0xa2, 0xd4, 0x15, 0xf1, 0x6d, 0x6e, + 0x83, 0x23, 0xe9, 0x1a, 0xd4, 0x2a, 0x82, 0x33, 0xae, 0xf6, 0xbd, 0xe2, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::SportModeState_>::type_info_blob() { + static const uint8_t blob[] = { + 0xf0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x9f, 0xa6, 0xcc, 0xdc, 0x5c, 0xaf, 0xde, 0xaa, 0xb8, 0xa7, 0x62, + 0xe3, 0x10, 0x44, 0x00, 0x98, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, + 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x4b, 0x1b, 0xf4, 0xaf, 0x32, 0xe5, 0xbc, 0x67, 0x10, 0xef, 0xc8, 0x29, 0x31, 0x15, 0x00, + 0x97, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x6d, 0x6e, 0x83, 0x23, 0xe9, 0x1a, 0xd4, + 0x2a, 0x82, 0x33, 0xae, 0xf6, 0xbd, 0xe2, 0x00, 0x87, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x97, 0x49, + 0x63, 0x0f, 0xff, 0x75, 0xcc, 0x17, 0x0a, 0xfb, 0x23, 0x87, 0x83, 0x00, 0xad, 0x02, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x61, 0x24, 0x29, 0x6f, 0x59, 0x45, 0x9b, 0xa9, 0x0b, 0xe9, 0x24, 0xc9, 0x35, 0xcc, 0x00, + 0x72, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xc4, 0xec, 0xb4, 0x9c, 0xd7, 0xb2, 0x25, + 0xd2, 0x26, 0x28, 0xb6, 0xb7, 0x64, 0xcc, 0x00, 0x02, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xd6, 0x62, 0x9a, 0x35, 0x54, 0x6d, 0x9f, 0xc9, 0xae, 0x65, 0xcf, 0xa2, 0xd4, 0x15, 0x00, + 0xe7, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::SportModeState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::SportModeState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::SportModeState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::SportModeState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::SportModeState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.stamp(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.error_code())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.progress())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.gait_type())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.foot_raise_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.position()[0], instance.position().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.body_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.velocity()[0], instance.velocity().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.yaw_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.range_obstacle()[0], instance.range_obstacle().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.foot_force()[0], instance.foot_force().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.foot_position_body()[0], instance.foot_position_body().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.foot_speed_body()[0], instance.foot_speed_body().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.path_point()) { //array depth 1 + if (!write(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::SportModeState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::SportModeState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::SportModeState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.stamp(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.error_code())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.progress())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.gait_type())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.foot_raise_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.position()[0], instance.position().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.body_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.velocity()[0], instance.velocity().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.yaw_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.range_obstacle()[0], instance.range_obstacle().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.foot_force()[0], instance.foot_force().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.foot_position_body()[0], instance.foot_position_body().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.foot_speed_body()[0], instance.foot_speed_body().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (auto & a_1:instance.path_point()) { //array depth 1 + if (!read(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::SportModeState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::SportModeState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::SportModeState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.stamp(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.error_code())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.progress())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.gait_type())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.foot_raise_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.position()[0], instance.position().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.body_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.velocity()[0], instance.velocity().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.yaw_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.range_obstacle()[0], instance.range_obstacle().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.foot_force()[0], instance.foot_force().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.foot_position_body()[0], instance.foot_position_body().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.foot_speed_body()[0], instance.foot_speed_body().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.path_point()) { //array depth 1 + if (!move(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::SportModeState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::SportModeState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::SportModeState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.stamp(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.error_code())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.progress())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.gait_type())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.foot_raise_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.position()[0], instance.position().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.body_height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.velocity()[0], instance.velocity().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.yaw_speed())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.range_obstacle()[0], instance.range_obstacle().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.foot_force()[0], instance.foot_force().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.foot_position_body()[0], instance.foot_position_body().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.foot_speed_body()[0], instance.foot_speed_body().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.path_point()) { //array depth 1 + if (!max(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::SportModeState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::SportModeState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_SPORTMODESTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/TimeSpec_.hpp b/unitree_SDK/include/unitree/idl/go2/TimeSpec_.hpp new file mode 100644 index 0000000..2298c75 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/TimeSpec_.hpp @@ -0,0 +1,302 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: TimeSpec_.idl + Source: TimeSpec_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_TIMESPEC__HPP +#define DDSCXX_UNITREE_IDL_GO2_TIMESPEC__HPP + +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class TimeSpec_ +{ +private: + int32_t sec_ = 0; + uint32_t nanosec_ = 0; + +public: + TimeSpec_() = default; + + explicit TimeSpec_( + int32_t sec, + uint32_t nanosec) : + sec_(sec), + nanosec_(nanosec) { } + + int32_t sec() const { return this->sec_; } + int32_t& sec() { return this->sec_; } + void sec(int32_t _val_) { this->sec_ = _val_; } + uint32_t nanosec() const { return this->nanosec_; } + uint32_t& nanosec() { return this->nanosec_; } + void nanosec(uint32_t _val_) { this->nanosec_ = _val_; } + + bool operator==(const TimeSpec_& _other) const + { + (void) _other; + return sec_ == _other.sec_ && + nanosec_ == _other.nanosec_; + } + + bool operator!=(const TimeSpec_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::TimeSpec_>::getTypeName() +{ + return "unitree_go::msg::dds_::TimeSpec_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::TimeSpec_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::TimeSpec_>::type_map_blob_sz() { return 258; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::TimeSpec_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::TimeSpec_>::type_map_blob() { + static const uint8_t blob[] = { + 0x4b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, + 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0x00, + 0x86, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x61, 0x24, 0x29, 0x6f, 0x59, 0x45, 0x9b, + 0xa9, 0x0b, 0xe9, 0x24, 0xc9, 0x35, 0xcc, 0x00, 0x6e, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x70, 0x65, 0x63, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0x61, 0x24, 0x29, 0x6f, 0x59, 0x45, 0x9b, 0xa9, 0x0b, 0xe9, 0x24, + 0xc9, 0x35, 0xcc, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, + 0xf9, 0x8d, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::TimeSpec_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, + 0x46, 0xf9, 0x8d, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x61, 0x24, 0x29, 0x6f, 0x59, 0x45, 0x9b, 0xa9, 0x0b, 0xe9, 0x24, + 0xc9, 0x35, 0xcc, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::TimeSpec_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::TimeSpec_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::TimeSpec_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::TimeSpec_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::TimeSpec_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.sec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.nanosec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::TimeSpec_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::TimeSpec_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::TimeSpec_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.sec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.nanosec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::TimeSpec_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::TimeSpec_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::TimeSpec_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.sec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.nanosec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::TimeSpec_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::TimeSpec_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::TimeSpec_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.sec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.nanosec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::TimeSpec_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::TimeSpec_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_TIMESPEC__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/UwbState_.hpp b/unitree_SDK/include/unitree/idl/go2/UwbState_.hpp new file mode 100644 index 0000000..1e40a8d --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/UwbState_.hpp @@ -0,0 +1,968 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: UwbState_.idl + Source: UwbState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_UWBSTATE__HPP +#define DDSCXX_UNITREE_IDL_GO2_UWBSTATE__HPP + +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class UwbState_ +{ +private: + std::array version_ = { }; + uint8_t channel_ = 0; + uint8_t joy_mode_ = 0; + float orientation_est_ = 0.0f; + float pitch_est_ = 0.0f; + float distance_est_ = 0.0f; + float yaw_est_ = 0.0f; + float tag_roll_ = 0.0f; + float tag_pitch_ = 0.0f; + float tag_yaw_ = 0.0f; + float base_roll_ = 0.0f; + float base_pitch_ = 0.0f; + float base_yaw_ = 0.0f; + std::array joystick_ = { }; + uint8_t error_state_ = 0; + uint8_t buttons_ = 0; + uint8_t enabled_from_app_ = 0; + +public: + UwbState_() = default; + + explicit UwbState_( + const std::array& version, + uint8_t channel, + uint8_t joy_mode, + float orientation_est, + float pitch_est, + float distance_est, + float yaw_est, + float tag_roll, + float tag_pitch, + float tag_yaw, + float base_roll, + float base_pitch, + float base_yaw, + const std::array& joystick, + uint8_t error_state, + uint8_t buttons, + uint8_t enabled_from_app) : + version_(version), + channel_(channel), + joy_mode_(joy_mode), + orientation_est_(orientation_est), + pitch_est_(pitch_est), + distance_est_(distance_est), + yaw_est_(yaw_est), + tag_roll_(tag_roll), + tag_pitch_(tag_pitch), + tag_yaw_(tag_yaw), + base_roll_(base_roll), + base_pitch_(base_pitch), + base_yaw_(base_yaw), + joystick_(joystick), + error_state_(error_state), + buttons_(buttons), + enabled_from_app_(enabled_from_app) { } + + const std::array& version() const { return this->version_; } + std::array& version() { return this->version_; } + void version(const std::array& _val_) { this->version_ = _val_; } + void version(std::array&& _val_) { this->version_ = _val_; } + uint8_t channel() const { return this->channel_; } + uint8_t& channel() { return this->channel_; } + void channel(uint8_t _val_) { this->channel_ = _val_; } + uint8_t joy_mode() const { return this->joy_mode_; } + uint8_t& joy_mode() { return this->joy_mode_; } + void joy_mode(uint8_t _val_) { this->joy_mode_ = _val_; } + float orientation_est() const { return this->orientation_est_; } + float& orientation_est() { return this->orientation_est_; } + void orientation_est(float _val_) { this->orientation_est_ = _val_; } + float pitch_est() const { return this->pitch_est_; } + float& pitch_est() { return this->pitch_est_; } + void pitch_est(float _val_) { this->pitch_est_ = _val_; } + float distance_est() const { return this->distance_est_; } + float& distance_est() { return this->distance_est_; } + void distance_est(float _val_) { this->distance_est_ = _val_; } + float yaw_est() const { return this->yaw_est_; } + float& yaw_est() { return this->yaw_est_; } + void yaw_est(float _val_) { this->yaw_est_ = _val_; } + float tag_roll() const { return this->tag_roll_; } + float& tag_roll() { return this->tag_roll_; } + void tag_roll(float _val_) { this->tag_roll_ = _val_; } + float tag_pitch() const { return this->tag_pitch_; } + float& tag_pitch() { return this->tag_pitch_; } + void tag_pitch(float _val_) { this->tag_pitch_ = _val_; } + float tag_yaw() const { return this->tag_yaw_; } + float& tag_yaw() { return this->tag_yaw_; } + void tag_yaw(float _val_) { this->tag_yaw_ = _val_; } + float base_roll() const { return this->base_roll_; } + float& base_roll() { return this->base_roll_; } + void base_roll(float _val_) { this->base_roll_ = _val_; } + float base_pitch() const { return this->base_pitch_; } + float& base_pitch() { return this->base_pitch_; } + void base_pitch(float _val_) { this->base_pitch_ = _val_; } + float base_yaw() const { return this->base_yaw_; } + float& base_yaw() { return this->base_yaw_; } + void base_yaw(float _val_) { this->base_yaw_ = _val_; } + const std::array& joystick() const { return this->joystick_; } + std::array& joystick() { return this->joystick_; } + void joystick(const std::array& _val_) { this->joystick_ = _val_; } + void joystick(std::array&& _val_) { this->joystick_ = _val_; } + uint8_t error_state() const { return this->error_state_; } + uint8_t& error_state() { return this->error_state_; } + void error_state(uint8_t _val_) { this->error_state_ = _val_; } + uint8_t buttons() const { return this->buttons_; } + uint8_t& buttons() { return this->buttons_; } + void buttons(uint8_t _val_) { this->buttons_ = _val_; } + uint8_t enabled_from_app() const { return this->enabled_from_app_; } + uint8_t& enabled_from_app() { return this->enabled_from_app_; } + void enabled_from_app(uint8_t _val_) { this->enabled_from_app_ = _val_; } + + bool operator==(const UwbState_& _other) const + { + (void) _other; + return version_ == _other.version_ && + channel_ == _other.channel_ && + joy_mode_ == _other.joy_mode_ && + orientation_est_ == _other.orientation_est_ && + pitch_est_ == _other.pitch_est_ && + distance_est_ == _other.distance_est_ && + yaw_est_ == _other.yaw_est_ && + tag_roll_ == _other.tag_roll_ && + tag_pitch_ == _other.tag_pitch_ && + tag_yaw_ == _other.tag_yaw_ && + base_roll_ == _other.base_roll_ && + base_pitch_ == _other.base_pitch_ && + base_yaw_ == _other.base_yaw_ && + joystick_ == _other.joystick_ && + error_state_ == _other.error_state_ && + buttons_ == _other.buttons_ && + enabled_from_app_ == _other.enabled_from_app_; + } + + bool operator!=(const UwbState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::UwbState_>::getTypeName() +{ + return "unitree_go::msg::dds_::UwbState_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::UwbState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::UwbState_>::type_map_blob_sz() { return 998; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::UwbState_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::UwbState_>::type_map_blob() { + static const uint8_t blob[] = { + 0x53, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xd9, 0x00, 0xc3, 0x35, 0xed, 0x0e, 0xb3, + 0x3d, 0x57, 0x4e, 0xb0, 0xbe, 0x39, 0xae, 0x00, 0x3b, 0x01, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x01, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x2a, 0xf7, 0x2f, 0x10, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xc4, 0x85, 0xd2, 0xed, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xf5, 0x20, 0x55, 0xed, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xb7, 0x48, 0xcc, 0x5d, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x17, 0x8d, 0xce, 0xa7, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xf5, 0x06, 0x73, 0x9b, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x2e, 0xae, 0x04, 0xde, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x6f, 0x2d, 0x01, 0xc9, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x2f, 0x7d, 0xc9, 0x14, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x1e, 0xe4, 0xc0, 0x80, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x69, 0x52, 0xd1, 0x26, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x02, 0xda, 0x41, 0x0a, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x83, 0xbd, 0x50, 0x7a, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x09, 0x2e, 0xd6, 0x98, 0x33, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0xa7, 0xd8, 0x5b, 0x8a, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x02, 0x63, 0x4e, 0xff, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x84, 0x86, 0xf2, 0x61, 0x00, 0x63, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xf2, 0x82, 0x5c, 0xad, 0xb9, 0xe5, 0x0d, 0xf1, 0x58, 0xaf, 0x64, 0xdc, 0x66, 0xa5, 0x20, 0x00, + 0x4b, 0x02, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x55, 0x77, 0x62, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x13, 0x02, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x76, 0x65, 0x72, 0x73, + 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x6a, 0x6f, 0x79, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x6f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x73, 0x74, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x70, 0x69, 0x74, 0x63, 0x68, 0x5f, 0x65, 0x73, 0x74, 0x00, 0x00, 0x00, + 0x1b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x0d, 0x00, 0x00, 0x00, + 0x64, 0x69, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x65, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x79, 0x61, 0x77, 0x5f, 0x65, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x74, 0x61, 0x67, 0x5f, + 0x72, 0x6f, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x74, 0x61, 0x67, 0x5f, 0x70, 0x69, 0x74, 0x63, + 0x68, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x74, 0x61, 0x67, 0x5f, 0x79, 0x61, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x62, 0x61, 0x73, 0x65, 0x5f, 0x72, 0x6f, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x62, 0x61, 0x73, 0x65, + 0x5f, 0x70, 0x69, 0x74, 0x63, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x62, 0x61, 0x73, 0x65, + 0x5f, 0x79, 0x61, 0x77, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x09, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x6a, 0x6f, 0x79, 0x73, 0x74, 0x69, 0x63, 0x6b, 0x00, 0x00, 0x00, 0x00, + 0x1a, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x62, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x11, 0x00, 0x00, 0x00, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x70, 0x70, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x82, 0x5c, 0xad, 0xb9, 0xe5, 0x0d, 0xf1, + 0x58, 0xaf, 0x64, 0xdc, 0x66, 0xa5, 0x20, 0xf1, 0xd9, 0x00, 0xc3, 0x35, 0xed, 0x0e, 0xb3, 0x3d, + 0x57, 0x4e, 0xb0, 0xbe, 0x39, 0xae, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::UwbState_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xd9, 0x00, 0xc3, 0x35, 0xed, 0x0e, 0xb3, 0x3d, 0x57, 0x4e, 0xb0, + 0xbe, 0x39, 0xae, 0x00, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x82, 0x5c, 0xad, 0xb9, 0xe5, 0x0d, 0xf1, 0x58, 0xaf, 0x64, 0xdc, + 0x66, 0xa5, 0x20, 0x00, 0x4f, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::UwbState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::UwbState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::UwbState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::UwbState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::UwbState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.channel())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.joy_mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.orientation_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.pitch_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.distance_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.yaw_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.tag_roll())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.tag_pitch())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.tag_yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.base_roll())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.base_pitch())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.base_yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.joystick()[0], instance.joystick().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.error_state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.buttons())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.enabled_from_app())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::UwbState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::UwbState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::UwbState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.channel())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.joy_mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.orientation_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.pitch_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.distance_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.yaw_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.tag_roll())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.tag_pitch())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.tag_yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.base_roll())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.base_pitch())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.base_yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.joystick()[0], instance.joystick().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.error_state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.buttons())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.enabled_from_app())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::UwbState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::UwbState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::UwbState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.channel())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.joy_mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.orientation_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.pitch_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.distance_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.yaw_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.tag_roll())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.tag_pitch())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.tag_yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.base_roll())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.base_pitch())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.base_yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.joystick()[0], instance.joystick().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.error_state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.buttons())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.enabled_from_app())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::UwbState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::UwbState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::UwbState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.channel())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.joy_mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.orientation_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.pitch_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.distance_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.yaw_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.tag_roll())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.tag_pitch())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.tag_yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.base_roll())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.base_pitch())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.base_yaw())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 13: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.joystick()[0], instance.joystick().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 14: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.error_state())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 15: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.buttons())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 16: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.enabled_from_app())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::UwbState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::UwbState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_UWBSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/UwbSwitch_.hpp b/unitree_SDK/include/unitree/idl/go2/UwbSwitch_.hpp new file mode 100644 index 0000000..ce9dca5 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/UwbSwitch_.hpp @@ -0,0 +1,260 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: UwbSwitch_.idl + Source: UwbSwitch_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_UWBSWITCH__HPP +#define DDSCXX_UNITREE_IDL_GO2_UWBSWITCH__HPP + +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class UwbSwitch_ +{ +private: + uint8_t enabled_ = 0; + +public: + UwbSwitch_() = default; + + explicit UwbSwitch_( + uint8_t enabled) : + enabled_(enabled) { } + + uint8_t enabled() const { return this->enabled_; } + uint8_t& enabled() { return this->enabled_; } + void enabled(uint8_t _val_) { this->enabled_ = _val_; } + + bool operator==(const UwbSwitch_& _other) const + { + (void) _other; + return enabled_ == _other.enabled_; + } + + bool operator!=(const UwbSwitch_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::UwbSwitch_>::getTypeName() +{ + return "unitree_go::msg::dds_::UwbSwitch_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::UwbSwitch_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::UwbSwitch_>::type_map_blob_sz() { return 218; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::UwbSwitch_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::UwbSwitch_>::type_map_blob() { + static const uint8_t blob[] = { + 0x3b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xb3, 0xcf, 0xfe, 0xd4, 0x3a, 0x87, 0x3e, + 0x4b, 0xff, 0x03, 0x70, 0x95, 0x52, 0x60, 0x00, 0x23, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xa1, 0x03, 0x11, 0x45, 0x00, + 0x6e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x22, 0x0e, 0x76, 0xfa, 0x1b, 0x1c, 0x22, + 0x03, 0x2c, 0x71, 0xd3, 0x7c, 0x77, 0x05, 0x00, 0x56, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x55, 0x77, 0x62, 0x53, 0x77, 0x69, 0x74, 0x63, 0x68, 0x5f, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x22, 0x0e, 0x76, + 0xfa, 0x1b, 0x1c, 0x22, 0x03, 0x2c, 0x71, 0xd3, 0x7c, 0x77, 0x05, 0xf1, 0xb3, 0xcf, 0xfe, 0xd4, + 0x3a, 0x87, 0x3e, 0x4b, 0xff, 0x03, 0x70, 0x95, 0x52, 0x60, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::UwbSwitch_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xb3, 0xcf, 0xfe, 0xd4, 0x3a, 0x87, 0x3e, 0x4b, 0xff, 0x03, 0x70, + 0x95, 0x52, 0x60, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x22, 0x0e, 0x76, 0xfa, 0x1b, 0x1c, 0x22, 0x03, 0x2c, 0x71, 0xd3, + 0x7c, 0x77, 0x05, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::UwbSwitch_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::UwbSwitch_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::UwbSwitch_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::UwbSwitch_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::UwbSwitch_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.enabled())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::UwbSwitch_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::UwbSwitch_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::UwbSwitch_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.enabled())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::UwbSwitch_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::UwbSwitch_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::UwbSwitch_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.enabled())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::UwbSwitch_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::UwbSwitch_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::UwbSwitch_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.enabled())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::UwbSwitch_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::UwbSwitch_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_UWBSWITCH__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/VoxelMapCompressed_.hpp b/unitree_SDK/include/unitree/idl/go2/VoxelMapCompressed_.hpp new file mode 100644 index 0000000..ffa83c9 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/VoxelMapCompressed_.hpp @@ -0,0 +1,600 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: VoxelMapCompressed_.idl + Source: VoxelMapCompressed_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_VOXELMAPCOMPRESSED__HPP +#define DDSCXX_UNITREE_IDL_GO2_VOXELMAPCOMPRESSED__HPP + +#include +#include +#include +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class VoxelMapCompressed_ +{ +private: + double stamp_ = 0.0; + std::string frame_id_; + double resolution_ = 0.0; + std::array origin_ = { }; + std::array width_ = { }; + uint64_t src_size_ = 0; + std::vector data_; + +public: + VoxelMapCompressed_() = default; + + explicit VoxelMapCompressed_( + double stamp, + const std::string& frame_id, + double resolution, + const std::array& origin, + const std::array& width, + uint64_t src_size, + const std::vector& data) : + stamp_(stamp), + frame_id_(frame_id), + resolution_(resolution), + origin_(origin), + width_(width), + src_size_(src_size), + data_(data) { } + + double stamp() const { return this->stamp_; } + double& stamp() { return this->stamp_; } + void stamp(double _val_) { this->stamp_ = _val_; } + const std::string& frame_id() const { return this->frame_id_; } + std::string& frame_id() { return this->frame_id_; } + void frame_id(const std::string& _val_) { this->frame_id_ = _val_; } + void frame_id(std::string&& _val_) { this->frame_id_ = _val_; } + double resolution() const { return this->resolution_; } + double& resolution() { return this->resolution_; } + void resolution(double _val_) { this->resolution_ = _val_; } + const std::array& origin() const { return this->origin_; } + std::array& origin() { return this->origin_; } + void origin(const std::array& _val_) { this->origin_ = _val_; } + void origin(std::array&& _val_) { this->origin_ = _val_; } + const std::array& width() const { return this->width_; } + std::array& width() { return this->width_; } + void width(const std::array& _val_) { this->width_ = _val_; } + void width(std::array&& _val_) { this->width_ = _val_; } + uint64_t src_size() const { return this->src_size_; } + uint64_t& src_size() { return this->src_size_; } + void src_size(uint64_t _val_) { this->src_size_ = _val_; } + const std::vector& data() const { return this->data_; } + std::vector& data() { return this->data_; } + void data(const std::vector& _val_) { this->data_ = _val_; } + void data(std::vector&& _val_) { this->data_ = _val_; } + + bool operator==(const VoxelMapCompressed_& _other) const + { + (void) _other; + return stamp_ == _other.stamp_ && + frame_id_ == _other.frame_id_ && + resolution_ == _other.resolution_ && + origin_ == _other.origin_ && + width_ == _other.width_ && + src_size_ == _other.src_size_ && + data_ == _other.data_; + } + + bool operator!=(const VoxelMapCompressed_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::VoxelMapCompressed_>::getTypeName() +{ + return "unitree_go::msg::dds_::VoxelMapCompressed_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::VoxelMapCompressed_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::VoxelMapCompressed_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::VoxelMapCompressed_>::type_map_blob_sz() { return 538; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::VoxelMapCompressed_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::VoxelMapCompressed_>::type_map_blob() { + static const uint8_t blob[] = { + 0xb8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xf4, 0x58, 0xe7, 0x8f, 0x62, 0xc9, 0xad, + 0xbc, 0x43, 0x1d, 0x16, 0x4e, 0xdf, 0xdd, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x96, 0xb8, 0xc7, 0x8d, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x4b, 0xb3, 0x9c, 0x5c, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xb7, 0xe1, 0x64, 0xb3, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x0a, 0x7c, 0x49, 0xb1, 0x53, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x06, 0xea, 0xae, 0x26, 0xa6, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x08, 0x20, 0x1e, 0x06, 0xae, 0x00, 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, 0x8d, 0x77, 0x7f, 0x38, 0x33, 0x01, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0x07, 0xc6, 0xdb, 0x76, 0xf0, 0x34, 0x86, 0x2a, 0x75, 0x47, 0x5e, + 0xd7, 0xa4, 0x76, 0x00, 0x1b, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x56, + 0x6f, 0x78, 0x65, 0x6c, 0x4d, 0x61, 0x70, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, + 0x64, 0x5f, 0x00, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x00, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x0a, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x77, 0x69, 0x64, 0x74, 0x68, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x09, 0x00, 0x00, 0x00, 0x73, 0x72, 0x63, 0x5f, + 0x73, 0x69, 0x7a, 0x65, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x00, 0x64, 0x61, 0x74, 0x61, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x07, 0xc6, 0xdb, + 0x76, 0xf0, 0x34, 0x86, 0x2a, 0x75, 0x47, 0x5e, 0xd7, 0xa4, 0x76, 0xf1, 0xf4, 0x58, 0xe7, 0x8f, + 0x62, 0xc9, 0xad, 0xbc, 0x43, 0x1d, 0x16, 0x4e, 0xdf, 0xdd, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::VoxelMapCompressed_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xf4, 0x58, 0xe7, 0x8f, 0x62, 0xc9, 0xad, 0xbc, 0x43, 0x1d, 0x16, + 0x4e, 0xdf, 0xdd, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x07, 0xc6, 0xdb, 0x76, 0xf0, 0x34, 0x86, 0x2a, 0x75, 0x47, 0x5e, + 0xd7, 0xa4, 0x76, 0x00, 0x1f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::VoxelMapCompressed_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::VoxelMapCompressed_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::VoxelMapCompressed_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::VoxelMapCompressed_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::VoxelMapCompressed_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.origin()[0], instance.origin().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.width()[0], instance.width().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.src_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!write(streamer, se_1)) + return false; + if (se_1 > 0 && + !write(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::VoxelMapCompressed_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::VoxelMapCompressed_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::VoxelMapCompressed_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.origin()[0], instance.origin().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.width()[0], instance.width().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.src_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!read(streamer, se_1)) + return false; + instance.data().resize(se_1); + if (se_1 > 0 && + !read(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::VoxelMapCompressed_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::VoxelMapCompressed_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::VoxelMapCompressed_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.origin()[0], instance.origin().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.width()[0], instance.width().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.src_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!move(streamer, se_1)) + return false; + if (se_1 > 0 && + !move(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::VoxelMapCompressed_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::VoxelMapCompressed_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::VoxelMapCompressed_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.stamp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.origin()[0], instance.origin().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.width()[0], instance.width().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.src_size())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + if (se_1 > 0 && + !max(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::VoxelMapCompressed_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::VoxelMapCompressed_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_VOXELMAPCOMPRESSED__HPP diff --git a/unitree_SDK/include/unitree/idl/go2/WirelessController_.hpp b/unitree_SDK/include/unitree/idl/go2/WirelessController_.hpp new file mode 100644 index 0000000..9ba4b63 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/go2/WirelessController_.hpp @@ -0,0 +1,426 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: WirelessController_.idl + Source: WirelessController_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_GO2_WIRELESSCONTROLLER__HPP +#define DDSCXX_UNITREE_IDL_GO2_WIRELESSCONTROLLER__HPP + +#include + +namespace unitree_go +{ +namespace msg +{ +namespace dds_ +{ +class WirelessController_ +{ +private: + float lx_ = 0.0f; + float ly_ = 0.0f; + float rx_ = 0.0f; + float ry_ = 0.0f; + uint16_t keys_ = 0; + +public: + WirelessController_() = default; + + explicit WirelessController_( + float lx, + float ly, + float rx, + float ry, + uint16_t keys) : + lx_(lx), + ly_(ly), + rx_(rx), + ry_(ry), + keys_(keys) { } + + float lx() const { return this->lx_; } + float& lx() { return this->lx_; } + void lx(float _val_) { this->lx_ = _val_; } + float ly() const { return this->ly_; } + float& ly() { return this->ly_; } + void ly(float _val_) { this->ly_ = _val_; } + float rx() const { return this->rx_; } + float& rx() { return this->rx_; } + void rx(float _val_) { this->rx_ = _val_; } + float ry() const { return this->ry_; } + float& ry() { return this->ry_; } + void ry(float _val_) { this->ry_ = _val_; } + uint16_t keys() const { return this->keys_; } + uint16_t& keys() { return this->keys_; } + void keys(uint16_t _val_) { this->keys_ = _val_; } + + bool operator==(const WirelessController_& _other) const + { + (void) _other; + return lx_ == _other.lx_ && + ly_ == _other.ly_ && + rx_ == _other.rx_ && + ry_ == _other.ry_ && + keys_ == _other.keys_; + } + + bool operator!=(const WirelessController_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_go::msg::dds_::WirelessController_>::getTypeName() +{ + return "unitree_go::msg::dds_::WirelessController_"; +} + +template <> constexpr bool TopicTraits<::unitree_go::msg::dds_::WirelessController_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::WirelessController_>::type_map_blob_sz() { return 382; } +template<> constexpr unsigned int TopicTraits<::unitree_go::msg::dds_::WirelessController_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::WirelessController_>::type_map_blob() { + static const uint8_t blob[] = { + 0x7b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xd8, 0xdc, 0x69, 0xff, 0xf5, 0xd7, 0x59, + 0x61, 0xcd, 0x0e, 0x3f, 0xc0, 0x49, 0xcb, 0x00, 0x63, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x80, 0x37, 0xcc, 0xea, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xe7, 0x28, 0xb4, 0x77, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x22, 0x77, 0x0f, 0xbd, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x73, 0x1a, 0x58, 0x83, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x14, 0xf8, 0x02, 0xe1, 0x00, + 0xd3, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xe9, 0x68, 0x6f, 0xe7, 0x6f, 0x7b, 0x08, + 0xf9, 0x2c, 0xb2, 0x49, 0x43, 0xac, 0x72, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x67, 0x6f, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x57, 0x69, 0x72, 0x65, 0x6c, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, + 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x5f, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x6c, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6c, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x72, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x72, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x6b, 0x65, 0x79, 0x73, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xf2, 0xe9, 0x68, 0x6f, 0xe7, 0x6f, 0x7b, 0x08, 0xf9, 0x2c, 0xb2, 0x49, 0x43, 0xac, 0x72, 0xf1, + 0xd8, 0xdc, 0x69, 0xff, 0xf5, 0xd7, 0x59, 0x61, 0xcd, 0x0e, 0x3f, 0xc0, 0x49, 0xcb, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_go::msg::dds_::WirelessController_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xd8, 0xdc, 0x69, 0xff, 0xf5, 0xd7, 0x59, 0x61, 0xcd, 0x0e, 0x3f, + 0xc0, 0x49, 0xcb, 0x00, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xe9, 0x68, 0x6f, 0xe7, 0x6f, 0x7b, 0x08, 0xf9, 0x2c, 0xb2, 0x49, + 0x43, 0xac, 0x72, 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_go::msg::dds_::WirelessController_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_go::msg::dds_::WirelessController_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_go::msg::dds_::WirelessController_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_go::msg::dds_::WirelessController_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_go::msg::dds_::WirelessController_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.lx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.ly())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.rx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.ry())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.keys())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_go::msg::dds_::WirelessController_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::WirelessController_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_go::msg::dds_::WirelessController_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.lx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.ly())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.rx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.ry())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.keys())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_go::msg::dds_::WirelessController_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::WirelessController_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_go::msg::dds_::WirelessController_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.lx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.ly())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.rx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.ry())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.keys())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_go::msg::dds_::WirelessController_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::WirelessController_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_go::msg::dds_::WirelessController_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.lx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.ly())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.rx())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.ry())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.keys())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_go::msg::dds_::WirelessController_& instance, bool as_key) { + auto &props = get_type_props<::unitree_go::msg::dds_::WirelessController_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_GO2_WIRELESSCONTROLLER__HPP diff --git a/unitree_SDK/include/unitree/idl/hg/BmsCmd_.hpp b/unitree_SDK/include/unitree/idl/hg/BmsCmd_.hpp new file mode 100644 index 0000000..087d58c --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg/BmsCmd_.hpp @@ -0,0 +1,321 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: BmsCmd_.idl + Source: BmsCmd_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_BMSCMD__HPP +#define DDSCXX_UNITREE_IDL_HG_BMSCMD__HPP + +#include +#include + +namespace unitree_hg +{ +namespace msg +{ +namespace dds_ +{ +class BmsCmd_ +{ +private: + uint8_t cmd_ = 0; + std::array reserve_ = { }; + +public: + BmsCmd_() = default; + + explicit BmsCmd_( + uint8_t cmd, + const std::array& reserve) : + cmd_(cmd), + reserve_(reserve) { } + + uint8_t cmd() const { return this->cmd_; } + uint8_t& cmd() { return this->cmd_; } + void cmd(uint8_t _val_) { this->cmd_ = _val_; } + const std::array& reserve() const { return this->reserve_; } + std::array& reserve() { return this->reserve_; } + void reserve(const std::array& _val_) { this->reserve_ = _val_; } + void reserve(std::array&& _val_) { this->reserve_ = _val_; } + + bool operator==(const BmsCmd_& _other) const + { + (void) _other; + return cmd_ == _other.cmd_ && + reserve_ == _other.reserve_; + } + + bool operator!=(const BmsCmd_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg::msg::dds_::BmsCmd_>::getTypeName() +{ + return "unitree_hg::msg::dds_::BmsCmd_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::BmsCmd_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::BmsCmd_>::type_map_blob_sz() { return 278; } +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::BmsCmd_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::BmsCmd_>::type_map_blob() { + static const uint8_t blob[] = { + 0x56, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x91, 0xa3, 0x78, 0x24, 0x46, 0xf5, 0xc1, + 0xa3, 0xbe, 0x38, 0x87, 0x82, 0x38, 0xf4, 0x00, 0x3e, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xdf, 0xff, 0x0a, 0x7f, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x28, 0x02, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0xf3, 0x1a, 0x44, 0x88, 0xbc, 0xce, 0xdc, 0xaa, 0xdb, 0x49, 0x15, + 0xee, 0x2b, 0x01, 0x00, 0x76, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x42, + 0x6d, 0x73, 0x43, 0x6d, 0x64, 0x5f, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x63, 0x6d, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xf3, 0x1a, 0x44, 0x88, 0xbc, 0xce, 0xdc, + 0xaa, 0xdb, 0x49, 0x15, 0xee, 0x2b, 0x01, 0xf1, 0x91, 0xa3, 0x78, 0x24, 0x46, 0xf5, 0xc1, 0xa3, + 0xbe, 0x38, 0x87, 0x82, 0x38, 0xf4, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::BmsCmd_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x91, 0xa3, 0x78, 0x24, 0x46, 0xf5, 0xc1, 0xa3, 0xbe, 0x38, 0x87, + 0x82, 0x38, 0xf4, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xf3, 0x1a, 0x44, 0x88, 0xbc, 0xce, 0xdc, 0xaa, 0xdb, 0x49, 0x15, + 0xee, 0x2b, 0x01, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg::msg::dds_::BmsCmd_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg::msg::dds_::BmsCmd_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg::msg::dds_::BmsCmd_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg::msg::dds_::BmsCmd_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg::msg::dds_::BmsCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.cmd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg::msg::dds_::BmsCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::BmsCmd_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg::msg::dds_::BmsCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.cmd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg::msg::dds_::BmsCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::BmsCmd_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg::msg::dds_::BmsCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.cmd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg::msg::dds_::BmsCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::BmsCmd_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg::msg::dds_::BmsCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.cmd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg::msg::dds_::BmsCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::BmsCmd_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_BMSCMD__HPP diff --git a/unitree_SDK/include/unitree/idl/hg/BmsState_.hpp b/unitree_SDK/include/unitree/idl/hg/BmsState_.hpp new file mode 100644 index 0000000..dce2267 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg/BmsState_.hpp @@ -0,0 +1,855 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: BmsState_.idl + Source: BmsState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_BMSSTATE__HPP +#define DDSCXX_UNITREE_IDL_HG_BMSSTATE__HPP + +#include +#include + +namespace unitree_hg +{ +namespace msg +{ +namespace dds_ +{ +class BmsState_ +{ +private: + uint8_t version_high_ = 0; + uint8_t version_low_ = 0; + uint8_t fn_ = 0; + std::array cell_vol_ = { }; + std::array bmsvoltage_ = { }; + int32_t current_ = 0; + uint8_t soc_ = 0; + uint8_t soh_ = 0; + std::array temperature_ = { }; + uint16_t cycle_ = 0; + uint16_t manufacturer_date_ = 0; + std::array bmsstate_ = { }; + std::array reserve_ = { }; + +public: + BmsState_() = default; + + explicit BmsState_( + uint8_t version_high, + uint8_t version_low, + uint8_t fn, + const std::array& cell_vol, + const std::array& bmsvoltage, + int32_t current, + uint8_t soc, + uint8_t soh, + const std::array& temperature, + uint16_t cycle, + uint16_t manufacturer_date, + const std::array& bmsstate, + const std::array& reserve) : + version_high_(version_high), + version_low_(version_low), + fn_(fn), + cell_vol_(cell_vol), + bmsvoltage_(bmsvoltage), + current_(current), + soc_(soc), + soh_(soh), + temperature_(temperature), + cycle_(cycle), + manufacturer_date_(manufacturer_date), + bmsstate_(bmsstate), + reserve_(reserve) { } + + uint8_t version_high() const { return this->version_high_; } + uint8_t& version_high() { return this->version_high_; } + void version_high(uint8_t _val_) { this->version_high_ = _val_; } + uint8_t version_low() const { return this->version_low_; } + uint8_t& version_low() { return this->version_low_; } + void version_low(uint8_t _val_) { this->version_low_ = _val_; } + uint8_t fn() const { return this->fn_; } + uint8_t& fn() { return this->fn_; } + void fn(uint8_t _val_) { this->fn_ = _val_; } + const std::array& cell_vol() const { return this->cell_vol_; } + std::array& cell_vol() { return this->cell_vol_; } + void cell_vol(const std::array& _val_) { this->cell_vol_ = _val_; } + void cell_vol(std::array&& _val_) { this->cell_vol_ = _val_; } + const std::array& bmsvoltage() const { return this->bmsvoltage_; } + std::array& bmsvoltage() { return this->bmsvoltage_; } + void bmsvoltage(const std::array& _val_) { this->bmsvoltage_ = _val_; } + void bmsvoltage(std::array&& _val_) { this->bmsvoltage_ = _val_; } + int32_t current() const { return this->current_; } + int32_t& current() { return this->current_; } + void current(int32_t _val_) { this->current_ = _val_; } + uint8_t soc() const { return this->soc_; } + uint8_t& soc() { return this->soc_; } + void soc(uint8_t _val_) { this->soc_ = _val_; } + uint8_t soh() const { return this->soh_; } + uint8_t& soh() { return this->soh_; } + void soh(uint8_t _val_) { this->soh_ = _val_; } + const std::array& temperature() const { return this->temperature_; } + std::array& temperature() { return this->temperature_; } + void temperature(const std::array& _val_) { this->temperature_ = _val_; } + void temperature(std::array&& _val_) { this->temperature_ = _val_; } + uint16_t cycle() const { return this->cycle_; } + uint16_t& cycle() { return this->cycle_; } + void cycle(uint16_t _val_) { this->cycle_ = _val_; } + uint16_t manufacturer_date() const { return this->manufacturer_date_; } + uint16_t& manufacturer_date() { return this->manufacturer_date_; } + void manufacturer_date(uint16_t _val_) { this->manufacturer_date_ = _val_; } + const std::array& bmsstate() const { return this->bmsstate_; } + std::array& bmsstate() { return this->bmsstate_; } + void bmsstate(const std::array& _val_) { this->bmsstate_ = _val_; } + void bmsstate(std::array&& _val_) { this->bmsstate_ = _val_; } + const std::array& reserve() const { return this->reserve_; } + std::array& reserve() { return this->reserve_; } + void reserve(const std::array& _val_) { this->reserve_ = _val_; } + void reserve(std::array&& _val_) { this->reserve_ = _val_; } + + bool operator==(const BmsState_& _other) const + { + (void) _other; + return version_high_ == _other.version_high_ && + version_low_ == _other.version_low_ && + fn_ == _other.fn_ && + cell_vol_ == _other.cell_vol_ && + bmsvoltage_ == _other.bmsvoltage_ && + current_ == _other.current_ && + soc_ == _other.soc_ && + soh_ == _other.soh_ && + temperature_ == _other.temperature_ && + cycle_ == _other.cycle_ && + manufacturer_date_ == _other.manufacturer_date_ && + bmsstate_ == _other.bmsstate_ && + reserve_ == _other.reserve_; + } + + bool operator!=(const BmsState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg::msg::dds_::BmsState_>::getTypeName() +{ + return "unitree_hg::msg::dds_::BmsState_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::BmsState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::BmsState_>::type_map_blob_sz() { return 874; } +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::BmsState_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::BmsState_>::type_map_blob() { + static const uint8_t blob[] = { + 0x36, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x4b, 0x98, 0xd8, 0x09, 0xa6, 0x3f, 0x63, + 0xc7, 0xcb, 0x31, 0xa8, 0x18, 0x50, 0x6b, 0x00, 0x1e, 0x01, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x01, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x75, 0x6a, 0xda, 0x84, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x51, 0x99, 0x89, 0x90, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x4d, 0x9d, 0x6c, 0x17, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x28, 0x06, 0x2d, 0x87, 0xc3, 0x55, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x07, 0x46, 0x32, 0x3c, 0x06, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x04, 0x43, 0xb5, 0xc9, 0x17, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0xc7, 0xd5, 0xf8, 0x49, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x17, 0x39, 0xe7, 0x01, 0x00, 0x16, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x03, 0xee, 0xf4, + 0x38, 0xf7, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x9a, + 0x4c, 0x07, 0x40, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0xe9, + 0x68, 0x5d, 0x46, 0x00, 0x16, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x07, 0x35, 0x33, 0xbf, 0xfb, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0x0c, 0xdb, 0xa6, 0x86, 0x24, 0x98, 0xf5, 0x54, 0xba, 0x92, 0x7b, + 0xa1, 0x8d, 0xe0, 0x00, 0xea, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x42, + 0x6d, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0xb2, 0x01, 0x00, 0x00, + 0x0d, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x0d, 0x00, 0x00, 0x00, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x69, 0x67, 0x68, + 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x6c, 0x6f, 0x77, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x66, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x28, 0x06, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x63, 0x65, 0x6c, 0x6c, 0x5f, 0x76, 0x6f, 0x6c, + 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x07, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x62, 0x6d, 0x73, 0x76, 0x6f, 0x6c, 0x74, 0x61, 0x67, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x6f, 0x63, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x73, 0x6f, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0c, 0x03, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x63, 0x79, 0x63, 0x6c, 0x65, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x6d, 0x61, 0x6e, 0x75, 0x66, 0x61, 0x63, 0x74, 0x75, 0x72, 0x65, 0x72, 0x5f, 0x64, 0x61, 0x74, + 0x65, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x07, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x62, 0x6d, 0x73, 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x0c, 0xdb, 0xa6, + 0x86, 0x24, 0x98, 0xf5, 0x54, 0xba, 0x92, 0x7b, 0xa1, 0x8d, 0xe0, 0xf1, 0x4b, 0x98, 0xd8, 0x09, + 0xa6, 0x3f, 0x63, 0xc7, 0xcb, 0x31, 0xa8, 0x18, 0x50, 0x6b, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::BmsState_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x4b, 0x98, 0xd8, 0x09, 0xa6, 0x3f, 0x63, 0xc7, 0xcb, 0x31, 0xa8, + 0x18, 0x50, 0x6b, 0x00, 0x22, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x0c, 0xdb, 0xa6, 0x86, 0x24, 0x98, 0xf5, 0x54, 0xba, 0x92, 0x7b, + 0xa1, 0x8d, 0xe0, 0x00, 0xee, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg::msg::dds_::BmsState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg::msg::dds_::BmsState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg::msg::dds_::BmsState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg::msg::dds_::BmsState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg::msg::dds_::BmsState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.version_high())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.version_low())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.fn())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.cell_vol()[0], instance.cell_vol().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.bmsvoltage()[0], instance.bmsvoltage().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.soc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.soh())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.cycle())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.manufacturer_date())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.bmsstate()[0], instance.bmsstate().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg::msg::dds_::BmsState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::BmsState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg::msg::dds_::BmsState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.version_high())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.version_low())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.fn())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.cell_vol()[0], instance.cell_vol().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.bmsvoltage()[0], instance.bmsvoltage().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.soc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.soh())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.cycle())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.manufacturer_date())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.bmsstate()[0], instance.bmsstate().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg::msg::dds_::BmsState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::BmsState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg::msg::dds_::BmsState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.version_high())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.version_low())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.fn())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.cell_vol()[0], instance.cell_vol().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.bmsvoltage()[0], instance.bmsvoltage().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.soc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.soh())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.cycle())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.manufacturer_date())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.bmsstate()[0], instance.bmsstate().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg::msg::dds_::BmsState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::BmsState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg::msg::dds_::BmsState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.version_high())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.version_low())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.fn())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.cell_vol()[0], instance.cell_vol().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.bmsvoltage()[0], instance.bmsvoltage().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.current())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.soc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.soh())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.cycle())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 10: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.manufacturer_date())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 11: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.bmsstate()[0], instance.bmsstate().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 12: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg::msg::dds_::BmsState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::BmsState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_BMSSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/hg/HandCmd_.hpp b/unitree_SDK/include/unitree/idl/hg/HandCmd_.hpp new file mode 100644 index 0000000..e54c79e --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg/HandCmd_.hpp @@ -0,0 +1,409 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: HandCmd_.idl + Source: HandCmd_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_HANDCMD__HPP +#define DDSCXX_UNITREE_IDL_HG_HANDCMD__HPP + +#include "unitree/idl/hg/MotorCmd_.hpp" + +#include +#include +#include + +namespace unitree_hg +{ +namespace msg +{ +namespace dds_ +{ +class HandCmd_ +{ +private: + std::vector<::unitree_hg::msg::dds_::MotorCmd_> motor_cmd_; + std::array reserve_ = { }; + +public: + HandCmd_() = default; + + explicit HandCmd_( + const std::vector<::unitree_hg::msg::dds_::MotorCmd_>& motor_cmd, + const std::array& reserve) : + motor_cmd_(motor_cmd), + reserve_(reserve) { } + + const std::vector<::unitree_hg::msg::dds_::MotorCmd_>& motor_cmd() const { return this->motor_cmd_; } + std::vector<::unitree_hg::msg::dds_::MotorCmd_>& motor_cmd() { return this->motor_cmd_; } + void motor_cmd(const std::vector<::unitree_hg::msg::dds_::MotorCmd_>& _val_) { this->motor_cmd_ = _val_; } + void motor_cmd(std::vector<::unitree_hg::msg::dds_::MotorCmd_>&& _val_) { this->motor_cmd_ = _val_; } + const std::array& reserve() const { return this->reserve_; } + std::array& reserve() { return this->reserve_; } + void reserve(const std::array& _val_) { this->reserve_ = _val_; } + void reserve(std::array&& _val_) { this->reserve_ = _val_; } + + bool operator==(const HandCmd_& _other) const + { + (void) _other; + return motor_cmd_ == _other.motor_cmd_ && + reserve_ == _other.reserve_; + } + + bool operator!=(const HandCmd_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg::msg::dds_::HandCmd_>::getTypeName() +{ + return "unitree_hg::msg::dds_::HandCmd_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::HandCmd_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::HandCmd_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::HandCmd_>::type_map_blob_sz() { return 752; } +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::HandCmd_>::type_info_blob_sz() { return 148; } +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::HandCmd_>::type_map_blob() { + static const uint8_t blob[] = { + 0x03, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf1, 0xa6, 0x3e, 0x17, 0xe2, 0x28, 0xe6, 0x7d, + 0x27, 0x6d, 0xfe, 0x71, 0xd6, 0xf1, 0x56, 0x00, 0x52, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf1, 0x01, 0x00, 0x00, 0xf1, + 0x82, 0x7f, 0x55, 0xde, 0x9b, 0x9d, 0xe3, 0x8c, 0x62, 0xba, 0xcd, 0x1e, 0x56, 0xc9, 0x5b, 0xcf, + 0x19, 0xa4, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0xf1, 0x82, + 0x7f, 0x55, 0xde, 0x9b, 0x9d, 0xe3, 0x8c, 0x62, 0xba, 0xcd, 0x1e, 0x56, 0xc9, 0x00, 0x00, 0x00, + 0x83, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x73, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x45, 0x80, 0xc2, 0x74, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x26, 0xb5, 0x68, 0xe4, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x87, 0x22, 0x16, 0x52, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x9e, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0xf2, 0x5c, 0x45, 0xf9, 0xf8, 0xb1, 0xe1, 0xc2, 0x79, 0xa6, 0x59, 0x52, 0x13, 0x32, 0xb0, 0x00, + 0x8e, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x48, 0x61, 0x6e, 0x64, 0x43, + 0x6d, 0x64, 0x5f, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf2, 0x01, 0x00, 0x00, 0xf2, 0xa2, 0xd9, 0xce, 0xd5, + 0x0a, 0x79, 0x56, 0xe2, 0xa6, 0x07, 0x61, 0x3a, 0x13, 0xf1, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x6d, 0x6f, 0x74, 0x6f, 0x72, 0x5f, 0x63, 0x6d, 0x64, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x04, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, + 0x00, 0x00, 0xf2, 0xa2, 0xd9, 0xce, 0xd5, 0x0a, 0x79, 0x56, 0xe2, 0xa6, 0x07, 0x61, 0x3a, 0x13, + 0xf1, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, + 0x6f, 0x74, 0x6f, 0x72, 0x43, 0x6d, 0x64, 0x5f, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x74, 0x61, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x6b, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6b, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0xf2, 0x5c, 0x45, 0xf9, 0xf8, 0xb1, 0xe1, 0xc2, 0x79, 0xa6, 0x59, 0x52, + 0x13, 0x32, 0xb0, 0xf1, 0xa6, 0x3e, 0x17, 0xe2, 0x28, 0xe6, 0x7d, 0x27, 0x6d, 0xfe, 0x71, 0xd6, + 0xf1, 0x56, 0xf2, 0xa2, 0xd9, 0xce, 0xd5, 0x0a, 0x79, 0x56, 0xe2, 0xa6, 0x07, 0x61, 0x3a, 0x13, + 0xf1, 0xf1, 0x82, 0x7f, 0x55, 0xde, 0x9b, 0x9d, 0xe3, 0x8c, 0x62, 0xba, 0xcd, 0x1e, 0x56, 0xc9, +}; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::HandCmd_>::type_info_blob() { + static const uint8_t blob[] = { + 0x90, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xa6, 0x3e, 0x17, 0xe2, 0x28, 0xe6, 0x7d, 0x27, 0x6d, 0xfe, 0x71, + 0xd6, 0xf1, 0x56, 0x00, 0x56, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x82, 0x7f, 0x55, 0xde, 0x9b, 0x9d, 0xe3, + 0x8c, 0x62, 0xba, 0xcd, 0x1e, 0x56, 0xc9, 0x00, 0x87, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x5c, 0x45, 0xf9, + 0xf8, 0xb1, 0xe1, 0xc2, 0x79, 0xa6, 0x59, 0x52, 0x13, 0x32, 0xb0, 0x00, 0x92, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xa2, 0xd9, 0xce, 0xd5, 0x0a, 0x79, 0x56, 0xe2, 0xa6, 0x07, 0x61, 0x3a, 0x13, 0xf1, 0x00, + 0xe6, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg::msg::dds_::HandCmd_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg::msg::dds_::HandCmd_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg::msg::dds_::HandCmd_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg::msg::dds_::HandCmd_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg::msg::dds_::HandCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.motor_cmd().size()); + if (!write(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!write(streamer, instance.motor_cmd()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg::msg::dds_::HandCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::HandCmd_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg::msg::dds_::HandCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.motor_cmd().size()); + if (!read(streamer, se_1)) + return false; + instance.motor_cmd().resize(se_1); + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!read(streamer, instance.motor_cmd()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg::msg::dds_::HandCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::HandCmd_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg::msg::dds_::HandCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.motor_cmd().size()); + if (!move(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!move(streamer, instance.motor_cmd()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg::msg::dds_::HandCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::HandCmd_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg::msg::dds_::HandCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!max(streamer, instance.motor_cmd()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg::msg::dds_::HandCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::HandCmd_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_HANDCMD__HPP diff --git a/unitree_SDK/include/unitree/idl/hg/HandState_.hpp b/unitree_SDK/include/unitree/idl/hg/HandState_.hpp new file mode 100644 index 0000000..8e1c9e7 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg/HandState_.hpp @@ -0,0 +1,850 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: HandState_.idl + Source: HandState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_HANDSTATE__HPP +#define DDSCXX_UNITREE_IDL_HG_HANDSTATE__HPP + +#include "unitree/idl/hg/IMUState_.hpp" + +#include "unitree/idl/hg/MotorState_.hpp" + +#include "unitree/idl/hg/PressSensorState_.hpp" + +#include +#include +#include + +namespace unitree_hg +{ +namespace msg +{ +namespace dds_ +{ +class HandState_ +{ +private: + std::vector<::unitree_hg::msg::dds_::MotorState_> motor_state_; + std::vector<::unitree_hg::msg::dds_::PressSensorState_> press_sensor_state_; + ::unitree_hg::msg::dds_::IMUState_ imu_state_; + float power_v_ = 0.0f; + float power_a_ = 0.0f; + float system_v_ = 0.0f; + float device_v_ = 0.0f; + std::array error_ = { }; + std::array reserve_ = { }; + +public: + HandState_() = default; + + explicit HandState_( + const std::vector<::unitree_hg::msg::dds_::MotorState_>& motor_state, + const std::vector<::unitree_hg::msg::dds_::PressSensorState_>& press_sensor_state, + const ::unitree_hg::msg::dds_::IMUState_& imu_state, + float power_v, + float power_a, + float system_v, + float device_v, + const std::array& error, + const std::array& reserve) : + motor_state_(motor_state), + press_sensor_state_(press_sensor_state), + imu_state_(imu_state), + power_v_(power_v), + power_a_(power_a), + system_v_(system_v), + device_v_(device_v), + error_(error), + reserve_(reserve) { } + + const std::vector<::unitree_hg::msg::dds_::MotorState_>& motor_state() const { return this->motor_state_; } + std::vector<::unitree_hg::msg::dds_::MotorState_>& motor_state() { return this->motor_state_; } + void motor_state(const std::vector<::unitree_hg::msg::dds_::MotorState_>& _val_) { this->motor_state_ = _val_; } + void motor_state(std::vector<::unitree_hg::msg::dds_::MotorState_>&& _val_) { this->motor_state_ = _val_; } + const std::vector<::unitree_hg::msg::dds_::PressSensorState_>& press_sensor_state() const { return this->press_sensor_state_; } + std::vector<::unitree_hg::msg::dds_::PressSensorState_>& press_sensor_state() { return this->press_sensor_state_; } + void press_sensor_state(const std::vector<::unitree_hg::msg::dds_::PressSensorState_>& _val_) { this->press_sensor_state_ = _val_; } + void press_sensor_state(std::vector<::unitree_hg::msg::dds_::PressSensorState_>&& _val_) { this->press_sensor_state_ = _val_; } + const ::unitree_hg::msg::dds_::IMUState_& imu_state() const { return this->imu_state_; } + ::unitree_hg::msg::dds_::IMUState_& imu_state() { return this->imu_state_; } + void imu_state(const ::unitree_hg::msg::dds_::IMUState_& _val_) { this->imu_state_ = _val_; } + void imu_state(::unitree_hg::msg::dds_::IMUState_&& _val_) { this->imu_state_ = _val_; } + float power_v() const { return this->power_v_; } + float& power_v() { return this->power_v_; } + void power_v(float _val_) { this->power_v_ = _val_; } + float power_a() const { return this->power_a_; } + float& power_a() { return this->power_a_; } + void power_a(float _val_) { this->power_a_ = _val_; } + float system_v() const { return this->system_v_; } + float& system_v() { return this->system_v_; } + void system_v(float _val_) { this->system_v_ = _val_; } + float device_v() const { return this->device_v_; } + float& device_v() { return this->device_v_; } + void device_v(float _val_) { this->device_v_ = _val_; } + const std::array& error() const { return this->error_; } + std::array& error() { return this->error_; } + void error(const std::array& _val_) { this->error_ = _val_; } + void error(std::array&& _val_) { this->error_ = _val_; } + const std::array& reserve() const { return this->reserve_; } + std::array& reserve() { return this->reserve_; } + void reserve(const std::array& _val_) { this->reserve_ = _val_; } + void reserve(std::array&& _val_) { this->reserve_ = _val_; } + + bool operator==(const HandState_& _other) const + { + (void) _other; + return motor_state_ == _other.motor_state_ && + press_sensor_state_ == _other.press_sensor_state_ && + imu_state_ == _other.imu_state_ && + power_v_ == _other.power_v_ && + power_a_ == _other.power_a_ && + system_v_ == _other.system_v_ && + device_v_ == _other.device_v_ && + error_ == _other.error_ && + reserve_ == _other.reserve_; + } + + bool operator!=(const HandState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg::msg::dds_::HandState_>::getTypeName() +{ + return "unitree_hg::msg::dds_::HandState_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::HandState_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::HandState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::HandState_>::type_map_blob_sz() { return 2244; } +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::HandState_>::type_info_blob_sz() { return 244; } +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::HandState_>::type_map_blob() { + static const uint8_t blob[] = { + 0x1f, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf1, 0x69, 0x9e, 0xb3, 0x27, 0x0c, 0x7d, 0x77, + 0x88, 0xed, 0x03, 0xbe, 0xbe, 0x16, 0xb9, 0x00, 0xf2, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf1, 0x01, 0x00, 0x00, 0xf1, + 0x7c, 0xc5, 0x84, 0xed, 0x94, 0x0b, 0x8f, 0x30, 0x18, 0xf1, 0x8d, 0xe0, 0xed, 0x24, 0xb2, 0x1e, + 0x53, 0xdc, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf1, + 0x01, 0x00, 0x00, 0xf1, 0x03, 0x93, 0x1d, 0x83, 0x67, 0x60, 0x08, 0x26, 0x6e, 0x46, 0x6a, 0x66, + 0xb2, 0x55, 0xa0, 0x32, 0xed, 0x8c, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf1, 0xfc, 0x68, 0x71, 0x76, 0x65, 0x12, 0x06, 0x55, 0x84, 0x73, 0xdf, 0x44, 0x22, + 0x80, 0x9e, 0x5f, 0x37, 0x13, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x52, 0xea, 0x3e, 0x50, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x3a, 0x40, 0xba, 0xb9, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x2b, 0xfa, 0xf9, 0xa4, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x8f, 0x6a, 0x1d, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0xcb, 0x5e, + 0x10, 0x0e, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0xf1, 0x7c, + 0xc5, 0x84, 0xed, 0x94, 0x0b, 0x8f, 0x30, 0x18, 0xf1, 0x8d, 0xe0, 0xed, 0x24, 0x00, 0x00, 0x00, + 0xd6, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xc6, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0xe9, 0x16, 0x89, 0x09, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x8a, 0xf7, 0xae, 0xdf, 0x00, 0x16, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x03, 0xee, 0xf4, + 0x38, 0xf7, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x0a, + 0xcf, 0x8b, 0xe1, 0x00, 0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0xa5, 0xfe, 0x26, 0xd5, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xd1, 0x41, 0x1a, 0xed, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0xf1, 0x03, 0x93, 0x1d, 0x83, 0x67, + 0x60, 0x08, 0x26, 0x6e, 0x46, 0x6a, 0x66, 0xb2, 0x55, 0x00, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0xd9, 0x9f, 0xad, 0x96, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0xee, 0xf4, 0x38, 0xf7, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x1c, 0x9a, 0x44, 0xeb, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0xf1, 0xfc, 0x68, 0x71, 0x76, + 0x65, 0x12, 0x06, 0x55, 0x84, 0x73, 0xdf, 0x44, 0x22, 0x80, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x75, 0xb9, 0xaa, 0xa0, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x6b, 0x3b, 0x2d, 0x85, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x0e, 0x12, 0x75, 0x69, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0xb0, 0x7d, + 0x92, 0xed, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0xee, + 0xf4, 0x38, 0xf7, 0x00, 0x1a, 0x05, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf2, 0xb9, 0xf2, 0x80, + 0x69, 0x66, 0x06, 0x0f, 0xc0, 0xf9, 0x13, 0xa4, 0x7b, 0x8a, 0xb9, 0x00, 0x92, 0x01, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x48, 0x61, 0x6e, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x5f, 0x00, 0x00, 0x00, 0x5a, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf2, 0x01, 0x00, 0x00, 0xf2, 0xa8, 0x6c, 0xba, 0xb3, + 0xae, 0x0a, 0xa9, 0x8a, 0x1e, 0x74, 0x66, 0x43, 0xa0, 0x99, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x6d, 0x6f, 0x74, 0x6f, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x35, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf2, 0x01, 0x00, 0x00, 0xf2, + 0xcd, 0x53, 0x1f, 0x52, 0x24, 0x7f, 0x1d, 0x07, 0xb3, 0x82, 0x0f, 0xf4, 0x2b, 0x21, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x70, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, + 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x7d, 0x41, 0x66, 0x75, 0x41, 0x77, 0xd8, 0x6f, 0xa2, + 0x7c, 0xd2, 0x5b, 0x04, 0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x69, 0x6d, 0x75, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x76, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x5f, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x5f, 0x76, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x64, 0x65, 0x76, 0x69, + 0x63, 0x65, 0x5f, 0x76, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, + 0x00, 0x00, 0xf2, 0xa8, 0x6c, 0xba, 0xb3, 0xae, 0x0a, 0xa9, 0x8a, 0x1e, 0x74, 0x66, 0x43, 0xa0, + 0x99, 0x00, 0x00, 0x00, 0x66, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, + 0x6f, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x2e, 0x01, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x74, 0x61, 0x75, 0x5f, 0x65, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x03, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x76, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x73, 0x65, 0x6e, 0x73, + 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x74, 0x6f, 0x72, 0x73, 0x74, 0x61, + 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0xf2, 0xcd, + 0x53, 0x1f, 0x52, 0x24, 0x7f, 0x1d, 0x07, 0xb3, 0x82, 0x0f, 0xf4, 0x2b, 0x21, 0x00, 0x00, 0x00, + 0xca, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x72, 0x65, 0x73, 0x73, + 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x8a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x70, 0x72, 0x65, 0x73, 0x73, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x26, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6c, 0x6f, 0x73, 0x74, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0xf2, 0x7d, + 0x41, 0x66, 0x75, 0x41, 0x77, 0xd8, 0x6f, 0xa2, 0x7c, 0xd2, 0x5b, 0x04, 0x03, 0x00, 0x00, 0x00, + 0xfe, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x49, 0x4d, 0x55, 0x53, 0x74, + 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x71, 0x75, 0x61, 0x74, + 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x67, 0x79, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, + 0x65, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x72, 0x70, 0x79, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf2, 0xb9, 0xf2, 0x80, + 0x69, 0x66, 0x06, 0x0f, 0xc0, 0xf9, 0x13, 0xa4, 0x7b, 0x8a, 0xb9, 0xf1, 0x69, 0x9e, 0xb3, 0x27, + 0x0c, 0x7d, 0x77, 0x88, 0xed, 0x03, 0xbe, 0xbe, 0x16, 0xb9, 0xf2, 0xa8, 0x6c, 0xba, 0xb3, 0xae, + 0x0a, 0xa9, 0x8a, 0x1e, 0x74, 0x66, 0x43, 0xa0, 0x99, 0xf1, 0x7c, 0xc5, 0x84, 0xed, 0x94, 0x0b, + 0x8f, 0x30, 0x18, 0xf1, 0x8d, 0xe0, 0xed, 0x24, 0xf2, 0xcd, 0x53, 0x1f, 0x52, 0x24, 0x7f, 0x1d, + 0x07, 0xb3, 0x82, 0x0f, 0xf4, 0x2b, 0x21, 0xf1, 0x03, 0x93, 0x1d, 0x83, 0x67, 0x60, 0x08, 0x26, + 0x6e, 0x46, 0x6a, 0x66, 0xb2, 0x55, 0xf2, 0x7d, 0x41, 0x66, 0x75, 0x41, 0x77, 0xd8, 0x6f, 0xa2, + 0x7c, 0xd2, 0x5b, 0x04, 0x03, 0xf1, 0xfc, 0x68, 0x71, 0x76, 0x65, 0x12, 0x06, 0x55, 0x84, 0x73, + 0xdf, 0x44, 0x22, 0x80, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::HandState_>::type_info_blob() { + static const uint8_t blob[] = { + 0xf0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x69, 0x9e, 0xb3, 0x27, 0x0c, 0x7d, 0x77, 0x88, 0xed, 0x03, 0xbe, + 0xbe, 0x16, 0xb9, 0x00, 0xf6, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x7c, 0xc5, 0x84, 0xed, 0x94, 0x0b, 0x8f, + 0x30, 0x18, 0xf1, 0x8d, 0xe0, 0xed, 0x24, 0x00, 0xda, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x03, 0x93, 0x1d, 0x83, 0x67, 0x60, 0x08, 0x26, 0x6e, 0x46, 0x6a, 0x66, 0xb2, 0x55, 0x00, + 0x6f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xfc, 0x68, 0x71, 0x76, 0x65, 0x12, 0x06, + 0x55, 0x84, 0x73, 0xdf, 0x44, 0x22, 0x80, 0x00, 0x97, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xb9, 0xf2, 0x80, + 0x69, 0x66, 0x06, 0x0f, 0xc0, 0xf9, 0x13, 0xa4, 0x7b, 0x8a, 0xb9, 0x00, 0x96, 0x01, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xa8, 0x6c, 0xba, 0xb3, 0xae, 0x0a, 0xa9, 0x8a, 0x1e, 0x74, 0x66, 0x43, 0xa0, 0x99, 0x00, + 0x6a, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xcd, 0x53, 0x1f, 0x52, 0x24, 0x7f, 0x1d, + 0x07, 0xb3, 0x82, 0x0f, 0xf4, 0x2b, 0x21, 0x00, 0xce, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x7d, 0x41, 0x66, 0x75, 0x41, 0x77, 0xd8, 0x6f, 0xa2, 0x7c, 0xd2, 0x5b, 0x04, 0x03, 0x00, + 0x02, 0x01, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg::msg::dds_::HandState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg::msg::dds_::HandState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg::msg::dds_::HandState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg::msg::dds_::HandState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg::msg::dds_::HandState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.motor_state().size()); + if (!write(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!write(streamer, instance.motor_state()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.press_sensor_state().size()); + if (!write(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!write(streamer, instance.press_sensor_state()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.power_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.power_a())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.system_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.device_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.error()[0], instance.error().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg::msg::dds_::HandState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::HandState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg::msg::dds_::HandState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.motor_state().size()); + if (!read(streamer, se_1)) + return false; + instance.motor_state().resize(se_1); + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!read(streamer, instance.motor_state()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.press_sensor_state().size()); + if (!read(streamer, se_1)) + return false; + instance.press_sensor_state().resize(se_1); + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!read(streamer, instance.press_sensor_state()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.power_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.power_a())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.system_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.device_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.error()[0], instance.error().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg::msg::dds_::HandState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::HandState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg::msg::dds_::HandState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.motor_state().size()); + if (!move(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!move(streamer, instance.motor_state()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.press_sensor_state().size()); + if (!move(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!move(streamer, instance.press_sensor_state()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.power_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.power_a())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.system_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.device_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.error()[0], instance.error().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg::msg::dds_::HandState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::HandState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg::msg::dds_::HandState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!max(streamer, instance.motor_state()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!max(streamer, instance.press_sensor_state()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.power_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.power_a())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.system_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.device_v())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.error()[0], instance.error().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg::msg::dds_::HandState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::HandState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_HANDSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/hg/IMUState_.hpp b/unitree_SDK/include/unitree/idl/hg/IMUState_.hpp new file mode 100644 index 0000000..0d521c0 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg/IMUState_.hpp @@ -0,0 +1,503 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: IMUState_.idl + Source: IMUState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_IMUSTATE__HPP +#define DDSCXX_UNITREE_IDL_HG_IMUSTATE__HPP + +#include +#include + +namespace unitree_hg +{ +namespace msg +{ +namespace dds_ +{ +class IMUState_ +{ +private: + std::array quaternion_ = { }; + std::array gyroscope_ = { }; + std::array accelerometer_ = { }; + std::array rpy_ = { }; + int16_t temperature_ = 0; + +public: + IMUState_() = default; + + explicit IMUState_( + const std::array& quaternion, + const std::array& gyroscope, + const std::array& accelerometer, + const std::array& rpy, + int16_t temperature) : + quaternion_(quaternion), + gyroscope_(gyroscope), + accelerometer_(accelerometer), + rpy_(rpy), + temperature_(temperature) { } + + const std::array& quaternion() const { return this->quaternion_; } + std::array& quaternion() { return this->quaternion_; } + void quaternion(const std::array& _val_) { this->quaternion_ = _val_; } + void quaternion(std::array&& _val_) { this->quaternion_ = _val_; } + const std::array& gyroscope() const { return this->gyroscope_; } + std::array& gyroscope() { return this->gyroscope_; } + void gyroscope(const std::array& _val_) { this->gyroscope_ = _val_; } + void gyroscope(std::array&& _val_) { this->gyroscope_ = _val_; } + const std::array& accelerometer() const { return this->accelerometer_; } + std::array& accelerometer() { return this->accelerometer_; } + void accelerometer(const std::array& _val_) { this->accelerometer_ = _val_; } + void accelerometer(std::array&& _val_) { this->accelerometer_ = _val_; } + const std::array& rpy() const { return this->rpy_; } + std::array& rpy() { return this->rpy_; } + void rpy(const std::array& _val_) { this->rpy_ = _val_; } + void rpy(std::array&& _val_) { this->rpy_ = _val_; } + int16_t temperature() const { return this->temperature_; } + int16_t& temperature() { return this->temperature_; } + void temperature(int16_t _val_) { this->temperature_ = _val_; } + + bool operator==(const IMUState_& _other) const + { + (void) _other; + return quaternion_ == _other.quaternion_ && + gyroscope_ == _other.gyroscope_ && + accelerometer_ == _other.accelerometer_ && + rpy_ == _other.rpy_ && + temperature_ == _other.temperature_; + } + + bool operator!=(const IMUState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg::msg::dds_::IMUState_>::getTypeName() +{ + return "unitree_hg::msg::dds_::IMUState_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::IMUState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::IMUState_>::type_map_blob_sz() { return 498; } +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::IMUState_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::IMUState_>::type_map_blob() { + static const uint8_t blob[] = { + 0xab, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xfc, 0x68, 0x71, 0x76, 0x65, 0x12, 0x06, + 0x55, 0x84, 0x73, 0xdf, 0x44, 0x22, 0x80, 0x00, 0x93, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x75, 0xb9, 0xaa, 0xa0, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x6b, 0x3b, 0x2d, 0x85, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x0e, 0x12, + 0x75, 0x69, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0xb0, 0x7d, 0x92, 0xed, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0xee, 0xf4, 0x38, 0xf7, 0x00, + 0x16, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x7d, 0x41, 0x66, 0x75, 0x41, 0x77, 0xd8, + 0x6f, 0xa2, 0x7c, 0xd2, 0x5b, 0x04, 0x03, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x49, 0x4d, 0x55, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0xc6, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x71, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x67, 0x79, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x6f, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x72, 0x70, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0x7d, 0x41, 0x66, 0x75, 0x41, 0x77, 0xd8, 0x6f, 0xa2, 0x7c, 0xd2, + 0x5b, 0x04, 0x03, 0xf1, 0xfc, 0x68, 0x71, 0x76, 0x65, 0x12, 0x06, 0x55, 0x84, 0x73, 0xdf, 0x44, + 0x22, 0x80, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::IMUState_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xfc, 0x68, 0x71, 0x76, 0x65, 0x12, 0x06, 0x55, 0x84, 0x73, 0xdf, + 0x44, 0x22, 0x80, 0x00, 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x7d, 0x41, 0x66, 0x75, 0x41, 0x77, 0xd8, 0x6f, 0xa2, 0x7c, 0xd2, + 0x5b, 0x04, 0x03, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg::msg::dds_::IMUState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg::msg::dds_::IMUState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg::msg::dds_::IMUState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg::msg::dds_::IMUState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg::msg::dds_::IMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg::msg::dds_::IMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::IMUState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg::msg::dds_::IMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg::msg::dds_::IMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::IMUState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg::msg::dds_::IMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg::msg::dds_::IMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::IMUState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg::msg::dds_::IMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg::msg::dds_::IMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::IMUState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_IMUSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/hg/LowCmd_.hpp b/unitree_SDK/include/unitree/idl/hg/LowCmd_.hpp new file mode 100644 index 0000000..eafe906 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg/LowCmd_.hpp @@ -0,0 +1,506 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: LowCmd_.idl + Source: LowCmd_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_LOWCMD__HPP +#define DDSCXX_UNITREE_IDL_HG_LOWCMD__HPP + +#include "unitree/idl/hg/MotorCmd_.hpp" + +#include +#include + +namespace unitree_hg +{ +namespace msg +{ +namespace dds_ +{ +class LowCmd_ +{ +private: + uint8_t mode_pr_ = 0; + uint8_t mode_machine_ = 0; + std::array<::unitree_hg::msg::dds_::MotorCmd_, 35> motor_cmd_ = { }; + std::array reserve_ = { }; + uint32_t crc_ = 0; + +public: + LowCmd_() = default; + + explicit LowCmd_( + uint8_t mode_pr, + uint8_t mode_machine, + const std::array<::unitree_hg::msg::dds_::MotorCmd_, 35>& motor_cmd, + const std::array& reserve, + uint32_t crc) : + mode_pr_(mode_pr), + mode_machine_(mode_machine), + motor_cmd_(motor_cmd), + reserve_(reserve), + crc_(crc) { } + + uint8_t mode_pr() const { return this->mode_pr_; } + uint8_t& mode_pr() { return this->mode_pr_; } + void mode_pr(uint8_t _val_) { this->mode_pr_ = _val_; } + uint8_t mode_machine() const { return this->mode_machine_; } + uint8_t& mode_machine() { return this->mode_machine_; } + void mode_machine(uint8_t _val_) { this->mode_machine_ = _val_; } + const std::array<::unitree_hg::msg::dds_::MotorCmd_, 35>& motor_cmd() const { return this->motor_cmd_; } + std::array<::unitree_hg::msg::dds_::MotorCmd_, 35>& motor_cmd() { return this->motor_cmd_; } + void motor_cmd(const std::array<::unitree_hg::msg::dds_::MotorCmd_, 35>& _val_) { this->motor_cmd_ = _val_; } + void motor_cmd(std::array<::unitree_hg::msg::dds_::MotorCmd_, 35>&& _val_) { this->motor_cmd_ = _val_; } + const std::array& reserve() const { return this->reserve_; } + std::array& reserve() { return this->reserve_; } + void reserve(const std::array& _val_) { this->reserve_ = _val_; } + void reserve(std::array&& _val_) { this->reserve_ = _val_; } + uint32_t crc() const { return this->crc_; } + uint32_t& crc() { return this->crc_; } + void crc(uint32_t _val_) { this->crc_ = _val_; } + + bool operator==(const LowCmd_& _other) const + { + (void) _other; + return mode_pr_ == _other.mode_pr_ && + mode_machine_ == _other.mode_machine_ && + motor_cmd_ == _other.motor_cmd_ && + reserve_ == _other.reserve_ && + crc_ == _other.crc_; + } + + bool operator!=(const LowCmd_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg::msg::dds_::LowCmd_>::getTypeName() +{ + return "unitree_hg::msg::dds_::LowCmd_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::LowCmd_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::LowCmd_>::type_map_blob_sz() { return 892; } +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::LowCmd_>::type_info_blob_sz() { return 148; } +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::LowCmd_>::type_map_blob() { + static const uint8_t blob[] = { + 0x37, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf1, 0x65, 0x69, 0xfc, 0x15, 0xf0, 0xd4, 0x7a, + 0xa8, 0x60, 0x0b, 0x9e, 0x91, 0xfb, 0xbc, 0x00, 0x87, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xb6, 0x9f, 0x36, 0x51, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xed, 0xb8, 0xc4, 0x0a, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf1, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x23, 0xf1, 0x82, 0x7f, 0x55, 0xde, 0x9b, 0x9d, 0xe3, 0x8c, 0x62, 0xba, + 0xcd, 0x1e, 0x56, 0xc9, 0x5b, 0xcf, 0x19, 0xa4, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x07, 0x9c, 0x3b, + 0x62, 0x94, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xf5, + 0xad, 0x59, 0xc5, 0xf1, 0x82, 0x7f, 0x55, 0xde, 0x9b, 0x9d, 0xe3, 0x8c, 0x62, 0xba, 0xcd, 0x1e, + 0x56, 0xc9, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x45, 0x80, 0xc2, 0x74, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x26, 0xb5, 0x68, 0xe4, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x87, 0x22, 0x16, 0x52, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0xf6, 0x01, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0xf2, 0x42, 0xb0, 0x28, 0x3a, 0xa7, 0xe1, 0xbb, 0x59, 0x2e, 0xc8, 0x98, + 0xa0, 0xdb, 0xed, 0x00, 0xe6, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4c, + 0x6f, 0x77, 0x43, 0x6d, 0x64, 0x5f, 0x00, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x6d, 0x6f, 0x64, 0x65, 0x5f, 0x70, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, + 0x5f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x23, 0xf2, 0xa2, 0xd9, 0xce, 0xd5, 0x0a, 0x79, 0x56, 0xe2, 0xa6, 0x07, 0x61, 0x3a, 0x13, 0xf1, + 0x0a, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x74, 0x6f, 0x72, 0x5f, 0x63, 0x6d, 0x64, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x63, 0x72, 0x63, 0x00, 0x00, 0x00, 0xf2, 0xa2, + 0xd9, 0xce, 0xd5, 0x0a, 0x79, 0x56, 0xe2, 0xa6, 0x07, 0x61, 0x3a, 0x13, 0xf1, 0x00, 0x00, 0x00, + 0xe2, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, 0x6f, 0x74, 0x6f, 0x72, + 0x43, 0x6d, 0x64, 0x5f, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x64, 0x71, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x74, 0x61, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6b, 0x70, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x6b, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0xf2, 0x42, 0xb0, 0x28, 0x3a, 0xa7, 0xe1, 0xbb, 0x59, 0x2e, 0xc8, 0x98, 0xa0, 0xdb, 0xed, 0xf1, + 0x65, 0x69, 0xfc, 0x15, 0xf0, 0xd4, 0x7a, 0xa8, 0x60, 0x0b, 0x9e, 0x91, 0xfb, 0xbc, 0xf2, 0xa2, + 0xd9, 0xce, 0xd5, 0x0a, 0x79, 0x56, 0xe2, 0xa6, 0x07, 0x61, 0x3a, 0x13, 0xf1, 0xf1, 0x82, 0x7f, + 0x55, 0xde, 0x9b, 0x9d, 0xe3, 0x8c, 0x62, 0xba, 0xcd, 0x1e, 0x56, 0xc9, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::LowCmd_>::type_info_blob() { + static const uint8_t blob[] = { + 0x90, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x65, 0x69, 0xfc, 0x15, 0xf0, 0xd4, 0x7a, 0xa8, 0x60, 0x0b, 0x9e, + 0x91, 0xfb, 0xbc, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x82, 0x7f, 0x55, 0xde, 0x9b, 0x9d, 0xe3, + 0x8c, 0x62, 0xba, 0xcd, 0x1e, 0x56, 0xc9, 0x00, 0x87, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x42, 0xb0, 0x28, + 0x3a, 0xa7, 0xe1, 0xbb, 0x59, 0x2e, 0xc8, 0x98, 0xa0, 0xdb, 0xed, 0x00, 0xea, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xa2, 0xd9, 0xce, 0xd5, 0x0a, 0x79, 0x56, 0xe2, 0xa6, 0x07, 0x61, 0x3a, 0x13, 0xf1, 0x00, + 0xe6, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg::msg::dds_::LowCmd_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg::msg::dds_::LowCmd_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg::msg::dds_::LowCmd_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg::msg::dds_::LowCmd_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg::msg::dds_::LowCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.mode_pr())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.mode_machine())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_cmd()) { //array depth 1 + if (!write(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg::msg::dds_::LowCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::LowCmd_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg::msg::dds_::LowCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.mode_pr())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.mode_machine())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (auto & a_1:instance.motor_cmd()) { //array depth 1 + if (!read(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg::msg::dds_::LowCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::LowCmd_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg::msg::dds_::LowCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.mode_pr())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.mode_machine())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_cmd()) { //array depth 1 + if (!move(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg::msg::dds_::LowCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::LowCmd_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg::msg::dds_::LowCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.mode_pr())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.mode_machine())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_cmd()) { //array depth 1 + if (!max(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg::msg::dds_::LowCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::LowCmd_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_LOWCMD__HPP diff --git a/unitree_SDK/include/unitree/idl/hg/LowState_.hpp b/unitree_SDK/include/unitree/idl/hg/LowState_.hpp new file mode 100644 index 0000000..0bcc83e --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg/LowState_.hpp @@ -0,0 +1,762 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: LowState_.idl + Source: LowState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_LOWSTATE__HPP +#define DDSCXX_UNITREE_IDL_HG_LOWSTATE__HPP + +#include "unitree/idl/hg/IMUState_.hpp" + +#include "unitree/idl/hg/MotorState_.hpp" + +#include +#include + +namespace unitree_hg +{ +namespace msg +{ +namespace dds_ +{ +class LowState_ +{ +private: + std::array version_ = { }; + uint8_t mode_pr_ = 0; + uint8_t mode_machine_ = 0; + uint32_t tick_ = 0; + ::unitree_hg::msg::dds_::IMUState_ imu_state_; + std::array<::unitree_hg::msg::dds_::MotorState_, 35> motor_state_ = { }; + std::array wireless_remote_ = { }; + std::array reserve_ = { }; + uint32_t crc_ = 0; + +public: + LowState_() = default; + + explicit LowState_( + const std::array& version, + uint8_t mode_pr, + uint8_t mode_machine, + uint32_t tick, + const ::unitree_hg::msg::dds_::IMUState_& imu_state, + const std::array<::unitree_hg::msg::dds_::MotorState_, 35>& motor_state, + const std::array& wireless_remote, + const std::array& reserve, + uint32_t crc) : + version_(version), + mode_pr_(mode_pr), + mode_machine_(mode_machine), + tick_(tick), + imu_state_(imu_state), + motor_state_(motor_state), + wireless_remote_(wireless_remote), + reserve_(reserve), + crc_(crc) { } + + const std::array& version() const { return this->version_; } + std::array& version() { return this->version_; } + void version(const std::array& _val_) { this->version_ = _val_; } + void version(std::array&& _val_) { this->version_ = _val_; } + uint8_t mode_pr() const { return this->mode_pr_; } + uint8_t& mode_pr() { return this->mode_pr_; } + void mode_pr(uint8_t _val_) { this->mode_pr_ = _val_; } + uint8_t mode_machine() const { return this->mode_machine_; } + uint8_t& mode_machine() { return this->mode_machine_; } + void mode_machine(uint8_t _val_) { this->mode_machine_ = _val_; } + uint32_t tick() const { return this->tick_; } + uint32_t& tick() { return this->tick_; } + void tick(uint32_t _val_) { this->tick_ = _val_; } + const ::unitree_hg::msg::dds_::IMUState_& imu_state() const { return this->imu_state_; } + ::unitree_hg::msg::dds_::IMUState_& imu_state() { return this->imu_state_; } + void imu_state(const ::unitree_hg::msg::dds_::IMUState_& _val_) { this->imu_state_ = _val_; } + void imu_state(::unitree_hg::msg::dds_::IMUState_&& _val_) { this->imu_state_ = _val_; } + const std::array<::unitree_hg::msg::dds_::MotorState_, 35>& motor_state() const { return this->motor_state_; } + std::array<::unitree_hg::msg::dds_::MotorState_, 35>& motor_state() { return this->motor_state_; } + void motor_state(const std::array<::unitree_hg::msg::dds_::MotorState_, 35>& _val_) { this->motor_state_ = _val_; } + void motor_state(std::array<::unitree_hg::msg::dds_::MotorState_, 35>&& _val_) { this->motor_state_ = _val_; } + const std::array& wireless_remote() const { return this->wireless_remote_; } + std::array& wireless_remote() { return this->wireless_remote_; } + void wireless_remote(const std::array& _val_) { this->wireless_remote_ = _val_; } + void wireless_remote(std::array&& _val_) { this->wireless_remote_ = _val_; } + const std::array& reserve() const { return this->reserve_; } + std::array& reserve() { return this->reserve_; } + void reserve(const std::array& _val_) { this->reserve_ = _val_; } + void reserve(std::array&& _val_) { this->reserve_ = _val_; } + uint32_t crc() const { return this->crc_; } + uint32_t& crc() { return this->crc_; } + void crc(uint32_t _val_) { this->crc_ = _val_; } + + bool operator==(const LowState_& _other) const + { + (void) _other; + return version_ == _other.version_ && + mode_pr_ == _other.mode_pr_ && + mode_machine_ == _other.mode_machine_ && + tick_ == _other.tick_ && + imu_state_ == _other.imu_state_ && + motor_state_ == _other.motor_state_ && + wireless_remote_ == _other.wireless_remote_ && + reserve_ == _other.reserve_ && + crc_ == _other.crc_; + } + + bool operator!=(const LowState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg::msg::dds_::LowState_>::getTypeName() +{ + return "unitree_hg::msg::dds_::LowState_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::LowState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::LowState_>::type_map_blob_sz() { return 1850; } +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::LowState_>::type_info_blob_sz() { return 196; } +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::LowState_>::type_map_blob() { + static const uint8_t blob[] = { + 0x9a, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf1, 0x2f, 0x38, 0x29, 0x6b, 0x52, 0xaa, 0x02, + 0x30, 0xb9, 0x2d, 0x37, 0x8b, 0x1e, 0x39, 0x00, 0xef, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x2a, 0xf7, 0x2f, 0x10, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xb6, 0x9f, 0x36, 0x51, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0xed, 0xb8, 0xc4, 0x0a, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe5, 0xe5, 0xc0, 0x75, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xfc, 0x68, 0x71, 0x76, 0x65, 0x12, 0x06, 0x55, 0x84, + 0x73, 0xdf, 0x44, 0x22, 0x80, 0x9e, 0x5f, 0x37, 0x13, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf1, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x23, 0xf1, 0x7c, 0xc5, 0x84, 0xed, 0x94, 0x0b, 0x8f, 0x30, 0x18, 0xf1, 0x8d, 0xe0, 0xed, 0x24, + 0xb2, 0x1e, 0x53, 0xdc, 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x02, 0xa8, 0x2f, 0x18, 0xc9, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xf5, 0xad, 0x59, 0xc5, 0xf1, 0xfc, 0x68, 0x71, 0x76, + 0x65, 0x12, 0x06, 0x55, 0x84, 0x73, 0xdf, 0x44, 0x22, 0x80, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x75, 0xb9, 0xaa, 0xa0, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x6b, 0x3b, 0x2d, 0x85, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x0e, 0x12, 0x75, 0x69, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0xb0, 0x7d, + 0x92, 0xed, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0xee, + 0xf4, 0x38, 0xf7, 0xf1, 0x7c, 0xc5, 0x84, 0xed, 0x94, 0x0b, 0x8f, 0x30, 0x18, 0xf1, 0x8d, 0xe0, + 0xed, 0x24, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xe9, 0x16, 0x89, 0x09, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x8a, 0xf7, 0xae, 0xdf, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x03, 0xee, 0xf4, 0x38, 0xf7, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x0a, 0xcf, 0x8b, 0xe1, 0x00, 0x16, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0xa5, 0xfe, + 0x26, 0xd5, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xd1, + 0x41, 0x1a, 0xed, 0x00, 0x16, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0x00, + 0x32, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf2, 0x2b, 0xe9, 0x70, 0x6c, 0x95, 0x87, 0xe8, + 0xd8, 0xaf, 0xd8, 0xbf, 0xc6, 0xde, 0x7b, 0x00, 0x8a, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x4c, 0x6f, 0x77, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x52, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x6d, 0x6f, 0x64, 0x65, 0x5f, 0x70, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, + 0x5f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x05, 0x00, 0x00, 0x00, 0x74, 0x69, 0x63, 0x6b, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x7d, + 0x41, 0x66, 0x75, 0x41, 0x77, 0xd8, 0x6f, 0xa2, 0x7c, 0xd2, 0x5b, 0x04, 0x03, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x69, 0x6d, 0x75, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, + 0x32, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf2, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x23, 0xf2, 0xa8, 0x6c, 0xba, 0xb3, 0xae, 0x0a, 0xa9, 0x8a, 0x1e, 0x74, + 0x66, 0x43, 0xa0, 0x99, 0x0c, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x74, 0x6f, 0x72, 0x5f, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x77, 0x69, 0x72, 0x65, 0x6c, 0x65, 0x73, 0x73, 0x5f, 0x72, 0x65, 0x6d, + 0x6f, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x63, 0x72, 0x63, 0x00, 0x00, 0x00, 0xf2, 0x7d, 0x41, 0x66, 0x75, 0x41, 0x77, 0xd8, 0x6f, 0xa2, + 0x7c, 0xd2, 0x5b, 0x04, 0x03, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x49, 0x4d, 0x55, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0xc6, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x71, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x67, 0x79, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x6f, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x72, 0x70, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0xf2, 0xa8, 0x6c, 0xba, 0xb3, 0xae, + 0x0a, 0xa9, 0x8a, 0x1e, 0x74, 0x66, 0x43, 0xa0, 0x99, 0x00, 0x00, 0x00, 0x66, 0x01, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, 0x6f, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x5f, 0x00, 0x00, 0x2e, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x64, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x74, 0x61, 0x75, 0x5f, 0x65, 0x73, 0x74, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x76, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x6d, 0x6f, 0x74, 0x6f, 0x72, 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0xf2, 0x2b, 0xe9, 0x70, 0x6c, 0x95, 0x87, 0xe8, 0xd8, 0xaf, 0xd8, 0xbf, 0xc6, 0xde, 0x7b, 0xf1, + 0x2f, 0x38, 0x29, 0x6b, 0x52, 0xaa, 0x02, 0x30, 0xb9, 0x2d, 0x37, 0x8b, 0x1e, 0x39, 0xf2, 0x7d, + 0x41, 0x66, 0x75, 0x41, 0x77, 0xd8, 0x6f, 0xa2, 0x7c, 0xd2, 0x5b, 0x04, 0x03, 0xf1, 0xfc, 0x68, + 0x71, 0x76, 0x65, 0x12, 0x06, 0x55, 0x84, 0x73, 0xdf, 0x44, 0x22, 0x80, 0xf2, 0xa8, 0x6c, 0xba, + 0xb3, 0xae, 0x0a, 0xa9, 0x8a, 0x1e, 0x74, 0x66, 0x43, 0xa0, 0x99, 0xf1, 0x7c, 0xc5, 0x84, 0xed, + 0x94, 0x0b, 0x8f, 0x30, 0x18, 0xf1, 0x8d, 0xe0, 0xed, 0x24, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::LowState_>::type_info_blob() { + static const uint8_t blob[] = { + 0xc0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x2f, 0x38, 0x29, 0x6b, 0x52, 0xaa, 0x02, 0x30, 0xb9, 0x2d, 0x37, + 0x8b, 0x1e, 0x39, 0x00, 0xf3, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xfc, 0x68, 0x71, 0x76, 0x65, 0x12, 0x06, + 0x55, 0x84, 0x73, 0xdf, 0x44, 0x22, 0x80, 0x00, 0x97, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x7c, 0xc5, 0x84, 0xed, 0x94, 0x0b, 0x8f, 0x30, 0x18, 0xf1, 0x8d, 0xe0, 0xed, 0x24, 0x00, + 0xda, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x2b, 0xe9, 0x70, 0x6c, 0x95, 0x87, 0xe8, 0xd8, 0xaf, 0xd8, 0xbf, + 0xc6, 0xde, 0x7b, 0x00, 0x8e, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x7d, 0x41, 0x66, 0x75, 0x41, 0x77, 0xd8, + 0x6f, 0xa2, 0x7c, 0xd2, 0x5b, 0x04, 0x03, 0x00, 0x02, 0x01, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xa8, 0x6c, 0xba, 0xb3, 0xae, 0x0a, 0xa9, 0x8a, 0x1e, 0x74, 0x66, 0x43, 0xa0, 0x99, 0x00, + 0x6a, 0x01, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg::msg::dds_::LowState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg::msg::dds_::LowState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg::msg::dds_::LowState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg::msg::dds_::LowState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg::msg::dds_::LowState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.mode_pr())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.mode_machine())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_state()) { //array depth 1 + if (!write(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg::msg::dds_::LowState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::LowState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg::msg::dds_::LowState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.mode_pr())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.mode_machine())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (auto & a_1:instance.motor_state()) { //array depth 1 + if (!read(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg::msg::dds_::LowState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::LowState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg::msg::dds_::LowState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.mode_pr())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.mode_machine())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_state()) { //array depth 1 + if (!move(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg::msg::dds_::LowState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::LowState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg::msg::dds_::LowState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.version()[0], instance.version().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.mode_pr())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.mode_machine())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.imu_state(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, false)) + return false; + for (const auto & a_1:instance.motor_state()) { //array depth 1 + if (!max(streamer, a_1, prop)) + return false; + } //array depth 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.wireless_remote()[0], instance.wireless_remote().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.crc())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg::msg::dds_::LowState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::LowState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_LOWSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/hg/MainBoardState_.hpp b/unitree_SDK/include/unitree/idl/hg/MainBoardState_.hpp new file mode 100644 index 0000000..9015c03 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg/MainBoardState_.hpp @@ -0,0 +1,460 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: MainBoardState_.idl + Source: MainBoardState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_MAINBOARDSTATE__HPP +#define DDSCXX_UNITREE_IDL_HG_MAINBOARDSTATE__HPP + +#include +#include + +namespace unitree_hg +{ +namespace msg +{ +namespace dds_ +{ +class MainBoardState_ +{ +private: + std::array fan_state_ = { }; + std::array temperature_ = { }; + std::array value_ = { }; + std::array state_ = { }; + +public: + MainBoardState_() = default; + + explicit MainBoardState_( + const std::array& fan_state, + const std::array& temperature, + const std::array& value, + const std::array& state) : + fan_state_(fan_state), + temperature_(temperature), + value_(value), + state_(state) { } + + const std::array& fan_state() const { return this->fan_state_; } + std::array& fan_state() { return this->fan_state_; } + void fan_state(const std::array& _val_) { this->fan_state_ = _val_; } + void fan_state(std::array&& _val_) { this->fan_state_ = _val_; } + const std::array& temperature() const { return this->temperature_; } + std::array& temperature() { return this->temperature_; } + void temperature(const std::array& _val_) { this->temperature_ = _val_; } + void temperature(std::array&& _val_) { this->temperature_ = _val_; } + const std::array& value() const { return this->value_; } + std::array& value() { return this->value_; } + void value(const std::array& _val_) { this->value_ = _val_; } + void value(std::array&& _val_) { this->value_ = _val_; } + const std::array& state() const { return this->state_; } + std::array& state() { return this->state_; } + void state(const std::array& _val_) { this->state_ = _val_; } + void state(std::array&& _val_) { this->state_ = _val_; } + + bool operator==(const MainBoardState_& _other) const + { + (void) _other; + return fan_state_ == _other.fan_state_ && + temperature_ == _other.temperature_ && + value_ == _other.value_ && + state_ == _other.state_; + } + + bool operator!=(const MainBoardState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg::msg::dds_::MainBoardState_>::getTypeName() +{ + return "unitree_hg::msg::dds_::MainBoardState_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::MainBoardState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::MainBoardState_>::type_map_blob_sz() { return 446; } +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::MainBoardState_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::MainBoardState_>::type_map_blob() { + static const uint8_t blob[] = { + 0x9a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xde, 0xab, 0xb8, 0xf4, 0x95, 0x16, 0x55, + 0x33, 0xd2, 0x9d, 0x46, 0x46, 0x5f, 0x6a, 0x00, 0x82, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x06, 0x06, 0x6f, 0x80, 0x17, 0x1f, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x06, 0x03, 0xee, 0xf4, 0x38, 0xf7, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x09, 0x20, 0x63, + 0xc1, 0x60, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x07, 0x9e, 0xd3, 0x9e, 0x2e, 0x00, 0x00, + 0xf4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x56, 0xc3, 0x59, 0xc8, 0xbe, 0x34, 0xec, + 0xd0, 0x38, 0xbc, 0x21, 0x76, 0x76, 0x4d, 0x00, 0xdc, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x4d, 0x61, 0x69, 0x6e, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x5f, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x06, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x66, 0x61, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x06, 0x09, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xf2, 0x56, 0xc3, 0x59, 0xc8, 0xbe, 0x34, 0xec, 0xd0, 0x38, 0xbc, 0x21, 0x76, 0x76, 0x4d, 0xf1, + 0xde, 0xab, 0xb8, 0xf4, 0x95, 0x16, 0x55, 0x33, 0xd2, 0x9d, 0x46, 0x46, 0x5f, 0x6a, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::MainBoardState_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xde, 0xab, 0xb8, 0xf4, 0x95, 0x16, 0x55, 0x33, 0xd2, 0x9d, 0x46, + 0x46, 0x5f, 0x6a, 0x00, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x56, 0xc3, 0x59, 0xc8, 0xbe, 0x34, 0xec, 0xd0, 0x38, 0xbc, 0x21, + 0x76, 0x76, 0x4d, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg::msg::dds_::MainBoardState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg::msg::dds_::MainBoardState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg::msg::dds_::MainBoardState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg::msg::dds_::MainBoardState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg::msg::dds_::MainBoardState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.fan_state()[0], instance.fan_state().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.value()[0], instance.value().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.state()[0], instance.state().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg::msg::dds_::MainBoardState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MainBoardState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg::msg::dds_::MainBoardState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.fan_state()[0], instance.fan_state().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.value()[0], instance.value().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.state()[0], instance.state().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg::msg::dds_::MainBoardState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MainBoardState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg::msg::dds_::MainBoardState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.fan_state()[0], instance.fan_state().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.value()[0], instance.value().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.state()[0], instance.state().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg::msg::dds_::MainBoardState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MainBoardState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg::msg::dds_::MainBoardState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.fan_state()[0], instance.fan_state().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.value()[0], instance.value().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.state()[0], instance.state().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg::msg::dds_::MainBoardState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MainBoardState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_MAINBOARDSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/hg/MotorCmd_.hpp b/unitree_SDK/include/unitree/idl/hg/MotorCmd_.hpp new file mode 100644 index 0000000..e38adf0 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg/MotorCmd_.hpp @@ -0,0 +1,509 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: MotorCmd_.idl + Source: MotorCmd_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_MOTORCMD__HPP +#define DDSCXX_UNITREE_IDL_HG_MOTORCMD__HPP + +#include + +namespace unitree_hg +{ +namespace msg +{ +namespace dds_ +{ +class MotorCmd_ +{ +private: + uint8_t mode_ = 0; + float q_ = 0.0f; + float dq_ = 0.0f; + float tau_ = 0.0f; + float kp_ = 0.0f; + float kd_ = 0.0f; + uint32_t reserve_ = 0; + +public: + MotorCmd_() = default; + + explicit MotorCmd_( + uint8_t mode, + float q, + float dq, + float tau, + float kp, + float kd, + uint32_t reserve) : + mode_(mode), + q_(q), + dq_(dq), + tau_(tau), + kp_(kp), + kd_(kd), + reserve_(reserve) { } + + uint8_t mode() const { return this->mode_; } + uint8_t& mode() { return this->mode_; } + void mode(uint8_t _val_) { this->mode_ = _val_; } + float q() const { return this->q_; } + float& q() { return this->q_; } + void q(float _val_) { this->q_ = _val_; } + float dq() const { return this->dq_; } + float& dq() { return this->dq_; } + void dq(float _val_) { this->dq_ = _val_; } + float tau() const { return this->tau_; } + float& tau() { return this->tau_; } + void tau(float _val_) { this->tau_ = _val_; } + float kp() const { return this->kp_; } + float& kp() { return this->kp_; } + void kp(float _val_) { this->kp_ = _val_; } + float kd() const { return this->kd_; } + float& kd() { return this->kd_; } + void kd(float _val_) { this->kd_ = _val_; } + uint32_t reserve() const { return this->reserve_; } + uint32_t& reserve() { return this->reserve_; } + void reserve(uint32_t _val_) { this->reserve_ = _val_; } + + bool operator==(const MotorCmd_& _other) const + { + (void) _other; + return mode_ == _other.mode_ && + q_ == _other.q_ && + dq_ == _other.dq_ && + tau_ == _other.tau_ && + kp_ == _other.kp_ && + kd_ == _other.kd_ && + reserve_ == _other.reserve_; + } + + bool operator!=(const MotorCmd_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg::msg::dds_::MotorCmd_>::getTypeName() +{ + return "unitree_hg::msg::dds_::MotorCmd_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::MotorCmd_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::MotorCmd_>::type_map_blob_sz() { return 454; } +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::MotorCmd_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::MotorCmd_>::type_map_blob() { + static const uint8_t blob[] = { + 0x9b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x82, 0x7f, 0x55, 0xde, 0x9b, 0x9d, 0xe3, + 0x8c, 0x62, 0xba, 0xcd, 0x1e, 0x56, 0xc9, 0x00, 0x83, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x45, 0x80, 0xc2, 0x74, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x26, 0xb5, 0x68, 0xe4, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x87, 0x22, 0x16, 0x52, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, + 0xfa, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xa2, 0xd9, 0xce, 0xd5, 0x0a, 0x79, 0x56, + 0xe2, 0xa6, 0x07, 0x61, 0x3a, 0x13, 0xf1, 0x00, 0xe2, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x4d, 0x6f, 0x74, 0x6f, 0x72, 0x43, 0x6d, 0x64, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0xaa, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x71, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x74, 0x61, 0x75, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x6b, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6b, 0x64, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xa2, 0xd9, 0xce, 0xd5, 0x0a, 0x79, 0x56, + 0xe2, 0xa6, 0x07, 0x61, 0x3a, 0x13, 0xf1, 0xf1, 0x82, 0x7f, 0x55, 0xde, 0x9b, 0x9d, 0xe3, 0x8c, + 0x62, 0xba, 0xcd, 0x1e, 0x56, 0xc9, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::MotorCmd_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x82, 0x7f, 0x55, 0xde, 0x9b, 0x9d, 0xe3, 0x8c, 0x62, 0xba, 0xcd, + 0x1e, 0x56, 0xc9, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xa2, 0xd9, 0xce, 0xd5, 0x0a, 0x79, 0x56, 0xe2, 0xa6, 0x07, 0x61, + 0x3a, 0x13, 0xf1, 0x00, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg::msg::dds_::MotorCmd_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg::msg::dds_::MotorCmd_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg::msg::dds_::MotorCmd_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg::msg::dds_::MotorCmd_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg::msg::dds_::MotorCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.tau())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.kp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.kd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg::msg::dds_::MotorCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MotorCmd_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg::msg::dds_::MotorCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.tau())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.kp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.kd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg::msg::dds_::MotorCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MotorCmd_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg::msg::dds_::MotorCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.tau())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.kp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.kd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg::msg::dds_::MotorCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MotorCmd_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg::msg::dds_::MotorCmd_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.tau())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.kp())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.kd())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg::msg::dds_::MotorCmd_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MotorCmd_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_MOTORCMD__HPP diff --git a/unitree_SDK/include/unitree/idl/hg/MotorState_.hpp b/unitree_SDK/include/unitree/idl/hg/MotorState_.hpp new file mode 100644 index 0000000..3149ac5 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg/MotorState_.hpp @@ -0,0 +1,691 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: MotorState_.idl + Source: MotorState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_MOTORSTATE__HPP +#define DDSCXX_UNITREE_IDL_HG_MOTORSTATE__HPP + +#include +#include + +namespace unitree_hg +{ +namespace msg +{ +namespace dds_ +{ +class MotorState_ +{ +private: + uint8_t mode_ = 0; + float q_ = 0.0f; + float dq_ = 0.0f; + float ddq_ = 0.0f; + float tau_est_ = 0.0f; + std::array temperature_ = { }; + float vol_ = 0.0f; + std::array sensor_ = { }; + uint32_t motorstate_ = 0; + std::array reserve_ = { }; + +public: + MotorState_() = default; + + explicit MotorState_( + uint8_t mode, + float q, + float dq, + float ddq, + float tau_est, + const std::array& temperature, + float vol, + const std::array& sensor, + uint32_t motorstate, + const std::array& reserve) : + mode_(mode), + q_(q), + dq_(dq), + ddq_(ddq), + tau_est_(tau_est), + temperature_(temperature), + vol_(vol), + sensor_(sensor), + motorstate_(motorstate), + reserve_(reserve) { } + + uint8_t mode() const { return this->mode_; } + uint8_t& mode() { return this->mode_; } + void mode(uint8_t _val_) { this->mode_ = _val_; } + float q() const { return this->q_; } + float& q() { return this->q_; } + void q(float _val_) { this->q_ = _val_; } + float dq() const { return this->dq_; } + float& dq() { return this->dq_; } + void dq(float _val_) { this->dq_ = _val_; } + float ddq() const { return this->ddq_; } + float& ddq() { return this->ddq_; } + void ddq(float _val_) { this->ddq_ = _val_; } + float tau_est() const { return this->tau_est_; } + float& tau_est() { return this->tau_est_; } + void tau_est(float _val_) { this->tau_est_ = _val_; } + const std::array& temperature() const { return this->temperature_; } + std::array& temperature() { return this->temperature_; } + void temperature(const std::array& _val_) { this->temperature_ = _val_; } + void temperature(std::array&& _val_) { this->temperature_ = _val_; } + float vol() const { return this->vol_; } + float& vol() { return this->vol_; } + void vol(float _val_) { this->vol_ = _val_; } + const std::array& sensor() const { return this->sensor_; } + std::array& sensor() { return this->sensor_; } + void sensor(const std::array& _val_) { this->sensor_ = _val_; } + void sensor(std::array&& _val_) { this->sensor_ = _val_; } + uint32_t motorstate() const { return this->motorstate_; } + uint32_t& motorstate() { return this->motorstate_; } + void motorstate(uint32_t _val_) { this->motorstate_ = _val_; } + const std::array& reserve() const { return this->reserve_; } + std::array& reserve() { return this->reserve_; } + void reserve(const std::array& _val_) { this->reserve_ = _val_; } + void reserve(std::array&& _val_) { this->reserve_ = _val_; } + + bool operator==(const MotorState_& _other) const + { + (void) _other; + return mode_ == _other.mode_ && + q_ == _other.q_ && + dq_ == _other.dq_ && + ddq_ == _other.ddq_ && + tau_est_ == _other.tau_est_ && + temperature_ == _other.temperature_ && + vol_ == _other.vol_ && + sensor_ == _other.sensor_ && + motorstate_ == _other.motorstate_ && + reserve_ == _other.reserve_; + } + + bool operator!=(const MotorState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg::msg::dds_::MotorState_>::getTypeName() +{ + return "unitree_hg::msg::dds_::MotorState_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::MotorState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::MotorState_>::type_map_blob_sz() { return 670; } +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::MotorState_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::MotorState_>::type_map_blob() { + static const uint8_t blob[] = { + 0xee, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x7c, 0xc5, 0x84, 0xed, 0x94, 0x0b, 0x8f, + 0x30, 0x18, 0xf1, 0x8d, 0xe0, 0xed, 0x24, 0x00, 0xd6, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x15, 0xd6, 0x17, 0x12, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x76, 0x94, 0xf4, 0xa6, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x47, 0xbc, 0xdc, 0xd7, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xe9, 0x16, 0x89, 0x09, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x8a, 0xf7, 0xae, 0xdf, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x02, 0x03, 0xee, 0xf4, 0x38, 0xf7, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x0a, 0xcf, 0x8b, 0xe1, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x02, 0x07, 0xa5, 0xfe, 0x26, 0xd5, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0xd1, 0x41, 0x1a, 0xed, 0x00, 0x16, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x07, 0x9c, 0x3b, + 0x62, 0x94, 0x00, 0x00, 0x7e, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xa8, 0x6c, 0xba, + 0xb3, 0xae, 0x0a, 0xa9, 0x8a, 0x1e, 0x74, 0x66, 0x43, 0xa0, 0x99, 0x00, 0x66, 0x01, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, 0x6f, 0x74, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x5f, 0x00, 0x00, 0x2e, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6d, 0x6f, 0x64, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x64, 0x64, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x08, 0x00, 0x00, 0x00, 0x74, 0x61, 0x75, 0x5f, 0x65, 0x73, 0x74, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x74, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x76, 0x6f, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x6d, 0x6f, 0x74, 0x6f, 0x72, 0x73, 0x74, 0x61, 0x74, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xf2, 0xa8, 0x6c, 0xba, 0xb3, 0xae, 0x0a, 0xa9, 0x8a, 0x1e, 0x74, 0x66, 0x43, 0xa0, 0x99, 0xf1, + 0x7c, 0xc5, 0x84, 0xed, 0x94, 0x0b, 0x8f, 0x30, 0x18, 0xf1, 0x8d, 0xe0, 0xed, 0x24, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::MotorState_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x7c, 0xc5, 0x84, 0xed, 0x94, 0x0b, 0x8f, 0x30, 0x18, 0xf1, 0x8d, + 0xe0, 0xed, 0x24, 0x00, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xa8, 0x6c, 0xba, 0xb3, 0xae, 0x0a, 0xa9, 0x8a, 0x1e, 0x74, 0x66, + 0x43, 0xa0, 0x99, 0x00, 0x6a, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg::msg::dds_::MotorState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg::msg::dds_::MotorState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg::msg::dds_::MotorState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg::msg::dds_::MotorState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg::msg::dds_::MotorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.ddq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.tau_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.vol())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.sensor()[0], instance.sensor().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.motorstate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg::msg::dds_::MotorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MotorState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg::msg::dds_::MotorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.ddq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.tau_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.vol())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.sensor()[0], instance.sensor().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.motorstate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg::msg::dds_::MotorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MotorState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg::msg::dds_::MotorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.ddq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.tau_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.vol())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.sensor()[0], instance.sensor().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.motorstate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg::msg::dds_::MotorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MotorState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg::msg::dds_::MotorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.mode())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.q())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.dq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.ddq())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.tau_est())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.vol())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.sensor()[0], instance.sensor().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.motorstate())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 9: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.reserve()[0], instance.reserve().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg::msg::dds_::MotorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::MotorState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_MOTORSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/hg/PressSensorState_.hpp b/unitree_SDK/include/unitree/idl/hg/PressSensorState_.hpp new file mode 100644 index 0000000..90cecad --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg/PressSensorState_.hpp @@ -0,0 +1,424 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: PressSensorState_.idl + Source: PressSensorState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_PRESSSENSORSTATE__HPP +#define DDSCXX_UNITREE_IDL_HG_PRESSSENSORSTATE__HPP + +#include +#include + +namespace unitree_hg +{ +namespace msg +{ +namespace dds_ +{ +class PressSensorState_ +{ +private: + std::array pressure_ = { }; + std::array temperature_ = { }; + uint32_t lost_ = 0; + uint32_t reserve_ = 0; + +public: + PressSensorState_() = default; + + explicit PressSensorState_( + const std::array& pressure, + const std::array& temperature, + uint32_t lost, + uint32_t reserve) : + pressure_(pressure), + temperature_(temperature), + lost_(lost), + reserve_(reserve) { } + + const std::array& pressure() const { return this->pressure_; } + std::array& pressure() { return this->pressure_; } + void pressure(const std::array& _val_) { this->pressure_ = _val_; } + void pressure(std::array&& _val_) { this->pressure_ = _val_; } + const std::array& temperature() const { return this->temperature_; } + std::array& temperature() { return this->temperature_; } + void temperature(const std::array& _val_) { this->temperature_ = _val_; } + void temperature(std::array&& _val_) { this->temperature_ = _val_; } + uint32_t lost() const { return this->lost_; } + uint32_t& lost() { return this->lost_; } + void lost(uint32_t _val_) { this->lost_ = _val_; } + uint32_t reserve() const { return this->reserve_; } + uint32_t& reserve() { return this->reserve_; } + void reserve(uint32_t _val_) { this->reserve_ = _val_; } + + bool operator==(const PressSensorState_& _other) const + { + (void) _other; + return pressure_ == _other.pressure_ && + temperature_ == _other.temperature_ && + lost_ == _other.lost_ && + reserve_ == _other.reserve_; + } + + bool operator!=(const PressSensorState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg::msg::dds_::PressSensorState_>::getTypeName() +{ + return "unitree_hg::msg::dds_::PressSensorState_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg::msg::dds_::PressSensorState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::PressSensorState_>::type_map_blob_sz() { return 406; } +template<> constexpr unsigned int TopicTraits<::unitree_hg::msg::dds_::PressSensorState_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::PressSensorState_>::type_map_blob() { + static const uint8_t blob[] = { + 0x83, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x03, 0x93, 0x1d, 0x83, 0x67, 0x60, 0x08, + 0x26, 0x6e, 0x46, 0x6a, 0x66, 0xb2, 0x55, 0x00, 0x6b, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0xd9, 0x9f, 0xad, 0x96, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0c, 0x09, 0xee, 0xf4, 0x38, 0xf7, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x1c, 0x9a, 0x44, 0xeb, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x9c, 0x3b, 0x62, 0x94, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xf2, 0xcd, 0x53, 0x1f, 0x52, 0x24, 0x7f, 0x1d, 0x07, 0xb3, 0x82, 0x0f, 0xf4, 0x2b, 0x21, 0x00, + 0xca, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x72, 0x65, 0x73, 0x73, + 0x53, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x8a, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x70, 0x72, 0x65, 0x73, 0x73, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x26, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x0c, 0x09, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6c, 0x6f, 0x73, 0x74, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xcd, 0x53, 0x1f, 0x52, 0x24, 0x7f, 0x1d, + 0x07, 0xb3, 0x82, 0x0f, 0xf4, 0x2b, 0x21, 0xf1, 0x03, 0x93, 0x1d, 0x83, 0x67, 0x60, 0x08, 0x26, + 0x6e, 0x46, 0x6a, 0x66, 0xb2, 0x55, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg::msg::dds_::PressSensorState_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x03, 0x93, 0x1d, 0x83, 0x67, 0x60, 0x08, 0x26, 0x6e, 0x46, 0x6a, + 0x66, 0xb2, 0x55, 0x00, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xcd, 0x53, 0x1f, 0x52, 0x24, 0x7f, 0x1d, 0x07, 0xb3, 0x82, 0x0f, + 0xf4, 0x2b, 0x21, 0x00, 0xce, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg::msg::dds_::PressSensorState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg::msg::dds_::PressSensorState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg::msg::dds_::PressSensorState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg::msg::dds_::PressSensorState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg::msg::dds_::PressSensorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.pressure()[0], instance.pressure().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.lost())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg::msg::dds_::PressSensorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::PressSensorState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg::msg::dds_::PressSensorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.pressure()[0], instance.pressure().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.lost())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg::msg::dds_::PressSensorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::PressSensorState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg::msg::dds_::PressSensorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.pressure()[0], instance.pressure().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.lost())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg::msg::dds_::PressSensorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::PressSensorState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg::msg::dds_::PressSensorState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.pressure()[0], instance.pressure().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.temperature()[0], instance.temperature().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.lost())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.reserve())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg::msg::dds_::PressSensorState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg::msg::dds_::PressSensorState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_PRESSSENSORSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/hg_doubleimu/doubleIMUState_.hpp b/unitree_SDK/include/unitree/idl/hg_doubleimu/doubleIMUState_.hpp new file mode 100644 index 0000000..9d9f194 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/hg_doubleimu/doubleIMUState_.hpp @@ -0,0 +1,545 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: doubleIMUState_.idl + Source: doubleIMUState_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_HG_DOUBLEIMU_DOUBLEIMUSTATE__HPP +#define DDSCXX_UNITREE_IDL_HG_DOUBLEIMU_DOUBLEIMUSTATE__HPP + +#include +#include + +namespace unitree_hg_doubleimu +{ +namespace msg +{ +namespace dds_ +{ +class doubleIMUState_ +{ +private: + std::array quaternion_ = { }; + std::array gyroscope_ = { }; + std::array accelerometer_ = { }; + std::array rpy_ = { }; + int16_t temperature_ = 0; + uint32_t tick_ = 0; + +public: + doubleIMUState_() = default; + + explicit doubleIMUState_( + const std::array& quaternion, + const std::array& gyroscope, + const std::array& accelerometer, + const std::array& rpy, + int16_t temperature, + uint32_t tick) : + quaternion_(quaternion), + gyroscope_(gyroscope), + accelerometer_(accelerometer), + rpy_(rpy), + temperature_(temperature), + tick_(tick) { } + + const std::array& quaternion() const { return this->quaternion_; } + std::array& quaternion() { return this->quaternion_; } + void quaternion(const std::array& _val_) { this->quaternion_ = _val_; } + void quaternion(std::array&& _val_) { this->quaternion_ = _val_; } + const std::array& gyroscope() const { return this->gyroscope_; } + std::array& gyroscope() { return this->gyroscope_; } + void gyroscope(const std::array& _val_) { this->gyroscope_ = _val_; } + void gyroscope(std::array&& _val_) { this->gyroscope_ = _val_; } + const std::array& accelerometer() const { return this->accelerometer_; } + std::array& accelerometer() { return this->accelerometer_; } + void accelerometer(const std::array& _val_) { this->accelerometer_ = _val_; } + void accelerometer(std::array&& _val_) { this->accelerometer_ = _val_; } + const std::array& rpy() const { return this->rpy_; } + std::array& rpy() { return this->rpy_; } + void rpy(const std::array& _val_) { this->rpy_ = _val_; } + void rpy(std::array&& _val_) { this->rpy_ = _val_; } + int16_t temperature() const { return this->temperature_; } + int16_t& temperature() { return this->temperature_; } + void temperature(int16_t _val_) { this->temperature_ = _val_; } + uint32_t tick() const { return this->tick_; } + uint32_t& tick() { return this->tick_; } + void tick(uint32_t _val_) { this->tick_ = _val_; } + + bool operator==(const doubleIMUState_& _other) const + { + (void) _other; + return quaternion_ == _other.quaternion_ && + gyroscope_ == _other.gyroscope_ && + accelerometer_ == _other.accelerometer_ && + rpy_ == _other.rpy_ && + temperature_ == _other.temperature_ && + tick_ == _other.tick_; + } + + bool operator!=(const doubleIMUState_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>::getTypeName() +{ + return "unitree_hg_doubleimu::msg::dds_::doubleIMUState_"; +} + +template <> constexpr bool TopicTraits<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>::type_map_blob_sz() { return 554; } +template<> constexpr unsigned int TopicTraits<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>::type_map_blob() { + static const uint8_t blob[] = { + 0xbb, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x8b, 0xcc, 0xc5, 0x2b, 0x0f, 0x1a, 0xc2, + 0x5a, 0xa6, 0x45, 0x4a, 0x3f, 0x62, 0x20, 0x00, 0xa3, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x93, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x75, 0xb9, 0xaa, 0xa0, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x6b, 0x3b, 0x2d, 0x85, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x0e, 0x12, + 0x75, 0x69, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0xb0, 0x7d, 0x92, 0xed, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0xee, 0xf4, 0x38, 0xf7, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe5, 0xe5, 0xc0, 0x75, 0x00, + 0x3f, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xd0, 0x8d, 0x00, 0x25, 0xc9, 0x25, 0x90, + 0xdf, 0xc3, 0x06, 0x18, 0x52, 0xa9, 0xf7, 0x00, 0x27, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x68, 0x67, 0x5f, 0x64, 0x6f, 0x75, 0x62, 0x6c, 0x65, 0x69, 0x6d, 0x75, + 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x64, 0x6f, 0x75, + 0x62, 0x6c, 0x65, 0x49, 0x4d, 0x55, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0xdf, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x09, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x71, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x67, 0x79, 0x72, 0x6f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x09, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x6f, + 0x6d, 0x65, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x72, 0x70, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x74, 0x65, 0x6d, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x05, 0x00, 0x00, 0x00, 0x74, 0x69, 0x63, 0x6b, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xd0, 0x8d, 0x00, + 0x25, 0xc9, 0x25, 0x90, 0xdf, 0xc3, 0x06, 0x18, 0x52, 0xa9, 0xf7, 0xf1, 0x8b, 0xcc, 0xc5, 0x2b, + 0x0f, 0x1a, 0xc2, 0x5a, 0xa6, 0x45, 0x4a, 0x3f, 0x62, 0x20, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x8b, 0xcc, 0xc5, 0x2b, 0x0f, 0x1a, 0xc2, 0x5a, 0xa6, 0x45, 0x4a, + 0x3f, 0x62, 0x20, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd0, 0x8d, 0x00, 0x25, 0xc9, 0x25, 0x90, 0xdf, 0xc3, 0x06, 0x18, + 0x52, 0xa9, 0xf7, 0x00, 0x2b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_hg_doubleimu::msg::dds_::doubleIMUState_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_hg_doubleimu::msg::dds_::doubleIMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_hg_doubleimu::msg::dds_::doubleIMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_hg_doubleimu::msg::dds_::doubleIMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_hg_doubleimu::msg::dds_::doubleIMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_hg_doubleimu::msg::dds_::doubleIMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_hg_doubleimu::msg::dds_::doubleIMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_hg_doubleimu::msg::dds_::doubleIMUState_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.quaternion()[0], instance.quaternion().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.gyroscope()[0], instance.gyroscope().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.accelerometer()[0], instance.accelerometer().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.rpy()[0], instance.rpy().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.temperature())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.tick())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_hg_doubleimu::msg::dds_::doubleIMUState_& instance, bool as_key) { + auto &props = get_type_props<::unitree_hg_doubleimu::msg::dds_::doubleIMUState_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_HG_DOUBLEIMU_DOUBLEIMUSTATE__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/Header_.hpp b/unitree_SDK/include/unitree/idl/ros2/Header_.hpp new file mode 100644 index 0000000..8225b8c --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/Header_.hpp @@ -0,0 +1,330 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Header_.idl + Source: Header_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_HEADER__HPP +#define DDSCXX_UNITREE_IDL_ROS2_HEADER__HPP + +#include "unitree/idl/ros2/Time_.hpp" + +#include + +namespace std_msgs +{ +namespace msg +{ +namespace dds_ +{ +class Header_ +{ +private: + ::builtin_interfaces::msg::dds_::Time_ stamp_; + std::string frame_id_; + +public: + Header_() = default; + + explicit Header_( + const ::builtin_interfaces::msg::dds_::Time_& stamp, + const std::string& frame_id) : + stamp_(stamp), + frame_id_(frame_id) { } + + const ::builtin_interfaces::msg::dds_::Time_& stamp() const { return this->stamp_; } + ::builtin_interfaces::msg::dds_::Time_& stamp() { return this->stamp_; } + void stamp(const ::builtin_interfaces::msg::dds_::Time_& _val_) { this->stamp_ = _val_; } + void stamp(::builtin_interfaces::msg::dds_::Time_&& _val_) { this->stamp_ = _val_; } + const std::string& frame_id() const { return this->frame_id_; } + std::string& frame_id() { return this->frame_id_; } + void frame_id(const std::string& _val_) { this->frame_id_ = _val_; } + void frame_id(std::string&& _val_) { this->frame_id_ = _val_; } + + bool operator==(const Header_& _other) const + { + (void) _other; + return stamp_ == _other.stamp_ && + frame_id_ == _other.frame_id_; + } + + bool operator!=(const Header_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::std_msgs::msg::dds_::Header_>::getTypeName() +{ + return "std_msgs::msg::dds_::Header_"; +} + +template <> constexpr bool TopicTraits<::std_msgs::msg::dds_::Header_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::std_msgs::msg::dds_::Header_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::std_msgs::msg::dds_::Header_>::type_map_blob_sz() { return 524; } +template<> constexpr unsigned int TopicTraits<::std_msgs::msg::dds_::Header_>::type_info_blob_sz() { return 148; } +template<> inline const uint8_t * TopicTraits<::std_msgs::msg::dds_::Header_>::type_map_blob() { + static const uint8_t blob[] = { + 0xa3, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, + 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x44, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, + 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, 0x8d, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x4b, 0xb3, 0x9c, 0x5c, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0x00, 0x1a, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, + 0x7b, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1d, 0x00, 0x00, 0x00, 0x73, 0x74, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, + 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, + 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, + 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, + 0x72, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6e, 0x6f, + 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0xf1, + 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0xf2, 0xd4, + 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0xf1, 0x56, 0x7c, + 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::std_msgs::msg::dds_::Header_>::type_info_blob() { + static const uint8_t blob[] = { + 0x90, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, + 0x1f, 0xa3, 0xf2, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, + 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, 0x37, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, + 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x7f, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, + 0x76, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::std_msgs::msg::dds_::Header_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::std_msgs::msg::dds_::Header_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::std_msgs::msg::dds_::Header_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::std_msgs::msg::dds_::Header_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::std_msgs::msg::dds_::Header_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.stamp(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::std_msgs::msg::dds_::Header_& instance, bool as_key) { + auto &props = get_type_props<::std_msgs::msg::dds_::Header_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::std_msgs::msg::dds_::Header_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.stamp(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::std_msgs::msg::dds_::Header_& instance, bool as_key) { + auto &props = get_type_props<::std_msgs::msg::dds_::Header_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::std_msgs::msg::dds_::Header_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.stamp(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::std_msgs::msg::dds_::Header_& instance, bool as_key) { + auto &props = get_type_props<::std_msgs::msg::dds_::Header_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::std_msgs::msg::dds_::Header_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.stamp(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::std_msgs::msg::dds_::Header_& instance, bool as_key) { + auto &props = get_type_props<::std_msgs::msg::dds_::Header_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_HEADER__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/Imu_.hpp b/unitree_SDK/include/unitree/idl/ros2/Imu_.hpp new file mode 100644 index 0000000..47004b5 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/Imu_.hpp @@ -0,0 +1,672 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Imu_.idl + Source: Imu_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_IMU__HPP +#define DDSCXX_UNITREE_IDL_ROS2_IMU__HPP + +#include "unitree/idl/ros2/Quaternion_.hpp" + +#include "unitree/idl/ros2/Vector3_.hpp" + +#include "unitree/idl/ros2/Header_.hpp" + +#include + +namespace sensor_msgs +{ +namespace msg +{ +namespace dds_ +{ +class Imu_ +{ +private: + ::std_msgs::msg::dds_::Header_ header_; + ::geometry_msgs::msg::dds_::Quaternion_ orientation_; + std::array orientation_covariance_ = { }; + ::geometry_msgs::msg::dds_::Vector3_ angular_velocity_; + std::array angular_velocity_covariance_ = { }; + ::geometry_msgs::msg::dds_::Vector3_ linear_acceleration_; + std::array linear_acceleration_covariance_ = { }; + +public: + Imu_() = default; + + explicit Imu_( + const ::std_msgs::msg::dds_::Header_& header, + const ::geometry_msgs::msg::dds_::Quaternion_& orientation, + const std::array& orientation_covariance, + const ::geometry_msgs::msg::dds_::Vector3_& angular_velocity, + const std::array& angular_velocity_covariance, + const ::geometry_msgs::msg::dds_::Vector3_& linear_acceleration, + const std::array& linear_acceleration_covariance) : + header_(header), + orientation_(orientation), + orientation_covariance_(orientation_covariance), + angular_velocity_(angular_velocity), + angular_velocity_covariance_(angular_velocity_covariance), + linear_acceleration_(linear_acceleration), + linear_acceleration_covariance_(linear_acceleration_covariance) { } + + const ::std_msgs::msg::dds_::Header_& header() const { return this->header_; } + ::std_msgs::msg::dds_::Header_& header() { return this->header_; } + void header(const ::std_msgs::msg::dds_::Header_& _val_) { this->header_ = _val_; } + void header(::std_msgs::msg::dds_::Header_&& _val_) { this->header_ = _val_; } + const ::geometry_msgs::msg::dds_::Quaternion_& orientation() const { return this->orientation_; } + ::geometry_msgs::msg::dds_::Quaternion_& orientation() { return this->orientation_; } + void orientation(const ::geometry_msgs::msg::dds_::Quaternion_& _val_) { this->orientation_ = _val_; } + void orientation(::geometry_msgs::msg::dds_::Quaternion_&& _val_) { this->orientation_ = _val_; } + const std::array& orientation_covariance() const { return this->orientation_covariance_; } + std::array& orientation_covariance() { return this->orientation_covariance_; } + void orientation_covariance(const std::array& _val_) { this->orientation_covariance_ = _val_; } + void orientation_covariance(std::array&& _val_) { this->orientation_covariance_ = _val_; } + const ::geometry_msgs::msg::dds_::Vector3_& angular_velocity() const { return this->angular_velocity_; } + ::geometry_msgs::msg::dds_::Vector3_& angular_velocity() { return this->angular_velocity_; } + void angular_velocity(const ::geometry_msgs::msg::dds_::Vector3_& _val_) { this->angular_velocity_ = _val_; } + void angular_velocity(::geometry_msgs::msg::dds_::Vector3_&& _val_) { this->angular_velocity_ = _val_; } + const std::array& angular_velocity_covariance() const { return this->angular_velocity_covariance_; } + std::array& angular_velocity_covariance() { return this->angular_velocity_covariance_; } + void angular_velocity_covariance(const std::array& _val_) { this->angular_velocity_covariance_ = _val_; } + void angular_velocity_covariance(std::array&& _val_) { this->angular_velocity_covariance_ = _val_; } + const ::geometry_msgs::msg::dds_::Vector3_& linear_acceleration() const { return this->linear_acceleration_; } + ::geometry_msgs::msg::dds_::Vector3_& linear_acceleration() { return this->linear_acceleration_; } + void linear_acceleration(const ::geometry_msgs::msg::dds_::Vector3_& _val_) { this->linear_acceleration_ = _val_; } + void linear_acceleration(::geometry_msgs::msg::dds_::Vector3_&& _val_) { this->linear_acceleration_ = _val_; } + const std::array& linear_acceleration_covariance() const { return this->linear_acceleration_covariance_; } + std::array& linear_acceleration_covariance() { return this->linear_acceleration_covariance_; } + void linear_acceleration_covariance(const std::array& _val_) { this->linear_acceleration_covariance_ = _val_; } + void linear_acceleration_covariance(std::array&& _val_) { this->linear_acceleration_covariance_ = _val_; } + + bool operator==(const Imu_& _other) const + { + (void) _other; + return header_ == _other.header_ && + orientation_ == _other.orientation_ && + orientation_covariance_ == _other.orientation_covariance_ && + angular_velocity_ == _other.angular_velocity_ && + angular_velocity_covariance_ == _other.angular_velocity_covariance_ && + linear_acceleration_ == _other.linear_acceleration_ && + linear_acceleration_covariance_ == _other.linear_acceleration_covariance_; + } + + bool operator!=(const Imu_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::sensor_msgs::msg::dds_::Imu_>::getTypeName() +{ + return "sensor_msgs::msg::dds_::Imu_"; +} + +template <> constexpr bool TopicTraits<::sensor_msgs::msg::dds_::Imu_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::sensor_msgs::msg::dds_::Imu_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::sensor_msgs::msg::dds_::Imu_>::type_map_blob_sz() { return 1814; } +template<> constexpr unsigned int TopicTraits<::sensor_msgs::msg::dds_::Imu_>::type_info_blob_sz() { return 292; } +template<> inline const uint8_t * TopicTraits<::sensor_msgs::msg::dds_::Imu_>::type_map_blob() { + static const uint8_t blob[] = { + 0x5f, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf1, 0xd4, 0xf9, 0x81, 0x03, 0x5a, 0x0e, 0xd7, + 0x22, 0x6a, 0xd9, 0xb4, 0x81, 0xee, 0xcf, 0x00, 0xe6, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, + 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, + 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0xda, 0x16, 0x39, 0x42, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x09, 0x0a, 0x77, 0xf3, 0x0b, 0x71, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, + 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x58, 0x1e, 0xf3, 0x6e, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x09, 0x0a, 0xe6, 0x5c, 0x0b, 0xa5, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, + 0xbc, 0x1c, 0x0c, 0x95, 0xca, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x0a, 0xcb, 0x0e, + 0x14, 0xbf, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, + 0xf2, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, + 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, 0x8d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x4b, 0xb3, 0x9c, 0x5c, 0xf1, 0x56, 0x7c, 0x5a, + 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, 0x33, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, + 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, + 0x04, 0x64, 0xd5, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, + 0x62, 0xa1, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xf1, 0x29, 0x01, 0x86, 0xf1, 0x5e, 0x73, 0x97, 0xe7, + 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, + 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, + 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, + 0xad, 0xe9, 0xe3, 0x00, 0x10, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf2, 0x29, 0xbf, 0xf9, + 0x05, 0xfe, 0xca, 0x04, 0x21, 0xfc, 0x4f, 0x4e, 0x24, 0x64, 0xd8, 0x00, 0xb1, 0x01, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, + 0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, + 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x49, 0x6d, 0x75, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x7d, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, + 0x55, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x6f, + 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x6f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x0a, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x6f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x76, 0x61, + 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, + 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x61, 0x6e, 0x67, 0x75, + 0x6c, 0x61, 0x72, 0x5f, 0x76, 0x65, 0x6c, 0x6f, 0x63, 0x69, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x09, 0x0a, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x61, 0x6e, 0x67, 0x75, + 0x6c, 0x61, 0x72, 0x5f, 0x76, 0x65, 0x6c, 0x6f, 0x63, 0x69, 0x74, 0x79, 0x5f, 0x63, 0x6f, 0x76, + 0x61, 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, + 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x6c, 0x69, 0x6e, 0x65, + 0x61, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x09, 0x0a, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x00, 0x00, + 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, + 0x7b, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1d, 0x00, 0x00, 0x00, 0x73, 0x74, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, + 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, + 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, + 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, + 0x72, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6e, 0x6f, + 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, + 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x51, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, + 0x5f, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0xf2, 0xac, 0xe2, 0x5e, + 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x78, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, + 0x33, 0x5f, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0xf2, 0x29, 0xbf, 0xf9, 0x05, 0xfe, 0xca, 0x04, 0x21, 0xfc, 0x4f, 0x4e, 0x24, 0x64, 0xd8, 0xf1, + 0xd4, 0xf9, 0x81, 0x03, 0x5a, 0x0e, 0xd7, 0x22, 0x6a, 0xd9, 0xb4, 0x81, 0xee, 0xcf, 0xf2, 0xe5, + 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0xf1, 0xdc, 0xf1, + 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0xf2, 0xd4, 0x85, 0x4f, + 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0xf1, 0x56, 0x7c, 0x5a, 0x93, + 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, + 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, + 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, + 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, + 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::sensor_msgs::msg::dds_::Imu_>::type_info_blob() { + static const uint8_t blob[] = { + 0x20, 0x01, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x88, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xd4, 0xf9, 0x81, 0x03, 0x5a, 0x0e, 0xd7, 0x22, 0x6a, 0xd9, 0xb4, + 0x81, 0xee, 0xcf, 0x00, 0xea, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, + 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x48, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, + 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, 0x57, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, + 0x47, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x88, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x29, 0xbf, 0xf9, 0x05, 0xfe, 0xca, 0x04, 0x21, 0xfc, 0x4f, 0x4e, + 0x24, 0x64, 0xd8, 0x00, 0xb5, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, + 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, + 0x76, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, + 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x94, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, + 0x7c, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::sensor_msgs::msg::dds_::Imu_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::sensor_msgs::msg::dds_::Imu_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::sensor_msgs::msg::dds_::Imu_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::sensor_msgs::msg::dds_::Imu_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::sensor_msgs::msg::dds_::Imu_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.orientation(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.orientation_covariance()[0], instance.orientation_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.angular_velocity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.angular_velocity_covariance()[0], instance.angular_velocity_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.linear_acceleration(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.linear_acceleration_covariance()[0], instance.linear_acceleration_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::sensor_msgs::msg::dds_::Imu_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::Imu_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::sensor_msgs::msg::dds_::Imu_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.orientation(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.orientation_covariance()[0], instance.orientation_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.angular_velocity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.angular_velocity_covariance()[0], instance.angular_velocity_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.linear_acceleration(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.linear_acceleration_covariance()[0], instance.linear_acceleration_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::sensor_msgs::msg::dds_::Imu_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::Imu_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::sensor_msgs::msg::dds_::Imu_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.orientation(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.orientation_covariance()[0], instance.orientation_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.angular_velocity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.angular_velocity_covariance()[0], instance.angular_velocity_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.linear_acceleration(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.linear_acceleration_covariance()[0], instance.linear_acceleration_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::sensor_msgs::msg::dds_::Imu_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::Imu_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::sensor_msgs::msg::dds_::Imu_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.orientation(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.orientation_covariance()[0], instance.orientation_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.angular_velocity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.angular_velocity_covariance()[0], instance.angular_velocity_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.linear_acceleration(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.linear_acceleration_covariance()[0], instance.linear_acceleration_covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::sensor_msgs::msg::dds_::Imu_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::Imu_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_IMU__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/MapMetaData_.hpp b/unitree_SDK/include/unitree/idl/ros2/MapMetaData_.hpp new file mode 100644 index 0000000..f450113 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/MapMetaData_.hpp @@ -0,0 +1,517 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: MapMetaData_.idl + Source: MapMetaData_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_MAPMETADATA__HPP +#define DDSCXX_UNITREE_IDL_ROS2_MAPMETADATA__HPP + +#include "unitree/idl/ros2/Time_.hpp" + +#include "unitree/idl/ros2/Pose_.hpp" + +#include + +namespace nav_msgs +{ +namespace msg +{ +namespace dds_ +{ +class MapMetaData_ +{ +private: + ::builtin_interfaces::msg::dds_::Time_ map_load_time_; + float resolution_ = 0.0f; + uint32_t width_ = 0; + uint32_t height_ = 0; + ::geometry_msgs::msg::dds_::Pose_ origin_; + +public: + MapMetaData_() = default; + + explicit MapMetaData_( + const ::builtin_interfaces::msg::dds_::Time_& map_load_time, + float resolution, + uint32_t width, + uint32_t height, + const ::geometry_msgs::msg::dds_::Pose_& origin) : + map_load_time_(map_load_time), + resolution_(resolution), + width_(width), + height_(height), + origin_(origin) { } + + const ::builtin_interfaces::msg::dds_::Time_& map_load_time() const { return this->map_load_time_; } + ::builtin_interfaces::msg::dds_::Time_& map_load_time() { return this->map_load_time_; } + void map_load_time(const ::builtin_interfaces::msg::dds_::Time_& _val_) { this->map_load_time_ = _val_; } + void map_load_time(::builtin_interfaces::msg::dds_::Time_&& _val_) { this->map_load_time_ = _val_; } + float resolution() const { return this->resolution_; } + float& resolution() { return this->resolution_; } + void resolution(float _val_) { this->resolution_ = _val_; } + uint32_t width() const { return this->width_; } + uint32_t& width() { return this->width_; } + void width(uint32_t _val_) { this->width_ = _val_; } + uint32_t height() const { return this->height_; } + uint32_t& height() { return this->height_; } + void height(uint32_t _val_) { this->height_ = _val_; } + const ::geometry_msgs::msg::dds_::Pose_& origin() const { return this->origin_; } + ::geometry_msgs::msg::dds_::Pose_& origin() { return this->origin_; } + void origin(const ::geometry_msgs::msg::dds_::Pose_& _val_) { this->origin_ = _val_; } + void origin(::geometry_msgs::msg::dds_::Pose_&& _val_) { this->origin_ = _val_; } + + bool operator==(const MapMetaData_& _other) const + { + (void) _other; + return map_load_time_ == _other.map_load_time_ && + resolution_ == _other.resolution_ && + width_ == _other.width_ && + height_ == _other.height_ && + origin_ == _other.origin_; + } + + bool operator!=(const MapMetaData_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::nav_msgs::msg::dds_::MapMetaData_>::getTypeName() +{ + return "nav_msgs::msg::dds_::MapMetaData_"; +} + +template <> constexpr bool TopicTraits<::nav_msgs::msg::dds_::MapMetaData_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::nav_msgs::msg::dds_::MapMetaData_>::type_map_blob_sz() { return 1546; } +template<> constexpr unsigned int TopicTraits<::nav_msgs::msg::dds_::MapMetaData_>::type_info_blob_sz() { return 292; } +template<> inline const uint8_t * TopicTraits<::nav_msgs::msg::dds_::MapMetaData_>::type_map_blob() { + static const uint8_t blob[] = { + 0x03, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf1, 0x07, 0x57, 0xb7, 0x09, 0xbd, 0x5c, 0x8d, + 0x18, 0x8f, 0x00, 0x60, 0x94, 0x68, 0x47, 0x00, 0x81, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, + 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x66, 0x5b, 0xc6, 0xd3, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xb7, 0xe1, 0x64, 0xb3, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xea, 0xae, 0x26, 0xa6, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xb4, 0x35, 0xe2, 0x27, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, + 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x7c, 0x49, 0xb1, 0x53, 0xf1, 0x56, 0x7c, + 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x33, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, + 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, + 0x04, 0x64, 0xd5, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, + 0x17, 0xeb, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, + 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x47, 0x57, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, + 0x86, 0x46, 0xa9, 0x62, 0xa1, 0xda, 0x16, 0x39, 0x42, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, + 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0xf1, + 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, 0x00, + 0x53, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x43, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0xf1, 0x29, 0x01, 0x86, 0x00, 0x60, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0xf2, 0xaf, 0xf2, 0xbe, 0x67, 0xdd, 0x8e, 0x1b, 0x5c, 0x8c, 0x51, 0x02, 0x52, 0xab, 0x2d, 0x00, + 0xe9, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x76, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, + 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, 0x61, 0x70, 0x4d, 0x65, 0x74, 0x61, + 0x44, 0x61, 0x74, 0x61, 0x5f, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, + 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x6d, 0x61, 0x70, 0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x77, 0x69, 0x64, 0x74, 0x68, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x0d, + 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, + 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x72, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, + 0x69, 0x6d, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x00, + 0x00, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, + 0x7d, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, + 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x5f, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, + 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, + 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x6f, 0x72, 0x69, 0x65, + 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, + 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, + 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x90, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x51, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, + 0x5f, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0xf2, 0xaf, 0xf2, 0xbe, 0x67, 0xdd, 0x8e, 0x1b, 0x5c, 0x8c, 0x51, 0x02, + 0x52, 0xab, 0x2d, 0xf1, 0x07, 0x57, 0xb7, 0x09, 0xbd, 0x5c, 0x8d, 0x18, 0x8f, 0x00, 0x60, 0x94, + 0x68, 0x47, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, + 0x0d, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, + 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0xf1, + 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0xf2, 0x04, + 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0xf1, 0x5e, 0x73, + 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0xf2, 0x6f, 0x01, 0xea, + 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, + 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::nav_msgs::msg::dds_::MapMetaData_>::type_info_blob() { + static const uint8_t blob[] = { + 0x20, 0x01, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x88, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x07, 0x57, 0xb7, 0x09, 0xbd, 0x5c, 0x8d, 0x18, 0x8f, 0x00, 0x60, + 0x94, 0x68, 0x47, 0x00, 0x85, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, + 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x00, + 0x55, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, + 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x47, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x88, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xaf, 0xf2, 0xbe, 0x67, 0xdd, 0x8e, 0x1b, 0x5c, 0x8c, 0x51, 0x02, + 0x52, 0xab, 0x2d, 0x00, 0xed, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, + 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x76, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x00, + 0x96, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, + 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, + 0x94, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::nav_msgs::msg::dds_::MapMetaData_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::nav_msgs::msg::dds_::MapMetaData_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::nav_msgs::msg::dds_::MapMetaData_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::nav_msgs::msg::dds_::MapMetaData_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::nav_msgs::msg::dds_::MapMetaData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.map_load_time(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.origin(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::nav_msgs::msg::dds_::MapMetaData_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::MapMetaData_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::nav_msgs::msg::dds_::MapMetaData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.map_load_time(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.origin(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::nav_msgs::msg::dds_::MapMetaData_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::MapMetaData_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::nav_msgs::msg::dds_::MapMetaData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.map_load_time(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.origin(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::nav_msgs::msg::dds_::MapMetaData_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::MapMetaData_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::nav_msgs::msg::dds_::MapMetaData_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.map_load_time(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.resolution())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.origin(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::nav_msgs::msg::dds_::MapMetaData_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::MapMetaData_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_MAPMETADATA__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/OccupancyGrid_.hpp b/unitree_SDK/include/unitree/idl/ros2/OccupancyGrid_.hpp new file mode 100644 index 0000000..518eb5c --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/OccupancyGrid_.hpp @@ -0,0 +1,532 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: OccupancyGrid_.idl + Source: OccupancyGrid_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_OCCUPANCYGRID__HPP +#define DDSCXX_UNITREE_IDL_ROS2_OCCUPANCYGRID__HPP + +#include "unitree/idl/ros2/MapMetaData_.hpp" + +#include "unitree/idl/ros2/Header_.hpp" + +#include +#include + +namespace nav_msgs +{ +namespace msg +{ +namespace dds_ +{ +class OccupancyGrid_ +{ +private: + ::std_msgs::msg::dds_::Header_ header_; + ::nav_msgs::msg::dds_::MapMetaData_ info_; + std::vector data_; + +public: + OccupancyGrid_() = default; + + explicit OccupancyGrid_( + const ::std_msgs::msg::dds_::Header_& header, + const ::nav_msgs::msg::dds_::MapMetaData_& info, + const std::vector& data) : + header_(header), + info_(info), + data_(data) { } + + const ::std_msgs::msg::dds_::Header_& header() const { return this->header_; } + ::std_msgs::msg::dds_::Header_& header() { return this->header_; } + void header(const ::std_msgs::msg::dds_::Header_& _val_) { this->header_ = _val_; } + void header(::std_msgs::msg::dds_::Header_&& _val_) { this->header_ = _val_; } + const ::nav_msgs::msg::dds_::MapMetaData_& info() const { return this->info_; } + ::nav_msgs::msg::dds_::MapMetaData_& info() { return this->info_; } + void info(const ::nav_msgs::msg::dds_::MapMetaData_& _val_) { this->info_ = _val_; } + void info(::nav_msgs::msg::dds_::MapMetaData_&& _val_) { this->info_ = _val_; } + const std::vector& data() const { return this->data_; } + std::vector& data() { return this->data_; } + void data(const std::vector& _val_) { this->data_ = _val_; } + void data(std::vector&& _val_) { this->data_ = _val_; } + + bool operator==(const OccupancyGrid_& _other) const + { + (void) _other; + return header_ == _other.header_ && + info_ == _other.info_ && + data_ == _other.data_; + } + + bool operator!=(const OccupancyGrid_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::nav_msgs::msg::dds_::OccupancyGrid_>::getTypeName() +{ + return "nav_msgs::msg::dds_::OccupancyGrid_"; +} + +template <> constexpr bool TopicTraits<::nav_msgs::msg::dds_::OccupancyGrid_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::nav_msgs::msg::dds_::OccupancyGrid_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::nav_msgs::msg::dds_::OccupancyGrid_>::type_map_blob_sz() { return 2154; } +template<> constexpr unsigned int TopicTraits<::nav_msgs::msg::dds_::OccupancyGrid_>::type_info_blob_sz() { return 388; } +template<> inline const uint8_t * TopicTraits<::nav_msgs::msg::dds_::OccupancyGrid_>::type_map_blob() { + static const uint8_t blob[] = { + 0xd7, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf1, 0xa6, 0x7a, 0x91, 0x75, 0x57, 0xcb, 0x8b, + 0xe9, 0x7b, 0x12, 0x9d, 0x77, 0xb3, 0xfd, 0x00, 0x68, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, + 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x07, 0x57, 0xb7, 0x09, 0xbd, + 0x5c, 0x8d, 0x18, 0x8f, 0x00, 0x60, 0x94, 0x68, 0x47, 0xca, 0xf9, 0xb6, 0xb9, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, + 0x8d, 0x77, 0x7f, 0x38, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, + 0x1f, 0xa3, 0xf2, 0x00, 0x44, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, + 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, 0x8d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x4b, 0xb3, 0x9c, 0x5c, 0xf1, 0x56, 0x7c, 0x5a, + 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, 0x33, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, + 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, + 0x04, 0x64, 0xd5, 0xf1, 0x07, 0x57, 0xb7, 0x09, 0xbd, 0x5c, 0x8d, 0x18, 0x8f, 0x00, 0x60, 0x94, + 0x68, 0x47, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, + 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x66, 0x5b, 0xc6, 0xd3, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xb7, 0xe1, 0x64, 0xb3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xea, 0xae, 0x26, 0xa6, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xb4, 0x35, 0xe2, 0x27, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, + 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x7c, 0x49, 0xb1, 0x53, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, + 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, + 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x47, 0x57, 0xfe, 0x07, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, + 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0xda, 0x16, 0x39, 0x42, 0xf1, 0x5e, 0x73, + 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x43, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, + 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, + 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, + 0xad, 0xe9, 0xe3, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, + 0x62, 0xa1, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xf1, 0x29, 0x01, 0x86, 0x00, 0xb0, 0x04, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0xf2, 0x9b, 0xfe, 0xf8, 0xd1, 0x93, 0x3f, 0x26, 0x1c, 0xef, 0x1f, 0x33, + 0xfd, 0x62, 0x89, 0x00, 0xab, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x76, 0x5f, 0x6d, 0x73, 0x67, 0x73, + 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4f, 0x63, 0x63, + 0x75, 0x70, 0x61, 0x6e, 0x63, 0x79, 0x47, 0x72, 0x69, 0x64, 0x5f, 0x00, 0x73, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xe5, + 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xaf, 0xf2, 0xbe, 0x67, 0xdd, + 0x8e, 0x1b, 0x5c, 0x8c, 0x51, 0x02, 0x52, 0xab, 0x2d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x69, 0x6e, 0x66, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x00, 0x64, 0x61, 0x74, 0x61, + 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, + 0x2a, 0x55, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x73, 0x74, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x73, + 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, + 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x70, 0x00, 0x09, 0x00, 0x00, 0x00, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, + 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, + 0x32, 0x0d, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x5f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0xf2, 0xaf, 0xf2, 0xbe, 0x67, 0xdd, + 0x8e, 0x1b, 0x5c, 0x8c, 0x51, 0x02, 0x52, 0xab, 0x2d, 0x00, 0x00, 0x00, 0xe9, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x6e, 0x61, 0x76, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, + 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4d, 0x61, 0x70, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, + 0x5f, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, + 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x70, 0x5f, + 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x72, 0x65, 0x73, 0x6f, + 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00, 0x77, 0x69, 0x64, 0x74, + 0x68, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, + 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x00, 0x00, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, + 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x92, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x5f, 0x00, 0x5e, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x04, + 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, + 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, + 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x6f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0xf2, 0x04, + 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, + 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, + 0x69, 0x6e, 0x74, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, + 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x90, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x51, 0x75, 0x61, 0x74, 0x65, 0x72, + 0x6e, 0x69, 0x6f, 0x6e, 0x5f, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, + 0xd6, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf2, 0x9b, 0xfe, 0xf8, 0xd1, 0x93, 0x3f, 0x26, + 0x1c, 0xef, 0x1f, 0x33, 0xfd, 0x62, 0x89, 0xf1, 0xa6, 0x7a, 0x91, 0x75, 0x57, 0xcb, 0x8b, 0xe9, + 0x7b, 0x12, 0x9d, 0x77, 0xb3, 0xfd, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, + 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, + 0xe5, 0x1f, 0xa3, 0xf2, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, + 0xe6, 0x32, 0x0d, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, + 0xf9, 0x8d, 0xf2, 0xaf, 0xf2, 0xbe, 0x67, 0xdd, 0x8e, 0x1b, 0x5c, 0x8c, 0x51, 0x02, 0x52, 0xab, + 0x2d, 0xf1, 0x07, 0x57, 0xb7, 0x09, 0xbd, 0x5c, 0x8d, 0x18, 0x8f, 0x00, 0x60, 0x94, 0x68, 0x47, + 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0xf1, + 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0xf2, 0x04, + 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0xf1, 0x5e, 0x73, + 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0xf2, 0x6f, 0x01, 0xea, + 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, + 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::nav_msgs::msg::dds_::OccupancyGrid_>::type_info_blob() { + static const uint8_t blob[] = { + 0x80, 0x01, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0xb8, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xa6, 0x7a, 0x91, 0x75, 0x57, 0xcb, 0x8b, 0xe9, 0x7b, 0x12, 0x9d, + 0x77, 0xb3, 0xfd, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, + 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x48, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x07, 0x57, 0xb7, 0x09, 0xbd, 0x5c, 0x8d, + 0x18, 0x8f, 0x00, 0x60, 0x94, 0x68, 0x47, 0x00, 0x85, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x00, + 0x55, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, + 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x47, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0xb8, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x9b, 0xfe, 0xf8, 0xd1, 0x93, 0x3f, 0x26, 0x1c, 0xef, 0x1f, 0x33, + 0xfd, 0x62, 0x89, 0x00, 0xaf, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, + 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, + 0x76, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xaf, 0xf2, 0xbe, 0x67, 0xdd, 0x8e, 0x1b, + 0x5c, 0x8c, 0x51, 0x02, 0x52, 0xab, 0x2d, 0x00, 0xed, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x00, + 0x96, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, + 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, + 0x94, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::nav_msgs::msg::dds_::OccupancyGrid_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::nav_msgs::msg::dds_::OccupancyGrid_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::nav_msgs::msg::dds_::OccupancyGrid_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::nav_msgs::msg::dds_::OccupancyGrid_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::nav_msgs::msg::dds_::OccupancyGrid_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.info(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!write(streamer, se_1)) + return false; + if (se_1 > 0 && + !write(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::nav_msgs::msg::dds_::OccupancyGrid_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::OccupancyGrid_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::nav_msgs::msg::dds_::OccupancyGrid_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.info(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!read(streamer, se_1)) + return false; + instance.data().resize(se_1); + if (se_1 > 0 && + !read(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::nav_msgs::msg::dds_::OccupancyGrid_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::OccupancyGrid_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::nav_msgs::msg::dds_::OccupancyGrid_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.info(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!move(streamer, se_1)) + return false; + if (se_1 > 0 && + !move(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::nav_msgs::msg::dds_::OccupancyGrid_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::OccupancyGrid_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::nav_msgs::msg::dds_::OccupancyGrid_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.info(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + if (se_1 > 0 && + !max(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::nav_msgs::msg::dds_::OccupancyGrid_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::OccupancyGrid_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_OCCUPANCYGRID__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/Odometry_.hpp b/unitree_SDK/include/unitree/idl/ros2/Odometry_.hpp new file mode 100644 index 0000000..e5aea5c --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/Odometry_.hpp @@ -0,0 +1,588 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Odometry_.idl + Source: Odometry_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_ODOMETRY__HPP +#define DDSCXX_UNITREE_IDL_ROS2_ODOMETRY__HPP + +#include "unitree/idl/ros2/PoseWithCovariance_.hpp" + +#include "unitree/idl/ros2/TwistWithCovariance_.hpp" + +#include "unitree/idl/ros2/Header_.hpp" + +#include + +namespace nav_msgs +{ +namespace msg +{ +namespace dds_ +{ +class Odometry_ +{ +private: + ::std_msgs::msg::dds_::Header_ header_; + std::string child_frame_id_; + ::geometry_msgs::msg::dds_::PoseWithCovariance_ pose_; + ::geometry_msgs::msg::dds_::TwistWithCovariance_ twist_; + +public: + Odometry_() = default; + + explicit Odometry_( + const ::std_msgs::msg::dds_::Header_& header, + const std::string& child_frame_id, + const ::geometry_msgs::msg::dds_::PoseWithCovariance_& pose, + const ::geometry_msgs::msg::dds_::TwistWithCovariance_& twist) : + header_(header), + child_frame_id_(child_frame_id), + pose_(pose), + twist_(twist) { } + + const ::std_msgs::msg::dds_::Header_& header() const { return this->header_; } + ::std_msgs::msg::dds_::Header_& header() { return this->header_; } + void header(const ::std_msgs::msg::dds_::Header_& _val_) { this->header_ = _val_; } + void header(::std_msgs::msg::dds_::Header_&& _val_) { this->header_ = _val_; } + const std::string& child_frame_id() const { return this->child_frame_id_; } + std::string& child_frame_id() { return this->child_frame_id_; } + void child_frame_id(const std::string& _val_) { this->child_frame_id_ = _val_; } + void child_frame_id(std::string&& _val_) { this->child_frame_id_ = _val_; } + const ::geometry_msgs::msg::dds_::PoseWithCovariance_& pose() const { return this->pose_; } + ::geometry_msgs::msg::dds_::PoseWithCovariance_& pose() { return this->pose_; } + void pose(const ::geometry_msgs::msg::dds_::PoseWithCovariance_& _val_) { this->pose_ = _val_; } + void pose(::geometry_msgs::msg::dds_::PoseWithCovariance_&& _val_) { this->pose_ = _val_; } + const ::geometry_msgs::msg::dds_::TwistWithCovariance_& twist() const { return this->twist_; } + ::geometry_msgs::msg::dds_::TwistWithCovariance_& twist() { return this->twist_; } + void twist(const ::geometry_msgs::msg::dds_::TwistWithCovariance_& _val_) { this->twist_ = _val_; } + void twist(::geometry_msgs::msg::dds_::TwistWithCovariance_&& _val_) { this->twist_ = _val_; } + + bool operator==(const Odometry_& _other) const + { + (void) _other; + return header_ == _other.header_ && + child_frame_id_ == _other.child_frame_id_ && + pose_ == _other.pose_ && + twist_ == _other.twist_; + } + + bool operator!=(const Odometry_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::nav_msgs::msg::dds_::Odometry_>::getTypeName() +{ + return "nav_msgs::msg::dds_::Odometry_"; +} + +template <> constexpr bool TopicTraits<::nav_msgs::msg::dds_::Odometry_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::nav_msgs::msg::dds_::Odometry_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::nav_msgs::msg::dds_::Odometry_>::type_map_blob_sz() { return 2952; } +template<> constexpr unsigned int TopicTraits<::nav_msgs::msg::dds_::Odometry_>::type_info_blob_sz() { return 508; } +template<> inline const uint8_t * TopicTraits<::nav_msgs::msg::dds_::Odometry_>::type_map_blob() { + static const uint8_t blob[] = { + 0xdf, 0x03, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf1, 0x09, 0x05, 0x85, 0xef, 0x1f, 0x33, 0xdc, + 0x43, 0x45, 0xaf, 0xc8, 0x7d, 0x2b, 0x18, 0x00, 0x81, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, + 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x8d, 0x9f, 0x65, 0x1d, + 0x19, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xb7, 0xb7, 0x26, 0xac, 0x8e, + 0x3d, 0x19, 0x1d, 0xc5, 0x32, 0xa3, 0x3c, 0x52, 0xc9, 0x2d, 0x5f, 0x8a, 0xe9, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x40, 0xaa, 0x70, 0xe1, 0xf7, + 0x44, 0x45, 0x66, 0x8e, 0xcd, 0x3e, 0x4a, 0x4b, 0xa6, 0xeb, 0x3b, 0xac, 0x16, 0xf1, 0xdc, 0xf1, + 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x44, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, + 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, + 0x8d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x4b, 0xb3, 0x9c, 0x5c, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, + 0x46, 0xf9, 0x8d, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0xf1, 0xb7, 0xb7, 0x26, 0xac, + 0x8e, 0x3d, 0x19, 0x1d, 0xc5, 0x32, 0xa3, 0x3c, 0x52, 0xc9, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2f, + 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x2d, 0x5f, 0x8a, + 0xe9, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x0a, 0xac, 0xdb, 0x06, 0x55, 0xf1, 0x2f, + 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x00, 0x00, 0x00, + 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, + 0xbc, 0x47, 0x57, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, + 0xa1, 0xda, 0x16, 0x39, 0x42, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, + 0x76, 0xcd, 0x4c, 0xbc, 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, + 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, + 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, + 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, + 0xad, 0xe9, 0xe3, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xf1, + 0x29, 0x01, 0x86, 0xf1, 0x40, 0xaa, 0x70, 0xe1, 0xf7, 0x44, 0x45, 0x66, 0x8e, 0xcd, 0x3e, 0x4a, + 0x4b, 0xa6, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, 0x84, 0x6f, + 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0xeb, 0x3b, 0xac, 0x16, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x24, 0x0a, 0xac, 0xdb, 0x06, 0x55, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, 0x84, 0x6f, + 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, + 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x9a, 0x93, 0x2b, 0x3c, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, + 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0xd1, 0x8b, 0x86, 0x24, 0xf1, 0x5e, 0x73, + 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x43, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, + 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, + 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, + 0xad, 0xe9, 0xe3, 0x00, 0x6c, 0x06, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf2, 0xc9, 0xe4, 0x81, + 0x30, 0x36, 0xe7, 0x83, 0xf6, 0x0b, 0x54, 0x7c, 0xee, 0x4e, 0x2f, 0x00, 0xd8, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, + 0x6e, 0x61, 0x76, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, + 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x4f, 0x64, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x00, 0x00, + 0xa4, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, + 0x55, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, + 0x69, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0x19, 0x12, 0x04, 0x8a, 0x82, 0xed, 0x6f, 0x0a, 0x49, 0x06, 0x5e, 0x94, 0xe7, + 0x0c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xf5, 0xc6, 0x39, 0xf6, 0x33, + 0xf1, 0x5a, 0x6d, 0x7b, 0xe3, 0xa4, 0x7b, 0x7e, 0x15, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x74, 0x77, 0x69, 0x73, 0x74, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, + 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x73, 0x74, 0x64, 0x5f, + 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, + 0x3a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, + 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x09, 0x00, 0x00, 0x00, 0x66, 0x72, 0x61, 0x6d, + 0x65, 0x5f, 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, + 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x62, 0x75, 0x69, 0x6c, + 0x74, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0xf2, 0x19, + 0x12, 0x04, 0x8a, 0x82, 0xed, 0x6f, 0x0a, 0x49, 0x06, 0x5e, 0x94, 0xe7, 0x0c, 0x00, 0x00, 0x00, + 0x99, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2e, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, + 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, + 0x73, 0x65, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, + 0x5f, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, + 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x0a, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x63, 0x6f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0xf2, 0x0d, 0x47, + 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x92, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x5f, 0x00, + 0x5e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, + 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x6f, + 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x6f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, + 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, + 0xdf, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, + 0x3a, 0x3a, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, + 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, + 0x90, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x26, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, + 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x51, 0x75, + 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, 0x5f, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x77, 0x00, 0x00, 0x00, 0xf2, 0xf5, 0xc6, 0x39, 0xf6, 0x33, 0xf1, 0x5a, 0x6d, 0x7b, 0xe3, 0xa4, + 0x7b, 0x7e, 0x15, 0x00, 0x99, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x37, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, + 0x3a, 0x3a, 0x54, 0x77, 0x69, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, 0x76, 0x61, 0x72, + 0x69, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, + 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x74, 0x77, 0x69, 0x73, 0x74, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x0a, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x00, 0x00, + 0x00, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, + 0x92, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, + 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x77, + 0x69, 0x73, 0x74, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, + 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, + 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x61, 0x6e, 0x67, 0x75, + 0x6c, 0x61, 0x72, 0x00, 0x00, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, + 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x33, 0x5f, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x7a, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0xf2, 0xc9, 0xe4, 0x81, + 0x30, 0x36, 0xe7, 0x83, 0xf6, 0x0b, 0x54, 0x7c, 0xee, 0x4e, 0x2f, 0xf1, 0x09, 0x05, 0x85, 0xef, + 0x1f, 0x33, 0xdc, 0x43, 0x45, 0xaf, 0xc8, 0x7d, 0x2b, 0x18, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, + 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, + 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, + 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, + 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0xf2, 0x19, 0x12, 0x04, 0x8a, 0x82, 0xed, 0x6f, 0x0a, 0x49, + 0x06, 0x5e, 0x94, 0xe7, 0x0c, 0xf1, 0xb7, 0xb7, 0x26, 0xac, 0x8e, 0x3d, 0x19, 0x1d, 0xc5, 0x32, + 0xa3, 0x3c, 0x52, 0xc9, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, + 0xf3, 0x2f, 0x7d, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, + 0x17, 0xeb, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, + 0xdf, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, + 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0xf1, + 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0xf2, 0xf5, + 0xc6, 0x39, 0xf6, 0x33, 0xf1, 0x5a, 0x6d, 0x7b, 0xe3, 0xa4, 0x7b, 0x7e, 0x15, 0xf1, 0x40, 0xaa, + 0x70, 0xe1, 0xf7, 0x44, 0x45, 0x66, 0x8e, 0xcd, 0x3e, 0x4a, 0x4b, 0xa6, 0xf2, 0x66, 0x9d, 0xb6, + 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0xf1, 0x28, 0xcf, 0x21, 0x56, + 0x4e, 0xbe, 0xe5, 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, + 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, + 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::nav_msgs::msg::dds_::Odometry_>::type_info_blob() { + static const uint8_t blob[] = { + 0xf8, 0x01, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0xe8, 0x00, 0x00, 0x00, 0xe4, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x09, 0x05, 0x85, 0xef, 0x1f, 0x33, 0xdc, 0x43, 0x45, 0xaf, 0xc8, + 0x7d, 0x2b, 0x18, 0x00, 0x85, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, + 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x48, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xb7, 0xb7, 0x26, 0xac, 0x8e, 0x3d, 0x19, + 0x1d, 0xc5, 0x32, 0xa3, 0x3c, 0x52, 0xc9, 0x00, 0x52, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x00, + 0x55, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, + 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x47, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x40, 0xaa, 0x70, 0xe1, 0xf7, 0x44, 0x45, + 0x66, 0x8e, 0xcd, 0x3e, 0x4a, 0x4b, 0xa6, 0x00, 0x52, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0x00, + 0x55, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x00, 0x01, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xc9, 0xe4, 0x81, 0x30, 0x36, 0xe7, 0x83, 0xf6, 0x0b, 0x54, 0x7c, + 0xee, 0x4e, 0x2f, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, + 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, + 0x76, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x19, 0x12, 0x04, 0x8a, 0x82, 0xed, 0x6f, + 0x0a, 0x49, 0x06, 0x5e, 0x94, 0xe7, 0x0c, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x00, + 0x96, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, + 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, + 0x94, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xf5, 0xc6, 0x39, 0xf6, 0x33, 0xf1, 0x5a, + 0x6d, 0x7b, 0xe3, 0xa4, 0x7b, 0x7e, 0x15, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x00, + 0x96, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, + 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x7c, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::nav_msgs::msg::dds_::Odometry_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::nav_msgs::msg::dds_::Odometry_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::nav_msgs::msg::dds_::Odometry_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::nav_msgs::msg::dds_::Odometry_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::nav_msgs::msg::dds_::Odometry_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.child_frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::nav_msgs::msg::dds_::Odometry_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::Odometry_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::nav_msgs::msg::dds_::Odometry_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.child_frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::nav_msgs::msg::dds_::Odometry_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::Odometry_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::nav_msgs::msg::dds_::Odometry_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.child_frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::nav_msgs::msg::dds_::Odometry_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::Odometry_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::nav_msgs::msg::dds_::Odometry_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.child_frame_id(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::nav_msgs::msg::dds_::Odometry_& instance, bool as_key) { + auto &props = get_type_props<::nav_msgs::msg::dds_::Odometry_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_ODOMETRY__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/Point32_.hpp b/unitree_SDK/include/unitree/idl/ros2/Point32_.hpp new file mode 100644 index 0000000..4acfd1a --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/Point32_.hpp @@ -0,0 +1,341 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Point32_.idl + Source: Point32_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_POINT32__HPP +#define DDSCXX_UNITREE_IDL_ROS2_POINT32__HPP + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class Point32_ +{ +private: + float x_ = 0.0f; + float y_ = 0.0f; + float z_ = 0.0f; + +public: + Point32_() = default; + + explicit Point32_( + float x, + float y, + float z) : + x_(x), + y_(y), + z_(z) { } + + float x() const { return this->x_; } + float& x() { return this->x_; } + void x(float _val_) { this->x_ = _val_; } + float y() const { return this->y_; } + float& y() { return this->y_; } + void y(float _val_) { this->y_ = _val_; } + float z() const { return this->z_; } + float& z() { return this->z_; } + void z(float _val_) { this->z_ = _val_; } + + bool operator==(const Point32_& _other) const + { + (void) _other; + return x_ == _other.x_ && + y_ == _other.y_ && + z_ == _other.z_; + } + + bool operator!=(const Point32_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::Point32_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::Point32_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::Point32_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Point32_>::type_map_blob_sz() { return 282; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Point32_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Point32_>::type_map_blob() { + static const uint8_t blob[] = { + 0x5b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xbd, 0xb3, 0x4b, 0x07, 0x97, 0x70, 0xd5, + 0x44, 0x4c, 0xda, 0x2d, 0x20, 0xb7, 0x83, 0x00, 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x9d, 0xd4, 0xe4, 0x61, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x41, 0x52, 0x90, 0x76, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0xfb, 0xad, 0xe9, 0xe3, 0x00, + 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xb5, 0xc0, 0x1f, 0x51, 0xb0, 0x99, 0xa4, + 0x54, 0xb3, 0xb8, 0xff, 0x68, 0x29, 0xe5, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x33, 0x32, 0x5f, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x7a, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xb5, 0xc0, 0x1f, + 0x51, 0xb0, 0x99, 0xa4, 0x54, 0xb3, 0xb8, 0xff, 0x68, 0x29, 0xe5, 0xf1, 0xbd, 0xb3, 0x4b, 0x07, + 0x97, 0x70, 0xd5, 0x44, 0x4c, 0xda, 0x2d, 0x20, 0xb7, 0x83, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Point32_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xbd, 0xb3, 0x4b, 0x07, 0x97, 0x70, 0xd5, 0x44, 0x4c, 0xda, 0x2d, + 0x20, 0xb7, 0x83, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xb5, 0xc0, 0x1f, 0x51, 0xb0, 0x99, 0xa4, 0x54, 0xb3, 0xb8, 0xff, + 0x68, 0x29, 0xe5, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::Point32_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::Point32_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::Point32_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::Point32_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::Point32_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::Point32_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Point32_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::Point32_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::Point32_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Point32_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::Point32_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::Point32_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Point32_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::Point32_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::Point32_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Point32_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_POINT32__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/PointCloud2_.hpp b/unitree_SDK/include/unitree/idl/ros2/PointCloud2_.hpp new file mode 100644 index 0000000..c0f6568 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/PointCloud2_.hpp @@ -0,0 +1,761 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: PointCloud2_.idl + Source: PointCloud2_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_POINTCLOUD2__HPP +#define DDSCXX_UNITREE_IDL_ROS2_POINTCLOUD2__HPP + +#include "unitree/idl/ros2/PointField_.hpp" + +#include "unitree/idl/ros2/Header_.hpp" + +#include +#include + +namespace sensor_msgs +{ +namespace msg +{ +namespace dds_ +{ +class PointCloud2_ +{ +private: + ::std_msgs::msg::dds_::Header_ header_; + uint32_t height_ = 0; + uint32_t width_ = 0; + std::vector<::sensor_msgs::msg::dds_::PointField_> fields_; + bool is_bigendian_ = false; + uint32_t point_step_ = 0; + uint32_t row_step_ = 0; + std::vector data_; + bool is_dense_ = false; + +public: + PointCloud2_() = default; + + explicit PointCloud2_( + const ::std_msgs::msg::dds_::Header_& header, + uint32_t height, + uint32_t width, + const std::vector<::sensor_msgs::msg::dds_::PointField_>& fields, + bool is_bigendian, + uint32_t point_step, + uint32_t row_step, + const std::vector& data, + bool is_dense) : + header_(header), + height_(height), + width_(width), + fields_(fields), + is_bigendian_(is_bigendian), + point_step_(point_step), + row_step_(row_step), + data_(data), + is_dense_(is_dense) { } + + const ::std_msgs::msg::dds_::Header_& header() const { return this->header_; } + ::std_msgs::msg::dds_::Header_& header() { return this->header_; } + void header(const ::std_msgs::msg::dds_::Header_& _val_) { this->header_ = _val_; } + void header(::std_msgs::msg::dds_::Header_&& _val_) { this->header_ = _val_; } + uint32_t height() const { return this->height_; } + uint32_t& height() { return this->height_; } + void height(uint32_t _val_) { this->height_ = _val_; } + uint32_t width() const { return this->width_; } + uint32_t& width() { return this->width_; } + void width(uint32_t _val_) { this->width_ = _val_; } + const std::vector<::sensor_msgs::msg::dds_::PointField_>& fields() const { return this->fields_; } + std::vector<::sensor_msgs::msg::dds_::PointField_>& fields() { return this->fields_; } + void fields(const std::vector<::sensor_msgs::msg::dds_::PointField_>& _val_) { this->fields_ = _val_; } + void fields(std::vector<::sensor_msgs::msg::dds_::PointField_>&& _val_) { this->fields_ = _val_; } + bool is_bigendian() const { return this->is_bigendian_; } + bool& is_bigendian() { return this->is_bigendian_; } + void is_bigendian(bool _val_) { this->is_bigendian_ = _val_; } + uint32_t point_step() const { return this->point_step_; } + uint32_t& point_step() { return this->point_step_; } + void point_step(uint32_t _val_) { this->point_step_ = _val_; } + uint32_t row_step() const { return this->row_step_; } + uint32_t& row_step() { return this->row_step_; } + void row_step(uint32_t _val_) { this->row_step_ = _val_; } + const std::vector& data() const { return this->data_; } + std::vector& data() { return this->data_; } + void data(const std::vector& _val_) { this->data_ = _val_; } + void data(std::vector&& _val_) { this->data_ = _val_; } + bool is_dense() const { return this->is_dense_; } + bool& is_dense() { return this->is_dense_; } + void is_dense(bool _val_) { this->is_dense_ = _val_; } + + bool operator==(const PointCloud2_& _other) const + { + (void) _other; + return header_ == _other.header_ && + height_ == _other.height_ && + width_ == _other.width_ && + fields_ == _other.fields_ && + is_bigendian_ == _other.is_bigendian_ && + point_step_ == _other.point_step_ && + row_step_ == _other.row_step_ && + data_ == _other.data_ && + is_dense_ == _other.is_dense_; + } + + bool operator!=(const PointCloud2_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::sensor_msgs::msg::dds_::PointCloud2_>::getTypeName() +{ + return "sensor_msgs::msg::dds_::PointCloud2_"; +} + +template <> constexpr bool TopicTraits<::sensor_msgs::msg::dds_::PointCloud2_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::sensor_msgs::msg::dds_::PointCloud2_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::sensor_msgs::msg::dds_::PointCloud2_>::type_map_blob_sz() { return 1472; } +template<> constexpr unsigned int TopicTraits<::sensor_msgs::msg::dds_::PointCloud2_>::type_info_blob_sz() { return 244; } +template<> inline const uint8_t * TopicTraits<::sensor_msgs::msg::dds_::PointCloud2_>::type_map_blob() { + static const uint8_t blob[] = { + 0xeb, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf1, 0x7f, 0x62, 0xa4, 0x8e, 0xfc, 0x63, 0xa8, + 0xa6, 0xfe, 0x5f, 0x9e, 0xda, 0x06, 0xd7, 0x00, 0xcb, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, + 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xb4, 0x35, 0xe2, 0x27, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xea, 0xae, 0x26, 0xa6, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf1, 0x01, 0x00, 0x00, 0xf1, + 0x82, 0x17, 0x10, 0x85, 0xb3, 0xf2, 0x74, 0x2b, 0xa8, 0x4e, 0xb5, 0xeb, 0x0e, 0x0b, 0xd0, 0x5b, + 0x6e, 0xd7, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x70, + 0x8e, 0x8a, 0xc3, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x1a, + 0x99, 0x6a, 0x87, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x8b, + 0x4f, 0x6f, 0x6b, 0x00, 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, + 0x01, 0x00, 0x00, 0x02, 0x8d, 0x77, 0x7f, 0x38, 0x0b, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x01, 0x40, 0x23, 0x8a, 0xea, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, + 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, + 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, 0x8d, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x4b, 0xb3, 0x9c, 0x5c, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0xf1, 0x82, 0x17, 0x10, 0x85, 0xb3, 0xf2, 0x74, 0x2b, + 0xa8, 0x4e, 0xb5, 0xeb, 0x0e, 0x0b, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0xb0, 0x68, 0x93, 0x1c, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x7a, 0x86, 0xc1, 0x57, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x39, 0x31, 0x10, 0x8d, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, 0x94, 0x2a, 0x04, 0x00, + 0x4c, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf2, 0xf6, 0xf1, 0xa7, 0xb4, 0x13, 0x2f, 0x17, + 0xb4, 0xae, 0x1d, 0x73, 0x77, 0xc5, 0xbc, 0x00, 0x63, 0x01, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x73, 0x65, 0x6e, 0x73, + 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, + 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x43, 0x6c, 0x6f, 0x75, 0x64, 0x32, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, + 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x77, 0x69, 0x64, 0x74, 0x68, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf2, 0x01, 0x00, 0x00, 0xf2, 0xa3, 0xab, 0xc2, 0x35, + 0xd1, 0x3d, 0xdb, 0xab, 0x7a, 0x36, 0x56, 0x16, 0xf1, 0x08, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x69, 0x73, 0x5f, 0x62, + 0x69, 0x67, 0x65, 0x6e, 0x64, 0x69, 0x61, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x09, 0x00, 0x00, 0x00, 0x72, 0x6f, 0x77, 0x5f, + 0x73, 0x74, 0x65, 0x70, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00, 0x00, 0x64, 0x61, 0x74, 0x61, + 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x69, 0x73, 0x5f, 0x64, 0x65, 0x6e, 0x73, 0x65, 0x00, 0x00, 0x00, 0xf2, + 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x00, + 0x7b, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1d, 0x00, 0x00, 0x00, 0x73, 0x74, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, + 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, + 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, + 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, + 0x72, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6e, 0x6f, + 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0xf2, 0xa3, 0xab, 0xc2, 0x35, 0xd1, 0x3d, 0xdb, 0xab, 0x7a, + 0x36, 0x56, 0x16, 0xf1, 0x08, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x73, 0x65, 0x6e, 0x73, + 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, + 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x00, + 0x6c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x70, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x64, 0x61, 0x74, 0x61, + 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x00, 0x00, 0x00, + 0x7c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf2, 0xf6, 0xf1, 0xa7, 0xb4, 0x13, 0x2f, 0x17, + 0xb4, 0xae, 0x1d, 0x73, 0x77, 0xc5, 0xbc, 0xf1, 0x7f, 0x62, 0xa4, 0x8e, 0xfc, 0x63, 0xa8, 0xa6, + 0xfe, 0x5f, 0x9e, 0xda, 0x06, 0xd7, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, + 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, + 0xe5, 0x1f, 0xa3, 0xf2, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, + 0xe6, 0x32, 0x0d, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, + 0xf9, 0x8d, 0xf2, 0xa3, 0xab, 0xc2, 0x35, 0xd1, 0x3d, 0xdb, 0xab, 0x7a, 0x36, 0x56, 0x16, 0xf1, + 0x08, 0xf1, 0x82, 0x17, 0x10, 0x85, 0xb3, 0xf2, 0x74, 0x2b, 0xa8, 0x4e, 0xb5, 0xeb, 0x0e, 0x0b, +}; + return blob; +} +template<> inline const uint8_t * TopicTraits<::sensor_msgs::msg::dds_::PointCloud2_>::type_info_blob() { + static const uint8_t blob[] = { + 0xf0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x7f, 0x62, 0xa4, 0x8e, 0xfc, 0x63, 0xa8, 0xa6, 0xfe, 0x5f, 0x9e, + 0xda, 0x06, 0xd7, 0x00, 0xcf, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, + 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x48, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x82, 0x17, 0x10, 0x85, 0xb3, 0xf2, 0x74, + 0x2b, 0xa8, 0x4e, 0xb5, 0xeb, 0x0e, 0x0b, 0x00, 0x57, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xf6, 0xf1, 0xa7, + 0xb4, 0x13, 0x2f, 0x17, 0xb4, 0xae, 0x1d, 0x73, 0x77, 0xc5, 0xbc, 0x00, 0x67, 0x01, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, + 0x7f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, + 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x76, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xa3, 0xab, 0xc2, 0x35, 0xd1, 0x3d, 0xdb, 0xab, 0x7a, 0x36, 0x56, 0x16, 0xf1, 0x08, 0x00, + 0xa8, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::sensor_msgs::msg::dds_::PointCloud2_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::sensor_msgs::msg::dds_::PointCloud2_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::sensor_msgs::msg::dds_::PointCloud2_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::sensor_msgs::msg::dds_::PointCloud2_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::sensor_msgs::msg::dds_::PointCloud2_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.fields().size()); + if (!write(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!write(streamer, instance.fields()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.is_bigendian())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.point_step())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.row_step())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!write(streamer, se_1)) + return false; + if (se_1 > 0 && + !write(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.is_dense())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::sensor_msgs::msg::dds_::PointCloud2_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::PointCloud2_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::sensor_msgs::msg::dds_::PointCloud2_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.fields().size()); + if (!read(streamer, se_1)) + return false; + instance.fields().resize(se_1); + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!read(streamer, instance.fields()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.is_bigendian())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.point_step())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.row_step())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!read(streamer, se_1)) + return false; + instance.data().resize(se_1); + if (se_1 > 0 && + !read(streamer, instance.data()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.is_dense())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::sensor_msgs::msg::dds_::PointCloud2_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::PointCloud2_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::sensor_msgs::msg::dds_::PointCloud2_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = uint32_t(instance.fields().size()); + if (!move(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!move(streamer, instance.fields()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.is_bigendian())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.point_step())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.row_step())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.data().size()); + if (!move(streamer, se_1)) + return false; + if (se_1 > 0 && + !move(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.is_dense())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::sensor_msgs::msg::dds_::PointCloud2_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::PointCloud2_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::sensor_msgs::msg::dds_::PointCloud2_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.height())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.width())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, false)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + for (uint32_t i_1 = 0; i_1 < se_1; i_1++) { + if (!max(streamer, instance.fields()[i_1], prop)) + return false; + } //i_1 + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + case 4: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.is_bigendian())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 5: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.point_step())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 6: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.row_step())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 7: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + if (se_1 > 0 && + !max(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + case 8: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.is_dense())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::sensor_msgs::msg::dds_::PointCloud2_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::PointCloud2_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_POINTCLOUD2__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/PointField_.hpp b/unitree_SDK/include/unitree/idl/ros2/PointField_.hpp new file mode 100644 index 0000000..4c7c2e8 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/PointField_.hpp @@ -0,0 +1,412 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: PointField_.idl + Source: PointField_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_POINTFIELD__HPP +#define DDSCXX_UNITREE_IDL_ROS2_POINTFIELD__HPP + +#include +#include + +namespace sensor_msgs +{ +namespace msg +{ +namespace dds_ +{ +namespace PointField_Constants +{ +const uint8_t INT8_ = 1; + +const uint8_t UINT8_ = 2; + +const uint8_t INT16_ = 3; + +const uint8_t UINT16_ = 4; + +const uint8_t INT32_ = 5; + +const uint8_t UINT32_ = 6; + +const uint8_t FLOAT32_ = 7; + +const uint8_t FLOAT64_ = 8; + +} + +class PointField_ +{ +private: + std::string name_; + uint32_t offset_ = 0; + uint8_t datatype_ = 0; + uint32_t count_ = 0; + +public: + PointField_() = default; + + explicit PointField_( + const std::string& name, + uint32_t offset, + uint8_t datatype, + uint32_t count) : + name_(name), + offset_(offset), + datatype_(datatype), + count_(count) { } + + const std::string& name() const { return this->name_; } + std::string& name() { return this->name_; } + void name(const std::string& _val_) { this->name_ = _val_; } + void name(std::string&& _val_) { this->name_ = _val_; } + uint32_t offset() const { return this->offset_; } + uint32_t& offset() { return this->offset_; } + void offset(uint32_t _val_) { this->offset_ = _val_; } + uint8_t datatype() const { return this->datatype_; } + uint8_t& datatype() { return this->datatype_; } + void datatype(uint8_t _val_) { this->datatype_ = _val_; } + uint32_t count() const { return this->count_; } + uint32_t& count() { return this->count_; } + void count(uint32_t _val_) { this->count_ = _val_; } + + bool operator==(const PointField_& _other) const + { + (void) _other; + return name_ == _other.name_ && + offset_ == _other.offset_ && + datatype_ == _other.datatype_ && + count_ == _other.count_; + } + + bool operator!=(const PointField_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::sensor_msgs::msg::dds_::PointField_>::getTypeName() +{ + return "sensor_msgs::msg::dds_::PointField_"; +} + +template <> constexpr bool TopicTraits<::sensor_msgs::msg::dds_::PointField_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::sensor_msgs::msg::dds_::PointField_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::sensor_msgs::msg::dds_::PointField_>::type_map_blob_sz() { return 342; } +template<> constexpr unsigned int TopicTraits<::sensor_msgs::msg::dds_::PointField_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::sensor_msgs::msg::dds_::PointField_>::type_map_blob() { + static const uint8_t blob[] = { + 0x6b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x82, 0x17, 0x10, 0x85, 0xb3, 0xf2, 0x74, + 0x2b, 0xa8, 0x4e, 0xb5, 0xeb, 0x0e, 0x0b, 0x00, 0x53, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0xb0, 0x68, 0x93, 0x1c, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x7a, 0x86, 0xc1, 0x57, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x39, 0x31, 0x10, 0x8d, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, 0x94, 0x2a, 0x04, 0x00, + 0xbc, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xa3, 0xab, 0xc2, 0x35, 0xd1, 0x3d, 0xdb, + 0xab, 0x7a, 0x36, 0x56, 0x16, 0xf1, 0x08, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x73, 0x65, 0x6e, 0x73, + 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, + 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x00, + 0x6c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x70, 0x00, 0x05, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6d, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x09, 0x00, 0x00, 0x00, 0x64, 0x61, 0x74, 0x61, + 0x74, 0x79, 0x70, 0x65, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xa3, 0xab, 0xc2, 0x35, 0xd1, 0x3d, 0xdb, + 0xab, 0x7a, 0x36, 0x56, 0x16, 0xf1, 0x08, 0xf1, 0x82, 0x17, 0x10, 0x85, 0xb3, 0xf2, 0x74, 0x2b, + 0xa8, 0x4e, 0xb5, 0xeb, 0x0e, 0x0b, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::sensor_msgs::msg::dds_::PointField_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x82, 0x17, 0x10, 0x85, 0xb3, 0xf2, 0x74, 0x2b, 0xa8, 0x4e, 0xb5, + 0xeb, 0x0e, 0x0b, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xa3, 0xab, 0xc2, 0x35, 0xd1, 0x3d, 0xdb, 0xab, 0x7a, 0x36, 0x56, + 0x16, 0xf1, 0x08, 0x00, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::sensor_msgs::msg::dds_::PointField_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::sensor_msgs::msg::dds_::PointField_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::sensor_msgs::msg::dds_::PointField_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::sensor_msgs::msg::dds_::PointField_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::sensor_msgs::msg::dds_::PointField_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.name(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.offset())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.datatype())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.count())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::sensor_msgs::msg::dds_::PointField_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::PointField_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::sensor_msgs::msg::dds_::PointField_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.name(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.offset())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.datatype())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.count())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::sensor_msgs::msg::dds_::PointField_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::PointField_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::sensor_msgs::msg::dds_::PointField_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.name(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.offset())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.datatype())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.count())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::sensor_msgs::msg::dds_::PointField_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::PointField_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::sensor_msgs::msg::dds_::PointField_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.name(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.offset())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.datatype())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.count())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::sensor_msgs::msg::dds_::PointField_& instance, bool as_key) { + auto &props = get_type_props<::sensor_msgs::msg::dds_::PointField_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_POINTFIELD__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/PointStamped_.hpp b/unitree_SDK/include/unitree/idl/ros2/PointStamped_.hpp new file mode 100644 index 0000000..46d60cd --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/PointStamped_.hpp @@ -0,0 +1,372 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: PointStamped_.idl + Source: PointStamped_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_POINTSTAMPED__HPP +#define DDSCXX_UNITREE_IDL_ROS2_POINTSTAMPED__HPP + +#include "unitree/idl/ros2/Point_.hpp" + +#include "unitree/idl/ros2/Header_.hpp" + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class PointStamped_ +{ +private: + ::std_msgs::msg::dds_::Header_ header_; + ::geometry_msgs::msg::dds_::Point_ point_; + +public: + PointStamped_() = default; + + explicit PointStamped_( + const ::std_msgs::msg::dds_::Header_& header, + const ::geometry_msgs::msg::dds_::Point_& point) : + header_(header), + point_(point) { } + + const ::std_msgs::msg::dds_::Header_& header() const { return this->header_; } + ::std_msgs::msg::dds_::Header_& header() { return this->header_; } + void header(const ::std_msgs::msg::dds_::Header_& _val_) { this->header_ = _val_; } + void header(::std_msgs::msg::dds_::Header_&& _val_) { this->header_ = _val_; } + const ::geometry_msgs::msg::dds_::Point_& point() const { return this->point_; } + ::geometry_msgs::msg::dds_::Point_& point() { return this->point_; } + void point(const ::geometry_msgs::msg::dds_::Point_& _val_) { this->point_ = _val_; } + void point(::geometry_msgs::msg::dds_::Point_&& _val_) { this->point_ = _val_; } + + bool operator==(const PointStamped_& _other) const + { + (void) _other; + return header_ == _other.header_ && + point_ == _other.point_; + } + + bool operator!=(const PointStamped_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::PointStamped_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::PointStamped_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::PointStamped_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::PointStamped_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::PointStamped_>::type_map_blob_sz() { return 1080; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::PointStamped_>::type_info_blob_sz() { return 244; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::PointStamped_>::type_map_blob() { + static const uint8_t blob[] = { + 0x5f, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf1, 0xbc, 0x24, 0xf4, 0xb3, 0xd4, 0xb8, 0xc5, + 0x25, 0x31, 0xec, 0x3b, 0xeb, 0x9c, 0x24, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, + 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, + 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x78, 0xee, 0x54, 0xaa, 0xf1, 0xdc, 0xf1, + 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x44, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, + 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, + 0x8d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x4b, 0xb3, 0x9c, 0x5c, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, + 0x46, 0xf9, 0x8d, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0xf1, 0x5e, 0x73, 0x97, 0xe7, + 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, + 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, + 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, + 0xad, 0xe9, 0xe3, 0x00, 0x50, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf2, 0x48, 0xc5, 0xdf, + 0xc4, 0x35, 0xf9, 0x84, 0x49, 0xf9, 0x9e, 0x53, 0x04, 0x09, 0xd0, 0x00, 0x94, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x53, + 0x74, 0x61, 0x6d, 0x70, 0x65, 0x64, 0x5f, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, + 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, + 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x69, 0x6e, + 0x74, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, + 0x4e, 0x2a, 0x55, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x73, 0x74, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x73, + 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, + 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x70, 0x00, 0x09, 0x00, 0x00, 0x00, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, + 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, + 0x32, 0x0d, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x5f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, + 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xf2, 0x48, 0xc5, 0xdf, 0xc4, 0x35, 0xf9, 0x84, 0x49, 0xf9, 0x9e, 0x53, 0x04, 0x09, 0xd0, 0xf1, + 0xbc, 0x24, 0xf4, 0xb3, 0xd4, 0xb8, 0xc5, 0x25, 0x31, 0xec, 0x3b, 0xeb, 0x9c, 0x24, 0xf2, 0xe5, + 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0xf1, 0xdc, 0xf1, + 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0xf2, 0xd4, 0x85, 0x4f, + 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0xf1, 0x56, 0x7c, 0x5a, 0x93, + 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, + 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, + 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::PointStamped_>::type_info_blob() { + static const uint8_t blob[] = { + 0xf0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xbc, 0x24, 0xf4, 0xb3, 0xd4, 0xb8, 0xc5, 0x25, 0x31, 0xec, 0x3b, + 0xeb, 0x9c, 0x24, 0x00, 0x55, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, + 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x48, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, + 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x47, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x48, 0xc5, 0xdf, + 0xc4, 0x35, 0xf9, 0x84, 0x49, 0xf9, 0x9e, 0x53, 0x04, 0x09, 0xd0, 0x00, 0x98, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, + 0x7f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, + 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x76, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, + 0x7c, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::PointStamped_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::PointStamped_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::PointStamped_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::PointStamped_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::PointStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.point(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::PointStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PointStamped_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::PointStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.point(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::PointStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PointStamped_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::PointStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.point(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::PointStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PointStamped_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::PointStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.point(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::PointStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PointStamped_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_POINTSTAMPED__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/Point_.hpp b/unitree_SDK/include/unitree/idl/ros2/Point_.hpp new file mode 100644 index 0000000..84fe1fc --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/Point_.hpp @@ -0,0 +1,341 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Point_.idl + Source: Point_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_POINT__HPP +#define DDSCXX_UNITREE_IDL_ROS2_POINT__HPP + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class Point_ +{ +private: + double x_ = 0.0; + double y_ = 0.0; + double z_ = 0.0; + +public: + Point_() = default; + + explicit Point_( + double x, + double y, + double z) : + x_(x), + y_(y), + z_(z) { } + + double x() const { return this->x_; } + double& x() { return this->x_; } + void x(double _val_) { this->x_ = _val_; } + double y() const { return this->y_; } + double& y() { return this->y_; } + void y(double _val_) { this->y_ = _val_; } + double z() const { return this->z_; } + double& z() { return this->z_; } + void z(double _val_) { this->z_ = _val_; } + + bool operator==(const Point_& _other) const + { + (void) _other; + return x_ == _other.x_ && + y_ == _other.y_ && + z_ == _other.z_; + } + + bool operator!=(const Point_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::Point_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::Point_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::Point_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Point_>::type_map_blob_sz() { return 282; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Point_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Point_>::type_map_blob() { + static const uint8_t blob[] = { + 0x5b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, + 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, + 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, + 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x7a, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, + 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0xf1, 0x5e, 0x73, 0x97, 0xe7, + 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Point_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, + 0xcd, 0x4c, 0xbc, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, + 0xf8, 0xfa, 0xdf, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::Point_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::Point_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::Point_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::Point_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::Point_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::Point_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Point_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::Point_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::Point_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Point_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::Point_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::Point_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Point_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::Point_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::Point_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Point_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_POINT__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/Pose2D_.hpp b/unitree_SDK/include/unitree/idl/ros2/Pose2D_.hpp new file mode 100644 index 0000000..7d360fa --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/Pose2D_.hpp @@ -0,0 +1,341 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Pose2D_.idl + Source: Pose2D_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_POSE2D__HPP +#define DDSCXX_UNITREE_IDL_ROS2_POSE2D__HPP + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class Pose2D_ +{ +private: + double x_ = 0.0; + double y_ = 0.0; + double theta_ = 0.0; + +public: + Pose2D_() = default; + + explicit Pose2D_( + double x, + double y, + double theta) : + x_(x), + y_(y), + theta_(theta) { } + + double x() const { return this->x_; } + double& x() { return this->x_; } + void x(double _val_) { this->x_ = _val_; } + double y() const { return this->y_; } + double& y() { return this->y_; } + void y(double _val_) { this->y_ = _val_; } + double theta() const { return this->theta_; } + double& theta() { return this->theta_; } + void theta(double _val_) { this->theta_ = _val_; } + + bool operator==(const Pose2D_& _other) const + { + (void) _other; + return x_ == _other.x_ && + y_ == _other.y_ && + theta_ == _other.theta_; + } + + bool operator!=(const Pose2D_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::Pose2D_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::Pose2D_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::Pose2D_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Pose2D_>::type_map_blob_sz() { return 286; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Pose2D_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Pose2D_>::type_map_blob() { + static const uint8_t blob[] = { + 0x5b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xe6, 0x4d, 0xe9, 0xc3, 0xbd, 0x87, 0xa5, + 0x1f, 0x57, 0xf7, 0x59, 0xf0, 0x59, 0x77, 0x00, 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x61, 0xa7, 0x4b, 0xe6, 0x00, + 0x94, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xc6, 0x23, 0x0c, 0x9d, 0x1e, 0x0d, 0x38, + 0x95, 0xf0, 0x39, 0x06, 0x50, 0x19, 0xc5, 0x00, 0x7c, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x32, 0x44, 0x5f, 0x00, 0x00, 0x00, + 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x74, 0x68, 0x65, 0x74, 0x61, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0xf2, 0xc6, 0x23, 0x0c, 0x9d, 0x1e, 0x0d, 0x38, 0x95, 0xf0, 0x39, 0x06, 0x50, 0x19, 0xc5, 0xf1, + 0xe6, 0x4d, 0xe9, 0xc3, 0xbd, 0x87, 0xa5, 0x1f, 0x57, 0xf7, 0x59, 0xf0, 0x59, 0x77, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Pose2D_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xe6, 0x4d, 0xe9, 0xc3, 0xbd, 0x87, 0xa5, 0x1f, 0x57, 0xf7, 0x59, + 0xf0, 0x59, 0x77, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xc6, 0x23, 0x0c, 0x9d, 0x1e, 0x0d, 0x38, 0x95, 0xf0, 0x39, 0x06, + 0x50, 0x19, 0xc5, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::Pose2D_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::Pose2D_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::Pose2D_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::Pose2D_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::Pose2D_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.theta())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::Pose2D_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Pose2D_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::Pose2D_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.theta())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::Pose2D_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Pose2D_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::Pose2D_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.theta())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::Pose2D_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Pose2D_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::Pose2D_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.theta())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::Pose2D_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Pose2D_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_POSE2D__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/PoseStamped_.hpp b/unitree_SDK/include/unitree/idl/ros2/PoseStamped_.hpp new file mode 100644 index 0000000..af8e054 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/PoseStamped_.hpp @@ -0,0 +1,415 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: PoseStamped_.idl + Source: PoseStamped_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_POSESTAMPED__HPP +#define DDSCXX_UNITREE_IDL_ROS2_POSESTAMPED__HPP + +#include "unitree/idl/ros2/Pose_.hpp" + +#include "unitree/idl/ros2/Header_.hpp" + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class PoseStamped_ +{ +private: + ::std_msgs::msg::dds_::Header_ header_; + ::geometry_msgs::msg::dds_::Pose_ pose_; + +public: + PoseStamped_() = default; + + explicit PoseStamped_( + const ::std_msgs::msg::dds_::Header_& header, + const ::geometry_msgs::msg::dds_::Pose_& pose) : + header_(header), + pose_(pose) { } + + const ::std_msgs::msg::dds_::Header_& header() const { return this->header_; } + ::std_msgs::msg::dds_::Header_& header() { return this->header_; } + void header(const ::std_msgs::msg::dds_::Header_& _val_) { this->header_ = _val_; } + void header(::std_msgs::msg::dds_::Header_&& _val_) { this->header_ = _val_; } + const ::geometry_msgs::msg::dds_::Pose_& pose() const { return this->pose_; } + ::geometry_msgs::msg::dds_::Pose_& pose() { return this->pose_; } + void pose(const ::geometry_msgs::msg::dds_::Pose_& _val_) { this->pose_ = _val_; } + void pose(::geometry_msgs::msg::dds_::Pose_&& _val_) { this->pose_ = _val_; } + + bool operator==(const PoseStamped_& _other) const + { + (void) _other; + return header_ == _other.header_ && + pose_ == _other.pose_; + } + + bool operator!=(const PoseStamped_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::PoseStamped_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::PoseStamped_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::PoseStamped_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::PoseStamped_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::PoseStamped_>::type_map_blob_sz() { return 1676; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::PoseStamped_>::type_info_blob_sz() { return 340; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::PoseStamped_>::type_map_blob() { + static const uint8_t blob[] = { + 0x2b, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xf1, 0xcb, 0xe6, 0x9d, 0x4c, 0xd6, 0x91, 0x76, + 0x9e, 0xaf, 0x8f, 0xf6, 0xd5, 0x5c, 0x6f, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, + 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, + 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x2d, 0x5f, 0x8a, 0xe9, 0xf1, 0xdc, 0xf1, + 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x44, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, + 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, + 0x8d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x4b, 0xb3, 0x9c, 0x5c, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, + 0x46, 0xf9, 0x8d, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, + 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, + 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x47, 0x57, 0xfe, + 0x07, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2e, + 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0xda, 0x16, 0x39, + 0x42, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, + 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, + 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xf1, 0x29, 0x01, 0x86, 0x00, + 0x9c, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xf2, 0x80, 0x17, 0x7b, 0xda, 0x5a, 0x70, 0x7b, + 0x8b, 0x87, 0xbc, 0x32, 0x31, 0x6b, 0x6a, 0x00, 0x93, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x65, + 0x64, 0x5f, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, + 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, + 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, + 0x7d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x65, 0x00, 0x00, 0x00, 0xf2, + 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x00, + 0x7b, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1d, 0x00, 0x00, 0x00, 0x73, 0x74, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, + 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, + 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, + 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, + 0x72, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6e, 0x6f, + 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, + 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x00, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x5f, 0x00, 0x5e, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x04, + 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, + 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, + 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x6f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0xf2, 0x04, + 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, + 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, + 0x69, 0x6e, 0x74, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, + 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x90, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x51, 0x75, 0x61, 0x74, 0x65, 0x72, + 0x6e, 0x69, 0x6f, 0x6e, 0x5f, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, + 0xb8, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xf2, 0x80, 0x17, 0x7b, 0xda, 0x5a, 0x70, 0x7b, + 0x8b, 0x87, 0xbc, 0x32, 0x31, 0x6b, 0x6a, 0xf1, 0xcb, 0xe6, 0x9d, 0x4c, 0xd6, 0x91, 0x76, 0x9e, + 0xaf, 0x8f, 0xf6, 0xd5, 0x5c, 0x6f, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, + 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, + 0xe5, 0x1f, 0xa3, 0xf2, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, + 0xe6, 0x32, 0x0d, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, + 0xf9, 0x8d, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, + 0x7d, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, + 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0xf1, + 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0xf2, 0x6f, + 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0xf1, 0x2e, 0xd7, + 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::PoseStamped_>::type_info_blob() { + static const uint8_t blob[] = { + 0x50, 0x01, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0xa0, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xcb, 0xe6, 0x9d, 0x4c, 0xd6, 0x91, 0x76, 0x9e, 0xaf, 0x8f, 0xf6, + 0xd5, 0x5c, 0x6f, 0x00, 0x55, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, + 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x48, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, + 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x00, 0x55, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, + 0x47, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, + 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, 0x57, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0xa0, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x80, 0x17, 0x7b, + 0xda, 0x5a, 0x70, 0x7b, 0x8b, 0x87, 0xbc, 0x32, 0x31, 0x6b, 0x6a, 0x00, 0x97, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, + 0x7f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, + 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x76, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x00, + 0x96, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, + 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, + 0x94, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::PoseStamped_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::PoseStamped_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::PoseStamped_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::PoseStamped_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::PoseStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::PoseStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseStamped_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::PoseStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::PoseStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseStamped_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::PoseStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::PoseStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseStamped_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::PoseStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::PoseStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseStamped_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_POSESTAMPED__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/PoseWithCovarianceStamped_.hpp b/unitree_SDK/include/unitree/idl/ros2/PoseWithCovarianceStamped_.hpp new file mode 100644 index 0000000..8608208 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/PoseWithCovarianceStamped_.hpp @@ -0,0 +1,438 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: PoseWithCovarianceStamped_.idl + Source: PoseWithCovarianceStamped_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_POSEWITHCOVARIANCESTAMPED__HPP +#define DDSCXX_UNITREE_IDL_ROS2_POSEWITHCOVARIANCESTAMPED__HPP + +#include "unitree/idl/ros2/PoseWithCovariance_.hpp" + +#include "unitree/idl/ros2/Header_.hpp" + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class PoseWithCovarianceStamped_ +{ +private: + ::std_msgs::msg::dds_::Header_ header_; + ::geometry_msgs::msg::dds_::PoseWithCovariance_ pose_; + +public: + PoseWithCovarianceStamped_() = default; + + explicit PoseWithCovarianceStamped_( + const ::std_msgs::msg::dds_::Header_& header, + const ::geometry_msgs::msg::dds_::PoseWithCovariance_& pose) : + header_(header), + pose_(pose) { } + + const ::std_msgs::msg::dds_::Header_& header() const { return this->header_; } + ::std_msgs::msg::dds_::Header_& header() { return this->header_; } + void header(const ::std_msgs::msg::dds_::Header_& _val_) { this->header_ = _val_; } + void header(::std_msgs::msg::dds_::Header_&& _val_) { this->header_ = _val_; } + const ::geometry_msgs::msg::dds_::PoseWithCovariance_& pose() const { return this->pose_; } + ::geometry_msgs::msg::dds_::PoseWithCovariance_& pose() { return this->pose_; } + void pose(const ::geometry_msgs::msg::dds_::PoseWithCovariance_& _val_) { this->pose_ = _val_; } + void pose(::geometry_msgs::msg::dds_::PoseWithCovariance_&& _val_) { this->pose_ = _val_; } + + bool operator==(const PoseWithCovarianceStamped_& _other) const + { + (void) _other; + return header_ == _other.header_ && + pose_ == _other.pose_; + } + + bool operator!=(const PoseWithCovarianceStamped_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::PoseWithCovarianceStamped_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>::type_map_blob_sz() { return 1994; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>::type_info_blob_sz() { return 388; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>::type_map_blob() { + static const uint8_t blob[] = { + 0x8f, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf1, 0x3d, 0xeb, 0xb5, 0x11, 0xcc, 0xa4, 0xdc, + 0x63, 0xf4, 0xba, 0x83, 0xde, 0x11, 0x70, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, + 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xb7, 0xb7, 0x26, 0xac, 0x8e, + 0x3d, 0x19, 0x1d, 0xc5, 0x32, 0xa3, 0x3c, 0x52, 0xc9, 0x2d, 0x5f, 0x8a, 0xe9, 0xf1, 0xdc, 0xf1, + 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x44, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, + 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, + 0x8d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x4b, 0xb3, 0x9c, 0x5c, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, + 0x46, 0xf9, 0x8d, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0xf1, 0xb7, 0xb7, 0x26, 0xac, + 0x8e, 0x3d, 0x19, 0x1d, 0xc5, 0x32, 0xa3, 0x3c, 0x52, 0xc9, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2f, + 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x2d, 0x5f, 0x8a, + 0xe9, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x0a, 0xac, 0xdb, 0x06, 0x55, 0xf1, 0x2f, + 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x00, 0x00, 0x00, + 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, + 0xbc, 0x47, 0x57, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, + 0xa1, 0xda, 0x16, 0x39, 0x42, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, + 0x76, 0xcd, 0x4c, 0xbc, 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, + 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, + 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, + 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, + 0xad, 0xe9, 0xe3, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xf1, + 0x29, 0x01, 0x86, 0x00, 0x58, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf2, 0x24, 0x77, 0x5a, + 0x9f, 0x85, 0xf9, 0x7b, 0x5b, 0xeb, 0x5a, 0x31, 0xb0, 0x0c, 0x05, 0x00, 0xa3, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x57, 0x69, + 0x74, 0x68, 0x43, 0x6f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x61, 0x6d, + 0x70, 0x65, 0x64, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, + 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x19, 0x12, 0x04, 0x8a, 0x82, 0xed, 0x6f, 0x0a, 0x49, + 0x06, 0x5e, 0x94, 0xe7, 0x0c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x65, + 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, + 0x2a, 0x55, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x73, 0x74, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x73, + 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x48, 0x65, 0x61, + 0x64, 0x65, 0x72, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, + 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x70, 0x00, 0x09, 0x00, 0x00, 0x00, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, + 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, + 0x32, 0x0d, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x5f, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, + 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x36, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0xf2, 0x19, 0x12, 0x04, 0x8a, 0x82, + 0xed, 0x6f, 0x0a, 0x49, 0x06, 0x5e, 0x94, 0xe7, 0x0c, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x57, 0x69, + 0x74, 0x68, 0x43, 0x6f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x00, 0x00, 0x00, + 0x55, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, + 0x7d, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x24, 0x0a, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x76, 0x61, + 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, + 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x92, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x5f, 0x00, 0x5e, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x04, + 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, + 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, + 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, + 0x6f, 0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0xf2, 0x04, + 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, + 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, + 0x69, 0x6e, 0x74, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, + 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x90, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x51, 0x75, 0x61, 0x74, 0x65, 0x72, + 0x6e, 0x69, 0x6f, 0x6e, 0x5f, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, + 0xd6, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0xf2, 0x24, 0x77, 0x5a, 0x9f, 0x85, 0xf9, 0x7b, + 0x5b, 0xeb, 0x5a, 0x31, 0xb0, 0x0c, 0x05, 0xf1, 0x3d, 0xeb, 0xb5, 0x11, 0xcc, 0xa4, 0xdc, 0x63, + 0xf4, 0xba, 0x83, 0xde, 0x11, 0x70, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, + 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, + 0xe5, 0x1f, 0xa3, 0xf2, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, + 0xe6, 0x32, 0x0d, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, + 0xf9, 0x8d, 0xf2, 0x19, 0x12, 0x04, 0x8a, 0x82, 0xed, 0x6f, 0x0a, 0x49, 0x06, 0x5e, 0x94, 0xe7, + 0x0c, 0xf1, 0xb7, 0xb7, 0x26, 0xac, 0x8e, 0x3d, 0x19, 0x1d, 0xc5, 0x32, 0xa3, 0x3c, 0x52, 0xc9, + 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0xf1, + 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0xf2, 0x04, + 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0xf1, 0x5e, 0x73, + 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0xf2, 0x6f, 0x01, 0xea, + 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, + 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>::type_info_blob() { + static const uint8_t blob[] = { + 0x80, 0x01, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0xb8, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x3d, 0xeb, 0xb5, 0x11, 0xcc, 0xa4, 0xdc, 0x63, 0xf4, 0xba, 0x83, + 0xde, 0x11, 0x70, 0x00, 0x55, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, + 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x48, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xb7, 0xb7, 0x26, 0xac, 0x8e, 0x3d, 0x19, + 0x1d, 0xc5, 0x32, 0xa3, 0x3c, 0x52, 0xc9, 0x00, 0x52, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x00, + 0x55, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, + 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x47, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0xb8, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x24, 0x77, 0x5a, 0x9f, 0x85, 0xf9, 0x7b, 0x5b, 0xeb, 0x5a, 0x31, + 0xb0, 0x0c, 0x05, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, + 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, + 0x76, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x19, 0x12, 0x04, 0x8a, 0x82, 0xed, 0x6f, + 0x0a, 0x49, 0x06, 0x5e, 0x94, 0xe7, 0x0c, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x00, + 0x96, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, + 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, + 0x94, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseWithCovarianceStamped_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_POSEWITHCOVARIANCESTAMPED__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/PoseWithCovariance_.hpp b/unitree_SDK/include/unitree/idl/ros2/PoseWithCovariance_.hpp new file mode 100644 index 0000000..ff93072 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/PoseWithCovariance_.hpp @@ -0,0 +1,388 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: PoseWithCovariance_.idl + Source: PoseWithCovariance_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_POSEWITHCOVARIANCE__HPP +#define DDSCXX_UNITREE_IDL_ROS2_POSEWITHCOVARIANCE__HPP + +#include "unitree/idl/ros2/Pose_.hpp" + +#include + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class PoseWithCovariance_ +{ +private: + ::geometry_msgs::msg::dds_::Pose_ pose_; + std::array covariance_ = { }; + +public: + PoseWithCovariance_() = default; + + explicit PoseWithCovariance_( + const ::geometry_msgs::msg::dds_::Pose_& pose, + const std::array& covariance) : + pose_(pose), + covariance_(covariance) { } + + const ::geometry_msgs::msg::dds_::Pose_& pose() const { return this->pose_; } + ::geometry_msgs::msg::dds_::Pose_& pose() { return this->pose_; } + void pose(const ::geometry_msgs::msg::dds_::Pose_& _val_) { this->pose_ = _val_; } + void pose(::geometry_msgs::msg::dds_::Pose_&& _val_) { this->pose_ = _val_; } + const std::array& covariance() const { return this->covariance_; } + std::array& covariance() { return this->covariance_; } + void covariance(const std::array& _val_) { this->covariance_ = _val_; } + void covariance(std::array&& _val_) { this->covariance_ = _val_; } + + bool operator==(const PoseWithCovariance_& _other) const + { + (void) _other; + return pose_ == _other.pose_ && + covariance_ == _other.covariance_; + } + + bool operator!=(const PoseWithCovariance_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovariance_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::PoseWithCovariance_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovariance_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovariance_>::type_map_blob_sz() { return 1180; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovariance_>::type_info_blob_sz() { return 244; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovariance_>::type_map_blob() { + static const uint8_t blob[] = { + 0x8b, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf1, 0xb7, 0xb7, 0x26, 0xac, 0x8e, 0x3d, 0x19, + 0x1d, 0xc5, 0x32, 0xa3, 0x3c, 0x52, 0xc9, 0x00, 0x4e, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, + 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x2d, 0x5f, 0x8a, 0xe9, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x24, 0x0a, 0xac, 0xdb, 0x06, 0x55, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, + 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, + 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x47, 0x57, 0xfe, + 0x07, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2e, + 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0xda, 0x16, 0x39, + 0x42, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, + 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, + 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xf1, 0x29, 0x01, 0x86, 0x00, + 0x88, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf2, 0x19, 0x12, 0x04, 0x8a, 0x82, 0xed, 0x6f, + 0x0a, 0x49, 0x06, 0x5e, 0x94, 0xe7, 0x0c, 0x00, 0x99, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, + 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x0d, + 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x73, 0x65, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x24, 0x0a, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, + 0x63, 0x65, 0x00, 0x00, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, + 0x34, 0xf3, 0x2f, 0x7d, 0x92, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, + 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x5f, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, + 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, + 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x6f, 0x72, 0x69, 0x65, + 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, + 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, + 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x90, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x51, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, + 0x5f, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xf2, 0x19, 0x12, 0x04, 0x8a, 0x82, 0xed, 0x6f, 0x0a, 0x49, 0x06, 0x5e, + 0x94, 0xe7, 0x0c, 0xf1, 0xb7, 0xb7, 0x26, 0xac, 0x8e, 0x3d, 0x19, 0x1d, 0xc5, 0x32, 0xa3, 0x3c, + 0x52, 0xc9, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, + 0x7d, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, + 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0xf1, + 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0xf2, 0x6f, + 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0xf1, 0x2e, 0xd7, + 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovariance_>::type_info_blob() { + static const uint8_t blob[] = { + 0xf0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xb7, 0xb7, 0x26, 0xac, 0x8e, 0x3d, 0x19, 0x1d, 0xc5, 0x32, 0xa3, + 0x3c, 0x52, 0xc9, 0x00, 0x52, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, + 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x00, 0x55, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, + 0x47, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, + 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, 0x57, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x19, 0x12, 0x04, + 0x8a, 0x82, 0xed, 0x6f, 0x0a, 0x49, 0x06, 0x5e, 0x94, 0xe7, 0x0c, 0x00, 0x9d, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, 0xf3, 0x2f, 0x7d, 0x00, + 0x96, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, + 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, + 0x94, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::PoseWithCovariance_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::PoseWithCovariance_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::PoseWithCovariance_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::PoseWithCovariance_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::PoseWithCovariance_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.covariance()[0], instance.covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::PoseWithCovariance_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseWithCovariance_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::PoseWithCovariance_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.covariance()[0], instance.covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::PoseWithCovariance_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseWithCovariance_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::PoseWithCovariance_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.covariance()[0], instance.covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::PoseWithCovariance_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseWithCovariance_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::PoseWithCovariance_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.pose(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.covariance()[0], instance.covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::PoseWithCovariance_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::PoseWithCovariance_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_POSEWITHCOVARIANCE__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/Pose_.hpp b/unitree_SDK/include/unitree/idl/ros2/Pose_.hpp new file mode 100644 index 0000000..ed9f11f --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/Pose_.hpp @@ -0,0 +1,351 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Pose_.idl + Source: Pose_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_POSE__HPP +#define DDSCXX_UNITREE_IDL_ROS2_POSE__HPP + +#include "unitree/idl/ros2/Point_.hpp" + +#include "unitree/idl/ros2/Quaternion_.hpp" + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class Pose_ +{ +private: + ::geometry_msgs::msg::dds_::Point_ position_; + ::geometry_msgs::msg::dds_::Quaternion_ orientation_; + +public: + Pose_() = default; + + explicit Pose_( + const ::geometry_msgs::msg::dds_::Point_& position, + const ::geometry_msgs::msg::dds_::Quaternion_& orientation) : + position_(position), + orientation_(orientation) { } + + const ::geometry_msgs::msg::dds_::Point_& position() const { return this->position_; } + ::geometry_msgs::msg::dds_::Point_& position() { return this->position_; } + void position(const ::geometry_msgs::msg::dds_::Point_& _val_) { this->position_ = _val_; } + void position(::geometry_msgs::msg::dds_::Point_&& _val_) { this->position_ = _val_; } + const ::geometry_msgs::msg::dds_::Quaternion_& orientation() const { return this->orientation_; } + ::geometry_msgs::msg::dds_::Quaternion_& orientation() { return this->orientation_; } + void orientation(const ::geometry_msgs::msg::dds_::Quaternion_& _val_) { this->orientation_ = _val_; } + void orientation(::geometry_msgs::msg::dds_::Quaternion_&& _val_) { this->orientation_ = _val_; } + + bool operator==(const Pose_& _other) const + { + (void) _other; + return position_ == _other.position_ && + orientation_ == _other.orientation_; + } + + bool operator!=(const Pose_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::Pose_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::Pose_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::Pose_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Pose_>::type_map_blob_sz() { return 878; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Pose_>::type_info_blob_sz() { return 196; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Pose_>::type_map_blob() { + static const uint8_t blob[] = { + 0x27, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, + 0x11, 0x90, 0x31, 0xc4, 0x88, 0x17, 0xeb, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, + 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x47, 0x57, 0xfe, 0x07, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, + 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0xda, 0x16, 0x39, 0x42, 0xf1, 0x5e, 0x73, + 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x43, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, + 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, + 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, + 0xad, 0xe9, 0xe3, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, + 0x62, 0xa1, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xf1, 0x29, 0x01, 0x86, 0x00, 0xdc, 0x01, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, + 0xf3, 0x2f, 0x7d, 0x00, 0x92, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, + 0x3a, 0x3a, 0x50, 0x6f, 0x73, 0x65, 0x5f, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, + 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, + 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x6f, 0x72, 0x69, 0x65, + 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, + 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x50, 0x6f, 0x69, 0x6e, 0x74, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, + 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x90, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x51, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, + 0x5f, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, + 0xf3, 0x2f, 0x7d, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, 0x88, + 0x17, 0xeb, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, + 0xdf, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, + 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0xf1, + 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Pose_>::type_info_blob() { + static const uint8_t blob[] = { + 0xc0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x2f, 0x93, 0xf0, 0x5b, 0x8c, 0xef, 0xbe, 0x11, 0x90, 0x31, 0xc4, + 0x88, 0x17, 0xeb, 0x00, 0x55, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, + 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x47, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x0d, 0x47, 0x26, 0x4b, 0x4a, 0x66, 0xfa, 0x94, 0xbb, 0xfe, 0x34, + 0xf3, 0x2f, 0x7d, 0x00, 0x96, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x04, 0xac, 0x28, 0xf9, 0x19, 0x64, 0x23, + 0x5d, 0xc9, 0x81, 0xe3, 0xf8, 0xfa, 0xdf, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, + 0x94, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::Pose_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::Pose_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::Pose_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::Pose_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::Pose_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.position(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.orientation(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::Pose_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Pose_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::Pose_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.position(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.orientation(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::Pose_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Pose_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::Pose_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.position(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.orientation(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::Pose_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Pose_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::Pose_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.position(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.orientation(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::Pose_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Pose_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_POSE__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/QuaternionStamped_.hpp b/unitree_SDK/include/unitree/idl/ros2/QuaternionStamped_.hpp new file mode 100644 index 0000000..4aca1af --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/QuaternionStamped_.hpp @@ -0,0 +1,375 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: QuaternionStamped_.idl + Source: QuaternionStamped_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_QUATERNIONSTAMPED__HPP +#define DDSCXX_UNITREE_IDL_ROS2_QUATERNIONSTAMPED__HPP + +#include "unitree/idl/ros2/Quaternion_.hpp" + +#include "unitree/idl/ros2/Header_.hpp" + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class QuaternionStamped_ +{ +private: + ::std_msgs::msg::dds_::Header_ header_; + ::geometry_msgs::msg::dds_::Quaternion_ quaternion_; + +public: + QuaternionStamped_() = default; + + explicit QuaternionStamped_( + const ::std_msgs::msg::dds_::Header_& header, + const ::geometry_msgs::msg::dds_::Quaternion_& quaternion) : + header_(header), + quaternion_(quaternion) { } + + const ::std_msgs::msg::dds_::Header_& header() const { return this->header_; } + ::std_msgs::msg::dds_::Header_& header() { return this->header_; } + void header(const ::std_msgs::msg::dds_::Header_& _val_) { this->header_ = _val_; } + void header(::std_msgs::msg::dds_::Header_&& _val_) { this->header_ = _val_; } + const ::geometry_msgs::msg::dds_::Quaternion_& quaternion() const { return this->quaternion_; } + ::geometry_msgs::msg::dds_::Quaternion_& quaternion() { return this->quaternion_; } + void quaternion(const ::geometry_msgs::msg::dds_::Quaternion_& _val_) { this->quaternion_ = _val_; } + void quaternion(::geometry_msgs::msg::dds_::Quaternion_&& _val_) { this->quaternion_ = _val_; } + + bool operator==(const QuaternionStamped_& _other) const + { + (void) _other; + return header_ == _other.header_ && + quaternion_ == _other.quaternion_; + } + + bool operator!=(const QuaternionStamped_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::QuaternionStamped_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::QuaternionStamped_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::QuaternionStamped_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::QuaternionStamped_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::QuaternionStamped_>::type_map_blob_sz() { return 1132; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::QuaternionStamped_>::type_info_blob_sz() { return 244; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::QuaternionStamped_>::type_map_blob() { + static const uint8_t blob[] = { + 0x6f, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf1, 0x48, 0xbf, 0x6a, 0x4a, 0x49, 0x9d, 0x11, + 0xb6, 0x78, 0xe7, 0xaa, 0xeb, 0xe0, 0xd8, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, + 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, + 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x75, 0xb9, 0xaa, 0xa0, 0xf1, 0xdc, 0xf1, + 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x44, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, + 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, + 0x8d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x4b, 0xb3, 0x9c, 0x5c, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, + 0x46, 0xf9, 0x8d, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, + 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, + 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, + 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, + 0xad, 0xe9, 0xe3, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xf1, + 0x29, 0x01, 0x86, 0x00, 0x74, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf2, 0x08, 0x9d, 0x5a, + 0xed, 0x58, 0xa4, 0x0f, 0x87, 0xb3, 0x3b, 0xf3, 0x76, 0x5e, 0x82, 0x00, 0xa1, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x51, 0x75, 0x61, 0x74, 0x65, 0x72, + 0x6e, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x65, 0x64, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x5d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, + 0x55, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x6f, + 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x71, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, 0x00, 0x00, + 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, + 0x7b, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1d, 0x00, 0x00, 0x00, 0x73, 0x74, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, + 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, + 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, + 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, + 0x72, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, + 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6e, 0x6f, + 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, + 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x51, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, + 0x5f, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xf2, 0x08, 0x9d, 0x5a, 0xed, 0x58, 0xa4, 0x0f, 0x87, 0xb3, 0x3b, 0xf3, + 0x76, 0x5e, 0x82, 0xf1, 0x48, 0xbf, 0x6a, 0x4a, 0x49, 0x9d, 0x11, 0xb6, 0x78, 0xe7, 0xaa, 0xeb, + 0xe0, 0xd8, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, + 0x55, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, + 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0xf1, + 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0xf2, 0x6f, + 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0xf1, 0x2e, 0xd7, + 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::QuaternionStamped_>::type_info_blob() { + static const uint8_t blob[] = { + 0xf0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x48, 0xbf, 0x6a, 0x4a, 0x49, 0x9d, 0x11, 0xb6, 0x78, 0xe7, 0xaa, + 0xeb, 0xe0, 0xd8, 0x00, 0x55, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, + 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x48, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, + 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, 0x57, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x08, 0x9d, 0x5a, + 0xed, 0x58, 0xa4, 0x0f, 0x87, 0xb3, 0x3b, 0xf3, 0x76, 0x5e, 0x82, 0x00, 0xa5, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, + 0x7f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, + 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x76, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, + 0x94, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::QuaternionStamped_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::QuaternionStamped_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::QuaternionStamped_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::QuaternionStamped_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::QuaternionStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.quaternion(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::QuaternionStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::QuaternionStamped_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::QuaternionStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.quaternion(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::QuaternionStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::QuaternionStamped_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::QuaternionStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.quaternion(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::QuaternionStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::QuaternionStamped_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::QuaternionStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.quaternion(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::QuaternionStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::QuaternionStamped_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_QUATERNIONSTAMPED__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/Quaternion_.hpp b/unitree_SDK/include/unitree/idl/ros2/Quaternion_.hpp new file mode 100644 index 0000000..1be7f6c --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/Quaternion_.hpp @@ -0,0 +1,383 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Quaternion_.idl + Source: Quaternion_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_QUATERNION__HPP +#define DDSCXX_UNITREE_IDL_ROS2_QUATERNION__HPP + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class Quaternion_ +{ +private: + double x_ = 0.0; + double y_ = 0.0; + double z_ = 0.0; + double w_ = 0.0; + +public: + Quaternion_() = default; + + explicit Quaternion_( + double x, + double y, + double z, + double w) : + x_(x), + y_(y), + z_(z), + w_(w) { } + + double x() const { return this->x_; } + double& x() { return this->x_; } + void x(double _val_) { this->x_ = _val_; } + double y() const { return this->y_; } + double& y() { return this->y_; } + void y(double _val_) { this->y_ = _val_; } + double z() const { return this->z_; } + double& z() { return this->z_; } + void z(double _val_) { this->z_ = _val_; } + double w() const { return this->w_; } + double& w() { return this->w_; } + void w(double _val_) { this->w_ = _val_; } + + bool operator==(const Quaternion_& _other) const + { + (void) _other; + return x_ == _other.x_ && + y_ == _other.y_ && + z_ == _other.z_ && + w_ == _other.w_; + } + + bool operator!=(const Quaternion_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::Quaternion_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::Quaternion_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::Quaternion_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Quaternion_>::type_map_blob_sz() { return 322; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Quaternion_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Quaternion_>::type_map_blob() { + static const uint8_t blob[] = { + 0x6b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, + 0x4b, 0x34, 0x86, 0x46, 0xa9, 0x62, 0xa1, 0x00, 0x53, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xf1, 0x29, 0x01, 0x86, 0x00, + 0xa8, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, + 0x80, 0x58, 0xc3, 0xa8, 0xda, 0xe3, 0x52, 0x00, 0x90, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x51, 0x75, 0x61, 0x74, 0x65, 0x72, 0x6e, 0x69, 0x6f, 0x6e, + 0x5f, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, + 0xda, 0xe3, 0x52, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, 0xa9, + 0x62, 0xa1, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Quaternion_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x2e, 0xd7, 0x30, 0x7b, 0x8e, 0xc5, 0x7c, 0x4b, 0x34, 0x86, 0x46, + 0xa9, 0x62, 0xa1, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x6f, 0x01, 0xea, 0x49, 0x00, 0xbc, 0x02, 0x80, 0x58, 0xc3, 0xa8, + 0xda, 0xe3, 0x52, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::Quaternion_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::Quaternion_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::Quaternion_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::Quaternion_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::Quaternion_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.w())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::Quaternion_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Quaternion_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::Quaternion_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.w())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::Quaternion_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Quaternion_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::Quaternion_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.w())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::Quaternion_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Quaternion_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::Quaternion_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 3: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.w())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::Quaternion_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Quaternion_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_QUATERNION__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/String_.hpp b/unitree_SDK/include/unitree/idl/ros2/String_.hpp new file mode 100644 index 0000000..a05a6c8 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/String_.hpp @@ -0,0 +1,266 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: String_.idl + Source: String_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_STRING__HPP +#define DDSCXX_UNITREE_IDL_ROS2_STRING__HPP + +#include + +namespace std_msgs +{ +namespace msg +{ +namespace dds_ +{ +class String_ +{ +private: + std::string data_; + +public: + String_() = default; + + explicit String_( + const std::string& data) : + data_(data) { } + + const std::string& data() const { return this->data_; } + std::string& data() { return this->data_; } + void data(const std::string& _val_) { this->data_ = _val_; } + void data(std::string&& _val_) { this->data_ = _val_; } + + bool operator==(const String_& _other) const + { + (void) _other; + return data_ == _other.data_; + } + + bool operator!=(const String_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::std_msgs::msg::dds_::String_>::getTypeName() +{ + return "std_msgs::msg::dds_::String_"; +} + +template <> constexpr bool TopicTraits<::std_msgs::msg::dds_::String_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::std_msgs::msg::dds_::String_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::std_msgs::msg::dds_::String_>::type_map_blob_sz() { return 210; } +template<> constexpr unsigned int TopicTraits<::std_msgs::msg::dds_::String_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::std_msgs::msg::dds_::String_>::type_map_blob() { + static const uint8_t blob[] = { + 0x3c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x59, 0x65, 0x6d, 0x08, 0x0a, 0xb9, 0x26, + 0xa3, 0x33, 0xa6, 0x9d, 0x26, 0x9c, 0xb1, 0x00, 0x24, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x8d, 0x77, 0x7f, 0x38, + 0x67, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xc3, 0xda, 0x80, 0xd6, 0x38, 0xe9, 0x1b, + 0x9f, 0xad, 0x0a, 0x6b, 0x76, 0x5c, 0xc2, 0x00, 0x4f, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x73, 0x74, 0x64, 0x5f, + 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, + 0x3a, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xf2, 0xc3, 0xda, 0x80, 0xd6, 0x38, 0xe9, 0x1b, 0x9f, 0xad, 0x0a, 0x6b, + 0x76, 0x5c, 0xc2, 0xf1, 0x59, 0x65, 0x6d, 0x08, 0x0a, 0xb9, 0x26, 0xa3, 0x33, 0xa6, 0x9d, 0x26, + 0x9c, 0xb1, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::std_msgs::msg::dds_::String_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x59, 0x65, 0x6d, 0x08, 0x0a, 0xb9, 0x26, 0xa3, 0x33, 0xa6, 0x9d, + 0x26, 0x9c, 0xb1, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xc3, 0xda, 0x80, 0xd6, 0x38, 0xe9, 0x1b, 0x9f, 0xad, 0x0a, 0x6b, + 0x76, 0x5c, 0xc2, 0x00, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::std_msgs::msg::dds_::String_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::std_msgs::msg::dds_::String_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::std_msgs::msg::dds_::String_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::std_msgs::msg::dds_::String_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::std_msgs::msg::dds_::String_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.data(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::std_msgs::msg::dds_::String_& instance, bool as_key) { + auto &props = get_type_props<::std_msgs::msg::dds_::String_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::std_msgs::msg::dds_::String_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.data(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::std_msgs::msg::dds_::String_& instance, bool as_key) { + auto &props = get_type_props<::std_msgs::msg::dds_::String_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::std_msgs::msg::dds_::String_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.data(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::std_msgs::msg::dds_::String_& instance, bool as_key) { + auto &props = get_type_props<::std_msgs::msg::dds_::String_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::std_msgs::msg::dds_::String_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.data(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::std_msgs::msg::dds_::String_& instance, bool as_key) { + auto &props = get_type_props<::std_msgs::msg::dds_::String_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_STRING__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/Time_.hpp b/unitree_SDK/include/unitree/idl/ros2/Time_.hpp new file mode 100644 index 0000000..09eccab --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/Time_.hpp @@ -0,0 +1,302 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Time_.idl + Source: Time_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_TIME__HPP +#define DDSCXX_UNITREE_IDL_ROS2_TIME__HPP + +#include + +namespace builtin_interfaces +{ +namespace msg +{ +namespace dds_ +{ +class Time_ +{ +private: + int32_t sec_ = 0; + uint32_t nanosec_ = 0; + +public: + Time_() = default; + + explicit Time_( + int32_t sec, + uint32_t nanosec) : + sec_(sec), + nanosec_(nanosec) { } + + int32_t sec() const { return this->sec_; } + int32_t& sec() { return this->sec_; } + void sec(int32_t _val_) { this->sec_ = _val_; } + uint32_t nanosec() const { return this->nanosec_; } + uint32_t& nanosec() { return this->nanosec_; } + void nanosec(uint32_t _val_) { this->nanosec_ = _val_; } + + bool operator==(const Time_& _other) const + { + (void) _other; + return sec_ == _other.sec_ && + nanosec_ == _other.nanosec_; + } + + bool operator!=(const Time_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::builtin_interfaces::msg::dds_::Time_>::getTypeName() +{ + return "builtin_interfaces::msg::dds_::Time_"; +} + +template <> constexpr bool TopicTraits<::builtin_interfaces::msg::dds_::Time_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::builtin_interfaces::msg::dds_::Time_>::type_map_blob_sz() { return 262; } +template<> constexpr unsigned int TopicTraits<::builtin_interfaces::msg::dds_::Time_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::builtin_interfaces::msg::dds_::Time_>::type_map_blob() { + static const uint8_t blob[] = { + 0x4b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, + 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0x00, + 0x8a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, + 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x72, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x62, 0x75, 0x69, 0x6c, + 0x74, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, + 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, + 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::builtin_interfaces::msg::dds_::Time_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, + 0x46, 0xf9, 0x8d, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, + 0xe6, 0x32, 0x0d, 0x00, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::builtin_interfaces::msg::dds_::Time_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::builtin_interfaces::msg::dds_::Time_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::builtin_interfaces::msg::dds_::Time_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::builtin_interfaces::msg::dds_::Time_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::builtin_interfaces::msg::dds_::Time_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.sec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.nanosec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::builtin_interfaces::msg::dds_::Time_& instance, bool as_key) { + auto &props = get_type_props<::builtin_interfaces::msg::dds_::Time_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::builtin_interfaces::msg::dds_::Time_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.sec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.nanosec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::builtin_interfaces::msg::dds_::Time_& instance, bool as_key) { + auto &props = get_type_props<::builtin_interfaces::msg::dds_::Time_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::builtin_interfaces::msg::dds_::Time_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.sec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.nanosec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::builtin_interfaces::msg::dds_::Time_& instance, bool as_key) { + auto &props = get_type_props<::builtin_interfaces::msg::dds_::Time_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::builtin_interfaces::msg::dds_::Time_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.sec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.nanosec())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::builtin_interfaces::msg::dds_::Time_& instance, bool as_key) { + auto &props = get_type_props<::builtin_interfaces::msg::dds_::Time_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_TIME__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/TwistStamped_.hpp b/unitree_SDK/include/unitree/idl/ros2/TwistStamped_.hpp new file mode 100644 index 0000000..55d054f --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/TwistStamped_.hpp @@ -0,0 +1,394 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: TwistStamped_.idl + Source: TwistStamped_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_TWISTSTAMPED__HPP +#define DDSCXX_UNITREE_IDL_ROS2_TWISTSTAMPED__HPP + +#include "unitree/idl/ros2/Twist_.hpp" + +#include "unitree/idl/ros2/Header_.hpp" + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class TwistStamped_ +{ +private: + ::std_msgs::msg::dds_::Header_ header_; + ::geometry_msgs::msg::dds_::Twist_ twist_; + +public: + TwistStamped_() = default; + + explicit TwistStamped_( + const ::std_msgs::msg::dds_::Header_& header, + const ::geometry_msgs::msg::dds_::Twist_& twist) : + header_(header), + twist_(twist) { } + + const ::std_msgs::msg::dds_::Header_& header() const { return this->header_; } + ::std_msgs::msg::dds_::Header_& header() { return this->header_; } + void header(const ::std_msgs::msg::dds_::Header_& _val_) { this->header_ = _val_; } + void header(::std_msgs::msg::dds_::Header_&& _val_) { this->header_ = _val_; } + const ::geometry_msgs::msg::dds_::Twist_& twist() const { return this->twist_; } + ::geometry_msgs::msg::dds_::Twist_& twist() { return this->twist_; } + void twist(const ::geometry_msgs::msg::dds_::Twist_& _val_) { this->twist_ = _val_; } + void twist(::geometry_msgs::msg::dds_::Twist_&& _val_) { this->twist_ = _val_; } + + bool operator==(const TwistStamped_& _other) const + { + (void) _other; + return header_ == _other.header_ && + twist_ == _other.twist_; + } + + bool operator!=(const TwistStamped_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::TwistStamped_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::TwistStamped_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::TwistStamped_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::TwistStamped_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::TwistStamped_>::type_map_blob_sz() { return 1378; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::TwistStamped_>::type_info_blob_sz() { return 292; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::TwistStamped_>::type_map_blob() { + static const uint8_t blob[] = { + 0xc3, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf1, 0x73, 0xe5, 0x49, 0xa3, 0xc7, 0xc7, 0x09, + 0x40, 0xe3, 0xe7, 0xba, 0xfb, 0x9f, 0x5d, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, + 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, + 0xbe, 0xe5, 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0xeb, 0x3b, 0xac, 0x16, 0xf1, 0xdc, 0xf1, + 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x44, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, + 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, + 0x8d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x4b, 0xb3, 0x9c, 0x5c, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, + 0x46, 0xf9, 0x8d, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0xf1, 0x28, 0xcf, 0x21, 0x56, + 0x4e, 0xbe, 0xe5, 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, + 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x9a, 0x93, 0x2b, + 0x3c, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, + 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0xd1, 0x8b, 0x86, + 0x24, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, + 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, 0xf8, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0xf2, 0x47, 0x67, 0x84, 0x3d, 0x44, 0x90, 0x86, 0x2d, 0xa2, 0x41, 0xbe, 0x2e, 0x36, 0xde, 0x00, + 0x94, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, + 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x77, + 0x69, 0x73, 0x74, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x65, 0x64, 0x5f, 0x00, 0x58, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xe5, + 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, + 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x74, 0x77, 0x69, 0x73, 0x74, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, + 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x7b, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x73, 0x74, 0x64, 0x5f, + 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, + 0x3a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xd4, + 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x09, 0x00, 0x00, 0x00, 0x66, 0x72, 0x61, 0x6d, + 0x65, 0x5f, 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, + 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x62, 0x75, 0x69, 0x6c, + 0x74, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x3a, 0x3a, + 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x69, 0x6d, 0x65, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x65, 0x63, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0xf2, 0x66, + 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x00, 0x00, 0x00, + 0x92, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, + 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x77, + 0x69, 0x73, 0x74, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, + 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, + 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x61, 0x6e, 0x67, 0x75, + 0x6c, 0x61, 0x72, 0x00, 0x00, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, + 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x33, 0x5f, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x7a, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf2, 0x47, 0x67, 0x84, + 0x3d, 0x44, 0x90, 0x86, 0x2d, 0xa2, 0x41, 0xbe, 0x2e, 0x36, 0xde, 0xf1, 0x73, 0xe5, 0x49, 0xa3, + 0xc7, 0xc7, 0x09, 0x40, 0xe3, 0xe7, 0xba, 0xfb, 0x9f, 0x5d, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, + 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, + 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, + 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, + 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, + 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, 0x84, 0x6f, 0x1b, + 0x3c, 0xfb, 0x2b, 0x52, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, + 0x78, 0xfd, 0x32, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, + 0x4c, 0xbc, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::TwistStamped_>::type_info_blob() { + static const uint8_t blob[] = { + 0x20, 0x01, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x88, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x73, 0xe5, 0x49, 0xa3, 0xc7, 0xc7, 0x09, 0x40, 0xe3, 0xe7, 0xba, + 0xfb, 0x9f, 0x5d, 0x00, 0x55, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, + 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x48, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, + 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0x00, 0x55, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, + 0x47, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x88, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x47, 0x67, 0x84, 0x3d, 0x44, 0x90, 0x86, 0x2d, 0xa2, 0x41, 0xbe, + 0x2e, 0x36, 0xde, 0x00, 0x98, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, + 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, + 0x76, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, + 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x00, 0x96, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, + 0x7c, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::TwistStamped_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::TwistStamped_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::TwistStamped_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::TwistStamped_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::TwistStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::TwistStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistStamped_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::TwistStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::TwistStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistStamped_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::TwistStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::TwistStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistStamped_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::TwistStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::TwistStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistStamped_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_TWISTSTAMPED__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/TwistWithCovarianceStamped_.hpp b/unitree_SDK/include/unitree/idl/ros2/TwistWithCovarianceStamped_.hpp new file mode 100644 index 0000000..803c49f --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/TwistWithCovarianceStamped_.hpp @@ -0,0 +1,417 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: TwistWithCovarianceStamped_.idl + Source: TwistWithCovarianceStamped_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_TWISTWITHCOVARIANCESTAMPED__HPP +#define DDSCXX_UNITREE_IDL_ROS2_TWISTWITHCOVARIANCESTAMPED__HPP + +#include "unitree/idl/ros2/TwistWithCovariance_.hpp" + +#include "unitree/idl/ros2/Header_.hpp" + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class TwistWithCovarianceStamped_ +{ +private: + ::std_msgs::msg::dds_::Header_ header_; + ::geometry_msgs::msg::dds_::TwistWithCovariance_ twist_; + +public: + TwistWithCovarianceStamped_() = default; + + explicit TwistWithCovarianceStamped_( + const ::std_msgs::msg::dds_::Header_& header, + const ::geometry_msgs::msg::dds_::TwistWithCovariance_& twist) : + header_(header), + twist_(twist) { } + + const ::std_msgs::msg::dds_::Header_& header() const { return this->header_; } + ::std_msgs::msg::dds_::Header_& header() { return this->header_; } + void header(const ::std_msgs::msg::dds_::Header_& _val_) { this->header_ = _val_; } + void header(::std_msgs::msg::dds_::Header_&& _val_) { this->header_ = _val_; } + const ::geometry_msgs::msg::dds_::TwistWithCovariance_& twist() const { return this->twist_; } + ::geometry_msgs::msg::dds_::TwistWithCovariance_& twist() { return this->twist_; } + void twist(const ::geometry_msgs::msg::dds_::TwistWithCovariance_& _val_) { this->twist_ = _val_; } + void twist(::geometry_msgs::msg::dds_::TwistWithCovariance_&& _val_) { this->twist_ = _val_; } + + bool operator==(const TwistWithCovarianceStamped_& _other) const + { + (void) _other; + return header_ == _other.header_ && + twist_ == _other.twist_; + } + + bool operator!=(const TwistWithCovarianceStamped_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::TwistWithCovarianceStamped_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>::type_map_blob_sz() { return 1696; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>::type_info_blob_sz() { return 340; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>::type_map_blob() { + static const uint8_t blob[] = { + 0x27, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xf1, 0x6b, 0x99, 0xff, 0x52, 0x31, 0x98, 0x5f, + 0xa5, 0x4d, 0x78, 0x46, 0x89, 0xff, 0xf4, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, + 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x40, 0xaa, 0x70, 0xe1, 0xf7, + 0x44, 0x45, 0x66, 0x8e, 0xcd, 0x3e, 0x4a, 0x4b, 0xa6, 0xeb, 0x3b, 0xac, 0x16, 0xf1, 0xdc, 0xf1, + 0x2c, 0xd2, 0xdd, 0x5e, 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x44, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x56, + 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x96, 0xb8, 0xc7, + 0x8d, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x4b, 0xb3, 0x9c, 0x5c, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, + 0x46, 0xf9, 0x8d, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x74, 0x45, 0x9c, 0xa3, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0xe2, 0x04, 0x64, 0xd5, 0xf1, 0x40, 0xaa, 0x70, 0xe1, + 0xf7, 0x44, 0x45, 0x66, 0x8e, 0xcd, 0x3e, 0x4a, 0x4b, 0xa6, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x28, + 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0xeb, 0x3b, 0xac, + 0x16, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x0a, 0xac, 0xdb, 0x06, 0x55, 0xf1, 0x28, + 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0x00, 0x00, 0x00, + 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, + 0xbc, 0x9a, 0x93, 0x2b, 0x3c, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, + 0xbc, 0xd1, 0x8b, 0x86, 0x24, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, + 0x76, 0xcd, 0x4c, 0xbc, 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, 0xb4, 0x03, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0xf2, 0x4d, 0x3f, 0xc8, 0x81, 0x9c, 0xdd, 0x5f, 0x9e, 0x68, 0x92, 0x3d, + 0xe6, 0x2d, 0xf3, 0x00, 0xa4, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x3e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, + 0x3a, 0x3a, 0x54, 0x77, 0x69, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, 0x76, 0x61, 0x72, + 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x65, 0x64, 0x5f, 0x00, 0x00, 0x00, + 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, + 0x55, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xf5, + 0xc6, 0x39, 0xf6, 0x33, 0xf1, 0x5a, 0x6d, 0x7b, 0xe3, 0xa4, 0x7b, 0x7e, 0x15, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x74, 0x77, 0x69, 0x73, 0x74, 0x00, 0x00, 0x00, 0xf2, 0xe5, 0x76, 0x5e, + 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, 0x7b, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, + 0x73, 0x74, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, + 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x47, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, + 0x0d, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x66, 0x72, 0x61, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, + 0xae, 0xf3, 0x2d, 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x62, 0x75, 0x69, 0x6c, 0x74, 0x69, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, + 0x69, 0x6d, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x73, 0x65, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x07, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6e, 0x61, 0x6e, 0x6f, 0x73, 0x65, 0x63, 0x00, + 0x00, 0x00, 0xf2, 0xf5, 0xc6, 0x39, 0xf6, 0x33, 0xf1, 0x5a, 0x6d, 0x7b, 0xe3, 0xa4, 0x7b, 0x7e, + 0x15, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x37, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, + 0x3a, 0x3a, 0x54, 0x77, 0x69, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, 0x76, 0x61, 0x72, + 0x69, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, + 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x74, 0x77, 0x69, 0x73, 0x74, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x0a, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x00, 0x00, + 0x00, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, + 0x92, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x21, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, + 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x77, + 0x69, 0x73, 0x74, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, + 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x6c, 0x69, 0x6e, 0x65, 0x61, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, + 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x61, 0x6e, 0x67, 0x75, + 0x6c, 0x61, 0x72, 0x00, 0x00, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, + 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x33, 0x5f, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x7a, 0x00, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xf2, 0x4d, 0x3f, 0xc8, + 0x81, 0x9c, 0xdd, 0x5f, 0x9e, 0x68, 0x92, 0x3d, 0xe6, 0x2d, 0xf3, 0xf1, 0x6b, 0x99, 0xff, 0x52, + 0x31, 0x98, 0x5f, 0xa5, 0x4d, 0x78, 0x46, 0x89, 0xff, 0xf4, 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, + 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, + 0x71, 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, + 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, + 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0xf2, 0xf5, 0xc6, 0x39, 0xf6, 0x33, 0xf1, 0x5a, 0x6d, 0x7b, + 0xe3, 0xa4, 0x7b, 0x7e, 0x15, 0xf1, 0x40, 0xaa, 0x70, 0xe1, 0xf7, 0x44, 0x45, 0x66, 0x8e, 0xcd, + 0x3e, 0x4a, 0x4b, 0xa6, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, + 0x17, 0x6d, 0x6f, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, 0x84, 0x6f, 0x1b, 0x3c, 0xfb, + 0x2b, 0x52, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, + 0x32, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, +}; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>::type_info_blob() { + static const uint8_t blob[] = { + 0x50, 0x01, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0xa0, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x6b, 0x99, 0xff, 0x52, 0x31, 0x98, 0x5f, 0xa5, 0x4d, 0x78, 0x46, + 0x89, 0xff, 0xf4, 0x00, 0x55, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xdc, 0xf1, 0x2c, 0xd2, 0xdd, 0x5e, 0x71, + 0x2c, 0xb7, 0xb1, 0xe5, 0x1f, 0xa3, 0xf2, 0x00, 0x48, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x56, 0x7c, 0x5a, 0x93, 0x54, 0x1c, 0x3b, 0x10, 0x86, 0xa4, 0xba, 0x46, 0xf9, 0x8d, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x40, 0xaa, 0x70, 0xe1, 0xf7, 0x44, 0x45, + 0x66, 0x8e, 0xcd, 0x3e, 0x4a, 0x4b, 0xa6, 0x00, 0x52, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0x00, + 0x55, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, + 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x47, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0xa0, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x4d, 0x3f, 0xc8, + 0x81, 0x9c, 0xdd, 0x5f, 0x9e, 0x68, 0x92, 0x3d, 0xe6, 0x2d, 0xf3, 0x00, 0xa8, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xe5, 0x76, 0x5e, 0xc4, 0x8c, 0xff, 0xd4, 0x19, 0xed, 0x7f, 0xe8, 0x4e, 0x2a, 0x55, 0x00, + 0x7f, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd4, 0x85, 0x4f, 0x13, 0xae, 0xf3, 0x2d, + 0xfe, 0x21, 0x57, 0xf3, 0xe6, 0x32, 0x0d, 0x00, 0x76, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xf5, 0xc6, 0x39, 0xf6, 0x33, 0xf1, 0x5a, 0x6d, 0x7b, 0xe3, 0xa4, 0x7b, 0x7e, 0x15, 0x00, + 0x9d, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, + 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x00, 0x96, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, + 0x7c, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistWithCovarianceStamped_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_TWISTWITHCOVARIANCESTAMPED__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/TwistWithCovariance_.hpp b/unitree_SDK/include/unitree/idl/ros2/TwistWithCovariance_.hpp new file mode 100644 index 0000000..945a8cc --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/TwistWithCovariance_.hpp @@ -0,0 +1,367 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: TwistWithCovariance_.idl + Source: TwistWithCovariance_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_TWISTWITHCOVARIANCE__HPP +#define DDSCXX_UNITREE_IDL_ROS2_TWISTWITHCOVARIANCE__HPP + +#include "unitree/idl/ros2/Twist_.hpp" + +#include + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class TwistWithCovariance_ +{ +private: + ::geometry_msgs::msg::dds_::Twist_ twist_; + std::array covariance_ = { }; + +public: + TwistWithCovariance_() = default; + + explicit TwistWithCovariance_( + const ::geometry_msgs::msg::dds_::Twist_& twist, + const std::array& covariance) : + twist_(twist), + covariance_(covariance) { } + + const ::geometry_msgs::msg::dds_::Twist_& twist() const { return this->twist_; } + ::geometry_msgs::msg::dds_::Twist_& twist() { return this->twist_; } + void twist(const ::geometry_msgs::msg::dds_::Twist_& _val_) { this->twist_ = _val_; } + void twist(::geometry_msgs::msg::dds_::Twist_&& _val_) { this->twist_ = _val_; } + const std::array& covariance() const { return this->covariance_; } + std::array& covariance() { return this->covariance_; } + void covariance(const std::array& _val_) { this->covariance_ = _val_; } + void covariance(std::array&& _val_) { this->covariance_ = _val_; } + + bool operator==(const TwistWithCovariance_& _other) const + { + (void) _other; + return twist_ == _other.twist_ && + covariance_ == _other.covariance_; + } + + bool operator!=(const TwistWithCovariance_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovariance_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::TwistWithCovariance_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovariance_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovariance_>::type_map_blob_sz() { return 882; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovariance_>::type_info_blob_sz() { return 196; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovariance_>::type_map_blob() { + static const uint8_t blob[] = { + 0x23, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf1, 0x40, 0xaa, 0x70, 0xe1, 0xf7, 0x44, 0x45, + 0x66, 0x8e, 0xcd, 0x3e, 0x4a, 0x4b, 0xa6, 0x00, 0x4e, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, + 0xbe, 0xe5, 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0xeb, 0x3b, 0xac, 0x16, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x24, 0x0a, 0xac, 0xdb, 0x06, 0x55, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, + 0xbe, 0xe5, 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, + 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x9a, 0x93, 0x2b, + 0x3c, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, + 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0xd1, 0x8b, 0x86, + 0x24, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, + 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, 0xe4, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0xf2, 0xf5, 0xc6, 0x39, 0xf6, 0x33, 0xf1, 0x5a, 0x6d, 0x7b, 0xe3, 0xa4, 0x7b, 0x7e, 0x15, 0x00, + 0x99, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2f, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, + 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x77, + 0x69, 0x73, 0x74, 0x57, 0x69, 0x74, 0x68, 0x43, 0x6f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x63, + 0x65, 0x5f, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, + 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x74, 0x77, 0x69, 0x73, + 0x74, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x90, 0xf3, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x0a, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x63, 0x6f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x00, 0x00, 0x00, 0xf2, 0x66, 0x9d, + 0xb6, 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x92, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x77, 0x69, 0x73, 0x74, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, + 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6c, 0x69, 0x6e, 0x65, + 0x61, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, + 0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x61, 0x6e, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x00, + 0x00, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, + 0x32, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, + 0x3a, 0x3a, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x33, 0x5f, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, + 0x5e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf2, 0xf5, 0xc6, 0x39, 0xf6, 0x33, 0xf1, 0x5a, + 0x6d, 0x7b, 0xe3, 0xa4, 0x7b, 0x7e, 0x15, 0xf1, 0x40, 0xaa, 0x70, 0xe1, 0xf7, 0x44, 0x45, 0x66, + 0x8e, 0xcd, 0x3e, 0x4a, 0x4b, 0xa6, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, + 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, 0x84, 0x6f, 0x1b, + 0x3c, 0xfb, 0x2b, 0x52, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, + 0x78, 0xfd, 0x32, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, + 0x4c, 0xbc, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovariance_>::type_info_blob() { + static const uint8_t blob[] = { + 0xc0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x40, 0xaa, 0x70, 0xe1, 0xf7, 0x44, 0x45, 0x66, 0x8e, 0xcd, 0x3e, + 0x4a, 0x4b, 0xa6, 0x00, 0x52, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, + 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0x00, 0x55, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, + 0x47, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xf5, 0xc6, 0x39, 0xf6, 0x33, 0xf1, 0x5a, 0x6d, 0x7b, 0xe3, 0xa4, + 0x7b, 0x7e, 0x15, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, + 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x00, 0x96, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, + 0x7c, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::TwistWithCovariance_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::TwistWithCovariance_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::TwistWithCovariance_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::TwistWithCovariance_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::TwistWithCovariance_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!write(streamer, instance.covariance()[0], instance.covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::TwistWithCovariance_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistWithCovariance_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::TwistWithCovariance_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!read(streamer, instance.covariance()[0], instance.covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::TwistWithCovariance_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistWithCovariance_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::TwistWithCovariance_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!move(streamer, instance.covariance()[0], instance.covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::TwistWithCovariance_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistWithCovariance_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::TwistWithCovariance_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.twist(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(true, true)) + return false; + if (!max(streamer, instance.covariance()[0], instance.covariance().size())) + return false; + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::TwistWithCovariance_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::TwistWithCovariance_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_TWISTWITHCOVARIANCE__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/Twist_.hpp b/unitree_SDK/include/unitree/idl/ros2/Twist_.hpp new file mode 100644 index 0000000..f722e45 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/Twist_.hpp @@ -0,0 +1,328 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Twist_.idl + Source: Twist_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_TWIST__HPP +#define DDSCXX_UNITREE_IDL_ROS2_TWIST__HPP + +#include "unitree/idl/ros2/Vector3_.hpp" + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class Twist_ +{ +private: + ::geometry_msgs::msg::dds_::Vector3_ linear_; + ::geometry_msgs::msg::dds_::Vector3_ angular_; + +public: + Twist_() = default; + + explicit Twist_( + const ::geometry_msgs::msg::dds_::Vector3_& linear, + const ::geometry_msgs::msg::dds_::Vector3_& angular) : + linear_(linear), + angular_(angular) { } + + const ::geometry_msgs::msg::dds_::Vector3_& linear() const { return this->linear_; } + ::geometry_msgs::msg::dds_::Vector3_& linear() { return this->linear_; } + void linear(const ::geometry_msgs::msg::dds_::Vector3_& _val_) { this->linear_ = _val_; } + void linear(::geometry_msgs::msg::dds_::Vector3_&& _val_) { this->linear_ = _val_; } + const ::geometry_msgs::msg::dds_::Vector3_& angular() const { return this->angular_; } + ::geometry_msgs::msg::dds_::Vector3_& angular() { return this->angular_; } + void angular(const ::geometry_msgs::msg::dds_::Vector3_& _val_) { this->angular_ = _val_; } + void angular(::geometry_msgs::msg::dds_::Vector3_&& _val_) { this->angular_ = _val_; } + + bool operator==(const Twist_& _other) const + { + (void) _other; + return linear_ == _other.linear_ && + angular_ == _other.angular_; + } + + bool operator!=(const Twist_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::Twist_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::Twist_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::Twist_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Twist_>::type_map_blob_sz() { return 580; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Twist_>::type_info_blob_sz() { return 148; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Twist_>::type_map_blob() { + static const uint8_t blob[] = { + 0xbf, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, + 0x84, 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, + 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x9a, 0x93, 0x2b, 0x3c, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, + 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0xd1, 0x8b, 0x86, 0x24, 0xf1, 0x5e, 0x73, + 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x43, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, + 0xd4, 0xe4, 0x61, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, + 0x52, 0x90, 0x76, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, + 0xad, 0xe9, 0xe3, 0x00, 0x38, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf2, 0x66, 0x9d, 0xb6, + 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x00, 0x92, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, + 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, + 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x54, 0x77, 0x69, 0x73, 0x74, 0x5f, + 0x00, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, + 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x6c, 0x69, 0x6e, 0x65, + 0x61, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, + 0x32, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x61, 0x6e, 0x67, 0x75, 0x6c, 0x61, 0x72, 0x00, + 0x00, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, + 0x32, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, + 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, + 0x3a, 0x3a, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x33, 0x5f, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf2, 0x66, 0x9d, 0xb6, 0x2b, 0xd5, 0x53, 0x1f, + 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, 0x84, + 0x6f, 0x1b, 0x3c, 0xfb, 0x2b, 0x52, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, + 0xda, 0xb3, 0x78, 0xfd, 0x32, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, + 0x76, 0xcd, 0x4c, 0xbc, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Twist_>::type_info_blob() { + static const uint8_t blob[] = { + 0x90, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x28, 0xcf, 0x21, 0x56, 0x4e, 0xbe, 0xe5, 0x84, 0x6f, 0x1b, 0x3c, + 0xfb, 0x2b, 0x52, 0x00, 0x55, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, + 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x47, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x40, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x66, 0x9d, 0xb6, + 0x2b, 0xd5, 0x53, 0x1f, 0x0b, 0xe5, 0x2c, 0x2a, 0x17, 0x6d, 0x6f, 0x00, 0x96, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, + 0x7c, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::Twist_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::Twist_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::Twist_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::Twist_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::Twist_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.linear(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.angular(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::Twist_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Twist_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::Twist_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.linear(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.angular(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::Twist_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Twist_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::Twist_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.linear(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.angular(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::Twist_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Twist_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::Twist_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.linear(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.angular(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::Twist_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Twist_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_TWIST__HPP diff --git a/unitree_SDK/include/unitree/idl/ros2/Vector3_.hpp b/unitree_SDK/include/unitree/idl/ros2/Vector3_.hpp new file mode 100644 index 0000000..14cfd21 --- /dev/null +++ b/unitree_SDK/include/unitree/idl/ros2/Vector3_.hpp @@ -0,0 +1,341 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Vector3_.idl + Source: Vector3_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_UNITREE_IDL_ROS2_VECTOR3__HPP +#define DDSCXX_UNITREE_IDL_ROS2_VECTOR3__HPP + + +namespace geometry_msgs +{ +namespace msg +{ +namespace dds_ +{ +class Vector3_ +{ +private: + double x_ = 0.0; + double y_ = 0.0; + double z_ = 0.0; + +public: + Vector3_() = default; + + explicit Vector3_( + double x, + double y, + double z) : + x_(x), + y_(y), + z_(z) { } + + double x() const { return this->x_; } + double& x() { return this->x_; } + void x(double _val_) { this->x_ = _val_; } + double y() const { return this->y_; } + double& y() { return this->y_; } + void y(double _val_) { this->y_ = _val_; } + double z() const { return this->z_; } + double& z() { return this->z_; } + void z(double _val_) { this->z_ = _val_; } + + bool operator==(const Vector3_& _other) const + { + (void) _other; + return x_ == _other.x_ && + y_ == _other.y_ && + z_ == _other.z_; + } + + bool operator!=(const Vector3_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::geometry_msgs::msg::dds_::Vector3_>::getTypeName() +{ + return "geometry_msgs::msg::dds_::Vector3_"; +} + +template <> constexpr bool TopicTraits<::geometry_msgs::msg::dds_::Vector3_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Vector3_>::type_map_blob_sz() { return 282; } +template<> constexpr unsigned int TopicTraits<::geometry_msgs::msg::dds_::Vector3_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Vector3_>::type_map_blob() { + static const uint8_t blob[] = { + 0x5b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, + 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, 0x00, 0x43, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x9d, 0xd4, 0xe4, 0x61, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x41, 0x52, 0x90, 0x76, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0xfb, 0xad, 0xe9, 0xe3, 0x00, + 0x90, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, + 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x67, 0x65, 0x6f, 0x6d, + 0x65, 0x74, 0x72, 0x79, 0x5f, 0x6d, 0x73, 0x67, 0x73, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, + 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x56, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x33, 0x5f, 0x00, 0x00, + 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x7a, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xac, 0xe2, 0x5e, + 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, 0x78, 0xfd, 0x32, 0xf1, 0x5e, 0x73, 0x97, 0xe7, + 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, 0xcd, 0x4c, 0xbc, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::geometry_msgs::msg::dds_::Vector3_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5e, 0x73, 0x97, 0xe7, 0xe8, 0x64, 0x40, 0xdf, 0x64, 0xaf, 0x76, + 0xcd, 0x4c, 0xbc, 0x00, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xac, 0xe2, 0x5e, 0x59, 0xb0, 0x1a, 0x7a, 0x3a, 0x5c, 0xda, 0xb3, + 0x78, 0xfd, 0x32, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::geometry_msgs::msg::dds_::Vector3_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::geometry_msgs::msg::dds_::Vector3_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::geometry_msgs::msg::dds_::Vector3_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::geometry_msgs::msg::dds_::Vector3_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::geometry_msgs::msg::dds_::Vector3_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::geometry_msgs::msg::dds_::Vector3_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Vector3_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::geometry_msgs::msg::dds_::Vector3_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::geometry_msgs::msg::dds_::Vector3_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Vector3_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::geometry_msgs::msg::dds_::Vector3_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::geometry_msgs::msg::dds_::Vector3_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Vector3_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::geometry_msgs::msg::dds_::Vector3_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.x())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.y())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.z())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::geometry_msgs::msg::dds_::Vector3_& instance, bool as_key) { + auto &props = get_type_props<::geometry_msgs::msg::dds_::Vector3_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_UNITREE_IDL_ROS2_VECTOR3__HPP diff --git a/unitree_SDK/include/unitree/robot/b2/back_video/back_video_api.hpp b/unitree_SDK/include/unitree/robot/b2/back_video/back_video_api.hpp new file mode 100644 index 0000000..39a61d3 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/back_video/back_video_api.hpp @@ -0,0 +1,24 @@ +#ifndef __UT_ROBOT_B2_BACK_VIDEO_API_HPP__ +#define __UT_ROBOT_B2_BACK_VIDEO_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/*service name*/ +const std::string ROBOT_BACK_VIDEO_SERVICE_NAME = "back_videohub"; + +/*api version*/ +const std::string ROBOT_BACK_VIDEO_API_VERSION = "1.0.0.0"; + +/*api id*/ +const int32_t ROBOT_BACK_VIDEO_API_ID_GETIMAGESAMPLE = 1001; +} +} +} + +#endif //__UT_ROBOT_B2_BACK_VIDEO_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/back_video/back_video_client.hpp b/unitree_SDK/include/unitree/robot/b2/back_video/back_video_client.hpp new file mode 100644 index 0000000..52a684f --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/back_video/back_video_client.hpp @@ -0,0 +1,34 @@ +#ifndef __UT_ROBOT_B2_BACK_VIDEO_CLIENT_HPP__ +#define __UT_ROBOT_B2_BACK_VIDEO_CLIENT_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/* + * BackVideoClient + */ +class BackVideoClient : public Client +{ +public: + explicit BackVideoClient(); + ~BackVideoClient(); + + void Init(); + + /* + * @brief GetImageSample + * @api: 1001 + */ + int32_t GetImageSample(std::vector&); + +}; +} +} +} + +#endif//__UT_ROBOT_B2_BACK_VIDEO_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/back_video/back_video_error.hpp b/unitree_SDK/include/unitree/robot/b2/back_video/back_video_error.hpp new file mode 100644 index 0000000..bdd06cd --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/back_video/back_video_error.hpp @@ -0,0 +1,17 @@ +#ifndef __UT_ROBOT_B2_BACK_VIDEO_ERROR_HPP__ +#define __UT_ROBOT_B2_BACK_VIDEO_ERROR_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ + UT_DECL_ERR(UT_ROBOT_BACK_VIDEO_ERR_COMM, 100, "Invalid parameter") +} +} +} + +#endif//__UT_ROBOT_B2_BACK_VIDEO_ERROR_HPP__ \ No newline at end of file diff --git a/unitree_SDK/include/unitree/robot/b2/config/config_api.hpp b/unitree_SDK/include/unitree/robot/b2/config/config_api.hpp new file mode 100644 index 0000000..acdaadd --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/config/config_api.hpp @@ -0,0 +1,210 @@ +#ifndef __UT_ROBOT_B2_CONFIG_API_HPP__ +#define __UT_ROBOT_B2_CONFIG_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/* + * service name + */ +const std::string CONFIG_SERVICE_NAME = "config"; + +/* + * api version + */ +const std::string CONFIG_API_VERSION = "1.0.0.1"; + +/* + * api id + */ +const int32_t CONFIG_API_ID_SET = 1001; +const int32_t CONFIG_API_ID_GET = 1002; +const int32_t CONFIG_API_ID_DEL = 1003; +const int32_t CONFIG_API_ID_META = 1004; + +/* + * data type + */ +class JsonizeConfigMeta : public common::Jsonize +{ +public: + JsonizeConfigMeta() + {} + + ~JsonizeConfigMeta() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + common::FromJson(json["lastModified"], lastModified); + common::FromJson(json["size"], size); + common::FromJson(json["epoch"], epoch); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + common::ToJson(lastModified, json["lastModified"]); + common::ToJson(size, json["size"]); + common::ToJson(epoch, json["epoch"]); + } + +public: + std::string name; + std::string lastModified; + int32_t size; + int32_t epoch; +}; + +class ConfigSetParameter : public common::Jsonize +{ +public: + ConfigSetParameter() + {} + + ~ConfigSetParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + common::FromJson(json["content"], content); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + common::ToJson(content, json["content"]); + } + +public: + std::string name; + std::string content; +}; + +class ConfigGetParameter : public common::Jsonize +{ +public: + ConfigGetParameter() + {} + + ~ConfigGetParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + } + +public: + std::string name; +}; + +class ConfigGetData : public common::Jsonize +{ +public: + ConfigGetData() + {} + + ~ConfigGetData() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["content"], content); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(content, json["content"]); + } + +public: + std::string content; +}; + +class ConfigDelParameter : public common::Jsonize +{ +public: + ConfigDelParameter() + {} + + ~ConfigDelParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + } + +public: + std::string name; +}; + +class ConfigMetaParameter : public common::Jsonize +{ +public: + ConfigMetaParameter() + {} + + ~ConfigMetaParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + } + +public: + std::string name; +}; + +class ConfigMetaData : public common::Jsonize +{ +public: + ConfigMetaData() + {} + + ~ConfigMetaData() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["meta"], meta); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(meta, json["meta"]); + } + +public: + JsonizeConfigMeta meta; +}; + +} +} +} + +#endif//__UT_ROBOT_B2_CONFIG_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/config/config_client.hpp b/unitree_SDK/include/unitree/robot/b2/config/config_client.hpp new file mode 100644 index 0000000..489bb66 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/config/config_client.hpp @@ -0,0 +1,68 @@ +#ifndef __UT_ROBOT_B2_CONFIG_CLIENT_HPP__ +#define __UT_ROBOT_B2_CONFIG_CLIENT_HPP__ + +#include +#include +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/* + * @brief ConfigMeta + */ +class ConfigMeta +{ +public: + ConfigMeta() : size(-1), epoch(-1) + {} + ~ConfigMeta() + {} + +public: + std::string name; + std::string lastModified; + int32_t size; + int32_t epoch; +}; + +/* + * @brief ConfigClient + */ + +using ConfigChangeStatusCallback = std::function; + +class ConfigClient : public Client +{ +public: + explicit ConfigClient(); + ~ConfigClient(); + + void Init(); + + int32_t Set(const std::string& name, const std::string& content); + int32_t Get(const std::string& name, std::string& content); + int32_t Del(const std::string& name); + int32_t Meta(const std::string& name, ConfigMeta& meta); + int32_t Meta(const std::string& name, std::string& meta); + + void SubscribeChangeStatus(const std::string& name, const ConfigChangeStatusCallback& callback); + +private: + void ChangeStatusMessageHandler(const void* message); + +private: + unitree::common::Mutex mLock; + std::map mNameCallbackMap; + ChannelSubscriberPtr mSubscriberPtr; +}; + +} +} +} + +#endif//__UT_ROBOT_B2_CONFIG_CLIENT_HPP__ + diff --git a/unitree_SDK/include/unitree/robot/b2/config/config_error.hpp b/unitree_SDK/include/unitree/robot/b2/config/config_error.hpp new file mode 100644 index 0000000..76a6429 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/config/config_error.hpp @@ -0,0 +1,29 @@ +#ifndef __UT_ROBOT_B2_CONFIG_ERROR_HPP__ +#define __UT_ROBOT_B2_CONFIG_ERROR_HPP__ + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +UT_DECL_ERR(UT_CONFIG_ERR_PARAMETER, 8201, "parameter error.") +UT_DECL_ERR(UT_CONFIG_ERR_NOT_FOUND, 8202, "config name is not found.") +UT_DECL_ERR(UT_CONFIG_ERR_NAME, 8203, "name is invalid.") +UT_DECL_ERR(UT_CONFIG_ERR_LIMITED, 8204, "name/content length limited.") +UT_DECL_ERR(UT_CONFIG_ERR_LOCK, 8205, "lock error.") +UT_DECL_ERR(UT_CONFIG_ERR_LOAD_META, 8206, "load meta error.") +UT_DECL_ERR(UT_CONFIG_ERR_SAVE_META, 8207, "save meta error.") +UT_DECL_ERR(UT_CONFIG_ERR_TEMP_META, 8208, "save meta temp error.") +UT_DECL_ERR(UT_CONFIG_ERR_FORMAL_META, 8209, "formalize meta error.") +UT_DECL_ERR(UT_CONFIG_ERR_REMOVE_META, 8210, "remove meta error.") +UT_DECL_ERR(UT_CONFIG_ERR_LOAD_DATA, 8211, "load data error.") +UT_DECL_ERR(UT_CONFIG_ERR_SAVE_DATA, 8212, "save data error.") +UT_DECL_ERR(UT_CONFIG_ERR_TEMP_DATA, 8213, "save data temp error.") +UT_DECL_ERR(UT_CONFIG_ERR_FORMAL_DATA, 8214, "formalize data error.") +UT_DECL_ERR(UT_CONFIG_ERR_REMOVE_DATA, 8215, "remove data error.") +} +} +} + +#endif//__UT_ROBOT_B2_CONFIG_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/front_video/front_video_api.hpp b/unitree_SDK/include/unitree/robot/b2/front_video/front_video_api.hpp new file mode 100644 index 0000000..7ee38ae --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/front_video/front_video_api.hpp @@ -0,0 +1,24 @@ +#ifndef __UT_ROBOT_B2_FRONT_VIDEO_API_HPP__ +#define __UT_ROBOT_B2_FRONT_VIDEO_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/*service name*/ +const std::string ROBOT_FRONT_VIDEO_SERVICE_NAME = "front_videohub"; + +/*api version*/ +const std::string ROBOT_FRONT_VIDEO_API_VERSION = "1.0.0.0"; + +/*api id*/ +const int32_t ROBOT_FRONT_VIDEO_API_ID_GETIMAGESAMPLE = 1001; +} +} +} + +#endif //__UT_ROBOT_B2_FRONT_VIDEO_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/front_video/front_video_client.hpp b/unitree_SDK/include/unitree/robot/b2/front_video/front_video_client.hpp new file mode 100644 index 0000000..11b21d0 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/front_video/front_video_client.hpp @@ -0,0 +1,34 @@ +#ifndef __UT_ROBOT_B2_FRONT_VIDEO_CLIENT_HPP__ +#define __UT_ROBOT_B2_FRONT_VIDEO_CLIENT_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/* + * FrontVideoClient + */ +class FrontVideoClient : public Client +{ +public: + explicit FrontVideoClient(); + ~FrontVideoClient(); + + void Init(); + + /* + * @brief GetImageSample + * @api: 1001 + */ + int32_t GetImageSample(std::vector&); + +}; +} +} +} + +#endif//__UT_ROBOT_B2_FRONT_VIDEO_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/front_video/front_video_error.hpp b/unitree_SDK/include/unitree/robot/b2/front_video/front_video_error.hpp new file mode 100644 index 0000000..c360c8f --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/front_video/front_video_error.hpp @@ -0,0 +1,17 @@ +#ifndef __UT_ROBOT_B2_FRONT_VIDEO_ERROR_HPP__ +#define __UT_ROBOT_B2_FRONT_VIDEO_ERROR_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ + UT_DECL_ERR(UT_ROBOT_FRONT_VIDEO_ERR_COMM, 100, "Invalid parameter") +} +} +} + +#endif//__UT_ROBOT_B2_FRONT_VIDEO_ERROR_HPP__ \ No newline at end of file diff --git a/unitree_SDK/include/unitree/robot/b2/motion_switcher/motion_switcher_api.hpp b/unitree_SDK/include/unitree/robot/b2/motion_switcher/motion_switcher_api.hpp new file mode 100644 index 0000000..e66d4ac --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/motion_switcher/motion_switcher_api.hpp @@ -0,0 +1,99 @@ +#ifndef __UT_ROBOT_B2_MOTION_SWITCHER_API_HPP__ +#define __UT_ROBOT_B2_MOTION_SWITCHER_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/* + * service name + */ +const std::string MOTION_SWITCHER_SERVICE_NAME = "motion_switcher"; + +/* + * api version + */ +const std::string MOTION_SWITCHER_API_VERSION = "1.0.0.1"; + +/* + * api id + */ +const int32_t MOTION_SWITCHER_API_ID_CHECK_MODE = 1001; +const int32_t MOTION_SWITCHER_API_ID_SELECT_MODE = 1002; +const int32_t MOTION_SWITCHER_API_ID_RELEASE_MODE = 1003; +const int32_t MOTION_SWITCHER_API_ID_SET_SILENT = 1004; +const int32_t MOTION_SWITCHER_API_ID_GET_SILENT = 1005; + +/* + * api data type + */ +class JsonizeModeName : public common::Jsonize +{ +public: + JsonizeModeName() + {} + + ~JsonizeModeName() + {} + + /*override*/ + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + + if (json.find("form") != json.end()) + { + common::FromJson(json["form"], form); + } + } + + /*override*/ + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + + if (!form.empty()) + { + common::ToJson(form, json["form"]); + } + } + +public: + std::string name; + std::string form; +}; + +class JsonizeSilent : public common::Jsonize +{ +public: + JsonizeSilent() : silent(false) + {} + + ~JsonizeSilent() + {} + + /*override*/ + void fromJson(common::JsonMap& json) + { + common::FromJson(json["silent"], silent); + } + + /*override*/ + void toJson(common::JsonMap& json) const + { + common::ToJson(silent, json["silent"]); + } + +public: + bool silent; +}; + +} +} +} + +#endif//__UT_ROBOT_B2_MOTION_SWITCHER_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/motion_switcher/motion_switcher_client.hpp b/unitree_SDK/include/unitree/robot/b2/motion_switcher/motion_switcher_client.hpp new file mode 100644 index 0000000..12c12ba --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/motion_switcher/motion_switcher_client.hpp @@ -0,0 +1,35 @@ +#ifndef __UT_ROBOT_B2_MOTION_SWITCHER_CLIENT_HPP__ +#define __UT_ROBOT_B2_MOTION_SWITCHER_CLIENT_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/* + * @brief MotionSwitcherClient + */ +class MotionSwitcherClient : public Client +{ +public: + explicit MotionSwitcherClient(); + ~MotionSwitcherClient(); + + void Init(); + + int32_t CheckMode(std::string& form, std::string& name); + int32_t SelectMode(const std::string& nameOrAlias); + int32_t ReleaseMode(); + int32_t SetSilent(bool silent); + int32_t GetSilent(bool& silent); +}; + +} +} +} + +#endif//__UT_ROBOT_B2_MOTION_SWITCHER_CLIENT_HPP__ + diff --git a/unitree_SDK/include/unitree/robot/b2/motion_switcher/motion_switcher_error.hpp b/unitree_SDK/include/unitree/robot/b2/motion_switcher/motion_switcher_error.hpp new file mode 100644 index 0000000..9aa0c66 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/motion_switcher/motion_switcher_error.hpp @@ -0,0 +1,25 @@ +#ifndef __UT_ROBOT_B2_MOTION_SWITCHER_ERROR_HPP__ +#define __UT_ROBOT_B2_MOTION_SWITCHER_ERROR_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ + UT_DECL_ERR(UT_SWITCH_ERR_PARAMETR, 7001, "parameter is invalid.") + UT_DECL_ERR(UT_SWITCH_ERR_BUSY, 7002, "switcher is busy.") + UT_DECL_ERR(UT_SWITCH_ERR_EVENT, 7003, "event is invalid.") + UT_DECL_ERR(UT_SWITCH_ERR_NAME, 7004, "name or alias is invalid.") + UT_DECL_ERR(UT_SWITCH_ERR_CMD, 7005, "name or alias is invalid.") + UT_DECL_ERR(UT_SWITCH_ERR_EXEC_CHECK, 7006, "check cmd execute error.") + UT_DECL_ERR(UT_SWITCH_ERR_EXEC_SELECT, 7007, "select cmd execute error.") + UT_DECL_ERR(UT_SWITCH_ERR_EXEC_RELEASE, 7008, "release cmd execute error.") + UT_DECL_ERR(UT_SWITCH_ERR_CUSTOMIZE, 7009, "save customize data error.") +} +} +} + +#endif//__UT_ROBOT_B2_MOTION_SWITCHER_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/robot_state/robot_state_api.hpp b/unitree_SDK/include/unitree/robot/b2/robot_state/robot_state_api.hpp new file mode 100644 index 0000000..58df82e --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/robot_state/robot_state_api.hpp @@ -0,0 +1,206 @@ +#ifndef __UT_ROBOT_B2_ROBOT_STATE_API_HPP__ +#define __UT_ROBOT_B2_ROBOT_STATE_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/* + * service name + */ +const std::string ROBOT_STATE_SERVICE_NAME = "robot_state"; + +/* + * api version + */ +const std::string ROBOT_STATE_API_VERSION = "1.0.0.2"; + +/* + * api id + */ +const int32_t ROBOT_STATE_API_ID_SERVICE_SWITCH = 1001; +const int32_t ROBOT_STATE_API_ID_SET_REPORT_FREQ = 1002; +const int32_t ROBOT_STATE_API_ID_SERVICE_LIST = 1003; +const int32_t ROBOT_STATE_API_ID_LOWPOWER_SWITCH = 1004; +const int32_t ROBOT_STATE_API_ID_LOWPOWER_STATUS = 1005; + +/* + * request parameter for 1001 + */ +class ServiceSwitchParameter : public common::Jsonize +{ +public: + ServiceSwitchParameter() : swit(0) + {} + + ~ServiceSwitchParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + common::FromJson(json["switch"], swit); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + common::ToJson(swit, json["switch"]); + } + +public: + std::string name; + int32_t swit; +}; + +/* + * response data for 1001 + */ +class ServiceSwitchData : public common::Jsonize +{ +public: + ServiceSwitchData() : status(0) + {} + + ~ServiceSwitchData() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + common::FromJson(json["status"], status); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + common::ToJson(status, json["status"]); + } + +public: + std::string name; + int32_t status; +}; + +/* + * request parameter for 1002 + */ +class SetReportFreqParameter : public common::Jsonize +{ +public: + SetReportFreqParameter() + {} + + ~SetReportFreqParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["interval"], interval); + common::FromJson(json["duration"], duration); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(interval, json["interval"]); + common::ToJson(duration, json["duration"]); + } + +public: + int32_t interval; + int32_t duration; +}; + +/* + * request data for 1003 + */ +class ServiceStateData : public common::Jsonize +{ +public: + ServiceStateData() + {} + + ~ServiceStateData() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + common::FromJson(json["status"], status); + common::FromJson(json["protect"], protect); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + common::ToJson(status, json["status"]); + common::ToJson(protect, json["protect"]); + } + +public: + std::string name; + int32_t status; + int32_t protect; +}; + +/* + * request parameter for 1004 + */ +class LowPowerSwitchParameter : public common::Jsonize +{ +public: + LowPowerSwitchParameter() : swit(0) + {} + + ~LowPowerSwitchParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["switch"], swit); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(swit, json["switch"]); + } + +public: + int32_t swit; +}; + +/* + * response data for 1004 + */ +class LowPowerStatusData : public common::Jsonize +{ +public: + LowPowerStatusData() : status(0) + {} + + ~LowPowerStatusData() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["status"], status); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(status, json["status"]); + } + +public: + int32_t status; +}; + +} +} +} + +#endif//__UT_ROBOT_B2_ROBOT_STATE_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/robot_state/robot_state_client.hpp b/unitree_SDK/include/unitree/robot/b2/robot_state/robot_state_client.hpp new file mode 100644 index 0000000..d67f2ff --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/robot_state/robot_state_client.hpp @@ -0,0 +1,49 @@ +#ifndef __UT_ROBOT_B2_ROBOT_STATE_CLIENT_HPP__ +#define __UT_ROBOT_B2_ROBOT_STATE_CLIENT_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/* + * @brief ServiceState + */ +class ServiceState +{ +public: + ServiceState() : status(0), protect(0) + {} + + std::string name; + int32_t status; + int32_t protect; +}; + +/* + * @brief RobotStateClient + */ +class RobotStateClient : public Client +{ +public: + explicit RobotStateClient(); + ~RobotStateClient(); + + void Init(); + + int32_t ServiceList(std::vector& serviceStateList); + int32_t ServiceSwitch(const std::string& name, int32_t swit, int32_t& status); + int32_t SetReportFreq(int32_t interval, int32_t duration); + int32_t LowPowerSwitch(int32_t swit); + int32_t LowPowerStatus(int32_t& status); +}; + +} +} +} + +#endif//__UT_ROBOT_B2_ROBOT_STATE_CLIENT_HPP__ + diff --git a/unitree_SDK/include/unitree/robot/b2/robot_state/robot_state_error.hpp b/unitree_SDK/include/unitree/robot/b2/robot_state/robot_state_error.hpp new file mode 100644 index 0000000..3a4a113 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/robot_state/robot_state_error.hpp @@ -0,0 +1,20 @@ +#ifndef __UT_ROBOT_B2_ROBOT_STATE_CLIENT_ERROR_HPP__ +#define __UT_ROBOT_B2_ROBOT_STATE_CLIENT_ERROR_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +UT_DECL_ERR(UT_ROBOT_STATE_CLIENT_ERR_SERVICE_SWITCH, 5201, "service switch error.") +UT_DECL_ERR(UT_ROBOT_STATE_CLIENT_ERR_SERVICE_PROTECTED, 5202, "service is protected.") +UT_DECL_ERR(UT_ROBOT_STATE_CLIENT_ERR_LOWPOWER_SWITCH, 5203, "low power switch error.") +UT_DECL_ERR(UT_ROBOT_STATE_CLIENT_ERR_LOWPOWER_STATE, 5204, "low power state error.") +} +} +} + +#endif//__UT_ROBOT_B2_ROBOT_STATE_CLIENT_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/sport/sport_api.hpp b/unitree_SDK/include/unitree/robot/b2/sport/sport_api.hpp new file mode 100644 index 0000000..01302b9 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/sport/sport_api.hpp @@ -0,0 +1,45 @@ +#ifndef __UT_ROBOT_B2_SPORT_API_HPP__ +#define __UT_ROBOT_B2_SPORT_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/*service name*/ +const std::string ROBOT_SPORT_SERVICE_NAME = "sport"; + +/*api version*/ +const std::string ROBOT_SPORT_API_VERSION = "1.0.0.1"; + +/*api id*/ +const int32_t ROBOT_SPORT_API_ID_DAMP = 1001; +const int32_t ROBOT_SPORT_API_ID_BALANCESTAND = 1002; +const int32_t ROBOT_SPORT_API_ID_STOPMOVE = 1003; +const int32_t ROBOT_SPORT_API_ID_STANDUP = 1004; +const int32_t ROBOT_SPORT_API_ID_STANDDOWN = 1005; +const int32_t ROBOT_SPORT_API_ID_RECOVERYSTAND = 1006; +const int32_t ROBOT_SPORT_API_ID_MOVE = 1008; +const int32_t ROBOT_SPORT_API_ID_SWITCHGAIT = 1011; +const int32_t ROBOT_SPORT_API_ID_BODYHEIGHT = 1013; +const int32_t ROBOT_SPORT_API_ID_SPEEDLEVEL = 1015; +const int32_t ROBOT_SPORT_API_ID_TRAJECTORYFOLLOW = 1018; +const int32_t ROBOT_SPORT_API_ID_CONTINUOUSGAIT = 1019; +const int32_t ROBOT_SPORT_API_ID_MOVETOPOS = 1036; +const int32_t ROBOT_SPORT_API_ID_SWITCHMOVEMODE = 1038; +const int32_t ROBOT_SPORT_API_ID_VISIONWALK = 1101; +const int32_t ROBOT_SPORT_API_ID_HANDSTAND = 1039; +const int32_t ROBOT_SPORT_API_ID_AUTORECOVERY_SET = 1040; +const int32_t ROBOT_SPORT_API_ID_FREEWALK = 1045; +const int32_t ROBOT_SPORT_API_ID_CLASSICWALK = 1049; +const int32_t ROBOT_SPORT_API_ID_FASTWALK = 1050; +const int32_t ROBOT_SPORT_API_ID_FREEEULER = 1051; + +} +} +} + +#endif //__UT_ROBOT_B2_SPORT_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/sport/sport_client.hpp b/unitree_SDK/include/unitree/robot/b2/sport/sport_client.hpp new file mode 100644 index 0000000..7d49ebf --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/sport/sport_client.hpp @@ -0,0 +1,86 @@ +#ifndef __UT_ROBOT_B2_SPORT_CLIENT_HPP__ +#define __UT_ROBOT_B2_SPORT_CLIENT_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +/* + * PathPoint + */ +struct stPathPoint +{ + float timeFromStart; + float x; + float y; + float yaw; + float vx; + float vy; + float vyaw; +}; + +typedef struct stPathPoint PathPoint; + +/* + * SportClient + */ +class SportClient : public Client +{ +public: + explicit SportClient(bool enableLease = false); + ~SportClient(); + + void Init(); + + int32_t Damp(); + + int32_t BalanceStand(); + + int32_t StopMove(); + + int32_t StandUp(); + + int32_t StandDown(); + + int32_t RecoveryStand(); + + int32_t Move(float vx, float vy, float vyaw); + + int32_t SwitchGait(int d); + + int32_t BodyHeight(float height); + + int32_t SpeedLevel(int level); + + int32_t TrajectoryFollow(std::vector &path); + + int32_t ContinuousGait(bool flag); + + int32_t MoveToPos(float x, float y, float yaw); + + int32_t SwitchMoveMode(bool flag); + + int32_t VisionWalk(bool flag); + + int32_t HandStand(bool flag); + + int32_t AutoRecoverySet(bool flag); + + int32_t FreeWalk(); + + int32_t ClassicWalk(bool flag); + + int32_t FastWalk(bool flag); + + int32_t Euler(float roll, float pitch, float yaw); + +}; +} +} +} + +#endif//__UT_ROBOT_B2_SPORT_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/b2/sport/sport_error.hpp b/unitree_SDK/include/unitree/robot/b2/sport/sport_error.hpp new file mode 100644 index 0000000..9f27c03 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/b2/sport/sport_error.hpp @@ -0,0 +1,19 @@ +#ifndef __UT_ROBOT_B2_SPORT_ERROR_HPP__ +#define __UT_ROBOT_B2_SPORT_ERROR_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace b2 +{ +UT_DECL_ERR(UT_ROBOT_SPORT_ERR_CLIENT_POINT_PATH, 4101, "point path error.") +UT_DECL_ERR(UT_ROBOT_SPORT_ERR_SERVER_OVERTIME, 4201, "server overtime.") +UT_DECL_ERR(UT_ROBOT_SPORT_ERR_SERVER_NOT_INIT, 4205, "server function not init.") +} +} +} + +#endif//__UT_ROBOT_B2_SPORT_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/channel/channel_factory.hpp b/unitree_SDK/include/unitree/robot/channel/channel_factory.hpp new file mode 100644 index 0000000..ebf02c0 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/channel/channel_factory.hpp @@ -0,0 +1,62 @@ +#ifndef __UT_ROBOT_SDK_CHANNEL_FACTORY_HPP__ +#define __UT_ROBOT_SDK_CHANNEL_FACTORY_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +template +using Channel = unitree::common::DdsTopicChannel; + +template +using ChannelPtr = unitree::common::DdsTopicChannelPtr; + +class ChannelFactory +{ +public: + static ChannelFactory* Instance() + { + static ChannelFactory inst; + return &inst; + } + + void Init(int32_t domainId, const std::string& networkInterface = ""); + void Init(const std::string& configFileName = ""); + void Init(const common::JsonMap& jsonMap); + + void Release(); + + template + ChannelPtr CreateSendChannel(const std::string& name) + { + ChannelPtr channelPtr = mDdsFactoryPtr->CreateTopicChannel(name); + mDdsFactoryPtr->SetWriter(channelPtr); + return channelPtr; + } + + template + ChannelPtr CreateRecvChannel(const std::string& name, std::function callback, int32_t queuelen = 0) + { + ChannelPtr channelPtr = mDdsFactoryPtr->CreateTopicChannel(name); + mDdsFactoryPtr->SetReader(channelPtr, callback, queuelen); + return channelPtr; + } + +public: + ~ChannelFactory(); + +private: + ChannelFactory(); + +private: + bool mInited; + common::DdsFactoryModelPtr mDdsFactoryPtr; + common::Mutex mMutex; +}; + +} +} + +#endif//__UT_ROBOT_SDK_CHANNEL_FACTORY_HPP__ diff --git a/unitree_SDK/include/unitree/robot/channel/channel_labor.hpp b/unitree_SDK/include/unitree/robot/channel/channel_labor.hpp new file mode 100644 index 0000000..cb68672 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/channel/channel_labor.hpp @@ -0,0 +1,99 @@ +#ifndef __UT_ROBOT_SDK_CHANNEL_LABOR_HPP__ +#define __UT_ROBOT_SDK_CHANNEL_LABOR_HPP__ + +#include +#include +#include + +namespace unitree +{ +namespace robot +{ +/* + * @brief + * @class: ChannelLabor + */ +template +class ChannelLabor +{ +public: + ChannelLabor() + {} + + virtual ~ChannelLabor() + {} + + void InitChannel(const std::string& name, const std::function& recvMesageCallback, int32_t queuelen = 0) + { + std::string sendChannelName = mNamerPtr->GetSendChannelName(name); + std::string recvChannelName = mNamerPtr->GetRecvChannelName(name); + + mSendChannlPtr = ChannelFactory::Instance()->CreateSendChannel(sendChannelName); + mRecvChannlPtr = ChannelFactory::Instance()->CreateRecvChannel(recvChannelName, recvMesageCallback, queuelen); + } + + bool Send(const SEND_MSG& msg, int64_t waitTimeout) + { + return mSendChannlPtr->Write(msg, waitTimeout); + } + + int64_t GetLastDataAvailableTime() const + { + return mRecvChannlPtr->GetLastDataAvailableTime(); + } + +protected: + ChannelNamerPtr mNamerPtr; + +private: + ChannelPtr mSendChannlPtr; + ChannelPtr mRecvChannlPtr; +}; + +template +using ChannelLaborPtr = std::shared_ptr>; + +/* + * @brief + * @class: ClientChannelLabor + */ +template +class ClientChannelLabor : public ChannelLabor +{ +public: + ClientChannelLabor() + { + ChannelLabor::mNamerPtr = ChannelNamerPtr(new ClientChannelNamer()); + } + + ~ClientChannelLabor() + {} +}; + +template +using ClientChannelLaborPtr = std::shared_ptr>; + +/* + * @brief + * @class: ServerChannelLabor + */ +template +class ServerChannelLabor : public ChannelLabor +{ +public: + ServerChannelLabor() + { + ChannelLabor::mNamerPtr = ChannelNamerPtr(new ServerChannelNamer()); + } + + ~ServerChannelLabor() + {} +}; + +template +using ServerChannelLaborPtr = std::shared_ptr>; + +} +} + +#endif//__UT_ROBOT_SDK_CHANNEL_LABOR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/channel/channel_namer.hpp b/unitree_SDK/include/unitree/robot/channel/channel_namer.hpp new file mode 100644 index 0000000..1a11fdd --- /dev/null +++ b/unitree_SDK/include/unitree/robot/channel/channel_namer.hpp @@ -0,0 +1,64 @@ +#ifndef __UT_ROBOT_SDK_CHANNEL_NAMER_HPP__ +#define __UT_ROBOT_SDK_CHANNEL_NAMER_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +const std::string ROBOT_SDK_CHANNEL_PREFIX = "rt/api/"; +const std::string ROBOT_SDK_CHANNEL_SUFFIX_CLIENT = "/request"; +const std::string ROBOT_SDK_CHANNEL_SUFFIX_SERVER = "/response"; + +/* + * @brief + * @class: ChannelNamer + */ +class ChannelNamer +{ +public: + virtual std::string GetSendChannelName(const std::string& name) = 0; + virtual std::string GetRecvChannelName(const std::string& name) = 0; +}; + +using ChannelNamerPtr = std::shared_ptr; + +/* + * @brief + * @class: ClientChannelNamer + */ +class ClientChannelNamer : public ChannelNamer +{ +public: + ClientChannelNamer(); + ~ClientChannelNamer(); + +protected: + std::string GetSendChannelName(const std::string& name); + std::string GetRecvChannelName(const std::string& name); +}; + +using ClientChannelNamerPtr = std::shared_ptr; + +/* + * @brief + * @class: ServerChannelNamer + */ +class ServerChannelNamer : public ChannelNamer +{ +public: + ServerChannelNamer(); + virtual ~ServerChannelNamer(); + +protected: + std::string GetSendChannelName(const std::string& name); + std::string GetRecvChannelName(const std::string& name); +}; + +using ServerChannelNamerPtr = std::shared_ptr; + +} +} + +#endif//__UT_ROBOT_SDK_CHANNEL_NAMER_HPP__ diff --git a/unitree_SDK/include/unitree/robot/channel/channel_publisher.hpp b/unitree_SDK/include/unitree/robot/channel/channel_publisher.hpp new file mode 100644 index 0000000..a2e277f --- /dev/null +++ b/unitree_SDK/include/unitree/robot/channel/channel_publisher.hpp @@ -0,0 +1,54 @@ +#ifndef __UT_ROBOT_SDK_CHANNEL_PUBLISHER_HPP__ +#define __UT_ROBOT_SDK_CHANNEL_PUBLISHER_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +template +class ChannelPublisher +{ +public: + explicit ChannelPublisher(const std::string& channelName) : + mChannelName(channelName) + {} + + void InitChannel() + { + mChannelPtr = ChannelFactory::Instance()->CreateSendChannel(mChannelName); + } + + bool Write(const MSG& msg, int64_t waitMicrosec = 0) + { + if (mChannelPtr) + { + return mChannelPtr->Write(msg, waitMicrosec); + } + + return false; + } + + void CloseChannel() + { + mChannelPtr.reset(); + } + + const std::string& GetChannelName() const + { + return mChannelName; + } + +private: + std::string mChannelName; + ChannelPtr mChannelPtr; +}; + +template +using ChannelPublisherPtr = std::shared_ptr>; + +} +} + +#endif//__UT_ROBOT_SDK_CHANNEL_PUBLISHER_HPP__ diff --git a/unitree_SDK/include/unitree/robot/channel/channel_subscriber.hpp b/unitree_SDK/include/unitree/robot/channel/channel_subscriber.hpp new file mode 100644 index 0000000..5e22ef8 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/channel/channel_subscriber.hpp @@ -0,0 +1,75 @@ +#ifndef __UT_ROBOT_SDK_CHANNEL_SUBSCRIBER_HPP__ +#define __UT_ROBOT_SDK_CHANNEL_SUBSCRIBER_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +template +class ChannelSubscriber +{ +public: + explicit ChannelSubscriber(const std::string& channelName) : + mChannelName(channelName), mQueueLen(0) + {} + + explicit ChannelSubscriber(const std::string& channelName, const std::function& handler, int64_t queuelen = 0) : + mChannelName(channelName), mQueueLen(queuelen), mHandler(handler) + {} + + void InitChannel(const std::function& handler, int64_t queuelen = 0) + { + mHandler = handler; + mQueueLen = queuelen; + + InitChannel(); + } + + void InitChannel() + { + if (mHandler) + { + mChannelPtr = ChannelFactory::Instance()->CreateRecvChannel(mChannelName, mHandler, mQueueLen); + } + else + { + UT_THROW(common::CommonException, "subscribe handler is invalid"); + } + } + + void CloseChannel() + { + mChannelPtr.reset(); + } + + int64_t GetLastDataAvailableTime() const + { + if (mChannelPtr) + { + return mChannelPtr->GetLastDataAvailableTime(); + } + + return -1; + } + + const std::string& GetChannelName() const + { + return mChannelName; + } + +private: + std::string mChannelName; + int64_t mQueueLen; + std::function mHandler; + ChannelPtr mChannelPtr; +}; + +template +using ChannelSubscriberPtr = std::shared_ptr>; + +} +} + +#endif//__UT_ROBOT_SDK_CHANNEL_SUBSCRIBER_HPP__ diff --git a/unitree_SDK/include/unitree/robot/client/client.hpp b/unitree_SDK/include/unitree/robot/client/client.hpp new file mode 100644 index 0000000..4abc4ad --- /dev/null +++ b/unitree_SDK/include/unitree/robot/client/client.hpp @@ -0,0 +1,61 @@ +#ifndef __UT_ROBOT_SDK_CLIENT_HPP__ +#define __UT_ROBOT_SDK_CLIENT_HPP__ + +#include +#include + +#define UT_ROBOT_CLIENT_REG_API_NO_PROI(apiId) \ + UT_ROBOT_CLIENT_REG_API(apiId, 0) + +#define UT_ROBOT_CLIENT_REG_API(apiId, priority) \ + RegistApi(apiId, priority) + +namespace unitree +{ +namespace robot +{ +/* + * @brief + * @class: Client + */ +class Client: public ClientBase +{ +public: + explicit Client(const std::string& name, bool enableLease = false); + virtual ~Client(); + + void WaitLeaseApplied(); + int64_t GetLeaseId(); + + const std::string& GetApiVersion() const; + std::string GetServerApiVersion(); + +protected: + void SetApiVersion(const std::string& apiVersion); + + int32_t Noop(); + + int32_t Call(int32_t apiId, const std::string& parameter, std::string& data); + int32_t Call(int32_t apiId, const std::string& parameter); + + int32_t Call(int32_t apiId, const std::vector& parameter, std::vector& data); + int32_t Call(int32_t apiId, const std::vector& parameter); + + int32_t Call(int32_t apiId, const std::string& parameter, const std::vector& binary); + + void RegistApi(int32_t apiId, int32_t priority = 0); + int32_t CheckApi(int32_t apiId, int32_t& priority, int64_t& leaseId); + +private: + bool mEnableLease; + std::string mApiVersion; + std::unordered_map mApiMap; + LeaseClientPtr mLeaseClientPtr; +}; + +using ClientPtr = std::shared_ptr; + +} +} + +#endif//__UT_ROBOT_SDK_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/client/client_base.hpp b/unitree_SDK/include/unitree/robot/client/client_base.hpp new file mode 100644 index 0000000..6be96c9 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/client/client_base.hpp @@ -0,0 +1,54 @@ +#ifndef __UT_ROBOT_SDK_CLIENT_BASE_HPP__ +#define __UT_ROBOT_SDK_CLIENT_BASE_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +/* + * @brief + * @default client timeout. 1s + */ +const int64_t ROBOT_CLIENT_TIMEOUT = 1000000; + +/* + * @brief + * @class: ClientBase + */ +class ClientBase +{ +public: + explicit ClientBase(const std::string& name); + virtual ~ClientBase(); + + virtual void Init() = 0; + + void SetTimeout(int64_t timeout); + void SetTimeout(float timeout); + +protected: + int32_t Call(int32_t apiId, const std::string& parameter, std::string& data, int32_t priority, int64_t leaseId); + int32_t Call(int32_t apiId, const std::string& parameter, int32_t priority, int64_t leaseId); + + int32_t Call(int32_t apiId, const std::vector& parameter, std::vector& bin_data, int32_t priority, int64_t leaseId); + int32_t Call(int32_t apiId, const std::vector& parameter, int32_t priority, int64_t leaseId); + + int32_t Call(int32_t apiId, const std::string& parameter, const std::vector& binary, int32_t priority, int64_t leaseId); + + int32_t Call(int32_t apiId, const std::string& parameter, std::string& data, int32_t priority, int64_t leaseId, int64_t timeout); + + void SetHeader(RequestHeader& header, int32_t apiId, int64_t leaseId, int32_t priority, bool noReply); + +private: + int64_t mTimeout; + ClientStubPtr mClientStubPtr; +}; + +using ClientBasePtr = std::shared_ptr; + +} +} + +#endif//__UT_ROBOT_SDK_CLIENT_BASE_HPP__ diff --git a/unitree_SDK/include/unitree/robot/client/client_stub.hpp b/unitree_SDK/include/unitree/robot/client/client_stub.hpp new file mode 100644 index 0000000..b15d64d --- /dev/null +++ b/unitree_SDK/include/unitree/robot/client/client_stub.hpp @@ -0,0 +1,36 @@ +#ifndef __UT_ROBOT_SDK_CLIENT_STUB_HPP__ +#define __UT_ROBOT_SDK_CLIENT_STUB_HPP__ + +#include +#include +#include + +namespace unitree +{ +namespace robot +{ +class ClientStub +{ +public: + explicit ClientStub(); + ~ClientStub(); + + void Init(const std::string& name); + + bool Send(const Request& req, int64_t waitTimeout); + RequestFuturePtr SendRequest(const Request& req, int64_t waitTimeout); + +private: + void ResponseFunc(const void* message); + +private: + ChannelLaborPtr mChannelLaborPtr; + RequestFutureQueuePtr mFutureQueuePtr; +}; + +using ClientStubPtr = std::shared_ptr; + +} +} + +#endif//__UT_ROBOT_SDK_CLIENT_STUB_HPP__ diff --git a/unitree_SDK/include/unitree/robot/client/lease_client.hpp b/unitree_SDK/include/unitree/robot/client/lease_client.hpp new file mode 100644 index 0000000..0601b14 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/client/lease_client.hpp @@ -0,0 +1,65 @@ +#ifndef __UT_ROBOT_SDK_LEASE_CLIENT_H__ +#define __UT_ROBOT_SDK_LEASE_CLIENT_H__ + +#include +#include + +namespace unitree +{ +namespace robot +{ +class LeaseContext +{ +public: + LeaseContext(); + ~LeaseContext(); + + void Update(int64_t id, int64_t term); + void Reset(); + + bool Valid() const; + + int64_t GetId() const; + int64_t GetTerm() const; + +private: + int64_t mId; + int64_t mTerm; +}; + +using LeaseContextPtr = std::shared_ptr; + +class LeaseClient : public ClientBase +{ +public: + explicit LeaseClient(const std::string& name); + ~LeaseClient(); + + void Init(); + + void WaitApplied(); + int64_t GetId(); + bool Applied(); + +private: + void Apply(); + void Renewal(); + + void ThreadFunction(); + + int64_t GetWaitMicrosec(); + +private: + std::string mName; + std::string mContextName; + LeaseContext mContext; + common::ThreadPtr mThreadPtr; + common::Mutex mMutex; +}; + +using LeaseClientPtr = std::shared_ptr; + +} +} + +#endif//__UT_ROBOT_SDK_LEASE_CLIENT_H__ diff --git a/unitree_SDK/include/unitree/robot/future/request_future.hpp b/unitree_SDK/include/unitree/robot/future/request_future.hpp new file mode 100644 index 0000000..a6c7fa8 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/future/request_future.hpp @@ -0,0 +1,82 @@ +#ifndef __UT_DDS_ROBOT_REQUEST_FUTURE_HPP__ +#define __UT_DDS_ROBOT_REQUEST_FUTURE_HPP__ + +#include +#include + +namespace unitree +{ +namespace robot +{ +class RequestFutureQueue; +using RequestFutureQueuePtr = std::shared_ptr; + +/* + * @brief + * @class: RequestFuture + */ +class RequestFuture : public std::enable_shared_from_this +{ +public: + enum + { + DEFER = 0, + READY = 1 + }; + + explicit RequestFuture(); + explicit RequestFuture(int64_t requestId); + ~RequestFuture(); + + void SetRequestId(int64_t requestId); + int64_t GetRequestId() const; + + bool SetQueue(const std::shared_ptr& futureQueuePtr); + + const ResponsePtr& GetResponse(int64_t microsec); + +public: + void Ready(const ResponsePtr& requestPtr); + +private: + bool IsDeferred(); + bool IsReady(); + +private: + int32_t mState; + int64_t mRequestId; + ResponsePtr mResponsePtr; + common::MutexCond mMutexCond; + RequestFutureQueuePtr mFutureQueuePtr; +}; + +using RequestFuturePtr = std::shared_ptr; + +/* + * @brief + * @class: RequestFutureQueue + */ +class RequestFutureQueue +{ +public: + using iterator = std::unordered_map::iterator; + using const_iterator = std::unordered_map::const_iterator; + + RequestFutureQueue(); + ~RequestFutureQueue(); + + RequestFuturePtr Get(int64_t requestId); + bool Put(int64_t requestId, const RequestFuturePtr& futurePtr); + void Remove(int64_t requestId); + + size_t Size(); + +private: + common::Mutex mMutex; + std::unordered_map mFutureMap; +}; + +} +} + +#endif//__UT_DDS_ROBOT_REQUEST_FUTURE_HPP__ diff --git a/unitree_SDK/include/unitree/robot/g1/arm/g1_arm_action_api.hpp b/unitree_SDK/include/unitree/robot/g1/arm/g1_arm_action_api.hpp new file mode 100644 index 0000000..91cc9c2 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/g1/arm/g1_arm_action_api.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include +#include + +namespace unitree { +namespace robot { +namespace g1 { +/*service name*/ +const std::string ARM_ACTION_SERVICE_NAME = "arm"; + +/*api version*/ +const std::string ARM_ACTION_API_VERSION = "1.0.0.14"; + +/*api id*/ +const int32_t ROBOT_API_ID_ARM_ACTION_EXECUTE_ACTION = 7106; +const int32_t ROBOT_API_ID_ARM_ACTION_GET_ACTION_LIST = 7107; + +class JsonizeArmActionCommand : public common::Jsonize { + public: + JsonizeArmActionCommand() {} + ~JsonizeArmActionCommand() {} + + void fromJson(common::JsonMap &json) { + common::FromJson(json["data"], action_id); + } + + void toJson(common::JsonMap &json) const { + common::ToJson(action_id, json["data"]); + } + + int32_t action_id; +}; + +} // namespace g1 +} // namespace robot +} // namespace unitree \ No newline at end of file diff --git a/unitree_SDK/include/unitree/robot/g1/arm/g1_arm_action_client.hpp b/unitree_SDK/include/unitree/robot/g1/arm/g1_arm_action_client.hpp new file mode 100644 index 0000000..c0c10c1 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/g1/arm/g1_arm_action_client.hpp @@ -0,0 +1,69 @@ +#pragma once + +#include +#include +#include "g1_arm_action_api.hpp" + +namespace unitree { +namespace robot { +namespace g1 { + + /** + * @brief Arm action client + * + * The arm action server provides some upper body actions. + * The controller is based on the `rt/arm_sdk` interface. + */ +class G1ArmActionClient : public Client { + public: + G1ArmActionClient() : Client(ARM_ACTION_SERVICE_NAME, false) {} + ~G1ArmActionClient() {} + + /*Init*/ + void Init() { + SetApiVersion(ARM_ACTION_API_VERSION); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_ARM_ACTION_EXECUTE_ACTION); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_ARM_ACTION_GET_ACTION_LIST); + } + + /*API Call*/ + int32_t ExecuteAction(int32_t action_id) { + std::string parameter, data; + JsonizeArmActionCommand json; + + json.action_id = action_id; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_ARM_ACTION_EXECUTE_ACTION, parameter, data); + } + + int32_t GetActionList(std::string &data) { + std::string parameter; + return Call(ROBOT_API_ID_ARM_ACTION_GET_ACTION_LIST, parameter, data); + } + + /*Action List*/ + std::map action_map = { + {"release arm", 99}, + {"two-hand kiss", 11}, + {"left kiss", 12}, + {"right kiss", 12}, + {"hands up", 15}, + {"clap", 17}, + {"high five", 18}, + {"hug", 19}, + {"heart", 20}, + {"right heart", 21}, + {"reject", 22}, + {"right hand up", 23}, + {"x-ray", 24}, + {"face wave", 25}, + {"high wave", 26}, + {"shake hand", 27}, + }; +}; + + +} // namespace g1 +} // namespace robot +} // namespace unitree \ No newline at end of file diff --git a/unitree_SDK/include/unitree/robot/g1/arm/g1_arm_action_error.hpp b/unitree_SDK/include/unitree/robot/g1/arm/g1_arm_action_error.hpp new file mode 100644 index 0000000..44683c4 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/g1/arm/g1_arm_action_error.hpp @@ -0,0 +1,20 @@ +#pragma once + +#include + +namespace unitree { +namespace robot { +namespace g1 { + +UT_DECL_ERR(UT_ROBOT_ARM_ACTION_ERR_ARMSDK, 7400, "The topic rt/armsdk is occupied.") +UT_DECL_ERR(UT_ROBOT_ARM_ACTION_ERR_HOLDING, 7401, "The arm is holding. Expecting release action(99) or the same last action id.") +UT_DECL_ERR(UT_ROBOT_ARM_ACTION_ERR_INVALID_ACTION_ID, 7402, "Invalid action id.") +// The actions are only supported in fsm id {500, 501, 801}; +// You can subscribe the topic rt/sportmodestate to check the fsm id. +// And in the state 801, the actions are only supported in the fsm mode {0, 3}. +// See https://support.unitree.com/home/en/G1_developer/sport_services_interface#Expert%20interface +UT_DECL_ERR(UT_ROBOT_ARM_ACTION_ERR_INVALID_FSM_ID, 7404, "Invalid fsm id.") + +} // namespace g1 +} // namespace robot +} // namespace unitree \ No newline at end of file diff --git a/unitree_SDK/include/unitree/robot/g1/audio/g1_audio_api.hpp b/unitree_SDK/include/unitree/robot/g1/audio/g1_audio_api.hpp new file mode 100644 index 0000000..6587e7b --- /dev/null +++ b/unitree_SDK/include/unitree/robot/g1/audio/g1_audio_api.hpp @@ -0,0 +1,94 @@ +#ifndef __UT_ROBOT_G1_AUDIO_API_HPP__ +#define __UT_ROBOT_G1_AUDIO_API_HPP__ + +#include +// #include + +namespace unitree { +namespace robot { +namespace g1 { +/*service name*/ +const std::string AUDIO_SERVICE_NAME = "voice"; + +/*api version*/ +const std::string AUDIO_API_VERSION = "1.0.0.0"; + +/*api id*/ +const int32_t ROBOT_API_ID_AUDIO_TTS = 1001; +const int32_t ROBOT_API_ID_AUDIO_ASR = 1002; +const int32_t ROBOT_API_ID_AUDIO_START_PLAY = 1003; +const int32_t ROBOT_API_ID_AUDIO_STOP_PLAY = 1004; +const int32_t ROBOT_API_ID_AUDIO_GET_VOLUME = 1005; +const int32_t ROBOT_API_ID_AUDIO_SET_VOLUME = 1006; +const int32_t ROBOT_API_ID_AUDIO_SET_RGB_LED = 1010; + +class TtsMakerParameter : public common::Jsonize { + public: + TtsMakerParameter() {} + ~TtsMakerParameter() {} + + void fromJson(common::JsonMap &json) {} + + void toJson(common::JsonMap &json) const { + common::ToJson(index, json["index"]); + common::ToJson(speaker_id, json["speaker_id"]); + common::ToJson(text, json["text"]); + } + + int32_t index = 0; + uint16_t speaker_id = 0; + std::string text; +}; + +class PlayStreamParameter : public common::Jsonize { + public: + PlayStreamParameter() {} + ~PlayStreamParameter() {} + + void fromJson(common::JsonMap &json) {} + + void toJson(common::JsonMap &json) const { + common::ToJson(app_name, json["app_name"]); + common::ToJson(stream_id, json["stream_id"]); + } + + std::string app_name; + std::string stream_id; +}; + +class PlayStopParameter : public common::Jsonize { + public: + PlayStopParameter() {} + ~PlayStopParameter() {} + + void fromJson(common::JsonMap &json) {} + + void toJson(common::JsonMap &json) const { + common::ToJson(app_name, json["app_name"]); + } + + std::string app_name; +}; + +class LedControlParameter : public common::Jsonize { + public: + LedControlParameter() {} + ~LedControlParameter() {} + + void fromJson(common::JsonMap &json) {} + + void toJson(common::JsonMap &json) const { + common::ToJson(R, json["R"]); + common::ToJson(G, json["G"]); + common::ToJson(B, json["B"]); + } + + uint8_t R; + uint8_t G; + uint8_t B; +}; +} // namespace g1 +} // namespace robot +} // namespace unitree + +#endif // __UT_ROBOT_G1_AUDIO_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/g1/audio/g1_audio_client.hpp b/unitree_SDK/include/unitree/robot/g1/audio/g1_audio_client.hpp new file mode 100644 index 0000000..6e4e8d0 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/g1/audio/g1_audio_client.hpp @@ -0,0 +1,110 @@ +#ifndef __UT_ROBOT_G1_AUDIO_CLIENT_HPP__ +#define __UT_ROBOT_G1_AUDIO_CLIENT_HPP__ + +#include +#include +#include + +#include "g1_audio_api.hpp" + +namespace unitree { +namespace robot { +namespace g1 { +class AudioClient : public Client { + public: + AudioClient() : Client(AUDIO_SERVICE_NAME, false) {} + ~AudioClient() {} + + /*Init*/ + void Init() { + SetApiVersion(AUDIO_API_VERSION); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_AUDIO_TTS); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_AUDIO_ASR); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_AUDIO_START_PLAY); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_AUDIO_STOP_PLAY); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_AUDIO_GET_VOLUME); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_AUDIO_SET_VOLUME); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_AUDIO_SET_RGB_LED); + }; + + /*API Call*/ + int32_t TtsMaker(const std::string& text, int32_t speaker_id) { + std::string parameter, data; + TtsMakerParameter json; + + json.index = tts_index++; + json.text = text; + json.speaker_id = speaker_id; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_AUDIO_TTS, parameter, data); + } + + int32_t GetVolume(uint8_t& volume) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_AUDIO_GET_VOLUME, parameter, data); + if (ret == 0) { + unitree::robot::go2::JsonizeCommObjInt json; + json.name = "volume"; + common::FromJsonString(data, json); + volume = json.value; + } + + return ret; + } + + int32_t SetVolume(uint8_t volume) { + std::string parameter, data; + unitree::robot::go2::JsonizeCommObjInt json; + + json.value = volume; + json.name = "volume"; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_AUDIO_SET_VOLUME, parameter, data); + } + + int32_t PlayStream(std::string app_name, std::string stream_id, + std::vector pcm_data) { + std::string parameter; + PlayStreamParameter json; + + json.app_name = app_name; + json.stream_id = stream_id; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_AUDIO_START_PLAY, parameter, pcm_data); + } + + int32_t PlayStop(std::string app_name) { + std::string parameter, data; + PlayStopParameter json; + + json.app_name = app_name; + parameter = common::ToJsonString(json); + + Call(ROBOT_API_ID_AUDIO_STOP_PLAY, parameter, data); + return 0; + } + + int32_t LedControl(uint8_t R, uint8_t G, uint8_t B) { + std::string parameter, data; + LedControlParameter json; + + json.R = R; + json.G = G; + json.B = B; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_AUDIO_SET_RGB_LED, parameter, data); + } + + private: + uint32_t tts_index = 0; +}; +} // namespace g1 + +} // namespace robot +} // namespace unitree +#endif // __UT_ROBOT_G1_AUDIO_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/g1/audio/g1_audio_error.hpp b/unitree_SDK/include/unitree/robot/g1/audio/g1_audio_error.hpp new file mode 100644 index 0000000..9dd3a71 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/g1/audio/g1_audio_error.hpp @@ -0,0 +1,14 @@ +#ifndef __UT_ROBOT_G1_AUDIO_ERROR_HPP__ +#define __UT_ROBOT_G1_AUDIO_ERROR_HPP__ + +#include + +namespace unitree { +namespace robot { +namespace g1 { +UT_DECL_ERR(UT_ROBOT_AUDIO_ERR_COMM, 100, "Invalid parameter ") +} // namespace g1 +} // namespace robot +} // namespace unitree + +#endif // __UT_ROBOT_G1_AUDIO_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/g1/loco/g1_loco_api.hpp b/unitree_SDK/include/unitree/robot/g1/loco/g1_loco_api.hpp new file mode 100644 index 0000000..8a4fc85 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/g1/loco/g1_loco_api.hpp @@ -0,0 +1,72 @@ +#ifndef __UT_ROBOT_G1_LOCO_API_HPP__ +#define __UT_ROBOT_G1_LOCO_API_HPP__ + +#include +#include + +namespace unitree { +namespace robot { +namespace g1 { +/*service name*/ +const std::string LOCO_SERVICE_NAME = "sport"; + +/*api version*/ +const std::string LOCO_API_VERSION = "1.0.0.0"; + +/*api id*/ +const int32_t ROBOT_API_ID_LOCO_GET_FSM_ID = 7001; +const int32_t ROBOT_API_ID_LOCO_GET_FSM_MODE = 7002; +const int32_t ROBOT_API_ID_LOCO_GET_BALANCE_MODE = 7003; +const int32_t ROBOT_API_ID_LOCO_GET_SWING_HEIGHT = 7004; +const int32_t ROBOT_API_ID_LOCO_GET_STAND_HEIGHT = 7005; +const int32_t ROBOT_API_ID_LOCO_GET_PHASE = 7006; // deprecated + +const int32_t ROBOT_API_ID_LOCO_SET_FSM_ID = 7101; +const int32_t ROBOT_API_ID_LOCO_SET_BALANCE_MODE = 7102; +const int32_t ROBOT_API_ID_LOCO_SET_SWING_HEIGHT = 7103; +const int32_t ROBOT_API_ID_LOCO_SET_STAND_HEIGHT = 7104; +const int32_t ROBOT_API_ID_LOCO_SET_VELOCITY = 7105; +const int32_t ROBOT_API_ID_LOCO_SET_ARM_TASK = 7106; +const int32_t ROBOT_API_ID_LOCO_SET_SPEED_MODE = 7107; + +using LocoCmd = + std::map>>; + +class JsonizeDataVecFloat : public common::Jsonize { +public: + JsonizeDataVecFloat() {} + ~JsonizeDataVecFloat() {} + + void fromJson(common::JsonMap &json) { common::FromJson(json["data"], data); } + + void toJson(common::JsonMap &json) const { + common::ToJson(data, json["data"]); + } + + std::vector data; +}; + +class JsonizeVelocityCommand : public common::Jsonize { +public: + JsonizeVelocityCommand() {} + ~JsonizeVelocityCommand() {} + + void fromJson(common::JsonMap &json) { + common::FromJson(json["velocity"], velocity); + common::FromJson(json["duration"], duration); + } + + void toJson(common::JsonMap &json) const { + common::ToJson(velocity, json["velocity"]); + common::ToJson(duration, json["duration"]); + } + + std::vector velocity; + float duration; +}; + +} // namespace g1 +} // namespace robot +} // namespace unitree + +#endif // __UT_ROBOT_G1_LOCO_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/g1/loco/g1_loco_client.hpp b/unitree_SDK/include/unitree/robot/g1/loco/g1_loco_client.hpp new file mode 100644 index 0000000..ba6bc23 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/g1/loco/g1_loco_client.hpp @@ -0,0 +1,253 @@ +#ifndef __UT_ROBOT_G1_LOCO_CLIENT_HPP__ +#define __UT_ROBOT_G1_LOCO_CLIENT_HPP__ + +#include "g1_loco_api.hpp" +#include +#include +#include + +namespace unitree { +namespace robot { +namespace g1 { +class LocoClient : public Client { + public: + LocoClient() : Client(LOCO_SERVICE_NAME, false) {} + ~LocoClient() {} + + /*Init*/ + void Init() { + SetApiVersion(LOCO_API_VERSION); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_FSM_ID); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_FSM_MODE); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_BALANCE_MODE); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_SWING_HEIGHT); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_STAND_HEIGHT); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_PHASE); // deprecated + + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_FSM_ID); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_BALANCE_MODE); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_SWING_HEIGHT); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_STAND_HEIGHT); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_VELOCITY); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_ARM_TASK); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_SPEED_MODE); + }; + + /*Low Level API Call*/ + int32_t GetFsmId(int& fsm_id) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_FSM_ID, parameter, data); + + if (ret == 0) { + go2::JsonizeDataInt json; + common::FromJsonString(data, json); + fsm_id = json.data; + } + + return ret; + } + + int32_t GetFsmMode(int& fsm_mode) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_FSM_MODE, parameter, data); + + if (ret == 0) { + go2::JsonizeDataInt json; + common::FromJsonString(data, json); + fsm_mode = json.data; + } + + return ret; + } + + int32_t GetBalanceMode(int& balance_mode) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_BALANCE_MODE, parameter, data); + + if (ret == 0) { + go2::JsonizeDataInt json; + common::FromJsonString(data, json); + balance_mode = json.data; + } + + return ret; + } + + int32_t GetSwingHeight(float& swing_height) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_SWING_HEIGHT, parameter, data); + + if (ret == 0) { + go2::JsonizeDataFloat json; + common::FromJsonString(data, json); + swing_height = json.data; + } + + return ret; + } + + int32_t GetStandHeight(float& stand_height) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_STAND_HEIGHT, parameter, data); + + if (ret == 0) { + go2::JsonizeDataFloat json; + common::FromJsonString(data, json); + stand_height = json.data; + } + + return ret; + } + + int32_t GetPhase(std::vector& phase) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_PHASE, parameter, data); + + if (ret == 0) { + JsonizeDataVecFloat json; + common::FromJsonString(data, json); + phase = json.data; + } + + return ret; + } + + int32_t SetFsmId(int fsm_id) { + std::string parameter, data; + + go2::JsonizeDataInt json; + json.data = fsm_id; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_FSM_ID, parameter, data); + } + + int32_t SetBalanceMode(int balance_mode) { + std::string parameter, data; + + go2::JsonizeDataInt json; + json.data = balance_mode; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_BALANCE_MODE, parameter, data); + } + + int32_t SetSwingHeight(float swing_height) { + std::string parameter, data; + + go2::JsonizeDataFloat json; + json.data = swing_height; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_SWING_HEIGHT, parameter, data); + } + + int32_t SetStandHeight(float stand_height) { + std::string parameter, data; + + go2::JsonizeDataFloat json; + json.data = stand_height; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_STAND_HEIGHT, parameter, data); + } + + int32_t SetVelocity(float vx, float vy, float omega, float duration = 1.f) { + std::string parameter, data; + + JsonizeVelocityCommand json; + std::vector velocity = {vx, vy, omega}; + json.velocity = velocity; + json.duration = duration; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_VELOCITY, parameter, data); + } + + int32_t SetTaskId(int task_id) { + std::string parameter, data; + + go2::JsonizeDataInt json; + json.data = task_id; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_ARM_TASK, parameter, data); + } + + /*High Level API Call*/ + int32_t Damp() { return SetFsmId(1); } + + int32_t Start() { return SetFsmId(500); } + + int32_t Squat() { return SetFsmId(2); } + + int32_t Sit() { return SetFsmId(3); } + + int32_t StandUp() { return SetFsmId(4); } + + int32_t ZeroTorque() { return SetFsmId(0); } + + int32_t StopMove() { return SetVelocity(0.f, 0.f, 0.f); } + + int32_t HighStand() { return SetStandHeight(std::numeric_limits::max()); } + + int32_t LowStand() { return SetStandHeight(std::numeric_limits::min()); } + + int32_t Move(float vx, float vy, float vyaw, bool continous_move) { + return SetVelocity(vx, vy, vyaw, continous_move ? 864000.f : 1.f); + } + + int32_t Move(float vx, float vy, float vyaw) { return Move(vx, vy, vyaw, continous_move_); } + + int32_t BalanceStand() { return SetBalanceMode(0); } + + int32_t ContinuousGait(bool flag) { return SetBalanceMode(flag ? 1 : 0); } + + int32_t SwitchMoveMode(bool flag) { + continous_move_ = flag; + return 0; + } + + int32_t WaveHand(bool turn_flag = false) { return SetTaskId(turn_flag ? 1 : 0); } + + int32_t ShakeHand(int stage = -1) { + switch (stage) { + case 0: + first_shake_hand_stage_ = false; + return SetTaskId(2); + + case 1: + first_shake_hand_stage_ = true; + return SetTaskId(3); + + default: + first_shake_hand_stage_ = !first_shake_hand_stage_; + return SetTaskId(first_shake_hand_stage_ ? 3 : 2); + } + } + + int32_t SetSpeedMode(int speed_mode) { + std::string parameter, data; + + go2::JsonizeDataInt json; + json.data = speed_mode; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_SPEED_MODE, parameter, data); + } + +private: + bool continous_move_ = false; + bool first_shake_hand_stage_ = true; +}; +} // namespace g1 + +} // namespace robot +} // namespace unitree +#endif // __UT_ROBOT_G1_LOCO_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/g1/loco/g1_loco_error.hpp b/unitree_SDK/include/unitree/robot/g1/loco/g1_loco_error.hpp new file mode 100644 index 0000000..805e65c --- /dev/null +++ b/unitree_SDK/include/unitree/robot/g1/loco/g1_loco_error.hpp @@ -0,0 +1,17 @@ +#ifndef __UT_ROBOT_G1_LOCO_ERROR_HPP__ +#define __UT_ROBOT_G1_LOCO_ERROR_HPP__ + +#include + +namespace unitree { +namespace robot { +namespace g1 { +UT_DECL_ERR(UT_ROBOT_LOCO_ERR_LOCOSTATE_NOT_AVAILABLE, 7301, + "LocoState not available.") +UT_DECL_ERR(UT_ROBOT_LOCO_ERR_INVALID_FSM_ID, 7302, "Invalid fsm id.") +UT_DECL_ERR(UT_ROBOT_LOCO_ERR_INVALID_TASK_ID, 7303, "Invalid task id.") +} // namespace g1 +} // namespace robot +} // namespace unitree + +#endif // __UT_ROBOT_G1_LOCO_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/config/config_api.hpp b/unitree_SDK/include/unitree/robot/go2/config/config_api.hpp new file mode 100644 index 0000000..2048950 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/config/config_api.hpp @@ -0,0 +1,210 @@ +#ifndef __UT_ROBOT_GO2_CONFIG_API_HPP__ +#define __UT_ROBOT_GO2_CONFIG_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +/* + * service name + */ +const std::string CONFIG_SERVICE_NAME = "config"; + +/* + * api version + */ +const std::string CONFIG_API_VERSION = "1.0.0.1"; + +/* + * api id + */ +const int32_t CONFIG_API_ID_SET = 1001; +const int32_t CONFIG_API_ID_GET = 1002; +const int32_t CONFIG_API_ID_DEL = 1003; +const int32_t CONFIG_API_ID_META = 1004; + +/* + * data type + */ +class JsonizeConfigMeta : public common::Jsonize +{ +public: + JsonizeConfigMeta() + {} + + ~JsonizeConfigMeta() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + common::FromJson(json["lastModified"], lastModified); + common::FromJson(json["size"], size); + common::FromJson(json["epoch"], epoch); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + common::ToJson(lastModified, json["lastModified"]); + common::ToJson(size, json["size"]); + common::ToJson(epoch, json["epoch"]); + } + +public: + std::string name; + std::string lastModified; + int32_t size; + int32_t epoch; +}; + +class ConfigSetParameter : public common::Jsonize +{ +public: + ConfigSetParameter() + {} + + ~ConfigSetParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + common::FromJson(json["content"], content); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + common::ToJson(content, json["content"]); + } + +public: + std::string name; + std::string content; +}; + +class ConfigGetParameter : public common::Jsonize +{ +public: + ConfigGetParameter() + {} + + ~ConfigGetParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + } + +public: + std::string name; +}; + +class ConfigGetData : public common::Jsonize +{ +public: + ConfigGetData() + {} + + ~ConfigGetData() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["content"], content); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(content, json["content"]); + } + +public: + std::string content; +}; + +class ConfigDelParameter : public common::Jsonize +{ +public: + ConfigDelParameter() + {} + + ~ConfigDelParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + } + +public: + std::string name; +}; + +class ConfigMetaParameter : public common::Jsonize +{ +public: + ConfigMetaParameter() + {} + + ~ConfigMetaParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + } + +public: + std::string name; +}; + +class ConfigMetaData : public common::Jsonize +{ +public: + ConfigMetaData() + {} + + ~ConfigMetaData() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["meta"], meta); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(meta, json["meta"]); + } + +public: + JsonizeConfigMeta meta; +}; + +} +} +} + +#endif//__UT_ROBOT_GO2_CONFIG_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/config/config_client.hpp b/unitree_SDK/include/unitree/robot/go2/config/config_client.hpp new file mode 100644 index 0000000..e61ee6b --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/config/config_client.hpp @@ -0,0 +1,68 @@ +#ifndef __UT_ROBOT_GO2_CONFIG_CLIENT_HPP__ +#define __UT_ROBOT_GO2_CONFIG_CLIENT_HPP__ + +#include +#include +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +/* + * @brief ConfigMeta + */ +class ConfigMeta +{ +public: + ConfigMeta() : size(-1), epoch(-1) + {} + ~ConfigMeta() + {} + +public: + std::string name; + std::string lastModified; + int32_t size; + int32_t epoch; +}; + +/* + * @brief ConfigClient + */ + +using ConfigChangeStatusCallback = std::function; + +class ConfigClient : public Client +{ +public: + explicit ConfigClient(); + ~ConfigClient(); + + void Init(); + + int32_t Set(const std::string& name, const std::string& content); + int32_t Get(const std::string& name, std::string& content); + int32_t Del(const std::string& name); + int32_t Meta(const std::string& name, ConfigMeta& meta); + int32_t Meta(const std::string& name, std::string& meta); + + void SubscribeChangeStatus(const std::string& name, const ConfigChangeStatusCallback& callback); + +private: + void ChangeStatusMessageHandler(const void* message); + +private: + unitree::common::Mutex mLock; + std::map mNameCallbackMap; + ChannelSubscriberPtr mSubscriberPtr; +}; + +} +} +} + +#endif//__UT_ROBOT_GO2_CONFIG_CLIENT_HPP__ + diff --git a/unitree_SDK/include/unitree/robot/go2/config/config_error.hpp b/unitree_SDK/include/unitree/robot/go2/config/config_error.hpp new file mode 100644 index 0000000..1cb582e --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/config/config_error.hpp @@ -0,0 +1,29 @@ +#ifndef __UT_ROBOT_GO2_CONFIG_ERROR_HPP__ +#define __UT_ROBOT_GO2_CONFIG_ERROR_HPP__ + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +UT_DECL_ERR(UT_CONFIG_ERR_PARAMETER, 8201, "parameter error.") +UT_DECL_ERR(UT_CONFIG_ERR_NOT_FOUND, 8202, "config name is not found.") +UT_DECL_ERR(UT_CONFIG_ERR_NAME, 8203, "name is invalid.") +UT_DECL_ERR(UT_CONFIG_ERR_LIMITED, 8204, "name/content length limited.") +UT_DECL_ERR(UT_CONFIG_ERR_LOCK, 8205, "lock error.") +UT_DECL_ERR(UT_CONFIG_ERR_LOAD_META, 8206, "load meta error.") +UT_DECL_ERR(UT_CONFIG_ERR_SAVE_META, 8207, "save meta error.") +UT_DECL_ERR(UT_CONFIG_ERR_TEMP_META, 8208, "save meta temp error.") +UT_DECL_ERR(UT_CONFIG_ERR_FORMAL_META, 8209, "formalize meta error.") +UT_DECL_ERR(UT_CONFIG_ERR_REMOVE_META, 8210, "remove meta error.") +UT_DECL_ERR(UT_CONFIG_ERR_LOAD_DATA, 8211, "load data error.") +UT_DECL_ERR(UT_CONFIG_ERR_SAVE_DATA, 8212, "save data error.") +UT_DECL_ERR(UT_CONFIG_ERR_TEMP_DATA, 8213, "save data temp error.") +UT_DECL_ERR(UT_CONFIG_ERR_FORMAL_DATA, 8214, "formalize data error.") +UT_DECL_ERR(UT_CONFIG_ERR_REMOVE_DATA, 8215, "remove data error.") +} +} +} + +#endif//__UT_ROBOT_GO2_CONFIG_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/obstacles_avoid/obstacles_avoid_api.hpp b/unitree_SDK/include/unitree/robot/go2/obstacles_avoid/obstacles_avoid_api.hpp new file mode 100644 index 0000000..e4406e9 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/obstacles_avoid/obstacles_avoid_api.hpp @@ -0,0 +1,104 @@ +#ifndef __UT_ROBOT_GO2_OBSTACLES_AVOID_API_HPP__ +#define __UT_ROBOT_GO2_OBSTACLES_AVOID_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +const std::string ROBOT_OBSTACLES_AVOID_SERVICE_NAME = "obstacles_avoid"; +const std::string ROBOT_OBSTACLES_AVOID_API_VERSION = "1.0.0.2"; + +const int32_t ROBOT_API_ID_OBSTACLES_AVOID_SWITCH_SET = 1001; +const int32_t ROBOT_API_ID_OBSTACLES_AVOID_SWITCH_GET = 1002; +const int32_t ROBOT_API_ID_OBSTACLES_AVOID_MOVE = 1003; +const int32_t ROBOT_API_ID_OBSTACLES_AVOID_USE_REMOTE_COMMAND_FROM_API = 1004; + +class ObstaclesAvoidSwitchSetParameter : public common::Jsonize +{ +public: + void fromJson(common::JsonMap& json) + { + common::FromJson(json["enable"], mEnable); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(mEnable, json["enable"]); + } + + bool mEnable = true; +}; + +class ObstaclesAvoidSwitchGetData : public common::Jsonize +{ +public: + void fromJson(common::JsonMap& json) + { + common::FromJson(json["enable"], mEnable); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(mEnable, json["enable"]); + } + + bool mEnable = true; +}; + +class ObstaclesAvoidMoveParameter : public common::Jsonize +{ +public: + void fromJson(common::JsonMap& json) + { + common::FromJson(json["x"], mX); + common::FromJson(json["y"], mY); + common::FromJson(json["yaw"], mYaw); + common::FromJson(json["mode"], mMode); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(mX, json["x"]); + common::ToJson(mY, json["y"]); + common::ToJson(mYaw, json["yaw"]); + common::ToJson(mMode, json["mode"]); + } + + float mX = 0.0; + float mY = 0.0; + float mYaw = 0.0; + + /* + * mode: + * 0 for vel + * 1 for increment pose + * 2 for absolute pose + */ + int mMode = 0; +}; + +class ObstaclesAvoidRemoteCommandSource : public common::Jsonize +{ +public: + void fromJson(common::JsonMap& json) + { + common::FromJson(json["is_remote_commands_from_api"], mIsRemoteCommandsFromApi); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(mIsRemoteCommandsFromApi, json["is_remote_commands_from_api"]); + } + + bool mIsRemoteCommandsFromApi = true; +}; + +} +} +} + +#endif//__UT_ROBOT_GO2_OBSTACLES_AVOID_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/obstacles_avoid/obstacles_avoid_client.hpp b/unitree_SDK/include/unitree/robot/go2/obstacles_avoid/obstacles_avoid_client.hpp new file mode 100644 index 0000000..6277007 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/obstacles_avoid/obstacles_avoid_client.hpp @@ -0,0 +1,33 @@ +#ifndef __UT_ROBOT_GO2_OBSTACLES_AVOID_CLIENT_HPP__ +#define __UT_ROBOT_GO2_OBSTACLES_AVOID_CLIENT_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +class ObstaclesAvoidClient : public Client +{ +public: + ObstaclesAvoidClient(); + ~ObstaclesAvoidClient(); + + void Init(); + + int32_t SwitchSet(bool enable); + int32_t SwitchGet(bool& enable); + + int32_t Move(float x, float y, float yaw); + int32_t UseRemoteCommandFromApi(bool isRemoteCommandsFromApi); + + int32_t MoveToAbsolutePosition(float x, float y, float yaw); + int32_t MoveToIncrementPosition(float x, float y, float yaw); +}; +} +} +} + +#endif//__UT_ROBOT_GO2_OBSTACLES_AVOID_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/public/jsonize_type.hpp b/unitree_SDK/include/unitree/robot/go2/public/jsonize_type.hpp new file mode 100644 index 0000000..16d4c05 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/public/jsonize_type.hpp @@ -0,0 +1,311 @@ +#ifndef __UT_ROBOT_GO2_SDK_JSON_DATA_TYPE_HPP__ +#define __UT_ROBOT_GO2_SDK_JSON_DATA_TYPE_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +/* + * @brief Jonsize for simple flag type bool + */ +class JsonizeFlagBool : public common::Jsonize +{ +public: + JsonizeFlagBool() : flag(false) + {} + + ~JsonizeFlagBool() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["flag"], flag); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(flag, json["flag"]); + } + +public: + bool flag; +}; + +/* + * @brief Jonsize for simple data type bool + */ +class JsonizeDataBool : public common::Jsonize +{ +public: + JsonizeDataBool() : data(false) + {} + + ~JsonizeDataBool() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["data"], data); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(data, json["data"]); + } + +public: + bool data; +}; + +/* + * @brief Jonsize for simple data type int + */ +class JsonizeDataInt : public common::Jsonize +{ +public: + JsonizeDataInt() : data(0) + {} + + ~JsonizeDataInt() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["data"], data); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(data, json["data"]); + } + +public: + int data; +}; + +/* + * @brief Jonsize for simple data type float + */ +class JsonizeDataFloat : public common::Jsonize +{ +public: + JsonizeDataFloat() : data(0.0F) + {} + + ~JsonizeDataFloat() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["data"], data); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(data, json["data"]); + } + +public: + float data; +}; + +/* + * @brief Jonsize for simple data type double + */ +class JsonizeDataDouble : public common::Jsonize +{ +public: + JsonizeDataDouble() : data(0.0F) + {} + + ~JsonizeDataDouble() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["data"], data); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(data, json["data"]); + } + +public: + double data; +}; + +/* + * @brief Jonsize for simple data type string + */ +class JsonizeDataString : public common::Jsonize +{ +public: + JsonizeDataString() + {} + + ~JsonizeDataString() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["data"], data); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(data, json["data"]); + } + +public: + std::string data; +}; + +/* + * @brief Jonsize for data type vec3 + */ +class JsonizeVec3 : public common::Jsonize +{ +public: + JsonizeVec3() : x(0.0F), y(0.0F), z(0.0F) + {} + + ~JsonizeVec3() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["x"], x); + common::FromJson(json["y"], y); + common::FromJson(json["z"], z); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(x, json["x"]); + common::ToJson(y, json["y"]); + common::ToJson(z, json["z"]); + } + +public: + float x; + float y; + float z; +}; + +/* + * @brief Jonsize for data type quaternion + */ +class JsonizeQuat : public common::Jsonize +{ +public: + JsonizeQuat() : x(0.0F), y(0.0F), z(0.0F), w(0.0F) + {} + + ~JsonizeQuat() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["x"], x); + common::FromJson(json["y"], y); + common::FromJson(json["z"], z); + common::FromJson(json["w"], w); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(x, json["x"]); + common::ToJson(y, json["y"]); + common::ToJson(z, json["z"]); + common::ToJson(w, json["w"]); + } + +public: + float x; + float y; + float z; + float w; +}; + +/* + * Jsonize class for PathPoint + */ +class JsonizePathPoint : public common::Jsonize +{ +public: + JsonizePathPoint() : + timeFromStart(0.0F), x(0.0F), y(0.0F), yaw(0.0F), vx(0.0F), vy(0.0F), vyaw(0.0F) + {} + + ~JsonizePathPoint() + {} + +public: + void fromJson(common::JsonMap& json) + { + common::FromJson(json["t_from_start"], timeFromStart); + common::FromJson(json["x"], x); + common::FromJson(json["y"], y); + common::FromJson(json["yaw"], yaw); + common::FromJson(json["vx"], vx); + common::FromJson(json["vy"], vy); + common::FromJson(json["vyaw"], vyaw); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(timeFromStart, json["t_from_start"]); + common::ToJson(x, json["x"]); + common::ToJson(y, json["y"]); + common::ToJson(yaw, json["yaw"]); + common::ToJson(vx, json["vx"]); + common::ToJson(vy, json["vy"]); + common::ToJson(vyaw, json["vyaw"]); + } + +public: + float timeFromStart; + float x; + float y; + float yaw; + float vx; + float vy; + float vyaw; +}; + +/* + * @brief Jonsize for simple common object type int + */ +class JsonizeCommObjInt : public common::Jsonize +{ +public: + JsonizeCommObjInt() : value(0) + {} + + ~JsonizeCommObjInt() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json[name], value); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(value, json[name]); + } + +public: + int value; + std::string name; +}; + +} +} +} +#endif//__UT_ROBOT_GO2_SDK_JSON_DATA_TYPE_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/robot_state/robot_state_api.hpp b/unitree_SDK/include/unitree/robot/go2/robot_state/robot_state_api.hpp new file mode 100644 index 0000000..7974591 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/robot_state/robot_state_api.hpp @@ -0,0 +1,152 @@ +#ifndef __UT_ROBOT_GO2_ROBOT_STATE_API_HPP__ +#define __UT_ROBOT_GO2_ROBOT_STATE_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +/* + * service name + */ +const std::string ROBOT_STATE_SERVICE_NAME = "robot_state"; + +/* + * api version + */ +const std::string ROBOT_STATE_API_VERSION = "1.0.0.1"; + +/* + * api id + */ +const int32_t ROBOT_STATE_API_ID_SERVICE_SWITCH = 1001; +const int32_t ROBOT_STATE_API_ID_SET_REPORT_FREQ = 1002; +const int32_t ROBOT_STATE_API_ID_SERVICE_LIST = 1003; + +/* + * request parameter for 1001 + */ +class ServiceSwitchParameter : public common::Jsonize +{ +public: + ServiceSwitchParameter() : swit(0) + {} + + ~ServiceSwitchParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + common::FromJson(json["switch"], swit); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + common::ToJson(swit, json["switch"]); + } + +public: + std::string name; + int32_t swit; +}; + +/* + * response data for 1001 + */ +class ServiceSwitchData : public common::Jsonize +{ +public: + ServiceSwitchData() : status(0) + {} + + ~ServiceSwitchData() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + common::FromJson(json["status"], status); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + common::ToJson(status, json["status"]); + } + +public: + std::string name; + int32_t status; +}; + +/* + * request parameter for 1002 + */ +class SetReportFreqParameter : public common::Jsonize +{ +public: + SetReportFreqParameter() + {} + + ~SetReportFreqParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["interval"], interval); + common::FromJson(json["duration"], duration); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(interval, json["interval"]); + common::ToJson(duration, json["duration"]); + } + +public: + int32_t interval; + int32_t duration; +}; + +/* + * request data for 1003 + */ +class ServiceStateData : public common::Jsonize +{ +public: + ServiceStateData() + {} + + ~ServiceStateData() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + common::FromJson(json["status"], status); + common::FromJson(json["protect"], protect); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + common::ToJson(status, json["status"]); + common::ToJson(protect, json["protect"]); + } + +public: + std::string name; + int32_t status; + int32_t protect; +}; + +} +} +} + +#endif//__UT_ROBOT_GO2_ROBOT_STATE_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/robot_state/robot_state_client.hpp b/unitree_SDK/include/unitree/robot/go2/robot_state/robot_state_client.hpp new file mode 100644 index 0000000..669a53c --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/robot_state/robot_state_client.hpp @@ -0,0 +1,47 @@ +#ifndef __UT_ROBOT_GO2_ROBOT_STATE_CLIENT_HPP__ +#define __UT_ROBOT_GO2_ROBOT_STATE_CLIENT_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +/* + * @brief ServiceState + */ +class ServiceState +{ +public: + ServiceState() : status(0), protect(0) + {} + + std::string name; + int32_t status; + int32_t protect; +}; + +/* + * @brief RobotStateClient + */ +class RobotStateClient : public Client +{ +public: + explicit RobotStateClient(); + ~RobotStateClient(); + + void Init(); + + int32_t ServiceList(std::vector& serviceStateList); + int32_t ServiceSwitch(const std::string& name, int32_t swit, int32_t& status); + int32_t SetReportFreq(int32_t interval, int32_t duration); +}; + +} +} +} + +#endif//__UT_ROBOT_GO2_ROBOT_STATE_CLIENT_HPP__ + diff --git a/unitree_SDK/include/unitree/robot/go2/robot_state/robot_state_error.hpp b/unitree_SDK/include/unitree/robot/go2/robot_state/robot_state_error.hpp new file mode 100644 index 0000000..84e1add --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/robot_state/robot_state_error.hpp @@ -0,0 +1,18 @@ +#ifndef __UT_ROBOT_GO2_ROBOT_STATE_CLIENT_ERROR_HPP__ +#define __UT_ROBOT_GO2_ROBOT_STATE_CLIENT_ERROR_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +UT_DECL_ERR(UT_ROBOT_STATE_CLIENT_ERR_SERVICE_SWITCH, 5201, "service switch error.") +UT_DECL_ERR(UT_ROBOT_STATE_CLIENT_ERR_SERVICE_PROTECTED, 5202, "service is protected.") +} +} +} + +#endif//__UT_ROBOT_GO2_ROBOT_STATE_CLIENT_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/sport/sport_api.hpp b/unitree_SDK/include/unitree/robot/go2/sport/sport_api.hpp new file mode 100644 index 0000000..926d870 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/sport/sport_api.hpp @@ -0,0 +1,64 @@ +#ifndef __UT_ROBOT_GO2_SPORT_API_HPP__ +#define __UT_ROBOT_GO2_SPORT_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +/*service name*/ +const std::string ROBOT_SPORT_SERVICE_NAME = "sport"; + +/*api version*/ +const std::string ROBOT_SPORT_API_VERSION = "1.0.0.1"; + +/*api id*/ +const int32_t ROBOT_SPORT_API_ID_DAMP = 1001; +const int32_t ROBOT_SPORT_API_ID_BALANCESTAND = 1002; +const int32_t ROBOT_SPORT_API_ID_STOPMOVE = 1003; +const int32_t ROBOT_SPORT_API_ID_STANDUP = 1004; +const int32_t ROBOT_SPORT_API_ID_STANDDOWN = 1005; +const int32_t ROBOT_SPORT_API_ID_RECOVERYSTAND = 1006; +const int32_t ROBOT_SPORT_API_ID_EULER = 1007; +const int32_t ROBOT_SPORT_API_ID_MOVE = 1008; +const int32_t ROBOT_SPORT_API_ID_SIT = 1009; +const int32_t ROBOT_SPORT_API_ID_RISESIT = 1010; +const int32_t ROBOT_SPORT_API_ID_SPEEDLEVEL = 1015; +const int32_t ROBOT_SPORT_API_ID_HELLO = 1016; +const int32_t ROBOT_SPORT_API_ID_STRETCH = 1017; +const int32_t ROBOT_SPORT_API_ID_CONTENT = 1020; +const int32_t ROBOT_SPORT_API_ID_DANCE1 = 1022; +const int32_t ROBOT_SPORT_API_ID_DANCE2 = 1023; +const int32_t ROBOT_SPORT_API_ID_SWITCHJOYSTICK = 1027; +const int32_t ROBOT_SPORT_API_ID_POSE = 1028; +const int32_t ROBOT_SPORT_API_ID_SCRAPE = 1029; +const int32_t ROBOT_SPORT_API_ID_FRONTFLIP = 1030; +const int32_t ROBOT_SPORT_API_ID_FRONTJUMP = 1031; +const int32_t ROBOT_SPORT_API_ID_FRONTPOUNCE = 1032; +const int32_t ROBOT_SPORT_API_ID_HEART = 1036; +const int32_t ROBOT_SPORT_API_ID_STATICWALK = 1061; +const int32_t ROBOT_SPORT_API_ID_TROTRUN = 1062; +const int32_t ROBOT_SPORT_API_ID_ECONOMICGAIT = 1063; +const int32_t ROBOT_SPORT_API_ID_LEFTFLIP = 2041; +const int32_t ROBOT_SPORT_API_ID_BACKFLIP = 2043; +const int32_t ROBOT_SPORT_API_ID_HANDSTAND = 2044; +const int32_t ROBOT_SPORT_API_ID_FREEWALK = 2045; +const int32_t ROBOT_SPORT_API_ID_FREEBOUND = 2046; +const int32_t ROBOT_SPORT_API_ID_FREEJUMP = 2047; +const int32_t ROBOT_SPORT_API_ID_FREEAVOID = 2048; +const int32_t ROBOT_SPORT_API_ID_CLASSICWALK = 2049; +const int32_t ROBOT_SPORT_API_ID_WALKUPRIGHT = 2050; +const int32_t ROBOT_SPORT_API_ID_CROSSSTEP = 2051; +const int32_t ROBOT_SPORT_API_ID_AUTORECOVERY_SET = 2054; +const int32_t ROBOT_SPORT_API_ID_AUTORECOVERY_GET = 2055; +const int32_t ROBOT_SPORT_API_ID_SWITCHAVOIDMODE = 2058; + + +} +} +} + +#endif //__UT_ROBOT_GO2_SPORT_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/sport/sport_client.hpp b/unitree_SDK/include/unitree/robot/go2/sport/sport_client.hpp new file mode 100644 index 0000000..faaef0f --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/sport/sport_client.hpp @@ -0,0 +1,86 @@ +#ifndef __UT_ROBOT_GO2_SPORT_CLIENT_HPP__ +#define __UT_ROBOT_GO2_SPORT_CLIENT_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +/* + * PathPoint + */ +struct stPathPoint +{ + float timeFromStart; + float x; + float y; + float yaw; + float vx; + float vy; + float vyaw; +}; + +typedef struct stPathPoint PathPoint; + +/* + * SportClient + */ +class SportClient : public Client +{ +public: + explicit SportClient(bool enableLease = false); + ~SportClient(); + + void Init(); + + int32_t Damp(); + int32_t BalanceStand(); + int32_t StopMove(); + int32_t StandUp(); + int32_t StandDown(); + int32_t RecoveryStand(); + int32_t Euler(float roll, float pitch, float yaw); + int32_t Move(float vx, float vy, float vyaw); + int32_t Sit(); + int32_t RiseSit(); + int32_t SpeedLevel(int level); + int32_t Hello(); + int32_t Stretch(); + int32_t SwitchJoystick(bool flag); + int32_t Content(); + int32_t Heart(); + int32_t Pose(bool flag); + int32_t Scrape(); + int32_t FrontFlip(); + int32_t FrontJump(); + int32_t FrontPounce(); + int32_t Dance1(); + int32_t Dance2(); + int32_t LeftFlip(); + int32_t BackFlip(); + int32_t HandStand(bool flag); + int32_t FreeWalk(); + int32_t FreeBound(bool flag); + int32_t FreeJump(bool flag); + int32_t FreeAvoid(bool flag); + int32_t ClassicWalk(bool flag); + int32_t WalkUpright(bool flag); + int32_t CrossStep(bool flag); + int32_t AutoRecoverSet(bool flag); + int32_t AutoRecoverGet(bool& flag); + int32_t StaticWalk(); + int32_t TrotRun(); + int32_t EconomicGait(); + int32_t SwitchAvoidMode(); + + + +}; +} +} +} + +#endif//__UT_ROBOT_GO2_SPORT_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/sport/sport_error.hpp b/unitree_SDK/include/unitree/robot/go2/sport/sport_error.hpp new file mode 100644 index 0000000..b062841 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/sport/sport_error.hpp @@ -0,0 +1,19 @@ +#ifndef __UT_ROBOT_GO2_SPORT_ERROR_HPP__ +#define __UT_ROBOT_GO2_SPORT_ERROR_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +UT_DECL_ERR(UT_ROBOT_SPORT_ERR_CLIENT_POINT_PATH, 4101, "point path error.") +UT_DECL_ERR(UT_ROBOT_SPORT_ERR_SERVER_OVERTIME, 4201, "server overtime.") +UT_DECL_ERR(UT_ROBOT_SPORT_ERR_SERVER_NOT_INIT, 4205, "server function not init.") +} +} +} + +#endif//__UT_ROBOT_GO2_SPORT_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/utrack/utrack_api.hpp b/unitree_SDK/include/unitree/robot/go2/utrack/utrack_api.hpp new file mode 100644 index 0000000..3376c6e --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/utrack/utrack_api.hpp @@ -0,0 +1,55 @@ +#ifndef __UT_ROBOT_GO2_UTRACK_API_HPP__ +#define __UT_ROBOT_GO2_UTRACK_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +const std::string ROBOT_UTRACK_SERVICE_NAME = "uwbswitch"; +const std::string ROBOT_UTRACK_API_VERSION = "1.0.0.1"; + +const int32_t ROBOT_API_ID_UTRACK_SWITCH_SET = 1001; +const int32_t ROBOT_API_ID_UTRACK_SWITCH_GET = 1002; +const int32_t ROBOT_API_ID_UTRACK_IS_TRACKING = 1003; + +class UtrackSwitchSetParameter : public common::Jsonize +{ +public: + void fromJson(common::JsonMap& json) + { + common::FromJson(json["enable"], mEnable); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(mEnable, json["enable"]); + } + + int32_t mEnable = true; +}; + +class UtrackSwitchGetData : public common::Jsonize +{ +public: + void fromJson(common::JsonMap& json) + { + common::FromJson(json["enable"], mEnable); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(mEnable, json["enable"]); + } + + int32_t mEnable = true; +}; + +} +} +} + +#endif//__UT_ROBOT_GO2_UTRACK_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/utrack/utrack_client.hpp b/unitree_SDK/include/unitree/robot/go2/utrack/utrack_client.hpp new file mode 100644 index 0000000..56024f9 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/utrack/utrack_client.hpp @@ -0,0 +1,28 @@ +#ifndef __UT_ROBOT_GO2_UTRACK_CLIENT_HPP__ +#define __UT_ROBOT_GO2_UTRACK_CLIENT_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +class UtrackClient : public Client +{ + public: + UtrackClient(); + ~UtrackClient(); + + void Init(); + + int32_t SwitchSet(bool enable); + int32_t SwitchGet(bool& enable); + int32_t IsTracking(bool& enable); +}; +} +} +} + +#endif//__UT_ROBOT_GO2_UTRACK_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/video/video_api.hpp b/unitree_SDK/include/unitree/robot/go2/video/video_api.hpp new file mode 100644 index 0000000..6cfffe2 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/video/video_api.hpp @@ -0,0 +1,24 @@ +#ifndef __UT_ROBOT_GO2_VIDEO_API_HPP__ +#define __UT_ROBOT_GO2_VIDEO_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +/*service name*/ +const std::string ROBOT_VIDEO_SERVICE_NAME = "videohub"; + +/*api version*/ +const std::string ROBOT_VIDEO_API_VERSION = "1.0.0.0"; + +/*api id*/ +const int32_t ROBOT_VIDEO_API_ID_GETIMAGESAMPLE = 1001; +} +} +} + +#endif //__UT_ROBOT_GO2_VIDEO_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/video/video_client.hpp b/unitree_SDK/include/unitree/robot/go2/video/video_client.hpp new file mode 100644 index 0000000..ca1226d --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/video/video_client.hpp @@ -0,0 +1,34 @@ +#ifndef __UT_ROBOT_GO2_VIDEO_CLIENT_HPP__ +#define __UT_ROBOT_GO2_VIDEO_CLIENT_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +/* + * VideoClient + */ +class VideoClient : public Client +{ +public: + explicit VideoClient(); + ~VideoClient(); + + void Init(); + + /* + * @brief GetImageSample + * @api: 1001 + */ + int32_t GetImageSample(std::vector&); + +}; +} +} +} + +#endif//__UT_ROBOT_GO2_VIDEO_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/video/video_error.hpp b/unitree_SDK/include/unitree/robot/go2/video/video_error.hpp new file mode 100644 index 0000000..585edc5 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/video/video_error.hpp @@ -0,0 +1,17 @@ +#ifndef __UT_ROBOT_GO2_VIDEO_ERROR_HPP__ +#define __UT_ROBOT_GO2_VIDEO_ERROR_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ + UT_DECL_ERR(UT_ROBOT_VIDEO_ERR_COMM, 100, "Invalid parameter") +} +} +} + +#endif//__UT_ROBOT_GO2_VIDEO_ERROR_HPP__ \ No newline at end of file diff --git a/unitree_SDK/include/unitree/robot/go2/vui/vui_api.hpp b/unitree_SDK/include/unitree/robot/go2/vui/vui_api.hpp new file mode 100644 index 0000000..b36f9d9 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/vui/vui_api.hpp @@ -0,0 +1,29 @@ +#ifndef __UT_ROBOT_GO2_VUI_API_HPP__ +#define __UT_ROBOT_GO2_VUI_API_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +/*service name*/ +const std::string ROBOT_VUI_SERVICE_NAME = "vui"; + +/*api version*/ +const std::string ROBOT_VUI_API_VERSION = "1.0.0.0"; + +/*api id*/ +const int32_t ROBOT_VUI_API_ID_SETSWITCH = 1001; +const int32_t ROBOT_VUI_API_ID_GETSWITCH = 1002; +const int32_t ROBOT_VUI_API_ID_SETVOLUME = 1003; +const int32_t ROBOT_VUI_API_ID_GETVOLUME = 1004; +const int32_t ROBOT_VUI_API_ID_SETBRIGHTNESS = 1005; +const int32_t ROBOT_VUI_API_ID_GETBRIGHTNESS = 1006; +} +} +} + +#endif //__UT_ROBOT_GO2_VUI_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/vui/vui_client.hpp b/unitree_SDK/include/unitree/robot/go2/vui/vui_client.hpp new file mode 100644 index 0000000..8b2723b --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/vui/vui_client.hpp @@ -0,0 +1,64 @@ +#ifndef __UT_ROBOT_GO2_VUI_CLIENT_HPP__ +#define __UT_ROBOT_GO2_VUI_CLIENT_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ +/* + * VuiClient + */ +class VuiClient : public Client +{ +public: + explicit VuiClient(); + ~VuiClient(); + + void Init(); + + /* + * @brief SetSwitch + * @api: 1001 + */ + int32_t SetSwitch(int enable); + + /* + * @brief GetSwitch + * @api: 1002 + */ + int32_t GetSwitch(int&); + + /* + * @brief SetVolume + * @api: 1003 + */ + int32_t SetVolume(int level); + + /* + * @brief GetVolume + * @api: 1004 + */ + int32_t GetVolume(int&); + + /* + * @brief SetBrightness + * @api: 1005 + */ + int32_t SetBrightness(int level); + + /* + * @brief GetBrightness + * @api: 1006 + */ + int32_t GetBrightness(int&); + +}; +} +} +} + +#endif//__UT_ROBOT_GO2_VUI_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/go2/vui/vui_error.hpp b/unitree_SDK/include/unitree/robot/go2/vui/vui_error.hpp new file mode 100644 index 0000000..4f0603d --- /dev/null +++ b/unitree_SDK/include/unitree/robot/go2/vui/vui_error.hpp @@ -0,0 +1,17 @@ +#ifndef __UT_ROBOT_GO2_VUI_ERROR_HPP__ +#define __UT_ROBOT_GO2_VUI_ERROR_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +namespace go2 +{ + UT_DECL_ERR(UT_ROBOT_VUI_ERR_COMM, 100, "Invalid parameter") +} +} +} + +#endif//__UT_ROBOT_GO2_VUI_ERROR_HPP__ \ No newline at end of file diff --git a/unitree_SDK/include/unitree/robot/h1/loco/h1_loco_api.hpp b/unitree_SDK/include/unitree/robot/h1/loco/h1_loco_api.hpp new file mode 100644 index 0000000..118d777 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/h1/loco/h1_loco_api.hpp @@ -0,0 +1,97 @@ +#ifndef __UT_ROBOT_H1_LOCO_API_HPP__ +#define __UT_ROBOT_H1_LOCO_API_HPP__ + +#include +#include + +namespace unitree { +namespace robot { +namespace h1 { +/*service name*/ +const std::string LOCO_SERVICE_NAME = "loco"; + +/*api version*/ +const std::string LOCO_API_VERSION = "2.0.0.0"; + +/*api id*/ +const int32_t ROBOT_API_ID_LOCO_GET_FSM_ID = 8001; +const int32_t ROBOT_API_ID_LOCO_GET_FSM_MODE = 8002; +const int32_t ROBOT_API_ID_LOCO_GET_BALANCE_MODE = 8003; +const int32_t ROBOT_API_ID_LOCO_GET_SWING_HEIGHT = 8004; +const int32_t ROBOT_API_ID_LOCO_GET_STAND_HEIGHT = 8005; +const int32_t ROBOT_API_ID_LOCO_GET_PHASE = 8006; // deprecated + +const int32_t ROBOT_API_ID_LOCO_SET_FSM_ID = 8101; +const int32_t ROBOT_API_ID_LOCO_SET_BALANCE_MODE = 8102; +const int32_t ROBOT_API_ID_LOCO_SET_SWING_HEIGHT = 8103; +const int32_t ROBOT_API_ID_LOCO_SET_STAND_HEIGHT = 8104; +const int32_t ROBOT_API_ID_LOCO_SET_VELOCITY = 8105; +const int32_t ROBOT_API_ID_LOCO_SET_PHASE = 8106; +const int32_t ROBOT_API_ID_LOCO_SET_ARM_TASK = 8107; + +const int32_t ROBOT_API_ID_LOCO_ENABLE_ODOM = 8201; +const int32_t ROBOT_API_ID_LOCO_DISABLE_ODOM = 8202; +const int32_t ROBOT_API_ID_LOCO_GET_ODOM = 8203; +const int32_t ROBOT_API_ID_LOCO_SET_TARGET_POSITION = 8204; + +using LocoCmd = std::map>>; + +class JsonizeDataVecFloat : public common::Jsonize { + public: + JsonizeDataVecFloat() {} + ~JsonizeDataVecFloat() {} + + void fromJson(common::JsonMap& json) { common::FromJson(json["data"], data); } + + void toJson(common::JsonMap& json) const { common::ToJson(data, json["data"]); } + + std::vector data; +}; + +class JsonizeVelocityCommand : public common::Jsonize { + public: + JsonizeVelocityCommand() {} + ~JsonizeVelocityCommand() {} + + void fromJson(common::JsonMap& json) { + common::FromJson(json["velocity"], velocity); + common::FromJson(json["duration"], duration); + } + + void toJson(common::JsonMap& json) const { + common::ToJson(velocity, json["velocity"]); + common::ToJson(duration, json["duration"]); + } + + std::vector velocity; + float duration; +}; + +class JsonizeTargetPos : public common::Jsonize { + public: + JsonizeTargetPos() {} + ~JsonizeTargetPos() {} + + void fromJson(common::JsonMap& json) { + common::FromJson(json["x"], x); + common::FromJson(json["y"], y); + common::FromJson(json["yaw"], yaw); + common::FromJson(json["relative"], relative); + } + + void toJson(common::JsonMap& json) const { + common::ToJson(x, json["x"]); + common::ToJson(y, json["y"]); + common::ToJson(yaw, json["yaw"]); + common::ToJson(relative, json["relative"]); + } + + float x, y, yaw; + bool relative; +}; + +} // namespace h1 +} // namespace robot +} // namespace unitree + +#endif // __UT_ROBOT_H1_LOCO_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/h1/loco/h1_loco_client.hpp b/unitree_SDK/include/unitree/robot/h1/loco/h1_loco_client.hpp new file mode 100644 index 0000000..acc2fdf --- /dev/null +++ b/unitree_SDK/include/unitree/robot/h1/loco/h1_loco_client.hpp @@ -0,0 +1,283 @@ +#ifndef __UT_ROBOT_H1_LOCO_CLIENT_HPP__ +#define __UT_ROBOT_H1_LOCO_CLIENT_HPP__ + +#include "h1_loco_api.hpp" +#include +#include +#include + +namespace unitree { +namespace robot { +namespace h1 { +class LocoClient : public Client { + public: + LocoClient() : Client(LOCO_SERVICE_NAME, false) {} + ~LocoClient() {} + + /*Init*/ + void Init() { + SetApiVersion(LOCO_API_VERSION); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_FSM_ID); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_FSM_MODE); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_BALANCE_MODE); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_SWING_HEIGHT); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_STAND_HEIGHT); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_PHASE); // deprecated + + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_FSM_ID); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_BALANCE_MODE); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_SWING_HEIGHT); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_STAND_HEIGHT); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_VELOCITY); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_PHASE); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_ARM_TASK); + + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_ENABLE_ODOM); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_DISABLE_ODOM); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_GET_ODOM); + UT_ROBOT_CLIENT_REG_API_NO_PROI(ROBOT_API_ID_LOCO_SET_TARGET_POSITION); + }; + + /*Low Level API Call*/ + int32_t GetFsmId(int& fsm_id) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_FSM_ID, parameter, data); + + go2::JsonizeDataInt json; + common::FromJsonString(data, json); + fsm_id = json.data; + + return ret; + } + + int32_t GetFsmMode(int& fsm_mode) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_FSM_MODE, parameter, data); + + go2::JsonizeDataInt json; + common::FromJsonString(data, json); + fsm_mode = json.data; + + return ret; + } + + int32_t GetBalanceMode(int& balance_mode) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_BALANCE_MODE, parameter, data); + + go2::JsonizeDataInt json; + common::FromJsonString(data, json); + balance_mode = json.data; + + return ret; + } + + int32_t GetSwingHeight(float& swing_height) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_SWING_HEIGHT, parameter, data); + + go2::JsonizeDataFloat json; + common::FromJsonString(data, json); + swing_height = json.data; + + return ret; + } + + int32_t GetStandHeight(float& stand_height) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_STAND_HEIGHT, parameter, data); + + go2::JsonizeDataFloat json; + common::FromJsonString(data, json); + stand_height = json.data; + + return ret; + } + + int32_t GetPhase(std::vector& phase) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_PHASE, parameter, data); + + JsonizeDataVecFloat json; + common::FromJsonString(data, json); + phase = json.data; + + return ret; + } + + int32_t EnableOdom() { + std::string parameter, data; + return Call(ROBOT_API_ID_LOCO_ENABLE_ODOM, parameter, data); + } + + int32_t DisableOdom() { + std::string parameter, data; + return Call(ROBOT_API_ID_LOCO_DISABLE_ODOM, parameter, data); + } + + int32_t GetOdom(float& x, float& y, float& yaw) { + std::string parameter, data; + + int32_t ret = Call(ROBOT_API_ID_LOCO_GET_ODOM, parameter, data); + + go2::JsonizeVec3 json; + common::FromJsonString(data, json); + x = json.x; + y = json.y; + yaw = json.z; + + return ret; + } + + int32_t SetFsmId(int fsm_id) { + std::string parameter, data; + + go2::JsonizeDataInt json; + json.data = fsm_id; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_FSM_ID, parameter, data); + } + + int32_t SetBalanceMode(int balance_mode) { + std::string parameter, data; + + go2::JsonizeDataInt json; + json.data = balance_mode; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_BALANCE_MODE, parameter, data); + } + + int32_t SetSwingHeight(float swing_height) { + std::string parameter, data; + + go2::JsonizeDataFloat json; + json.data = swing_height; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_SWING_HEIGHT, parameter, data); + } + + int32_t SetStandHeight(float stand_height) { + std::string parameter, data; + + go2::JsonizeDataFloat json; + json.data = stand_height; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_STAND_HEIGHT, parameter, data); + } + + int32_t SetVelocity(float vx, float vy, float omega, float duration = 1.f) { + std::string parameter, data; + + JsonizeVelocityCommand json; + std::vector velocity = {vx, vy, omega}; + json.velocity = velocity; + json.duration = duration; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_VELOCITY, parameter, data); + } + + int32_t SetPhase(std::vector phase) { + std::string parameter, data; + + JsonizeDataVecFloat json; + json.data = phase; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_PHASE, parameter, data); + } + + int32_t SetTargetPos(float x, float y, float yaw, bool relative = true) { + std::string parameter, data; + + JsonizeTargetPos json; + json.x = x; + json.y = y; + json.yaw = yaw; + json.relative = relative; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_TARGET_POSITION, parameter, data); + } + + int32_t SetTaskId(int task_id) { + std::string parameter, data; + + go2::JsonizeDataInt json; + json.data = task_id; + parameter = common::ToJsonString(json); + + return Call(ROBOT_API_ID_LOCO_SET_ARM_TASK, parameter, data); + } + + /*High Level API Call*/ + int32_t Damp() { return SetFsmId(1); } + + int32_t Start() { return SetFsmId(204); } + + int32_t StandUp() { return SetFsmId(2); } + + int32_t ZeroTorque() { return SetFsmId(0); } + + int32_t StopMove() { return SetVelocity(0.f, 0.f, 0.f); } + + int32_t HighStand() { return SetStandHeight(std::numeric_limits::max()); } + + int32_t LowStand() { return SetStandHeight(std::numeric_limits::min()); } + + int32_t Move(float vx, float vy, float vyaw, bool continous_move) { + return SetVelocity(vx, vy, vyaw, continous_move ? 864000.f : 1.f); + } + + int32_t Move(float vx, float vy, float vyaw) { return Move(vx, vy, vyaw, continous_move_); } + + int32_t BalanceStand() { return SetBalanceMode(0); } + + int32_t ContinuousGait(bool flag) { return SetBalanceMode(flag ? 1 : 0); } + + int32_t SwitchMoveMode(bool flag) { + continous_move_ = flag; + return 0; + } + + int32_t SetNextFoot(bool foot) { + return SetPhase(foot ? std::vector({0.f, 1.f}) : std::vector({1.f, 0.f})); + } + + int32_t WaveHand() { return SetTaskId(0); } + + int32_t ShakeHand(int stage = -1) { + switch (stage) { + case 0: + first_shake_hand_stage_ = false; + return SetTaskId(1); + + case 1: + first_shake_hand_stage_ = true; + return SetTaskId(2); + + default: + first_shake_hand_stage_ = !first_shake_hand_stage_; + return SetTaskId(first_shake_hand_stage_ ? 2 : 1); + } + } + + private: + bool continous_move_ = false; + bool first_shake_hand_stage_ = true; +}; +} // namespace h1 + +} // namespace robot +} // namespace unitree +#endif // __UT_ROBOT_H1_LOCO_CLIENT_HPP__ diff --git a/unitree_SDK/include/unitree/robot/h1/loco/h1_loco_error.hpp b/unitree_SDK/include/unitree/robot/h1/loco/h1_loco_error.hpp new file mode 100644 index 0000000..cf831e6 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/h1/loco/h1_loco_error.hpp @@ -0,0 +1,17 @@ +#ifndef __UT_ROBOT_H1_LOCO_ERROR_HPP__ +#define __UT_ROBOT_H1_LOCO_ERROR_HPP__ + +#include + +namespace unitree { +namespace robot { +namespace h1 { +UT_DECL_ERR(UT_ROBOT_LOCO_ERR_LOCOSTATE_NOT_AVAILABLE, 8301, "LocoState not available.") +UT_DECL_ERR(UT_ROBOT_LOCO_ERR_INVALID_FSM_ID, 8302, "Invalid fsm id.") +UT_DECL_ERR(UT_ROBOT_LOCO_ERR_ODOMSTATE_NOT_AVAILABLE, 8303, "OdomState not available.") +UT_DECL_ERR(UT_ROBOT_LOCO_ERR_INVALID_TASK_ID, 8304, "Invalid task id.") +} // namespace h1 +} // namespace robot +} // namespace unitree + +#endif // __UT_ROBOT_H1_LOCO_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/internal/internal.hpp b/unitree_SDK/include/unitree/robot/internal/internal.hpp new file mode 100644 index 0000000..e96dd94 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal.hpp @@ -0,0 +1,17 @@ +#ifndef __UT_ROBOT_SDK_INERNAL_HPP__ +#define __UT_ROBOT_SDK_INERNAL_HPP__ + +#include +#include +#include + +namespace unitree +{ +namespace robot +{ +using RequestPtr = std::shared_ptr; +using ResponsePtr = std::shared_ptr; +} +} + +#endif//__UT_ROBOT_SDK_INERNAL_HPP__ diff --git a/unitree_SDK/include/unitree/robot/internal/internal_api.hpp b/unitree_SDK/include/unitree/robot/internal/internal_api.hpp new file mode 100644 index 0000000..2d8da53 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal_api.hpp @@ -0,0 +1,120 @@ +#ifndef __UT_ROBOT_SDK_INERNAL_API_HPP__ +#define __UT_ROBOT_SDK_INERNAL_API_HPP__ + +#include +#include + +namespace unitree +{ +namespace robot +{ +/* + * @brief max internal api id + * @value: 100 + */ +const int32_t ROBOT_INTERNAL_API_ID_MAX = 100; + +/////////////////////////////////////////////////////////////// +/* + * @brief invailed api id + * @value: -1 + */ +const int32_t ROBOT_API_ID_NONE = -1; + +/* + * @brief Get api version from server. + * @value: 1 + */ +const int32_t ROBOT_API_ID_INTERNAL_API_VERSION = 1; + +/* + * @brief Noop. + * @value: 2 + */ +const int32_t ROBOT_API_ID_INTERNAL_API_NOOP = 2; + +/* + * @brief Apply lease from server. + * @value: 101 + */ +const int32_t ROBOT_API_ID_LEASE_APPLY = 101; +/* + * @brief Renewal lease term from server. + * @value: 102 + */ +const int32_t ROBOT_API_ID_LEASE_RENEWAL = 102; + +/////////////////////////////////////////////////////////////// + +/* + * @biref robot lease term default. + * @value: default 1000000 us + */ +const int32_t ROBOT_LEASE_TERM = 1000000; + +/* + * micro: IS_INTERNAL_API + */ +#define IS_INTERNAL_API(apiId) ((apiId) <= ROBOT_MAX_INTERNAL_API_ID) + +/////////////////////////////////////////////////////////////// + +/* + * @brief Input parameter type for ROBOT_API_ID_INTERNAL_APPLY_LEASE + * @class: ApplyLeaseParameter + */ +class ApplyLeaseParameter : public common::Jsonize +{ +public: + ApplyLeaseParameter() + {} + + ~ApplyLeaseParameter() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["name"], name); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(name, json["name"]); + } + +public: + std::string name; +}; + +/* + * @brief Output data type for ROBOT_API_ID_INTERNAL_APPLY_LEASE + * @class: ApplyLeaseData + */ +class ApplyLeaseData : public common::Jsonize +{ +public: + ApplyLeaseData() : id(0),term(0) + {} + + ~ApplyLeaseData() + {} + + void fromJson(common::JsonMap& json) + { + common::FromJson(json["id"], id); + common::FromJson(json["term"], term); + } + + void toJson(common::JsonMap& json) const + { + common::ToJson(id, json["id"]); + common::ToJson(term, json["term"]); + } + +public: + int64_t id; + int64_t term; +}; +} +} +#endif//__UT_ROBOT_SDK_INERNAL_API_HPP__ diff --git a/unitree_SDK/include/unitree/robot/internal/internal_error.hpp b/unitree_SDK/include/unitree/robot/internal/internal_error.hpp new file mode 100644 index 0000000..94b11a8 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal_error.hpp @@ -0,0 +1,29 @@ +#ifndef __UT_ROBOT_INTERNAL_ERROR_HPP__ +#define __UT_ROBOT_INTERNAL_ERROR_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +UT_DECL_ERR(UT_ROBOT_OK, 0, "Success.") +UT_DECL_ERR(UT_ROBOT_ERR_UNKNOWN, 3001, "Unknown error.") +UT_DECL_ERR(UT_ROBOT_ERR_CLIENT_SEND, 3102, "Send request error.") +UT_DECL_ERR(UT_ROBOT_ERR_CLIENT_API_NOT_REG, 3103, "Api is not registed.") +UT_DECL_ERR(UT_ROBOT_ERR_CLIENT_API_TIMEOUT, 3104, "Call api timeout error.") +UT_DECL_ERR(UT_ROBOT_ERR_CLIENT_API_NOT_MATCH, 3105, "Response api not match error.") +UT_DECL_ERR(UT_ROBOT_ERR_CLIENT_API_DATA, 3106, "Response data error.") +UT_DECL_ERR(UT_ROBOT_ERR_CLIENT_LEASE_INVALID, 3107, "Lease is invalid.") + +UT_DECL_ERR(UT_ROBOT_ERR_SERVER_SEND, 3201, "Send response error.") +UT_DECL_ERR(UT_ROBOT_ERR_SERVER_INTERNAL, 3202, "Server internal error.") +UT_DECL_ERR(UT_ROBOT_ERR_SERVER_API_NOT_IMPL, 3203, "Api not implement error.") +UT_DECL_ERR(UT_ROBOT_ERR_SERVER_API_PARAMETER, 3204, "Api parameter error.") +UT_DECL_ERR(UT_ROBOT_ERR_SERVER_LEASE_DENIED, 3205, "Request denied by lease.") +UT_DECL_ERR(UT_ROBOT_ERR_SERVER_LEASE_NOT_EXIST, 3206, "Lease not exist in server cache.") +UT_DECL_ERR(UT_ROBOT_ERR_SERVER_LEASE_EXIST, 3207, "Lease is already exist in server cache.") +} +} + +#endif//__UT_ROBOT_INTERNAL_ERROR_HPP__ diff --git a/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestHeader_.hpp b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestHeader_.hpp new file mode 100644 index 0000000..37fb2c1 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestHeader_.hpp @@ -0,0 +1,408 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: RequestHeader_.idl + Source: RequestHeader_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_REQUESTHEADER__HPP +#define DDSCXX_REQUESTHEADER__HPP + +#include "RequestIdentity_.hpp" + +#include "RequestLease_.hpp" + +#include "RequestPolicy_.hpp" + + +namespace unitree_api +{ +namespace msg +{ +namespace dds_ +{ +class RequestHeader_ +{ +private: + ::unitree_api::msg::dds_::RequestIdentity_ identity_; + ::unitree_api::msg::dds_::RequestLease_ lease_; + ::unitree_api::msg::dds_::RequestPolicy_ policy_; + +public: + RequestHeader_() = default; + + explicit RequestHeader_( + const ::unitree_api::msg::dds_::RequestIdentity_& identity, + const ::unitree_api::msg::dds_::RequestLease_& lease, + const ::unitree_api::msg::dds_::RequestPolicy_& policy) : + identity_(identity), + lease_(lease), + policy_(policy) { } + + const ::unitree_api::msg::dds_::RequestIdentity_& identity() const { return this->identity_; } + ::unitree_api::msg::dds_::RequestIdentity_& identity() { return this->identity_; } + void identity(const ::unitree_api::msg::dds_::RequestIdentity_& _val_) { this->identity_ = _val_; } + void identity(::unitree_api::msg::dds_::RequestIdentity_&& _val_) { this->identity_ = _val_; } + const ::unitree_api::msg::dds_::RequestLease_& lease() const { return this->lease_; } + ::unitree_api::msg::dds_::RequestLease_& lease() { return this->lease_; } + void lease(const ::unitree_api::msg::dds_::RequestLease_& _val_) { this->lease_ = _val_; } + void lease(::unitree_api::msg::dds_::RequestLease_&& _val_) { this->lease_ = _val_; } + const ::unitree_api::msg::dds_::RequestPolicy_& policy() const { return this->policy_; } + ::unitree_api::msg::dds_::RequestPolicy_& policy() { return this->policy_; } + void policy(const ::unitree_api::msg::dds_::RequestPolicy_& _val_) { this->policy_ = _val_; } + void policy(::unitree_api::msg::dds_::RequestPolicy_&& _val_) { this->policy_ = _val_; } + + bool operator==(const RequestHeader_& _other) const + { + (void) _other; + return identity_ == _other.identity_ && + lease_ == _other.lease_ && + policy_ == _other.policy_; + } + + bool operator!=(const RequestHeader_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_api::msg::dds_::RequestHeader_>::getTypeName() +{ + return "unitree_api::msg::dds_::RequestHeader_"; +} + +template <> constexpr bool TopicTraits<::unitree_api::msg::dds_::RequestHeader_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::RequestHeader_>::type_map_blob_sz() { return 1064; } +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::RequestHeader_>::type_info_blob_sz() { return 244; } +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::RequestHeader_>::type_map_blob() { + static const uint8_t blob[] = { + 0x4f, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf1, 0xfd, 0xdd, 0x30, 0x0e, 0xc6, 0xac, 0x5e, + 0x7a, 0x4b, 0xda, 0xf7, 0xa4, 0xdc, 0xc7, 0x00, 0x71, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, + 0x0b, 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0xff, 0x48, 0x3d, 0x1f, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xe7, 0xaa, 0x98, 0x61, 0xf7, + 0xb0, 0x22, 0x20, 0x9b, 0xda, 0x6c, 0x89, 0x3f, 0xca, 0x1a, 0xdc, 0x13, 0xcf, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x76, 0x57, 0x81, 0x5a, 0xa1, + 0x5f, 0x25, 0x32, 0xc9, 0x00, 0x8d, 0x48, 0x4d, 0x4f, 0xf4, 0xaf, 0x8b, 0x57, 0xf1, 0x8f, 0x78, + 0x20, 0x91, 0xd8, 0x0b, 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0x33, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xb8, + 0x0b, 0xb7, 0x74, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xd3, + 0x3a, 0xff, 0x5d, 0xf1, 0xe7, 0xaa, 0x98, 0x61, 0xf7, 0xb0, 0x22, 0x20, 0x9b, 0xda, 0x6c, 0x89, + 0x3f, 0xca, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xb8, 0x0b, 0xb7, 0x74, 0xf1, 0x76, 0x57, 0x81, 0x5a, + 0xa1, 0x5f, 0x25, 0x32, 0xc9, 0x00, 0x8d, 0x48, 0x4d, 0x4f, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0xb9, + 0x88, 0x29, 0x5c, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x14, + 0x70, 0x9c, 0x93, 0x00, 0x4e, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf2, 0x9b, 0x9a, 0x2d, + 0x50, 0x17, 0x56, 0xf6, 0x0f, 0x8c, 0x92, 0x41, 0xb0, 0xee, 0xdb, 0x00, 0xbd, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, + 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, + 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x0c, 0xd7, 0x3d, 0x1a, 0x1e, 0x87, 0xee, 0x27, 0x8f, + 0x84, 0xee, 0x9f, 0x41, 0xe3, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x99, + 0xe3, 0xb9, 0xf0, 0xba, 0xac, 0xdc, 0x09, 0x3a, 0x18, 0x6d, 0x89, 0x7a, 0x17, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x00, 0x00, 0x00, 0xf2, 0xf8, 0x8b, + 0x48, 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x75, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, + 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x69, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x61, 0x70, 0x69, 0x5f, + 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, 0x0c, 0xd7, 0x3d, 0x1a, 0x1e, 0x87, 0xee, 0x27, 0x8f, 0x84, + 0xee, 0x9f, 0x41, 0xe3, 0x55, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x05, 0x00, 0x03, 0x00, 0x00, 0x00, 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, 0x99, 0xe3, + 0xb9, 0xf0, 0xba, 0xac, 0xdc, 0x09, 0x3a, 0x18, 0x6d, 0x89, 0x7a, 0x17, 0x76, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, + 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6e, 0x6f, 0x72, 0x65, + 0x70, 0x6c, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xf2, 0x9b, 0x9a, 0x2d, 0x50, 0x17, 0x56, 0xf6, 0x0f, 0x8c, 0x92, 0x41, 0xb0, 0xee, 0xdb, 0xf1, + 0xfd, 0xdd, 0x30, 0x0e, 0xc6, 0xac, 0x5e, 0x7a, 0x4b, 0xda, 0xf7, 0xa4, 0xdc, 0xc7, 0xf2, 0xf8, + 0x8b, 0x48, 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0xf1, 0x8f, 0x78, + 0x20, 0x91, 0xd8, 0x0b, 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0xf2, 0x0c, 0xd7, 0x3d, + 0x1a, 0x1e, 0x87, 0xee, 0x27, 0x8f, 0x84, 0xee, 0x9f, 0x41, 0xe3, 0xf1, 0xe7, 0xaa, 0x98, 0x61, + 0xf7, 0xb0, 0x22, 0x20, 0x9b, 0xda, 0x6c, 0x89, 0x3f, 0xca, 0xf2, 0x99, 0xe3, 0xb9, 0xf0, 0xba, + 0xac, 0xdc, 0x09, 0x3a, 0x18, 0x6d, 0x89, 0x7a, 0x17, 0xf1, 0x76, 0x57, 0x81, 0x5a, 0xa1, 0x5f, + 0x25, 0x32, 0xc9, 0x00, 0x8d, 0x48, 0x4d, 0x4f, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::RequestHeader_>::type_info_blob() { + static const uint8_t blob[] = { + 0xf0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xfd, 0xdd, 0x30, 0x0e, 0xc6, 0xac, 0x5e, 0x7a, 0x4b, 0xda, 0xf7, + 0xa4, 0xdc, 0xc7, 0x00, 0x75, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, 0x89, + 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0x00, 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0xe7, 0xaa, 0x98, 0x61, 0xf7, 0xb0, 0x22, 0x20, 0x9b, 0xda, 0x6c, 0x89, 0x3f, 0xca, 0x00, + 0x27, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x76, 0x57, 0x81, 0x5a, 0xa1, 0x5f, 0x25, + 0x32, 0xc9, 0x00, 0x8d, 0x48, 0x4d, 0x4f, 0x00, 0x37, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x9b, 0x9a, 0x2d, + 0x50, 0x17, 0x56, 0xf6, 0x0f, 0x8c, 0x92, 0x41, 0xb0, 0xee, 0xdb, 0x00, 0xc1, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x0c, 0xd7, 0x3d, 0x1a, 0x1e, 0x87, 0xee, + 0x27, 0x8f, 0x84, 0xee, 0x9f, 0x41, 0xe3, 0x00, 0x59, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x99, 0xe3, 0xb9, 0xf0, 0xba, 0xac, 0xdc, 0x09, 0x3a, 0x18, 0x6d, 0x89, 0x7a, 0x17, 0x00, + 0x7a, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_api::msg::dds_::RequestHeader_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_api::msg::dds_::RequestHeader_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_api::msg::dds_::RequestHeader_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_api::msg::dds_::RequestHeader_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_api::msg::dds_::RequestHeader_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.identity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.lease(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.policy(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_api::msg::dds_::RequestHeader_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestHeader_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_api::msg::dds_::RequestHeader_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.identity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.lease(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.policy(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_api::msg::dds_::RequestHeader_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestHeader_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_api::msg::dds_::RequestHeader_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.identity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.lease(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.policy(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_api::msg::dds_::RequestHeader_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestHeader_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_api::msg::dds_::RequestHeader_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.identity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.lease(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.policy(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_api::msg::dds_::RequestHeader_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestHeader_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_REQUESTHEADER__HPP diff --git a/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestIdentity_.hpp b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestIdentity_.hpp new file mode 100644 index 0000000..2a80413 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestIdentity_.hpp @@ -0,0 +1,302 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: RequestIdentity_.idl + Source: RequestIdentity_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_REQUESTIDENTITY__HPP +#define DDSCXX_REQUESTIDENTITY__HPP + +#include + +namespace unitree_api +{ +namespace msg +{ +namespace dds_ +{ +class RequestIdentity_ +{ +private: + int64_t id_ = 0; + int64_t api_id_ = 0; + +public: + RequestIdentity_() = default; + + explicit RequestIdentity_( + int64_t id, + int64_t api_id) : + id_(id), + api_id_(api_id) { } + + int64_t id() const { return this->id_; } + int64_t& id() { return this->id_; } + void id(int64_t _val_) { this->id_ = _val_; } + int64_t api_id() const { return this->api_id_; } + int64_t& api_id() { return this->api_id_; } + void api_id(int64_t _val_) { this->api_id_ = _val_; } + + bool operator==(const RequestIdentity_& _other) const + { + (void) _other; + return id_ == _other.id_ && + api_id_ == _other.api_id_; + } + + bool operator!=(const RequestIdentity_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_api::msg::dds_::RequestIdentity_>::getTypeName() +{ + return "unitree_api::msg::dds_::RequestIdentity_"; +} + +template <> constexpr bool TopicTraits<::unitree_api::msg::dds_::RequestIdentity_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::RequestIdentity_>::type_map_blob_sz() { return 266; } +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::RequestIdentity_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::RequestIdentity_>::type_map_blob() { + static const uint8_t blob[] = { + 0x4b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, 0x89, + 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xb8, 0x0b, 0xb7, 0x74, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xd3, 0x3a, 0xff, 0x5d, 0x00, + 0x8d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, 0xcf, 0x5a, + 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x00, 0x75, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, + 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x69, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x61, 0x70, 0x69, 0x5f, 0x69, 0x64, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0xf8, 0x8b, 0x48, + 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0xf1, 0x8f, 0x78, 0x20, 0x91, + 0xd8, 0x0b, 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::RequestIdentity_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, 0x89, 0x0d, 0xad, 0xf3, 0xe7, + 0xd6, 0x60, 0xe6, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, + 0x3c, 0xdd, 0x22, 0x00, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_api::msg::dds_::RequestIdentity_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_api::msg::dds_::RequestIdentity_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_api::msg::dds_::RequestIdentity_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_api::msg::dds_::RequestIdentity_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_api::msg::dds_::RequestIdentity_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.api_id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_api::msg::dds_::RequestIdentity_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestIdentity_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_api::msg::dds_::RequestIdentity_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.api_id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_api::msg::dds_::RequestIdentity_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestIdentity_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_api::msg::dds_::RequestIdentity_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.api_id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_api::msg::dds_::RequestIdentity_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestIdentity_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_api::msg::dds_::RequestIdentity_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.api_id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_api::msg::dds_::RequestIdentity_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestIdentity_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_REQUESTIDENTITY__HPP diff --git a/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestLease_.hpp b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestLease_.hpp new file mode 100644 index 0000000..c62ebde --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestLease_.hpp @@ -0,0 +1,260 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: RequestLease_.idl + Source: RequestLease_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_REQUESTLEASE__HPP +#define DDSCXX_REQUESTLEASE__HPP + +#include + +namespace unitree_api +{ +namespace msg +{ +namespace dds_ +{ +class RequestLease_ +{ +private: + int64_t id_ = 0; + +public: + RequestLease_() = default; + + explicit RequestLease_( + int64_t id) : + id_(id) { } + + int64_t id() const { return this->id_; } + int64_t& id() { return this->id_; } + void id(int64_t _val_) { this->id_ = _val_; } + + bool operator==(const RequestLease_& _other) const + { + (void) _other; + return id_ == _other.id_; + } + + bool operator!=(const RequestLease_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_api::msg::dds_::RequestLease_>::getTypeName() +{ + return "unitree_api::msg::dds_::RequestLease_"; +} + +template <> constexpr bool TopicTraits<::unitree_api::msg::dds_::RequestLease_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::RequestLease_>::type_map_blob_sz() { return 218; } +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::RequestLease_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::RequestLease_>::type_map_blob() { + static const uint8_t blob[] = { + 0x3b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0xe7, 0xaa, 0x98, 0x61, 0xf7, 0xb0, 0x22, + 0x20, 0x9b, 0xda, 0x6c, 0x89, 0x3f, 0xca, 0x00, 0x23, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xb8, 0x0b, 0xb7, 0x74, 0x00, + 0x6d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x0c, 0xd7, 0x3d, 0x1a, 0x1e, 0x87, 0xee, + 0x27, 0x8f, 0x84, 0xee, 0x9f, 0x41, 0xe3, 0x00, 0x55, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, + 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4c, 0x65, 0x61, 0x73, 0x65, + 0x5f, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, 0x03, 0x00, 0x00, 0x00, 0x69, 0x64, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x0c, 0xd7, 0x3d, + 0x1a, 0x1e, 0x87, 0xee, 0x27, 0x8f, 0x84, 0xee, 0x9f, 0x41, 0xe3, 0xf1, 0xe7, 0xaa, 0x98, 0x61, + 0xf7, 0xb0, 0x22, 0x20, 0x9b, 0xda, 0x6c, 0x89, 0x3f, 0xca, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::RequestLease_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xe7, 0xaa, 0x98, 0x61, 0xf7, 0xb0, 0x22, 0x20, 0x9b, 0xda, 0x6c, + 0x89, 0x3f, 0xca, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x0c, 0xd7, 0x3d, 0x1a, 0x1e, 0x87, 0xee, 0x27, 0x8f, 0x84, 0xee, + 0x9f, 0x41, 0xe3, 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_api::msg::dds_::RequestLease_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_api::msg::dds_::RequestLease_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_api::msg::dds_::RequestLease_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_api::msg::dds_::RequestLease_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_api::msg::dds_::RequestLease_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_api::msg::dds_::RequestLease_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestLease_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_api::msg::dds_::RequestLease_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_api::msg::dds_::RequestLease_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestLease_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_api::msg::dds_::RequestLease_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_api::msg::dds_::RequestLease_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestLease_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_api::msg::dds_::RequestLease_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.id())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_api::msg::dds_::RequestLease_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestLease_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_REQUESTLEASE__HPP diff --git a/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestPolicy_.hpp b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestPolicy_.hpp new file mode 100644 index 0000000..7c09e25 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/RequestPolicy_.hpp @@ -0,0 +1,302 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: RequestPolicy_.idl + Source: RequestPolicy_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_REQUESTPOLICY__HPP +#define DDSCXX_REQUESTPOLICY__HPP + +#include + +namespace unitree_api +{ +namespace msg +{ +namespace dds_ +{ +class RequestPolicy_ +{ +private: + int32_t priority_ = 0; + bool noreply_ = false; + +public: + RequestPolicy_() = default; + + explicit RequestPolicy_( + int32_t priority, + bool noreply) : + priority_(priority), + noreply_(noreply) { } + + int32_t priority() const { return this->priority_; } + int32_t& priority() { return this->priority_; } + void priority(int32_t _val_) { this->priority_ = _val_; } + bool noreply() const { return this->noreply_; } + bool& noreply() { return this->noreply_; } + void noreply(bool _val_) { this->noreply_ = _val_; } + + bool operator==(const RequestPolicy_& _other) const + { + (void) _other; + return priority_ == _other.priority_ && + noreply_ == _other.noreply_; + } + + bool operator!=(const RequestPolicy_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_api::msg::dds_::RequestPolicy_>::getTypeName() +{ + return "unitree_api::msg::dds_::RequestPolicy_"; +} + +template <> constexpr bool TopicTraits<::unitree_api::msg::dds_::RequestPolicy_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::RequestPolicy_>::type_map_blob_sz() { return 266; } +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::RequestPolicy_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::RequestPolicy_>::type_map_blob() { + static const uint8_t blob[] = { + 0x4b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x76, 0x57, 0x81, 0x5a, 0xa1, 0x5f, 0x25, + 0x32, 0xc9, 0x00, 0x8d, 0x48, 0x4d, 0x4f, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0xb9, 0x88, 0x29, 0x5c, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x14, 0x70, 0x9c, 0x93, 0x00, + 0x8e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x99, 0xe3, 0xb9, 0xf0, 0xba, 0xac, 0xdc, + 0x09, 0x3a, 0x18, 0x6d, 0x89, 0x7a, 0x17, 0x00, 0x76, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, + 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, + 0x79, 0x5f, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, 0x70, 0x72, 0x69, 0x6f, + 0x72, 0x69, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6e, 0x6f, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x99, 0xe3, 0xb9, + 0xf0, 0xba, 0xac, 0xdc, 0x09, 0x3a, 0x18, 0x6d, 0x89, 0x7a, 0x17, 0xf1, 0x76, 0x57, 0x81, 0x5a, + 0xa1, 0x5f, 0x25, 0x32, 0xc9, 0x00, 0x8d, 0x48, 0x4d, 0x4f, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::RequestPolicy_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x76, 0x57, 0x81, 0x5a, 0xa1, 0x5f, 0x25, 0x32, 0xc9, 0x00, 0x8d, + 0x48, 0x4d, 0x4f, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x99, 0xe3, 0xb9, 0xf0, 0xba, 0xac, 0xdc, 0x09, 0x3a, 0x18, 0x6d, + 0x89, 0x7a, 0x17, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_api::msg::dds_::RequestPolicy_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_api::msg::dds_::RequestPolicy_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_api::msg::dds_::RequestPolicy_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_api::msg::dds_::RequestPolicy_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_api::msg::dds_::RequestPolicy_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.priority())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.noreply())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_api::msg::dds_::RequestPolicy_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestPolicy_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_api::msg::dds_::RequestPolicy_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.priority())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.noreply())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_api::msg::dds_::RequestPolicy_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestPolicy_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_api::msg::dds_::RequestPolicy_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.priority())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.noreply())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_api::msg::dds_::RequestPolicy_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestPolicy_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_api::msg::dds_::RequestPolicy_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.priority())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.noreply())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_api::msg::dds_::RequestPolicy_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::RequestPolicy_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_REQUESTPOLICY__HPP diff --git a/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/Request_.hpp b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/Request_.hpp new file mode 100644 index 0000000..7b9b2f0 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/Request_.hpp @@ -0,0 +1,477 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Request_.idl + Source: Request_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_REQUEST__HPP +#define DDSCXX_REQUEST__HPP + +#include "RequestHeader_.hpp" + +#include +#include +#include + +namespace unitree_api +{ +namespace msg +{ +namespace dds_ +{ +class Request_ +{ +private: + ::unitree_api::msg::dds_::RequestHeader_ header_; + std::string parameter_; + std::vector binary_; + +public: + Request_() = default; + + explicit Request_( + const ::unitree_api::msg::dds_::RequestHeader_& header, + const std::string& parameter, + const std::vector& binary) : + header_(header), + parameter_(parameter), + binary_(binary) { } + + const ::unitree_api::msg::dds_::RequestHeader_& header() const { return this->header_; } + ::unitree_api::msg::dds_::RequestHeader_& header() { return this->header_; } + void header(const ::unitree_api::msg::dds_::RequestHeader_& _val_) { this->header_ = _val_; } + void header(::unitree_api::msg::dds_::RequestHeader_&& _val_) { this->header_ = _val_; } + const std::string& parameter() const { return this->parameter_; } + std::string& parameter() { return this->parameter_; } + void parameter(const std::string& _val_) { this->parameter_ = _val_; } + void parameter(std::string&& _val_) { this->parameter_ = _val_; } + const std::vector& binary() const { return this->binary_; } + std::vector& binary() { return this->binary_; } + void binary(const std::vector& _val_) { this->binary_ = _val_; } + void binary(std::vector&& _val_) { this->binary_ = _val_; } + + bool operator==(const Request_& _other) const + { + (void) _other; + return header_ == _other.header_ && + parameter_ == _other.parameter_ && + binary_ == _other.binary_; + } + + bool operator!=(const Request_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_api::msg::dds_::Request_>::getTypeName() +{ + return "unitree_api::msg::dds_::Request_"; +} + +template <> constexpr bool TopicTraits<::unitree_api::msg::dds_::Request_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_api::msg::dds_::Request_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::Request_>::type_map_blob_sz() { return 1382; } +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::Request_>::type_info_blob_sz() { return 292; } +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::Request_>::type_map_blob() { + static const uint8_t blob[] = { + 0xbb, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf1, 0xcb, 0xa4, 0xdc, 0x96, 0x5d, 0x39, 0x3a, + 0xda, 0x76, 0xb4, 0xde, 0x08, 0x19, 0x25, 0x00, 0x58, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xfd, 0xdd, 0x30, 0x0e, 0xc6, + 0xac, 0x5e, 0x7a, 0x4b, 0xda, 0xf7, 0xa4, 0xdc, 0xc7, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x03, 0x14, 0x4c, 0xce, + 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, + 0x9d, 0x71, 0x83, 0xf1, 0xf1, 0xfd, 0xdd, 0x30, 0x0e, 0xc6, 0xac, 0x5e, 0x7a, 0x4b, 0xda, 0xf7, + 0xa4, 0xdc, 0xc7, 0x00, 0x71, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, 0x89, 0x0d, 0xad, + 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0xff, 0x48, 0x3d, 0x1f, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0xe7, 0xaa, 0x98, 0x61, 0xf7, 0xb0, 0x22, 0x20, 0x9b, + 0xda, 0x6c, 0x89, 0x3f, 0xca, 0x1a, 0xdc, 0x13, 0xcf, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x76, 0x57, 0x81, 0x5a, 0xa1, 0x5f, 0x25, 0x32, 0xc9, + 0x00, 0x8d, 0x48, 0x4d, 0x4f, 0xf4, 0xaf, 0x8b, 0x57, 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, + 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xb8, 0x0b, 0xb7, 0x74, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xd3, 0x3a, 0xff, 0x5d, 0xf1, + 0xe7, 0xaa, 0x98, 0x61, 0xf7, 0xb0, 0x22, 0x20, 0x9b, 0xda, 0x6c, 0x89, 0x3f, 0xca, 0x00, 0x00, + 0x23, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x05, 0xb8, 0x0b, 0xb7, 0x74, 0xf1, 0x76, 0x57, 0x81, 0x5a, 0xa1, 0x5f, 0x25, 0x32, + 0xc9, 0x00, 0x8d, 0x48, 0x4d, 0x4f, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0xb9, 0x88, 0x29, 0x5c, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x14, 0x70, 0x9c, 0x93, 0x00, + 0x02, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0xf2, 0xc4, 0x7a, 0x44, 0x29, 0xfc, 0xbf, 0x53, + 0x94, 0x86, 0x49, 0x87, 0x53, 0xc4, 0x8f, 0x00, 0xa1, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, + 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x00, 0x00, 0x00, 0x00, + 0x69, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0x9b, 0x9a, 0x2d, 0x50, 0x17, 0x56, 0xf6, 0x0f, 0x8c, 0x92, 0x41, 0xb0, 0xee, + 0xdb, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, + 0x07, 0x00, 0x00, 0x00, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x00, 0x00, 0x00, 0xf2, 0x9b, 0x9a, + 0x2d, 0x50, 0x17, 0x56, 0xf6, 0x0f, 0x8c, 0x92, 0x41, 0xb0, 0xee, 0xdb, 0xbd, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, + 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, + 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x0c, 0xd7, 0x3d, 0x1a, 0x1e, 0x87, 0xee, 0x27, 0x8f, + 0x84, 0xee, 0x9f, 0x41, 0xe3, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x6c, 0x65, 0x61, 0x73, + 0x65, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x99, + 0xe3, 0xb9, 0xf0, 0xba, 0xac, 0xdc, 0x09, 0x3a, 0x18, 0x6d, 0x89, 0x7a, 0x17, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x00, 0x00, 0x00, 0xf2, 0xf8, 0x8b, + 0x48, 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x75, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, + 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x69, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x61, 0x70, 0x69, 0x5f, + 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, 0x0c, 0xd7, 0x3d, 0x1a, 0x1e, 0x87, 0xee, 0x27, 0x8f, 0x84, + 0xee, 0x9f, 0x41, 0xe3, 0x55, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x05, 0x00, 0x03, 0x00, 0x00, 0x00, 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, 0x99, 0xe3, + 0xb9, 0xf0, 0xba, 0xac, 0xdc, 0x09, 0x3a, 0x18, 0x6d, 0x89, 0x7a, 0x17, 0x76, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, + 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x50, + 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x09, 0x00, 0x00, 0x00, + 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, 0x6e, 0x6f, 0x72, 0x65, + 0x70, 0x6c, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, + 0xf2, 0xc4, 0x7a, 0x44, 0x29, 0xfc, 0xbf, 0x53, 0x94, 0x86, 0x49, 0x87, 0x53, 0xc4, 0x8f, 0xf1, + 0xcb, 0xa4, 0xdc, 0x96, 0x5d, 0x39, 0x3a, 0xda, 0x76, 0xb4, 0xde, 0x08, 0x19, 0x25, 0xf2, 0x9b, + 0x9a, 0x2d, 0x50, 0x17, 0x56, 0xf6, 0x0f, 0x8c, 0x92, 0x41, 0xb0, 0xee, 0xdb, 0xf1, 0xfd, 0xdd, + 0x30, 0x0e, 0xc6, 0xac, 0x5e, 0x7a, 0x4b, 0xda, 0xf7, 0xa4, 0xdc, 0xc7, 0xf2, 0xf8, 0x8b, 0x48, + 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0xf1, 0x8f, 0x78, 0x20, 0x91, + 0xd8, 0x0b, 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0xf2, 0x0c, 0xd7, 0x3d, 0x1a, 0x1e, + 0x87, 0xee, 0x27, 0x8f, 0x84, 0xee, 0x9f, 0x41, 0xe3, 0xf1, 0xe7, 0xaa, 0x98, 0x61, 0xf7, 0xb0, + 0x22, 0x20, 0x9b, 0xda, 0x6c, 0x89, 0x3f, 0xca, 0xf2, 0x99, 0xe3, 0xb9, 0xf0, 0xba, 0xac, 0xdc, + 0x09, 0x3a, 0x18, 0x6d, 0x89, 0x7a, 0x17, 0xf1, 0x76, 0x57, 0x81, 0x5a, 0xa1, 0x5f, 0x25, 0x32, + 0xc9, 0x00, 0x8d, 0x48, 0x4d, 0x4f, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::Request_>::type_info_blob() { + static const uint8_t blob[] = { + 0x20, 0x01, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x88, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0xcb, 0xa4, 0xdc, 0x96, 0x5d, 0x39, 0x3a, 0xda, 0x76, 0xb4, 0xde, + 0x08, 0x19, 0x25, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xfd, 0xdd, 0x30, 0x0e, 0xc6, 0xac, 0x5e, + 0x7a, 0x4b, 0xda, 0xf7, 0xa4, 0xdc, 0xc7, 0x00, 0x75, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0xe7, 0xaa, 0x98, 0x61, 0xf7, 0xb0, 0x22, + 0x20, 0x9b, 0xda, 0x6c, 0x89, 0x3f, 0xca, 0x00, 0x27, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x76, 0x57, 0x81, 0x5a, 0xa1, 0x5f, 0x25, 0x32, 0xc9, 0x00, 0x8d, 0x48, 0x4d, 0x4f, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x88, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0xc4, 0x7a, 0x44, 0x29, 0xfc, 0xbf, 0x53, 0x94, 0x86, 0x49, 0x87, + 0x53, 0xc4, 0x8f, 0x00, 0xa5, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x9b, 0x9a, 0x2d, 0x50, 0x17, 0x56, 0xf6, + 0x0f, 0x8c, 0x92, 0x41, 0xb0, 0xee, 0xdb, 0x00, 0xc1, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x00, + 0x79, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0x0c, 0xd7, 0x3d, 0x1a, 0x1e, 0x87, 0xee, + 0x27, 0x8f, 0x84, 0xee, 0x9f, 0x41, 0xe3, 0x00, 0x59, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x99, 0xe3, 0xb9, 0xf0, 0xba, 0xac, 0xdc, 0x09, 0x3a, 0x18, 0x6d, 0x89, 0x7a, 0x17, 0x00, + 0x7a, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_api::msg::dds_::Request_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_api::msg::dds_::Request_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_api::msg::dds_::Request_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_api::msg::dds_::Request_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_api::msg::dds_::Request_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.parameter(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.binary().size()); + if (!write(streamer, se_1)) + return false; + if (se_1 > 0 && + !write(streamer, instance.binary()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_api::msg::dds_::Request_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::Request_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_api::msg::dds_::Request_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.parameter(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.binary().size()); + if (!read(streamer, se_1)) + return false; + instance.binary().resize(se_1); + if (se_1 > 0 && + !read(streamer, instance.binary()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_api::msg::dds_::Request_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::Request_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_api::msg::dds_::Request_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.parameter(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.binary().size()); + if (!move(streamer, se_1)) + return false; + if (se_1 > 0 && + !move(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_api::msg::dds_::Request_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::Request_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_api::msg::dds_::Request_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.parameter(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + if (se_1 > 0 && + !max(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_api::msg::dds_::Request_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::Request_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_REQUEST__HPP diff --git a/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/ResponseHeader_.hpp b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/ResponseHeader_.hpp new file mode 100644 index 0000000..cd19a73 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/ResponseHeader_.hpp @@ -0,0 +1,344 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: ResponseHeader_.idl + Source: ResponseHeader_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_RESPONSEHEADER__HPP +#define DDSCXX_RESPONSEHEADER__HPP + +#include "RequestIdentity_.hpp" + +#include "ResponseStatus_.hpp" + + +namespace unitree_api +{ +namespace msg +{ +namespace dds_ +{ +class ResponseHeader_ +{ +private: + ::unitree_api::msg::dds_::RequestIdentity_ identity_; + ::unitree_api::msg::dds_::ResponseStatus_ status_; + +public: + ResponseHeader_() = default; + + explicit ResponseHeader_( + const ::unitree_api::msg::dds_::RequestIdentity_& identity, + const ::unitree_api::msg::dds_::ResponseStatus_& status) : + identity_(identity), + status_(status) { } + + const ::unitree_api::msg::dds_::RequestIdentity_& identity() const { return this->identity_; } + ::unitree_api::msg::dds_::RequestIdentity_& identity() { return this->identity_; } + void identity(const ::unitree_api::msg::dds_::RequestIdentity_& _val_) { this->identity_ = _val_; } + void identity(::unitree_api::msg::dds_::RequestIdentity_&& _val_) { this->identity_ = _val_; } + const ::unitree_api::msg::dds_::ResponseStatus_& status() const { return this->status_; } + ::unitree_api::msg::dds_::ResponseStatus_& status() { return this->status_; } + void status(const ::unitree_api::msg::dds_::ResponseStatus_& _val_) { this->status_ = _val_; } + void status(::unitree_api::msg::dds_::ResponseStatus_&& _val_) { this->status_ = _val_; } + + bool operator==(const ResponseHeader_& _other) const + { + (void) _other; + return identity_ == _other.identity_ && + status_ == _other.status_; + } + + bool operator!=(const ResponseHeader_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_api::msg::dds_::ResponseHeader_>::getTypeName() +{ + return "unitree_api::msg::dds_::ResponseHeader_"; +} + +template <> constexpr bool TopicTraits<::unitree_api::msg::dds_::ResponseHeader_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::ResponseHeader_>::type_map_blob_sz() { return 754; } +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::ResponseHeader_>::type_info_blob_sz() { return 196; } +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::ResponseHeader_>::type_map_blob() { + static const uint8_t blob[] = { + 0xe7, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf1, 0x9c, 0x43, 0xe5, 0x09, 0xd9, 0x26, 0x2e, + 0x25, 0xe7, 0x3c, 0x21, 0xef, 0xbf, 0xee, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, + 0x0b, 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0xff, 0x48, 0x3d, 0x1f, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5b, 0x67, 0x75, 0x71, 0x30, + 0x34, 0xdf, 0x53, 0x23, 0x66, 0x5f, 0xf9, 0x73, 0x40, 0x9a, 0xcb, 0x44, 0x54, 0xf1, 0x8f, 0x78, + 0x20, 0x91, 0xd8, 0x0b, 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0x33, 0x00, 0x00, 0x00, + 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xb8, + 0x0b, 0xb7, 0x74, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xd3, + 0x3a, 0xff, 0x5d, 0xf1, 0x5b, 0x67, 0x75, 0x71, 0x30, 0x34, 0xdf, 0x53, 0x23, 0x66, 0x5f, 0xf9, + 0x73, 0x40, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0xc1, 0x33, 0x67, 0x94, 0x00, 0x9f, 0x01, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0xf2, 0x0f, 0x90, 0xcc, 0xa0, 0xee, 0x3b, 0x25, 0x7f, 0xf8, 0x91, 0x0c, + 0x07, 0xeb, 0x3e, 0x00, 0x95, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x00, + 0x59, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, + 0x22, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x1a, + 0x4c, 0x7d, 0xe4, 0xfc, 0x64, 0xee, 0x04, 0x5d, 0x30, 0x0c, 0xff, 0x55, 0xda, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x00, 0x00, 0x00, 0xf2, 0xf8, 0x8b, + 0x48, 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x75, 0x00, 0x00, 0x00, + 0xf2, 0x51, 0x01, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, + 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, + 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, + 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x69, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x61, 0x70, 0x69, 0x5f, + 0x69, 0x64, 0x00, 0x00, 0x00, 0xf2, 0x1a, 0x4c, 0x7d, 0xe4, 0xfc, 0x64, 0xee, 0x04, 0x5d, 0x30, + 0x0c, 0xff, 0x55, 0xda, 0x57, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x30, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, + 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x00, + 0x1b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x04, 0x00, 0x05, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, + 0x5e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xf2, 0x0f, 0x90, 0xcc, 0xa0, 0xee, 0x3b, 0x25, + 0x7f, 0xf8, 0x91, 0x0c, 0x07, 0xeb, 0x3e, 0xf1, 0x9c, 0x43, 0xe5, 0x09, 0xd9, 0x26, 0x2e, 0x25, + 0xe7, 0x3c, 0x21, 0xef, 0xbf, 0xee, 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, + 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, 0x89, 0x0d, 0xad, 0xf3, + 0xe7, 0xd6, 0x60, 0xe6, 0xf2, 0x1a, 0x4c, 0x7d, 0xe4, 0xfc, 0x64, 0xee, 0x04, 0x5d, 0x30, 0x0c, + 0xff, 0x55, 0xda, 0xf1, 0x5b, 0x67, 0x75, 0x71, 0x30, 0x34, 0xdf, 0x53, 0x23, 0x66, 0x5f, 0xf9, + 0x73, 0x40, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::ResponseHeader_>::type_info_blob() { + static const uint8_t blob[] = { + 0xc0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x9c, 0x43, 0xe5, 0x09, 0xd9, 0x26, 0x2e, 0x25, 0xe7, 0x3c, 0x21, + 0xef, 0xbf, 0xee, 0x00, 0x55, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, 0x89, + 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0x00, 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x5b, 0x67, 0x75, 0x71, 0x30, 0x34, 0xdf, 0x53, 0x23, 0x66, 0x5f, 0xf9, 0x73, 0x40, 0x00, + 0x27, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x58, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x0f, 0x90, 0xcc, 0xa0, 0xee, 0x3b, 0x25, 0x7f, 0xf8, 0x91, 0x0c, + 0x07, 0xeb, 0x3e, 0x00, 0x99, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, 0xcf, 0x5a, + 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x00, 0x79, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x1a, 0x4c, 0x7d, 0xe4, 0xfc, 0x64, 0xee, 0x04, 0x5d, 0x30, 0x0c, 0xff, 0x55, 0xda, 0x00, + 0x5b, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_api::msg::dds_::ResponseHeader_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_api::msg::dds_::ResponseHeader_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_api::msg::dds_::ResponseHeader_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_api::msg::dds_::ResponseHeader_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_api::msg::dds_::ResponseHeader_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.identity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.status(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_api::msg::dds_::ResponseHeader_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::ResponseHeader_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_api::msg::dds_::ResponseHeader_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.identity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.status(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_api::msg::dds_::ResponseHeader_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::ResponseHeader_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_api::msg::dds_::ResponseHeader_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.identity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.status(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_api::msg::dds_::ResponseHeader_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::ResponseHeader_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_api::msg::dds_::ResponseHeader_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.identity(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.status(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_api::msg::dds_::ResponseHeader_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::ResponseHeader_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_RESPONSEHEADER__HPP diff --git a/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/ResponseStatus_.hpp b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/ResponseStatus_.hpp new file mode 100644 index 0000000..b83a26c --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/ResponseStatus_.hpp @@ -0,0 +1,260 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: ResponseStatus_.idl + Source: ResponseStatus_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_RESPONSESTATUS__HPP +#define DDSCXX_RESPONSESTATUS__HPP + +#include + +namespace unitree_api +{ +namespace msg +{ +namespace dds_ +{ +class ResponseStatus_ +{ +private: + int32_t code_ = 0; + +public: + ResponseStatus_() = default; + + explicit ResponseStatus_( + int32_t code) : + code_(code) { } + + int32_t code() const { return this->code_; } + int32_t& code() { return this->code_; } + void code(int32_t _val_) { this->code_ = _val_; } + + bool operator==(const ResponseStatus_& _other) const + { + (void) _other; + return code_ == _other.code_; + } + + bool operator!=(const ResponseStatus_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_api::msg::dds_::ResponseStatus_>::getTypeName() +{ + return "unitree_api::msg::dds_::ResponseStatus_"; +} + +template <> constexpr bool TopicTraits<::unitree_api::msg::dds_::ResponseStatus_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::ResponseStatus_>::type_map_blob_sz() { return 218; } +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::ResponseStatus_>::type_info_blob_sz() { return 100; } +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::ResponseStatus_>::type_map_blob() { + static const uint8_t blob[] = { + 0x3b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf1, 0x5b, 0x67, 0x75, 0x71, 0x30, 0x34, 0xdf, + 0x53, 0x23, 0x66, 0x5f, 0xf9, 0x73, 0x40, 0x00, 0x23, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0xc1, 0x33, 0x67, 0x94, 0x00, + 0x6f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x1a, 0x4c, 0x7d, 0xe4, 0xfc, 0x64, 0xee, + 0x04, 0x5d, 0x30, 0x0c, 0xff, 0x55, 0xda, 0x00, 0x57, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, + 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x5f, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x05, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x64, 0x65, + 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x1a, 0x4c, 0x7d, + 0xe4, 0xfc, 0x64, 0xee, 0x04, 0x5d, 0x30, 0x0c, 0xff, 0x55, 0xda, 0xf1, 0x5b, 0x67, 0x75, 0x71, + 0x30, 0x34, 0xdf, 0x53, 0x23, 0x66, 0x5f, 0xf9, 0x73, 0x40, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::ResponseStatus_>::type_info_blob() { + static const uint8_t blob[] = { + 0x60, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5b, 0x67, 0x75, 0x71, 0x30, 0x34, 0xdf, 0x53, 0x23, 0x66, 0x5f, + 0xf9, 0x73, 0x40, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf2, 0x1a, 0x4c, 0x7d, 0xe4, 0xfc, 0x64, 0xee, 0x04, 0x5d, 0x30, 0x0c, + 0xff, 0x55, 0xda, 0x00, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_api::msg::dds_::ResponseStatus_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_api::msg::dds_::ResponseStatus_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_api::msg::dds_::ResponseStatus_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_api::msg::dds_::ResponseStatus_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_api::msg::dds_::ResponseStatus_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.code())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_api::msg::dds_::ResponseStatus_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::ResponseStatus_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_api::msg::dds_::ResponseStatus_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.code())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_api::msg::dds_::ResponseStatus_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::ResponseStatus_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_api::msg::dds_::ResponseStatus_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.code())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_api::msg::dds_::ResponseStatus_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::ResponseStatus_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_api::msg::dds_::ResponseStatus_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.code())) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_api::msg::dds_::ResponseStatus_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::ResponseStatus_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_RESPONSESTATUS__HPP diff --git a/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/Response_.hpp b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/Response_.hpp new file mode 100644 index 0000000..8fac7ae --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal_idl_decl/Response_.hpp @@ -0,0 +1,454 @@ +/**************************************************************** + + Generated by Eclipse Cyclone DDS IDL to CXX Translator + File name: Response_.idl + Source: Response_.hpp + Cyclone DDS: v0.10.2 + +*****************************************************************/ +#ifndef DDSCXX_RESPONSE__HPP +#define DDSCXX_RESPONSE__HPP + +#include "ResponseHeader_.hpp" + +#include +#include +#include + +namespace unitree_api +{ +namespace msg +{ +namespace dds_ +{ +class Response_ +{ +private: + ::unitree_api::msg::dds_::ResponseHeader_ header_; + std::string data_; + std::vector binary_; + +public: + Response_() = default; + + explicit Response_( + const ::unitree_api::msg::dds_::ResponseHeader_& header, + const std::string& data, + const std::vector& binary) : + header_(header), + data_(data), + binary_(binary) { } + + const ::unitree_api::msg::dds_::ResponseHeader_& header() const { return this->header_; } + ::unitree_api::msg::dds_::ResponseHeader_& header() { return this->header_; } + void header(const ::unitree_api::msg::dds_::ResponseHeader_& _val_) { this->header_ = _val_; } + void header(::unitree_api::msg::dds_::ResponseHeader_&& _val_) { this->header_ = _val_; } + const std::string& data() const { return this->data_; } + std::string& data() { return this->data_; } + void data(const std::string& _val_) { this->data_ = _val_; } + void data(std::string&& _val_) { this->data_ = _val_; } + const std::vector& binary() const { return this->binary_; } + std::vector& binary() { return this->binary_; } + void binary(const std::vector& _val_) { this->binary_ = _val_; } + void binary(std::vector&& _val_) { this->binary_ = _val_; } + + bool operator==(const Response_& _other) const + { + (void) _other; + return header_ == _other.header_ && + data_ == _other.data_ && + binary_ == _other.binary_; + } + + bool operator!=(const Response_& _other) const + { + return !(*this == _other); + } + +}; + +} + +} + +} + +#include "dds/topic/TopicTraits.hpp" +#include "org/eclipse/cyclonedds/topic/datatopic.hpp" + +namespace org { +namespace eclipse { +namespace cyclonedds { +namespace topic { + +template <> constexpr const char* TopicTraits<::unitree_api::msg::dds_::Response_>::getTypeName() +{ + return "unitree_api::msg::dds_::Response_"; +} + +template <> constexpr bool TopicTraits<::unitree_api::msg::dds_::Response_>::isSelfContained() +{ + return false; +} + +template <> constexpr bool TopicTraits<::unitree_api::msg::dds_::Response_>::isKeyless() +{ + return true; +} + +#ifdef DDSCXX_HAS_TYPE_DISCOVERY +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::Response_>::type_map_blob_sz() { return 1068; } +template<> constexpr unsigned int TopicTraits<::unitree_api::msg::dds_::Response_>::type_info_blob_sz() { return 244; } +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::Response_>::type_map_blob() { + static const uint8_t blob[] = { + 0x53, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf1, 0x48, 0xc9, 0x97, 0xd3, 0x79, 0xc3, 0xe1, + 0x8c, 0x53, 0x0b, 0x5f, 0x8f, 0xe9, 0x46, 0x00, 0x58, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x9c, 0x43, 0xe5, 0x09, 0xd9, + 0x26, 0x2e, 0x25, 0xe7, 0x3c, 0x21, 0xef, 0xbf, 0xee, 0x09, 0x9f, 0xb9, 0x95, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x8d, 0x77, 0x7f, 0x38, + 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x01, 0x00, 0x00, 0x02, + 0x9d, 0x71, 0x83, 0xf1, 0xf1, 0x9c, 0x43, 0xe5, 0x09, 0xd9, 0x26, 0x2e, 0x25, 0xe7, 0x3c, 0x21, + 0xef, 0xbf, 0xee, 0x00, 0x51, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, 0x89, 0x0d, 0xad, + 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0xff, 0x48, 0x3d, 0x1f, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf1, 0x5b, 0x67, 0x75, 0x71, 0x30, 0x34, 0xdf, 0x53, 0x23, + 0x66, 0x5f, 0xf9, 0x73, 0x40, 0x9a, 0xcb, 0x44, 0x54, 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, + 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0x33, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xb8, 0x0b, 0xb7, 0x74, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0xd3, 0x3a, 0xff, 0x5d, 0xf1, + 0x5b, 0x67, 0x75, 0x71, 0x30, 0x34, 0xdf, 0x53, 0x23, 0x66, 0x5f, 0xf9, 0x73, 0x40, 0x00, 0x00, + 0x23, 0x00, 0x00, 0x00, 0xf1, 0x51, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x04, 0xc1, 0x33, 0x67, 0x94, 0x00, 0x4f, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0xf2, 0xd1, 0xc3, 0x2c, 0xc0, 0x22, 0x14, 0x90, 0x1a, 0x46, 0x4a, 0x6c, 0x51, 0x32, 0x5d, 0x00, + 0x9d, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x22, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, + 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x0f, 0x90, 0xcc, 0xa0, 0xee, + 0x3b, 0x25, 0x7f, 0xf8, 0x91, 0x0c, 0x07, 0xeb, 0x3e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x70, 0x00, 0x05, 0x00, 0x00, 0x00, 0x64, 0x61, 0x74, 0x61, + 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, + 0x01, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00, 0x00, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x00, 0x00, + 0x00, 0xf2, 0x0f, 0x90, 0xcc, 0xa0, 0xee, 0x3b, 0x25, 0x7f, 0xf8, 0x91, 0x0c, 0x07, 0xeb, 0x3e, + 0x95, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, + 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x5f, 0x00, 0x59, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0xf8, + 0x8b, 0x48, 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x00, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x00, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0xf2, 0x1a, 0x4c, 0x7d, 0xe4, 0xfc, + 0x64, 0xee, 0x04, 0x5d, 0x30, 0x0c, 0xff, 0x55, 0xda, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x00, 0x00, 0x00, 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, 0xcf, + 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x75, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, + 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, + 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, + 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, + 0x69, 0x74, 0x79, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x69, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x05, 0x00, 0x07, 0x00, 0x00, 0x00, 0x61, 0x70, 0x69, 0x5f, 0x69, 0x64, 0x00, 0x00, + 0x00, 0xf2, 0x1a, 0x4c, 0x7d, 0xe4, 0xfc, 0x64, 0xee, 0x04, 0x5d, 0x30, 0x0c, 0xff, 0x55, 0xda, + 0x57, 0x00, 0x00, 0x00, 0xf2, 0x51, 0x01, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x75, 0x6e, 0x69, 0x74, 0x72, 0x65, 0x65, 0x5f, 0x61, 0x70, 0x69, 0x3a, + 0x3a, 0x6d, 0x73, 0x67, 0x3a, 0x3a, 0x64, 0x64, 0x73, 0x5f, 0x3a, 0x3a, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x00, 0x1b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x63, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0xf2, 0xd1, 0xc3, 0x2c, 0xc0, 0x22, 0x14, 0x90, 0x1a, 0x46, 0x4a, 0x6c, + 0x51, 0x32, 0x5d, 0xf1, 0x48, 0xc9, 0x97, 0xd3, 0x79, 0xc3, 0xe1, 0x8c, 0x53, 0x0b, 0x5f, 0x8f, + 0xe9, 0x46, 0xf2, 0x0f, 0x90, 0xcc, 0xa0, 0xee, 0x3b, 0x25, 0x7f, 0xf8, 0x91, 0x0c, 0x07, 0xeb, + 0x3e, 0xf1, 0x9c, 0x43, 0xe5, 0x09, 0xd9, 0x26, 0x2e, 0x25, 0xe7, 0x3c, 0x21, 0xef, 0xbf, 0xee, + 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, 0xcf, 0x5a, 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0xf1, + 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0xf2, 0x1a, + 0x4c, 0x7d, 0xe4, 0xfc, 0x64, 0xee, 0x04, 0x5d, 0x30, 0x0c, 0xff, 0x55, 0xda, 0xf1, 0x5b, 0x67, + 0x75, 0x71, 0x30, 0x34, 0xdf, 0x53, 0x23, 0x66, 0x5f, 0xf9, 0x73, 0x40, }; + return blob; +} +template<> inline const uint8_t * TopicTraits<::unitree_api::msg::dds_::Response_>::type_info_blob() { + static const uint8_t blob[] = { + 0xf0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x40, 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf1, 0x48, 0xc9, 0x97, 0xd3, 0x79, 0xc3, 0xe1, 0x8c, 0x53, 0x0b, 0x5f, + 0x8f, 0xe9, 0x46, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x9c, 0x43, 0xe5, 0x09, 0xd9, 0x26, 0x2e, + 0x25, 0xe7, 0x3c, 0x21, 0xef, 0xbf, 0xee, 0x00, 0x55, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf1, 0x8f, 0x78, 0x20, 0x91, 0xd8, 0x0b, 0x89, 0x0d, 0xad, 0xf3, 0xe7, 0xd6, 0x60, 0xe6, 0x00, + 0x37, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf1, 0x5b, 0x67, 0x75, 0x71, 0x30, 0x34, 0xdf, + 0x53, 0x23, 0x66, 0x5f, 0xf9, 0x73, 0x40, 0x00, 0x27, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00, 0x40, + 0x70, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xd1, 0xc3, 0x2c, + 0xc0, 0x22, 0x14, 0x90, 0x1a, 0x46, 0x4a, 0x6c, 0x51, 0x32, 0x5d, 0x00, 0xa1, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x0f, 0x90, 0xcc, 0xa0, 0xee, 0x3b, 0x25, 0x7f, 0xf8, 0x91, 0x0c, 0x07, 0xeb, 0x3e, 0x00, + 0x99, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xf2, 0xf8, 0x8b, 0x48, 0x81, 0xc6, 0xcf, 0x5a, + 0x29, 0xdc, 0xd6, 0x89, 0x3c, 0xdd, 0x22, 0x00, 0x79, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf2, 0x1a, 0x4c, 0x7d, 0xe4, 0xfc, 0x64, 0xee, 0x04, 0x5d, 0x30, 0x0c, 0xff, 0x55, 0xda, 0x00, + 0x5b, 0x00, 0x00, 0x00, }; + return blob; +} +#endif //DDSCXX_HAS_TYPE_DISCOVERY + +} //namespace topic +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +namespace dds { +namespace topic { + +template <> +struct topic_type_name<::unitree_api::msg::dds_::Response_> +{ + static std::string value() + { + return org::eclipse::cyclonedds::topic::TopicTraits<::unitree_api::msg::dds_::Response_>::getTypeName(); + } +}; + +} +} + +REGISTER_TOPIC_TYPE(::unitree_api::msg::dds_::Response_) + +namespace org{ +namespace eclipse{ +namespace cyclonedds{ +namespace core{ +namespace cdr{ + +template<> +propvec &get_type_props<::unitree_api::msg::dds_::Response_>(); + +template::value, bool> = true > +bool write(T& streamer, const ::unitree_api::msg::dds_::Response_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!write(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!write_string(streamer, instance.data(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.binary().size()); + if (!write(streamer, se_1)) + return false; + if (se_1 > 0 && + !write(streamer, instance.binary()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool write(S& str, const ::unitree_api::msg::dds_::Response_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::Response_>(); + str.set_mode(cdr_stream::stream_mode::write, as_key); + return write(str, instance, props.data()); +} + +template::value, bool> = true > +bool read(T& streamer, ::unitree_api::msg::dds_::Response_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!read(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!read_string(streamer, instance.data(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.binary().size()); + if (!read(streamer, se_1)) + return false; + instance.binary().resize(se_1); + if (se_1 > 0 && + !read(streamer, instance.binary()[0], se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool read(S& str, ::unitree_api::msg::dds_::Response_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::Response_>(); + str.set_mode(cdr_stream::stream_mode::read, as_key); + return read(str, instance, props.data()); +} + +template::value, bool> = true > +bool move(T& streamer, const ::unitree_api::msg::dds_::Response_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!move(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!move_string(streamer, instance.data(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = uint32_t(instance.binary().size()); + if (!move(streamer, se_1)) + return false; + if (se_1 > 0 && + !move(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool move(S& str, const ::unitree_api::msg::dds_::Response_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::Response_>(); + str.set_mode(cdr_stream::stream_mode::move, as_key); + return move(str, instance, props.data()); +} + +template::value, bool> = true > +bool max(T& streamer, const ::unitree_api::msg::dds_::Response_& instance, entity_properties_t *props) { + (void)instance; + if (!streamer.start_struct(*props)) + return false; + auto prop = streamer.first_entity(props); + while (prop) { + switch (prop->m_id) { + case 0: + if (!streamer.start_member(*prop)) + return false; + if (!max(streamer, instance.header(), prop)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 1: + if (!streamer.start_member(*prop)) + return false; + if (!max_string(streamer, instance.data(), 0)) + return false; + if (!streamer.finish_member(*prop)) + return false; + break; + case 2: + if (!streamer.start_member(*prop)) + return false; + if (!streamer.start_consecutive(false, true)) + return false; + { + uint32_t se_1 = 0; + if (!max(streamer, se_1)) + return false; + if (se_1 > 0 && + !max(streamer, uint8_t(), se_1)) + return false; + } //end sequence 1 + if (!streamer.finish_consecutive()) + return false; + streamer.position(SIZE_MAX); + if (!streamer.finish_member(*prop)) + return false; + break; + } + prop = streamer.next_entity(prop); + } + return streamer.finish_struct(*props); +} + +template::value, bool> = true > +bool max(S& str, const ::unitree_api::msg::dds_::Response_& instance, bool as_key) { + auto &props = get_type_props<::unitree_api::msg::dds_::Response_>(); + str.set_mode(cdr_stream::stream_mode::max, as_key); + return max(str, instance, props.data()); +} + +} //namespace cdr +} //namespace core +} //namespace cyclonedds +} //namespace eclipse +} //namespace org + +#endif // DDSCXX_RESPONSE__HPP diff --git a/unitree_SDK/include/unitree/robot/internal/internal_request_response.hpp b/unitree_SDK/include/unitree/robot/internal/internal_request_response.hpp new file mode 100644 index 0000000..4be14ce --- /dev/null +++ b/unitree_SDK/include/unitree/robot/internal/internal_request_response.hpp @@ -0,0 +1,23 @@ +#ifndef __UT_ROBOT_INTERNAL_REQUEST_RESPONSE_HPP__ +#define __UT_ROBOT_INTERNAL_REQUEST_RESPONSE_HPP__ + +#include +#include + +namespace unitree +{ +namespace robot +{ +using RequestIdentity = unitree_api::msg::dds_::RequestIdentity_; +using RequestLease = unitree_api::msg::dds_::RequestLease_; +using RequestPolicy = unitree_api::msg::dds_::RequestPolicy_; +using RequestHeader = unitree_api::msg::dds_::RequestHeader_; +using Request = unitree_api::msg::dds_::Request_; + +using ResponseStatus = unitree_api::msg::dds_::ResponseStatus_; +using ResponseHeader = unitree_api::msg::dds_::ResponseHeader_; +using Response = unitree_api::msg::dds_::Response_; +} +} + +#endif//__UT_ROBOT_INTERNAL_REQUEST_RESPONSE_HPP__ diff --git a/unitree_SDK/include/unitree/robot/serialize/serialize.hpp b/unitree_SDK/include/unitree/robot/serialize/serialize.hpp new file mode 100644 index 0000000..cac54d8 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/serialize/serialize.hpp @@ -0,0 +1,43 @@ +#ifndef __UT_ROBOT_SDK_SERIALIZE_HPP__ +#define __UT_ROBOT_SDK_SERIALIZE_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +template +inline bool Serialize(const T& instance, std::string& serialziedData) +{ + try + { + serialziedData = common::ToJsonString(instance); + } + catch(const common::Exception& e) + { + return false; + } + + return true; +} + +template +inline bool Deserialize(const std::string& serialziedData, T& instance) +{ + try + { + instance = common::FromJsonString(serialziedData); + } + catch(const common::Exception& e) + { + return false; + } + + return true; +} + +} +} + +#endif//__UT_ROBOT_SDK_SERIALIZE_HPP__ diff --git a/unitree_SDK/include/unitree/robot/server/lease_server.hpp b/unitree_SDK/include/unitree/robot/server/lease_server.hpp new file mode 100644 index 0000000..d0b886a --- /dev/null +++ b/unitree_SDK/include/unitree/robot/server/lease_server.hpp @@ -0,0 +1,60 @@ +#ifndef __UT_ROBOT_LEASE_SERVER_HPP__ +#define __UT_ROBOT_LEASE_SERVER_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +class LeaseCache +{ +public: + LeaseCache(); + ~LeaseCache(); + + void Set(int64_t id, const std::string& mName, int64_t lastModified = 0); + void Renewal(int64_t lastModified = 0); + void Clear(); + + int64_t GetLastModified() const; + int64_t GetId() const; + const std::string& GetName() const; + +private: + int64_t mLastModified; + int64_t mId; + std::string mName; +}; + +class LeaseServer : public ServerBase +{ +public: + explicit LeaseServer(const std::string& name, int64_t term); + ~LeaseServer(); + + void Init(); + + bool CheckRequestLeaseDenied(int64_t leaseId); + +private: + void ServerRequestHandler(const RequestPtr& request); + + int32_t Apply(const std::string& parameter, std::string& data); + int32_t Renewal(int64_t leaseId); + + int64_t GenerateId(const std::string& name); + +private: + int64_t mTerm; + LeaseCache mCache; + common::Mutex mMutex; + ServerStubPtr mServerStubPtr; +}; + +using LeaseServerPtr = std::shared_ptr; + +} +} + +#endif//__UT_ROBOT_LEASE_SERVER_HPP__ diff --git a/unitree_SDK/include/unitree/robot/server/server.hpp b/unitree_SDK/include/unitree/robot/server/server.hpp new file mode 100644 index 0000000..2eb0494 --- /dev/null +++ b/unitree_SDK/include/unitree/robot/server/server.hpp @@ -0,0 +1,77 @@ +#ifndef __UT_ROBOT_SDK_SERVER_HPP__ +#define __UT_ROBOT_SDK_SERVER_HPP__ + +#include +#include + +#define UT_ROBOT_SERVER_REG_API_HANDLER_NO_LEASE(apiId, handler) \ + UT_ROBOT_SERVER_REG_API_HANDLER(apiId, handler, false) + +#define UT_ROBOT_SERVER_REG_API_BINARY_HANDLER_NO_LEASE(apiId, handler) \ + UT_ROBOT_SERVER_REG_API_BINARY_HANDLER(apiId, handler, false) + +#define UT_ROBOT_SERVER_REG_API_HANDLER(apiId, handler, checkLease) \ + RegistHandler(apiId, std::bind(handler, this, std::placeholders::_1, std::placeholders::_2), checkLease) + +#define UT_ROBOT_SERVER_REG_API_BINARY_HANDLER(apiId, handler, checkLease) \ + RegistBinaryHandler(apiId, std::bind(handler, this, std::placeholders::_1, std::placeholders::_2), checkLease) + +namespace unitree +{ +namespace robot +{ +using RequestHandler = std::function; +using BinaryRequestHandler = std::function& parameter, std::vector& data)>; + +class Server : public ServerBase +{ +public: + explicit Server(const std::string& name); + virtual ~Server(); + + virtual void Init() = 0; + + void StartLease(int64_t leaseTerm); + void StartLease(float leaseTerm); + + const std::string& GetName(); + const std::string& GetApiVersion() const; + + int32_t GetCurrentApiId() const; + +protected: + void SetApiVersion(const std::string& version); + + void ServerRequestHandler(const RequestPtr& request); + + void RegistHandler(int32_t apiId, const RequestHandler& handler, bool checkLease = false); + void RegistBinaryHandler(int32_t apiId, const BinaryRequestHandler& binaryHandler, bool checkLease = false); + + bool IsBinary(int32_t apiId); + + RequestHandler GetHandler(int32_t apiId, bool& ignoreLease) const; + BinaryRequestHandler GetBinaryHandler(int32_t apiId, bool& ignoreLease) const; + + bool CheckLeaseDenied(int64_t leaseId); + +private: + bool mEnableLease; + std::string mName; + std::string mApiVersion; + std::unordered_map> mApiHandlerMap; + std::unordered_map> mApiBinaryHandlerMap; + + std::set mApiBinarySet; + + LeaseServerPtr mLeaseServerPtr; + +private: + static thread_local int32_t mCurrentApiId; +}; + +using ServerPtr = std::shared_ptr; + +} +} + +#endif//__UT_ROBOT_SDK_SERVER_HPP__ diff --git a/unitree_SDK/include/unitree/robot/server/server_base.hpp b/unitree_SDK/include/unitree/robot/server/server_base.hpp new file mode 100644 index 0000000..d32de9a --- /dev/null +++ b/unitree_SDK/include/unitree/robot/server/server_base.hpp @@ -0,0 +1,35 @@ +#ifndef __UT_ROBOT_SDK_SERVER_BASE_HPP__ +#define __UT_ROBOT_SDK_SERVER_BASE_HPP__ + +#include + +namespace unitree +{ +namespace robot +{ +class ServerBase +{ +public: + explicit ServerBase(const std::string& name); + virtual ~ServerBase(); + + virtual void Init() = 0; + virtual void Start(bool enableProiQueue = false); + + const std::string& GetName() const; + +protected: + virtual void ServerRequestHandler(const RequestPtr& request) = 0; + void SendResponse(const Response& response); + +protected: + std::string mName; + ServerStubPtr mServerStubPtr; +}; + +using ServerBasePtr = std::shared_ptr; + +} +} + +#endif//__UT_ROBOT_SDK_SERVER_BASE_HPP__ diff --git a/unitree_SDK/include/unitree/robot/server/server_stub.hpp b/unitree_SDK/include/unitree/robot/server/server_stub.hpp new file mode 100644 index 0000000..289f3dc --- /dev/null +++ b/unitree_SDK/include/unitree/robot/server/server_stub.hpp @@ -0,0 +1,46 @@ +#ifndef __UT_ROBOT_SDK_SERVER_STUB_HPP__ +#define __UT_ROBOT_SDK_SERVER_STUB_HPP__ + +#include +#include +#include +#include + +namespace unitree +{ +namespace robot +{ +using ServerRequestHandler = std::function; + +class ServerStub +{ +public: + explicit ServerStub(); + ~ServerStub(); + + void Init(const std::string& name, const ServerRequestHandler& handler, bool enableProiQueue); + bool Send(const Response& response, int64_t timeout = 0); + +private: + void Enqueue(const void* message); + + int32_t QueueThreadFunction(); + int32_t ProiQueueThreadFunction(); + +private: + bool mEnableProiQueue; + bool mRunning; + ServerRequestHandler mRequestHandler; + ChannelLaborPtr mChannelLaborPtr; + common::BlockQueuePtr mQueuePtr; + common::BlockQueuePtr mProiQueuePtr; + common::ThreadPtr mQueueThreadPtr; + common::ThreadPtr mProiQueueThreadPtr; +}; + +using ServerStubPtr = std::shared_ptr; + +} +} + +#endif//__UT_ROBOT_SDK_SERVER_STUB_HPP__ diff --git a/unitree_SDK/lib/cmake/unitree_sdk2/unitree_sdk2Config.cmake b/unitree_SDK/lib/cmake/unitree_sdk2/unitree_sdk2Config.cmake new file mode 100644 index 0000000..ff2bad6 --- /dev/null +++ b/unitree_SDK/lib/cmake/unitree_sdk2/unitree_sdk2Config.cmake @@ -0,0 +1,7 @@ +include(CMakeFindDependencyMacro) + +# Same syntax as find_package +find_dependency(Threads REQUIRED) + +# Add the targets file +include("${CMAKE_CURRENT_LIST_DIR}/unitree_sdk2Targets.cmake") diff --git a/unitree_SDK/lib/cmake/unitree_sdk2/unitree_sdk2ConfigVersion.cmake b/unitree_SDK/lib/cmake/unitree_sdk2/unitree_sdk2ConfigVersion.cmake new file mode 100644 index 0000000..3e553e3 --- /dev/null +++ b/unitree_SDK/lib/cmake/unitree_sdk2/unitree_sdk2ConfigVersion.cmake @@ -0,0 +1,52 @@ +# This is a basic version file for the Config-mode of find_package(). +# It is used by write_basic_package_version_file() as input file for configure_file() +# to create a version-file which can be installed along a config.cmake file. +# +# The created file sets PACKAGE_VERSION_EXACT if the current version string and +# the requested version string are exactly the same and it sets +# PACKAGE_VERSION_COMPATIBLE if the current version is equal to the requested version. +# The tweak version component is ignored. +# The variable CVF_VERSION must be set before calling configure_file(). + + +set(PACKAGE_VERSION "2.0.0") + +if("2.0.0" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version + set(CVF_VERSION_NO_TWEAK "${CMAKE_MATCH_1}") +else() + set(CVF_VERSION_NO_TWEAK "2.0.0") +endif() + +if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version + set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}") +else() + set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}") +endif() + +if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK) + set(PACKAGE_VERSION_COMPATIBLE TRUE) +else() + set(PACKAGE_VERSION_COMPATIBLE FALSE) +endif() + +if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) +endif() + + +# if the installed project requested no architecture check, don't perform the check +if("FALSE") + return() +endif() + +# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") + return() +endif() + +# check that the installed version has the same 32/64bit-ness as the one which is currently searching: +if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8") + math(EXPR installedBits "8 * 8") + set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + set(PACKAGE_VERSION_UNSUITABLE TRUE) +endif() diff --git a/unitree_SDK/lib/cmake/unitree_sdk2/unitree_sdk2Targets.cmake b/unitree_SDK/lib/cmake/unitree_sdk2/unitree_sdk2Targets.cmake new file mode 100644 index 0000000..fe0ab2f --- /dev/null +++ b/unitree_SDK/lib/cmake/unitree_sdk2/unitree_sdk2Targets.cmake @@ -0,0 +1,96 @@ +if(CMAKE_VERSION VERSION_LESS 3.5.0) + message(FATAL_ERROR "This file relies on consumers using CMake 3.5.0 or greater.") +endif() +cmake_policy(PUSH) +cmake_policy(VERSION 2.6) + +# Commands may need to know the format version. +set(CMAKE_IMPORT_FILE_VERSION 1) + +# Protect against multiple inclusion, which would fail when already imported targets are added once more. +set(_targetsDefined) +set(_targetsNotDefined) +set(_expectedTargets) +foreach(_expectedTarget unitree_sdk2) + list(APPEND _expectedTargets ${_expectedTarget}) + if(NOT TARGET ${_expectedTarget}) + list(APPEND _targetsNotDefined ${_expectedTarget}) + endif() + if(TARGET ${_expectedTarget}) + list(APPEND _targetsDefined ${_expectedTarget}) + endif() +endforeach() +if("${_targetsDefined}" STREQUAL "${_expectedTargets}") + unset(_targetsDefined) + unset(_targetsNotDefined) + unset(_expectedTargets) + set(CMAKE_IMPORT_FILE_VERSION) + cmake_policy(POP) + return() +endif() +if(NOT "${_targetsDefined}" STREQUAL "") + message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n") +endif() +unset(_targetsDefined) +unset(_targetsNotDefined) +unset(_expectedTargets) + + +# Compute the installation prefix relative to this file. +get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) +if(_IMPORT_PREFIX STREQUAL "/") + set(_IMPORT_PREFIX "") +endif() + +# Create imported target ddsc and ddscxx +add_library(ddsc SHARED IMPORTED GLOBAL) +set_target_properties(ddsc PROPERTIES + IMPORTED_LOCATION ${_IMPORT_PREFIX}/lib/libddsc.so + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include" + INTERFACE_LINK_LIBRARIES "Threads::Threads" + IMPORTED_NO_SONAME TRUE) + +add_library(ddscxx SHARED IMPORTED GLOBAL) +set_target_properties(ddscxx PROPERTIES + IMPORTED_LOCATION ${_IMPORT_PREFIX}/lib/libddscxx.so + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/ddscxx" + INTERFACE_LINK_LIBRARIES "Threads::Threads" + IMPORTED_NO_SONAME TRUE) + +# Create imported target unitree_sdk2 +add_library(unitree_sdk2 STATIC IMPORTED GLOBAL) +set_target_properties(unitree_sdk2 PROPERTIES + IMPORTED_LOCATION ${_IMPORT_PREFIX}/lib/libunitree_sdk2.a + INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include" + INTERFACE_LINK_LIBRARIES "ddsc;ddscxx;Threads::Threads" + LINKER_LANGUAGE CXX +) + +# Cleanup temporary variables. +set(_IMPORT_PREFIX) + +# Loop over all imported files and verify that they actually exist +foreach(target ${_IMPORT_CHECK_TARGETS} ) + foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} ) + if(NOT EXISTS "${file}" ) + message(FATAL_ERROR "The imported target \"${target}\" references the file + \"${file}\" +but this file does not exist. Possible reasons include: +* The file was deleted, renamed, or moved to another location. +* An install or uninstall procedure did not complete successfully. +* The installation package was faulty and contained + \"${CMAKE_CURRENT_LIST_FILE}\" +but not all the files it references. +") + endif() + endforeach() + unset(_IMPORT_CHECK_FILES_FOR_${target}) +endforeach() +unset(_IMPORT_CHECK_TARGETS) + +# Commands beyond this point should not need to know the version. +set(CMAKE_IMPORT_FILE_VERSION) +cmake_policy(POP) diff --git a/unitree_SDK/lib/libddsc.so b/unitree_SDK/lib/libddsc.so new file mode 100644 index 0000000..d7e922f Binary files /dev/null and b/unitree_SDK/lib/libddsc.so differ diff --git a/unitree_SDK/lib/libddsc.so.0 b/unitree_SDK/lib/libddsc.so.0 new file mode 100644 index 0000000..cf5ed91 --- /dev/null +++ b/unitree_SDK/lib/libddsc.so.0 @@ -0,0 +1 @@ +libddsc.so \ No newline at end of file diff --git a/unitree_SDK/lib/libddscxx.so b/unitree_SDK/lib/libddscxx.so new file mode 100644 index 0000000..42faf3d Binary files /dev/null and b/unitree_SDK/lib/libddscxx.so differ diff --git a/unitree_SDK/lib/libddscxx.so.0 b/unitree_SDK/lib/libddscxx.so.0 new file mode 100644 index 0000000..8e183cd --- /dev/null +++ b/unitree_SDK/lib/libddscxx.so.0 @@ -0,0 +1 @@ +libddscxx.so \ No newline at end of file diff --git a/unitree_SDK/lib/libunitree_sdk2.a b/unitree_SDK/lib/libunitree_sdk2.a new file mode 100644 index 0000000..076f97f Binary files /dev/null and b/unitree_SDK/lib/libunitree_sdk2.a differ diff --git a/urdf/d1_description/CMakeLists.txt b/urdf/d1_description/CMakeLists.txt new file mode 100644 index 0000000..2fb4911 --- /dev/null +++ b/urdf/d1_description/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8.3) + +project(d1_description) + +find_package(catkin REQUIRED) + +catkin_package() + +find_package(roslaunch) + +foreach(dir config launch meshes urdf) + install(DIRECTORY ${dir}/ + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir}) +endforeach(dir) diff --git a/urdf/d1_description/config/joint_names_d1_description.yaml b/urdf/d1_description/config/joint_names_d1_description.yaml new file mode 100644 index 0000000..b8cd94f --- /dev/null +++ b/urdf/d1_description/config/joint_names_d1_description.yaml @@ -0,0 +1 @@ +controller_joint_names: ['', 'Joint1', 'Joint2', 'Joint3', 'Joint4', 'Joint5', 'Joint6', 'Joint7_1', 'Joint7_2', ] diff --git a/urdf/d1_description/export.log b/urdf/d1_description/export.log new file mode 100644 index 0000000..e89ee02 --- /dev/null +++ b/urdf/d1_description/export.log @@ -0,0 +1,13 @@ +2024-02-01 10:44:52,857 INFO Logger.cs: 70 - +-------------------------------------------------------------------------------- +2024-02-01 10:44:52,887 INFO Logger.cs: 71 - Logging commencing for SW2URDF exporter +2024-02-01 10:44:52,889 INFO Logger.cs: 73 - Commit version 1.6.0-4-g7f85cfe +2024-02-01 10:44:52,889 INFO Logger.cs: 74 - Build version 1.6.7995.38578 +2024-02-01 10:44:52,891 INFO SwAddin.cs: 192 - Attempting to connect to SW +2024-02-01 10:44:52,891 INFO SwAddin.cs: 197 - Setting up callbacks +2024-02-01 10:44:52,891 INFO SwAddin.cs: 201 - Setting up command manager +2024-02-01 10:44:52,892 INFO SwAddin.cs: 204 - Adding command manager +2024-02-01 10:44:52,895 INFO SwAddin.cs: 263 - Adding Assembly export to file menu +2024-02-01 10:44:52,895 INFO SwAddin.cs: 272 - Adding Part export to file menu +2024-02-01 10:44:52,896 INFO SwAddin.cs: 210 - Adding event handlers +2024-02-01 10:44:52,898 INFO SwAddin.cs: 217 - Connecting plugin to SolidWorks diff --git a/urdf/d1_description/launch/display.launch b/urdf/d1_description/launch/display.launch new file mode 100644 index 0000000..2f7884f --- /dev/null +++ b/urdf/d1_description/launch/display.launch @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/urdf/d1_description/launch/gazebo.launch b/urdf/d1_description/launch/gazebo.launch new file mode 100644 index 0000000..bd87a50 --- /dev/null +++ b/urdf/d1_description/launch/gazebo.launch @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/urdf/d1_description/meshes/Link1.STL b/urdf/d1_description/meshes/Link1.STL new file mode 100644 index 0000000..fab96c9 Binary files /dev/null and b/urdf/d1_description/meshes/Link1.STL differ diff --git a/urdf/d1_description/meshes/Link2.STL b/urdf/d1_description/meshes/Link2.STL new file mode 100644 index 0000000..81536da Binary files /dev/null and b/urdf/d1_description/meshes/Link2.STL differ diff --git a/urdf/d1_description/meshes/Link3.STL b/urdf/d1_description/meshes/Link3.STL new file mode 100644 index 0000000..f12190f Binary files /dev/null and b/urdf/d1_description/meshes/Link3.STL differ diff --git a/urdf/d1_description/meshes/Link4.STL b/urdf/d1_description/meshes/Link4.STL new file mode 100644 index 0000000..ea9ed66 Binary files /dev/null and b/urdf/d1_description/meshes/Link4.STL differ diff --git a/urdf/d1_description/meshes/Link5.STL b/urdf/d1_description/meshes/Link5.STL new file mode 100644 index 0000000..7f5982e Binary files /dev/null and b/urdf/d1_description/meshes/Link5.STL differ diff --git a/urdf/d1_description/meshes/Link6.STL b/urdf/d1_description/meshes/Link6.STL new file mode 100644 index 0000000..48065eb Binary files /dev/null and b/urdf/d1_description/meshes/Link6.STL differ diff --git a/urdf/d1_description/meshes/Link7_1.STL b/urdf/d1_description/meshes/Link7_1.STL new file mode 100644 index 0000000..b385f4c Binary files /dev/null and b/urdf/d1_description/meshes/Link7_1.STL differ diff --git a/urdf/d1_description/meshes/Link7_2.STL b/urdf/d1_description/meshes/Link7_2.STL new file mode 100644 index 0000000..6b13b2f Binary files /dev/null and b/urdf/d1_description/meshes/Link7_2.STL differ diff --git a/urdf/d1_description/meshes/base_link.STL b/urdf/d1_description/meshes/base_link.STL new file mode 100644 index 0000000..adb0d53 Binary files /dev/null and b/urdf/d1_description/meshes/base_link.STL differ diff --git a/urdf/d1_description/package.xml b/urdf/d1_description/package.xml new file mode 100644 index 0000000..e0a0bf4 --- /dev/null +++ b/urdf/d1_description/package.xml @@ -0,0 +1,21 @@ + + d1_description + 1.0.0 + +

      URDF Description package for d1_description

      +

      This package contains configuration data, 3D models and launch files +for d1_description robot

      +
      + TODO + + BSD + catkin + roslaunch + robot_state_publisher + rviz + joint_state_publisher_gui + gazebo + + + +
      \ No newline at end of file diff --git a/urdf/d1_description/urdf/d1_description.csv b/urdf/d1_description/urdf/d1_description.csv new file mode 100644 index 0000000..3fe8c31 --- /dev/null +++ b/urdf/d1_description/urdf/d1_description.csv @@ -0,0 +1,10 @@ +Link Name,Center of Mass X,Center of Mass Y,Center of Mass Z,Center of Mass Roll,Center of Mass Pitch,Center of Mass Yaw,Mass,Moment Ixx,Moment Ixy,Moment Ixz,Moment Iyy,Moment Iyz,Moment Izz,Visual X,Visual Y,Visual Z,Visual Roll,Visual Pitch,Visual Yaw,Mesh Filename,Color Red,Color Green,Color Blue,Color Alpha,Collision X,Collision Y,Collision Z,Collision Roll,Collision Pitch,Collision Yaw,Collision Mesh Filename,Material Name,SW Components,Coordinate System,Axis Name,Joint Name,Joint Type,Joint Origin X,Joint Origin Y,Joint Origin Z,Joint Origin Roll,Joint Origin Pitch,Joint Origin Yaw,Parent,Joint Axis X,Joint Axis Y,Joint Axis Z,Limit Effort,Limit Velocity,Limit Lower,Limit Upper,Calibration rising,Calibration falling,Dynamics Damping,Dynamics Friction,Safety Soft Upper,Safety Soft Lower,Safety K Position,Safety K Velocity +base_link,0.0017,0.00E+00,0.0295,0,0,0,0.568,0.000644,2.97E-07,3.33E-06,0.0006769,-4.52E-07,0.0010466,0,0,0,0,0,0,package://d1_description/meshes/base_link.STL,1,1,1,1,0,0,0,0,0,0,package://d1_description/meshes/base_link.STL,,J0-1,坐标系base,,,,0,0,0,0,0,0,,0,0,0,,,,,,,,,,,, +Link1,-0.000843,-0.000119,0.0223535,0,0,0,0.368,3.45E-04,-9.00E-08,1.18E-06,3.31E-04,1.42E-06,2.14E-04,0,0,0,0,0,0,package://d1_description/meshes/Link1.STL,1,1,1,1,0,0,0,0,0,0,package://d1_description/meshes/Link1.STL,,J1-1,坐标?,joint1,Joint1,revolute,0,0,0.0533,0,0,-3.1416,base_link,0,0,1,0,0,0,0,,,,,,,, +Link2,0.00011,0.184077,-0.027408,0,0,0,0.477,0.003553597,4.79E-06,1.29E-07,1.42E-04,-3.76E-06,0.003490769,0,0,0,0,0,0,package://d1_description/meshes/Link2.STL,1,1,1,1,0,0,0,0,0,0,package://d1_description/meshes/Link2.STL,,J2-1,坐标?,joint2,Joint2,revolute,0,0.028,0.0563,1.5708,0,-3.1416,Link1,0,0,-1,0,0,0,0,,,,,,,, +Link3,0.017869,0.04318,-0.0275,0,0,0,0.159,5.90E-05,-6.41E-06,0.00E+00,6.89E-05,0.00E+00,8.86E-05,0,0,0,0,0,0,package://d1_description/meshes/Link3.STL,1,1,1,1,0,0,0,0,0,0,package://d1_description/meshes/Link3.STL,,J3-1,坐标?,joint3,Joint3,revolute,0,0.2693,0.0009,0,0,0,Link2,0,0,-1,0,0,0,0,,,,,,,, +Link4,-0.000626,0.00038,0.105418,0,0,0,0.224,5.43E-04,-7.30E-08,7.20E-06,5.73E-04,-1.31E-06,4.77E-05,0,0,0,0,0,0,package://d1_description/meshes/Link4.STL,1,1,1,1,0,0,0,0,0,0,package://d1_description/meshes/Link4.STL,,J4-1,坐标?,joint4,Joint4,revolute,0.0577,0.042,-0.0275,-1.5708,0,-1.5708,Link3,0,0,1,0,0,0,0,,,,,,,, +Link5,0.044336,0.005481,-0.023801,0,0,0,0.134,3.62E-05,6.42E-06,-5.00E-09,5.91E-05,1.00E-09,6.66E-05,0,0,0,0,0,0,package://d1_description/meshes/Link5.STL,1,1,1,1,0,0,0,0,0,0,package://d1_description/meshes/Link5.STL,,J5-1,坐标?,joint5,Joint5,revolute,-0.0001,-0.0237,0.14018,1.5708,-1.5708,0,Link4,0,0,-1,0,0,0,0,,,,,,,, +Link6,7.00E-06,3.65E-03,0.076577,0,0,0,0.238,2.04E-04,-2.80E-07,-3.50E-08,3.48E-04,1.93E-05,2.09E-04,0,0,0,0,0,0,package://d1_description/meshes/Link6.STL,1,1,1,1,0,0,0,0,0,0,package://d1_description/meshes/Link6.STL,,ZS-1,坐标?,joint6,Joint6,revolute,0.0825,-0.0010782,-0.023822,-1.5708,0,-1.5708,Link5,0,0,-1,0,0,0,0,,,,,,,, +Link7_1,0.012444,0.006,0.01067,0,0,0,0.025,2.37E-06,-7.74E-20,-1.04E-06,7.24E-06,-1.20E-20,7.84E-06,0,0,0,0,0,0,package://d1_description/meshes/Link7_1.STL,1,1,1,1,0,0,0,0,0,0,package://d1_description/meshes/Link7_1.STL,,ZS-03-1,坐标?_1,joint7,Joint7_1,prismatic,-0.0056012,-0.029636,0.0706,1.5714,-1.5708,0,Link6,0,0,-1,0,0,0,0,,,,,,,, +Link7_2,0.012444,-0.006,0.01067,0,0,0,0.025,2.37E-06,7.83E-20,-1.04E-06,7.24E-06,1.21E-20,7.84E-06,0,0,0,0,0,0,package://d1_description/meshes/Link7_2.STL,1,1,1,1,0,0,0,0,0,0,package://d1_description/meshes/Link7_2.STL,,ZS-03-2,坐标?_2,joint7,Joint7_2,prismatic,-0.0056388,0.02964,0.0706,1.5702,-1.5708,0,Link6,0,0,1,0,0,0,0,,,,,,,, diff --git a/urdf/d1_description/urdf/d1_description.urdf b/urdf/d1_description/urdf/d1_description.urdf new file mode 100644 index 0000000..c6a6dba --- /dev/null +++ b/urdf/d1_description/urdf/d1_description.urdf @@ -0,0 +1,511 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file