Add documentation headers across system modules
This commit is contained in:
@@ -27,6 +27,19 @@ ComboPackage::ComboPackage(const std::string& packageName, double discountPercen
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Function: ComboPackage (parameterized constructor with ID)
|
||||
Description: Initializes a combo package with an existing ID, name, discount percentage,
|
||||
service IDs, and state. Updates UID tracking based on ID.
|
||||
Parameters:
|
||||
- id: const std::string&, unique ID of the package
|
||||
- packageName: const std::string&, name of the package
|
||||
- discountPercentage: double, discount percentage applied
|
||||
- serviceIDs: const util::Vector<std::string>&, IDs of services included
|
||||
- status: util::State, state of the package (ACTIVE/INACTIVE)
|
||||
Returns:
|
||||
- A new ComboPackage object
|
||||
*/
|
||||
ComboPackage::ComboPackage(const std::string& id, const std::string& packageName, double discountPercentage, const util::Vector<std::string>& serviceIDs, util::State status)
|
||||
: m_id(id),
|
||||
m_packageName(packageName),
|
||||
@@ -103,6 +116,14 @@ void ComboPackage::setState(util::State status)
|
||||
m_status = status;
|
||||
}
|
||||
|
||||
/*
|
||||
Function: getServiceIDsAsString (static helper)
|
||||
Description: Converts a vector of service IDs into a single string separated by '|'.
|
||||
Parameters:
|
||||
- serviceIDs: const util::Vector<std::string>&, vector of service IDs
|
||||
Returns:
|
||||
- std::string: Concatenated service IDs string
|
||||
*/
|
||||
static std::string getServiceIDsAsString(const util::Vector<std::string>& serviceIDs)
|
||||
{
|
||||
int numberOfServices = serviceIDs.getSize();
|
||||
@@ -118,6 +139,14 @@ static std::string getServiceIDsAsString(const util::Vector<std::string>& servic
|
||||
return serviceIDsString;
|
||||
}
|
||||
|
||||
/*
|
||||
Function: getServiceIDsAsVector (static helper)
|
||||
Description: Converts a string of service IDs separated by '|' into a vector.
|
||||
Parameters:
|
||||
- serviceIDsString: const std::string&, concatenated service IDs string
|
||||
Returns:
|
||||
- util::Vector<std::string>: Vector of service IDs
|
||||
*/
|
||||
static util::Vector<std::string> getServiceIDsAsVector(const std::string& serviceIDsString)
|
||||
{
|
||||
util::Vector<std::string> serviceIDs;
|
||||
@@ -130,6 +159,14 @@ static util::Vector<std::string> getServiceIDsAsVector(const std::string& servic
|
||||
return serviceIDs;
|
||||
}
|
||||
|
||||
/*
|
||||
Function: serialize
|
||||
Description: Serializes the combo package into a CSV-formatted string.
|
||||
Parameters:
|
||||
- None
|
||||
Returns:
|
||||
- std::string: Serialized combo package record
|
||||
*/
|
||||
std::string ComboPackage::serialize() const
|
||||
{
|
||||
std::ostringstream serializedComboPackage;
|
||||
@@ -141,6 +178,16 @@ std::string ComboPackage::serialize() const
|
||||
return serializedComboPackage.str();
|
||||
}
|
||||
|
||||
/*
|
||||
Function: deserialize
|
||||
Description: Deserializes a CSV-formatted string into a ComboPackage object.
|
||||
Parameters:
|
||||
- record: const std::string&, serialized combo package record
|
||||
Returns:
|
||||
- ComboPackage*: Pointer to the deserialized ComboPackage object
|
||||
Throws:
|
||||
- std::runtime_error if data is invalid
|
||||
*/
|
||||
ComboPackage* ComboPackage::deserialize(const std::string& record)
|
||||
{
|
||||
std::string id, packageName;
|
||||
@@ -171,6 +218,14 @@ ComboPackage* ComboPackage::deserialize(const std::string& record)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
Function: getHeaders
|
||||
Description: Retrieves the CSV headers for combo package serialization.
|
||||
Parameters:
|
||||
- None
|
||||
Returns:
|
||||
- std::string: Header string ("ID,PackageName,DiscountPercentage,ServiceIDs,Status")
|
||||
*/
|
||||
std::string ComboPackage::getHeaders()
|
||||
{
|
||||
return "ID,PackageName,DiscountPercentage,ServiceIDs,Status";
|
||||
|
||||
Reference in New Issue
Block a user