TEST(ParameterTest, NumericParameterValidation) {
	NumericParameter p;
	ASSERT_NO_THROW(p = NumericParameter(0.2, 0.1, 1.0, 0.1, "asd", "asd"));

	EXPECT_THROW(p.set(0.05), SIPL::SIPLException);
	EXPECT_THROW(p.set(1.2), SIPL::SIPLException);
	EXPECT_NO_THROW(p.set(0.4));
}
Esempio n. 2
0
 const std::vector<const Parameter*> Flicker::setupParameters()
 {
     std::vector<const runtime::Parameter*> parameters;
     
     NumericParameter<Float64>* amount = new NumericParameter<Float64>(AMOUNT, Float64(0.0), Float64(1.0));
     amount->setTitle(L_("Relative amount"));
     amount->setAccessMode(runtime::Parameter::ACTIVATED_WRITE);
     parameters.push_back(amount);
                                 
     return parameters;
 }
Esempio n. 3
0
 const std::vector<const Parameter*> Send::setupParameters()
 {
     std::vector<const runtime::Parameter*> parameters;
     
     NumericParameter<UInt16>* port = new NumericParameter<UInt16>(PORT);
     port->setTitle("TCP port");
     port->setAccessMode(runtime::Parameter::INITIALIZED_WRITE);
     port->setMin(UInt16(MIN_PORT));
     port->setMax(UInt16(MAX_PORT));
     parameters.push_back(port);
     
     return parameters;
 }
Esempio n. 4
0
 const std::vector<const Parameter*> CameraBuffer::setupParameters()
 {
     std::vector<const Parameter*> parameters;
 
     NumericParameter<UInt32>* numBuffers = new NumericParameter<UInt32>(NUM_BUFFERS);
     numBuffers->setTitle("Number of buffers");
     numBuffers->setAccessMode(runtime::Parameter::INITIALIZED_WRITE);
     numBuffers->setMin(UInt32(1));
     parameters.push_back(numBuffers);
 
     NumericParameter<UInt32>* bufferSize = new NumericParameter<UInt32>(BUFFER_SIZE);
     bufferSize->setTitle("Buffer size in bytes");
     bufferSize->setAccessMode(runtime::Parameter::INITIALIZED_WRITE);
     parameters.push_back(bufferSize);
                                 
     return parameters;
 }
Esempio n. 5
0
 const std::vector<const Parameter*> ParameterOperator::setupParameters()
 {
     std::vector<const Parameter*> parameters;
     
     ParameterGroup* group1 = new ParameterGroup(PARAM_GROUP_1);
     group1->setTitle("Group 1");
     parameters.push_back(group1);
     
     ParameterGroup* group2 = new ParameterGroup(PARAM_GROUP_2, group1);
     group2->setTitle("Group 2");
     parameters.push_back(group2);
     
     NumericParameter<Int32>* intParam = new NumericParameter<Int32>(INT_PARAM, group1);
     intParam->setTitle("Integer parameter");
     intParam->setMax(Int32(1000));
     intParam->setMin(Int32(-1000));
     intParam->setAccessMode(Parameter::INITIALIZED_WRITE);
     parameters.push_back(intParam);
     
     EnumParameter* enumParam = new EnumParameter(ENUM_PARAM, group2);
     enumParam->setTitle("Enum parameter");
     enumParam->setAccessMode(Parameter::ACTIVATED_WRITE);
     enumParam->add(EnumDescription(Enum(0), "Choice 0"));
     enumParam->add(EnumDescription(Enum(1), "Choice 1"));
     enumParam->add(EnumDescription(Enum(2), "Choice 2"));
     parameters.push_back(enumParam);
     
     Parameter* boolParam = new Parameter(BOOL_PARAM, Variant::BOOL);
     boolParam->setTitle("Boolean parameter");
     boolParam->setAccessMode(Parameter::INITIALIZED_WRITE);
     parameters.push_back(boolParam);
     
     Parameter* matrixParam = new MatrixParameter(MATRIX_PARAM, Variant::FLOAT_32_MATRIX);
     matrixParam->setTitle("Matrix parameter");
     matrixParam->setAccessMode(Parameter::INITIALIZED_WRITE);
     parameters.push_back(matrixParam);
     
     MatrixParameter* intMatrixParam = new MatrixParameter(INT_MATRIX_PARAM, Variant::UINT_32_MATRIX);
     intMatrixParam->setTitle("Integer matrix parameter");
     intMatrixParam->setAccessMode(Parameter::INITIALIZED_WRITE);
     intMatrixParam->setRows(1);
     intMatrixParam->setCols(2);
     parameters.push_back(intMatrixParam);
     
     Parameter* triggerValueParam = new Parameter(TRIGGER_VALUE_PARAM, Variant::BOOL);
     triggerValueParam->setTitle("Trigger value");
     triggerValueParam->setAccessMode(Parameter::INITIALIZED_WRITE);
     parameters.push_back(triggerValueParam);
     
     Parameter* triggerParam = new Parameter(TRIGGER_PARAM, Variant::TRIGGER);
     triggerParam->setTitle("Trigger");
     triggerParam->setAccessMode(Parameter::INITIALIZED_WRITE);
     triggerParam->setUpdateBehavior(Parameter::PUSH);
     parameters.push_back(triggerParam);
     
     Parameter* pushParam = new Parameter(PUSH_PARAM, Variant::FLOAT_32);
     pushParam->setTitle("Push");
     pushParam->setAccessMode(Parameter::INITIALIZED_WRITE);
     pushParam->setUpdateBehavior(Parameter::PUSH);
     parameters.push_back(pushParam);
     
     Parameter* pullParam = new Parameter(PULL_PARAM, Variant::FLOAT_32);
     pullParam->setTitle("Pull");
     pullParam->setAccessMode(Parameter::INITIALIZED_READ);
     pullParam->setUpdateBehavior(Parameter::PULL);
     parameters.push_back(pullParam);
     
     return parameters;
 }