#include <SlaveQueue.h>
Public Member Functions | |
int | id () const |
int | post (MsgBuf &ptr) |
unsigned long | rcv (MsgBuf &ptr) |
unsigned long | rcvNonBlocking (MsgBuf &ptr) |
unsigned long | rcvNonBlockingAny (MsgBuf &ptr) |
bool | rcvQuiet (MsgBuf &ptr) |
SlaveQueue (unsigned int ind) | |
~SlaveQueue () | |
Private Attributes | |
int | queue_id_ |
Definition at line 17 of file SlaveQueue.h.
SlaveQueue::SlaveQueue | ( | unsigned int | ind | ) |
Definition at line 5 of file SlaveQueue.cc.
References QUEUE_ID, and queue_id_.
: queue_id_(0) { /* get an (existing) public message queue */ queue_id_ = msgget(QUEUE_ID + ind, 0); if (queue_id_ == -1) { XCEPT_RAISE(evf::Exception, "failed to get message queue"); } }
SlaveQueue::~SlaveQueue | ( | ) |
Definition at line 15 of file SlaveQueue.cc.
{ }
int SlaveQueue::id | ( | void | ) | const |
int SlaveQueue::post | ( | MsgBuf & | ptr | ) |
Definition at line 18 of file SlaveQueue.cc.
References gather_cfg::cout, evf::MsgBuf::msize(), evf::MsgBuf::ptr_, and queue_id_.
Referenced by evf::Vulture::control(), and evf::SubProcess::postSlave().
unsigned long SlaveQueue::rcv | ( | MsgBuf & | ptr | ) |
Definition at line 28 of file SlaveQueue.cc.
References MSGQ_MESSAGE_TYPE_RANGE, evf::MsgBuf::msize(), MSQS_MESSAGE_TYPE_SLA, evf::MsgBuf::ptr_, and queue_id_.
Referenced by evf::Vulture::control(), and evf::SubProcess::rcvSlave().
{ unsigned long msg_type = MSQS_MESSAGE_TYPE_SLA; int rc = msgrcv(queue_id_, ptr.ptr_, ptr.msize() + 1, -msg_type, 0); if (rc == -1 && errno != ENOMSG) { std::string serr = "rcv::Slave failed to get message from queue - error:"; serr += strerror(errno); XCEPT_RAISE(evf::Exception, serr); } else if (rc == -1 && errno == ENOMSG) return MSGQ_MESSAGE_TYPE_RANGE; return msg_type; }
unsigned long SlaveQueue::rcvNonBlocking | ( | MsgBuf & | ptr | ) |
Definition at line 49 of file SlaveQueue.cc.
References MSGQ_MESSAGE_TYPE_RANGE, evf::MsgBuf::msize(), MSQS_MESSAGE_TYPE_SLA, evf::MsgBuf::ptr_, and queue_id_.
Referenced by evf::SubProcess::rcvSlaveNonBlocking().
{ unsigned long msg_type = MSQS_MESSAGE_TYPE_SLA; int rc = msgrcv(queue_id_, ptr.ptr_, ptr.msize() + 1, -msg_type, IPC_NOWAIT); if (rc == -1 && errno != ENOMSG) { std::string serr = "rcvnb::Slave failed to get message from queue - error:"; serr += strerror(errno); XCEPT_RAISE(evf::Exception, serr); } else if (rc == -1 && errno == ENOMSG) return MSGQ_MESSAGE_TYPE_RANGE; return msg_type; }
unsigned long SlaveQueue::rcvNonBlockingAny | ( | MsgBuf & | ptr | ) |
Definition at line 63 of file SlaveQueue.cc.
References MSGQ_MESSAGE_TYPE_RANGE, evf::MsgBuf::msize(), evf::MsgBuf::ptr_, and queue_id_.
{ unsigned long msg_type = 0; int rc = msgrcv(queue_id_, ptr.ptr_, ptr.msize() + 1, msg_type, IPC_NOWAIT); if (rc == -1 && errno != ENOMSG) { std::string serr = "rcvnb::Slave failed to get message from queue - error:"; serr += strerror(errno); XCEPT_RAISE(evf::Exception, serr); } else if (rc == -1 && errno == ENOMSG) return MSGQ_MESSAGE_TYPE_RANGE; return msg_type; }
bool SlaveQueue::rcvQuiet | ( | MsgBuf & | ptr | ) |
Definition at line 41 of file SlaveQueue.cc.
References evf::MsgBuf::msize(), evf::MsgBuf::ptr_, and queue_id_.
int evf::SlaveQueue::queue_id_ [private] |
Definition at line 33 of file SlaveQueue.h.
Referenced by id(), post(), rcv(), rcvNonBlocking(), rcvNonBlockingAny(), rcvQuiet(), and SlaveQueue().