From ab7187c2fade44310afde098e94ebfcacf51b954 Mon Sep 17 00:00:00 2001 From: Olivier BICHLER <olivier.bichler@cea.fr> Date: Mon, 2 Oct 2023 11:54:20 +0200 Subject: [PATCH] Added some doc --- include/aidge/utils/Attributes.hpp | 16 ++++++++++++++++ include/aidge/utils/StaticAttributes.hpp | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/include/aidge/utils/Attributes.hpp b/include/aidge/utils/Attributes.hpp index 641e10415..efa923ed4 100644 --- a/include/aidge/utils/Attributes.hpp +++ b/include/aidge/utils/Attributes.hpp @@ -42,8 +42,24 @@ constexpr std::size_t size(T (&)[N]) { return N; } */ class Attributes { public: + /** + * @brief Check if the attribute exists. + * @param name Name of the attribute to check. + * @return bool True if the attribute exists, false otherwise. + */ virtual bool hasAttr(const std::string& name) const = 0; + + /** + * @brief Get the (implementation defined) name of the type of an attribute, returned by std::type_info::name. + * @param name Name of the attribute. + * @return std::string Name of the type as returned by std::type_info::name. + */ virtual std::string getAttrType(const std::string& name) const = 0; + + /** + * @brief Get the attribute's name list. + * @return std::vector<std::string> Vector of names of the attributes. + */ virtual std::vector<std::string> getAttrsName() const = 0; #ifdef PYBIND diff --git a/include/aidge/utils/StaticAttributes.hpp b/include/aidge/utils/StaticAttributes.hpp index cb34fc89d..4687ddbb2 100644 --- a/include/aidge/utils/StaticAttributes.hpp +++ b/include/aidge/utils/StaticAttributes.hpp @@ -19,6 +19,11 @@ #include "aidge/utils/Attributes.hpp" namespace Aidge { +/** + * @brief This class is designed to handle static attributes (i.e. known at compile-time) + * with named accessors, with minimal overhead (the name strings are not stored in each object + * instance and it remains possible to access attribute without overhead at compile-time). +*/ template <class ATTRS_ENUM, class ...T> class StaticAttributes : public Attributes { public: -- GitLab