Introduced registerFactory

registerFactory works like registerType with a delegate. The difference
is, the delegate returns a shared_ptr to the created object