Go to the documentation of this file.
68 #define TypeNameNoDebug(TypeNameString) \
69 ClassNameNoDebug(TypeNameString); \
70 virtual const word& type() const { return typeName; }
73 #define TypeName(TypeNameString) \
74 ClassName(TypeNameString); \
75 virtual const word& type() const { return typeName; }
87 template<
class To,
class From>
92 return dynamic_cast<To&
>(r);
94 catch (
const std::bad_cast&)
97 <<
"Attempt to cast type " <<
typeid(r).
name()
98 <<
" to type " <<
typeid(To).
name()
101 return dynamic_cast<To&
>(r);
108 template<
class To,
class From>
113 return dynamic_cast<To&
>(r);
115 catch (
const std::bad_cast&)
118 <<
"Attempt to cast type " <<
typeid(r).
name()
119 <<
" to type " <<
typeid(To).
name()
122 return dynamic_cast<To&
>(r);
130 template<
class To,
class From>
135 return dynamic_cast<To&
>(r);
137 catch (
const std::bad_cast&)
140 <<
"Attempt to cast type " << r.type()
141 <<
" to type " << To::typeName
144 return dynamic_cast<To&
>(r);
153 template<
class To,
class From>
154 inline To&
refCast(From& r,
const label index)
158 return dynamic_cast<To&
>(r);
160 catch (
const std::bad_cast&)
163 <<
"Attempt to cast type " << r.type()
164 <<
" to type " << To::typeName
165 <<
" at index " << index
168 return dynamic_cast<To&
>(r);
176 template<
class To,
class From>
181 return dynamic_cast<To&
>(r);
183 catch (
const std::bad_cast&)
186 <<
"Attempt to cast type " << r.type()
187 <<
" to type " << To::typeName
190 return dynamic_cast<To&
>(r);
196 template<
class TargetType,
class Type>
197 inline const TargetType*
isA(
const Type& t)
200 return dynamic_cast<const TargetType*
>(
p);
205 template<
class TargetType>
211 return isA<TargetType,Type>(t);
217 template<
class TargetType,
class Type>
220 return typeid(TargetType) ==
typeid(t);
225 template<
class TargetType>
231 return isType<TargetType,Type>(t);
bool operator()(const Type &t) const
Check is typeid is identical to the TargetType, as a functor.
word name(const complex &c)
Return string representation of complex.
Macro definitions for declaring ClassName(), NamespaceName(), etc.
bool operator()(const Type &t) const
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
errorManip< error > abort(error &err)
To & refCast(From &r)
Reference type cast template function.
bool isType(const Type &t)
Check is typeid is identical to the TargetType.
const TargetType * isA(const Type &t)
Check if dynamic_cast to TargetType is possible.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
To & dynamicCast(From &r)
Check if dynamic_cast to TargetType is possible, as a functor.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.