libtad  2.1
A library that makes working with multidimensional arrays in C++ easy
Classes | Enumerations | Functions | Variables
TAD Namespace Reference

Classes

class  ArrayDescription
 The ArrayDescription manages array metadata. More...
 
class  ArrayContainer
 The ArrayContainer class manages arrays with arbitrary component data types. More...
 
class  Array
 An Array with a specific component data type given the template parameter. This is the main class to work with since it allows useful for operations on arrays (e.g. component-wise addition) and provides iterators. More...
 
class  TagList
 A tag list to store key/value pairs, where both key and value are strings. More...
 
class  Importer
 The importer class imports arrays from files or streams. More...
 
class  Exporter
 The exporter class exports arrays to files or streams. More...
 

Enumerations

enum  Type {
  int8 = 0 , uint8 = 1 , int16 = 2 , uint16 = 3 ,
  int32 = 4 , uint32 = 5 , int64 = 6 , uint64 = 7 ,
  float32 = 8 , float64 = 9
}
 The data type that array element components can represent. More...
 
enum  Error {
  ErrorNone = 0 , ErrorFormatUnsupported = 1 , ErrorFeaturesUnsupported = 2 , ErrorMissingHints = 3 ,
  ErrorInvalidData = 4 , ErrorSeekingNotSupported = 5 , ErrorAppendingNotSupported = 6 , ErrorLibrary = 7 ,
  ErrorSysErrno = 8
}
 Input/output errors. More...
 

Functions

constexpr size_t typeSize (Type t)
 Returns the size of a TAD type. More...
 
template<typename T >
constexpr Type typeFromTemplate ()
 Returns the TAD component type that corresponds to the template parameter. More...
 
bool typeFromString (const std::string &s, Type *t)
 Determine the TAD component type described in the string, return false if this fails. More...
 
const char * typeToString (Type t)
 Return the name of the given type. More...
 
ArrayContainer convert (const ArrayContainer &a, Type newType)
 Convert the given array to the given new component type. If conversion is not actually necessary because the new type is the same as the old, the returned array will simply share its data with the original array. More...
 
template<typename T , typename FUNC >
Array< T > forEachComponent (const Array< T > &a, FUNC func)
 Apply func to all components in array a. More...
 
template<typename T , typename FUNC >
Array< T > & forEachComponentInplace (Array< T > &a, FUNC func)
 Apply func to all components in array a, in place. More...
 
template<typename T , typename FUNC >
Array< T > forEachComponent (const Array< T > &a, T b, FUNC func)
 Apply func to all components in array a using value b. More...
 
template<typename T , typename FUNC >
Array< T > & forEachComponentInplace (Array< T > &a, T b, FUNC func)
 Apply func to all components in array a using value b, in place. More...
 
template<typename T , typename FUNC >
Array< T > forEachComponent (const Array< T > &a, const Array< T > &b, FUNC func)
 Apply func to all components in arrays a and b. More...
 
template<typename T , typename FUNC >
Array< T > & forEachComponentInplace (Array< T > &a, const Array< T > &b, FUNC func)
 Apply func to all components in arrays a and b, in place. More...
 
template<typename T , typename FUNC >
Array< T > forEachElement (const Array< T > &a, FUNC func)
 Apply func to all elements in array a. More...
 
template<typename T , typename FUNC >
Array< T > & forEachElementInplace (Array< T > &a, FUNC func)
 Apply func to all elements in array a, in place. More...
 
template<typename T , typename FUNC >
Array< T > forEachElement (const Array< T > &a, const T *b, FUNC func)
 Apply func to all elements in array a using element b. More...
 
template<typename T , typename FUNC >
Array< T > & forEachElementInplace (Array< T > &a, const T *b, FUNC func)
 Apply func to all elements in array a using element b, in place. More...
 
template<typename T , typename FUNC >
Array< T > forEachElement (const Array< T > &a, const Array< T > &b, FUNC func)
 Apply func to all elements in arrays a and b. More...
 
template<typename T , typename FUNC >
Array< T > & forEachElementInplace (Array< T > &a, const Array< T > &b, FUNC func)
 Apply func to all elements in arrays a and b, in place. More...
 
template<typename T >
Array< T > operator- (const Array< T > &a)
 
template<typename T >
Array< T > abs (const Array< T > &a)
 
template<typename T >
Array< T > absInplace (Array< T > &a)
 
