IBAMR  IBAMR version 0.19.
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
IBTK::StreamableManager Class Reference

Class StreamableManager is a singleton manager class that organizes the actual packing and unpacking of concrete Streamable objects for SAMRAI::tbox::AbstractStream based communication. More...

#include <ibtk/StreamableManager.h>

Public Member Functions

bool checkFactoryRegistration (SAMRAI::tbox::Pointer< StreamableFactory > factory)
 
int registerFactory (SAMRAI::tbox::Pointer< StreamableFactory > factory)
 
size_t getDataStreamSize (SAMRAI::tbox::Pointer< Streamable > data_item) const
 Return an upper bound on the amount of space required to pack a Streamable object to a buffer. More...
 
size_t getDataStreamSize (const std::vector< SAMRAI::tbox::Pointer< Streamable > > &data_items) const
 Return an upper bound on the amount of space required to pack a vector of Streamable objects to a buffer. More...
 
void packStream (SAMRAI::tbox::AbstractStream &stream, SAMRAI::tbox::Pointer< Streamable > data_item)
 Pack a Streamable object into the output stream. More...
 
void packStream (SAMRAI::tbox::AbstractStream &stream, std::vector< SAMRAI::tbox::Pointer< Streamable > > &data_items)
 Pack a vector of Streamable objects into the output stream. More...
 
SAMRAI::tbox::Pointer< StreamableunpackStream (SAMRAI::tbox::AbstractStream &stream, const SAMRAI::hier::IntVector< NDIM > &offset)
 Unpack a Streamable object from the data stream. More...
 
void unpackStream (SAMRAI::tbox::AbstractStream &stream, const SAMRAI::hier::IntVector< NDIM > &offset, std::vector< SAMRAI::tbox::Pointer< Streamable > > &data_items)
 Unpack a vector of Streamable objects from the data stream. More...
 

Static Public Member Functions

static StreamableManagergetManager ()
 
static void freeManager ()
 
static int getUnregisteredID ()
 

Protected Member Functions

 StreamableManager ()
 Constructor. More...
 
 ~StreamableManager ()
 Destructor. More...
 

Static Protected Member Functions

static int createUniqueID ()
 

Private Types

using StreamableFactoryMap = std::map< int, SAMRAI::tbox::Pointer< StreamableFactory > >
 

Private Member Functions

 StreamableManager (const StreamableManager &from)=delete
 Copy constructor. More...
 
StreamableManageroperator= (const StreamableManager &that)=delete
 Assignment operator. More...
 

Private Attributes

StreamableFactoryMap d_factory_map
 

Static Private Attributes

static StreamableManagers_data_manager_instance
 
static bool s_registered_callback
 
static unsigned char s_shutdown_priority
 
static int s_current_id_number
 
static const int s_unregistered_id_number
 

Detailed Description

See also
Streamable
StreamableFactory

Member Typedef Documentation

◆ StreamableFactoryMap

Constructor & Destructor Documentation

◆ StreamableManager() [1/2]

IBTK::StreamableManager::StreamableManager ( )
protected

◆ ~StreamableManager()

IBTK::StreamableManager::~StreamableManager ( )
protected

◆ StreamableManager() [2/2]

IBTK::StreamableManager::StreamableManager ( const StreamableManager from)
privatedelete
Note
This constructor is not implemented and should not be used.
Parameters
fromThe value to copy to this object.

Member Function Documentation

◆ getManager()

static StreamableManager* IBTK::StreamableManager::getManager ( )
static

Return a pointer to the instance of the Streamable manager. All access to the singleton StreamableManager object is through the getManager() function.

Note that when the manager is accessed for the first time, the freeManager static method is registered with the ShutdownRegistry class. Consequently, an allocated manager is freed at program completion. Thus, users of this class do not explicitly allocate or deallocate the manager instances.

Returns
A pointer to the data manager instance.

◆ freeManager()

static void IBTK::StreamableManager::freeManager ( )
static

