coin-Bcp
BCP_message_pvm.hpp
Go to the documentation of this file.
1 // Copyright (C) 2000, International Business Machines
2 // Corporation and others. All Rights Reserved.
3 #ifndef _BCP_MESSAGE_PVM_H
4 #define _BCP_MESSAGE_PVM_H
5 
6 #include "BcpConfig.h"
7 
8 #if defined(COIN_HAS_PVM)
9 
10 #include "BCP_message.hpp"
11 
12 //#############################################################################
13 
14 class BCP_pvm_environment : public BCP_message_environment {
15 private:
16  void check_error(const int code, const char* str) const;
17 public:
18  BCP_pvm_environment() {}
19  ~BCP_pvm_environment();
20 
21  int register_process(USER_initialize* user_init);
22  int parent_process();
23 
24  bool alive(const int pid);
25  const int* alive(int num, const int* pids);
26 
27  void send(const int target, const BCP_message_tag tag);
28  void send(const int target,
29  const BCP_message_tag tag, const BCP_buffer& buf);
30 
31  void multicast(int num, const int* targets,
32  const BCP_message_tag tag);
33  void multicast(int num, const int* targets,
34  const BCP_message_tag tag, const BCP_buffer& buf);
35 
36  void receive(const int source,
37  const BCP_message_tag tag, BCP_buffer& buf,
38  const double timeout);
39  bool probe(const int source, const BCP_message_tag tag);
40 
41  int start_process(const BCP_string& exe,
42  const bool debug);
43  int start_process(const BCP_string& exe,
44  const BCP_string& machine,
45  const bool debug);
46  bool start_processes(const BCP_string& exe,
47  const int proc_num,
48  const bool debug,
49  int* ids);
50  bool start_processes(const BCP_string& exe,
51  const int proc_num,
52  const BCP_vec<BCP_string>& machines,
53  const bool debug,
54  int* ids);
55 
56 // void stop_process(const int process);
57 // void stop_processes(const BCP_proc_array* processes);
58 };
59 
60 #endif /* COIN_HAS_PVM */
61 
62 #endif
BCP_message_tag
This enumerative constant describes the message tags different processes of BCP understand.
virtual void send(const int target, const BCP_message_tag tag)=0
Send an empty message (message tag only) to the process given by the frist argument.
virtual bool start_processes(const BCP_string &exe, const int proc_num, const bool debug, int *ids)=0
Spawn proc_num processes, all with the same executable.
virtual void receive(const int source, const BCP_message_tag tag, BCP_buffer &buf, const double timeout)=0
Blocking receive with timeout.
This is an abstract base class that describes the message passing environment.
Definition: BCP_message.hpp:30
This class is a very simple impelementation of a constant length string.
Definition: BCP_string.hpp:13
This class is an abstract base class for the initializer class the user has to provide.
Definition: BCP_USER.hpp:160
virtual bool probe(const int source, const BCP_message_tag tag)=0
Probe if there are any messages from the given process with the given message tag.
virtual int start_process(const BCP_string &exe, const bool debug)=0
Spawn a new process.
This class describes the message buffer used for all processes of BCP.
Definition: BCP_buffer.hpp:39
virtual int parent_process()=0
Return the process id of the parent process (the process that spawned the currnet process...
virtual int register_process(USER_initialize *user_init)=0
A process can register (receive its process id) with the message passing environment.
virtual bool alive(const int pid)=0
Test if the process given by the argument is alive or not.
virtual void multicast(int num, const int *targets, const BCP_message_tag tag)=0
Send an empty message (message tag only) to all the processes in the process array.