Skip to content

Conversation

@Az3git
Copy link
Contributor

@Az3git Az3git commented Nov 14, 2025

No description provided.

};

} // namespace sim
} // namespace sims
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not Sims 4?

Suggested change
} // namespace sims
} // namespace sim

class INewFlowFactory {
public:
virtual std::shared_ptr<INewFlow> create_flow() = 0;
virtual std::shared_ptr<INewFlow> create_flow(INewMPLB& mplb) = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
virtual std::shared_ptr<INewFlow> create_flow(INewMPLB& mplb) = 0;
virtual std::shared_ptr<INewFlow> create_flow(const INewMPLB& mplb) = 0;

Comment on lines 11 to 14
FlowFactoryMock(const YAML::Node& flow_node,
std::shared_ptr<sim::IHost> sender,
std::shared_ptr<sim::IHost> receiver);
std::shared_ptr<sim::INewFlow> create_flow() final;
std::shared_ptr<sim::INewFlow> create_flow(sim::INewMPLB& mplb) final;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not take flow_node, concrete factory should take just concrete list of arguments specified for concrete flow. And I think flows need smart pointer to mplb, not references

Suggested change
FlowFactoryMock(const YAML::Node& flow_node,
std::shared_ptr<sim::IHost> sender,
std::shared_ptr<sim::IHost> receiver);
std::shared_ptr<sim::INewFlow> create_flow() final;
std::shared_ptr<sim::INewFlow> create_flow(sim::INewMPLB& mplb) final;
FlowFactoryMock();
std::shared_ptr<sim::INewFlow> create_flow(std::shared_ptr<sim::INewMPLB> mplb) final;

[[maybe_unused]] std::shared_ptr<sim::IHost> a_receiver,
[[maybe_unused]] std::shared_ptr<sim::INewMPLB> a_mplb)
: m_id(std::move(a_id)) {
[[maybe_unused]] sim::INewMPLB& a_mplb)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[[maybe_unused]] sim::INewMPLB& a_mplb)
[[maybe_unused]] std::weak_ptr<sim::INewMPLB> a_mplb)

NewFlowMock(Id a_id, std::shared_ptr<sim::IHost> a_sender,
std::shared_ptr<sim::IHost> a_receiver,
std::shared_ptr<sim::INewMPLB> a_mplb);
sim::INewMPLB& a_mplb);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sim::INewMPLB& a_mplb);
std::weak_ptr<sim::INewMPLB> a_mplb);

private:
Id m_id;
sim::FlowContext m_context;
sim::INewMPLB& m_mplb;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because flow and mplb have smart pointers to each other. In case of usage std::shared_ptr there will be loop dependencies

Suggested change
sim::INewMPLB& m_mplb;
std::weak_ptr<sim::INewMPLB> m_mplb;

@Az3git Az3git marked this pull request as draft November 19, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants