FreeFOAM The Cross-Platform CFD Toolkit
FixedList< T, Size > Class Template Reference

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

#include <OpenFOAM/FixedList.H>


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 71 of file FixedList.H.

+ Inheritance diagram for FixedList< T, Size >:

List of all members.

Classes

class  Hash
 Hashing function class. More...

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Friends

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

Member Typedef Documentation

typedef T value_type

Type of values the FixedList contains.

Definition at line 214 of file FixedList.H.

typedef T& reference

Type that can be used for storing into.

FixedList::value_type objects.

Definition at line 218 of file FixedList.H.

typedef const T& const_reference

Type that can be used for storing into.

constant FixedList::value_type objects

Definition at line 222 of file FixedList.H.

typedef label difference_type

The type that can represent the difference between any two.

FixedList iterator objects.

Definition at line 226 of file FixedList.H.

typedef label size_type

The type that can represent the size of a FixedList.

Definition at line 229 of file FixedList.H.

typedef T* iterator

Random access iterator for traversing FixedList.

Definition at line 235 of file FixedList.H.

typedef const T* const_iterator

Random access iterator for traversing FixedList.

Definition at line 247 of file FixedList.H.

typedef T* reverse_iterator

Reverse iterator for reverse traversal of FixedList.

Definition at line 265 of file FixedList.H.

typedef const T* const_reverse_iterator

Reverse iterator for reverse traversal of constant FixedList.

Definition at line 277 of file FixedList.H.


Constructor & Destructor Documentation

FixedList ( )
inline

Null constructor.

Definition at line 33 of file FixedListI.H.

FixedList ( const T  v[Size])
inline

Construct from components.

Definition at line 38 of file FixedListI.H.

FixedList ( const T t)
inline

Construct from value.

Definition at line 48 of file FixedListI.H.

FixedList ( const UList< T > &  lst)
inline

Construct from UList.

Definition at line 58 of file FixedListI.H.

References UList< T >::size().

FixedList ( const SLList< T > &  lst)
inline

Construct from SLList.

Definition at line 70 of file FixedListI.H.

References SLListBase::begin(), SLListBase::end(), and SLListBase::size().

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

Copy constructor.

Definition at line 88 of file FixedListI.H.

FixedList ( Istream is)

Construct from Istream.

Definition at line 35 of file FixedListIO.C.

References operator>>().


Member Function Documentation

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

Return a null FixedList.

Definition at line 108 of file FixedListI.H.

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

Clone.

Definition at line 99 of file FixedListI.H.

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 115 of file FixedListI.H.

Referenced by triSurfaceTools::calcInterpolationWeights(), and PatchTools::sortedEdgeFaces().

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 122 of file FixedListI.H.

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 196 of file FixedListI.H.

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 204 of file FixedListI.H.

Referenced by Foam::operator>>().

void checkStart ( const label  start) const
inline

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

Definition at line 130 of file FixedListI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorIn.

void checkSize ( const label  size) const
inline

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

Definition at line 143 of file FixedListI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorIn.

Referenced by Foam::operator>>().

void checkIndex ( const label  i) const
inline

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

Definition at line 157 of file FixedListI.H.

References Foam::abort(), Foam::FatalError, and FatalErrorIn.

void resize ( const label  s)
inline

Dummy resize function.

needed to make FixedList consistent with List

Definition at line 169 of file FixedListI.H.

void setSize ( const label  s)
inline

Dummy setSize function.

needed to make FixedList consistent with List

Definition at line 177 of file FixedListI.H.

Referenced by triSurfaceTools::collapseEdges(), triSurfaceTools::mergePoints(), and sampledTriSurfaceMesh::update().

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

Copy (not transfer) the argument contents.

needed to make FixedList consistent with List

Definition at line 185 of file FixedListI.H.

Referenced by edgeSurface::edgeSurface().

void writeEntry ( Ostream os) const

