#include <cclass.h>
Public Member Functions | |
Item & | constructor () |
const Item & | constructor () const |
CoreClass (const Symbol *sym, LiveModule *lmod, PropertyTable *pt) | |
Creates an item representation of a live class. | |
CoreObject * | createInstance (void *user_data=0, bool bDeserialize=false) const |
Creates an instance of this class. | |
bool | derivedFrom (const String &className) const |
Returns true if the class is derived from a class with the given name. | |
void | factory (ObjectFactory f) |
ObjectFactory | factory () const |
void | gcMark (uint32 mark) |
Marks the class and its inner data. | |
LiveModule * | liveModule () const |
const PropertyTable & | properties () const |
PropertyTable & | properties () |
const Symbol * | symbol () const |
~CoreClass () |
The Virtual Machine has his own image of the classes. Classes items are meant to i.e. access classes wide variables or classes methods.
Class Items are also used to create objects in a faster way. They maintain a copy of an empty object, that is just duplicated as-is via memcopy, making the creation of a new object a quite fast operation.
They also store a list of attributes that must be given at object after their creation. As the classes doesn't really has attributes, they do not participate in attribute loops and list; they just have to remember which attributes must be given to objects being constructed out of them.
Falcon::CoreClass::CoreClass | ( | const Symbol * | sym, | |
LiveModule * | lmod, | |||
PropertyTable * | pt | |||
) |
Creates an item representation of a live class.
The representation of the class nees a bit of extra informations that are provided by the virtual machine, other than the symbol that generated this item. The module id is useful as this object often refers to its module in the VM. Having the ID recorded here prevents the need to search for the live ID in the VM at critical times.
Falcon::CoreClass::~CoreClass | ( | ) |
Item& Falcon::CoreClass::constructor | ( | ) | [inline] |
const Item& Falcon::CoreClass::constructor | ( | ) | const [inline] |
CoreObject* Falcon::CoreClass::createInstance | ( | void * | user_data = 0 , |
|
bool | bDeserialize = false | |||
) | const |
Creates an instance of this class.
The returned object and all its properties are stored in the same memory pool from which this instance is created. On a multithreading application, this method can only be called from inside the thread that is running the VM.
In some cases (e.g. de-serialization) the caller may wish not to have the object initialized and filled with attributes. The optional appedAtribs parameter may be passed false to have the caller to fill the instance with startup data.
user_data | pre-allocated user data. | |
bDeserialize | set to true if you are deserializing an instance (that is, if its constructor should not configure it). |
bool Falcon::CoreClass::derivedFrom | ( | const String & | className | ) | const |
Returns true if the class is derived from a class with the given name.
This function scans the property table of the class (template properties) for an item with the given name, and if that item exists and it's a class item, then this method returns true.
className | the name of a possibly parent class |
void Falcon::CoreClass::factory | ( | ObjectFactory | f | ) | [inline] |
ObjectFactory Falcon::CoreClass::factory | ( | ) | const [inline] |
void Falcon::CoreClass::gcMark | ( | uint32 | mark | ) | [virtual] |
Marks the class and its inner data.
This marks the class, the livemodule it is bound to, the property table data and the ancestors.
Reimplemented from Falcon::Garbageable.
LiveModule* Falcon::CoreClass::liveModule | ( | ) | const [inline] |
const PropertyTable& Falcon::CoreClass::properties | ( | ) | const [inline] |
PropertyTable& Falcon::CoreClass::properties | ( | ) | [inline] |
Referenced by Falcon::CoreCarrier< _T >::hasProperty().
const Symbol* Falcon::CoreClass::symbol | ( | ) | const [inline] |