00001
00002
00003 #ifndef _BCP_MESSAGE_SINGLE_H
00004 #define _BCP_MESSAGE_SINGLE_H
00005
00006 #include <map>
00007
00008 #include "BcpConfig.h"
00009
00010 #include "BCP_message.hpp"
00011
00012 class BCP_process;
00013
00014
00015
00016 class BCP_single_environment : public BCP_message_environment {
00017 private:
00018 BCP_single_environment(const BCP_single_environment&);
00019 BCP_single_environment& operator=(const BCP_single_environment&);
00020 protected:
00021
00022 int _argnum;
00023 char ** _arglist;
00024 public:
00025 void set_arguments(const int argnum, const char* const * args);
00026 protected:
00027 BCP_single_environment(int my_id) :
00028 _argnum(0), _arglist(NULL), _my_id(my_id) {}
00029 protected:
00030 int _my_id;
00031 static std::map<int, BCP_process*> processes;
00032 public:
00033 BCP_single_environment() : _argnum(0), _arglist(NULL), _my_id() {}
00034 virtual ~BCP_single_environment();
00035
00036 int register_process(USER_initialize* user_init);
00037 int parent_process();
00038
00039 bool alive(const int pid);
00040 const int* alive(int num, const int* pids);
00041
00042 void send(const int target, const BCP_message_tag tag);
00043 void send(const int target,
00044 const BCP_message_tag tag, const BCP_buffer& buf);
00045
00046 void multicast(int num, const int* targets,
00047 const BCP_message_tag tag);
00048 void multicast(int num, const int* targets,
00049 const BCP_message_tag tag, const BCP_buffer& buf);
00050
00051 void receive(const int source,
00052 const BCP_message_tag tag, BCP_buffer& buf,
00053 const double timeout);
00054 bool probe(const int source, const BCP_message_tag tag);
00055
00056 int start_process(const BCP_string& exe,
00057 const bool debug);
00058 int start_process(const BCP_string& exe,
00059 const BCP_string& machine,
00060 const bool debug);
00061 bool start_processes(const BCP_string& exe,
00062 const int proc_num,
00063 const bool debug,
00064 int* ids);
00065 bool start_processes(const BCP_string& exe,
00066 const int proc_num,
00067 const BCP_vec<BCP_string>& machines,
00068 const bool debug,
00069 int* ids);
00070
00071
00072
00073 };
00074
00075 #endif