Forward compatibility: flex
[foam-extend-3.2.git] / src / mesh / cfMesh / utilities / helperClasses / parallelHelpers / labelledPointScalar / refLabelledPointScalar.H
blobe6665b4a3e7444c1be0a9130006975d901b090bd
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | cfMesh: A library for mesh generation
4    \\    /   O peration     |
5     \\  /    A nd           | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6      \\/     M anipulation  | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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/>.
24 Class
25     refLabelledPointScalar
27 Description
28     A class containing a label and labelledPointScalar. It is used for
29     exchanging data over processors
31 SourceFiles
33 \*---------------------------------------------------------------------------*/
35 #ifndef refLabelledPointScalar_H
36 #define refLabelledPointScalar_H
38 #include "labelledPointScalar.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 namespace Foam
45 /*---------------------------------------------------------------------------*\
46                     Class refLabelledPointScalar Declaration
47 \*---------------------------------------------------------------------------*/
49 class refLabelledPointScalar
51     // Private data
52         //- point label
53         label pLabel_;
55         //- labelledPointScalar
56         labelledPointScalar lps_;
58     public:
60     // Constructors
61         //- Null construct
62         refLabelledPointScalar()
63         :
64             pLabel_(-1),
65             lps_()
66         {}
68         //- Construct from label and labelledPointScalar
69         refLabelledPointScalar(const label pl, const labelledPointScalar& lps)
70         :
71             pLabel_(pl),
72             lps_(lps)
73         {}
75     // Destructor
76         ~refLabelledPointScalar()
77         {}
79     // Member functions
80         //- return object label
81         inline label objectLabel() const
82         {
83             return pLabel_;
84         }
86         //- return labelledPointScalar
87         inline const labelledPointScalar& lps() const
88         {
89             return lps_;
90         }
92     // Member operators
94         inline void operator=(const refLabelledPointScalar& lps)
95         {
96             pLabel_ = lps.pLabel_;
97             lps_ = lps.lps_;
98         }
100         inline bool operator==(const refLabelledPointScalar& lps) const
101         {
102             if( pLabel_ == lps.pLabel_ )
103                 return true;
105             return false;
106         }
108         inline bool operator!=(const refLabelledPointScalar& lps) const
109         {
110             return !this->operator==(lps);
111         }
113     // Friend operators
114         friend Ostream& operator<<(Ostream& os, const refLabelledPointScalar& lps)
115         {
116             os << token::BEGIN_LIST;
117             os << lps.pLabel_ << token::SPACE;
118             os << lps.lps_ << token::END_LIST;
120             // Check state of Ostream
121             os.check("operator<<(Ostream&, const labelledPointScalarS&");
123             return os;
124         }
126         friend Istream& operator>>(Istream& is, refLabelledPointScalar& lps)
127         {
128             // Read beginning of refLabelledPointScalar
129             is.readBegin("refLabelledPointScalar");
131             is >> lps.pLabel_;
132             is >> lps.lps_;
134             // Read end of refLabelledPointScalar
135             is.readEnd("refLabelledPointScalar");
137             // Check state of Istream
138             is.check("operator>>(Istream&, refLabelledPointScalar");
140             return is;
141         }
144 //- Specify data associated with refLabelledPointScalar type is contiguous
145 template<>
146 inline bool contiguous<refLabelledPointScalar>() {return true;}
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 } // End namespace Foam
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 #endif
156 // ************************************************************************* //