36 p_impl = std::make_unique<ItemCatalogueImpl>(*other.
p_impl);
49 const std::string& label)
51 p_impl->factory.add(modelType, func);
52 p_impl->m_info.push_back({modelType, label});
59 return p_impl->factory.contains(modelType);
64 return p_impl->factory.create(modelType);
69 std::vector<std::string> result;
70 for (
const auto& x :
p_impl->m_info)
71 result.push_back(x.item_type);
77 std::vector<std::string> result;
78 for (
const auto& x :
p_impl->m_info)
79 result.push_back(x.item_label);
85 return static_cast<int>(
p_impl->factory.size());
93 for (
auto it : other.
p_impl->factory) {
95 throw std::runtime_error(
96 "ItemCatalogue::add() -> Catalogue contains duplicated records");
void swap(OutputDataIterator< TValue, TContainer > &left, OutputDataIterator< TValue, TContainer > &right)
make Swappable
Catalogue for item constructions.
std::vector< std::string > modelTypes() const
void registerItem(const std::string &label={})
std::unique_ptr< ItemCatalogueImpl > p_impl
ItemCatalogue & operator=(const ItemCatalogue &other)
std::vector< std::string > labels() const
void merge(const ItemCatalogue &other)
Adds content of other catalogue to this.
std::unique_ptr< SessionItem > create(const std::string &modelType) const
bool contains(const std::string &modelType) const
materialitems.h Collection of materials to populate MaterialModel.
std::function< std::unique_ptr< SessionItem >()> item_factory_func_t
Definition for item factory funciton.
std::vector< TypeAndLabel > m_info
IFactory< std::string, SessionItem > factory