| IOLink 1.11.0

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
iolink::ArrayX< T > Class Template Reference

A multi dimensionnal array. More...

`#include <iolink/ArrayX.h>`

## Public Types
using | ValueType = T
| The data type of array's elements.

## Public Member Functions
| ArrayX (const VectorXu64 &shape)
| Create an array with the given shape.
| ArrayX (const Indexer &indexer)
| Create an array with a memory layout fitting the given indexer.
| ArrayX (const ArrayX &other)
ArrayX & | operator= (const ArrayX &other)
| ArrayX (ArrayX &&other) noexcept
ArrayX & | operator= (ArrayX &&other) noexcept
size_t | dimensionCount () const
| The number of dimensions of the array.
const VectorXu64 & | shape () const
| Return the shape of the array.
const Indexer & | indexer () const
| Return the indexer instance used by the array.
T | at (const VectorXu64 &index) const
| Get an element of the array.
void | setAt (const VectorXu64 &index, T value)
| Set a value to an element of the array.
void | reshape (const VectorXu64 &shape)
| Change the shape of the array.
const T * | buffer () const
| Return a pointer to the internal buffer.
T * | buffer ()
| Return a non-const pointer to the internal buffer.
std::string | toString () const
| Return a string representation.
bool | operator== (const ArrayX &other) const
bool | operator!= (const ArrayX &other) const

## Detailed Description

template<typename T>
class iolink::ArrayX< T >

A multi dimensionnal array.

This class should not be used as is, you must use its aliases or it will not work. The current aliases are:

- Arrayi8
- Arrayi16
- Arrayi32
- Arrayi64
- Arrayu8
- Arrayu16
- Arrayu32
- Arrayu64
- Arrayf
- Arrayd

Template Parameters

  T | The type of element stored in the array.

Examples
  serializationArray.cpp.

## Constructor & Destructor Documentation

## ◆ ArrayX() [1/2]

template<typename T >

iolink::ArrayX< T >::ArrayX | ( | const VectorXu64 & | shape | ) |
| explicit

Create an array with the given shape.

The memory layout of the array will be the default one used by IOLink, the Fortran one, in wich the leftmost dimension is the continuous one.

Parameters

  shape | The shape of the array.

## ◆ ArrayX() [2/2]

template<typename T >

iolink::ArrayX< T >::ArrayX | ( | const Indexer & | indexer | ) |
| explicit

Create an array with a memory layout fitting the given indexer.

Parameters

  indexer | the Indexer instance describing the mmeory layout.

## Member Function Documentation

## ◆ at()

template<typename T >

T iolink::ArrayX< T >::at | ( | const VectorXu64 & | index | ) | const

Get an element of the array.

Warning
  If Array has an empty shape (dimension count = 0), this method has an undefined behavior.

Parameters

  index | The index of the element to get.

## ◆ reshape()

template<typename T >

void iolink::ArrayX< T >::reshape | ( | const VectorXu64 & | shape | ) |

Change the shape of the array.

Parameters

  shape | The new shape.

## ◆ setAt()

template<typename T >

void iolink::ArrayX< T >::setAt | ( | const VectorXu64 & | index,
|  | T | value
| ) |  |

Set a value to an element of the array.

Warning
  If Array has an empty shape (dimension count = 0), this method has an undefined behavior.

Parameters

  index | The index of the element to set.
  value | The value to set at the given index.

Examples
  serializationArray.cpp.

The documentation for this class was generated from the following file:

- iolink/public/include/iolink/ArrayX.h