gnucap-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnucap-devel] problem with clone_instance


From: al davis
Subject: Re: [Gnucap-devel] problem with clone_instance
Date: Sun, 24 Nov 2013 22:07:11 -0500
User-agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; )

On Monday 18 November 2013, Felix Salfelder wrote:
> i'm now considerably successful with something like
> 
> /*-----------------------------------------------------------
> ---------------*/ class NOTHING : public COMPONENT { //
> public:
>   NOTHING():COMPONENT(){ }
>   CARD* clone() const { return new(NOTHING);}
> private:
>   std::string value_name()const { return "error";}
>   int max_nodes()const {return 0;}
>   std::string dev_type()const {return "error";}
>   std::string port_name(int)const {untested(); return
> "error";} bool print_type_in_spice()const {return 0;}
> };
> /*-----------------------------------------------------------
> ---------------*/ static NOTHING p0;
> static MODEL_SEMI_RESISTOR  p1(&p0); // <= fix the
> corresponding constructors static MODEL_SEMI_CAPACITOR
> p2(&p0); // <= fix the corresponding constructors static
> DISPATCHER<MODEL_CARD>::INSTALL
>   d1(&model_dispatcher, "r|res", &p1),
>   d2(&model_dispatcher, "c|cap", &p2);
> /*-----------------------------------------------------------
> ---------------*/

That is an improvement, I think.

print_type_in_spice should return true or false, not the number 
0.  It is probably the same to the compiler but different to a 
human reader.  Some other languages with strong typing would 
flag this as an error.

At first I thought ... why not link it to the resistor or 
capacitor, the usual use?  Answer: because the resistor is a 
plugin, not necessarily loaded.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]