summaryrefslogtreecommitdiff
path: root/NT/src/rendercontext.h
blob: 6501c66583b704b602fce7febb6e3124ed780333 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#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> splitterChannel(new SplitterChannel());
			    AutoPtr<Channel> consoleChannel(new ConsoleChannel());
			    AutoPtr<Channel> fileChannel(new FileChannel("Rotord_"+id+".log"));
			    splitterChannel->addChannel(consoleChannel);
			    splitterChannel->addChannel(fileChannel);
			    AutoPtr<Formatter> formatter(new PatternFormatter("%d-%m-%Y %H:%M:%S %s: %t"));
			    AutoPtr<Channel> 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() {
				while (!isCancelled()) {
					sleep(100);
				}
			}
			std::string text_render(std::string node_id="");
			Graph graph;
		private:
			std::string id;
	};
	
};



#endif //RENDERCONTEXT_H