78 FORCEINLINE mask_t operator >> (mask_t m, int i) {return (mask_t)(((int)m) >> i);} |
78 FORCEINLINE mask_t operator >> (mask_t m, int i) {return (mask_t)(((int)m) >> i);} |
79 |
79 |
80 |
80 |
81 /** Informative template class exposing basic enumeration properties used by several |
81 /** Informative template class exposing basic enumeration properties used by several |
82 * other templates below. Here we have only forward declaration. For each enum type |
82 * other templates below. Here we have only forward declaration. For each enum type |
83 * we will create specialization derived from MakeEnumPropsT<>. */ |
83 * we will create specialization derived from MakeEnumPropsT<>. |
|
84 * i.e.: |
|
85 * template <> struct EnumPropsT<Track> : MakeEnumPropsT<Track, byte, TRACK_BEGIN, TRACK_END, INVALID_TRACK> {}; |
|
86 * followed by: |
|
87 * typedef TinyEnumT<Track> TrackByte; |
|
88 */ |
84 template <typename Tenum_t> struct EnumPropsT; |
89 template <typename Tenum_t> struct EnumPropsT; |
85 |
90 |
86 /** Helper template class that makes basic properties of given enumeration type visible |
91 /** Helper template class that makes basic properties of given enumeration type visible |
87 * from outsize. It is used as base class of several EnumPropsT specializations each |
92 * from outsize. It is used as base class of several EnumPropsT specializations each |
88 * dedicated to one of commonly used enumeration types. */ |
93 * dedicated to one of commonly used enumeration types. |
|
94 * @param Tenum_t enumeration type that you want to describe |
|
95 * @param Tstorage_t what storage type would be sufficient (i.e. byte) |
|
96 * @param Tbegin first valid value from the contiguous range (i.e. TRACK_BEGIN) |
|
97 * @param Tend one past the last valid value from the contiguous range (i.e. TRACK_END) |
|
98 * @param Tinvalid value used as invalid value marker (i.e. INVALID_TRACK) |
|
99 */ |
89 template <typename Tenum_t, typename Tstorage_t, Tenum_t Tbegin, Tenum_t Tend, Tenum_t Tinvalid> |
100 template <typename Tenum_t, typename Tstorage_t, Tenum_t Tbegin, Tenum_t Tend, Tenum_t Tinvalid> |
90 struct MakeEnumPropsT { |
101 struct MakeEnumPropsT { |
91 typedef Tenum_t type; ///< enum type (i.e. Trackdir) |
102 typedef Tenum_t type; ///< enum type (i.e. Trackdir) |
92 typedef Tstorage_t storage; ///< storage type (i.e. byte) |
103 typedef Tstorage_t storage; ///< storage type (i.e. byte) |
93 static const Tenum_t begin = Tbegin; ///< lowest valid value (i.e. TRACKDIR_BEGIN) |
104 static const Tenum_t begin = Tbegin; ///< lowest valid value (i.e. TRACKDIR_BEGIN) |