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.

_______________________________________________
Gnucap-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnucap-devel

Reply via email to