All Classes Namespaces Functions Variables Typedefs Enumerations Friends
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ucxx::Header Class Reference

A serializable object containing metadata of multiple buffers. More...

#include <header.h>

Public Member Functions

 Header (bool next, size_t nframes, int *isCUDA, size_t *size)
 Constructor of a fixed-size header. More...
 
 Header (std::string serializedHeader)
 Constructor of a fixed-size header from serialized data. More...
 
const std::string serialize () const
 Get the serialized data. More...
 

Static Public Member Functions

static size_t dataSize ()
 Get the size of the underlying data. More...
 
static std::vector< HeaderbuildHeaders (const std::vector< size_t > &size, const std::vector< int > &isCUDA)
 Convenience method to build headers given arbitrary-sized input. More...
 

Public Attributes

bool next
 Whether there is a next header.
 
size_t nframes
 Number of frames.
 
std::array< int, HeaderFramesSizeisCUDA
 Flag for whether each frame is CUDA or host.
 
std::array< size_t, HeaderFramesSizesize
 Size in bytes of each frame.
 

Detailed Description

A serializable object containing metadata of multiple buffers.

A serializable object containing metadata of a pre-defined number of buffers used to inform the remote endpoint of multiple incoming messages from buffers of given properties.

Constructor & Destructor Documentation

◆ Header() [1/2]

ucxx::Header::Header ( bool  next,
size_t  nframes,
int *  isCUDA,
size_t *  size 
)

Constructor of a fixed-size header.

Constructor of a fixed-size header used to transmit pre-defined information about frames that the receiver does not need to know anything about.

This constructores receives a flag next indicating whether the next message the receiver should expect is another header (in case the number of frames is larger than the pre-defined size), the number of frames nframes it contains information for, and pointers to nframes arrays of whether each frame is CUDA (isCUDA == true) or host (isCUDA == false) and the size size of each frame in bytes.

Parameters
[in]nextwhether the receiver should expect a next header.
[in]nframesthe number of frames the header contains information for (must be lower or equal than HeaderFramesSize).
[in]isCUDAarray with length nframes containing flag of whether each of the frames being transferred are CUDA (true) or host (false).
[in]sizearray with length nframes containing the size in bytes of each frame.

◆ Header() [2/2]

ucxx::Header::Header ( std::string  serializedHeader)
explicit

Constructor of a fixed-size header from serialized data.

Reconstruct (i.e., deserialize) a fixed-size header from serialized data.

Parameters
[in]serializedHeaderthe header in serialized format.

Member Function Documentation

◆ buildHeaders()

static std::vector<Header> ucxx::Header::buildHeaders ( const std::vector< size_t > &  size,
const std::vector< int > &  isCUDA 
)
static

Convenience method to build headers given arbitrary-sized input.

Convenience method to build one or more headers given arbitrary-sized input size and isCUDA vectors.

Parameters
[in]isCUDAvector containing flag of whether each frame being transferred are CUDA (1) or host (0).
[in]sizevector containing the size in bytes of eachf frame.
Returns
A vector of one or more ucxx::Header objects.

◆ dataSize()

static size_t ucxx::Header::dataSize ( )
static

Get the size of the underlying data.

Get the size of the underlying data, in other words, the size of a serialized ucxx::Header ready for transfer.

Returns
the size of the underlying data.

◆ serialize()

const std::string ucxx::Header::serialize ( ) const

Get the serialized data.

Get the serialized data ready for transfer.

Returns
the serialized data.

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