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


C++ TypeSet::end方法代码示例

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


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

示例1: getGreatestCommonSubtypes

TypeSet getGreatestCommonSubtypes(const TypeSet& set) {

    // handle the empty set
    if (set.empty()) return set;

    // handle the all set => empty set (since no common sub-type)
    if (set.isAll()) return TypeSet();

    TypeSet res;
    auto it = set.begin();
    res.insert(*it);
    ++it;

    // refine sub-set step by step
    for(;it != set.end(); ++it) {
        TypeSet tmp;
        for(const Type& cur : res) {
            tmp.insert(getGreatestCommonSubtypes(cur, *it));
        }
        res = tmp;
    }

    // done
    return res;
}
开发者ID:cotsog,项目名称:souffle,代码行数:25,代码来源:TypeSystem.cpp

示例2: addConnection

void IConnectionLoader::addConnection(
        VertexMap& vertices, SystemTypeGetter* info,
        int from, int to, TypeSet tags)
{
	TypeSet toType, fromType;

	toType.insert(info->getType(to));
	toType.insert(tags.begin(), tags.end());
	fromType.insert(info->getType(from));
	fromType.insert(tags.begin(), tags.end());

    //Add vertices if they dont exists already
    //this will fail if it already exists
    vertices.insert(std::make_pair(from, Vertex(from))); 
    vertices.insert(std::make_pair(to, Vertex(to)));

    //Add edges to the vertices
    vertices.find(from)->second.addEdge(to, toType);
	vertices.find(to)->second.addEdge(from, fromType);
}
开发者ID:RickyChow,项目名称:DropbearsExpress,代码行数:20,代码来源:IConnectionLoader.cpp

示例3: getTypeInfo

/*******************************************************************
* Function:	ArrayIndexAnalysis::getTypeInfo
* Purpose : Get an array dimensions' information
* Initial : Nurudeen A. Lameed on July 21, 2009
********************************************************************
Revisions and bug fixes:
*/
inline TypeInfo ArrayIndexAnalysis::getTypeInfo(const IIRNode* node, const SymbolExpr* symbol) const
{
    // retrieve the type set
    TypeInfoMap post = typeInferenceInfo->postTypeMap;
    TypeSet tSet = (post[node])[symbol];

    // look for one with bounds information
    // if none has the info, return an empty type info.
    for (TypeSet::const_iterator it = tSet.begin(), iEnd = tSet.end(); it != iEnd; ++it)
    {
        TypeInfo typ = *it;

        if ( typ.getSizeKnown() )
        {
            return *it;
        }
    }

    return TypeInfo(); // return an empty type info
}
开发者ID:dcdelia,项目名称:mcvm,代码行数:27,代码来源:analysis_boundscheck.cpp

示例4: drop_single_impl_collision

/**
 * Move all single impl in a single impl method signature to next pass.
 * We make a single optimization per pass over any given single impl so
 * I1, I2 and void I1.m(I2)
 * the first optimization (I1 or I2) moves the other interface to next pass.
 * That is not the case for methods on non optimizable classes, so for
 * I1, I2 and void C.m(I1, I2)
 * then m is changed in a single pass for both I1 and I2.
 */
void OptimizationImpl::drop_single_impl_collision(DexType* intf,
                                                  SingleImplData& data,
                                                  DexMethod* method) {
  auto check_type = [&](DexType* type) {
    if (type != intf && single_impls->is_single_impl(type) &&
        !single_impls->is_escaped(type)) {
      single_impls->escape_interface(type, NEXT_PASS);
      assert(optimized.find(type) == optimized.end());
    }
  };

  auto owner = method->get_class();
  if (!single_impls->is_single_impl(owner)) return;
  check_type(owner);
  auto proto = method->get_proto();
  check_type(proto->get_rtype());
  auto args_list = proto->get_args();
  for (auto arg : args_list->get_type_list()) {
    check_type(arg);
  }
}
开发者ID:foukation,项目名称:redex,代码行数:30,代码来源:SingleImplOptimize.cpp

示例5: run_pass

void RenameClassesPass::run_pass(DexStoresVector& stores,
                                 ConfigFiles& cfg,
                                 PassManager& mgr) {
  const JsonWrapper& json_cfg = cfg.get_json_config();
  if (json_cfg.get("emit_name_based_locators", false)) {
    // TODO: Purge the old RenameClassesPass entirely everywhere.
    fprintf(stderr,
            "[RenameClassesPass] error: Configuration option "
            "emit_locator_strings is not compatible with RenameClassesPass. "
            "Upgrade to RenameClassesPassV2 instead.\n");
    exit(EXIT_FAILURE);
  }

  auto scope = build_class_scope(stores);
  ClassHierarchy ch = build_type_hierarchy(scope);
  std::unordered_set<const DexType*> untouchables;
  for (const auto& base : m_untouchable_hierarchies) {
    auto base_type = DexType::get_type(base.c_str());
    if (base_type != nullptr) {
      untouchables.insert(base_type);
      TypeSet children;
      get_all_children(ch, base_type, children);
      untouchables.insert(children.begin(), children.end());
    }
  }
  mgr.incr_metric(METRIC_CLASSES_IN_SCOPE, scope.size());
  rename_classes(
      scope, m_pre_filter_whitelist, m_post_filter_whitelist,
      untouchables, m_rename_annotations, mgr);
  TRACE(RENAME, 1,
      "renamed classes: %d anon classes, %d from single char patterns, "
      "%d from multi char patterns\n",
      match_inner,
      match_short,
      match_long);
  TRACE(RENAME, 1, "String savings, at least %d bytes \n",
      base_strings_size - ren_strings_size);
}
开发者ID:JoelMarcey,项目名称:redex,代码行数:38,代码来源:RenameClasses.cpp

