1 ////////////////////////////////////////////////////////////////////////////////
3 // Author: Andy Rushton
4 // Copyright: (c) Southampton University 1999-2004
5 // (c) Andy Rushton 2004-2009
6 // License: BSD License, see ../docs/license.html
8 ////////////////////////////////////////////////////////////////////////////////
9 #include "persistent_int.hpp"
14 ////////////////////////////////////////////////////////////////////////////////
16 template<typename K, typename T, typename P, typename DK, typename DT>
17 void dump_map(dump_context& context, const std::map<K,T,P>& data, DK key_fn, DT val_fn)
18 throw(persistent_dump_failed)
20 dump_unsigned(context,data.size());
21 for (typename std::map<K,T,P>::const_iterator i = data.begin(); i != data.end(); i++)
23 key_fn(context,i->first);
24 val_fn(context,i->second);
28 template<typename K, typename T, typename P, typename RK, typename RT>
29 void restore_map(restore_context& context, std::map<K,T,P>& data, RK key_fn, RT val_fn)
30 throw(persistent_restore_failed)
34 restore_unsigned(context,size);
35 for (unsigned j = 0; j < size; j++)
39 val_fn(context,data[key]);
43 ////////////////////////////////////////////////////////////////////////////////
45 } // end namespace stlplus