GlobalObjects
Loading...
Searching...
No Matches
glo::LockManager::LockedObject Class Reference

Objects can be locked. Objects of this class represent an object locked by the communicator, with possibly also locked objects like embedded objects. More...

#include <GloLockManager.h>

Classes

class  CommunicatorRightsRestrictions
 The individual lock modes of the object with object ID from LockedObject::m_LockObjektID for a communicator. More...
 

Public Member Functions

 LockedObject (const ObjID &rLockObjekt)
 
 ~LockedObject ()
 
void deleteCommunicator (Communicator *pCommunicator)
 
std::size_t getNumCommunicators ()
 
ObjID getObjID () const
 
bool hasAnyOtherCompetingProtection (Communicator *pCommunicator, EnLockMode eLockMode) const
 
bool isPossible (Communicator *pCommunicator, bool bRead, bool bWrite, bool bDelete) const
 
int lockObject (Communicator *pCommunicator, std::stack< ObjID > *pDependObjIdStack, EnLockMode eLockMode, EnDeepMode eDeepMode, bool bSimulate=false)
 
int unlockObject (Communicator *pCommunicator, std::stack< ObjID > *&prDependObjIdStack, EnLockMode eLockMode, EnDeepMode eDeepMode, bool bSimulate=false)
 

Protected Member Functions

 LockedObject ()
 

Protected Attributes

std::map< NUM_PTR, CommunicatorRightsRestrictions *, std::less< NUM_PTR > > m_CommunicatorMap
 
ObjID m_LockObjektID
 

Private Member Functions

 LockedObject (const LockedObject &)
 
LockManager::LockedObjectoperator= (LockedObject &)
 
int setLockCount (std::list< DependentObjsWithDeepMode * > &rLockCountList, std::stack< ObjID > *&prUnlockDependObjIdStack, std::stack< ObjID > *pLockDependObjIdStack, EnDeepMode eDeepMode, bool bSimulate=false)
 
int setLocks (CommunicatorRightsRestrictions *pItem, EnLockMode eLockMode, EnDeepMode eDeepMode, std::stack< ObjID > *&prUnlockDependObjIdStack, std::stack< ObjID > *pLockDependObjIdStack, bool bSimulate=false)
 

Friends

class LockManager
 

Detailed Description

Objects can be locked. Objects of this class represent an object locked by the communicator, with possibly also locked objects like embedded objects.

Author
Helmut Jakoby

Constructor & Destructor Documentation

◆ LockedObject() [1/3]

glo::LockManager::LockedObject::LockedObject ( )
protected

The default constructor is not available.

◆ LockedObject() [2/3]

glo::LockManager::LockedObject::LockedObject ( const ObjID & rLockObjekt)

Constructor with parameter passing.

Parameters
[in]rLockObjektThe object ID of the object to be locked.

◆ ~LockedObject()

glo::LockManager::LockedObject::~LockedObject ( )

Destructor.

◆ LockedObject() [3/3]

glo::LockManager::LockedObject::LockedObject ( const LockedObject & )
private

The copy constructor is not available.

Member Function Documentation

◆ deleteCommunicator()

void glo::LockManager::LockedObject::deleteCommunicator ( Communicator * pCommunicator)

Removes all locks of the passed communicator.

Parameters
[in]pCommunicatorThe communicator.

◆ getNumCommunicators()

std::size_t glo::LockManager::LockedObject::getNumCommunicators ( )

Returns the number of communicators who have locked the object with the object ID from LockedObject::m_LockObjectID.

Returns
The number of locking communicators.

◆ getObjID()

ObjID glo::LockManager::LockedObject::getObjID ( ) const

Returns the object ID of the locked object.

Returns
The object ID.

◆ hasAnyOtherCompetingProtection()

bool glo::LockManager::LockedObject::hasAnyOtherCompetingProtection ( Communicator * pCommunicator,
EnLockMode eLockMode ) const

Checks whether another communicator of the object with object ID from LockedObject::m_LockObjektID is competing for the passed communicator.

Parameters
[in]pCommunicatorThe communicator.
[in]eLockModeThe lock mode to be checked for the communicator.
Returns
If true, there is a competing lock. The object with the object ID from LockedObject :: m_LockObjektID cannot be locked by the transferred communicator with the transferred lock mode.

◆ isPossible()

bool glo::LockManager::LockedObject::isPossible ( Communicator * pCommunicator,
bool bRead,
bool bWrite,
bool bDelete ) const

