Blood manager source file. More...
Go to the source code of this file.
Functions | |||||||||||||||||||
isValidBloodGroup | |||||||||||||||||||
Check if blood group is valid This function checks if the given blood group id is valid by checking the size of the
| |||||||||||||||||||
bool | isValidBloodGroup (uint32_t id) | ||||||||||||||||||
addBloodGroup | |||||||||||||||||||
Add blood group This function adds a new blood group to the
| |||||||||||||||||||
bool | addBloodGroup (uint32_t id, const char *bloodGroup, float price, uint32_t quantity) | ||||||||||||||||||
initializeBloodGroups | |||||||||||||||||||
Initialize blood groups This function helps to initialize the default blood groups to the
| |||||||||||||||||||
void | initializeBloodGroups (void) | ||||||||||||||||||
saveBloodGroups | |||||||||||||||||||
Save blood groups to file This function saves the linkedlist data from
| |||||||||||||||||||
void | saveBloodGroups (void) | ||||||||||||||||||
updateBloodQuantity | |||||||||||||||||||
Update blood quantity This function updates the blood quantity of the given blood group id by traversing the
| |||||||||||||||||||
bool | updateBloodQuantity (uint32_t id, uint32_t newQuantity) | ||||||||||||||||||
updateBloodPrice | |||||||||||||||||||
Update blood price This function updates the blood price of the given blood group id by traversing the
| |||||||||||||||||||
bool | updateBloodPrice (uint32_t id, float newPrice) | ||||||||||||||||||
loadBloodGroups | |||||||||||||||||||
Load blood groups from file This function loads the blood groups from the file
| |||||||||||||||||||
void | loadBloodGroups (void) | ||||||||||||||||||
isBloodAvailable | |||||||||||||||||||
Check if blood is available for a specific transaction type This function checks if blood is available for a specific transaction type by traversing the
| |||||||||||||||||||
bool | isBloodAvailable (uint32_t *id, TransactionType type) | ||||||||||||||||||
displayBloodGroups | |||||||||||||||||||
Display all blood groups This function displays all the blood groups in the
| |||||||||||||||||||
void | displayBloodGroups (void) | ||||||||||||||||||
displayBloodStocks | |||||||||||||||||||
Display all blood stocks This function displays all the blood stocks in the
| |||||||||||||||||||
void | displayBloodStocks (void) | ||||||||||||||||||
getBloodGroupById | |||||||||||||||||||
Get blood group by id This function returns the blood group name by the given id.
| |||||||||||||||||||
char * | getBloodGroupById (uint32_t id) | ||||||||||||||||||
freeBloodList | |||||||||||||||||||
Free blood list This function frees the
| |||||||||||||||||||
void | freeBloodList (void) | ||||||||||||||||||
Variables | |
BloodStock * | bloodHead = NULL |
Blood stock head pointer. | |
char * | availableBloodGroups [8] = { "A+", "A-", "B+", "B-", "O+", "O-", "AB+", "AB-" } |
Blood groups. | |
Blood manager source file.
This file contains the implementation of the functions for the blood manager module.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file blood_manager.c.
bool addBloodGroup | ( | uint32_t | id, |
const char * | bloodGroup, | ||
float | price, | ||
uint32_t | quantity ) |
Definition at line 83 of file blood_manager.c.
void displayBloodGroups | ( | void | ) |
Definition at line 359 of file blood_manager.c.
void displayBloodStocks | ( | void | ) |
Definition at line 374 of file blood_manager.c.
void freeBloodList | ( | void | ) |
Definition at line 420 of file blood_manager.c.
char * getBloodGroupById | ( | uint32_t | id | ) |
Definition at line 404 of file blood_manager.c.
void initializeBloodGroups | ( | void | ) |
Definition at line 128 of file blood_manager.c.
bool isBloodAvailable | ( | uint32_t * | id, |
TransactionType | type ) |
Definition at line 313 of file blood_manager.c.
bool isValidBloodGroup | ( | uint32_t | id | ) |
Definition at line 59 of file blood_manager.c.
void loadBloodGroups | ( | void | ) |
Definition at line 249 of file blood_manager.c.
void saveBloodGroups | ( | void | ) |
Definition at line 149 of file blood_manager.c.
bool updateBloodPrice | ( | uint32_t | id, |
float | newPrice ) |
Definition at line 217 of file blood_manager.c.
bool updateBloodQuantity | ( | uint32_t | id, |
uint32_t | newQuantity ) |
Definition at line 183 of file blood_manager.c.
char* availableBloodGroups[8] = { "A+", "A-", "B+", "B-", "O+", "O-", "AB+", "AB-" } |
Blood groups.
This array contains the available blood groups.
Definition at line 44 of file blood_manager.c.
BloodStock* bloodHead = NULL |
Blood stock head pointer.
Globally exposed blood stock head pointer.
This pointer is used to track blood stock linkedlist on runtime.
Definition at line 38 of file blood_manager.c.