Skip to content

Commit

Permalink
Replace openPMD_Datatypes global with function
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Aug 17, 2023
1 parent a283b14 commit a63f8d8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 41 deletions.
2 changes: 1 addition & 1 deletion include/openPMD/Datatype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ enum class Datatype : int
* listed in order in a vector.
*
*/
extern std::vector<Datatype> openPMD_Datatypes;
std::vector<Datatype> openPMD_Datatypes();

/** @brief Fundamental equivalence check for two given types T and U.
*
Expand Down
83 changes: 43 additions & 40 deletions src/Datatype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,46 +224,49 @@ std::string datatypeToString(openPMD::Datatype dt)
return buf.str();
}

std::vector<Datatype> openPMD_Datatypes{
Datatype::CHAR,
Datatype::UCHAR,
Datatype::SCHAR,
Datatype::SHORT,
Datatype::INT,
Datatype::LONG,
Datatype::LONGLONG,
Datatype::USHORT,
Datatype::UINT,
Datatype::ULONG,
Datatype::ULONGLONG,
Datatype::FLOAT,
Datatype::DOUBLE,
Datatype::LONG_DOUBLE,
Datatype::CFLOAT,
Datatype::CDOUBLE,
Datatype::CLONG_DOUBLE,
Datatype::STRING,
Datatype::VEC_CHAR,
Datatype::VEC_SHORT,
Datatype::VEC_INT,
Datatype::VEC_LONG,
Datatype::VEC_LONGLONG,
Datatype::VEC_UCHAR,
Datatype::VEC_USHORT,
Datatype::VEC_UINT,
Datatype::VEC_ULONG,
Datatype::VEC_ULONGLONG,
Datatype::VEC_FLOAT,
Datatype::VEC_DOUBLE,
Datatype::VEC_LONG_DOUBLE,
Datatype::VEC_CFLOAT,
Datatype::VEC_CDOUBLE,
Datatype::VEC_CLONG_DOUBLE,
Datatype::VEC_SCHAR,
Datatype::VEC_STRING,
Datatype::ARR_DBL_7,
Datatype::BOOL,
Datatype::UNDEFINED};
std::vector<Datatype> openPMD_Datatypes()
{
return {
Datatype::CHAR,
Datatype::UCHAR,
Datatype::SCHAR,
Datatype::SHORT,
Datatype::INT,
Datatype::LONG,
Datatype::LONGLONG,
Datatype::USHORT,
Datatype::UINT,
Datatype::ULONG,
Datatype::ULONGLONG,
Datatype::FLOAT,
Datatype::DOUBLE,
Datatype::LONG_DOUBLE,
Datatype::CFLOAT,
Datatype::CDOUBLE,
Datatype::CLONG_DOUBLE,
Datatype::STRING,
Datatype::VEC_CHAR,
Datatype::VEC_SHORT,
Datatype::VEC_INT,
Datatype::VEC_LONG,
Datatype::VEC_LONGLONG,
Datatype::VEC_UCHAR,
Datatype::VEC_USHORT,
Datatype::VEC_UINT,
Datatype::VEC_ULONG,
Datatype::VEC_ULONGLONG,
Datatype::VEC_FLOAT,
Datatype::VEC_DOUBLE,
Datatype::VEC_LONG_DOUBLE,
Datatype::VEC_CFLOAT,
Datatype::VEC_CDOUBLE,
Datatype::VEC_CLONG_DOUBLE,
Datatype::VEC_SCHAR,
Datatype::VEC_STRING,
Datatype::ARR_DBL_7,
Datatype::BOOL,
Datatype::UNDEFINED};
}

namespace
{
Expand Down

0 comments on commit a63f8d8

Please sign in to comment.