From 6068b62e3975fa9e2844b06ede62f04fabf02e1f Mon Sep 17 00:00:00 2001 From: AndreaRigoni Date: Thu, 2 Apr 2026 11:56:25 +0000 Subject: [PATCH] refactor: replace HRP with NVP in Cylinder serialization and add stream operators for TRS --- .gitignore | 1 + src/Math/Cylinder.h | 2 +- src/Math/Transform.h | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 05ed939..6a07fa1 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ src/Python/uLib/__pycache__ src/Python/uLib/.nfs* test_props.xml test_props2.xml +test_boost.cpp diff --git a/src/Math/Cylinder.h b/src/Math/Cylinder.h index 921d52a..b707569 100644 --- a/src/Math/Cylinder.h +++ b/src/Math/Cylinder.h @@ -86,7 +86,7 @@ public: ar & HRP(Radius); ar & HRP(Height); ar & boost::serialization::make_hrp_enum("Axis", Axis, {"X", "Y", "Z"}); - ar & HRP("TRS", boost::serialization::base_object(*this)); + ar & NVP("TRS", boost::serialization::base_object(*this)); } /** Sets the radius of the cylinder */ diff --git a/src/Math/Transform.h b/src/Math/Transform.h index becad34..bf5d4b4 100644 --- a/src/Math/Transform.h +++ b/src/Math/Transform.h @@ -287,6 +287,16 @@ public: +inline std::ostream& operator<<(std::ostream& os, const TRS& trs) { + os << trs.position << " " << trs.rotation << " " << trs.scaling; + return os; +} + +inline std::istream& operator>>(std::istream& is, TRS& trs) { + is >> trs.position >> trs.rotation >> trs.scaling; + return is; +} + } // uLib