KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIFACE Struct Referenceabstract

Implement a participant in the KIWAY alchemy. More...

#include <kiway.h>

Inheritance diagram for KIFACE:
KIFACE_BASE BMP2CMP::IFACE CV::IFACE GERBV::IFACE IFACE PCB::IFACE PCBCALC::IFACE PGE::IFACE SCH::IFACE

Public Member Functions

virtual ~KIFACE () throw ()
 
virtual bool OnKifaceStart (PGM_BASE *aProgram, int aCtlBits, KIWAY *aKiway)=0
 Called just once shortly after the DSO is loaded.
 
virtual void OnKifaceEnd ()=0
 Called just once just before the DSO is to be unloaded.
 
virtual void Reset ()=0
 Reloads global state.
 
virtual wxWindow * CreateKiWindow (wxWindow *aParent, int aClassId, KIWAY *aKIWAY, int aCtlBits=0)=0
 Create a wxWindow for the current project.
 
virtual void SaveFileAs (const wxString &srcProjectBasePath, const wxString &srcProjectName, const wxString &newProjectBasePath, const wxString &newProjectName, const wxString &srcFilePath, wxString &aErrors)
 Saving a file under a different name is delegated to the various KIFACEs because the project doesn't know the internal format of the various files (which may have paths in them that need updating).
 
virtual void * IfaceOrAddress (int aDataId)=0
 Return pointer to the requested object.
 
virtual void GetActions (std::vector< TOOL_ACTION * > &aActions) const =0
 Append this Kiface's registered actions to the given list.
 
virtual int HandleJob (JOB *aJob)
 
virtual bool HandleJobConfig (JOB *aJob, wxWindow *aParent)
 

Detailed Description

Implement a participant in the KIWAY alchemy.

KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad process. It makes it possible to call between DSOs without having to link them together. Most all calls are via virtual functions which means C++ vtables are used to hold function pointers and eliminate the need to link to specific object code libraries. There is one KIWAY in the launching portion of the process for each open KiCad project. Each project has its own KIWAY. Within a KIWAY is an actual PROJECT data structure. A KIWAY also facilitates communicating between DSOs on the topic of the project in question.

Definition at line 150 of file kiway.h.

Constructor & Destructor Documentation

◆ ~KIFACE()

virtual KIFACE::~KIFACE ( )
throw (
)
inlinevirtual

Definition at line 156 of file kiway.h.

Member Function Documentation

◆ CreateKiWindow()

virtual wxWindow * KIFACE::CreateKiWindow ( wxWindow *  aParent,
int  aClassId,
KIWAY aKIWAY,
int  aCtlBits = 0 
)
pure virtual

Create a wxWindow for the current project.

The caller must cast the return value into the known type.

Parameters
aParentmay be NULL or is otherwise the parent to connect under. If NULL then caller may want to connect the returned wxWindow into some hierarchy after this function returns.
aClassIdidentifies which wxFrame or wxDialog to retrieve, using a value known to the implementing KIFACE.
aKIWAYtells the window which KIWAY (and PROJECT) it is a participant in.
aCtlBitsconsists of bit flags from the set of KFCTL_* #defines above.
Returns
the window created and if not NULL, should be cast into the known type using and old school cast. dynamic_cast is problematic since it needs typeinfo probably not contained in the caller's link image.

Implemented in BMP2CMP::IFACE, CV::IFACE, SCH::IFACE, GERBV::IFACE, PGE::IFACE, PCBCALC::IFACE, PCB::IFACE, IFACE, and KIFACE_BASE.

◆ GetActions()

virtual void KIFACE::GetActions ( std::vector< TOOL_ACTION * > &  aActions) const
pure virtual

Append this Kiface's registered actions to the given list.

Implemented in KIFACE_BASE.

◆ HandleJob()

virtual int KIFACE::HandleJob ( JOB aJob)
inlinevirtual

Reimplemented in SCH::IFACE, and PCB::IFACE.

Definition at line 244 of file kiway.h.

Referenced by KIWAY::ProcessJob().

◆ HandleJobConfig()

virtual bool KIFACE::HandleJobConfig ( JOB aJob,
wxWindow *  aParent 
)
inlinevirtual

Reimplemented in SCH::IFACE, and PCB::IFACE.

Definition at line 249 of file kiway.h.

Referenced by KIWAY::ProcessJobConfigDialog().

◆ IfaceOrAddress()

virtual void * KIFACE::IfaceOrAddress ( int  aDataId)
pure virtual

Return pointer to the requested object.

The safest way to use this is to retrieve a pointer to a static instance of an interface, similar to how the KIFACE interface is exported. But if you know what you are doing use it to retrieve anything you want. Segfaults are your fault.

Parameters
aDataIdidentifies which object you want the address of, and consists of choices known in advance by the implementing KIFACE.
Returns
the requested object which must be cast into the known type.

Implemented in BMP2CMP::IFACE, CV::IFACE, SCH::IFACE, GERBV::IFACE, PGE::IFACE, PCBCALC::IFACE, PCB::IFACE, IFACE, and KIFACE_BASE.

Referenced by ERC_TESTER::TestFootprintLinkIssues().

◆ OnKifaceEnd()

virtual void KIFACE::OnKifaceEnd ( )
pure virtual

Called just once just before the DSO is to be unloaded.

It is called before static C++ destructors are called. A default implementation is supplied.

Implemented in CV::IFACE, SCH::IFACE, GERBV::IFACE, KIFACE_BASE, PGE::IFACE, PCBCALC::IFACE, PCB::IFACE, and IFACE.

◆ OnKifaceStart()

virtual bool KIFACE::OnKifaceStart ( PGM_BASE aProgram,
int  aCtlBits,
KIWAY aKiway 
)
pure virtual

Called just once shortly after the DSO is loaded.

It is the second function called, immediately after the KIFACE_GETTER(). However before either of those, static C++ constructors are called. The DSO implementation should do process level initialization here, not project specific since there will be multiple projects open eventually.

Parameters
aProgramis the process block: PGM_BASE*.
aCtlBitsconsists of bit flags from the set of KFCTL_* #defines above.
Returns
true if DSO initialized OK, false if not. When returning false, the loader may optionally decide to terminate the process or not, but will not put out any UI because that is the duty of this function to say why it is returning false. Never return false without having reported to the UI why.

Implemented in BMP2CMP::IFACE, CV::IFACE, SCH::IFACE, GERBV::IFACE, PGE::IFACE, PCBCALC::IFACE, PCB::IFACE, IFACE, and KIFACE_BASE.

◆ Reset()

virtual void KIFACE::Reset ( )
pure virtual

Reloads global state.

Implemented in SCH::IFACE, KIFACE_BASE, and PCB::IFACE.

◆ SaveFileAs()

virtual void KIFACE::SaveFileAs ( const wxString &  srcProjectBasePath,
const wxString &  srcProjectName,
const wxString &  newProjectBasePath,
const wxString &  newProjectName,
const wxString &  srcFilePath,
wxString &  aErrors 
)
inlinevirtual

Saving a file under a different name is delegated to the various KIFACEs because the project doesn't know the internal format of the various files (which may have paths in them that need updating).

Reimplemented in SCH::IFACE, GERBV::IFACE, PGE::IFACE, and PCB::IFACE.

Definition at line 216 of file kiway.h.

Referenced by SAVE_AS_TRAVERSER::OnFile().


The documentation for this struct was generated from the following file: