Пример #1
0
void NetworkManager::cleanUpLinks(Links & links, Assignment * assignment)
{
    for ( Links::iterator l = links.begin(); l != links.end(); l++ )
    {
        NetPath path = assignment->GetAssignment(*l);
        if ( !path.empty() )
            removeAssignment(*l, path);

        assignment->RemoveAssignment(*l);
    }
}
Пример #2
0
	void Print(std::ostream& stream)
	{
		std::vector<Objects::const_iterator> referencedObjects;
		referencedObjects.reserve(links.size());
		for(Links::const_iterator i = links.begin(); i != links.end(); ++i)
			referencedObjects.push_back(i->second);
		std::sort(referencedObjects.begin(), referencedObjects.end());
		referencedObjects.resize(std::unique(referencedObjects.begin(), referencedObjects.end()) - referencedObjects.begin());

		// пока просто вывести
		for(Objects::const_iterator object = objects.begin(); object != objects.end(); ++object)
		{
			if(std::binary_search(referencedObjects.begin(), referencedObjects.end(), object))
				continue;
			Print(stream, object);
		}
	}
Пример #3
0
/** Gets the results of the trace, then returns the first detector
 * (that is NOT a monitor) found in the results.
 * @return sptr to IDetector, or an invalid sptr if not found
 */
IDetector_const_sptr InstrumentRayTracer::getDetectorResult() const {
  Links results = this->getResults();

  // Go through all results
  Links::const_iterator resultItr = results.begin();
  for (; resultItr != results.end(); ++resultItr) {
    IComponent_const_sptr component =
        m_instrument->getComponentByID(resultItr->componentID);
    IDetector_const_sptr det =
        boost::dynamic_pointer_cast<const IDetector>(component);
    if (det) {
      if (!det->isMonitor()) {
        return det;
      }
    } // (is a detector)
  }   // each ray tracer result
  return IDetector_const_sptr();
}