#include <OMKPvmSvmLink.h>
Inheritance diagram for OMK::PvmSvmLink:
Public Member Functions | |
PvmSvmLink (int td) | |
Constructor. | |
virtual | ~PvmSvmLink () |
Destructor. | |
virtual void | send (PvmOutgoingMessage &m, PvmMessage::MessageTag tag) |
send a specific outgoing message along the link | |
virtual PvmIncomingMessage & | waitForMessage (PvmMessage::MessageTag tag) |
wait for a message comming along the link and receive it | |
virtual PvmIncomingMessage * | testForMessage (PvmMessage::MessageTag tag) |
testForMessage. | |
virtual PvmIncomingMessage * | testIfRequestUpdateProcessTable (PvmMessage::MessageTag tag) |
CHADI. | |
virtual PvmMessage::MessageTag | testForAnyMessage (PvmIncomingMessage &receiveBuffer) |
test for any message sent to this site from a specified site. | |
virtual void | unpack (IncomingSynchronisationMessage &) |
unpack from a message | |
virtual void | pack (OutgoingSynchronisationMessage &) const |
pack in a message | |
virtual PvmOutgoingMessage & | getOutgoingBuffer () |
get the outgoing buffer which will be sent at the next call of sendOutgoingBuffer | |
void | sendOutgoingBuffer (PvmMessage::MessageTag tag) |
send the outgoingBuffer | |
virtual int | getTID () |
get the site id of the process at the other end of the link | |
virtual void | printDebuggingInformation () |
printDebugging information | |
Protected Attributes | |
PvmUnicastMessage | _outgoingBuffer |
standard outgoing buffer for that link | |
PvmIncomingMessage | _incomingBuffer |
standard incomming buffer for that link | |
int | _distantSiteId |
distant workstation site id for that link |
Definition at line 30 of file OMKPvmSvmLink.h.
PvmSvmLink::PvmSvmLink | ( | int | td | ) |
Constructor.
Definition at line 30 of file OMKPvmSvmLink.cxx.
00030 : 00031 SvmLink(), 00032 _outgoingBuffer ( td ), 00033 _distantSiteId ( td ) 00034 { 00035 }
PvmSvmLink::~PvmSvmLink | ( | ) | [virtual] |
void PvmSvmLink::send | ( | PvmOutgoingMessage & | m, | |
PvmMessage::MessageTag | tag | |||
) | [virtual] |
send a specific outgoing message along the link
m | the message to send | |
the | tag associated to the message |
Implements OMK::SvmLink.
Definition at line 45 of file OMKPvmSvmLink.cxx.
References OMK::PvmOutgoingMessage::send().
00046 { 00047 m.send ( tag ) ; 00048 }
PvmIncomingMessage & PvmSvmLink::waitForMessage | ( | PvmMessage::MessageTag | tag | ) | [virtual] |
wait for a message comming along the link and receive it
tag | the tag of the message to wait for |
Implements OMK::SvmLink.
Definition at line 62 of file OMKPvmSvmLink.cxx.
References _distantSiteId, _incomingBuffer, and OMK::PvmIncomingMessage::initialise().
00063 { 00064 // attente en reception 00065 int res = pvm_recv (_distantSiteId, tag) ; 00066 00067 _incomingBuffer.initialise ( res ) ; 00068 #ifdef _DEBUGPVMMESS 00069 cerr << "waitForMessage : On recoit un message tag: " << tag << " de " << hex << _distantSiteId << dec << endl; 00070 #endif 00071 // On renvoie le message 00072 return _incomingBuffer ; 00073 }
PvmIncomingMessage * PvmSvmLink::testForMessage | ( | PvmMessage::MessageTag | tag | ) | [virtual] |
testForMessage.
Test to see if a message has arrived and receive it
tag | the tag of the message to wait for |
Implements OMK::SvmLink.
Definition at line 77 of file OMKPvmSvmLink.cxx.
References _distantSiteId, _incomingBuffer, and OMK::PvmIncomingMessage::initialise().
00078 { 00079 #ifdef _DEBUGPVMMESS 00080 cerr << "PvmSvmLink::testForMessage: tag " <<tag<<endl; 00081 #endif 00082 00083 int res = pvm_nrecv (_distantSiteId, tag) ; 00084 00085 if (res >= 0) 00086 { 00087 _incomingBuffer.initialise ( res ); 00088 return &_incomingBuffer ; 00089 } 00090 else 00091 { 00092 return NULL ; 00093 } 00094 }
PvmIncomingMessage * PvmSvmLink::testIfRequestUpdateProcessTable | ( | PvmMessage::MessageTag | tag | ) | [virtual] |
CHADI.
Implements OMK::SvmLink.
Definition at line 97 of file OMKPvmSvmLink.cxx.
References _distantSiteId, _incomingBuffer, OMK::PvmIncomingMessage::initialise(), and OMK::PvmMessage::updateProcessTable.
00098 { 00099 #ifdef _DEBUGPVMMESS 00100 cerr << "PvmSvmLink::testForMessage: tag " <<tag<<endl; 00101 #endif 00102 00103 int res = pvm_nrecv (_distantSiteId, PvmMessage::updateProcessTable) ; 00104 00105 if (res > 0) 00106 { 00107 _incomingBuffer.initialise ( res ); 00108 return &_incomingBuffer ; 00109 } 00110 else 00111 { 00112 return NULL ; 00113 } 00114 }
PvmMessage::MessageTag PvmSvmLink::testForAnyMessage | ( | PvmIncomingMessage & | receiveBuffer | ) | [virtual] |
test for any message sent to this site from a specified site.
This call is non blocking
receiveBuffer | : the user buffer to use to receive any message the tag of the received message |
Implements OMK::SvmLink.
Definition at line 118 of file OMKPvmSvmLink.cxx.
References _distantSiteId, OMK::PvmIncomingMessage::initialise(), and OMASSERT.
00119 { 00120 PvmMessage::MessageTag result ; 00121 00122 int bufid = pvm_nrecv ( _distantSiteId, -1 ) ; //test if any message has arrived from distantDiteId 00123 00124 if ( bufid < 0 ) 00125 { 00126 std::cerr<<"Svm::waitForAnyRequests ERROR "; 00127 switch (bufid) 00128 { 00129 case PvmBadParam: 00130 std::cerr<<"giving an invalid tid value, or msgtag < -1"; 00131 break; 00132 case PvmSysErr: 00133 std::cerr<<"pvmd not responding"; 00134 break; 00135 default: 00136 std::cerr<<"unexpected error"; 00137 OMASSERT( false ) ; 00138 } 00139 std::cerr<<std::endl; 00140 } 00141 00142 if ( bufid != 0 ) 00143 { 00144 int bytes ; 00145 int senderSiteId ; 00146 int msgtag ; 00147 int info = pvm_bufinfo( bufid, &bytes , &msgtag , &senderSiteId ) ; 00148 00149 result = static_cast<PvmMessage::MessageTag>(msgtag) ; 00150 00151 if ( info < 0 ) 00152 { 00153 cerr<<"Svm::waitForAnyRequests ERROR in pvm_bufinfo "; 00154 switch (info) 00155 { 00156 case PvmBadParam: 00157 cerr<<"invalid argument"; 00158 break; 00159 case PvmNoSuchBuf: 00160 cerr<<"specified buffer does not exist"; 00161 break; 00162 default: 00163 cerr<<"unexpected error"; 00164 OMASSERT( false ) ; 00165 } 00166 cerr<<endl; 00167 } 00168 } 00169 00170 receiveBuffer.initialise ( bufid ) ; 00171 00172 return result ; 00173 }
void PvmSvmLink::unpack | ( | IncomingSynchronisationMessage & | ) | [virtual] |
unpack from a message
Implements OMK::Packable.
Definition at line 195 of file OMKPvmSvmLink.cxx.
References _distantSiteId, _outgoingBuffer, and OMK::PvmUnicastMessage::setDistantSiteId().
00196 { 00197 #ifdef _DEBUGPVMMESS 00198 cerr<<"PvmSvmLink::unpack: "; 00199 #endif 00200 in >> _distantSiteId ; 00201 00202 _outgoingBuffer.setDistantSiteId ( _distantSiteId ) ; 00203 #ifdef _DEBUGPVMMESS 00204 cerr<<"distant site Id: "<<_distantSiteId<<endl; 00205 #endif 00206 }
void PvmSvmLink::pack | ( | OutgoingSynchronisationMessage & | ) | const [virtual] |
pack in a message
Implements OMK::Packable.
Definition at line 189 of file OMKPvmSvmLink.cxx.
References _distantSiteId.
00190 { 00191 out << _distantSiteId ; 00192 }
PvmOutgoingMessage & PvmSvmLink::getOutgoingBuffer | ( | ) | [virtual] |
get the outgoing buffer which will be sent at the next call of sendOutgoingBuffer
Implements OMK::SvmLink.
Definition at line 210 of file OMKPvmSvmLink.cxx.
References _outgoingBuffer.
00211 { 00212 return _outgoingBuffer ; 00213 }
void PvmSvmLink::sendOutgoingBuffer | ( | PvmMessage::MessageTag | tag | ) | [virtual] |
send the outgoingBuffer
tag | the tag to send the outgoing message with |
Implements OMK::SvmLink.
Definition at line 52 of file OMKPvmSvmLink.cxx.
References _outgoingBuffer, and OMK::PvmUnicastMessage::send().
00053 { 00054 #ifdef _DEBUGPVMMESS 00055 cerr << "PvmSvmLink::sendOutgoingBuffer (" << tag <<") "<<endl; 00056 #endif 00057 _outgoingBuffer.send ( tag ) ; 00058 }
int PvmSvmLink::getTID | ( | ) | [virtual] |
get the site id of the process at the other end of the link
Implements OMK::SvmLink.
Definition at line 184 of file OMKPvmSvmLink.cxx.
References _distantSiteId.
00185 { 00186 return _distantSiteId ; 00187 }
void PvmSvmLink::printDebuggingInformation | ( | ) | [virtual] |
printDebugging information
Implements OMK::SvmLink.
Definition at line 177 of file OMKPvmSvmLink.cxx.
References _distantSiteId.
00178 { 00179 cerr << "PvmSvmLink:"<<this<<":printDebuggingInformation:_distantSiteIdant : " << hex << _distantSiteId << dec << endl ; 00180 }
PvmUnicastMessage OMK::PvmSvmLink::_outgoingBuffer [protected] |
standard outgoing buffer for that link
Definition at line 99 of file OMKPvmSvmLink.h.
Referenced by getOutgoingBuffer(), sendOutgoingBuffer(), and unpack().
PvmIncomingMessage OMK::PvmSvmLink::_incomingBuffer [protected] |
standard incomming buffer for that link
Definition at line 102 of file OMKPvmSvmLink.h.
Referenced by testForMessage(), testIfRequestUpdateProcessTable(), and waitForMessage().
int OMK::PvmSvmLink::_distantSiteId [protected] |
distant workstation site id for that link
Definition at line 105 of file OMKPvmSvmLink.h.
Referenced by getTID(), pack(), printDebuggingInformation(), testForAnyMessage(), testForMessage(), testIfRequestUpdateProcessTable(), unpack(), and waitForMessage().
Documentation generated on Mon Jun 9 11:46:03 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |