Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
FixedList< T, Size > Class Template Reference

A 1D vector of objects of type <T> with a fixed size <Size>. More...

Inheritance diagram for FixedList< T, Size >:
Inheritance graph
[legend]

Classes

class  Hash
 Hashing function class. More...
 

Public Types

typedef T value_type
 Type of values the FixedList contains. More...
 
typedef Treference
 Type that can be used for storing into. More...
 
typedef const Tconst_reference
 Type that can be used for storing into. More...
 
typedef label difference_type
 The type that can represent the difference between any two. More...
 
typedef label size_type
 The type that can represent the size of a FixedList. More...
 
typedef Titerator
 Random access iterator for traversing FixedList. More...
 
typedef const Tconst_iterator
 Random access iterator for traversing FixedList. More...
 
typedef Treverse_iterator
 Reverse iterator for reverse traversal of FixedList. More...
 
typedef const Tconst_reverse_iterator
 Reverse iterator for reverse traversal of constant FixedList. More...
 

Public Member Functions

 FixedList ()
 Null constructor. More...
 
 FixedList (const T &)
 Construct from value. More...
 
 FixedList (const T v[Size])
 Construct from C-array. More...
 
template<class InputIterator >
 FixedList (InputIterator first, InputIterator last)
 Construct given start and end iterators. More...
 
 FixedList (std::initializer_list< T >)
 Construct from an initializer list. More...
 
 FixedList (const UList< T > &)
 Construct from UList. More...
 
 FixedList (const SLList< T > &)
 Construct from SLList. More...
 
 FixedList (const FixedList< T, Size > &)
 Copy constructor. More...
 
 FixedList (Istream &)
 Construct from Istream. More...
 
autoPtr< FixedList< T, Size > > clone () const
 Clone. More...
 
label fcIndex (const label i) const
 Return the forward circular index, i.e. the next index. More...
 
label rcIndex (const label i) const
 Return the reverse circular index, i.e. the previous index. More...
 
const Tcdata () const
 Return a const pointer to the first data element,. More...
 
Tdata ()
 Return a pointer to the first data element,. More...
 
Tfirst ()
 Return the first element of the list. More...
 
const Tfirst () const
 Return first element of the list. More...
 
Tlast ()
 Return the last element of the list. More...
 
const Tlast () const
 Return the last element of the list. More...
 
void checkStart (const label start) const
 Check start is within valid range (0 ... size-1) More...
 
void checkSize (const label size) const
 Check size is within valid range (0 ... size) More...
 
void checkIndex (const label i) const
 Check index i is within valid range (0 ... size-1) More...
 
void resize (const label)
 Dummy resize function. More...
 
void setSize (const label)
 Dummy setSize function. More...
 
void transfer (const FixedList< T, Size > &)
 Copy (not transfer) the argument contents. More...
 
void writeEntry (Ostream &) const
 Write the FixedList as a dictionary entry. More...
 
void writeEntry (const word &keyword, Ostream &) const
 Write the FixedList as a dictionary entry with keyword. More...
 
Toperator[] (const label)
 Return element of FixedList. More...
 
const Toperator[] (const label) const
 Return element of constant FixedList. More...
 
void operator= (const T v[Size])
 Assignment to array operator. Takes linear time. More...
 
void operator= (const UList< T > &)
 Assignment to UList operator. Takes linear time. More...
 
void operator= (const SLList< T > &)
 Assignment to SLList operator. Takes linear time. More...
 
void operator= (std::initializer_list< T >)
 Assignment to an initializer list. Takes linear time. More...
 
void operator= (const T &)
 Assignment of all entries to the given value. More...
 
iterator begin ()
 Return an iterator to begin traversing the FixedList. More...
 
iterator end ()
 Return an iterator to end traversing the FixedList. More...
 
const_iterator cbegin () const
 Return const_iterator to begin traversing the constant FixedList. More...
 
const_iterator cend () const
 Return const_iterator to end traversing the constant FixedList. More...
 
const_iterator begin () const
 Return const_iterator to begin traversing the constant FixedList. More...
 
const_iterator end () const
 Return const_iterator to end traversing the constant FixedList. More...
 
reverse_iterator rbegin ()
 Return reverse_iterator to begin reverse traversing the FixedList. More...
 
reverse_iterator rend ()
 Return reverse_iterator to end reverse traversing the FixedList. More...
 
const_reverse_iterator crbegin () const
 Return const_reverse_iterator to begin reverse traversing FixedList. More...
 
const_reverse_iterator crend () const
 Return const_reverse_iterator to end reverse traversing FixedList. More...
 
const_reverse_iterator rbegin () const
 Return const_reverse_iterator to begin reverse traversing FixedList. More...
 
const_reverse_iterator rend () const
 Return const_reverse_iterator to end reverse traversing FixedList. More...
 
