scim 1.4.18
|
Reference counted base class. More...
#include <scim_object.h>
Public Member Functions | |
bool | is_referenced () const |
void | ref () |
Increase an object's reference count by one. | |
void | unref () |
Protected Member Functions | |
ReferencedObject () | |
Constructor. | |
virtual | ~ReferencedObject ()=0 |
Destructor. | |
void | set_referenced (bool reference) |
Friends | |
template<typename T > | |
class | Pointer |
Reference counted base class.
ReferencedObject is a reference counting base class. it has an integer reference counter so that dynamic objects can have their memory allocation handled by the scim smart pointer: Pointer<>. This keeps the memory management in scim consistent across all classes. If you derive a class from ReferencedObject and allocate it on the heap, you free the memory and destroy the object by calling unref(), not delete.
|
protected |
Constructor.
|
protectedpure virtual |
Destructor.
Set the internal referenced flag.
reference | - true if the initial reference count must be removed by owner. |
Called by derived classes to set the referenced flag. A object sets this flag to true , indicating that it owns the initial reference count and unref() must be called.
bool scim::ReferencedObject::is_referenced | ( | ) | const |
The referenced flag setting.
void scim::ReferencedObject::ref | ( | ) |
Increase an object's reference count by one.
void scim::ReferencedObject::unref | ( | ) |
Decrease an object's reference count by one. When the reference count becomes zero delete is called. Remember, with ReferencedObject you must call unref() on dynmaically allocated objects, not delete.
Referenced by scim::FunctionSlot1< R, P1 >::call(), scim::MethodSlot1< T, R, P1 >::call(), scim::SignalSlot1< T, R, P1 >::call(), scim::FunctionSlot2< R, P1, P2 >::call(), scim::MethodSlot2< T, R, P1, P2 >::call(), scim::SignalSlot2< T, R, P1, P2 >::call(), scim::FunctionSlot3< R, P1, P2, P3 >::call(), scim::MethodSlot3< T, R, P1, P2, P3 >::call(), scim::SignalSlot3< T, R, P1, P2, P3 >::call(), scim::FunctionSlot4< R, P1, P2, P3, P4 >::call(), scim::MethodSlot4< T, R, P1, P2, P3, P4 >::call(), scim::SignalSlot4< T, R, P1, P2, P3, P4 >::call(), scim::FunctionSlot5< R, P1, P2, P3, P4, P5 >::call(), scim::MethodSlot5< T, R, P1, P2, P3, P4, P5 >::call(), scim::SignalSlot5< T, R, P1, P2, P3, P4, P5 >::call(), scim::FunctionSlot6< R, P1, P2, P3, P4, P5, P6 >::call(), scim::MethodSlot6< T, R, P1, P2, P3, P4, P5, P6 >::call(), and scim::SignalSlot6< T, R, P1, P2, P3, P4, P5, P6 >::call().