Skip to content
Snippets Groups Projects
Commit 493e86ea authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon
Browse files

Seperate template impl from public and private for ADIOS class

parent 809643ad
No related branches found
No related tags found
1 merge request!59Seperate templete impl from public and private for ADIOS class
......@@ -343,19 +343,22 @@ protected: // no const to allow default empty and copy constructors
std::map<unsigned int, Variable<T>> &GetVariableMap();
};
//------------------------------------------------------------------------------
// Explicit declaration of the template methods
#define declare_template_instantiation(T) \
extern template Variable<T> &ADIOS::DefineVariable<T>( \
const std::string &name, const Dims, const Dims, const Dims); \
extern template Variable<T> &ADIOS::GetVariable<T>(const std::string &); \
extern template unsigned int ADIOS::GetVariableIndex<T>( \
const std::string &name); \
template <> \
std::map<unsigned int, Variable<T>> &ADIOS::GetVariableMap<T>();
\
extern template Variable<T> &ADIOS::GetVariable<T>(const std::string &);
ADIOS_FOREACH_TYPE_1ARG(declare_template_instantiation)
extern template unsigned int ADIOS::GetVariableIndex<void>(const std::string &);
#undef declare_template_instantiation
} // end namespace adios
// Include the inline implementations for the public interface
#include "ADIOS.inl"
#endif /* ADIOS_H_ */
......@@ -6,10 +6,11 @@
* This contains the template implementations for the ADIOS class
*/
#ifndef ADIOS_TCC_
#define ADIOS_TCC_
#include "ADIOS.h"
#ifndef ADIOS_INL_
#define ADIOS_INL_
#ifndef ADIOS_H_
#error "Inline file should only be included from it's header, never on it's own"
#endif
namespace adios
{
......@@ -31,4 +32,4 @@ VariableCompound &ADIOS::DefineVariableCompound(const std::string &name,
} // end namespace adios
#endif /* ADIOS_TCC_ */
#endif /* ADIOS_INL_ */
......@@ -18,6 +18,7 @@
#include "ADIOS.h"
#include "ADIOS.tcc"
#include "ADIOSMacros.h"
#include "functions/adiosFunctions.h"
......@@ -379,4 +380,19 @@ void ADIOS::CheckMethod(std::map<std::string, Method>::const_iterator itMethod,
}
}
//------------------------------------------------------------------------------
// Explicitly instantiate the necessary template implementations
#define define_template_instantiation(T) \
template Variable<T> &ADIOS::DefineVariable<T>( \
const std::string &, const Dims, const Dims, const Dims); \
\
template Variable<T> &ADIOS::GetVariable<T>(const std::string &);
ADIOS_FOREACH_TYPE_1ARG(define_template_instantiation)
template unsigned int ADIOS::GetVariableIndex<void>(const std::string &);
#undef define_template_instatiation
//------------------------------------------------------------------------------
} // end namespace adios
......@@ -6,7 +6,10 @@
* This contains the template specializatios for the ADIOS class
*/
#include "ADIOS.tcc"
#ifndef ADIOS_TCC_
#define ADIOS_TCC_
#include "ADIOS.h"
#include "ADIOSMacros.h"
namespace adios
......@@ -114,8 +117,6 @@ ADIOS::GetVariableMap()
return m_CLDouble;
}
// -----------------------------------------------------------------------------
// explicit template instantiations of DefineVariable:
// -----------------------------------------------------------------------------
template <typename T>
......@@ -133,14 +134,6 @@ ADIOS::DefineVariable(const std::string &name, const Dims globalDimensions,
return variableMap.at(size);
}
#define define_template_instantiation(T) \
template Variable<T> &ADIOS::DefineVariable<T>( \
const std::string &, const Dims, const Dims, const Dims);
ADIOS_FOREACH_TYPE_1ARG(define_template_instantiation)
#undef define_template_instatiation
// -----------------------------------------------------------------------------
// template specializations of GetVariable:
// -----------------------------------------------------------------------------
template <class T>
......@@ -160,11 +153,6 @@ Variable<T> &ADIOS::GetVariable(const std::string &name)
return GetVariableMap<T>().at(GetVariableIndex<T>(name));
}
#define define_template_instatiation(T) \
template unsigned int ADIOS::GetVariableIndex<T>(const std::string &); \
template Variable<T> &ADIOS::GetVariable<T>(const std::string &);
ADIOS_FOREACH_TYPE_1ARG(define_template_instatiation)
template unsigned int ADIOS::GetVariableIndex<void>(const std::string &);
#undef define_template_instatiation
} // end namespace adios
#endif // ADIOS_TCC_
......@@ -10,7 +10,7 @@ endif()
foreach(adios2_target IN LISTS adios2_targets)
add_library(${adios2_target}
ADIOS.cpp ADIOS_inst.cpp
ADIOS.cpp ADIOS.tcc
#ADIOS_C.cpp
capsule/heap/STLVector.cpp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment