Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00008
00009
00010 #include "EventFilter/ShmBuffer/interface/FUShmBuffer.h"
00011 #include "EventFilter/ShmBuffer/bin/FUShmClient.h"
00012
00013
00014 #include <iostream>
00015 #include <iomanip>
00016 #include <sstream>
00017 #include <unistd.h>
00018
00019
00020 using namespace std;
00021 using namespace evf;
00022
00023
00024
00025 void print_fed(unsigned int iFed,const vector<unsigned char>& fedData);
00026
00027
00028
00029 int main(int argc,char**argv)
00030 {
00031
00032 bool waitForKey(false);if (argc>1) {stringstream ss;ss<<argv[1];ss>>waitForKey;}
00033 double crashPrb(0.0); if (argc>2) {stringstream ss;ss<<argv[2];ss>>crashPrb; }
00034 int sleepTime(0); if (argc>3) {stringstream ss;ss<<argv[3];ss>>sleepTime; }
00035
00036
00037 FUShmBuffer* buffer=FUShmBuffer::getShmBuffer(); if (0==buffer) return 1;
00038 FUShmClient* client=new FUShmClient(buffer);
00039 client->setCrashPrb(crashPrb);
00040 client->setSleep(sleepTime);
00041
00042
00043 vector<vector<unsigned char> > fedData;
00044
00045
00046 while(1) {
00047
00048
00049 if (waitForKey) {
00050 cout<<"press key+<RETURN> to read next: "<<flush; char val; cin>>val;
00051 cout<<endl;
00052 }
00053
00054
00055 unsigned int iCell=client->readNext(fedData);
00056 cout<<"READ at index "<<iCell<<endl;
00057
00058
00059 for(unsigned int i=0;i<4 ;i++) print_fed(i,fedData[i]);
00060 cout<<endl;
00061
00062 }
00063
00064 return 0;
00065 }
00066
00067
00068
00069 void print_fed(unsigned int iFed,const vector<unsigned char>& fedData)
00070 {
00071 cout<<"fed "<<iFed<<": "<<flush;
00072 vector<unsigned char>::const_iterator it;
00073 cout.fill('0');
00074 for (it=fedData.begin();it!=fedData.end();++it)
00075 cout<<setiosflags(ios::right)<<setw(2)<<hex<<(int)(*it)<<dec<<" ";
00076 cout<<endl;
00077 }