From 7d094fe719923db5eb6b30edcc4fa01c6ce2cc2e Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Fri, 7 Aug 2026 12:34:22 +0200 Subject: Cleaning up code --- modules/core/c++/abstract/data.hpp | 89 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) (limited to 'modules/core/c++/abstract/data.hpp') diff --git a/modules/core/c++/abstract/data.hpp b/modules/core/c++/abstract/data.hpp index f1ae5a7..327fb63 100644 --- a/modules/core/c++/abstract/data.hpp +++ b/modules/core/c++/abstract/data.hpp @@ -10,8 +10,97 @@ class data final {}; template class data,Encode> final { +public: + using Schema = sch::Primitive; + using Encode = Encode; private: + native_data_type::type value_; public: + data(): + value_{} + {} + + data(native_data_type::type value__): + value_{value__} + {} + + constexpr auto get() const { + return value_; + } + + void set(native_data_type value__){ + value_ = value__; + } + + constexpr bool operator==(const data& rhs) const { + return value_ == rhs.value_; + } + + constexpr bool operator!=(const data& rhs) const { + return value_ != rhs.value_; + } + + constexpr bool operator>(const data& rhs) const { + return value_ > rhs.value_; + } + + constexpr bool operator<(const data& rhs) const { + return value_ < rhs.value_; + } + + constexpr bool operator>=(const data& rhs) const { + return value_ >= rhs.value_; + } + + constexpr bool operator<=(const data& rhs) const { + return value_ >= rhs.value_; + } + + constexpr bool equals(const data& rhs) const { + return (*this) == rhs; + } + + data operator+(const data& rhs) const { + return {value_ + rhs.value_}; + } + + data operator-(const data& rhs) const { + return {value_ - rhs.value_}; + } + + data operator*(const data& rhs) const { + return {value_ * rhs.value_}; + } + + data operator/(const data& rhs) const { + return {value_ / rhs.value_}; + } + + data& operator+=(const data& rhs) { + value_ += rhs.value_; + return *this + } + + data& operator-=(const data& rhs) { + value_ -= rhs.value_; + return *this + } + + data& operator*=(const data& rhs) { + value_ *= rhs.value_; + return *this + } + + data& operator/=(const data& rhs) { + value_ /= rhs.value_; + return *this + } + + template + data cast_to() const { + data val{static_cast::type>(value_)}; + return val; + } }; -- cgit v1.2.3