Nested Modules
This document briefly explains how to create modules inside other modules. ./NestedModules.cc is a minimal example.
Nested modules
A module can be instantiated inside another using the usual flow of creating a module and using parameters to initialize it. Simo::Module::create_child allows to create modules with a lifetime associated to the parent.
Simo::Module::create_child is a utility method to create the name of a child.
The usual flow to create a nested component is:
};
public:
nested_param.name(name_of_child("nested_module"));
auto nested_module_success = nested_module->
initialize(ctx, nested_param);
return !nested_module_success.success()
? nested_module_success
: Simo::InitializationStatus::ok(this);
}
};
Definition NestedModule.cc:22
Simo::InitializationStatus initialize(Simo::Context &ctx, const Simo::Parameters &p) override
Definition NestedModule.cc:24
Definition NestedModule.cc:36
Simo::InitializationStatus initialize(Simo::Context &ctx, const Simo::Parameters &p) override
Definition NestedModule.cc:38
Definition InitializationStatus.h:32
T & create_child(Args... args)
Definition Module.h:184
Collects parameters that are then passed to a Module instance.
Definition Module.h:33