示例6: optimize

/**
 * Run an optimization step.
 */
size_t OptimizationImpl::optimize(Scope& scope) {
  TypeList to_optimize;
  single_impls->get_interfaces(to_optimize);
  for (auto intf : to_optimize) {
    auto& intf_data = single_impls->get_single_impl_data(intf);
    TRACE(INTF, 3, "(OPT) %s => %s\n", SHOW(intf), SHOW(intf_data.cls));
    if (intf_data.is_escaped()) continue;
    auto escape = can_optimize(intf, intf_data);
    if (escape != EscapeReason::NO_ESCAPE) {
      single_impls->escape_interface(intf, escape);
      continue;
    }
    do_optimize(intf, intf_data);
    optimized.insert(intf);
  }
  // make a new scope deleting all single impl interfaces
  Scope new_scope;
  for (auto cls : scope) {
    if (optimized.find(cls->get_type()) != optimized.end()) continue;
    new_scope.push_back(cls);
  }
  scope.swap(new_scope);
  return optimized.size();
}
开发者ID:foukation,项目名称:redex,代码行数:27,代码来源:SingleImplOptimize.cpp

示例7: process

bool CalculateAmplitudes::process() {
    //_ui.btnOK->setEnabled(false);

    _processors.clear();
    _ui.table->setRowCount(0);

    Core::TimeWindow acTimeWindow;

    if ( !_origin || (_recomputeAmplitudes && !_thread) )
        return false;

    if ( _amplitudeTypes.empty() )
        return false;

    _timeWindow = Core::TimeWindow();

    /*
    TypeSet wantedAmpTypes;

    wantedAmpTypes.insert("MLv");
    wantedAmpTypes.insert("mb");
    wantedAmpTypes.insert("mB");
    wantedAmpTypes.insert("Mwp");

    try {
    	vector<string> amps = SCApp->configGetStrings("amplitudes");
    	wantedAmpTypes.clear();
    	wantedAmpTypes.insert(amps.begin(), amps.end());
    }
    catch (...) {}
    */

    QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));

    if ( _thread )
        _thread->connect();

    typedef pair<PickCPtr, double> PickStreamEntry;

    // Typedef a pickmap that maps a streamcode to a pick
    typedef map<string, PickStreamEntry> PickStreamMap;

    // This map is needed to find the earliest P pick of
    // a certain stream
    PickStreamMap pickStreamMap;

    for ( size_t i = 0; i < _origin->arrivalCount(); ++i ) {
        Arrival *ar = _origin->arrival(i);

        double weight = 1.;
        try {
            weight = ar->weight();
        }
        catch (Seiscomp::Core::ValueException) {}

        if ( Util::getShortPhaseName(ar->phase().code()) != 'P' || weight < 0.5 ) {
            continue;
        }

        Pick *pick = Pick::Find(ar->pickID());
        if ( !pick ) {
// 			cerr << " - Skipping arrival " << i << " -> no pick found" << endl;
            continue;
        }

        double dist = -1;

        try {
            dist = ar->distance();
        }
        catch ( Core::ValueError &e ) {
            try {
                Client::StationLocation loc;
                double azi1, azi2;

                loc = Client::Inventory::Instance()->stationLocation(pick->waveformID().networkCode(), pick->waveformID().stationCode(), pick->time().value());
                Math::Geo::delazi(loc.latitude, loc.longitude, _origin->latitude(), _origin->longitude(), &dist, &azi1, &azi2);
            }
            catch ( Core::GeneralException &e ) {}
        }


        DataModel::WaveformStreamID wfid = pick->waveformID();
        // Strip the component code because every AmplitudeProcessor
        // will use its own component to pick the amplitude on
        wfid.setChannelCode(wfid.channelCode().substr(0,2));

        string streamID = waveformIDToStdString(wfid);
        PickStreamEntry &e = pickStreamMap[streamID];

        // When there is already a pick registered for this stream which has
        // been picked earlier, ignore the current pick
        if ( e.first && e.first->time().value() < pick->time().value() )
            continue;

        e.first = pick;
        e.second = dist;
    }

    for ( PickStreamMap::iterator it = pickStreamMap.begin(); it != pickStreamMap.end(); ++it ) {
//.........这里部分代码省略.........
开发者ID:peacocks,项目名称:seiscomp3,代码行数:101,代码来源:calculateamplitudes.cpp


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