]> git.mxchange.org Git - flightgear.git/blobdiff - src/Navaids/FlightPlan.hxx
Handle DB-locked errors.
[flightgear.git] / src / Navaids / FlightPlan.hxx
index b46dae03c7a11230b2bd8f8b2713dc592642a421..bdd022830d5968d78d8ee7dd6d5b33acec94d1f2 100644 (file)
@@ -100,7 +100,7 @@ public:
   {
   public:
     virtual ~Delegate();
-    
+        
     virtual void departureChanged() { }
     virtual void arrivalChanged() { }
     virtual void waypointsChanged() { }
@@ -120,6 +120,7 @@ public:
     
     friend class FlightPlan;
     
+    bool _deleteWithPlan;
     Delegate* _inner;
   };
   
@@ -207,9 +208,30 @@ public:
    */
   WayptRef waypointFromString(const std::string& target);
   
-  void setDelegate(Delegate* d);
+  /**
+   * abstract interface for creating delegates automatically when a
+   * flight-plan is created or loaded
+   */
+  class DelegateFactory
+  {
+  public:
+    virtual Delegate* createFlightPlanDelegate(FlightPlan* fp) = 0;
+  };
+  
+  static void registerDelegateFactory(DelegateFactory* df);
+  static void unregisterDelegateFactory(DelegateFactory* df);
+  
+  void addDelegate(Delegate* d);
   void removeDelegate(Delegate* d);
 private:
+  void lockDelegate();
+  void unlockDelegate();
+  
+  int _delegateLock;
+  bool _arrivalChanged, 
+    _departureChanged, 
+    _waypointsChanged, 
+    _currentWaypointChanged;
   
   bool loadPlainTextRoute(const SGPath& path);
   
@@ -225,9 +247,9 @@ private:
   
   FGAirportRef _departure, _destination;
   FGRunway* _departureRunway, *_destinationRunway;
-  SID* _sid;
-  STAR* _star;
-  Approach* _approach;
+  SGSharedPtr<SID> _sid;
+  SGSharedPtr<STAR> _star;
+  SGSharedPtr<Approach> _approach;
   std::string _sidTransition, _starTransition;
   
   double _totalDistance;