|
ActiveLib
|
#include <Inventory.h>


Public Types | |
| using | value = Entry |
| Inventory value type, i.e. entries. | |
| using | base = std::vector<value> |
| Base storage class - entry keyed by ID/name. | |
| using | size_type = base::size_type |
| Inventory size_type. | |
| using | iterator = typename base::iterator |
| Base storage class - entry keyed by ID/name. | |
| using | Option = std::optional<Inventory> |
| An optional inventory. | |
| using | Item = value |
| An inventory item pairing an entry with its ID/name. | |
| using | ItemOption = std::optional<Inventory::Item> |
| An optional inventory item. | |
| using | Sequence = std::vector<std::pair<int16_t, const_iterator>> |
| Inventory contents sequenced by the entry index (NB: invalidated if the inventory changes) | |
Public Member Functions | |
| Inventory () | |
| Inventory (base entries) | |
| bool | isFilled () const |
| True if entries have been filled into the inventory. | |
| size_type | attributeSize (bool isRequiredOnly=false) const |
| Sequence | sequence () const |
| Inventory & | withType (const std::type_info *ownerType) |
| Inventory & | merge (const Inventory &inventory) |
| iterator | registerIncoming (const Identity &identity) |
| void | resetAvailable () |
| iterator | findEntry (const Identity &identity, const std::type_info *owner=nullptr) |
| iterator | findEntry (int16_t ind, const std::type_info *owner=nullptr) |
| bool | setRequired (bool mustHave, int16_t ind, const std::type_info *owner=nullptr) |
Public Attributes | |
| bool | isEveryItemAccepted = false |
| True if cargo with any item ID can be accepted by the package inventory. | |
Interface for the inventory of a package (describing package/item content)
|
inline |
Default constructor
|
inline |
Constructor
| entries | The inventory entries |
| Inventory::size_type Inventory::attributeSize | ( | bool | isRequiredOnly = false | ) | const |
Count the number of attributes in the inventory
| isRequiredOnly | True if only required attributes should be counted |
| Inventory::iterator Inventory::findEntry | ( | const Identity & | identity, |
| const std::type_info * | owner = nullptr ) |
Find an entry by identity and optionally owner type
| identity | The entry identity |
| owner | The entry owner type |

| Inventory::iterator Inventory::findEntry | ( | int16_t | ind, |
| const std::type_info * | owner = nullptr ) |
Find an entry by field index and optionally owner type
| ind | The field index |
| owner | The entry owner type |
Merge another inventory with this
| inventory | The inventory to merge |

| Inventory::iterator Inventory::registerIncoming | ( | const Identity & | identity | ) |
Register an incoming item in the inventory
| identity | The item identity |

| void Inventory::resetAvailable | ( | ) |
Reset the availability per entry to zero (typically just prior to importing)
| Inventory::Sequence Inventory::sequence | ( | ) | const |
Get the inventory handling sequence, e.g. to package in the correct order for transport
| bool Inventory::setRequired | ( | bool | mustHave, |
| int16_t | ind, | ||
| const std::type_info * | owner = nullptr ) |
Set the required state of a specified field (for export)
| mustHave | True if the field is required for export |
| ind | The field index |
| owner | The entry owner type |


| Inventory & Inventory::withType | ( | const std::type_info * | ownerType | ) |
Set the owner type for the inventory entries
| ownerType | The owner type (typically used to link entries to objects within a hierarchical structure) |