6#ifndef ACTIVE_SERIALISE_INVENTORY
7#define ACTIVE_SERIALISE_INVENTORY
9#include "Active/Serialise/Inventory/Entry.h"
11#include <unordered_map>
27 using base = std::vector<value>;
33 using Option = std::optional<Inventory>;
39 using Sequence = std::vector<std::pair<int16_t, const_iterator>>;
118 bool setRequired(
bool mustHave, int16_t ind,
const std::type_info* owner =
nullptr);
122 bool m_isFilled =
false;
Definition Inventory.h:19
Sequence sequence() const
Definition Inventory.cpp:32
typename base::iterator iterator
Base storage class - entry keyed by ID/name.
Definition Inventory.h:31
std::optional< Inventory::Item > ItemOption
An optional inventory item.
Definition Inventory.h:37
size_type attributeSize(bool isRequiredOnly=false) const
Definition Inventory.cpp:20
bool isEveryItemAccepted
True if cargo with any item ID can be accepted by the package inventory.
Definition Inventory.h:56
Inventory & withType(const std::type_info *ownerType)
Definition Inventory.cpp:53
Inventory()
Definition Inventory.h:46
iterator findEntry(const Identity &identity, const std::type_info *owner=nullptr)
Definition Inventory.cpp:108
Entry value
Inventory value type, i.e. entries.
Definition Inventory.h:25
std::optional< Inventory > Option
An optional inventory.
Definition Inventory.h:33
iterator registerIncoming(const Identity &identity)
Definition Inventory.cpp:81
std::vector< value > base
Base storage class - entry keyed by ID/name.
Definition Inventory.h:27
bool isFilled() const
True if entries have been filled into the inventory.
Definition Inventory.h:61
void resetAvailable()
Definition Inventory.cpp:95
Inventory & merge(const Inventory &inventory)
Definition Inventory.cpp:66
Inventory(base entries)
Definition Inventory.h:51
base::size_type size_type
Inventory size_type.
Definition Inventory.h:29
std::vector< std::pair< int16_t, const_iterator > > Sequence
Inventory contents sequenced by the entry index (NB: invalidated if the inventory changes)
Definition Inventory.h:39
bool setRequired(bool mustHave, int16_t ind, const std::type_info *owner=nullptr)
Definition Inventory.cpp:139