From b195db9c3c2208c336816b30f8defa3105bce835 Mon Sep 17 00:00:00 2001
From: wfg <wfg@10.128.40.195>
Date: Mon, 30 Jan 2017 19:48:56 -0500
Subject: [PATCH] Added GetType<T> function in adiosTemplates.h

Propagate GetType<T> in Group, Engine and Support classes

To do:

Test ./examples/hello/writer/helloWriter_OOP.cpp
---
 examples/hello/writer/helloWriter_OOP.cpp |  7 +-
 include/core/Engine.h                     |  2 -
 include/format/BP1Writer.h                |  7 +-
 include/functions/adiosFunctions.h        |  8 ---
 include/functions/adiosTemplates.h        | 70 +++++++++++-------
 src/core/Engine.cpp                       |  5 +-
 src/core/Group.cpp                        | 86 +++++++++++------------
 src/core/Support.cpp                      | 27 +++----
 src/engine/dataman/DataMan.cpp            | 65 ++++++++++-------
 src/engine/writer/Writer.cpp              | 26 +++----
 src/functions/adiosFunctions.cpp          |  9 ---
 src/mpidummy.cpp                          |  7 +-
 12 files changed, 163 insertions(+), 156 deletions(-)

diff --git a/examples/hello/writer/helloWriter_OOP.cpp b/examples/hello/writer/helloWriter_OOP.cpp
index ab1992567..08cfa24ce 100644
--- a/examples/hello/writer/helloWriter_OOP.cpp
+++ b/examples/hello/writer/helloWriter_OOP.cpp
@@ -38,11 +38,12 @@ int main( int argc, char* argv [] )
     {
         //Define group and variables with transforms, variables don't have functions, only group can access variables
         adios::Group& ioGroup = adios.DeclareGroup( "ioGroup" );
+
         adios::Var ioNx = ioGroup.DefineVariable<unsigned int>( "Nx" );
+        //adios::Dims dimNx = ioGroup.SetDimensions( {ioNx} );
 
-        adios::Dims dimNx = ioGroup.SetDimensions( {ioNx} );
-        adios::Var ioMyDoubles = ioGroup.DefineVariable<double>( "myDoubles", dimNx );
-        adios::Var ioMyFloats = ioGroup.DefineVariable<float>( "myFloats", dimNx );
+        adios::Var ioMyDoubles = ioGroup.DefineVariable<double>( "myDoubles", "Nx" );
+        adios::Var ioMyFloats = ioGroup.DefineVariable<float>( "myFloats", "Nx" );
 
         //add transform to variable in group...not executed (just testing API)
         adios::Transform bzip2 = adios::transform::BZIP2( );
diff --git a/include/core/Engine.h b/include/core/Engine.h
index 2cdd048a5..2094f6882 100644
--- a/include/core/Engine.h
+++ b/include/core/Engine.h
@@ -152,12 +152,10 @@ protected:
      * Returns an index to variable type container in Group
      * @param group variable group owner object
      * @param variableName variable to be checked
-     * @param types from Support class, collection of type aliases
      * @param hint added information if exception is thrown
      * @return index to variable in group type container
      */
     unsigned int PreSetVariable( Group& group, const std::string variableName,
-                                 const std::set<std::string>& types,
                                  const std::string hint );
 
     /**
diff --git a/include/format/BP1Writer.h b/include/format/BP1Writer.h
index 0aef1cf1b..73a92cbfe 100644
--- a/include/format/BP1Writer.h
+++ b/include/format/BP1Writer.h
@@ -269,7 +269,7 @@ public:
         WriteToBuffers( dataBuffers, &dataType, 1, dataOffset );
 
         //Characteristics Sets in Metadata and Data
-        const std::size_t metadataCharacteristicsSetsCountPosition = metadataOffset; //very important piece
+        //const std::size_t metadataCharacteristicsSetsCountPosition = metadataOffset; //very important piece
         std::size_t dataCharacteristicsCountPosition = dataOffset;
         const std::uint64_t sets = 1; //write one for now
         WriteToBuffers( metadataBuffers, &sets, 8, metadataOffset );
@@ -457,11 +457,6 @@ public:
         ++m_VariablesCount;
     } //end of function
 
-
-private:
-
-    bool m_DebugMode = false;
-
 };
 
 
diff --git a/include/functions/adiosFunctions.h b/include/functions/adiosFunctions.h
index 7d0a58ad2..17697adcf 100644
--- a/include/functions/adiosFunctions.h
+++ b/include/functions/adiosFunctions.h
@@ -132,14 +132,6 @@ void CreateDirectory( const std::string fullPath ) noexcept;
 void SetTransformsHelper( const std::vector<std::string>& transformNames, std::vector< std::shared_ptr<Transform> >& transforms,
                           const bool debugMode, std::vector<short>& transformIndices, std::vector<short>& parameters );
 
-/**
- * Check in types set if "type" is one of the aliases for a certain type, (e.g. if type = integer is an accepted alias for "int", returning true)
- * @param type input to be compared with an alias
- * @param types set containing aliases to a certain type, from Support.h
- * @return true: is an alias, false: is not
- */
-bool IsTypeAlias( const std::string type, const std::set<std::string>& types );
-
 
 /**
  * Transforms a vector
diff --git a/include/functions/adiosTemplates.h b/include/functions/adiosTemplates.h
index 643153351..53c20f6ce 100644
--- a/include/functions/adiosTemplates.h
+++ b/include/functions/adiosTemplates.h
@@ -12,45 +12,63 @@
 namespace adios
 {
 
-template< class T >
+template< class T> inline
 std::string GetType( ) noexcept
-{
-    std::string type;
+{ return ""; }
+
+template<> inline
+std::string GetType<char>() noexcept { return "char"; }
+
+template<> inline
+std::string GetType<unsigned char>() noexcept { return "unsigned char"; }
 
-    if( std::is_same<T,char>::value )
-        type = "char";
+template<> inline
+std::string GetType<short>() noexcept { return "short"; }
 
-    else if( std::is_same<T,short>::value )
-        type = "short";
+template<> inline
+std::string GetType<unsigned short>() noexcept { return "unsigned short"; }
 
-    else if( std::is_same<T,int>::value )
-        type = "int";
+template<> inline
+std::string GetType<int>() noexcept { return "int"; }
 
-    else if( std::is_same<T,long int>::value )
-        type = "long int";
+template<> inline
+std::string GetType<unsigned int>() noexcept { return "unsigned int"; }
 
-    else if( std::is_same<T,unsigned char>::value )
-        type = "unsigned char";
+template<> inline
+std::string GetType<long int>() noexcept { return "long int"; }
 
-    else if( std::is_same<T,unsigned short>::value )
-        type = "unsigned short";
+template<> inline
+std::string GetType<unsigned long int>() noexcept { return "unsigned long int"; }
 
-    else if( std::is_same<T,unsigned int>::value )
-        type = "unsigned int";
+template<> inline
+std::string GetType<float>() noexcept { return "float"; }
 
-    else if( std::is_same<T,unsigned long int>::value )
-        type = "unsigned long int";
+template<> inline
+std::string GetType<double>() noexcept { return "double"; }
 
-    else if( std::is_same<T,float>::value )
-        type = "float";
+template<> inline
+std::string GetType<long double>() noexcept { return "long double"; }
 
-    else if( std::is_same<T,double>::value )
-        type = "double";
 
-    else if( std::is_same<T,long double>::value )
-        type = "long double";
+/**
+ * Check in types set if "type" is one of the aliases for a certain type,
+ * (e.g. if type = integer is an accepted alias for "int", returning true)
+ * @param type input to be compared with an alias
+ * @param aliases set containing aliases to a certain type, typically Support::DatatypesAliases from Support.h
+ * @return true: is an alias, false: is not
+ */
+template<class T>
+bool IsTypeAlias( const std::string type,
+		          const std::map<std::string, std::set<std::string>>& aliases ) noexcept
+{
+	if( aliases.count( type ) == 1 ) //most of the time we will pass the same type
+		return true;
+
+	bool isAlias = false;
+	if( aliases.at( GetType<T>() ).count( type ) == 1 )
+	    isAlias = true;
 
-    return type;
+	return isAlias;
 }
 
 
diff --git a/src/core/Engine.cpp b/src/core/Engine.cpp
index 774a84ea9..7293df87d 100644
--- a/src/core/Engine.cpp
+++ b/src/core/Engine.cpp
@@ -44,7 +44,7 @@ void Engine::SetDefaultGroup( Group& group )
 
 //PROTECTED
 unsigned int Engine::PreSetVariable( Group& group, const std::string variableName,
-                                     const std::set<std::string>& types, const std::string hint )
+                                     const std::string hint )
 {
     auto itVariable = group.m_Variables.find( variableName );
 
@@ -52,9 +52,6 @@ unsigned int Engine::PreSetVariable( Group& group, const std::string variableNam
     {
         if( itVariable == group.m_Variables.end() )
             throw std::invalid_argument( "ERROR: variable " + variableName + " doesn't exist " + hint + ".\n" );
-
-        if( IsTypeAlias( itVariable->second.first, types ) == false )
-            throw std::invalid_argument( "ERROR: type in variable " + variableName + " doesn't match " + hint + ".\n" );
     }
 
     group.m_WrittenVariables.insert( variableName ); // group tracks its own written variables for dimensions
diff --git a/src/core/Group.cpp b/src/core/Group.cpp
index a0679e813..341381d51 100644
--- a/src/core/Group.cpp
+++ b/src/core/Group.cpp
@@ -90,67 +90,67 @@ Var Group::DefineVariable( const std::string variableName, const std::string typ
 
     const int globalBoundsIndex = SetGlobalBounds( globalDimensionsCSV, globalOffsetsCSV );
 
-    if( IsTypeAlias( type, Support::DatatypesAliases.at("char") ) == true )
+    if( IsTypeAlias<char>( type, Support::DatatypesAliases ) == true )
     {
         m_Char.push_back( Variable<char>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false } );
         m_Variables[variableName] = std::make_pair( type, m_Char.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned char") ) == true )
+    else if( IsTypeAlias<unsigned char>( type, Support::DatatypesAliases ) == true )
     {
         m_UChar.push_back( Variable<unsigned char>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false  } );
         m_Variables[variableName] = std::make_pair( type, m_UChar.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("short") ) == true )
+    else if( IsTypeAlias<short>( type, Support::DatatypesAliases ) == true )
     {
         m_Short.push_back( Variable<short>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false  } );
         m_Variables[variableName] = std::make_pair( type, m_Short.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned short") ) == true )
+    else if( IsTypeAlias<unsigned short>( type, Support::DatatypesAliases ) == true )
     {
         m_UShort.push_back( Variable<unsigned short>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false  } );
         m_Variables[variableName] = std::make_pair( type, m_UShort.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("int") ) == true )
+    else if( IsTypeAlias<int>( type, Support::DatatypesAliases ) == true )
     {
         m_Int.push_back( Variable<int>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false  } );
         m_Variables[variableName] = std::make_pair( type, m_Int.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned int") ) == true )
+    else if( IsTypeAlias<unsigned int>( type, Support::DatatypesAliases ) == true )
     {
         m_UInt.push_back( Variable<unsigned int>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false  } );
         m_Variables[variableName] = std::make_pair( type, m_UInt.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("long int") ) == true )
+    else if( IsTypeAlias<long int>( type, Support::DatatypesAliases ) == true )
     {
         m_LInt.push_back( Variable<long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false  } );
         m_Variables[variableName] = std::make_pair( type, m_LInt.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long int") ) == true )
+    else if( IsTypeAlias<unsigned long int>( type, Support::DatatypesAliases ) == true )
     {
         m_ULInt.push_back( Variable<unsigned long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false  } );
         m_Variables[variableName] = std::make_pair( type, m_ULInt.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("long long int") ) == true )
+    else if( IsTypeAlias<long long int>( type, Support::DatatypesAliases ) == true )
     {
         m_LLInt.push_back( Variable<long long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false  } );
         m_Variables[variableName] = std::make_pair( type, m_LLInt.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long long int") ) == true )
+    else if( IsTypeAlias<unsigned long long int>( type, Support::DatatypesAliases ) == true )
     {
         m_ULLInt.push_back( Variable<unsigned long long int>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false  } );
         m_Variables[variableName] = std::make_pair( type, m_ULLInt.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("float") ) == true )
+    else if( IsTypeAlias<float>( type, Support::DatatypesAliases ) == true )
     {
         m_Float.push_back( Variable<float>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false  } );
         m_Variables[variableName] = std::make_pair( type, m_Float.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("double") ) == true )
+    else if( IsTypeAlias<double>( type, Support::DatatypesAliases ) == true )
     {
         m_Double.push_back( Variable<double>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false  } );
         m_Variables[variableName] = std::make_pair( type, m_Double.size()-1 );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("long double") ) == true )
