From f7112a407cf0cf06c9f3fdd714174864dfe11ab6 Mon Sep 17 00:00:00 2001 From: Ralph Wessel Date: Thu, 10 Oct 2024 12:12:35 +0100 Subject: [PATCH] Set correct base class for RecordCollection RecordCollection serialises name --- .../Connector/Record/Collection/RecordCollection.cpp | 5 +++++ .../Connector/Record/Collection/RecordCollection.h | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/SpeckleConnector/Connector/Record/Collection/RecordCollection.cpp b/SpeckleConnector/Connector/Record/Collection/RecordCollection.cpp index dcbbf51..55e747a 100644 --- a/SpeckleConnector/Connector/Record/Collection/RecordCollection.cpp +++ b/SpeckleConnector/Connector/Record/Collection/RecordCollection.cpp @@ -18,11 +18,13 @@ namespace { ///Serialisation fields enum FieldIndex { + nameID, elementID, }; ///Serialisation field IDs static std::array fieldID = { + Identity{"name"}, Identity{"elements"}, }; @@ -80,6 +82,7 @@ bool RecordCollection::fillInventory(active::serialise::Inventory& inventory) co base::fillInventory(inventory); inventory.merge(Inventory{ { + { Identity{fieldID[nameID]}, nameID, element }, { Identity{fieldID[elementID]}, elementID, m_children.size() + m_indices.size(), std::nullopt }, }, }.withType(&typeid(RecordCollection))); @@ -100,6 +103,8 @@ Cargo::Unique RecordCollection::getCargo(const Inventory::Item& item) const { using namespace active::serialise; //TODO: This is only currently coded to write collection content - reading can be added as required in future switch (item.index) { + case nameID: + return std::make_unique(m_name); case elementID: { if (item.available < m_children.size()) { auto iter = m_children.begin(); diff --git a/SpeckleConnector/Connector/Record/Collection/RecordCollection.h b/SpeckleConnector/Connector/Record/Collection/RecordCollection.h index b7be102..023a604 100644 --- a/SpeckleConnector/Connector/Record/Collection/RecordCollection.h +++ b/SpeckleConnector/Connector/Record/Collection/RecordCollection.h @@ -33,7 +33,11 @@ namespace connector::record { */ class RecordCollection : public speckle::database::Record { public: - + + // MARK: - Types + + using base = speckle::database::Record; + // MARK: - Constructors /*!