示例#1
0
TEST_F(IdfFixture, IdfObject_GroupPushingAndPopping) {
  // NON-EXTENSIBLE OBJECT
  IdfObject object(IddObjectType::Lights);
  EXPECT_TRUE(object.pushExtensibleGroup().empty());

  // MINFIELDS INCLUDES AN EXTENSIBLE GROUP, BUT EXTENSIBLE GROUPS STILL INITIALIZED AS EMPTY
  object = IdfObject(IddObjectType::BuildingSurface_Detailed);
  EXPECT_EQ(static_cast<unsigned>(10),object.numFields());
  // push empty strings
  EXPECT_FALSE(object.pushExtensibleGroup().empty());
  EXPECT_EQ(static_cast<unsigned>(13),object.numFields());
  // push non-empty strings (correct number)
  StringVector values;
  values.push_back("2.1");
  values.push_back("100.0");
  values.push_back("0.0");
  EXPECT_FALSE(object.pushExtensibleGroup(values).empty());
  EXPECT_EQ(static_cast<unsigned>(16),object.numFields());
  // try to push incorrect number of non-empty strings
  values.pop_back();
  EXPECT_TRUE(object.pushExtensibleGroup(values).empty());
  EXPECT_EQ(static_cast<unsigned>(16),object.numFields());
  // pop until false
  StringVector result;
  result.push_back("Fake entry.");
  unsigned n = 16;
  while (!result.empty()) {
    result = object.popExtensibleGroup();
    if (!result.empty()) { n -= 3; }
    EXPECT_EQ(n,object.numFields());
  }
  EXPECT_EQ(static_cast<unsigned>(10),object.numFields());

}
示例#2
0
void RpmTransaction::process(const StringVector& install,
			     const StringVector& remove,
			     const StringVector& upgrade)
{
  int rc = 0;
  int probFilter = 0;
  int notifyFlags = 0;
  int tsFlags = 0;
  rpmProblemSet probs;
  if (!upgrade.empty()) 
    probFilter |= RPMPROB_FILTER_OLDPACKAGE;
  //  probFilter |= RPMPROB_FILTER_REPLACEPKG//reinstall;;
  //  probFilter |= RPMPROB_FILTER_REPLACEOLDFILES;
  //      probFilter |= RPMPROB_FILTER_REPLACENEWFILES;
  notifyFlags |= INSTALL_LABEL | INSTALL_HASH;
  if (!remove.empty())
    addToTransactionRemove(remove);
  if (!install.empty())
    addToTransactionInstall(install);
  if (!upgrade.empty())
    addToTransactionUpgrade(upgrade);
  rpmDependencyConflict conflicts = NULL;
  int numConflicts;
  if (rpmdepCheck(m_ts, &conflicts, &numConflicts) || conflicts) 
    {
      std::cerr << "Conflicts found!!" << std::endl;
      if (conflicts)
	{
	  printDepProblems(stderr, conflicts, numConflicts);
	  rpmdepFreeConflicts(conflicts, numConflicts);
	}
      exit(EXIT_FAILURE);
    }
  rc = rpmdepOrder(m_ts);
  if (rc > 0) 
    {
      std::cerr << "Ordering failed" << std::endl;
      return;
    }
  rc = rpmRunTransactions(m_ts, rpmShowProgress, (void *)notifyFlags, NULL,
			  &probs, (rpmtransFlags)tsFlags,
			  (rpmprobFilterFlags)probFilter);
  if (rc > 0) 
    {
      std::cerr << "Error while running transaction" << std::endl;
      //	if (probs->numProblems > 0)
      //	  rpmpsPrint(stderr, probs);
    } else 
    {
      if (rc < 0)
	std::cerr << "warning:some errors occurred while running transaction" << std::endl; 
    }
  std::cout << "Done." << std::endl;


  //  rpmpsFree(probs);

}
示例#3
0
const std::vector<std::string>& GasMixture::validGasTypes() {
  static StringVector result;
  if (result.empty()) {
    result = getIddKeyNames(IddFactory::instance().getObject(iddObjectType()).get(),
                            OS_WindowMaterial_GasMixtureFields::Gas1Type);
    OS_ASSERT(!result.empty());
  }
  return result;
}
示例#4
0
static void parseStringVector(const std::string& str, StringVector& res)
{
  res.clear();
  std::string item;
  bool inQuotes = 0;
  for(std::string::size_type i = 0;i < str.length();i++)
    {
      if (!inQuotes && str[i] == ':')
	{
	  res.push_back(item);
	  item.erase();
	  continue;
	}
      if (!inQuotes && str[i] == '\"')
	{
	  inQuotes = 1;
	  continue;
	}
      if (inQuotes && str[i] == '\"')
	{
	  if (i + 1 < str.length() && str[i + 1] == '\"')
	    {
	      item += "\"";
	      i++;
	      continue;
	    }
	  inQuotes = 0;
	  continue;
	}
      item += str[i];
    }
  if (!res.empty() || !item.empty())
    res.push_back(item);
}
示例#5
0
void
checkForUnmatchedPatterns(
	const Configuration *		cfg,
	const StringVector &		namesList,
	const StringVector &		wildcardedNamesAndTypes,
	StringVector &				unmatchedPatterns) throw(ConfigurationException)
{
	int							i;
	int							len;
	const char *				wildcardedName;

	unmatchedPatterns.empty();
	//--------
	// Check if there is a wildcarded name that does not match anything
	//--------
	len = wildcardedNamesAndTypes.length();
	for (i = 0; i < len; i += 3) {
		wildcardedName = wildcardedNamesAndTypes[i+1];
		if (!doesPatternMatchAnyUnexpandedNameInList(cfg, wildcardedName,
		                                             namesList))
		{
			unmatchedPatterns.add(wildcardedName);
		}
	}
}
示例#6
0
文件: FullID.cpp 项目: ecell/ecell3
void SystemPath::canonicalize()
{
    StringVector aNewPathComponents;

    for ( StringVector::const_iterator i( theComponents.begin() );
           i != theComponents.end(); ++i )
    {
        if ( *i == "." )
        {
            continue;
        }
        else if ( *i == ".." )
        {
            if ( aNewPathComponents.empty() )
            {
                break;
            }
            aNewPathComponents.pop_back();
        }
        else
        {
            aNewPathComponents.push_back( *i );
        }
    }

    theComponents.swap( aNewPathComponents );
}
 std::vector<std::string> SimulationControl_Impl::annualSimulationEnvironmentPeriods() const {
   StringVector result;
   OptionalSqlFile oSqlFile = model().sqlFile();
   if (oSqlFile && runSimulationforWeatherFileRunPeriods()) {
     RunPeriodVector runPeriods = this->runPeriods();
     StringVector environmentPeriods = oSqlFile->availableEnvPeriods();
     for (const RunPeriod& runPeriod : runPeriods) {
       if (runPeriod.isAnnual() && !runPeriod.isRepeated()) {
         std::string rpName = runPeriod.name().get();
         StringVector::const_iterator it = std::find_if(environmentPeriods.begin(),environmentPeriods.end(),std::bind(istringEqual,rpName,std::placeholders::_1));
         if (it != environmentPeriods.end()) {
           result.push_back(*it);
         }
       }
     }
     if (result.empty()) {
       // try environment name from WeatherFile
       OptionalWeatherFile oWeatherFile = model().getOptionalUniqueModelObject<WeatherFile>();
       if (oWeatherFile) {
         OptionalString os = oWeatherFile->environmentName();
         if (os) {
           std::string candidate = *os;
           StringVector::const_iterator it = std::find_if(environmentPeriods.begin(),environmentPeriods.end(),std::bind(istringEqual,candidate,std::placeholders::_1));
           if (it != environmentPeriods.end()) {
             result.push_back(*it);
           }
         }
       }
     }
   }
   return result;
 }
示例#8
0
ModuleLinkerPass::StringVector ModuleLinkerPass::getAllSymbolsUsedByKernel(
	const std::string& kernelName) const
{
	StringSet usedSymbols;

	usedSymbols.insert(kernelName);

	StringVector unprocessedSymbols = getAllSymbolsUsedByThisKernel(
		kernelName, _linkedModule);
	
	while(!unprocessedSymbols.empty())
	{
		StringVector newSymbols;
	
		for(auto symbol = unprocessedSymbols.begin();
			symbol != unprocessedSymbols.end(); ++symbol)
		{
			if(!usedSymbols.insert(*symbol).second) continue;
		
			if(!isKernelSymbol(_linkedModule, *symbol)) continue;
		
			StringVector kernelSymbols = getAllSymbolsUsedByThisKernel(
				*symbol, _linkedModule);
				
			newSymbols.insert(newSymbols.end(), kernelSymbols.begin(),
				kernelSymbols.end());
		}
		
		unprocessedSymbols = std::move(newSymbols);
	}
	
	return StringVector(usedSymbols.begin(), usedSymbols.end());
}
// Attempt to select one of the passed in strings as the gap sequence. If none fit the constraints,
// this sets gapSequence to the empty string and returns an error code
GapFillReturnCode GapFillProcess::selectGapSequence(int estimatedSize, const StringVector& sequences, std::string& gapSequence) const
{
    assert(!sequences.empty());
    int selectedIdx = -1;
    int selectedSizeDiff = std::numeric_limits<int>::max();

    for(size_t i = 0; i < sequences.size(); ++i)
    {
        int diff = abs(sequences[i].size() - estimatedSize);
        //printf("ES: %d S: %zu D: %d\n", estimatedSize, sequences[i].size(), diff);

        if(diff < selectedSizeDiff)
        {
            selectedSizeDiff = diff;
            selectedIdx = i;
        }
    }

    // Perform checks on the quality of the gap sequences
    int MAX_SIZE_DIFF = 100;
    if(selectedSizeDiff > MAX_SIZE_DIFF)
    {
        gapSequence = "";
        return GFRC_BAD_SIZE;
    }
    
    gapSequence = sequences[selectedIdx];
    return GFRC_OK;
}
示例#10
0
 // Get all output variable names that could be associated with this object.
 const std::vector<std::string>& Connection_Impl::outputVariableNames() const 
 { 
   static StringVector result;
   if (result.empty()) {
   }
   return result;
 }
