00001
00002
00003 #ifndef _BCP_MESSAGE_PVM_H
00004 #define _BCP_MESSAGE_PVM_H
00005
00006 #include "BCP_message.hpp"
00007
00008
00009
00010 class BCP_pvm_id : public BCP_proc_id {
00011 private:
00012 int _pid;
00013 public:
00014 BCP_pvm_id(int id = 0) : _pid(id) {}
00015 ~BCP_pvm_id() {}
00016
00017 bool is_same_process(const BCP_proc_id* other_process) const;
00018 inline int pid() const { return _pid; }
00019 inline BCP_proc_id* clone() const { return new BCP_pvm_id(_pid); }
00020 };
00021
00022
00023
00024 class BCP_pvm_environment : public BCP_message_environment {
00025 private:
00026 void check_error(const int code, const char* str) const;
00027 public:
00028 BCP_pvm_environment() {}
00029 ~BCP_pvm_environment();
00030
00031 BCP_proc_id* register_process(USER_initialize* user_init);
00032 BCP_proc_id* parent_process();
00033
00034 bool alive(const BCP_proc_id* pid);
00035 BCP_vec<BCP_proc_id*>::iterator alive(const BCP_proc_array& parray);
00036
00037 void send(const BCP_proc_id* const target, const BCP_message_tag tag);
00038 void send(const BCP_proc_id* const target,
00039 const BCP_message_tag tag, const BCP_buffer& buf);
00040
00041 void multicast(const BCP_proc_array* const target,
00042 const BCP_message_tag tag);
00043 void multicast(const BCP_proc_array* const target,
00044 const BCP_message_tag tag, const BCP_buffer& buf);
00045 void multicast(BCP_vec<BCP_proc_id*>::const_iterator beg,
00046 BCP_vec<BCP_proc_id*>::const_iterator end,
00047 const BCP_message_tag tag);
00048 void multicast(BCP_vec<BCP_proc_id*>::const_iterator beg,
00049 BCP_vec<BCP_proc_id*>::const_iterator end,
00050 const BCP_message_tag tag,
00051 const BCP_buffer& buf);
00052
00053 void receive(const BCP_proc_id* const source,
00054 const BCP_message_tag tag, BCP_buffer& buf,
00055 const double timeout);
00056 bool probe(const BCP_proc_id* const source,
00057 const BCP_message_tag tag);
00058
00059 BCP_proc_id* unpack_proc_id(BCP_buffer& buf);
00060 void pack_proc_id(BCP_buffer& buf, const BCP_proc_id* pid);
00061
00062 BCP_proc_id* start_process(const BCP_string& exe,
00063 const bool debug);
00064 BCP_proc_id* start_process(const BCP_string& exe,
00065 const BCP_string& machine,
00066 const bool debug);
00067 BCP_proc_array* start_processes(const BCP_string& exe,
00068 const int proc_num,
00069 const bool debug);
00070 BCP_proc_array* start_processes(const BCP_string& exe,
00071 const int proc_num,
00072 const BCP_vec<BCP_string>& machines,
00073 const bool debug);
00074
00075
00076
00077 };
00078
00079
00080
00081 int BCP_is_pvm_id(const BCP_proc_id* pid, const char* str);
00082
00083
00084
00085 int* BCP_process_array_2_int(const BCP_proc_array* const target,
00086 const char* str);
00087
00088 #endif