Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Toggle main menu visibility
Loading...
Searching...
No Matches
noop_arena.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2024 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/noop_arena.h
10
//! @brief No-op arena implementation.
11
12
#ifndef ROC_CORE_NOOP_ARENA_H_
13
#define ROC_CORE_NOOP_ARENA_H_
14
15
#include "
roc_core/iarena.h
"
16
#include "
roc_core/noncopyable.h
"
17
18
namespace
roc
{
19
namespace
core
{
20
21
//! Arena implementation that just fails all allocations.
22
//! Can be used with containers that have embedded capacity and arena,
23
//! but we want them to use only embedded capacity.
24
class
NoopArenaImpl
:
public
IArena
,
public
NonCopyable<> {
25
public
:
26
//! Allocate memory no-op.
27
//! @returns
28
//! Always returns null.
29
virtual
void
*
allocate
(
size_t
size);
30
31
//! Deallocate memory no-op.
32
virtual
void
deallocate
(
void
* ptr);
33
34
//! Compute allocated size no-op.
35
//! @returns
36
//! Always 0.
37
virtual
size_t
compute_allocated_size
(
size_t
size)
const
;
38
39
//! Allocated size given pointer no-op.
40
//! @returns
41
//! Always 0.
42
virtual
size_t
allocated_size
(
void
* ptr)
const
;
43
};
44
45
//! Arena implementation that just fails all allocations.
46
//! @see NoopArenaImpl.
47
static
NoopArenaImpl
NoopArena;
48
49
}
// namespace core
50
}
// namespace roc
51
52
#endif
// ROC_CORE_NOOP_ARENA_H_
roc::core::IArena
Memory arena interface.
Definition
iarena.h:23
roc::core::NoopArenaImpl
Arena implementation that just fails all allocations. Can be used with containers that have embedded ...
Definition
noop_arena.h:24
roc::core::NoopArenaImpl::allocate
virtual void * allocate(size_t size)
Allocate memory no-op.
roc::core::NoopArenaImpl::allocated_size
virtual size_t allocated_size(void *ptr) const
Allocated size given pointer no-op.
roc::core::NoopArenaImpl::deallocate
virtual void deallocate(void *ptr)
Deallocate memory no-op.
roc::core::NoopArenaImpl::compute_allocated_size
virtual size_t compute_allocated_size(size_t size) const
Compute allocated size no-op.
iarena.h
Memory arena interface.
roc::core
General-purpose building blocks and platform abstraction layer.
roc
Root namespace.
noncopyable.h
Non-copyable object.
roc_core
noop_arena.h
Generated by
1.17.0