Re: [ng-spice] Readline Response
Paolo Nenzi wrote:
>
> On Thu, 26 Aug 1999, Kev wrote:
>
> > Manu Rouat wrote:
>
> > I would suggest that new interfaces for ng-spice are coded as C++ classes
> > using virtual functions, to make it easier to integrate ng-spice into
> > other tools (e.g. my v2k project).
> What is a virtual function, I am not familiar with c++.
..
> Paolo
C++ classes are similar to C structs (in implementation), the major
difference is that you can declare a class function as 'virtual', in
which case a 'function table pointer' is added to the structure and
a pointer to the 'virtual' routine added to the 'function table'.
Classes derived from such a base class can replace that virtual
function with a different routine (by using a different table).
You can then pass a pointer to either the base or derived class
to a routine and get different behavior:
X(bs_cls *foo) {
foo->vfunc(); // version of 'vfunc' called depends on
// the function table pointer in 'foo'
}
The advantage for interfaces is that you can define (say) a
dumb terminal interface as the 'base' class, and then derive
a smarter (say GUI) interface from it. If this interface class
is passed into ng-spice, it won't know (or care) which it is
using. I.e. if you deliver ng-spice as libraries that can be
included in other applications those other applications can
provide better user interfaces than that delivered with
ng-spice.
Hope this helps.
Regards,
Kev.
--
http://www.v-ms.com
mailto:admin@v-ms.com Mixed Signal Simulation
Partial thread listing:
- Re: [ng-spice] Readline Response, (continued)
NG-SPICE Implementation Document,
Paolo Nenzi
MacQuire Patches,
Paolo Nenzi
cvs down?
Manu Rouat