I derived a class from sc_module that handles it's own configuration from an XML node passed to the new module constructor.
One of the pieces of information handed down in the XML node is the modules name.
///Constructor
my_module::my_module
( pugi::xml_node *node ///< xml node pointer
)
: sc_module ( node->attribute("name").value() )
, clock ( "clock_in" )
, targ_socket ( "targ_socket" )
, init_socket ( "init_socket" )
{
...
}
This will result in the following warning:
Warning: (W569) sc_module(const char*), sc_module(const std::string&) have been
deprecated, use sc_module(const sc_module_name&): my_mod
In addition the system seems to get confused and complains about already existing hierarchical names ...
Using sc_module_name inside the constructor initialization list takes care of the warning but the created name is missing the hierarchy push from "my_module" ...
...
: sc_module ( sc_module_name(node->attribute("name").value()) )
...
I believe this is due to the fact that sc_module_name is not created on the stack and it's destructor is called before the constructors of the other entities (i.e. clock) is called ...
What would be the appropriate way to achieve a module name function inside the initialization list constructor?!?
Thanks for any pointers!
- Jens