/home/coin/SVN-release/CoinAll-1.1.0/Bcp/src/include/BCP_message_single.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_SINGLE_H
00004 #define _BCP_MESSAGE_SINGLE_H
00005 
00006 #include "BCP_process.hpp"
00007 #include "BCP_message.hpp"
00008 #include "BCP_tm.hpp"
00009 #include "BCP_lp.hpp"
00010 #include "BCP_cg.hpp"
00011 #include "BCP_vg.hpp"
00012 //#include "BCP_cp.hpp"
00013 //#include "BCP_vp.hpp"
00014 
00015 //#############################################################################
00016 
00017 class BCP_single_id : public BCP_proc_id {
00018 private:
00019    int _pid;
00020 public:
00021    BCP_single_id(int id = -1) : _pid(id) {}
00022    ~BCP_single_id() {}
00023 
00024    bool is_same_process(const BCP_proc_id* other_process) const;
00025    inline int pid() const { return _pid; }
00026    BCP_single_id* clone() const { return new BCP_single_id(_pid); }
00027 };
00028 
00029 inline bool
00030 operator<(const BCP_single_id& id0, const BCP_single_id& id1)
00031 {
00032    return id0.pid() < id1.pid();
00033 }
00034 
00035 //#############################################################################
00036 
00037 class BCP_single_environment : public BCP_message_environment {
00038 private:
00039    BCP_single_environment(const BCP_single_environment&);
00040    BCP_single_environment& operator=(const BCP_single_environment&);
00041 protected:
00042   // The argument list of the started process
00043   int _argnum;
00044   char ** _arglist;
00045 public:
00046   void set_arguments(const int argnum, const char* const * args);
00047 protected:
00048    BCP_single_environment(BCP_single_id& my_id) :
00049      _argnum(0), _arglist(NULL), _my_id(my_id) {}
00050 protected:
00051    BCP_single_id _my_id;
00052    static std::map<BCP_single_id, BCP_process*> processes;
00053 public:
00054    BCP_single_environment() : _argnum(0), _arglist(NULL), _my_id() {}
00055    virtual ~BCP_single_environment();
00056    
00057    virtual BCP_proc_id* register_process(USER_initialize* user_init);
00058    virtual BCP_proc_id* parent_process();
00059 
00060    virtual bool alive(const BCP_proc_id* pid); 
00061    virtual BCP_vec<BCP_proc_id*>::iterator alive(const BCP_proc_array& parray);
00062 
00063    virtual void send(const BCP_proc_id* const target,
00064                      const BCP_message_tag tag);
00065    virtual void send(const BCP_proc_id* const target,
00066                      const BCP_message_tag tag, const BCP_buffer& buf);
00067 
00068    virtual void multicast(const BCP_proc_array* const target,
00069                           const BCP_message_tag tag);
00070    virtual void multicast(const BCP_proc_array* const target,
00071                           const BCP_message_tag tag, const BCP_buffer& buf);
00072    virtual void multicast(BCP_vec<BCP_proc_id*>::const_iterator beg,
00073                           BCP_vec<BCP_proc_id*>::const_iterator end,
00074                           const BCP_message_tag tag);
00075    virtual void multicast(BCP_vec<BCP_proc_id*>::const_iterator beg,
00076                           BCP_vec<BCP_proc_id*>::const_iterator end,
00077                           const BCP_message_tag tag,
00078                           const BCP_buffer& buf);
00079 
00080    virtual void receive(const BCP_proc_id* const source,
00081                         const BCP_message_tag tag, BCP_buffer& buf,
00082                         const double timeout);
00083    virtual bool probe(const BCP_proc_id* const source,
00084                       const BCP_message_tag tag);
00085 
00086    virtual BCP_proc_id* unpack_proc_id(BCP_buffer& buf);
00087    virtual void pack_proc_id(BCP_buffer& buf, const BCP_proc_id* pid);
00088 
00089    virtual BCP_proc_id* start_process(const BCP_string& exe,
00090                                       const bool debug);
00091    virtual BCP_proc_id* start_process(const BCP_string& exe,
00092                                       const BCP_string& machine,
00093                                       const bool debug);
00094    virtual BCP_proc_array* start_processes(const BCP_string& exe,
00095                                            const int proc_num,
00096                                            const bool debug);
00097    virtual BCP_proc_array* start_processes(const BCP_string& exe,
00098                                            const int proc_num,
00099                                            const BCP_vec<BCP_string>& machines,
00100                                            const bool debug);
00101 
00102 //    void stop_process(const BCP_proc_id* process);
00103 //    void stop_processes(const BCP_proc_array* processes);
00104 };
00105 
00106 //#############################################################################
00107 
00108 BCP_single_id* BCP_is_single_id(const BCP_proc_id* pid, const char* str);
00109 
00110 #endif

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