示例#11
0
void
ConfigScope::listLocalNames(
	Configuration::Type		typeMask,
	StringVector &			vec) const
{
	int						i;
	int						countWanted;
	int						countUnwanted;
	ConfigScopeEntry *		entry;

	//--------
	// Iterate over all the entries in the hash table and copy
	// their names into the StringVector
	//--------
	vec.empty();
	vec.ensureCapacity(m_numEntries);
	countWanted = 0;
	countUnwanted = 0;
	for (i = 0; i < m_tableSize; i++) {
		entry = m_table[i].m_next;
		while (entry) {
			if (entry->type() & typeMask) {
				vec.add(entry->name());
				countWanted++;
			} else {
				countUnwanted++;
			}
			entry = entry->m_next;
		}
	}
	assert(countWanted + countUnwanted == m_numEntries);
}
示例#12
0
	void CommandLine::InitFromArgv(const StringVector& argv) {
		argv_ = StringVector(1);
		switches_.clear();
		begin_args_ = 1;
		SetProgram(argv.empty() ? FilePath() : FilePath(argv[0]));
		AppendSwitchesAndArguments(*this, argv);
	}
/*!
 * Parses lines for function/procedure names.
 *
 * \param line line to be processed
 * \param lastline last line processed
 * \param functionStack stack of functions
 * \param functionName function name found
 *
 * \return 1 if function name is found
 * \return 0 if it is still in some function
 * \return 2 if the code line doesn't belong to any function
 */
