• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TypedValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TypedValue的典型用法代码示例。如果您正苦于以下问题:C++ TypedValue类的具体用法?C++ TypedValue怎么用?C++ TypedValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TypedValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: assert

void Kernel::setArgument(unsigned int index, TypedValue value)
{
  assert(index < m_function->arg_size());

  const llvm::Value *argument = getArgument(index);

  // Deallocate existing argument
  if (m_values.count(argument))
  {
    delete[] m_values[argument].data;
  }

#if LLVM_VERSION >= 40
  if (getArgumentTypeName(index).str() == "sampler_t")
  {
    // Get an llvm::ConstantInt that represents the sampler value
    llvm::Type *i32 = llvm::Type::getInt32Ty(m_program->getLLVMContext());
    llvm::Constant *samplerValue = llvm::ConstantInt::get(i32, value.getSInt());

    // A sampler argument is a pointer to the llvm::ConstantInt value
    TypedValue sampler;
    sampler.size = sizeof(size_t);
    sampler.num = 1;
    sampler.data = new unsigned char[sizeof(size_t)];
    sampler.setPointer((size_t)samplerValue);

    m_values[argument] = sampler;
  }
  else
#endif
  {
    m_values[argument] = value.clone();
  }
}
开发者ID:jrprice,项目名称:Oclgrind,代码行数:34,代码来源:Kernel.cpp


示例2: findExactMinMaxValuesForAttributeHelper

bool InjectJoinFilters::findExactMinMaxValuesForAttributeHelper(
    const physical::PhysicalPtr &physical_plan,
    const expressions::AttributeReferencePtr &attribute,
    std::int64_t *min_cpp_value,
    std::int64_t *max_cpp_value) const {
  bool min_value_is_exact;
  bool max_value_is_exact;

  const TypedValue min_value =
      cost_model_->findMinValueStat(physical_plan, attribute, &min_value_is_exact);
  const TypedValue max_value =
      cost_model_->findMaxValueStat(physical_plan, attribute, &max_value_is_exact);
  if (min_value.isNull() || max_value.isNull() ||
      (!min_value_is_exact) || (!max_value_is_exact)) {
    return false;
  }

  switch (attribute->getValueType().getTypeID()) {
    case TypeID::kInt: {
      *min_cpp_value = min_value.getLiteral<int>();
      *max_cpp_value = max_value.getLiteral<int>();
      return true;
    }
    case TypeID::kLong: {
      *min_cpp_value = min_value.getLiteral<std::int64_t>();
      *max_cpp_value = max_value.getLiteral<std::int64_t>();
      return true;
    }
    default:
      return false;
  }
}
开发者ID:apache,项目名称:incubator-quickstep,代码行数:32,代码来源:InjectJoinFilters.cpp


示例3: getVariable

bool WorkItem::printVariable(string name) const
{
  // Find variable
  const llvm::Value *value = getVariable(name);
  if (!value)
  {
    return false;
  }

  // Get variable value
  TypedValue result = getOperand(value);
  const llvm::Type *type = value->getType();

  if (value->getValueID() == llvm::Value::GlobalVariableVal ||
      ((const llvm::Instruction*)value)->getOpcode()
         == llvm::Instruction::Alloca)
  {
    // If value is alloca or global variable, look-up data at address
    size_t address = result.getPointer();
    Memory *memory = getMemory(value->getType()->getPointerAddressSpace());
    unsigned char *data = (unsigned char*)memory->getPointer(address);
    printTypedData(value->getType()->getPointerElementType(), data);
  }
  else
  {
    printTypedData(type, result.data);
  }

  return true;
}
开发者ID:,项目名称:,代码行数:30,代码来源:


示例4: iterateUnaryInl

  inline void iterateUnaryInl(AggregationStateSum *state, const TypedValue &value) const {
    DCHECK(value.isPlausibleInstanceOf(argument_type_.getSignature()));
    if (value.isNull()) return;

    SpinMutexLock lock(state->mutex_);
    state->sum_ = fast_operator_->applyToTypedValues(state->sum_, value);
    state->null_ = false;
  }
开发者ID:HanumathRao,项目名称:incubator-quickstep,代码行数:8,代码来源:AggregationHandleSum.hpp


示例5: getUpperBoundCodeForTypedValue

 /**
  * @brief Find the first code which is greater than the specified typed
  *        value, similar to std::upper_bound().
  * @warning value must not be NULL.
  *
  * @param value A typed value, which can be either the exact same Type as
  *        the values in this dictionary, or another Type which is comparable
  *        according to LessComparison.
  * @param value_type The Type that value belongs to.
  * @return The first code whose corresponding uncompressed value is greater
  *         than value. May return numberOfCodes() if every value in the
  *         dictionary is less than or equal to value.
  **/
 std::uint32_t getUpperBoundCodeForTypedValue(const TypedValue &value,
                                              const Type &value_type) const {
   DCHECK(!value.isNull());
   if (value_type.isSubsumedBy(type_)) {
     return getUpperBoundCodeForUntypedValue(value.getDataPtr());
   } else {
     return getUpperBoundCodeForDifferentTypedValue(value, value_type);
   }
 }
开发者ID:HanumathRao,项目名称:incubator-quickstep,代码行数:22,代码来源:CompressionDictionary.hpp


示例6: TypedValue

void
Meta::setMap(const std::string &name, const std::vector<StringUtils::NamedValue> &value) {
    TypedValue val = TypedValue::createMapValue();
    for (std::vector<StringUtils::NamedValue>::const_iterator it = value.begin();
         it != value.end();
         ++it) {
        val.add(it->first, TypedValue(it->second));
    }
    setTypedValue(name, val);
}
开发者ID:bacek,项目名称:xscript,代码行数:10,代码来源:meta.cpp


示例7: getLowerBoundCodeForTypedValue

 /**
  * @brief Find the first code which is not less than the specified typed
  *        value, similar to std::lower_bound().
  * @warning value must not be NULL.
  *
  * @param value A typed value, which can be either the exact same Type as
  *        the values in this dictionary, or another Type which is comparable
  *        according to LessComparison.
  * @param value_type The Type that value belongs to.
  * @return The first code whose corresponding uncompressed value is not less
  *         than value. May return numberOfCodes() if every value in the
  *         dictionary is less than value.
  **/
 std::uint32_t getLowerBoundCodeForTypedValue(const TypedValue &value,
                                              const Type &value_type,
                                              const bool ignore_null_code = false) const {
   DCHECK(!value.isNull());
   if (value_type.isSubsumedBy(type_)) {
     return getLowerBoundCodeForUntypedValue(value.getDataPtr(), ignore_null_code);
   } else {
     return getLowerBoundCodeForDifferentTypedValue(value, value_type, ignore_null_code);
   }
 }
开发者ID:HanumathRao,项目名称:incubator-quickstep,代码行数:23,代码来源:CompressionDictionary.hpp


示例8: appendTypedValue

 /**
  * @brief Append a TypedValue to this NativeColumnVector.
  *
  * @param value A value to append to this NativeColumnVector.
  **/
 inline void appendTypedValue(const TypedValue &value) {
   DCHECK_LT(actual_length_, reserved_length_);
   DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
   if (null_bitmap_ && value.isNull()) {
     null_bitmap_->setBit(actual_length_, true);
   } else {
     DCHECK(!value.isNull());
     value.copyInto(static_cast<char*>(values_) + (actual_length_ * type_length_));
   }
   ++actual_length_;
 }
开发者ID:apache,项目名称:incubator-quickstep,代码行数:16,代码来源:ColumnVector.hpp


