// plugin/xmlsave/src/xml_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 XML_VISITOR_HH #define XML_VISITOR_HH 1 namespace sgpem { class Resource; class Process; class Thread; class Request; class SubRequest; } #include "config.h" #include #include #include #include namespace sgpem { class XMLVisitor; /** \brief Serialize objects to XML This class is a concrete class derived from SerializeVisitor and implements each methodto serialize into an xml tree. The pointer to the sgpem (root) node must be passed as constructor parameter. */ class XMLVisitor : public SerializeVisitor { public: /** \brief Class constructor to save to the passed XML tree Build an XMLVisitor taking a pointer to an xml node as parameter. Every called method see this node as his relative root. */ XMLVisitor(xmlNodePtr current); /** \brief A pretty virtual destructor */ virtual ~XMLVisitor(); /** \brief Add output to the serializer taking data from history Wrapper method: call from_history(xmlNodePtr parent, const History& obj); */ virtual void from_history(const History& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from environment Wrapper method: call from_environment(xmlNodePtr parent, const Environment& obj); */ virtual void from_environment(const Environment& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from resource BUG: a resource must be saved with her own associated key. Throw an exception. */ virtual void from_resource(const Resource& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from resource and key BUG FIXED: This save a resource with her own associated key. Wrapper method: call from_resource(xmlNodePtr parent, const Resource& obj, const Glib::ustring& key); */ virtual void from_resource(const Resource& obj, const Glib::ustring& key) throw(SerializerError); /** \brief Add output to the serializer taking data from process Wrapper method: call from_process(xmlNodePtr parent, const Process& obj); */ virtual void from_process(const Process& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from thread Wrapper method: call from_thread(xmlNodePtr parent, const Thread& obj); */ virtual void from_thread(const Thread& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from request Wrapper method: call from_request(xmlNodePtr parent, const Request& obj); */ virtual void from_request(const Request& obj) throw(SerializerError); /** \brief Add output to the serializer taking data from subrequest Wrapper method: call from_subrequest(xmlNodePtr parent, const SubRequest& obj); */ virtual void from_subrequest(const SubRequest& obj) throw(SerializerError); private: void from_history(xmlNodePtr parent, const History& obj) throw(SerializerError); void from_environment(xmlNodePtr parent, const Environment& obj) throw(SerializerError); void from_resource(xmlNodePtr parent, const Resource& obj, const Glib::ustring& key) throw(SerializerError); void from_process(xmlNodePtr parent, const Process& obj) throw(SerializerError); void from_thread(xmlNodePtr parent, const Thread& obj) throw(SerializerError); void from_request(xmlNodePtr parent, const Request& obj) throw(SerializerError); void from_subrequest(xmlNodePtr parent, const SubRequest& obj) throw(SerializerError); xmlNodePtr _current; }; } // ~namespace #endif //~ XML_VISITOR_HH