mbo::LockedVar< bool > Class Template Reference

locked boolean variable More...

#include <MboLockedVar.h>

Collaboration diagram for mbo::LockedVar< bool >:

Collaboration graph
{mbo::CCriticalSectionFake\n||+ Enter()\l+ Leave()\l+ GetLock()\l+ GetLevel()\l}{mbo::ICriticalSection\n||+ ~ICriticalSection()\l+ Enter()\l+ Leave()\l+ GetLock()\l+ GetLevel()\l}
[legend]

List of all members.

Public Member Functions

 LockedVar ()
 LockedVar (const _Ty tIn)
 operator _Ty ()
 operator const _Ty () const
_Tyoperator * ()
const _Tyoperator * () const
const _Tyoperator= (const _Ty &tIn)
_Ty __exchange (const _Ty tIn)
mbo::CLock __getLock () const

Protected Types

typedef bool _Ty

Protected Attributes

bool m_val
 value


Detailed Description

template<>
class mbo::LockedVar< bool >

locked boolean variable

See also:
MboLockedVar

Definition at line 166 of file MboLockedVar.h.


Member Typedef Documentation

typedef bool mbo::LockedVar< bool >::_Ty [protected]

Definition at line 177 of file MboLockedVar.h.


Constructor & Destructor Documentation

mbo::LockedVar< bool >::LockedVar (  )  [inline]

Default Constructor

Definition at line 185 of file MboLockedVar.h.

00186         : m_val(false)
00187     {
00188     }

mbo::LockedVar< bool >::LockedVar ( const _Ty  tIn  )  [inline, explicit]

Standard Constructor

Parameters:
tIn initial value

Definition at line 193 of file MboLockedVar.h.

00194         : m_val(tIn)
00195     {
00196     }


Member Function Documentation

mbo::LockedVar< bool >::operator _Ty (  )  [inline]

access to locked value (a copy is returned)

Returns:
not locked copy of the value
Note:
This returns a copy because returning a reference would bypass locking.

Definition at line 203 of file MboLockedVar.h.

References mbo::LockedVar< _Ty, _THREAD_MODEL >::m_val.

00204     {
00205         return m_val;
00206     }

mbo::LockedVar< bool >::operator const _Ty (  )  const [inline]

const access to locked value (a const copy is returned)

Returns:
not locked const copy of the value
Note:
This returns a copy because returning a reference would bypass locking.

Definition at line 213 of file MboLockedVar.h.

References mbo::LockedVar< _Ty, _THREAD_MODEL >::m_val.

00214     {
00215         return m_val;
00216     }

_Ty& mbo::LockedVar< bool >::operator * (  )  [inline]

Returns:
non const access to locked value

Definition at line 220 of file MboLockedVar.h.

References mbo::LockedVar< _Ty, _THREAD_MODEL >::m_val.

00221     {
00222         return m_val;
00223     }

const _Ty& mbo::LockedVar< bool >::operator * (  )  const [inline]

Returns:
const access to locked value

Definition at line 227 of file MboLockedVar.h.

References mbo::LockedVar< _Ty, _THREAD_MODEL >::m_val.

00228     {
00229         return m_val;
00230     }

const _Ty& mbo::LockedVar< bool >::operator= ( const _Ty tIn  )  [inline]

assignment

Parameters:
tIn new value
Note:
This returns a reference to the input. It is not feasible to return the value itself. A copy would be to slow and a reference would bypass locking.

Definition at line 238 of file MboLockedVar.h.

References mbo::LockedVar< _Ty, _THREAD_MODEL >::m_val.

00239     {
00240         m_val = tIn;
00241         return tIn; /* tIn not t */
00242     }

_Ty mbo::LockedVar< bool >::__exchange ( const _Ty  tIn  )  [inline]

value exchangement

Parameters:
tIn the new value
Returns:
the old value

Definition at line 249 of file MboLockedVar.h.

References mbo::LockedVar< _Ty, _THREAD_MODEL >::m_val.

00250     {
00251         _Ty tOld(m_val);
00252         m_val = tIn;
00253         return tOld; /* the old value */
00254     }

mbo::CLock mbo::LockedVar< bool >::__getLock (  )  const [inline]

Returns:
Lock for variable

Definition at line 258 of file MboLockedVar.h.

00259     {
00260         return mbo::CLockSingle(&m_mx);
00261     }


Member Data Documentation

bool mbo::LockedVar< bool >::m_val [protected]

value

Definition at line 179 of file MboLockedVar.h.


The documentation for this class was generated from the following file:
  Hosted on code.google.com  
© Marcus Börger
Generated on Fri Jan 18 21:21:12 2008 for MBO-lib by doxygen 1.5.4