#ifndef RENDERCONTEXT_H #define RENDERCONTEXT_H /*------------------------ Render context manages a rotor graph as a web service, and renders out linear movies TJR Jan 2014 -------------------------*/ #include "Poco/Task.h" #include "rotor.h" #include "graph.h" namespace Rotor { class Render_context: public Poco::Task { public: Render_context(const std::string& _id): Task(_id) { id=_id; graph.init(id); //set up log AutoPtr splitterChannel(new SplitterChannel()); AutoPtr consoleChannel(new ConsoleChannel()); AutoPtr fileChannel(new FileChannel("Rotord_"+id+".log")); splitterChannel->addChannel(consoleChannel); splitterChannel->addChannel(fileChannel); AutoPtr formatter(new PatternFormatter("%d-%m-%Y %H:%M:%S %s: %t")); AutoPtr formattingChannel(new FormattingChannel(formatter, splitterChannel)); Logger& logger = Logger::create(id, formattingChannel, Message::PRIO_TRACE); logger.information("started thread"); } ~Render_context(){ Logger& logger = Logger::get(id); cancel(); logger.information("stopped thread"); } void runTask() { Logger& logger = Logger::get(id); while (!isCancelled()) { sleep(100); } } Graph graph; private: std::string id; }; }; #endif //RENDERCONTEXT_H