GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

GFC::Object Class Reference

Reference counting base class. More...

#include <gfc/object.hh>

Inheritance diagram for GFC::Object:

GFC::Trackable GFC::G::AsyncQueue GFC::G::Boxed GFC::G::Completion GFC::G::Condition GFC::G::Date GFC::G::MainContext GFC::G::MainLoop GFC::G::MarkupParseContext GFC::G::Module GFC::G::Mutex GFC::G::PatternSpec GFC::G::Rand GFC::G::Scanner GFC::G::ThreadPool GFC::G::Timer List of all members.

Public Member Functions

Protected Member Functions


Detailed Description

Reference counting base class.

Object is a base class that implements reference counting. Derived from Trackable, it adds an integer reference counter so that dynamic objects can have their memory allocation handled by the GFC smart pointer: Pointer<>. This keeps the memory management in GFC consistent across all classes. If you derive a class from GFC::Object and allocate it on the heap, you free the memory and destroy the object by calling unref(), not delete.

Note if you declare a class that derives from GFC::Object on the stack you don't need to call unref(). It's not an error to do so though because nothing will happen.


Member Function Documentation

virtual void GFC::Object::unref  )  [virtual]
 

Decrease an object's reference count by one.

When the reference count becomes zero delete is called. Remember, with Object you must call unref() on dynmaically allocated objects, not delete.

Reimplemented from GFC::Trackable.

Reimplemented in GFC::G::AsyncQueue, GFC::G::MainContext, and GFC::G::MainLoop.


The documentation for this class was generated from the following file:
Generated on Tue Aug 24 00:04:57 2004 for GFC-Core by doxygen 1.3.8