#include <CeylanCountable.h>
Public Types | |
typedef Ceylan::Uint32 | InstanceCount |
Records rhe number of instances. | |
Public Member Functions | |
Countable (bool verbose=true) | |
Constructs a Countable, increments the global reference count. | |
virtual | ~Countable () throw () |
The virtual destructor decrements the reference count. | |
Static Public Member Functions | |
static const std::string | ToString (Ceylan::VerbosityLevels level=Ceylan::high) |
Returns informations about the global reference count. | |
static InstanceCount | GetInstanceCount () |
Returns the current instance count. | |
static InstanceCount | GetMaximumInstanceCount () |
Returns the current maximum instance count ever reached in this run. | |
Private Member Functions | |
Countable (const Countable &source) | |
Copy constructor made private to ensure that it will never be called. | |
Countable & | operator= (const Countable &source) |
Assignment operator made private to ensure that it will never be called. | |
Private Attributes | |
bool | _verbose |
Tells whether count changes should be recorded in LightLog. | |
Static Private Attributes | |
static InstanceCount | ReferenceCount = 0 |
The current reference count. | |
static InstanceCount | MaximumReferenceCount = 0 |
The maximum reference count that has been already reached. | |
static const std::string | LogPrefix = "[Instance count]" |
The prefix used when instance counts are logged. |
Its main use is to check that every Countable is rightly deallocated when appropriate, i.e. each program should end up with a null instance count.
Definition at line 65 of file CeylanCountable.h.
Countable::Countable | ( | bool | verbose = true |
) | [explicit] |
Constructs a Countable, increments the global reference count.
verbose | tells whether LogLight should be used to publish changes of instances counts. |
Definition at line 52 of file CeylanCountable.cc.
References _verbose, CEYLAN_LOG, LogPrefix, MaximumReferenceCount, ReferenceCount, and Ceylan::toString().
Countable::~Countable | ( | ) | throw () [virtual] |
The virtual destructor decrements the reference count.
Definition at line 72 of file CeylanCountable.cc.
References _verbose, CEYLAN_LOG, Ceylan::emergencyShutdown(), LogPrefix, MaximumReferenceCount, ReferenceCount, and Ceylan::toString().
Ceylan::Countable::Countable | ( | const Countable & | source | ) | [private] |
Copy constructor made private to ensure that it will never be called.
The compiler should complain whenever this undefined constructor is called, implicitly or not.
Countable::InstanceCount Countable::GetInstanceCount | ( | ) | [static] |
Returns the current instance count.
Definition at line 102 of file CeylanCountable.cc.
References ReferenceCount.
Countable::InstanceCount Countable::GetMaximumInstanceCount | ( | ) | [static] |
Returns the current maximum instance count ever reached in this run.
Definition at line 111 of file CeylanCountable.cc.
References MaximumReferenceCount.
Assignment operator made private to ensure that it will never be called.
The compiler should complain whenever this undefined operator is called, implicitly or not.
const string Countable::ToString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | [static] |
Returns informations about the global reference count.
Definition at line 92 of file CeylanCountable.cc.
References MaximumReferenceCount, ReferenceCount, and Ceylan::toString().
bool Ceylan::Countable::_verbose [private] |
Tells whether count changes should be recorded in LightLog.
Definition at line 132 of file CeylanCountable.h.
Referenced by Countable(), and ~Countable().
const string Countable::LogPrefix = "[Instance count]" [static, private] |
The prefix used when instance counts are logged.
Definition at line 144 of file CeylanCountable.h.
Referenced by Countable(), and ~Countable().
Countable::InstanceCount Countable::MaximumReferenceCount = 0 [static, private] |
The maximum reference count that has been already reached.
Definition at line 140 of file CeylanCountable.h.
Referenced by Countable(), GetMaximumInstanceCount(), ToString(), and ~Countable().
Countable::InstanceCount Countable::ReferenceCount = 0 [static, private] |
The current reference count.
Definition at line 136 of file CeylanCountable.h.
Referenced by Countable(), GetInstanceCount(), ToString(), and ~Countable().