CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

edm::multicore::MessageReceiverForSource Class Reference

#include <MessageReceiverForSource.h>

List of all members.

Public Member Functions

 MessageReceiverForSource (int iQueueID)
 Takes the ID of the posix message queue used for the messages.
unsigned long numberOfConsecutiveIndices () const
unsigned long numberToSkip () const
void receive ()
unsigned long startIndex () const
 After calling receive this holds the index to the first event to process.

Private Member Functions

 MessageReceiverForSource (const MessageReceiverForSource &)
const MessageReceiverForSourceoperator= (const MessageReceiverForSource &)

Private Attributes

unsigned long m_numberOfConsecutiveIndices
unsigned long m_numberToSkip
int m_queueID
unsigned long m_startIndex

Detailed Description

Definition at line 30 of file MessageReceiverForSource.h.


Constructor & Destructor Documentation

MessageReceiverForSource::MessageReceiverForSource ( int  iQueueID)

Takes the ID of the posix message queue used for the messages.

Definition at line 38 of file MessageReceiverForSource.cc.

edm::multicore::MessageReceiverForSource::MessageReceiverForSource ( const MessageReceiverForSource ) [private]

Member Function Documentation

unsigned long edm::multicore::MessageReceiverForSource::numberOfConsecutiveIndices ( ) const [inline]

After calling receive this holds the number of consecutive event indices to be processed. It will return 0 if there is no more work to be done and the process should exit.

Definition at line 55 of file MessageReceiverForSource.h.

References m_numberOfConsecutiveIndices.

unsigned long edm::multicore::MessageReceiverForSource::numberToSkip ( ) const [inline]

After calling receive this holds the difference between the previous startIndex + numberOfConsecutiveIndices and the new startIndex. This is useful since most sources use 'skip' to go to next starting point.

Definition at line 60 of file MessageReceiverForSource.h.

References m_numberToSkip.

                                            {
            return m_numberToSkip;
         }
const MessageReceiverForSource& edm::multicore::MessageReceiverForSource::operator= ( const MessageReceiverForSource ) [private]
void MessageReceiverForSource::receive ( )

Waits for a message on the queue. Throws a cms::Exception if there is an error

Definition at line 82 of file MessageReceiverForSource.cc.

References Exception, m_numberOfConsecutiveIndices, m_numberToSkip, m_queueID, m_startIndex, argparse::message, edm::multicore::MessageForSource::messageType(), edm::multicore::MessageForSource::nIndices, edm::multicore::MessageForSource::sizeForBuffer(), edm::multicore::MessageForSource::startIndex, and relativeConstraints::value.

{
   unsigned long previousStartIndex = m_startIndex;
   unsigned long previousConsecutiveIndices = m_numberOfConsecutiveIndices;
   /*
   //DUMMY
   if (m_originalConsecutiveIndices != m_numberOfConsecutiveIndices) {
      m_numberOfConsecutiveIndices = m_originalConsecutiveIndices;
      m_startIndex = m_numberOfConsecutiveIndices*m_forkedChildIndex;
   } else {
      m_startIndex += m_numberOfConsecutiveIndices+m_numberOfIndicesToSkip;
   }*/
   MessageForSource message;
   errno = 0;
   int value = msgrcv(m_queueID, &message, MessageForSource::sizeForBuffer(), MessageForSource::messageType(), 0);
   if (value < 0 ) {
      m_numberOfConsecutiveIndices=0;
      throw cms::Exception("MulticoreCommunicationFailure")<<"failed to receive data from controller: errno="<<errno<<" : "<<strerror(errno);
   }
   m_startIndex = message.startIndex;
   m_numberOfConsecutiveIndices = message.nIndices;
   
   m_numberToSkip = m_startIndex-previousStartIndex-previousConsecutiveIndices;
   return;
}
unsigned long edm::multicore::MessageReceiverForSource::startIndex ( ) const [inline]

After calling receive this holds the index to the first event to process.

Definition at line 49 of file MessageReceiverForSource.h.

References m_startIndex.

                                          {
            return m_startIndex;
         }

Member Data Documentation

Definition at line 72 of file MessageReceiverForSource.h.

Referenced by numberOfConsecutiveIndices(), and receive().

Definition at line 73 of file MessageReceiverForSource.h.

Referenced by numberToSkip(), and receive().

Definition at line 70 of file MessageReceiverForSource.h.

Referenced by receive().

Definition at line 71 of file MessageReceiverForSource.h.

Referenced by receive(), and startIndex().