コード例 #1
0
ファイル: Load.cpp プロジェクト: mantidproject/mantid
/**
 * Set the loader option for use as a Child Algorithm.
 * @param loader :: Concrete loader
 * @param startProgress :: The start progress fraction
 * @param endProgress :: The end progress fraction
 * @param logging:: If true, enable logging
 */
void Load::setUpLoader(API::IAlgorithm_sptr &loader, const double startProgress,
                       const double endProgress, const bool logging) const {
  // Set as a child so that we are in control of output storage
  loader->setChild(true);
  loader->setLogging(logging);
  // If output workspaces are nameless, give them a temporary name to satisfy
  // validator
  const std::vector<Property *> &props = loader->getProperties();
  for (auto prop : props) {
    auto wsProp = dynamic_cast<IWorkspaceProperty *>(prop);

    if (wsProp && !wsProp->isOptional() &&
        prop->direction() == Direction::Output) {
      if (prop->value().empty())
        prop->setValue("LoadChildWorkspace");
    }
  }
  if (startProgress >= 0. && endProgress > startProgress && endProgress <= 1.) {
    loader->addObserver(this->progressObserver());
    setChildStartProgress(startProgress);
    setChildEndProgress(endProgress);
  }
}