Re: [Cppcms-users] Post-attach/add hook in cppcms::application
Brought to you by:
artyom-beilis
|
From: Joerg S. <jo...@br...> - 2014-03-06 13:54:06
|
On Thu, Mar 06, 2014 at 02:35:59AM -0800, Artyom Beilis wrote: > The factory is provided for the topmost application in hierarchy. > > How it works. > > You define an application A at mount point /foo/bar > The A has subapplications b & c, while c has sub applications d and e > > Tree: > > A > /\ > b c > /\ > d e > > Now when the factory object is requested, the ENTIRE should usually be created and stored in the pool. i.e. pool may own several A's which are actually roots of multiple trees. > > You can build a tree in a constructor or in a method that is called by the factory. > > The idea is that once the application (tree) is created the URL dispatcher would know how to route the relevant requests. > Of course when you "add" or "attach" a child to a tree you can call any his members you want before or after add/attach I understand and this is what I am doing. My question is whether the boilerplate code can be reduced by making the application class itself provide such a callback. Before: auto app = new child_app(); attach(app, ...); app->initialize(); With a cppcms::application providing such a hook directly: attach(new child_app(), ...); and attach calls the initialize() at the end. It's boring, repeative code. Joerg |