Use of the enumeration data class |
Category: |
C++
Applicable to: |
All Versions
Description: |
This technote illustrates the use of enumeration data class through an example in which an enumerated value needs to be sent as part of a message.
Let's assume Data1 and Data2 are both Enumerations and Data2 inherits from Data1. For this example, Data1 has red and green defined and Data2 has yellow defined. Assuming you have a signal named sig, with a Data2 data class you may use either:
port.send (sig, Data2(Data2::red);
or
port.send (sig, Data2(Data1::red);
You may send the yellow value using the following:
port.send (sig, (Data2(Data2::yellow));
or
port.send (sig, Data2::yellow);
Copyright © 1999, ObjecTime Limited. |