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


C++ VString::size方法代码示例

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


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

示例1:

MStringS::MStringS(const VString string){
	int size=string.size();
	if (!size) {data=0; return ;}
	data=(short*)new char[size*2+2];
	//MString ret; ret.Reserv(size);
	for(int i=0; i<size; i++) data[i]=ctos(string[i]);
	sz=size; data[sz]=0;
	return ;
}
开发者ID:mikelsv,项目名称:opensource,代码行数:9,代码来源:wince-twoms.cpp

示例2:

void Utils::CLogger::SetInstanceFilter( VString& filterList )
{
	// 删除Root的Appender,等于不输出任何信息
	log4cplus::Logger rootLogger = log4cplus::Logger::getRoot();
	rootLogger.removeAllAppenders();

	// 设置要求输出的Instance
	size_t iCount=filterList.size();
	for ( size_t i=0; i<iCount; i++)
	{
		log4cplus::Logger logger = log4cplus::Logger::getInstance(filterList[i].GetString());
		logger.addAppender(GetAppender());
#ifdef _DEBUG
		logger.addAppender(GetDebugAppender());
#endif // _DEBUG
	}
}
开发者ID:wang1986one,项目名称:duipcmgr,代码行数:17,代码来源:Log4cplus.cpp

示例3: join

VString VStringList::join(const VString &separator) const
{
    int l = size()-1;
    VString ret;
    // немного ускоряем работу
    ret.reserve(l * separator.size());

    for(int i=0; i<l; ++i)
    {
	ret.append(at(i));
	ret.append(separator);
    }

    if(!isEmpty())
	ret.append(at(size()-1));
    return ret;
}
开发者ID:Vourhey,项目名称:Vt--Vadim-Technology-,代码行数:17,代码来源:vstringlist.cpp

示例4: main


