diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2012-03-22 16:36:07 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2013-01-05 17:17:51 +0100 |
commit | f565f417f386c5d13f73da8b3eca19847dc4367c (patch) | |
tree | b97a90936792fdfe382a0f703d643ca623468f6d /src/utils/dimension.hpp | |
parent | 4f31d71c8164a84a45aa1e2408e0e2cb54ff30bb (diff) | |
download | usdx-f565f417f386c5d13f73da8b3eca19847dc4367c.tar.gz usdx-f565f417f386c5d13f73da8b3eca19847dc4367c.tar.xz usdx-f565f417f386c5d13f73da8b3eca19847dc4367c.zip |
utils/dimension: added template for types of the metrics
Diffstat (limited to 'src/utils/dimension.hpp')
-rw-r--r-- | src/utils/dimension.hpp | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/src/utils/dimension.hpp b/src/utils/dimension.hpp index 4518fbb8..788adbf9 100644 --- a/src/utils/dimension.hpp +++ b/src/utils/dimension.hpp @@ -29,20 +29,52 @@ namespace usdx { + template <class T> class Dimension { private: - unsigned int width; - unsigned int height; + T width; + T height; + public: - Dimension(unsigned int width, unsigned int height); - Dimension(const Dimension& dimension); + Dimension(T width, T height) : + width(width), height(height) + { + } + + Dimension(const Dimension& dimension) : + width(dimension.width), height(dimension.height) + { + } + + Dimension<T>& operator=(const Dimension<T>& dimension) + { + width = dimension.width; + height = dimension.height; + return *this; + } + + + + T get_width(void) const + { + return width; + } + + void set_width(const T& value) + { + width = value; + } - unsigned int get_width(void) const; - void set_width(unsigned int width); + T get_height(void) const + { + return height; + } - unsigned int get_height(void) const; - void set_height(unsigned int height); + void set_height(const T& value) + { + height = value; + } }; }; |