当前位置: 首页>>代码示例>>C++>>正文


C++ IAlgorithm_sptr::getAlgorithmID方法代码示例

本文整理汇总了C++中IAlgorithm_sptr::getAlgorithmID方法的典型用法代码示例。如果您正苦于以下问题:C++ IAlgorithm_sptr::getAlgorithmID方法的具体用法?C++ IAlgorithm_sptr::getAlgorithmID怎么用?C++ IAlgorithm_sptr::getAlgorithmID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAlgorithm_sptr的用法示例。


在下文中一共展示了IAlgorithm_sptr::getAlgorithmID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getPropertyValue

  /** Validate the properties together */
  std::map<std::string, std::string> LiveDataAlgorithm::validateInputs()
  {
    std::map<std::string, std::string> out;

    const std::string instrument = getPropertyValue("Instrument");
    const bool eventListener = LiveListenerFactory::Instance().create(instrument,false)->buffersEvents();
    if ( !eventListener && getPropertyValue("AccumulationMethod") == "Add" )
    {
      out["AccumulationMethod"] = "The " + instrument + " live stream produces histograms. Add is not a sensible accumulation method.";
    }

    if (this->getPropertyValue("OutputWorkspace").empty())
      out["OutputWorkspace"] = "Must specify the OutputWorkspace.";

    // Validate inputs
    if (this->hasPostProcessing())
    {
      if (this->getPropertyValue("AccumulationWorkspace").empty())
        out["AccumulationWorkspace"] = "Must specify the AccumulationWorkspace parameter if using PostProcessing.";

      if (this->getPropertyValue("AccumulationWorkspace") == this->getPropertyValue("OutputWorkspace"))
        out["AccumulationWorkspace"] = "The AccumulationWorkspace must be different than the OutputWorkspace, when using PostProcessing.";
    }

    // For StartLiveData and MonitorLiveData, make sure another thread is not already using these names
    if (this->name() != "LoadLiveData")
    {
      /** Validate that the workspace names chosen are not in use already */
      std::string outName = this->getPropertyValue("OutputWorkspace");
      std::string accumName = this->getPropertyValue("AccumulationWorkspace");

      // Check that no other MonitorLiveData thread is running with the same settings
      auto it = AlgorithmManager::Instance().algorithms().begin();
      for (; it != AlgorithmManager::Instance().algorithms().end(); it++)
      {
        IAlgorithm_sptr alg = *it;
        // MonitorLiveData thread that is running, except THIS one.
        if (alg->name() == "MonitorLiveData" && (alg->getAlgorithmID() != this->getAlgorithmID())
            && alg->isRunning())
        {
          if (!accumName.empty() && alg->getPropertyValue("AccumulationWorkspace") == accumName)
            out["AccumulationWorkspace"] += "Another MonitorLiveData thread is running with the same AccumulationWorkspace.\n"
                "Please specify a different AccumulationWorkspace name.";
          if (alg->getPropertyValue("OutputWorkspace") == outName)
            out["OutputWorkspace"] += "Another MonitorLiveData thread is running with the same OutputWorkspace.\n"
                "Please specify a different OutputWorkspace name.";
        }
      }
    }

    return out;
  }
开发者ID:trnielsen,项目名称:mantid,代码行数:53,代码来源:LiveDataAlgorithm.cpp


注:本文中的IAlgorithm_sptr::getAlgorithmID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。