[Echempp-devel] segment classes and Factory (and XML)
Status: Beta
Brought to you by:
berndspeiser
|
From: <ber...@t-...> - 2005-08-25 19:44:43
|
Hi, I thought a bit more about the problem of `outside' storage of segments (and possibly other classes) and reading of such storage. In principle, we want to `save' and `load' information in a textual way. I suggest that we call the corresponding functions like that. Then, we have two problems which have to be solved: (1) which techniques will allow us to generate an object of the desired type when loading information? I think that Alexandresu's Factory template will help us a lot. Among other things, this template implements a function which generates an object of a certain type, when the type is coded by an ID of type say int (or better: char *). Thus, each type which is desired to be generated has its distinct ID (for example, each segment type must be coded into something exactly denoting its type). This object (concrete product of the factory) is returned as a pointer to its base class (abstract product). The ID code is stored in the file. Hopefully, this procedure will do. We will have to add some functions to each segment type, but that should be possible. I'm afraid that I will have to do a similar thing for the Quantities library, because similar information is needed for the various quantity parameters `inside' the segment. And this brings us to the next question: (2) what do we want to save and in which format? Here, I recommend (taking up some earlier discussion with Kai) to use some XML extension, say `echemML' or `echeML'. I don't know too much about XML, but what I read tells me that this should give us a structured way to store and retrieve information. There are even C++ parser classes which read XML code and generate a parse tree from it (see: http://www.grinninglizard.com/tinyxml/index.html). I have, however, no idea how complicated it is to implement something like that. Best regards Bernd -- ======================================================================= Bernd Speiser Institut f"ur Organische Chemie Auf der Morgenstelle 18 D-72076 T"ubingen Germany phone: +49-7071-2976205 (office) +49-7071-2976242 (laboratory) fax: +49-7071-295518 e-mail: ber...@un... Internet: http://www.uni-tuebingen.de/speiser ======================================================================= |