65 #define TypeNameNoDebug(TypeNameString) \ 66 ClassNameNoDebug(TypeNameString); \ 67 virtual const word& type() const { return typeName; } 70 #define TypeName(TypeNameString) \ 71 ClassName(TypeNameString); \ 72 virtual const word& type() const { return typeName; } 84 template<
class To,
class From>
89 return dynamic_cast<To&
>(r);
91 catch (
const std::bad_cast&)
94 <<
"Attempt to cast type " <<
typeid(r).
name()
95 <<
" to type " <<
typeid(To).
name()
98 return dynamic_cast<To&
>(r);
105 template<
class To,
class From>
110 return dynamic_cast<To&
>(r);
112 catch (
const std::bad_cast&)
115 <<
"Attempt to cast type " << r.type()
116 <<
" to type " << To::typeName
119 return dynamic_cast<To&
>(r);
125 template<
class TestType,
class Type>
128 return typeid(t) ==
typeid(TestType);
133 template<
class TestType,
class Type>
134 inline bool isA(
const Type& t)
136 const Type* tPtr = &t;
137 return dynamic_cast<const TestType*
>(tPtr);
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
To & dynamicCast(From &r)
Reference type cast template function,.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
To & refCast(From &r)
Reference type cast template function.
bool isType(const Type &t)
Check the typeid.
errorManip< error > abort(error &err)
word name(const complex &)
Return a string representation of a complex.
Macro definitions for declaring ClassName(), NamespaceName(), etc.