source: cpp/frams/model/modelparts.cpp @ 477

Last change on this file since 477 was 292, checked in by Maciej Komosinski, 10 years ago

Added missing initializations

  • Property svn:eol-style set to native
File size: 17.7 KB
Line 
1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
4
5#include <stdlib.h>
6#include <math.h>
7#include <stdio.h>
8#include <string.h>
9#include <ctype.h>
10#include <time.h>
11#include <errno.h>
12
13///////////////////////////////     MODELPARTS.CPP     ///////////////
14
15#include "modelparts.h"
16#include "model.h"
17
18#include <common/nonstd.h>
19#include <frams/param/param.h>
20#include <frams/neuro/neurolibrary.h>
21#include <frams/util/multirange.h>
22#include <frams/util/extvalue.h>
23#include <frams/param/paramobj.h>
24
25#include F0_DEFASSIGN_FILE
26
27#ifndef SDK_WITHOUT_FRAMS
28#include <frams/neuro/neuroclsobject.h>
29#endif
30
31template<>
32char ModelUserTags::reg[5]={0};
33
34/////////////////////////
35
36PartBase::~PartBase()
37{if (mapped) delete mapped;}
38
39void PartBase::notifyMappingChange()
40{
41if (owner) owner->partmappingchanged=1;
42}
43
44void PartBase::setMapping(const IRange &r)
45{
46if (mapped) (*mapped)=r;
47else mapped=new MultiRange(r);
48notifyMappingChange();
49}
50
51void PartBase::clearMapping()
52{
53if (mapped) {delete mapped; mapped=0;}
54}
55
56void PartBase::addMapping(const IRange &r)
57{
58if (mapped) mapped->add(r);
59else mapped=new MultiRange(r);
60notifyMappingChange();
61}
62
63void PartBase::setMapping(const MultiRange &mr)
64{
65if (mapped) (*mapped)=mr;
66else mapped=new MultiRange(mr);
67notifyMappingChange();
68}
69
70void PartBase::addMapping(const MultiRange &mr)
71{
72if (mapped) mapped->add(mr);
73else mapped=new MultiRange(mr);
74notifyMappingChange();
75}
76
77void PartBase::setInfo(const SString& name,const SString& value)
78{
79strSetField(info,name,value);
80}
81
82void PartBase::setInfo(const SString& name,int value)
83{
84setInfo(name,SString::valueOf(value));
85}
86
87void PartBase::setInfo(const SString& name,double value)
88{
89setInfo(name,SString::valueOf(value));
90}
91
92SString PartBase::getInfo(const SString& name)
93{
94return strGetField(info,name);
95}
96
97/////////////////////////
98
99NeuroClass::NeuroClass(ParamEntry *_props,SString _description,
100                       int _prefinputs,int _prefoutput,int _preflocation,
101                       int *_vectordata,bool own_vd,int vhints)
102        :ownedvectordata(own_vd),
103         name(_props->name),longname(_props->id),description(_description),
104         props(_props),ownedprops(false),
105         prefinputs(_prefinputs),
106         prefoutput(_prefoutput),
107         preflocation(_preflocation),
108         vectordata(_vectordata),
109         visualhints(vhints),impl_count(0),/*impl(0),*/active(1),genactive(0)
110{}
111
112NeuroClass::~NeuroClass()
113{
114setSymbolGlyph(0,0);
115if (props && ownedprops)
116        ParamObject::freeParamTab(props);
117}
118
119NeuroClass::NeuroClass()
120        :ownedvectordata(0),
121         name("Invalid"),
122         props(empty_paramtab),ownedprops(false),
123         prefinputs(0), prefoutput(0),
124         preflocation(0), vectordata(0),
125         visualhints(0),impl_count(0), /*impl(0),*/ active(1), genactive(0)
126{}
127
128SString NeuroClass::getSummary()
129{
130SString t;
131t=getDescription();
132if (t.len()) t+="\n\n";
133t+="Characteristics:\n";
134if(getPreferredInputs())
135        {
136        if (getPreferredInputs()<0) t+="   supports any number of inputs\n";
137        else if (getPreferredInputs()==1) t+="   uses single input\n";
138        else t+=SString::sprintf("   uses %d inputs\n",getPreferredInputs());
139        }
140else t+="   does not use inputs\n";
141if(getPreferredOutput())
142        t+="   provides output value\n";
143else
144        t+="   does not provide output value\n";
145switch(getPreferredLocation())
146        {
147        case 0: t+="   does not require location in body\n"; break;
148        case 1: t+="   should be located on a Part\n"; break;
149        case 2: t+="   should be located on a Joint\n"; break;
150        }
151Param p=getProperties();
152if (p.getPropCount())
153        {
154        if (t.len()) t+="\n\n";
155        t+="Properties:\n";
156        const char *h;
157        int i;
158        for(i=0;i<p.getPropCount();i++)
159                {
160                if (i) t+="\n";
161                t+="   "; t+=p.name(i); t+=" ("; t+=p.id(i); t+=")";
162                switch(*p.type(i))
163                        {
164                        case 'd': t+=" integer";
165                        {paInt a,b,c; if (p.getMinMax(i,a,b,c)>=2) t+=SString::sprintf(" %d..%d",a,b);}
166                                break;
167                        case 'f': t+=" float";
168                        {double a,b,c; if (p.getMinMax(i,a,b,c)>=2) t+=SString::sprintf(" %g..%g",a,b);}
169                                break;
170                        case 's': t+=" string"; break;
171                        case 'x': t+=" anything"; break;
172                        }
173                if (h=p.help(i)) if (*h) {t+=" - "; t+=h;}
174                }
175        }
176return t;
177}
178
179/////////////////////////
180
181/////////////////////////////////////
182
183Neuro::Neuro(double _state,double _inertia,double _force,double _sigmo)
184        :PartBase(getDefaultStyle()),state(_state)
185#ifdef MODEL_V1_COMPATIBLE
186,inertia(_inertia),force(_force),sigmo(_sigmo)
187#endif
188{
189#ifdef MODEL_V1_COMPATIBLE
190olditems=0;
191#endif
192flags=0;
193myclass=0;
194knownclass=1;
195part_refno=-1; joint_refno=-1;
196}
197
198Neuro::Neuro(void):PartBase(getDefaultStyle())
199{
200defassign();
201state=0.0;
202myclass=NULL;
203myclassname="N";//default d="N" but f0.def is unable to set this (d is GETSET, not a regular FIELD)
204knownclass=0;
205refno=0;
206pos=Pt3D_0; rot=Pt3D_0;
207parent=0; part=0; joint=0;
208parentcount=0;
209#ifdef MODEL_V1_COMPATIBLE
210olditems=0;
211#endif
212flags=0;
213part_refno=-1; joint_refno=-1;
214}
215
216
217Neuro::~Neuro()
218{
219#ifdef MODEL_V1_COMPATIBLE
220if (olditems) delete olditems;
221#endif
222int i;
223for(i=0;i<inputs.size();i++)
224        {
225        NInput &ni=inputs(i);
226        if (ni.info) delete ni.info;
227        }
228}
229
230SString** Neuro::inputInfo(int i)
231{
232if (i>=getInputCount()) return 0;
233return &inputs(i).info;
234}
235
236void Neuro::setInputInfo(int i,const SString& name,const SString &value)
237{
238SString **s=inputInfo(i);
239if (!s) return;
240if (!*s) *s=new SString();
241strSetField(**s,name,value);
242}
243
244void Neuro::setInputInfo(int i,const SString& name,int value)
245{
246setInputInfo(i,name,SString::valueOf(value));
247}
248
249void Neuro::setInputInfo(int i,const SString& name,double value)
250{
251setInputInfo(i,name,SString::valueOf(value));
252}
253
254SString Neuro::getInputInfo(int i)
255{
256SString **s=inputInfo(i);
257if (!s) return SString();
258if (!*s) return SString();
259return **s;
260}
261
262SString Neuro::getInputInfo(int i,const SString& name)
263{
264SString **s=inputInfo(i);
265if (!s) return SString();
266if (!*s) return SString();
267return strGetField(**s,name);
268}
269
270void Neuro::operator=(const Neuro& src)
271{
272refno=src.refno;
273#ifdef MODEL_V1_COMPATIBLE
274neuro_refno=-1;
275conn_refno=-1;
276force=src.force;
277sigmo=src.sigmo;
278inertia=src.inertia;
279weight=src.weight;
280olditems=0;
281#endif
282state=src.state;
283part_refno=-1;
284joint_refno=-1;
285pos=src.pos; rot=src.rot;
286parent=0; part=0; joint=0;
287parentcount=0;
288flags=0;
289myclass=src.myclass;
290knownclass=src.knownclass;
291myclassname=src.myclassname;
292myclassparams=src.myclassparams;
293}
294
295void Neuro::attachToPart(int i)
296{attachToPart((i>=0)?owner->getPart(i):0);}
297
298void Neuro::attachToJoint(int i)
299{attachToJoint((i>=0)?owner->getJoint(i):0);}
300
301int Neuro::getClassCount()
302{return NeuroLibrary::staticlibrary.getClassCount();}
303
304NeuroClass* Neuro::getClass(int classindex)
305{return NeuroLibrary::staticlibrary.getClass(classindex);}
306
307NeuroClass* Neuro::getClass(const SString& classname)
308{return NeuroLibrary::staticlibrary.findClass(classname);}
309
310int Neuro::getClassIndex(const NeuroClass*nc)
311{return NeuroLibrary::staticlibrary.classes.find((void*)nc);}
312
313NeuroClass* Neuro::getClass()
314{
315checkClass();
316return myclass;
317}
318
319void Neuro::setClass(NeuroClass* cl)
320{
321myclass=cl;
322myclassname=cl->getName();
323knownclass=1;
324}
325
326SString Neuro::getClassName(int classindex)
327{
328NeuroClass *cl=NeuroLibrary::staticlibrary.getClass(classindex);
329return cl? cl->getName() : SString();
330}
331
332void Neuro::setDetails(const SString& details)
333{
334int colon=details.indexOf(':');
335if (colon>=0) {myclassname=details.substr(0,colon); myclassparams=details.substr(colon+1);}
336else {myclassname=details; myclassparams=0;}
337knownclass=0;
338}
339
340SString Neuro::getDetails()
341{
342SString ret=getClassName();
343if (myclassparams.len()) {if (!ret.len()) ret="N"; ret+=":"; ret+=myclassparams;}
344return ret;
345}
346
347void Neuro::checkClass()
348{
349if (knownclass) return;
350myclass=getClass(myclassname);
351knownclass=1;
352}
353
354SyntParam Neuro::classProperties(bool handle_defaults_when_saving)
355{
356NeuroClass *cl=getClass();
357ParamEntry *pe = cl ? cl->getParamTab() : emptyParamTab;
358return SyntParam(pe,&myclassparams,handle_defaults_when_saving);
359}
360
361SString Neuro::getClassName()
362{
363return myclassname;
364}
365
366void Neuro::setClassName(const SString& clazz)
367{
368myclassname=clazz;
369knownclass=0;
370}
371
372int Neuro::addInput(Neuro* child,double weight,const SString *info)
373{
374inputs+=NInput(child,weight,(info&&(info->len()))?new SString(*info):0);
375child->parentcount++;
376if (child->parentcount==1) {child->parent=this;}
377return inputs.size()-1;
378}
379
380int Neuro::findInput(Neuro* child) const
381{
382for(int i=0;i<inputs.size();i++)
383        if (inputs(i).n==child) return i;
384return -1;
385}
386
387Neuro* Neuro::getInput(int i,double &weight) const
388{
389if (i>=getInputCount()) return 0;
390NInput &inp=inputs(i);
391weight=inp.weight;
392return inp.n;
393}
394
395double Neuro::getInputWeight(int i) const
396{
397return inputs(i).weight;
398}
399
400void Neuro::setInputWeight(int i,double w)
401{
402inputs(i).weight=w;
403}
404
405void Neuro::setInput(int i,Neuro* n)
406{
407NInput &inp=inputs(i);
408inp.n=n;
409}
410
411void Neuro::setInput(int i,Neuro* n,double w)
412{
413NInput &inp=inputs(i);
414inp.n=n;
415inp.weight=w;
416}
417
418void Neuro::removeInput(int refno)
419{
420Neuro *child=getInput(refno);
421child->parentcount--;
422if (child->parent==this) child->parent=0;
423SString *s=inputs(refno).info;
424if (s) delete s;
425inputs.remove(refno);
426}
427
428int Neuro::removeInput(Neuro* child)
429{
430int i=findInput(child);
431if (i>=0) removeInput(i);
432return i;
433}
434
435int Neuro::getOutputsCount() const
436{
437   int c=0;
438   for(int i=0;i<owner->getNeuroCount();i++)
439     for(int j=0;j<owner->getNeuro(i)->getInputCount();j++) c+=owner->getNeuro(i)->getInput(j)==this;
440   return c;
441}
442
443int Neuro::isOldEffector()
444{
445static SString bend("|"),rot("@");
446return ((getClassName()==bend)||(getClassName()==rot));
447}
448
449int Neuro::isOldReceptor()
450{
451static SString g("G"),t("T"),s("S");
452return ((getClassName()==g)||(getClassName()==t)||(getClassName()==s));
453}
454
455int Neuro::isOldNeuron()
456{
457static SString n("N");
458return (getClassName()==n);
459}
460
461int Neuro::isNNConnection()
462{
463static SString conn("-");
464return (getClassName()==conn);
465}
466
467int Neuro::findInputs(SList& result,const char* classname,const Part* part,const Joint* joint) const
468{
469Neuro *nu;
470SString cn(classname);
471int n0=result.size();
472for(int i=0;nu=getInput(i);i++)
473        {
474        if (part)
475                if (nu->part != part) continue;
476        if (joint)
477                if (nu->joint != joint) continue;
478        if (classname)
479                if (nu->getClassName() != cn) continue;
480        result+=(void*)nu;
481        }
482return result.size()-n0;
483}
484
485int Neuro::findOutputs(SList& result,const char* classname,const Part* part,const Joint* joint) const
486{ // not very efficient...
487Neuro *nu,*inp;
488SString cn(classname);
489SList found;
490int n0=result.size();
491for(int i=0;nu=getModel().getNeuro(i);i++)
492        {
493        if (part)
494                if (nu->part != part) continue;
495        if (joint)
496                if (nu->joint != joint) continue;
497        if (classname)
498                if (inp->getClassName() != cn) continue;
499        for (int j=0;inp=nu->getInput(j);j++)
500                if (inp==this)
501                        {
502                        result+=(void*)nu;
503                        break;
504                        }
505        }
506return result.size()-n0;
507}
508
509void Neuro::get_inputCount(PARAMGETARGS)
510{ret->setInt(inputs.size());}
511
512void Neuro::p_getInputNeuroDef(ExtValue *args,ExtValue *ret)
513{
514int i=args->getInt();
515if ((i<0)||(i>=inputs.size()))
516        ret->setEmpty();
517else
518        ret->setObject(ExtObject(&Neuro::getStaticParam(),inputs(i).n));
519}
520
521void Neuro::p_getInputWeight(ExtValue *args,ExtValue *ret)
522{
523int i=args->getInt();
524if ((i<0)||(i>=inputs.size()))
525        ret->setEmpty();
526else
527        ret->setDouble(inputs(i).weight);
528}
529
530void Neuro::p_getInputNeuroIndex(ExtValue *args,ExtValue *ret)
531{
532int i=args->getInt();
533if ((i<0)||(i>=inputs.size()))
534        ret->setInt(-1);
535else
536        ret->setInt(inputs(i).n->refno);
537}
538
539void Neuro::get_classObject(PARAMGETARGS)
540{
541#ifndef SDK_WITHOUT_FRAMS
542NeuroClassExt::makeStaticObject(ret,getClass());
543#endif
544}
545
546/////// old items
547#ifdef MODEL_V1_COMPATIBLE
548void OldItems::buildlist()
549{ // guaranteed to work only for old NN layouts
550 // (neurons,neuro connections, old receptors and effectors)
551if (listok) return;
552 // inputs can contain both neuroitem connections (details="") and direct neuron references (details="N")
553 // in OldItems we create neuroitems freom direct references
554for(int i=0;i<neuro.getInputCount();i++)
555        {
556        float w;
557        Neuro *n=neuro.getInput(i,w);
558        if (n->isOldNeuron())
559                {
560                Neuro *ni=new Neuro();
561                ni->setClassName("-");
562                ni->weight=w;
563                ni->neuro_refno=neuro.refno;
564                ni->conn_refno=n->refno;
565                items+=ni;
566                syntitems+=ni;
567                }
568        else
569                {
570                items+=n;
571                n->weight=w;
572                }
573        }
574SList outputs;
575neuro.findOutputs(outputs);
576FOREACH(Neuro*,n,outputs)
577        {
578        if (n->isNNConnection() || n->isOldNeuron())
579                outputs-=n;
580        }
581items+=outputs;
582listok=1;
583}
584
585void OldItems::freelist()
586{
587FOREACH(Neuro*,n,syntitems)
588        delete n;
589syntitems.clear();
590items.clear();
591listok=0;
592}
593
594int OldItems::getItemCount()
595{
596buildlist();
597return items.size();
598}
599
600NeuroItem *OldItems::getNeuroItem(int i)
601{
602buildlist();
603return (NeuroItem*)items(i);
604}
605
606NeuroItem *OldItems::addNewNeuroItem()
607{
608Neuro *nu=neuro.getModel().addNewNeuro();
609nu->setClassName("-");
610if (listok) items+=nu;
611neuro.addInput(nu);
612return (NeuroItem*)nu;
613}
614
615int OldItems::findNeuroItem(NeuroItem *ni)
616{
617buildlist();
618return items.find((void*)ni);
619}
620#endif
621
622///////////////////////////////////////
623
624SString Part::getDefaultStyle()
625{return SString("part");}
626SString Joint::getDefaultStyle()
627{return SString("joint");}
628/*
629const SString& Neuro::getDefaultStyle()
630{static SString s("neuro"); return s;}
631const SString& NeuroItem::getDefaultStyle()
632{static SString s("neuroitem"); return s;}
633*/
634SString Neuro::getDefaultStyle()
635{return SString("neuro");}
636
637Part::Part(enum Shape s):PartBase(getDefaultStyle())
638{
639o=Orient_1;
640p=Pt3D_0;
641rot=Pt3D_0;
642flags=0;
643defassign();
644shape=s;
645}
646
647void Part::operator=(const Part& src)
648{
649p=src.p; o=src.o;
650flags=src.flags;
651mass=src.mass; density=src.density;
652friction=src.friction;
653ingest=src.ingest;
654assim=src.assim;
655size=src.size;
656rot=src.rot;
657refno=src.refno;
658vcolor=src.vcolor;
659vsize=src.vsize;
660vis_style=src.vis_style;
661shape=src.shape;
662scale=src.scale;
663hollow=src.hollow;
664}
665
666void Part::setOrient(const Orient &_o)
667{
668o=_o;
669rot.getAngles(o.x,o.z);
670}
671
672void Part::setRot(const Pt3D &r)
673{
674rot=r;
675o=Orient_1;
676o.rotate(rot);
677}
678
679void Part::setPositionAndRotationFromAxis(const Pt3D &p1,const Pt3D &p2)
680{
681Pt3D x=p2-p1;
682Pt3D dir(x.y,x.z,x.x);
683p=p1+x*0.5;
684rot.getAngles(x,dir);
685}
686
687Param& Part::getStaticParam()
688{
689static Param p(f0_part_paramtab,0,"Part");
690return p;
691}
692
693
694///////////////////////////
695
696Joint::Joint():PartBase(getDefaultStyle())
697{
698rot=Pt3D_0;
699defassign();
700d.x=JOINT_DELTA_MARKER;
701d.y=JOINT_DELTA_MARKER;
702d.z=JOINT_DELTA_MARKER;
703part1=0; part2=0;
704flags=0;
705usedelta=0;
706}
707
708void Joint::operator=(const Joint& src)
709{
710rot=src.rot;
711d=src.d;
712shape=src.shape;
713stamina=src.stamina;
714stif=src.stif; rotstif=src.rotstif;
715vis_style=src.vis_style;
716vcolor=src.vcolor;
717part1=0; part2=0;
718flags=src.flags;
719usedelta=src.usedelta;
720refno=src.refno;
721}
722
723void Joint::attachToParts(Part* p1,Part* p2)
724{
725part1=p1;
726part2=p2;
727if (p1 && p2)
728        {
729        o=rot;
730        if (usedelta)
731                {
732                p1->o.transform(p2->o,o);
733//              p2->o.x=p1->o/o.x; p2->o.y=p1->o/o.y; p2->o.z=p1->o/o.z;
734                p2->p=p2->o.transform(d)+p1->p;
735                }
736        }
737}
738
739void Joint::attachToParts(int p1,int p2)
740{
741attachToParts((p1>=0)?owner->getPart(p1):0,(p2>=0)?owner->getPart(p2):0);
742}
743
744void Joint::resetDelta()
745{
746d=Pt3D(JOINT_DELTA_MARKER,JOINT_DELTA_MARKER,JOINT_DELTA_MARKER);
747}
748
749void Joint::resetDeltaMarkers()
750{
751if (d.x==JOINT_DELTA_MARKER) d.x=0;
752if (d.y==JOINT_DELTA_MARKER) d.y=0;
753if (d.z==JOINT_DELTA_MARKER) d.z=0;
754}
755
756void Joint::useDelta(bool use)
757{
758usedelta=use;
759}
760
761bool Joint::isDelta()
762{
763return usedelta;
764}
765
766Param& Joint::getStaticParam()
767{
768static Param p(f0_joint_paramtab,0,"Joint");
769return p;
770}
771
772
773/////////////////////////////////////////////////////////////////
774/////////////////////////////////////////////////////////////////
775
776#include F0_CLASSES_FILE
777
778#ifdef MODEL_V1_COMPATIBLE
779
780#define FIELDSTRUCT Neuro
781ParamEntry f0_old_neuro_tab[]=
782{
783{"Connections",2,6,"n",},
784{"Other properties",},
785{"p",0,0,"part ref#","d",FIELD(part_refno),},
786{"j",0,0,"joint ref#","d",FIELD(joint_refno),},
787{"s",1,0,"state","f",FIELD(state),},
788{"in",1,0,"Inertia","f",FIELD(inertia),},
789{"fo",1,0,"Force","f",FIELD(force),},
790{"si",1,0,"Sigmoid","f",FIELD(sigmo),},
791{0,0,0,},
792};
793#undef FIELDSTRUCT
794
795#define FIELDSTRUCT NeuroItem
796ParamEntry f0_neuroitem_paramtab[]=
797{
798{"Connections",3,12,"ni",},
799{"Geometry",},
800{"Other",},
801{"n",0,0,"neuron ref#","d",FIELD(neuro_refno),},
802{"c",2,0,"connection ref#","d",FIELD(conn_refno),},
803{"w",2,0,"connection weight","f",FIELD(weight),},
804{"p",0,0,"part ref#","d",FIELD(part_refno),},
805{"j",0,0,"joint ref#","d",FIELD(joint_refno),},
806{"px",1,0,"position.x","f",FIELD(pos.x),},
807{"py",1,0,"position.y","f",FIELD(pos.y),},
808{"pz",1,0,"position.z","f",FIELD(pos.z),},
809{"rx",1,0,"rotation.x","f",FIELD(rot.x),},
810{"ry",1,0,"rotation.y","f",FIELD(rot.y),},
811{"rz",1,0,"rotation.z","f",FIELD(rot.z),},
812{"d",2,0,"item details","s",GETSET(details),},
813{0,0,0,},
814};
815#undef FIELDSTRUCT
816#endif
817
818////////////////////////////////////////
819
820ParamEntry Neuro::emptyParamTab[]=
821{
822{"Undefined Neuro",1,0,"?",},
823{0,0,0,},
824};
825
826Param Part::extraProperties()
827{
828return Param(f0_part_xtra_paramtab,this);
829}
830
831Param Joint::extraProperties()
832{
833return Param(f0_joint_xtra_paramtab,this);
834}
835
836Param Neuro::extraProperties()
837{
838return Param(f0_neuro_xtra_paramtab,this);
839}
840
841Param Part::properties()
842{
843return Param(f0_part_paramtab,this);
844}
845
846Param Joint::properties()
847{
848return Param(usedelta?f0_joint_paramtab:f0_nodeltajoint_paramtab,this);
849}
850
851Param Neuro::properties()
852{
853return Param(f0_neuro_paramtab,this);
854}
855
856class NeuroExtParamTab: public ParamTab
857{
858  public:
859NeuroExtParamTab():ParamTab(f0_neuro_paramtab)
860        {
861#define FIELDSTRUCT NeuroExt
862        ParamEntry entry={"class",2,0,"neuro class","s",GETSET(neuroclass)};
863#undef FIELDSTRUCT
864        add(&entry);
865
866#define FIELDSTRUCT Neuro
867        ParamEntry entry2={"state",2,0,"state","f",FIELD(state)};
868#undef FIELDSTRUCT
869        add(&entry2);
870        }
871};
872
873Param& Neuro::getStaticParam()
874{
875static Param p(f0_neuro_paramtab,0,"NeuroDef");
876return p;
877}
878
879////////////////////////
880
881NeuroConn::NeuroConn()
882{
883defassign();
884}
885
886//////////////////////////////////////
887
888ParamEntry *NeuroExt::getParamTab()
889{
890static NeuroExtParamTab tab;
891return tab.getParamTab();
892}
893
894void NeuroExt::get_neuroclass(PARAMGETARGS)
895{ret->setString(getClassName());}
896
897int NeuroExt::set_neuroclass(PARAMSETARGS)
898{setClassName(arg->getString());return PSET_CHANGED;}
899
900
Note: See TracBrowser for help on using the repository browser.