Teuchos::RCPNodeTracer Class Reference
[Teuchos Memory Management Utilities]

Debug-mode RCPNode tracing class. More...

#include <Teuchos_RCPNode.hpp>

List of all members.

Static Public Member Functions

General user functions (can be called by any client)
static TEUCHOS_LIB_DLL_EXPORT
bool 
isTracingActiveRCPNodes ()
 Return if we are tracing active nodes or not.
static TEUCHOS_LIB_DLL_EXPORT
int 
numActiveRCPNodes ()
 Print the number of active RCPNode objects currently being tracked.
static TEUCHOS_LIB_DLL_EXPORT
RCPNodeStatistics 
getRCPNodeStatistics ()
 Return the statistics on RCPNode allocations.
static TEUCHOS_LIB_DLL_EXPORT
void 
printRCPNodeStatistics (const RCPNodeStatistics &rcpNodeStatistics, std::ostream &out)
 Print the RCPNode allocation statistics.
static TEUCHOS_LIB_DLL_EXPORT
void 
setPrintRCPNodeStatisticsOnExit (bool printRCPNodeStatisticsOnExit)
 Set if RCPNode usage statistics will be printed when the program ends or not.
static TEUCHOS_LIB_DLL_EXPORT
bool 
getPrintRCPNodeStatisticsOnExit ()
 Reteurn if RCPNode usage statistics will be printed when the program ends or not.
static TEUCHOS_LIB_DLL_EXPORT
void 
printActiveRCPNodes (std::ostream &out)
 Print the list of currently active RCP nodes.
Internal implementation functions (not to be called by general
clients).

static TEUCHOS_LIB_DLL_EXPORT
void 
addNewRCPNode (RCPNode *rcp_node, const std::string &info)
 Add new RCPNode to the global list.
static TEUCHOS_LIB_DLL_EXPORT
void 
removeRCPNode (RCPNode *rcp_node)
 Remove an RCPNode from global list.
template<class T>
static const void * getRCPNodeBaseObjMapKeyVoidPtr (T *p)
 Get a const void* address to be used as the lookup key for an RCPNode given its embedded object's typed pointer.
static TEUCHOS_LIB_DLL_EXPORT
RCPNode
getExistingRCPNodeGivenLookupKey (const void *lookupKey)
 Return a raw pointer to an existing owning RCPNode given its lookup key.
template<class T>
static RCPNodegetExistingRCPNode (T *p)
 Return a raw pointer to an existing owning RCPNode given the address to the underlying object if it exits.
static TEUCHOS_LIB_DLL_EXPORT
int 
getAddNewRCPNodeCallNumber ()
 Exposed to be used in unit testing.

Classes

struct  RCPNodeStatistics
 RCP statistics struct. More...


Detailed Description

Debug-mode RCPNode tracing class.

This is a static class that is used to trace all RCP nodes that are created and destroyed and to look-up RCPNodes given an an object's address. This database is used for several different types of debug-mode runtime checking including a) the detection of cicular references, b) detecting the creation of duplicate owning RCPNode objects for the same reference-counted object, and c) to create weak RCP objects for existing RCPNode objects.

This is primarily an internal implementation class but there are a few functions (maked as such below) that can be called by general users to turn on and off node tracing and to print the active RCPNode objects at any time.

Definition at line 273 of file Teuchos_RCPNode.hpp.


Member Function Documentation

bool Teuchos::RCPNodeTracer::isTracingActiveRCPNodes (  )  [static]

Return if we are tracing active nodes or not.

NOTE: This will always return false when TEUCHOS_DEBUG is not defined.

Definition at line 221 of file Teuchos_RCPNode.cpp.

int Teuchos::RCPNodeTracer::numActiveRCPNodes (  )  [static]

Print the number of active RCPNode objects currently being tracked.

Definition at line 235 of file Teuchos_RCPNode.cpp.

RCPNodeTracer::RCPNodeStatistics Teuchos::RCPNodeTracer::getRCPNodeStatistics (  )  [static]

