#include "state.h"
#include "signaller.h"
+#include <libcxml/cxml.h>
+#include <libxml++/libxml++.h>
#include <boost/signals2.hpp>
+#include <string>
+#include <map>
+
+class Job;
class Event
{
Event (cxml::ConstNodePtr node);
void set (std::string k, std::string v);
+ std::string get (std::string k) const;
- void as_xml (cxml::NodePtr parent) const;
+ void as_xml (xmlpp::Element* parent) const;
std::string dump () const;
private:
struct timeval _time;
- std::map<std::string k, std::string v) _data;
+ std::map<std::string, std::string> _data;
};
class Analytics : public State, public Signaller
{
public:
Analytics ();
+ ~Analytics ();
- void job_state_changed (boost::shared_ptr<Job> job);
+ void start ();
- void write () const;
- void read ();
+ void job_state_changed (boost::shared_ptr<Job> job);
boost::signals2::signal<void (std::string, std::string)> Message;
static Analytics* instance ();
private:
- /** Mutex to protect _events */
- boost::mutex _mutex;
+ int successful_dcp_encodes () const;
+ void xmlpp_document (xmlpp::Document &) const;
+ void write () const;
+ void read ();
+ void thread ();
+
+ /** Mutex to protect _id and _events */
+ mutable boost::mutex _mutex;
+ std::string _id;
std::list<Event> _events;
+ boost::thread* _thread;
static Analytics* _instance;
static int const _current_version;
};