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 Feb 28, 2024
1 parent 917d6ab commit a58ad7c
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 @@ -38,7 +36,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 a58ad7c

Please sign in to comment.