当前位置: 首页>>代码示例>>C++>>正文


C++ TypedValue类代码示例

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


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


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