# asIObjectType Class Reference

The interface for an object type.

List of all members.

## Public Member Functions
Miscellaneous
virtual asIScriptEngine * | GetEngine () const =0
| Returns a pointer to the script engine.
virtual const char * | GetConfigGroup () const =0
| Returns the config group in which the type was registered.
Memory management
virtual int | AddRef ()=0
| Increases the reference counter.
virtual int | Release ()=0
| Decrease reference counter.
Type info
virtual const char * | GetName () const =0
| Returns a temporary pointer to the name of the datatype.
virtual asIObjectType * | GetBaseType () const =0
| Returns the object type that this type derives from.
virtual asDWORD | GetFlags () const =0
| Returns the object type flags.
virtual asUINT | GetSize () const =0
| Returns the size of the object type.
virtual int | GetTypeId () const =0
| Returns the type id for the object type.
virtual int | GetSubTypeId () const =0
| Returns the type id of the template sub type.
Interfaces
virtual int | GetInterfaceCount () const =0
| Returns the number of interfaces implemented.
virtual asIObjectType * | GetInterface (asUINT index) const =0
| Returns a temporary pointer to the specified interface or null if none are found.
Factories
virtual int | GetFactoryCount () const =0
| Returns the number of factory functions for the object type.
virtual int | GetFactoryIdByIndex (int index) const =0
| Returns the factory id by index.
virtual int | GetFactoryIdByDecl (const char *decl) const =0
| Returns the factory id by declaration.
Methods
virtual int | GetMethodCount () const =0
| Returns the number of methods for the object type.
virtual int | GetMethodIdByIndex (int index) const =0
| Returns the method id by index.
virtual int | GetMethodIdByName (const char *name) const =0
| Returns the method id by name.
virtual int | GetMethodIdByDecl (const char *decl) const =0
| Returns the method id by declaration.
virtual asIScriptFunction * | GetMethodDescriptorByIndex (int index) const =0
| Returns the function descriptor for the script method.
Properties
virtual int | GetPropertyCount () const =0
| Returns the number of properties that the object contains.
virtual int | GetPropertyTypeId (asUINT prop) const =0
| Returns the type id of the property referenced by prop.
virtual const char * | GetPropertyName (asUINT prop) const =0
| Returns the name of the property referenced by prop.
virtual int | GetPropertyOffset (asUINT prop) const =0
| Returns the offset of the property in the memory layout.
Behaviours
virtual int | GetBehaviourCount () const =0
| Returns the number of behaviours.
virtual int | GetBehaviourByIndex (asUINT index, asEBehaviours *outBehaviour) const =0
| Returns the function id and type of the behaviour.

## Member Function Documentation

virtual int asIObjectType::AddRef | ( |  | ) | `[pure virtual]`

Returns:
  The number of references to this object.

Call this method when storing an additional reference to the object.

virtual asIObjectType* asIObjectType::GetBaseType | ( |  | ) | const`[pure virtual]`

Returns:
  A pointer to the object type that this type derives from.

This method will only return a pointer in case of script classes that derives from another script class.

virtual int asIObjectType::GetBehaviourByIndex | ( | asUINT | index,
|  | asEBehaviours * | outBehaviour |
| ) |  |  | const`[pure virtual]`

Parameters:

  `[in]` | index | The index of the behaviour.
  `[out]` | outBehaviour | Receives the type of the behaviour.

Returns:
  The function id of the behaviour.

Return values:

  | asINVALID_ARG | The index is too large.

virtual int asIObjectType::GetBehaviourCount | ( |  | ) | const`[pure virtual]`

Returns:
  The number of behaviours for this type.

virtual const char* asIObjectType::GetConfigGroup | ( |  | ) | const`[pure virtual]`

Returns:
  The name of the config group, or null if not set.

virtual asIScriptEngine* asIObjectType::GetEngine | ( |  | ) | const`[pure virtual]`

Returns:
  A pointer to the engine.

virtual int asIObjectType::GetFactoryCount | ( |  | ) | const`[pure virtual]`

Returns:
  A negative value on error, or the number of factory functions for this object.

virtual int asIObjectType::GetFactoryIdByDecl | ( | const char * | decl | ) | const`[pure virtual]`

Parameters:

  `[in]` | decl | The factory signature.

Returns:
  A negative value on error, or the factory id.

Return values:

  | asNO_FUNCTION | Didn't find any matching functions.
  | asINVALID_DECLARATION | decl is not a valid declaration.
  | asERROR | The module for the type was not built successfully.

The factory function is named after the object type and returns a handle to the object. Example:

     id = type->GetFactoryIdByDecl("object@ object(int arg1, int arg2)");

