42 #ifndef Foam_IndirectListBase_H 43 #define Foam_IndirectListBase_H 56 template<
class T,
class Addr>
73 template<
class ListType>
74 inline void copyList(
const ListType& rhs);
106 class const_iterator;
145 inline const T&
front()
const;
151 inline const T&
back()
const;
162 inline label
rcIndex(
const label i)
const;
165 inline const T&
fcValue(
const label i)
const;
171 inline const T&
rcValue(
const label i)
const;
187 inline bool contains(
const T& val, label
pos = 0, label len = -1)
const;
194 label
find(
const T& val, label
pos = 0, label len = -1)
const;
200 label
rfind(
const T& val, label
pos = -1)
const;
230 template<
class AnyAddr>
242 typename addressing_type::const_iterator iter_;
255 typename addressing_type::const_iterator addrIter
272 return (iter_ == rhs.iter_);
277 return (iter_ != rhs.iter_);
288 typename addressing_type::const_iterator iter_;
300 const UList<T>&
list,
301 typename addressing_type::const_iterator addrIter
304 begin_(
list.cdata()),
318 return (iter_ == rhs.iter_);
323 return (iter_ != rhs.iter_);
390 bool found(
const T& val, label
pos = 0)
const 401 template<
class T,
class Addr>
402 Ostream& operator<<(Ostream& os, const IndirectListBase<T, Addr>& list)
label difference_type
The difference between iterator objects.
bool found(const T &val, label pos=0) const
Same as contains()
T & reference
The type used for storing into value_type objects.
const UList< T > & values() const noexcept
The list of values (without addressing)
T & last()
Access last element of the list, position [size()-1].
Addr addressing_type
The addressing type (non-stl definition)
Number of items before requiring line-breaks in the list output.
label rfind(const T &val, label pos=-1) const
Find index of the last occurrence of the value.
label find(const T &val, label pos=0, label len=-1) const
Find index of the first occurrence of the value.
bool operator==(const const_iterator &rhs) const
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const T & back() const
The last element of the list.
std::forward_iterator_tag iterator_category
void operator=(const T &val)
Assign all addressed elements to the given value.
reference operator*() const
const_iterator cbegin() const
Return a const_iterator at begin of list.
iterator(UList< T > &list, typename addressing_type::const_iterator addrIter)
T & first()
Access first element of the list, position [0].
Base for lists with indirect addressing, templated on the list contents type and the addressing type...
IndirectListBase()=delete
No default construct.
bool uniform() const
True if all entries have identical values, and list is non-empty.
T & operator[](const label i)
Non-const access to an element in the list.
bool operator!=(const const_iterator &rhs) const
dimensionedScalar pos(const dimensionedScalar &ds)
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
const_iterator cend() const
Return a const_iterator at end of list.
const_iterator(const UList< T > &list, typename addressing_type::const_iterator addrIter)
A const iterator for an indirect list.
bool contains(const T &val, label pos=0, label len=-1) const
Is the value contained in the list?
const T * const_pointer
The pointer type for const access to value_type items.
label size() const noexcept
The number of elements in the list.
bool operator!=(const iterator &rhs) const
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const T & front() const
The first element of the list.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
const Addr & addressing() const noexcept
The addressing used for the list.
const_iterator & operator++()
List< T > operator()() const
Return the addressed elements as a List.
OBJstream os(runTime.globalPath()/outputName)
iterator begin()
Return an iterator at begin of list.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
bool empty() const noexcept
True if the list is empty (ie, size() is zero).
reference operator*() const
iterator end()
Return an iterator at end of list.
label size_type
The type to represent the size of a UList.
label rcIndex(const label i) const
The reverse circular index. The previous index in the list which returns to the last at the beginning...
const T & const_reference
The type used for reading from constant value_type objects.
T value_type
Type of values the list contains.
A non-const iterator for an indirect list.
label fcIndex(const label i) const
The forward circular index. The next index in the list which returns to the first at the end of the l...
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing the constant UList.
T * pointer
The pointer type for non-const access to value_type items.
void copyList(const ListType &rhs)
Deep copy values from the list.
bool operator==(const iterator &rhs) const
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list)
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
std::forward_iterator_tag iterator_category
List< T > list() const
Return the addressed elements as a List.
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)