conduit 0.6.0
Modern C++23 header-only event-dispatching / event-transport library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
conduit::EventRegistry Class Reference

Registers event cells for wire decoding. More...

#include <serialization.hpp>

Public Member Functions

 EventRegistry ()
 
 EventRegistry (const EventRegistry &other)
 
 EventRegistry (EventRegistry &&) noexcept=delete
 
EventRegistryoperator= (const EventRegistry &)=delete
 
EventRegistryoperator= (EventRegistry &&) noexcept=delete
 
 ~EventRegistry ()=default
 
template<typename T >
EventRegistryadd ()
 Register the descriptor for an event type T (i.e.
 
EventRegistryadd_descriptor (parcel::cell_type_descriptor_t desc)
 Register a previously-resolved cell descriptor.
 
EventEnvelope decode_json (parcel::json_t const &j) const
 
EventEnvelope decode_cbor (std::span< const std::uint8_t > bytes) const
 
EventEnvelope decode_cbor (std::span< const char > bytes) const
 
std::shared_ptr< const parcel::ParcelRegistry > parcel_registry_snapshot () const noexcept
 Snapshot accessor for the underlying parcel registry.
 

Detailed Description

Registers event cells for wire decoding.

Wraps a parcel::ParcelRegistry, pre-registers the envelope cell and conduit's auxiliary cells, and exposes thin decode_json / decode_cbor helpers that always return an EventEnvelope.

add_descriptor is safe to call concurrently with decode_json / decode_cbor: a writer builds a fresh inner registry from the current snapshot under a unique lock, then swaps the active shared_ptr so readers (which take a shared lock just long enough to copy the handle) always observe a self-consistent state.

Constructor & Destructor Documentation

◆ EventRegistry() [1/3]

conduit::EventRegistry::EventRegistry ( )
inline

◆ EventRegistry() [2/3]

conduit::EventRegistry::EventRegistry ( const EventRegistry other)
inline

◆ EventRegistry() [3/3]

conduit::EventRegistry::EventRegistry ( EventRegistry &&  )
deletenoexcept

◆ ~EventRegistry()

conduit::EventRegistry::~EventRegistry ( )
default

Member Function Documentation

◆ add()

template<typename T >
EventRegistry & conduit::EventRegistry::add ( )
inline

Register the descriptor for an event type T (i.e.

a class derived from conduit::Event<T, Name>).

◆ add_descriptor()

EventRegistry & conduit::EventRegistry::add_descriptor ( parcel::cell_type_descriptor_t  desc)
inline

Register a previously-resolved cell descriptor.

Safe to call from any thread; concurrent readers see a self-consistent registry throughout the swap.

◆ decode_cbor() [1/2]

EventEnvelope conduit::EventRegistry::decode_cbor ( std::span< const char >  bytes) const
inline

◆ decode_cbor() [2/2]

EventEnvelope conduit::EventRegistry::decode_cbor ( std::span< const std::uint8_t >  bytes) const
inline

◆ decode_json()

EventEnvelope conduit::EventRegistry::decode_json ( parcel::json_t const &  j) const
inline

◆ operator=() [1/2]

EventRegistry & conduit::EventRegistry::operator= ( const EventRegistry )
delete

◆ operator=() [2/2]

EventRegistry & conduit::EventRegistry::operator= ( EventRegistry &&  )
deletenoexcept

◆ parcel_registry_snapshot()

std::shared_ptr< const parcel::ParcelRegistry > conduit::EventRegistry::parcel_registry_snapshot ( ) const
inlinenoexcept

Snapshot accessor for the underlying parcel registry.

The returned shared_ptr pins one self-consistent registry version for its lifetime, even while add_descriptor concurrently swaps in newer versions.


The documentation for this class was generated from the following file: