a simple question on enumerated attributes.
Since it is not possible to add new states other than the predefined ones (14 states) (i.e. see this post)
I would like to use enum attributes to define a state parameter with “unconventional” name (unfortunately I must adopt such names without re-mapping to the TANGO predefined states).
My question is: is it possible to have two or more enum attributes within a device server having the same labels? For example:
Because you are talking about compiler pb, I assume your Tango class is C++.
If you use the C++ 11 way of enum declaration, you can have the same label several times.
enum class _FirstEnum
{
FIRST = 0,
SECOND
};
typedef _FirstEnum FirstEnum;
enum class _SecondEnum
{
FIRST = 0,
SECOND
};
typedef _SecondEnum SecondEnum;
Then use enum label like FirstEnum::FIRST or SecondEnum::FIRST
Dear Manu,
after long time, I forgot to add to the previous question that, as suggested in the User Guide examples (pag. 163), I needed to add a “: short” in your enum class definition:
enum class _FirstEnum : short
{
FIRST = 0,
SECOND
};
typedef _FirstEnum FirstEnum;
otherwise I get this error while reading the attribute:
Invalid enumeration type. Supported types are C++11 scoped enum with short as underlying data type or old enum