Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 30, 2015, 11:34:25 PM (8 years ago)
Author:
landauf
Message:

made some enums in network library strongly typed. for most other enums in network this isn't possible because they are often used like flags (converted to int and compared with binary operators).
packet::Type now uses uint8_t as underlying type which reduces the network traffic (by default the type was int)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/src/libraries/network/NetworkPrereqs.h

    r10994 r11006  
    8989    namespace PacketFlag
    9090    {
    91       enum Value
    92       {
    93         Reliable    = 1,
    94         Unsequenced = 2,
    95         NoAllocate  = 4
    96       };
     91      static constexpr uint32_t Reliable    = 1;
     92      static constexpr uint32_t Unsequenced = 2;
     93      static constexpr uint32_t NoAllocate  = 4;
    9794    }
    9895  }
     
    10198  {
    10299    typedef int Type;
    103     static const Type NETWORK_FUNCTION = 6;
     100    static constexpr Type NETWORK_FUNCTION = 6;
    104101  }
    105102}
Note: See TracChangeset for help on using the changeset viewer.