From 25e05907f0292310eaae27a032db0ee274413874 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Tue, 2 Jul 2024 19:46:02 +0200 Subject: Preparing benchmark work --- modules/codec/c++/data.hpp | 47 ++++++++++++++++++++++++------------------ modules/codec/c++/rpc.hpp | 5 +++-- modules/codec/c++/transfer.hpp | 8 +++---- 3 files changed, 34 insertions(+), 26 deletions(-) (limited to 'modules/codec') diff --git a/modules/codec/c++/data.hpp b/modules/codec/c++/data.hpp index 5ebe579..dd70cd9 100644 --- a/modules/codec/c++/data.hpp +++ b/modules/codec/c++/data.hpp @@ -86,8 +86,8 @@ private: static_assert(always_false, "Type not supported"); }; -template -class data, encode::Native, storage::Default> { +template +class data, encode::Native, Storage> { public: using Schema = schema::Primitive; private: @@ -107,29 +107,29 @@ public: typename native_data_type::type get() const {return value_;} - data operator*(const data& rhs)const{ + data operator*(const data& rhs)const{ return {get() * rhs.get()}; } - data operator/(const data& rhs)const{ + data operator/(const data& rhs)const{ return {get() / rhs.get()}; } - data operator+(const data& rhs)const{ + data operator+(const data& rhs)const{ return {get() + rhs.get()}; } - data& operator+=(const data& rhs)const{ + data& operator+=(const data& rhs)const{ value_ += rhs.get(); return *this; } - data& operator-=(const data& rhs)const{ + data& operator-=(const data& rhs)const{ value_ -= rhs.get(); return *this; } - data operator-(const data& rhs)const{ + data operator-(const data& rhs)const{ return {get() - rhs.get()}; } @@ -147,7 +147,7 @@ public: * Casts */ template - data cast_to(){ + data cast_to(){ auto raw_to = static_cast::type>(value_); return {raw_to}; } @@ -156,12 +156,12 @@ public: /** * Mixed precision class for native formats */ -template -class data, schema::Primitive>, encode::Native, storage::Default>{ +template +class data, schema::Primitive>, encode::Native, Storage>{ public: using Schema = schema::MixedPrecision, schema::Primitive>; private: - data value_; + data value_; public: data():value_{}{} @@ -175,51 +175,58 @@ public: value_.set(val.template cast_to().get()); } - data operator*(const data& rhs) const { + data operator*(const data& rhs) const { using CalcType = typename native_data_type::type; CalcType left = static_cast(value_.get()); CalcType right = static_cast(rhs.get()); return {left * right}; } - data operator/(const data& rhs)const{ + data operator*(const data& rhs) const { + using CalcType = typename native_data_type::type; + CalcType left = static_cast(value_.get()); + CalcType right = rhs.get(); + return {left * right}; + } + + data operator/(const data& rhs)const{ using CalcType = typename native_data_type::type; CalcType left = static_cast(value_.get()); CalcType right = static_cast(rhs.get()); return {left / right}; } - data operator+(const data& rhs)const{ + data operator+(const data& rhs)const{ using CalcType = typename native_data_type::type; CalcType left = static_cast(value_.get()); CalcType right = static_cast(rhs.get()); return {left + right}; } - data& operator+=(const data& rhs)const{ + data& operator+=(const data& rhs)const{ *this = *this + rhs.get(); return *this; } - data operator-(const data& rhs)const{ + data operator-(const data& rhs)const{ using CalcType = typename native_data_type::type; CalcType left = static_cast(value_.get()); CalcType right = static_cast(rhs.get()); return {left - right}; } - data& operator-=(const data& rhs) const { + data& operator-=(const data& rhs) const { *this = *this - rhs.get(); return *this; } template - bool operator==(const data& rhs)const{ + bool operator==(const data& rhs)const{ return get() == rhs.get(); } template - bool operator<(const data& rhs) const { + bool operator<(const data& rhs) const { return get() < rhs.get(); } }; diff --git a/modules/codec/c++/rpc.hpp b/modules/codec/c++/rpc.hpp index 2c97d6b..d172ec4 100644 --- a/modules/codec/c++/rpc.hpp +++ b/modules/codec/c++/rpc.hpp @@ -9,7 +9,6 @@ #include namespace saw { - /** * This class acts as a helper for rpc calls and representing data on the remote. */ @@ -139,7 +138,9 @@ template class remote_address { static_assert(always_false, "Type of remote not supported"); - + /** + * + */ }; /** diff --git a/modules/codec/c++/transfer.hpp b/modules/codec/c++/transfer.hpp index b6aa977..1fb297e 100644 --- a/modules/codec/c++/transfer.hpp +++ b/modules/codec/c++/transfer.hpp @@ -1,9 +1,9 @@ #pragma once namespace saw { -template -class data_client; - -template +template class data_server; + +template +class data_client; } -- cgit v1.2.3