fix serialization for properties unintrusive

This commit is contained in:
AndreaRigoni
2026-04-01 19:59:37 +00:00
parent 8e6e332217
commit 9118afdd13
7 changed files with 312 additions and 182 deletions

View File

@@ -63,6 +63,13 @@ public:
virtual void serialize(Archive::log_archive & ar, const unsigned int version) = 0;
};
/**
* @brief Template class for typed properties.
*/
@@ -226,7 +233,8 @@ typedef Property<long> LongProperty;
typedef Property<unsigned long> ULongProperty;
typedef Property<float> FloatProperty;
typedef Property<double> DoubleProperty;
typedef Property<Bool_t> BoolProperty;
typedef Property<Bool_t> BoolProperty;
/**
* @brief Property specialized for enumerations, providing labels for GUI representations.
@@ -244,6 +252,16 @@ private:
std::vector<std::string> m_Labels;
};
/**
* @brief Macro to simplify property declaration within a class.
* Usage: ULIB_PROPERTY(float, Width, 1.0f)
@@ -386,12 +404,14 @@ private:
std::vector<std::string> m_GroupStack;
};
/**
* @brief Convenience macro to automatically activate and register all HRP members
* as uLib properties. Usage: ULIB_ACTIVATE_PROPERTIES(obj)
*/
#define ULIB_ACTIVATE_PROPERTIES(obj) \
{ uLib::Archive::property_register_archive _ar_tmp(&(obj)); (obj).serialize(_ar_tmp, 0); }
{ uLib::Archive::property_register_archive _ar_tmp(&(obj)); _ar_tmp & (obj); }
} // namespace Archive
} // namespace uLib