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 */ Size3D(size_t w,size_t h,size_t d)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 */ x()58 size_t x() const 59 { 60 return width; 61 } 62 63 /** Semantic accessor for height as y. 64 * 65 * @return y. 66 */ y()67 size_t y() const 68 { 69 return height; 70 } 71 72 /** Semantic accessor for depth as z. 73 * 74 * @return z. 75 */ z()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 */ 99