1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
27 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 inline Foam::labelRanges::labelRanges()
35 inline Foam::labelRanges::labelRanges(const label nElem)
41 // * * * * * * * * * * * * * * * * Iterators * * * * * * * * * * * * * * * * //
43 inline Foam::labelRanges::const_iterator::const_iterator()
45 list_(*reinterpret_cast< Foam::labelRanges* >(0)),
51 inline Foam::labelRanges::const_iterator::const_iterator(const labelRanges& lst)
59 // equivalent to end iterator
60 index_ = subIndex_ = -1;
65 inline bool Foam::labelRanges::const_iterator::operator==
67 const const_iterator& iter
72 this->index_ == iter.index_
73 && this->subIndex_ == iter.subIndex_
78 inline bool Foam::labelRanges::const_iterator::operator!=
80 const const_iterator& iter
83 return !(this->operator==(iter));
87 inline Foam::label Foam::labelRanges::const_iterator::operator*()
89 return list_[index_][subIndex_];
93 inline Foam::label Foam::labelRanges::const_iterator::operator()()
95 return list_[index_][subIndex_];
99 inline Foam::labelRanges::const_iterator&
100 Foam::labelRanges::const_iterator::operator++()
102 if (++subIndex_ >= list_[index_].size())
104 // go to next list entry
106 if (++index_ >= list_.size())
108 // equivalent to end iterator
109 index_ = subIndex_ = -1;
117 inline Foam::labelRanges::const_iterator
118 Foam::labelRanges::const_iterator::operator++(int)
120 const_iterator old = *this;
126 inline Foam::labelRanges::const_iterator Foam::labelRanges::cbegin() const
128 return const_iterator(*this);
132 inline const Foam::labelRanges::const_iterator& Foam::labelRanges::cend() const
138 inline Foam::labelRanges::const_iterator Foam::labelRanges::begin() const
140 return const_iterator(*this);
144 inline const Foam::labelRanges::const_iterator& Foam::labelRanges::end() const
150 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
152 inline bool Foam::labelRanges::contains(const label value) const
156 if (this->ParentType::operator[](i).contains(value))
166 // ************************************************************************* //