StandardTypeDescriptor Class Reference

StandardTypeDescriptor provides convenience functions to StandardTypeDescriptorOrdinal enum. More...

#include <StandardTypeDescriptor.h>

List of all members.

Static Public Member Functions

static char const *const toString (StandardTypeDescriptorOrdinal st)
static StandardTypeDescriptorOrdinal fromString (char const *const str)
static bool isNative (StandardTypeDescriptorOrdinal st)
static bool isNativeNotBool (StandardTypeDescriptorOrdinal st)
static bool isIntegralNative (StandardTypeDescriptorOrdinal st)
 Note: Boolean considered integral native.
static bool isExact (StandardTypeDescriptorOrdinal st)
 Note: Boolean not considered exact.
static bool isApprox (StandardTypeDescriptorOrdinal st)
static bool isArray (StandardTypeDescriptorOrdinal st)
static bool isVariableLenArray (StandardTypeDescriptorOrdinal st)
static bool isFixedLenArray (StandardTypeDescriptorOrdinal st)
static bool isTextArray (StandardTypeDescriptorOrdinal st)
static bool isBinaryArray (StandardTypeDescriptorOrdinal st)

Private Member Functions

 StandardTypeDescriptor ()


Detailed Description

StandardTypeDescriptor provides convenience functions to StandardTypeDescriptorOrdinal enum.

Definition at line 78 of file StandardTypeDescriptor.h.


Constructor & Destructor Documentation

StandardTypeDescriptor::StandardTypeDescriptor (  )  [explicit, private]


Member Function Documentation

static char const* const StandardTypeDescriptor::toString ( StandardTypeDescriptorOrdinal  st  )  [inline, static]

Definition at line 82 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_BINARY, STANDARD_TYPE_BOOL, STANDARD_TYPE_CHAR, STANDARD_TYPE_DOUBLE, STANDARD_TYPE_INT_16, STANDARD_TYPE_INT_32, STANDARD_TYPE_INT_64, STANDARD_TYPE_INT_8, STANDARD_TYPE_REAL, STANDARD_TYPE_UINT_16, STANDARD_TYPE_UINT_32, STANDARD_TYPE_UINT_64, STANDARD_TYPE_UINT_8, STANDARD_TYPE_UNICODE_CHAR, STANDARD_TYPE_UNICODE_VARCHAR, STANDARD_TYPE_VARBINARY, and STANDARD_TYPE_VARCHAR.

Referenced by InstructionSignature::compute(), ExtendedInstructionDef::computeSignature(), CalcAssemblerTest::getTypeString(), InvalidTypeException::InvalidTypeException(), InvalidValueException< T >::InvalidValueException(), operator<<(), and StandardTypeTest::testStandardTypeToString().

00083     {
00084         switch (st) {
00085         case STANDARD_TYPE_INT_8:
00086             return "s1";             // signed, 1 byte
00087         case STANDARD_TYPE_UINT_8:
00088             return "u1";             // unsigned, 1 byte
00089         case STANDARD_TYPE_INT_16:
00090             return "s2";
00091         case STANDARD_TYPE_UINT_16:
00092             return "u2";
00093         case STANDARD_TYPE_INT_32:
00094             return "s4";
00095         case STANDARD_TYPE_UINT_32:
00096             return "u4";
00097         case STANDARD_TYPE_INT_64:
00098             return "s8";
00099         case STANDARD_TYPE_UINT_64:
00100             return "u8";
00101         case STANDARD_TYPE_BOOL:
00102             return "bo";
00103         case STANDARD_TYPE_REAL:     // float
00104             return "r";
00105         case STANDARD_TYPE_DOUBLE:
00106             return "d";
00107         case STANDARD_TYPE_CHAR:
00108             return "c";
00109         case STANDARD_TYPE_VARCHAR:
00110             return "vc";
00111         case STANDARD_TYPE_BINARY:
00112             return "b";
00113         case STANDARD_TYPE_VARBINARY:
00114             return "vb";
00115         case STANDARD_TYPE_UNICODE_CHAR:
00116             return "U";
00117         case STANDARD_TYPE_UNICODE_VARCHAR:
00118             return "vU";
00119         default:
00120             permAssert(false);
00121         }
00122     }

static StandardTypeDescriptorOrdinal StandardTypeDescriptor::fromString ( char const *const  str  )  [inline, static]

Definition at line 125 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_BINARY, STANDARD_TYPE_BOOL, STANDARD_TYPE_CHAR, STANDARD_TYPE_DOUBLE, STANDARD_TYPE_INT_16, STANDARD_TYPE_INT_32, STANDARD_TYPE_INT_64, STANDARD_TYPE_INT_8, STANDARD_TYPE_REAL, STANDARD_TYPE_UINT_16, STANDARD_TYPE_UINT_32, STANDARD_TYPE_UINT_64, STANDARD_TYPE_UINT_8, STANDARD_TYPE_UNICODE_CHAR, STANDARD_TYPE_UNICODE_VARCHAR, STANDARD_TYPE_VARBINARY, and STANDARD_TYPE_VARCHAR.

Referenced by testConvertDecimal(), testConvertFloatToIntTypes(), testConvertIntTypesToFloat(), and StandardTypeTest::testStandardTypeToString().

00126     {
00127         // A bit ugly, but rather fast.
00128         switch (*str) {
00129         case 's':
00130             switch (*(str + 1)) {
00131             case '1':
00132                 return STANDARD_TYPE_INT_8;
00133             case '2':
00134                 return STANDARD_TYPE_INT_16;
00135             case '4':
00136                 return STANDARD_TYPE_INT_32;
00137             case '8':
00138                 return STANDARD_TYPE_INT_64;
00139             default:
00140                 break;
00141             }
00142             break;
00143         case 'u':
00144             switch (*(str + 1)) {
00145             case '1':
00146                 return STANDARD_TYPE_UINT_8;
00147             case '2':
00148                 return STANDARD_TYPE_UINT_16;
00149             case '4':
00150                 return STANDARD_TYPE_UINT_32;
00151             case '8':
00152                 return STANDARD_TYPE_UINT_64;
00153             default:
00154                 break;
00155             }
00156             break;
00157         case 'r':
00158             return STANDARD_TYPE_REAL;
00159         case 'd':
00160             return STANDARD_TYPE_DOUBLE;
00161         case 'c':
00162             return STANDARD_TYPE_CHAR;
00163         case 'U':
00164             return STANDARD_TYPE_UNICODE_CHAR;
00165         case 'v':
00166             switch (*(str + 1)) {
00167             case 'c':
00168                 return STANDARD_TYPE_VARCHAR;
00169             case 'b':
00170                 return STANDARD_TYPE_VARBINARY;
00171             case 'U':
00172                 return STANDARD_TYPE_UNICODE_VARCHAR;
00173             default:
00174                 break;
00175             }
00176         case 'b':
00177             switch (*(str + 1)) {
00178             case 'o':
00179                 return STANDARD_TYPE_BOOL;
00180             case 0:         // string null terminator
00181                 return STANDARD_TYPE_BINARY;
00182             default:
00183                 break;
00184             }
00185         }
00186 
00187         permAssert(false);
00188     }

static bool StandardTypeDescriptor::isNative ( StandardTypeDescriptorOrdinal  st  )  [inline, static]

Definition at line 191 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_DOUBLE.

Referenced by NativeInstruction< TMPLT >::NativeInstruction(), and StandardTypeTest::testStandardTypeIsNative().

00192     {
00193         if (st <= STANDARD_TYPE_DOUBLE) {
00194             return true;
00195         }
00196         return false;
00197     }

static bool StandardTypeDescriptor::isNativeNotBool ( StandardTypeDescriptorOrdinal  st  )  [inline, static]

Definition at line 201 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_BOOL, and STANDARD_TYPE_DOUBLE.

Referenced by NativeNativeInstructionRegister::registerInstructions(), CastInstructionRegister::registerInstructions(), BoolNativeInstructionRegister::registerInstructions(), and StandardTypeTest::testStandardTypeIsNativeNotBool().

00202     {
00203         if (st <= STANDARD_TYPE_DOUBLE && st != STANDARD_TYPE_BOOL) {
00204             return true;
00205         }
00206         return false;
00207     }

static bool StandardTypeDescriptor::isIntegralNative ( StandardTypeDescriptorOrdinal  st  )  [inline, static]

Note: Boolean considered integral native.

Might not be a reasonable assumption.

Definition at line 214 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_BOOL.

Referenced by IntegralNativeInstruction< TMPLT >::IntegralNativeInstruction(), MockProducerExecStream::prepare(), and StandardTypeTest::testStandardTypeIsIntegralNative().

00215     {
00216         if (st <= STANDARD_TYPE_BOOL) {
00217             return true;
00218         }
00219         return false;
00220     }

static bool StandardTypeDescriptor::isExact ( StandardTypeDescriptorOrdinal  st  )  [inline, static]

Note: Boolean not considered exact.

Might not be a reasonable assumption.

Definition at line 227 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_UINT_64.

Referenced by histogramAlloc(), mathLn(), mathLog10(), IntegralNativeInstructionRegister::registerInstructions(), StandardTypeTest::testStandardTypeIsExact(), WinAggAddTest(), and WinAggDropTest().

00228     {
00229         if (st <= STANDARD_TYPE_UINT_64) {
00230             return true;
00231         }
00232         return false;
00233     }

static bool StandardTypeDescriptor::isApprox ( StandardTypeDescriptorOrdinal  st  )  [inline, static]

Definition at line 237 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_DOUBLE, and STANDARD_TYPE_REAL.

Referenced by histogramAlloc(), mathAbs(), mathLn(), mathLog10(), mathPow(), StandardTypeTest::testStandardTypeIsApprox(), WinAggAddTest(), and WinAggDropTest().

00238     {
00239         if (st == STANDARD_TYPE_REAL ||
00240             st == STANDARD_TYPE_DOUBLE) {
00241             return true;
00242         }
00243         return false;
00244     }

