8 #ifndef CPPCMS_SERIALIZATION_CLASSES_H 9 #define CPPCMS_SERIALIZATION_CLASSES_H 11 #include <cppcms/defs.h> 12 #include <booster/copy_ptr.h> 14 #include <booster/backtrace.h> 16 #include <booster/traits/enable_if.h> 17 #include <booster/traits/is_base_of.h> 21 #ifdef CPPCMS_DOXYGEN_DOCS 22 template<
typename Object>
41 template<
typename Object,
typename Enable =
void>
67 void reserve(
size_t size);
72 void write_chunk(
void const *begin,
size_t len);
77 void read_chunk(
void *begin,
size_t len);
82 size_t next_chunk_size();
93 std::string read_chunk_as_string();
106 void mode(mode_type m);
126 void str(std::string
const &str);
162 template<
typename Archivable>
165 if(a.
mode() == archive::save_to_archive)
175 template<
typename Archivable>
185 template<
typename Archivable>
207 virtual void save(
archive &serialized_object)
const = 0;
241 virtual void serialize(
archive &a) = 0;
259 #ifdef CPPCMS_DOXYGEN_DOCS 295 template<
typename Object>
300 static void load(std::string
const &serialized_object,Object &real_object);
305 static void save(Object
const &real_object,std::string &serialized_object);
310 template<
typename Object,
typename Enable =
void>
318 struct serialization_traits<D,typename booster::enable_if<booster::is_base_of<serializable_base,D> >::type> {
325 a.
str(serialized_object);
335 serialized_object = a.
str();
Abstract class for serialization object.
Definition: serialization_classes.h:217
Error thrown in case of serialization error.
Definition: serialization_classes.h:49
Special traits class that describes how to serialize various objects that are not defived from serial...
Definition: serialization_classes.h:27
Same as std::runtime_error but records stack trace.
Definition: backtrace.h:158
mode_type
Definition: serialization_classes.h:98
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
archive & operator>>(archive &a, Archivable &object)
Definition: serialization_classes.h:186
archive & operator&(archive &a, Archivable &object)
Definition: serialization_classes.h:163
static void load(Object &d, archive &a)
virtual void load(archive &serialized_object)=0
static void save(Object const &d, archive &a)
virtual void load(archive &a)
Definition: serialization_classes.h:245
virtual void save(archive &serialized_object) const =0
virtual void save(archive &a) const
Definition: serialization_classes.h:252
Base abstract class for object that can be serialized into std::string.
Definition: serialization_classes.h:198
archive & operator<<(archive &a, Archivable const &object)
Definition: serialization_classes.h:176
This is the traits class for serialization traits.
Definition: serialization_classes.h:296
Class that represents a binary archive that can be stored in persistent storage or transfered...
Definition: serialization_classes.h:61