HepLockable


HepLockable is intended to be a (multiply inherited) base class for objects which will be handled by a combinatoric engine. It maintains an integer, which is used bit-by-bit for locks. When asked to lock itself, HepLockable sets the appropriate bit and then asks all its children to lock themselves with the same bit. When asked to unlock, it does a similar process. A HepLockable is locked if any of its bits are set, or if any of its children are locked.

HepLockable also has static methods to allocate and de-allocate bits for use by HepLock objects. In this way, locks can be turned on and off independent of each other.

Anyone using HepLockable should remember to implement the methods:

     virtual HepLockable *lockableChild(int i);
     virtual int nLockChildren() const;
if they are appropriate. If there is multiple inheritance in the inheritance hierarchy, be certain to return correct pointer.

Author

Paul Rensing

See also

HepChooser, HepCombiner, HepLock

Declaration

#include "CLHEP/Combination/Lockable.h"

class HepLockable

Typedefs

typedef void* ClassId;

Public Member Functions

Constructor
inline HepLockable()
allocBit
static int allocBit()
ClassID
static ClassId ClassID()
This method must be re-implemented by sub-classes to allow for dynamic cast (will become redundant with new ANSI/ISO standard)
freeBit
inline static void freeBit(int bit)
isA
inline virtual int isA(ClassId id)
This method must be re-implemented by sub-classes to allow for dynamic cast (will become redundant with new ANSI/ISO standard)
lock
inline void lock(int bit)
locked
inline int locked() const
unlock
inline void unlock(int bit)

Example

CLHEP/test/testComb.cc


29 September 1997
EVC