dump_sharedheap.h 1.94 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
4
5
/*! \file dump_sharedheap.h
 * \brief factored out SharedHeap dump function (prototypes)
 * 
 * ----------------------------------------------------------------------------
 * 
thomas.forbriger's avatar
thomas.forbriger committed
6
 * $Id: dump_sharedheap.h,v 1.2 2002-12-29 00:09:06 forbrig Exp $
thomas.forbriger's avatar
thomas.forbriger committed
7
8
9
10
11
12
13
14
15
16
17
 * \author Thomas Forbriger
 * \date 19/12/2002
 * 
 * factored out SharedHeap dump function (prototypes)
 *
 * \ingroup group_helpers
 * 
 * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) 
 * 
 * REVISIONS and CHANGES 
 *  - 19/12/2002   V1.0   Thomas Forbriger
thomas.forbriger's avatar
thomas.forbriger committed
18
19
20
 *  - 28/12/2002   V1.1   (thof)
 *                        - functions now take ConstSharedHeap class reference
 *                          arguments
thomas.forbriger's avatar
thomas.forbriger committed
21
22
23
24
25
26
27
28
 * 
 * ============================================================================
 */

// include guard
#ifndef AFF_DUMP_SHAREDHEAP_H_VERSION

#define AFF_DUMP_SHAREDHEAP_H_VERSION \
thomas.forbriger's avatar
thomas.forbriger committed
29
  "AFF_DUMP_SHAREDHEAP_H   V1.1"
thomas.forbriger's avatar
thomas.forbriger committed
30
#define AFF_DUMP_SHAREDHEAP_H_CVSID \
thomas.forbriger's avatar
thomas.forbriger committed
31
  "$Id: dump_sharedheap.h,v 1.2 2002-12-29 00:09:06 forbrig Exp $"
thomas.forbriger's avatar
thomas.forbriger committed
32
33
34
35
36
37
38
39
40
41
42
43
44

#include<iostream>
#include<aff/lib/sharedheap.h>

namespace aff {

using std::endl;

/*! \brief Dump heap layout 
 *
 * \ingroup group_helpers
 */
template<typename T>
thomas.forbriger's avatar
thomas.forbriger committed
45
void dump_layout(const aff::ConstSharedHeap<T>& sharedheap, 
thomas.forbriger's avatar
thomas.forbriger committed
46
47
48
49
50
51
52
53
54
55
56
57
58
          std::ostream& os=std::cout)
{
  os << "dump of a SharedHeap object:";
  os << "  size=" << sharedheap.size() << endl;
}

/*----------------------------------------------------------------------*/

/*! \brief Dump heap contents 
 *
 * \ingroup group_helpers
 */
template<typename T>
thomas.forbriger's avatar
thomas.forbriger committed
59
void dump(const aff::ConstSharedHeap<T>& sharedheap, 
thomas.forbriger's avatar
thomas.forbriger committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
          std::ostream& os=std::cout)
{
  dump_layout(sharedheap, os);
  os << "  elements:" << endl;
  int i=0;
  for (aff::Tsize k=0; k<sharedheap.size(); k++)
  {
    if (!i) { os << "   "; }
    os.width(8);
    os << sharedheap[k] << " ";
    if (++i>7) { i=0; os << endl; }
  }
  os << endl;
}

} // namespace aff

#endif // AFF_DUMP_SHAREDHEAP_H_VERSION (includeguard)

/* ----- END OF dump_sharedheap.h ----- */