diff --git a/src/backend/dynamic_process.cc b/src/backend/dynamic_process.cc index 45a376b..669b9b4 100644 --- a/src/backend/dynamic_process.cc +++ b/src/backend/dynamic_process.cc @@ -135,7 +135,8 @@ DynamicProcess::get_state() const void DynamicProcess::serialize(SerializeVisitor& translator) const { - translator.from_process(*_core); + // translator.from_process(*_core); + translator.from_process(*this); } StaticProcess& diff --git a/src/backend/dynamic_thread.cc b/src/backend/dynamic_thread.cc index 511107b..0dfbf30 100644 --- a/src/backend/dynamic_thread.cc +++ b/src/backend/dynamic_thread.cc @@ -102,7 +102,8 @@ DynamicThread::get_requests() void DynamicThread::serialize(SerializeVisitor& translator) const { - translator.from_thread(*_core); + //translator.from_thread(*_core); + translator.from_thread(*this); } StaticThread& diff --git a/src/backend/serialize_visitor.hh b/src/backend/serialize_visitor.hh index 27f24ce..988223b 100644 --- a/src/backend/serialize_visitor.hh +++ b/src/backend/serialize_visitor.hh @@ -23,9 +23,11 @@ namespace sgpem { + class History; + class Environment; class Resource; - class StaticProcess; - class StaticThread; + class Process; + class Thread; class Request; class SubRequest; } @@ -38,15 +40,58 @@ 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 SerializeVisitor { public: virtual ~SerializeVisitor() = 0; + /** + \brief Add output to the serializer taking data from history + */ + virtual void from_history(const History& obj) = 0; + + /** + \brief Add output to the serializer taking data from environment + */ + virtual void from_environment(const Environment& obj) = 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) = 0; - virtual void from_process(const StaticProcess& obj) = 0; - virtual void from_thread(const StaticThread& obj) = 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) = 0; + + /** + \brief Add output to the serializer taking data from process + */ + virtual void from_process(const Process& obj) = 0; + + /** + \brief Add output to the serializer taking data from thread + */ + virtual void from_thread(const Thread& obj) = 0; + + /** + \brief Add output to the serializer taking data from request + */ virtual void from_request(const Request& obj) = 0; + + /** + \brief Add output to the serializer taking data from subrequest + */ virtual void from_subrequest(const SubRequest& obj) = 0; }; }