Set correct base class for RecordCollection

RecordCollection serialises name
This commit is contained in:
Ralph Wessel
2024-10-10 12:12:35 +01:00
parent 7ed4d8c807
commit f7112a407c
2 changed files with 10 additions and 1 deletions
@@ -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<StringWrap>(m_name);
case elementID: {
if (item.available < m_children.size()) {
auto iter = m_children.begin();
@@ -33,7 +33,11 @@ namespace connector::record {
*/
class RecordCollection : public speckle::database::Record {
public:
// MARK: - Types
using base = speckle::database::Record;
// MARK: - Constructors
/*!