IndirectListBase< T, Addr > Class Template Reference

Base for lists with indirect addressing, templated on the list contents type and the addressing type. Storage for both values and addressing is held outside of the class. More...

Classes

class  const_iterator
 A const iterator for an indirect list. More...
 
class  iterator
 A non-const iterator for an indirect list. More...
 

Public Types

typedef T value_type
 Type of values the list contains. More...
 
typedef Tpointer
 The pointer type for non-const access to value_type items. More...
 
typedef Treference
 The type used for storing into value_type objects. More...
 
typedef label size_type
 The type to represent the size of a UList. More...
 
typedef label difference_type
 The difference between iterator objects. More...
 
typedef Addr addressing_type
 The addressing type (non-stl definition) More...
 

Public Member Functions

 IndirectListBase ()=delete
 No default construct. More...
 
 IndirectListBase (const UList< T > &values, const Addr &addr)
 Store references to the values list and the addressing array. More...
 
label size () const
 The number of elements in the list. More...
 
bool empty () const
 True if the list is empty (ie, size() is zero). More...
 
bool uniform () const
 True if all entries have identical values, and list is non-empty. More...
 
Tfirst ()
 The first element of the list. More...
 
const Tfirst () const
 The first element of the list. More...
 
Tlast ()
 The last element of the list. More...
 
const Tlast () const
 The last element of the list. More...
 
const UList< T > & values () const
 The list of values (without addressing) More...
 
UList< T > & values ()
 The list of values (without addressing) More...
 
const Addr & addressing () const
 The addressing used for the list. More...
 
label find (const T &val, label pos=0) const
 Find index of the first occurrence of the value. More...
 
label rfind (const T &val, label pos=-1) const
 Find index of the last occurrence of the value. More...
 
bool found (const T &val, label pos=0) const
 True if the value if found in the list. More...
 
List< Toperator() () const
 Return the addressed elements as a List. More...
 
Toperator[] (const label i)
 Non-const access to an element in the list. More...
 
const Toperator[] (const label i) const
 Const access to an element in the list. More...
 
void operator= (const T &val)
 Assign all addressed elements to the given value. More...
 
void operator= (const Foam::zero)
 Assignment of all entries to zero. More...
 
void operator= (const UList< T > &rhs)
 Deep copy values from a list of the addressed elements. More...
 
void operator= (const IndirectListBase< T, Addr > &rhs)
 Deep copy values from a list of the addressed elements. More...
 
template<class AnyAddr >
void operator= (const IndirectListBase< T, AnyAddr > &rhs)
 Deep copy values from a list of the addressed elements. More...
 
iterator begin ()
 Return an iterator at begin of list. More...
 
iterator end ()
 Return an iterator at end of list. More...
 
const_iterator cbegin () const
 Return a const_iterator at begin of list. More...
 
const_iterator cend () const
 Return a const_iterator at end of list. More...
 
const_iterator begin () const
 Return a const_iterator at end of list. More...
 
const_iterator end () const
 Return a const_iterator at end of list. More...
 
OstreamwriteList (Ostream &os, const label shortLen=0) const
 Write List, with line-breaks in ASCII when length exceeds shortLen. More...
 

Public Attributes

const typedef Tconst_pointer
 The pointer type for const access to value_type items. More...
 
const typedef Tconst_reference
 The type used for reading from constant value_type objects. More...
 

Protected Member Functions

template<class ListType >
void copyList (const ListType &rhs)
 Deep copy values from the list. More...
 

Detailed Description

template<class T, class Addr>
class Foam::IndirectListBase< T, Addr >

Base for lists with indirect addressing, templated on the list contents type and the addressing type. Storage for both values and addressing is held outside of the class.

Source files

Definition at line 56 of file IndirectListBase.H.

Member Typedef Documentation

◆ value_type

typedef T value_type

Type of values the list contains.

Definition at line 81 of file IndirectListBase.H.

◆ pointer

typedef T* pointer

The pointer type for non-const access to value_type items.

Definition at line 84 of file IndirectListBase.H.

◆ reference

typedef T& reference

The type used for storing into value_type objects.

Definition at line 90 of file IndirectListBase.H.

◆ size_type

typedef label size_type

The type to represent the size of a UList.

Definition at line 96 of file IndirectListBase.H.

◆ difference_type

typedef label difference_type

The difference between iterator objects.

Definition at line 99 of file IndirectListBase.H.

◆ addressing_type

typedef Addr addressing_type

The addressing type (non-stl definition)

Definition at line 105 of file IndirectListBase.H.

Constructor & Destructor Documentation

◆ IndirectListBase() [1/2]

IndirectListBase ( )
delete

No default construct.

◆ IndirectListBase() [2/2]

IndirectListBase ( const UList< T > &  values,
const Addr &  addr 
)
inline

Store references to the values list and the addressing array.

Definition at line 65 of file IndirectListBaseI.H.

Member Function Documentation

◆ copyList()

void copyList ( const ListType &  rhs)
inlineprotected

Deep copy values from the list.

Definition at line 32 of file IndirectListBaseI.H.

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

Here is the call graph for this function:

◆ size()

label size ( ) const
inline

The number of elements in the list.

Definition at line 125 of file IndirectListBase.H.

Referenced by List< substance >::append(), DynamicList< Foam::triPoints >::append(), bitSet::bitSet(), List< substance >::operator=(), DynamicList< Foam::triPoints >::operator=(), PackedList< 2 >::PackedList(), LLTMatrix< Type >::solve(), Foam::ListListOps::subSizes(), and IndirectListBase< T, Addr >::writeList().

Here is the caller graph for this function:

◆ empty()

bool empty ( ) const
inline

True if the list is empty (ie, size() is zero).

Definition at line 131 of file IndirectListBase.H.

◆ uniform()

bool uniform ( ) const
inline

True if all entries have identical values, and list is non-empty.

Definition at line 78 of file IndirectListBaseI.H.

References T.

Referenced by IndirectListBase< T, Addr >::writeList().

Here is the caller graph for this function:

◆ first() [1/2]

T& first ( )
inline

The first element of the list.

Definition at line 140 of file IndirectListBase.H.

◆ first() [2/2]

const T& first ( ) const
inline

The first element of the list.

Definition at line 146 of file IndirectListBase.H.

◆ last() [1/2]

T& last ( )
inline

The last element of the list.

Definition at line 152 of file IndirectListBase.H.

◆ last() [2/2]

const T& last ( ) const
inline

The last element of the list.

Definition at line 158 of file IndirectListBase.H.

◆ values() [1/2]

const UList<T>& values ( ) const
inline

The list of values (without addressing)

Definition at line 164 of file IndirectListBase.H.

◆ values() [2/2]

UList<T>& values ( )
inline

The list of values (without addressing)

Definition at line 170 of file IndirectListBase.H.

◆ addressing()

const Addr& addressing ( ) const
inline

The addressing used for the list.

Definition at line 176 of file IndirectListBase.H.

◆ find()

Foam::label find ( const T val,
label  pos = 0 
) const

Find index of the first occurrence of the value.

Any occurrences before the start pos are ignored. Linear search.

Returns
-1 if not found.

Definition at line 32 of file IndirectListBase.C.

References List_CONST_ACCESS, Foam::pos(), and T.

Here is the call graph for this function:

◆ rfind()

Foam::label rfind ( const T val,
label  pos = -1 
) const

Find index of the last occurrence of the value.

Any occurrences after the end pos are ignored. Linear search.

Returns
-1 if not found.

Definition at line 60 of file IndirectListBase.C.

References List_CONST_ACCESS, Foam::pos(), and T.

Here is the call graph for this function:

◆ found()

bool found ( const T val,
label  pos = 0 
) const
inline

True if the value if found in the list.

Any occurrences before the start pos are ignored. Linear search.

Definition at line 103 of file IndirectListBaseI.H.

References Foam::ListOps::find(), and Foam::pos().

Here is the call graph for this function:

◆ operator()()

Foam::List< T > operator() ( ) const
inline