label size () const
 Return the number of elements in the FixedList. More...
 
label max_size () const
 Return size of the largest possible FixedList. More...
 
bool empty () const
 Return true if the FixedList is empty (ie, size() is zero) More...
 
void swap (FixedList< T, Size > &)
 Swap two FixedLists of the same type in constant time. More...
 
bool operator== (const FixedList< T, Size > &) const
 Equality operation on FixedLists of the same type. More...
 
bool operator!= (const FixedList< T, Size > &) const
 The opposite of the equality operation. Takes linear time. More...
 
bool operator< (const FixedList< T, Size > &) const
 Compare two FixedLists lexicographically. Takes linear time. More...
 
bool operator> (const FixedList< T, Size > &) const
 Compare two FixedLists lexicographically. Takes linear time. More...
 
bool operator<= (const FixedList< T, Size > &) const
 Return true if !(a > b). Takes linear time. More...
 
bool operator>= (const FixedList< T, Size > &) const
 Return true if !(a < b). Takes linear time. More...
 

Static Public Member Functions

static const FixedList< T, Size > & null ()
 Return a null FixedList. More...
 

Friends

Istreamoperator>> (Istream &, FixedList< T, Size > &)
 Read List from Istream, discarding contents of existing List. More...
 
Ostreamoperator (Ostream &, const FixedList< T, Size > &)
 Write FixedList to Ostream. More...
 

Detailed Description

template<class T, unsigned Size>
class Foam::FixedList< T, Size >

A 1D vector of objects of type <T> with a fixed size <Size>.

Source files

Definition at line 54 of file FixedList.H.

Member Typedef Documentation

◆ value_type

typedef T value_type

Type of values the FixedList contains.

Definition at line 243 of file FixedList.H.

◆ reference

typedef T& reference

Type that can be used for storing into.

FixedList::value_type objects

Definition at line 247 of file FixedList.H.

◆ const_reference

typedef const T& const_reference

Type that can be used for storing into.

constant FixedList::value_type objects

Definition at line 251 of file FixedList.H.

◆ difference_type

The type that can represent the difference between any two.

FixedList iterator objects

Definition at line 255 of file FixedList.H.

◆ size_type

typedef label size_type

The type that can represent the size of a FixedList.

Definition at line 258 of file FixedList.H.

◆ iterator

typedef T* iterator

Random access iterator for traversing FixedList.

Definition at line 264 of file FixedList.H.

◆ const_iterator

typedef const T* const_iterator

Random access iterator for traversing FixedList.

Definition at line 276 of file FixedList.H.

◆ reverse_iterator

typedef T* reverse_iterator

Reverse iterator for reverse traversal of FixedList.

Definition at line 294 of file FixedList.H.

◆ const_reverse_iterator

typedef const T* const_reverse_iterator

Reverse iterator for reverse traversal of constant FixedList.

Definition at line 306 of file FixedList.H.

Constructor & Destructor Documentation

◆ FixedList() [1/9]

FixedList ( )
inline

Null constructor.

Definition at line 33 of file FixedListI.H.

Referenced by FixedList< Type, 3 >::FixedList(), and FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ FixedList() [2/9]

FixedList ( const T t)
inlineexplicit

Construct from value.

Definition at line 38 of file FixedListI.H.

◆ FixedList() [3/9]

FixedList ( const T  v[Size])
inlineexplicit

Construct from C-array.

Definition at line 48 of file FixedListI.H.

◆ FixedList() [4/9]

FixedList ( InputIterator  first,
InputIterator  last 
)
inline

Construct given start and end iterators.

Definition at line 60 of file FixedListI.H.

◆ FixedList() [5/9]

FixedList ( std::initializer_list< T lst)
inline

Construct from an initializer list.

Definition at line 76 of file FixedListI.H.

◆ FixedList() [6/9]

FixedList ( const UList< T > &  lst)
inlineexplicit

Construct from UList.

Definition at line 83 of file FixedListI.H.

◆ FixedList() [7/9]

FixedList ( const SLList< T > &  lst)
inlineexplicit

Construct from SLList.

Definition at line 95 of file FixedListI.H.

◆ FixedList() [8/9]

FixedList ( const FixedList< T, Size > &  lst)
inline

Copy constructor.

Definition at line 108 of file FixedListI.H.

◆ FixedList() [9/9]

FixedList ( Istream is)

Construct from Istream.

Definition at line 35 of file FixedListIO.C.

Member Function Documentation

◆ null()

const Foam::FixedList< T, Size > & null ( )
inlinestatic

Return a null FixedList.

Definition at line 128 of file FixedListI.H.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ clone()

Foam::autoPtr< Foam::FixedList< T, Size > > clone ( ) const
inline

Clone.

Definition at line 119 of file FixedListI.H.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ fcIndex()

Foam::label fcIndex ( const label  i) const
inline

