/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | cfMesh: A library for mesh generation \\ / O peration | \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com) \\/ M anipulation | Copyright (C) Creative Fields, Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . Class Foam::graphRow Description This class provides non-const access to a row of a graph SourceFiles graphRowI.H \*---------------------------------------------------------------------------*/ #ifndef graphRow_H #define graphRow_H // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { class Ostream; template class graphRow; template class graphConstRow; template Ostream& operator<<(Ostream&, const graphRow&); /*---------------------------------------------------------------------------*\ Class graphRow Declaration \*---------------------------------------------------------------------------*/ template class graphRow { // Private data //- Reference to the graph graphType& data_; //- Row number const label rowI_; // Allow copy construct from non-const to const version friend class graphConstRow; public: // Constructors //- Construct from graph and row number inline graphRow(graphType& g, const label i); //- Copy contructor inline graphRow(const graphRow& r); //- Destructor ~graphRow() = default; // Member Functions //- Return the number of elements in the row inline label size() const; //- Reset the number of elements in the row inline void setSize(const label s); //- Clear the row inline void clear(); // Member Operators //- Append an element to the given row inline void append(const label); //- Append an element to the given row if it does not exist there inline void appendIfNotIn(const label); //- check if the element is in the given row (takes linear time) inline bool contains(const label e) const; inline bool found(const label e) const; inline label find(const label e) const; //- set and get operators inline label operator[](const label) const; inline label& operator[](const label); //- Copy contents from another row inline void operator=(const graphRow& rhs); //- Copy contents from a list template inline void operator=(const ListType& rhs); // IOstream operators //- Write graphRow contents to Ostream. friend Ostream& operator<< ( Ostream& os, const graphRow& r ); }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "graphRowI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif // ************************************************************************* //