File Information
Library: IoT/Devices
Package: Datapoints
Header: IoT/Devices/FlagsDatapoint.h
Description
The base class for datapoints holding a variable number of flag bits, internally stored as a std::vector<bool>.
An implementation should handle conversion between a flag bit and the corresponding symbolic name of a flag.
In addition to the methods defined in this interface, a FlagsDatapoint implementation should expose the following properties:
- displayValue (string, optional): The current value of the datapoint, formatted as string for display purposes.
Inheritance
Direct Base Classes: Datapoint
Member Summary
Member Functions: definedFlags, flags, reset, resetFlags, set, setFlags, toggle, toggleFlags, unset, unsetFlags, validFlags, validValue, value
Inherited Functions: getFeature, getPropertyBool, getPropertyDouble, getPropertyInt, getPropertyInt16, getPropertyInt64, getPropertyString, getPropertyTimestamp, hasFeature, hasProperty, invalidate, setFeature, setPropertyBool, setPropertyDouble, setPropertyInt, setPropertyInt16, setPropertyInt64, setPropertyString, setPropertyTimestamp, valid
Types Aliases
FlagsType
using FlagsType = std::vector < bool >;
Constructors
FlagsDatapoint
Creates the FlagsDatapoint.
Destructor
~FlagsDatapoint
~FlagsDatapoint();
Destroys the FlagsDatapoint.
Member Functions
definedFlags
virtual std::vector < FlagValue > definedFlags() const = 0;
Returns a vector containing the possible flags and mappings to symbolic names.
flags
virtual std::vector < std::string > flags() const = 0;
Returns a vector containing the symbolic names of all flags currently set, even if the datapoint has been invalidated.
Use validFlags() to get a valid value only.
reset
virtual FlagsType reset(
FlagsType value = FlagsType ()
) = 0;
Resets all flags to zero or the given value. Also makes the datapoint valid.
Returns the previously set flags.
resetFlags
virtual void resetFlags(
const std::vector < std::string > & flags = std::vector < std::string > ()
) = 0;
Resets all flags to the given set of flags and makes the datapoint valid.
set
virtual FlagsType set(
FlagsType flags
) = 0;
Sets flags by logically OR-ing the currently set flags with the given ones.
Returns the previously set flags.
setFlags
virtual void setFlags(
const std::vector < std::string > & flags
) = 0;
Sets flags by logically OR-ing the currently set flags with the given ones.
toggle
virtual FlagsType toggle(
FlagsType flags
) = 0;
Sets flags by logically XOR-ing the currently set flags with the given ones.
Returns the previously set flags.
toggleFlags
virtual void toggleFlags(
const std::vector < std::string > & flags
) = 0;
Sets flags by logically XOR-ing the currently set flags with the given ones.
unset
virtual FlagsType unset(
FlagsType flags
) = 0;
Unsets flags by logically AND-ing the currently set flags with the inverted given ones.
Returns the previously set flags.
unsetFlags
virtual void unsetFlags(
const std::vector < std::string > & flags
) = 0;
Unsets flags by logically AND-ing the currently set flags with the inverted given ones.
validFlags
virtual Poco::Optional < std::vector < std::string >> validFlags() const = 0;
Returns a vector containing the symbolic names of all flags currently set if the datapoint is valid, otherwise an empty value.
validValue
virtual Poco::Optional < FlagsType > validValue() const = 0;
Returns the bit vector value of the datapoint if it is valid, otherwise an empty value.
value
virtual FlagsType value() const = 0;
Returns the bit vector value of the datapoint, even if the datapoint has been invalidated.
Use validValue() to get a valid value only.
Variables
validated
Poco::BasicEvent < const FlagsType > validated;
Fired when an invalid datapoint becomes valid again, by being updated with a new value. The new valud is given as event argument.
valueChanged
Poco::BasicEvent < const FlagsType > valueChanged;
Fired when the value of the datapoint has changed.
valueUpdated
Poco::BasicEvent < const FlagsType > valueUpdated;
Fired when the value of the datapoint has been updated by calling update(). This event is also fired if the actual value has not changed.