class FooWrapper : protected ROScppInitializer
public Foo
{
public:
FooWrapper(...) : ROScppInitializer(),
Foo(...)
{ }
...
};
This way it is ensured that the constructor of ROScppInitialier is called right before the instance of Foo is constructed (in the process of constructing FooWrapper). The advantage of this solution is that the Python programmer could not care less what roscpp is doing. Things will "just work". The downside of this solution is that if any command line arguments have been passed to the Python program, they are not forwarded to roscpp. But to forward these parameters an explicit function call needs to be made. For that we provide a function call