Return the statistics on RCPNode allocations.

Definition at line 245 of file Teuchos_RCPNode.cpp.

void Teuchos::RCPNodeTracer::printRCPNodeStatistics ( const RCPNodeStatistics rcpNodeStatistics,
std::ostream &  out 
) [static]

Print the RCPNode allocation statistics.

Definition at line 250 of file Teuchos_RCPNode.cpp.

void Teuchos::RCPNodeTracer::setPrintRCPNodeStatisticsOnExit ( bool  printRCPNodeStatisticsOnExit  )  [static]

Set if RCPNode usage statistics will be printed when the program ends or not.

Definition at line 264 of file Teuchos_RCPNode.cpp.

bool Teuchos::RCPNodeTracer::getPrintRCPNodeStatisticsOnExit (  )  [static]

Reteurn if RCPNode usage statistics will be printed when the program ends or not.

Definition at line 271 of file Teuchos_RCPNode.cpp.

void Teuchos::RCPNodeTracer::printActiveRCPNodes ( std::ostream &  out  )  [static]

Print the list of currently active RCP nodes.

When the macro TEUCHOS_SHOW_ACTIVE_REFCOUNTPTR_NODE_TRACE is defined, this function will print out all of the RCP nodes that are currently active. This function can be called at any time during a program.

When the macro TEUCHOS_SHOW_ACTIVE_REFCOUNTPTR_NODE_TRACE is defined this function will get called automatically after the program ends and all of the local and global RCP objects have been destroyed. If any RCP nodes are printed at that time, then this is an indication that there may be some circular references that will caused memory leaks. You memory checking tool such as valgrind or purify should complain about this!

Definition at line 277 of file Teuchos_RCPNode.cpp.

void Teuchos::RCPNodeTracer::addNewRCPNode ( RCPNode rcp_node,
const std::string &  info 
) [static]

Add new RCPNode to the global list.

Only gets called when RCPNode tracing has been activated.

Definition at line 317 of file Teuchos_RCPNode.cpp.

void Teuchos::RCPNodeTracer::removeRCPNode ( RCPNode rcp_node  )  [static]

Remove an RCPNode from global list.

Always gets called in a debug build (TEUCHOS_DEBUG defined) when node tracing is enabled.

Definition at line 398 of file Teuchos_RCPNode.cpp.

template<class T>
static const void* Teuchos::RCPNodeTracer::getRCPNodeBaseObjMapKeyVoidPtr ( T *  p  )  [inline, static]

Get a const void* address to be used as the lookup key for an RCPNode given its embedded object's typed pointer.

This only returns the base address reliabily for all types if HAS_TEUCHOS_GET_BASE_OBJ_VOID_PTR is defined.

Returns:
0 if p == 0.

Definition at line 392 of file Teuchos_RCPNode.hpp.

RCPNode * Teuchos::RCPNodeTracer::getExistingRCPNodeGivenLookupKey ( const void *  lookupKey  )  [static]

Return a raw pointer to an existing owning RCPNode given its lookup key.

Returns:
returnVal != 0 if an owning RCPNode exists, 0 otherwsise.

Definition at line 453 of file Teuchos_RCPNode.cpp.

template<class T>
static RCPNode* Teuchos::RCPNodeTracer::getExistingRCPNode ( T *  p  )  [inline, static]

Return a raw pointer to an existing owning RCPNode given the address to the underlying object if it exits.

Returns:
returnVal != 0 if an owning RCPNode exists, 0 otherwsise.

Definition at line 422 of file Teuchos_RCPNode.hpp.

int Teuchos::RCPNodeTracer::getAddNewRCPNodeCallNumber (  )  [static]

Exposed to be used in unit testing.

Definition at line 472 of file Teuchos_RCPNode.cpp.


The documentation for this class was generated from the following files:
Generated on Tue Jul 13 09:23:02 2010 for Teuchos - Trilinos Tools Package by  doxygen 1.4.7