CMS 3D CMS Logo

Public Member Functions | Private Attributes

evf::SlaveQueue Class Reference

#include <SlaveQueue.h>

List of all members.

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)
 SlaveQueue (unsigned int ind)
 ~SlaveQueue ()

Private Attributes

int queue_id_

Detailed Description

Definition at line 18 of file SlaveQueue.h.


Constructor & Destructor Documentation

evf::SlaveQueue::SlaveQueue ( unsigned int  ind) [inline]

Definition at line 22 of file SlaveQueue.h.

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");
        }
      }
evf::SlaveQueue::~SlaveQueue ( ) [inline]

Definition at line 31 of file SlaveQueue.h.

      {
      }

Member Function Documentation

int evf::SlaveQueue::id ( void  ) const [inline]

Definition at line 84 of file SlaveQueue.h.

References queue_id_.

{return queue_id_;}
int evf::SlaveQueue::post ( MsgBuf ptr) [inline]

Definition at line 35 of file SlaveQueue.h.

References gather_cfg::cout, evf::MsgBuf::msize(), evf::MsgBuf::ptr_, and queue_id_.

Referenced by evf::Vulture::control(), and evf::SubProcess::postSlave().

      {
        int rc;                  /* error code retuend by system calls. */
        rc = msgsnd(queue_id_,ptr.ptr_, ptr.msize(),0);
        //      delete ptr;
        if(rc==-1)
          std::cout << "snd::Slave failed to post message - error:"
                    << strerror(errno) << std::endl;
        return rc;
      }
unsigned long evf::SlaveQueue::rcv ( MsgBuf ptr) [inline]

Definition at line 45 of file SlaveQueue.h.

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(), - 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 evf::SlaveQueue::rcvNonBlocking ( MsgBuf ptr) [inline]

Definition at line 58 of file SlaveQueue.h.

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(), - 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 evf::SlaveQueue::rcvNonBlockingAny ( MsgBuf ptr) [inline]

Definition at line 71 of file SlaveQueue.h.

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(), 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;
      }

Member Data Documentation

Definition at line 87 of file SlaveQueue.h.

Referenced by id(), post(), rcv(), rcvNonBlocking(), rcvNonBlockingAny(), and SlaveQueue().