This project is a C-based simulation of an Emergency Response Dispatch System. It manages a fleet of response units and assigns them to incoming incidents based on priority. The project heavily utilizes custom data structures—such as Stacks, Queues, and Doubly Linked Lists—to efficiently manage resource allocation, incident queues, and operation history.
- Priority-Based Dispatching: Incidents are queued and handled based on their severity (
high,medium,low). - Resource Management: Tracks the availability of response units in real-time.
- Undo Functionality: Reverts the most recent dispatch operation using a Stack-based history tracker.
- Status Tracking: Monitors incidents from
queuedtointervenedand finallysolved. - Custom Data Structures: Implements its own memory-managed Stacks and Queues rather than relying on external libraries.
- Queues (Linked-List based): Used to separate incidents into high, medium, and low priority lines. Also used to track the pool of available units.
- Stack (Linked-List based): Keeps a history of active interventions, allowing the system to easily undo the last dispatch.
- Doubly Linked Lists: Used as the underlying structure to store the global registries of all incidents and interventions.
The system reads a number of units, then reads commands from an input file and executes the following operations:
ADD_INCIDENT <id> <priority> "<description>"- Logs a new emergency.CHECK_UNITS_AVAILABILITY- Returns the number of currently idle units.DISPATCH- Assigns the next available unit to the highest priority pending incident.UNDO_LAST_DISPATCH- Cancels the last active dispatch, freeing the unit and re-queuing the incident.SOLVED_INCIDENT <id>- Marks an active intervention as solved and frees the assigned unit.SHOW_UNIT <id>- Displays the type and status of a specific unit.SHOW_INCIDENT <id>- Displays the priority, description, and status of a specific incident.SHOW_INTERVENTIONS- Lists all recorded interventions and their statuses.
The program requires an input file named tema1.in to run and will output the results of the operations to tema1.out.