diff --git a/source/adios2/ADIOSTypes.h b/source/adios2/ADIOSTypes.h index 4679e3fe50..d23372cccf 100644 --- a/source/adios2/ADIOSTypes.h +++ b/source/adios2/ADIOSTypes.h @@ -137,6 +137,10 @@ using std::uint64_t; using cfloat = std::complex; using cdouble = std::complex; +// Compound is never actually defined, it's just used to template with, in +// particular Variable. +class Compound; + // Limit, using uint64_t to make it portable constexpr uint64_t MaxU64 = std::numeric_limits::max(); constexpr size_t MaxSizeT = std::numeric_limits::max(); diff --git a/source/adios2/core/VariableCompound.cpp b/source/adios2/core/VariableCompound.cpp index 05c5282205..f8b596a105 100644 --- a/source/adios2/core/VariableCompound.cpp +++ b/source/adios2/core/VariableCompound.cpp @@ -18,19 +18,18 @@ namespace adios2 namespace core { -VariableCompound::VariableCompound(const std::string &name, - const size_t structSize, const Dims &shape, - const Dims &start, const Dims &count, - const bool constantDims, - const bool debugMode) -: VariableBase(name, "compound", structSize, shape, start, count, constantDims, - debugMode) +Variable::Variable(const std::string &name, const size_t structSize, + const Dims &shape, const Dims &start, + const Dims &count, const bool constantDims, + const bool debugMode) +: VariableBase(name, "compound", structSize, shape, start, count, + constantDims, debugMode) { } #define declare_template_instantiation(T) \ - template void VariableCompound::InsertMember(const std::string &, \ - const size_t); + template void Variable::InsertMember(const std::string &, \ + const size_t); ADIOS2_FOREACH_STDTYPE_1ARG(declare_template_instantiation) #undef declare_template_instantiation diff --git a/source/adios2/core/VariableCompound.h b/source/adios2/core/VariableCompound.h index f2be1ad9e9..2b63e7d7ca 100644 --- a/source/adios2/core/VariableCompound.h +++ b/source/adios2/core/VariableCompound.h @@ -11,7 +11,9 @@ #ifndef ADIOS2_CORE_VARIABLECOMPOUND_H_ #define ADIOS2_CORE_VARIABLECOMPOUND_H_ -#include "VariableBase.h" +// FIXME, VariableCompound is now also an alias for Variable, so +// arguably this should be all merged into Variable.{h,tcc,cpp} +#include "Variable.h" #include "adios2/ADIOSMacros.h" @@ -24,7 +26,8 @@ namespace core * @param Base (parent) class for template derived (child) class CVariable. * Required to put CVariable objects in STL containers. */ -class VariableCompound : public VariableBase +template <> +class Variable : public VariableBase { public: @@ -41,11 +44,12 @@ class VariableCompound : public VariableBase /** vector of primitve element types defining compound struct */ std::vector m_Elements; - VariableCompound(const std::string &name, const size_t structSize, - const Dims &shape, const Dims &start, const Dims &count, - const bool constantDims, const bool debugMode); + Variable(); + Variable(const std::string &name, const size_t structSize, + const Dims &shape, const Dims &start, const Dims &count, + const bool constantDims, const bool debugMode); - ~VariableCompound() = default; + ~Variable() = default; /** * Inserts an Element into the compound struct definition @@ -58,11 +62,13 @@ class VariableCompound : public VariableBase // Explicit declaration of the public template methods #define declare_template_instantiation(T) \ - extern template void VariableCompound::InsertMember( \ + extern template void Variable::InsertMember( \ const std::string &, const size_t); ADIOS2_FOREACH_STDTYPE_1ARG(declare_template_instantiation) #undef declare_template_instantiation +using VariableCompound = Variable; + } // end namespace core } // end namespace adios2 diff --git a/source/adios2/core/VariableCompound.tcc b/source/adios2/core/VariableCompound.tcc index 62d2ad3559..798244c640 100644 --- a/source/adios2/core/VariableCompound.tcc +++ b/source/adios2/core/VariableCompound.tcc @@ -21,8 +21,8 @@ namespace core { template -void VariableCompound::InsertMember(const std::string &name, - const size_t offset) +void Variable::InsertMember(const std::string &name, + const size_t offset) { m_Elements.push_back(Element{name, helper::GetType(), offset}); }