CMS 3D CMS Logo

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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 
void print_fed (unsigned int iFed, const vector< unsigned char > &fedData)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 29 of file FUShmClient_t.cc.

References OfflineClient_cff::client, gather_cfg::cout, i, print_fed(), evf::FUShmClient::readNext(), evf::FUShmClient::setCrashPrb(), and evf::FUShmClient::setSleep().

30 {
31  // set parameters
32  bool waitForKey(false);if (argc>1) {stringstream ss;ss<<argv[1];ss>>waitForKey;}
33  double crashPrb(0.0); if (argc>2) {stringstream ss;ss<<argv[2];ss>>crashPrb; }
34  int sleepTime(0); if (argc>3) {stringstream ss;ss<<argv[3];ss>>sleepTime; }
35 
36  // get shared memory buffer and instantiate client
37  FUShmBuffer* buffer=FUShmBuffer::getShmBuffer(); if (0==buffer) return 1;
38  FUShmClient* client=new FUShmClient(buffer);
39  client->setCrashPrb(crashPrb);
40  client->setSleep(sleepTime);
41 
42  // the structure to hold the read fed data
43  vector<vector<unsigned char> > fedData;
44 
45  // client loop
46  while(1) {
47 
48  // wait for the user to press a key
49  if (waitForKey) {
50  cout<<"press key+<RETURN> to read next: "<<flush; char val; cin>>val;
51  cout<<endl;
52  }
53 
54  // read next event
55  unsigned int iCell=client->readNext(fedData);
56  cout<<"READ at index "<<iCell<<endl;
57 
58  // print content
59  for(unsigned int i=0;i<4 /*fedData.size()*/;i++) print_fed(i,fedData[i]);
60  cout<<endl;
61 
62  }
63 
64  return 0;
65 }
int i
Definition: DBlmapReader.cc:9
unsigned int readNext(std::vector< std::vector< unsigned char > > &feds)
Definition: FUShmClient.cc:51
void print_fed(unsigned int iFed, const vector< unsigned char > &fedData)
void setSleep(int sec)
Definition: FUShmClient.h:30
tuple argc
Definition: dir2webdir.py:41
tuple cout
Definition: gather_cfg.py:121
void setCrashPrb(double prb)
Definition: FUShmClient.h:29
void print_fed ( unsigned int  iFed,
const vector< unsigned char > &  fedData 
)

Definition at line 69 of file FUShmClient_t.cc.

References gather_cfg::cout.

Referenced by main().

70 {
71  cout<<"fed "<<iFed<<": "<<flush;
72  vector<unsigned char>::const_iterator it;
73  cout.fill('0');
74  for (it=fedData.begin();it!=fedData.end();++it)
75  cout<<setiosflags(ios::right)<<setw(2)<<hex<<(int)(*it)<<dec<<" ";
76  cout<<endl;
77 }
tuple cout
Definition: gather_cfg.py:121