modifications to typeInfo.hpp and type system
- ClassInfo is added to support for non-polymorphic typename - removal template specialization for realx3 and etc. - addition of new TypeInfo for triple and quadruple - change in Logial TypeInfo to remove recursive include in some files
This commit is contained in:
parent
ff8968e595
commit
97f0ddf82e
|
@ -58,7 +58,8 @@ struct checkStatic
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
inline word basicTypeName()
|
||||
inline
|
||||
word basicTypeName()
|
||||
{
|
||||
int status;
|
||||
auto &ti = typeid(T);
|
||||
|
@ -117,7 +118,8 @@ inline word basicTypeName<real>()
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
word constexpr getTypeName()
|
||||
inline
|
||||
word getTypeName()
|
||||
{
|
||||
if constexpr (checkStatic<T>::hasMember())
|
||||
{
|
||||
|
@ -130,7 +132,8 @@ word constexpr getTypeName()
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
word constexpr getTypeName(const T &)
|
||||
inline
|
||||
word getTypeName(const T &)
|
||||
{
|
||||
if constexpr (checkStatic<T>::hasMember())
|
||||
{
|
||||
|
@ -157,6 +160,32 @@ bool checkType(Type2 &object)
|
|||
}
|
||||
} // namespace pFlow
|
||||
|
||||
#define QuadrupleTypeInfoNV(T) \
|
||||
inline static word TYPENAME() \
|
||||
{ \
|
||||
return getTypeName<T>()+"x4"; \
|
||||
} \
|
||||
word typeName() const \
|
||||
{ \
|
||||
return TYPENAME(); \
|
||||
}
|
||||
|
||||
#define TripleTypeInfoNV(T) \
|
||||
inline static word TYPENAME() \
|
||||
{ \
|
||||
return getTypeName<T>()+"x3"; \
|
||||
} \
|
||||
word typeName() const \
|
||||
{ \
|
||||
return TYPENAME(); \
|
||||
}
|
||||
|
||||
#define ClassInfo(tName) \
|
||||
inline static word TYPENAME() \
|
||||
{ \
|
||||
return tName; \
|
||||
}
|
||||
|
||||
#define TypeInfo(tName) \
|
||||
inline static word TYPENAME() \
|
||||
{ \
|
||||
|
|
|
@ -22,7 +22,7 @@ Licence:
|
|||
|
||||
#include "builtinTypes.hpp"
|
||||
#include "bTypesFunctions.hpp"
|
||||
#include "typeInfo.hpp"
|
||||
|
||||
|
||||
|
||||
namespace pFlow
|
||||
|
@ -62,7 +62,15 @@ private:
|
|||
public:
|
||||
|
||||
/// Type info
|
||||
TypeInfoNV("Logical");
|
||||
inline static word TYPENAME()
|
||||
{
|
||||
return "Logical";
|
||||
}
|
||||
|
||||
inline word typeName()const
|
||||
{
|
||||
return TYPENAME();
|
||||
}
|
||||
|
||||
//// Constructors
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ Licence:
|
|||
#define __quadruple_hpp__
|
||||
|
||||
#include "error.hpp"
|
||||
#include "typeInfo.hpp"
|
||||
#include "iIstream.hpp"
|
||||
#include "iOstream.hpp"
|
||||
#include "token.hpp"
|
||||
|
@ -40,14 +41,13 @@ class iIstream;
|
|||
// you can see it as a sequence of four elements (w,x,y,z) or an (scalar and
|
||||
// vector)
|
||||
template<typename T>
|
||||
class quadruple
|
||||
struct quadruple
|
||||
{
|
||||
public:
|
||||
|
||||
T s_;
|
||||
triple<T> v_;
|
||||
|
||||
public:
|
||||
|
||||
QuadrupleTypeInfoNV(T);
|
||||
|
||||
//// constructors
|
||||
INLINE_FUNCTION_HD
|
||||
|
|
|
@ -22,6 +22,7 @@ Licence:
|
|||
|
||||
#include "pFlowMacros.hpp"
|
||||
#include "numericConstants.hpp"
|
||||
#include "typeInfo.hpp"
|
||||
#include "uniquePtr.hpp"
|
||||
#include "iOstream.hpp"
|
||||
#include "iIstream.hpp"
|
||||
|
@ -49,6 +50,7 @@ struct triple
|
|||
T y_;
|
||||
T z_;
|
||||
|
||||
TripleTypeInfoNV(T);
|
||||
//// Constructors
|
||||
|
||||
/// Initilize to zero
|
||||
|
|
|
@ -50,16 +50,16 @@ using realx4 = quadruple<real>;
|
|||
|
||||
using realx4x3 = quadruple<realx3>;
|
||||
|
||||
template<>
|
||||
/*template<>
|
||||
inline word
|
||||
basicTypeName<int8x3>()
|
||||
triple<int8>::TYPENAME()
|
||||
{
|
||||
return "int8x3";
|
||||
}
|
||||
|
||||
template<>
|
||||
inline word
|
||||
basicTypeName<int32x3>()
|
||||
triple<int32>::TYPENAME()
|
||||
{
|
||||
return "int32x3";
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ inline word
|
|||
basicTypeName<realx4x3>()
|
||||
{
|
||||
return "realx4x3";
|
||||
}
|
||||
}*/
|
||||
|
||||
extern const realx3 zero3;
|
||||
extern const realx3 one3;
|
||||
|
|
Loading…
Reference in New Issue