FEDEM Model Database  R8.0
Source code of the FEDEM model database
Namespaces | Macros | Functions | Variables
FFaTypeCheck.H File Reference

Type checking control. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 FFaTypeCheck
 Type checking control.
 

Macros

#define Fmd_HEADER_INIT()
 Macro enabling type checking for a class. More...
 
#define Fmd_BASE_HEADER_INIT()
 Macro enabling type checking for a top-level class. More...
 
#define Fmd_CONSTRUCTOR_INIT(clType)
 Macro with type checking initializations. More...
 
#define Fmd_SOURCE_INIT(clName, clType, prClType)
 Macro with type checking implementations. More...
 

Functions

int FFaTypeCheck::getNewTypeID (const char *typeName)
 Returns a unique type ID number for typeName. More...
 
int FFaTypeCheck::getTypeIDFromName (const char *typeName)
 Returns the type ID number for typeName, if it exists. More...
 
const char * FFaTypeCheck::getTypeNameFromID (int typeID)
 Returns the type name associated with the specified typeID. More...
 

Variables

constexpr int FFaTypeCheck::NO_TYPE_ID = -1
 Value for undefined type ID number. More...
 

Detailed Description

Type checking control.

This file contains a set of macros to be used in class definitions, to enable simple type checking in class hierarcies.

Macro Definition Documentation

◆ Fmd_BASE_HEADER_INIT

#define Fmd_BASE_HEADER_INIT ( )
Value:
protected: \
int itsTypeID; \
const char* itsTypeIDName; \
Fmd_HEADER_INIT()

Macro enabling type checking for a top-level class.

Place this in top of the class definition, e.g.:

class myTopClass
{
#define Fmd_BASE_HEADER_INIT()
Macro enabling type checking for a top-level class.
Definition: FFaTypeCheck.H:62

◆ Fmd_CONSTRUCTOR_INIT

#define Fmd_CONSTRUCTOR_INIT (   clType)
Value:
itsTypeID = clType::getClassTypeID(); \
itsTypeIDName = clType::getClassTypeIDName()

Macro with type checking initializations.

Place this in the start of your constructor implementation, e.g.:

someClassName::someClassName()
{
Fmd_CONSTRUCTOR_INIT(someClassName);
#define Fmd_CONSTRUCTOR_INIT(clType)
Macro with type checking initializations.
Definition: FFaTypeCheck.H:75

◆ Fmd_HEADER_INIT

#define Fmd_HEADER_INIT ( )
Value:
public: \
virtual bool isOfType(int tp) const; \
virtual int getTypeID() const; \
virtual const char* getTypeIDName() const; \
\
static const char* getClassTypeIDName(); \
static int getClassTypeID(); \
static int getParentClassTypeID(); \
\
protected: \
static bool staticIsOfType(int tp); \
\
static int typeID; \
static const char* typeIDName
int getTypeID(const std::string &functionType)
Returns the function type ID for a given functionType name.
Definition: FFaFunctionManager.C:194

Macro enabling type checking for a class.

Place this in top of the class definition, e.g.:

class someClass
{
#define Fmd_HEADER_INIT()
Macro enabling type checking for a class.
Definition: FFaTypeCheck.H:39

◆ Fmd_SOURCE_INIT

#define Fmd_SOURCE_INIT (   clName,
  clType,
  prClType 
)

Macro with type checking implementations.

Place this somewhere in global scope, preferably at the top of the implementation file of the class, e.g.:

Fmd_SOURCE_INIT(classTypeIDName, someClassName, parentClassName);
#define Fmd_SOURCE_INIT(clName, clType, prClType)
Macro with type checking implementations.
Definition: FFaTypeCheck.H:85