Für Vorlesungen, bitte die Webseite verwenden. https://flavigny.de/lecture
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

38 行
978B

  1. // Simulator, Singleton
  2. class Simulator {
  3. public:
  4. // Konstruktor
  5. Simulator ();
  6. // aktuelle Zeit auslesen
  7. int GetTime ();
  8. // (B): Draht w wird zur Zeit t in Zustand s wechseln
  9. void StoreWireEvent (Wire& w, int t, State s);
  10. // (D): Baustein c soll zur aktuellen Zeit neu berechnet werden
  11. void StoreCircuitEvent (Circuit& c);
  12. // Starte Simulation bei Zeit 0
  13. void Simulate (int end);
  14. private:
  15. struct WireEvent { // Eine lokale Struktur
  16. WireEvent (); // fuer Ereignis "Zustandswechsel"
  17. WireEvent (Wire& W, int T, State S);
  18. Wire* w;
  19. int t;
  20. State s;
  21. bool operator< (WireEvent we);
  22. void print (std::ostream& stm) {stm << "(WE: " << t << " " << w << " " << s << std::endl; }
  23. } ;
  24. int time;
  25. MinPriorityQueue<WireEvent> pq; // Fuer (B)-Ereignisse
  26. Queue<Circuit*> q; // Fuer (D)-Ereignisse
  27. } ;
  28. // Globale Variable vom Typ Simulator (Singleton).
  29. // Wird von allen Bausteinen und Draehten benutzt!
  30. Simulator Sim;