Ignore:
Timestamp:
Jul 2, 2024, 2:27:57 PM (5 days ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
72abc90a
Parents:
011c29e
Message:

change basic_ostream to ostream, first attempt of enumeration input

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/enum.hfa

    r011c29e r64eeb06  
    88};
    99
    10 forall( E | Bounded(E) ) trait Serial {
     10forall( E | Bounded( E ) ) trait Serial {
    1111    unsigned fromInstance( E e );
    1212    E fromInt( unsigned i );
     
    1616
    1717// Design one
    18 forall( E, V | Serial(E) ) trait CfaEnum {
     18forall( E, V | Serial( E ) ) trait CfaEnum {
    1919    char * label( E e );
    2020    unsigned int posn( E e );
     
    2424// I/O
    2525
    26 forall( ostype & | basic_ostream(ostype), E, V | CfaEnum(E, V) ) {
     26forall( istype & | istream( istype ), E, V | CfaEnum( E, V ) )
     27istype & ?|?( istype &, E );
     28
     29forall( ostype & | ostream( ostype ), E, V | CfaEnum( E, V ) ) {
    2730        ostype & ?|?( ostype &, E );
    2831        OSTYPE_VOID( E );
    2932}
    3033
    31 forall( ostype & | basic_ostream(ostype), E | CfaEnum(E, quasi_void) )
    32 ostype & ?|?( ostype &, E );
     34forall( ostype & | ostream( ostype ), E | CfaEnum( E, quasi_void ) ) {
     35        ostype & ?|?( ostype &, E );
     36        OSTYPE_VOID( E );
     37}
    3338
    3439// Design two <- should go for this if we have change the cost model
    35 // forall(E | Serial(E)) trait CfaEnum {
    36 //     char * label(E e);
    37 //     unsigned int posn(E e);
     40// forall( E | Serial( E ) ) trait CfaEnum {
     41//     char * label( E e );
     42//     unsigned int posn( E e );
    3843// };
    3944
    40 // forall(E, V| CfaEnum(E)) trait TypedEnum {
    41 //     V value(E e);
     45// forall( E, V| CfaEnum( E)) trait TypedEnum {
     46//     V value( E e);
    4247// };
    4348
    44 forall( E, V | CfaEnum(E, V) ) {                                                // relational operators
    45     int ?==?(E, E);
    46     int ?!=?(E, E);
    47     int ?<?(E, E);
    48     int ?<=?(E, E);
    49     int ?>?(E, E);
    50     int ?>=?(E, E);
     49forall( E, V | CfaEnum( E, V ) ) {                                              // relational operators
     50    int ?==?( E, E );
     51    int ?!=?( E, E );
     52    int ?<?( E, E );
     53    int ?<=?( E, E );
     54    int ?>?( E, E );
     55    int ?>=?( E, E );
    5156
    52     int ++?(E&);
    53     int ?++(E&);
    54     int --?(E&);
    55     int ?--(E&);
     57    int ++?( E &);
     58    int ?++( E &);
     59    int --?( E &);
     60    int ?--( E &);
    5661}
Note: See TracChangeset for help on using the changeset viewer.