示例9: getLimitCodesForComparisonTyped

 /**
  * @brief Determine the range of codes that match a specified comparison with
  *        a specified typed value.
  *
  * @param comp The comparison to evaluate.
  * @param value A typed value, which can be either the exact same Type as
  *        the values in this dictionary, or another Type which is comparable
  *        according to LessComparison.
  * @param value_type The Type that value belongs to.
  * @return The limits of the range of codes which match the predicate
  *         "coded-value comp value". The range is [first, second) (i.e. it
  *         is inclusive of first but not second).
  **/
 std::pair<std::uint32_t, std::uint32_t> getLimitCodesForComparisonTyped(
     const ComparisonID comp,
     const TypedValue &value,
     const Type &value_type) const {
   if (value_type.isSubsumedBy(type_)) {
     return getLimitCodesForComparisonUntyped(comp,
                                              value.isNull() ? nullptr : value.getDataPtr());
   } else {
     return getLimitCodesForComparisonDifferentTyped(comp, value, value_type);
   }
 }
开发者ID:HanumathRao,项目名称:incubator-quickstep,代码行数:24,代码来源:CompressionDictionary.hpp


示例10: positionalWriteTypedValue

 /**
  * @brief Overwrite the value at the specified position with the supplied
  *        TypedValue.
  * @warning You must call prepareForPositionalWrites() BEFORE calling this
  *          method.
  * @warning Do NOT use positional writes in combination with appends.
  * @warning It is intended that this and other positional write methods
  *          should be called exactly once for each position (if this is
  *          violated, NULLs may not be tracked properly).
  *
  * @param position The position of the value in this NativeColumnVector to
  *        overwrite.
  * @param value A TypedValue to write into this NativeColumnVector.
  **/
 inline void positionalWriteTypedValue(const std::size_t position,
                                       const TypedValue &value) {
   DCHECK_LT(position, actual_length_);
   DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
   if (null_bitmap_ && value.isNull()) {
     null_bitmap_->setBit(position, true);
   } else {
     DCHECK(!value.isNull());
     value.copyInto(static_cast<char*>(values_) + (position * type_length_));
   }
 }
开发者ID:apache,项目名称:incubator-quickstep,代码行数:25,代码来源:ColumnVector.hpp


示例11: getCodeForTypedValue

 /**
  * @brief Get the compressed code that represents the specified typed value.
  * @note This uses a binary search to find the appropriate code. It runs in
  *       O(log(n)) time.
  *
  * @param value A typed value, which can be either the exact same Type as
  *        the values in this dictionary, or another Type which is comparable
  *        according to LessComparison.
  * @param value_type The Type that value belongs to.
  * @return The code for value in this dictionary, or the value of
  *         numberOfCodes() (the maximum code plus one) if value is not
  *         contained in this dictionary.
  **/
 std::uint32_t getCodeForTypedValue(const TypedValue &value,
                                    const Type &value_type) const {
   if (value.isNull()) {
     return getNullCode() == std::numeric_limits<std::uint32_t>::max() ? number_of_codes_including_null_
                                                                       : getNullCode();
   } else if (value_type.isSubsumedBy(type_)) {
     return getCodeForUntypedValue(value.getDataPtr());
   } else {
     return getCodeForDifferentTypedValue(value, value_type);
   }
 }
开发者ID:HanumathRao,项目名称:incubator-quickstep,代码行数:24,代码来源:CompressionDictionary.hpp


示例12: printValueToFile

void CharType::printValueToFile(const TypedValue &value,
                                FILE *file,
                                const int padding) const {
  DCHECK(!value.isNull());
  DCHECK_EQ(length_, static_cast<decltype(length_)>(static_cast<int>(length_)))
      << "Can not convert CHAR Type's maximum length " << length_
      << " to int for fprintf()";

  std::fprintf(file,
               "%*.*s",
               padding,
               static_cast<int>(length_),
               static_cast<const char*>(value.getOutOfLineData()));
}
开发者ID:apache,项目名称:incubator-quickstep,代码行数:14,代码来源:CharType.cpp


