mxmSmartHandleCore Class Reference
[modularMX Runtime Platform Core]

Implements all mxm::smart<T> code that does not have to go into the template - hopefully minimizing code expansion. More...

#include <mxmSmartHandleCore.h>

Inheritance diagram for mxmSmartHandleCore:

mxmObject mxm::smart< T > List of all members.

Public Member Functions

bool operator! (void) const
 [Not synchronized] To provide typesafe and syntactically acceptable way of testing for (non-) null-ness.
bool null (void) const
 [Not synchronized] Returns true if handle is null-handle, and false otherwise.
int groupSize () const
 [Synchronized] Returns the number of handles in the smart pointer group the handle is member of.
void setLock (mxmLockInterface *lock, bool assume_ownership=false)
 [Not synchronized] This method sets up the synchronization mechanism to be used to protect the emerging handle group's collective datastructure.
bool releaseSmartlyHandledObject (void)
 [Synchronized] Releases control over potential handlee and becomes a null-handle again.

Private Member Functions

 mxmSmartHandleCore ()
 Initializes to default state: null-handle, no lock.
void init ()
 [Not synchronized] Helper.
virtual void deleteHandlee ()=0
 [Not synchronized] Helper, to be implemented by subclasses.
void reset ()
 [Synchronized] Helper, leaves potential group and returns to default state: null-handle without any lock attached.
void joinGroup (const mxmSmartHandleCore &other, void *handlee_override=0, bool lock_already_acquired=false)
 [Synchronized, via target group's lock!] Helper, makes default-state handle join the specified target group.

Private Attributes

mxmSmartHandleCorePrev
mxmSmartHandleCoreNext
void * Handlee
mxmLockInterfaceLock
mxm::u32 OwnedLock:1
mxm::u32 Reserved:31

Friends

class mxm::smart

Detailed Description

Implements all mxm::smart<T> code that does not have to go into the template - hopefully minimizing code expansion.

Author:
[khe] Kai Hergenroether


Member Function Documentation

void mxmSmartHandleCore::joinGroup const mxmSmartHandleCore other,
void *  handlee_override = 0,
bool  lock_already_acquired = false
[private]
 

[Synchronized, via target group's lock!] Helper, makes default-state handle join the specified target group.

Must only be invoked on a handle in default state: null-handle (=> alone), no lock.

If the handle other is a null-handle, no group join is performed and we remain in default state. This can happen and is perfectly OK.

Copies dumb handlee pointer and locking semantics from other.

bool mxmSmartHandleCore::releaseSmartlyHandledObject void   ) 
 

[Synchronized] Releases control over potential handlee and becomes a null-handle again.

Ownership over the handlee object is transferred back to the calling context.

Returns:
false in case control over the handlee could not be released. This happens if there are other smart handles for the handlee object around. In this case everything is left unchanged. If on the other hand the handlee object could be properly released, the handle becomes a null-handle and the method returns true. Locking settings remain unchanged.

void mxmSmartHandleCore::setLock mxmLockInterface lock,
bool  assume_ownership = false
 

[Not synchronized] This method sets up the synchronization mechanism to be used to protect the emerging handle group's collective datastructure.

This method can only be invoked on a smart handle that

  • does not yet have a lock (= is still unprotected)
  • is currently alone (= the only member of the handle group spawned by itself)

Failure to honor the above requirements is considered a programmer's screw-up, and is swiftly and decisively responded to with a call to mxm::terminal().

Parameters:
lock The lock object to be used for synchronization. Must be non-0.
assume_ownership If set to true the emerging handle group will assume ownership over the lock object. As a result, the lock will be automatically deleted at the time the last of the respective smart handles dies.


The documentation for this class was generated from the following files:
Generated on Fri Jun 29 17:21:05 2007 for MxPEG SDK by  doxygen 1.4.6