Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00008
00009
00010 #include "EventFilter/ShmBuffer/bin/FUShmServer.h"
00011
00012
00013 #include <iostream>
00014
00015
00016 using namespace std;
00017 using namespace evf;
00018
00019
00021
00023
00024
00025 FUShmServer::FUShmServer(FUShmBuffer* buffer)
00026 : buffer_(buffer)
00027 {
00028
00029 }
00030
00031
00032
00033 FUShmServer::~FUShmServer()
00034 {
00035
00036 }
00037
00038
00040
00042
00043
00044 unsigned int FUShmServer::writeNext(unsigned char *data,
00045 unsigned int nFed,
00046 unsigned int *fedSize)
00047 {
00048 FUShmRawCell* cell =buffer_->rawCellToWrite();
00049 buffer_->printEvtState(cell->index());
00050
00051
00052 cell->clear();
00053 unsigned int dataSize(0);
00054 for (unsigned int i=0;i<nFed;i++) dataSize+=fedSize[i];
00055 unsigned int iCell =cell->index();
00056 unsigned char *cellBufferAddr=cell->writeData(data,dataSize);
00057
00058 if (0!=cellBufferAddr) {
00059
00060 unsigned int fedOffset(0);
00061 for (unsigned int i=0;i<nFed;i++) {
00062 unsigned char* fedAddr=cellBufferAddr+fedOffset;
00063 cell->markFed(i,fedSize[i],fedAddr);
00064 fedOffset+=fedSize[i];
00065 }
00066
00067 buffer_->finishWritingRawCell(cell);
00068 }
00069
00070 return iCell;
00071 }