Project
Loading...
Searching...
No Matches
o2::gpu::FlatObject Class Reference

GPUCA_GPUCODE. More...

#include <FlatObject.h>

Inherited by o2::gpu::NDPiecewisePolynomials< FDim, FDegree, false >, o2::base::MatLayerCyl, o2::base::MatLayerCylSet, o2::gpu::IrregularSpline1D, o2::gpu::IrregularSpline2D3D, o2::gpu::MultivariatePolynomial< Dim, Degree, InteractionOnly >, o2::gpu::NDPiecewisePolynomials< Dim, Degree, InteractionOnly >, o2::gpu::SemiregularSpline2D3D, o2::gpu::Spline1DContainer< DataT >, o2::gpu::Spline2DContainer< DataT >, o2::gpu::SplineContainer< DataT >, o2::gpu::TPCFastSpaceChargeCorrection, o2::gpu::TPCFastTransform, o2::tpc::CalibdEdxContainer, o2::tpc::CalibdEdxTrackTopologyPol, o2::tpc::CalibdEdxTrackTopologySpline, and o2::trd::GeometryFlat.

Public Member Functions

 FlatObject ()=default
 _____________ Constructors / destructors __________________________
 
 ~FlatObject ()
 
 FlatObject (const FlatObject &)=delete
 
FlatObjectoperator= (const FlatObject &)=delete
 
void destroy ()
 _______________ Utilities _______________________________________________
 
size_t getFlatBufferSize () const
 Gives size of the flat buffer.
 
const chargetFlatBufferPtr () const
 Gives pointer to the flat buffer.
 
bool isConstructed () const
 Tells if the object is constructed.
 
bool isBufferInternal () const
 Tells if the buffer is internal.
 
void adoptInternalBuffer (char *buf)
 
void clearInternalBufferPtr ()
 
void printC () const
 Print the content of the flat buffer.
 

Static Public Member Functions

static size_t alignSize (size_t sizeBytes, size_t alignmentBytes)
 _______________ Generic utilities _______________________________________________
 
template<class T >
static T * relocatePointer (const char *oldBase, char *newBase, const T *ptr)
 Relocates a pointer inside a buffer to the new buffer address.
 
template<class T , class TFile >
static int32_t writeToFile (T &obj, TFile &outf, const char *name)
 write a child class object to the file
 
template<class T , class TFile >
static T * readFromFile (TFile &inpf, const char *name)
 read a child class object from the file
 
template<class T >
static std::string stressTest (T &obj)
 Test the flat object functionality for a child class T.
 

Protected Types

enum  ConstructionState : uint32_t { NotConstructed = 0x0 , Constructed = 0x1 , InProgress = 0x2 }
 GPUCA_GPUCODE. More...
 

Protected Member Functions

void startConstruction ()
 _____________ Construction _________
 
void finishConstruction (int32_t flatBufferSize)
 
void cloneFromObject (const FlatObject &obj, char *newFlatBufferPtr)
 
charreleaseInternalBuffer ()
 _____________ Methods for making the data buffer external __________________________
 
void moveBufferTo (char *newBufferPtr)
 
void setActualBufferAddress (char *actualFlatBufferPtr)
 _____________ Methods for moving the class with its external buffer to another location __________________________
 
void setFutureBufferAddress (char *futureFlatBufferPtr)
 
 ClassDefNV (FlatObject, 1)
 Pointer to the flat buffer.
 

Static Protected Member Functions

static constexpr size_t getClassAlignmentBytes ()
 _____________ Memory alignment __________________________
 
static constexpr size_t getBufferAlignmentBytes ()
 Gives minimal alignment in bytes required for the flat buffer.
 

Protected Attributes

int32_t mFlatBufferSize = 0
 size of the flat buffer
 
uint32_t mConstructionMask = ConstructionState::NotConstructed
 mask for constructed object members, first two bytes are used by this class
 
charmFlatBufferContainer = nullptr
 
charmFlatBufferPtr = nullptr
 

Detailed Description

GPUCA_GPUCODE.

Definition at line 175 of file FlatObject.h.

Member Enumeration Documentation

◆ ConstructionState

enum o2::gpu::FlatObject::ConstructionState : uint32_t
protected

GPUCA_GPUCODE.

_______________ Data members _______________________________________________ Enumeration of construction states

Enumerator
NotConstructed 

