logic: deep copy edge components
- added a copy method to EdgeComponents - added a copy method to DataTypeModifier fortune cookie message = Roem Rijkdom en Liefde liggen op je Weg.
This commit is contained in:
@@ -36,7 +36,7 @@ std::shared_ptr<Edge> Edge::createPlainCopy(Node* from, Node* to) const
|
||||
|
||||
for (std::shared_ptr<EdgeComponent> component: m_components)
|
||||
{
|
||||
edge->addComponent(component); // Todo: create a deep copy here
|
||||
edge->addComponent(component->copy());
|
||||
}
|
||||
|
||||
return edge;
|
||||
|
||||
@@ -10,6 +10,8 @@ public:
|
||||
EdgeComponent();
|
||||
virtual ~EdgeComponent();
|
||||
|
||||
virtual std::shared_ptr<EdgeComponent> copy() const = 0;
|
||||
|
||||
void setEdge(Edge* edge);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -13,6 +13,11 @@ EdgeComponentDataType::~EdgeComponentDataType()
|
||||
{
|
||||
}
|
||||
|
||||
std::shared_ptr<EdgeComponent> EdgeComponentDataType::copy() const
|
||||
{
|
||||
return std::make_shared<EdgeComponentDataType>(m_qualifierList, m_modifierStack);
|
||||
}
|
||||
|
||||
DataType EdgeComponentDataType::getDataType() const
|
||||
{
|
||||
return DataType(getEdge()->getTo()->getName(), m_qualifierList, m_modifierStack);
|
||||
|
||||
@@ -14,6 +14,8 @@ public:
|
||||
EdgeComponentDataType(const DataTypeQualifierList qualifierList, const DataTypeModifierStack modifierStack);
|
||||
virtual ~EdgeComponentDataType();
|
||||
|
||||
virtual std::shared_ptr<EdgeComponent> copy() const;
|
||||
|
||||
DataType getDataType() const;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user