+    else if( IsTypeAlias<long double>( type, Support::DatatypesAliases ) == true )
     {
         m_LDouble.push_back( Variable<long double>{ dimensionsCSV, nullptr, globalBoundsIndex, transforms, parameters, false } );
         m_Variables[variableName] = std::make_pair( type, m_LDouble.size()-1 );
@@ -177,62 +177,62 @@ void Group::AddTransform( const std::string variableName, Transform& transform,
     const std::string type( itVariable->second.first );
     const unsigned int index = itVariable->second.second;
 
-    if( IsTypeAlias( type, Support::DatatypesAliases.at("char") ) == true )
+    if( IsTypeAlias<char>( type, Support::DatatypesAliases ) == true )
     {
         m_Char[index].Transforms.push_back( &transform );
         m_Char[index].Parameters.push_back( parameter );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned char") ) == true )
+    else if( IsTypeAlias<unsigned char>( type, Support::DatatypesAliases ) == true )
     {
         m_UChar[index].Transforms.push_back( &transform );
         m_UChar[index].Parameters.push_back( parameter );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("short") ) == true )
+    else if( IsTypeAlias<short>( type, Support::DatatypesAliases ) == true )
     {
         m_Short[index].Transforms.push_back( &transform );
         m_Short[index].Parameters.push_back( parameter );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned short") ) == true )
+    else if( IsTypeAlias<unsigned short>( type, Support::DatatypesAliases ) == true )
     {
         m_UShort[index].Transforms.push_back( &transform );
         m_UShort[index].Parameters.push_back( parameter );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("int") ) == true )
+    else if( IsTypeAlias<int>( type, Support::DatatypesAliases ) == true )
     {
         m_Int[index].Transforms.push_back( &transform );
         m_Int[index].Parameters.push_back( parameter );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned int") ) == true )
+    else if( IsTypeAlias<unsigned int>( type, Support::DatatypesAliases ) == true )
     {
         m_UInt[index].Transforms.push_back( &transform );
         m_UInt[index].Parameters.push_back( parameter );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("long int") ) == true )
+    else if( IsTypeAlias<long int>( type, Support::DatatypesAliases ) == true )
     {
         m_LInt[index].Transforms.push_back( &transform );
         m_LInt[index].Parameters.push_back( parameter );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long int") ) == true )
+    else if( IsTypeAlias<unsigned long int>( type, Support::DatatypesAliases ) == true )
     {
         m_ULInt[index].Transforms.push_back( &transform );
         m_ULInt[index].Parameters.push_back( parameter );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long long int") ) == true )
+    else if( IsTypeAlias<unsigned long long int>( type, Support::DatatypesAliases ) == true )
     {
         m_ULLInt[index].Transforms.push_back( &transform );
         m_ULLInt[index].Parameters.push_back( parameter );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("float") ) == true )
+    else if( IsTypeAlias<float>( type, Support::DatatypesAliases ) == true )
     {
         m_Float[index].Transforms.push_back( &transform );
         m_Float[index].Parameters.push_back( parameter );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("double") ) == true )
+    else if( IsTypeAlias<double>( type, Support::DatatypesAliases ) == true )
     {
         m_Double[index].Transforms.push_back( &transform );
         m_Double[index].Parameters.push_back( parameter );
     }
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("long double") ) == true )
+    else if( IsTypeAlias<long double>( type, Support::DatatypesAliases ) == true )
     {
         m_LDouble[index].Transforms.push_back( &transform );
         m_LDouble[index].Parameters.push_back( parameter );
@@ -287,28 +287,28 @@ unsigned long long int Group::GetIntVariableValue( const std::string variableNam
     const unsigned int index = m_Variables.at( variableName ).second;
     long long int value = -1;
 
-    if( IsTypeAlias( type, Support::DatatypesAliases.at("short") ) == true )
+    if( IsTypeAlias<short>( type, Support::DatatypesAliases ) == true )
         value = *( m_Short[index].Values );
 
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned short") ) == true )
+    else if( IsTypeAlias<unsigned short>( type, Support::DatatypesAliases ) == true )
         value = *( m_UShort[index].Values );
 
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("int") ) == true )
+    else if( IsTypeAlias<int>( type, Support::DatatypesAliases ) == true )
         value = *( m_Int[index].Values );
 
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned int") ) == true )
+    else if( IsTypeAlias<unsigned int>( type, Support::DatatypesAliases ) == true )
         value = *( m_UInt[index].Values );
 
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("long int") ) == true )
+    else if( IsTypeAlias<long int>( type, Support::DatatypesAliases ) == true )
         value = *( m_LInt[index].Values );
 
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long int") ) == true )
+    else if( IsTypeAlias<unsigned long int>( type, Support::DatatypesAliases ) == true )
         value = *( m_ULInt[index].Values );
 
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("long long int") ) == true )
+    else if( IsTypeAlias<long long int>( type, Support::DatatypesAliases ) == true )
         value = *( m_LLInt[index].Values );
 
