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; }
87template<
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);
108template<
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);
130template<
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);
153template<
class To,
class From>
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);
176template<
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);
196template<
class TargetType,
class Type>
197inline const TargetType*
isA(
const Type& t)
200 return dynamic_cast<const TargetType*
>(
p);
205template<
class TargetType>
211 return isA<TargetType,Type>(t);
217template<
class TargetType,
class Type>
220 return typeid(TargetType) ==
typeid(t);
225template<
class TargetType>
231 return isType<TargetType,Type>(t);
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macro definitions for declaring ClassName(), NamespaceName(), etc.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
To & refCast(From &r)
Reference type cast template function.
const TargetType * isA(const Type &t)
Check if dynamic_cast to TargetType is possible.
bool isType(const Type &t)
Check is typeid is identical to the TargetType.
errorManip< error > abort(error &err)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
To & dynamicCast(From &r)
Check if dynamic_cast to TargetType is possible, as a functor.
bool operator()(const Type &t) const
Check is typeid is identical to the TargetType, as a functor.
bool operator()(const Type &t) const