70 template<
class T>
class List;
71 template<
class T>
class SubList;
72 template<
class T>
class UList;
73 template<
class T>
class IndirectList;
74 template<
class T>
class UIndirectList;
75 template<
class T,
class Addr>
class IndirectListBase;
78 template<
class T>
Ostream& operator<<(Ostream&, const UList<T>&);
178 friend class List<
T>;
190 return NullObjectRef<UList<T>>();
222 bool operator()(
const label a,
const label
b)
const 232 UList(
const UList<T>&) =
default;
257 inline const
T&
fcValue(const label i) const;
263 inline const
T&
rcValue(const label i) const;
288 inline const
T&
front() const;
294 inline const
T&
back() const;
308 inline
void checkStart(const label start) const;
314 inline
void checkRange(const label start, const label len) const;
326 inline
bool contains(const
T& val) const;
333 inline
bool contains(const
T& val, label
pos, label len = -1) const;
338 label
find(const
T& val) const;
345 label
find(const
T& val, label
pos, label len = -1) const;
351 label
rfind(const
T& val, label
pos = -1) const;
410 inline
T& operator[](const label i);
415 inline const
T& operator[](const label i) const;
418 inline operator const
Foam::
List<
T>&() const;
421 inline
void operator=(const
T& val);
516 bool operator<(const UList<T>& list)
const;
519 bool operator>(
const UList<T>& list)
const;
522 bool operator<=(const UList<T>& list)
const;
535 void writeEntry(
const word& keyword, Ostream&
os)
const;
539 Ostream&
writeList(Ostream&
os,
const label shortLen=0)
const;
545 friend Istream&
operator>> <
T>
557 template<
class TypeT = T>
558 typename std::enable_if<std::is_same<bool, TypeT>::value,
bool>
::type 559 inline test(
const label i)
const 561 return (i >= 0 && i < size_ && v_[i]);
567 template<
class TypeT = T>
568 typename std::enable_if<std::is_same<bool, TypeT>::value,
bool>
::type 569 inline get(
const label i)
const 571 return (i >= 0 && i < size_ && v_[i]);
578 template<
class TypeT = T>
579 typename std::enable_if<std::is_same<bool, TypeT>::value,
bool>
::type 580 inline unset(
const label i)
582 if (i >= 0 && i < size_ && v_[i])
596 inline unsigned operator()
602 if (is_contiguous<T>::value)
604 return Foam::Hasher(obj.cdata(), obj.size_bytes(), seed);
608 for (
const T& val : obj)
610 seed = op(val, seed);
618 template<
class Unused=
bool>
619 struct Hash :
UList<T>::hasher
641 const T&
last()
const {
return back(); };
644 bool found(
const T& val, label
pos = 0)
const 666 Istream&
operator>>(Istream& is, UList<T>& list)
668 return list.readList(is);
675 Ostream& operator<<(Ostream& os, const UList<T>& list)
682 Ostream& operator<<(Ostream& os, const std::vector<T>& list);
700 template<
class T,
class Compare>
708 template<
class T,
class Compare>
744 bool operator()(
const T& obj)
const {
return obj.empty(); }
752 label
operator()(
const T& obj)
const {
return obj.size(); }
void swap(UList< T > &list) noexcept
Swap content with another UList of the same type in constant time.
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access)
const_iterator cend() const noexcept
Return const_iterator to end traversing the constant UList.
T * pointer
The pointer type for non-const access to value_type items.
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type unset(const label i)
Unset the bool entry at specified position, always false for out-of-range access. ...
FOAM_DEPRECATED_FOR(2021-04, "hasher()") Hash()
void swapLast(const label i)
Swap element with the last element. Fatal on an empty list.
label operator()(const T &obj) const
void swapFirst(const label i)
Swap element with the first element. Fatal on an empty list.
Number of items before requiring line-breaks in the list output.
bool operator()(const label a, const label b) const
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing the UList.
A range or interval of labels defined by a start and a size.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
const T * const_pointer
The pointer type for const access to value_type items.
bool empty() const noexcept
True if List is empty (ie, size() is zero)
T * data() noexcept
Return pointer to the underlying array serving as data storage.
T & front()
Access first element of the list, position [0].
T & first()
Access first element of the list, position [0].
Object access operator or list access operator (default is pass-through)
bool found(const T &val, label pos=0) const
Same as contains()
T * iterator
Random access iterator for traversing a UList.
void stableSort(UList< T > &list)
Stable sort the list.
labelRange validateRange(const labelRange &requestedRange) const
Return a validated (start,size) subset range, which means that it always addresses a valid section of...
void setAddressableSize(const label n) noexcept
Set addressed size to be inconsistent with allocated storage.
Base for lists with indirect addressing, templated on the list contents type and the addressing type...
UList< bool > boolUList
A UList of bools.
bool contains(const T &val) const
True if the value is contained in the list.
static bool less(const vector &x, const vector &y)
To compare normals.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
Istream & readList(Istream &is)
Read List contents from Istream.
UList< label > labelUList
A UList of labels.
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing the UList.
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
label difference_type
The difference between iterator objects.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the UList.
UList< T > & operator=(const UList< T > &)=delete
No copy assignment (default: shallow copy)
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the UList.
dimensionedScalar pos(const dimensionedScalar &ds)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
A List obtained as a section of another List.
const UList< T > & values
void fill_uniform(const T &val)
Assign all entries to the given value.
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list)
label capacity() const noexcept
Size of the underlying storage.
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
void sort(UList< T > &list)
Sort the list.
Istream & operator>>(Istream &, directionInfo &)
bool operator==(const UList< T > &list) const
Equality operation on ULists of the same type.
bool operator!=(const UList< T > &list) const
The opposite of the equality operation. Takes linear time.
label rfind(const T &val, label pos=-1) const
Find index of the last occurrence of the value.
void reverse(UList< T > &list, const label n)
Reverse the first n elements of the list.
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator (non-const access)
bool operator()(const T &obj) const
iterator begin() noexcept
Return an iterator to begin traversing the UList.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label find(const T &val) const
Find index of the first occurrence of the value.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
UList< char > charUList
A UList of chars.
label size() const noexcept
The number of elements in the container.
const UList< T > & values
OBJstream os(runTime.globalPath()/outputName)
T & reference
The type used for storing into value_type objects.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type test(const label i) const
Test bool value at specified position, always false for out-of-range access.
static constexpr label max_size() noexcept
The size of the largest possible UList.
void moveLast(const label i)
Move element to the last position.
T & last()
Access last element of the list, position [size()-1].
label size_type
The type to represent the size of a UList.
void checkRange(const label start, const label len) const
Check that start and length define a valid range.
unsigned Hasher(const void *data, size_t len, unsigned seed=0)
Bob Jenkins's 96-bit mixer hashing function (lookup3)
constexpr UList() noexcept
Default construct, zero-sized and nullptr.
const T * const_iterator
Random access iterator for traversing a UList.
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
std::streamsize byteSize() const
Number of contiguous bytes for the List data, runtime FatalError if type is not contiguous.
bool operator()(const label a, const label b) const
void shallowCopy(T *__restrict__ ptr, const label len) noexcept
Copy the pointer and size.
greater(const UList< T > &list)
static const UList< T > & null() noexcept
Return a null UList (reference to a nullObject). Behaves like an empty UList.
T & back()
Access last element of the list, position [size()-1].
Includes some standard C++ headers, defines global macros and templates used in multiple places by Op...
const T & const_reference
The type used for reading from constant value_type objects.
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.
void checkSize(const label size) const
Check size is within valid range [0,size].
void writeEntry(Ostream &os) const
Write the UList with its compound type.
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
void deepCopy(const UList< T > &list)
Copy elements of the given UList. Sizes must match!
iterator end() noexcept
Return an iterator to end traversing the UList.
label rcIndex(const label i) const noexcept
The reverse circular index. The previous index in the list which returns to the last at the beginning...
void shuffle(UList< T > &list)
Randomise the list order.
void moveFirst(const label i)
Move element to the first position.
void checkStart(const label start) const
Check start is within valid range [0,size)
const T & operator()(const T &obj) const
void checkIndex(const label i) const
Check index is within valid range [0,size)
T value_type
The value type the list contains.
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)
std::streamsize size_bytes() const noexcept
Number of contiguous bytes for the List data.
bool operator>=(const UList< T > &list) const
Return true if !(a < b). Takes linear time.
less(const UList< T > &list)
bool operator>(const UList< T > &list) const
Compare two ULists lexicographically. Takes linear time.