void ConstData::setParameter(unsigned int id, const Data& value) { try { switch(id) { case ALLOCATE_DATA: m_allocateData = data_cast<Bool>(value); break; case DATA_TYPE: DataOperatorBase::setParameter(id, value); // make sure some value is set if (! valuePtr()) resetValuePtr(typeToData(data_cast<Enum>(value))); break; default: DataOperatorBase::setParameter(id, value); } } catch(std::bad_cast&) { throw WrongParameterType(parameter(id), *this); } }
void ReadDirectory::setParameter(unsigned int id, const Data& value) { Enum enumValue; try { switch(id) { case DIRECTORY: enumValue = data_cast<Enum>(value); if (m_directory != NO_DIRECTORY) { if(m_directoryMap.count(std::size_t(enumValue)) == 0) throw WrongParameterValue(parameter(id), *this); } m_directory = enumValue; break; default: throw WrongParameterId(id, *this); } } catch(std::bad_cast&) { throw WrongParameterType(parameter(id), *this); } }
void CameraBuffer::setParameter(const unsigned int id, const Data& value) { try { switch(id) { case BUFFER_SIZE: m_bufferSize = stromx::runtime::data_cast<UInt32>(value); break; case NUM_BUFFERS: { UInt32 newNumBuffers = stromx::runtime::data_cast<UInt32>(value); if(newNumBuffers < 1) throw WrongParameterValue(parameter(NUM_BUFFERS), *this); m_numBuffers = newNumBuffers; break; } default: throw WrongParameterId(id, *this); } } catch(std::bad_cast&) { throw WrongParameterType(parameter(id), *this); } }
void TestOperator::setParameter(unsigned int id, const runtime::Data& value) { try { switch(id) { case BUFFER_SIZE: m_bufferSize = data_cast<UInt32>(value); break; case SLEEP_TIME: m_sleepTime = data_cast<UInt32>(value); break; case THROW_EXCEPTION: m_throwException = data_cast<Bool>(value); break; case TEST_DATA: m_testData = data_cast<TestData>(value); break; default: throw WrongParameterId(id, *this); } } catch(std::bad_cast&) { throw WrongParameterType(*parameters()[id], *this); } }
void Flicker::setParameter(unsigned int id, const Data& value) { try { switch(id) { case AMOUNT: m_amount = stromx::runtime::data_cast<Float64>(value); m_amount = std::max(0.0, std::min(double(1.0), double(m_amount))); break; default: throw WrongParameterId(id, *this); } } catch(std::bad_cast&) { throw WrongParameterType(parameter(id), *this); } }
void ParameterOperator::setParameter(unsigned int id, const Data& value) { try { switch(id) { case INT_PARAM: m_intParam = data_cast<Int32>(value); break; case INITIALIZE_PARAM: m_initializeParam = data_cast<UInt32>(value); break; case ENUM_PARAM: m_enumParam = data_cast<Enum>(value); break; case BOOL_PARAM: m_boolParam = data_cast<Bool>(value); break; case MATRIX_PARAM: m_matrixParam = data_cast<stromx::runtime::Matrix>(value); break; case INT_MATRIX_PARAM: m_intMatrixParam = data_cast<stromx::runtime::Matrix>(value); break; case TRIGGER_VALUE_PARAM: m_triggerValue = data_cast<stromx::runtime::Bool>(value); break; case TRIGGER_PARAM: data_cast<stromx::runtime::TriggerData>(value); m_triggerValue = true; break; case PUSH_PARAM: m_pushValue = data_cast<Float32>(value); break; default: throw WrongParameterId(id, *this); } } catch(std::bad_cast&) { throw WrongParameterType(*parameters()[id], *this); } }
void ReadGpio::setParameter(unsigned int id, const Data& data) { try { switch(id) { case GPIO: { m_gpio = data_cast<runtime::Enum>(data); break; } default: throw WrongParameterId(id, *this); } } catch(std::bad_cast&) { throw WrongParameterType(parameter(id), *this); } }
void ConvertPixelType::setParameter(unsigned int id, const Data& value) { try { switch(id) { case PIXEL_TYPE: m_pixelType = stromx::runtime::data_cast<Enum>(value); break; case DATA_FLOW: m_dataFlow = stromx::runtime::data_cast<Enum>(value); break; default: throw WrongParameterId(id, *this); } } catch(std::bad_cast&) { throw WrongParameterType(parameter(id), *this); } }
void ExceptionOperator::setParameter(unsigned int id, const Data& value) { try { switch(id) { case THROW_INITIALIZE: m_throwInitialize = data_cast<Bool>(value); break; case THROW_ACTIVATE: m_throwActivate = data_cast<Bool>(value); break; case THROW_EXECUTE: m_throwExecute = data_cast<Bool>(value); break; case THROW_DEACTIVATE: m_throwDeactivate = data_cast<Bool>(value); break; case THROW_DEINITIALIZE: m_throwDeinitialize = data_cast<Bool>(value); break; case THROW_PARAMETER: m_throwParameter = data_cast<Bool>(value); break; case PARAMETER: if (m_throwParameter) throw WrongParameterId(id, *this); else m_parameter = data_cast<Int32>(value); break; default: throw WrongParameterId(id, *this); } } catch(std::bad_cast&) { throw WrongParameterType(*parameters()[id], *this); } }