bool PHSDataInt64::BuildYourselfFromYourValueSet(){ PHSData::BuildYourselfFromYourValueSet(); GetInt64( SSAPI_PHS_INT_FLOAT_FID_VALUE, &m_value ); m_hasCriticalThreshold = GetInt64( SSAPI_PHS_INT_FLOAT_FID_CRIT_THRESHOLD, &m_criticalThreshold )? true : false; m_hasNonCriticalThreshold = GetInt64( SSAPI_PHS_INT_FLOAT_FID_NON_CRIT_THRESHOLD, &m_nonCriticalThreshold )? true : false; m_hasFatalThreshold = GetInt64( SSAPI_PHS_INT_FLOAT_FID_FATAL_THRESHOLD, &m_fatalThreshold )? true : false; return true; }
//============================================================================ // NNumber::GetUInt64 : Get a uint64_t value. //---------------------------------------------------------------------------- uint64_t NNumber::GetUInt64(void) const { // Get the value return((uint64_t) GetInt64()); }
//============================================================================ // NNumber::GetInt32 : Get an int32_t value. //---------------------------------------------------------------------------- int32_t NNumber::GetInt32(void) const { // Get the value return((int32_t) GetInt64()); }
hashcode_t HashCode::hashcodeByUnRepeatedField(const Message* msg, const FieldDescriptor* field) { auto reflect = msg->GetReflection(); switch (field->cpp_type()) { case FieldDescriptor::CPPTYPE_UINT64: return stl_hashcode(reflect->GetUInt64(*msg, field)); case FieldDescriptor::CPPTYPE_INT64: return stl_hashcode(reflect->GetInt64(*msg, field)); case FieldDescriptor::CPPTYPE_UINT32: return stl_hashcode(reflect->GetUInt32(*msg, field)); case FieldDescriptor::CPPTYPE_INT32: return stl_hashcode(reflect->GetInt32(*msg, field)); case FieldDescriptor::CPPTYPE_STRING: return stl_hashcode(reflect->GetString(*msg, field)); case FieldDescriptor::CPPTYPE_DOUBLE: return stl_hashcode(reflect->GetDouble(*msg, field)); case FieldDescriptor::CPPTYPE_FLOAT: return stl_hashcode(reflect->GetFloat(*msg, field)); case FieldDescriptor::CPPTYPE_BOOL: return stl_hashcode(reflect->GetBool(*msg, field)); case FieldDescriptor::CPPTYPE_ENUM: return stl_hashcode(reflect->GetEnum(*msg, field)->number()); case FieldDescriptor::CPPTYPE_MESSAGE: return stl_hashcode(reflect->GetMessage(*msg, field)); default: LOG(ERROR)<< "The type of protobuf is not supported"; return 0; } }
bool Process::BuildYourselfFromYourValueSet(){ int temp; U32 ls; ManagedObject::BuildYourselfFromYourValueSet(); GetInt( SSAPI_PROCESS_FID_CAN_START, &temp ); m_canStart = temp? true : false; GetInt( SSAPI_PROCESS_FID_CAN_ABORT, &temp ); m_canAbort = temp? true : false; GetInt( SSAPI_PROCESS_FID_CAN_PAUSE, &temp ); m_canPause = temp? true : false; GetU32( SSAPI_PROCESS_FID_PERCENT_COMPLETE, &m_percentComplete ); GetU32( SSAPI_PROCESS_FID_PRIORITY, &m_priority ); GetInt64( SSAPI_PROCESS_FID_TIME_STARTED, &m_timeStarted ); GetU32( SSAPI_PROCESS_FID_STATE, &m_state ); if( GetU32( SSAPI_PROCESS_FID_NAME, &ls ) ) m_name = ls; GetU32( SSAPI_PROCESS_FID_OWNER_MANAGER_CLASS_TYPE, &m_ownerManagerClassType ); GetGenericValue( (char *)&m_ownerId, sizeof(m_ownerId), SSAPI_PROCESS_FID_OWNER_ID ); return true; }
//============================================================================ // NCFNumber::GetObject : Get the object. //---------------------------------------------------------------------------- NCFObject NCFNumber::GetObject(void) const { float64_t valueFloat64; float32_t valueFloat32; int64_t valueInt64; NCFObject theObject; // Get the object switch (GetPrecision()) { case kNPrecisionInt8: case kNPrecisionInt16: case kNPrecisionInt32: case kNPrecisionInt64: valueInt64 = GetInt64(); theObject.SetObject(CFNumberCreate(kCFAllocatorNano, kCFNumberLongLongType, &valueInt64)); break; case kNPrecisionFloat32: valueFloat32 = GetFloat32(); theObject.SetObject(CFNumberCreate(kCFAllocatorNano, kCFNumberFloatType, &valueFloat32)); break; case kNPrecisionFloat64: valueFloat64 = GetFloat64(); theObject.SetObject(CFNumberCreate(kCFAllocatorNano, kCFNumberDoubleType, &valueFloat64)); break; default: NN_LOG("Unable to convert '%@' to CFNumber", GetString()); break; } return(theObject); }
INT64 MgdSqlDataReader::GetInt64(INT32 index) { INT64 ret = 0; MG_FEATURE_SERVICE_TRY() STRING propertyName = GetPropertyName(index); ret = GetInt64(propertyName); MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgdSqlDataReader::GetInt64") return ret; }
TTm TJsonVal::GetTm() const { EAssert(IsStr() || IsNum()); if (IsStr()) { const TStr& TmStr = GetStr(); return TTm::GetTmFromWebLogDateTimeStr(TmStr, '-', ':', '.', 'T'); } else { return TTm::GetTmFromMSecs(TTm::GetWinMSecsFromUnixMSecs(GetInt64())); } }
__int64 CQuery::GetInt64(char *sCol) { int n; n=FindCol(sCol); if (n==-1) { return CQUERYNOCOL; } else { return GetInt64(n); } }
bool PHSData::BuildYourselfFromYourValueSet(){ int temp; ManagedObject::BuildYourselfFromYourValueSet(); GetInt( SSAPI_PHS_FID_IS_SETTABLE, &temp ); m_isSettable = temp ? true : false; m_hasSampleRate = GetInt64( SSAPI_PHS_FID_SAMPLE_RATE, &m_sampleRate )? true : false; GetInt( SSAPI_PHS_FID_NAME, (int *)&m_name ); GetInt( SSAPI_PHS_FID_VALUE_TYPE, &temp ); GetInt64( SSAPI_PHS_FID_COLLECTION_TIMESTAMP, &m_collectionTimestamp ); m_valueType = (VALUE_TYPE)temp; return true; }
bool StorageElementArray::BuildYourselfFromYourValueSet(){ int temp; StorageElement::BuildYourselfFromYourValueSet(); GetInt64( SSAPI_STORAGE_ELEMENT_ARRAY_FID_MEMBER_CAPACITY, &m_memberCapacity ); GetInt64( SSAPI_STORAGE_ELEMENT_ARRAY_FID_DATA_BLOCK_SIZE, &m_dataBlockSize ); GetInt64( SSAPI_STORAGE_ELEMENT_ARRAY_FID_PARITY_BLOCK_SIZE, &m_parityBlockSize ); GetInt( SSAPI_STORAGE_ELEMENT_ARRAY_FID_PECKING_ORDER, (int *)&m_peckingOrder ); GetInt( SSAPI_STORAGE_ELEMENT_ARRAY_FID_IS_INITED, &temp ); m_isInited = temp? true : false; GetU32( SSAPI_STORAGE_ELEMENT_ARRAY_FID_SERIAL_NUMBER, &m_serialNumber ); GetGenericValue( (char *)&m_hostSparePoolId, sizeof(m_hostSparePoolId), SSAPI_STORAGE_ELEMENT_ARRAY_FID_HOST_SPAREPOOL_ID ); GetInt64( SSAPI_STORAGE_ELEMENT_ARRAY_FID_CREATION_TIME, &m_creationTime ); return true; }
int JsValue::GetInt() const { std::string whyNot; if (not _CheckType(_holder->type, IntType, &whyNot)) { TF_CODING_ERROR(whyNot); return 0; } return static_cast<int>(GetInt64()); }
// Returns the well defined text representation of this expression. FdoString* FdoInt64Value::ToString() { static const FdoInt32 iBufLen = 256; wchar_t szBuf[iBufLen]; FdoStringUtility::ClearString(m_toString); if (IsNull()) { m_toString = FdoStringUtility::MakeString(FdoStringUtility::NullString); return m_toString; } #ifdef _WIN32 _i64tow(GetInt64(), szBuf, 10); #else swprintf(szBuf, sizeof(szBuf)/sizeof(wchar_t), L"%lld", GetInt64()); #endif m_toString = FdoStringUtility::MakeString(szBuf); return m_toString; }
__int64 GProfile::GetInt64OrDefault(const char *szSectionName, const char *szKey, __int64 nDefault) { __int64 ret; try { ret = GetInt64(szSectionName, szKey); } catch(...) { ret = nDefault; } return ret; }
__int64 CDataBase::GetInt64(const char *sCol) { __int64 iReturn = CQUERYNOCOL; int n = -1; // ---- n = FindCol(sCol); // ---- if (n != -1) { iReturn = GetInt64(n); } // ---- return iReturn; }
uint64_t JsValue::GetUInt64() const { std::string whyNot; if (not _CheckType(_holder->type, IntType, &whyNot)) { TF_CODING_ERROR(whyNot); return 0; } if (not IsUInt64()) return static_cast<uint64_t>(GetInt64()); return boost::get<uint64_t>(_holder->value); }
bool SoftwareDescriptor::BuildYourselfFromYourValueSet(){ int temp; ManagedObject::BuildYourselfFromYourValueSet(); GetU32( SSAPI_IOP_SW_IMAGE_DESCRIPTOR_FID_MAJOR_VERSION, &m_majorVersion ); GetU32( SSAPI_IOP_SW_IMAGE_DESCRIPTOR_FID_MINOR_VERSION, &m_minorVersion); GetU32( SSAPI_IOP_SW_IMAGE_DESCRIPTOR_FID_REFERENCE_COUNT, &m_referenceCount ); GetInt64( SSAPI_IOP_SW_IMAGE_DESCRIPTOR_FID_LOADED_ON, &m_loadedOn ); GetInt( SSAPI_IOP_SW_IMAGE_DESCRIPTOR_FID_IS_DEFAULT, &temp ); m_isDefault = temp? true : false; return true; }
double JsValue::GetReal() const { if (_holder->type == IntType) { return IsUInt64() ? static_cast<double>(GetUInt64()) : static_cast<double>(GetInt64()); } std::string whyNot; if (not _CheckType(_holder->type, RealType, &whyNot)) { TF_CODING_ERROR(whyNot); return 0; } return boost::get<double>(_holder->value); }
Value *GetDefaultValue(CodeGenerator *codegen, AstTypeNode *typeNode) { switch (typeNode->getTypeType()) { default: return nullptr; case node_boolean: return codegen->getBuilder().getFalse(); case node_float: return GetFloat(codegen, 0.0f); case node_double: return GetDouble(codegen, 0.0); case node_signed_integer8: return GetInt8(codegen, 0); case node_signed_integer16: return GetInt16(codegen, 0); case node_signed_integer32: return GetInt32(codegen, 0); case node_signed_integer64: return GetInt64(codegen, 0); case node_unsigned_integer8: return GetUInt8(codegen, 0); case node_unsigned_integer16: return GetUInt16(codegen, 0); case node_unsigned_integer32: return GetUInt32(codegen, 0); case node_unsigned_integer64: return GetUInt64(codegen, 0); case node_string: return GetString(codegen, ""); } }
void CMdbResult::GetNumber(void* v, register uint32 nFieldNo) { switch(GetType(nFieldNo)) { case MDB_INT8_FIELD: *(int8*)v = GetInt8(nFieldNo); break; case MDB_INT16_FIELD: *(int16*)v = GetInt16(nFieldNo); break; case MDB_INT32_FIELD: *(int32*)v = GetInt32(nFieldNo); break; case MDB_INT64_FIELD: *(int64*)v = GetInt64(nFieldNo); break; case MDB_UINT8_FIELD: *(uint8*)v = GetUInt8(nFieldNo); break; case MDB_UINT16_FIELD: *(uint16*)v = GetUInt16(nFieldNo); break; case MDB_UINT32_FIELD: *(uint32*)v = GetUInt32(nFieldNo); break; case MDB_UINT64_FIELD: *(uint64*)v = GetUInt64(nFieldNo); break; case MDB_FLOAT_FIELD: *(float*)v = GetFloat(nFieldNo); break; case MDB_DOUBLE_FIELD: case MDB_DATETIME_FIELD: *(double*)v = GetDouble(nFieldNo); break; case MDB_DATE_FIELD: case MDB_TIME_FIELD: *(int32*)v = GetInt32(nFieldNo); break; } }
// Creates a Value* of integer64 type with a value of zero. Value *GetZero_64(CodeGenerator *codegen) { return GetInt64(codegen, 0); }
// Creates a Value* of integer64 type with a value of two. Value *GetTwo_64(CodeGenerator *codegen) { return GetInt64(codegen, 2); }
void Pb2Json::Message2Json(const ProtobufMsg& message, Json& json, bool enum2str) { auto descriptor = message.GetDescriptor(); auto reflection = message.GetReflection(); if (nullptr == descriptor || nullptr == descriptor) return; auto count = descriptor->field_count(); for (auto i = 0; i < count; ++i) { const auto field = descriptor->field(i); if (field->is_repeated()) { if (reflection->FieldSize(message, field) > 0) RepeatedMessage2Json(message, field, reflection, json[field->name()], enum2str); continue; } if (!reflection->HasField(message, field)) { continue; } switch (field->type()) { case ProtobufFieldDescriptor::TYPE_MESSAGE: { const ProtobufMsg& tmp_message = reflection->GetMessage(message, field); if (0 != tmp_message.ByteSize()) Message2Json(tmp_message, json[field->name()]); } break; case ProtobufFieldDescriptor::TYPE_BOOL: json[field->name()] = reflection->GetBool(message, field) ? true : false; break; case ProtobufFieldDescriptor::TYPE_ENUM: { auto* enum_value_desc = reflection->GetEnum(message, field); if (enum2str) { json[field->name()] = enum_value_desc->name(); } else { json[field->name()] = enum_value_desc->number(); } } break; case ProtobufFieldDescriptor::TYPE_INT32: case ProtobufFieldDescriptor::TYPE_SINT32: case ProtobufFieldDescriptor::TYPE_SFIXED32: json[field->name()] = reflection->GetInt32(message, field); break; case ProtobufFieldDescriptor::TYPE_UINT32: case ProtobufFieldDescriptor::TYPE_FIXED32: json[field->name()] = reflection->GetUInt32(message, field); break; case ProtobufFieldDescriptor::TYPE_INT64: case ProtobufFieldDescriptor::TYPE_SINT64: case ProtobufFieldDescriptor::TYPE_SFIXED64: json[field->name()] = reflection->GetInt64(message, field); break; case ProtobufFieldDescriptor::TYPE_UINT64: case ProtobufFieldDescriptor::TYPE_FIXED64: json[field->name()] = reflection->GetUInt64(message, field); break; case ProtobufFieldDescriptor::TYPE_FLOAT: json[field->name()] = reflection->GetFloat(message, field); break; case ProtobufFieldDescriptor::TYPE_STRING: case ProtobufFieldDescriptor::TYPE_BYTES: json[field->name()] = reflection->GetString(message, field); break; default: break; } } }
//============================================================================ // NNumber::Compare : Compare the value. //---------------------------------------------------------------------------- NComparison NNumber::Compare(const NNumber &theValue) const { float64_t valueFloat64_1, valueFloat64_2; float32_t valueFloat32_1, valueFloat32_2; int64_t valueInt64_1, valueInt64_2; NComparison theResult; // Compare equal types if (mPrecision == theValue.mPrecision || (IsInteger() && theValue.IsInteger())) { switch (mPrecision) { case kNPrecisionInt8: case kNPrecisionInt16: case kNPrecisionInt32: case kNPrecisionInt64: theResult = GetComparison(mValue.integer, theValue.mValue.integer); break; case kNPrecisionFloat32: valueFloat32_1 = (float32_t) mValue.real; valueFloat32_2 = (float32_t) theValue.mValue.real; theResult = GetComparison(valueFloat32_1, valueFloat32_2); break; case kNPrecisionFloat64: theResult = GetComparison(mValue.real, theValue.mValue.real); break; default: NN_LOG("Unknown precision: %d", mPrecision); theResult = kNCompareLessThan; break; } } // Compare dis-similar types else { switch (mPrecision) { case kNPrecisionInt8: case kNPrecisionInt16: case kNPrecisionInt32: case kNPrecisionInt64: valueInt64_1 = GetInt64(); valueInt64_2 = theValue.GetInt64(); theResult = GetComparison(valueInt64_1, valueInt64_2); break; case kNPrecisionFloat32: valueFloat32_1 = GetFloat32(); valueFloat32_2 = theValue.GetFloat32(); theResult = GetComparison(valueFloat32_1, valueFloat32_2); break; case kNPrecisionFloat64: valueFloat64_1 = GetFloat64(); valueFloat64_2 = theValue.GetFloat64(); theResult = GetComparison(valueFloat64_1, valueFloat64_2); break; default: NN_LOG("Unknown precision: %d", mPrecision); theResult = kNCompareLessThan; break; } } return(theResult); }
int64 FeatureShp::GetInt64(const char* name) const { return GetInt64(m_pFields->FindField(name)); }
template <> long long Variant::Get<long long>() const { return GetInt64(); }
// Creates a Value* of integer64 type with a value of one. Value *GetOne_64(CodeGenerator *codegen) { return GetInt64(codegen, 1); }
FdoCompareType FdoInt64Value::DoCompare( FdoDataValue* other ) { FdoCompareType compare = FdoCompareType_Undefined; FdoPtr<FdoDataValue> thisValue; FdoPtr<FdoDataValue> otherValue; FdoDouble doubleValue; FdoInt64Value roundValue; switch ( other->GetDataType() ) { // Same type, do simple comparison case FdoDataType_Int64: { FdoInt64 num1 = GetInt64(); FdoInt64 num2 = static_cast<FdoInt64Value*>(other)->GetInt64(); compare = FdoCompare( num1, num2 ); } break; // Other values's type has smaller range. Convert other value to this value's type and compare. case FdoDataType_Byte: case FdoDataType_Int16: case FdoDataType_Int32: otherValue = FdoInt64Value::Create( other ); compare = Compare( otherValue ); break; // These floating-point type have larger range but less precision. case FdoDataType_Decimal: case FdoDataType_Double: case FdoDataType_Single: // Convert this int64 to the other type and compare. switch ( other->GetDataType() ) { case FdoDataType_Decimal: thisValue = FdoDecimalValue::Create( this ); doubleValue = static_cast<FdoDecimalValue*>((FdoDataValue*)thisValue)->GetDecimal(); break; case FdoDataType_Double: thisValue = FdoDoubleValue::Create( this ); doubleValue = static_cast<FdoDoubleValue*>((FdoDataValue*)thisValue)->GetDouble(); break; case FdoDataType_Single: thisValue = FdoSingleValue::Create( this ); doubleValue = (FdoDouble) (static_cast<FdoSingleValue*>((FdoDataValue*)thisValue)->GetSingle()); break; } compare = thisValue->Compare( other ); // Int64 value many have been rounded by conversion. Rounded value might be equal to // other value when Int64 value is not. if ( compare == FdoCompareType_Equal ) { // Convert rounded value back to Int64 if ( doubleValue > (FdoDouble) FdoInt64Max ) { // Value rounded above int64 range, so it is less than single value compare = FdoCompareType_Less; } else if ( doubleValue < (FdoDouble) FdoInt64Min ) { // Value rounded below int64 range, so it is greater than single value compare = FdoCompareType_Greater; } else { // rounded value in int64 range roundValue = (FdoInt64) doubleValue; if ( roundValue < GetInt64() ) // Int64 value was rounded down so it is actually greater than other value compare = FdoCompareType_Greater; if ( roundValue > GetInt64() ) // Int64 value was rounded up so it is actually less than single value compare = FdoCompareType_Less; } } break; } return compare; }