Commit cd9c77b9 authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

[API] move typeToString to own file

parent 230c4877
......@@ -34,6 +34,7 @@
#include "core/debug/CheckFunctions.h"
#include "core/logging/Logging.h"
#include "core/math/Sample.h"
#include "core/typeToString.h"
#include "domain_decomposition/MapPointToPeriodicDomain.h"
......
......@@ -290,35 +290,6 @@ inline bool floatIsEqual( float lhs, float rhs, const float epsilon = real_compa
return std::fabs( lhs - rhs ) < epsilon;
}
// data type to string conversion
template< typename T > inline const char* typeToString();
#define TypeToString(X) template<> inline const char* typeToString< X >() { \
static char string[] = #X; \
return string; \
}
TypeToString(bool)
TypeToString(char)
TypeToString(short)
TypeToString(int)
TypeToString(long)
TypeToString(long long)
TypeToString(unsigned char)
TypeToString(unsigned short)
TypeToString(unsigned int)
TypeToString(unsigned long)
TypeToString(unsigned long long)
TypeToString(float)
TypeToString(double)
#undef TypeToString
template< typename T > inline const char* typeToString( T ) { return typeToString<T>(); }
} // namespace walberla
#define WALBERLA_UNUSED(x) (void)(x)
......
//======================================================================================================================
//
// This file is part of waLBerla. waLBerla is free software: you can
// redistribute it and/or modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
//
// waLBerla is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with waLBerla (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>.
//
//! \file typeToString.h
//! \author Florian Schornbaum <florian.schornbaum@fau.de>
//
//======================================================================================================================
#pragma once
namespace walberla {
// data type to string conversion
template< typename T > inline const char* typeToString();
#define TypeToString(X) template<> inline const char* typeToString< X >() { \
static char string[] = #X; \
return string; \
}
TypeToString(bool)
TypeToString(char)
TypeToString(short)
TypeToString(int)
TypeToString(long)
TypeToString(long long)
TypeToString(unsigned char)
TypeToString(unsigned short)
TypeToString(unsigned int)
TypeToString(unsigned long)
TypeToString(unsigned long long)
TypeToString(float)
TypeToString(double)
#undef TypeToString
template< typename T > inline const char* typeToString( T ) { return typeToString<T>(); }
} // namespace walberla
......@@ -30,6 +30,7 @@
#include "core/DataTypes.h"
#include "core/math/GenericAABB.h"
#include "core/math/KahanSummation.h"
#include "core/typeToString.h"
#include <queue>
#include <vector>
......
......@@ -33,6 +33,8 @@
#include "core/math/GenericAABB.h"
#include "core/math/Vector3.h"
#include "core/typeToString.h"
#include <vector>
#include <queue>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment