uLabel.H
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef uLabel_H
00037 #define uLabel_H
00038
00039 #include <climits>
00040 #include <cstdlib>
00041
00042
00043
00044
00045 #if FOAM_LABEL64
00046 # define FOAM_ULABEL_MAX 18000000000000000000
00047 #else
00048 # define FOAM_ULABEL_MAX 4000000000
00049 #endif
00050
00051
00052 #if UINT_MAX > FOAM_ULABEL_MAX
00053
00054
00055
00056 # undef FOAM_ULABEL_MAX
00057 # define FOAM_ULABEL_MAX UINT_MAX
00058
00059 # include "uint.H"
00060
00061 namespace Foam
00062 {
00063 typedef unsigned int uLabel;
00064
00065 static const uLabel uLabelMin = 0;
00066 static const uLabel uLabelMax = UINT_MAX;
00067
00068 inline uLabel readULabel(Istream& is)
00069 {
00070 return readUint(is);
00071 }
00072
00073 }
00074
00075
00076 #elif ULONG_MAX > FOAM_ULABEL_MAX
00077
00078
00079
00080 # undef FOAM_ULABEL_MAX
00081 # define FOAM_ULABEL_MAX ULONG_MAX
00082
00083 # include "uint.H"
00084 # include "ulong.H"
00085
00086 namespace Foam
00087 {
00088 typedef unsigned long uLabel;
00089
00090 static const uLabel uLabelMin = 0;
00091 static const uLabel uLabelMax = ULONG_MAX;
00092
00093 inline uLabel readULabel(Istream& is)
00094 {
00095 return readUlong(is);
00096 }
00097
00098 }
00099
00100
00101 #elif ULLONG_MAX > FOAM_ULABEL_MAX
00102
00103
00104
00105 # undef FOAM_ULABEL_MAX
00106
00107 # error "Not implemented yet"
00108
00109 #endif
00110
00111
00112
00113
00114 #include "pTraits.H"
00115 #include "direction.H"
00116
00117 namespace Foam
00118 {
00119
00120
00121 template<>
00122 class pTraits<uLabel>
00123 {
00124 uLabel p_;
00125
00126 public:
00127
00128
00129 typedef uLabel cmptType;
00130
00131
00132
00133 enum
00134 {
00135 dim = 3,
00136 rank = 0,
00137 nComponents = 1
00138 };
00139
00140
00141
00142 static const char* const typeName;
00143 static const char* componentNames[];
00144 static const uLabel zero;
00145 static const uLabel one;
00146 static const uLabel max;
00147 static const uLabel min;
00148
00149
00150
00151
00152 pTraits(Istream&);
00153
00154
00155
00156
00157 operator uLabel() const
00158 {
00159 return p_;
00160 }
00161 };
00162
00163
00164
00165
00166 inline uLabel& setComponent(uLabel& l, const direction)
00167 {
00168 return l;
00169 }
00170
00171 inline uLabel component(const uLabel l, const direction)
00172 {
00173 return l;
00174 }
00175
00176
00177
00178
00179 }
00180
00181
00182
00183 #endif
00184
00185
Copyright © 2000-2009 OpenCFD Ltd