DUDS
Distributed Update of Data from Something
duds::data::QuantityNddArray Struct Reference

An array of quantites of dynamic size and number of dimensions. More...

#include <QuantityArray.hpp>

Collaboration diagram for duds::data::QuantityNddArray:

Public Types

typedef duds::general::NddArray< double > Array
 The type of the array holding quantity values. More...
 
typedef QuantityIterator< typename Array::const_iteratorconst_iterator
 A const iterator type that will yield Quantity objects when dereferenced. More...
 
typedef QuantityIterator< typename Array::iteratoriterator
 An iterator type that will yield Quantity objects when dereferenced. More...
 

Public Member Functions

 QuantityNddArray ()=default
 The default constructor; expect unit to be uninitialized. More...
 
 QuantityNddArray (const QuantityNddArray &)=default
 A default copy constrcutor. More...
 
 QuantityNddArray (QuantityNddArray &&q) noexcept
 Move constructor; the array of quantities is moved rather than copied. More...
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void clear () noexcept
 Clears the array and units. More...
 
bool empty () const
 True if the array is empty; units are immateral. More...
 
iterator end ()
 
const_iterator end () const
 
template<class Dim >
Quantity get (const Dim &pos) const
 Returns a new Quantity object for the requested position. More...
 
Quantity get (const Array::DimList &pos) const
 Returns a new Quantity object for the requested position. More...
 
QuantityNddArrayoperator= (const QuantityNddArray &a)=default
 Copies one QuantityNddArray into another for an exact match. More...
 
QuantityNddArrayoperator= (QuantityNddArray &&q)=default
 Move assignment; the array of quantities is moved rather than copied. More...
 
template<std::size_t N>
QuantityNddArrayoperator= (const QuantityArray< N > &q)
 Copies the contents of a QuantityArray into this object. More...
 
template<class Dim >
void set (const Dim &pos, const Quantity &q)
 Sets a stored quantity to be the same as given Quantity object. More...
 
void set (const Array::DimList &pos, const Quantity &q)
 Sets a stored quantity to be the same as given Quantity object. More...
 

Public Attributes

Array array
 The array of quantity values. More...
 
Unit unit
 The units of all values in the array. More...
 

Private Member Functions

template<class A >
void serialize (A &a, const unsigned int)
 

Friends

class boost::serialization::access
 

Detailed Description

An array of quantites of dynamic size and number of dimensions.

A duds::general::NddArray is used to hold all quantity values, doubles, and the units are held separately. This reduces the memory usage over having an array of Quantity objects. Functions are provided that work with Quantity objects.

Author
Jeff Jackowski

Definition at line 284 of file QuantityArray.hpp.

Member Typedef Documentation

◆ Array

The type of the array holding quantity values.

Definition at line 288 of file QuantityArray.hpp.

◆ const_iterator

A const iterator type that will yield Quantity objects when dereferenced.

Definition at line 351 of file QuantityArray.hpp.

◆ iterator

An iterator type that will yield Quantity objects when dereferenced.

Definition at line 347 of file QuantityArray.hpp.

Constructor & Destructor Documentation

◆ QuantityNddArray() [1/3]

duds::data::QuantityNddArray::QuantityNddArray ( )
default

The default constructor; expect unit to be uninitialized.

Postcondition
array is empty and unit is uninitialized.

◆ QuantityNddArray() [2/3]

duds::data::QuantityNddArray::QuantityNddArray ( const QuantityNddArray )
default

A default copy constrcutor.

◆ QuantityNddArray() [3/3]

duds::data::QuantityNddArray::QuantityNddArray ( QuantityNddArray &&  q)
inlinenoexcept

Move constructor; the array of quantities is moved rather than copied.

Definition at line 309 of file QuantityArray.hpp.

Member Function Documentation

◆ begin() [1/2]

iterator duds::data::QuantityNddArray::begin ( )
inline

Definition at line 352 of file QuantityArray.hpp.

◆ begin() [2/2]

const_iterator duds::data::QuantityNddArray::begin ( ) const
inline

Definition at line 355 of file QuantityArray.hpp.

◆ cbegin()

const_iterator duds::data::QuantityNddArray::cbegin ( ) const
inline

Definition at line 358 of file QuantityArray.hpp.

◆ cend()

