Skip to content
Snippets Groups Projects
Commit 4c99d521 authored by Thomas Jürges's avatar Thomas Jürges
Browse files

SW-546: Simplify the dtor a bit

parent 916efa7f
No related branches found
No related tags found
No related merge requests found
...@@ -158,41 +158,65 @@ namespace LOFAR ...@@ -158,41 +158,65 @@ namespace LOFAR
TBB_Dipole::~TBB_Dipole() TBB_Dipole::~TBB_Dipole()
{ {
// Executed by the main thread after joined with all workers, so no need to lock or delay cancellation. /**
if (isInitialized()) { * Executed by the main thread after joined with all workers, so no
try { * need to lock or delay cancellation.
if (doTransient()) { */
if(isInitialized())
{
const bool transientMode(doTransient());
try
{
if(transientMode == true)
{
itsDipoleDataset()->resize1D(itsDumpInfo.itsDatasetLen); itsDipoleDataset()->resize1D(itsDumpInfo.itsDatasetLen);
} else { // spectral mode
//itsDipoleGroup()->resize1D(itsDumpInfo.itsDatasetLen * 2); // TODO: remove times 2 once DAL supports TBB spectral dataset of complex<int16_t>. Also, use resize() if switched to create() (2D).
} }
} catch (exception& exc) { // dal::DALException, or std::bad_alloc from vector constr }
LOG_WARN_STR("TBB: failed to resize HDF5 dipole dataset to external data size: " << exc.what()); catch(exception& exc)
{
// dal::DALException, or std::bad_alloc from vector constr
LOG_WARN_STR("TBB: failed to resize HDF5 dipole dataset to "
"external data size: "
<< exc.what());
} }
try { try
{
// Thus in values (scalar for transient mode, complex for subband mode) // Thus in values (scalar for transient mode, complex for subband mode)
if (doTransient()) { if(transientMode == true)
itsDipoleDataset()->dataLength().value = itsDumpInfo.itsDatasetLen; {
} else { // spectral mode itsDipoleDataset()->dataLength().value =
//TODO: fill in itsDumpInfo.itsDatasetLen;
} }
} catch (dal::DALException& exc) {
LOG_WARN_STR("TBB: failed to set dipole DATA_LENGTH attribute: " << exc.what());
} }
try { catch(dal::DALException& exc)
/* {
* We write flags at the end, because HDF5 attributes can only be (re)set, not updated. LOG_WARN_STR("TBB: failed to set dipole DATA_LENGTH attribute: "
* TODO: If an .h5 internal (non-chunked!) 1D dataset would be possible without pre-specifying size, << exc.what());
* that would be better. Then we can write flags while data comes in. Else, leave as-is. }
try
{
/**
* We write flags at the end, because HDF5 attributes can only
* be (re)set, not updated.
*
* TODO: If an .h5 internal (non-chunked!) 1D dataset would be
* possible without pre-specifying size, that would be better.
* Then we can write flags while data comes in. Else, leave
* as-is.
*/ */
if (doTransient()) { if(doTransient())
itsDipoleDataset()->flagOffsets().create(itsDumpInfo.itsFlagOffsets.size()).set(itsDumpInfo.itsFlagOffsets); {
} else { // spectral mode itsDipoleDataset()->flagOffsets().create(
//TODO: fill in itsDumpInfo.itsFlagOffsets.size()).set(
itsDumpInfo.itsFlagOffsets);
} }
} catch (dal::DALException& exc) { }
LOG_WARN_STR("TBB: failed to set dipole FLAG_OFFSETS attribute: " << exc.what()); catch(dal::DALException& exc)
{
LOG_WARN_STR("TBB: failed to set dipole FLAG_OFFSETS "
"attribute: "
<< exc.what());
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment