GCC Code Coverage Report


Directory: ./
File: components/parking_system/include/tickets/ITicketService.h
Date: 2025-12-16 19:41:02
Exec Total Coverage
Lines: 1 1 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 #pragma once
2
3 #include "Ticket.h"
4
5 /**
6 * @brief Interface for ticket service
7 *
8 * Manages parking tickets throughout the vehicle lifecycle:
9 * - Entry: Issue new ticket
10 * - Payment: Mark ticket as paid
11 * - Exit: Validate and use ticket
12 */
13 class ITicketService {
14 public:
15 20 virtual ~ITicketService() = default;
16
17 /**
18 * @brief Create new ticket
19 * @return Ticket ID (0 if failed)
20 */
21 [[nodiscard]] virtual uint32_t getNewTicket() = 0;
22
23 /**
24 * @brief Mark ticket as paid
25 * @param ticketId Ticket ID to pay
26 * @return true if successful, false if ticket doesn't exist
27 */
28 virtual bool payTicket(uint32_t ticketId) = 0;
29
30 /**
31 * @brief Validate ticket is paid and mark as used (for exit)
32 * @param ticketId Ticket ID to validate
33 * @return true if paid and not already used, false otherwise
34 */
35 virtual bool validateAndUseTicket(uint32_t ticketId) = 0;
36
37 /**
38 * @brief Get ticket information
39 * @param ticketId Ticket ID
40 * @param ticket Output ticket structure
41 * @return true if ticket exists, false otherwise
42 */
43 [[nodiscard]] virtual bool getTicketInfo(uint32_t ticketId, Ticket& ticket) const = 0;
44
45 /**
46 * @brief Get number of active (not used) tickets
47 * @return Number of cars currently in parking garage
48 */
49 [[nodiscard]] virtual uint32_t getActiveTicketCount() const = 0;
50
51 /**
52 * @brief Get maximum parking capacity
53 * @return Maximum number of parking spaces
54 */
55 [[nodiscard]] virtual uint32_t getCapacity() const = 0;
56
57 /**
58 * @brief Reset ticket service to initial state
59 * Clears all tickets and resets ID counter to 1
60 */
61 virtual void reset() = 0;
62
63 /**
64 * @brief Set parking capacity
65 * @param capacity New maximum parking capacity
66 */
67 virtual void setCapacity(uint32_t capacity) = 0;
68 };
69