00001 #ifndef __J2K__Train__Track_HPP__
00002 #define __J2K__Train__Track_HPP__
00003
00004 #include <j2k/Fred/Basic.hpp>
00005 #include <j2k/Fred/Boolean.hpp>
00006 #include <j2k/Fred/StdTypes.hpp>
00007 #include <j2k/Fred/QNX/System.hpp>
00008
00009 #include <j2k/Fred/QNX/Train/Segment.hpp>
00010 #include <j2k/Fred/QNX/Train/Switch.hpp>
00011
00012 #define NSEG 16 // * This is the number of segments
00013 #define NSW 4 // * This is the number of switches
00014
00015 #define OPEN 1 // * This is the switch position
00016 #define CLOSE 0 //
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 class Track
00039 {
00040 public:
00041 Track();
00042 virtual ~Track();
00043
00044 void testSwitches();
00045 int isSegmentOccupied(int seg);
00046 void setSwitch(int s, int p);
00047 void showGeometry();
00048
00049 int getNext( int s );
00050 int getPrev( int s );
00051
00052 private:
00053 Segment segment[ NSEG ];
00054 Switch switch[ NSW ];
00055
00056 void initSegments();
00057 void initSwitches();
00058 void initGeometry();
00059
00060
00061 void updateTrack(int ID, int P);
00062 };
00063
00064 #endif