CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PlaybackRawDataProvider.h
Go to the documentation of this file.
1 #ifndef PLAYBACKRAWDATAPROVIDER_H
2 #define PLAYBACKRAWDATAPROVIDER_H 1
3 
7 
8 #include <memory>
9 #include <semaphore.h>
10 
12 
14 {
15 public:
16  //
17  // construction/destruction
18  //
20  virtual ~PlaybackRawDataProvider();
21 
22  // EDAnalyzer interface
23  virtual void beginJob();
24  virtual void analyze(const edm::Event&, const edm::EventSetup&);
25  virtual void endJob();
26 
27  // provide cached fed collection (and run/evt number, if needed!)
29  virtual FEDRawDataCollection* getFEDRawData(unsigned int& runNumber,
30  unsigned int& evtNumber);
31  void setFreeToEof();
32 
34 
35 
36 private:
37 
39  //
40  // private member functions
41  //
42  void lock() { sem_wait(&lock_); }
43  void unlock() { sem_post(&lock_); }
44  void waitWriteSem() { sem_wait(&writeSem_); }
45  void postWriteSem() { sem_post(&writeSem_); }
46  void waitReadSem() { sem_wait(&readSem_);}
47  void postReadSem() { sem_post(&readSem_); }
48 
49 
50  void sem_print();
51 
52 
53 private:
54  //
55  // member data
56  //
57  unsigned int queueSize_;
59  unsigned int *runNumber_;
60  unsigned int *evtNumber_;
61  unsigned int count_;
62 
63  sem_t lock_;
64  sem_t writeSem_;
65  sem_t readSem_;
66  unsigned int writeIndex_;
67  unsigned int readIndex_;
68  bool freeToEof_;
69 };
70 
71 
72 //
73 // implementation of inline functions
74 //
75 
76 //______________________________________________________________________________
77 inline
79 {
80  return instance_;
81 }
82 
83 
84 #endif
FEDRawDataCollection ** eventQueue_
PlaybackRawDataProvider(const edm::ParameterSet &)
virtual FEDRawDataCollection * getFEDRawData()
static PlaybackRawDataProvider * instance()
static PlaybackRawDataProvider * instance_
virtual void analyze(const edm::Event &, const edm::EventSetup &)