00001
00002
#ifndef CONVERTER_BOX_RUNNER_H
00003
#define CONVERTER_BOX_RUNNER_H
00004
00005
#include <NMSTL/netioevent>
00006
00007
#include "ConverterBox.h"
00008
00009 BOREALIS_NAMESPACE_BEGIN;
00010
00011
class AuroraNode;
00012
class ConfFile;
00013
00014 class ConverterBoxRunner {
00015
public:
00016
ConverterBoxRunner(
AuroraNode& node, ptr<ConfFile> conf)
throw (
AuroraException);
00017
~ConverterBoxRunner();
00018
00019
void start();
00020
00021
00022
void terminate();
00023
00024
private:
00025
class BoxHandler :
public NetHandler<> {
00026
public:
00027 BoxHandler(IOEventLoop &loop, IOHandle h, ptr<ConverterBox> box) :
00028 NetHandler<>(loop, h),
00029 _box(box)
00030 {
00031 }
00032
00033
virtual int incoming_data(constbuf buf);
00034
00035
private:
00036 ptr<ConverterBox> _box;
00037
Stream *_stream;
00038 };
00039
00040
AuroraNode& _node;
00041 IOEventLoop _loop;
00042 CThread _thread;
00043
00044
typedef TCPAcceptor<BoxHandler, ptr<ConverterBox> > BoxAcceptor;
00045 };
00046
00047 BOREALIS_NAMESPACE_END;
00048
00049
#endif