#include <FXRefedObject.h>
Inheritance diagram for FX::FXRefingObject< type >:
type | The type of the data to be reference counted. This must inherit FX::FXRefedObject |
In v0.6 of TnFOX the old implementation of this taken from Tornado was replaced with a much superior version based on FX::Generic::ptr. This has enabled a much greater degree of self-determination - now FXRefingObject configures itself automatically according to how you configure its FXRefedObject - you no longer need to reproduce the policies. Also when type inherits a FX::QMutex that mutex is automatically locked around modifications to the referrers list if enabled.
The basic form is as follows:
class Foo : public FXRefedObject<FXAtomicInt>, public QMutex { bool foo(); }; typedef FXRefingObject<Foo> FooHold; ... bool f(Foo *f) { FooHold fh(f); return fh->foo(); }
PtrPtr()
, PtrRef()
, PtrRelease()
and PtrReset()
helper functions there is a PtrDetach()
which returns a handle referring to a new
copy constructed instance of the pointee.FXRefingObject can work with FX::FXLRUCache to implement a LRU caching system of reference counted objects.
Definition at line 413 of file FXRefedObject.h.
Public Member Functions | |
FXRefingObject (type *data=0, const char *file=0, int lineno=0) | |
FXRefingObject (FXAutoPtr< type > &ptr) | |
FXRefingObject (const FXRefingObject &o, const char *file=0, int lineno=0) | |
const char * | int_allocated_file () const throw () |
int | int_allocated_lineno () const throw () |
type & | operator * () |
const type & | operator * () const |
type * | operator-> () |
const type * | operator-> () const |
template<typename T> | |
bool | operator== (const ptr< T > &o) const |
template<typename T> | |
bool | operator== (T *o) const |
operator Tester * () const | |
bool | operator! () const |
template<typename T> | |
bool | operator!= (const ptr< T > &o) const |
template<typename T> | |
bool | operator!= (T *o) const |
Friends | |
FXRefingObject | PtrDetach (FXRefingObject &p) |
type * | PtrRelease (ptr &p) |
void | PtrReset (ptr &p, type *data) |