int CVerilogCounter::ParseFunctionName(const string &line, string &lastline, StringVector &functionStack, string &functionName)
{
	string str;
	size_t idx;
	/* FIND KEYWORD "task" / "function" */
	static int func_flag = 0, task_flag = 0;
	/* FIND KEYWORD "task" / "function" */
	idx = CUtil::FindKeyword(line, "task");
	if (idx != string::npos)
	{
		if (idx + 5 < line.length())
		{
			str = line.substr(idx + 5);
			functionStack.push_back(str);
		}
		task_flag++;/* FOUND KEYWORD "task" */
	}
	
	idx = CUtil::FindKeyword(line, "function");
	if (idx != string::npos)
	{
		if (idx + 9 < line.length())
		{
			str = line.substr(idx + 9);
			functionStack.push_back(str);
		}
		func_flag++;/* FOUND KEYWORD "function" */
	}
    
	if (functionStack.empty())
	{
		// dealing with some code out of any subroutines, it a "main" code
		return 2;
	}
    
	idx = CUtil::FindKeyword(line, "endtask");
	if(idx != string::npos){
		task_flag--;
	}
	else{
		idx = CUtil::FindKeyword(line, "endfunction");
		if(idx != string::npos){
			func_flag--;
		}
	}
	
	if (idx != string::npos)
	{
		str = functionStack.back();
		functionStack.pop_back();
		idx = str.find(";");
		if (idx != string::npos)
		{
			functionName = CUtil::ClearRedundantSpaces(str.substr(0, idx));
			lastline=line; // warning fix
			return 1;
		}
	}
	return 0;
}
void QuantitationInfo::initialise ()
{
	GenIFStream fromFile ( MsparamsDir::instance ().getParamPath ( "quan.txt" ) );
	string line;
	while ( getline ( fromFile, line ) ) {
		if ( line.length () != 0 && line [0] != '#' ) {
			name.push_back ( line );
			string n = name.back ();
			StringVector sv;
			for ( ; ; ) {
				string modificationName;
				getline ( fromFile, modificationName );
				if ( modificationName [0] == '>' ) {
					if ( sv.empty () && n != "Label:15N" ) {
						ErrorHandler::genError ()->error ( "No quantitation modifications specified for quantitation type " + n + " in file quan.txt.\n" );
					}
					break;
				}
				else
					sv.push_back ( modificationName );
			}
			singQuanInfo [n] = sv;
		}
	}
}
示例#15
0
// Check that all the strings in the vector align to the same coordinates
// of the passed in sequence
bool HapgenUtil::checkAlignmentsAreConsistent(const std::string& refString, const StringVector& queries)
{
    if(queries.empty())
        return true;

    // Perform local alignments of each query to the refString
    LocalAlignmentResultVector alignments;
    for(size_t i = 0; i < queries.size(); ++i)
        alignments.push_back(StdAlnTools::localAlignment(refString, queries[i]));

    size_t i = 0;
    for(size_t j = 1; j < alignments.size(); ++j)
    {
        if(alignments[i].targetStartIndex != alignments[j].targetStartIndex ||
           alignments[j].targetEndIndex != alignments[j].targetEndIndex)
        {
            std::cerr << "Warning: inconsistent alignments found for haplotype realignment\n";
            std::cerr << "A[" << i << "]: " << alignments[i] << "\n";
            std::cerr << "A[" << j << "]: " << alignments[j] << "\n";
            return false;
        }
    }

    return true;
}
TEST_F(ModelFixture, ScheduleTypeRegistry_ClassNames) {
  StringVector classesWithSchedules = ScheduleTypeRegistry::instance().classNames();
  EXPECT_FALSE(classesWithSchedules.empty());
  std::stringstream ss;
  BOOST_FOREACH(const std::string& className,classesWithSchedules) {
    EXPECT_FALSE(ScheduleTypeRegistry::instance().getScheduleTypesByClassName(className).empty());
    ss << "  " << className << std::endl;
  }
示例#17
0
static std::string combineStringVector(const StringVector& v)
{
  if (v.empty())
    return "";
  if (v.size() == 1)
    return v.front();
  std::string s = v.front();
  for(StringVector::size_type i = 1;i < v.size();i++)
    s += " " + v[i];
  return s;
}
示例#18
0
void RuleMap::addRule(FilterRule * r)
{
	this->m_AllFilterRules.push_back(r); //for delete FilterRule;
	FilterRuleMap * rules;
	FilterRuleVector * unshortcutRules;
	StringVector domains;
	r->getDomains(domains);
	if (r->isWhiteFilter())
	{
		rules = domains.empty()?&m_ShortcutWhiteRules:&m_DomainWhiteRules;
		unshortcutRules = &m_UnshortcutWhiteRules;
	}
	else 
	{
		rules = domains.empty() ? &m_ShortcutFilterRules : &m_DomainFilterRules;
		unshortcutRules = &m_UnshortcutFilterRules;
	}
	if(!domains.empty()) 
	{
		for(UINT i=0;i<domains.size();i++) 
		{
			insertRuleToFilterRuleMap(rules,domains[i],r);
		}
		return;
	}
	/*
	 * 没有域名信息才会进行8个字符8个字符的索引
	 */
	const std::string & reFilter = r->getRegularFilter();
	StringVector shortcuts;
	if (collectShortcuts(reFilter, shortcuts)) 
	{
		unsigned int i = 0;
		for (; i < shortcuts.size(); i++) 
		{
			insertRuleToFilterRuleMap(rules,shortcuts[i],r);
		}
	} 
	else
		unshortcutRules->push_back(r);//append(r);
}
示例#19
0
 size_t recognizeCluster(const StringVector& params, int& mode) const
 {
 assert(!params.empty());
 if (mode == 0 && params[0] == "--")
   return 0;
 if (mode == 0 && findKey(params[0]) != (KeyVector::size_type)-1)
   return CliParser::recognizeCluster(params, mode);
 if (params.size() < 3 ||
     (params[1] != "=" && params[1] != "<=" && params[1] != ">=" && params[1] != "<" && params[1] != ">"))
   return CliParser::recognizeCluster(params, mode);
 return 2;
 }
示例#20
0
static std::string saveStringVector(const StringVector& values)
{
  if (values.empty())
    return "";
  std::string str = "\"" + doubleQuotes(values[0]) + "\"";
  for(StringVector::size_type i = 1;i < values.size();i++)
    {
      str += ":";
      str += "\"" + doubleQuotes(values[i]) + "\"";
    }
  return str;
}
TEST_F(ModelFixture, ScheduleTypeRegistry_ClassNames) {
  StringVector classesWithSchedules = ScheduleTypeRegistry::instance().classNames();
  EXPECT_FALSE(classesWithSchedules.empty());
  std::stringstream ss;
  for (const std::string& className : classesWithSchedules) {
    EXPECT_FALSE(ScheduleTypeRegistry::instance().getScheduleTypesByClassName(className).empty());
    ss << "  " << className << std::endl;
  }
  LOG(Trace,"The following ModelObject classes reference at least one schedule:"
      << std::endl << ss.str());

}
static void writeReport ( const SearchCompareParams& params, const vector <SearchResults*>& searchResults )
{
	bool remove = params.getRemove ();
	bool multisample = params.getMultiSample ();
	string reportHomologousProteins = params.getReportHomologousProteins ();
	string reportType = params.getReportType ();
	char format = params.getSaveFormat ();
	bool quanProteinFlag = PPProteinHitQuanInfo::getQuan ();

	StringVector idList = searchResults [0]->getIDList ();
	StringVector idFilterList = params.getIDFilterList ();
	sort ( idFilterList.begin (), idFilterList.end () );
	StringVector idUsedList;
	if ( !idFilterList.empty () && multisample )
		set_intersection ( idList.begin (), idList.end (), idFilterList.begin (), idFilterList.end (), back_inserter ( idUsedList ) );
	else
		idUsedList = idList;
	sort ( idUsedList.begin (), idUsedList.end (), sortIDs () );

	if ( reportType == "Calibration" ) {
		for ( StringVectorSizeType i = 0 ; i < idUsedList.size () ; i++ ) {
			SearchResultsPeptideReport srpr ( searchResults, idUsedList [i] );
			printAbortFunctions ( cout );
			srpr.printHTMLCalibration ( cout );
		}
	}
	else {
		vector <SearchResultsReport*> srr;
		for ( StringVectorSizeType i = 0 ; i < idUsedList.size () ; i++ ) {
			if ( reportType == "Protein" ) {
				if ( quanProteinFlag ) {
					srr.push_back ( new SearchResultsPeptideReport ( searchResults, remove, params.getAccessionNumbers (), params.getSortType (), params.getSortType2 (), params.getReportHitsType (), reportHomologousProteins, idUsedList [i] ) );
				}
				else {
					srr.push_back ( new SearchResultsProteinReport ( searchResults, remove, params.getAccessionNumbers (), params.getReportHitsType (), reportHomologousProteins, idUsedList [i] ) );
				}
			}
			else if ( reportType == "Peptide" || reportType == "Modifications" || sresXLinks ) {
				srr.push_back ( new SearchResultsPeptideReport ( searchResults, remove, params.getAccessionNumbers (), params.getSortType (), params.getSortType2 (), params.getReportHitsType (), reportHomologousProteins, idUsedList [i] ) );
			}
			else if ( sresTime ) {
				srr.push_back ( new SearchResultsPeptideReport ( searchResults, remove, params.getAccessionNumbers (), params.getSortType (), params.getSortType2 (), params.getUnmatchedSpectra (), params.getReportHitsType (), reportHomologousProteins, idUsedList [i], format != 'P' && format != 'F' && format != 'V' ) );
			}
			else ErrorHandler::genError ()->error ( "Invalid report type.\n" );
		}
		printAbortFunctions ( cout );
		ujm->deletePreviousMessage ( cout );
		doReport ( cout, params, idUsedList, srr );
		for ( std::vector <SearchResultsReport*>::size_type j = 0 ; j < srr.size () ; j++ ) delete srr [j];
	}
}
示例#23
0
bool MGFInstance::isMGFType ( const string& tLine )
{
	if ( !start.empty () ) {
		bool flag1 = false;									// Check the start possibilities
		for ( StringVectorSizeType i = 0 ; i < start.size () ; i++ ) {
			string& s = start [i];
			if ( !tLine.compare ( 0, s.length (), s ) ) {
				flag1 = true;
				break;
			}
		}
		if ( !flag1 ) return false;
	}
	if ( !end.empty () ) {
		bool flag2 = false;									// Check the end possibilities
		string::size_type tlen = tLine.length ();
		for ( StringVectorSizeType j = 0 ; j < end.size () ; j++ ) {
			string& e = end [j];
			string::size_type elen = e.length ();
			if ( tlen >= elen ) {
				if ( !tLine.compare ( tlen - elen, elen, e ) ) {
					flag2 = true;
					break;
				}
			}
		}
		if ( !flag2 ) return false;
	}
	if ( !contains.empty () ) {
		string::size_type idx = 0;
		for ( StringVectorSizeType k = 0 ; k < contains.size () ; k++ ) {
			idx = tLine.find ( contains [k], idx );
			if ( idx == string::npos ) return false;
			idx++;
		}
	}
	return true;
}
示例#24
0
std::string MetAssemble::processKmer(const std::string& str, int count)
{
    MetagenomeBuilder builder;
    builder.setSource(str, count);
    builder.setKmerParameters(m_parameters.kmer, m_parameters.kmerThreshold);
    builder.setIndex(m_parameters.pBWT, m_parameters.pRevBWT, m_parameters.pBWTCache, m_parameters.pRevBWTCache);
    builder.run();

    StringVector contigs;
    builder.getContigs(contigs);
    std::string out = contigs.empty() ? "" : contigs.front();
    //std::cout << "Constructed " << contigs.size() << " contigs from kmer (size: " << out.size() << ")\n";
    return out;
}
static void getSearchResults ( const SearchCompareParams& params, vector <SearchResults*>& searchResults )
{
	sresSingleProject = true;
	sresMainAndSupplementary = ( params.getSaveFormat () != 'P'  && params.getSaveFormat () != 'B' );
	sresMergedFlag = params.getMergeOption () == "Merged" && params.getReportType () != "Modifications";
	sresModsMergedFlag = params.getMergeOption () == "Merged" && params.getReportType () == "Modifications";
	string proj;
	StringVector filenames = params.getFilenames ();
#ifdef MYSQL_DATABASE
	for ( StringVectorSizeType i = 0 ; i < filenames.size () ; i++ ) {
		BatchJobItem* bji;
		string searchEndTime;
		string searchTime;
		try {
			bji = MySQLPPSDDBase::instance ().getBatchJobByKey ( filenames [i] );
			searchEndTime = MySQLPPSDDBase::instance ().getSearchEndTimeByKey ( filenames [i] );
			searchTime = MySQLPPSDDBase::instance ().getSearchTimeByKey ( filenames [i] );
		}
		catch ( runtime_error e ) {		// Catch database login problems
			ErrorHandler::genError ()->error ( e );
		}
		if ( !bji ) {
			ErrorHandler::genError ()->error ( "Unknown search key.\n" );
		}
		string temp = bji->getUserID () + '/' + getUncalibratedProject ( bji->getProjectName () );
		if ( i != 0 && temp != proj ) sresSingleProject = false;
		proj = temp;
		MySQLPPSDDBase::instance ().updateProjectRecordUpdated ( bji->getProjectID () );
		searchResults.push_back ( new SearchResults ( bji->getProjectName (), bji->getResultsName (), bji->getResultsFullPath (), params, i, searchEndTime, searchTime ) );
	}
#endif
	if ( filenames.empty () ) {
		int numSearches = params.getNumCommandLineSearches ();
		StringVector projectNames = params.getCommandLineProjectNames ();
		StringVector resultsNames = params.getCommandLineResultsNames ();
		StringVector resultsFullPaths = params.getCommandLineResultsFullPaths ();
		for ( StringVectorSizeType i = 0 ; i < numSearches ; i++ ) {
			string temp = getUncalibratedProject ( projectNames [i] );
			if ( i != 0 && temp != proj ) sresSingleProject = false;
			proj = temp;
			searchResults.push_back ( new SearchResults ( projectNames [i], resultsNames [i], resultsFullPaths [i], params, i, "", "" ) );
		}
		if ( searchResults.empty () ) ErrorHandler::genError ()->error ( "No results to display.\n" );
	}
	if ( sresTime && !sresMergedFlag && !sresSingleProject ) {
		ErrorHandler::genError ()->error ( "Time reports using the separated option can only compare results files from the same project.\n" );
	}
	SearchResults::mergeResults ( params );
}
示例#26
0
bool CLemmatizer::FormatResults(const string& InputWordStr, const vector<CAutomAnnotationInner>& src, StringVector& results, bool bFound) const
{

	for (int i = 0; i < src.size(); i++)
	{
		const CAutomAnnotationInner& A = src[i];
		const CLemmaInfo& I = m_LemmaInfos[A.m_LemmaInfoNo].m_LemmaInfo;
		const CFlexiaModel& M = m_FlexiaModels[A.m_ModelNo];
		const CMorphForm& F = M.m_Flexia[A.m_ItemNo];

		string Line;
		// printing lem sign
		{
			Line += bFound ? '+' : '-';
			if (I.m_CommonAncode[0] == 0)
				Line += "??";
			else
				Line += string(I.m_CommonAncode, I.m_CommonAncode+2);
			Line +=  " ";
		};

		// print Lemma
		{

			string Lemma = InputWordStr.substr(0, InputWordStr.length() - F.m_FlexiaStr.length())+M.get_first_flex();
			if (Lemma.substr(0, F.m_PrefixStr.length()) == F.m_PrefixStr)
				Lemma.erase(0, F.m_PrefixStr.length());
			Line +=  Lemma;
			Line +=  " ";
		};

		// print ancode
		Line +=  F.m_Gramcode;
		
		//  print paradigm id and weight
		if (bFound) 
			Line += Format(" %lu %i", A.GetParadigmId(), A.m_nWeight);
		else
			Line += " -1 0";
				
		

		results.push_back(Line);
	}

	return !results.empty();
};
示例#27
0
void ConfigCenter::onConfigFileValue(const StringVector& path, 
		       const std::string& sectArg,
		       const std::string& value,
				     bool adding,
				     const ConfigFilePosInfo& pos)
{
  assert(!path.empty());
  if (path[0] == "repo")
    {
      if (trim(sectArg).empty())
	throw NotImplementedException("Empty configuration file section argument");
      ConfRepoVector::size_type i = 0;
      while(i < m_root.repo.size() && m_root.repo[i].name != sectArg)
	i++;
      if (i >= m_root.repo.size())
	{
	  m_root.repo.push_back(ConfRepo(sectArg));
	  m_stringValues.clear();
	  m_stringListValues.clear();
	  m_booleanValues.clear();
	  m_uintValues.clear();
	  initValues();
	  initRepoValues();
	  initProvideValues();
	}
    }
  if (path[0] == "provide")
    {
      if (trim(sectArg).empty())
	throw NotImplementedException("Empty configuration file section argument");
      ConfProvideVector::size_type i = 0;
      while(i < m_root.provide.size() && m_root.provide[i].name != sectArg)
	i++;
      if (i >= m_root.provide.size())
	{
	  m_root.provide.push_back(ConfProvide(sectArg));
	  m_stringValues.clear();
	  m_stringListValues.clear();
	  m_booleanValues.clear();
	  m_uintValues.clear();
	  initValues();
	  initRepoValues();
	  initProvideValues();
	}
    }
  ConfigAdapter::onValue(path, sectArg, value, adding, pos);
}
示例#28
0
void SingleEntryParameters::parseForEntryData ( const ParameterList* params )
{
	const char* value;
	if ( params->getValue ( "entry_data", value ) ) {
		if ( is_dna_database ( database ) ) {
			if ( accessMethod == "Index Number" ) {
				bool flag = getPostQuery3Vectors ( value, indexNum, dnaReadingFrame, openReadingFrame );
				if ( !flag ) {
					ErrorHandler::genError ()->error ( "Incorrectly formatted List of Entries for DNA database.\n Correct format is:\n(Index Number) (DNA Reading Frame) (Open Reading Frame)\n" );
				}
			}
			else {
				bool flag = getPostQuery3Vectors ( value, accessionNum, dnaReadingFrame, openReadingFrame );
				if ( !flag ) {
					ErrorHandler::genError ()->error ( "Incorrectly formatted List of Entries for DNA database.\n Correct format is:\n(Accession Number) (DNA Reading Frame) (Open Reading Frame)\n" );
				}
			}
		}
		else {
			if ( accessMethod == "Index Number" ) {
				getPostQueryVector ( value, indexNum, '\n' );
				if ( indexNum.empty () ) {
					StringVector temp;
					getPostQueryVector ( value, temp, '\n' );
					if ( temp.empty () )
						ErrorHandler::genError ()->error ( "No index numbers entered.\n" );
					else
						ErrorHandler::genError ()->error ( "You have not entered index numbers which must be integer numbers. If you entered accession numbers change Retrieve Entry by to Accession Number.\n" );
				}
			}
			else {
				getPostQueryVector ( value, accessionNum, '\n' );
				if ( accessionNum.empty () )
					ErrorHandler::genError ()->error ( "No accession numbers entered.\n" );
			}
		}
		BoolDeque bv = params->getBoolDequeValue ( "e", getNumEntries () );
		BoolDequeConstIterator bvi = find ( bv.begin (), bv.end (), true );		// If all are false then no e parameters so don't delete anything.
		if ( bvi != bv.end () ) {
			deleteEntries ( bv, accessionNum );
			deleteEntries ( bv, indexNum );
			deleteEntries ( bv, dnaReadingFrame );
			deleteEntries ( bv, openReadingFrame );
		}
	}
}
示例#29
0
	virtual void AfterReinstall(const string & id, DistInfo & dist) {
		ServerInstanceInfo inst( Name, id );
		uid_t uid = mgr_user::Uid( inst.UserName );
		string user_home_dir = getpwuid( uid )->pw_dir;
		mgr_file::Attrs attrs(0744, uid, mgr_user::GroupGid(inst.UserName));
		const string link_dir = mgr_file::ConcatPath( user_home_dir, ".steam/sdk32/" );
		mgr_file::MkDir( link_dir, &attrs );
		mgr_file::MkLink( mgr_file::ConcatPath( inst.GetInstancePath(), "bin/steamclient.so" ),
					mgr_file::ConcatPath( link_dir, "steamclient.so" ) );
		Debug( "Link to steamclient.so created" );
		
		StringVector maps;
		GetMaps(inst, maps);
		if( !maps.empty() )
			inst.SetParam( "map", maps.front() );

	}
void MeshCombiner::consoleMeshCombiner()
{
    StringVector vec = m_MeshCombinerConfig->getMultiSetting( "Mesh" );
    if( vec.empty() )
        return;

    MergeMesh* mm = new MergeMesh();
    SkeletonPtr skel = SkeletonPtr();

    for( StringVector::iterator it = vec.begin();
            it != vec.end(); ++it )
    {
        log( "Loading: " + *it );
        try
        {
            MeshPtr mesh = MeshManager::getSingleton().load(
                               *it, ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );

            if( !mesh.isNull() )
                mm->addMesh( mesh );
        }
        catch( ... )
        {
        }
    }

    // save
    MeshPtr mesh = mm->bake();

    MeshSerializer* meshSerializer = new MeshSerializer();
    meshSerializer->exportMesh( mesh.getPointer(), "./media/merged.mesh" );

    MeshManager::getSingleton().remove( mesh->getHandle() );

    // try to load...
    mesh = MeshManager::getSingleton().load(
               "merged.mesh", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME );

    SceneManager* sm = Root::getSingleton().createSceneManager( ST_GENERIC );

    // try to place...
    sm->getRootSceneNode()->attachObject( sm->createEntity( "test", "merged.mesh" ) );

    delete meshSerializer;
    delete mm;
}