Main Page   Class Hierarchy   Compound List   File List   Compound Members  

RTTIClassDescriptor Class Reference

#include <class.h>

Inheritance diagram for RTTIClassDescriptor:

RTTIType List of all members.

Public Types

typedef RTTIFieldDescriptor *(* RTTIDescribeFieldsFunc )()
typedef RTTIMethodDescriptor *(* RTTIDescribeMethodsFunc )()
typedef void(* RTTIDefaultConstructor )(void *ptr)
typedef void *(* RTTICreateInstanceFunc )()
enum  TypeTag {
  RTTI_UNKNOWN, RTTI_VOID, RTTI_CHAR, RTTI_UCHAR,
  RTTI_SCHAR, RTTI_SHORT, RTTI_USHORT, RTTI_INT,
  RTTI_UINT, RTTI_LONG, RTTI_ULONG, RTTI_FLOAT,
  RTTI_DOUBLE, RTTI_BOOL, RTTI_ARRAY, RTTI_STRUCT,
  RTTI_PTR, RTTI_DERIVED, RTTI_METHOD
}

Public Methods

void getTypeName (char *buf)
RTTIClassDescriptor * getNext ()
RTTIFieldDescriptor ** getFields ()
int getNumberOfFields ()
char const * getName ()
int getSize ()
int getFlags ()
void * newInstance ()
RTTIClassDescriptor ** getBaseClasses ()
int getNumberOfBaseClasses ()
RTTIMethodDescriptor ** getMethods ()
int getNumberOfMethods ()
RTTIFieldDescriptorfindField (char const *name)
RTTIMethodDescriptorfindMethod (char const *name)
 RTTIClassDescriptor (char const *name, int size, RTTIDescribeFieldsFunc describeFieldsFunc, RTTIDescribeMethodsFunc describeMethodsFunc, RTTICreateInstanceFunc createInstanceFunc, int flags)
 RTTIClassDescriptor (char const *name, int size, int flags)
 ~RTTIClassDescriptor ()
int getTag ()
bool isBuiltin ()
bool isScalar ()
bool isArray ()
bool isPointer ()
bool isClass ()
bool isBaseClass ()

Static Public Attributes

RTTIType voidType
RTTIType charType
RTTIType ucharType
RTTIType scharType
RTTIType shortType
RTTIType ushortType
RTTIType intType
RTTIType uintType
RTTIType longType
RTTIType ulongType
RTTIType floatType
RTTIType doubleType
RTTIType boolType
RTTIType unknownType

Protected Methods

void buildClassDescriptor ()
void destroy ()

Protected Attributes

RTTIClassDescriptor * next
RTTIClassDescriptor * collisionChain
RTTIMethodDescriptormethodList
RTTIMethodDescriptor ** methods
int nMethods
RTTIFieldDescriptorfieldList
RTTIFieldDescriptor ** fields
int nFields
int flags
int size
bool initialized
char const * name
unsigned hashCode
int nBaseClasses
RTTIClassDescriptor ** baseClasses
RTTIDefaultConstructor defaultConstructor
RTTICreateInstanceFunc createInstanceFunc
int tag

Friends

class RTTIRepository
class RTTIBfdRepository
class RTTIClassDescriptor
class RTTIFieldDescriptor
class RTTIMethodDescriptor

Detailed Description

Class descriptor


Constructor & Destructor Documentation

RTTIClassDescriptor::RTTIClassDescriptor char const *    name,
int    size,
RTTIDescribeFieldsFunc    describeFieldsFunc,
RTTIDescribeMethodsFunc    describeMethodsFunc,
RTTICreateInstanceFunc    createInstanceFunc,
int    flags
 

Create and initialize class descriptor from information provided by programmer (typdecl.h) This constructor requires functions returning list of components instead of lists themselve, because these component descriptors should be created in context this DLL.

Parameters:
name  name of the class.
size  size of the class instance.
describeFieldsFunc  function which returns list of fields
describeMethodsFunc  function which returns list of methods
function  which invokes default ontructor to create instance of the class
flags  flags associated with the class

RTTIClassDescriptor::RTTIClassDescriptor char const *    name,
int    size,
int    flags
 

