Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/QNX4/Train/Track.hpp

Go to the documentation of this file.
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           /           [1]               [2]            \
00023         /                                               \
00024       /                                                   \
00025      |                                                     |
00026      |                                                     |
00027      |                                                     |
00028      |                                                     |
00029       \                                                   /
00030         \                                               /
00031           \           [4]               [3]           /
00032             . - - - - -*- - - - - - - - -*- - - - - .
00033                        \               /
00034                          . - - - - - .
00035 
00036 */
00037 
00038 class Track
00039 {
00040 public:
00041   Track();                          // * Track initialisation
00042   virtual ~Track();                 // * Track destruction
00043     
00044   void testSwitches();              // * Test the switch operations
00045   int  isSegmentOccupied(int seg);  // * Querry a zone to see if occupied
00046   void setSwitch(int s, int p);     // * Set switch (S) position (P)
00047   void showGeometry();              // * DEBUG!!!!
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   // * Update the Track according to the switch position
00061   void updateTrack(int ID, int P); 
00062 };
00063 
00064 #endif

Generated on Sun Oct 14 18:46:37 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001