RTI Connext Modern C++ API Version 7.3.0
rti::core::Cookie Class Reference

Unique identifier for a written data sample in the form of a sequence of bytes. More...

#include <rti/core/Cookie.hpp>

Public Member Functions

 Cookie ()
 Creates an empty cookie. More...
 
template<typename ByteContainer >
 Cookie (const ByteContainer &bytes)
 Creates a new cookie with the bytes inside a container. More...
 
dds::core::vector< uint8_t > & value ()
 Retrieves a reference to the vector of bytes. More...
 
const dds::core::vector< uint8_t > & value () const
 Retrieves a const reference to the vector of bytes. More...
 
template<typename T >
T * to_pointer () const
 Converts a cookie into a pointer. More...
 

Related Functions

(Note that these are not member functions.)

typedef dds::core::vector< CookieCookieSeq
 A sequence of Cookie objects. More...
 
std::ostream & operator<< (std::ostream &out, const Cookie &cookie)
 Prints a Cookie to an output stream. More...
 

Detailed Description

Unique identifier for a written data sample in the form of a sequence of bytes.

See also
dds::pub::DataWriter::write(const T&, rti::pub::WriteParams&)

Constructor & Destructor Documentation

◆ Cookie() [1/2]

rti::core::Cookie::Cookie ( )
inline

Creates an empty cookie.

◆ Cookie() [2/2]

template<typename ByteContainer >
rti::core::Cookie::Cookie ( const ByteContainer &  bytes)
inlineexplicit

Creates a new cookie with the bytes inside a container.

Member Function Documentation

◆ value() [1/2]

dds::core::vector< uint8_t > & rti::core::Cookie::value ( )

Retrieves a reference to the vector of bytes.

◆ value() [2/2]

const dds::core::vector< uint8_t > & rti::core::Cookie::value ( ) const

Retrieves a const reference to the vector of bytes.

◆ to_pointer()

template<typename T >
T * rti::core::Cookie::to_pointer ( ) const
inline

Converts a cookie into a pointer.

Utility function that allows retrieving a pointer stored in a cookie.

Precondition
The cookie's value was filled with a pointer, otherwise the value returned may not be a valid memory address.
Template Parameters
TThe pointer type
Returns
The pointer this cookie represents

Friends And Related Function Documentation

◆ CookieSeq

A sequence of Cookie objects.

◆ operator<<()

std::ostream & operator<< ( std::ostream &  out,
const Cookie cookie 
)
related

Prints a Cookie to an output stream.