Accelerated Computation Engine
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
EAbstractAnalytic::Block Class Reference

#include <eabstractanalytic_block.h>

Inheritance diagram for EAbstractAnalytic::Block:

Public Member Functions

 Block ()=default
 
 Block (int index)
 
int index () const
 
QByteArray toBytes () const
 
template<class T >
const T * cast () const
 
void fromBytes (const QByteArray &data)
 
template<class T >
T * cast ()
 

Static Public Member Functions

static int extractIndex (const QByteArray &data)
 

Protected Member Functions

virtual void write (QDataStream &stream) const
 
virtual void read (QDataStream &stream)
 

Friends

EDebugoperator<< (EDebug &, const EAbstractAnalytic::Block *const)
 

Detailed Description

This represents a block of work or results that an analytic produces and consumes. This class handles storing the data needed for work and result blocks for an analytic. This also handles the conversion to and from a byte array so blocks can be communicated between different processes if MPI or chunk running is used.

Constructor & Destructor Documentation

◆ Block() [1/2]

EAbstractAnalytic::Block::Block ( )
explicitdefault

Constructs an uninitialized block. This is used in MPI and chunk runs to load blocks from byte arrays.

◆ Block() [2/2]

EAbstractAnalytic::Block::Block ( int  index)
explicit

Constructs a new block with the given index.

Parameters
indexThe index for this new block.

Member Function Documentation

◆ cast() [1/2]

template<class T >
const T * EAbstractAnalytic::Block::cast ( ) const

Casts this abstract block object into another constant class type.

Template Parameters
TThe type this abstract block is being cast to. This should be this block's implementation type.
Returns
Cast constant pointer to this object.

◆ cast() [2/2]

template<class T >
T * EAbstractAnalytic::Block::cast ( )

Casts this abstract block object into another class type.

Template Parameters
TThe type this abstract block is being cast to. This should be this block's implementation type.
Returns
Cast pointer to this object.

◆ extractIndex()

int EAbstractAnalytic::Block::extractIndex ( const QByteArray &  data)
static

Extracts the index from a byte array created from a to bytes method call of this class. This is used to extract special codes used in MPI.

Parameters
data
Returns
Index or special code of block byte array.

◆ fromBytes()

void EAbstractAnalytic::Block::fromBytes ( const QByteArray &  data)

Read in new data from the given byte array for this block, overwriting any previous data, including the data of this block's implementation.

Parameters
data

◆ index()

int EAbstractAnalytic::Block::index ( ) const

Returns the index of this block.

Returns
Index of this block.

◆ read()

void EAbstractAnalytic::Block::read ( QDataStream &  stream)
protectedvirtual

This interface reads in new data from the given byte array, overwriting any data it previously contained. The default implementation does nothing.

Parameters
streamThe data stream that is used to read in this block's implementation data.

◆ toBytes()

QByteArray EAbstractAnalytic::Block::toBytes ( ) const

Returns a byte array that contains all this blocks information. This includes any implementation's data.

Returns
Byte array containing all data of this block.

◆ write()

void EAbstractAnalytic::Block::write ( QDataStream &  stream) const
protectedvirtual

This interface writes out its data to the given qt data stream. The default implementation does nothing.

Parameters
streamThe data stream that is used to write out this block's implementation data.

Friends And Related Function Documentation

◆ operator<<

EDebug& operator<< ( EDebug ,
const EAbstractAnalytic::Block const 
)
friend

Writes a abstract analytic block object to the debug stream for debugging output.

Parameters
debugThe debug object which has the given abstract analytic block value streamed to it.
valueThe abstract analytic object that is streamed to the given debug object.
Returns
Reference to the debug object.

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