Checks whether the passed communicator is allowed to read, write and/or delete the object with the object ID from vLockedObject::m_LockObjectID.

Parameters
[in]pCommunicatorThe communicator.
[in]bReadIf true, a check is made for 'read'.
[in]bWriteIf true, a check is made for 'write'.
[in]bDeleteIf true, a check is made for 'delete'.
Returns
If true, the modes set to true for the communicator are possible.

◆ lockObject()

int glo::LockManager::LockedObject::lockObject ( Communicator * pCommunicator,
std::stack< ObjID > * pDependObjIdStack,
EnLockMode eLockMode,
EnDeepMode eDeepMode,
bool bSimulate = false )

Locks the object with the object ID from LockedObject::m_LockObjectID for a communicator.

Parameters
[in]pCommunicatorThe blocking communicator.
[in]pDependObjIdStackThe stack of object IDs of the objects to be locked.
[in]eLockModeThe lock mode.
[in]eDeepModeThe lock depth mode.
[in]bSimulateIf true, only simulation is carried out, i.e. no value is set, but a valid result or error is returned.
Returns
A return <0 indicates an error.

◆ operator=()

LockManager::LockedObject & glo::LockManager::LockedObject::operator= ( LockedObject & )
private

The assignment operator is not available.

◆ setLockCount()

int glo::LockManager::LockedObject::setLockCount ( std::list< DependentObjsWithDeepMode * > & rLockCountList,
std::stack< ObjID > *& prUnlockDependObjIdStack,
std::stack< ObjID > * pLockDependObjIdStack,
EnDeepMode eDeepMode,
bool bSimulate = false )
private

Help method for LockedObject::setLocks (...).

Parameters
[in,out]rLockCountListThe list for each lock mode from CommunicatorRightsRestrictions
[in,out]prUnlockDependObjIdStackThe stack of object IDs of the objects to be shared.
[in]pLockDependObjIdStackThe stack of object IDs of the objects to be locked.
[in]eDeepModeThe lock depth mode.
[in]bSimulateIf true, only simulation is performed, i.e. no value is set, but a valid result or an error is returned.
Returns
A return value < 0 indicates an error.

◆ setLocks()

int glo::LockManager::LockedObject::setLocks ( CommunicatorRightsRestrictions * pItem,
EnLockMode eLockMode,
EnDeepMode eDeepMode,
std::stack< ObjID > *& prUnlockDependObjIdStack,
std::stack< ObjID > * pLockDependObjIdStack,
bool bSimulate = false )
private

Locks the object with object ID from LockedObject::m_LockObjektID for a CommunicatorRightsRestrictions or releases it.

Parameters
[in]pItemThe CommunicatorRightsRestrictions in which the lock or release is entered.
[in]eLockModeThe lock mode.
[in]eDeepModeThe lock depth mode.
[in,out]prUnlockDependObjIdStackThe stack of object IDs of the objects to be shared.
[in]pLockDependObjIdStackThe stack of object IDs of the objects to be locked.
[in]bSimulateIf true, only simulation is performed, i.e. no value is set, but a valid result or an error is returned.
Returns
A return value < 0 indicates an error.

◆ unlockObject()

int glo::LockManager::LockedObject::unlockObject ( Communicator * pCommunicator,
std::stack< ObjID > *& prDependObjIdStack,
EnLockMode eLockMode,
EnDeepMode eDeepMode,
bool bSimulate = false )

Releases the object locked by a communicator with the object ID from LockedObject::m_LockObjectID.

Parameters
[in]pCommunicatorThe releasing communicator.
[in,out]prDependObjIdStackThe stack of object IDs of the objects to be released.
[in]eLockModeThe original lock mode which should be released.
[in]eDeepModeThe lock depth mode of the original lock mode that is to be canceled.
[in]bSimulateIf true, only simulation is carried out, ie no value is set, but a result or error is returned.
Returns
A return <0 indicates an error.

Friends And Related Symbol Documentation

◆ LockManager

friend class LockManager
friend

Member Data Documentation

◆ m_CommunicatorMap

std::map< NUM_PTR, CommunicatorRightsRestrictions *, std::less<NUM_PTR> > glo::LockManager::LockedObject::m_CommunicatorMap
protected

The individual lock modes of the communicators that lock the object with the object ID from LockedObject::m_LockObjektID.
Index is the address, casted to NUM_PTR, of the Communicator from CommunicatorRightsRestrictions::m_pCommunicator.

◆ m_LockObjektID

ObjID glo::LockManager::LockedObject::m_LockObjektID
protected

The object ID of the locked object.


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