heapwalk_sequence Class Reference
[Memory Library]

#include <winstl/memory/heapwalk_sequence.hpp>

Inheritance diagram for heapwalk_sequence:

stl_collection_tag collection_tag

List of all members.


Detailed Description

An STL-like sequence for walking heap allocated blocks.

The following code illustrates the use of the class to enumerate all currently allocated blocks in the given heap:

HANDLE                      hHeap = . . . // Handle to an existing heap
winstl::heapwalk_sequence   blocks(hHeap);

winstl::heapwalk_sequence::const_iterator   b = blocks.begin();
winstl::heapwalk_sequence::const_iterator   e = blocks.end();

for(; b != e; ++b)
{
  printf("  Block of size %lu at %p\n", (*b).cbData, (*b).lpData);
}

If you do not specify a heap handle, the sequence uses the process heap, as shown in the following code:

winstl::heapwalk_sequence   blocks; // Uses process heap

winstl::heapwalk_sequence::const_iterator   b = blocks.begin();
winstl::heapwalk_sequence::const_iterator   e = blocks.end();

for(; b != e; ++b)
{
  printf("  Block of size %lu at %p\n", (*b).cbData, (*b).lpData);
}

Member Types

typedef heapwalk_sequence class_type
 The class.
typedef entry_type const & value_type
 The value type.
typedef
heapwalk_sequence_const_iterator 
const_iterator
 The non-mutating (const) iterator type.
typedef entry_type const & const_reference
 The non-mutating (const) reference type.

Public Member Functions

Construction
 heapwalk_sequence ()
 Creates an instance that walks the default process heap.
 heapwalk_sequence (HANDLE hHeap)
 Creates an instance that walks the given heap.
 ~heapwalk_sequence () throw ()
 Destructor.
Iteration
const_iterator begin () const
 Begins the iteration.
const_iterator end () const
 Ends the iteration.

Member Typedef Documentation

The class.

typedef entry_type const& value_type

The value type.

The non-mutating (const) iterator type.

typedef entry_type const& const_reference

The non-mutating (const) reference type.


Constructor & Destructor Documentation

Creates an instance that walks the default process heap.

heapwalk_sequence ( HANDLE  hHeap  )  [explicit]

Creates an instance that walks the given heap.

Note:
The heapwalk_sequence does not take ownership of the given heap handle

~heapwalk_sequence (  )  throw ()

Destructor.


Member Function Documentation

const_iterator begin (  )  const

Begins the iteration.

Returns:
An iterator representing the start of the sequence

const_iterator end (  )  const

Ends the iteration.

Returns:
An iterator representing the end of the sequence


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

Generated on Thu Jun 10 08:59:28 2010 for STLSoft by  doxygen 1.5.6