mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
className.H - remove old macro versions (were surrounded by #if 0 ... #endif)
This commit is contained in:
@ -52,7 +52,7 @@ Description
|
||||
inline const char* typeName_() { return TypeNameString; } \
|
||||
extern const ::Foam::word typeName;
|
||||
|
||||
//- Add typeName information from argument @a TypeNameString to a template class.
|
||||
//- Add typeName information from argument @a TemplateNameString to a template class.
|
||||
// Without debug information.
|
||||
#define TemplateNameNoDebug(TemplateNameString) \
|
||||
class TemplateNameString##Name \
|
||||
@ -189,68 +189,6 @@ public: \
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
#if 0 // PREVIOUS DEFINITIONS
|
||||
|
||||
//- Adds typeName information from its argument @a TypeNameString to a class
|
||||
#define ClassName(TypeNameString) \
|
||||
static const char* typeName_() { return TypeNameString; } \
|
||||
static const ::Foam::word typeName; \
|
||||
static int debug
|
||||
|
||||
#define NamespaceName(TypeNameString) \
|
||||
inline const char* typeName_() { return TypeNameString; } \
|
||||
extern const ::Foam::word typeName; \
|
||||
extern int debug
|
||||
|
||||
#define TemplateName(template) \
|
||||
class template##Name \
|
||||
{ \
|
||||
public: \
|
||||
\
|
||||
template##Name() \
|
||||
{} \
|
||||
\
|
||||
ClassName(#template); \
|
||||
};
|
||||
|
||||
|
||||
#define defineTypeNameAndDebug(Type, DebugSwitch) \
|
||||
const ::Foam::word Type::typeName(Type::typeName_()); \
|
||||
int Type::debug(::Foam::debug::debugSwitch(Type::typeName_(), DebugSwitch));
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
#define defineTemplateTypeNameAndDebugWithName(Type, Name, DebugSwitch) \
|
||||
const ::Foam::word Type::typeName(Name); \
|
||||
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch));
|
||||
#else
|
||||
#define defineTemplateTypeNameAndDebugWithName(Type, Name, DebugSwitch) \
|
||||
template<> \
|
||||
const ::Foam::word Type::typeName(Name); \
|
||||
template<> \
|
||||
int Type::debug(::Foam::debug::debugSwitch(Name, DebugSwitch));
|
||||
#endif
|
||||
|
||||
#define defineTemplateTypeNameAndDebug(Type, DebugSwitch) \
|
||||
defineTemplateTypeNameAndDebugWithName(Type, #Type, DebugSwitch);
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
#define defineNamedTemplateTypeNameAndDebug(Type, DebugSwitch) \
|
||||
const ::Foam::word Type::typeName(Type::typeName_()); \
|
||||
int Type::debug(::Foam::debug::debugSwitch(Type::typeName_(), DebugSwitch));
|
||||
#else
|
||||
#define defineNamedTemplateTypeNameAndDebug(Type, DebugSwitch) \
|
||||
template<> \
|
||||
const ::Foam::word Type::typeName(Type::typeName_()); \
|
||||
template<> \
|
||||
int Type::debug(::Foam::debug::debugSwitch(Type::typeName_(), DebugSwitch));
|
||||
#endif
|
||||
|
||||
#endif // OLD DEFINITIONS
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -60,12 +60,14 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// declarations for use in header files
|
||||
// declarations (for use in header files)
|
||||
|
||||
//- Declare a ClassNameNoDebug() with extra virtual type info
|
||||
#define TypeNameNoDebug(TypeNameString) \
|
||||
ClassNameNoDebug(TypeNameString); \
|
||||
virtual const word& type() const { return typeName; }
|
||||
|
||||
//- Declare a ClassName() with extra virtual type info
|
||||
#define TypeName(TypeNameString) \
|
||||
ClassName(TypeNameString); \
|
||||
virtual const word& type() const { return typeName; }
|
||||
@ -78,9 +80,8 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||
|
||||
// Reference type cast template function wraps dynamic_cast to handle the
|
||||
// bad_cast exception and generate a FatalError.
|
||||
|
||||
//- Reference type cast template function,
|
||||
// wraps dynamic_cast to handle bad_cast exception and generate a FatalError.
|
||||
template<class To, class From>
|
||||
inline To& dynamicCast(From& r)
|
||||
{
|
||||
@ -100,6 +101,8 @@ inline To& dynamicCast(From& r)
|
||||
}
|
||||
|
||||
|
||||
//- Reference type cast template function.
|
||||
// As per dynamicCast, but handles type names via the virtual type() method.
|
||||
template<class To, class From>
|
||||
inline To& refCast(From& r)
|
||||
{
|
||||
@ -119,6 +122,7 @@ inline To& refCast(From& r)
|
||||
}
|
||||
|
||||
|
||||
//- Check the typeid
|
||||
template<class TestType, class Type>
|
||||
inline bool isType(const Type& t)
|
||||
{
|
||||
@ -126,6 +130,7 @@ inline bool isType(const Type& t)
|
||||
}
|
||||
|
||||
|
||||
//- Check if a dynamic_cast to typeid is possible
|
||||
template<class TestType, class Type>
|
||||
inline bool isA(const Type& t)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user