AFF --- A container for numbers (array) by Friederich and Forbriger.
dump_sharedheap.h
Go to the documentation of this file.
1 
42 // include guard
43 #ifndef AFF_DUMP_SHAREDHEAP_H_VERSION
44 
45 #define AFF_DUMP_SHAREDHEAP_H_VERSION \
46  "AFF_DUMP_SHAREDHEAP_H V1.2"
47 
48 #include<iostream>
49 #include<aff/lib/sharedheap.h>
50 
51 namespace aff {
52 
53 using std::endl;
54 
59 template<typename T>
60 void dump_layout(const aff::ConstSharedHeap<T>& sharedheap,
61  std::ostream& os=std::cout)
62 {
63  os << " SharedHeap object size: "
64  << sharedheap.size() << " elements" << endl;
65 }
66 
67 /*----------------------------------------------------------------------*/
68 
73 template<typename T>
74 void dump(const aff::ConstSharedHeap<T>& sharedheap,
75  std::ostream& os=std::cout)
76 {
77  os << "dump of SharedHeap object:" << endl;
78  dump_layout(sharedheap, os);
79  os << " element values:" << endl;
80  int i=0;
81  for (aff::Tsize k=0; k<sharedheap.size(); k++)
82  {
83  if (!i) { os << " "; }
84  os.width(8);
85  os << sharedheap[k] << " ";
86  if (++i>7) { i=0; os << endl; }
87  }
88  os << endl;
89 }
90 
91 } // namespace aff
92 
93 #endif // AFF_DUMP_SHAREDHEAP_H_VERSION (includeguard)
94 
95 /* ----- END OF dump_sharedheap.h ----- */
Root namespace of library.
Definition: array.h:148
void dump(const Strided &shape, std::ostream &os)
dump shape
Definition: dump.cc:49
const Tsize & size() const
Definition: sharedheap.h:179
shared heap representation (prototypes)
This is the base class for const elements.
Definition: sharedheap.h:139
void dump_layout(const aff::ConstSharedHeap< T > &sharedheap, std::ostream &os=std::cout)
Dump heap layout.
size_t Tsize
Type to hold the size of an array dimension.
Definition: types.h:51