uint64.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) 2014-2021 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 Primitive
25  uint64
26 
27 Description
28  64bit uinteger
29 
30 SourceFiles
31  uint64.C
32  uint64IO.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef uint64_H
37 #define uint64_H
38 
39 #include <cstdint>
40 #include <climits>
41 #include <cstdlib>
42 
43 #include "word.H"
44 #include "pTraits.H"
45 #include "direction.H"
46 
47 #ifndef UINT64_MIN
48 #define UINT64_MIN 0
49 #endif
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 class Istream;
57 class Ostream;
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 //- Return a word representation of an uint64
62 word name(const uint64_t);
63 
64 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
65 
66 uint64_t readUint64(Istream&);
67 bool read(const char*, uint64_t&);
68 Istream& operator>>(Istream&, uint64_t&);
69 Ostream& operator<<(Ostream&, const uint64_t);
70 
71 //- Template specialisation for pTraits<uint64_t>
72 template<>
73 class pTraits<uint64_t>
74 {
75  uint64_t p_;
76 
77 public:
78 
79  //- Component type
80  typedef uint64_t cmptType;
81 
82 
83  // Member constants
84 
85  //- Dimensionality of space
86  static const direction dim = 3;
87 
88  //- Rank of uint64_t is 0
89  static const direction rank = 0;
90 
91  //- Number of components in uint64_t is 1
92  static const direction nComponents = 1;
93 
94 
95  // Static Data Members
96 
97  static const char* const typeName;
98  static const char* const componentNames[];
99  static const uint64_t zero;
100  static const uint64_t one;
101  static const uint64_t min;
102  static const uint64_t max;
103  static const uint64_t rootMax;
104  static const uint64_t rootMin;
105 
106 
107  // Constructors
108 
109  //- Construct from primitive
110  explicit pTraits(const uint64_t&);
111 
112  //- Construct from Istream
113  pTraits(Istream&);
114 
115 
116  // Member Functions
117 
118  //- Access to the uint64_t value
119  operator uint64_t() const
120  {
121  return p_;
122  }
123 
124  //- Access to the uint64_t value
125  operator uint64_t&()
126  {
127  return p_;
128  }
129 };
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
uint64_t cmptType
Component type.
Definition: uint64.H:80
static const uint64_t zero
Definition: uint64.H:99
uint8_t direction
Definition: direction.H:45
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Traits class for primitives.
Definition: pTraits.H:50
static const uint64_t one
Definition: uint64.H:100
static const uint64_t max
Definition: uint64.H:102
bool read(const char *, int32_t &)
Definition: int32IO.C:85
static const uint64_t min
Definition: uint64.H:101
static const uint64_t rootMax
Definition: uint64.H:103
Istream & operator>>(Istream &, directionInfo &)
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
static const char *const typeName
Definition: uint64.H:97
Direction is an 8-bit unsigned integer type used to represent the Cartesian directions etc...
uint64_t readUint64(Istream &)
Definition: uint64IO.C:74
Ostream & operator<<(Ostream &, const ensightPart &)
static const uint64_t rootMin
Definition: uint64.H:104
pTraits(const PrimitiveType &p)
Construct from primitive.
Definition: pTraits.H:60
Namespace for OpenFOAM.