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


C++ VecStr类代码示例

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


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

示例1: icd9ChildrenShortUnordered

// [[Rcpp::export]]
CV icd9ChildrenShortUnordered(const CV &icd9Short,
                              const VecStr &icd9cmReal,
                              const bool onlyReal) {
  icd_set out;
  if (icd9Short.size() == 0) {
    CV out;
    out.attr("icd_short_diag") = true;
    return out;
  }
  List parts         = icd9ShortToParts(icd9Short, "");
  CV mjr             = parts[0];
  CV mnr             = parts[1];
  CV::iterator itmjr = mjr.begin();
  CV::iterator itmnr = mnr.begin();
  for (; itmjr != mjr.end(); ++itmjr, ++itmnr) {
    Str thismjr = as<Str>(*itmjr);
    Str thismnr = as<Str>(*itmnr);
    const CV newminors =
      icd9ExpandMinor(thismnr, icd9IsASingleE(thismjr.c_str()));
    VecStr newshort = as<VecStr>(icd9MajMinToShort(thismjr, newminors));
    out.insert(newshort.begin(), newshort.end());
  }
  if (onlyReal) {
    icd_set out_real;
    icd_set reals(icd9cmReal.begin(), icd9cmReal.end());
    for (icd_set::iterator j = out.begin(); j != out.end(); ++j) {
      if (reals.find(*j) != reals.end()) out_real.insert(*j);
    }
    out = out_real;
  }
  CV rcppOut                     = wrap(out);
  rcppOut.attr("icd_short_diag") = true;
  return rcppOut;
}
开发者ID:anobel,项目名称:icd,代码行数:35,代码来源:ranges.cpp

示例2: icd9ChildrenShort

// [[Rcpp::export]]
CV icd9ChildrenShort(CV icd9Short, const VecStr &icd9cmReal, bool onlyReal) {
  std::set<Str> out;
  if (icd9Short.size() == 0) {
    icd9Short.attr("icd_short_diag") = true;
    return icd9Short;
  }
  List parts         = icd9ShortToParts(icd9Short, "");
  CV mjr             = parts[0];
  CV mnr             = parts[1];
  CV::iterator itmjr = mjr.begin();
  CV::iterator itmnr = mnr.begin();
  for (; itmjr != mjr.end(); ++itmjr, ++itmnr) {
    Str thismjr = as<Str>(*itmjr);
    Str thismnr = as<Str>(*itmnr);
    const CV newminors =
      icd9ExpandMinor(thismnr, icd9IsASingleE(thismjr.c_str()));
    VecStr newshort = as<VecStr>(icd9MajMinToShort(thismjr, newminors));
    out.insert(newshort.begin(), newshort.end());
  }
  if (onlyReal) {
    std::set<Str> out_real;
    const std::set<Str> reals(icd9cmReal.begin(), icd9cmReal.end());
    std::set_intersection(out.begin(),
                          out.end(),
                          reals.begin(),
                          reals.end(),
                          std::inserter(out_real, out_real.begin()));
    out = out_real;
  }
  CV rcppOut                     = wrap(out);
  rcppOut.attr("icd_short_diag") = true;
  return rcppOut;
}
开发者ID:anobel,项目名称:icd,代码行数:34,代码来源:ranges.cpp

示例3: vecStrToReadObjs

std::vector<READ> vecStrToReadObjs(const VecStr & strs, const std::string & stubName){
	std::vector<READ> ans;
	for(const auto & strPos : iter::range(strs.size())){
		ans.emplace_back(READ(seqInfo(stubName + "." + leftPadNumStr(strPos, strs.size()), strs[strPos])));
	}
	return ans;
}
开发者ID:bailey-lab,项目名称:bibseq,代码行数:7,代码来源:seqToolsUtils.hpp

示例4: readObjsToVecStr

VecStr readObjsToVecStr(const std::vector<T> & vec){
	VecStr ans;
	for(const auto & read : vec){
		ans.emplace_back(read.seqBase_.seq_);
	}
	return ans;
}
开发者ID:bailey-lab,项目名称:bibseq,代码行数:7,代码来源:seqToolsUtils.hpp

示例5: st

