Skip to content

Antonio-88/Emergency_dispatch_system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Emergency Dispatch System

Overview

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.

Features

  • 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 queued to intervened and finally solved.
  • Custom Data Structures: Implements its own memory-managed Stacks and Queues rather than relying on external libraries.

Data Structures Used

  • 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.

Supported Operations

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.

Compilation and Execution

The program requires an input file named tema1.in to run and will output the results of the operations to tema1.out.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors