Skip to content

Commit

Permalink
Merge pull request #3126 from pnorbert/nullengine
Browse files Browse the repository at this point in the history
Removed the virtual NULL engine from the C++/C/Python API...
  • Loading branch information
pnorbert authored and Chuck Atkins committed Mar 24, 2022
2 parents 4328408 + 624750d commit e07b74a
Show file tree
Hide file tree
Showing 20 changed files with 432 additions and 798 deletions.
72 changes: 0 additions & 72 deletions bindings/C/adios2/c/adios2_c_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,6 @@ adios2_error adios2_begin_step(adios2_engine *engine,
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
*status = adios2_step_status_end_of_stream;
return adios2_error_none;
}

const adios2::StepStatus statusCpp = engineCpp->BeginStep(
ToStepMode(mode, "in call to adios2_begin_step"), timeout_seconds);

Expand All @@ -228,12 +222,6 @@ adios2_error adios2_current_step(size_t *current_step,
const adios2::core::Engine *engineCpp =
reinterpret_cast<const adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
*current_step = adios2::MaxSizeT;
return adios2_error_none;
}

*current_step = engineCpp->CurrentStep();
return adios2_error_none;
}
Expand All @@ -254,12 +242,6 @@ adios2_error adios2_steps(size_t *steps, const adios2_engine *engine)
const adios2::core::Engine *engineCpp =
reinterpret_cast<const adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
*steps = 0;
return adios2_error_none;
}

*steps = engineCpp->Steps();
return adios2_error_none;
}
Expand All @@ -281,11 +263,6 @@ adios2_error adios2_put(adios2_engine *engine, adios2_variable *variable,
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
return adios2_error_none;
}

adios2::helper::CheckForNullptr(
variable, "for adios2_variable, in call to adios2_put");

Expand Down Expand Up @@ -339,11 +316,6 @@ adios2_error adios2_put_by_name(adios2_engine *engine,
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
return adios2_error_none;
}

adios2::helper::CheckForNullptr(
variable_name,
"for const char* variable_name, in call to adios2_put_by_name");
Expand Down Expand Up @@ -391,11 +363,6 @@ adios2_error adios2_perform_puts(adios2_engine *engine)
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
return adios2_error_none;
}

engineCpp->PerformPuts();
return adios2_error_none;
}
Expand All @@ -416,11 +383,6 @@ adios2_error adios2_perform_data_write(adios2_engine *engine)
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
return adios2_error_none;
}

engineCpp->PerformDataWrite();
return adios2_error_none;
}
Expand All @@ -442,11 +404,6 @@ adios2_error adios2_get(adios2_engine *engine, adios2_variable *variable,
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
return adios2_error_none;
}

adios2::helper::CheckForNullptr(variable,
"for adios2_variable, in call "
"to adios2_get");
Expand Down Expand Up @@ -501,11 +458,6 @@ adios2_error adios2_get_by_name(adios2_engine *engine,
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
return adios2_error_none;
}

adios2::helper::CheckForNullptr(
variable_name, "for const char* variable_name, in call to "
"adios2_get_by_name");
Expand Down Expand Up @@ -552,11 +504,6 @@ adios2_error adios2_perform_gets(adios2_engine *engine)
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
return adios2_error_none;
}

engineCpp->PerformGets();
return adios2_error_none;
}
Expand All @@ -577,11 +524,6 @@ adios2_error adios2_end_step(adios2_engine *engine)
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
return adios2_error_none;
}

engineCpp->EndStep();
return adios2_error_none;
}
Expand All @@ -608,11 +550,6 @@ adios2_error adios2_flush_by_index(adios2_engine *engine,
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
return adios2_error_none;
}

engineCpp->Flush(transport_index);

return adios2_error_none;
Expand Down Expand Up @@ -690,10 +627,6 @@ adios2_varinfo *adios2_inquire_blockinfo(adios2_engine *engine,
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
return NULL;
}
adios2::helper::CheckForNullptr(variable,
"for adios2_variable, in call "
"to adios2_get");
Expand Down Expand Up @@ -873,11 +806,6 @@ adios2_error adios2_close_by_index(adios2_engine *engine,
adios2::core::Engine *engineCpp =
reinterpret_cast<adios2::core::Engine *>(engine);

if (engineCpp->m_EngineType == "NULL")
{
return adios2_error_none;
}

engineCpp->Close(transport_index);

// erase Engine object from IO
Expand Down
52 changes: 0 additions & 52 deletions bindings/CXX11/adios2/cxx11/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,113 +49,69 @@ Mode Engine::OpenMode() const
StepStatus Engine::BeginStep()
{
helper::CheckForNullptr(m_Engine, "in call to Engine::BeginStep");
if (m_Engine->m_EngineType == "NULL")
{
return StepStatus::EndOfStream;
}
return m_Engine->BeginStep();
}

StepStatus Engine::BeginStep(const StepMode mode, const float timeoutSeconds)
{
helper::CheckForNullptr(
m_Engine, "in call to Engine::BeginStep(const StepMode, const float)");
if (m_Engine->m_EngineType == "NULL")
{
return StepStatus::EndOfStream;
}
return m_Engine->BeginStep(mode, timeoutSeconds);
}

size_t Engine::CurrentStep() const
{
helper::CheckForNullptr(m_Engine, "in call to Engine::CurrentStep");
if (m_Engine->m_EngineType == "NULL")
{
return MaxSizeT;
}
return m_Engine->CurrentStep();
}

void Engine::PerformPuts()
{
helper::CheckForNullptr(m_Engine, "in call to Engine::PerformPuts");
if (m_Engine->m_EngineType == "NULL")
{
return;
}
m_Engine->PerformPuts();
}

void Engine::PerformDataWrite()
{
helper::CheckForNullptr(m_Engine, "in call to Engine::PerformDataWrite");
if (m_Engine->m_EngineType == "NULL")
{
return;
}
m_Engine->PerformDataWrite();
}

void Engine::PerformGets()
{
helper::CheckForNullptr(m_Engine, "in call to Engine::PerformGets");
if (m_Engine->m_EngineType == "NULL")
{
return;
}
m_Engine->PerformGets();
}

void Engine::LockWriterDefinitions()
{
helper::CheckForNullptr(m_Engine,
"in call to Engine::LockWriterDefinitions");
if (m_Engine->m_EngineType == "NULL")
{
return;
}
m_Engine->LockWriterDefinitions();
}

void Engine::LockReaderSelections()
{
helper::CheckForNullptr(m_Engine,
"in call to Engine::LockReaderSelections");
if (m_Engine->m_EngineType == "NULL")
{
return;
}
m_Engine->LockReaderSelections();
}

void Engine::EndStep()
{
helper::CheckForNullptr(m_Engine, "in call to Engine::EndStep");
if (m_Engine->m_EngineType == "NULL")
{
return;
}
m_Engine->EndStep();
}

void Engine::Flush(const int transportIndex)
{
helper::CheckForNullptr(m_Engine, "in call to Engine::Flush");
if (m_Engine->m_EngineType == "NULL")
{
return;
}
m_Engine->Flush(transportIndex);
}

void Engine::Close(const int transportIndex)
{
helper::CheckForNullptr(m_Engine, "in call to Engine::Close");
if (m_Engine->m_EngineType == "NULL")
{
return;
}
m_Engine->Close(transportIndex);

// erase Engine object from IO
Expand All @@ -168,10 +124,6 @@ void Engine::Close(const int transportIndex)
size_t Engine::Steps() const
{
helper::CheckForNullptr(m_Engine, "in call to Engine::Steps");
if (m_Engine->m_EngineType == "NULL")
{
return 0;
}
return m_Engine->Steps();
}

Expand Down Expand Up @@ -223,10 +175,6 @@ size_t Engine::DebugGetDataBufferSize() const
{
helper::CheckForNullptr(m_Engine,
"in call to Engine::DebugGetDataBufferSize");
if (m_Engine->m_EngineType == "NULL")
{
return 0;
}
return m_Engine->DebugGetDataBufferSize();
}

Expand Down
Loading

0 comments on commit e07b74a

Please sign in to comment.