Holoscan SDK v4.2.0

Template Class HoloEntitySerializerBase

Base Type

  • public nvidia::gxf::PubSubEntitySerializer

template<typename EndpointT>
class HoloEntitySerializerBase : public nvidia::gxf::PubSubEntitySerializer

Shared HOLO/NDPL entity serializer core, parameterized on the endpoint type.

Implements the full PubSubEntitySerializer interface: entity serialize/deserialize using the “HOLO” wire format, and native-descriptor export/import using the NDPL envelope. Subclasses only provide the constructor (passing endpoint type and name).

EndpointT must provide: write(), read(), write_trivial_type(), read_trivial_type(), bytes_written(), bytes_remaining(), and constructors from vector<uint8_t>* (write), const vector<uint8_t>* (read), and (uint8_t*, size_t) (write into buffer).

Public Types

enum class ComponentType : uint32_t

Values:

enumerator kUnknown
enumerator kTensor
enumerator kTimestamp
enumerator kMessage
enumerator kMetadataDictionary
enumerator kMessageLabel

Public Functions

~HoloEntitySerializerBase() override = default
HoloEntitySerializerBase(const HoloEntitySerializerBase&) = delete
HoloEntitySerializerBase &operator=(const HoloEntitySerializerBase&) = delete
nvidia::gxf::Expected<std::vector<uint8_t>> serialize(nvidia::gxf::Entity entity, nvidia::gxf::Handle<nvidia::gxf::Allocator> allocator = nvidia::gxf::Handle<nvidia::gxf::Allocator>()) override
nvidia::gxf::Expected<size_t> serialize_into(nvidia::gxf::Entity entity, uint8_t *buffer, size_t buffer_size, nvidia::gxf::Handle<nvidia::gxf::Allocator> allocator = nvidia::gxf::Handle<nvidia::gxf::Allocator>()) override
nvidia::gxf::Expected<nvidia::gxf::Entity> deserialize(const std::vector<uint8_t> &data, gxf_context_t context, nvidia::gxf::Handle<nvidia::gxf::Allocator> allocator) override
size_t estimate_size(nvidia::gxf::Entity entity) override
inline bool supports_gpu_tensors() const override
inline bool supports_zero_copy() const override
inline bool supports_direct_buffer_serialization() const override
inline bool supports_native_descriptors() const override
nvidia::gxf::Expected<void> export_native_descriptor(gxf_uid_t entity_uid, gxf_context_t context, nvidia::gxf::Handle<nvidia::gxf::Allocator> allocator, nvidia::gxf::NativeDescriptorPayload &out_payload, const std::string &protocol_name = "") override
nvidia::gxf::Expected<nvidia::gxf::Entity> import_native_descriptor(const nvidia::gxf::NativeDescriptorPayload &payload, gxf_context_t context, nvidia::gxf::Handle<nvidia::gxf::Allocator> allocator) override
inline const char *name() const override
inline void set_native_buffer_adapter(std::shared_ptr<NativeBufferProtocolAdapter> adapter)
inline void set_cuda_stream(cudaStream_t stream)
inline cudaStream_t cuda_stream() const

Public Static Attributes

static constexpr uint32_t kFlagIsGpuTensor = 0x01

Protected Functions

inline explicit HoloEntitySerializerBase(std::string serializer_name, cudaStream_t cuda_stream = nullptr)

Protected Attributes

std::string serializer_name_

struct ComponentHeader

Public Members

uint32_t type_id = 0
uint32_t name_length = 0
uint32_t data_size = 0
uint32_t flags = 0

struct SerializationHeader

Public Members

uint32_t magic = 0x484F4C4F
uint32_t version = 1
uint32_t num_components = 0
uint32_t flags = 0
uint64_t total_size = 0

struct TensorMetadata

Public Members

uint32_t rank = 0
uint32_t element_type = 0
uint32_t storage_type = 0
uint64_t bytes_per_element = 0
uint64_t total_bytes = 0
uint64_t shape[8] = {0}
uint64_t strides[8] = {0}

Previous Class GXFComponentResource
Next Template Class HoloIpcCudaNativeBufferAdapterBase
© Copyright 2022-2026, NVIDIA. Last updated on May 11, 2026