Agora C++ API Reference for All Platforms

Public Member Functions | List of all members
agora::RefCounter Class Reference

## Public Member Functions
| RefCounter (int ref_count)
void | IncRef ()
agora::RefCountReleaseStatus | DecRef ()
bool | HasOneRef () const
| RefCounter (int ref_count)
void | IncRef ()
agora::RefCountReleaseStatus | DecRef ()
bool | HasOneRef () const

## Constructor & Destructor Documentation

## ◆ RefCounter() [1/2]

agora::RefCounter::RefCounter | ( | int | ref_count | ) |
| inline explicit

## ◆ RefCounter() [2/2]

agora::RefCounter::RefCounter | ( | int | ref_count | ) |
| inline explicit

## Member Function Documentation

## ◆ IncRef() [1/2]

void agora::RefCounter::IncRef | ( |  | ) |
| inline

## ◆ DecRef() [1/2]

agora::RefCountReleaseStatus agora::RefCounter::DecRef | ( |  | ) |
| inline

Returns true if this was the last reference, and the resource protected by the reference counter can be deleted.

## ◆ HasOneRef() [1/2]

bool agora::RefCounter::HasOneRef | ( |  | ) | const
| inline

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 resource protected by the reference counter, knowing that it has exclusive access.

## ◆ IncRef() [2/2]

void agora::RefCounter::IncRef | ( |  | ) |
| inline

## ◆ DecRef() [2/2]

agora::RefCountReleaseStatus agora::RefCounter::DecRef | ( |  | ) |
| inline

Returns true if this was the last reference, and the resource protected by the reference counter can be deleted.

## ◆ HasOneRef() [2/2]

bool agora::RefCounter::HasOneRef | ( |  | ) | const
| inline

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 resource protected by the reference counter, knowing that it has exclusive access.