// src/backend/serialize_visitor.hh - Copyright 2005, 2006, University
//               of Padova, dept. of Pure and Applied
//               Mathematics
//
// This file is part of SGPEMv2.
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// SGPEMv2 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with SGPEMv2; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

#ifndef SERIALIZE_VISITOR_HH
#define SERIALIZE_VISITOR_HH 1

namespace sgpem
{
  class History;
  class Environment;
  class Resource;
  class Process;
  class Thread;
  class Request;
  class SubRequest;
}

#include "config.h"

#include <sgpemv2/serializer_error.hh>

#include <glibmm/ustring.h>

namespace sgpem
{
  class SerializeVisitor;

  /**
    \brief Interface class to serialize data

    This class is a virtual class and each method must be reimplemented
    in derived classes to have effective serialization.
   */
  class SG_DLLEXPORT SerializeVisitor
  {
  public:
    virtual ~SerializeVisitor() = 0;

    /**
      \brief Add output to the serializer taking data from history
     */
    virtual void from_history(const History& obj) throw(SerializerError) = 0;

    /**
      \brief Add output to the serializer taking data from environment
     */
    virtual void from_environment(const Environment& obj) throw(SerializerError) = 0;

    /**
      \brief Add output to the serializer taking data from resource
      BUG: a resource must be saved with her own associated key.
     */
    virtual void from_resource(const Resource& obj) throw(SerializerError) = 0;


    /**
      \brief Add output to the serializer taking data from resource and key
      BUG FIXED: This save a resource with her own associated key.
     */
    virtual void from_resource(const Resource& obj, const Glib::ustring& key) throw(SerializerError) = 0;

    /**
      \brief Add output to the serializer taking data from process
     */
    virtual void from_process(const Process& obj) throw(SerializerError) = 0;

    /**
      \brief Add output to the serializer taking data from thread
     */
    virtual void from_thread(const Thread& obj) throw(SerializerError) = 0;

    /**
      \brief Add output to the serializer taking data from request
     */
    virtual void from_request(const Request& obj) throw(SerializerError) = 0;

    /**
      \brief Add output to the serializer taking data from subrequest
     */
    virtual void from_subrequest(const SubRequest& obj) throw(SerializerError) = 0;
  };
}

#endif