Return the addressed elements as a List.

Definition at line 116 of file IndirectListBaseI.H.

◆ operator[]() [1/2]

T & operator[] ( const label  i)
inline

Non-const access to an element in the list.

Definition at line 133 of file IndirectListBaseI.H.

◆ operator[]() [2/2]

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

Const access to an element in the list.

Definition at line 141 of file IndirectListBaseI.H.

◆ operator=() [1/5]

void operator= ( const T val)
inline

Assign all addressed elements to the given value.

Definition at line 148 of file IndirectListBaseI.H.

◆ operator=() [2/5]

void operator= ( const Foam::zero  )
inline

Assignment of all entries to zero.

Definition at line 159 of file IndirectListBaseI.H.

References Foam::Zero.

◆ operator=() [3/5]

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

Deep copy values from a list of the addressed elements.

Fatal if list sizes are not identical

Definition at line 171 of file IndirectListBaseI.H.

◆ operator=() [4/5]

void operator= ( const IndirectListBase< T, Addr > &  rhs)
inline

Deep copy values from a list of the addressed elements.

Fatal if list sizes are not identical

Definition at line 181 of file IndirectListBaseI.H.

◆ operator=() [5/5]

void operator= ( const IndirectListBase< T, AnyAddr > &  rhs)
inline

Deep copy values from a list of the addressed elements.

Fatal if list sizes are not identical

Definition at line 192 of file IndirectListBaseI.H.

◆ begin() [1/2]

iterator begin ( )
inline

Return an iterator at begin of list.

Definition at line 332 of file IndirectListBase.H.

References UList< T >::cbegin().

Referenced by bitSet::bitSet(), HashSet< Foam::string >::HashSet(), HashSet< Foam::string >::insert(), bitSet::set(), HashSet< Foam::string >::unset(), and bitSet::unset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ end() [1/2]

iterator end ( )
inline

Return an iterator at end of list.

Definition at line 338 of file IndirectListBase.H.

References UList< T >::cend().

Referenced by bitSet::bitSet(), HashSet< Foam::string >::HashSet(), HashSet< Foam::string >::insert(), bitSet::set(), HashSet< Foam::string >::unset(), and bitSet::unset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cbegin()

const_iterator cbegin ( ) const
inline

Return a const_iterator at begin of list.

Definition at line 347 of file IndirectListBase.H.

References UList< T >::cbegin().

Referenced by IndirectListBase< T, Addr >::begin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cend()

const_iterator cend ( ) const
inline

Return a const_iterator at end of list.

Definition at line 353 of file IndirectListBase.H.

References UList< T >::cend().

Referenced by IndirectListBase< T, Addr >::end().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ begin() [2/2]

const_iterator begin ( ) const
inline

Return a const_iterator at end of list.

Definition at line 359 of file IndirectListBase.H.

References IndirectListBase< T, Addr >::cbegin().

Here is the call graph for this function:

◆ end() [2/2]

const_iterator end ( ) const
inline

Return a const_iterator at end of list.

Definition at line 365 of file IndirectListBase.H.

References IndirectListBase< T, Addr >::cend().

Here is the call graph for this function:

◆ writeList()

Foam::Ostream & writeList ( Ostream os,
const label  shortLen = 0 
) const

Write List, with line-breaks in ASCII when length exceeds shortLen.

Using '0' suppresses line-breaks entirely.

Definition at line 38 of file IndirectListBaseIO.C.

References Ostream::beginRawWrite(), IOstream::check(), Ostream::endRawWrite(), IOstreamOption::format(), FUNCTION_NAME, Foam::nl, IndirectListBase< T, Addr >::size(), T, IndirectListBase< T, Addr >::uniform(), and Ostream::writeRaw().

Referenced by Foam::operator<<().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ const_pointer

const typedef T* const_pointer

The pointer type for const access to value_type items.

Definition at line 87 of file IndirectListBase.H.

◆ const_reference

const typedef T& const_reference

The type used for reading from constant value_type objects.

Definition at line 93 of file IndirectListBase.H.


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