qrailway 0.9

cBahnhof.h

gehe zur Dokumentation dieser Datei
00001 #ifndef CBAHNHOF_H
00002 #define CBAHNHOF_H
00003 
00004 #include "cConstants.h"
00005 #include <QObject>
00006 #include <q3canvas.h>
00007 #include <q3sqlcursor.h>
00008 #include <QSqlQuery>
00009 #include <math.h>
00010 #include <qdatetime.h>
00011 #include <QSettings>
00012 #include "cReedkontaktListe.h"
00013 #include "cListe.h"
00014 
00015 class cIntelligenz;
00016 
00018 
00019 class cGleis
00020 {
00021  public:
00023     cGleis(void);
00025     ~cGleis(void);
00026 
00028     void initialize(void);
00029  
00031     void einfahrt(int standzeittmp,int timeaddon=-1,int zugtyp=1);
00033     void ausfahrt(void);
00034 
00036     void setReed(int nr,int conid);
00038     int getReed(int nr);
00039 
00041     bool existiert(void); 
00042 
00044     int getBesitzerVonGleis(void);
00045 
00047     void setBesitzerVonGleis(int besitzertmp); 
00048 
00050     bool istGleisFreigegeben(void);
00051 
00053     bool faellig(void);
00054 
00056     void setGleisFreigegeben(bool freigegeben);
00057 
00059     QDateTime einfahrtszeit;
00060     
00062     QString prefix;
00064     int besitzer;
00066     int standzeit;
00068     bool hauptgleis;
00070     bool nebengleis;
00072     int reserviertNebenbahn;
00074     int reserviertNebenbahnRichtung;
00075  private:
00077     int reed[10];
00079     int timekonst[4],timevar[4]; 
00080 };
00081 
00083 
00084 class cBahnhof : public QObject
00085 {
00086  Q_OBJECT
00087 public:
00089   void cDebug(int prioritaet,const QString & meldung);
00090 
00092   cBahnhof(void);
00093 
00095   ~cBahnhof(void);
00096 
00098   int initialize(cIntelligenz* Intelligenztmp,int bahnhofsnrtmp);
00099 
00101   void setzeGleisReihenfolge(int trainid, int meldungid, int* gleisfolge);
00102 
00104   int getZugAufGleis(int gleisnr);
00105 
00107   int getRichtungAufGleis(int gleisnr);
00108 
00110   QString getName(void);
00111 
00113   bool existiertGleis(int gleisnr);
00114 
00116   int round(double zahl);
00117 
00128    QString getBesitzerBeschreibung(int besitzer);
00129 
00131    bool existiertBahnhof(void);
00132 
00134    int setzeBefehlssatz(int befehl,int befehlssatz);  
00135 
00137   void ausschalten(void) ;
00138 
00140   void einschalten(void);
00141 
00143   int getBefehlssatzNr(int befehl);
00144 
00146   QString getPrefix(int gleisnr);
00147 
00149   bool istSchattenbahnhof(void);
00150 
00152   bool istHauptbahnhof(void);
00153 
00155   void setStatus(int statustmp);
00156 
00158   int getStatus(void);
00159   
00161   bool reserviere(int besitzer,int trainid);
00162 
00164   void setGleisFreigegeben(int gleisnr,bool freigegeben);
00165 
00167   void setBesitzerVonGleis(int gleisnr,int besitzertmp);
00168 
00170   bool istGleisFreigegeben(int gleisnr);
00172   int getBesitzerVonGleis(int gleisnr);
00173 
00175   int befehl0[maxBahnhof];
00177   int ziel0[maxBahnhof];
00179   int bahnhof0[maxBahnhof];
00181   int befehl1[maxBahnhof];
00183   int ziel1[maxBahnhof];
00185   int bahnhof1[maxBahnhof];
00186  signals:
00188   void SignalGleisStatus(int,int);
00189  public slots:
00191   void BefehlAusfuehren(int bahnhofsnrtmp=0,int reedid=0,int trainid=0,int meldungid=0,int zugbefehlsnr=0);
00193   void sendSignals(void);
00194  private:
00196   cGleis gleis[maxGleis];
00198   int schattenbahnhof;
00200   int status;
00202   int letztesgleis;
00204   int letzterbefehl;
00206   bool BahnhofExistiert;
00208   QString Bahnhofsbezeichnung;
00210   cIntelligenz* Intelligenz;
00212   int befehlnr[3];
00214   int bahnhofsnr;
00216   int countGleis;
00217 signals:
00219   void SignalAutomatischeSteuerung(int);
00220 };
00221 
00222 #include "cIntelligenz.h"
00223 
00224 #endif // CBAHNHOF_H