HAN-FUN API  1.5.3
This project provides the common implementation of ULE Alliance's HAN-FUN application protocol.
HF::Attributes::AbstractAttribute Class Reference

Parent class for Attribute API implementation. More...

#include <attributes.h>

+ Inheritance diagram for HF::Attributes::AbstractAttribute:
+ Collaboration diagram for HF::Attributes::AbstractAttribute:

Public Member Functions

uint8_t uid () const
 Attribute's UID. More...
 
bool isWritable () const
 Indicate if the attribute is writable. More...
 
uint16_t interface () const
 Return the UID of the interface the attribute belongs to. More...
 
int compare (const IAttribute &other) const
 Compare this attribute with the given attribute in other. More...
 
- Public Member Functions inherited from HF::Attributes::IAttribute
virtual HF::Interface const * owner () const =0
 Pointer to the interface that owns this attribute. More...
 
virtual uint16_t size (bool with_uid) const =0
 Number bytes needed to serialize the message. More...
 
virtual uint16_t pack (Common::ByteArray &array, uint16_t offset, bool with_uid) const =0
 Write the object on to a ByteArray so it can be sent over the network. More...
 
virtual uint16_t unpack (const Common::ByteArray &array, uint16_t offset, bool with_uid)=0
 Read a message from a ByteArray. More...
 
virtual float changed (const IAttribute &other) const =0
 This method is used to get the percentage of change that the attribute has in relation to the value present in other. More...
 
- Public Member Functions inherited from HF::Common::Serializable
virtual ~Serializable ()
 Destructor.
 
virtual uint16_t size () const =0
 Number bytes needed to serialize the message. More...
 
virtual uint16_t pack (ByteArray &array, uint16_t offset=0) const =0
 Write the object on to a ByteArray so it can be sent over the network. More...
 
virtual uint16_t unpack (const ByteArray &array, uint16_t offset=0)=0
 Read a message from a ByteArray. More...
 
- Public Member Functions inherited from HF::Common::Cloneable< IAttribute >
virtual IAttribute * clone () const=0
 Create a clone object of the object where this method is being called. More...
 

Protected Attributes

const uint16_t _itf_uid
 Interface this attribute belongs to. More...
 
const uint8_t _uid
 Attribute unique identifier. More...
 
const bool _writable
 Attribute access mode. More...
 

Detailed Description

Parent class for Attribute API implementation.

Definition at line 270 of file attributes.h.

Member Function Documentation

◆ compare()

int HF::Attributes::AbstractAttribute::compare ( const IAttribute other) const
inlinevirtual

Compare this attribute with the given attribute in other.

This method should return < 0 if this attribute is less that, 0 if it is equal and > 0 if greater that the other attribute.

Parameters
[in]otherattribute to compare to.
Return values
<0if attribute less than other;
0if attribute equal to other;
>0if attribute greater than other.

Implements HF::Attributes::IAttribute.

Reimplemented in HF::Attributes::Attribute< T, _Owner, EnableIf(IsParent(HF::Interface, _Owner))>, HF::Attributes::Attribute< T, _Owner, typename >, HF::Attributes::Attribute< int8_t >, HF::Attributes::Attribute< uint32_t >, HF::Attributes::Attribute< int16_t >, HF::Attributes::Attribute< HS_Colour >, HF::Attributes::Attribute< XY_Colour >, HF::Attributes::Attribute< uint8_t >, HF::Attributes::Attribute< uint16_t >, and HF::Attributes::Attribute< bool >.

Definition at line 329 of file attributes.h.

References HF::Attributes::IAttribute::interface(), interface(), HF::Attributes::IAttribute::uid(), and uid().

Referenced by HF::Attributes::Attribute< bool >::changed(), HF::Attributes::Attribute< T, _Owner, EnableIf(IsParent(HF::Interface, _Owner))>::changed(), HF::Attributes::Attribute< bool >::compare(), and HF::Attributes::Attribute< T, _Owner, EnableIf(IsParent(HF::Interface, _Owner))>::compare().

330  {
331  int res = this->interface() - other.interface();
332 
333  if (res != 0)
334  {
335  return res;
336  }
337 
338  return this->uid() - other.uid();
339  }
uint16_t interface() const
Return the UID of the interface the attribute belongs to.
Definition: attributes.h:294
uint8_t uid() const
Attribute&#39;s UID.
Definition: attributes.h:284
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ interface()

uint16_t HF::Attributes::AbstractAttribute::interface ( ) const
inlinevirtual

Return the UID of the interface the attribute belongs to.

Returns
UID of the interface the attribute belongs to.

Implements HF::Attributes::IAttribute.

Definition at line 294 of file attributes.h.

References _itf_uid.

Referenced by compare().

295  {
296  return _itf_uid;
297  }
const uint16_t _itf_uid
Interface this attribute belongs to.
Definition: attributes.h:274
+ Here is the caller graph for this function:

◆ isWritable()

bool HF::Attributes::AbstractAttribute::isWritable ( ) const
inlinevirtual

Indicate if the attribute is writable.

Return values
trueif the attribute is writable,
falseotherwise.

Implements HF::Attributes::IAttribute.

Definition at line 289 of file attributes.h.

References _writable.

Referenced by HF::Attributes::Attribute< T, _Owner, EnableIf(IsParent(HF::Interface, _Owner))>::clone().

290  {
291  return _writable;
292  }
const bool _writable
Attribute access mode.
Definition: attributes.h:276
+ Here is the caller graph for this function:

◆ uid()

uint8_t HF::Attributes::AbstractAttribute::uid ( ) const
inlinevirtual

Field Documentation

◆ _itf_uid

const uint16_t HF::Attributes::AbstractAttribute::_itf_uid
protected

Interface this attribute belongs to.

Definition at line 274 of file attributes.h.

Referenced by HF::Attributes::Attribute< bool >::clone(), and interface().

◆ _uid

const uint8_t HF::Attributes::AbstractAttribute::_uid
protected

Attribute unique identifier.

Definition at line 275 of file attributes.h.

Referenced by HF::Attributes::Attribute< bool >::clone(), and uid().

◆ _writable

const bool HF::Attributes::AbstractAttribute::_writable
protected

Attribute access mode.

Definition at line 276 of file attributes.h.

Referenced by HF::Attributes::Attribute< bool >::clone(), and isWritable().


The documentation for this class was generated from the following file: