Compute Library
 23.08
Size3D.h
Go to the documentation of this file.
1 /*
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 
29 namespace arm_compute
30 {
31 /** Class for specifying the size of a 3D shape or object */
32 class Size3D
33 {
34 public:
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  */
43  Size3D(size_t w, size_t h, size_t d) noexcept
44  : 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 
81  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 
91 public:
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 
97 } // namespace arm_compute
98 #endif /* ARM_COMPUTE_SIZE3D_H */
arm_compute::Size3D::Size3D
Size3D(size_t w, size_t h, size_t d) noexcept
Constructor.
Definition: Size3D.h:43
arm_compute::Size3D::Size3D
Size3D()=default
Default constructor.
arm_compute::Size3D::x
size_t x() const
Semantic accessor for width as x.
Definition: Size3D.h:58
arm_compute::Size3D::width
size_t width
Width of the 3D shape or object.
Definition: Size3D.h:92
arm_compute::Size3D::y
size_t y() const
Semantic accessor for height as y.
Definition: Size3D.h:67
arm_compute::Size3D::height
size_t height
Height of the 3D shape or object.
Definition: Size3D.h:93
arm_compute::Size3D::depth
size_t depth
Depth of the 3D shape or object.
Definition: Size3D.h:94
arm_compute::test::validation::w
SimpleTensor< float > w
Definition: DFT.cpp:156
arm_compute::Size3D::to_string
std::string to_string() const
Convert the values stored to string.
Definition: Size3D.cpp:29
arm_compute::Size3D::z
size_t z() const
Semantic accessor for depth as z.
Definition: Size3D.h:76
arm_compute::Size3D
Class for specifying the size of a 3D shape or object.
Definition: Size3D.h:32
arm_compute
Copyright (c) 2017-2023 Arm Limited.
Definition: introduction.dox:24
arm_compute::Size3D::operator==
bool operator==(const Size3D &other) const
Definition: Size3D.h:86
arm_compute::Size3D::operator!=
bool operator!=(const Size3D &other) const
Definition: Size3D.h:81