#pragma once forall(T) { // T is the based type of enum(T) forall(E) trait Bounded { E lowerBound(); E upperBound(); }; forall(E| Bounded(E, T)) trait Serial { unsigned fromInstance(E e); E fromInt(unsigned i); E succ(E e); E pred(E e); }; // Opague Enum + TypedEnum forall(E | Serial(E, T)) trait CfaEnum { char * labelE(E e); unsigned int posE(E e); }; forall(E | CfaEnum(E, T)) trait TypedEnum { T valueE(E e); }; forall(E | TypedEnum(E, T)) { // comparison int ?==?(E l, E r); int ?!=?(E l, E r); int ?!=?(E l, zero_t); int ??(E l, E r); int ?>=?(E l, E r); // for testing; To be removed // char * typeEnumString(E e); char * typeEnumString(E e); } }