SerializeHelpers.h

Go to the documentation of this file.
00001 #ifndef __SERIALIZEHELPERS_H__
00002 #define __SERIALIZEHELPERS_H__
00003 
00004 #include <vector>
00005 
00006 #include "Serialize.h"
00007 
00008 namespace oasys {
00009 
00010 //----------------------------------------------------------------------------
00011 template<typename _type> void
00012 serialize_basic_vector(oasys::SerializeAction* action,
00013                        std::string             name,
00014                        std::vector<_type>*     v)
00015 {
00016     name += ".size";
00017 
00018     u_int32_t size;
00019     size = v->size();
00020     action->process(name.c_str(), &size);
00021     
00022     if (action->error())
00023         return;
00024 
00025     v->resize(size);
00026     
00027     for (u_int32_t i=0; i<size; ++i)
00028     {
00029         action->process(name.c_str(), &((*v)[i]));
00030         if (action->error())
00031             return;
00032     }
00033 }
00034 
00035 } // namespace oasys
00036 
00037 #endif /* __SERIALIZEHELPERS_H__ */

Generated on Fri Dec 22 14:48:00 2006 for DTN Reference Implementation by  doxygen 1.5.1