BCP_message_environment Class Reference

This is an abstract base class that describes the message passing environment. More...

#include <BCP_message.hpp>

Inheritance diagram for BCP_message_environment:
Inheritance graph
[legend]

List of all members.

Public Member Functions

Destructor



virtual ~BCP_message_environment ()
 Being virtual, the destructor invokes the destructor for the real type of the object being deleted.
Registering a process



virtual BCP_proc_idregister_process (USER_initialize *user_init)=0
 A process can register (receive its process id) with the message passing environment.
Identify parent process



virtual BCP_proc_idparent_process ()=0
 Return the process id of the parent process (the process that spawned the currnet process.
Testing processes



virtual bool alive (const BCP_proc_id *pid)=0
 Test if the process given by the argument is alive or not.
virtual BCP_vec< BCP_proc_id * >
::iterator 
alive (const BCP_proc_array &parray)=0
 Test if the processes given by the process array in the argument are alive or not.
Send to one process



virtual void send (const BCP_proc_id *const target, const BCP_message_tag tag)=0
 Send an empty message (message tag only) to the process given by the frist argument.
virtual void send (const BCP_proc_id *const target, const BCP_message_tag tag, const BCP_buffer &buf)=0
 Send the message in the buffer with the given message tag to the process given by the first argument.
Broadcasting



virtual void multicast (const BCP_proc_array *const target, const BCP_message_tag tag)=0
 Send an empty message (message tag only) to all the processes in the process array.
virtual void multicast (const BCP_proc_array *const target, const BCP_message_tag tag, const BCP_buffer &buf)=0
 Send the message in the buffer with the given message tag to all processes in the process array.
Selective broadcasting



virtual void multicast (BCP_vec< BCP_proc_id * >::const_iterator beg, BCP_vec< BCP_proc_id * >::const_iterator end, const BCP_message_tag tag)=0
 Send an empty message (message tag only) to the processes in [beg, end).
virtual void multicast (BCP_vec< BCP_proc_id * >::const_iterator beg, BCP_vec< BCP_proc_id * >::const_iterator end, const BCP_message_tag tag, const BCP_buffer &buf)=0
 Send the message in the buffer with the given message tag to the processes in [beg, end).
Receiving



virtual void receive (const BCP_proc_id *const source, const BCP_message_tag tag, BCP_buffer &buf, const double timeout)=0
 Blocking receive with timeout.
virtual bool probe (const BCP_proc_id *const source, const BCP_message_tag tag)=0
 Probe if there are any messages from the given process with the given message tag.
Starting a process



virtual BCP_proc_idstart_process (const BCP_string &exe, const bool debug)=0
 Spawn a new process.
virtual BCP_proc_idstart_process (const BCP_string &exe, const BCP_string &machine, const bool debug)=0
 Spawn a new process on the machine specified by the second argument.
virtual BCP_proc_arraystart_processes (const BCP_string &exe, const int proc_num, const bool debug)=0
 Spawn proc_num processes, all with the same executable.
virtual BCP_proc_arraystart_processes (const BCP_string &exe, const int proc_num, const BCP_vec< BCP_string > &machines, const bool debug)=0
 Spawn proc_num processes on the machines given by the third argument, all with the same executable.
Pack/unpack process id



virtual BCP_proc_idunpack_proc_id (BCP_buffer &buf)=0
 Unpack a process id from the buffer given in the argument.
virtual void pack_proc_id (BCP_buffer &buf, const BCP_proc_id *pid)=0
 Pack the process id into the buffer.
Additional function for MPI interface



virtual int num_procs ()
 Return the number of processes.

Detailed Description

This is an abstract base class that describes the message passing environment.

The implementation of the message passing protocol must implement this class.

All methods are pure virtual, enforcing the correct overriding of the methods.

Definition at line 184 of file BCP_message.hpp.


Constructor & Destructor Documentation

virtual BCP_message_environment::~BCP_message_environment (  )  [inline, virtual]

Being virtual, the destructor invokes the destructor for the real type of the object being deleted.

Definition at line 190 of file BCP_message.hpp.


Member Function Documentation

virtual BCP_proc_id* BCP_message_environment::register_process ( USER_initialize user_init  )  [pure virtual]

A process can register (receive its process id) with the message passing environment.

Implemented in BCP_single_environment.

virtual BCP_proc_id* BCP_message_environment::parent_process (  )  [pure virtual]

Return the process id of the parent process (the process that spawned the currnet process.

Returns null if the process does not have a parent.

Implemented in BCP_single_environment.

virtual bool BCP_message_environment::alive ( const BCP_proc_id pid  )  [pure virtual]

Test if the process given by the argument is alive or not.

Return true if alive, false otherwise.

Implemented in BCP_single_environment.

virtual BCP_vec<BCP_proc_id*>::iterator BCP_message_environment::alive ( const BCP_proc_array parray  )  [pure virtual]

Test if the processes given by the process array in the argument are alive or not.

Return an iterator to the first dead process, or to the end of the array if there are no dead processes.

Implemented in BCP_single_environment.

virtual void BCP_message_environment::send ( const BCP_proc_id *const   target,
const BCP_message_tag  tag 
) [pure virtual]

Send an empty message (message tag only) to the process given by the frist argument.

Implemented in BCP_single_environment.

virtual void BCP_message_environment::send ( const BCP_proc_id *const   target,
const BCP_message_tag  tag,
const BCP_buffer buf 
) [pure virtual]

Send the message in the buffer with the given message tag to the process given by the first argument.

Implemented in BCP_single_environment.

virtual void BCP_message_environment::multicast ( const BCP_proc_array *const   target,
const BCP_message_tag  tag 
) [pure virtual]

Send an empty message (message tag only) to all the processes in the process array.

Implemented in BCP_single_environment.

virtual void BCP_message_environment::multicast ( const BCP_proc_array *const   target,
const BCP_message_tag  tag,
const BCP_buffer buf 
) [pure virtual]

Send the message in the buffer with the given message tag to all processes in the process array.

Implemented in BCP_single_environment.

virtual void BCP_message_environment::multicast ( BCP_vec< BCP_proc_id * >::const_iterator  beg,
BCP_vec< BCP_proc_id * >::const_iterator  end,
const BCP_message_tag  tag 
) [pure virtual]

Send an empty message (message tag only) to the processes in [beg, end).

Implemented in BCP_single_environment.

virtual void BCP_message_environment::multicast ( BCP_vec< BCP_proc_id * >::const_iterator  beg,
BCP_vec< BCP_proc_id * >::const_iterator  end,
const BCP_message_tag  tag,
const BCP_buffer buf 
) [pure virtual]

Send the message in the buffer with the given message tag to the processes in [beg, end).

Implemented in BCP_single_environment.

virtual void BCP_message_environment::receive ( const BCP_proc_id *const   source,
const BCP_message_tag  tag,
BCP_buffer buf,
const double  timeout 
) [pure virtual]

Blocking receive with timeout.

Wait until a message is received from the given process with the given message tag within the given timelimit. If timeout is positive then the receive routine times out after this many seconds. If it is negative then the method blocks until a message is received. The received message is saved into the buffer. With a 0 pointer as the first argument (or the predefined BCP_AnyProcess process id can be used) a message from any process will be accepted. Messages with any message tag are accepted if the second argument is BCP_Msg_AnyMessage.

Implemented in BCP_single_environment.

virtual bool BCP_message_environment::probe ( const BCP_proc_id *const   source,
const BCP_message_tag  tag 
) [pure virtual]

Probe if there are any messages from the given process with the given message tag.

Return true if such a message is found, false otherwise. Note that the message is not "read", only its existence is checked. Similarly as above, the wild cards BCP_AnyProcess and BCP_Msg_AnyMessage can be used.

Implemented in BCP_single_environment.

virtual BCP_proc_id* BCP_message_environment::start_process ( const BCP_string exe,
const bool  debug 
) [pure virtual]

Spawn a new process.

The first argument contains the path to the executable to be spawned. If the second argument is set to true, then the executable is spawned under a debugger.

Implemented in BCP_single_environment.

virtual BCP_proc_id* BCP_message_environment::start_process ( const BCP_string exe,
const BCP_string machine,
const bool  debug 
) [pure virtual]

Spawn a new process on the machine specified by the second argument.

Implemented in BCP_single_environment.

virtual BCP_proc_array* BCP_message_environment::start_processes ( const BCP_string exe,
const int  proc_num,
const bool  debug 
) [pure virtual]

Spawn proc_num processes, all with the same executable.

Implemented in BCP_single_environment.

virtual BCP_proc_array* BCP_message_environment::start_processes ( const BCP_string exe,
const int  proc_num,
const BCP_vec< BCP_string > &  machines,
const bool  debug 
) [pure virtual]

Spawn proc_num processes on the machines given by the third argument, all with the same executable.

Implemented in BCP_single_environment.

virtual BCP_proc_id* BCP_message_environment::unpack_proc_id ( BCP_buffer buf  )  [pure virtual]

Unpack a process id from the buffer given in the argument.

Implemented in BCP_single_environment.

virtual void BCP_message_environment::pack_proc_id ( BCP_buffer buf,
const BCP_proc_id pid 
) [pure virtual]

Pack the process id into the buffer.

Implemented in BCP_single_environment.

virtual int BCP_message_environment::num_procs (  )  [inline, virtual]

Return the number of processes.

For non-MPI this just returns 0.

Definition at line 323 of file BCP_message.hpp.


The documentation for this class was generated from the following file:

Generated on 15 Mar 2015 for Coin-All by  doxygen 1.6.1