feat(engine): basic attribute implementation
This commit is contained in:
34
src/Engine/Operator/Attribute.cpp
Normal file
34
src/Engine/Operator/Attribute.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "Engine/Operator/Attribute.h"
|
||||
#include "Engine/Types.h"
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
using namespace enzo;
|
||||
|
||||
|
||||
ga::Attribute::Attribute(std::string name, ga::AttributeType type)
|
||||
: name_{name}, type_{type}
|
||||
{
|
||||
// init store
|
||||
switch(type_)
|
||||
{
|
||||
case(AttrType::intT):
|
||||
intStore_=std::make_shared<std::vector<int>>();
|
||||
break;
|
||||
case(AttrType::floatT):
|
||||
floatStore_=std::make_shared<std::vector<float>>();
|
||||
break;
|
||||
default:
|
||||
throw std::runtime_error("Type " + std::to_string(static_cast<int>(type_)) + " was not accounted for");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ga::AttributeType ga::Attribute::getType()
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user