コード例 #1
0
ファイル: Load.cpp プロジェクト: mantidproject/mantid
/**
 * Set the output workspace(s) if the load's return workspace has type
 * API::Workspace
 * @param loader :: Shared pointer to load algorithm
 */
void Load::setOutputWorkspace(const API::IAlgorithm_sptr &loader) {
  // Go through each OutputWorkspace property and check whether we need to make
  // a counterpart here
  const std::vector<Property *> &loaderProps = loader->getProperties();
  const size_t count = loader->propertyCount();
  for (size_t i = 0; i < count; ++i) {
    Property *prop = loaderProps[i];
    if (dynamic_cast<IWorkspaceProperty *>(prop) &&
        prop->direction() == Direction::Output) {
      const std::string &name = prop->name();
      if (!this->existsProperty(name)) {
        declareProperty(Kernel::make_unique<WorkspaceProperty<Workspace>>(
            name, loader->getPropertyValue(name), Direction::Output));
      }
      Workspace_sptr wkspace = getOutputWorkspace(name, loader);
      setProperty(name, wkspace);
    }
  }
}