Class PropFloat

Float properties represent a feature whose value is a floating-point number.

Inheritance
PropFloat
Implements
Namespace: ic4
Assembly: ic4dotnet.dll
Syntax
public class PropFloat : Property, IDisposable
Remarks

Common examples for a float properties are AcquisitionFrameRate, ExposureTime or Gain.

A float property can limit the range of valid values. The range of possible values can be queried by reading Minimum and Maximum.

The possible values can be further restricted by an increment value or a set of value values. Check IncrementMode, Increment and ValidValueSet.

A float property supplies hints that can be useful when creating a user interface:

PropFloat instances are created in multiple ways:

Properties

DisplayNotation

A suggested display notation to use when displaying the float property's value

Declaration
public DisplayNotation DisplayNotation { get; }
Property Value
Type Description
DisplayNotation

A suggested display notation to use when displaying the float property's value

Remarks

The display precision can be used as a hint when creating user interfaces

DisplayPrecision

A suggested number of significant digits to use when displaying the float property's value

Declaration
public long DisplayPrecision { get; }
Property Value
Type Description
long

A suggested number of significant digits to use when displaying the float property's value

Remarks

The display precision can be used as a hint when creating user interfaces

Increment

The step size for valid values accepted by this float property

Declaration
public double Increment { get; }
Property Value
Type Description
double

The step size for valid values accepted by this float property

Remarks

The increment restricts the set of valid values for a float property.

For example, if the property's minimum value is 0, the maximum is 10, and the increment is 0.5, 0.25 is not a valid value for the property

Accessing Increment will throw an exception if IncrementMode is not equal to Increment.

Exceptions
Type Condition
IC4Exception

Check ErrorCode and ToString() for details.

IncrementMode

Indicates how this float property restricts which values are valid between its minimum and maximum value.

Declaration
public PropertyIncrementMode IncrementMode { get; }
Property Value
Type Description
PropertyIncrementMode

The property's increment mode

Remarks

A float property has 1 of 3 possible increment modes:

Increment mode Description
None The property has no restrictions, all values between Minimum and Maximum can be set.
Increment Only multiples of Increment can be set.
ValueSet Only values that are part of ValidValueSet can be set.

Maximum

The maximum value accepted by this property.

Declaration
public double Maximum { get; }
Property Value
Type Description
double

The maximum value accepted by this property.

Exceptions
Type Condition
IC4Exception

Check ErrorCode and ToString() for details.

Minimum

The minimum value accepted by this property.

Declaration
public double Minimum { get; }
Property Value
Type Description
double

The minimum value accepted by this property.

Exceptions
Type Condition
IC4Exception

Check ErrorCode and ToString() for details.

Representation

The suggested representation for this float property

Declaration
public FloatRepresentation Representation { get; }
Property Value
Type Description
FloatRepresentation

The suggested representation for this float property

Remarks

The representation can be used as a hint when creating user interfaces

Unit

The unit of this float property

Declaration
public string Unit { get; }
Property Value
Type Description
string

The unit of this float property

Exceptions
Type Condition
IC4Exception

Check ErrorCode and ToString() for details.

ValidValueSet

The set of valid values for this property

Declaration
public IReadOnlyList<double> ValidValueSet { get; }
Property Value
Type Description
IReadOnlyList<double>

A list containing the values that are valid for this property

Remarks

Accessing Increment will throw an exception if IncrementMode is not equal to ValueSet.

Exceptions
Type Condition
IC4Exception

Check ErrorCode and ToString() for details.

Value

The current value of this property

The value is only writable is the property's writability is not restricted. See IsLocked, IsReadonly, IsAvailable.

Declaration
public double Value { get; set; }
Property Value
Type Description
double

The current value of this property

Exceptions
Type Condition
IC4Exception

Check ErrorCode and ToString() for details.

Methods

TryGetValue(out double)

Tries to get the current value of the property.

Declaration
public bool TryGetValue(out double val)
Parameters
Type Name Description
double val

Output parameter receiving the current value of the property on success

Returns
Type Description
bool

true, if the operation was successful, otherwise false.

Remarks

In contrast to reading the Value property directly, this method does not throw an exception in case of an error.

TrySetValue(double)

Tries to set the current value of the property.

Declaration
public bool TrySetValue(double val)
Parameters
Type Name Description
double val

The new value

Returns
Type Description
bool

true, if the operation was successful, otherwise false.

Remarks

In contrast to writing the Value property directly, this method does not throw an exception in case of an error.

Implements