A representation of a financial institution. More...
#include <Bank.h>
Public Member Functions | |
Bank ()=default | |
Bank (BankName name, std::map< accounting::AccountNumber, BankAccountTypes > numbers={}, const bool isClosed=false) | |
Full initialisation constructor. | |
const std::map< accounting::AccountNumber, BankAccountTypes > & | accounts () const noexcept |
An accessor for all the accounts associated with this financial institution. | |
void | add (const accounting::AccountNumber &number, const BankAccountTypes type) |
Adds a new account number along with its corresponding type to the financial institution. | |
void | close () |
Marks the financial institution as closed for usage. | |
bool | isClosed () const noexcept |
An accessor for the flag to indicate if the financial institution is closed for usage. | |
void | open () |
Marks the financial institution as open for usage. | |
void | remove (const accounting::AccountNumber &number) |
Removes an account number from the association with the financial institution. | |
Public Attributes | |
BankName | name_ |
The name of the financial institution, empty when not set. | |
A representation of a financial institution.
|
default |
|
explicit |
Full initialisation constructor.
BankError | Thrown if the provided name is empty. This ensures that every financial institution always has a valid and meaningful name. |
BankError | When the account number is invalid. |
BankError | When the account type is unknown. |
name | The name to assign to the financial institution. Must represent a valid name. |
numbers | A collection of account numbers to associate with the financial institution. Each account number must map to a valid bank account type. |
isClosed | Indicates whether the financial institution should be marked as closed for usage. Pass true to initialise the financial institution as closed; otherwise, false. |
|
nodiscardnoexcept |
An accessor for all the accounts associated with this financial institution.
void drn::banking::Bank::add | ( | const accounting::AccountNumber & | number, |
const BankAccountTypes | type ) |
Adds a new account number along with its corresponding type to the financial institution.
It is designed to register an account number and its associated type to the list of accounts in the financial institution.
number | The account number being added to the financial institution. |
type | The account type corresponding to the account number. |
void drn::banking::Bank::close | ( | ) |
Marks the financial institution as closed for usage.
BankError | When the financial institution is already closed. |
|
nodiscardnoexcept |
An accessor for the flag to indicate if the financial institution is closed for usage.
void drn::banking::Bank::open | ( | ) |
Marks the financial institution as open for usage.
BankError | When the financial institution is already opened. |
void drn::banking::Bank::remove | ( | const accounting::AccountNumber & | number | ) |
Removes an account number from the association with the financial institution.
BankError | When the account number to remove is not associated with the financial institution. |
number | The number to remove. |
BankName drn::banking::Bank::name_ |
The name of the financial institution, empty when not set.