commore  1.0.6-SNAPSHOT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
commore::RefObject Class Reference

#include <RefObject.h>

+ Inheritance diagram for commore::RefObject:

Public Member Functions

 RefObject ()
 
virtual ~RefObject ()
 
virtual void attach ()
 
virtual void release ()
 
virtual void nested_attach ()
 
virtual void nested_release ()
 
virtual void interface_release ()
 
virtual void Run ()
 
virtual CriticalSectionget_cs ()
 

Static Public Member Functions

static AutoRefBase auto_create ()
 
static AutoRefBase auto_create (const AChar *s)
 
static AutoRefBase create ()
 
static AutoRefBase create (const AChar *s)
 
static AutoRefBase bind ()
 
static AutoRefBase bind (const AChar *s)
 
static const ACharfactory_name ()
 

Detailed Description

Base classe for classes of objects which are meant to be used with AutoRef smart pointers. The RefObject has the responsability to handle its reference counting, via the methods attach and release (a default implementation is provided). When creating a class which inherits from RefObject, a RefFactory class responsible for instantiating this kind of objects must also be created, and instantiated. See RefFactory for more information about its instanciation. Classes which inherits from RefObject should implement the static factory_name method, which returns a factory identifier (usually, the string representation of the class name : "namespece::class"). It must be the same as the factory name returned by its factory (RefFactory::factory_name).

Todo:
is interface reference counter realy useful

Constructor & Destructor Documentation

RefObject::RefObject ( )

Construtor Reference counter is set to 0

RefObject::~RefObject ( )
virtual

Member Function Documentation

void RefObject::attach ( )
virtual

Manage basic ref counter Attach object to a new reference Inrease reference counter

static AutoRefBase commore::RefObject::auto_create ( )
inlinestatic

Allow automatic creation of object auto_create is overriden by a subclass and call like this : AutoRef pa; should automatically create an A object referenced by pa.

Returns
a not typed autoref
static AutoRefBase commore::RefObject::auto_create ( const AChar s)
inlinestatic

Allow automaic creation of object with a parameter

static AutoRefBase commore::RefObject::bind ( )
inlinestatic
Todo:
not used
static AutoRefBase commore::RefObject::bind ( const AChar s)
inlinestatic
Todo:
not used
static AutoRefBase commore::RefObject::create ( )
inlinestatic

Allow creation of object without calling new operator. If create is overridden in a subclass, it is called like this to work : AutoRef pa; pa.create();

static AutoRefBase commore::RefObject::create ( const AChar s)
inlinestatic

As create() with a parameter

static const AChar* commore::RefObject::factory_name ( )
inlinestatic

Must be define in the subclass, if the RefObject is intended to be instantiated by factories (with the same factory_name).

Returns
the name of factory that must by call to create an objet
CriticalSection * RefObject::get_cs ( )
virtual

Default critical section to protect refenece count Can be overrriden by implementation

The default critical section protect RefObject reference counter

Reimplemented in commore::Processor::HImpl::PImpl, and commore::Action.

void RefObject::interface_release ( )
virtual

Call when nested_release reach count 0 To be implemented by ref object

Todo:
is usefull

Reimplemented in TCPIPListener, TCPIPSender, and SocketClient.

void RefObject::nested_attach ( )
virtual

Manage interface reference counter and basic ref counter. Allow IAutoRef to know when refobjet is not referenced anymore by an other IAutoRef so it can call interface_release()

Todo:
is useful ?
void RefObject::nested_release ( )
virtual
void RefObject::release ( )
virtual

Release object Decrease reference counter If reference counter = 0 the object is deleted

virtual void commore::RefObject::Run ( )
inlinevirtual

Base action usage.

Todo:
understand why run crash

The documentation for this class was generated from the following files: