Thread: [Echempp-devel] getter functions in segment classes
Status: Beta
Brought to you by:
berndspeiser
|
From: Kai L. <kai...@un...> - 2005-08-24 11:22:31
|
Hi All, during the implementation of the GUI classes for excitation functions, the question arised how to save/load an excitation function in a data file. The problem is that in general the special type of segment within an excitation function is not known (wee treat them with a general DISegment pointer). Thus, the information needed to create a segment (initial potentials, phase shifts etc. ) is lost. When we save an excitation function to a data file, the information should be stored somewhere, in order to recreate the different segments while loading the data file. Maybe, we could think about a concept within the excitation function class that provides detailed informations about the stored segments? Any ideas? Kai --=20 http://echempp.sourceforge.net Kai Ludwig Institut f=FCr Organische Chemie Auf der Morgenstelle 18 72076 T=FCbingen Tel.: +49-7071-29-73049 Mail: kai...@un... |
|
From: Bernd S. <ber...@un...> - 2005-08-24 12:25:36
|
Kai Ludwig wrote: > Hi All, > > during the implementation of the GUI classes > for excitation functions, the question arised > how to save/load an excitation function in a > data file. > > The problem is that in general the special > type of segment within an excitation function > is not known (wee treat them with a general > DISegment pointer). > Thus, the information needed to create a segment > (initial potentials, phase shifts etc. ) is lost. > > When we save an excitation function to a > data file, the information should be stored > somewhere, in order to recreate the different > segments while loading the data file. > > Maybe, we could think about a concept within > the excitation function class that provides > detailed informations about the stored segments? > > Any ideas? > > Kai > see the Alexandrescu book! He gives some possible solutions, but probably none of them is optimal. 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 ======================================================================= |
|
From: Bernd S. <ber...@un...> - 2005-08-24 14:11:07
|
Alain Millers wrote:
>> see the Alexandrescu book! He gives some possible solutions, but
>> probably none of them is optimal.
>> Bernd
>>
> is a copy of this book online avaible? or at least the needed pages to
> solve this problem?
> alain
There is a web site (maybe check in google under A. Alexandrescu).
The exact reference in bibtex format is
@book{Alexandrescu_2001,
author = {A. Alexandrescu},
title = {Modern C++ Design. Generic Programming and Design Patterns
Applied},
publisher = {Addison-Wesley},
address = {Boston},
year = {2001},
projects = {EChem++},
checked = {+},
copy = {BS Bu205}
}
I have a copy and will bring it on Friday
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
=======================================================================
|
|
From: <ber...@t-...> - 2005-08-25 08:22:48
|
Kai Ludwig wrote: Dear all, > Maybe, we could think about a concept within > the excitation function class that provides > detailed informations about the stored segments? Alexandrescu's Loki library has a Factory template, which is specifically designed to solve the problem of generating objects when the information of which derived class the objects belongs to is given in a way that can not be directly used. This is what we have here: we could read some name (e.g. in the form of a string) of the segment type to be generated from storage and would have to give this to a `new' statement in the form of a class name. The factory template does this. As mentioned, I'll bring the Alexandrescu book on Friday. 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 ======================================================================= |
|
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 ======================================================================= |
|
From: <ber...@t-...> - 2005-08-28 18:17:52
|
Dear all, I started the implementation of a SegmentFactory, which can generate segments given a string defining the type of the segment. This would be needed for loading segment information from a file. Here is a preliminary status report. I started with the Loki::Factory template of Alexandrescu. Unfortunately, as we can expect, not everything is straightforward, when we apply this to Segments. First of all, the segment classes are templates (D and I are the parameters!). This means that the registration of the segment with the factory and the definition of the ID string must also be templated. I have not yet solved this problem in a fully satisfying way, but I can indeed do registration. A second problem will be that the create member function (which actually generates the new object according to the string ID) in our case needs a parameter (i.e., the istream from which it can get additional information about the object to be built - namely the segment parameters). This is not possible in the Loki::Factory implementation. I'll continue with this. 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 ======================================================================= |
|
From: <ber...@t-...> - 2005-08-29 17:46:02
|
Dear all, please download the latest cvs version of ExcitationFunction, which contains a rearranged template instationtion scheme, segment.cpp has been deleted and the Makefile.am has been changed accordingly. Consequently, please do a bootstrap/configure after downloading and before recompiling. This change was necessary to allow further work on the save/load mechanism. 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 ======================================================================= |
|
From: Kai L. <kai...@un...> - 2005-08-30 12:57:33
|
> please download the latest cvs version of ExcitationFunction, which > contains a rearranged template instationtion scheme, segment.cpp has > been deleted and the Makefile.am has been changed accordingly. > Consequently, please do a bootstrap/configure after downloading and > before recompiling. Remark: Note that a bootstrap/configure is not necessary, since only the Makefile.am is changed. A simple 'make' should be enough --> this will cause a single 'autmake' command before compilation. Regards, Kai --=20 http://echempp.sourceforge.net Kai Ludwig Institut f=FCr Organische Chemie Auf der Morgenstelle 18 72076 T=FCbingen Tel.: +49-7071-29-73049 Mail: kai...@un... |
|
From: <ber...@t-...> - 2005-08-30 19:35:58
|
Kai Ludwig wrote: >>please download the latest cvs version of ExcitationFunction, which >>contains a rearranged template instationtion scheme, segment.cpp has >>been deleted and the Makefile.am has been changed accordingly. >>Consequently, please do a bootstrap/configure after downloading and >>before recompiling. > > > Remark: > > Note that a bootstrap/configure is not necessary, > since only the Makefile.am is changed. > A simple 'make' should be enough --> this will > cause a single 'autmake' command before compilation. OK! 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 ======================================================================= |