38#ifndef PRIMITIVE_TYPE_ARRAY_2D_H
39#define PRIMITIVE_TYPE_ARRAY_2D_H
43#include "data/array2DWrapper.h"
44#include "data/dataHandler.h"
45#include "data/primitiveTypeArray.h"
121 void setDataAt(
const std::type_info& type,
const size_t address,
141 template <
typename T>
150 template <
typename T>
166 for (
size_t i = 0; i < this->
nbElements; i++) {
180 template <
typename T>
191 for (T& elt : this->data) {
196 this->invalidCachedHash =
true;
201 const size_t address,
206 this->checkAddressAndType(type, address);
209 this->data.at(address) = value;
212 this->invalidCachedHash =
true;
220 if (
this != &other) {
222 std::stringstream message;
223 message <<
"Assigned PrimitiveTypeArray2D do not have the same "
225 << this->nbElements <<
" / " << other.
nbElements <<
".";
226 throw std::domain_error(message.str());
230 for (
auto i = 0; i < this->nbElements; i++) {
231 this->data.at(i) = other.
data.at(i);
DataHandler for 2D arrays of primitive types.
Definition: array2DWrapper.h:68
std::vector< T > * containerPtr
Pointer to the array containing the data accessed through the ArrayWrapper.
Definition: arrayWrapper.h:105
const size_t nbElements
Number of elements contained pointer vector.
Definition: arrayWrapper.h:99
void setPointer(std::vector< T > *ptr)
Set the pointer of the ArrayWrapper.
Definition: arrayWrapper.h:365
Base class for all sources of data to be accessed by a TPG Instruction executed within a Program.
Definition: dataHandler.h:54
DataHandler for 2D arrays of primitive types.
Definition: primitiveTypeArray2D.h:69
std::vector< T > data
Array storing the data of the PrimitiveTypeArray2D.
Definition: primitiveTypeArray2D.h:74
PrimitiveTypeArray2D< T > & operator=(const PrimitiveTypeArray2D< T > &other)
Assignement Operator for PrimitiveTypeArray2D<T>
Definition: primitiveTypeArray2D.h:216
PrimitiveTypeArray2D(const size_t w=2, const size_t h=4)
Constructor for the 2D array.
Definition: primitiveTypeArray2D.h:142
void resetData() override
Sets all elements of the Array to 0 (or its equivalent for the given template param....
Definition: primitiveTypeArray2D.h:189
virtual DataHandler * clone() const override
Inherited from DataHandler.
Definition: primitiveTypeArray2D.h:181
void setDataAt(const std::type_info &type, const size_t address, const T &value)
Set the data at the given address to the given value.
Definition: primitiveTypeArray2D.h:200
Definition: array2DWrapper.h:44