IOLink Python 1.11.0
Loading...
Searching...
No Matches
iolink.iolink.RandomAccessCapabilitySet Class Reference
Inheritance diagram for iolink.iolink.RandomAccessCapabilitySet:

Public Member Functions

 __init__ (self, *args)
 
 value (self)
 
 has (self, flags)
 
 add (self, flags)
 
 remove (self, flags)
 
 __eq__ (self, flags)
 
 __ne__ (self, flags)
 
 __ior__ (self, flags)
 
 __iand__ (self, flags)
 
 __ixor__ (self, flags)
 
 __or__ (self, flags)
 
 __and__ (self, flags)
 
 __xor__ (self, flags)
 

Properties

 thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
 

Detailed Description

Template class to handle a flags system from an enum.

The wrapped enum must have the values set to follow a flags logic, flags values
must be multiples of two. The enum can also have shorcut values that combines
multiple basic values.

Setup:

.. code-block:: c++

    // our enum to wrap
    enum class TestEnum
    {
      Value1 = 0x1, // basic value: 001
      Value2 = 0x2, // basic value: 010
      Value3 = 0x4, // basic value: 100

      // Value1 and Value2
      Combo1 = 0x3, // shortcut value: 011

      // Value1 and Value3
      Combo2 = 0x5, // shortcut value: 101
    };

    // defines bitwise operators on enum
    IOLINK_DEFINE_ENUM_BITWISE_OPERATORS(TestEnum)

    // alias on template type
    using TestFlagSet = FlagSet<EnumType>;

:param EnumType: The enum to wrap.

Member Function Documentation

◆ add()

iolink.iolink.RandomAccessCapabilitySet.add (   self,
  flags 
)
Set the given set of flags to true.

◆ has()

iolink.iolink.RandomAccessCapabilitySet.has (   self,
  flags 
)
Check if a given set of flags is true.

◆ remove()

iolink.iolink.RandomAccessCapabilitySet.remove (   self,
  flags 
)
Set the given set of flags to false.

◆ value()

iolink.iolink.RandomAccessCapabilitySet.value (   self)
Return the internal value

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