CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MessageReceiverForSource.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Framework
4 // Class : MessageReceiverForSource
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Chris Jones
10 // Created: Thu Dec 30 10:09:50 CST 2010
11 // $Id: MessageReceiverForSource.cc,v 1.1 2011/01/02 19:50:58 chrjones Exp $
12 //
13 
14 // system include files
15 #include <sys/types.h>
16 #include <sys/ipc.h>
17 #include <sys/msg.h>
18 #include <errno.h>
19 #include <string.h>
20 
21 // user include files
25 
26 using namespace edm::multicore;
27 //
28 // constants, enums and typedefs
29 //
30 
31 //
32 // static data member definitions
33 //
34 
35 //
36 // constructors and destructor
37 //
39 m_queueID(iQueueID),
40 m_startIndex(0),
41 m_numberOfConsecutiveIndices(0),
42 m_numberToSkip(0)
43 {
44 }
45 /*
46 MessageReceiverForSource::MessageReceiverForSource(unsigned int iChildIndex, unsigned int iNumberOfChildren, unsigned int iNumberOfSequentialEvents):
47 m_startIndex(0),
48 m_numberOfConsecutiveIndices(0),
49 m_numberToSkip(0),
50 m_forkedChildIndex(iChildIndex),
51 m_numberOfIndicesToSkip( iNumberOfSequentialEvents*(iNumberOfChildren-1) ),
52 m_originalConsecutiveIndices(iNumberOfSequentialEvents)
53 {
54 }
55  */
56 
57 // MessageReceiverForSource::MessageReceiverForSource(const MessageReceiverForSource& rhs)
58 // {
59 // // do actual copying here;
60 // }
61 
62 //MessageReceiverForSource::~MessageReceiverForSource()
63 //{
64 //}
65 
66 //
67 // assignment operators
68 //
69 // const MessageReceiverForSource& MessageReceiverForSource::operator=(const MessageReceiverForSource& rhs)
70 // {
71 // //An exception safe implementation is
72 // MessageReceiverForSource temp(rhs);
73 // swap(rhs);
74 //
75 // return *this;
76 // }
77 
78 //
79 // member functions
80 //
81 void
83 {
84  unsigned long previousStartIndex = m_startIndex;
85  unsigned long previousConsecutiveIndices = m_numberOfConsecutiveIndices;
86  /*
87  //DUMMY
88  if (m_originalConsecutiveIndices != m_numberOfConsecutiveIndices) {
89  m_numberOfConsecutiveIndices = m_originalConsecutiveIndices;
90  m_startIndex = m_numberOfConsecutiveIndices*m_forkedChildIndex;
91  } else {
92  m_startIndex += m_numberOfConsecutiveIndices+m_numberOfIndicesToSkip;
93  }*/
95  errno = 0;
97  if (value < 0 ) {
99  throw cms::Exception("MulticoreCommunicationFailure")<<"failed to receive data from controller: errno="<<errno<<" : "<<strerror(errno);
100  }
101  m_startIndex = message.startIndex;
103 
104  m_numberToSkip = m_startIndex-previousStartIndex-previousConsecutiveIndices;
105  return;
106 }
107 
108 //
109 // const member functions
110 //
111 
112 //
113 // static member functions
114 //
MessageReceiverForSource(int iQueueID)
Takes the ID of the posix message queue used for the messages.
string message
Definition: argparse.py:126