[flyweight] new draft uploaded at vault

Hello, Given that the response to my initial prompt for interest in a flyweight library was encouraging, I've worked a little more in it to the point that I can show now a pretty functional lib along with some docs. Please download at Vault/Patterns: http://tinyurl.com/f7fum The draft contains: * 90% of my initially intended functionality (it lacks serialization support and other, accessory extensions). * A more or less developed tutorial introducing the lib and its main design concepts. * A very interesting (IMHO) component called intermodule_holder which allows you to define flyweight types working across different dynamic modules of the same program. Without this component, dynamic linking induces fatal duplicates of some internal static objects. intermodule_holder has been developed with the invaluable help of Boost.Interprocess and I've only tested it in CW 8.3 for Windows. As B.IP has been added to the CVS only recently, it is likely that problems arise till the library stabilizes. Kudos to Ion for the terrific library. I've tested it in CW 8.3 an GCC 3.2, should compile in any decent compiler modulo minor glitches I'd welcome being reported about. I'd be extremely grateful if you can download the stuff, give it a try/read and report about it. It is at design stage that your opinions are most valuable, so please do share them! Points I'm particularly interested in: * Do you deem the lib worth eventually proposing to Boost? * Do you like the usage interface? * Are you OK with the design concepts, in particular with the concepts around factories and holders? * Have you been able to use it? * Have you been able to use it in a demanding envrionment? Having performance figures would be terrific. * Improvements/extensions? Sorry for the long post, eagerly looking fwd to getting your feedback, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

* Do you deem the lib worth eventually proposing to Boost?
Yes!
* Do you like the usage interface?
Very much... However, as i will like it even more if the principal class name were easier to write, I am not a native English speaker and the ht, th kills me :) What about something like Boost.Flyweight / boost::flyweight / fw ? The code is cleaner this way.
* Are you OK with the design concepts, in particular with the concepts around factories and holders?
This is one of the strong point of the library. This makes it very flexible. I like the design a lot.
* Have you been able to use it?
Yes, with Linux/gcc4, no problems...
* Improvements/extensions?
I think that one nice thing to have is the ability to interact directly with the factories. I would like to be able, at least for debugging purpose but I have in mind some other scenarios, to write something like: struct names {}; struct user { flyweight< std::string, tag<names>, set_factory > name; int age; }; flyweight_factory< names >::instance().insert( "Joaquin" ); flyweight_factory< names >::instance().insert( "Penelope" ); ... ... std::for_each( flyweight_factory< names >::instance().begin(), flyweight_factory< names >::instance().end(), std::ostream_inserter< std::string >( cout ) ); If I have this feature I will be able to use a flyweight to create a translation table for my program. I simple defined a map from English to "other language" phrases bindings (pb) and uses it as my assoc_container_factory. (some details maybe need to be tunned but the idea is simple) I can now write: struct translations {}; typedef flyweight < std::string, tag< translations >, assoc_container_factory< tunned_map<std::string,std::string> >
tr;
... fileMenu.set_text( "File" ); // set_text takes a tr object ... void ChangeLanguageToSpanish() { flyweight_factory< translations >::instance()[ "File" ] = "Archivo"; ... }; Is this possible? Thanks for yet another great library! Best regards Matias Capeletto

JOAQUIN LOPEZ MUNOZ wrote :
Hello,
Given that the response to my initial prompt for interest in a flyweight library was encouraging, I've worked a little more in it to the point that I can show now a pretty functional lib along with some docs. Please download at Vault/Patterns:
The documentation doesn't really says how memory management is done. Could you give more info about this ?
participants (3)
-
JOAQUIN LOPEZ MU?Z
-
loufoque
-
Matias Capeletto