cloudcompare/trunk — pull request #144 by luca-penasa (2014-05-27 14:21:02+00:00)
Title: Dynamic Factories for object from plugins created in qCC_db

Hi, this is first try to impelmenet dynamic factories for plugins. I basically:
- define a ExternalFactory object with a convenient container for them
- in qCC_db I added a static pointer to a container of factories.
- when a plugin is loaded CC will try to see if the plugin can give back an implementation of a personalized factory,and if so
- it will add it to the ExternalFactoriesContainer

When the data are saved everything goes normally.

When the data are loaded:
- i read the type of data I have to import
- if it is a ccCustomObject I load it as a plain ccCustomObject as first so to load the metadata
- once I have the metadata I pass them to the ExternalFactoriesContainer and i give back the right object. (there are two keys: plugin_name and class_name for each object )
- once I have the actual object I re-read it from file. This will use the righ fromFile_meOnly etc to load the data.
- end :-)

BTW The problem now is that we should also serialize the size of "personal data" of the external object so that when loading, if there is not a good factory, we can simply skip it and load the other objects. (now if the right plugin is not loaded and one tries to load a file with objects generated from a plugin it simply does nothing.)

Please Daniel give a look to it.
(I think it is not a too much dirty solution this time ;-)

Thanks