示例13: fillWithValue

 /**
  * @brief Fill this entire ColumnVector with copies of value.
  *
  * @param value A value to fill this ColumnVector with.
  **/
 inline void fillWithValue(const TypedValue &value) {
   DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
   if (value.isNull()) {
     fillWithNulls();
   } else {
     if (null_bitmap_) {
       null_bitmap_->clear();
     }
     for (std::size_t pos = 0;
          pos < reserved_length_;
          ++pos) {
       value.copyInto(static_cast<char*>(values_) + (pos * type_length_));
     }
     actual_length_ = reserved_length_;
   }
 }
开发者ID:apache,项目名称:incubator-quickstep,代码行数:21,代码来源:ColumnVector.hpp


示例14: getPartitionId

 /**
  * @brief Calulate the partition id into which the attribute value
  *        should be inserted.
  *
  * @param value_of_attribute The attribute value for which the
  *                           partition id is to be determined.
  * @return The partition id of the partition for the attribute value.
  **/
 const partition_id getPartitionId(
     const TypedValue &value_of_attribute) const override {
   // TODO(gerald): Optimize for the case where the number of partitions is a
   // power of 2. We can just mask out the lower-order hash bits rather than
   // doing a division operation.
   return value_of_attribute.getHash() % num_partitions_;
 }
开发者ID:d-dash,项目名称:quickstep,代码行数:15,代码来源:PartitionScheme.hpp


示例15: ASSERT

void FacetHelper::generateIDAndNameForMultiValued(const TypedValue & attributeValue ,
		std::vector< std::pair<unsigned , std::string> > & resultIdsAndNames){
	ASSERT(attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_INT ||
	        attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_LONG ||
			attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_FLOAT ||
			attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_DOUBLE ||
			attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_TEXT ||
			attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_TIME);
	std::vector<TypedValue> singleValues;
	attributeValue.breakMultiValueIntoSingleValueTypedValueObjects(&singleValues);
	for(std::vector<TypedValue>::iterator singleValue = singleValues.begin() ; singleValue != singleValues.end() ; ++singleValue){
		std::pair<unsigned, std::string>  idAndNamePair = generateIDAndName(*singleValue);
		if(std::find(resultIdsAndNames.begin() , resultIdsAndNames.end() , idAndNamePair) == resultIdsAndNames.end()){
			resultIdsAndNames.push_back(idAndNamePair);
		}
	}
}
开发者ID:Poorvak,项目名称:srch2-ngn,代码行数:17,代码来源:FacetOperator.cpp


示例16: DCHECK

TypedValue CharType::coerceValue(const TypedValue &original_value,
                                 const Type &original_type) const {
  DCHECK(isCoercibleFrom(original_type))
      << "Can't coerce value of Type " << original_type.getName()
      << " to Type " << getName();

  if (original_value.isNull()) {
    return makeNullValue();
  }

  const void *original_data = original_value.getOutOfLineData();
  const std::size_t original_data_size = original_value.getDataSize();

  // VARCHAR always has a null-terminator. CHAR(X) has a null-terminator when
  // string's length is less than X.
  const bool null_terminated
      = (original_type.getTypeID() == kVarChar)
        || (original_data_size < original_type.maximumByteLength())
        || (std::memchr(original_data, '\0', original_data_size) != nullptr);

  if (original_data_size <= length_) {
    if (null_terminated || (original_data_size == length_)) {
      TypedValue value_copy(original_value);
      value_copy.markType(kChar);
      return value_copy;
    } else {
      // Need to make a new NULL-terminated copy of the string.
      char *null_terminated_str = static_cast<char*>(std::malloc(original_data_size + 1));
      std::memcpy(null_terminated_str, original_data, original_data_size);
      null_terminated_str[original_data_size] = '\0';
      return TypedValue::CreateWithOwnedData(kChar,
                                             null_terminated_str,
                                             original_data_size + 1);
    }
  } else {
    // Need to truncate.
    if (original_value.ownsOutOfLineData()) {
      char *truncated_str = static_cast<char*>(std::malloc(length_));
      std::memcpy(truncated_str, original_data, length_);
      return TypedValue::CreateWithOwnedData(kChar, truncated_str, length_);
    } else {
      // Original is a reference, so we will just make a shorter reference.
      return TypedValue(kChar, original_data, length_);
    }
  }
}
开发者ID:apache,项目名称:incubator-quickstep,代码行数:46,代码来源:CharType.cpp


