YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
ref.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4
5namespace yaclib {
6
7/**
8 * Reference counting interface
9 */
10class IRef {
11 public:
12 /**
13 * Increments reference counter
14 */
15 virtual void IncRef() noexcept {
16 }
17
18 /**
19 * Decrements reference counter
20 */
21 virtual void DecRef() noexcept {
22 }
23
24 virtual std::size_t GetRef() noexcept {
25 return 1;
26 }
27
28 virtual ~IRef() noexcept = default;
29};
30
31} // namespace yaclib
Reference counting interface.
Definition ref.hpp:10
virtual ~IRef() noexcept=default
virtual void IncRef() noexcept
Increments reference counter.
Definition ref.hpp:15
virtual void DecRef() noexcept
Decrements reference counter.
Definition ref.hpp:21
virtual std::size_t GetRef() noexcept
Definition ref.hpp:24
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25