Please state the source:
The class for the reference count of the object, and the basic majority of the classes inherit it:
/** * A reference counted object. * Reference counted Object * Whenever using multiple inheritance you should inherit this class virtually. * Use multiple inheritance, generally inherit this class */class Yate_api refobject:public genobject{ynocopy (refobject);//No automatic copies Pleasepubl IC:/** * The constructor initializes the reference counter to 1! * constructor, initialize the reference counter to 1. * Use Deref () to destruct the objects when safe * uses Deref () to destroy this object in a safe time */Refobject (); /** * destructor. */virtual ~refobject (); /** * Get a pointer to a derived class given this class name * Gets a pointer to a derived class because the class name * @param name name of the CLA SS we is asking for * @ parameter name, requested class name * @return Pointer to the requested class or NULL if this object doesn ' t impl Ement It * @ Returns the address of the requested class, NULL if this object is not instantiated */virtual void* getObject (const string& name) const; /** * Check If the object is still referenced and safe to access. * Check to see if the object is still referenced and secure access * Note that you should is not the trust this resUlt unless the object is locked * Note that this result cannot be fully trusted unless the object is locked by another method * by other means. * @return True if the object is referenced and safe to access * @ returns TRUE if the objects are referenced and secured access */virtual bool Alive () Const /** * Increments the reference counter if not already zero * increase the reference counter if not 0 * @return True If the object is Su Ccessfully referenced and is safe to access * @ Returns TRUE if the object is referenced and secured access */bool ref (); /** * decrements the reference counter, destroys the object if it reaches zero * reduces the reference counter, if 0 destroys objects * <PRE&G T *//Deref This object, return quickly if the object is deleted * if (Deref ()) return; * </pre> * @return True If the object may have been deleted, false if it still exists and are safe to access * @ Returns True if the object has been deleted, false, still exists and secure access to */bool Deref (); /** * Get the current value of the the reference counter * Gets the reference counter present values * @return The value of the reference Counte R */Inline intRefCount () const{return m_refcount;} /** * refcounted objects should just has the counter decremented. * Reference count Object reduction counter * that would destroy them only when the refcount reaches zero. * Destroyed when the reference counter is 0 */virtual void destruct (); /** * Check If reference counter manipulations is efficient on this platform. * Check if the reference counter object on this platform is valid * If platform does not the support atomic operations a mutexes pool is used. * If the platform does not support atomic operations using a mutex pool * @return True if RefCount uses atomic integer operations * @ returns True if object count is using atomic integer action */ static bool Efficientincdec ();p rotected:/** * This method was called when the reference count reaches zero after * This method is called after the app count is 0 * Unlocking the mutex if the call to Zerorefstest () returned true. * If call Zerorefstest () returns True, dismiss this mutex * The default behaviour is to delete the object. * This object is deleted by default */virtual void zerorefs (); /** * Bring the object back alive by setting the reference counter to One. * Note that it works only if the counter is zero previously * @return True if the object was resurrected-its name M Ay be Lazarus;-) */bool Resurrect (); /** * pre-destruction notification, called just before the object is deleted. * Unlike in the destructor it's safe to call virtual methods here. * Reimplementing This method allows to perform any object cleanups. */virtual void destroyed ();p rivate:int m_refcount; Mutex* M_mutex;};
Yate Learning--yateclass.h--class Yate_api refobject:public Genobject