ROSE 0.11.145.147
|
Base class for serialization generators.
A serialization generator is responsible for generating C++ source code to serialize and deserialize instances of an node class.
Definition at line 13 of file Serializer.h.
#include <Rosebud/Serializer.h>
Public Types | |
using | Ptr = SerializerPtr |
Shared-ownership pointer. | |
Public Member Functions | |
virtual std::string | name () const =0 |
Every serializer has a unique name. | |
virtual std::string | purpose () const =0 |
Single-line description for the serializer. | |
virtual bool | isSerializable (const Ast::ClassPtr &) const =0 |
Determines if a class should be serialized. | |
virtual void | genPrologue (std::ostream &header, std::ostream &impl, const Ast::ClassPtr &, const Hierarchy &, const Generator &) const =0 |
Generate prologue code. | |
virtual void | genBody (std::ostream &header, std::ostream &impl, const Ast::ClassPtr &, const Hierarchy &, const Generator &) const =0 |
Generate main serialization code for the specified class. | |
virtual void | genEpilogue (std::ostream &header, std::ostream &impl, const Ast::ClassPtr &, const Hierarchy &, const Generator &) const =0 |
Generate epilogue code. | |
Static Public Member Functions | |
static void | registerSerializer (const Ptr &) |
Register a serializer for use later. | |
static const std::vector< Ptr > & | registeredSerializers () |
Return all registered serializers. | |
static Ptr | lookup (const std::string &) |
Return the registered serializer with the specified name. | |
static std::vector< Ptr > | lookup (const std::vector< std::string > &) |
Returns the serializers registered with the specified names. | |
Shared-ownership pointer.
Definition at line 19 of file Serializer.h.
|
inlinevirtual |
Definition at line 31 of file Serializer.h.
|
inlineprotected |
Definition at line 33 of file Serializer.h.
|
pure virtual |
Every serializer has a unique name.
Implemented in Rosebud::BoostSerializer, Rosebud::CerealSerializer, and Rosebud::NoneSerializer.
|
pure virtual |
Single-line description for the serializer.
Implemented in Rosebud::BoostSerializer, Rosebud::CerealSerializer, and Rosebud::NoneSerializer.
|
pure virtual |
Determines if a class should be serialized.
Returns true if this class should have serilization and deserialization functions.
Implemented in Rosebud::BoostSerializer, Rosebud::CerealSerializer, and Rosebud::NoneSerializer.
|
pure virtual |
Generate prologue code.
In the header file, the prologue goes immediately after the generated include-once protection and before any user-written pre-class-definition code.
Implemented in Rosebud::BoostSerializer, Rosebud::CerealSerializer, and Rosebud::NoneSerializer.
|
pure virtual |
Generate main serialization code for the specified class.
This code emitted by this function will appear inside the class definition in the header, and near the end of the implementation file.
The header
and impl
streams are output streams for the C++ header file and implementation file, respectively. The generator is from whence this serializer was called.
Implemented in Rosebud::BoostSerializer, Rosebud::CerealSerializer, and Rosebud::NoneSerializer.
|
pure virtual |
Generate epilogue code.
In the header file, this goes at the end of the file, after the class definition and after the namespace (if any) but before the closing compile-once directives.
Implemented in Rosebud::BoostSerializer, Rosebud::CerealSerializer, and Rosebud::NoneSerializer.