This class holds an array of processes. More...
#include <BCP_message.hpp>
Public Member Functions | |
Constructor and destructor | |
BCP_proc_array () | |
The default constructor creates an empty process array. | |
~BCP_proc_array () | |
The destructor deletes all data members (purges _procs ). | |
Query methods | |
bool | is_free_proc (const int index) |
Determine if the process indexed by the argument is free or not. | |
int | index_of_proc (const BCP_proc_id *proc) |
Return the index of the process given by its process id in the vector of all processes. | |
BCP_vec< BCP_proc_id * > & | procs () |
Return the vector of all processes. | |
const BCP_vec< BCP_proc_id * > & | procs () const |
Return the vector of all processes (const version). | |
const BCP_proc_id * | process (const int i) |
Return a const pointer to the i-th process. | |
int | size () const |
Return the total number of processes. | |
int | free_num () const |
Return the number of free processes. | |
int | busy_num () const |
Return the number of busy (not free) processes. | |
BCP_proc_id * | get_free_proc () |
Get the process id of a free process. | |
Modifying methods | |
void | clear () |
Purge all process ids from the process array. | |
void | add_procs (BCP_vec< BCP_proc_id * >::const_iterator first, BCP_vec< BCP_proc_id * >::const_iterator last) |
Append the processes in [first,last) to the end of the vector of all processes and mark them as free. | |
void | delete_proc (const int index) |
Delete the process indexed by the argument from the vector of all processes (and also from the vector of free processes if applicable). | |
void | set_proc_free (BCP_proc_id *proc) |
Append the process to the end of the vector of free processes. | |
Private Member Functions | |
Disabled methods | |
BCP_proc_array (const BCP_proc_array &) | |
The default constructor is declared but not defined to disable it. | |
BCP_proc_array & | operator= (const BCP_proc_array &) |
The assignment operator is declared but not defined to disable it. | |
Private Attributes | |
Data members | |
BCP_vec< BCP_proc_id * > | _procs |
Vector of all processes. | |
BCP_vec< BCP_proc_id * > | _free_procs |
Vector of free processes (subset of all processes). |
This class holds an array of processes.
Definition at line 61 of file BCP_message.hpp.
BCP_proc_array::BCP_proc_array | ( | const BCP_proc_array & | ) | [private] |
The default constructor is declared but not defined to disable it.
BCP_proc_array::BCP_proc_array | ( | ) | [inline] |
The default constructor creates an empty process array.
Definition at line 82 of file BCP_message.hpp.
BCP_proc_array::~BCP_proc_array | ( | ) | [inline] |
The destructor deletes all data members (purges _procs
).
Definition at line 84 of file BCP_message.hpp.
BCP_proc_array& BCP_proc_array::operator= | ( | const BCP_proc_array & | ) | [private] |
The assignment operator is declared but not defined to disable it.
bool BCP_proc_array::is_free_proc | ( | const int | index | ) | [inline] |
Determine if the process indexed by the argument is free or not.
Definition at line 92 of file BCP_message.hpp.
int BCP_proc_array::index_of_proc | ( | const BCP_proc_id * | proc | ) | [inline] |
Return the index of the process given by its process id in the vector of all processes.
Definition at line 102 of file BCP_message.hpp.
BCP_vec<BCP_proc_id*>& BCP_proc_array::procs | ( | ) | [inline] |
Return the vector of all processes.
Definition at line 110 of file BCP_message.hpp.
const BCP_vec<BCP_proc_id*>& BCP_proc_array::procs | ( | ) | const [inline] |
Return the vector of all processes (const version).
Definition at line 112 of file BCP_message.hpp.
const BCP_proc_id* BCP_proc_array::process | ( | const int | i | ) | [inline] |
Return a const pointer to the i-th process.
Definition at line 114 of file BCP_message.hpp.
int BCP_proc_array::size | ( | ) | const [inline] |
Return the total number of processes.
Definition at line 116 of file BCP_message.hpp.
int BCP_proc_array::free_num | ( | ) | const [inline] |
Return the number of free processes.
Definition at line 118 of file BCP_message.hpp.
int BCP_proc_array::busy_num | ( | ) | const [inline] |
Return the number of busy (not free) processes.
Definition at line 120 of file BCP_message.hpp.
BCP_proc_id* BCP_proc_array::get_free_proc | ( | ) | [inline] |
Get the process id of a free process.
Return 0 if there are none.
Definition at line 122 of file BCP_message.hpp.
void BCP_proc_array::clear | ( | ) | [inline] |
Purge all process ids from the process array.
Definition at line 135 of file BCP_message.hpp.
void BCP_proc_array::add_procs | ( | BCP_vec< BCP_proc_id * >::const_iterator | first, | |
BCP_vec< BCP_proc_id * >::const_iterator | last | |||
) | [inline] |
Append the processes in [first,last)
to the end of the vector of all processes and mark them as free.
Definition at line 141 of file BCP_message.hpp.
void BCP_proc_array::delete_proc | ( | const int | index | ) | [inline] |
Delete the process indexed by the argument from the vector of all processes (and also from the vector of free processes if applicable).
Definition at line 153 of file BCP_message.hpp.
void BCP_proc_array::set_proc_free | ( | BCP_proc_id * | proc | ) | [inline] |
Append the process to the end of the vector of free processes.
The process to be set free must already be in the vector of all processes.
Definition at line 169 of file BCP_message.hpp.
BCP_vec<BCP_proc_id*> BCP_proc_array::_procs [private] |
Vector of all processes.
Definition at line 74 of file BCP_message.hpp.
BCP_vec<BCP_proc_id*> BCP_proc_array::_free_procs [private] |
Vector of free processes (subset of all processes).
Definition at line 76 of file BCP_message.hpp.