Skip to content

Commit 99c9d01

Browse files
committed
Introduce getStandardMaximum(), deprecate getStandard()
1 parent c7d1103 commit 99c9d01

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

include/openPMD/version.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ std::string getVersion();
8686
*
8787
* @return std::string openPMD standard version (dot separated)
8888
*/
89-
std::string getStandard();
89+
[[deprecated(
90+
"Deprecated due to unclear semantics. Use one of getStandardMinimum, "
91+
"getStandardMaximum() or getStandardDefault instead.")]] std::string
92+
getStandard();
9093

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

108+
/** Return the minimum supported version of the openPMD standard (read,
109+
* run-time)
110+
*
111+
* @return std::string minimum openPMD standard version (dot separated)
112+
*/
113+
std::string getStandardMaximum();
114+
105115
/** Return the feature variants of the openPMD-api library (run-time)
106116
*
107117
* @return std::map< std::string, bool > with variants such as backends

src/version.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ std::string openPMD::getVersion()
3535

3636
std::string openPMD::getStandard()
3737
{
38-
std::stringstream standard;
39-
standard << OPENPMD_STANDARD_MAJOR << "." << OPENPMD_STANDARD_MINOR << "."
40-
<< OPENPMD_STANDARD_PATCH;
41-
return standard.str();
38+
return getStandardMaximum();
4239
}
4340

4441
std::string openPMD::getStandardDefault()
@@ -58,3 +55,11 @@ std::string openPMD::getStandardMinimum()
5855
<< OPENPMD_STANDARD_MIN_PATCH;
5956
return standardMin.str();
6057
}
58+
59+
std::string openPMD::getStandardMaximum()
60+
{
61+
std::stringstream standard;
62+
standard << OPENPMD_STANDARD_MAJOR << "." << OPENPMD_STANDARD_MINOR << "."
63+
<< OPENPMD_STANDARD_PATCH;
64+
return standard.str();
65+
}

test/CoreTest.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// expose private and protected members for invasive testing
2-
#include "openPMD/Datatype.hpp"
3-
#include "openPMD/Error.hpp"
42
#if openPMD_USE_INVASIVE_TESTS
53
#define OPENPMD_private public:
64
#define OPENPMD_protected public:
@@ -39,7 +37,7 @@ TEST_CASE("versions_test", "[core]")
3937
auto const standardDefault = getStandardDefault();
4038
REQUIRE(standardDefault == "1.1.0");
4139

42-
auto const standard = getStandard();
40+
auto const standard = getStandardMaximum();
4341
REQUIRE(standard == "2.0.0");
4442

4543
auto const standardMin = getStandardMinimum();

0 commit comments

Comments
 (0)