Skip to content
Snippets Groups Projects
Commit ab7187c2 authored by Olivier BICHLER's avatar Olivier BICHLER
Browse files

Added some doc

parent 3fff049f
No related branches found
No related tags found
1 merge request!16Unified interface for attributes
...@@ -42,8 +42,24 @@ constexpr std::size_t size(T (&)[N]) { return N; } ...@@ -42,8 +42,24 @@ constexpr std::size_t size(T (&)[N]) { return N; }
*/ */
class Attributes { class Attributes {
public: 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; 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; 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; virtual std::vector<std::string> getAttrsName() const = 0;
#ifdef PYBIND #ifdef PYBIND
......
...@@ -19,6 +19,11 @@ ...@@ -19,6 +19,11 @@
#include "aidge/utils/Attributes.hpp" #include "aidge/utils/Attributes.hpp"
namespace Aidge { 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> template <class ATTRS_ENUM, class ...T>
class StaticAttributes : public Attributes { class StaticAttributes : public Attributes {
public: public:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment