Add documentation headers across system modules

This commit is contained in:
Jissin Mathew
2026-05-22 16:52:06 +05:30
parent 53713f444b
commit 388e459a5a
17 changed files with 785 additions and 9 deletions
@@ -1,3 +1,13 @@
/*
File: ObserversHelper.h
Description: Provides utility functions for loading and saving observers
in the notification management system. Ensures that observer
IDs are validated against existing users in the datastore
before attaching them to the notification service.
Author: Trenser
Date: 22-May-2026
*/
#pragma once
#include "NotificationManagementService.h"
#include "FileHelper.h"
@@ -5,6 +15,20 @@
namespace util
{
/*
Function: loadObservers
Description: Loads observer IDs from a file and attaches the corresponding users
to the notification management service. Validates that each observer ID
exists in the datastore before attaching.
Parameters:
- filePath: const std::string&, path to the file containing observer IDs
- service: NotificationManagementService*, pointer to the notification service
- dataStore: DataStore&, reference to the datastore containing users
Returns:
- void
Throws:
- std::runtime_error if an observer ID is invalid (not found in datastore)
*/
inline void loadObservers(const std::string& filePath, NotificationManagementService* service, DataStore& dataStore)
{
auto observerIDs = util::loadRecords(filePath);
@@ -21,6 +45,16 @@ namespace util
}
}
/*
Function: saveObservers
Description: Saves the current observer IDs from the notification management service
to a file for persistence.
Parameters:
- filePath: const std::string&, path to the file where observer IDs will be saved
- service: NotificationManagementService*, pointer to the notification service
Returns:
- void
*/
inline void saveObservers(const std::string& filePath, NotificationManagementService* service)
{
auto observerIDs = service->getObserverIDs();