OMK::CurrentActiveObject Class Reference

class CurrentActiveObject. More...

#include <OMKCurrentActiveObject.h>

Collaboration diagram for OMK::CurrentActiveObject:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CurrentActiveObject (const SimulatedObject *currentActiveObject)
 constructor: installs currentActiveObject on top of the global context
virtual ~CurrentActiveObject ()
 destructor: uninstalls the currentActiveObject

Static Public Member Functions

static SimulatedObjectgetCurrentActiveObject ()

Protected Attributes

void * _oldName

Detailed Description

class CurrentActiveObject.

This class is used to keep a global context indicating to the current execution thread the simulated object the thread is executing code in behalf of. This class uses the same design pattern as HeapStackTop

Definition at line 33 of file OMKCurrentActiveObject.h.


Constructor & Destructor Documentation

CurrentActiveObject::CurrentActiveObject ( const SimulatedObject currentActiveObject  ) 

constructor: installs currentActiveObject on top of the global context

Definition at line 40 of file OMKCurrentActiveObject.cpp.

References _oldName, and OMKCurrentActiveObjecto.

00041 {
00042 #if !defined _MSC_VER && defined _OMK_MUTEX_
00043  _oldName = pthread_getspecific( threadContextKey ) ;
00044   pthread_setspecific ( threadContextKey , currentActiveObject );   
00045 #else
00046   OMKCurrentActiveObjecto = currentActiveObject ;
00047 #endif
00048 }

CurrentActiveObject::~CurrentActiveObject (  )  [virtual]

destructor: uninstalls the currentActiveObject

Definition at line 50 of file OMKCurrentActiveObject.cpp.

References _oldName.

00051 {
00052 #if !defined _MSC_VER && defined _OMK_MUTEX_
00053   pthread_setspecific ( threadContextKey , _oldName );
00054 #endif
00055 }


Member Function Documentation

SimulatedObject * CurrentActiveObject::getCurrentActiveObject (  )  [static]

Definition at line 58 of file OMKCurrentActiveObject.cpp.

References OMKCurrentActiveObjecto.

Referenced by OMK::Input< T >::realConnect(), OMK::Output< T >::set(), OMK::GenericControlParameter< T, AncestorClass >::set(), and OMK::AbstractInput< Type >::setConnectable().

00059 {
00060 #if !defined _MSC_VER && defined _OMK_MUTEX_
00061   return (SimulatedObject *) pthread_getspecific( threadContextKey ) ;
00062 #else
00063   return (SimulatedObject *) OMKCurrentActiveObjecto ;
00064 #endif
00065 }


Member Data Documentation

void* OMK::CurrentActiveObject::_oldName [protected]

Definition at line 55 of file OMKCurrentActiveObject.h.

Referenced by CurrentActiveObject(), and ~CurrentActiveObject().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:02 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007