const_iterator duds::data::QuantityNddArray::cend ( ) const
inline

Definition at line 367 of file QuantityArray.hpp.

◆ clear()

void duds::data::QuantityNddArray::clear ( )
inlinenoexcept

Clears the array and units.

Definition at line 334 of file QuantityArray.hpp.

◆ empty()

bool duds::data::QuantityNddArray::empty ( ) const
inline

True if the array is empty; units are immateral.

Definition at line 341 of file QuantityArray.hpp.

◆ end() [1/2]

iterator duds::data::QuantityNddArray::end ( )
inline

Definition at line 361 of file QuantityArray.hpp.

◆ end() [2/2]

const_iterator duds::data::QuantityNddArray::end ( ) const
inline

Definition at line 364 of file QuantityArray.hpp.

◆ get() [1/2]

template<class Dim >
Quantity duds::data::QuantityNddArray::get ( const Dim &  pos) const
inline

Returns a new Quantity object for the requested position.

Template Parameters
DimThe type holding the position. It must have forward iterators.
Parameters
posThe position in the array.
Exceptions
duds::data::general::OutOfRangeErrorThrown by Array::at() when the position is outside the array's boundries.

Definition at line 380 of file QuantityArray.hpp.

◆ get() [2/2]

Quantity duds::data::QuantityNddArray::get ( const Array::DimList pos) const
inline

Returns a new Quantity object for the requested position.

Parameters
posThe position in the array.
Exceptions
OutOfRangeErrorThrown by Array::at() when the position is outside the array's boundries.

Definition at line 389 of file QuantityArray.hpp.

◆ operator=() [1/3]

QuantityNddArray& duds::data::QuantityNddArray::operator= ( const QuantityNddArray a)
default

Copies one QuantityNddArray into another for an exact match.

◆ operator=() [2/3]

QuantityNddArray& duds::data::QuantityNddArray::operator= ( QuantityNddArray &&  q)
default

Move assignment; the array of quantities is moved rather than copied.

◆ operator=() [3/3]

template<std::size_t N>
QuantityNddArray& duds::data::QuantityNddArray::operator= ( const QuantityArray< N > &  q)
inline

Copies the contents of a QuantityArray into this object.

Postcondition
The dimensions of this object will match q.
Template Parameters
NThe length of the source array.
Parameters
qThe source array.

Definition at line 326 of file QuantityArray.hpp.

◆ serialize()

template<class A >
void duds::data::QuantityNddArray::serialize ( A &  a,
const unsigned  int 
)
inlineprivate

Definition at line 436 of file QuantityArray.hpp.

◆ set() [1/2]

template<class Dim >
void duds::data::QuantityNddArray::set ( const Dim &  pos,
const Quantity q 
)
inline

Sets a stored quantity to be the same as given Quantity object.

Precondition
The given Quantity has the same units as all quantites in this array (unit).
Template Parameters
DimThe type holding the position. It must have forward iterators.
Parameters
posThe position in the array.
qThe quantity to store.
Exceptions
UnitMismatchThe units of q are not the same as the units of this array.
duds::data::general::OutOfRangeErrorThrown by Array::at() when the position is outside the array's boundries.

Definition at line 407 of file QuantityArray.hpp.

◆ set() [2/2]

void duds::data::QuantityNddArray::set ( const Array::DimList pos,
const Quantity q 
)
inline

Sets a stored quantity to be the same as given Quantity object.

Precondition
The given Quantity has the same units as all quantites in this array (unit).
Parameters
posThe position in the array.
qThe quantity to store.
Exceptions
UnitMismatchThe units of q are not the same as the units of this array.
duds::data::general::OutOfRangeErrorThrown by Array::at() when the position is outside the array's boundries.

Definition at line 425 of file QuantityArray.hpp.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 434 of file QuantityArray.hpp.

Member Data Documentation

◆ array

Array duds::data::QuantityNddArray::array

The array of quantity values.

Definition at line 292 of file QuantityArray.hpp.

Referenced by duds::data::QuantityArray< 3 >::operator=().

◆ unit

Unit duds::data::QuantityNddArray::unit

The units of all values in the array.

Definition at line 296 of file QuantityArray.hpp.

Referenced by duds::data::QuantityArray< 3 >::operator=().


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