<div dir="ltr">Hi Berk, <div><br></div><div style>It could be worth investigating the use of the cross-platform c++ library "CppMicroServices".</div><div style><br></div><div style><br></div><div style>"The C++ Micro Services library provides a dynamic service registry based on the service layer as specified in the OSGi R4.2 specifications. It enables users to realize a service oriented approach within their software stack.</div>

<div>The advantages include higher reuse of components, looser coupling, better organization of responsibilities, cleaner API contracts, etc."</div><div style>Source: <a href="http://cppmicroservices.org/">http://cppmicroservices.org/</a></div>

<div style><br></div><div style><br></div><div style><br></div><div style><div>"Let’s also note that the library is API complete and is now used in projects like [2] and [3] and companies like [4]. The library also provides full life-cycle notifications for registered objects, an auto-load mechanism roughly similar to ITK, powerful service object queries, and puts an emphasis on the separation of interface and implementation.</div>

<div>[2] <a href="http://www.mitk.org">http://www.mitk.org</a></div><div>[3] <a href="https://github.com/Global-Vision-Systems/Ds4Cpp">https://github.com/Global-Vision-Systems/Ds4Cpp</a></div><div>[4] <a href="http://www.global-vision-systems.com/index.php?Home">http://www.global-vision-systems.com/index.php?Home</a></div>

<div>"</div><div style>Source: Link to ITK list.</div><div style><br></div></div><div style><br></div><div style><br></div><div style>We started to talk about it with ITK folks. For more information:</div><div style>

<br></div><div style>  Initial email: <a href="http://article.gmane.org/gmane.comp.lib.itk.devel/932/match=micro+service">http://article.gmane.org/gmane.comp.lib.itk.devel/932/match=micro+service</a><br></div><div style>
<br>
</div><div style>and</div><div style><br></div><div style>  Latest answer: <a href="http://article.gmane.org/gmane.comp.lib.itk.devel/939/match=micro+service">http://article.gmane.org/gmane.comp.lib.itk.devel/939/match=micro+service</a><br>

