PeerToFinderPeerLocationFindResultPtr PeerToFinderPeerLocationFindResult::create(ElementPtr root)
        {
          PeerToFinderPeerLocationFindResultPtr ret(new message::PeerToFinderPeerLocationFindResult);

          ret->mID = IMessageHelper::getAttributeID(root);
          ret->mTime = IMessageHelper::getAttributeEpoch(root);

          ElementPtr locs = root->findFirstChildElement("locations");
          if (locs)
          {
            LocationList ll;
            ElementPtr loc = locs->findFirstChildElement("location");
            while (loc)
            {
              Location l = MessageHelper::createLocation(loc->findFirstChildElement("details"));
              l.mID = IMessageHelper::getAttributeID(loc);
              ll.push_back(l);

              loc = loc->getNextSiblingElement();
            }

            if (ll.size() > 0)
              ret->mLocations = ll;
          }

          return ret;
        }
Exemplo n.º 2
0
LocationList location_list(
  simgrid::mc::ObjectInformation& info,
  Dwarf_Attribute& attr)
{
  LocationList locations;
  std::ptrdiff_t offset = 0;
  while (1) {

    Dwarf_Addr base, start, end;
    Dwarf_Op *ops;
    std::size_t len;

    offset = dwarf_getlocations(
      &attr, offset, &base, &start, &end, &ops, &len);

    if (offset == 0)
      break;
    else if (offset == -1)
      xbt_die("Error while loading location list");

    std::uint64_t base_address = (std::uint64_t) info.base_address();

    LocationListEntry::range_type range;
    if (start == 0)
      // If start == 0, this is not a location list:
      range = { 0, UINT64_MAX };
    else
      range =  { base_address + start, base_address + end };

    locations.push_back({ DwarfExpression(ops, ops+len), range });
  }

  return locations;
}
Exemplo n.º 3
0
void StelLocationMgr::setLocations(const LocationList &locations)
{
	for(LocationList::const_iterator it = locations.constBegin();it!=locations.constEnd();++it)
	{
		this->locations.insert(it->getID(),*it);
	}

	emit locationListChanged();
}
Exemplo n.º 4
0
/**
 * Appends the given list to the one held by the model.
 * @param  locList  Result information
 * @param  parent   Index under which to add the results (ignored)
 */
void LocationListModel::add(const LocationList& locList,
                            const QModelIndex& parent)
{
	(void)parent;

	locationsAdded_ = true;

	// Determine the first and last rows for the new items.
	int firstRow = locList_.size();
	int lastRow = firstRow + locList.size() - 1;
	if (lastRow < firstRow)
		return;

	// Begin row insertion.
	// This is required by QAbstractItemModel.
	beginInsertRows(QModelIndex(), firstRow, lastRow);

	// Add the entries.
	// The condition optimises for the case where the list can be internally
	// copied from one object to another.
	// Not sure whether the condition is also checked by the += operator itself
	// (probably it is, but let's be on the safe side).
	if (locList_.isEmpty())
		locList_ = locList;
	else
		locList_ += locList;

	// End row insertion.
	// This is required by QAbstractItemModel.
	endInsertRows();
}
static Interval nextCandidate(LocationLists& locLists) {
    int min = INT_MAX;
    int max = -1;
    LocationList* minLocList;
    for (auto& locList : locLists) {
        if (locList.empty()) {
            return Interval(-1, -1);
        }
        int front = locList.front();
        if (front < min) {
            min = front;
            minLocList = &locList;
        }
        if (front > max) {
            max = front;
        }
    }
    minLocList->pop_front();
    return Interval(min, max);
}
Exemplo n.º 6
0
MemCheckIterTools::LocationListIterator::LocationListIterator(LocationList & l,
        const IterTool &iterTool) : p(l.begin()), m_end(l.end()), m_iterTool(iterTool)
{
    while (p != m_end && m_iterTool.omitNonWorkspace && p->isOutOfWorkspace(m_iterTool.workspacePath))
        ++p;
}