Ceylan::System::Synchronized< bool > Class Template Reference

Partial specialization of the Synchonized template for bool. More...

#include <CeylanSynchronized.h>

Collaboration diagram for Ceylan::System::Synchronized< bool >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Synchronized (bool value)
 Value assigned constructor.
SynchronizedsetValue (const volatile bool &value)
 Sets value.
const volatile bool & getValue () const volatile
 Returns the current value.
Synchronizedoperator= (const bool &value)
 Assignment operator.
 operator bool () const volatile
 Conversion operator.
bool operator++ ()
 Prefixed increment operator (ex: ++x).
bool operator++ (int)
 Postfixed increment operator (ex: x++).
bool operator-- ()
 Prefixed decrement operator (ex: --x).
bool operator-- (int)
 Postfixed decrement operator (ex: x--).

Private Member Functions

 Synchronized ()
 Default constructor made private to ensure that it will be never called.
 Synchronized (const Synchronized &source)
 Copy constructor made private to ensure that it will be never called.
Synchronizedoperator= (const Synchronized &source)
 Assignment operator made private to ensure that it will be never called.

Private Attributes

volatile bool _value
 The synchronized resource.
Mutex _mutex
 The protecting mutex.


Detailed Description

template<>
class Ceylan::System::Synchronized< bool >

Partial specialization of the Synchonized template for bool.

Needed since bool do not implement natively ++ and -- operators.

Note:
Although its is a partial specialization, at least with some compilers (Visual C++ 2005), unchanged methods are not "inherited", hence must be duplicated verbatim.

Definition at line 249 of file CeylanSynchronized.h.


Constructor & Destructor Documentation

Ceylan::System::Synchronized< bool >::Synchronized ( bool  value  )  [inline]

Value assigned constructor.

Note:
This constructor would not be convenient if it used the 'explicit' keyword.

Definition at line 263 of file CeylanSynchronized.h.

Ceylan::System::Synchronized< bool >::Synchronized (  )  [private]

Default constructor made private to ensure that it will be never called.

Ceylan::System::Synchronized< bool >::Synchronized ( const Synchronized< bool > &  source  )  [private]

Copy constructor made private to ensure that it will be never called.

Calls such as: Synchronized<int> number = 0 ; should be rewritten in: Synchronized<int> number( 0 ) ; otherwise a copy constructor would be needed.


Member Function Documentation

const volatile bool& Ceylan::System::Synchronized< bool >::getValue (  )  const volatile [inline]

Returns the current value.

Definition at line 286 of file CeylanSynchronized.h.

References Ceylan::System::Synchronized< X >::_value.

Referenced by Ceylan::System::Thread::isClean(), and Ceylan::System::Thread::isRunning().

Ceylan::System::Synchronized< bool >::operator bool (  )  const volatile [inline]

Conversion operator.

Definition at line 309 of file CeylanSynchronized.h.

References Ceylan::System::Synchronized< X >::_value.

bool Ceylan::System::Synchronized< bool >::operator++ ( int   )  [inline]

Postfixed increment operator (ex: x++).

Definition at line 338 of file CeylanSynchronized.h.

References Ceylan::System::Synchronized< X >::operator++().

bool Ceylan::System::Synchronized< bool >::operator++ (  )  [inline]

Prefixed increment operator (ex: ++x).

Here, reverses the logical value of the bool.

Definition at line 324 of file CeylanSynchronized.h.

References Ceylan::System::Synchronized< X >::_mutex, Ceylan::System::Synchronized< X >::_value, Ceylan::System::Mutex::lock(), and Ceylan::System::Mutex::unlock().

bool Ceylan::System::Synchronized< bool >::operator-- ( int   )  [inline]

Postfixed decrement operator (ex: x--).

Definition at line 366 of file CeylanSynchronized.h.

References Ceylan::System::Synchronized< X >::operator--().

bool Ceylan::System::Synchronized< bool >::operator-- (  )  [inline]

Prefixed decrement operator (ex: --x).

Here, reverses the logical value of the bool.

Definition at line 353 of file CeylanSynchronized.h.

References Ceylan::System::Synchronized< X >::_mutex, Ceylan::System::Synchronized< X >::_value, Ceylan::System::Mutex::lock(), and Ceylan::System::Mutex::unlock().

Synchronized& Ceylan::System::Synchronized< bool >::operator= ( const Synchronized< bool > &  source  )  [private]

Assignment operator made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

Synchronized& Ceylan::System::Synchronized< bool >::operator= ( const bool &  value  )  [inline]

Assignment operator.

Definition at line 299 of file CeylanSynchronized.h.

References Ceylan::System::Synchronized< X >::setValue().

Synchronized& Ceylan::System::Synchronized< bool >::setValue ( const volatile bool &  value  )  [inline]


Member Data Documentation

The protecting mutex.

Definition at line 384 of file CeylanSynchronized.h.

volatile bool Ceylan::System::Synchronized< bool >::_value [private]

The synchronized resource.

Definition at line 380 of file CeylanSynchronized.h.


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

Generated on Thu Jun 4 20:41:09 2009 for Ceylan by  doxygen 1.5.8