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 H, typename E, typename DK, typename DT>
17 void dump_hash(dump_context& context, const hash<K,T,H,E>& data, DK key_fn, DT val_fn)
18 throw(persistent_dump_failed)
20 dump_unsigned(context,data.size());
21 for (typename hash<K,T,H,E>::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 H, typename E, typename RK, typename RT>
29 void restore_hash(restore_context& context, hash<K,T,H,E>& 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