static bool StandardTypeDescriptor::isArray ( StandardTypeDescriptorOrdinal  st  )  [inline, static]

Definition at line 247 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_CHAR, and STANDARD_TYPE_UNICODE_VARCHAR.

Referenced by castStrToBinaryA(), castStrToCharA(), castStrToVarBinaryA(), castStrToVarCharA(), TupleAccessor::compute(), CalcAssemblerTest::getTypeString(), histogramAlloc(), StringDesc::pointer(), RegisterRef< char * >::pointer(), PointerPointerInstruction< PTR_TYPE, PTR_TYPE >::PointerPointerInstruction(), PointerPointerInstructionRegister::registerInstructions(), PointerIntegralInstructionRegister::registerInstructions(), IntegralPointerInstructionRegister::registerInstructions(), BoolPointerInstructionRegister::registerInstructions(), StringDesc::stringLength(), RegisterRef< char * >::stringLength(), StandardTypeTest::testStandardTypeIsArray(), CalcAssemblerTest::testStandardTypes(), RegisterRef< char * >::valueToString(), WinAggAddTestStr(), and WinAggDropTestStr().

00248     {
00249         if (st >= STANDARD_TYPE_CHAR &&
00250             st <= STANDARD_TYPE_UNICODE_VARCHAR) {
00251             return true;
00252         }
00253         return false;
00254     }

static bool StandardTypeDescriptor::isVariableLenArray ( StandardTypeDescriptorOrdinal  st  )  [inline, static]

Definition at line 257 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_UNICODE_VARCHAR, STANDARD_TYPE_VARBINARY, and STANDARD_TYPE_VARCHAR.

Referenced by StringDesc::stringLength(), RegisterRef< char * >::stringLength(), StandardTypeTest::testStandardTypeIsVariableLenArray(), WinAggAddTestStr(), and WinAggDropTestStr().

00258     {
00259         if (st == STANDARD_TYPE_VARCHAR ||
00260             st == STANDARD_TYPE_VARBINARY ||
00261             st == STANDARD_TYPE_UNICODE_VARCHAR) {
00262             return true;
00263         }
00264         return false;
00265     }

static bool StandardTypeDescriptor::isFixedLenArray ( StandardTypeDescriptorOrdinal  st  )  [inline, static]

Definition at line 268 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_BINARY, STANDARD_TYPE_CHAR, and STANDARD_TYPE_UNICODE_CHAR.

Referenced by StandardTypeTest::testStandardTypeIsFixedLenArray().

00269     {
00270         if (st == STANDARD_TYPE_CHAR ||
00271             st == STANDARD_TYPE_BINARY ||
00272             st == STANDARD_TYPE_UNICODE_CHAR) {
00273             return true;
00274         }
00275         return false;
00276     }

static bool StandardTypeDescriptor::isTextArray ( StandardTypeDescriptorOrdinal  st  )  [inline, static]

Definition at line 279 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_CHAR, STANDARD_TYPE_UNICODE_CHAR, STANDARD_TYPE_UNICODE_VARCHAR, and STANDARD_TYPE_VARCHAR.

Referenced by castApproxToStrA(), castBooleanToStrA(), CastDateToStrA(), castExactToStrA(), CastStrAToDate(), CastStrAToTime(), CastStrAToTimestamp(), castStrToApproxA(), castStrToBooleanA(), castStrToExactA(), CastTimestampToStrA(), CastTimeToStrA(), FlatFileExecStreamImpl::readTupleDescriptor(), strCatA2(), strCatA3(), strCmpA(), strCpyA(), strLenBitA(), strLenCharA(), strLenOctA(), strLikeEscapeA(), strOverlayA4(), strOverlayA5(), strPosA(), strSimilarEscapeA(), strSubStringA3(), strSubStringA4(), strToLowerA(), strToUpperA(), strTrimA(), and StandardTypeTest::testStandardTypeIsTextArray().

00280     {
00281         if (st == STANDARD_TYPE_CHAR ||
00282             st == STANDARD_TYPE_VARCHAR ||
00283             st == STANDARD_TYPE_UNICODE_CHAR ||
00284             st == STANDARD_TYPE_UNICODE_VARCHAR) {
00285             return true;
00286         }
00287         return false;
00288     }

static bool StandardTypeDescriptor::isBinaryArray ( StandardTypeDescriptorOrdinal  st  )  [inline, static]

Definition at line 291 of file StandardTypeDescriptor.h.

References STANDARD_TYPE_BINARY, and STANDARD_TYPE_VARBINARY.

Referenced by strCmpOct(), and StandardTypeTest::testStandardTypeIsBinaryArray().

00292     {
00293         if (st == STANDARD_TYPE_VARBINARY ||
00294             st == STANDARD_TYPE_BINARY) {
00295             return true;
00296         }
00297         return false;
00298     }


The documentation for this class was generated from the following file:
Generated on Mon Jun 22 04:00:47 2009 for Fennel by  doxygen 1.5.1