void ParserMgr::InitParsers()
{
#ifdef DEBUG_PM_FUNC
    ScopeTracker st("ParserMgr::InitParsers", std::this_thread::get_id());
#endif
    try
    {
        VecStr expressions;
        for (size_t i=0; i<ds::NUM_MODELS; ++i)
        {
            const ParamModelBase* model = _modelMgr->Model((ds::PMODEL)i);
            if (model->DoEvaluate())
            {
                VecStr model_exprns = model->Expressions();
                expressions.insert(expressions.end(),
                                       model_exprns.begin(),
                                       model_exprns.end());
            }
        }
        SetExpression(expressions);
            //Note that the expressions are not actually evaluated at this point
    }
    catch (mu::ParserError& e)
    {
        _log->AddExcept("ParserMgr::InitParsers: " + std::string(e.GetMsg()));
    }
}
开发者ID:mattphillipsphd,项目名称:DynaSys,代码行数:27,代码来源:parsermgr.cpp

示例6: findLongestSharedSeqFromReads

VecStr findLongestSharedSeqFromReads(const std::vector<T>& reads) {
  VecStr seqs;
  for (const auto& rIter : reads) {
    seqs.push_back(rIter.seqBase_.seq_);
  }
  return seqUtil::findLongestShardedMotif(seqs);
}
开发者ID:bailey-lab,项目名称:bibseq,代码行数:7,代码来源:seqToolsUtils.hpp

示例7: extractCols

VecStr TableReader::extractCols(const VecStr & row, const VecStr & cols) const{
	VecStr ret;
	ret.reserve(cols.size());
	for(const auto & col : cols){
		ret.emplace_back(row[header_.getColPos(col)]);
	}
	return ret;
}
开发者ID:bailey-lab,项目名称:bibseq,代码行数:8,代码来源:TableReader.cpp

示例8: Keys

VecStr ParamModelBase::Keys() const
{
    VecStr vs;
    const size_t num_pars = _parameters.size();
    for (size_t i=0; i<num_pars; ++i)
        vs.push_back(Key(i));
    return vs;
}
开发者ID:mattphillipsphd,项目名称:DynaSys,代码行数:8,代码来源:parammodelbase.cpp

示例9: getStringsContains

VecStr getStringsContains(const VecStr& vec, const std::string& contains) {
  VecStr ans;
  for (const auto& iter : vec) {
    if (iter.find(contains) != std::string::npos) {
      ans.push_back(iter);
    }
  }
  return ans;
}
开发者ID:bailey-lab,项目名称:bibseq,代码行数:9,代码来源:vectorUtils.cpp

示例10: fastPermuteVectorOneLength

const VecStr fastPermuteVectorOneLength(std::string vec) {
  VecStr ans;
  int numOfPermutes = Factorial((int)vec.size());
  ans.reserve(numOfPermutes);
  do {
    ans.push_back(vec);
  } while (std::next_permutation(vec.begin(), vec.end()));
  return ans;
}
开发者ID:bailey-lab,项目名称:bibseq,代码行数:9,代码来源:vectorUtils.cpp

示例11: numVecToVecStr

VecStr numVecToVecStr(const std::vector<T>& nums) {
	VecStr ans;
	ans.reserve(nums.size());
	// std::generate_n(ans.begin(), nums.size(), [](const T & num) {return
	// estd::to_string(num);});
	for (const auto& num : nums) {
		ans.emplace_back(estd::to_string(num));
	}
	return ans;
}
开发者ID:bailey-lab,项目名称:bibseq,代码行数:10,代码来源:vectorUtils.hpp

示例12: alignToSeqStrings

VecStr alignToSeqStrings(const std::vector<READ>& reads, const REF& reference,
                         aligner& alignObj, bool local, bool usingQuality) {
  VecStr output;
  output.push_back(reference.seqBase_.seq_);
  for (const auto read : reads) {
    alignObj.alignCache(reference, read, local);
    output.push_back(alignObj.alignObjectB_.seqBase_.seq_);
  }
  return output;
}
开发者ID:bailey-lab,项目名称:bibseq,代码行数:10,代码来源:seqToolsUtils.hpp

示例13: tokenizeString