Create class descriptor for class loaded from debug information

Parameters:
name  name of the class.
size  size of the class instance.
flags  flags associated with the class

RTTIClassDescriptor::~RTTIClassDescriptor  
 

Class descriptor desctructor


Member Function Documentation

RTTIFieldDescriptor* RTTIClassDescriptor::findField char const *    name
 

Find field by name

Parameters:
name  of the field
Returns:
field with such name or NULL if not found

RTTIMethodDescriptor* RTTIClassDescriptor::findMethod char const *    name
 

Find method by name

Parameters:
name  of the method
Returns:
method with such name or NULL if not found. In case of polymorphic methods, reference to first once is returned. RTTIMethodDescriptor.getIndex() method can be used to get index of this method in array returned by getMethods. You can then check name, number and type of parameters of method descriptos references by following elements of the array. Code can look something like it:
     RTTIMethodDescriptor* mth = cls->findMethod(name);
     if (mth != NULL) { 
         RTTIMethodDescriptor** allMethods = cls->getMethods();
         for (int i = mth->getIndex(), 
                        n = cls->getNumberOfMethods(); 
              i < n && strcmp(allMethods[i]->getName, name) == 0; 
              i++) 
         { 
              if (allMethods[i]->getNumberOfParamters() == nParams 
                  && ... ) // check if method profile matches profile of searched method
              {
                  return allMethods[i];
              } 
         } 
     }
     return NULL;
 

RTTIClassDescriptor** RTTIClassDescriptor::getBaseClasses   [inline]
 

Get base classes of this class

Returns:
array of pointers to base classes descriptors

RTTIFieldDescriptor** RTTIClassDescriptor::getFields   [inline]
 

Get array of class fields.

Returns:
array of pointers to field descriptors ordered by field name.

int RTTIClassDescriptor::getFlags   [inline]
 

Get class flags

Returns:
combination of RTTIClassFlags flags

RTTIMethodDescriptor** RTTIClassDescriptor::getMethods   [inline]
 

Get array with the clas methods

Returns:
array of pointers to method descriptors ordered by method name

char const* RTTIClassDescriptor::getName   [inline]
 

Get name of the class

Returns:
class name

RTTIClassDescriptor* RTTIClassDescriptor::getNext   [inline]
 

Get next class. All classes in repository are linked in L1 list. Repository getFirstClass method can be used to get reference to first class descriptor in the list. And getNext method can be used to iterate through the * list

Returns:
next class descriptor in the list or NULL if this class descriptor is the last

int RTTIClassDescriptor::getNumberOfBaseClasses   [inline]
 

Get number of base classes

Returns:
number of direct base classes

int RTTIClassDescriptor::getNumberOfFields   [inline]
 

Get number of fields in the class

Returns:
number of fields in the class (size of array returned by getFields method)

int RTTIClassDescriptor::getNumberOfMethods   [inline]
 

Get number of methods in the class

Returns:
number of methods in the class (size of array returned by getMethods method)

int RTTIClassDescriptor::getSize   [inline]
 

Get size f class instance

Returns:
size in bytes f class instance

int RTTIType::getTag   [inline, inherited]
 

Get type tag

Returns:
one of TypeTag enumaration constants

void RTTIClassDescriptor::getTypeName char *    buf [virtual]
 

Get type name

Parameters:
buf  buffer in which type name should be placed.

Reimplemented from RTTIType.

bool RTTIType::isArray   [inline, inherited]
 

Checks whether it is array type

bool RTTIType::isBaseClass   [inline, inherited]
 

Checks whether type represents inhertited base class

bool RTTIType::isBuiltin   [inline, inherited]
 

Checks whether it is built-in type

bool RTTIType::isClass   [inline, inherited]
 

Checks whether it is class or struct type

bool RTTIType::isPointer   [inline, inherited]
 

Checks whether it is pointer type

bool RTTIType::isScalar   [inline, inherited]
 

Checks whether it is integer of floating point type

void* RTTIClassDescriptor::newInstance  
 

Createnew instance of the class

Returns:
newly created instance


The documentation for this class was generated from the following file:
Generated on Fri Apr 26 17:39:24 2002 for CppReflection by doxygen1.2.15