//.........这里部分代码省略.........
  bbb.MergeAndAdd(cb_et.cp().era({"7TeV"}).bin_id({3, 5}).process({"W"}), cb);
  bbb.MergeAndAdd(cb_et.cp().era({"8TeV"}).bin_id({1, 2}).process({"ZL", "ZJ", "QCD", "W"}), cb);
  bbb.MergeAndAdd(cb_et.cp().era({"8TeV"}).bin_id({3, 5}).process({"W"}), cb);
  bbb.MergeAndAdd(cb_et.cp().era({"7TeV"}).bin_id({6}).process({"ZL", "ZJ", "W", "ZTT"}), cb);
  //! [part3]
  bbb.MergeAndAdd(cb_et.cp().era({"8TeV"}).bin_id({6}).process({"ZL", "ZJ", "W"}), cb);
  //! [part3]
  bbb.MergeAndAdd(cb_et.cp().era({"8TeV"}).bin_id({7}).process({"ZL", "ZJ", "W", "ZTT"}), cb);

  ch::CombineHarvester cb_mt = cb.cp().channel({"mt"});
  bbb.MergeAndAdd(cb_mt.cp().era({"7TeV"}).bin_id({1, 2, 3, 4}).process({"W", "QCD"}), cb);
  bbb.MergeAndAdd(cb_mt.cp().era({"8TeV"}).bin_id({1, 2, 3, 4}).process({"W", "QCD"}), cb);
  bbb.MergeAndAdd(cb_mt.cp().era({"7TeV"}).bin_id({5}).process({"W"}), cb);
  bbb.MergeAndAdd(cb_mt.cp().era({"7TeV"}).bin_id({6}).process({"W", "ZTT"}), cb);
  bbb.MergeAndAdd(cb_mt.cp().era({"8TeV"}).bin_id({5, 6}).process({"W"}), cb);
  bbb.MergeAndAdd(cb_mt.cp().era({"8TeV"}).bin_id({7}).process({"W", "ZTT"}), cb);

  ch::CombineHarvester cb_em = cb.cp().channel({"em"});
  bbb.MergeAndAdd(cb_em.cp().era({"7TeV"}).bin_id({1, 3}).process({"Fakes"}), cb);
  bbb.MergeAndAdd(cb_em.cp().era({"8TeV"}).bin_id({1, 3}).process({"Fakes"}), cb);
  bbb.MergeAndAdd(cb_em.cp().era({"7TeV"}).bin_id({4}).process({"Fakes", "EWK", "Ztt"}), cb);
  bbb.MergeAndAdd(cb_em.cp().era({"8TeV"}).bin_id({5}).process({"Fakes", "EWK", "Ztt"}), cb);
  bbb.MergeAndAdd(cb_em.cp().era({"8TeV"}).bin_id({4}).process({"Fakes", "EWK"}), cb);

  ch::CombineHarvester cb_tt = cb.cp().channel({"tt"});
  bbb.MergeAndAdd(cb_tt.cp().era({"8TeV"}).bin_id({0, 1, 2}).process({"ZTT", "QCD"}), cb);

  bbb.SetAddThreshold(0.);  // ee and mm use a different threshold
  ch::CombineHarvester cb_ll = cb.cp().channel({"ee", "mm"});
  bbb.MergeAndAdd(cb_ll.cp().era({"7TeV"}).bin_id({1, 3, 4}).process({"ZTT", "ZEE", "ZMM", "TTJ"}), cb);
  bbb.MergeAndAdd(cb_ll.cp().era({"8TeV"}).bin_id({1, 3, 4}).process({"ZTT", "ZEE", "ZMM", "TTJ"}), cb);

  cout << ">> Setting standardised bin names...\n";
  ch::SetStandardBinNames(cb);
  //! [part4]
  VString droplist = ch::ParseFileLines(
    aux_pruning + "uncertainty-pruning-drop-131128-sm.txt");
  cout << ">> Droplist contains " << droplist.size() << " entries\n";

  set<string> to_drop;
  for (auto x : droplist) to_drop.insert(x);

  auto pre_drop = cb.syst_name_set();
  cb.syst_name(droplist, false);
  auto post_drop = cb.syst_name_set();
  cout << ">> Systematics dropped: " << pre_drop.size() - post_drop.size()
            << "\n";
  //! [part4]

  // The following is an example of duplicating existing objects and modifying
  // them in the process. Here we clone all mH=125 signals, adding "_SM125" to
  // the process name, switching it to background and giving it the generic mass
  // label. This would let us create a datacard for doing a second Higgs search

  // ch::CloneProcsAndSysts(cb.cp().signals().mass({"125"}), cb,
  //                        [](ch::Object* p) {
  //   p->set_process(p->process() + "_SM125");
  //   p->set_signal(false);
  //   p->set_mass("*");
  // });


  // Writing datacards manually - easier with CardWriter below:

  // string folder = "output/sm_cards/LIMITS";
  // boost::filesystem::create_directories(folder);
  // boost::filesystem::create_directories(folder + "/common");
  // for (auto m : masses) {
  //   boost::filesystem::create_directories(folder + "/" + m);
  // }

  // for (string chn : chns) {
  //   TFile output((folder + "/common/htt_" + chn + ".input.root").c_str(),
  //                "RECREATE");
  //   auto bins = cb.cp().channel({chn}).bin_set();
  //   for (auto b : bins) {
  //     for (auto m : masses) {
  //       cout << ">> Writing datacard for bin: " << b << " and mass: " << m
  //                 << "\r" << flush;
  //       cb.cp().channel({chn}).bin({b}).mass({m, "*"}).WriteDatacard(
  //           folder + "/" + m + "/" + b + ".txt", output);
  //     }
  //   }
  //   output.Close();
  // }



  // Here we define a CardWriter with a template for how the text datacard
  // and the root files should be named.
  ch::CardWriter writer("$TAG/$MASS/$ANALYSIS_$CHANNEL_$BINID_$ERA.txt",
                        "$TAG/common/$ANALYSIS_$CHANNEL.input_$ERA.root");
  // writer.SetVerbosity(1);
  writer.WriteCards("output/sm_cards/cmb", cb);
  for (auto chn : cb.channel_set()) {
    writer.WriteCards("output/sm_cards/" + chn, cb.cp().channel({chn}));
  }

  cout << "\n>> Done!\n";
}
开发者ID:capalmer85,项目名称:CombineHarvester,代码行数:101,代码来源:SMLegacyExample.cpp

示例5: main


