aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/defs.hh
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2008-02-02 15:43:00 +0000
committerErik Schnetter <schnetter@cct.lsu.edu>2008-02-02 15:43:00 +0000
commit1beb710e75a868f71b74ca5a2b13017593a4469e (patch)
treed9d916cb78ae9b3ee1bd824fbfc9d32401892d2d /Carpet/CarpetLib/src/defs.hh
parentd2d5504fd8975ae714d70cbdda4805d49f0c5bf5 (diff)
CarpetLib: Add function memoryof to measure size of data structures
Add an overloaded function memoryof which measures the size in bytes of CarpetLib's data structures. darcs-hash:20080202154302-dae7b-de41c79cb04617327695fae27928c05c5d431ee8.gz
Diffstat (limited to 'Carpet/CarpetLib/src/defs.hh')
-rw-r--r--Carpet/CarpetLib/src/defs.hh24
1 files changed, 24 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/defs.hh b/Carpet/CarpetLib/src/defs.hh
index 807e9fc59..59d22f4c8 100644
--- a/Carpet/CarpetLib/src/defs.hh
+++ b/Carpet/CarpetLib/src/defs.hh
@@ -235,6 +235,30 @@ namespace CarpetLib {
+// Container memory usage
+inline size_t memoryof (char e) { return sizeof e; }
+inline size_t memoryof (short e) { return sizeof e; }
+inline size_t memoryof (int e) { return sizeof e; }
+inline size_t memoryof (long e) { return sizeof e; }
+inline size_t memoryof (long long e) { return sizeof e; }
+inline size_t memoryof (unsigned char e) { return sizeof e; }
+inline size_t memoryof (unsigned short e) { return sizeof e; }
+inline size_t memoryof (unsigned int e) { return sizeof e; }
+inline size_t memoryof (unsigned long e) { return sizeof e; }
+inline size_t memoryof (unsigned long long e) { return sizeof e; }
+inline size_t memoryof (float e) { return sizeof e; }
+inline size_t memoryof (double e) { return sizeof e; }
+inline size_t memoryof (long double e) { return sizeof e; }
+inline size_t memoryof (void * e) { return sizeof e; }
+template<class T> inline size_t memoryof (T * e) { return sizeof e; }
+template<class T> inline size_t memoryof (T const * e) { return sizeof e; }
+template<class T> size_t memoryof (list<T> const & c);
+template<class T> size_t memoryof (set<T> const & c);
+template<class T> size_t memoryof (stack<T> const & c);
+template<class T> size_t memoryof (vector<T> const & c);
+
+
+
// Container input
template<class T> istream& input (istream& is, vector<T>& v);