You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
789 B
C++

#pragma once
#include <memory>
#include <vector>
#include "ifaces/ILinkMixin.h"
/// \brief Интерфейс для классов-связей между элементами.
/// \tparam TElem Тип элемента, между которыми устанавливается связь.
template <class TElem>
class ILink {
public:
using ElemPtr = std::shared_ptr<TElem>;
virtual ~ILink() = default;
virtual ElemPtr getNode() const = 0;
virtual ElemPtr getParent() const = 0;
virtual void setParent(const ElemPtr& parent) = 0;
virtual const std::vector<ElemPtr>& getChildren() const = 0;
virtual void addChild(const ElemPtr& child) = 0;
virtual void removeChild(const ElemPtr& child) = 0;
virtual void replaceChild(const ElemPtr& oldChild, const ElemPtr& newChild) = 0;
};