1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh 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 cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
28 This class provides access to a row of a graph
33 \*---------------------------------------------------------------------------*/
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 template<class graphType> class graphRow;
50 template<class graphType>
51 Ostream& operator<<(Ostream&, const graphRow<graphType>&);
53 /*---------------------------------------------------------------------------*\
54 Class graphRow Declaration
55 \*---------------------------------------------------------------------------*/
57 template<class graphType>
61 //- reference to the graph
67 // Private member functions
69 inline void checkIndex(const label i) const;
75 //- Construct from graph and row number
76 inline graphRow(graphType&, const label);
79 inline graphRow(const graphRow<graphType>&);
87 //- Returns the number of rows
88 inline label size() const;
90 //- Reset the number of rows
91 inline void setSize(const label size);
98 //- Append an element to the given row
99 inline void append(const label);
101 //- Append an element to the given row if it does not exist there
102 inline void appendIfNotIn(const label);
104 //- check if the element is in the given row (takes linear time)
105 inline bool contains(const label e) const;
106 inline label containsAtPosition(const label e) const;
108 //- set and get operators
109 inline label operator[](const label) const;
110 inline label& operator[](const label);
112 //- Assignment operator
113 inline void operator=(const graphRow<graphType>&);
114 template<class listType>
115 inline void operator=(const listType&);
117 // IOstream operators
119 // Write graphRow to Ostream.
120 friend Ostream& operator<< <graphType>
123 const graphRow<graphType>&
126 //- Read from Istream, discarding contents of existing graphRow.
127 /* friend Istream& operator>> <T, width>
135 typedef const graphRow<const VRWGraph> constRow;
136 typedef graphRow<VRWGraph> row;
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 } // End namespace Foam
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 #include "graphRowI.H"
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 // ************************************************************************* //