Ejemplo n.º 1
0
std::pair<std::unique_ptr<ComponentInfo>, std::unique_ptr<DetectorInfo>>
InstrumentVisitor::makeWrappers(const Instrument &instrument,
                                ParameterMap *pmap) {
  // Visitee instrument is base instrument if no ParameterMap
  const auto visiteeInstrument =
      pmap ? ParComponentFactory::createInstrument(
                 boost::shared_ptr<const Instrument>(&instrument, NoDeleting()),
                 boost::shared_ptr<ParameterMap>(pmap, NoDeleting()))
           : boost::shared_ptr<const Instrument>(&instrument, NoDeleting());
  InstrumentVisitor visitor(visiteeInstrument);
  visitor.walkInstrument();
  return visitor.makeWrappers();
}
Ejemplo n.º 2
0
/** Looks recursively upwards in the component tree for the first instance of a
* component with a matching type.
* @param comp :: The component to start the search with
* @param type :: Parameter type
* @returns the first matching parameter.
*/
Parameter_sptr ParameterMap::getRecursiveByType(const IComponent *comp,
                                                const std::string &type) const {
  boost::shared_ptr<const IComponent> compInFocus(comp, NoDeleting());
  while (compInFocus != NULL) {
    Parameter_sptr param = getByType(compInFocus.get(), type);
    if (param) {
      return param;
    }
    compInFocus = compInFocus->getParent();
  }
  // Nothing was found!
  return Parameter_sptr();
}