#include <CeylanSynchronized.h>
Public Member Functions | |
Synchronized (bool value) | |
Value assigned constructor. | |
Synchronized & | setValue (const volatile bool &value) |
Sets value. | |
const volatile bool & | getValue () const volatile |
Returns the current value. | |
Synchronized & | operator= (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. | |
Synchronized & | operator= (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. |
Needed since bool do not implement natively ++ and -- operators.
Definition at line 249 of file CeylanSynchronized.h.
Ceylan::System::Synchronized< bool >::Synchronized | ( | bool | value | ) | [inline] |
Value assigned constructor.
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.
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] |
Sets value.
Definition at line 272 of file CeylanSynchronized.h.
References Ceylan::System::Synchronized< X >::_mutex, Ceylan::System::Synchronized< X >::_value, Ceylan::System::Mutex::lock(), and Ceylan::System::Mutex::unlock().
Mutex Ceylan::System::Synchronized< bool >::_mutex [private] |
volatile bool Ceylan::System::Synchronized< bool >::_value [private] |