template<typename T >
Array< T > operator+ (const Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator+ (const Array< T > &a, T b)
 
template<typename T >
Array< T > operator+= (Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator+= (Array< T > &a, T b)
 
template<typename T >
Array< T > operator- (const Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator- (const Array< T > &a, T b)
 
template<typename T >
Array< T > operator-= (Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator-= (Array< T > &a, T b)
 
template<typename T >
Array< T > operator* (const Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator* (const Array< T > &a, T b)
 
template<typename T >
Array< T > operator*= (Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator*= (Array< T > &a, T b)
 
template<typename T >
Array< T > operator/ (const Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator/ (const Array< T > &a, T b)
 
template<typename T >
Array< T > operator/= (Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator/= (Array< T > &a, T b)
 
template<typename T >
Array< T > operator% (const Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator% (const Array< T > &a, T b)
 
template<typename T >
Array< T > operator%= (Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator%= (Array< T > &a, T b)
 
template<typename T >
Array< T > operator& (const Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator& (const Array< T > &a, T b)
 
template<typename T >
Array< T > operator&= (Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator&= (Array< T > &a, T b)
 
template<typename T >
Array< T > operator| (const Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator| (const Array< T > &a, T b)
 
template<typename T >
Array< T > operator|= (Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator|= (Array< T > &a, T b)
 
template<typename T >
Array< T > operator^ (const Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator^ (const Array< T > &a, T b)
 
template<typename T >
Array< T > operator^= (Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > operator^= (Array< T > &a, T b)
 
template<typename T >
Array< T > min (const Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > min (const Array< T > &a, T b)
 
template<typename T >
Array< T > minInplace (Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > minInplace (Array< T > &a, T b)
 
template<typename T >
Array< T > max (const Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > max (const Array< T > &a, T b)
 
template<typename T >
Array< T > maxInplace (Array< T > &a, const Array< T > &b)
 
template<typename T >
Array< T > maxInplace (Array< T > &a, T b)
 
const char * strerror (Error e)
 Convert an input/output error to human-readable string. More...
 
ArrayContainer load (const std::string &fileName, const TagList &hints=TagList(), Error *error=nullptr)
 Shortcut to read a single array from a file in a single line of code. More...
 
bool save (const ArrayContainer &A, const std::string &fileName, bool append=Overwrite, Error *error=nullptr, const TagList &hints=TagList())
 Shortcut to write a single array to a file in a single line of code. More...
 

Variables

const bool Append = true
 Flag to be used for the append parameter of TAD::save() More...
 
const bool Overwrite = false
 Flag to be used for the append parameter of TAD::save() More...
 

Enumeration Type Documentation

◆ Error

enum TAD::Error

Input/output errors.

Enumerator
ErrorNone 

No error.

ErrorFormatUnsupported 

Unsupported file format.

ErrorFeaturesUnsupported 

Unsupported features used by the file.

ErrorMissingHints 

File format requires hints that are missing.

ErrorInvalidData 

Invalid data.

ErrorSeekingNotSupported 

Seeking not supported.

ErrorAppendingNotSupported 

Appending not supported.

ErrorLibrary 

Failure of external library.

ErrorSysErrno 

System error, consult errno.

◆ Type

enum TAD::Type

The data type that array element components can represent.

Enumerator
int8 

int8_t

uint8 

uint8_t

int16 

int16_t

uint16 

uint16_t

int32 

int32_t

uint32 

uint32_t

int64 

int64_t

uint64 

uint64_t

float32 

IEEE 754 single precision floating point (on all relevant platforms: float)

float64 

IEEE 754 double precision floating point (on all relevant platforms: double)

Function Documentation

◆ abs()

template<typename T >
Array<T> TAD::abs ( const Array< T > &  a)

◆ absInplace()

template<typename T >
Array<T> TAD::absInplace ( Array< T > &  a)

◆ convert()

ArrayContainer TAD::convert ( const ArrayContainer a,
Type  newType 
)
inline

Convert the given array to the given new component type. If conversion is not actually necessary because the new type is the same as the old, the returned array will simply share its data with the original array.

◆ forEachComponent() [1/3]

template<typename T , typename FUNC >
Array<T> TAD::forEachComponent ( const Array< T > &  a,
const Array< T > &  b,
FUNC  func 
)

Apply func to all components in arrays a and b.

◆ forEachComponent() [2/3]

template<typename T , typename FUNC >
Array<T> TAD::forEachComponent ( const Array< T > &  a,
FUNC  func 
)

Apply func to all components in array a.

◆ forEachComponent() [3/3]

template<typename T , typename FUNC >
Array<T> TAD::forEachComponent ( const Array< T > &  a,
b,
FUNC  func 
)

Apply func to all components in array a using value b.

◆ forEachComponentInplace() [1/3]

template<typename T , typename FUNC >
Array<T>& TAD::forEachComponentInplace ( Array< T > &  a,
const Array< T > &  b,
FUNC  func 
)

Apply func to all components in arrays a and b, in place.

◆ forEachComponentInplace() [2/3]

template<typename T , typename FUNC >
Array<T>& TAD::forEachComponentInplace ( Array< T > &  a,
FUNC  func 
)

Apply func to all components in array a, in place.

◆ forEachComponentInplace() [3/3]

template<typename T , typename FUNC >
Array<T>& TAD::forEachComponentInplace ( Array< T > &  a,
b,
FUNC  func 
)

Apply func to all components in array a using value b, in place.

◆ forEachElement() [1/3]

template<typename T , typename FUNC >
Array<T> TAD::forEachElement ( const Array< T > &  a,
const Array< T > &  b,
FUNC  func 
)

Apply func to all elements in arrays a and b.

◆ forEachElement() [2/3]

template<typename T , typename FUNC >
Array<T> TAD::forEachElement ( const Array< T > &  a,
const T *  b,
FUNC  func 
)

Apply func to all elements in array a using element b.

◆ forEachElement() [3/3]

template<typename T , typename FUNC >
Array<T> TAD::forEachElement ( const Array< T > &  a,
FUNC  func 
)

Apply func to all elements in array a.

◆ forEachElementInplace() [1/3]

template<typename T , typename FUNC >
Array<T>& TAD::forEachElementInplace ( Array< T > &  a,
const Array< T > &  b,
FUNC  func 
)

Apply func to all elements in arrays a and b, in place.

◆ forEachElementInplace() [2/3]

template<typename T , typename FUNC >
Array<T>& TAD::forEachElementInplace ( Array< T > &  a,
const T *  b,
FUNC  func 
)

Apply func to all elements in array a using element b, in place.

◆ forEachElementInplace() [3/3]

template<typename T , typename FUNC >
Array<T>& TAD::forEachElementInplace ( Array< T > &  a,
FUNC  func 
)

Apply func to all elements in array a, in place.

◆ load()

ArrayContainer TAD::load ( const std::string &  fileName,
const TagList hints = TagList(),
Error error = nullptr 
)
inline

Shortcut to read a single array from a file in a single line of code.

◆ max() [1/2]

template<typename T >
Array<T> TAD::max ( const Array< T > &  a,
const Array< T > &  b 
)

◆ max() [2/2]

template<typename T >
Array<T> TAD::max ( const Array< T > &  a,
b 
)

◆ maxInplace() [1/2]

template<typename T >
Array<T> TAD::maxInplace ( Array< T > &  a,
const Array< T > &  b 
)

◆ maxInplace() [2/2]

template<typename T >
Array<T> TAD::maxInplace ( Array< T > &  a,
b 
)

◆ min() [1/2]

template<typename T >
Array<T> TAD::min ( const Array< T > &  a,
const Array< T > &  b 
)

◆ min() [2/2]

template<typename T >
Array<T> TAD::min ( const Array< T > &  a,
b 
)

◆ minInplace() [1/2]

template<typename T >
Array<T> TAD::minInplace ( Array< T > &  a,
const Array< T > &  b 
)

◆ minInplace() [2/2]

template<typename T >
Array<T> TAD::minInplace ( Array< T > &  a,
b 
)

◆ operator%() [1/2]

template<typename T >
Array<T> TAD::operator% ( const Array< T > &  a,
const Array< T > &  b 
)

◆ operator%() [2/2]

template<typename T >
Array<T> TAD::operator% ( const Array< T > &  a,
b 
)

◆ operator%=() [1/2]

template<typename T >
Array<T> TAD::operator%= ( Array< T > &  a,
const Array< T > &  b 
)

◆ operator%=() [2/2]

template<typename T >
Array<T> TAD::operator%= ( Array< T > &  a,
b 
)

◆ operator&() [1/2]

template<typename T >
Array<T> TAD::operator& ( const Array< T > &  a,
const Array< T > &  b 
)

◆ operator&() [2/2]

template<typename T >
Array<T> TAD::operator& ( const Array< T > &  a,
b 
)

◆ operator&=() [1/2]

template<typename T >
Array<T> TAD::operator&= ( Array< T > &  a,
const Array< T > &  b 
)

◆ operator&=() [2/2]

template<typename T >
Array<T> TAD::operator&= ( Array< T > &  a,
b 
)

◆ operator*() [1/2]

template<typename T >
Array<T> TAD::operator* ( const Array< T > &  a,
const Array< T > &  b 
)

◆ operator*() [2/2]

template<typename T >
Array<T> TAD::operator* ( const Array< T > &  a,
b 
)

◆ operator*=() [1/2]

template<typename T >
Array<T> TAD::operator*= ( Array< T > &  a,
const Array< T > &  b 
)

◆ operator*=() [2/2]

template<typename T >
Array<T> TAD::operator*= ( Array< T > &  a,
b 
)

◆ operator+() [1/2]

template<typename T >
Array<T> TAD::operator+ ( const Array< T > &  a,
const Array< T > &  b 
)

◆ operator+() [2/2]

template<typename T >
Array<T> TAD::operator+ ( const Array< T > &  a,
b 
)

◆ operator+=() [1/2]

template<typename T >
Array<T> TAD::operator+= ( Array< T > &  a,
const Array< T > &  b 
)

◆ operator+=() [2/2]

template<typename T >
Array<T> TAD::operator+= ( Array< T > &  a,
b 
)

◆ operator-() [1/3]

template<typename T >
Array<T> TAD::operator- ( const Array< T > &  a)

◆ operator-() [2/3]

template<typename T >
Array<T> TAD::operator- ( const Array< T > &  a,
const Array< T > &  b 
)

◆ operator-() [3/3]

template<typename T >
Array<T> TAD::operator- ( const Array< T > &  a,
b 
)

◆ operator-=() [1/2]

template<typename T >
Array<T> TAD::operator-= ( Array< T > &  a,
const Array< T > &  b 
)

◆ operator-=() [2/2]

template<typename T >
Array<T> TAD::operator-= ( Array< T > &  a,
b 
)

◆ operator/() [1/2]

template<typename T >
Array<T> TAD::operator/ ( const Array< T > &  a,
const Array< T > &  b 
)

◆ operator/() [2/2]

template<typename T >
Array<T> TAD::operator/ ( const Array< T > &  a,
b 
)

◆ operator/=() [1/2]

template<typename T >
Array<T> TAD::operator/= ( Array< T > &  a,
const Array< T > &  b 
)

◆ operator/=() [2/2]

template<typename T >
Array<T> TAD::operator/= ( Array< T > &  a,
b 
)

◆ operator^() [1/2]

template<typename T >
Array<T> TAD::operator^ ( const Array< T > &  a,
const Array< T > &  b 
)

◆ operator^() [2/2]

template<typename T >
Array<T> TAD::operator^ ( const Array< T > &  a,
b 
)

◆ operator^=() [1/2]

template<typename T >
Array<T> TAD::operator^= ( Array< T > &  a,
const Array< T > &  b 
)

◆ operator^=() [2/2]

template<typename T >
Array<T> TAD::operator^= ( Array< T > &  a,
b 
)

◆ operator|() [1/2]

template<typename T >
Array<T> TAD::operator| ( const Array< T > &  a,
const Array< T > &  b 
)

◆ operator|() [2/2]

template<typename T >
Array<T> TAD::operator| ( const Array< T > &  a,
b 
)

◆ operator|=() [1/2]

template<typename T >
Array<T> TAD::operator|= ( Array< T > &  a,
const Array< T > &  b 
)

◆ operator|=() [2/2]

template<typename T >
Array<T> TAD::operator|= ( Array< T > &  a,
b 
)

◆ save()

bool TAD::save ( const ArrayContainer A,
const std::string &  fileName,
bool  append = Overwrite,
Error error = nullptr,
const TagList hints = TagList() 
)
inline

Shortcut to write a single array to a file in a single line of code.

◆ strerror()

const char* TAD::strerror ( Error  e)

Convert an input/output error to human-readable string.

◆ typeFromString()

bool TAD::typeFromString ( const std::string &  s,
Type t 
)
inline

Determine the TAD component type described in the string, return false if this fails.

◆ typeFromTemplate()

template<typename T >
constexpr Type TAD::typeFromTemplate ( )
inlineconstexpr

Returns the TAD component type that corresponds to the template parameter.

◆ typeSize()

constexpr size_t TAD::typeSize ( Type  t)
inlineconstexpr

Returns the size of a TAD type.

◆ typeToString()

const char* TAD::typeToString ( Type  t)
inline

Return the name of the given type.

Variable Documentation

◆ Append

const bool TAD::Append = true

Flag to be used for the append parameter of TAD::save()

◆ Overwrite

const bool TAD::Overwrite = false

Flag to be used for the append parameter of TAD::save()