Return the forward circular index, i.e. the next index.

which returns to the first at the end of the list

Definition at line 135 of file FixedListI.H.

Referenced by triSurfaceTools::calcInterpolationWeights(), FixedList< T, Size >::Hash< HashT >::Hash(), NamedEnum< directionType, 3 >::names(), and triSurface::triSurfInstance().

Here is the caller graph for this function:

◆ rcIndex()

Foam::label rcIndex ( const label  i) const
inline

Return the reverse circular index, i.e. the previous index.

which returns to the last at the beginning of the list

Definition at line 142 of file FixedListI.H.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ cdata()

const T * cdata ( ) const
inline

Return a const pointer to the first data element,.

similar to the STL front() method and the string::data() method This can be used (with caution) when interfacing with C code

Definition at line 212 of file FixedListI.H.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash(), and FixedList< Type, 3 >::writeEntry().

Here is the caller graph for this function:

◆ data()

T * data ( )
inline

Return a pointer to the first data element,.

similar to the STL front() method and the string::data() method This can be used (with caution) when interfacing with C code

Definition at line 220 of file FixedListI.H.

Referenced by FixedList< Type, 3 >::FixedList(), and FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ first() [1/2]

T & first ( )
inline

Return the first element of the list.

Definition at line 227 of file FixedListI.H.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash(), and LangmuirHinshelwoodReactionRate::write().

Here is the caller graph for this function:

◆ first() [2/2]

const T & first ( ) const
inline

Return first element of the list.

Definition at line 234 of file FixedListI.H.

◆ last() [1/2]

T & last ( )
inline

Return the last element of the list.

Definition at line 241 of file FixedListI.H.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ last() [2/2]

const T & last ( ) const
inline

Return the last element of the list.

Definition at line 248 of file FixedListI.H.

◆ checkStart()

void checkStart ( const label  start) const
inline

Check start is within valid range (0 ... size-1)

Definition at line 149 of file FixedListI.H.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ checkSize()

void checkSize ( const label  size) const
inline

Check size is within valid range (0 ... size)

Definition at line 161 of file FixedListI.H.

Referenced by FixedList< Type, 3 >::FixedList(), and FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ checkIndex()

void checkIndex ( const label  i) const
inline

Check index i is within valid range (0 ... size-1)

Definition at line 173 of file FixedListI.H.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ resize()

void resize ( const label  s)
inline

Dummy resize function.

needed to make FixedList consistent with List

Definition at line 185 of file FixedListI.H.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ setSize()

void setSize ( const label  s)
inline

Dummy setSize function.

needed to make FixedList consistent with List

Definition at line 193 of file FixedListI.H.

Referenced by triSurfaceTools::collapseEdges(), meshRefinement::createZoneBaffles(), blockDescriptor::facePoints(), FixedList< T, Size >::Hash< HashT >::Hash(), and triSurfaceTools::mergePoints().

Here is the caller graph for this function:

◆ transfer()

void transfer ( const FixedList< T, Size > &  lst)
inline

Copy (not transfer) the argument contents.

needed to make FixedList consistent with List

Definition at line 201 of file FixedListI.H.

Referenced by snappySnapDriver::doSnap(), edgeSurface::edgeSurface(), FixedList< T, Size >::Hash< HashT >::Hash(), and NASedgeFormat::read().

Here is the caller graph for this function:

◆ writeEntry() [1/2]

void writeEntry ( Ostream os) const

Write the FixedList as a dictionary entry.

Definition at line 137 of file FixedListIO.C.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash(), and FixedList< Type, 3 >::writeEntry().

Here is the caller graph for this function:

◆ writeEntry() [2/2]

void writeEntry ( const word keyword,
Ostream os 
) const

Write the FixedList as a dictionary entry with keyword.

Definition at line 153 of file FixedListIO.C.

◆ operator[]() [1/2]

T & operator[] ( const label  i)
inline

Return element of FixedList.

Definition at line 257 of file FixedListI.H.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ operator[]() [2/2]

const T & operator[] ( const label  i) const
inline

Return element of constant FixedList.

Definition at line 267 of file FixedListI.H.

◆ operator=() [1/5]

void operator= ( const T  v[Size])
inline

Assignment to array operator. Takes linear time.

Definition at line 277 of file FixedListI.H.

Referenced by FixedList< T, Size >::Hash< HashT >::Hash().

Here is the caller graph for this function:

◆ operator=() [2/5]

void operator= ( const UList< T > &  lst)
inline

Assignment to UList operator. Takes linear time.

Definition at line 286 of file FixedListI.H.

◆ operator=() [3/5]

void operator= ( const SLList< T > &  lst)
inline

Assignment to SLList operator. Takes linear time.

Definition at line 297 of file FixedListI.H.

◆ operator=() [4/5]

void operator= ( std::initializer_list< T lst)
inline

