#include <coherence/lang/ClassBasedHeapAnalyzer.hpp>
Inherits Object, and Comparable.
Public Types | |||||||
typedef spec::Handle | Handle | ||||||
ClassStats Handle definition. | |||||||
typedef spec::View | View | ||||||
ClassStats View definition. | |||||||
typedef spec::Holder | Holder | ||||||
ClassStats Holder definition. | |||||||
Public Member Functions | |||||||
virtual int64_t | getObjectCount () const | ||||||
Return the instance count for the class. | |||||||
virtual int64_t | getByteCount () const | ||||||
Return the byte count for the class. | |||||||
virtual int64_t | getAllocationCount () const | ||||||
Return the allocation count for the class. | |||||||
int32_t | compareTo (Object::View v) const | ||||||
Compare this object with the specified object for order. Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object.
It is strongly recommended, but not strictly required, that
| |||||||
virtual TypedHandle < const String > | toString () const | ||||||
Output a human-readable description of this Object to the given stream. Note that when overriding this method the return type must be TypedHandle<const String> rather then String::View. These two types are assignment compatible but not equivalent and declaring the override with String::View will not be a compatible override. coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toString method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents and is generally how toString() will be implemented.
Object::View vKey = ... Object::View vValue = ... std::cout << vKey << " = " << vValue << std::endl; String::View vs = COH_TO_STRING(vKey << " = " << vValue); The COH_TO_STRING macro is also the most common way to implement the toString method. For example:
virtual TypedHandle<const String> Person::toString() const { return COH_TO_STRING("Name: " << f_sName << " SSN: " << f_nSSN); }
| |||||||
Protected Member Functions | |||||||
ClassStats (int64_t cObjs, int64_t cBytes, int64_t cAlloc) | |||||||
Create a new ClassStats. | |||||||
Protected Attributes | |||||||
int64_t | m_cInstanceCount | ||||||
The number of instances of the class. | |||||||
int64_t | m_cByteCount | ||||||
The byte size of all the instances. | |||||||
int64_t | m_cAllocationCount | ||||||
The total number of allocations of the class. |
ClassStats | ( | int64_t | cObjs, | |
int64_t | cBytes, | |||
int64_t | cAlloc | |||
) | [protected] |
Create a new ClassStats.
cObjs | the instance count | |
cBytes | the byte count | |
cAlloc | the allocation count |