Struct TopicHolder

Struct Documentation

struct TopicHolder

Auxiliary struct to cleanup a topic created during entity creation. It is similar to a unique_ptr and its custom deleter at the same time.

The creation process of an entity should be as follows:

  • find_and_check_topic_and_type is called

  • If the type is not found, it is created and registered

  • cast_or_create_topic is called on a stack-allocated TopicHolder

  • An early return will delete the topic if necessary

  • create_datawriter or create_datareader is called

  • Rest of the initialization process is performed

  • Before correctly returning the created entity, field should_be_deleted is set to false to avoid deletion of the topic

Public Functions

inline ~TopicHolder()

Public Members

eprosima::fastdds::dds::DomainParticipant *participant = nullptr
eprosima::fastdds::dds::TopicDescription *desc = nullptr
eprosima::fastdds::dds::Topic *topic = nullptr
bool should_be_deleted = false