Assignment to an initializer list. Takes linear time.

Definition at line 309 of file FixedListI.H.

◆ operator=() [5/5]

void operator= ( const T t)
inline

Assignment of all entries to the given value.

Definition at line 321 of file FixedListI.H.

◆ begin() [1/2]

Foam::FixedList< T, Size >::iterator begin ( )
inline

Return an iterator to begin traversing the FixedList.

Definition at line 334 of file FixedListI.H.

◆ end() [1/2]

Foam::FixedList< T, Size >::iterator end ( )
inline

Return an iterator to end traversing the FixedList.

Definition at line 358 of file FixedListI.H.

◆ cbegin()

Foam::FixedList< T, Size >::const_iterator cbegin ( ) const
inline

Return const_iterator to begin traversing the constant FixedList.

Definition at line 350 of file FixedListI.H.

Referenced by FixedList< Type, 3 >::operator<().

Here is the caller graph for this function:

◆ cend()

Foam::FixedList< T, Size >::const_iterator cend ( ) const
inline

Return const_iterator to end traversing the constant FixedList.

Definition at line 374 of file FixedListI.H.

Referenced by FixedList< Type, 3 >::operator<().

Here is the caller graph for this function:

◆ begin() [2/2]

Foam::FixedList< T, Size >::const_iterator begin ( ) const
inline

Return const_iterator to begin traversing the constant FixedList.

Definition at line 342 of file FixedListI.H.

◆ end() [2/2]

Foam::FixedList< T, Size >::const_iterator end ( ) const
inline

Return const_iterator to end traversing the constant FixedList.

Definition at line 366 of file FixedListI.H.

◆ rbegin() [1/2]

Foam::FixedList< T, Size >::iterator rbegin ( )
inline

Return reverse_iterator to begin reverse traversing the FixedList.

Definition at line 382 of file FixedListI.H.

◆ rend() [1/2]

Foam::FixedList< T, Size >::iterator rend ( )
inline

Return reverse_iterator to end reverse traversing the FixedList.

Definition at line 406 of file FixedListI.H.

◆ crbegin()

Foam::FixedList< T, Size >::const_iterator crbegin ( ) const
inline

Return const_reverse_iterator to begin reverse traversing FixedList.

Definition at line 398 of file FixedListI.H.

◆ crend()

Foam::FixedList< T, Size >::const_iterator crend ( ) const
inline

Return const_reverse_iterator to end reverse traversing FixedList.

Definition at line 422 of file FixedListI.H.

◆ rbegin() [2/2]

Foam::FixedList< T, Size >::const_iterator rbegin ( ) const
inline

Return const_reverse_iterator to begin reverse traversing FixedList.

Definition at line 390 of file FixedListI.H.

◆ rend() [2/2]

Foam::FixedList< T, Size >::const_iterator rend ( ) const
inline

Return const_reverse_iterator to end reverse traversing FixedList.

Definition at line 414 of file FixedListI.H.

◆ size()

Foam::label size ( ) const
inline

◆ max_size()

Foam::label max_size ( ) const
inline

Return size of the largest possible FixedList.

Definition at line 436 of file FixedListI.H.

◆ empty()

bool empty ( ) const
inline

Return true if the FixedList is empty (ie, size() is zero)

Definition at line 443 of file FixedListI.H.

◆ swap()

void swap ( FixedList< T, Size > &  a)

Swap two FixedLists of the same type in constant time.

Definition at line 32 of file FixedList.C.

◆ operator==()

bool operator== ( const FixedList< T, Size > &  a) const

Equality operation on FixedLists of the same type.

Returns true when the FixedLists are elementwise equal (using FixedList::value_type::operator==). Takes linear time

Definition at line 48 of file FixedList.C.

◆ operator!=()

bool operator!= ( const FixedList< T, Size > &  a) const

The opposite of the equality operation. Takes linear time.

Definition at line 64 of file FixedList.C.

◆ operator<()

bool operator< ( const FixedList< T, Size > &  a) const

Compare two FixedLists lexicographically. Takes linear time.

Definition at line 71 of file FixedList.C.

◆ operator>()

bool operator> ( const FixedList< T, Size > &  a) const

Compare two FixedLists lexicographically. Takes linear time.

Definition at line 102 of file FixedList.C.

◆ operator<=()

bool operator<= ( const FixedList< T, Size > &  a) const

Return true if !(a > b). Takes linear time.

Definition at line 109 of file FixedList.C.

◆ operator>=()

bool operator>= ( const FixedList< T, Size > &  a) const

Return true if !(a < b). Takes linear time.

Definition at line 116 of file FixedList.C.

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
FixedList< T, Size > &   
)
friend

Read List from Istream, discarding contents of existing List.

◆ operator

Ostream& operator ( Ostream ,
const FixedList< T, Size > &   
)
friend

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