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


C++ NameSet类代码示例

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


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

示例1: throw

/*! \todo
*/
NameSet Parameter::getDependentParameterNameSet() const throw()
{
  NameSet lNameSet;
  for(NameSet::const_iterator lItr = mDependentParameterNameSet.begin(); lItr != mDependentParameterNameSet.end(); lItr++)
    lNameSet.insert(lItr->c_str());
  return lNameSet;
}
开发者ID:fjean,项目名称:vipers,代码行数:9,代码来源:Parameter.cpp

示例2: ParamsRangeChecked

// Called before any call to GenericFilter::Preflight().
void EnvironmentBase::EnterPreflightPhase( ParamList*   inParamList,
                                           StateList*   inStateList,
                                           StateVector* /*inStateVector*/ )
{
  bcierr__.SetAction( BCIStream::ConfigurationError );
  phase_ = preflight;
  Accessor_<ParamList>::spGlobal = inParamList;
  Accessor_<StateList>::spGlobal = inStateList;
  Accessor_<StateVector>::spGlobal = NULL;
  BCIStream::Apply( *inParamList );

  ParamsRangeChecked().clear();
  if( inParamList )
  {
    NameSet notAutoConfig;
    for( int i = 0; i < inParamList->Size(); ++i )
    {
      const Param& p = inParamList->ByIndex( i );
      if( !IsAutoConfigParam( p ) )
        notAutoConfig.insert( p.Name() );
    }
    RangeCheckParams( inParamList, notAutoConfig );
  }
  ParamsAccessedDuringPreflight().clear();
  StatesAccessedDuringPreflight().clear();

  for( ExtensionsContainer::iterator i = Extensions().begin(); i != Extensions().end(); ++i )
    ( *i )->CallPreflight();
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:30,代码来源:Environment.cpp

示例3: escapedKey

QStringList QWinSettingsPrivate::children(const QString &uKey, ChildSpec spec) const
{
    NameSet result;
    QString rKey = escapedKey(uKey);

    for (int i = 0; i < regList.size(); ++i) {
        HKEY parent_handle = regList.at(i).handle();
        if (parent_handle == 0)
            continue;
        HKEY handle = openKey(parent_handle, KEY_READ, rKey);
        if (handle == 0)
            continue;

        if (spec == AllKeys) {
            NameSet keys;
            allKeys(handle, QLatin1String(""), &keys);
            mergeKeySets(&result, keys);
        } else { // ChildGroups or ChildKeys
            QStringList names = childKeysOrGroups(handle, spec);
            mergeKeySets(&result, names);
        }

        RegCloseKey(handle);

        if (!fallbacks)
            return result.keys();
    }

    return result.keys();
}
开发者ID:13W,项目名称:phantomjs,代码行数:30,代码来源:qsettings_win.cpp

示例4: read

void IndexForNativeFormat::read(ReadBuffer & istr, const NameSet & required_columns)
{
	while (!istr.eof())
	{
		blocks.emplace_back();
		IndexOfBlockForNativeFormat & block = blocks.back();

		readVarUInt(block.num_columns, istr);
		readVarUInt(block.num_rows, istr);

		if (block.num_columns < required_columns.size())
			throw Exception("Index contain less than required columns", ErrorCodes::INCORRECT_INDEX);

		for (size_t i = 0; i < block.num_columns; ++i)
		{
			IndexOfOneColumnForNativeFormat column_index;

			readBinary(column_index.name, istr);
			readBinary(column_index.type, istr);
			readBinary(column_index.location.offset_in_compressed_file, istr);
			readBinary(column_index.location.offset_in_decompressed_block, istr);

			if (required_columns.count(column_index.name))
				block.columns.push_back(std::move(column_index));
		}

		if (block.columns.size() < required_columns.size())
			throw Exception("Index contain less than required columns", ErrorCodes::INCORRECT_INDEX);
		if (block.columns.size() > required_columns.size())
			throw Exception("Index contain duplicate columns", ErrorCodes::INCORRECT_INDEX);

		block.num_columns = block.columns.size();
	}
}
开发者ID:crestone,项目名称:ClickHouse,代码行数:34,代码来源:NativeBlockInputStream.cpp

示例5: file

// **************************************************************************
// Function:   LoadParameterList
// Purpose:    Loads the current list of parameters from a parameter file
//             It does NOT load system critical dynamic parameters (e.g., ports,
//             IP addresses)
// Parameters: char *filename - filename of the parameterlist
//             nonexisting - if true, load parameters, even if they currently do
//                       not exist in the list
// Returns:    true - successful
//             false - error
// **************************************************************************
bool
ParamList::Load( const string& inFileName, bool inImportNonexisting )
{
  ifstream file( inFileName.c_str() );
  ParamList paramsFromFile;
  file >> paramsFromFile;
  if( file.fail() )
    return false;

  // If desired, exclude parameters missing from the main parameter list.
  typedef set<string> NameSet;
  NameSet unwantedParams;
  if( !inImportNonexisting )
    for( int i = 0; i < paramsFromFile.Size(); ++i )
      if( !Exists( paramsFromFile[i].Name() ) )
        unwantedParams.insert( paramsFromFile[i].Name() );

  for( NameSet::const_iterator i = unwantedParams.begin(); i != unwantedParams.end(); ++i )
    paramsFromFile.Delete( *i );

  for( int i = 0; i < paramsFromFile.Size(); ++i )
  {
    Param &p = paramsFromFile[i], &q = ByName( p.Name() );
    if( !q.Readonly() )
      q.AssignValues( p, true );
  }
  return true;
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:39,代码来源:ParamList.cpp

示例6: ASSERT

void DatabaseTracker::recordDeletingDatabase(SecurityOrigin *origin, const String& name)
{
    ASSERT(!m_databaseGuard.tryLock());
    ASSERT(canDeleteDatabase(origin, name));
    NameSet* nameSet = m_beingDeleted.get(origin);
    if (!nameSet) {
        nameSet = new NameSet();
        m_beingDeleted.set(origin->isolatedCopy(), nameSet);
    }
    ASSERT(!nameSet->contains(name));
    nameSet->add(name.isolatedCopy());
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:12,代码来源:DatabaseTracker.cpp

示例7: inters

void
EnvironmentBase::RangeCheckParams( const ParamList* inParamList, const NameSet& inCheck )
{
  for( NameSetMap::const_iterator i = OwnedParams().begin(); i != OwnedParams().end(); ++i )
  {
    vector<string> inters( inCheck.size() );
    vector<string>::iterator inters_end = set_intersection(
      inCheck.begin(), inCheck.end(),
      i->second.begin(), i->second.end(),
      inters.begin(), Param::NameCmp()
    );
    for( vector<string>::const_iterator j = inters.begin(); j != inters_end; ++j )
    {
      const Param& p = ( *inParamList )[ *j ];
      const string& lowRangeStr = p.LowRange(),
                  & highRangeStr = p.HighRange();
      bool checkLowRange = ( !lowRangeStr.empty() ),
           checkHighRange = ( !highRangeStr.empty() );
      if( checkLowRange )
      {
        double lowRange = ::atof( lowRangeStr.c_str() );
        for( int j = 0; j < p.NumRows(); ++j )
          for( int k = 0; k < p.NumColumns(); ++k )
          {
            double value = ::atof( p.Value( j, k ).ToString().c_str() );
            if( value < lowRange )
              bcierr__ << DescribeValue( p, j, k )
                       << " is "
                       << value << ", exceeds lower range (" << lowRange << ")";
          }
      }
      if( checkHighRange )
      {
        double highRange = ::atof( highRangeStr.c_str() );
        for( int j = 0; j < p.NumRows(); ++j )
          for( int k = 0; k < p.NumColumns(); ++k )
          {
            double value = ::atof( p.Value( j, k ).ToString().c_str() );
            if( value > highRange )
              bcierr__ << DescribeValue( p, j, k )
                       << " is "
                       << value << ", exceeds high range (" << highRange << ")";
          }
      }
      if( checkLowRange || checkHighRange )
        ParamsRangeChecked().insert( p.Name() );
    }
  }
}
开发者ID:ACrazyer,项目名称:NeuralSystemsBCI2000,代码行数:49,代码来源:Environment.cpp

示例8: if

void *evalUnique(void *vptr_value) {
  int start;
  char *wordArray;
  NameSet *p = (NameSet *)vptr_value;

  start = myNameSet->start;
  while(start < end) {
    string word = p.at(start);
    word = substr(0,word.find(' '));
    int wordLength = (int)word.length();
    int origLength = (int)word.length();
    int containsDupe = 0;
    wordArray = new char [wordLength+1];
    strcpy (wordArray, word.c_str());
    for(int x=0;x<wordLength;x++) {
      for(int j=0;j<wordLength;j++) {
        if(x==j) {
          continue;
        }
        else if(* (wordArray+x)==*(wordArray+j)) {
            k=j;
            wordLength--;
            containsDupe=1;
            while(k < wordLength) {
              *(wordArray+k)=*(wordArray+k+1);
              k++;
            }
            j=0;
        }
      }
    }
      if(containsDupe == 0) {
        uniqCount++;
      }
      if(containsDupe == 0 && origLength >= 6) {
        //outputFile << "Line: " << lineNumber << " Word: " << word << " Dupe: " << containsDupe << " Unique: " << wordLength << endl;
        //outputFile << word << endl;
        uniqCounterArray[lineNumber] = wordLength;
      }
    //printf("word read is: %s Dupe: %d Size: %d\n", word, containsDupe,origLength);
    //strcpy(word,"");
    delete[] wordArray;
    start++;
  }
}
开发者ID:mageru,项目名称:parallelalgo,代码行数:45,代码来源:uniqnamesV2.cpp

示例9: filterBlockWithQuery

bool filterBlockWithQuery(ASTPtr query, Block & block, const Context & context)
{
	query = query->clone();
	const ASTSelectQuery & select = typeid_cast<ASTSelectQuery & >(*query);
	if (!select.where_expression && !select.prewhere_expression)
		return false;

	NameSet columns;
	for (const auto & it : block.getColumnsList())
		columns.insert(it.name);

	/// Составим выражение, вычисляющее выражения в WHERE и PREWHERE, зависящие только от имеющихся столбцов.
	std::vector<ASTPtr> functions;
	if (select.where_expression)
		extractFunctions(select.where_expression, columns, functions);
	if (select.prewhere_expression)
		extractFunctions(select.prewhere_expression, columns, functions);
	ASTPtr expression_ast = buildWhereExpression(functions);
	if (!expression_ast)
		return false;

	/// Распарсим и вычислим выражение.
	ExpressionAnalyzer analyzer(expression_ast, context, {}, block.getColumnsList());
	ExpressionActionsPtr actions = analyzer.getActions(false);
	actions->execute(block);

	/// Отфильтруем блок.
	String filter_column_name = expression_ast->getColumnName();
	ColumnPtr filter_column = block.getByName(filter_column_name).column;
	if (auto converted = filter_column->convertToFullColumnIfConst())
		filter_column = converted;
	const IColumn::Filter & filter = dynamic_cast<ColumnUInt8 &>(*filter_column).getData();

	if (std::accumulate(filter.begin(), filter.end(), 0ul) == filter.size())
		return false;

	for (size_t i = 0; i < block.columns(); ++i)
	{
		ColumnPtr & column = block.safeGetByPosition(i).column;
		column = column->filter(filter, -1);
	}

	return true;
}
开发者ID:jacktang,项目名称:ClickHouse,代码行数:44,代码来源:VirtualColumnUtils.cpp

示例10: mParamMode

/*! TODO:
*/
TranslucencyModule::TranslucencyModule()
	:Module(MODULE_NAME, MODULE_DISPLAY_NAME, TRANSLUCENCYMODULE_VERSION),
	mParamMode(PARAMETER_NAME_MODE, Variable::eVariableTypeString, "Translucency mode", "The type of translucency to perform", false),
	mParamAlpha(PARAMETER_NAME_ALPHA, Variable::eVariableTypeDouble, "Translucency alpha", "Percentage of translucency (0=opaque, 1=invisible)", true),
	mParamInvert(PARAMETER_NAME_INVERT, Variable::eVariableTypeBool, "Invert mask", "Invert plain or alpha mask", true)
{
	mShortDescription = "Module for embedding a color image in another one with translucency effect";
	mLongDescription = "This module embeds an image into another one using an alpha mask (translucency)";

	ValueSet lModeName;
	lModeName.insert(Value("image", "Whole Image", "Whole image is made translucent using the specified alpha value"));
	lModeName.insert(Value("plainmask", "Plain Mask", "Only the image pixels where the provided mask is non zero are made translucent using the specified alpha value"));
	lModeName.insert(Value("alphamask", "Alpha Mask", "Each pixel of the mask specify the alpha value to apply to the corresponding image pixel"));
	mParamMode.setPossibleValues(lModeName);

  NameSet lDependentParameterSet;
  lDependentParameterSet.insert(PARAMETER_NAME_ALPHA);
  lDependentParameterSet.insert(PARAMETER_NAME_INVERT);
  mParamMode.setDependentParameterNameSet(lDependentParameterSet);

	mParamMode.setValueStr("plainmask");
	mParamAlpha.setValue(0.5);
	mParamAlpha.setMinValue("0");
	mParamAlpha.setMaxValue("1");
	mParamInvert.setValue(false);

	newParameter(mParamMode);
	newParameter(mParamAlpha);
	newParameter(mParamInvert);

	mInputSlotBackgroundColorImage  = newSlot(new ModuleSlot(this, INPUT_SLOT_NAME_BGIMAGE, INPUT_SLOT_DISPLAYNAME_BGIMAGE, "Background image on which embedding with be performed"));
	mInputSlotTranslucencyColorImage  = newSlot(new ModuleSlot(this, INPUT_SLOT_NAME_TRANSIMAGE, INPUT_SLOT_DISPLAYNAME_TRANSIMAGE, "Image that is going to be made translucent"));
	mInputSlotTranslucencyMaskImage  = newSlot(new ModuleSlot(this, INPUT_SLOT_NAME_ALPHAMASK, INPUT_SLOT_DISPLAYNAME_ALPHAMASK, "Alpha mask used to make translucent image"));

	mOutputSlot = newSlot(new ModuleSlot(this, OUTPUT_SLOT_NAME_IMAGE, OUTPUT_SLOT_DISPLAYNAME_IMAGE, "Output image", &mOutputFrame));

	mOutputFrameIpl = NULL;
	mOutputFrame = NULL;
	mTmpFrame1 = NULL;
	mTmpFrame2 = NULL;
	mTmpFrame3 = NULL;
	mTmpFrame4 = NULL;
	mTmpFrame5 = NULL;
}
开发者ID:fjean,项目名称:vipers,代码行数:46,代码来源:Translucency.cpp

示例11: filter

NamesAndTypesList NamesAndTypesList::filter(const NameSet & names) const
{
    NamesAndTypesList res;
    for (const NameAndTypePair & column : *this)
    {
        if (names.count(column.name))
            res.push_back(column);
    }
    return res;
}
开发者ID:chipitsine,项目名称:ClickHouse,代码行数:10,代码来源:NamesAndTypes.cpp

示例12: filterBlockWithQuery

bool filterBlockWithQuery(const ASTPtr & query, Block & block, const Context & context)
{
    const ASTSelectQuery & select = typeid_cast<const ASTSelectQuery & >(*query);
    if (!select.where_expression && !select.prewhere_expression)
        return false;

    NameSet columns;
    for (const auto & it : block.getColumnsList())
        columns.insert(it.name);

    /// We will create an expression that evaluates the expressions in WHERE and PREWHERE, depending only on the existing columns.
    std::vector<ASTPtr> functions;
    if (select.where_expression)
        extractFunctions(select.where_expression, columns, functions);
    if (select.prewhere_expression)
        extractFunctions(select.prewhere_expression, columns, functions);
    ASTPtr expression_ast = buildWhereExpression(functions);
    if (!expression_ast)
        return false;

    /// Let's parse and calculate the expression.
    ExpressionAnalyzer analyzer(expression_ast, context, {}, block.getColumnsList());
    ExpressionActionsPtr actions = analyzer.getActions(false);
    actions->execute(block);

    /// Filter the block.
    String filter_column_name = expression_ast->getColumnName();
    ColumnPtr filter_column = block.getByName(filter_column_name).column;
    if (auto converted = filter_column->convertToFullColumnIfConst())
        filter_column = converted;
    const IColumn::Filter & filter = dynamic_cast<ColumnUInt8 &>(*filter_column).getData();

    if (countBytesInFilter(filter) == 0)
        return false;

    for (size_t i = 0; i < block.columns(); ++i)
    {
        ColumnPtr & column = block.safeGetByPosition(i).column;
        column = column->filter(filter, -1);
    }

    return true;
}
开发者ID:yurial,项目名称:ClickHouse,代码行数:43,代码来源:VirtualColumnUtils.cpp

示例13: isValidFunction

/// Verifying that the function depends only on the specified columns
static bool isValidFunction(ASTPtr expression, const NameSet & columns)
{
    for (size_t i = 0; i < expression->children.size(); ++i)
        if (!isValidFunction(expression->children[i], columns))
            return false;

    if (const ASTIdentifier * identifier = typeid_cast<const ASTIdentifier *>(&*expression))
    {
        if (identifier->kind == ASTIdentifier::Kind::Column)
            return columns.count(identifier->name);
    }
    return true;
}
开发者ID:yurial,项目名称:ClickHouse,代码行数:14,代码来源:VirtualColumnUtils.cpp

示例14: cleanInvalidUpdateMorph

void AnimationCleanerVisitor::cleanInvalidUpdateMorph() {
    // Removes unused UpdateMorph targets (i.e. name does not match any MorphGeometry target)
    for(AnimationUpdateCallBackMap::iterator update = _updates.begin() ; update != _updates.end() ; ++ update) {
        osgAnimation::UpdateMorph *updateMorph = dynamic_cast<osgAnimation::UpdateMorph*>(update->first.get());
        if(!updateMorph) continue;

        NameSet toRemove;
        for(unsigned int i = 0, numTarget = updateMorph->getNumTarget(); i < numTarget; ++i) {
            const std::string& name = updateMorph->getTargetName(i);
            if(_morphTargets.count(name) == 0) {
                toRemove.insert(name);
            }
        }

        for(NameSet::iterator targetName = toRemove.begin(); targetName != toRemove.end(); ++targetName) {
            updateMorph->removeTarget(*targetName);
        }
    }

    // Removes empty UpdateMorphCallback
    for(AnimationUpdateCallBackMap::iterator update = _updates.begin() ; update != _updates.end() ; ) {
        osgAnimation::UpdateMorph *updateMorph = dynamic_cast<osgAnimation::UpdateMorph*>(update->first.get());
        if(!updateMorph || updateMorph->getNumTarget() != 0) {
            ++ update;
        }
        else {
            osg::Callback *callBack = update->second.get()->getUpdateCallback();
            if(callBack) {
                if(callBack == updateMorph)
                    update->second.get()->setUpdateCallback(callBack->getNestedCallback());
                else
                    callBack->removeNestedCallback(updateMorph);
            }
            _updates.erase(update ++);
        }
    }
}
开发者ID:MORTAL2000,项目名称:OpenSceneGraph,代码行数:37,代码来源:AnimationCleanerVisitor.cpp

示例15: file

// **************************************************************************
// Function:   LoadParameterList
// Purpose:    Loads the current list of parameters from a parameter file
//             It does NOT load system critical dynamic parameters (e.g., ports,
//             IP addresses)
// Parameters: char *filename - filename of the parameterlist
//             nonexisting - if true, load parameters, even if they currently do
//                       not exist in the list
// Returns:    true - successful
//             false - error
// **************************************************************************
bool
ParamList::Load( const string& inFileName, bool inImportNonexisting )
{
  ifstream file( inFileName.c_str() );
  ParamList paramsFromFile;
  file >> paramsFromFile;
  if( file.fail() )
    return false;

  typedef set<string> NameSet;
  NameSet unwantedParams;

  // Exclude parameters from unwanted sections.
  const char* unwantedSections[] = { "System", };
  for( size_t j = 0; j < sizeof( unwantedSections ) / sizeof( *unwantedSections ); ++j )
    for( ParamContainer::const_iterator i = paramsFromFile.mParams.begin();
                                         i != paramsFromFile.mParams.end(); ++i )
      if( Param::strciequal( i->Param.Section(), unwantedSections[ j ] ) )
        unwantedParams.insert( i->Param.mName );

  // If desired, exclude parameters missing from the main parameter list.
  if( !inImportNonexisting )
    for( ParamContainer::const_iterator i = paramsFromFile.mParams.begin();
                                         i != paramsFromFile.mParams.end(); ++i )
      if( mNameIndex.find( i->Param.mName ) == mNameIndex.end() )
        unwantedParams.insert( i->Param.mName );

  for( NameSet::const_iterator i = unwantedParams.begin(); i != unwantedParams.end(); ++i )
    paramsFromFile.Delete( *i );

  for( ParamContainer::const_iterator i = paramsFromFile.mParams.begin();
                                       i != paramsFromFile.mParams.end(); ++i )
    ( *this )[ i->Param.mName ].AssignValues( i->Param );

  return true;
}
开发者ID:SproutOrc,项目名称:BiteProc,代码行数:47,代码来源:ParamList.cpp


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