/home/coin/SVN-release/CoinAll-1.1.0/Bcp/src/include/BCP_message_pvm.hpp

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

Generated on Sun Nov 14 14:06:29 2010 for Coin-All by  doxygen 1.4.7