ROSE 0.11.145.147
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Rosebud::Serializer Class Referenceabstract

Description

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>

Inheritance diagram for Rosebud::Serializer:
Inheritance graph
[legend]

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< Ptrlookup (const std::vector< std::string > &)
 Returns the serializers registered with the specified names.
 

Member Typedef Documentation

◆ Ptr

Shared-ownership pointer.

Definition at line 19 of file Serializer.h.

Constructor & Destructor Documentation

◆ ~Serializer()

virtual Rosebud::Serializer::~Serializer ( )
inlinevirtual

Definition at line 31 of file Serializer.h.

◆ Serializer()

Rosebud::Serializer::Serializer ( )
inlineprotected

Definition at line 33 of file Serializer.h.

Member Function Documentation

◆ name()

virtual std::string Rosebud::Serializer::name ( ) const
pure virtual

Every serializer has a unique name.

Implemented in Rosebud::BoostSerializer, Rosebud::CerealSerializer, and Rosebud::NoneSerializer.

◆ purpose()

virtual std::string Rosebud::Serializer::purpose ( ) const
pure virtual

Single-line description for the serializer.

Implemented in Rosebud::BoostSerializer, Rosebud::CerealSerializer, and Rosebud::NoneSerializer.

◆ isSerializable()

virtual bool Rosebud::Serializer::isSerializable ( const Ast::ClassPtr ) const
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.

◆ genPrologue()

virtual void Rosebud::Serializer::genPrologue ( std::ostream &  header,
std::ostream &  impl,
const Ast::ClassPtr ,
const Hierarchy ,
const Generator  
) const
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.

◆ genBody()

virtual void Rosebud::Serializer::genBody ( std::ostream &  header,
std::ostream &  impl,
const Ast::ClassPtr ,
const Hierarchy ,
const Generator  
) const
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.

◆ genEpilogue()

virtual void Rosebud::Serializer::genEpilogue ( std::ostream &  header,
std::ostream &  impl,
const Ast::ClassPtr ,
const Hierarchy ,
const Generator  
) const
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.


The documentation for this class was generated from the following file: