KiCad PCB EDA Suite
KIFACE Struct Referenceabstract

Class KIFACE is used by a participant in the KIWAY alchemy. More...

#include <kiway.h>

Inheritance diagram for KIFACE:
KIFACE_I CV::IFACE GERBV::IFACE PCB::IFACE PGE::IFACE SCH::IFACE

Public Member Functions

virtual ~KIFACE () throw ()
 
VTBL_ENTRY bool OnKifaceStart (PGM_BASE *aProgram, int aCtlBits)=0
 Function OnKifaceStart is called just once shortly after the DSO is loaded. More...
 
VTBL_ENTRY void OnKifaceEnd ()=0
 Function OnKifaceEnd is called just once just before the DSO is to be unloaded. More...
 
VTBL_ENTRY wxWindow * CreateWindow (wxWindow *aParent, int aClassId, KIWAY *aKIWAY, int aCtlBits=0)=0
 Function CreateWindow creates a wxWindow for the current project. More...
 
VTBL_ENTRY void * IfaceOrAddress (int aDataId)=0
 Function IfaceOrAddress returns a pointer to the requested object. More...
 

Detailed Description

Class KIFACE is used by 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

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

Definition at line 156 of file kiway.h.

156 {}

Member Function Documentation

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

Function CreateWindow creates 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
wxWindow* - 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 PCB::IFACE, SCH::IFACE, CV::IFACE, GERBV::IFACE, KIFACE_I, and PGE::IFACE.

Referenced by FOOTPRINT_PREVIEW_PANEL_BASE::Create(), and KIWAY::Player().

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

Function IfaceOrAddress returns a 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
void* - and must be cast into the known type.

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

Referenced by get_instance_from_id().

VTBL_ENTRY void KIFACE::OnKifaceEnd ( )
pure virtual

Function OnKifaceEnd is 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 PCB::IFACE, SCH::IFACE, CV::IFACE, GERBV::IFACE, PGE::IFACE, and KIFACE_I.

Referenced by KIWAY::OnKiwayEnd().

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

Function OnKifaceStart is 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
bool - 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 PCB::IFACE, SCH::IFACE, CV::IFACE, GERBV::IFACE, PGE::IFACE, and KIFACE_I.

Referenced by KIWAY::KiFACE().


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