Use manual method for naming CountedObject classes

This commit is contained in:
Vinnie Falco
2013-06-26 01:10:54 -07:00
parent aa92b9cffe
commit 1dffaf5d57
21 changed files with 23 additions and 35 deletions

View File

@@ -101,8 +101,6 @@ public:
getCounter ().decrement ();
}
virtual char const* getCountedObjectName () = 0;
private:
class Counter : public CountedObjects::CounterBase
{
@@ -111,23 +109,13 @@ private:
char const* getName () const noexcept
{
return getClassName ();
return Object::getCountedObjectName ();
}
void checkPureVirtual () const { }
};
private:
/* Due to a bug in Visual Studio 10 and earlier, the string returned by
typeid().name() will appear to leak on exit. Therefore, we should
only call this function when there's an actual leak, or else there
will be spurious leak notices at exit.
*/
static char const* getClassName () noexcept
{
return typeid (Object).name ();
}
static Counter& getCounter () noexcept
{
// VFALCO TODO Research the thread safety of static initializers

View File

@@ -12,7 +12,7 @@ class STObject
, public CountedObject <STObject>
{
public:
char const* getCountedObjectName () { return "STObject"; }
static char const* getCountedObjectName () { return "STObject"; }
STObject () : mType (NULL)
{
@@ -325,7 +325,7 @@ class STArray
, public CountedObject <STArray>
{
public:
char const* getCountedObjectName () { return "STArray"; }
static char const* getCountedObjectName () { return "STArray"; }
typedef boost::ptr_vector<STObject> vector;
typedef boost::ptr_vector<STObject>::iterator iterator;