Deallocate the StreamableManager instance.

It is not necessary to call this function at program termination, since it is automatically called by the ShutdownRegistry class.

◆ getUnregisteredID()

static int IBTK::StreamableManager::getUnregisteredID ( )
static
Returns
A integer value reserved for unregistered StreamableFactory objects. A concrete StreamableFactory object must use this as its initial streamable ID.

◆ checkFactoryRegistration()

bool IBTK::StreamableManager::checkFactoryRegistration ( SAMRAI::tbox::Pointer< StreamableFactory factory)

Check to see if a StreamableFactory has been registered with the manager.

Returns
true if the factory has been registered, false otherwise.
Note
This method simply checks to see if a StreamableFactory with the same Streamable ID has been registered with the manager. Every different Streamable/StreamableFactory type must have a unique ID.

◆ registerFactory()

int IBTK::StreamableManager::registerFactory ( SAMRAI::tbox::Pointer< StreamableFactory factory)

Register a StreamableFactory with the manager.

Each factory object registered with the manager is provided with a unique ID.

Note
To ensure that each MPI process uses the same streamable ID for each streamable class registered with the manager, this method is collective on all MPI processes!

◆ getDataStreamSize() [1/2]

size_t IBTK::StreamableManager::getDataStreamSize ( SAMRAI::tbox::Pointer< Streamable data_item) const
inline

◆ getDataStreamSize() [2/2]

size_t IBTK::StreamableManager::getDataStreamSize ( const std::vector< SAMRAI::tbox::Pointer< Streamable > > &  data_items) const
inline

◆ packStream() [1/2]

void IBTK::StreamableManager::packStream ( SAMRAI::tbox::AbstractStream stream,
SAMRAI::tbox::Pointer< Streamable data_item 
)
inline

◆ packStream() [2/2]

void IBTK::StreamableManager::packStream ( SAMRAI::tbox::AbstractStream stream,
std::vector< SAMRAI::tbox::Pointer< Streamable > > &  data_items 
)
inline

◆ unpackStream() [1/2]

SAMRAI::tbox::Pointer< Streamable > IBTK::StreamableManager::unpackStream ( SAMRAI::tbox::AbstractStream stream,
const SAMRAI::hier::IntVector< NDIM > &  offset 
)
inline

◆ unpackStream() [2/2]

void IBTK::StreamableManager::unpackStream ( SAMRAI::tbox::AbstractStream stream,
const SAMRAI::hier::IntVector< NDIM > &  offset,
std::vector< SAMRAI::tbox::Pointer< Streamable > > &  data_items 
)
inline

◆ createUniqueID()

static int IBTK::StreamableManager::createUniqueID ( )
staticprotected

Generate a unique ID number.

Every call to createUniqueID() returns a different integer, simplifying the task of generating ID numbers for StreamableFactory objects.

◆ operator=()

StreamableManager& IBTK::StreamableManager::operator= ( const StreamableManager that)
privatedelete
Note
This operator is not implemented and should not be used.
Parameters
thatThe value to assign to this object.
Returns
A reference to this object.

Member Data Documentation

◆ s_data_manager_instance

StreamableManager* IBTK::StreamableManager::s_data_manager_instance
staticprivate

Static data members used to control access to and destruction of singleton data manager instance.

◆ s_registered_callback

bool IBTK::StreamableManager::s_registered_callback
staticprivate

◆ s_shutdown_priority

unsigned char IBTK::StreamableManager::s_shutdown_priority
staticprivate

◆ s_current_id_number

int IBTK::StreamableManager::s_current_id_number
staticprivate

Static data members used to simplify the process of assigning unique ID numbers to each registered StreamableFactory object.

◆ s_unregistered_id_number

const int IBTK::StreamableManager::s_unregistered_id_number
staticprivate

◆ d_factory_map

StreamableFactoryMap IBTK::StreamableManager::d_factory_map
private

Map from Streamable ID to registered StreamableFactory objects.


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