[Kst] Datasource questions

Brisset, Nicolas Nicolas.Brisset at eurocopter.com
Tue Oct 18 12:51:17 CEST 2005


Regarding the problem I reported yesterday, it seems that "INDEX" is the
default X axis value stored somewhere (kstvectordefaults.cpp ?), which
for some reason "overwrites" the first value in the list built by the
datasource in some cases. Once you've managed to change that value to
something else, it works fine. The funny thing is that you can load
other vectors (say  Vec3 as X and Vec4 as Y) and when you invoke the
datawizard again, the list for X vectors is right. Maybe I should file a
bug report for that one ?

Now, more generally speaking, I'd like to have more detailed information
as to the way in which datasources are called and the results used. I
suppose a simple text file in devel-docs would be enough, but some
things are rather hard to understand right now.

If I've understood the process correctly (which I doubt), it works in
the following way:
- invoke the datawizard and select a file: all installed datasources (a
.desktop file is provided and the .so can be loaded) are queried via the
undertands_[type] functions
- for all datasources returning "understands" values > 0, the field list
is queried via fieldList_[format] functions if existing, otherwise the
constructor is called and then the fieldList() method, then the
destructor
- the datasource returning the highest number in understands_[format]
wins, if there are equal results the number of fields returned is used
to determine the best candidate (I don't know whether understands values
are limited to 100 prior to comparison ?)
- when you click Next, the lists for X and Y vectors are built calling
the constructor and fieldList methods (which can result in some delay
e.g. when the constructor parses the whole file). I don't have the
feeling that previously built field lists are reused here, or at least
not always. That is also where I don't understand why the value stored
in KDE settings (INDEX) can overwrite the first element in the X axis
list: it should be set as default selection if present in the list, but
not overwrite the first element
- step through other pages in the wizard, click "Finish": it creates the
vectors, asking for the number of samples for each (I suppose
frameCount(field), but maybe just frameCount() in some cases ?) to then
load the values with readFiled(field, 0, nb_samples). Apparently, it
actually does readField(field, 0, nb_samples-1) and just after
readField(field, nb_samples, -1). There must be a reason (maybe update()
is called in between ?) but it's not very clear
- once the vectors are loaded, curves are created and put into plots
- at the pace determined by the time setting, update() is called. (Is it
called a first time unconditionnally to detect updates while
initializing plots ?). If it returns ::UPDATE, something happens
(frameCount(field) + readField(...) for each plotted field ?) otherwise
nothing. Another question I have here is whether it is OK for update to
set _valid to false if there is a problem (e.g. the data file is gone
!). Apparently, it takes more than that to stop the update process...
Even so, what happens when _valid becomes true again ?
- if the user hits "Reload", George already wrote what was supposed to
happen. But I have put a trace in the constructor at some point while
trying to understand something, and I noticed that it gets called 19
times (!) for a given file. That does not sound right to me! (This
should perhaps go into another bug report ?)

I would be grateful if someone with more insight could correct/complete
the above description and post it somewhere. Of course, I could look at
the code and find the answers with traces and trial/error, but I think
it would be better to document the logics initial developers had in
mind, as I suspect in some cases the datasource developers might do
things that wer not really "planned", resulting in performance or
stability issues...


More information about the Kst mailing list