24.02.1
IArrayAccessor.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017-2019 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_TEST_IARRAYACCESSOR_H
25
#define ARM_COMPUTE_TEST_IARRAYACCESSOR_H
26
27
namespace
arm_compute
28
{
29
namespace
test
30
{
31
/** Common interface to provide information and access to array like
32
* structures.
33
*/
34
template
<
typename
T>
35
class
IArrayAccessor
36
{
37
public
:
38
/** Array value type */
39
using
value_type
= T;
40
41
/** Virtual destructor. */
42
virtual
~IArrayAccessor
() =
default
;
43
44
/** Number of elements of the tensor.
45
*
46
* @return the number of elements.
47
*/
48
virtual
size_t
num_values
()
const
= 0;
49
50
/** Access to the buffer.
51
*
52
* @return A pointer to the first element in the buffer.
53
*/
54
virtual
T *
buffer
() = 0;
55
56
/** Resize array.
57
*
58
* @param[in] num The new array size in number of elements
59
*/
60
virtual
void
resize
(
size_t
num) = 0;
61
62
/** Reference to the element of the array located at the given index
63
*
64
* @param[in] index Index of the element
65
*
66
* @return A reference to the element of the array located at the given index.
67
*/
68
virtual
T &
at
(
size_t
index)
const
= 0;
69
};
70
}
// namespace test
71
}
// namespace arm_compute
72
#endif
/* ARM_COMPUTE_TEST_IARRAYACCESSOR_H */
arm_compute::test::IArrayAccessor::resize
virtual void resize(size_t num)=0
Resize array.
arm_compute::test::IArrayAccessor::at
virtual T & at(size_t index) const =0
Reference to the element of the array located at the given index.
arm_compute::test::IArrayAccessor::~IArrayAccessor
virtual ~IArrayAccessor()=default
Virtual destructor.
arm_compute::test::IArrayAccessor::num_values
virtual size_t num_values() const =0
Number of elements of the tensor.
arm_compute::test::IArrayAccessor::buffer
virtual T * buffer()=0
Access to the buffer.
arm_compute
Copyright (c) 2017-2024 Arm Limited.
Definition:
introduction.dox:24
arm_compute::test::IArrayAccessor
Common interface to provide information and access to array like structures.
Definition:
IArrayAccessor.h:35
arm_compute::test::IArrayAccessor::value_type
T value_type
Array value type.
Definition:
IArrayAccessor.h:39
tests
IArrayAccessor.h
Generated on Mon Mar 18 2024 11:32:04 for Compute Library by
1.8.17