Classdesc 3.44
polyPackBase.h
1/*
2 @copyright Russell Standish 2000-2013
3 @author Russell Standish
4 This file is part of Classdesc
5
6 Open source licensed under the MIT license. See LICENSE for details.
7*/
8
9#ifndef CLASSDESC_POLYPACKBASE_H
10#define CLASSDESC_POLYPACKBASE_H
11
13#include "pack_base.h"
14
15namespace classdesc
16{
19 {
20 virtual void pack(pack_t&, const string&) const=0;
21 virtual void unpack(unpack_t&, const string&)=0;
22 virtual ~PolyPackBase() {}
23 };
24
26
43
44 template <class T>
45 struct PolyPack: virtual public PolyPackBase
46 {
47 void pack(pack_t& x, const string& d) const
48 {::pack(x,d,static_cast<const T&>(*this));}
49
50 void unpack(unpack_t& x, const string& d)
51 {::unpack(x,d,static_cast<T&>(*this));}
52
53 };
54
55 template <> struct tn<PolyPackBase>
56 {
57 static std::string name()
58 {return "classdesc::PolyPackBase";}
59 };
60 template <class T> struct tn<PolyPack<T> >
61 {
62 static std::string name()
63 {return "classdesc::PolyPack<"+typeName<T>()+">";}
64 };
65}
66#endif
67
Definition pack_base.h:138
Contains definitions related to classdesc functionality.
serialisation descriptor
interface for applying pack descriptors to polymorphic objects
Definition polyPackBase.h:19
utility class for defining pack descriptors for polymorphic types
Definition polyPackBase.h:46
Definition classdesc.h:571