# track_type.h

Go to the documentation of this file.

    00001 /* $Id: track_type.h 12199 2008-02-20 17:49:50Z frosch $ */
    00002
    00005 #ifndef TRACK_TYPE_H
    00006 #define TRACK_TYPE_H
    00007
    00008 #include "core/enum_type.hpp"
    00009
    00014 enum Track {
    00015   TRACK_BEGIN = 0,
    00016   TRACK_X     = 0,
    00017   TRACK_Y     = 1,
    00018   TRACK_UPPER = 2,
    00019   TRACK_LOWER = 3,
    00020   TRACK_LEFT  = 4,
    00021   TRACK_RIGHT = 5,
    00022   TRACK_END,
    00023   INVALID_TRACK = 0xFF
    00024 };
    00025
    00027 DECLARE_POSTFIX_INCREMENT(Track);
    00029 template <> struct EnumPropsT<Track> : MakeEnumPropsT<Track, byte, TRACK_BEGIN, TRACK_END, INVALID_TRACK> {};
    00030 typedef TinyEnumT<Track> TrackByte;
    00031
    00032
    00034 enum TrackBits {
    00035   TRACK_BIT_NONE    = 0U,
    00036   TRACK_BIT_X       = 1U << TRACK_X,
    00037   TRACK_BIT_Y       = 1U << TRACK_Y,
    00038   TRACK_BIT_UPPER   = 1U << TRACK_UPPER,
    00039   TRACK_BIT_LOWER   = 1U << TRACK_LOWER,
    00040   TRACK_BIT_LEFT    = 1U << TRACK_LEFT,
    00041   TRACK_BIT_RIGHT   = 1U << TRACK_RIGHT,
    00042   TRACK_BIT_CROSS   = TRACK_BIT_X     | TRACK_BIT_Y,
    00043   TRACK_BIT_HORZ    = TRACK_BIT_UPPER | TRACK_BIT_LOWER,
    00044   TRACK_BIT_VERT    = TRACK_BIT_LEFT  | TRACK_BIT_RIGHT,
    00045   TRACK_BIT_3WAY_NE = TRACK_BIT_X     | TRACK_BIT_UPPER | TRACK_BIT_RIGHT,
    00046   TRACK_BIT_3WAY_SE = TRACK_BIT_Y     | TRACK_BIT_LOWER | TRACK_BIT_RIGHT,
    00047   TRACK_BIT_3WAY_SW = TRACK_BIT_X     | TRACK_BIT_LOWER | TRACK_BIT_LEFT,
    00048   TRACK_BIT_3WAY_NW = TRACK_BIT_Y     | TRACK_BIT_UPPER | TRACK_BIT_LEFT,
    00049   TRACK_BIT_ALL     = TRACK_BIT_CROSS | TRACK_BIT_HORZ  | TRACK_BIT_VERT,
    00050   TRACK_BIT_MASK    = 0x3FU,
    00051   TRACK_BIT_WORMHOLE = 0x40U,
    00052   TRACK_BIT_DEPOT   = 0x80U,
    00053   INVALID_TRACK_BIT = 0xFF
    00054 };
    00055
    00057 template <> struct EnumPropsT<TrackBits> : MakeEnumPropsT<TrackBits, byte, TRACK_BIT_NONE, TRACK_BIT_ALL, INVALID_TRACK_BIT> {};
    00058 typedef TinyEnumT<TrackBits> TrackBitsByte;
    00059
    00060 DECLARE_ENUM_AS_BIT_SET(TrackBits);
    00061
    00071 enum Trackdir {
    00072   TRACKDIR_BEGIN    =  0,
    00073   TRACKDIR_X_NE     =  0,
    00074   TRACKDIR_Y_SE     =  1,
    00075   TRACKDIR_UPPER_E  =  2,
    00076   TRACKDIR_LOWER_E  =  3,
    00077   TRACKDIR_LEFT_S   =  4,
    00078   TRACKDIR_RIGHT_S  =  5,
    00079   TRACKDIR_RVREV_NE =  6,
    00080   TRACKDIR_RVREV_SE =  7,
    00081   TRACKDIR_X_SW     =  8,
    00082   TRACKDIR_Y_NW     =  9,
    00083   TRACKDIR_UPPER_W  = 10,
    00084   TRACKDIR_LOWER_W  = 11,
    00085   TRACKDIR_LEFT_N   = 12,
    00086   TRACKDIR_RIGHT_N  = 13,
    00087   TRACKDIR_RVREV_SW = 14,
    00088   TRACKDIR_RVREV_NW = 15,
    00089   TRACKDIR_END,
    00090   INVALID_TRACKDIR  = 0xFF,
    00091 };
    00092
    00094 template <> struct EnumPropsT<Trackdir> : MakeEnumPropsT<Trackdir, byte, TRACKDIR_BEGIN, TRACKDIR_END, INVALID_TRACKDIR> {};
    00095 typedef TinyEnumT<Trackdir> TrackdirByte;
    00096
    00103 enum TrackdirBits {
    00104   TRACKDIR_BIT_NONE     = 0x0000,
    00105   TRACKDIR_BIT_X_NE     = 0x0001,
    00106   TRACKDIR_BIT_Y_SE     = 0x0002,
    00107   TRACKDIR_BIT_UPPER_E  = 0x0004,
    00108   TRACKDIR_BIT_LOWER_E  = 0x0008,
    00109   TRACKDIR_BIT_LEFT_S   = 0x0010,
    00110   TRACKDIR_BIT_RIGHT_S  = 0x0020,
    00111   /* Again, note the two missing values here. This enables trackdir -> track conversion by doing (trackdir & 0xFF) */
    00112   TRACKDIR_BIT_X_SW     = 0x0100,
    00113   TRACKDIR_BIT_Y_NW     = 0x0200,
    00114   TRACKDIR_BIT_UPPER_W  = 0x0400,
    00115   TRACKDIR_BIT_LOWER_W  = 0x0800,
    00116   TRACKDIR_BIT_LEFT_N   = 0x1000,
    00117   TRACKDIR_BIT_RIGHT_N  = 0x2000,
    00118   TRACKDIR_BIT_MASK     = 0x3F3F,
    00119   INVALID_TRACKDIR_BIT  = 0xFFFF,
    00120 };
    00121
    00123 template <> struct EnumPropsT<TrackdirBits> : MakeEnumPropsT<TrackdirBits, uint16, TRACKDIR_BIT_NONE, TRACKDIR_BIT_MASK, INVALID_TRACKDIR_BIT> {};
    00124 typedef TinyEnumT<TrackdirBits> TrackdirBitsShort;
    00125 DECLARE_ENUM_AS_BIT_SET(TrackdirBits);
    00126
    00127 typedef uint32 TrackStatus;
    00128
    00129 #endif /* TRACK_TYPE_H */