PropFloat Class Reference

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

Inheritance diagram for PropFloat:

Property

Public Member Functions

PropFloatRepresentation  representation (Error &err=Error::Default()) const

Returns the suggested representation for this float property.

std::string unit (Error &err=Error::Default()) const

Returns the unit of this float property.

PropDisplayNotation displayNotation (Error &err=Error::Default()) const

Returns a suggested display notation to use when displaying the float property's value.

int64_t displayPrecision (Error &err=Error::Default()) const

Returns a suggested number of significant digits to use when displaying the float property's value.

bool setValue (double value, Error &err=Error::Default())

Changes the value of this property.

double getValue (Error &err=Error::Default()) const

Reads the current value of this property.

double minimum (Error &err=Error::Default()) const

Returns the minimum value accepted by this property.

double maximum (Error &err=Error::Default()) const

Returns the maximum value accepted by this property.

PropIncrementMode incrementMode (Error &err=Error::Default()) const

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

double increment (Error &err=Error::Default()) const

Returns the step size for valid values accepted by this float property.

std::vector< double > validValueSet (Error &err=Error::Default()) const

Returns the valid value set for this property.

- Public Member Functions inherited from Property
Property ()=default

Creates an invalid object.

bool is_valid () const noexcept

Checks whether this property is a valid object.

bool operator== (const Property &other) const noexcept

Checks whether a property object refers to the same property as another property object.

bool operator!= (const Property &other) const noexcept

Checks whether a property object refers to a different property as another property object.

bool operator< (const Property &other) const noexcept

Provides an ordering of property objects.

PropType type (Error &err=Error::Default()) const

Returns the type of the property.

std::string name (Error &err=Error::Default()) const

Returns the name of the property.

bool isAvailable (Error &err=Error::Default()) const

Checks whether a property is currently available.

bool isLocked (Error &err=Error::Default()) const

Checks whether a property is currently locked.

bool isLikelyLockedByStream (Error &err=Error::Default()) const

Tries to determine whether a property is locked because a data stream is active.

bool isReadOnly (Error &err=Error::Default()) const

Checks whether a property is read-only.

PropVisibility visibility (Error &err=Error::Default()) const

Returns a visibility hint for the property.

std::string displayName (Error &err=Error::Default()) const

Returns the display name of the property.

std::string tooltip (Error &err=Error::Default()) const

Returns a tooltip for the property.

std::string description (Error &err=Error::Default()) const

Returns a description for the property.

PropCommand asCommand (Error &err=Error::Default()) const

Converts this property into a PropCommand.

PropInteger asInteger (Error &err=Error::Default()) const

Converts this property into a PropInteger.

PropBoolean asBoolean (Error &err=Error::Default()) const

Converts this property into a PropBoolean.

PropFloat asFloat (Error &err=Error::Default()) const

Converts this property into a PropFloat.

PropString asString (Error &err=Error::Default()) const

Converts this property into a PropString.

PropEnumeration asEnumeration (Error &err=Error::Default()) const

Converts this property into a PropEnumeration.

PropEnumEntry asEnumEntry (Error &err=Error::Default()) const

Converts this property into a PropEnumEntry.

PropRegister asRegister (Error &err=Error::Default()) const

Converts this property into a PropRegister.

PropCategory asCategory (Error &=Error::Default()) const

Converts this property into a PropCategory.

NotificationToken eventAddNotification (NotificationHandler cb, Error &err=Error::Default())

Registers a new property notification event handler.

bool eventRemoveNotification (NotificationToken token, Error &err=Error::Default())

Unregisters a previously registered property notification event handler.

bool isSelector (Error &err=Error::Default()) const

Indicates whether this property's value changes the meaning and/or value of other properties.

std::vector< PropertyselectedProperties (Error &err=Error::Default()) const

Returns the list of properties whose values' meaning depend on this property.

Additional Inherited Members

- Public Types inherited from Property
using NotificationHandler = std::function< void(Property &prop)>

Function prototype for property notification event handlers.

using NotificationToken = void *

Represents a registered callback.

Detailed Description

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

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 calling PropFloat::minimum() and PropFloat::maximum().

The possible values can be further restricted by an increment value or a set of value values. Check PropFloat::incrementMode(), PropFloat::increment() and PropFloat::validValueSet() for details.

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

PropFloat instances are created in two ways:

Member Function Documentation

◆ displayNotation()

PropDisplayNotation displayNotation ( Error err = Error::Default()) const
inline

Returns a suggested display notation to use when displaying the float property's value.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The suggested display notation for this property.
If an error occurred, this function returns a default representation. Check the err output parameter for details.

◆ displayPrecision()

int64_t displayPrecision ( Error err = Error::Default()) const
inline

Returns a suggested number of significant digits to use when displaying the float property's value.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The suggested display notation for this property.
If an error occurred, this function returns a default precision. Check the err output parameter for details.

◆ getValue()

double getValue ( Error err = Error::Default()) const
inline

Reads the current value of this property.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The current value.
If an error occurs, the function returns 0. Check the err output parameter for details.
See also
PropFloat::setValue()

◆ increment()

double increment ( Error err = Error::Default()) const
inline

Returns the step size for valid values accepted by this float property.

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 and will be rejected when trying to write it.

This function will fail if PropFloat::incrementMode() does not return PropIncrementMode::Increment.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The step size.
If an error occurs, the function returns 0. Check the err output parameter for details.
See also
PropInteger::incrementMode()

◆ incrementMode()

PropIncrementMode incrementMode ( Error err = Error::Default()) const
inline

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

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
PropIncrementMode::Increment, if the property has a fixed step size between valid values.
PropIncrementMode::ValueSet if the property has a set of valid values.
PropIncrementMode::None if the property has no restrictions.
If an error occurs, the function returns PropIncrementMode::None. Check the err output parameter for details.
See also
PropFloat::increment()
PropFloat::validValueSet()

◆ maximum()

double maximum ( Error err = Error::Default()) const
inline

Returns the maximum value accepted by this property.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The maximum value.
If an error occurs, the function returns 0. Check the err output parameter for details.
See also
PropFloat::minimum()

◆ minimum()

double minimum ( Error err = Error::Default()) const
inline

Returns the minimum value accepted by this property.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The minimum value.
If an error occurs, the function returns 0. Check the err output parameter for details.
See also
PropFloat::maximum()

◆ representation()

PropFloatRepresentation representation ( Error err = Error::Default()) const
inline

Returns the suggested representation for this float property.

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

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The suggested representation of this property.
If an error occurred, this function returns a default representation. Check the err output parameter for details.

◆ setValue()

bool setValue ( double  value,
Error err = Error::Default() 
)
inline

Changes the value of this property.

Parameters
[in]valueThe new value to set
[out]errReference to an error handler. See Error Handling for details.
Returns
true on success, otherwise false.
Check the err output parameter for details.
See also
PropFloat::getValue()

◆ unit()

std::string unit ( Error err = Error::Default()) const
inline

Returns the unit of this float property.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
The unit of this property. The unit can be an empty string, if there is no unit for the property.
If an error occurred, this function returns an empty string. Check the err output parameter for details.

◆ validValueSet()

std::vector< double > validValueSet ( Error err = Error::Default()) const
inline

Returns the valid value set for this property.

This function will fail if PropFloat::incrementMode() does not return PropIncrementMode::ValueSet.

Parameters
[out]errReference to an error handler. See Error Handling for details.
Returns
A vector containing the set of valid values.
If an error occurs, the function returns an empty vector. Check the err output parameter for details.
See also
PropFloat::incrementMode()