virtual int asIObjectType::GetFactoryIdByIndex | ( | int | index | ) | const`[pure virtual]`

Parameters:

  `[in]` | index | The index of the factory function.

Returns:
  A negative value on error, or the factory id.

Return values:

  | asINVALID_ARG | index is out of bounds.

virtual asDWORD asIObjectType::GetFlags | ( |  | ) | const`[pure virtual]`

Returns:
  A bit mask with the flags from asEObjTypeFlags.

Script classes are identified by having the asOBJ_SCRIPT_OBJECT flag set. Interfaces are identified as a script class with a size of zero.

See also:
  GetSize

virtual asIObjectType* asIObjectType::GetInterface | ( | asUINT | index | ) | const`[pure virtual]`

Parameters:

  `[in]` | index | The interface index.

Returns:
  A pointer to the interface type.

virtual int asIObjectType::GetInterfaceCount | ( |  | ) | const`[pure virtual]`

Returns:
  The number of interfaces implemented by this type.

virtual int asIObjectType::GetMethodCount | ( |  | ) | const`[pure virtual]`

Returns:
  A negative value on error, or the number of methods for this object.

virtual asIScriptFunction* asIObjectType::GetMethodDescriptorByIndex | ( | int | index | ) | const`[pure virtual]`

Parameters:

  `[in]` | index | The index of the method.

Returns:
  A pointer to the method description interface, or null if not found.

virtual int asIObjectType::GetMethodIdByDecl | ( | const char * | decl | ) | const`[pure virtual]`

Parameters:

  `[in]` | decl | The method signature.

Returns:
  A negative value on error, or the method id.

Return values:

  | asMULTIPLE_FUNCTIONS | Found multiple matching methods.
  | asNO_FUNCTION | Didn't find any matching method.
  | asINVALID_DECLARATION | decl is not a valid declaration.
  | asERROR | The module for the type was not built successfully.

This method should be used to retrieve the ID of the script method for the object that you wish to execute. The ID is then sent to the context's Prepare method.

The method will find the script method with the exact same declaration.

virtual int asIObjectType::GetMethodIdByIndex | ( | int | index | ) | const`[pure virtual]`

Parameters:

  `[in]` | index | The index of the method.

Returns:
  A negative value on error, or the method id.

Return values:

  | asINVALID_ARG | index is out of bounds.

This method should be used to retrieve the ID of the script method for the object that you wish to execute. The ID is then sent to the context's Prepare method.

virtual int asIObjectType::GetMethodIdByName | ( | const char * | name | ) | const`[pure virtual]`

Parameters:

  `[in]` | name | The name of the method.

Returns:
  A negative value on error, or the method id.

Return values:

  | asMULTIPLE_FUNCTIONS | Found multiple matching methods.
  | asNO_FUNCTION | Didn't find any matching method.

This method should be used to retrieve the ID of the script method for the object that you wish to execute. The ID is then sent to the context's Prepare method.

virtual const char* asIObjectType::GetName | ( |  | ) | const`[pure virtual]`

Returns:
  A null terminated string with the name of the object type.

virtual int asIObjectType::GetPropertyCount | ( |  | ) | const`[pure virtual]`

Returns:
  The number of member properties of the script object.

virtual const char* asIObjectType::GetPropertyName | ( | asUINT | prop | ) | const`[pure virtual]`

Parameters:

  `[in]` | prop | The property index.

Returns:
  A null terminated string with the property name.

virtual int asIObjectType::GetPropertyOffset | ( | asUINT | prop | ) | const`[pure virtual]`

Parameters:

  `[in]` | prop | The property index.

Returns:
  The offset of the property in the memory layout.

virtual int asIObjectType::GetPropertyTypeId | ( | asUINT | prop | ) | const`[pure virtual]`

Parameters:

  `[in]` | prop | The property index.

Returns:
  The type id of the member property, or a negative value on error.

Return values:

  | asINVALID_ARG | prop is too large

virtual asUINT asIObjectType::GetSize | ( |  | ) | const`[pure virtual]`

Returns:
  The number of bytes necessary to store instances of this type.

Application registered reference types doesn't store this information, as the script engine doesn't allocate memory for these itself.

virtual int asIObjectType::GetSubTypeId | ( |  | ) | const`[pure virtual]`

Returns:
  The type id of the template sub type, or a negative value on error.

Return values:

  | asERROR | The type is not a template type.

virtual int asIObjectType::GetTypeId | ( |  | ) | const`[pure virtual]`

Returns:
  The type id for the object type.

virtual int asIObjectType::Release | ( |  | ) | `[pure virtual]`

Returns:
  The number of references to this object.

Call this method when you will no longer use the references that you own.

The documentation for this class was generated from the following file:

- angelscript.h