KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kiway.h File Reference
#include <atomic>
#include <wx/defs.h>
#include <wx/event.h>
#include <import_export.h>
#include <search_stack.h>
#include <project.h>
#include <frame_type.h>
#include <mail_type.h>
#include <ki_exception.h>
#include <jobs/job.h>

Go to the source code of this file.

Classes

struct  KIFACE
 Implement a participant in the KIWAY alchemy. More...
 
class  KIWAY
 A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad process. More...
 

Macros

#define KIFACE_VERSION   1
 The KIWAY and KIFACE classes are used to communicate between various process modules, all residing within a single process. More...
 
#define KIFACE_GETTER   KIFACE_1
 
#define KIFACE_INSTANCE_NAME_AND_VERSION   "KIFACE_1"
 
#define KFCTL_STANDALONE   ( 1 << 0 )
 Running as a standalone Top. More...
 
#define KFCTL_CPP_PROJECT_SUITE   ( 1 << 1 )
 Running under C++ project mgr, possibly with others. More...
 
#define KFCTL_CLI   ( 1 << 2 )
 Running as CLI app. More...
 

Typedefs

typedef KIFACEKIFACE_GETTER_FUNC(int *aKIFACEversion, int aKIWAYversion, PGM_BASE *aProgram)
 Point to the one and only KIFACE export. More...
 

Functions

KIFACEKIFACE_GETTER (int *aKIFACEversion, int aKIWAYversion, PGM_BASE *aProgram)
 No name mangling. Each KIFACE (DSO/DLL) will implement this once. More...
 

Variables

KIWAY Kiway
 

Macro Definition Documentation

◆ KFCTL_CLI

#define KFCTL_CLI   ( 1 << 2 )

Running as CLI app.

Definition at line 160 of file kiway.h.

◆ KFCTL_CPP_PROJECT_SUITE

#define KFCTL_CPP_PROJECT_SUITE   ( 1 << 1 )

Running under C++ project mgr, possibly with others.

Definition at line 159 of file kiway.h.

◆ KFCTL_STANDALONE

#define KFCTL_STANDALONE   ( 1 << 0 )

Running as a standalone Top.

Definition at line 158 of file kiway.h.

◆ KIFACE_GETTER

#define KIFACE_GETTER   KIFACE_1

Definition at line 111 of file kiway.h.

◆ KIFACE_INSTANCE_NAME_AND_VERSION

#define KIFACE_INSTANCE_NAME_AND_VERSION   "KIFACE_1"

Definition at line 115 of file kiway.h.

◆ KIFACE_VERSION

#define KIFACE_VERSION   1

The KIWAY and KIFACE classes are used to communicate between various process modules, all residing within a single process.

The program modules are either top level like an *.exe or subsidiary like a *.dll. In much of the documentation the term DSO is used to refer to the *.dll portions, that is the term used on linux. But it should be taken to mean DLL on Windows.

These are a couple of reasons why this design was chosen:

  1. By using DSOs within a single process, it is not necessary to use IPC. The DSOs can send wxEvents between themselves using wxEvtHandler interfaces in a platform independent way. There can also be function calls from one DSO to another.

  2. The use of a number of separately linked DSOs closely resembles the original KiCad program design, consisting of Eeschema and Pcbnew. But it also allows separate compilation and linking of those two DSOs without a ton of inter-DSO dependencies and common data structures. Linking smaller, purpose specific DSOs is thought to be better for maintenance simplicity than a large single link image.

  3. By keeping the core functionality in DSOs rather than EXE tops, it becomes possible to re-use the DSOs under different program tops. For example, a DSO named _pcbnew.so can be used under a C++ top or under a python top. Only one CMake target must be defined to build either. Whether that is a separate build or not is not the important thing. Simply having a single CMake target has advantages. (Each builder person will have his/her own intentions relative to use of python or not.) Once a DSO is python capable, it can be driven by any number of python program tops, including demo-ing (automation) and testing separately.

All KiCad source code is UTF8 encoded by law, so make sure your editor is set as such! As such, it is OK to use UTF8 characters:

┏ ┗ ┓ ┛ ━ ┃


                             ┏━━━process top━━━━━┓
                             ┃                   ┃       wxEvent channels
         ┏━━━━━━━━━━━━━━━━━━━-━[KIWAY project 1]━-━━━━━━━━━━━━━━━━━━━━━━┓
         ┃                   ┃                   ┃                      ┃
         ┃     ┏━━━━━━━━━━━━━-━[KIWAY project 2]━-━━━━━━━━━━┓           ┃
         ┃     ┃             ┃                   ┃          ┃           ┃
         ┃     ┃           ┏━-━[KIWAY project 3]━-━┓        ┃           ┃
         ┃     ┃           ┃ ┗━━━━━━━━━━━━━━━━━━━┛ ┃        ┃           ┃
         ┃     ┃           ┃                       ┃        ┃           ┃
         ┃     ┃           ┃                       ┃        ┃           ┃
