CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FUShmDqmCell.cc
Go to the documentation of this file.
1 //
3 // FUShmDqmCell
4 // ------------
5 //
6 // 17/03/2007 Philipp Schieferdecker <philipp.schieferdecker@cern.ch>
8 
9 
11 
12 #include <iostream>
13 #include <iomanip>
14 #include <cstring>
15 
16 using namespace std;
17 using namespace evf;
18 
19 
21 // construction/destruction
23 
24 //______________________________________________________________________________
25 FUShmDqmCell::FUShmDqmCell(unsigned int payloadSize)
26  : payloadSize_(payloadSize)
27 {
29  void* payloadAddr=(void*)((unsigned long)this+payloadOffset_);
30  new (payloadAddr) unsigned char[payloadSize_];
31 }
32 
33 
34 //______________________________________________________________________________
36 {
37 
38 }
39 
40 
42 // implementation of member functions
44 
45 //______________________________________________________________________________
46 void FUShmDqmCell::initialize(unsigned int index)
47 {
48  index_=index;
49  clear();
50 }
51 
52 
53 //______________________________________________________________________________
54 unsigned char* FUShmDqmCell::payloadAddr() const
55 {
56  unsigned char* result=(unsigned char*)((unsigned long)this+payloadOffset_);
57  return result;
58 }
59 
60 
61 //______________________________________________________________________________
63 {
64  eventSize_=0;
65 }
66 
67 
68 //______________________________________________________________________________
70  unsigned int evtAtUpdate,
71  unsigned int folderId,
72  unsigned int fuProcessId,
73  unsigned int fuGuid,
74  unsigned char *data,
75  unsigned int dataSize)
76 {
77  if (eventSize_!=0)
78  cout<<"FUShmDqmCell::writeData WARNING: overwriting data!"<<endl;
79 
80  if (dataSize>payloadSize_) {
81  cout<<"FUShmDqmCell::writeData ERROR: data does not fit!"<<endl;
82  return;
83  }
84 
89  fuGuid_ =fuGuid;
90  unsigned char* targetAddr=payloadAddr();
91  memcpy(targetAddr,data,dataSize);
92  eventSize_=dataSize;
93 }
94 
95 
96 //______________________________________________________________________________
97 unsigned int FUShmDqmCell::size(unsigned int payloadSize)
98 {
99  return sizeof(FUShmDqmCell)+sizeof(unsigned char)*payloadSize;
100 }
unsigned int fuGuid_
Definition: FUShmDqmCell.h:59
unsigned int fuGuid() const
Definition: FUShmDqmCell.h:27
unsigned int index() const
Definition: FUShmDqmCell.h:22
void initialize(unsigned int index)
Definition: FUShmDqmCell.cc:46
unsigned int folderId() const
Definition: FUShmDqmCell.h:25
unsigned int payloadOffset_
Definition: FUShmDqmCell.h:61
unsigned int evtAtUpdate() const
Definition: FUShmDqmCell.h:24
unsigned int runNumber_
Definition: FUShmDqmCell.h:55
FUShmDqmCell(unsigned int payloadSize)
Definition: FUShmDqmCell.cc:25
unsigned int evtAtUpdate_
Definition: FUShmDqmCell.h:56
unsigned int fuProcessId() const
Definition: FUShmDqmCell.h:26
unsigned int runNumber() const
Definition: FUShmDqmCell.h:23
unsigned int payloadSize_
Definition: FUShmDqmCell.h:60
unsigned int eventSize_
Definition: FUShmDqmCell.h:62
unsigned int index_
Definition: FUShmDqmCell.h:54
tuple result
Definition: query.py:137
unsigned char * payloadAddr() const
Definition: FUShmDqmCell.cc:54
unsigned int fuProcessId_
Definition: FUShmDqmCell.h:58
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
unsigned int folderId_
Definition: FUShmDqmCell.h:57
void writeData(unsigned int runNumber, unsigned int evtAtUpdate, unsigned int folderId, unsigned int fuProcessId, unsigned int fuGuid, unsigned char *data, unsigned int dataSize)
Definition: FUShmDqmCell.cc:69
tuple cout
Definition: gather_cfg.py:121
static unsigned int size(unsigned int payloadSize)
Definition: FUShmDqmCell.cc:97
unsigned int payloadSize() const
Definition: FUShmDqmCell.h:29