File: DebugDispatcher.cpp

package info (click to toggle)
eris 1.2.1-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,360 kB
  • ctags: 1,348
  • sloc: sh: 8,289; cpp: 7,576; perl: 287; ansic: 172; makefile: 143
file content (38 lines) | stat: -rw-r--r-- 720 bytes parent folder | download
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
#ifdef HAVE_CONFIG_H
	#include "config.h"
#endif

#include <Eris/DebugDispatcher.h>

#include <Atlas/Codecs/XML.h>
#include <Atlas/Message/Encoder.h>

#include <fstream>

namespace Eris
{
	
DebugDispatcher::DebugDispatcher(const std::string &logFile) :
	LeafDispatcher("debug")
{
	_log.open(logFile.c_str(), std::ios::out | std::ios::app);
	_log << "=======================================" << std::endl;	
	_codec = new Atlas::Codecs::XML(_log, NULL);
	_enc = new Atlas::Message::Encoder(_codec);
}
	
DebugDispatcher::~DebugDispatcher()
{
	delete _enc;
	delete _codec;
	_log.close();
}

bool DebugDispatcher::dispatch(DispatchContextDeque &dq)
{
	_enc->streamMessage(dq.front());
	_log << std::endl;
	return false;
}

}