[Kst] kst2 datasource API comments
Peter Kümmel
syntheticpp at gmx.net
Thu Mar 18 15:17:00 CET 2010
Barth Netterfield wrote:
> On March 16, 2010 02:38:30 pm Peter Kümmel wrote:
>> I've cleaned up the ascii.cpp code: splitted into more files,
>> removed the duplicates of key and tag names, and hopefully made
>> it more readable.
>
> We should talk about plans with that. I will attempt to get to writing an
> improved ascii source document - things have been a little slow kst-wise for
> me lately.
>
>> Maybe it is also possible to simplify datasource.h
>
> Can you send out a quick plan after looking at it. I was looking at it last
> week as well. It is a bit of a mess, but....
>
Reading datasource.h I had following ideas for DataSource:
- most static functions are for handling the plugins. This
code could be splitted out into a other, new class: DataSourcePluginManager
- as Nicolas suggested I would add metadata to each data and would introduce
a simple struct, something like
struct DataSource::Info{
QMap<QString, double> scalar;
QMap<QString, QString> strings;
};
and then
Info sourceInfo();
Info fieldInfo(const QString&);
Info matrixInfo(const QString&);
- Are there files which store fields and matrices? If not,
I would introduce two classes which inherit from DataSource,
on for vector data and one for matrices. The info and data
lists becomes:
QStringList dataList(); // vectors or matrices
Info dataInfo(const QString&);
- somehow we should split out the update stuff, and implement it
such way that a concrete DataSource implementations does not
need to know anything about the update mechanism.
- make all functions which must be implemented pure virtual
- most of the static functions of DataSourcePluginInterface should
be part of the concrete data source implementations: understands(),
supportsTime(), ... are essentialle functions of the datasource
not of the plugin infrastructure.
- why do we use malloc? We have C++.
Peter
More information about the Kst
mailing list