diff --git a/include/aidge/utils/Attributes.hpp b/include/aidge/utils/Attributes.hpp index 641e104151a98772284922e9f05e1670bbbd8eba..efa923ed4dc55995c3da8d5dd687f5b4dfa041bc 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 cb34fc89d3d4bc95844ea2c45a4cf546ac92c3f5..4687ddbb2536be679733282c362cbf9e548a66ce 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: