00001 #ifndef BspCentral_HPP
00002 #define BspCentral_HPP
00003
00004
00005 #include <map>
00006
00007 #include <vector>
00008
00009
00010 #include "BspProxyStubPool.hpp"
00011 #include "Registration.hpp"
00012 #include "BspPut.hpp"
00013 #include "DrmaManager.hpp"
00014
00015 #include "utils/c++/Config.hpp"
00016 #include "utils/c++/GuardedVariable.hpp"
00017 #include "utils/c++/Condition.hpp"
00018
00019 using namespace std;
00020
00021 class DrmaManager;
00022
00034 class BspCentral{
00035
00036 private:
00037
00038
00039 BspProxyStubPool stubPool;
00042 std::map<int, std::string> tasks;
00044 std::map<int, std::string> iors;
00046 int myPid;
00048 int totalNumProcs;
00052 GuardedVariable<int> superstep;
00053 GuardedVariable<int> synchedProcecess;
00056 GuardedVariable<int> pids;
00060 DrmaManager drmaManager;
00064 pthread_mutex_t bspSynchLock;
00069 Condition globalInitDone;
00073 Condition synchDone;
00078
00079
00084 int getNextPid();
00085
00091 string getIor(int taskNum);
00092
00098 string getTaskId(int taskNum);
00099
00100 public:
00101
00102
00108 BspCentral(Config & config);
00109
00110
00111
00112
00120 void registerRemoteIor(int pid, string ior);
00121
00128 void takeYourPid(int pid);
00129
00134 void waitGlobalInit();
00135
00142 void initSlave(string processZeroIor);
00143
00147 int getPid(){ return myPid; }
00148
00152 void setPid(int pid_){ myPid = pid_; }
00153
00157 void setTotalNumProcs(int numProcs){ totalNumProcs = numProcs; }
00158
00162 int getTotalNumProcs(){ return totalNumProcs; }
00163
00167 string getIor();
00168
00183 void bspPut(int pid, void * src, void * dst, int offset, int nBytes);
00184
00189 void bspSynch();
00190
00196 void bspSynchDone();
00197
00202 void bspLocalSynch();
00203
00209 void addPendingPut(const BspPut & bspPut);
00210
00211
00219 void addPendingRegistration(void * ident, int size);
00220
00221
00227 void addPendingDeregistration(void * ident);
00228
00232 void bspEnd();
00233
00245 void bspGet(int pid, void * src, int offset, void * dst, int nBytes);
00246
00253 void bspGetRequest(const BspGetRequest & request);
00254
00260 void bspGetReply(const BspGetReply & reply);
00261
00270 void bspGetReplyFowarder(const int & pid, const BspGetReply & reply);
00271
00272
00273 };
00274
00275 #endif//BspCentral_HPP
00276
00277
00278