Skip to content

Commit

Permalink
Introduce runtime checks in HDF5 & ADIOS1
Browse files Browse the repository at this point in the history
  • Loading branch information
C0nsultant committed Sep 18, 2018
1 parent 139d815 commit 5e9dbce
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/IO/ADIOS/CommonADIOS1IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,9 @@ void
CommonADIOS1IOHandlerImpl::readAttribute(Writable* writable,
Parameter< Operation::READ_ATT >& parameters)
{
if( !writable->written )
throw std::runtime_error("Internal error: Writable not marked written during attribute reading");

ADIOS_FILE* f;
f = m_openReadFileHandles.at(m_filePaths.at(writable));

Expand Down Expand Up @@ -1311,6 +1314,9 @@ void
CommonADIOS1IOHandlerImpl::listPaths(Writable* writable,
Parameter< Operation::LIST_PATHS >& parameters)
{
if( !writable->written )
throw std::runtime_error("Internal error: Writable not marked written during path listing");

ADIOS_FILE* f;
f = m_openReadFileHandles.at(m_filePaths.at(writable));

Expand Down Expand Up @@ -1359,6 +1365,9 @@ void
CommonADIOS1IOHandlerImpl::listDatasets(Writable* writable,
Parameter< Operation::LIST_DATASETS >& parameters)
{
if( !writable->written )
throw std::runtime_error("Internal error: Writable not marked written during dataset listing");

ADIOS_FILE* f;
f = m_openReadFileHandles.at(m_filePaths.at(writable));

Expand Down Expand Up @@ -1388,6 +1397,9 @@ void
CommonADIOS1IOHandlerImpl::listAttributes(Writable* writable,
Parameter< Operation::LIST_ATTS >& parameters)
{
if( !writable->written )
throw std::runtime_error("Internal error: Writable not marked written during attribute listing");

ADIOS_FILE* f;
f = m_openReadFileHandles.at(m_filePaths.at(writable));

Expand Down
12 changes: 12 additions & 0 deletions src/IO/HDF5/HDF5IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,9 @@ void
HDF5IOHandlerImpl::readAttribute(Writable* writable,
Parameter< Operation::READ_ATT >& parameters)
{
if( !writable->written )
throw std::runtime_error("Internal error: Writable not marked written during attribute read");

auto res = m_fileIDs.find(writable);
if( res == m_fileIDs.end() )
res = m_fileIDs.find(writable->parent);
Expand Down Expand Up @@ -1396,6 +1399,9 @@ void
HDF5IOHandlerImpl::listPaths(Writable* writable,
Parameter< Operation::LIST_PATHS > & parameters)
{
if( !writable->written )
throw std::runtime_error("Internal error: Writable not marked written during path listing");

auto res = m_fileIDs.find(writable);
if( res == m_fileIDs.end() )
res = m_fileIDs.find(writable->parent);
Expand Down Expand Up @@ -1428,6 +1434,9 @@ void
HDF5IOHandlerImpl::listDatasets(Writable* writable,
Parameter< Operation::LIST_DATASETS >& parameters)
{
if( !writable->written )
throw std::runtime_error("Internal error: Writable not marked written during dataset listing");

auto res = m_fileIDs.find(writable);
if( res == m_fileIDs.end() )
res = m_fileIDs.find(writable->parent);
Expand Down Expand Up @@ -1459,6 +1468,9 @@ HDF5IOHandlerImpl::listDatasets(Writable* writable,
void HDF5IOHandlerImpl::listAttributes(Writable* writable,
Parameter< Operation::LIST_ATTS >& parameters)
{
if( !writable->written )
throw std::runtime_error("Internal error: Writable not marked written during attribute listing");

auto res = m_fileIDs.find(writable);
if( res == m_fileIDs.end() )
res = m_fileIDs.find(writable->parent);
Expand Down

0 comments on commit 5e9dbce

Please sign in to comment.