the object is not constructed

Constructed 

the object is constructed, temporary memory is released

InProgress 

construction started: temporary memory is reserved

Definition at line 316 of file FlatObject.h.

Constructor & Destructor Documentation

◆ FlatObject() [1/2]

o2::gpu::FlatObject::FlatObject ( )
default

_____________ Constructors / destructors __________________________

Default constructor / destructor

◆ ~FlatObject()

o2::gpu::FlatObject::~FlatObject ( )
inline

========================================================================================================

  Inline implementations of methods

========================================================================================================

Definition at line 337 of file FlatObject.h.

◆ FlatObject() [2/2]

o2::gpu::FlatObject::FlatObject ( const FlatObject )
delete

Member Function Documentation

◆ adoptInternalBuffer()

void o2::gpu::FlatObject::adoptInternalBuffer ( char buf)
inline

Definition at line 534 of file FlatObject.h.

◆ alignSize()

static size_t o2::gpu::FlatObject::alignSize ( size_t  sizeBytes,
size_t  alignmentBytes 
)
inlinestatic

_______________ Generic utilities _______________________________________________

Increases given size to achieve required alignment

Definition at line 277 of file FlatObject.h.

◆ ClassDefNV()

o2::gpu::FlatObject::ClassDefNV ( FlatObject  ,
 
)
protected

Pointer to the flat buffer.

◆ clearInternalBufferPtr()

void o2::gpu::FlatObject::clearInternalBufferPtr ( )
inline

Definition at line 541 of file FlatObject.h.

◆ cloneFromObject()

void o2::gpu::FlatObject::cloneFromObject ( const FlatObject obj,
char newFlatBufferPtr 
)
inlineprotected

Initializes from another object, copies data to newBufferPtr When newBufferPtr==nullptr, an internal container will be created, the data will be copied there. A daughter class should relocate pointers inside the buffer.

Initializes from another object, copies data to newBufferPtr When newBufferPtr==nullptr, the internal container will be created, the data will be copied there. obj can be *this (provided it does not own its buffer AND the external buffer is provided, which means

Definition at line 373 of file FlatObject.h.

◆ destroy()

void o2::gpu::FlatObject::destroy ( )
inline

_______________ Utilities _______________________________________________

Set the object to NotConstructed state, release the buffer

Set the object to NotConstructed state, release the buffer

Definition at line 349 of file FlatObject.h.

◆ finishConstruction()

void o2::gpu::FlatObject::finishConstruction ( int32_t  flatBufferSize)
inlineprotected

Finishes construction: creates internal flat buffer. A daughter class should put all created variable-size members to this buffer

Finishes construction: creates internal flat buffer. A daughter class should put all created variable-size members to this buffer

Definition at line 358 of file FlatObject.h.

◆ getBufferAlignmentBytes()

static constexpr size_t o2::gpu::FlatObject::getBufferAlignmentBytes ( )
inlinestaticconstexprprotected

Gives minimal alignment in bytes required for the flat buffer.

Definition at line 197 of file FlatObject.h.

◆ getClassAlignmentBytes()

static constexpr size_t o2::gpu::FlatObject::getClassAlignmentBytes ( )
inlinestaticconstexprprotected

_____________ Memory alignment __________________________

Gives minimal alignment in bytes required for the class object

Definition at line 194 of file FlatObject.h.

◆ getFlatBufferPtr()

const char * o2::gpu::FlatObject::getFlatBufferPtr ( ) const
inline

Gives pointer to the flat buffer.

Definition at line 259 of file FlatObject.h.

◆ getFlatBufferSize()

size_t o2::gpu::FlatObject::getFlatBufferSize ( ) const
inline

Gives size of the flat buffer.

Definition at line 256 of file FlatObject.h.

◆ isBufferInternal()

bool o2::gpu::FlatObject::isBufferInternal ( ) const
inline

Tells if the buffer is internal.

Definition at line 265 of file FlatObject.h.

◆ isConstructed()

bool o2::gpu::FlatObject::isConstructed ( ) const
inline

Tells if the object is constructed.

Definition at line 262 of file FlatObject.h.

◆ moveBufferTo()

void o2::gpu::FlatObject::moveBufferTo ( char newBufferPtr)
inlineprotected

Sets buffer pointer to the new address, move the buffer content there. A daughter class must relocate all the pointers inside th buffer

sets buffer pointer to the new address, move the buffer content there.

Definition at line 396 of file FlatObject.h.

◆ operator=()

FlatObject & o2::gpu::FlatObject::operator= ( const FlatObject )
delete

◆ printC()

void o2::gpu::FlatObject::printC ( ) const
inline

Print the content of the flat buffer.

Print the content of the flat buffer

Definition at line 458 of file FlatObject.h.

◆ readFromFile()

template<class T , class TFile >
T * o2::gpu::FlatObject::readFromFile ( TFile &  inpf,
const char name 
)
inlinestatic

read a child class object from the file

read from file

Definition at line 502 of file FlatObject.h.

◆ releaseInternalBuffer()

char * o2::gpu::FlatObject::releaseInternalBuffer ( )
inlineprotected

_____________ Methods for making the data buffer external __________________________

Definition at line 526 of file FlatObject.h.

◆ relocatePointer()

template<class T >
static T * o2::gpu::FlatObject::relocatePointer ( const char oldBase,
char newBase,
const T *  ptr 
)
inlinestatic

Relocates a pointer inside a buffer to the new buffer address.

Definition at line 285 of file FlatObject.h.

◆ setActualBufferAddress()

void o2::gpu::FlatObject::setActualBufferAddress ( char actualFlatBufferPtr)
inlineprotected

_____________ Methods for moving the class with its external buffer to another location __________________________

Sets the actual location of the flat buffer after it has been moved (i.e. to another maschine) It sets mFlatBufferPtr to actualFlatBufferPtr. A daughter class should later update all the pointers inside the buffer to the new location.

Sets the actual location of the external flat buffer after it has been moved (i.e. to another maschine)

It sets mFlatBufferPtr to actualFlatBufferPtr. A daughter class should update all the pointers inside the buffer in the new location.

Definition at line 547 of file FlatObject.h.

◆ setFutureBufferAddress()

void o2::gpu::FlatObject::setFutureBufferAddress ( char futureFlatBufferPtr)
inlineprotected

Sets a future location of the external flat buffer before moving it to this location (i.e. when copying to GPU).

The object can be used immidiatelly after the move, call of setActualFlatBufferAddress() is not needed.

A daughter class should already relocate all the pointers inside the current buffer to the future location. It should not touch memory in the future location, since it may be not yet available.

!!! Information about the actual buffer location will be lost. !!! Most of the class methods may be called only after the buffer will be moved to its new location. !!! To undo call setActualFlatBufferAddress()

Sets a future location of the external flat buffer before moving it to this location.

A daughter class should already reset all the pointers inside the current buffer to the future location without touching memory in the future location.

Definition at line 557 of file FlatObject.h.

◆ startConstruction()

void o2::gpu::FlatObject::startConstruction ( )
inlineprotected

_____________ Construction _________

Starts the construction procedure. A daughter class should reserve temporary memory.

Starts the construction procedure. A daughter class should reserve temporary memory.

Definition at line 342 of file FlatObject.h.

◆ stressTest()

template<class T >
std::string o2::gpu::FlatObject::stressTest ( T &  obj)
inlinestatic

Test the flat object functionality for a child class T.

Test the flat object functionality for an object of a child class T the obj is modified here. Check if it is functional after the test.

Definition at line 411 of file FlatObject.h.

◆ writeToFile()

template<class T , class TFile >
int32_t o2::gpu::FlatObject::writeToFile ( T &  obj,
TFile &  outf,
const char name 
)
inlinestatic

write a child class object to the file

store to file

Definition at line 480 of file FlatObject.h.

Member Data Documentation

◆ mConstructionMask

uint32_t o2::gpu::FlatObject::mConstructionMask = ConstructionState::NotConstructed
protected

mask for constructed object members, first two bytes are used by this class

Definition at line 323 of file FlatObject.h.

◆ mFlatBufferContainer

char* o2::gpu::FlatObject::mFlatBufferContainer = nullptr
protected

Definition at line 324 of file FlatObject.h.

◆ mFlatBufferPtr

char* o2::gpu::FlatObject::mFlatBufferPtr = nullptr
protected

Definition at line 325 of file FlatObject.h.

◆ mFlatBufferSize

int32_t o2::gpu::FlatObject::mFlatBufferSize = 0
protected

size of the flat buffer

Definition at line 322 of file FlatObject.h.


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