-    else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long long int") ) == true )
+    else if( IsTypeAlias<unsigned long long int>( type, Support::DatatypesAliases ) == true )
         value = *( m_ULLInt[index].Values );
 
     else
@@ -357,14 +357,14 @@ std::vector<unsigned long long int> Group::GetDimensions( const std::string dime
 void Group::Monitor( std::ostream& logStream ) const
 {
     logStream << "\tVariable \t Type\n";
-    for( auto& variablePair : m_Variables )
+    for( const auto& variablePair : m_Variables )
     {
         logStream << "\t" << variablePair.first << " \t " << variablePair.second.first << "\n";
     }
     logStream << "\n";
 
     logStream << "\tAttribute \t Type \t Value \n";
-    for( auto& attributePair : m_Attributes )
+    for( const auto& attributePair : m_Attributes )
     {
         logStream << "\t" << attributePair.first << " \t " << attributePair.second.TypeID << " \t " << attributePair.second.Value << "\n";
     }
@@ -506,28 +506,28 @@ void Group::SetDimensionVariablesFlag( const std::string csv, const std::string
         const std::string type( itVariable->second.first );
         const unsigned int index = itVariable->second.second;
 
-        if( IsTypeAlias( type, Support::DatatypesAliases.at("short") ) == true )
+        if( IsTypeAlias<short>( type, Support::DatatypesAliases ) == true )
             m_Short[index].IsDimension = true;
 
-        else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned short") ) == true )
+        else if( IsTypeAlias<unsigned short>( type, Support::DatatypesAliases ) == true )
             m_UShort[index].IsDimension = true;
 
-        else if( IsTypeAlias( type, Support::DatatypesAliases.at("int") ) == true )
+        else if( IsTypeAlias<int>( type, Support::DatatypesAliases ) == true )
             m_Int[index].IsDimension = true;
 
-        else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned int") ) == true )
+        else if( IsTypeAlias<unsigned int>( type, Support::DatatypesAliases ) == true )
             m_UInt[index].IsDimension = true;
 
-        else if( IsTypeAlias( type, Support::DatatypesAliases.at("long int") ) == true )
+        else if( IsTypeAlias<long int>( type, Support::DatatypesAliases ) == true )
             m_LInt[index].IsDimension = true;
 
-        else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long int") ) == true )
+        else if( IsTypeAlias<unsigned long int>( type, Support::DatatypesAliases ) == true )
             m_ULInt[index].IsDimension = true;
 
-        else if( IsTypeAlias( type, Support::DatatypesAliases.at("long long int") ) == true )
+        else if( IsTypeAlias<long long int>( type, Support::DatatypesAliases ) == true )
             m_LLInt[index].IsDimension = true;
 
-        else if( IsTypeAlias( type, Support::DatatypesAliases.at("unsigned long long int") ) == true )
+        else if( IsTypeAlias<unsigned long long int>( type, Support::DatatypesAliases ) == true )
             m_ULLInt[index].IsDimension = true;
 
         else
diff --git a/src/core/Support.cpp b/src/core/Support.cpp
index 4700f7838..25804adb7 100644
--- a/src/core/Support.cpp
+++ b/src/core/Support.cpp
@@ -7,6 +7,7 @@
 
 
 #include "core/Support.h"
+#include "functions/adiosTemplates.h"
 
 
 namespace adios
@@ -87,19 +88,19 @@ const std::map<std::string, std::set<std::string> > Support::Datatypes
 
 const std::map<std::string, std::set<std::string> > Support::DatatypesAliases
 {
-    { "char",           { "char", "character" }  },
-    { "unsigned char",  { "unsigned char", "unsigned character" }  },
-    { "short",          { "short", "integer*2" } },
-    { "unsigned short", { "unsigned short" }  },
-    { "int",                    { "int", "integer" } },
-    { "unsigned int",           { "unsigned int", "unsigned integer" } },
-    { "long int",               { "long int", "long", "long integer" } },
-    { "unsigned long int",      { "unsigned long int", "unsigned long", "unsigned long integer" } },
-    { "long long int",          { "long long int", "long long", "long long integer" } },
-    { "unsigned long long int", { "unsigned long long int", "unsigned long long", "unsigned long long integer" } },
-    { "float", { "float", "real", "real*4" } },
-    { "double", { "double", "double precision", "real*8" } },
-    { "long double", { "long double", "long double precision", "real*16" } }
+    { GetType<char>(),         { GetType<char>(), "character" }  },
+    { GetType<unsigned char>(),  { GetType<unsigned char>(), "unsigned character" }  },
+    { GetType<short>(),          { GetType<short>(), "integer*2" } },
+    { GetType<unsigned short>(), { GetType<unsigned short>() }  },
+    { GetType<int>(),            { GetType<int>(), "integer" } },
+    { GetType<unsigned int>(),   { GetType<unsigned int>(), "unsigned integer" } },
+    { GetType<long int>(),       { GetType<long int>(), "long", "long integer" } },
+    { GetType<unsigned long int>(), { GetType<unsigned long int>(), "unsigned long", "unsigned long integer" } },
+    { GetType<long long int>(),  { GetType<long long int>(), "long long", "long long integer" } },
+    { GetType<unsigned long long int>(), { GetType<unsigned long long int>(), "unsigned long long", "unsigned long long integer" } },
+    { GetType<float>(),                  { GetType<float>(), "real", "real*4" } },
+    { GetType<double>(),      { GetType<double>(), "double precision", "real*8" } },
+    { GetType<long double>(), { GetType<long double>(), "long double precision", "real*16" } }
 };
 
 
diff --git a/src/engine/dataman/DataMan.cpp b/src/engine/dataman/DataMan.cpp
index 8c784b970..9c918fb77 100644
--- a/src/engine/dataman/DataMan.cpp
+++ b/src/engine/dataman/DataMan.cpp
@@ -47,7 +47,7 @@ void DataMan::Init( )
 
 void DataMan::Write( Group& group, const std::string variableName, const char* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("char"), " from call to Write char*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write char*" );
 	Variable<char>& variable = group.m_Char[index]; //must be a reference
 	variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -56,7 +56,7 @@ void DataMan::Write( Group& group, const std::string variableName, const char* v
 
 void DataMan::Write( Group& group, const std::string variableName, const unsigned char* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("unsigned char"), " from call to Write unsigned char*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write unsigned char*" );
 	Variable<unsigned char>& variable = group.m_UChar[index]; //must be a reference
     variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -65,7 +65,7 @@ void DataMan::Write( Group& group, const std::string variableName, const unsigne
 
 void DataMan::Write( Group& group, const std::string variableName, const short* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("short"), " from call to Write short*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write short*" );
 	Variable<short>& variable = group.m_Short[index]; //must be a reference
     variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -74,7 +74,7 @@ void DataMan::Write( Group& group, const std::string variableName, const short*
 
 void DataMan::Write( Group& group, const std::string variableName, const unsigned short* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("unsigned short"), " from call to Write unsigned short*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write unsigned short*" );
 	Variable<unsigned short>& variable = group.m_UShort[index]; //must be a reference
     variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -83,7 +83,7 @@ void DataMan::Write( Group& group, const std::string variableName, const unsigne
 
 void DataMan::Write( Group& group, const std::string variableName, const int* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("int"), " from call to Write int*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write int*" );
 	Variable<int>& variable = group.m_Int[index]; //must be a reference
     variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -92,7 +92,7 @@ void DataMan::Write( Group& group, const std::string variableName, const int* va
 
 void DataMan::Write( Group& group, const std::string variableName, const unsigned int* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("unsigned int"), " from call to Write unsigned int*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write unsigned int*" );
 	Variable<unsigned int>& variable = group.m_UInt[index]; //must be a reference
     variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -101,7 +101,7 @@ void DataMan::Write( Group& group, const std::string variableName, const unsigne
 
 void DataMan::Write( Group& group, const std::string variableName, const long int* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("long int"), " from call to Write long int*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write long int*" );
 	Variable<long int>& variable = group.m_LInt[index]; //must be a reference
     variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -110,7 +110,7 @@ void DataMan::Write( Group& group, const std::string variableName, const long in
 
 void DataMan::Write( Group& group, const std::string variableName, const unsigned long int* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("unsigned long int"), " from call to Write unsigned long int*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write unsigned long int*" );
 	Variable<unsigned long int>& variable = group.m_ULInt[index]; //must be a reference
 	variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -119,7 +119,7 @@ void DataMan::Write( Group& group, const std::string variableName, const unsigne
 
 void DataMan::Write( Group& group, const std::string variableName, const long long int* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("long long int"), " from call to Write long long int*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write long long int*" );
 	Variable<long long int>& variable = group.m_LLInt[index]; //must be a reference
 	variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -128,7 +128,7 @@ void DataMan::Write( Group& group, const std::string variableName, const long lo
 
 void DataMan::Write( Group& group, const std::string variableName, const unsigned long long int* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("unsigned long long int"), " from call to Write unsigned long long int*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write unsigned long long int*" );
 	Variable<unsigned long long int>& variable = group.m_ULLInt[index]; //must be a reference
 	variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -136,7 +136,7 @@ void DataMan::Write( Group& group, const std::string variableName, const unsigne
 
 void DataMan::Write( Group& group, const std::string variableName, const float* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("float"), " from call to Write float*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write float*" );
 	Variable<float>& variable = group.m_Float[index]; //must be a reference
 	variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -144,7 +144,7 @@ void DataMan::Write( Group& group, const std::string variableName, const float*
 
 void DataMan::Write( Group& group, const std::string variableName, const double* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("double"), " from call to Write double*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write double*" );
 	Variable<double>& variable = group.m_Double[index]; //must be a reference
 	variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -153,7 +153,7 @@ void DataMan::Write( Group& group, const std::string variableName, const double*
 
 void DataMan::Write( Group& group, const std::string variableName, const long double* values )
 {
-	auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("long double"), " from call to Write long double*" );
+	auto index = PreSetVariable( group, variableName, " from call to Write long double*" );
 	Variable<long double>& variable = group.m_LDouble[index]; //must be a reference
 	variable.Values = values;
 	DataManWriteVariable( group, variableName, variable, m_Capsules, m_Transports );
@@ -162,67 +162,80 @@ void DataMan::Write( Group& group, const std::string variableName, const long do
 //USING Preset Group
 void DataMan::Write( const std::string variableName, const char* values )
 {
+	CheckDefaultGroup( );
 	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const unsigned char* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const short* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const unsigned short* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const int* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const unsigned int* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const long int* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const unsigned long int* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const long long int* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const unsigned long long int* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const float* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const double* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 void DataMan::Write( const std::string variableName, const long double* values )
 {
-    Write( *m_Group, variableName, values );
+	CheckDefaultGroup( );
+	Write( *m_Group, variableName, values );
 }
 
 
@@ -233,7 +246,7 @@ void DataMan::InitCapsules( )
 }
 
 
-void DataMan::InitTransports( )
+void DataMan::InitTransports( ) //maybe move this?
 {
     std::set< std::string > transportStreamNames; //used to check for name conflict between transports
 
diff --git a/src/engine/writer/Writer.cpp b/src/engine/writer/Writer.cpp
index 07d355e14..89f832d61 100644
--- a/src/engine/writer/Writer.cpp
+++ b/src/engine/writer/Writer.cpp
@@ -46,7 +46,7 @@ void Writer::Init( )
 
 void Writer::Write( Group& group, const std::string variableName, const char* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("char"), " from call to Write char*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write char*" );
     Variable<char>& variable = group.m_Char[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -54,7 +54,7 @@ void Writer::Write( Group& group, const std::string variableName, const char* va
 
 void Writer::Write( Group& group, const std::string variableName, const unsigned char* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("unsigned char"), " from call to Write unsigned char*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write unsigned char*" );
     Variable<unsigned char>& variable = group.m_UChar[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -62,7 +62,7 @@ void Writer::Write( Group& group, const std::string variableName, const unsigned
 
 void Writer::Write( Group& group, const std::string variableName, const short* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("short"), " from call to Write short*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write short*" );
     Variable<short>& variable = group.m_Short[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -70,7 +70,7 @@ void Writer::Write( Group& group, const std::string variableName, const short* v
 
 void Writer::Write( Group& group, const std::string variableName, const unsigned short* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("unsigned short"), " from call to Write unsigned short*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write unsigned short*" );
     Variable<unsigned short>& variable = group.m_UShort[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -78,7 +78,7 @@ void Writer::Write( Group& group, const std::string variableName, const unsigned
 
 void Writer::Write( Group& group, const std::string variableName, const int* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("int"), " from call to Write int*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write int*" );
     Variable<int>& variable = group.m_Int[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -86,7 +86,7 @@ void Writer::Write( Group& group, const std::string variableName, const int* val
 
 void Writer::Write( Group& group, const std::string variableName, const unsigned int* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("unsigned int"), " from call to Write unsigned int*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write unsigned int*" );
     Variable<unsigned int>& variable = group.m_UInt[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -94,7 +94,7 @@ void Writer::Write( Group& group, const std::string variableName, const unsigned
 
 void Writer::Write( Group& group, const std::string variableName, const long int* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("long int"), " from call to Write long int*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write long int*" );
     Variable<long int>& variable = group.m_LInt[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -102,7 +102,7 @@ void Writer::Write( Group& group, const std::string variableName, const long int
 
 void Writer::Write( Group& group, const std::string variableName, const unsigned long int* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("unsigned long int"), " from call to Write unsigned long int*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write unsigned long int*" );
     Variable<unsigned long int>& variable = group.m_ULInt[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -110,7 +110,7 @@ void Writer::Write( Group& group, const std::string variableName, const unsigned
 
 void Writer::Write( Group& group, const std::string variableName, const long long int* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("long long int"), " from call to Write long long int*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write long long int*" );
     Variable<long long int>& variable = group.m_LLInt[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -118,7 +118,7 @@ void Writer::Write( Group& group, const std::string variableName, const long lon
 
 void Writer::Write( Group& group, const std::string variableName, const unsigned long long int* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("unsigned long long int"), " from call to Write unsigned long long int*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write unsigned long long int*" );
     Variable<unsigned long long int>& variable = group.m_ULLInt[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -126,7 +126,7 @@ void Writer::Write( Group& group, const std::string variableName, const unsigned
 
 void Writer::Write( Group& group, const std::string variableName, const float* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("float"), " from call to Write float*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write float*" );
     Variable<float>& variable = group.m_Float[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -135,7 +135,7 @@ void Writer::Write( Group& group, const std::string variableName, const float* v
 
 void Writer::Write( Group& group, const std::string variableName, const double* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("double"), " from call to Write double*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write double*" );
     Variable<double>& variable = group.m_Double[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
@@ -144,7 +144,7 @@ void Writer::Write( Group& group, const std::string variableName, const double*
 
 void Writer::Write( Group& group, const std::string variableName, const long double* values )
 {
-    auto index = PreSetVariable( group, variableName, Support::DatatypesAliases.at("long double"), " from call to Write long double*" );
+    auto index = PreSetVariable( group, variableName, " from call to Write long double*" );
     Variable<long double>& variable = group.m_LDouble[index]; //must be a reference
     variable.Values = values;
     WriterWriteVariable( group, variableName, variable, *m_Capsules[0], m_Transports, m_BP1Writer );
diff --git a/src/functions/adiosFunctions.cpp b/src/functions/adiosFunctions.cpp
index baea09006..94230cff1 100644
--- a/src/functions/adiosFunctions.cpp
+++ b/src/functions/adiosFunctions.cpp
@@ -468,15 +468,6 @@ void SetTransformsHelper( const std::vector<std::string>& transformNames, std::v
 }
 
 
-bool IsTypeAlias( const std::string type, const std::set<std::string>& types )
-{
-    bool isAlias = false;
-    if( types.count( type ) == 1 )
-        isAlias = true;
-
-    return isAlias;
-}
-
 
 std::map<std::string, std::string> BuildParametersMap( const std::vector<std::string>& parameters,
                                                        const bool debugMode )
diff --git a/src/mpidummy.cpp b/src/mpidummy.cpp
index 3a3de22a2..18970f760 100644
--- a/src/mpidummy.cpp
+++ b/src/mpidummy.cpp
@@ -13,6 +13,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 #include <string.h>
+#include <cstdint>
 //#define _LARGEFILE64_SOURCE
 #include <sys/types.h>
 #include <sys/time.h>
@@ -193,11 +194,11 @@ int MPI_File_get_size(MPI_File fh, MPI_Offset *size) {
 int MPI_File_read(MPI_File fh, void *buf, int count, MPI_Datatype datatype, MPI_Status *status)
 {
     // FIXME: int count can read only 2GB (*datatype size) array at max
-    uint64_t bytes_to_read = count * datatype;  // datatype should hold the size of the type, not an id
-    uint64_t bytes_read;
+    std::uint64_t bytes_to_read = count * datatype;  // datatype should hold the size of the type, not an id
+    std::uint64_t bytes_read;
     bytes_read = read (fh, buf, bytes_to_read);
     if (bytes_read != bytes_to_read) {
-        snprintf(mpierrmsg, MPI_MAX_ERROR_STRING, "could not read %lu bytes. read only: %lu \n", bytes_to_read, bytes_read);
+        snprintf(mpierrmsg, MPI_MAX_ERROR_STRING, "could not read %llu bytes. read only: %llu \n", bytes_to_read, bytes_read);
         return -2;
     }
     *status = bytes_read;
-- 
GitLab