|
Classes |
class | Callback |
| Base class for callback with no arguments and no return value. More...
|
class | CallbackR |
class | Callback1 |
class | CallbackR1 |
class | Callback2 |
class | CallbackR2 |
class | Callback3 |
class | CallbackR3 |
class | FunctionCallback |
class | FunctionCallbackR |
class | FunctionCallback1 |
class | FunctionCallbackR1 |
class | FunctionCallback2 |
class | FunctionCallbackR2 |
class | FunctionCallback3 |
class | FunctionCallbackR3 |
class | MethodCallback |
class | MethodCallbackR |
class | MethodCallback1 |
class | MethodCallbackR1 |
class | MethodCallback2 |
class | MethodCallbackR2 |
class | MethodCallback3 |
class | MethodCallbackR3 |
class | Ref |
| Smart pointer class Smart pointers provide automatic memory management, so that programmer never cares on freeing memory. Smart pointers mechanism frees an object when there are no any references to it. Smart pointers should be used instead of standard C pointers: - Attention:
- Smart pointers works only with objects that support AddRef() and Release() operations. It is assumed that object keeps a reference count (a number of smapt pointers pointing to it). This reference count is incremented in AddRef() command and decremented in Release(). Also Release() performs check whether reference count is 0 and calls 'delete this'. GML provides special base class for this: gml::SmartObject. If you want to use smart pointers either derive your object from this class or provide own implementation of AddRef() and Release() methods. 1) initialization Smart pointers are initiliazed just like the standard pointers:
Smart pointers must never be defined like this: gml::Rev<Object>* obj; !!! 2) use of smart pointers Smart pointers are dereferenced like normal pointers: gml::Ref<Object> obj = new Object(1,2,3);
obj->SomeMethod();
(*obj).SomeMethod();
3) smart pointers as parameters Smart pointers are implicitly casted to normal pointers: This operation is dangerous unless used properly. You should use it like follows. Smart pointers may be passed to functions and returned from functions like normal pointers. The general rule is this: Use ONLY smart pointers when storing objects. Use normals pointers when passing smart pointers as parameters or return values So the following is forbidden: class SomeClass
{
private:
Object* obj;
public:
void CreateObject()
{
gml::Ref<Object> obj = new Object(1,2,3);
m_obj = obj;
}
};
Correct use: .
More...
|
class | SmartObject |
| Base class for objects with support for reference counting. More...
|
class | String |
| Standard string with some extensions. More...
|
class | Ref |
| Smart pointer class Smart pointers provide automatic memory management, so that programmer never cares on freeing memory. Smart pointers mechanism frees an object when there are no any references to it. Smart pointers should be used instead of standard C pointers: - Attention:
- Smart pointers works only with objects that support AddRef() and Release() operations. It is assumed that object keeps a reference count (a number of smapt pointers pointing to it). This reference count is incremented in AddRef() command and decremented in Release(). Also Release() performs check whether reference count is 0 and calls 'delete this'. GML provides special base class for this: gml::SmartObject. If you want to use smart pointers either derive your object from this class or provide own implementation of AddRef() and Release() methods. 1) initialization Smart pointers are initiliazed just like the standard pointers:
Smart pointers must never be defined like this: gml::Rev<Object>* obj; !!! 2) use of smart pointers Smart pointers are dereferenced like normal pointers: gml::Ref<Object> obj = new Object(1,2,3);
obj->SomeMethod();
(*obj).SomeMethod();
3) smart pointers as parameters Smart pointers are implicitly casted to normal pointers: This operation is dangerous unless used properly. You should use it like follows. Smart pointers may be passed to functions and returned from functions like normal pointers. The general rule is this: Use ONLY smart pointers when storing objects. Use normals pointers when passing smart pointers as parameters or return values So the following is forbidden: class SomeClass
{
private:
Object* obj;
public:
void CreateObject()
{
gml::Ref<Object> obj = new Object(1,2,3);
m_obj = obj;
}
};
Correct use: .
More...
|
Functions |
Ref< newT > & | gml::Ref::ConvRef (const Ref< oldT > &old_ref) |
| Casting & convertion of smart references.
|