24.02.1
Array.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2016-2021 Arm Limited.
3
*
4
* SPDX-License-Identifier: MIT
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to
8
* deal in the Software without restriction, including without limitation the
9
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
* sell copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in all
14
* copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
* SOFTWARE.
23
*/
24
#ifndef ARM_COMPUTE_ARRAY_H
25
#define ARM_COMPUTE_ARRAY_H
26
27
#include "
arm_compute/core/IArray.h
"
28
#include "
arm_compute/core/Types.h
"
29
30
#include <memory>
31
32
namespace
arm_compute
33
{
34
/** Basic implementation of the IArray interface which allocates a static number of T values */
35
template
<
class
T>
36
class
Array
:
public
IArray
<T>
37
{
38
public
:
39
/** Default constructor: empty array */
40
Array
() :
IArray
<T>(0), _values(nullptr)
41
{
42
}
43
/** Constructor: initializes an array which can contain up to max_num_points values
44
*
45
* @param[in] max_num_values Maximum number of values the array will be able to stored
46
*/
47
Array
(
size_t
max_num_values
) :
IArray
<T>(
max_num_values
), _values(std::make_unique<T[]>(
max_num_values
))
48
{
49
}
50
51
// Inherited methods overridden:
52
T *
buffer
()
const override
53
{
54
return
_values.get();
55
}
56
57
private
:
58
std::unique_ptr<T[]> _values;
59
};
60
61
/** Array of uint8s. */
62
using
UInt8Array
=
Array<uint8_t>
;
63
/** Array of uint16s. */
64
using
UInt16Array
=
Array<uint16_t>
;
65
/** Array of uint32s. */
66
using
UInt32Array
=
Array<uint32_t>
;
67
/** Array of int16s. */
68
using
Int16Array
=
Array<int16_t>
;
69
/** Array of int32s. */
70
using
Int32Array
=
Array<int32_t>
;
71
/** Array of floats. */
72
using
FloatArray
=
Array<float>
;
73
}
// namespace arm_compute
74
#endif
/* ARM_COMPUTE_ARRAY_H */
IArray.h
arm_compute::Array::buffer
T * buffer() const override
Pointer to the first element of the array.
Definition:
Array.h:52
arm_compute::Array
Basic implementation of the IArray interface which allocates a static number of T values
Definition:
Array.h:36
arm_compute::IArray
Array of type T.
Definition:
IArray.h:36
Types.h
arm_compute::IArray::max_num_values
size_t max_num_values() const
Maximum number of values which can be stored in this array.
Definition:
IArray.h:52
arm_compute::Array::Array
Array(size_t max_num_values)
Constructor: initializes an array which can contain up to max_num_points values.
Definition:
Array.h:47
arm_compute
Copyright (c) 2017-2024 Arm Limited.
Definition:
introduction.dox:24
arm_compute::Array::Array
Array()
Default constructor: empty array.
Definition:
Array.h:40
arm_compute
runtime
Array.h
Generated on Mon Mar 18 2024 11:31:55 for Compute Library by
1.8.17