# agora::RefCounter类 参考 (/zh-CN/api-reference/rtc-server-sdk/cpp/classagora-1-1-ref-counter)
> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).
## 构造及析构函数说明 [#构造及析构函数说明]
### RefCounter() [1/2] [#refcounter-12]
agora::RefCounter::RefCounter(int *ref_count*)
### RefCounter() [2/2] [#refcounter-22]
agora::RefCounter::RefCounter()
## 成员函数说明 [#成员函数说明]
### IncRef() [#incref]
void agora::RefCounter::IncRef()
### DecRef() [#decref]
[agora::RefCountReleaseStatus](/zh-CN/api-reference/rtc-server-sdk/cpp/namespaceagora#ad7412d9f3ea9df5f452273bf6e9226ef) agora::RefCounter::DecRef()
Returns true if this was the last reference, and the resource protected by the reference counter can be deleted.
### HasOneRef() [#hasoneref]
bool agora::RefCounter::HasOneRef() const
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.
## 类成员变量说明 [#类成员变量说明]
### ref_count_ [#ref_count_]
volatile int agora::RefCounter::ref_count_