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