Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ion::base::StaticDeleterDeleter Class Reference

StaticDeleterDeleter is an internal class that holds and deletes StaticDeleters; it should not be used directly. More...

#include "staticsafedeclare.h"

Inheritance diagram for ion::base::StaticDeleterDeleter:
Collaboration diagram for ion::base::StaticDeleterDeleter:

Public Member Functions

 StaticDeleterDeleter ()
 
 ~StaticDeleterDeleter () override
 
template<typename T >
void AddPointerToDelete (const std::string &name, T *ptr)
 Adds a regular pointer to be deleted when this class is destroyed. More...
 
template<typename T >
void AddArrayToDelete (const std::string &name, T *ptr)
 Adds an array pointer to be deleted when this class is destroyed. More...
 
template<typename T >
void IgnoreInstance (const std::string &name, const T &ptr)
 Does nothing, but simplifies the above macros for static non-pointer instances. More...
 
const StaticDeleterBaseGetDeleterAt (size_t index) const
 Returns the deleter at the passed index. More...
 
size_t GetDeleterCount () const
 Returns the number of deleters in this. More...
 
int GetRefCount () const
 GetRefCount() is part of the interface necessary for SharedPtr. More...
 

Static Public Member Functions

static StaticDeleterDeleterGetInstance ()
 Returns a pointer to the global instance. More...
 
static void DestroyInstance ()
 Call this function once, and only once, at the end of a program, to explicitly destroy all StaticDeleters (including the StaticDeleterDeleter instance). More...
 

Detailed Description

StaticDeleterDeleter is an internal class that holds and deletes StaticDeleters; it should not be used directly.

Though it is an internal class, it must be decorated since it is required by StaticDeleters that may be instantiated in other translation units. The single StaticDeleterDeleter is destroyed at program shutdown, and destroys all StaticDeleters in the reverse order they were created with the above macros.

Definition at line 192 of file staticsafedeclare.h.

Constructor & Destructor Documentation

ion::base::StaticDeleterDeleter::StaticDeleterDeleter ( )

Definition at line 25 of file staticsafedeclare.cc.

References ion::base::GetDefaultLogEntryWriter().

ion::base::StaticDeleterDeleter::~StaticDeleterDeleter ( )
override

Definition at line 33 of file staticsafedeclare.cc.

Member Function Documentation

template<typename T >
void ion::base::StaticDeleterDeleter::AddArrayToDelete ( const std::string &  name,
T ptr 
)
inline

Adds an array pointer to be deleted when this class is destroyed.

Definition at line 205 of file staticsafedeclare.h.

References mutex_.

template<typename T >
void ion::base::StaticDeleterDeleter::AddPointerToDelete ( const std::string &  name,
T ptr 
)
inline

Adds a regular pointer to be deleted when this class is destroyed.

Definition at line 199 of file staticsafedeclare.h.

References mutex_.

void ion::base::StaticDeleterDeleter::DestroyInstance ( )
static

Call this function once, and only once, at the end of a program, to explicitly destroy all StaticDeleters (including the StaticDeleterDeleter instance).

Any attempt to access pointers declared with the macros in this file will fail after this call. Even if this function is never called, however, the static instance will still be destroyed at program shutdown, it will just probably happen after any memory trackers are destroyed, causing them to report erroneous leaks.

Definition at line 61 of file staticsafedeclare.cc.

const StaticDeleterBase* ion::base::StaticDeleterDeleter::GetDeleterAt ( size_t  index) const
inline

Returns the deleter at the passed index.

Returns NULL if the index is invalid.

Definition at line 219 of file staticsafedeclare.h.

size_t ion::base::StaticDeleterDeleter::GetDeleterCount ( ) const
inline

Returns the number of deleters in this.

Definition at line 224 of file staticsafedeclare.h.

StaticDeleterDeleter * ion::base::StaticDeleterDeleter::GetInstance ( )
static

Returns a pointer to the global instance.

Definition at line 54 of file staticsafedeclare.cc.

References ION_DECLARE_SAFE_STATIC.

int ion::base::Shareable::GetRefCount ( ) const
inlineinherited

GetRefCount() is part of the interface necessary for SharedPtr.

Definition at line 34 of file shareable.h.

Referenced by ion::base::Notifier::RemoveReceiver().

template<typename T >
void ion::base::StaticDeleterDeleter::IgnoreInstance ( const std::string &  name,
const T ptr 
)
inline

Does nothing, but simplifies the above macros for static non-pointer instances.

Definition at line 212 of file staticsafedeclare.h.


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