← Back to team overview

kicad-developers team mailing list archive

Stream-based plugin import (?)

 

Hi,

I have a question about the PLUGIN interface. Currently, the board
loader looks like this:

    BOARD* Load( const wxString& aFileName, BOARD* aAppendToMe, const
PROPERTIES* aProperties )

This means that it's quite difficult to use these methods in-process,
as you have to write out to file in order to then parse it, which
substantially increases time and complexity to parse data that comes
from in-memory (e.g. a test harness, in-process decompression streams,
stdin, named pipes or a network stream, etc).

Is there any mileage in making PLUGIN having a stream-based interface
so that you can feed it any stream? The downside to this is the
LINE_READER-based plugins are substantially (~10 times) faster for
actual files than for wxFFileInputStreams (with another ~10x slowdown
for wxFileInputStream), which would slow down the native file handling
unless there's some extra handling like:

* There is a parallel filename interface (as currently), which defers
to the stream-based implementation unless overridden, or
* The interested classes check if the stream is a file stream and
actually use the underlying file using the GetFile() method.

There are more questions about the footprint load too, which is even
more file-system-centric, as it takes two paths:

    MODULE* FootprintLoad( const wxString& aLibraryPath, const
wxString& aFootprintName, const PROPERTIES* aProperties)

And then, further for the saving functions, which also can only write
to the file system.

TL;DR: Should we look at making board and library functions more
"generic" in that they don't require actual files on disk?

Cheers,

John


Follow ups