/*
class Consumer : public RoutingModule {
public:
Consumer( CommandQueue* b, Format format )
: RoutingModule(), buffer( b ), formatId( format )
{ }
void init()
{
}
void start()
{
for (;;) {
const Command &command = buffer->remove();
RoutingModule::command( command.command, command.arg );
}
}
const char* name() { return "Consumer"; }
Format inputFormat() { return formatId; }
Format outputFormat() { return formatId; }
private:
CommandQueue *buffer;
Format formatId;
};
class ConsumerThread : public Thread {
public:
ConsumerThread( Consumer *c )
: consumer( c )
{ }
void execute( void* )
{
consumer->start();
}
private:
Consumer *consumer;
};
class ThreadBoundryModule : public RoutingModule {
public:
ThreadBoundryModule( int size, Format format )
: RoutingModule(), readCommandQueue( size ), consumer( &readCommandQueue, format ),
consumerThread( &consumer ), formatId( format )
{
}
void init()
{
}
void connectTo( Module *m, const Frame &f )
{
consumer.connectTo( m, f );
consumerThread.start(0);
}
void process( const Frame &frame )
{
readCommandQueue.add( frame );
}
const char *name() { return "Thread Boundry Module"; }
Format inputFormat() { return formatId; }
Format outputFormat() { return formatId; }
private:
CommandQueue readCommandQueue;
Consumer consumer;
ConsumerThread consumerThread;
Format formatId;
};
class ProcessBoundryThing : public DispatchInterface {
public:
void dispatch( Command *command )
{
}
};
*/