1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 A container with an integer key attached to any item.
31 The key can useful for sorting.
36 \*---------------------------------------------------------------------------*/
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 // Forward declaration of friend functions and operators
50 template<class T> class Keyed;
52 template<class T> Istream& operator>>(Istream&, Keyed<T>&);
53 template<class T> Ostream& operator<<(Ostream&, const Keyed<T>&);
55 /*---------------------------------------------------------------------------*\
56 Class Keyed Declaration
57 \*---------------------------------------------------------------------------*/
72 //- Add labels to a list of values
73 inline static List<Keyed<T> > createList
79 //- Add labels to a list of values
80 inline static List<Keyed<T> > createList
83 const List<label>& keys
92 //- Construct as a copy of item, with a key
93 inline Keyed(const T& item, const label key=0);
95 //- Construct by transferring the item, with a key
96 inline Keyed(const Xfer<T>& item, const label key=0);
98 //- Construct from Istream
99 inline Keyed(Istream&);
106 //- Return const access to the integer key
107 inline label key() const;
109 //- Return non-const access to the integer key
113 // IOstream Operators
115 friend Istream& operator>> <T>(Istream&, Keyed<T>&);
116 friend Ostream& operator<< <T>(Ostream&, const Keyed<T>&);
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 } // End namespace Foam
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 // ************************************************************************* //