bool
addOrUpdateByPrefix(
            StylesheetConstructionContext&  theConstructionContext,
            VectorType&                     theVector,
            const XalanDOMString&           thePrefix,
            const XalanDOMString&           theURI)
{
    typedef typename VectorType::value_type     value_type;

    value_type* const   theEntry =
        findByPrefixNonConst(theVector, thePrefix);

    if (theEntry == 0)
    {
        theVector.push_back(
            value_type(
                theConstructionContext.getPooledString(thePrefix),
                theConstructionContext.getPooledString(theURI)));

        return true;
    }
    else
    {
        if (theEntry->getURI() == theURI)
        {
            return false;
        }
        else
        {
            theEntry->setURI(theConstructionContext.getPooledString(theURI));

            return true;
        }
    }
}
示例#2
0
void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const bool aData)
{
  nsString dataString;
  dataString += aData ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false");
  AnnotationType annotation = std::make_pair(nsString(aName), dataString);
  mAnnotations.push_back(annotation);
}
示例#3
0
void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const nsACString& aData)
{
  nsString dataString;
  AppendUTF8toUTF16(aData, dataString);
  AnnotationType annotation = std::make_pair(nsString(aName), dataString);
  mAnnotations.push_back(annotation);
}
示例#4
0
void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const double aData)
{
  nsString dataString;
  dataString.AppendFloat(aData);
  AnnotationType annotation = std::make_pair(nsString(aName), dataString);
  mAnnotations.push_back(annotation);
}
示例#5
0
	void put(T *t) {
		std::lock_guard<Lock> l(_lock);
		
		_data.push_back(t);
		std::sort(_data.begin(), _data.end(), Comparator());
		
		assert(sem_post(&_count) == 0);
	}
示例#6
0
void readTwoColumnData(const String& file,VectorType& v0,VectorType& v1)
{
	std::ifstream fin(file.c_str());
	if (!fin || !fin.good() || fin.bad()) throw
		RuntimeError("Cannot open file\n");
	while(!fin.eof()) {
		String s;
		fin>>s;
		if (s[0]=='#') continue;
		FieldType x = std::atof(s.c_str());
		SizeType size=v0.size();
		if (size>1 && x<v0[size-1]) break;
		v0.push_back(x);
		fin>>s;
		if (s[0]=='#') continue;
		v1.push_back(atof(s.c_str()));
	}
	fin.close();
}
示例#7
0
VPFactory::VectorType
	VPFactory::getFlowKeys() const
{
	VectorType	retVector;

	for ( FlowDBConstIter it = flowDB.begin();
		  it != flowDB.end();
		  it ++ )
	{
		retVector.push_back( it->flowName );
	}

	return retVector;
}
示例#8
0
VPFactory::VectorType
	VPFactory::getPatchKeys(const Category type) const
{
	// if catg == PROCESSOR	| PROVIDER	|  CONSUMER

	VectorType	retVector;

	for (PatchDBConstIter it = patchDB.begin();
		it != patchDB.end();
		it++)
	{
		if (type==it->catg)
			retVector.push_back(it->processName);
	}

	return retVector;
}
示例#9
0
void
ChromeHangAnnotations::AddAnnotation(const nsAString& aName, const nsAString& aData)
{
  AnnotationType annotation = std::make_pair(nsString(aName), nsString(aData));
  mAnnotations.push_back(annotation);
}
示例#10
0
Observations
ReadData
::ReadObservations(DataSettings &DS) 
{
  Observations Obs;
  
  std::ifstream IndivID(DS.GetPathToGroup());
  std::ifstream TimePointsFile(DS.GetPathToTimepoints());
  std::ifstream LandmarksFile(DS.GetPathToLandmarks());
  std::ifstream CognitiveScoresFile(DS.GetPathToCognitiveScores());
      
  std::string GroupLine, TimePointsLine, LandmarksLine, CognitiveScoresLine;
  unsigned int CurrentSubjectID = -1;
  
  VectorType TimePoints;
  std::vector<VectorType> Landmarks;
  std::vector<VectorType> CognitiveScores;
  
  while(getline(IndivID, GroupLine))
  {
    if(CurrentSubjectID == -1) CurrentSubjectID = std::stoi(GroupLine);
    
    unsigned int NewSubjectID = std::stoi(GroupLine);
    getline(TimePointsFile, TimePointsLine);
    if(DS.LandmarkPresence())        getline(LandmarksFile, LandmarksLine);
    if(DS.CognitiveScoresPresence()) getline(CognitiveScoresFile, CognitiveScoresLine);
    
    /// New subject
    if(NewSubjectID != CurrentSubjectID)
    {
      IndividualObservations Individual(TimePoints);
      if(DS.LandmarkPresence())        Individual.AddLandmarks(Landmarks);
      if(DS.CognitiveScoresPresence()) Individual.AddCognitiveScores(CognitiveScores);
      Obs.AddIndividualData(Individual);
                  
      CurrentSubjectID = NewSubjectID;
      TimePoints.clear();
      Landmarks.clear();
      CognitiveScores.clear();
    }

    TimePoints.push_back(stod(TimePointsLine));
    if(DS.LandmarkPresence()) 
    {
      VectorType NewObs(DS.GetLandmarksDimension());
      int i = 0;
      std::stringstream LineStream(LandmarksLine);
      std::string cell;
      while(std::getline(LineStream, cell, ','))
      {
        NewObs(i) = std::stod(cell);
        ++i;
      }
      
      Landmarks.push_back(NewObs);
    }
    if(DS.CognitiveScoresPresence())
    {
        
      VectorType NewObs(DS.GetCognitiveScoresDimension());
      int i = 0;
      std::stringstream LineStream(CognitiveScoresLine);
      std::string cell;
      while(std::getline(LineStream, cell, ','))
      {
        NewObs(i) = std::stod(cell);
        ++i;
      }
      CognitiveScores.push_back(NewObs);
    }
  }
  
  IndividualObservations Individual(TimePoints);
  if(DS.LandmarkPresence())        Individual.AddLandmarks(Landmarks);
  if(DS.CognitiveScoresPresence()) Individual.AddCognitiveScores(CognitiveScores);
  Obs.AddIndividualData(Individual);
  
  
  return Obs;
}