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 \*---------------------------------------------------------------------------*/
26 #include "hashedWordList.H"
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 void Foam::hashedWordList::rehash()
35 indices_.insert(List<word>::operator[](i), i);
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
42 Foam::hashedWordList::hashedWordList()
48 Foam::hashedWordList::hashedWordList(const UList<word>& names)
56 Foam::hashedWordList::hashedWordList(const hashedWordList& names)
58 List<word>(static_cast<const UList<word>&>(names))
64 Foam::hashedWordList::hashedWordList(const Xfer< List<word> >& names)
72 Foam::hashedWordList::hashedWordList
82 List<word>::operator[](i) = names[i];
89 Foam::hashedWordList::hashedWordList
96 for (unsigned i = 0; names[i] && *(names[i]); ++i)
101 List<word>::setSize(nNames);
104 List<word>::operator[](i) = names[i];
111 Foam::hashedWordList::hashedWordList(Istream& is)
117 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
119 void Foam::hashedWordList::clear()
126 void Foam::hashedWordList::append(const word& name)
128 const label idx = size();
129 List<word>::append(name);
130 indices_.insert(name, idx);
134 void Foam::hashedWordList::transfer(List<word>& lst)
136 List<word>::transfer(lst);
141 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
143 Foam::Istream& Foam::operator>>(Istream& is, hashedWordList& lst)
145 is >> static_cast<List<word>&>(lst);
152 Foam::Ostream& Foam::operator<<(Ostream& os, const hashedWordList& lst)
154 os << static_cast<const List<word>&>(lst);
159 // ************************************************************************* //