Go to the documentation of this file.
54 #include <initializer_list>
56 #include <type_traits>
66 template<
class T,
unsigned N>
class FixedList;
67 template<
class T>
class UList;
69 template<
class T,
unsigned N>
70 Istream&
operator>>(Istream& is, FixedList<T, N>& list);
72 template<
class T,
unsigned N>
73 Ostream&
operator<<(Ostream&
os,
const FixedList<T, N>& list);
80 template<
class T,
unsigned N>
86 "Size must be positive (non-zero) and fit as a signed int value"
169 inline FixedList(std::initializer_list<T> list);
175 template<
unsigned AnyNum>
204 inline const T*
cdata() const noexcept;
207 inline
T*
data() noexcept;
221 inline
T&
first() noexcept;
224 inline const
T&
first() const noexcept;
227 inline
T&
last() noexcept;
230 inline const
T&
last() const noexcept;
234 inline static std::streamsize
size_bytes() noexcept;
242 inline label
fcIndex(const label i) const;
245 inline const
T&
fcValue(const label i) const;
252 inline label
rcIndex(const label i) const;
255 inline const
T&
rcValue(const label i) const;
264 inline
void checkStart(const label start) const;
282 label
find(const
T& val, label
pos = 0) const;
288 label
rfind(const
T& val, label
pos = -1) const;
293 inline
bool found(const
T& val, label
pos = 0) const;
299 inline
void resize(const label
n);
308 inline void fill(
const T& val);
348 inline void operator=(std::initializer_list<T> list);
414 static constexpr
bool empty() noexcept {
return !
N; }
417 static constexpr label
size() noexcept {
return N; }
420 static constexpr
unsigned max_size() noexcept {
return N; }
477 inline unsigned operator()
485 return Foam::Hasher(obj.cdata(), obj.size_bytes(), seed);
489 for (
const T& val : obj)
491 seed = op(val, seed);
499 template<
class Unused=
bool>
510 template<
class T,
unsigned N>
514 template<
class T,
unsigned N>
518 template<
class T,
unsigned N>
522 template<
class T,
unsigned N>
530 template<
class T,
unsigned N>
540 template<
class T,
unsigned N>
543 return list.readList(is);
549 template<
class T,
unsigned N>
void resize_nocopy(const label n)
Dummy function, to make FixedList consistent with List.
const T & fcValue(const label i) const
Return forward circular value (ie, next value in the list)
autoPtr< FixedList< T, N > > clone() const
Clone.
Istream & readList(Istream &is)
Read from Istream, discarding contents of existing List.
void Swap(DynamicList< T, SizeMinA > &a, DynamicList< T, SizeMinB > &b)
A class for handling words, derived from Foam::string.
void writeEntry(Ostream &os) const
Write the FixedList with its compound type.
iterator end() noexcept
Return an iterator to end traversing the FixedList.
void swapLast(const label i)
Swap element with the last element.
const_iterator cend() const noexcept
Return const_iterator to end traversing the constant FixedList.
const_reverse_iterator crbegin() const
Return const_reverse_iterator to begin reverse traversing FixedList.
void checkIndex(const label i) const
Check index is within valid range [0,N)
void swap(FixedList< T, N > &other)
Swap lists by swapping the content of the individual list elements.
unsigned Hasher(const void *data, size_t len, unsigned seed=0)
Bob Jenkins's 96-bit mixer hashing function (lookup3)
void transfer(FixedList< T, N > &list)
const char * cdata_bytes() const noexcept
Return pointer to the underlying array serving as data storage,.
T & last() noexcept
The last element of the list, position [N-1].
bool operator<=(const FixedList< T, N > &list) const
Return true if !(a > b). Takes linear time.
const typedef T * const_pointer
The pointer type for const access to value_type items.
static constexpr unsigned max_size() noexcept
The dimensioned size (template parameter N) of the FixedList.
const T * cdata() const noexcept
Return pointer to the underlying array serving as data storage.
void checkStart(const label start) const
Check start is within valid range [0,size)
T * pointer
The pointer type for non-const access to value_type items.
static std::streamsize size_bytes() noexcept
Number of contiguous bytes for the list data,.
static constexpr label size() noexcept
Return the number of elements in the FixedList.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
label size_type
The type to represent the size of a FixedList.
Istream & operator>>(Istream &, directionInfo &)
void operator=(const T list[N])
Assignment to array operator. Takes linear time.
bool operator!=(const FixedList< T, N > &list) const
The opposite of the equality operation. Takes linear time.
void resize(const label n)
Dummy function, to make FixedList consistent with List.
void fill(const T &val)
Assign all entries to the given value.
label difference_type
The difference between iterator objects.
label fcIndex(const label i) const
A template class to specify if a data type is composed solely of Foam::label elements.
T & reference
The type used for storing into value_type objects.
Swap arguments as per std::swap, but in Foam namespace.
T & first() noexcept
The first element of the list, position [0].
Template class for non-intrusive linked lists.
iterator begin() noexcept
Return an iterator to begin traversing the FixedList.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Hash function class. The default definition is for primitives. Non-primitives used to hash entries on...
bool operator==(const FixedList< T, N > &list) const
Equality operation on FixedLists of the same type.
Forward declarations for SLList.
bool operator<(const FixedList< T, N > &list) const
Compare two FixedLists lexicographically. Takes linear time.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
label rfind(const T &val, label pos=-1) const
Find index of the last occurrence of the value.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
static std::streamsize byteSize()
T * iterator
Random access iterator for traversing FixedList.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
Number of items before requiring line-breaks in the list output.
const T & rcValue(const label i) const
Return reverse circular value (ie, previous value in the list)
const typedef T & const_reference
The type used for reading from constant value_type objects.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
const_reverse_iterator crend() const
Return const_reverse_iterator to end reverse traversing FixedList.
void moveFirst(const label i)
Move element to the first position.
OBJstream os(runTime.globalPath()/outputName)
T value_type
The value type the FixedList contains.
reverse_iterator rend()
Return reverse_iterator to end reverse traversing the FixedList.
void setSize(const label n)
Dummy function, to make FixedList consistent with List.
T & operator[](const label i)
Return element of FixedList.
A template class to specify if a data type is composed solely of Foam::scalar elements.
std::reverse_iterator< const_iterator > const_reverse_iterator
Reverse iterator (const access)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
char * data_bytes() noexcept
Return pointer to the underlying array serving as data storage,.
bool operator>(const FixedList< T, N > &list) const
Compare two FixedLists lexicographically. Takes linear time.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write List, with line-breaks in ASCII when length exceeds shortLen.
bool operator>=(const FixedList< T, N > &list) const
Return true if !(a < b). Takes linear time.
Deprecated(2021-04) hashing functor. Use hasher()
void swapFirst(const label i)
Swap element with the first element.
A 1D vector of objects of type <T> with a fixed length <N>.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
FOAM_DEPRECATED_FOR(2021-04, "hasher()") Hash()
FixedList()=default
Default construct.
const_iterator cbegin() const noexcept
Return const_iterator to begin traversing the constant FixedList.
Hashing functor for FixedList.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const Vector< label > N(dict.get< Vector< label >>("N"))
const typedef T * const_iterator
Random access iterator for traversing FixedList.
static constexpr bool empty() noexcept
Always false since zero-sized FixedList is compile-time disabled.
bool found(const T &val, label pos=0) const
True if the value if found in the list.
void checkSize(const label size) const
Check size is identical to template parameter N.
std::reverse_iterator< iterator > reverse_iterator
Reverse iterator (non-const access)
label rcIndex(const label i) const
Database for solution data, solver performance and other reduced data.
reverse_iterator rbegin()
Return reverse_iterator to begin reverse traversing the FixedList.
A template class to specify that a data type can be considered as being contiguous in memory.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
void moveLast(const label i)
Move element to the last position.
dimensionedScalar pos(const dimensionedScalar &ds)