Skip to content

Commit

Permalink
Merge pull request #2318 from bradking/data-type
Browse files Browse the repository at this point in the history
Rename internal data type enumeration from Type to DataType
  • Loading branch information
Chuck Atkins authored Jun 16, 2020
2 parents 40c6e39 + e326af1 commit 0288859
Show file tree
Hide file tree
Showing 99 changed files with 742 additions and 721 deletions.
12 changes: 6 additions & 6 deletions bindings/C/adios2/c/adios2_c_attribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ adios2_error adios2_attribute_type(adios2_type *type,
reinterpret_cast<const adios2::core::AttributeBase *>(attribute);

auto type_s = attributeBase->m_Type;
if (type_s == adios2::helper::GetType<std::string>())
if (type_s == adios2::helper::GetDataType<std::string>())
{
*type = adios2_type_string;
}
#define make_case(T) \
else if (type_s == adios2::helper::GetType<MapAdios2Type<T>::Type>()) \
else if (type_s == adios2::helper::GetDataType<MapAdios2Type<T>::Type>()) \
{ \
*type = T; \
}
Expand Down Expand Up @@ -146,13 +146,13 @@ adios2_error adios2_attribute_data(void *data, size_t *size,
const adios2::core::AttributeBase *attributeBase =
reinterpret_cast<const adios2::core::AttributeBase *>(attribute);

const adios2::Type type(attributeBase->m_Type);
const adios2::DataType type(attributeBase->m_Type);

if (type == adios2::Type::None)
if (type == adios2::DataType::None)
{
// not supported
}
else if (type == adios2::helper::GetType<std::string>())
else if (type == adios2::helper::GetDataType<std::string>())
{
const adios2::core::Attribute<std::string> *attributeCpp =
dynamic_cast<const adios2::core::Attribute<std::string> *>(
Expand All @@ -177,7 +177,7 @@ adios2_error adios2_attribute_data(void *data, size_t *size,
}
}
#define declare_template_instantiation(T) \
else if (type == adios2::helper::GetType<T>()) \
else if (type == adios2::helper::GetDataType<T>()) \
{ \
const adios2::core::Attribute<T> *attributeCpp = \
dynamic_cast<const adios2::core::Attribute<T> *>(attributeBase); \
Expand Down
34 changes: 17 additions & 17 deletions bindings/C/adios2/c/adios2_c_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "adios2_c_engine.h"

#include "adios2/core/Engine.h"
#include "adios2/helper/adiosFunctions.h" //GetType<T>
#include "adios2/helper/adiosFunctions.h" //GetDataType<T>
#include "adios2_c_internal.h"

namespace
Expand Down Expand Up @@ -241,25 +241,25 @@ adios2_error adios2_put(adios2_engine *engine, adios2_variable *variable,

adios2::core::VariableBase *variableBase =
reinterpret_cast<adios2::core::VariableBase *>(variable);
const adios2::Type type(variableBase->m_Type);
const adios2::DataType type(variableBase->m_Type);

const adios2::Mode modeCpp = adios2_ToMode(
mode, "only adios2_mode_deferred or adios2_mode_sync are valid, "
"in call to adios2_put");

if (type == adios2::Type::Compound)
if (type == adios2::DataType::Compound)
{
// not supported
}
else if (type == adios2::helper::GetType<std::string>())
else if (type == adios2::helper::GetDataType<std::string>())
{
const std::string dataStr(reinterpret_cast<const char *>(data));
engineCpp->Put(*dynamic_cast<adios2::core::Variable<std::string> *>(
variableBase),
dataStr, modeCpp);
}
#define declare_template_instantiation(T) \
else if (type == adios2::helper::GetType<T>()) \
else if (type == adios2::helper::GetDataType<T>()) \
{ \
engineCpp->Put( \
*dynamic_cast<adios2::core::Variable<T> *>(variableBase), \
Expand Down Expand Up @@ -302,20 +302,20 @@ adios2_error adios2_put_by_name(adios2_engine *engine,
mode, "only adios2_mode_deferred or adios2_mode_sync are valid, "
"in call to adios2_put_by_name");

const adios2::Type type(
const adios2::DataType type(
engineCpp->m_IO.InquireVariableType(variable_name));

if (type == adios2::Type::Compound)
if (type == adios2::DataType::Compound)
{
// not supported
}
else if (type == adios2::helper::GetType<std::string>())
else if (type == adios2::helper::GetDataType<std::string>())
{
const std::string dataStr(reinterpret_cast<const char *>(data));
engineCpp->Put(variable_name, dataStr, modeCpp);
}
#define declare_template_instantiation(T) \
else if (type == adios2::helper::GetType<T>()) \
else if (type == adios2::helper::GetDataType<T>()) \
{ \
engineCpp->Put(variable_name, reinterpret_cast<const T *>(data), \
modeCpp); \
Expand Down Expand Up @@ -379,13 +379,13 @@ adios2_error adios2_get(adios2_engine *engine, adios2_variable *variable,
adios2::core::VariableBase *variableBase =
reinterpret_cast<adios2::core::VariableBase *>(variable);

const adios2::Type type(variableBase->m_Type);
const adios2::DataType type(variableBase->m_Type);

if (type == adios2::Type::Compound)
if (type == adios2::DataType::Compound)
{
// not supported
}
else if (type == adios2::helper::GetType<std::string>())
else if (type == adios2::helper::GetDataType<std::string>())
{
std::string dataStr;
engineCpp->Get(*dynamic_cast<adios2::core::Variable<std::string> *>(
Expand All @@ -394,7 +394,7 @@ adios2_error adios2_get(adios2_engine *engine, adios2_variable *variable,
dataStr.copy(reinterpret_cast<char *>(values), dataStr.size());
}
#define declare_template_instantiation(T) \
else if (type == adios2::helper::GetType<T>()) \
else if (type == adios2::helper::GetDataType<T>()) \
{ \
const adios2::Mode modeCpp = adios2_ToMode( \
mode, "only adios2_mode_deferred or adios2_mode_sync are valid, " \
Expand Down Expand Up @@ -438,21 +438,21 @@ adios2_error adios2_get_by_name(adios2_engine *engine,
const adios2::Mode modeCpp = adios2_ToMode(
mode, "only adios2_mode_deferred or adios2_mode_sync are valid, "
"in call to adios2_get_by_name");
const adios2::Type type(
const adios2::DataType type(
engineCpp->m_IO.InquireVariableType(variable_name));

if (type == adios2::Type::Compound)
if (type == adios2::DataType::Compound)
{
// not supported
}
else if (type == adios2::helper::GetType<std::string>())
else if (type == adios2::helper::GetDataType<std::string>())
{
std::string dataStr;
engineCpp->Get(variable_name, dataStr);
dataStr.copy(reinterpret_cast<char *>(data), dataStr.size());
}
#define declare_template_instantiation(T) \
else if (type == adios2::helper::GetType<T>()) \
else if (type == adios2::helper::GetDataType<T>()) \
{ \
engineCpp->Get(variable_name, reinterpret_cast<T *>(data), modeCpp); \
}
Expand Down
26 changes: 13 additions & 13 deletions bindings/C/adios2/c/adios2_c_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <vector>

#include "adios2/core/IO.h"
#include "adios2/helper/adiosFunctions.h" //GetType<T>
#include "adios2/helper/adiosFunctions.h" //GetDataType<T>
#include "adios2_c_internal.h"

#ifdef __cplusplus
Expand Down Expand Up @@ -258,15 +258,15 @@ adios2_variable *adios2_inquire_variable(adios2_io *io, const char *name)
return variable;
}

const adios2::Type type(ioCpp.InquireVariableType(name));
const adios2::DataType type(ioCpp.InquireVariableType(name));
adios2::core::VariableBase *variableCpp = nullptr;

if (type == adios2::Type::Compound)
if (type == adios2::DataType::Compound)
{
// not supported
}
#define declare_template_instantiation(T) \
else if (type == adios2::helper::GetType<T>()) \
else if (type == adios2::helper::GetDataType<T>()) \
{ \
variableCpp = ioCpp.InquireVariable<T>(name); \
}
Expand Down Expand Up @@ -308,15 +308,15 @@ adios2_error adios2_inquire_all_variables(adios2_variable ***variables,
for (auto &name : names)
{
auto it = dataMap.find(name);
const adios2::Type type(it->second.first);
const adios2::DataType type(it->second.first);
adios2::core::VariableBase *variable = nullptr;

if (type == adios2::Type::Compound)
if (type == adios2::DataType::Compound)
{
// not supported
}
#define declare_template_instantiation(T) \
else if (type == adios2::helper::GetType<T>()) \
else if (type == adios2::helper::GetDataType<T>()) \
{ \
variable = ioCpp.InquireVariable<T>(name); \
list[n] = reinterpret_cast<adios2_variable *>(variable); \
Expand Down Expand Up @@ -506,15 +506,15 @@ adios2_attribute *adios2_inquire_attribute(adios2_io *io, const char *name)
return attribute;
}

const adios2::Type type(itAttribute->second.first);
const adios2::DataType type(itAttribute->second.first);
adios2::core::AttributeBase *attributeCpp = nullptr;

if (type == adios2::Type::Compound)
if (type == adios2::DataType::Compound)
{
// not supported
}
#define declare_template_instantiation(T) \
else if (type == adios2::helper::GetType<T>()) \
else if (type == adios2::helper::GetDataType<T>()) \
{ \
attributeCpp = ioCpp.InquireAttribute<T>(name); \
}
Expand Down Expand Up @@ -567,15 +567,15 @@ adios2_error adios2_inquire_all_attributes(adios2_attribute ***attributes,
for (auto &name : names)
{
auto it = dataMap.find(name);
const adios2::Type type(it->second.first);
const adios2::DataType type(it->second.first);
adios2::core::AttributeBase *attribute = nullptr;

if (type == adios2::Type::Compound)
if (type == adios2::DataType::Compound)
{
// not supported
}
#define declare_template_instantiation(T) \
else if (type == adios2::helper::GetType<T>()) \
else if (type == adios2::helper::GetDataType<T>()) \
{ \
attribute = ioCpp.InquireAttribute<T>(name); \
list[n] = reinterpret_cast<adios2_attribute *>(attribute); \
Expand Down
2 changes: 1 addition & 1 deletion bindings/C/adios2/c/adios2_c_io_mpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <vector>

#include "adios2/core/IO.h"
#include "adios2/helper/adiosFunctions.h" //GetType<T>
#include "adios2/helper/adiosFunctions.h" //GetDataType<T>
#include "adios2_c_internal.h"

#include "adios2/helper/adiosCommMPI.h"
Expand Down
36 changes: 18 additions & 18 deletions bindings/C/adios2/c/adios2_c_variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ adios2_error adios2_variable_type(adios2_type *type,
const adios2::core::VariableBase *variableBase =
reinterpret_cast<const adios2::core::VariableBase *>(variable);

const adios2::Type typeCpp = variableBase->m_Type;
if (typeCpp == adios2::helper::GetType<std::string>())
const adios2::DataType typeCpp = variableBase->m_Type;
if (typeCpp == adios2::helper::GetDataType<std::string>())
{
*type = adios2_type_string;
}
#define make_case(T) \
else if (typeCpp == adios2::helper::GetType<MapAdios2Type<T>::Type>()) \
else if (typeCpp == adios2::helper::GetDataType<MapAdios2Type<T>::Type>()) \
{ \
*type = T; \
}
Expand Down Expand Up @@ -319,13 +319,13 @@ adios2_error adios2_variable_shape(size_t *shape,
const adios2::core::VariableBase *variableBase =
reinterpret_cast<const adios2::core::VariableBase *>(variable);

const adios2::Type typeCpp = variableBase->m_Type;
if (typeCpp == adios2::Type::Compound)
const adios2::DataType typeCpp = variableBase->m_Type;
if (typeCpp == adios2::DataType::Compound)
{
// not supported
}
#define declare_template_instantiation(T) \
else if (typeCpp == adios2::helper::GetType<T>()) \
else if (typeCpp == adios2::helper::GetDataType<T>()) \
{ \
const adios2::core::Variable<T> *variable = \
dynamic_cast<const adios2::core::Variable<T> *>(variableBase); \
Expand Down Expand Up @@ -382,13 +382,13 @@ adios2_error adios2_variable_count(size_t *count,
const adios2::core::VariableBase *variableBase =
reinterpret_cast<const adios2::core::VariableBase *>(variable);

const adios2::Type typeCpp = variableBase->m_Type;
if (typeCpp == adios2::Type::Compound)
const adios2::DataType typeCpp = variableBase->m_Type;
if (typeCpp == adios2::DataType::Compound)
{
// not supported
}
#define declare_template_instantiation(T) \
else if (typeCpp == adios2::helper::GetType<T>()) \
else if (typeCpp == adios2::helper::GetDataType<T>()) \
{ \
const adios2::core::Variable<T> *variable = \
dynamic_cast<const adios2::core::Variable<T> *>(variableBase); \
Expand Down Expand Up @@ -458,14 +458,14 @@ adios2_error adios2_selection_size(size_t *size,
const adios2::core::VariableBase *variableBase =
reinterpret_cast<const adios2::core::VariableBase *>(variable);

const adios2::Type typeCpp = variableBase->m_Type;
const adios2::DataType typeCpp = variableBase->m_Type;

if (typeCpp == adios2::Type::Compound)
if (typeCpp == adios2::DataType::Compound)
{
// not supported
}
#define declare_template_instantiation(T) \
else if (typeCpp == adios2::helper::GetType<T>()) \
else if (typeCpp == adios2::helper::GetDataType<T>()) \
{ \
const adios2::core::Variable<T> *variable = \
dynamic_cast<const adios2::core::Variable<T> *>(variableBase); \
Expand Down Expand Up @@ -552,14 +552,14 @@ adios2_error adios2_variable_min(void *min, const adios2_variable *variable)

const adios2::core::VariableBase *variableBase =
reinterpret_cast<const adios2::core::VariableBase *>(variable);
const adios2::Type type(variableBase->m_Type);
const adios2::DataType type(variableBase->m_Type);

if (type == adios2::Type::Compound)
if (type == adios2::DataType::Compound)
{
// not supported
}
#define declare_template_instantiation(T) \
else if (type == adios2::helper::GetType<T>()) \
else if (type == adios2::helper::GetDataType<T>()) \
{ \
T *minT = reinterpret_cast<T *>(min); \
const adios2::core::Variable<T> *variableT = \
Expand Down Expand Up @@ -589,14 +589,14 @@ adios2_error adios2_variable_max(void *max, const adios2_variable *variable)

const adios2::core::VariableBase *variableBase =
reinterpret_cast<const adios2::core::VariableBase *>(variable);
const adios2::Type type(variableBase->m_Type);
const adios2::DataType type(variableBase->m_Type);

if (type == adios2::Type::Compound)
if (type == adios2::DataType::Compound)
{
// not supported
}
#define declare_template_instantiation(T) \
else if (type == adios2::helper::GetType<T>()) \
else if (type == adios2::helper::GetDataType<T>()) \
{ \
T *maxT = reinterpret_cast<T *>(max); \
const adios2::core::Variable<T> *variableT = \
Expand Down
10 changes: 5 additions & 5 deletions bindings/CXX11/adios2/cxx11/IO.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,19 +311,19 @@ class IO

/**
* Inspects variable type. This function can be used in conjunction with
* MACROS in an else if (type == adios2::GetType<T>() ) {} loop
* MACROS in an else if (type == adios2::GetDataType<T>() ) {} loop
* @param name unique variable name identifier in current IO
* @return type as in adios2::GetType<T>() (e.g. "double", "float"),
* @return type as in adios2::GetDataType<T>() (e.g. "double", "float"),
* empty std::string if variable not found
*/
std::string VariableType(const std::string &name) const;

/**
* Inspects attribute type. This function can be used in conjunction with
* MACROS in an else if (type == adios2::GetType<T>() ) {} loop
* MACROS in an else if (type == adios2::GetDataType<T>() ) {} loop
* @param name unique attribute name identifier in current IO
* @return type as in adios2::GetType<T>() (e.g. "double", "float"), empty
* std::string if attribute not found
* @return type as in adios2::GetDataType<T>() (e.g. "double", "float"),
* empty std::string if attribute not found
*/
std::string AttributeType(const std::string &name) const;

Expand Down
2 changes: 1 addition & 1 deletion bindings/CXX11/adios2/cxx11/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace adios2
{

#define declare_template_instantiation(T) \
template std::string GetType<T>() noexcept;
template std::string GetDataType<T>() noexcept;

ADIOS2_FOREACH_TYPE_1ARG(declare_template_instantiation)
#undef declare_template_instantiation
Expand Down
Loading

0 comments on commit 0288859

Please sign in to comment.