Rework to weak_ptr from lots of shared_ptr.
This commit is contained in:
+7
-5
@@ -12,10 +12,10 @@ namespace VISEQ::GRAPH::EDGES {
|
||||
|
||||
public:
|
||||
Edge() {}
|
||||
Edge(std::shared_ptr<NODES::Node> start, std::shared_ptr<NODES::Node> end) : start(start), end(end) {}
|
||||
Edge(std::weak_ptr<NODES::Node> start, std::weak_ptr<NODES::Node> end) : start(start), end(end) {}
|
||||
|
||||
std::shared_ptr<NODES::Node> start;
|
||||
std::shared_ptr<NODES::Node> end;
|
||||
std::weak_ptr<NODES::Node> start;
|
||||
std::weak_ptr<NODES::Node> end;
|
||||
|
||||
std::weak_ptr<Connector> start_conn;
|
||||
std::weak_ptr<Connector> end_conn;
|
||||
@@ -39,13 +39,15 @@ namespace VISEQ::GRAPH::EDGES {
|
||||
|
||||
virtual EdgeType getEdgeType() const {return edgeType;}
|
||||
|
||||
std::shared_ptr<NODES::Node> getNextNode(std::shared_ptr<NODES::Node> origin){
|
||||
return start == origin ? end : start;
|
||||
std::weak_ptr<NODES::Node> getNextNode(std::weak_ptr<NODES::Node> origin){
|
||||
return start.lock() == origin.lock() ? end : start;
|
||||
}
|
||||
|
||||
void draw(Vec2Df mouse_pos, Camera2D cam) {}
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<Edge> SPTR_Edge;
|
||||
typedef std::weak_ptr<Edge> WPTR_Edge;
|
||||
typedef std::vector<SPTR_Edge> VEC_SPTR_Edge;
|
||||
typedef std::vector<WPTR_Edge> VEC_WPTR_Edge;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user