fpmas 1.6
Public Member Functions | Public Attributes | List of all members
fpmas::api::communication::DataPack Class Reference

#include <communication.h>

Public Member Functions

 DataPack (std::size_t count, std::size_t data_size)
 
 DataPack ()
 
 DataPack (const DataPack &other)
 
 DataPack (DataPack &&other)
 
DataPackoperator= (const DataPack &other)
 
DataPackoperator= (DataPack &&other)
 
void resize (std::size_t count)
 
void free ()
 
 ~DataPack ()
 

Public Attributes

std::size_t size
 
std::size_t count
 
std::size_t data_size
 
char * buffer
 

Detailed Description

A convenient wrapper for void* buffers used in MPI functions.

Constructor & Destructor Documentation

◆ DataPack() [1/4]

fpmas::api::communication::DataPack::DataPack ( std::size_t  count,
std::size_t  data_size 
)
inline

Allocates a buffer of count items of size data_size.

◆ DataPack() [2/4]

fpmas::api::communication::DataPack::DataPack ( )
inline

Allocates a void buffer, of size 0.

◆ DataPack() [3/4]

fpmas::api::communication::DataPack::DataPack ( const DataPack other)
inline

Copy constructor.

Allocates a buffer of the same size as other, and copies data from other's buffer to this buffer.

Parameters
otherDataPack to copy from

◆ DataPack() [4/4]

fpmas::api::communication::DataPack::DataPack ( DataPack &&  other)
inline

Move constructor.

Moves other's buffer tothis` buffer.

Parameters
otherDataPack to move from

◆ ~DataPack()

fpmas::api::communication::DataPack::~DataPack ( )
inline

Frees the internal buffer.

Member Function Documentation

◆ operator=() [1/2]

DataPack & fpmas::api::communication::DataPack::operator= ( const DataPack other)
inline

Copy assignment.

Frees this buffer, and copies other's buffer into this buffer.

Parameters
otherDataPack to copy from

◆ operator=() [2/2]

DataPack & fpmas::api::communication::DataPack::operator= ( DataPack &&  other)
inline

Move assignment.

Frees this buffer, and moves other's buffer into this buffer.

Parameters
otherDataPack to move from

◆ resize()

void fpmas::api::communication::DataPack::resize ( std::size_t  count)
inline

Resizes the internal buffer so that it can contain count item.

The new buffer size is count * data_size.

Bytes in range [0, min(this->count, count)) are left unchanged, as specified by the std::realloc() standard method.

Parameters
countnew item count

◆ free()

void fpmas::api::communication::DataPack::free ( )
inline

Frees the internal buffer.

Member Data Documentation

◆ size

std::size_t fpmas::api::communication::DataPack::size

Size of the buffer in bytes.

size = count * data_size

◆ count

std::size_t fpmas::api::communication::DataPack::count

Items count in the buffer.

◆ data_size

std::size_t fpmas::api::communication::DataPack::data_size

Size of each item, so that size = cound * data_size.

◆ buffer

char* fpmas::api::communication::DataPack::buffer

Pointer to the internal buffer.


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