Add standardized documentation headers

This commit is contained in:
Avinash Rajesh
2026-05-22 11:27:49 +05:30
parent 7e9cc27f1c
commit 6ca659c573
6 changed files with 182 additions and 9 deletions
@@ -1,5 +1,20 @@
/*
File: Controller.cpp
Description: Implementation file containing the method definitions
of the Controller class, which manages user authentication,
inventory, services, bookings, and notifications.
Author: Trenser
Date:19-May-2026
*/
#include "Controller.h" #include "Controller.h"
/*
Function: login
Description: Authenticates a user based on provided credentials.
Parameter: const std::string& username - the username of the user
const std::string& password - the password of the user
Return type: bool
*/
bool Controller::login(const std::string& username, const std::string& password) bool Controller::login(const std::string& username, const std::string& password)
{ {
return false; return false;
@@ -48,6 +63,13 @@ void Controller::purchaseComboPackage(const std::string& comboPackageID, const s
{ {
} }
/*
Function: getInventoryItems
Description: Retrieves all inventory items from the inventory management service
and constructs a read-only map for external use.
Parameter: None
Return type: util::Map<std::string, const InventoryItem*>
*/
util::Map<std::string, const InventoryItem*> Controller::getInventoryItems() util::Map<std::string, const InventoryItem*> Controller::getInventoryItems()
{ {
auto inventoryIems = m_inventoryManagementService.getInventoryItems(); auto inventoryIems = m_inventoryManagementService.getInventoryItems();
@@ -60,21 +82,48 @@ util::Map<std::string, const InventoryItem*> Controller::getInventoryItems()
return readOnlyInventoryItems; return readOnlyInventoryItems;
} }
/*
Function: getInventoryItem
Description: Retrieves a specific inventory item by its ID from the inventory management service.
Parameter: const std::string& inventoryItemID - ID of the inventory item
Return type: const InventoryItem*
*/
const InventoryItem* Controller::getInventoryItem(const std::string& inventoryItemID) const InventoryItem* Controller::getInventoryItem(const std::string& inventoryItemID)
{ {
return m_inventoryManagementService.getInventoryItem(inventoryItemID); return m_inventoryManagementService.getInventoryItem(inventoryItemID);
} }
/*
Function: addInventoryItem
Description: Adds a new inventory item with specified details to the inventory management service.
Parameter: const std::string& partName - name of the part
int quantity - quantity of the part
double price - price of the part
Return type: void
*/
void Controller::addInventoryItem(const std::string& partName, int quantity, double price) void Controller::addInventoryItem(const std::string& partName, int quantity, double price)
{ {
m_inventoryManagementService.addInventoryItem(partName, quantity, price); m_inventoryManagementService.addInventoryItem(partName, quantity, price);
} }
/*
Function: removeInventoryItem
Description: Removes an inventory item from the inventory management service by its ID.
Parameter: const std::string& inventoryItemID - ID of the inventory item
Return type: void
*/
void Controller::removeInventoryItem(const std::string& inventoryItemID) void Controller::removeInventoryItem(const std::string& inventoryItemID)
{ {
m_inventoryManagementService.removeInventoryItem(inventoryItemID); m_inventoryManagementService.removeInventoryItem(inventoryItemID);
} }
/*
Function: addInventoryItemStock
Description: Adds stock to an existing inventory item in the inventory management service.
Parameter: const std::string& selectedItemId - ID of the inventory item
int quantity - quantity to add
Return type: void
*/
void Controller::addInventoryItemStock(const std::string& selectedItemId, int quantity) void Controller::addInventoryItemStock(const std::string& selectedItemId, int quantity)
{ {
m_inventoryManagementService.addInventoryItemStock(selectedItemId, quantity); m_inventoryManagementService.addInventoryItemStock(selectedItemId, quantity);
@@ -1,3 +1,11 @@
/*
File: Controller.h
Description: Header file declaring the Controller class, which manages
user authentication, inventory, services, bookings, job cards,
invoices, and notifications in the system.
Author: Trenser
Date:19-May-2026
*/
#pragma once #pragma once
#include "Map.h" #include "Map.h"
#include <string> #include <string>
@@ -1,13 +1,37 @@
/*
File: InventoryManagementService.cpp
Description: Implementation file containing the method definitions of the
InventoryManagementService class, including inventory operations
and notification handling.
Author: Trenser
Date:19-May-2026
*/
#include "InventoryManagementService.h" #include "InventoryManagementService.h"
#include "InventoryItem.h" #include "InventoryItem.h"
#include "Factory.h" #include "Factory.h"
/*
Function: addInventoryItem
Description: Creates a new inventory item using the Factory and inserts it
into the DataStore.
Parameter: const std::string& partName - name of the part
int quantity - initial quantity of the part
double price - price of the part
Return type: void
*/
void InventoryManagementService::addInventoryItem(const std::string& partName, int quantity, double price) void InventoryManagementService::addInventoryItem(const std::string& partName, int quantity, double price)
{ {
InventoryItem* newItem = Factory::getObject<InventoryItem>(partName, quantity, price); InventoryItem* newItem = Factory::getObject<InventoryItem>(partName, quantity, price);
m_dataStore.getInventoryItems().insert(newItem->getId(), newItem); m_dataStore.getInventoryItems().insert(newItem->getId(), newItem);
} }
/*
Function: addInventoryItemStock
Description: Increases the stock quantity of an existing inventory item.
Parameter: const std::string& selectedItemId - ID of the inventory item
int quantity - quantity to add
Return type: void
*/
void InventoryManagementService::addInventoryItemStock(const std::string& selectedItemId, int quantity) void InventoryManagementService::addInventoryItemStock(const std::string& selectedItemId, int quantity)
{ {
int index = m_dataStore.getInventoryItems().find(selectedItemId); int index = m_dataStore.getInventoryItems().find(selectedItemId);
@@ -22,11 +46,23 @@ void InventoryManagementService::addInventoryItemStock(const std::string& select
} }
} }
/*
Function: getInventoryItems
Description: Retrieves all inventory items stored in the DataStore.
Parameter: None
Return type: util::Map<std::string, InventoryItem*>
*/
util::Map<std::string, InventoryItem*> InventoryManagementService::getInventoryItems() util::Map<std::string, InventoryItem*> InventoryManagementService::getInventoryItems()
{ {
return m_dataStore.getInventoryItems(); return m_dataStore.getInventoryItems();
} }
/*
Function: removeInventoryItem
Description: Marks an inventory item as inactive instead of deleting it.
Parameter: const std::string& inventoryItemID - ID of the inventory item
Return type: void
*/
void InventoryManagementService::removeInventoryItem(const std::string& inventoryItemID) void InventoryManagementService::removeInventoryItem(const std::string& inventoryItemID)
{ {
int index = m_dataStore.getInventoryItems().find(inventoryItemID); int index = m_dataStore.getInventoryItems().find(inventoryItemID);
@@ -40,6 +76,12 @@ void InventoryManagementService::removeInventoryItem(const std::string& inventor
} }
} }
/*
Function: getInventoryItem
Description: Retrieves a specific inventory item by its ID from the DataStore.
Parameter: const std::string& inventoryItemID - ID of the inventory item
Return type: InventoryItem*
*/
InventoryItem* InventoryManagementService::getInventoryItem(const std::string& inventoryItemID) InventoryItem* InventoryManagementService::getInventoryItem(const std::string& inventoryItemID)
{ {
int index = m_dataStore.getInventoryItems().find(inventoryItemID); int index = m_dataStore.getInventoryItems().find(inventoryItemID);
@@ -1,3 +1,11 @@
/*
File: InventoryManagementService.h
Description: Header file declaring the InventoryManagementService class,
which manages inventory items, stock updates, and notifications
related to low stock alerts. Inherits from NotificationManagementService.
Author: Trenser
Date:19-May-2026
*/
#pragma once #pragma once
#include <string> #include <string>
#include "Map.h" #include "Map.h"
@@ -1,10 +1,23 @@
/*
File: AdminMenu.cpp
Description: Implementation file containing the method definitions of the
AdminMenu class, including menu handling, inventory operations,
and stock management functions.
Author: Trenser
Date:19-May-2026
*/
#include <iomanip> #include <iomanip>
#include "AdminMenu.h" #include "AdminMenu.h"
#include "InventoryItem.h" #include "InventoryItem.h"
#include "InputHelper.h" #include "InputHelper.h"
#include "OutputHelper.h" #include "OutputHelper.h"
#include "InventoryItem.h"
/*
Function: showMenu
Description: Displays the admin menu and handles user input until the menu is exited.
Parameter: None
Return type: void
*/
void AdminMenu::showMenu() void AdminMenu::showMenu()
{ {
bool isMenuActive = true; bool isMenuActive = true;
@@ -43,6 +56,13 @@ void AdminMenu::changePassword()
{ {
} }
/*
Function: viewStockLevels
Description: Displays all active inventory items with their details
including ID, part name, quantity, and price.
Parameter: None
Return type: void
*/
void AdminMenu::viewStockLevels() void AdminMenu::viewStockLevels()
{ {
auto inventoryItems = m_controller.getInventoryItems(); auto inventoryItems = m_controller.getInventoryItems();
@@ -68,6 +88,14 @@ void AdminMenu::viewStockLevels()
} }
} }
/*
Function: filterActiveItems
Description: Filters out inactive inventory items and returns a map
containing only active items.
Parameter: const util::Map<std::string, const InventoryItem*>& inventoryItems -
map of all inventory items
Return type: util::Map<std::string, const InventoryItem*>
*/
static util::Map<std::string, const InventoryItem*> static util::Map<std::string, const InventoryItem*>
filterActiveItems(const util::Map<std::string, const InventoryItem*>& inventoryItems) filterActiveItems(const util::Map<std::string, const InventoryItem*>& inventoryItems)
{ {
@@ -84,6 +112,14 @@ filterActiveItems(const util::Map<std::string, const InventoryItem*>& inventoryI
return activeItems; return activeItems;
} }
/*
Function: displayInventoryWithItems
Description: Displays inventory items in a tabular format with index, ID,
part name, quantity, and price.
Parameter: util::Map<std::string, const InventoryItem*>& inventoryItems -
map of inventory items to display
Return type: void
*/
static void displayInventoryWithItems(util::Map<std::string, const InventoryItem*>& inventoryItems) static void displayInventoryWithItems(util::Map<std::string, const InventoryItem*>& inventoryItems)
{ {
int inventorySize = inventoryItems.getSize(); int inventorySize = inventoryItems.getSize();
@@ -108,6 +144,15 @@ static void displayInventoryWithItems(util::Map<std::string, const InventoryItem
} }
} }
/*
Function: addQuantityToItem
Description: Allows the admin to select an active inventory item and
increase its stock quantity.
Parameter: util::Map<std::string, const InventoryItem*>& inventoryItems -
map of inventory items
Controller& m_controller - controller instance to update stock
Return type: void
*/
static void addQuantityToItem(util::Map<std::string, const InventoryItem*>& inventoryItems, Controller& m_controller) static void addQuantityToItem(util::Map<std::string, const InventoryItem*>& inventoryItems, Controller& m_controller)
{ {
int itemIndex; int itemIndex;
@@ -149,6 +194,13 @@ static void addQuantityToItem(util::Map<std::string, const InventoryItem*>& inve
} }
} }
/*
Function: addInventoryItem
Description: Allows the admin to either add a new inventory item
or increase the quantity of an existing item.
Parameter: None
Return type: void
*/
void AdminMenu::addInventoryItem() void AdminMenu::addInventoryItem()
{ {
util::clear(); util::clear();
@@ -182,14 +234,13 @@ void AdminMenu::addInventoryItem()
util::pressEnter(); util::pressEnter();
} }
static util::Map<std::string, const InventoryItem*> /*
filterActiveItems(const util::Map<std::string, const InventoryItem*>& inventoryItems) Function: removeInventoryItem
{ } Description: Removes an active inventory item by marking it inactive
after user selection.
static void displayInventoryWithItems(util::Map<std::string, const InventoryItem*>& inventoryItems) Parameter: None
{ Return type: void
} */
void AdminMenu::removeInventoryItem() void AdminMenu::removeInventoryItem()
{ {
util::clear(); util::clear();
@@ -225,6 +276,13 @@ void AdminMenu::removeInventoryItem()
util::pressEnter(); util::pressEnter();
} }
/*
Function: checkStockAvailability
Description: Checks if a specific inventory item is available
and displays its details if active.
Parameter: None
Return type: void
*/
void AdminMenu::checkStockAvailability() void AdminMenu::checkStockAvailability()
{ {
util::clear(); util::clear();
@@ -1,3 +1,11 @@
/*
File: AdminMenu.h
Description: Header file declaring the AdminMenu class, which provides
administrative operations such as inventory management,
user management, service configuration, and notifications.
Author: Trenser
Date:19-May-2026
*/
#pragma once #pragma once
#include "Controller.h" #include "Controller.h"