Agora Java API Reference for Android

Public Member Functions | Protected Attributes | List of all members
agora::RefCountedObject< T > Class Template Reference

`#include <AgoraRefCountedObject.h>`

Inheritance diagram for agora::RefCountedObject< T >:

## Public Member Functions
template<class P0 >
| RefCountedObject (const P0 &p0)
virtual void | AddRef () const
virtual agora::RefCountReleaseStatus | Release () const
virtual bool | HasOneRef () const

## Protected Attributes
agora::RefCounter | ref_count_

## Detailed Description

### template<class T>
class agora::RefCountedObject< T >

Agora sample code for wrapping a class that needs to inherit from RefCountInterface in order to be held by agora::agora_refptr Usage: agora::agora_refptr<TypeName> ptr = new RefCountedObject<TypeName>(Arg1, Arg2, ...);

## Member Function Documentation

## ◆ HasOneRef()

template<class T >

virtual bool agora::RefCountedObject< T >::HasOneRef | ( |  | ) | const
| virtual

Return whether the reference count is one. If the reference count is used in the conventional way, a reference count of 1 implies that the current thread owns the reference and no other thread shares it. This call performs the test for a reference count of one, and performs the memory barrier needed for the owning thread to act on the object, knowing that it has exclusive access to the object.