Update of /cvsroot/pclasses/pclasses2/src/s11n
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10013/src/s11n
Modified Files:
reg_map_specializations.h test.cpp
Log Message:
map de/ser is working.
Index: reg_map_specializations.h
===================================================================
RCS file: /cvsroot/pclasses/pclasses2/src/s11n/reg_map_specializations.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- reg_map_specializations.h 26 Dec 2004 01:26:15 -0000 1.3
+++ reg_map_specializations.h 26 Dec 2004 01:54:34 -0000 1.4
@@ -36,6 +36,7 @@
} // anon namespace
+namespace P {
namespace s11n {
@@ -54,7 +55,7 @@
-} // namespace s11n
+} } // namespace P::s11n
#undef PS11N_MAP_TYPE_PROXY
#undef PS11N_MAP_TYPE_NAME
Index: test.cpp
===================================================================
RCS file: /cvsroot/pclasses/pclasses2/src/s11n/test.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- test.cpp 26 Dec 2004 01:43:29 -0000 1.2
+++ test.cpp 26 Dec 2004 01:54:34 -0000 1.3
@@ -3,11 +3,13 @@
#include <pclasses/s11n/s11n_node.h>
#include <pclasses/s11n/s11n_debuggering_macros.h>
#include <pclasses/s11n/list.h>
+#include <pclasses/s11n/map.h>
#include <pclasses/s11n/pods_streamable.h>
#include <pclasses/Util/LexT.h>
#include <memory> // auto_ptr
#include <cassert>
#include <list>
+#include <map>
#define NODE_TYPE ::P::s11n::s11n_node
#define SERIALIZE(Node,SType,SObj) ::P::s11n::serialize< NODE_TYPE >( Node, SObj )
@@ -109,17 +111,35 @@
using ::P::Util::LexT;
typedef std::list<LexT> ListT;
+ typedef std::map<int,LexT> MapT;
ListT list;
+ MapT map;
+ LexT tmpval;
for( int i = 0; i < 10; i++ )
{
- list.push_back( LexT( std::string("this is item #") + LexT(i).str() ) );
+ tmpval = std::string("this is item #") + LexT(i).str();
+ CERR << "Adding ["<<tmpval<<"]\n";
+ list.push_back( tmpval );
+ map[i] = tmpval;
}
- assert( SERIALIZE(node,ListT,list) );
+ CERR << "list/map sizes == " << list.size() << " , " << map.size()<<"\n";
+
+ bool worked;
+ CERR << "Containers...\n";
+
+ assert( SERIALIZE(node,ListT,list) );
list.clear();
+ worked = ::P::s11n::deserialize( node, list );
+ assert( worked && "deser list failed :(" );
+ CERR << "deser list.size() == " << list.size()<<"\n";
+
+ node.clear();
+ assert( SERIALIZE(node,MapT,map) );
+ map.clear();
+ worked = ::P::s11n::deserialize( node, map );
+ assert( worked && "deser map failed :(" );
+ CERR << "map.size() == " << map.size()<<"\n";
- bool worked = ::P::s11n::deserialize( node, list );
- assert( worked && "deser list failed :(" );
- CERR << "list.size() == " << list.size()<<"\n";
return 0;
}
|