Skip to content
Snippets Groups Projects
Commit 1100b0e8 authored by Yuelong Yu's avatar Yuelong Yu
Browse files

fixed tif multiple close event

parent 5b128f4b
No related branches found
No related tags found
No related merge requests found
......@@ -63,35 +63,43 @@ namespace FSDaqNS
string filename = m_metadata2d.filename
+ "_"+to_string(frameno)
+".tif";
string filenametmp = m_metadata2d.filename
+ "_"+to_string(frameno)
+".tmp";
if(m_tiffwriter->isInitialized())
{
m_tiffwriter->close();
return false;
}
else
try
{
m_tiffwriter->setFrame(m_metadata2d.x,m_metadata2d.y);
m_tiffwriter->setFileName(filenametmp,
"PCO tango server");
LOG_INFOS("create tif file : " + filenametmp);
}
catch(...)
{
try
{
m_tiffwriter->setFrame(m_metadata2d.x,m_metadata2d.y);
m_tiffwriter->setFileName(filename,
"PCO tango server");
LOG_INFOS("create tif file : " + filename);
}
catch(...)
{
LOG_STREAM(__FUNCTION__,FSDetCoreNS::ERROR,"cannot create a new TIF file");
return false;
}
LOG_STREAM(__FUNCTION__,FSDetCoreNS::ERROR,"cannot create a new TIF file");
return false;
}
int16* ptr = data.data();
m_tiffwriter->append(ptr);
bool ret = m_tiffwriter->writeFile();
m_tiffwriter->close();
LOG_INFOS("close tif file : " + filename);
LOG_INFOS("close tif file : " + filenametmp);
if(std::rename(filenametmp.c_str(), filename.c_str()))
{
ret = false;
LOG_STREAM(__FUNCTION__,FSDetCoreNS::ERROR,"cannot rename file");
}
return ret;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment