39#ifndef PRIMITIVE_TYPE_ARRAY_H
40#define PRIMITIVE_TYPE_ARRAY_H
42#include "data/arrayWrapper.h"
43#include "data/dataHandler.h"
106 void setDataAt(
const std::type_info& type,
const size_t address,
147 for (
size_t i = 0; i < this->
nbElements; i++) {
171 for (T& elt : this->data) {
176 this->invalidCachedHash =
true;
181 const size_t address,
const T& value)
185 this->checkAddressAndType(type, address);
188 this->data.at(address) = value;
191 this->invalidCachedHash =
true;
198 if (
this != &other) {
200 std::stringstream message;
201 message <<
"Assigned PrimitiveTypeArray do not have the same "
203 << this->nbElements <<
" / " << other.
nbElements <<
".";
204 throw std::domain_error(message.str());
208 for (
auto i = 0; i < this->nbElements; i++) {
209 this->data.at(i) = other.
data.at(i);
Definition: arrayWrapper.h:69
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
Definition: primitiveTypeArray.h:54
PrimitiveTypeArray(size_t size=8)
Constructor for the PrimitiveTypeArray class.
Definition: primitiveTypeArray.h:126
virtual ~PrimitiveTypeArray()=default
Default destructor.
std::vector< T > data
Array storing the data of the PrimitiveTypeArray.
Definition: primitiveTypeArray.h:59
virtual DataHandler * clone() const override
Inherited from DataHandler.
Definition: primitiveTypeArray.h:161
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: primitiveTypeArray.h:180
PrimitiveTypeArray(const PrimitiveTypeArray< T > &other)
Copy constructor (deep copy).
Definition: primitiveTypeArray.h:133
PrimitiveTypeArray< T > & operator=(const PrimitiveTypeArray< T > &other)
Assignement Operator for PrimitiveTypeArray<T>
Definition: primitiveTypeArray.h:194
void resetData() override
Sets all elements of the Array to 0 (or its equivalent for the given template param....
Definition: primitiveTypeArray.h:169
PrimitiveTypeArray(const ArrayWrapper< T > &other)
Copy content from an ArrayWrapper.
Definition: primitiveTypeArray.h:142
Definition: array2DWrapper.h:44