Enzo
Loading...
Searching...
No Matches
Attribute.h
1#pragma once
2#include <string>
3#include <optional>
4#include <string_view>
5#include <vector>
6#include "Engine/Types.h"
7#include <memory>
8
9
10namespace enzo{
11 namespace ga{
12 template <typename T>
13 using StoreContainer = std::vector<T>;
14
15 template <typename T>
16 class AttributeHandle;
17
37 class Attribute
38 {
39 public:
47 Attribute(std::string name, ga::AttributeType type);
48 Attribute(const Attribute& other);
52 AttributeType getType() const;
56 std::string getName() const;
60 unsigned int getTypeSize() const;
61
65 void resize(size_t size);
66
67
68 template <typename T>
69 friend class AttributeHandle;
70 template <typename T>
71 friend class AttributeHandleRO;
72
73 private:
74 // private attributes are attributes that are hidden from the user
75 // for internal use
76 bool private_=false;
77 // hidden attributes are user accessible attributes that the user may
78 // or may want to use
79 bool hidden_=false;
80 // allows the user to read the attribute but not modify it
81 bool readOnly_=false;
82
84 unsigned int typeSize_=1;
85
86 std::string name_;
87
88 // void* data_;
89
90 // data stores
91 std::shared_ptr<StoreContainer<bt::intT>> intStore_;
92 std::shared_ptr<StoreContainer<bt::floatT>> floatStore_;
93 std::shared_ptr<StoreContainer<enzo::bt::Vector3>> vector3Store_;
94 std::shared_ptr<StoreContainer<enzo::bt::boolT>> boolStore_;
95 };
96
97
98 }
99}
Basic attribute, parameter, and node types for Enzo.
AttributeType
Data types available to store attribute values in.
Definition Types.h:33
Read only accessor for enzo::ga::Attribute.
Definition AttributeHandle.h:195
Read write accessor for enzo::ga::Attribute.
std::string getName() const
Returns the name of this attribute.
Definition Attribute.cpp:105
AttributeType getType() const
Returns the attribute type this attribute stores.
Definition Attribute.cpp:100
Attribute(std::string name, ga::AttributeType type)
Construct a new attribute and initialize its typed storage.
Definition Attribute.cpp:10
unsigned int getTypeSize() const
Returns the number of components in the type (eg. StringT is 1, vectorT is 3).
void resize(size_t size)
Changes the number of elements stored.
Definition Attribute.cpp:45