Class Hierarchy   Compound List   File List   Header Files   Compound Members   File Members  

cast.h File Reference

This file contains functions to do casting and type checking for Object. More...

Compounds

Defines

Functions


Detailed Description

This file contains functions to do casting and type checking for Object.


Define Documentation

#define IOKERNEL__CAST_H


Function Documentation

template<class T>
bool is_a (const Object * o)

template<class T>
bool is_kind_of (const Object * o)

Test if an object is a_kind_of instance of a class.

object o is_kind_of class T if o is an instance of T or a subclass of T.

E.g. if (is_kind_of<IfStatement>(object)) ...

Parameters:
T - a subclass of Object.
o - an instance.
Returns:
true iff o is a_kind_of class T.

template<class T>
T * to (const Object * o)

Cast an object to a class.

If the cast is illegal, this function will bomb.

E.g. IfStatement *ifstmt = to<IfStatement>(stmt);

Parameters:
T - a subclass of Object.
o - an instance.
Returns:
the same object o but as class T.

template<class T>
const T * to_const (const Object * o)

Cast an object to a const class.

If the cast is illegal, this function will bomb.

Parameters:
T - a subclass of Object.
o - an instance.
Returns:
the same object o but as const class T.

Generated at Mon Nov 22 19:43:05 1999 for NCI SUIF by doxygen  written by Dimitri van Heesch, © 1997-1999