blob: e2dc6fe012870c8c06b660a46ff87a0d0dc58eb2 [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 */
Felix Thomasmathibalanafd38f02023-09-27 17:46:17 +010043 Size3D(size_t w, size_t h, size_t d) noexcept : width(w), height(h), depth(d)
Adnan AlSinane4563a02021-09-01 15:32:03 +010044 {
45 }
46
47 /** Convert the values stored to string
48 *
49 * @return string of (width x height x depth).
50 */
51 std::string to_string() const;
52
53 /** Semantic accessor for width as x.
54 *
55 * @return x.
56 */
57 size_t x() const
58 {
59 return width;
60 }
61
62 /** Semantic accessor for height as y.
63 *
64 * @return y.
65 */
66 size_t y() const
67 {
68 return height;
69 }
70
71 /** Semantic accessor for depth as z.
72 *
73 * @return z.
74 */
75 size_t z() const
76 {
77 return depth;
78 }
79
Freddie Liardet69df64f2021-10-26 14:06:47 +010080 bool operator!=(const Size3D &other) const
81 {
82 return !(*this == other);
83 }
84
85 bool operator==(const Size3D &other) const
86 {
87 return (width == other.width) && (height == other.height) && (depth == other.depth);
88 }
89
Adnan AlSinane4563a02021-09-01 15:32:03 +010090public:
91 size_t width = {}; /**< Width of the 3D shape or object */
92 size_t height = {}; /**< Height of the 3D shape or object */
93 size_t depth = {}; /**< Depth of the 3D shape or object */
94};
95
Adnan AlSinane4563a02021-09-01 15:32:03 +010096} // namespace arm_compute
97#endif /* ARM_COMPUTE_SIZE3D_H */