</div><div style><br></div><div style><br></div><div style><br></div><div style><br></div><div style>Hth</div><div style>Jc</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Mar 2, 2013 at 8:47 PM, Berk Geveci <span dir="ltr"><<a href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have been having some conversations about the factories and what we<br>
should do with them in the future. One feedback I already received<br>
(from David Camp, LBNL) was that, due to string comparisons used,<br>
object factories have a significant impact on performance when<br>
creating large number of objects. This makes me wonder if broadly<br>
supporting class overriding with this mechanism is worth the<br>
performance hit. We could potentially revisit the way factories work<br>
and optimize it a bit. Or we could say we will enable this feature<br>
only for select classes - mainly rendering related classes. If you<br>
want to keep using object factories, maybe you could give us a list of<br>
classes and we can enable them with factory support. Or maybe the<br>
improvements that you want to enable via factories can be pushed<br>
upstream.<br>
<div class="HOEnZb"><div class="h5"><br>
On Wed, Feb 13, 2013 at 8:44 PM, Kathleen S. Biagas <<a href="mailto:biagas2@llnl.gov">biagas2@llnl.gov</a>> wrote:<br>
> On Wed, 2013-02-13 at 08:50 -0500, Marcus D. Hanwell wrote:<br>
>> On Tue, Feb 12, 2013 at 8:54 PM, Kathleen S. Biagas <<a href="mailto:biagas2@llnl.gov">biagas2@llnl.gov</a>> wrote:<br>
>> > Trying to come up to speed with current VTK master, and ran across<br>
>> > issues trying to override vtk classes.<br>
>> ><br>
>> > One thing I noticed was that I could not override the classes I was<br>
>> > interested in without first building VTK with VTK_ALL_NEW_OBJECT_FACTORY<br>
>> > enabled.  So my first question is:  are more classes going to be opened<br>
>> > up for overriding within the new scheme of things without having to set<br>
>> > this flag?  Or will this flag be enabled by default in the future?  We<br>
>> > eventually want our code to compile with a user's preinstalled VTK, and<br>
>> > there wouldn't be a guarantee this flag would have been used.<br>
>><br>
>> I would be interested in knowing which classes you are interested in<br>
>> overriding that were not. There are several new macros now, and as you<br>
>> discovered the default one no longer uses the object factory without<br>
>> the build flag you mentioned. The plan was to leave that off by<br>
>> default, and add more classes where runtime overrides are needed.<br>
><br>
> One of the classes we override is vtkDataSetMapper, so that we can<br>
> instantiate specialized mappers for vtkRectilinearGrids and<br>
> vtkStructuredGrids.  Another is vtkCellDataToPointData, again with<br>
> specialized handling for vtkStructuredGrids and vtkRectilinearGrids.<br>
> We also override vtkRectilinearGrid and vtkStructuredGrid to provide<br>
> implementations with smaller memory footprints.<br>
><br>
> These are all handled correctly if we enable VTK_ALL_NEW_OBJECT_FACTORY.<br>
><br>
>> ><br>
>> > The other thing I noticed was a change in behavior.  To illustrate, I<br>
>> > copied the TestObjectFactory.cxx from Common/Core/Testing/cxx, and<br>
>> > modified it to override vtkCamera instead of vtkPoints.<br>
>> ><br>
>> > When built against an older version of VTK, say 5.8, the results show<br>
>> > that when vtkCamera is instantiated, the correct version (either<br>
>> > vtkTestCamera or vtkTestCamera2) is succesfully created. Running through<br>
>> > the vtkOverrideInformationCollection printing OverrideWithName, only two<br>
>> > are shown: vtkTestCamera and vtkTestCamera2.<br>
>> ><br>
>> > When built against latest version of master, the results show that when<br>
>> > vtkCamera is instantiated, a vtkOpenGLCamera is created instead of<br>
>> > either of the registered overrides in the test (vtkTestCamera or<br>
>> > vtkTestCamera2). Running through the vtkOverrideInformationCollection,<br>
>> > and printing the OverrideWithName, three are shown: vtkOpenGLCamera,<br>
>> > vtkTestCamera and vtkTestCamera2.<br>
>> ><br>
>> That is because the old VTK didn't use the object factory for the<br>
>> default overrides, and so you could come in and add an additional<br>
>> override. Now that we use the object factory internally that is<br>
>> generally the first. As far as I can tell the object factory mechanism<br>
>> has always returned the first match by default, and will only provide<br>
>> a list if you use that part of the API.<br>
><br>
> Aah, understand this aspect now, thanks.<br>
>> ><br>
>> > In the new scheme of things, how would I go about ensuring my override<br>
>> > takes precedence over any default ones? eg vtkTestCamera over<br>
>> > vtkOpenGLCamera?<br>
>><br>
>> The object factory API would need to be modified in some way, this<br>
>> functionality has never been present. The old hardwired factory<br>
>> classes for particular kits would first check the object factory, and<br>
>> if nothing was returned construct the class that was set at compile<br>
>> time. This meant that effectively you could override the builtin<br>
>> class, but only once.<br>
>><br>
>> It would be great to know more about what you are doing, and what<br>
>> classes you are thinking of in VTK that you would like to override.<br>
>><br>
> One of the things we have is a Rendering module, and it overrides things<br>
> like vtkCamera.  Even enabling the VTK_ALL_NEW_OBJECT_FACTORY flag<br>
> doesn't allow this to work correctly, due to the OpenGL overrides<br>
> already existing.<br>
><br>
> I did a little tweaking of the build for this, making it a proper<br>
> 'Module' in the VTK sense, following instructions I found on<br>
> <a href="http://vtk.org/Wiki/VTK/Module_Development#External_modules" target="_blank">http://vtk.org/Wiki/VTK/Module_Development#External_modules</a><br>
><br>
> I ran into a problem in that vtkExternalModuleMacros.cmake was not<br>
> included in the VTK install tree.  Is there a specific flag to set<br>
> during build that allows this to be installed?  In the meantime, I<br>
> copied this file to the installation, but building this code as a<br>
> vtkModule still doesn't allow the overrides defined by the module to<br>
> take precedence.<br>
><br>
> I thought of using vtkObjectFactory::SetAllEnableFlags(0, "vtkCamera")<br>
> before registering the rendering module's factory, but wasn't sure if<br>
> that was overkill ...<br>
><br>
> Thanks for the feedback!<br>
><br>
> Kathleen<br>
><br>
>> Marcus<br>
><br>
><br>
><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
><br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>+1 919 869 8849<br>
</div>