1#ifndef Rosebud_Serializer_H
2#define Rosebud_Serializer_H
3#include <Rosebud/Ast.h>
5#include <Rosebud/Utility.h>
25 static std::vector<Ptr> registry_;
46 static std::vector<Ptr>
lookup(
const std::vector<std::string>&);
53 virtual std::string
name()
const = 0;
95 static void initRegistry();
Base class for backend code generators.
Base class for serialization generators.
virtual void genPrologue(std::ostream &header, std::ostream &impl, const Ast::ClassPtr &, const Hierarchy &, const Generator &) const =0
Generate prologue code.
virtual void genEpilogue(std::ostream &header, std::ostream &impl, const Ast::ClassPtr &, const Hierarchy &, const Generator &) const =0
Generate epilogue code.
SerializerPtr Ptr
Shared-ownership pointer.
static std::vector< Ptr > lookup(const std::vector< std::string > &)
Returns the serializers registered with the specified names.
virtual std::string purpose() const =0
Single-line description for the serializer.
static void registerSerializer(const Ptr &)
Register a serializer for use later.
static const std::vector< Ptr > & registeredSerializers()
Return all registered serializers.
virtual bool isSerializable(const Ast::ClassPtr &) const =0
Determines if a class should be serialized.
static Ptr lookup(const std::string &)
Return the registered serializer with the specified name.
virtual std::string name() const =0
Every serializer has a unique name.
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.
Graph containing user-defined vertices and edges.
std::shared_ptr< Class > ClassPtr
Shared-ownership pointer to a Class.
Rosebud is a tool to generate abstract syntax trees.
std::shared_ptr< Serializer > SerializerPtr
Shared-ownership pointer to a Serializer.