-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
The sim::Manager
interface is a bit bothersome to handle from a user's point of view.
A much better design would be to construct a Manager
using a builder. This has a number of benefits:
- No need to pass around an
std::unique_ptr
for the manager. - Easier to customize the simulation. E.g., no need to subclass some particular subclass of
sim::Manager
and then pass anstd::ostream
object to the constructor in order to output results to a file. Something likebuilder.setOutput(some_stream)
should do the trick. - Allows making the object that the builder builds (the manager) be responsible for also running the simulation.
Builder proposal:
class SimulationBuilder {
public:
static SimulationBuilder create();
SimulationBuilder& outputTo(const std::string& filename);
SimulationBuilder& outputToStdout();
template <typename FUNC>
SimulationBuilder& protocolCreator(FUNC&& creator);
SimulationBuilder& networkConfig(...);
Simulator build();
};
auto builder = SimulationBuilder::create();
// bla bla
auto simulator = builder.build();
// runs the simulation
simulator.run();
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request