Write the FixedList as a dictionary entry.

Definition at line 137 of file FixedListIO.C.

void writeEntry ( const word keyword,
Ostream os 
) const

Write the FixedList as a dictionary entry with keyword.

Definition at line 157 of file FixedListIO.C.

References Foam::endl(), and Ostream::writeKeyword().

T & operator[] ( const label  i)
inline

Return element of FixedList.

Definition at line 214 of file FixedListI.H.

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

Return element of constant FixedList.

Definition at line 225 of file FixedListI.H.

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

Assignment from array operator. Takes linear time.

Definition at line 235 of file FixedListI.H.

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

Assignment from UList operator. Takes linear time.

Definition at line 244 of file FixedListI.H.

References UList< T >::size().

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

Assignment from SLList operator. Takes linear time.

Definition at line 255 of file FixedListI.H.

References SLListBase::begin(), SLListBase::end(), and SLListBase::size().

void operator= ( const T t)
inline

Assignment of all entries to the given value.

Definition at line 272 of file FixedListI.H.

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

Return an iterator to begin traversing the FixedList.

Definition at line 285 of file FixedListI.H.

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

Return an iterator to end traversing the FixedList.

Reimplemented in edge.

Definition at line 309 of file FixedListI.H.

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

Return const_iterator to begin traversing the constant FixedList.

Definition at line 301 of file FixedListI.H.

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

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

Return const_iterator to end traversing the constant FixedList.

Definition at line 325 of file FixedListI.H.

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

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

Return const_iterator to begin traversing the constant FixedList.

Definition at line 293 of file FixedListI.H.

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

Return const_iterator to end traversing the constant FixedList.

Reimplemented in edge.

Definition at line 317 of file FixedListI.H.

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

Return reverse_iterator to begin reverse traversing the FixedList.

Definition at line 333 of file FixedListI.H.

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

Return reverse_iterator to end reverse traversing the FixedList.

Definition at line 357 of file FixedListI.H.

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

Return const_reverse_iterator to begin reverse traversing FixedList.

Definition at line 349 of file FixedListI.H.

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

Return const_reverse_iterator to end reverse traversing FixedList.

Definition at line 373 of file FixedListI.H.

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

Return const_reverse_iterator to begin reverse traversing FixedList.

Definition at line 341 of file FixedListI.H.

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

Return const_reverse_iterator to end reverse traversing FixedList.

Definition at line 365 of file FixedListI.H.

Foam::label size ( ) const
inline

Return the number of elements in the FixedList.

Definition at line 380 of file FixedListI.H.

Referenced by indexedOctree< Type >::print().

Foam::label max_size ( ) const
inline

Return size of the largest possible FixedList.

Definition at line 387 of file FixedListI.H.

bool empty ( ) const
inline

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

Definition at line 394 of file FixedListI.H.

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

Swap two FixedLists of the same type in constant time.

Definition at line 34 of file FixedList.C.

References List_ACCESS, List_ELEM, List_END_FOR_ALL, List_FOR_ALL, and T.

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 50 of file FixedList.C.

References equal(), List_CONST_ACCESS, List_ELEM, List_END_FOR_ALL, List_FOR_ALL, and T.

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

The opposite of the equality operation. Takes linear time.

Definition at line 66 of file FixedList.C.

References Foam::operator==().

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

Compare two FixedLists lexicographically. Takes linear time.

Definition at line 73 of file FixedList.C.

References FixedList< T, Size >::cbegin(), and FixedList< T, Size >::cend().

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

Compare two FixedLists lexicographically. Takes linear time.

Definition at line 104 of file FixedList.C.

References FixedList< T, Size >::operator.

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

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

Definition at line 111 of file FixedList.C.

References Foam::operator>().

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

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

Definition at line 118 of file FixedList.C.

References Foam::operator<().


Friends And Related Function Documentation

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

Read List from Istream, discarding contents of existing List.

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

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