Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:06

0001 #include "DumpPacket.h"
0002 
0003 #include <ffarawobjects/OfflinePacket.h>
0004 
0005 DumpPacket::~DumpPacket()
0006 {
0007   for (auto &iter : m_PacketDumpFile)
0008   {
0009     iter.second->close();
0010     delete iter.second;
0011   }
0012   m_PacketDumpFile.clear();
0013   return;
0014 }
0015 
0016 void DumpPacket::ddumppacket(OfflinePacket *pkt)
0017 {
0018   int packetid = pkt->getIdentifier();
0019   if (m_PacketDumpFile.find(packetid) == m_PacketDumpFile.end())
0020   {
0021     std::string fname = "offlinepacket_" + std::to_string(packetid) + ".ddump";
0022     std::ofstream *dumpfile = new std::ofstream(fname);
0023     // dumpfile.open(fname);
0024     m_PacketDumpFile.insert(std::make_pair(packetid, dumpfile));
0025     m_PacketDumpCounter.insert(std::make_pair(packetid, m_ddump_flag));
0026   }
0027   if (m_PacketDumpCounter[packetid] != 0)
0028   {
0029     pkt->dump(*m_PacketDumpFile[packetid]);
0030     m_PacketDumpCounter[packetid]--;
0031   }
0032   return;
0033 }