Interface which should be implemented for all objects that are able to be locked. More...
#include <CeylanLockable.h>
Classes | |
class | LockException |
This exception is raised when a lock gets misused. More... | |
Public Types | |
enum | TextOutputFormat { rawText, html } |
Defines what text output formats for TextDisplayable instances are available. More... | |
Public Member Functions | |
Lockable () | |
Basic constructor, Lockable comes unlocked. | |
virtual | ~Lockable () throw () |
Basic virtual destructor, unlocks Lockable if locked. | |
virtual bool | mustBeLocked () const |
bool | isLocked () const |
Returns the lock state, locked or unlocked. | |
virtual void | lock () |
Locks the Lockable. | |
virtual void | unlock () |
Unlocks the Lockable. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const |
Returns an user-friendly description of the state of this object. | |
Static Public Member Functions | |
static const std::string | ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high) |
Returns a user-friendly description of this list of pointers to text displayable instances. | |
static TextOutputFormat | GetOutputFormat () |
Returns the current overall text format to be used by TextDisplayable instances. | |
static void | SetOutputFormat (TextOutputFormat newOutputFormat) |
Sets the current overall text format to be used by TextDisplayable instances. | |
Protected Member Functions | |
virtual void | postLock () |
Callback method called just after being locked. | |
virtual void | preUnlock () |
Callback method called just before being unlocked. | |
Protected Attributes | |
bool | _locked |
This is the actual piece of informations which is used to know the lock state. | |
Static Protected Attributes | |
static TextOutputFormat | _OutputFormat = rawText |
The text format to be used currently by TextDisplayable instances. | |
Private Member Functions | |
Lockable (const Lockable &source) | |
Copy constructor made private to ensure that it will be never called. | |
Lockable & | operator= (const Lockable &source) |
Assignment operator made private to ensure that it will be never called. |
Interface which should be implemented for all objects that are able to be locked.
Definition at line 48 of file CeylanLockable.h.
enum Ceylan::TextDisplayable::TextOutputFormat [inherited] |
Defines what text output formats for TextDisplayable instances are available.
Definition at line 124 of file CeylanTextDisplayable.h.
Lockable::Lockable | ( | ) |
Basic constructor, Lockable comes unlocked.
Definition at line 62 of file CeylanLockable.cc.
Lockable::~Lockable | ( | ) | throw () [virtual] |
Basic virtual destructor, unlocks Lockable if locked.
Definition at line 70 of file CeylanLockable.cc.
References _locked, dataUtils::e, mustBeLocked(), Ceylan::Exception::toString(), and unlock().
Ceylan::Lockable::Lockable | ( | const Lockable & | source | ) | [private] |
Copy constructor made private to ensure that it will be never called.
The compiler should complain whenever this undefined constructor is called, implicitly or not.
TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat | ( | ) | [static, inherited] |
Returns the current overall text format to be used by TextDisplayable instances.
Definition at line 63 of file CeylanTextDisplayable.cc.
References Ceylan::TextDisplayable::_OutputFormat.
Referenced by Ceylan::formatStringList(), Ceylan::formatStringMap(), Ceylan::XML::XMLMarkup::toString(), Ceylan::Maths::Linear::Vector3::toString(), Ceylan::Maths::Linear::Vector2::toString(), Ceylan::Maths::Linear::Tripoint::toString(), Ceylan::Module::toString(), Ceylan::Maths::Linear::Matrix3::toString(), Ceylan::Maths::Linear::Matrix2::toString(), Ceylan::Maths::Linear::HomogeneousMatrix3::toString(), and Ceylan::Maths::Linear::Bipoint::toString().
bool Ceylan::Lockable::isLocked | ( | ) | const [inline] |
Returns the lock state, locked or unlocked.
Definition at line 251 of file CeylanLockable.h.
void Lockable::lock | ( | ) | [virtual] |
Locks the Lockable.
Locking an already locked Lockable may raise an exception. If mustBeLocked returns false, does nothing.
This method is to be called by the user of the class instances.
It will handle the locking process and will call the 'postLock' method afterwards. This 'postLock' method should be overriden so that the locking does actually something.
This method, 'lock', may be overriden for special locking processes, for example for reentrant mutex instances.
Reimplemented in Ceylan::System::Mutex.
Definition at line 108 of file CeylanLockable.cc.
References _locked, mustBeLocked(), postLock(), and generalUtils::true.
bool Lockable::mustBeLocked | ( | ) | const [virtual] |
Definition at line 99 of file CeylanLockable.cc.
References generalUtils::true.
Referenced by lock(), unlock(), and ~Lockable().
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.
void Lockable::postLock | ( | ) | [protected, virtual] |
Callback method called just after being locked.
Meant to be overriden if necessary, since this default implementation does nothing.
LockException | if the effective locking failed. |
Reimplemented in Ceylan::System::Mutex.
Definition at line 173 of file CeylanLockable.cc.
Referenced by lock().
void Lockable::preUnlock | ( | ) | [protected, virtual] |
Callback method called just before being unlocked.
Meant to be overriden if necessary, since this default implementation does nothing.
LockException | if the effective unlocking failed. |
Reimplemented in Ceylan::System::Mutex.
Definition at line 182 of file CeylanLockable.cc.
Referenced by unlock().
void TextDisplayable::SetOutputFormat | ( | TextOutputFormat | newOutputFormat | ) | [static, inherited] |
Sets the current overall text format to be used by TextDisplayable instances.
newOutputFormat | the new output format. |
Definition at line 72 of file CeylanTextDisplayable.cc.
References Ceylan::TextDisplayable::_OutputFormat.
Referenced by Ceylan::Log::LogHolder::LogHolder().
const std::string TextDisplayable::ToString | ( | std::list< TextDisplayable * > | displayables, | |
Ceylan::VerbosityLevels | level = Ceylan::high | |||
) | [static, inherited] |
Returns a user-friendly description of this list of pointers to text displayable instances.
displayables | a list of pointers to TextDisplayable instances/ | |
level | the requested verbosity level. |
Definition at line 45 of file CeylanTextDisplayable.cc.
References Ceylan::formatStringList().
const string Lockable::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Implements Ceylan::TextDisplayable.
Reimplemented in Ceylan::System::Mutex.
Definition at line 157 of file CeylanLockable.cc.
References _locked.
void Lockable::unlock | ( | ) | [virtual] |
Unlocks the Lockable.
Unlocking a non locked Lockable raises an exception. If mustBeLocked returns false, does nothing.
This method is to be called by the user of the class instances.
It will handle the unlocking process and will call the 'preUnlock' method afterwards. This 'preUnlock' method should be overriden so that the unlocking does actually something.
This method, 'unlock', may be overriden for special unlocking processes, for example for reentrant mutex instances.
Reimplemented in Ceylan::System::Mutex.
Definition at line 133 of file CeylanLockable.cc.
References _locked, generalUtils::false, mustBeLocked(), and preUnlock().
Referenced by ~Lockable().
bool Ceylan::Lockable::_locked [protected] |
This is the actual piece of informations which is used to know the lock state.
Definition at line 217 of file CeylanLockable.h.
Referenced by Ceylan::System::Mutex::lock(), lock(), toString(), Ceylan::System::Mutex::unlock(), unlock(), and ~Lockable().
TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited] |
The text format to be used currently by TextDisplayable instances.
Definition at line 158 of file CeylanTextDisplayable.h.
Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().