Debian Codegraph @

examples/ExtBaseIO.hh

raw
1 #ifndef GSEXAMPLE_EXTBASEIO_HH_
2 #define GSEXAMPLE_EXTBASEIO_HH_
3
4 // The header for the top-level base class in the hierarchy
5 #include "ExtBase.hh"
6
7 // Header for the I/O factory template
8 #include "geners/AbsReaderWriter.hh"
9
10 // Header for the macro associating a class with the I/O factory
11 #include "geners/associate_serialization_factory.hh"
12
13 // I/O factory for classes derived from ExtBase.
14 // Note the absence of public constructors.
15 class IOFactoryForExtBase : public gs::DefaultReaderWriter<ExtBase>
16 {
17 friend class gs::StaticReaderWriter<IOFactoryForExtBase>;
18 IOFactoryForExtBase();
19 };
20
21 // I/O factory wrapped into a singleton
22 typedef gs::StaticReaderWriter<IOFactoryForExtBase> StaticIOFactoryForExtBase;
23
24 // If the top-level base is not pure virtual, you also need to develop
25 // the I/O wrapper for it. The corresponding declarations can be placed
26 // here, for example.
27
28 // Call the necessary macros to register the ExtBase class with Geners
29 gs_specialize_class_id(ExtBase, 1)
30 gs_declare_type_external(ExtBase)
31 gs_associate_serialization_factory(ExtBase, StaticIOFactoryForExtBase)
32
33 #endif // GSEXAMPLE_EXTBASEIO_HH_