Quick Links:

bal | bbl | bdl | bsl

Public Member Functions | Friends

balst::StackTrace Class Reference

#include <balst_stacktrace.h>

List of all members.

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (StackTrace, bslma::UsesBslmaAllocator)
 BSLMF_NESTED_TRAIT_DECLARATION (StackTrace, bslmf::IsBitwiseMoveable)
 StackTrace (bslma::Allocator *basicAllocator=0)
 StackTrace (const StackTrace &original, bslma::Allocator *basicAllocator=0)
 ~StackTrace ()
StackTraceoperator= (const StackTrace &rhs)
StackTraceFrameoperator[] (int index)
void append (const StackTraceFrame &value)
void removeAll ()
void resize (int newLength)
void swap (StackTrace &other)
const StackTraceFrameoperator[] (int index) const
int length () const
bslma::Allocatorallocator () const
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const

Friends

bool operator== (const StackTrace &, const StackTrace &)

Detailed Description

This value-semantic class describes a function-call stack, represented as a sequence of randomly accessible StackTraceFrame objects, each of which represents one function call on the stack. Note that if no allocator is supplied at construction, an owned bdlma::HeapBypassAllocator object is used to supply memory.

See Component balst_stacktrace


Constructor & Destructor Documentation

balst::StackTrace::StackTrace ( bslma::Allocator basicAllocator = 0  )  [explicit]

Create an empty StackTrace object (having a length of 0). Optionally specify basicAllocator used to supply memory. If basicAllocator is 0, then an owned heap-bypass allocator object is used. Note that the heap-bypass allocator is used by default to avoid heap allocation in situations where the heap may have been corrupted.

balst::StackTrace::StackTrace ( const StackTrace original,
bslma::Allocator basicAllocator = 0 
)

Create a StackTrace object having the same value as the specified original object. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, then an owned heap-bypass allocator object is used. Note that the heap-bypass allocator is used by default to avoid heap allocation in situations where the heap may have been corrupted.

balst::StackTrace::~StackTrace (  ) 

Destroy this object.


Member Function Documentation

balst::StackTrace::BSLMF_NESTED_TRAIT_DECLARATION ( StackTrace  ,
bslma::UsesBslmaAllocator   
)
balst::StackTrace::BSLMF_NESTED_TRAIT_DECLARATION ( StackTrace  ,
bslmf::IsBitwiseMoveable   
)
StackTrace& balst::StackTrace::operator= ( const StackTrace rhs  ) 

Assign to this object the value of the specified rhs object, and return a reference providing modifiable access to this object.

StackTraceFrame& balst::StackTrace::operator[] ( int  index  ) 

Return a reference providing modifiable access to the stack-trace frame at the specified index. The behavior is undefined unless 0 <= index < length().

void balst::StackTrace::append ( const StackTraceFrame value  ) 

Append to this sequence the specified value.

void balst::StackTrace::removeAll (  ) 

Remove all stack-trace frames from this object. After this operation, the length() method will return 0.

void balst::StackTrace::resize ( int  newLength  ) 

Add default constructed stack-trace frames to, or remove stack-trace frames from, the end of this stack-trace object such that, after the operation, length() == newLength. Stack trace frames whose indices are in the range 0 <= index < min(length, newLength) will be unchanged. The behavior is undefined unless 0 <= newLength.

void balst::StackTrace::swap ( StackTrace other  ) 

Efficiently exchange the value of this object with the value of the specified other object. This method provides the no-throw exception-safety guarantee. The behavior is undefined unless this object was created with the same allocator as other.

const StackTraceFrame& balst::StackTrace::operator[] ( int  index  )  const

Return a reference providing non-modifiable access to the stack-trace frame at the specified index. The behavior is undefined unless 0 <= index < length().

int balst::StackTrace::length (  )  const

Return the number of stack-trace frames contained in this object.

bslma::Allocator* balst::StackTrace::allocator (  )  const

Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the owned heap-bypass allocator is used.

bsl::ostream& balst::StackTrace::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Write the value of this object to the specified output stream in a human-readable format, and return a reference to stream. Optionally specify an initial indentation level, whose absolute value is incremented recursively for nested objects. If level is specified, optionally specify spacesPerLevel, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect. Note that the format is not fully specified, and can change without notice.


Friends And Related Function Documentation

bool operator== ( const StackTrace ,
const StackTrace  
) [friend]

Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two StackTrace objects have the same value if they have the save length, and each of their corresponding stack-trace frames have the same value.


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