コード例 #1
0
ファイル: berryCommandService.cpp プロジェクト: paulcm/MITK
SmartPointer<IElementReference> CommandService::RegisterElementForCommand(
    const SmartPointer<ParameterizedCommand>& command,
    const SmartPointer<UIElement>& element)
{
  if (!command->GetCommand()->IsDefined())
  {
    throw NotDefinedException(
        "Cannot define a callback for undefined command "
            + command->GetCommand()->GetId());
  }
  if (element.IsNull())
  {
    throw NotDefinedException("No callback defined for command "
        + command->GetCommand()->GetId());
  }

  QHash<QString, QString> paramMap = command->GetParameterMap();
  QHash<QString, Object::Pointer> parms;
  for (QHash<QString, QString>::const_iterator i = paramMap.begin();
       i != paramMap.end(); ++i)
  {
    Object::Pointer value(new ObjectString(i.value()));
    parms.insert(i.key(), value);
  }
  IElementReference::Pointer ref(new ElementReference(command->GetId(),
                                                      element, parms));
  RegisterElement(ref);
  return ref;
}
コード例 #2
0
ファイル: berryCommand.cpp プロジェクト: AGrafmint/MITK
  ParameterType::Pointer Command::GetReturnType() const {
    if (!this->IsDefined()) {
      throw NotDefinedException(
          "Cannot get the return type of an undefined command. " + id);
    }

    return returnType;
  }
コード例 #3
0
ファイル: berryCommand.cpp プロジェクト: AGrafmint/MITK
  std::vector<IParameter::Pointer> Command::GetParameters() const {
    if (!this->IsDefined()) {
      throw NotDefinedException(
          "Cannot get the parameters from an undefined command. " + id);
    }

    return parameters;
  }
コード例 #4
0
ファイル: berryParameterType.cpp プロジェクト: 151706061/MITK
bool ParameterType::IsCompatible(const QObject* const value) const
{
  if (!this->IsDefined())
  {
    throw NotDefinedException(
        "Cannot use IsCompatible() with an undefined ParameterType");
  }
  return value->inherits(qPrintable(type));
}
コード例 #5
0
ファイル: berryParameterType.cpp プロジェクト: 151706061/MITK
IParameterValueConverter* ParameterType::GetValueConverter() const
{
  if (!this->IsDefined())
  {
    throw NotDefinedException(
        "Cannot use GetValueConverter() with an undefined ParameterType"); //$NON-NLS-1$
  }

  return parameterTypeConverter.data();
}
コード例 #6
0
ファイル: berryCommand.cpp プロジェクト: AGrafmint/MITK
  IParameter::Pointer Command::GetParameter(const std::string& parameterId) const
       {
    if (!this->IsDefined()) {
      throw NotDefinedException(
          "Cannot get a parameter from an undefined command. " + id);
    }

    for (unsigned int i = 0; i < parameters.size(); i++) {
      IParameter::Pointer parameter(parameters[i]);
      if (parameter->GetId() == parameterId) {
        return parameter;
      }
    }

    return IParameter::Pointer(0);
  }
コード例 #7
0
  std::string CommandManager::GetHelpContextId(const SmartPointer<const Command> command) const
      throw(NotDefinedException) {
    // Check if the command is defined.
    if (!command->IsDefined()) {
      throw NotDefinedException("The command is not defined. " //$NON-NLS-1$
          + command->GetId());
    }

    // Check the handler.
    const IHandler::Pointer handler(command->GetHandler());
    if (handler) {
      const IHandler::WeakPtr weakHandler(handler);
      Poco::HashMap<WeakPointer<IHandler>, std::string, Object::Hash>::ConstIterator itr =
        helpContextIdsByHandler.find(weakHandler);
      if (itr != helpContextIdsByHandler.end() && !itr->second.empty())
      {
        return itr->second;
      }
    }

    // Simply return whatever the command has as a help context identifier.
    return command->GetHelpContextId();
  }
コード例 #8
0
void BaseMatrix::IEQND() const
   { Throw(NotDefinedException("inequalities", "matrices")); }
コード例 #9
0
void BandLUMatrix::GetCol(MatrixRowCol&)
   { Throw(NotDefinedException("GetCol","BandLUMatrix")); }
コード例 #10
0
void CroutMatrix::GetCol(MatrixRowCol&)
   { Throw(NotDefinedException("GetCol","Crout")); }
コード例 #11
0
ファイル: newmatex.cpp プロジェクト: DX94/Enigma-Studio-3
void BandLUMatrix::operator=(const BaseMatrix&)
   { Throw(NotDefinedException("=","BandLUMatrix")); }
コード例 #12
0
ファイル: newmatex.cpp プロジェクト: DX94/Enigma-Studio-3
void CroutMatrix::operator=(const BaseMatrix&)
   { Throw(NotDefinedException("=","Crout")); }