bbssrv2mpi.h
Go to the documentation of this file.00001 #ifndef bbslsrv2_h
00002 #define bbslsrv2_h
00003
00004 #include <nrnmpiuse.h>
00005 #include <InterViews/resource.h>
00006
00007 class MpiMessageList;
00008 class MpiPendingList;
00009 class MpiWorkList;
00010 class MpiReadyList;
00011 class MpiLookingToDoList;
00012 class MpiResultList;
00013 struct bbsmpibuf;
00014
00015 extern "C" {
00016 void bbs_handle();
00017 }
00018
00019 class BBSDirectServer {
00020 public:
00021 BBSDirectServer();
00022 virtual ~BBSDirectServer();
00023
00024 void post(const char* key, bbsmpibuf*);
00025 boolean look(const char* key, bbsmpibuf**);
00026 boolean look_take(const char* key, bbsmpibuf**);
00027 boolean take_pending(const char* key, int* cid);
00028 void put_pending(const char* key, int cid);
00029 static BBSDirectServer* server_;
00030 static void handle();
00031 static void handle1(int size, int tag, int source);
00032 void start();
00033 void done();
00034
00035 void post_todo(int parentid, int cid, bbsmpibuf*);
00036 void context(bbsmpibuf*);
00037 boolean send_context(int cid);
00038 void post_result(int id, bbsmpibuf*);
00039 int look_take_todo(bbsmpibuf**);
00040 int look_take_result(int parentid, bbsmpibuf**);
00041 void context_wait();
00042 private:
00043 void add_looking_todo(int cid);
00044 private:
00045 MpiMessageList* messages_;
00046 MpiPendingList* pending_;
00047 MpiWorkList* work_;
00048 MpiLookingToDoList* looking_todo_;
00049 MpiReadyList* todo_;
00050 MpiResultList* results_;
00051 MpiLookingToDoList* send_context_;
00052 int next_id_;
00053 bbsmpibuf* context_buf_;
00054 int remaining_context_cnt_;
00055 };
00056
00057 #endif