class asIScriptAny { public: // Memory management int AddRef(); int Release(); // Contained value void Store(void *ref, int typeId); int Retrieve(void *ref, int typeId); int GetTypeId(); int CopyFrom(asIScriptAny *other); };
int AddRef();
This method increases the internal reference counter of the object and returns the count. The returned value shouldn't be used for anything else but debugging.
Call AddRef() each time you assign a reference to a new variable.
The internal reference counter.
int Release();
Decreases the internal reference counter and returns the count. If the counter reaches 0 the object is deleted and the memory is freed.
After calling Release() don't forget to set your reference to 0 so that you don't mistakenly try to use the reference again.
The internal reference counter.
void Store(void *ref, int typeId);
This method is used to store a value in the container object. The application should pass a pointer to the variable with the value, and the typeId that represents the type of the variable. The method will make a copy of the value held by the variable.
Currently only object handles are supported, but later on all types will be supported.
ref |
A pointer to the variable that hold the value that should be stored. |
typeId |
The typeId representing the type of the variable. |
int Retrieve(void *ref, int typeId);
Call this method to retrieve a copy of the contained value. The application should pass a pointer to the variable that will receive the copy. The typeId represents the type of the value that you want to retrieve, if the contained value is incompatible with this type, then the method will not retrieve anything and will return a negative value.
ref |
A pointer to the variable that should receive the copy of the contained value. |
typeId |
The typeId representing the type of the variable. |
A negative value on error.
int GetTypeId();
Returns the type id of the contained value. If no value has been set yet
the return value is 0, which represents the type id of void
.
The type id of the contained value.
int CopyFrom(asIScriptAny *other);
This method copies the contents of the other object to this one.
other |
A pointer to the other any object. |
A negative value on error.