nil.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::nil
26 
27 Description
28  A zero-sized class without any storage. Used, for example, in HashSet.
29 
30  Note:
31  A zero-sized class actually does still require at least 1 byte storage.
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef nil_H
36 #define nil_H
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace Foam
41 {
42 
43 // Forward declaration of classes
44 class Istream;
45 class Ostream;
46 
47 // Forward declaration of friend functions and operators
48 
49 class nil;
50 
51 Istream& operator>>(Istream&, nil&);
52 Ostream& operator<<(Ostream&, const nil&);
53 
54 
55 /*---------------------------------------------------------------------------*\
56  Class nil Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class nil
60 {
61 
62 public:
63 
64  // Constructors
65 
66  //- Construct null
67  nil()
68  {}
69 
70  //- Construct from Istream
71  nil(Istream&)
72  {}
73 
74 
75  // IOstream Operators
76 
77  friend Istream& operator>>(Istream& is, nil&)
78  {
79  return is;
80  }
81 
82  friend Ostream& operator<<(Ostream& os, const nil&)
83  {
84  return os;
85  }
86 };
87 
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 } // End namespace Foam
92 
93 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94 
95 #endif
96 
97 // ************************************************************************* //
friend Ostream & operator<<(Ostream &os, const nil &)
Definition: nil.H:81
friend Istream & operator>>(Istream &is, nil &)
Definition: nil.H:76
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Istream & operator>>(Istream &, directionInfo &)
nil()
Construct null.
Definition: nil.H:66
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Ostream & operator<<(Ostream &, const ensightPart &)
Namespace for OpenFOAM.
A zero-sized class without any storage. Used, for example, in HashSet.
Definition: nil.H:58