diff options
Diffstat (limited to 'src/multistorage.cc')
-rw-r--r-- | src/multistorage.cc | 103 |
1 files changed, 59 insertions, 44 deletions
diff --git a/src/multistorage.cc b/src/multistorage.cc index e3329c5..3e79f90 100644 --- a/src/multistorage.cc +++ b/src/multistorage.cc @@ -1,93 +1,109 @@ #include "multistorage.hh" +using namespace std; + namespace Formaline { - - using namespace std; - - - + multistorage:: multistorage () { } - - - + + + multistorage:: ~ multistorage () { - for (list<storage *>::const_iterator it = stores.begin(); - it != stores.end(); - ++ it) + close (); + } + + + + void + multistorage:: + close () + { + for (list<storage *>::const_iterator + it = stores.begin(); it != stores.end(); ++ it) { delete * it; } + stores.clear (); } - - - + + + void multistorage:: add_storage (storage * const s) { stores.push_front (s); } - - - + + + int multistorage:: num_storages () const { return stores.size(); } - - - + + + + void + multistorage::open_group (multistorage & ms, char const * const name) + { + for (list<storage *>::const_iterator + it = stores.begin(); it != stores.end(); ++ it) + { + ms.add_storage ((* it)->open_group (name)); + } + } + + + void multistorage:: store (char const * const key, bool const value) const { - for (list<storage *>::const_iterator it = stores.begin(); - it != stores.end(); - ++ it) + for (list<storage *>::const_iterator + it = stores.begin(); it != stores.end(); ++ it) { (* it)->store (key, value); } } - - - + + + void multistorage:: store (char const * const key, CCTK_INT const value) const { - for (list<storage *>::const_iterator it = stores.begin(); - it != stores.end(); - ++ it) + for (list<storage *>::const_iterator + it = stores.begin(); it != stores.end(); ++ it) { (* it)->store (key, value); } } - - - + + + void multistorage:: store (char const * const key, CCTK_REAL const value) const { - for (list<storage *>::const_iterator it = stores.begin(); - it != stores.end(); - ++ it) + for (list<storage *>::const_iterator + it = stores.begin(); it != stores.end(); ++ it) { (* it)->store (key, value); } } - - - + + + void multistorage:: store (char const * const key, char const * const value) const @@ -95,14 +111,13 @@ namespace Formaline // Ignore null strings if (value == 0) return; - for (list<storage *>::const_iterator it = stores.begin(); - it != stores.end(); - ++ it) + for (list<storage *>::const_iterator + it = stores.begin(); it != stores.end(); ++ it) { (* it)->store (key, value); } } - - - + + + } // namespace Formaline |