Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
ownership_policy.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 Roc Streaming authors
3
*
4
* This Source Code Form is subject to the terms of the Mozilla Public
5
* License, v. 2.0. If a copy of the MPL was not distributed with this
6
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
*/
8
9
//! @file roc_core/ownership_policy.h
10
//! @brief Ownership policies.
11
12
#ifndef ROC_CORE_OWNERSHIP_POLICY_H_
13
#define ROC_CORE_OWNERSHIP_POLICY_H_
14
15
namespace
roc
{
16
namespace
core
{
17
18
template
<
class
T,
template
<
class
TT>
class
Ownership>
class
SharedPtr
;
19
20
//! Reference counted object ownership.
21
template
<
class
T>
struct
RefCountedOwnership
{
22
//! Pointer type returned from containers.
23
typedef
SharedPtr<T, core::RefCountedOwnership>
Pointer
;
24
25
//! Acquire ownership.
26
static
void
acquire
(T&
object
) {
27
object
.incref();
28
}
29
30
//! Release ownership.
31
static
void
release
(T&
object
) {
32
object
.decref();
33
}
34
};
35
36
//! No ownership.
37
template
<
class
T>
struct
NoOwnership
{
38
//! Pointer type returned from containers.
39
typedef
T*
Pointer
;
40
41
//! Acquire ownership.
42
static
void
acquire
(T&) {
43
}
44
45
//! Release ownership.
46
static
void
release
(T&) {
47
}
48
};
49
50
}
// namespace core
51
}
// namespace roc
52
53
#endif
// ROC_CORE_OWNERSHIP_POLICY_H_
roc::core::SharedPtr
Shared ownership intrusive pointer.
Definition
shared_ptr.h:32
roc::core
General-purpose building blocks and platform abstraction layer.
roc
Root namespace.
roc::core::NoOwnership
No ownership.
Definition
ownership_policy.h:37
roc::core::NoOwnership::acquire
static void acquire(T &)
Acquire ownership.
Definition
ownership_policy.h:42
roc::core::NoOwnership::release
static void release(T &)
Release ownership.
Definition
ownership_policy.h:46
roc::core::NoOwnership::Pointer
T * Pointer
Pointer type returned from containers.
Definition
ownership_policy.h:39
roc::core::RefCountedOwnership
Reference counted object ownership.
Definition
ownership_policy.h:21
roc::core::RefCountedOwnership::Pointer
SharedPtr< T, core::RefCountedOwnership > Pointer
Pointer type returned from containers.
Definition
ownership_policy.h:23
roc::core::RefCountedOwnership::acquire
static void acquire(T &object)
Acquire ownership.
Definition
ownership_policy.h:26
roc::core::RefCountedOwnership::release
static void release(T &object)
Release ownership.
Definition
ownership_policy.h:31
roc_core
ownership_policy.h
Generated by
1.17.0