┏━━━━━━━━|━━━━━|━━━━━━━━━━━|━━━━━━━━━┓    ┏━━━━━━━━|━━━━━━━━|━━━━━━━━━━━|━━━━━┓
┃ KIFACE ┃     ┃           ┃         ┃    ┃ KIFACE ┃        ┃           ┃     ┃
┃        ┃     ┃           ┃         ┃    ┃        ┃        ┃           ┃     ┃
┃        ┃     ┃           ┃         ┃    ┃        ┃        ┃           ┃     ┃
┃┏━━━━━━━+━┓ ┏━+━━━━━━━┓ ┏━+━━━━━━━┓ ┃    ┃┏━━━━━━━+━┓ ┏━━━━+━━━━┓ ┏━━━━+━━━━┓┃
┃┃wxFrame  ┃ ┃wxFrame  ┃ ┃wxFrame  ┃ ┃    ┃┃wxFrame  ┃ ┃wxFrame  ┃ ┃wxFrame  ┃┃
┃┃project 1┃ ┃project 2┃ ┃project 3┃ ┃    ┃┃project 3┃ ┃project 2┃ ┃project 1┃┃
┃┗━━━━━━━━━┛ ┗━━━━━━━━━┛ ┗━━━━━━━━━┛ ┃    ┃┗━━━━━━━━━┛ ┗━━━━━━━━━┛ ┗━━━━━━━━━┛┃
┃                                    ┃    ┃                                   ┃
┃                                    ┃    ┃                                   ┃
┗━━━━━━ eeschema DSO ━━━━━━━━━━━━━━━━┛    ┗━━━━━━ pcbnew DSO ━━━━━━━━━━━━━━━━━┛

Definition at line 110 of file kiway.h.

Typedef Documentation

◆ KIFACE_GETTER_FUNC

typedef KIFACE * KIFACE_GETTER_FUNC(int *aKIFACEversion, int aKIWAYversion, PGM_BASE *aProgram)

Point to the one and only KIFACE export.

The export's address is looked up via symbolic string and should be extern "C" to avoid name mangling. This function will only be called one time. The DSO itself however may be asked to support multiple Top windows, i.e. multiple projects within its lifetime.

Parameters
aKIFACEversionis where to put the API version implemented by the KIFACE.
aKIWAYversiontells the KIFACE what KIWAY version will be available.
aProgramis a pointer to the PGM_BASE for this process.
Returns
unconditionally, cannot fail.

Definition at line 498 of file kiway.h.

Function Documentation

◆ KIFACE_GETTER()

KIFACE * KIFACE_GETTER ( int *  aKIFACEversion,
int  aKIWAYversion,
PGM_BASE aProgram 
)

No name mangling. Each KIFACE (DSO/DLL) will implement this once.

Definition at line 83 of file bitmap2cmp_main.cpp.

References BMP2CMP::kiface(), CV::kiface(), SCH::kiface(), GERBV::kiface(), PCBCALC::kiface(), PCB::kiface(), PGE::kiface(), and process.

Variable Documentation

◆ Kiway

KIWAY Kiway
extern

Referenced by FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDIT_FRAME::AddLibraryFile(), SCH_EDIT_FRAME::AskToSaveChanges(), SYMBOL_EDIT_FRAME::CanCloseSymbolFromSchematic(), SCH_EDIT_FRAME::canCloseWindow(), PCB_EDIT_FRAME::canCloseWindow(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), SYMBOL_EDIT_FRAME::DdAddLibrary(), DIALOG_SHIM::DIALOG_SHIM(), PCB_EDIT_FRAME::FetchNetlistFromSchematic(), FOOTPRINT_EDIT_FRAME::LoadFootprintFromBoard(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), SYMBOL_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), PGM_SINGLE_TOP::OnPgmExit(), PGM_KICAD::OnPgmExit(), PGM_TEST_FRAME::OnPgmExit(), PGM_SINGLE_TOP::OnPgmInit(), PGM_KICAD::OnPgmInit(), PCB_EDIT_FRAME::OnQuit(), SCH_BASE_FRAME::OnSymChangeDebounceTimer(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard(), Prj(), FOOTPRINT_WIZARD_FRAME::PythonPluginsReload(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), PCB_EDIT_FRAME::RunEeschema(), SYMBOL_EDIT_FRAME::saveCurrentSymbol(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_EDIT_FRAME::saveProjectSettings(), PCB_BASE_FRAME::SelectLibrary(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), PCB_EDIT_FRAME::SendCrossProbeItem(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), SCH_EDIT_FRAME::SendSelectItemsToPcb(), PCB_EDIT_FRAME::SendSelectItemsToSch(), SCH_EDIT_FRAME::SetCrossProbeConnection(), SYMBOL_EDIT_FRAME::SetCurSymbol(), FOOTPRINT_EDIT_FRAME::setupTools(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), PCB_EDIT_FRAME::ShowFootprintPropertiesDialog(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIMULATOR_FRAME::SIMULATOR_FRAME(), and PCB_EDIT_FRAME::TestStandalone().