IlsRefCounted
Category
Reference counter class
Inheritance Path
IlsRefCounted
Related Pattern
Proxy, flyweight
Description
This class is the base class of
IlsObject and
IlsEntity, which in turn are the parent classes of server objects.
IlsRefCounted includes a reference counter as a data member and supports smart pointers. Smart pointers automatically delete objects to which they point when the reference counters of those objects return to zero.
Warning: In case of multiple inheritance, we recommend that you make the derivation virtual in order to avoid the duplication of reference counters to an object. |
Libraries
Synopsis
class IlsRefCounted
{
public:
IlsRefCounted(const IlsRefCounted&);
virtual ~IlsRefCounted();
IlsRefCounted&
operator=(const IlsRefCounted&);
};
Constructors
IlsRefCounted();
This is the default constructor of the class.
IlsRefCounted(const IlsRefCounted&);
This is the copy constructor of IlsRefCounted. It is designed to avoid copying the reference counter. The copied object gets a null reference counter, that is, one whose initial value is 0.
Destructor
virtual ~IlsRefCounted();
This is the virtual destructor for IlsRefCounted.
Member Functions
IlsRefCount getRefCount() const;
This member function returns the reference counter of an object.
IlsRefCount refcountIncr();
This member function increments the reference counter. It is seldom used.
We recommend that you exclusively rely on smart pointers for reference counting.
IlsRefCount refcountDecr();
This member function decrements the reference counter. It is seldom used.
We recommend that you exclusively rely on smart pointers for reference counting.
[static] void SetMT();
This static member function activates the multithread-safe facility. For details, see the static function
IlsMvServer::Initialize.
Operators
IlsRefCounted& operator=(const IlsRefCounted&);
This is the assignment operator of IlsRefcounted.
See Also
Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.