From 6218b68542ef6c752cf6fd71ac31c899714c6db7 Mon Sep 17 00:00:00 2001 From: Greg Eisenhauer Date: Fri, 11 Jun 2021 09:52:15 -0400 Subject: [PATCH] Add const char* entry to ADIOS constructors to avoid ugliness --- bindings/CXX11/adios2/cxx11/ADIOS.cpp | 2 ++ bindings/CXX11/adios2/cxx11/ADIOS.h | 8 ++++++++ testing/adios2/interface/TestADIOSInterface.cpp | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/bindings/CXX11/adios2/cxx11/ADIOS.cpp b/bindings/CXX11/adios2/cxx11/ADIOS.cpp index ec0a16ba03..d8cc46639a 100644 --- a/bindings/CXX11/adios2/cxx11/ADIOS.cpp +++ b/bindings/CXX11/adios2/cxx11/ADIOS.cpp @@ -19,6 +19,8 @@ ADIOS::ADIOS(const std::string &configFile, const bool debugMode) { } +ADIOS::ADIOS(const char *configFile) : ADIOS(std::string(configFile), "C++") {} + ADIOS::ADIOS(const bool debugMode) : ADIOS("", "C++") {} ADIOS::ADIOS(const std::string &configFile, const std::string &hostLanguage, diff --git a/bindings/CXX11/adios2/cxx11/ADIOS.h b/bindings/CXX11/adios2/cxx11/ADIOS.h index 4304631ce8..da8d739b34 100644 --- a/bindings/CXX11/adios2/cxx11/ADIOS.h +++ b/bindings/CXX11/adios2/cxx11/ADIOS.h @@ -99,6 +99,14 @@ class ADIOS */ ADIOS(const std::string &configFile, const bool debugMode = true); + /** + * Starting point for non-MPI serial apps. Creates an ADIOS object allowing + * a runtime config file. + * @param configFile runtime config file + * @exception std::invalid_argument if user input is incorrect + */ + ADIOS(const char *configFile); + /** * Starting point for non-MPI apps. Creates an ADIOS object * @param debugMode is deprecated and has no effect on library behavior diff --git a/testing/adios2/interface/TestADIOSInterface.cpp b/testing/adios2/interface/TestADIOSInterface.cpp index eef00f75ef..d5192cc9a3 100644 --- a/testing/adios2/interface/TestADIOSInterface.cpp +++ b/testing/adios2/interface/TestADIOSInterface.cpp @@ -23,6 +23,16 @@ TEST(ADIOSInterface, MPICommRemoved) #endif +TEST(ADIOSInterface, BADConfigFile) +{ + EXPECT_THROW(adios2::ADIOS adios("notthere.xml"); + adios2::IO io = adios.DeclareIO("TestIO"); + + adios2::Engine engine = + io.Open("test.bp", adios2::Mode::Write); + , std::logic_error); +} + /** ADIOS2_CXX11_API */ class ADIOS2_CXX11_API : public ::testing::Test