Loading...
Searching...
No Matches
Classes | Public Types | Protected Member Functions | Protected Attributes | List of all members
bitpit::PiercedSyncMaster Class Reference

Base class for defining an object that acts like a master in pierced synchronization. More...

#include <piercedSync.hpp>

Inheritance diagram for bitpit::PiercedSyncMaster:
Inheritance graph
[legend]

Classes

struct  SyncModeHasher
 

Public Types

typedef std::vector< PiercedSyncSlave * > SyncGroup
 
enum  SyncMode {
  SYNC_MODE_CONCURRENT , SYNC_MODE_JOURNALED , SYNC_MODE_DISABLED , SYNC_MODE_ITR_COUNT = SYNC_MODE_DISABLED + 1 ,
  SYNC_MODE_ITR_BEGIN = 0 , SYNC_MODE_ITR_END = SYNC_MODE_ITR_BEGIN + SYNC_MODE_ITR_COUNT
}
 

Protected Member Functions

 PiercedSyncMaster ()
 
void dump (std::ostream &stream) const
 
PiercedSyncMaster::SyncMode getSlaveSyncMode (const PiercedSyncSlave *slave) const
 
bool isSlaveRegistered (const PiercedSyncSlave *slave) const
 
bool isSlaveSynced (const PiercedSyncSlave *slave) const
 
bool isSynced () const
 
bool isSyncEnabled () const
 
void processSyncAction (const PiercedSyncAction &action)
 
void registerSlave (PiercedSyncSlave *slave, PiercedSyncMaster::SyncMode syncMode) const
 
void restore (std::istream &stream)
 
void setSyncEnabled (bool enabled) const
 
void swap (PiercedSyncMaster &other) noexcept
 
void sync ()
 
void unregisterSlave (const PiercedSyncSlave *slave) const
 

Protected Attributes

std::unordered_map< PiercedSyncSlave *, SyncModem_slaves
 

Detailed Description

Base class for defining an object that acts like a master in pierced synchronization.

Definition at line 128 of file piercedSync.hpp.

Member Typedef Documentation

◆ SyncGroup

Slave synchronization group definition

Definition at line 134 of file piercedSync.hpp.

Member Enumeration Documentation

◆ SyncMode

Synchronization mode

Definition at line 139 of file piercedSync.hpp.

Constructor & Destructor Documentation

◆ PiercedSyncMaster()

bitpit::PiercedSyncMaster::PiercedSyncMaster ( )
protected

Constructor

Definition at line 213 of file piercedSync.cpp.

Member Function Documentation

◆ dump()

void bitpit::PiercedSyncMaster::dump ( std::ostream & stream) const
protected

Dump the object.

Parameters
streamis the stream data should be written to

Definition at line 564 of file piercedSync.cpp.

◆ getSlaveSyncMode()

PiercedSyncMaster::SyncMode bitpit::PiercedSyncMaster::getSlaveSyncMode ( const PiercedSyncSlave * slave) const
protected

Get the synchronization mode for the specified slave

Parameters
slaveis the slave for which the synchronization mode is requested
Returns
The synchronization mode of the slave

Definition at line 463 of file piercedSync.cpp.

◆ isSlaveRegistered()

bool bitpit::PiercedSyncMaster::isSlaveRegistered ( const PiercedSyncSlave * slave) const
protected

Check if te specified slave is registered.

Parameters
slaveis the slave to check

Definition at line 452 of file piercedSync.cpp.

◆ isSlaveSynced()

bool bitpit::PiercedSyncMaster::isSlaveSynced ( const PiercedSyncSlave * slave) const
protected

Check if the specified slave is synced.

If synchronization is disabled for the slave, the slaved will be always considered out-of-sync.

Parameters
slaveis the slave for which the check has to be performed
Returns
Returns true if the slave is synchronized, false otherwise.

Definition at line 477 of file piercedSync.cpp.

◆ isSynced()

bool bitpit::PiercedSyncMaster::isSynced ( ) const
protected

Check if all the slaves are synced.

Returns
Returns true if all slave are synchronized, false otherwise.

Definition at line 511 of file piercedSync.cpp.

◆ isSyncEnabled()

bool bitpit::PiercedSyncMaster::isSyncEnabled ( ) const
protected

Checks if the synchronization is enabled.

Returns
Returns true if the synchronization is be enabled, otherwise it returns false

Definition at line 539 of file piercedSync.cpp.

◆ processSyncAction()

void bitpit::PiercedSyncMaster::processSyncAction ( const PiercedSyncAction & action)
protected

Process the specified synchronization action.

Parameters
actionis the synchronization action that will be processed

Definition at line 271 of file piercedSync.cpp.

◆ registerSlave()

void bitpit::PiercedSyncMaster::registerSlave ( PiercedSyncSlave * slave,
PiercedSyncMaster::SyncMode syncMode ) const
protected

Register the specified slave

Parameters
slaveis the slave that will be registered
syncModeis the synchronization mode that will be used for the slave

Definition at line 247 of file piercedSync.cpp.

◆ restore()

void bitpit::PiercedSyncMaster::restore ( std::istream & stream)
protected

Restore the object.

Parameters
streamis the stream data should be read from

Definition at line 549 of file piercedSync.cpp.

◆ setSyncEnabled()

void bitpit::PiercedSyncMaster::setSyncEnabled ( bool enabled) const
protected

Enabled the synchronization.

Parameters
enabledis set to true the synchronization will be enabled, otherwise it will be disabled

Definition at line 528 of file piercedSync.cpp.

◆ swap()

void bitpit::PiercedSyncMaster::swap ( PiercedSyncMaster & other)
protectednoexcept

Exchanges the content of the kernel by the content of x, which is another kernel object of the same type. Sizes may differ.

After the call to this member function, the elements in this kernel are those which were in x before the call, and the elements of x are those which were in this. All iterators, references and pointers remain valid for the swapped objects.

Parameters
otheris another kernel of the same type (i.e., instantiated with the same template parameters) whose content is swapped with that of this kernel.

Definition at line 234 of file piercedSync.cpp.

◆ sync()

void bitpit::PiercedSyncMaster::sync ( )
protected

Syncronize all the registered slaves.

Definition at line 492 of file piercedSync.cpp.

◆ unregisterSlave()

void bitpit::PiercedSyncMaster::unregisterSlave ( const PiercedSyncSlave * slave) const
protected

Unregister the specified slave

Parameters
slaveis the slave that will be unregistered

Definition at line 425 of file piercedSync.cpp.

Member Data Documentation

◆ m_slaves

std::unordered_map<PiercedSyncSlave *, SyncMode> bitpit::PiercedSyncMaster::m_slaves
mutableprotected

Slaves

Definition at line 164 of file piercedSync.hpp.


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