//.........这里部分代码省略.........
    bbb.MergeAndAdd(cb_et.cp().era({"8TeV"}).bin_id({1, 2}).process({"ZL", "ZJ", "QCD", "W"}), cb);
    bbb.MergeAndAdd(cb_et.cp().era({"8TeV"}).bin_id({3, 5}).process({"W"}), cb);
    bbb.MergeAndAdd(cb_et.cp().era({"7TeV"}).bin_id({6}).process({"ZL", "ZJ", "W", "ZTT"}), cb);
    bbb.MergeAndAdd(cb_et.cp().era({"8TeV"}).bin_id({6}).process({"ZL", "ZJ", "W"}), cb);
    bbb.MergeAndAdd(cb_et.cp().era({"8TeV"}).bin_id({7}).process({"ZL", "ZJ", "W", "ZTT"}), cb);

    ch::CombineHarvester cb_mt = cb.cp().channel({"mt"});
    bbb.MergeAndAdd(cb_mt.cp().era({"7TeV"}).bin_id({1, 2, 3, 4}).process({"W", "QCD"}), cb);
    bbb.MergeAndAdd(cb_mt.cp().era({"8TeV"}).bin_id({1, 2, 3, 4}).process({"W", "QCD"}), cb);
    bbb.MergeAndAdd(cb_mt.cp().era({"7TeV"}).bin_id({5}).process({"W"}), cb);
    bbb.MergeAndAdd(cb_mt.cp().era({"7TeV"}).bin_id({6}).process({"W", "ZTT"}), cb);
    bbb.MergeAndAdd(cb_mt.cp().era({"8TeV"}).bin_id({5, 6}).process({"W"}), cb);
    bbb.MergeAndAdd(cb_mt.cp().era({"8TeV"}).bin_id({7}).process({"W", "ZTT"}), cb);

    ch::CombineHarvester cb_em = cb.cp().channel({"em"});
    bbb.MergeAndAdd(cb_em.cp().era({"7TeV"}).bin_id({1, 3}).process({"Fakes"}), cb);
    bbb.MergeAndAdd(cb_em.cp().era({"8TeV"}).bin_id({1, 3}).process({"Fakes"}), cb);
    bbb.MergeAndAdd(cb_em.cp().era({"7TeV"}).bin_id({4}).process({"Fakes", "EWK", "Ztt"}), cb);
    bbb.MergeAndAdd(cb_em.cp().era({"8TeV"}).bin_id({5}).process({"Fakes", "EWK", "Ztt"}), cb);
    bbb.MergeAndAdd(cb_em.cp().era({"8TeV"}).bin_id({4}).process({"Fakes", "EWK"}), cb);

    ch::CombineHarvester cb_tt = cb.cp().channel({"tt"});
    bbb.MergeAndAdd(cb_tt.cp().era({"8TeV"}).bin_id({0, 1, 2}).process({"ZTT", "QCD"}), cb);

    bbb.SetAddThreshold(0.);  // ee and mm use a different threshold
    ch::CombineHarvester cb_ll = cb.cp().channel({"ee", "mm"});
    bbb.MergeAndAdd(cb_ll.cp().era({"7TeV"}).bin_id({1, 3, 4}).process({"ZTT", "ZEE", "ZMM", "TTJ"}), cb);
    bbb.MergeAndAdd(cb_ll.cp().era({"8TeV"}).bin_id({1, 3, 4}).process({"ZTT", "ZEE", "ZMM", "TTJ"}), cb);

    cout << ">> Setting standardised bin names...\n";
    ch::SetStandardBinNames(cb);
    VString droplist = ch::ParseFileLines(
                           aux_pruning + "uncertainty-pruning-drop-131128-sm.txt");
    cout << ">> Droplist contains " << droplist.size() << " entries\n";

    set<string> to_drop;
    for (auto x : droplist) to_drop.insert(x);

    auto pre_drop = cb.syst_name_set();
    cb.syst_name(droplist, false);
    auto post_drop = cb.syst_name_set();
    cout << ">> Systematics dropped: " << pre_drop.size() - post_drop.size()
         << "\n";


    map<string, bool> can_morph = {
        {"et", true},
        {"mt", true},
        {"em", true},
        {"ee", false},
        {"mm", false},
        {"tt", true}
    };

    RooWorkspace ws("htt", "htt");
    RooRealVar mh("MH", "", 125, 90, 145);

    // TFile demo("htt_sm_morphing_debug.root", "RECREATE");
    //! [part1]
    bool do_morphing = true;
    if (do_morphing) {
        // RooMsgService::instance().setGlobalKillBelow(RooFit::WARNING);
        for (auto chn : chns) {
            auto bins = cb.cp().channel({chn}).bin_set();
            for (auto bin : bins) {
                for (auto p : sig_procs) {
开发者ID:truggles,项目名称:CombineHarvester,代码行数:67,代码来源:SMLegacyMorphing.cpp

示例6: _setEntityMaterial

VBOOL VLogicModel::_setEntityMaterial(const VString &entityName, const VString &matName)
{
    if (matName.empty())
    {
        return VTRUE;
    }
    else
    {
        VEntityMap::iterator itr = mEntities.find(entityName);

        if (itr == mEntities.end())
        {
            Ogre::LogManager::getSingleton().logMessage( "Logic Model Entity with name '" + entityName + "' dosen't exists! " +
                    "LogicModel::_setEntityMaterial " + mName );
            return VFALSE;
        }

        VEntityValue &entValue = itr->second;
        Ogre::Entity *entity = entValue.mEntity;
        assert(entity);

        if (matName.find(";") != VString::npos)
        {
            Ogre::StringVector matNames = Ogre::StringUtil::split(matName, ";");
            assert(matName.size() > 1);

            for (VUINT32 i = 0; i < entity->getNumSubEntities(); ++i)
            {
                Ogre::SubEntity *subEntity = entity->getSubEntity(i);
                assert(subEntity);

                VString subMatName;

                if (i < matNames.size())
                {
                    subMatName = matNames[i];
                }
                else
                {
                    subMatName = matNames[0];
                }

                const Ogre::MaterialPtr subMat = Ogre::MaterialManager::getSingleton().getByName(subMatName);
                if (!subMat.isNull())
                {
                    subEntity->setMaterialName(subMatName);
                }
            }
        }
        else
        {
            const Ogre::MaterialPtr entityMat = Ogre::MaterialManager::getSingleton().getByName(matName);
            if (!entityMat.isNull())
            {
                entity->setMaterialName(matName);
            }
        }
    }

    return VTRUE;
}
开发者ID:asnwerear,项目名称:VEngine,代码行数:61,代码来源:VLogicModel.cpp


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