ModelElement subclassed from Classified and Propertied

This commit is contained in:
Ralph Wessel
2024-10-21 21:45:07 +01:00
parent 35f4e58a58
commit 01bb88b4a1
6 changed files with 32 additions and 10 deletions
@@ -94,7 +94,7 @@ ModelElement::ModelElement(const API_Element& elemData, const Guid& tableID) : b
source: The object to copy
--------------------------------------------------------------------*/
ModelElement::ModelElement(const ModelElement& source) : base{ source } {
ModelElement::ModelElement(const ModelElement& source) : base{source}, Classified{source}, Propertied{source} {
m_data = source.m_data ? std::make_unique<Data>(*m_data) : nullptr;
} //ModelElement::ModelElement
@@ -1,14 +1,17 @@
#ifndef SPECKLE_RECORD_MODEL_ELEMENT
#define SPECKLE_RECORD_MODEL_ELEMENT
#include "Speckle/Record/Classification/Classified.h"
#include "Speckle/Record/Element/Element.h"
#include "Speckle/Record/Element/Element.h"
#include "Speckle/Record/Property/Propertied.h"
namespace speckle::record::element {
/*!
Base class for model elements, i.e. with 3D bodies and typically representing the project model
*/
class ModelElement : public Element {
class ModelElement : public Element, public classify::Classified, public property::Propertied {
public:
// MARK: - Types
@@ -13,13 +13,6 @@ using namespace speckle::record::classify;
using namespace speckle::record::property;
using namespace speckle::utility;
/*--------------------------------------------------------------------
Default constructor
--------------------------------------------------------------------*/
Propertied::Propertied() {
} //Propertied::Propertied
/*--------------------------------------------------------------------
Get the attached properties
@@ -25,7 +25,18 @@ namespace speckle::record::property {
/*!
Default constructor
*/
Propertied();
Propertied() {}
/*!
Copy constructor
@param source The object to copy
*/
Propertied(const Propertied& source) :
m_properties{source.m_properties ? std::make_unique<std::vector<Property>>(*source.m_properties) : nullptr} {}
/*!
Move constructor
@param source The object to move
*/
Propertied(Propertied&& source) noexcept : m_properties{std::move(source.m_properties)} {}
/*!
Destructor
*/
@@ -69,6 +69,16 @@ Property::Property(const Setting& setting, std::shared_ptr<Template> propTemplat
} //Property::Property
/*--------------------------------------------------------------------
Copy constructor
source: The object to copy
--------------------------------------------------------------------*/
Property::Property(const Property& source) :
m_setting{source.m_setting ? std::make_unique<Setting>(*source.m_setting) : nullptr}, m_template{source.m_template} {
} //Property::Property
/*--------------------------------------------------------------------
Move constructor
@@ -55,6 +55,11 @@ namespace speckle::record::property {
@param propTemplate The property template (NB: may override the specified value if it does not meet the template criteria)
*/
Property(const Setting& setting, std::shared_ptr<Template> propTemplate);
/*!
Copy constructor
@param source The object to copy
*/
Property(const Property& source);
/*!
Move constructor
@param source the property to move