15 #include <boost/thread.hpp> 
   16 #include <boost/bind.hpp> 
   17 #include <boost/archive/binary_iarchive.hpp> 
   22 #include "baseMQtools.h" 
   24 #include "FairMQLogger.h" 
   38         using namespace baseMQ::tools::resolve;
 
   40         if (has_BoostSerialization<
PndSdsDigiTopix4, 
void(boost::archive::binary_iarchive&, 
const unsigned int)>::value == 1)
 
   53                 FairMQChannel& dataInChannel = fChannels.at(
"data-in").at(0);
 
   54                 FairMQChannel& dataOutChannel = fChannels.at(
"data-out").at(0);
 
   60                 while (CheckCurrentState(RUNNING))
 
   62                         FairMQMessage* header = fTransportFactory->CreateMessage();
 
   63                         FairMQMessage* msg = fTransportFactory->CreateMessage();
 
   65                         if (dataInChannel.Receive(header) > 0)
 
   67                                 int status = *(
static_cast<int*
>(header->GetData()));
 
   69                                 if (dataInChannel.ExpectsAnotherPart())
 
   71                                         if (dataInChannel.Receive(msg)){
 
   72                                                 string msgStr(static_cast<char*>(msg->GetData()), msg->GetSize());
 
   73                                                 istringstream ibuffer(msgStr);
 
   75                                                 boost::archive::binary_iarchive InputArchive(ibuffer);
 
   80                                                 catch (boost::archive::archive_exception& e)
 
   82                                                         LOG(ERROR) << e.what();
 
   90                                                 bool endSorting = 
false;
 
   91                                                 double timeOfLast = 0;
 
   94                                                                 if (iter.GetTimeStamp() > 0){
 
   96                                                                         timeOfLast = iter.GetTimeStamp();
 
  103                                                         if (endSorting == 
false){
 
  109                                                                 LOG(INFO) << 
"EndSorting or STOP-Status " << 
status;
 
  117                                                         unique_ptr<FairMQMessage> headerCpy(fTransportFactory->CreateMessage(
sizeof(
int)));
 
  118                                                         headerCpy->Copy(header);
 
  119                                                         dataOutChannel.SendPart(headerCpy);
 
  122                                                         std::ostringstream obuffer;
 
  123                                                         boost::archive::binary_oarchive OutputArchive(obuffer);
 
  125                                                         int outputSize = obuffer.str().length();
 
  126                                                         unique_ptr<FairMQMessage> msg2(fTransportFactory->CreateMessage(outputSize));
 
  127                                                         memcpy(msg2->GetData(), obuffer.str().c_str(), outputSize);
 
  128                                                         dataOutChannel.Send(msg2);
 
  144                                         LOG(INFO) << 
"STOP-Signal Received!";
 
  150                                         unique_ptr<FairMQMessage> headerCpy(fTransportFactory->CreateMessage(
sizeof(
int)));
 
  151                                         headerCpy->Copy(header);
 
  152                                         dataOutChannel.SendPart(headerCpy);
 
  154                                         std::ostringstream obuffer;
 
  155                                         boost::archive::binary_oarchive OutputArchive(obuffer);
 
  157                                         int outputSize = obuffer.str().length();
 
  158                                         unique_ptr<FairMQMessage> msg2(fTransportFactory->CreateMessage(outputSize));
 
  159                                         memcpy(msg2->GetData(), obuffer.str().c_str(), outputSize);
 
  160                                         dataOutChannel.Send(msg2);
 
virtual void WriteOutData(double time)
Data class to store the digi output of a pixel module. 
std::vector< PndSdsDigiTopix4 > fTopixData
virtual std::vector< TData > GetOutputData()
virtual ~PndMQTopix4Sorter()
std::vector< PndSdsDigiTopix4 > fOutputData
virtual void AddElement(TData digi, double timestamp)
bool fHasBoostSerialization
virtual void DeleteOutputData()
virtual void WriteOutAll()