28#include <SimoxUtility/algorithm/string.h>
56 const std::vector<unsigned char>&
data,
64 aron->VERSION = aron::Version();
75 if (
aron->shape != otherAron->shape)
79 if (
aron->type != otherAron->type)
84 if (
aron->data != otherAron->data)
98 return *
this == *other;
117 return std::make_shared<NDArray>(
aron);
120 data::dto::NDArrayPtr
123 return variant ? variant->toNDArrayDTO() :
nullptr;
130 auto dict = std::make_shared<Dict>();
132 dict->addElement(
"data", copy_this);
139 return aron->data.data();
145 aron->data = std::vector<unsigned char>(elements);
146 std::memcpy(
aron->data.data(), src, elements);
149 std::vector<unsigned char>
170 aron->shape.push_back(i);
191 data::dto::NDArrayPtr
207 return "armarx::aron::data::NDArray<" + simox::alg::to_string(
aron->shape,
", ") +
", " +
229 auto casted = type::Matrix::DynamicCastAndCheck(
type);
231 return (
aron->shape.size() == 3 &&
232 (
aron->shape[0] == casted->getRows() || casted->getRows() == -1) &&
233 (
aron->shape[1] == casted->getCols() || casted->getCols() == -1));
239 return (
aron->shape.size() == 3 &&
aron->shape[0] == 1 &&
aron->shape[1] == 4);
245 return (
aron->shape.size() == 3);
251 return (
aron->shape.size() == 3);
257 return (
aron->shape.size() == (
unsigned int)casted->getNumberDimensions());
268 std::stringstream ss;
269 ss <<
"(" << simox::alg::join(simox::alg::multi_to_string(dimensions),
", ") <<
")";
virtual std::string getShortName() const override
get a short str representation of this variant
void setData(unsigned int, const unsigned char *)
static PointerType FromNDArrayDTO(const data::dto::NDArrayPtr &aron)
data::dto::NDArrayPtr toNDArrayDTO() const
virtual type::VariantPtr recalculateType() const override
recalculate the type of a data variant. Please not tha the mapping ist NOT bijective,...
static std::string DimensionsToString(const std::vector< int > &dimensions)
Return dimensions in a readable string such as "(2, 3, 4)".
virtual std::string getFullName() const override
get the full str representation of this variant
std::vector< unsigned char > getDataAsVector() const
std::string getType() const
unsigned char * getData() const
NDArray(const Path &path=Path())
virtual bool operator==(const NDArray &) const override
virtual bool fullfillsType(const type::VariantPtr &) const override
checks, if the current data variant fullfills the given type
std::vector< int > getShape() const
void setShape(const std::vector< int > &)
DictPtr getAsDict() const
static data::dto::NDArrayPtr ToNDArrayDTO(const PointerType &navigator)
void setType(const std::string &)
static VariantPtr FromAronDTO(const data::dto::GenericDataPtr &, const Path &=Path())
create a variant from a dto object
Path getPath() const
get the path
data::dto::GenericDataPtr toAronDTO() const override
std::optional< float > getImportance() const override
AronDataType::PointerType aron
virtual PointerType clone() const
A base class for aron exceptions.
The NotImplementedYetException class.
static std::shared_ptr< Quaternion > DynamicCastAndCheck(const VariantPtr &n)
A convenience header to include all aron files (full include, not forward declared)
std::shared_ptr< Dict > DictPtr
std::shared_ptr< NDArray > NDArrayPtr
A convenience header to include all aron files (full include, not forward declared)
std::shared_ptr< Variant > VariantPtr