VecStr tokenizeString(const std::string& str, const std::string& delim,
                      bool addEmptyToEnd = false) {
  VecStr output;
  if("whitespace" == delim){
    std::stringstream tempStream(str);
    while (!tempStream.eof()) {
      std::string tempName;
      tempStream >> tempName;
      output.emplace_back(tempName);
    }
  }else{
开发者ID:bailey-lab,项目名称:graphSourceCode,代码行数:11,代码来源:main.cpp

示例14: longToRagged

int longToRagged(const SEXP& icd9df, VecVecStr& ragged, VecStr& visitIds,
		const std::string visitId, const std::string icd9Field =
				"icd9", bool aggregate = true) {
#ifdef ICD9_VALGRIND
	CALLGRIND_START_INSTRUMENTATION;
#endif
	SEXP icds = PROTECT(getRListOrDfElement(icd9df, icd9Field.c_str()));
	SEXP vsexp = PROTECT(getRListOrDfElement(icd9df, visitId.c_str()));
	const int approx_cmb_per_visit = 15; // just an estimate. Prob best to overestimate.
	int vlen = Rf_length(icds);
	visitIds.reserve(vlen / approx_cmb_per_visit);
	ragged.reserve(vlen / approx_cmb_per_visit);
	int max_per_pt = 1;
	if (TYPEOF(vsexp) != STRSXP)
	  Rcpp::stop("need string input to longToRagged\n");
#ifdef ICD9_DEBUG
	Rcpp::Rcout << "longToRagged SEXP is STR\n";
#endif

	const char* lastVisitId = "";
	for (int i = 0; i < vlen; ++i) {
	  // always STRING? may get numeric, integer, factor? Can always handle this on R side
		const char* icd = CHAR(STRING_ELT(icds, i));
		const char* vi = CHAR(STRING_ELT(vsexp, i));

		if (strcmp(lastVisitId, vi) != 0
				&& (!aggregate
						|| std::find(visitIds.rbegin(), visitIds.rend(), vi)
								== visitIds.rend())) {
			VecStr vcodes;
			vcodes.reserve(approx_cmb_per_visit); // estimate of number of codes per patient.
			vcodes.push_back(icd); // new vector of ICD codes with this first item
			ragged.push_back(vcodes); // and add that vector to the intermediate structure
			visitIds.push_back(vi);
		} else {
#ifdef ICD9_DEBUG
			if (ragged.size()==0) {
				Rcout << "ragged size is ZERO! aborting\n";
				break;
			}
#endif
			ragged[ragged.size() - 1].push_back(icd); // augment vec for current visit and N/V/E type // EXPENSIVE.
			int len = ragged[ragged.size() - 1].size(); // get new count of cmb for one patient
			if (len > max_per_pt)
				max_per_pt = len;
		}
#ifdef ICD9_DEBUG_TRACE
		Rcout << "ragged size is " << ragged.size() << "\n";
#endif

		lastVisitId = vi;
	} // end loop through all visit-code input data

#ifdef ICD9_VALGRIND
	CALLGRIND_STOP_INSTRUMENTATION;
	//        CALLGRIND_DUMP_STATS;
#endif
	UNPROTECT(2); // do sooner if possible?
	return max_per_pt;
}
开发者ID:matt2005,项目名称:icd9,代码行数:60,代码来源:longToWide.cpp

示例15: getNextRow

bool TableReader::getNextRow(VecStr & row){
	std::string currentLine = "";
	row.clear();
	if(njh::files::crossPlatGetline(*in_, currentLine)){
		row = tokenizeString(currentLine, tabOpts_.inDelim_, true);
		if(row.size() != header_.nCol()){
			std::stringstream ss;
			ss << __PRETTY_FUNCTION__ << ", error the row has a different number of columns than the first line" << "\n";
			ss << "rowSize: " << row.size() << ", firstLineSize: " << header_.nCol() << "\n";
			ss << "row: " << currentLine << "\n";
			throw std::runtime_error{ss.str()};
		}
		return true;
	}
	return false;
}
开发者ID:bailey-lab,项目名称:bibseq,代码行数:16,代码来源:TableReader.cpp


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