CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
FUShmServer_t.cc File Reference
#include "EventFilter/ShmBuffer/interface/FUShmBuffer.h"
#include "EventFilter/ShmBuffer/bin/FUShmServer.h"
#include <iostream>
#include <cstdlib>
#include <sstream>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 23 of file FUShmServer_t.cc.

References gather_cfg::cout, data, i, rand(), getRunRegistry::server, tmp, and evf::FUShmServer::writeNext().

24 {
25  bool segmentationMode=false;
26  unsigned int nCells =32;
27  unsigned int nFed = 4;
28  unsigned int bytesPerFed =10;
29  unsigned int cellBufferSize =nFed*bytesPerFed;
30 
31  if (argc>1) { stringstream ss; ss<<argv[1]; ss>>segmentationMode; }
32 
33  cout<<" FUShmServer_t:"
34  <<" segmentationMode="<<segmentationMode
35  <<" nCells="<<nCells
36  <<" nFed="<<nFed
37  <<" bytesPerFed="<<bytesPerFed
38  <<" cellBufferSize="<<cellBufferSize<<endl<<endl;
39 
40  FUShmBuffer* buffer=FUShmBuffer::createShmBuffer(segmentationMode,
41  nCells,0,0,
42  cellBufferSize,0,0);
43  if (0==buffer) return 1;
44  FUShmServer* server=new FUShmServer(buffer);
45 
46 
47  // the fake data written to shared memory
48  unsigned char* data =new unsigned char[cellBufferSize];
49  unsigned int* fedSize =new unsigned int[nFed];
50  for (unsigned int i=0;i<nFed;i++) fedSize[i]=bytesPerFed;
51 
52 
53  // server loop
54  while(1) {
55 
56  // generate data
57  for (unsigned int i=0;i<cellBufferSize;i++) {
58  unsigned int rnd=rand();
59  double tmp=rnd/(double)RAND_MAX*255;
60  rnd=(unsigned int)tmp;
61  data[i]=(unsigned char)rnd;
62  }
63 
64  unsigned int iCell=server->writeNext(data,nFed,fedSize);
65  cout<<"WROTE at index "<<iCell<<endl;
66  }
67 
68  return 0;
69 }
int i
Definition: DBlmapReader.cc:9
tuple argc
Definition: dir2webdir.py:41
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
unsigned int writeNext(unsigned char *data, unsigned int nFed, unsigned int *fedSize)
Definition: FUShmServer.cc:44
Signal rand(Signal arg)
Definition: vlib.cc:442
tuple cout
Definition: gather_cfg.py:121