Introduced registerFactory

`registerFactory(delegate)` works like `registerType(delegate)`, with the
difference of the delegate returning a `shared_ptr` to the created object