示例17: applyToTypedValue

  TypedValue applyToTypedValue(const TypedValue &argument) const override {
    if (source_nullability && argument.isNull()) {
      return TypedValue(TargetType::kStaticTypeID);
    }

    return TypedValue(static_cast<typename TargetType::cpptype>(
        argument.getLiteral<typename SourceType::cpptype>()));
  }
开发者ID:apache,项目名称:incubator-quickstep,代码行数:8,代码来源:NumericCastOperation.hpp


示例18: doProcessOneResult

void FacetOperator::doProcessOneResult(const TypedValue & attributeValue, const unsigned facetFieldIndex){
	if(attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_INT ||
	        attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_LONG ||
			attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_FLOAT ||
			attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_DOUBLE ||
			attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_TEXT ||
			attributeValue.getType() == ATTRIBUTE_TYPE_MULTI_TIME){
		std::vector<std::pair<unsigned , std::string> > idsAndNames;
		this->facetHelpers.at(facetFieldIndex)->generateIDAndNameForMultiValued(attributeValue , idsAndNames);
		for(std::vector<std::pair<unsigned , std::string> >::iterator idAndName = idsAndNames.begin() ; idAndName != idsAndNames.end() ; ++idAndName){
			this->facetResults.at(facetFieldIndex).second->addResultToBucket(idAndName->first , idAndName->second , FacetAggregationTypeCount);
		}
	}else{ // single value
		std::pair<unsigned , std::string> idandName = this->facetHelpers.at(facetFieldIndex)->generateIDAndName(attributeValue);
		this->facetResults.at(facetFieldIndex).second->addResultToBucket(idandName.first , idandName.second , FacetAggregationTypeCount);
	}
}
开发者ID:Poorvak,项目名称:srch2-ngn,代码行数:17,代码来源:FacetOperator.cpp


示例19: make_pair

std::pair<unsigned , std::string> CategoricalFacetHelper::generateIDAndName(const TypedValue & attributeValue){
	std::string attributeValueLowerCase = attributeValue.toString();
	std::transform(attributeValueLowerCase.begin(), attributeValueLowerCase.end(), attributeValueLowerCase.begin(), ::tolower);

	if(categoryValueToBucketIdMap.find(attributeValueLowerCase) == categoryValueToBucketIdMap.end()){
		categoryValueToBucketIdMap[attributeValueLowerCase] = categoryValueToBucketIdMap.size();
	}
	return std::make_pair(categoryValueToBucketIdMap[attributeValueLowerCase] , attributeValueLowerCase);
}
开发者ID:Poorvak,项目名称:srch2-ngn,代码行数:9,代码来源:FacetOperator.cpp


示例20: printValueToFile

void IntType::printValueToFile(const TypedValue &value,
                               FILE *file,
                               const int padding) const {
  DCHECK(!value.isNull());

  std::fprintf(file,
               "%*d",
               static_cast<int>(padding),
               value.getLiteral<int>());
}
开发者ID:HanumathRao,项目名称:incubator-quickstep,代码行数:10,代码来源:IntType.cpp



注:本文中的TypedValue类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TypingDistance::minDistance方法代码示例发布时间:2022-05-31
下一篇:
C++ TypedRoot类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap