Go to the documentation of this file.
20 #ifndef LIBMESH_REFERENCE_COUNTER_H
21 #define LIBMESH_REFERENCE_COUNTER_H
24 #include "libmesh/libmesh_config.h"
25 #include "libmesh/threads.h"
26 #include "libmesh/libmesh.h"
96 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
116 typedef std::map<std::string, std::pair<
unsigned int,
179 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
184 std::pair<unsigned int, unsigned int> & p =
_counts[
name];
192 #if defined(LIBMESH_ENABLE_REFERENCE_COUNTING) && defined(DEBUG)
197 std::pair<unsigned int, unsigned int> & p =
_counts[
name];
207 #endif // LIBMESH_REFERENCE_COUNTER_H
void increment_destructor_count(const std::string &name)
Increments the destruction counter.
The libMesh namespace provides an interface to certain functionality in the library.
std::map< std::string, std::pair< unsigned int, unsigned int > > Counts
Data structure to log the information.
static Counts _counts
Actually holds the data.
static Threads::atomic< unsigned int > _n_objects
The number of objects.
static std::string get_info()
Gets a string containing the reference information.
void increment_constructor_count(const std::string &name)
Increments the construction counter.
static void print_info(std::ostream &out=libMesh::out)
Prints the reference information, by default to libMesh::out.
static unsigned int n_objects()
Prints the number of outstanding (created, but not yet destroyed) objects.
spin_mutex spin_mtx
A convenient spin mutex object which can be used for obtaining locks.
This is the base class for enabling reference counting.
ReferenceCounter()
Constructors.
~ReferenceCounter()
Destructor.
static void enable_print_counter_info()
Methods to enable/disable the reference counter output from print_info()
static bool _enable_print_counter
Flag to control whether reference count information is printed when print_info is called.
static void disable_print_counter_info()
void ErrorVector unsigned int
std::string name(const ElemQuality q)
This function returns a string containing some name for q.
static Threads::spin_mutex _mutex
Mutual exclusion object to enable thread-safe reference counting.