#define _SERIALIZATION_VERSION_H(h) ((unsigned short)(h)) << 16
#define _SERIALIZATION_VERSION_L(l) ((unsigned short)(l))
#define _SERIALIZATION_VERSION(h,l) (_SERIALIZATION_VERSION_H(h) | _SERIALIZATION_VERSION_L(l))
#define SERIALIZATION_VERSION _SERIALIZATION_VERSION(1,0)
#define SERIALIZATION_VERSION_L(v) (((unsigned int)(v)) & (0xFFFF))
#define SERIALIZATION_VERSION_H(v) (((unsigned int)(v)) >> 16)
#define SERIALIZATION_FLOAT_PRECISION 16 // 浮点精度
NAMESPACE_SERIALIZATION_BEGIN
#ifdef _MSC_VER
typedef long long _int64_;
typedef unsigned long long _uint64_;
#elif __GNUC__
typedef int64_t _int64_;
typedef uint64_t _uint64_;
#else // unknown
typedef int _int64_;
typedef unsigned int _uint64_;
#endif
class storagepos;
struct storage_type;
typedef _int64_ vehicleoff;
class storagepos
{
public:
typedef storagepos _My;
storagepos(vehicleoff _off=0):m_vehicle_off(_off){}
operator vehicleoff()const{ return m_vehicle_off; }
vehicleoff operator -(const _My& _right)const
{
return (m_vehicle_off - (vehicleoff)_right);
}
_My& operator -=(const _My& _right)
{
m_vehicle_off -= (vehicleoff)_right;
return (*this);
}
vehicleoff operator +(const _My& _right)const
{
return (m_vehicle_off + (vehicleoff)_right);
}
_My& operator +=(const _My& _right)
{
m_vehicle_off += (vehicleoff)_right;
return (*this);
}
bool operator ==(const _My& _right)const
{
return (m_vehicle_off==(vehicleoff)_right);
}
bool operator !=(const _My& _right)const
{
return !(*this==_right);
}
private:
vehicleoff m_vehicle_off;
};
struct storage_type
{
typedef unsigned int VEHICLE_TYPE;
enum
{
_ISTREAM_TYPE,
_OSTREAM_TYPE,
_ISTRING_TYPE,
_OSTRING_TYPE,
_WISTREAM_TYPE,
_WOSTREAM_TYPE,
_WISTRING_TYPE,
_WOSTRING_TYPE,
_IXML_TYPE,
_OXML_TYPE
};
};
template<typename storage_class,storage_type::VEHICLE_TYPE _storage_type> class basic_iarchive_impl;
template<typename storage_class,storage_type::VEHICLE_TYPE _storage_type> class basic_oarchive_impl;
template<typename storage_class,storage_type::VEHICLE_TYPE _storage_type>
struct iarchive_param_deliverer
{
basic_iarchive_impl<storage_class,_storage_type>* m_bii;
storage_class* _storage;
storagepos* _storage_pos;
};
template<typename storage_class,storage_type::VEHICLE_TYPE _storage_type>
struct oarchive_param_deliverer
{
basic_oarchive_impl<storage_class,_storage_type>* m_boi;
storage_class* _storage;
storagepos* _storage_pos;
};
NAMESPACE_SERIALIZATION_END
#endif
//baisc_from_to_archive.hpp
#ifndef BASIC_ARCHIVE_INCLUDE
#define BASIC_ARCHIVE_INCLUDE
#include "archive_config.hpp"
NAMESPACE_SERIALIZATION_BEGIN
template<typename storage_class>
class basic_archive;
template<typename storage_class>
class basic_archive
{
protected:
storage_class* _storage; // 仓库
storagepos _storage_pos;
protected:
basic_archive(const storage_class* sc)
{
_storage = const_cast<storage_class*>(sc);
}
basic_archive();
basic_archive(const basic_archive&);
public:
virtual ~basic_archive(){}
};
NAMESPACE_SERIALIZATION_END
#endif
// basic_archive.hpp
#ifndef BASIC_ARCHIVE_INCLUDE
#define BASIC_ARCHIVE_INCLUDE
#include "archive_config.hpp"
NAMESPACE_SERIALIZATION_BEGIN
template<typename storage_class>
class basic_archive;