BlitzMax Extended  0.8.18
Pushing Blitz to the Max.
Data Structures | Macros | Functions
blitz_class.h File Reference

The class description used by every object. More...

#include "_common.h"
#include "blitz_debug.h"
#include "blitz_gc.h"

Go to the source code of this file.

Data Structures

struct  BBClass
 Contains critical information and functionality for object instances. More...

Macros

#define BBCLASS_MAX_INSTANCESIZE
 The maximum size an instance of a class (object) can take up.
#define BBCLASS_MAX_NUM_REGISTERED
 The maximum number of classes that can be registered with the runtime.
#define BBCLASS_NUM_VFNS
 The number of a class' virtual functions table.
#define BBCLASS_ABSTRACT_METHOD
 Declares a virtual function to be an abstract method.
#define BBCLASS_ABSTRACT_FUNCTION
 Declares a virtual function to be an abstract function.

Functions

void bbClassRegister (const BBClass *clas)
 Registers a class with the runtime.
BBClass ** bbClassAllRegistered (BBInt *count)
 Lists all registered classes.

Detailed Description

The class description used by every object.

Classes contain general information and functionality to work with instances of the respective object. They do not store individual information for every object instance.

Apart from the obvious functionality via virtual functions and information necessary for allocation and such, each BBClass also contains a debug_scope property that holds descriptions used by BlitzMax.

Author:
Mark Sibly
Fabian Niemann

Macro Definition Documentation

#define BBCLASS_ABSTRACT_FUNCTION

Declares a virtual function to be an abstract function.

When assigned to a (named) virtual function, each call to that function will result in a new BBNullFunctionException to be thrown.

See also:
BBNullFunctionException
#define BBCLASS_ABSTRACT_METHOD

Declares a virtual function to be an abstract method.

When assigned to a (named) virtual function, each call to that function will result in a new BBNullMethodException to be thrown.

See also:
BBNullMethodException
#define BBCLASS_MAX_INSTANCESIZE

The maximum size an instance of a class (object) can take up.

Note:
While theoretically this could be SIZE_MAX, it is not since BlitzMax operates on an int basis. This however should not be a problem, as it is very unlikely to ever have objects which are even nearly that large.

Referenced by bbClassRegister().

#define BBCLASS_MAX_NUM_REGISTERED

The maximum number of classes that can be registered with the runtime.

Used internally by bbClassRegister and bb_class_register_multiple to check against overflow.

Todo:
Make depended on BB_CONST_CLASSREGISTER

Referenced by bbClassRegister().

#define BBCLASS_NUM_VFNS

The number of a class' virtual functions table.

See also:
BBClass

Function Documentation

BBClass** bbClassAllRegistered ( BBInt count)

Lists all registered classes.

Parameters:
countAn pointer to an integer in which the number of registered classes is stored.
Returns:
A pointer to the first element in the list of registered classes
void bbClassRegister ( const BBClass clas)

Registers a class with the runtime.

Internally the runtime keeps track of all registered classes to use them when necessary, for example reflection.

Note:
You can use classes implemented in C without calling this, if you include them in the ".i" files of the module. Then, of course, they are not visible when using reflection.
Warning:
This does not check if a class is already included, since this is usually done by the compiler. So be careful not to include something twice.
Parameters:
clasThe class to register