Skip to content

Commit

Permalink
Introduce getStandardMaximum(), deprecate getStandard()
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Jun 26, 2024
1 parent f454194 commit 02971a2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
12 changes: 11 additions & 1 deletion include/openPMD/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ std::string getVersion();
*
* @return std::string openPMD standard version (dot separated)
*/
std::string getStandard();
[[deprecated(
"Deprecated due to unclear semantics. Use one of getStandardMinimum, "
"getStandardMaximum() or getStandardDefault instead.")]] std::string
getStandard();

/** Return the default used version of the openPMD standard (read & write,
* run-time)
Expand All @@ -102,6 +105,13 @@ std::string getStandardDefault();
*/
std::string getStandardMinimum();

/** Return the minimum supported version of the openPMD standard (read,
* run-time)
*
* @return std::string minimum openPMD standard version (dot separated)
*/
std::string getStandardMaximum();

/** Return the feature variants of the openPMD-api library (run-time)
*
* @return std::map< std::string, bool > with variants such as backends
Expand Down
13 changes: 9 additions & 4 deletions src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ std::string openPMD::getVersion()

std::string openPMD::getStandard()
{
std::stringstream standard;
standard << OPENPMD_STANDARD_MAJOR << "." << OPENPMD_STANDARD_MINOR << "."
<< OPENPMD_STANDARD_PATCH;
return standard.str();
return getStandardMaximum();
}

std::string openPMD::getStandardDefault()
Expand All @@ -58,3 +55,11 @@ std::string openPMD::getStandardMinimum()
<< OPENPMD_STANDARD_MIN_PATCH;
return standardMin.str();
}

std::string openPMD::getStandardMaximum()
{
std::stringstream standard;
standard << OPENPMD_STANDARD_MAJOR << "." << OPENPMD_STANDARD_MINOR << "."
<< OPENPMD_STANDARD_PATCH;
return standard.str();
}
4 changes: 1 addition & 3 deletions test/CoreTest.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// expose private and protected members for invasive testing
#include "openPMD/Datatype.hpp"
#include "openPMD/Error.hpp"
#if openPMD_USE_INVASIVE_TESTS
#define OPENPMD_private public:
#define OPENPMD_protected public:
Expand Down Expand Up @@ -39,7 +37,7 @@ TEST_CASE("versions_test", "[core]")
auto const standardDefault = getStandardDefault();
REQUIRE(standardDefault == "1.1.0");

auto const standard = getStandard();
auto const standard = getStandardMaximum();
REQUIRE(standard == "2.0.0");

auto const standardMin = getStandardMinimum();
Expand Down

0 comments on commit 02971a2

Please sign in to comment.