← Back to team overview

kicad-developers team mailing list archive

Re: Fixing libcommon

 

On Sun, Mar 19, 2017 at 1:18 AM, Maciej Suminski
<maciej.suminski@xxxxxxx> wrote:
> In order to remove the hardcoded values from WORKSHEET_VIEWITEM, I
> started moving code that used to be compiled multiple times to separate
> units. This is also a basic way to solve the internal units conversion
> problem.
>
> There are still a few more files that are compiled multiple times. I
> plan to fix them as well, but first I want to send the first patches to
> see if we all agree on the proposed solution.
>
> Alternatively, there could be an abstract class to provide conversion
> methods. If it is preferred, then we need to decide how to access its
> instance (singleton, attach to KiFace, static object?)
>
> Ultimately we can have a real common library for all apps (libkicommon?)
> that could be compiled as a shared library. Such approach should reduce
> *.kiface files size and linking time.
>
> Any thoughts?
>
> Regards,
> Orson
>

 The data relations and access functions via the kiface have always
seemed very awkward to me. Maybe some more time should go
into looking at what objects are better as part of a static object which
may have a lifetime independent of the current kiface. With pcbnew
for example, the 3D cache manager ideally should be instantiated
once when it is first needed and persist until pcbnew is closed.
However, the easiest way to add the cache manager was to destroy
any old instance and create a new one for each pcb instance which is
destroyed or created. In this case, the creation/destruction of the
3d cache was due largely to the fact that the cache manager needs
information which can currently only be accessed via kiface; if the
manager were to exist more independently of kiface then it would
at least require some notification functions to inform it of the
creation/destruction of a kiface object.

 Regarding libraries and the STL, if we use STL classes in the library
then we need to hide the use of STL somehow in order to ensure a
clean interface with no compiler warnings about exporting methods
from template classes. For example, rather than simply returning a
pointer to a list, the API would have to present methods to retrieve
the number of items, first, next item, or maybe even indexed item.

- Cirilo

> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
>


References