blob: 4241ed4f7e0afc4ea68ac44e5a2e7f04eefd4658 [file] [log] [blame]
Adnan AlSinane4563a02021-09-01 15:32:03 +01001/*
2 * Copyright (c) 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_SIZE3D_H
25#define ARM_COMPUTE_SIZE3D_H
26
27#include <string>
28
29namespace arm_compute
30{
31/** Class for specifying the size of a 3D shape or object */
32class Size3D
33{
34public:
35 /** Default constructor */
36 Size3D() = default;
37 /** Constructor. Initializes "width", "height" and "depth" respectively with "w", "h" and "d"
38 *
39 * @param[in] w Width of the 3D shape or object
40 * @param[in] h Height of the 3D shape or object
41 * @param[in] d Depth of the 3D shape or object
42 */
Freddie Liardetebefe522021-11-25 16:19:28 +000043 Size3D(size_t w, size_t h, size_t d) noexcept
Adnan AlSinane4563a02021-09-01 15:32:03 +010044 : width(w), height(h), depth(d)
45 {
46 }
47
48 /** Convert the values stored to string
49 *
50 * @return string of (width x height x depth).
51 */
52 std::string to_string() const;
53
54 /** Semantic accessor for width as x.
55 *
56 * @return x.
57 */
58 size_t x() const
59 {
60 return width;
61 }
62
63 /** Semantic accessor for height as y.
64 *
65 * @return y.
66 */
67 size_t y() const
68 {
69 return height;
70 }
71
72 /** Semantic accessor for depth as z.
73 *
74 * @return z.
75 */
76 size_t z() const
77 {
78 return depth;
79 }
80
Freddie Liardet69df64f2021-10-26 14:06:47 +010081 bool operator!=(const Size3D &other) const
82 {
83 return !(*this == other);
84 }
85
86 bool operator==(const Size3D &other) const
87 {
88 return (width == other.width) && (height == other.height) && (depth == other.depth);
89 }
90
Adnan AlSinane4563a02021-09-01 15:32:03 +010091public:
92 size_t width = {}; /**< Width of the 3D shape or object */
93 size_t height = {}; /**< Height of the 3D shape or object */
94 size_t depth = {}; /**< Depth of the 3D shape or object */
95};
96
Adnan AlSinane4563a02021-09-01 15:32:03 +010097} // namespace arm_compute
98#endif /* ARM_COMPUTE_SIZE3D_H */