1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A container with an integer key attached to any item.
30 The key can useful for sorting.
35 \*---------------------------------------------------------------------------*/
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 // Forward declaration of friend functions and operators
49 template<class T> class Keyed;
51 template<class T> Istream& operator>>(Istream&, Keyed<T>&);
52 template<class T> Ostream& operator<<(Ostream&, const Keyed<T>&);
54 /*---------------------------------------------------------------------------*\
55 Class Keyed Declaration
56 \*---------------------------------------------------------------------------*/
71 //- Add labels to a list of values
72 inline static List<Keyed<T> > createList
78 //- Add labels to a list of values
79 inline static List<Keyed<T> > createList
82 const List<label>& keys
91 //- Construct as a copy of item, with a key
92 inline Keyed(const T& item, const label key=0);
94 //- Construct by transferring the item, with a key
95 inline Keyed(const Xfer<T>& item, const label key=0);
97 //- Construct from Istream
98 inline Keyed(Istream&);
105 //- Return const access to the integer key
106 inline label key() const;
108 //- Return non-const access to the integer key
112 // IOstream Operators
114 friend Istream& operator>> <T>(Istream&, Keyed<T>&);
115 friend Ostream& operator<< <T>(Ostream&, const Keyed<T>&);
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 } // End namespace Foam
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 // ************************************************************************* //