MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / AttributeBase

Class AttributeBase

include/geode/basic/attribute.hpp:51–164  ·  view source on GitHub ↗

! * Base class defining the virtual API used by the AttributeManager. */

Source from the content-addressed store, hash-verified

49 * Base class defining the virtual API used by the AttributeManager.
50 */
51 class AttributeBase
52 {
53 OPENGEODE_DISABLE_COPY( AttributeBase );
54 friend class bitsery::Access;
55
56 public:
57 PASSKEY( AttributeManager, AttributeKey /*key*/ );
58
59 virtual ~AttributeBase() = default;
60
61 [[nodiscard]] virtual float generic_value( index_t element ) const = 0;
62
63 [[nodiscard]] virtual float generic_item_value(
64 index_t element, local_index_t item ) const = 0;
65
66 [[nodiscard]] virtual bool is_genericable() const = 0;
67
68 [[nodiscard]] virtual local_index_t nb_items() const = 0;
69
70 [[nodiscard]] virtual std::string_view type() = 0;
71
72 [[nodiscard]] std::string_view name() const
73 {
74 return name_;
75 }
76
77 [[nodiscard]] const AttributeProperties& properties() const
78 {
79 return properties_;
80 }
81
82 void set_properties( AttributeProperties new_properties )
83 {
84 properties_ = std::move( new_properties );
85 }
86
87 public:
88 void set_name( std::string_view name, AttributeKey /*key*/ )
89 {
90 name_ = to_string( name );
91 }
92
93 [[nodiscard]] virtual std::shared_ptr< AttributeBase > clone(
94 AttributeKey /*key*/ ) const = 0;
95
96 virtual void copy( const AttributeBase& attribute,
97 index_t nb_elements,
98 AttributeKey /*key*/ ) = 0;
99
100 [[nodiscard]] virtual std::shared_ptr< AttributeBase > extract(
101 absl::Span< const index_t > old2new,
102 index_t nb_elements,
103 AttributeKey /*key*/ ) const = 0;
104
105 [[nodiscard]] virtual std::shared_ptr< AttributeBase > extract(
106 const GenericMapping< index_t >& old2new_mapping,
107 index_t nb_elements,
108 AttributeKey /*key*/ ) const = 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected