Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/enum.hfa

    r259012e r5eb3f65  
    33#include "iostream.hfa"
    44
    5 forall( E ) trait Bounded {
     5forall(E) trait Bounded {
    66    E lowerBound();
    77    E upperBound();
    88};
    99
    10 forall( E | Bounded(E) ) trait Serial {
    11     unsigned fromInstance( E e );
    12     E fromInt( unsigned i );
    13     E succ( E e );
    14     E pred( E e );
     10forall(E | Bounded(E)) trait Serial {
     11    unsigned fromInstance(E e);
     12    E fromInt(unsigned i);
     13    E succ(E e);
     14    E pred(E e);
    1515};
    1616
    1717// Design one
    18 forall( E, V | Serial(E) ) trait CfaEnum {
    19     char * label( E e );
    20     unsigned int posn( E e );
    21     V value( E e );
     18forall(E, V | Serial(E)) trait CfaEnum {
     19    char * label(E e);
     20    unsigned int posn(E e);
     21    V value(E e);
     22    char * type_name(E e);
    2223};
    2324
    24 // I/O
     25forall(ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V))
     26ostype & ?|?(ostype&, E);
    2527
    26 forall( ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V) ) {
    27         ostype & ?|?( ostype &, E );
    28         OSTYPE_VOID( E );
    29 }
    30 
    31 forall( ostype & | basic_ostream(ostype), E | CfaEnum(E, quasi_void) )
    32 ostype & ?|?( ostype &, E );
     28forall(ostype & | basic_ostream(ostype), E| CfaEnum(E, quasi_void))
     29ostype & ?|?(ostype&, E);
    3330
    3431// Design two <- should go for this if we have change the cost model
     
    4239// };
    4340
    44 forall( E, V | CfaEnum(E, V) ) {                                                // relational operators
     41forall(ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V)) {
    4542    int ?==?(E, E);
    46     int ?!=?(E, E);
     43    int ?<=?(E, E);
     44    int ?>=?(E, E);
    4745    int ?<?(E, E);
    48     int ?<=?(E, E);
    4946    int ?>?(E, E);
    50     int ?>=?(E, E);
     47
     48        // E ++?( E & lhs );
     49        // E ?++( E & lhs );
    5150}
Note: See TracChangeset for help on using the changeset viewer.