pTraits.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9  Copyright (C) 2020-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::pTraits
29 
30 Description
31  A traits class, which is primarily used for primitives.
32 
33  All primitives need a specialised version of this class. The
34  specialised version will normally also require a conversion
35  method.
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef Foam_pTraits_H
40 #define Foam_pTraits_H
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward Declarations
48 class Istream;
49 class Ostream;
50 
51 /*---------------------------------------------------------------------------*\
52  Class pTraits Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 // The base implementation is a pass-through to the base class.
56 // Accordingly it inherits all static methods (eg, typeName etc).
57 template<class Base>
58 class pTraits
59 :
60  public Base
61 {
62 public:
63 
64  // Constructors
65 
66  //- Copy construct from base class
67  explicit pTraits(const Base& obj)
68  :
69  Base(obj)
70  {}
71 
72  //- Construct from Istream
73  explicit pTraits(Istream& is)
74  :
75  Base(is)
76  {}
77 };
78 
79 
80 /*---------------------------------------------------------------------------*\
81  Class zero_one Declaration
82 \*---------------------------------------------------------------------------*/
83 
84 //- Represents 0/1 range or concept. Used for tagged dispatch or clamping
85 class zero_one {};
86 
87 
88 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
89 
90 } // End namespace Foam
91 
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
93 
94 #endif
95 
96 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A traits class, which is primarily used for primitives.
Definition: pTraits.H:51
pTraits(const Base &obj)
Copy construct from base class.
Definition: pTraits.H:62
Represents 0/1 range or concept. Used for tagged dispatch or clamping.
Definition: pTraits.H:84
Namespace for OpenFOAM.