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

C:/temp/src/j2k/nto/bak2/Train.cpp

Go to the documentation of this file.
00001 #ifndef __J2K__Train_CPP__
00002 #define __J2K__Train_CPP__
00003 
00004 #include <j2k/nto/Train.hpp>
00005 
00006   Train::Train()
00007   {
00008     ctrl = NULL;
00009     name = NULL;
00010     name_length = NULL;
00011     memset( &train, 0, sizeof( Train_t ) );
00012   }
00013 
00014   Train::~Train() 
00015   {
00016     if ( ctrl ) delete   ctrl;
00017     if ( name ) delete[] name;
00018   }
00019 
00020   void  Train::setSpeed( int speed ) 
00021   {
00022     train.speed = speed;
00023   }
00024 
00025   int   Train::getSpeed() 
00026   {
00027     return train.speed;
00028   }
00029 
00030   void  Train::setLights( BOOL lights_on )
00031   {
00032     train.lights_on = lights_on;
00033   }
00034 
00035   BOOL  Train::getLights() 
00036   {
00037     return train.lights_on;
00038   }
00039 
00040   void  Train::setDirection( BOOL clockwise ) 
00041   {
00042     train.direction = clockwise;
00043   }
00044 
00045   BOOL  Train::getDirection() 
00046   {
00047     return train.direction;
00048   }
00049 
00050   void  Train::setID( UCHAR id ) 
00051   {
00052     train.id = id;
00053   }
00054 
00055   UCHAR Train::getID() 
00056   {
00057     return train.id;
00058   }
00059 
00060   void  Train::setController( Controller* c )
00061   {
00062     ctrl = c;
00063   }
00064 
00065   void  Train::setPrority( UCHAR prio )
00066   {
00067     train.priority = prio;
00068   }
00069 
00070   UCHAR Train::getPrority() 
00071   { 
00072     return train.priority;
00073   } 
00074 
00075   void  Train::printStatus()
00076   {
00077     printf(" Train " );
00078   }
00079 
00080   void  Train::stop()
00081   {
00082     setSpeed(  0 );
00083   }
00084  
00085   void  Train::emergencyStop()
00086   {
00087     setSpeed( -1 );
00088   }
00089 
00090   // Where did the train started
00091   void  Train::setStartTrack( UCHAR where )
00092   {
00093     train.startTrackIndex = where;
00094   }
00095 
00096   UCHAR Train::getStartTrack()
00097   {
00098     return train.startTrackIndex;
00099   }
00100 
00101   // Where you want the train to stop
00102   void  Train::setEndTrack( UCHAR where )
00103   {
00104     train.endTrackIndex = where;
00105   }
00106 
00107   UCHAR Train::getEndTrack()
00108   {
00109     return train.endTrackIndex;
00110   }
00111 
00112   // Where are you ?
00113   void  Train::setCurrentTrack( UCHAR index )
00114   {
00115     train.currTrackIndex = index;
00116   }
00117 
00118   UCHAR Train::getCurrentTrack()
00119   {
00120     return train.currTrackIndex;
00121   }
00122  
00123   // How much time it took ?
00124   _uint64 Train::getElapsed()
00125   {
00126     return train.elapsed;
00127   }
00128 
00129   // How much time you have to get to end track ?
00130   void Train::setDeadline( _uint64 delta_time )
00131   {
00132     train.deadline = delta_time;
00133   }
00134 
00135   _uint64 Train::getDeadline()
00136   {
00137     return train.deadline; 
00138   }
00139 
00140   // Train Color
00141   void Train::setColor( UCHAR color = 0 )  // Black
00142   {
00143     train.color = color;
00144   }
00145  
00146   int Train::getColor()
00147   {
00148     return train.color;
00149   }
00150 
00151   void  Train::setName( const char* n )
00152   {
00153     if ( n ) {
00154 
00155     } else if ( name ) {
00156       delete[] name;
00157       name = NULL;      
00158     } else {
00159       name = NULL;      
00160     }
00161 
00162   }
00163 
00164 
00165 #endif

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