VIPER REFERENCE MANUAL


NAME
iflClassList - class inheritance chain

HEADER FILE
#include <ifl/iflClassList.h>

PUBLIC METHOD SUMMARY
iflClassList ( char* ClassName, iflClassId Parent);
char* find ( int parentIdx) const;
int find ( iflClassId classID) const;

CLASS DESCRIPTION
iflClassList is used to statically create a class inheritance chain; it's not setup to deal with multiple inheritance, just the "primary" base class. The implementation if very lightweight with the only significant overhead being checking for derivation from a base class in a deep class hierarchy.

   Usage
Put the iflClassListDeclare macro in the public section of a class declaration derived from a base class and the iflClassListImplementBase or iflClassListImplementDerived macro in the implementation file. These macros will declare and implement the methods described below, thus allowing the class hierarchy to be interrogated. All of these macros should not be terminated with a ';'.

The iflClassListDeclare macro takes no arguements. The iflClassListImplementBase macro takes the class name and a description string as arguments. The invocation for a base class named "Base" would look like:
    iflClassListImplementBase(Base, "A base class for all seasons")
The iflClassListImplementDerived macro takes the class name, the base class name and a description string as arguments. The invocation for a base class named "Jump" derived from a class named "Base" would look like:
    iflClassListImplementDerived(Jump, Base, "Look before you leap")

   Public methods added
The folling public methods are added to the invoking class by the iflClassListImplementBase and iflClassListImplementDerived macros:

getClassName()

virtual char* getClassName(int parentIdx=0);
This method specifies the name of the class for this object instantiantion (or of the nearest ancestor class that registers itself using this macro.) The optional parentIdx argument allows the name of one of the parent classes to be returned, the values specifies how may levels of the class hierarchy to traverse.

getClassId()

virtual iflClassId getClassId();
This method returns the class ID for this object instantiantion.

derivesFrom()

virtual int derivesFrom(iflClassId classID);
This method returns TRUE if this object instantiantion derives from the class indicated by classID. This class ID is formed using the iflClassID macro defined in <ifl/iflTypes.h>; e.g. iflClassID(iflFile).

   Protected methods added
The following protected method is added to the invoking class by the iflClassListImplementBase and iflClassListImplementDerived macros:

getDefaultDescription()

virtual char* getDefaultDescription()
This method returns the default description for this object instantiantion. This is the string supplied in the iflClassListImplementBase and iflClassListImplementDerived macros.

METHOD DESCRIPTIONS

   iflClassList()
iflClassList ( char* ClassName, iflClassId Parent);

Constructs an iflClassList with the givent class name and parent. This is invoked from iflClassListImplementBase and iflClassListImplementDerived macros.

   find()
char* find ( int parentIdx) const;
int find ( iflClassId classID) const;

This first version returns the name of the class, parentIdx levels up in the class list. The second versions returns TRUE if classID is found in the class list.