FlightGear next
atc_mgr.hxx
Go to the documentation of this file.
1/*
2 * SPDX-FileName: atc_mgr.hxx
3 * SPDX-FileComment: Started August 1, 2010; based on earlier work by David C. Luff
4 * SPDX-FileCopyrightText: Written by Durk Talsma.
5 * SPDX-FileContributor: Updated by Jonathan Redpath. Started June 12, 2019. Documenting and extending functionality of the ATC subsystem
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9/**************************************************************************
10 * The ATC Manager interfaces the users aircraft within the AI traffic system
11 * and also monitors the ongoing AI traffic patterns for potential conflicts
12 * and interferes where necessary.
13 *************************************************************************/
14
15#pragma once
16
17#include <simgear/structure/SGReferenced.hxx>
18#include <simgear/structure/subsystem_mgr.hxx>
19
24#include <Traffic/Schedule.hxx>
25
26
27typedef std::vector<FGATCController*> AtcVec;
28typedef std::vector<FGATCController*>::iterator AtcVecIterator;
29
30class FGATCManager : public SGSubsystem
31{
32private:
33 AtcVec activeStations;
34 FGATCController *controller, *prevController; // The ATC controller that is responsible for the user's aircraft.
35 FGATCController *enRouteController;
36
37 bool networkVisible;
38 bool initSucceeded;
39 SGPropertyNode_ptr trans_num;
40 std::string destination;
41
42 std::unique_ptr<FGAISchedule> userAircraftTrafficRef;
43 std::unique_ptr<FGScheduledFlight> userAircraftScheduledFlight;
44
45 SGPropertyNode_ptr _routeManagerDestinationAirportNode;
46
47public:
49 virtual ~FGATCManager();
50
51 // Subsystem API.
52 void postinit() override;
53 void shutdown() override;
54 void update(double time) override;
55
56 // Subsystem identification.
57 static const char* staticSubsystemClassId() { return "ATC"; }
58
59 void addController(FGATCController* controller);
60 void removeController(FGATCController* controller);
61
63
64 void reposition();
65};
std::vector< FGATCController * > AtcVec
Definition atc_mgr.hxx:27
std::vector< FGATCController * >::iterator AtcVecIterator
Definition atc_mgr.hxx:28
class FGATCController NOTE: this class serves as an abstraction layer for all sorts of ATC controller...
void postinit() override
Sets up ATC subsystem parts depending on other subsystems Override of SGSubsystem::postinit() Will se...
Definition atc_mgr.cxx:67
FGATCController * getEnRouteController()
Definition atc_mgr.cxx:460
void addController(FGATCController *controller)
Adds FGATCController instance to std::vector activeStations.
Definition atc_mgr.cxx:280
void shutdown() override
Shutdown method Clears activeStations vector in preparation for clean shutdown Override of SGSubsyste...
Definition atc_mgr.cxx:247
void reposition()
Definition atc_mgr.cxx:256
static const char * staticSubsystemClassId()
Definition atc_mgr.hxx:57
FGATCManager()
Constructor, initializes values to private boolean and FGATCController instances.
Definition atc_mgr.cxx:47
virtual ~FGATCManager()
Default destructor.
Definition atc_mgr.cxx:59
void update(double time) override
Update the subsystem.
Definition atc_mgr.cxx:304
void removeController(FGATCController *controller)
Searches for and removes FGATCController instance from std::vector activeStations.
Definition atc_mgr.cxx:287