[gme-users] Ordering in GME Enumeration Values?
Zoltan Molnar
zolmol at isis.vanderbilt.edu
Fri Oct 27 11:44:16 CDT 2006
If you don't specify explicit values for enum items then each distinct item's value becomes the item itself.
For example,
1
2
3
defined in the meta as an enumeration, might look like in the xmp file:
<enumitem dispname = "1" value = "1"></enumitem>
<enumitem dispname = "2" value = "2"></enumitem>
<enumitem dispname = "3" value = "3"></enumitem>
Another definition (explicit value assignment):
One, 1
Two, 2
Three, 3
results in the following xmp:
<enumitem dispname = "One" value = "1"></enumitem>
<enumitem dispname = "Two" value = "2"></enumitem>
<enumitem dispname = "Three" value = "3"></enumitem>
Values are comparable in such cases, because from Bon2 you can ask
myAttr->getIntegerValue().
They are not comparable, in case of the
One
Two
Three
definition, where values will be "One", "Two", ..., so you must use
myAttr->getStringValue() in such cases.
So the C++ comparison trick is possible only in certain cases, when integer-convertible values are found in the enum.
Zoli
-----Original Message-----
From: gme-users-bounces at list.isis.vanderbilt.edu on behalf of Joe H.
Sent: Fri 10/27/2006 7:44 AM
To: gme-users
Cc:
Subject: [gme-users] Ordering in GME Enumeration Values?
Hello.
I have a question concerning enumeration values modeled in GME. Do the
values take on ascending order like they do in C/C++? For example, if I
specify an enumeration in GME with values of yellow, red, and then blue can
I do a comparison to see if an enumeration value is less than blue? This
would be very helpful for me in defining my OCL constraints but I wasn't
sure if GME supports this.
Thanks.
-Joe
More information about the gme-users
mailing list