CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/EventFilter/Utilities/interface/MasterQueue.h

Go to the documentation of this file.
00001 #ifndef EVENTFILTER_UTILITIES_MASTERQUEUE_H
00002 #define EVENTFILTER_UTILITIES_MASTERQUEUE_H
00003 
00004 #include <stdio.h>       /* standard I/O functions.              */
00005 #include <stdlib.h>      /* malloc(), free() etc.                */
00006 #include <sys/types.h>   /* various type definitions.            */
00007 #include <sys/ipc.h>     /* general SysV IPC structures          */
00008 #include <sys/msg.h>     /* message queue functions and structs. */
00009 #include <errno.h>
00010 #include <string.h>
00011 
00012 #include <iostream>
00013 #include <sstream>
00014 #include <vector>
00015 
00016 #include "EventFilter/Utilities/interface/Exception.h"
00017 #include "EventFilter/Utilities/interface/MsgBuf.h"
00018 
00019 namespace evf {
00020 
00021 class MasterQueue {
00022 
00023 public:
00024 
00025         MasterQueue(unsigned int ind);
00026         ~MasterQueue();
00027 
00028         int post(MsgBuf &ptr);
00029         int postLength(MsgBuf &ptr, unsigned int length);
00030         unsigned long rcv(MsgBuf &ptr);
00031         bool rcvQuiet(MsgBuf &ptr);
00032         unsigned long rcvNonBlocking(MsgBuf &ptr);
00033         int disconnect();
00034         int id();
00035         int status();
00036         int occupancy() const;
00037         void drain();
00038         pid_t pidOfLastSend() const;
00039         pid_t pidOfLastReceive() const;
00040 
00041         std::vector<int> getReceivers() const { return receivers_; }
00042 
00043 private:
00044 
00045         void updateReceivers();
00046 
00047 private:
00048 
00049         int queue_id_; /* ID of the created queue.            */
00050         int status_;
00051         int occup_;
00052         int pidOfLastSend_;
00053         int pidOfLastReceive_;
00054         std::vector<int> receivers_;
00055 };
00056 }
00057 #endif