00001 #ifndef __J2K__MsgContainer_HPP__
00002 #define __J2K__MsgContainer_HPP__
00003
00004 #include <stdio.h>
00005 #include <errno.h>
00006 #include <stdlib.h>
00007 #include <sys/dispatch.h>
00008
00009 #include <j2k/Fred/Standard.hpp>
00010 #include <j2k/nto/Message.hpp>
00011 #include <j2k/nto/NameSpace.hpp>
00012
00013 enum MsgContainerType_t
00014 {
00015 server = 0,
00016 client = 1
00017 };
00018
00019 class MsgContainer
00020 {
00021 protected:
00022 int fd;
00023 int connected;
00024 NameSpace* n;
00025 Message* message;
00026 Message* replyMsg;
00027 MsgContainerType_t user;
00028
00029 public:
00030 MsgContainer( NameSpace* n0, MsgContainerType_t user0 = client );
00031 virtual ~MsgContainer();
00032
00033 void connect( const char* name = NULL );
00034
00035 void disconnect();
00036
00037 int handleReceive( int rcvid, int replyData = 0 );
00038 int receive();
00039 void send( int data );
00040 void reply( int rcvid, int data );
00041 virtual void run() = 0;
00042 };
00043
00044 #endif