diff --git a/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_alloc.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_alloc.h new file mode 100644 index 0000000000000000000000000000000000000000..d6e6417751837e8e45440f18cca0ce08a38373cb --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_error.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_error.h new file mode 100644 index 0000000000000000000000000000000000000000..386612496fd7a7e1f7d000e8c5395b1ab9d21c43 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_impl.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..5fc45d33bc6d7a2c1f7014fb39ae7b36eab521c4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_listener.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_listener.h new file mode 100644 index 0000000000000000000000000000000000000000..82ad1be16a4ea00a39b7c3b12661048b1a19779b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_qos.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_qos.h new file mode 100644 index 0000000000000000000000000000000000000000..22e05522555aedddedfe1fb9bd386299919b18c6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_qosdefs.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_qosdefs.h new file mode 100644 index 0000000000000000000000000000000000000000..6011ec9a1507a6bff20f4e9b5264420ac625e540 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_status.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_public_status.h new file mode 100644 index 0000000000000000000000000000000000000000..04d4c4a9a2ff198cf1be4b272c221ad8a9a8d7dd --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_rhc.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_rhc.h new file mode 100644 index 0000000000000000000000000000000000000000..5825089611ef1fd7873e110a263c458137d95758 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_statistics.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsc/dds_statistics.h new file mode 100644 index 0000000000000000000000000000000000000000..c3ee166e8dc428773a5a597bd06a2aab7bafb870 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_acknack.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_acknack.h new file mode 100644 index 0000000000000000000000000000000000000000..a6f1c244b4a041fc8bb91c09f44f894bcc6738a3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_builtin_topic_if.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_builtin_topic_if.h new file mode 100644 index 0000000000000000000000000000000000000000..5fa7f77d1b236acdedc46ca0cbfe15d5ab023227 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_cdrstream.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_cdrstream.h new file mode 100644 index 0000000000000000000000000000000000000000..ce529239d8833950812ec7ded21c2b30e636a057 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_cfgelems.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_cfgelems.h new file mode 100644 index 0000000000000000000000000000000000000000..b541abd1f590f6de9ea8bd0ae0f2851f8a888dbb --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_cfgunits.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_cfgunits.h new file mode 100644 index 0000000000000000000000000000000000000000..22f0171e821ad65169a8645afcd52b96f4a12112 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_config.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_config.h new file mode 100644 index 0000000000000000000000000000000000000000..6e0ef81781ffb9b6232a250ea5f7a580379778be --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_config_impl.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_config_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..9c36f6276879406902a54c0101614ea61f3fad4f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_deadline.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_deadline.h new file mode 100644 index 0000000000000000000000000000000000000000..8eced4bf0303e564959f13f1f723772ab0da6583 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_deliver_locally.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_deliver_locally.h new file mode 100644 index 0000000000000000000000000000000000000000..ff216cfd45be600804d1a553b077dee2c38e346a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_domaingv.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_domaingv.h new file mode 100644 index 0000000000000000000000000000000000000000..7fcd9d45e173fe41f14d83ebf907945909f3c671 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_endpoint.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_endpoint.h new file mode 100644 index 0000000000000000000000000000000000000000..999492185a92ff20fdb9aa56e211e3891de317be --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_entity.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_entity.h new file mode 100644 index 0000000000000000000000000000000000000000..b68ca0b343cbe7720959dd8e9ee29ba1f859411a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_entity_index.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_entity_index.h new file mode 100644 index 0000000000000000000000000000000000000000..d85663e9688148652274b56433cc8414659ddba6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_entity_match.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_entity_match.h new file mode 100644 index 0000000000000000000000000000000000000000..b455dda4d56b2a599ae6d39f960ad163d56b07f1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_guid.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_guid.h new file mode 100644 index 0000000000000000000000000000000000000000..21b3f89f53cddf129b46cb22b9a9db0af7e4784d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_handshake.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_handshake.h new file mode 100644 index 0000000000000000000000000000000000000000..fc5cb21181c13947c57d5b3101645f31e995a02e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_iid.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_iid.h new file mode 100644 index 0000000000000000000000000000000000000000..c3216af699cf6ceef02bd5b0ce4947e0fb05ddf7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_ipaddr.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_ipaddr.h new file mode 100644 index 0000000000000000000000000000000000000000..9b9e13348eeba68c2eec7cc4eafe8e1b66d0a7e3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_keyhash.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_keyhash.h new file mode 100644 index 0000000000000000000000000000000000000000..0f0bd5bdd73fb2f538d1708af75a7a8b76917036 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_lifespan.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_lifespan.h new file mode 100644 index 0000000000000000000000000000000000000000..520243b52416286155dc43ef4a633a28726ff43e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_list_genptr.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_list_genptr.h new file mode 100644 index 0000000000000000000000000000000000000000..327fe6a4e3eb868d749ba24417f1256710da7ffd --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_list_tmpl.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_list_tmpl.h new file mode 100644 index 0000000000000000000000000000000000000000..0c44cd72af25204f1b7e9acde283d3df63806f3a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_locator.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_locator.h new file mode 100644 index 0000000000000000000000000000000000000000..84e4f45c23f78f75f1aae8f910b81909399a903a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_mcgroup.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_mcgroup.h new file mode 100644 index 0000000000000000000000000000000000000000..75cf6243b70cd22179a978e1c6e481923871f497 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_ownip.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_ownip.h new file mode 100644 index 0000000000000000000000000000000000000000..6e5ad3a3390d950ab839a40723cb028487deabf6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_participant.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_participant.h new file mode 100644 index 0000000000000000000000000000000000000000..80babdf7997a25df0d0b5f134016ec4d744a9797 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_plist.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_plist.h new file mode 100644 index 0000000000000000000000000000000000000000..a4da541438e030b4b7905269c73bc9066003c30f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_plist_generic.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_plist_generic.h new file mode 100644 index 0000000000000000000000000000000000000000..3162175b0e18c58c4021680e7d3a36484cc4e70f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_pmd.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_pmd.h new file mode 100644 index 0000000000000000000000000000000000000000..f315936771c6273e830f301ce31120f0a829d426 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_portmapping.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_portmapping.h new file mode 100644 index 0000000000000000000000000000000000000000..fa1b003e001f4a591e53bd8646f4016eb4f96ae3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_proxy_endpoint.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_proxy_endpoint.h new file mode 100644 index 0000000000000000000000000000000000000000..b3c67f9f242accb0472ab24e039d0334141429c6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_proxy_participant.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_proxy_participant.h new file mode 100644 index 0000000000000000000000000000000000000000..95dfa03efd28f007e87fde4a978b02cc9ea5054c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_raweth.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_raweth.h new file mode 100644 index 0000000000000000000000000000000000000000..82423dd1ea5bdb32ad3cdc8669c19549e5003d65 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_rhc.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_rhc.h new file mode 100644 index 0000000000000000000000000000000000000000..879a2e7e78523d2fd4b4ffeef94c7065937c9257 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_security_exchange.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_security_exchange.h new file mode 100644 index 0000000000000000000000000000000000000000..2ee5691ddaa111f227bf4d94de76b97242d3ef6f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_security_msg.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_security_msg.h new file mode 100644 index 0000000000000000000000000000000000000000..89709b970fca6d6343a9dd23b1d33a207f460488 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_security_omg.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_security_omg.h new file mode 100644 index 0000000000000000000000000000000000000000..4248b54716e2f21032dbf258c12b994ea211fff9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_security_util.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_security_util.h new file mode 100644 index 0000000000000000000000000000000000000000..c6fce10b298f6de94adead93169fd00df5159e87 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_serdata.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_serdata.h new file mode 100644 index 0000000000000000000000000000000000000000..a9f7f8a9af6c19f98e5be096e27466371bb167b9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_serdata_default.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_serdata_default.h new file mode 100644 index 0000000000000000000000000000000000000000..1eaaa51509c361730249cf1aeae63dc78cd9613a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_serdata_plist.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_serdata_plist.h new file mode 100644 index 0000000000000000000000000000000000000000..610745ac0f267f296d6ce80a4256705cc92e44fd --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_serdata_pserop.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_serdata_pserop.h new file mode 100644 index 0000000000000000000000000000000000000000..9ebba56904f771557854dbc1777df2fc2eb5fa52 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_sertopic.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_sertopic.h new file mode 100644 index 0000000000000000000000000000000000000000..dc632cc4d70fdf781003fda985dac37e91b62af2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_sertype.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_sertype.h new file mode 100644 index 0000000000000000000000000000000000000000..cdbefd771306ff13651b9a761bf5e3996dab7c25 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_shm_transport.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_shm_transport.h new file mode 100644 index 0000000000000000000000000000000000000000..acc5efbb6c5f3da5cfac914a8146b6b3c51b7c93 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_ssl.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_ssl.h new file mode 100644 index 0000000000000000000000000000000000000000..e06c5d16780d5bcca98deba7655350785b444bc9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_statistics.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_statistics.h new file mode 100644 index 0000000000000000000000000000000000000000..97925cd8beab18454849f471994e3ce7be0d8b14 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_tcp.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_tcp.h new file mode 100644 index 0000000000000000000000000000000000000000..1398e471ef352561d625977a5cf87bca09b08217 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_threadmon.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_threadmon.h new file mode 100644 index 0000000000000000000000000000000000000000..f4171dca8d8f0e5828dacacd98e88936fc489baa --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_time.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_time.h new file mode 100644 index 0000000000000000000000000000000000000000..b64382eeb1b3ec2b0280d1400310224885dbf793 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_tkmap.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_tkmap.h new file mode 100644 index 0000000000000000000000000000000000000000..493e37ca204834279b44380409c2fb778e25b9fe --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_topic.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_topic.h new file mode 100644 index 0000000000000000000000000000000000000000..7817b6bbd2a4c19948e5bf361415988b49990315 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_tran.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_tran.h new file mode 100644 index 0000000000000000000000000000000000000000..118928a8fde31e90059cf757eb5bbe68759b8bbd --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_typebuilder.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_typebuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..d4ba839e53b1fcb9eafc577d0c9337bb76d02891 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_typelib.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_typelib.h new file mode 100644 index 0000000000000000000000000000000000000000..d7e6eff51ffca57a4b724b799c953199404acbd0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_typelookup.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_typelookup.h new file mode 100644 index 0000000000000000000000000000000000000000..edab77ed71fdd58ba807288cbe1608234cb2f1aa --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_typewrap.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_typewrap.h new file mode 100644 index 0000000000000000000000000000000000000000..1551543309d5ace1a1b00b91433736b4207952a2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_udp.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_udp.h new file mode 100644 index 0000000000000000000000000000000000000000..1e66ca05739948a5029ba867a9e9ef624a4caf11 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_vendor.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_vendor.h new file mode 100644 index 0000000000000000000000000000000000000000..77b44f47c7ffc1a7ee85bae10128e7a778693ca3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_vnet.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_vnet.h new file mode 100644 index 0000000000000000000000000000000000000000..f95f442a4eeb5369c67ef5d93ec6b5d8b76c4c4c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_wraddrset.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_wraddrset.h new file mode 100644 index 0000000000000000000000000000000000000000..48b2d100786df97dfb0abf071b67f2d6f1acc495 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xqos.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xqos.h new file mode 100644 index 0000000000000000000000000000000000000000..17019e413752639522e4b6b62026363e169a1238 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_impl.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..92c25622cbe97d0b724868aa2c6c61cadad3f779 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typeinfo.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typeinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..5d40bd827825b03083374cfd4726ef1c4efc8a56 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typeinfo.idl b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typeinfo.idl new file mode 100644 index 0000000000000000000000000000000000000000..27c357cde8f63743901523f6ab207c54ea576eee --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typelookup.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typelookup.h new file mode 100644 index 0000000000000000000000000000000000000000..1d0a20a80d0c5794dc7792275b31ccaa969602d0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typelookup.idl b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typelookup.idl new file mode 100644 index 0000000000000000000000000000000000000000..b747178f96146037298f7caebb73e6e23e698e32 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typemap.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typemap.h new file mode 100644 index 0000000000000000000000000000000000000000..7988c3a695c30457bc69a587ecf378ff2edd82d3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typemap.idl b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/ddsi_xt_typemap.idl new file mode 100644 index 0000000000000000000000000000000000000000..278380a560e395cea68389a0bebb678514d5dd45 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_addrset.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_addrset.h new file mode 100644 index 0000000000000000000000000000000000000000..3f25cf2bb01ac1324e63d3efc9f61211368c089b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_bitset.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_bitset.h new file mode 100644 index 0000000000000000000000000000000000000000..98826cc47656639023f04c7243120816a6eb2744 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_bswap.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_bswap.h new file mode 100644 index 0000000000000000000000000000000000000000..88a26cba069f241e790b29460550ea842840669a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_ddsi_discovery.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_ddsi_discovery.h new file mode 100644 index 0000000000000000000000000000000000000000..b216ad2c4f4b455d02d0eecbf1ca2e242606beba --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_debmon.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_debmon.h new file mode 100644 index 0000000000000000000000000000000000000000..41f4a8c20fed7c80d221d5e304827ef255b72727 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_feature_check.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_feature_check.h new file mode 100644 index 0000000000000000000000000000000000000000..97c1a20580193f7bd4e835433aa58c400cb69b7e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_freelist.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_freelist.h new file mode 100644 index 0000000000000000000000000000000000000000..92b72a3507d9e094731ae05c80626ba6364966b1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_gc.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_gc.h new file mode 100644 index 0000000000000000000000000000000000000000..83b085911f2a925fa31e358ccbc61b3041cda06b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_hbcontrol.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_hbcontrol.h new file mode 100644 index 0000000000000000000000000000000000000000..172535cddf12e30abc181a3662f7b2f9ab02558b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_init.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_init.h new file mode 100644 index 0000000000000000000000000000000000000000..2d3247e692f26b87b366b113186a20d20b65038f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_inverse_uint32_set.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_inverse_uint32_set.h new file mode 100644 index 0000000000000000000000000000000000000000..82ccb0934ba3df38b4fb996de6a5f67fcec7dbb5 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_lat_estim.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_lat_estim.h new file mode 100644 index 0000000000000000000000000000000000000000..db85e008c12e5a3c7ad884d332b109e76753862a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_lease.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_lease.h new file mode 100644 index 0000000000000000000000000000000000000000..3912d07fb4af5f080a173fc35e673bdbf0a36336 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_log.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_log.h new file mode 100644 index 0000000000000000000000000000000000000000..e4d6266957cc543985fe130a4c365c88770b40c3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_misc.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_misc.h new file mode 100644 index 0000000000000000000000000000000000000000..255604c856db288ecaa41abb081557b9313dc2b1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_pcap.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_pcap.h new file mode 100644 index 0000000000000000000000000000000000000000..8e540864ed4f001b17d2f8ac8880079377f93269 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_protocol.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_protocol.h new file mode 100644 index 0000000000000000000000000000000000000000..75decd56cc1a319f983f515230218bc4ecb735ca --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_qosmatch.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_qosmatch.h new file mode 100644 index 0000000000000000000000000000000000000000..d9d758cabb0ae46d5d41467f671cdabdd7c27c88 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_radmin.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_radmin.h new file mode 100644 index 0000000000000000000000000000000000000000..693cbab9ec255ac59d5044dc439d02530f1dece8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_receive.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_receive.h new file mode 100644 index 0000000000000000000000000000000000000000..569a99f8b5ca0c5f2ae27095c4c14b278b072104 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_rtps.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_rtps.h new file mode 100644 index 0000000000000000000000000000000000000000..a5236e4b8c01a32781320feecc2888bda131d0c6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_sockwaitset.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_sockwaitset.h new file mode 100644 index 0000000000000000000000000000000000000000..545cca07dfbe5f7f21e2feba4511bd37716151fd --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_thread.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_thread.h new file mode 100644 index 0000000000000000000000000000000000000000..298bdde5e42b38b5e5fd5befda3b192e1584a223 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_transmit.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_transmit.h new file mode 100644 index 0000000000000000000000000000000000000000..272a6c154dc9e59102f5084f6d690cf69fa6e4b9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_unused.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_unused.h new file mode 100644 index 0000000000000000000000000000000000000000..3c1f389cbbed3352a37e39b9cfc97eeeea043049 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_whc.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_whc.h new file mode 100644 index 0000000000000000000000000000000000000000..d69b80b1044b4da3c5988aff38e38281f96da258 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_xevent.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_xevent.h new file mode 100644 index 0000000000000000000000000000000000000000..a18ca09167c1eab3166bcffd03606b34a12986c6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_xmsg.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/q_xmsg.h new file mode 100644 index 0000000000000000000000000000000000000000..38d293b79a730792cc6f3d000b5dfdc2eb100132 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/sysdeps.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsi/sysdeps.h new file mode 100644 index 0000000000000000000000000000000000000000..a3fcce130164b9071bf630ad7498346923905ac7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/align.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/align.h new file mode 100644 index 0000000000000000000000000000000000000000..b183711403daa06834861bd4d6c8905138f69ece --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/arch.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/arch.h new file mode 100644 index 0000000000000000000000000000000000000000..7a4420c8ec8287895a644ef3c46fcb5d8ebbca66 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/atomics.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/atomics.h new file mode 100644 index 0000000000000000000000000000000000000000..d0a82f007ba24b76100eed89cf11a562a40cd1f9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/atomics/arm.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/atomics/arm.h new file mode 100644 index 0000000000000000000000000000000000000000..f11c172a9b3957e6e327afd4ebfd32439928ef67 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/atomics/gcc.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/atomics/gcc.h new file mode 100644 index 0000000000000000000000000000000000000000..52193894397afcc2b6a9b8f640bc9964016a188f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/atomics/msvc.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/atomics/msvc.h new file mode 100644 index 0000000000000000000000000000000000000000..88cfc6b87930225cad365c5217eb5d0016ea4c68 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/atomics/sun.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/atomics/sun.h new file mode 100644 index 0000000000000000000000000000000000000000..3d77ae32d0064d029d5e67a8be3ebb31578a23b6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/attributes.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/attributes.h new file mode 100644 index 0000000000000000000000000000000000000000..b4c1463f1383459a35977999b06fd1de0de7474b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/avl.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/avl.h new file mode 100644 index 0000000000000000000000000000000000000000..32a7c1b1aaea82a83d4736c2f5d9990d39b5044f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/bswap.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/bswap.h new file mode 100644 index 0000000000000000000000000000000000000000..abe1d5590b33c7949d100aa33760412812ff5564 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/cdtors.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/cdtors.h new file mode 100644 index 0000000000000000000000000000000000000000..5508d1f892741fb545de25f29bbcb0cf01b28134 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/circlist.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/circlist.h new file mode 100644 index 0000000000000000000000000000000000000000..2409c3e70c1dfca77a7f67d36f02a090ed26cc7c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/countargs.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/countargs.h new file mode 100644 index 0000000000000000000000000000000000000000..ed1af399d046d6bc5c4379932977894f36ae0a4e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/dynlib.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/dynlib.h new file mode 100644 index 0000000000000000000000000000000000000000..3b078d6928c1ce366fd286ef2beeef8f97f5f9eb --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/endian.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/endian.h new file mode 100644 index 0000000000000000000000000000000000000000..038b91227ffc97a318536c9c066fc40be1472e46 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/environ.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/environ.h new file mode 100644 index 0000000000000000000000000000000000000000..783de64091c49f18ed088302a36d4d89998b0215 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/expand_vars.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/expand_vars.h new file mode 100644 index 0000000000000000000000000000000000000000..37d9a691053cf3b6d62a4ea85b9d76187c1ca5b4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/fibheap.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/fibheap.h new file mode 100644 index 0000000000000000000000000000000000000000..005a215f43a3e09525f94a5fba09799428d90bd2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/filesystem.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/filesystem.h new file mode 100644 index 0000000000000000000000000000000000000000..dc8dd7f5703730ca21004b27fc9d7cc9ae12036d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/filesystem/posix.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/filesystem/posix.h new file mode 100644 index 0000000000000000000000000000000000000000..7a1097e8cec69bbb681322054db5cf2cd20c0a77 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/filesystem/windows.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/filesystem/windows.h new file mode 100644 index 0000000000000000000000000000000000000000..332037712559d2915a63e732c92fa9263ae83dfe --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/heap.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/heap.h new file mode 100644 index 0000000000000000000000000000000000000000..0a7b4ea82c7b8ca6f3d27f0fc9c1d028b86c382a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/hopscotch.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/hopscotch.h new file mode 100644 index 0000000000000000000000000000000000000000..fa011086df37b3ce18fd37020df26db754e6e412 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/ifaddrs.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/ifaddrs.h new file mode 100644 index 0000000000000000000000000000000000000000..eada1ad1b4ad3f1aba7dfa6c76b55a76cb32111e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/io.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/io.h new file mode 100644 index 0000000000000000000000000000000000000000..317bec3478d2577c3acbe0be07b6437f60796b70 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/iovec.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/iovec.h new file mode 100644 index 0000000000000000000000000000000000000000..4c1e165ad009014a935b92c9541ba1223499d67c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/log.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/log.h new file mode 100644 index 0000000000000000000000000000000000000000..b3f356fb48dcf664484a6d76389eb5c492ca4276 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/md5.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/md5.h new file mode 100644 index 0000000000000000000000000000000000000000..1bb1dcbecf31e7a876e22f7648144edbe15640a3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/mh3.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/mh3.h new file mode 100644 index 0000000000000000000000000000000000000000..b1b5f95f885dbb3ce590251ac0b4dbff4e051a73 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/misc.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/misc.h new file mode 100644 index 0000000000000000000000000000000000000000..beb310e1c70cec93f6f1cdb726615f5553118673 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/netstat.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/netstat.h new file mode 100644 index 0000000000000000000000000000000000000000..86ae75538668d5ed293d8f9bc7ffde7b134d9079 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/process.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/process.h new file mode 100644 index 0000000000000000000000000000000000000000..4d0990cbf256ca5c87b1dbccb5466673176ab8f2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/random.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/random.h new file mode 100644 index 0000000000000000000000000000000000000000..21bf896521a3e73d1aad9161aa7563876d20e789 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/retcode.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/retcode.h new file mode 100644 index 0000000000000000000000000000000000000000..26ba62cd651e8f28590318d19cdcc1d9e25a891a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/rusage.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/rusage.h new file mode 100644 index 0000000000000000000000000000000000000000..81ed055e9d4305ef3acef7bb2fcc12e170c5f391 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sched.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sched.h new file mode 100644 index 0000000000000000000000000000000000000000..8d640ed0774f6849206ac778d2745a9c7aaf751b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sockets.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sockets.h new file mode 100644 index 0000000000000000000000000000000000000000..65b40ed58c5b1e69c383e2e12d5a972e1649e857 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sockets/posix.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sockets/posix.h new file mode 100644 index 0000000000000000000000000000000000000000..fde5b52fce0f39ea9457654d16fbbe4cf81eb339 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sockets/windows.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sockets/windows.h new file mode 100644 index 0000000000000000000000000000000000000000..2298cb83ec4931624a12c1b2b965feec025bb7aa --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/static_assert.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/static_assert.h new file mode 100644 index 0000000000000000000000000000000000000000..12477e5a1bd5fa2256c997885d1cf126c865c98f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/string.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/string.h new file mode 100644 index 0000000000000000000000000000000000000000..73ed0b9bc781343baa5f54339137dbfd18ab3652 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/strtod.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/strtod.h new file mode 100644 index 0000000000000000000000000000000000000000..b1d1b3d9e0793c94214b9b7035a929b6fe98c6dc --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/strtol.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/strtol.h new file mode 100644 index 0000000000000000000000000000000000000000..b80f0529c70431464dbac72d85c888385ddbe411 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sync.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sync.h new file mode 100644 index 0000000000000000000000000000000000000000..47916e4eb3c29ea4c3871b2b85d98377fc4225d7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sync/freertos.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sync/freertos.h new file mode 100644 index 0000000000000000000000000000000000000000..28b393fdf29dce212d9e3f3f3b9b742d5e704164 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sync/posix.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sync/posix.h new file mode 100644 index 0000000000000000000000000000000000000000..50bb11eab3366862832b55d6e57773fac781975c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sync/windows.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/sync/windows.h new file mode 100644 index 0000000000000000000000000000000000000000..eb9870282adea32e1960143e2ba6554f80647e10 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/threads.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/threads.h new file mode 100644 index 0000000000000000000000000000000000000000..e93329625822d0421fcddcf608fc37742f7e858b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/threads/freertos.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/threads/freertos.h new file mode 100644 index 0000000000000000000000000000000000000000..c8d126a1670e5f717d1f81ed9c10cf52f7f8a476 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/threads/posix.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/threads/posix.h new file mode 100644 index 0000000000000000000000000000000000000000..af3b7f66608739d7ec360bdb4404efa718119137 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/threads/windows.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/threads/windows.h new file mode 100644 index 0000000000000000000000000000000000000000..01c1e04cebf8da6fa7b93dca0ab878c3b9905532 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/time.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/time.h new file mode 100644 index 0000000000000000000000000000000000000000..f64ed5035cc395262c0dfdcbf70ff24a09c473bd --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/time/freertos.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/time/freertos.h new file mode 100644 index 0000000000000000000000000000000000000000..0aed9c5d041a1094da4f8ccae97dad3a92f0e25a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/types.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/types.h new file mode 100644 index 0000000000000000000000000000000000000000..9cbe97358e9fae39cb76cd8187441c4680131220 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/types/posix.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/types/posix.h new file mode 100644 index 0000000000000000000000000000000000000000..07731b34367e4e36501918bbdb16b047e0956e74 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/types/vxworks.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/types/vxworks.h new file mode 100644 index 0000000000000000000000000000000000000000..a52e65ea0870285f8f3c6403ab47f3702f3eed53 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/types/windows.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/types/windows.h new file mode 100644 index 0000000000000000000000000000000000000000..73c68c8101e79715b7939484716a13dd25a22780 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/xmlparser.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/ddsrt/xmlparser.h new file mode 100644 index 0000000000000000000000000000000000000000..62643c2cfa9af2a898a079b061dd1fd0c1826e69 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/export.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/export.h new file mode 100644 index 0000000000000000000000000000000000000000..9363496ed095da45169a057608b55d1f381156ea --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/features.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/features.h new file mode 100644 index 0000000000000000000000000000000000000000..51a728181e02ce2e165266492dd66259a6160c5a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/version.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/dds/version.h new file mode 100644 index 0000000000000000000000000000000000000000..3cbcc43dbcfcac4435d488dcd4c03a0502270a41 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddsc/dds.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddsc/dds.h new file mode 100644 index 0000000000000000000000000000000000000000..fcf3f9d1296c456237948652a01dff9082e6fb33 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/LICENSE b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..b353abd8ad7bec4d909c0ac0f2760a45f19e4170 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/BuiltinTopicTypes.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/BuiltinTopicTypes.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4ed147d135d84bafac1f217caab199f31b2ef1e2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Duration.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Duration.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5280f5e5f6eb31581c2fb145c343e6ce0b92a014 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Entity.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Entity.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e8c6867fd257c841a1adbceddc4509a4e9b91233 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Exception.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8599664e2d343ae12e7ed7dd91acdee08f6eda9c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/External.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/External.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5d88735eb491b118f2971413d38062f8d9658188 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/InstanceHandle.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/InstanceHandle.hpp new file mode 100644 index 0000000000000000000000000000000000000000..39fbca84614d801d4397d932243fb7609bb9c470 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/LengthUnlimited.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/LengthUnlimited.hpp new file mode 100644 index 0000000000000000000000000000000000000000..054242f59f08fd21a4f7f9e54a9ace6ba1c7ebe2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Optional.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Optional.hpp new file mode 100644 index 0000000000000000000000000000000000000000..93a95a39f9a4f0b5c11bc798b985f54ed4322b0d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/QosProvider.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/QosProvider.hpp new file mode 100644 index 0000000000000000000000000000000000000000..041e5b22fa782396ee61704085504a60be78e03c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Reference.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Reference.hpp new file mode 100644 index 0000000000000000000000000000000000000000..200760af165617b50325030830ff43fdc3cfa39e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/SafeEnumeration.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/SafeEnumeration.hpp new file mode 100644 index 0000000000000000000000000000000000000000..28075d77a81ef82d71daf7f974d6efa2c9ab491a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/TBuiltinTopicTypes.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/TBuiltinTopicTypes.hpp new file mode 100644 index 0000000000000000000000000000000000000000..67dbe6d5ca6dd72e9060e98069cb7e39b7ea3e22 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/TEntity.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/TEntity.hpp new file mode 100644 index 0000000000000000000000000000000000000000..94cdec4a449e8e1848861e283fb1307a0351c87a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/TEntityQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/TEntityQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..57f2dfb2bb5e11ddb145f224217fdf863c6fb7cb --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/TInstanceHandle.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/TInstanceHandle.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5ad36feebef8f82934b282ed01502f7b57d466ea --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/TQosProvider.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/TQosProvider.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2889d8f6b57bbdd9bd4728a9c3571a1eeaebe2ae --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Time.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Time.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7d4534c71f75bb2840a9bcd74c38a46261001610 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Value.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/Value.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ba2ecf241ddf99635a836df57b6bcb5765712b9c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/WeakReference.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/WeakReference.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fe2693827558b7b9f5b4779cbc8db1ea0d047527 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/array.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/array.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ecbf2e84c90147cdcda28e957af3677c831eff1c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/Condition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/Condition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1c0f4d51c725d0ab94bb253831782dc31f0ff331 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/GuardCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/GuardCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..81ecbb424dc85b761dc48643a28f05776a82483e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/StatusCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/StatusCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..237e06025063f3e2263213a8224719a8f2ce1a7b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/TCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/TCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a0b33be0f31e704f076fa4ebf20aa4b77a6667a1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/TGuardCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/TGuardCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8d60f33dd0d4d7935c42afb2719627371657a012 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/TStatusCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/TStatusCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a7574b971b91ce1b5826100790182d1c3ea9f3a7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/TWaitSet.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/TWaitSet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..60a44422e06193581b80b72f948e31dfa2c72b66 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/WaitSet.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/WaitSet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a8d7632468a813e10309d15c30f9ca26187be02a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/Condition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/Condition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f0b11dd9879287222f500f7801e2d7e9f73fccca --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/GuardCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/GuardCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..293651021fd287f4477b551d23dfbeef6d6b835d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/StatusCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/StatusCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..566b70f54362a13844bbf422b6b6bc1628c157e6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/TConditionImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/TConditionImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..da5adac44bea2a133cbebf6ce449e0d3e587c6b5 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/TGuardConditionImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/TGuardConditionImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b23d4418737e79dbffb3644efb52e62964830096 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/TStatusConditionImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/TStatusConditionImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..860c18d40f3bf63ba8f6340c58234c7099212fbc --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/TWaitSetImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/TWaitSetImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..88da4adc191844337f30906cae579877d716bab8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/WaitSet.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/cond/detail/WaitSet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a95ddac57e6b1dfb4e0d5359dfde5082eb1559a1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/conformance.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/conformance.hpp new file mode 100644 index 0000000000000000000000000000000000000000..db8c947ce7731198db9273192b10fd34dd70d612 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/ddscore.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/ddscore.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2847f38b9aab7dc38cb311286beb80362d86a0de --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/BuiltinTopicTypes.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/BuiltinTopicTypes.hpp new file mode 100644 index 0000000000000000000000000000000000000000..00715efa84e17f0e66174369598d0222d0de2327 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/Entity.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/Entity.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cec2f0df40459b47825f12e4243ca9434b0109f2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/InstanceHandle.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/InstanceHandle.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e86d0526e82ba813508182bbd910dee60e691b64 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/QosProvider.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/QosProvider.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ebc7ff15e87e0e6cfc25d0ba84786ad8aba5805f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/ReferenceImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/ReferenceImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ab909d49b3d4a13cf578e67996440175da8d3f9e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/TEntityImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/TEntityImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0b66869bd3222d369be29df5e8765686ef58cb45 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/TEntityQosImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/TEntityQosImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c262e6b4d5dad339c52ece7e5245ffe7b8e82ab7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/TInstanceHandleImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/TInstanceHandleImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..971eb1d1eadb982918495babd7ee4575ebe7b110 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/TQosProviderImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/TQosProviderImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cba63fd837fc01377a5d9abef54419c92280ebd5 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/Value.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/Value.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5a7c454c772356a8902f92bc1382ee645337c3c4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/WeakReferenceImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/WeakReferenceImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2ee8b16f83260e35ccbacd34f141beb31f433667 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/array.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/array.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fcb15123af3243e692e1870403b8e7296276f3c5 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/conformance.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/conformance.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9418f440fbc16bcaaf6176a7883f260b615bf152 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/ddscore.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/ddscore.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1e3645a31c27b962a0b2afa4c105271b1ef4a1d4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/export.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/export.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c2d9702d6341f5697d4c4dea45d03c60f8ae3b77 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/inttypes.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/inttypes.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a65f3a0ac87d6cbbd908c55cc89f9ac9164ea689 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/macros.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/macros.hpp new file mode 100644 index 0000000000000000000000000000000000000000..772fb8dabd7cf14fd25a36ee4550736a872b2cdb --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/module_docs.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/module_docs.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7409aad6844fba0f29478bec27dd93405f774ed1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/old_win_stdint.h b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/old_win_stdint.h new file mode 100644 index 0000000000000000000000000000000000000000..f7918b2f6ea3a55da279c374bab1148a542e67cf --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/ref_traits.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/detail/ref_traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ec36bd1d7c8ddede0c594794c63ef87bec7ad8ba --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/macros.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/macros.hpp new file mode 100644 index 0000000000000000000000000000000000000000..60ec85ebd04fb2ca495c8af0dbfb2480a2b8390b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/CorePolicy.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/CorePolicy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..789353807d86ab4891ea6c0840714a755c20f93a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/PolicyKind.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/PolicyKind.hpp new file mode 100644 index 0000000000000000000000000000000000000000..90ca22b7544f5c07cd3d94cc48974349344121a2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/QosPolicyCount.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/QosPolicyCount.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a73976b1ce91d07204965f0e1aaf7f82b63392fe --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/TCorePolicy.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/TCorePolicy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4faefc07d85b3d9d81be6006e29b962a59e39b4a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/TQosPolicyCount.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/TQosPolicyCount.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a7ecfa7613b3c1617c285115a0c7bcbd72d8ac84 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/detail/CorePolicy.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/detail/CorePolicy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ba3eefe2d636af174af29192894037d5015002f0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/detail/QosPolicyCount.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/detail/QosPolicyCount.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f76c83b7ec50aa9cec0bbbdcb608d5e57ec7a67d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/detail/TCorePolicyImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/detail/TCorePolicyImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..00c67aa66fe8834134f40efdcaf54239bc5065bc --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/detail/TQosPolicyCountImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/policy/detail/TQosPolicyCountImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9d029234a2adbb9d7cc247ed2608bf9d5a667ab0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/ref_traits.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/ref_traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7baecd22bf299e0fde599d89f7e478d6c540d0b4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/refmacros.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/refmacros.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7c9607393bac4d15c93d071825b61cdd255fc85f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/status/State.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/status/State.hpp new file mode 100644 index 0000000000000000000000000000000000000000..454fa26dfc9dc85ea0aabb1d77eda15a52e80c79 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/status/Status.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/status/Status.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c355839e974b4fd97474a03755cd9050b0e40cca --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/status/TStatus.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/status/TStatus.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e908dc7f7773d9fe4c918ef0709270d841e6b0f1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/status/detail/Status.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/status/detail/Status.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dacfd0f76ef3c614eaa4a155821972ec13b84e24 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/status/detail/TStatusImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/status/detail/TStatusImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..912d1887c50ef69e9551617e00de0b4f79475c95 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/types.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/types.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6189b5bc980c5611b3625bea80b07628c788a3c5 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/Annotations.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/Annotations.hpp new file mode 100644 index 0000000000000000000000000000000000000000..39195bcdb975b276a17a25955b18e4e45c42bbd1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/CollectionTypes.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/CollectionTypes.hpp new file mode 100644 index 0000000000000000000000000000000000000000..61ff764fdb64ede805105e024fc4ae4712343d93 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/DynamicData.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/DynamicData.hpp new file mode 100644 index 0000000000000000000000000000000000000000..df04b2c11489e0832a33bd9cbb8f2c76057207d1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/DynamicType.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/DynamicType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e1e63a3a9b37a3b1f8316eb16efcdc4f77d1dad1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/MemberType.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/MemberType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..524bca1e9d8fc2d2baba258e7a4eb6fe5ebb5dc4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/PrimitiveTypes.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/PrimitiveTypes.hpp new file mode 100644 index 0000000000000000000000000000000000000000..294d2c75ec23691cf758be5ff141522a656bf3bc --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/StructType.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/StructType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3785021c9b0ae2cd9d15a951cd356bd56a29bf92 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TAnnotation.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TAnnotation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..14203590b72494ca9166068d3d18d8b17905f106 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TCollectionTypes.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TCollectionTypes.hpp new file mode 100644 index 0000000000000000000000000000000000000000..86140a401be93dc3fd0ed8baf7b0caed9ca8a7f9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TDynamicData.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TDynamicData.hpp new file mode 100644 index 0000000000000000000000000000000000000000..20de7da2131b0f40568060cadfaa3307ac7d1b35 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TDynamicType.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TDynamicType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d532ad8d6111330a28c2ca565600bd9fae55424e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TMemberType.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TMemberType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c770e3be29baacb8019ad172b88f4f73ca1dc272 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TStructType.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TStructType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7b6f85912db4b619a328083ff635611f0fbe3ec5 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TTypeProvider.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TTypeProvider.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e89faa5e94b0fab359188bebff1fe383a7fa888c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TypeKind.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TypeKind.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a1c3a2f2356ab7f087a0ec37f962167f048b70de --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TypeProvider.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/TypeProvider.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4b94db7bfb8223fa207b802b3355a319a0b9171a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/UnionCase.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/UnionCase.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d6d21731ac09696375048fe9809340f583a99508 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/UnionType.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/UnionType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..197c241d806cfd94fdf8406f5a23034086cbdb2b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/Annotation.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/Annotation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4fcd272faa2f60f8d3d3e609fd8bd2d7668900d5 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/CollectionTypes.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/CollectionTypes.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5870947b6aa4409dc668c7add343aa0741e0cc6d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/DynamicData.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/DynamicData.hpp new file mode 100644 index 0000000000000000000000000000000000000000..92a5cbf325f9b31f27bb22087be92fa447e7c053 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/DynamicType.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/DynamicType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0770614354a2f6b87c18e8d6a49d59ba3fba7311 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/MemberType.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/MemberType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..32b985b283ce6fb565717e18be81445ed8934154 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/PrimitiveTypes.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/PrimitiveTypes.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9be5de46e2f6e2c8edad6783a9e5e948ce9b0bcd --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/StructType.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/StructType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8f5a0b0f422abca16fa03c35d2be71ae3ec80057 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/TypeProvider.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/TypeProvider.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cbdcc22501e1eb87097ab14ccf25fc790666e722 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/UnionCase.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/UnionCase.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fea22b4f64d58dd6709eb7c041934c99e5077abe --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/UnionType.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/core/xtypes/detail/UnionType.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5c0d080cf512824ac7a571ecc48392e41bdf9b66 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/dds.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/dds.hpp new file mode 100644 index 0000000000000000000000000000000000000000..28c9e0d5ba5e3b2a986c3aea74e3b08fc8ebc330 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/DomainParticipant.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/DomainParticipant.hpp new file mode 100644 index 0000000000000000000000000000000000000000..07c534c1078025bb2c0e2120283bf529fdfff576 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/DomainParticipantListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/DomainParticipantListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6a616859d33ad85c4387d2f877b42be4672811a1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/TDomainParticipant.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/TDomainParticipant.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3500d2a1d0484ca4157e985a410e3ed40e61f97e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/ddsdomain.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/ddsdomain.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3d865beaf06c7fe0412bf855fab41ba049269a41 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/detail/DomainParticipant.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/detail/DomainParticipant.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2c9003ae61362bf2ae01614be113c915aa5219c8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/detail/TDomainParticipantImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/detail/TDomainParticipantImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..40255a50ca203b55cd21ccaa309638bfe5c619c2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/detail/ddsdomain.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/detail/ddsdomain.hpp new file mode 100644 index 0000000000000000000000000000000000000000..55b058c4b30c91fef11411ec125a481386f0a477 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/discovery.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/discovery.hpp new file mode 100644 index 0000000000000000000000000000000000000000..34808f31b4fe23c24589c080ee40fad5ce676bd9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/find.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/find.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4149e0a6be8ffec69b06ecec6c07da4ff2bf6513 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/qos/DomainParticipantQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/qos/DomainParticipantQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2ca5437bf6b114e4378fd39b6a73f7fbc8f2fb73 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/qos/detail/DomainParticipantQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/domain/qos/detail/DomainParticipantQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1e851c4af99d62ab458ff4bae643bf8b1e48a256 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/features.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/features.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ed918bd23dc981d6717f6aa1d4b3d4d80ff12580 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/AnyDataWriter.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/AnyDataWriter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1662da47db23e61e41d28c2f4bba92942d2d8fe0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/AnyDataWriterListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/AnyDataWriterListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ba928fdab41de43da37fd1164765a15ca3035bb7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/CoherentSet.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/CoherentSet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8c6b65453ec2630c9f282c9c7ccadb54a2efac7e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/DataWriter.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/DataWriter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ca4b8871b07e946d7dee36f111e709ad3baa468b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/DataWriterListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/DataWriterListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9ccc3dae1d89e125de382705764a57d68daf94ec --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/Publisher.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/Publisher.hpp new file mode 100644 index 0000000000000000000000000000000000000000..720d0c28daaf5cb40dcd61f1ab008116b7a9196f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/PublisherListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/PublisherListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..209cbfd5537cd110cbdd74fdadb80e7e8fd2d9c3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/SuspendedPublication.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/SuspendedPublication.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f92139dae81d0ab15adeff3ca27879e5a574dc1d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/TAnyDataWriter.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/TAnyDataWriter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e27c7404856ade0d0f71a45ad62ef456fd9e4c8c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/TCoherentSet.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/TCoherentSet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..72f3b4655b66f3b72a1c01fc4d65948c6c3478a9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/TPublisher.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/TPublisher.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b1e4ea30a46ec63c344efde956f4138c488c0eda --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/TSuspendedPublication.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/TSuspendedPublication.hpp new file mode 100644 index 0000000000000000000000000000000000000000..05f1689a05a9299025f38bb6d88ba0cf734c79de --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/ddspub.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/ddspub.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d49b6523dea5b105372924d569797f3580706571 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/AnyDataWriter.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/AnyDataWriter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..44e16d4ab7901303cec698726505a41995a423d3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/CoherentSet.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/CoherentSet.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2a1c98ce3d868a86b86bc3d96b1801fe9866e01a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/DataWriter.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/DataWriter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1f329e67f70da9b9ae72d98e881cd3012f7ab57a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/DataWriterImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/DataWriterImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..70dff6737cd88972b308dd131197898e1d74b9cf --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/Publisher.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/Publisher.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c037889ad71347510e1019f5951460c6c571d5b2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/SuspendedPublication.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/SuspendedPublication.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ad5f198817a0fe01e9e9c0388761e6ceca241fbb --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/TAnyDataWriterImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/TAnyDataWriterImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..743770bac3205a5425367d08d9aa2114e79778d0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/TCoherentSetImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/TCoherentSetImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9b5cf23f5c3345aac65349ee879adb738d3fcd51 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/TPublisherImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/TPublisherImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0c7847ea94a22ac78d0501f35aa58e37a501f2e4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/TSuspendedPublicationImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/TSuspendedPublicationImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a6a9c81a96a3adf45041e991f856e9d137dda499 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/ddspub.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/ddspub.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1b8514a635adefed8cce8043fbf471ddae374f5f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/discovery.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/discovery.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0ba82a19a292bc11d19047ce3ba68e721027e582 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/find.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/detail/find.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dae1a76ed89bec7224a90f59032649f829ac0f29 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/discovery.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/discovery.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f884d958445cc7ad4901b9c920ac602935a67529 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/find.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/find.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1ce0ace22f2b3ac2662a24e226d4656ebd069fea --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/qos/DataWriterQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/qos/DataWriterQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e5f35acb2eb93989ec7a4c70282e8bb720ec8722 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/qos/PublisherQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/qos/PublisherQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6b018c3d3482900099a2c66d482e78896a6e8ff1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/qos/detail/DataWriterQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/qos/detail/DataWriterQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5034a423103dec49bc19f554140334eca614487b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/qos/detail/PublisherQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/pub/qos/detail/PublisherQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c5ddb2487af611b1f6a10c3c164f135da95044b1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/AnyDataReader.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/AnyDataReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f3d1710378a8c3432c37d0f63132af5c478b8008 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/AnyDataReaderListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/AnyDataReaderListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4cd7799c7e44b2eafb739e8b511219b9ed718a5e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/CoherentAccess.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/CoherentAccess.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cb8f9e16c7cfe0399902280de12b04dd418a8d28 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/DataReader.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/DataReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7043b63ca7d717f28ba149b1a7dbfeec3790baf1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/DataReaderListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/DataReaderListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..497f9ba3814d70ea0216207446a8c6d2f08e80b8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/GenerationCount.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/GenerationCount.hpp new file mode 100644 index 0000000000000000000000000000000000000000..40b4754e966a1715da96caf4cb904792387fc8bf --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/LoanedSamples.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/LoanedSamples.hpp new file mode 100644 index 0000000000000000000000000000000000000000..de74e12235a4718ee46a7e3da680170e017d4076 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/Query.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/Query.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8306e7a688a0794973ec67f5087302848b0fad99 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/Rank.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/Rank.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d61b5e791a5d8260b1e3a829e9e5160113a61ee1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/Sample.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/Sample.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3194fbcd465d6709c8a60006c367e4e0ed7a970c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/SampleInfo.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/SampleInfo.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d5a1280a75b9fed4fc527959342e3a7258aa2674 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/SampleRef.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/SampleRef.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eee3922093e61894c0f863653bd7e49448f0cf84 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/SharedSamples.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/SharedSamples.hpp new file mode 100644 index 0000000000000000000000000000000000000000..64ed71ded1370ba7276997f8cf086ee692b6082e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/Subscriber.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/Subscriber.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d2a723013fa60ee6d2702525079b6292b5d81dd9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/SubscriberListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/SubscriberListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9dab7cfc8304c1db1f189534128eddba9b0fd96a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TAnyDataReader.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TAnyDataReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..496a2bc399b6ba6e49a9e525d6c7977ffec831a9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TCoherentAccess.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TCoherentAccess.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c30d5612b8d6696a55b36e8a139fcfa6f25c1ce7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TDataReader.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TDataReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..69a3616c1323aa927f3ffc195a6fa67614f5a320 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TGenerationCount.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TGenerationCount.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f62cef22545535578bda4d04d666f80c4c0f3e69 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TQuery.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TQuery.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f80ff7d0eee8e20cb1f8c573d90dbc767d4d96f7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TRank.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TRank.hpp new file mode 100644 index 0000000000000000000000000000000000000000..38a8b1f84bc5445d452302ebe1a80fcbbf4d640d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TSample.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TSample.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b8683f96ea2ca226fc7c0043f4a53d1bfaf4281e --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TSampleInfo.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TSampleInfo.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ac5e537bb6f4dc12b228df56b4733961cd050077 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TSampleRef.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TSampleRef.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c7c89d196a61f8966a9e1301c98640afaffc872c --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TSubscriber.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/TSubscriber.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3bb294db55f36ffcb30e2d3a78b23d8676dddbab --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/QueryCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/QueryCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..080b956d1e93f03798131ee2203eb650fac715d1 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/ReadCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/ReadCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..98bb6836309009cd2ffd68df60f656f0371b792a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/TQueryCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/TQueryCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e2d19bff2f5f9b55dc10d76b2bafb0b3a116858a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/TReadCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/TReadCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bcd7b06094af88d25bc5d6c9b9cb57a78e97fa34 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/detail/QueryCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/detail/QueryCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c66197aeb9deb07d3ab07e5beaa892403c48f9ed --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/detail/ReadCondition.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/detail/ReadCondition.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bb36f27ec3eee795f6c002f3d964459f832309be --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/detail/TQueryConditionImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/detail/TQueryConditionImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..aa12808c2d7396efb13b0e20850fe520a1daeb4b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/detail/TReadConditionImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/cond/detail/TReadConditionImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..037e09921e193539aa9ef25afc1a2d75e537081f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/ddssub.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/ddssub.hpp new file mode 100644 index 0000000000000000000000000000000000000000..10484bb81d1ec6ecb1ef2425d4bb76d37050bfde --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/AnyDataReader.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/AnyDataReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9c40abed93ca81c53a533453ca7d30d300525122 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/CoherentAccess.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/CoherentAccess.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a9b2bf65fd43b013dade1306ce41771929a7cd51 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/DataReader.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/DataReader.hpp new file mode 100644 index 0000000000000000000000000000000000000000..59556a4f5b8946c8e1fa0a5e8779ffd619cf2fcd --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/GenerationCount.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/GenerationCount.hpp new file mode 100644 index 0000000000000000000000000000000000000000..65437b231ef4bd302907fa3104ea258ba7b4c866 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/LoanedSamples.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/LoanedSamples.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fffaa69eed0da3447be00154e776fb036d4e411a --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/LoanedSamplesImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/LoanedSamplesImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..eeabfa21c65ae4cc769699727fdf7af8a7da9474 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/Manipulators.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/Manipulators.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3954c69dd8da03397d7c34fa8dafa94931a05118 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/Query.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/Query.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b801de424fbd5d6a7940d139c0b19392d63155e9 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/Rank.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/Rank.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4b8fb53307ae99624fc883f600f1a6ee8f6c3c03 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/Sample.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/Sample.hpp new file mode 100644 index 0000000000000000000000000000000000000000..be26e1ba79bfe8251a355492273bba2f264115e2 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/SampleInfo.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/SampleInfo.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ba45c0343131a2bd63b7ee96ba411b78043d7f55 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/SampleRef.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/SampleRef.hpp new file mode 100644 index 0000000000000000000000000000000000000000..73c8c5f028c586bed8b9835c62cf68ddbfabcd30 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/SamplesHolder.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/SamplesHolder.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e94e56b5368c017ba4d29375b070b586de05815d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/SharedSamples.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/SharedSamples.hpp new file mode 100644 index 0000000000000000000000000000000000000000..76058fa4e455363684afec0213be5a0d1d7baa5f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/SharedSamplesImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/SharedSamplesImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e51ff061fc8d22b71a74ef6344d3a0c981fdf1b0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/Subscriber.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/Subscriber.hpp new file mode 100644 index 0000000000000000000000000000000000000000..99b212539168df75290ef9c5fca49a6db6b9b29d --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TAnyDataReaderImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TAnyDataReaderImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f89e47b873580c9936d5754cc4293ada58bf20d3 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TCoherentAccessImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TCoherentAccessImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..375450d5639fb083af717b354286e8d06d63c666 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TDataReaderImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TDataReaderImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f4193937c3d417a4d5f427d70aa9564daff8e690 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TGenerationCountImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TGenerationCountImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3ff45fac37175a1141f7c5e98e0d15574c2e6b48 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TQueryImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TQueryImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6a36c56086b3d521224d3b8d50e560ddb5d9bc02 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TRankImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TRankImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1a17572d4b899d6cf5abdfe7d009f68fe15c8705 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TSampleImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TSampleImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d0bc82666b025d8b909f6f37f9588003fcbf48b4 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TSampleInfoImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TSampleInfoImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..306db46afee15d04ab6c83463719606ee90c26d0 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TSampleRefImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TSampleRefImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fbf91990389bc5f9fdc7c2a6faf898c8f81d648f --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TSubscriberImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/TSubscriberImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..98c8438143610ed00a138cfdfeb95df296e3d1b6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/ddssub.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/ddssub.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a9b4a5b9fe3a14541f6628bb871178b2dd582648 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/discovery.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/discovery.hpp new file mode 100644 index 0000000000000000000000000000000000000000..97ac59c83fdd4cdfe695ac3adfa269197348ec36 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/find.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/detail/find.hpp new file mode 100644 index 0000000000000000000000000000000000000000..21aee6ecc4461aadd53e2756cfac337636a61b55 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/discovery.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/discovery.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f3628bcc0524a911b0c75ce1b01fd25762c942b8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/find.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/find.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d1cea5ac449bbe5177db2a399f35442a3ffc82bf --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/qos/DataReaderQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/qos/DataReaderQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..967a50307ce94b37f11b54c3b6617c4551df2884 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/qos/SubscriberQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/qos/SubscriberQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7397c1243d94b3398b3328fdbdb77f34b1e38e20 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/qos/detail/DataReaderQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/qos/detail/DataReaderQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3b1821e8b31090b384254598de2c516d00279c89 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/qos/detail/SubscriberQos.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/qos/detail/SubscriberQos.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6a6fc36f8d84ead9e2361a28abbedc09f8143a67 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/status/DataState.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/status/DataState.hpp new file mode 100644 index 0000000000000000000000000000000000000000..727c826fc482b08c878159b975dfa14207c029be --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/status/detail/DataStateImpl.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/sub/status/detail/DataStateImpl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..88ee4a92d8fb3be1dfab3f743e6400063611acbc --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/AnyTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/AnyTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..81e610eec5957d1b82b0e8078829888f7f6e6ef6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/AnyTopicListener.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/AnyTopicListener.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ae7425137170e6053bbba40199f7fb4173450f2b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/BuiltinTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/BuiltinTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ddf08c5274b7fb71a97b695411ba3118cc61e42b --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/BuiltinTopicKey.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/BuiltinTopicKey.hpp new file mode 100644 index 0000000000000000000000000000000000000000..104b7f1386676fa9aac4c91279bc3bd4e594f7e7 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/ContentFilteredTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/ContentFilteredTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..279e092ef3cef2fe04aef2b66c18a6b38b6f41c6 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/Filter.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/Filter.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d458aaef3214b47bec2b00d9dc1c0ad1dce549f8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/MultiTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/MultiTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a5c1d7db88f2f96b168738e41a57a1f90e522c64 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TAnyTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TAnyTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2ad1b6a1eddab6c467a9b5c0286c962c44ae3b99 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TBuiltinTopic.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TBuiltinTopic.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6f59618b54884c51e260092507bb2be139da82b8 --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TBuiltinTopicKey.hpp b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TBuiltinTopicKey.hpp new file mode 100644 index 0000000000000000000000000000000000000000..354c1bce1cb32d78ded87e96fadc3ee5a95e5bdb --- /dev/null +++ b/third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/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_ */