CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MasterQueue.h
Go to the documentation of this file.
1 #ifndef EVENTFILTER_UTILITIES_MASTERQUEUE_H
2 #define EVENTFILTER_UTILITIES_MASTERQUEUE_H
3 
4 #include <stdio.h> /* standard I/O functions. */
5 #include <stdlib.h> /* malloc(), free() etc. */
6 #include <sys/types.h> /* various type definitions. */
7 #include <sys/ipc.h> /* general SysV IPC structures */
8 #include <sys/msg.h> /* message queue functions and structs. */
9 #include <errno.h>
10 #include <string.h>
11 
12 #include <iostream>
13 #include <sstream>
14 #include <vector>
15 
18 
19 namespace evf {
20 
21 class MasterQueue {
22 
23 public:
24 
25  MasterQueue(unsigned int ind);
26  ~MasterQueue();
27 
28  int post(MsgBuf &ptr);
29  int postLength(MsgBuf &ptr, unsigned int length);
30  unsigned long rcv(MsgBuf &ptr);
31  bool rcvQuiet(MsgBuf &ptr);
32  unsigned long rcvNonBlocking(MsgBuf &ptr);
33  int disconnect();
34  int id();
35  int status();
36  int occupancy() const;
37  void drain();
38  pid_t pidOfLastSend() const;
39  pid_t pidOfLastReceive() const;
40 
41  std::vector<int> getReceivers() const { return receivers_; }
42 
43 private:
44 
45  void updateReceivers();
46 
47 private:
48 
49  int queue_id_; /* ID of the created queue. */
50  int status_;
51  int occup_;
54  std::vector<int> receivers_;
55 };
56 }
57 #endif
int postLength(MsgBuf &ptr, unsigned int length)
Definition: MasterQueue.cc:36
pid_t pidOfLastSend() const
Definition: MasterQueue.cc:142
MasterQueue(unsigned int ind)
Definition: MasterQueue.cc:7
std::vector< int > getReceivers() const
Definition: MasterQueue.h:41
unsigned long rcv(MsgBuf &ptr)
Definition: MasterQueue.cc:58
unsigned long rcvNonBlocking(MsgBuf &ptr)
Definition: MasterQueue.cc:82
int occupancy() const
Definition: MasterQueue.cc:123
pid_t pidOfLastReceive() const
Definition: MasterQueue.cc:146
bool rcvQuiet(MsgBuf &ptr)
Definition: MasterQueue.cc:74
int post(MsgBuf &ptr)
Definition: MasterQueue.cc:26
std::vector< int > receivers_
Definition: MasterQueue.h:54
void updateReceivers()
Definition: MasterQueue.cc:150