// This file is a part of the Framsticks GDK. // Copyright (C) 1999-2014 Maciej Komosinski and Szymon Ulatowski. See LICENSE.txt for details. // Refer to http://www.framsticks.com/ for further information. #include #include "neurolibparam.h" #include NeuroLibParam::NeuroLibParam(const char* gr, const char* name, const char* pref) :mygroup(gr),myname(name),myprefix(pref) { anode=NeuroLibrary::staticlibrary.classes.l_add.add( STATRICKCALLBACK(this,&NeuroLibParam::neuroclassAdded,0)); dnode=NeuroLibrary::staticlibrary.classes.l_postdel.add( STATRICKCALLBACK(this,&NeuroLibParam::neuroclassRemoved,0)); } NeuroLibParam::~NeuroLibParam() { NeuroLibrary::staticlibrary.classes.l_add.removeNode(anode);// remove(anode) tez powinno byc ok - do sprawdzenia NeuroLibrary::staticlibrary.classes.l_postdel.removeNode(dnode); } void NeuroLibParam::neuroclassAdded(void* data,long i) {onadd.action(i);} void NeuroLibParam::neuroclassRemoved(void* data,long i) {ondelete.action(i);} static bool isGoodName(const SString& name) { for(int i=0;i=Neuro::getClassCount()) return 0; t=myprefix; SString n=Neuro::getClass(i)->getName(); if (isGoodName(n)) t+=n; else {//jezeli w nazwie klasy neuronu sa "dziwne" znaki to zamiast tego uzywamy long name // * -> Constant, | -> Bend_muscle, @ -> Rotation_muscle n=Neuro::getClass(i)->getLongName(); for(char* p=n.directWrite();*p;p++) if (*p==' ') *p='_'; n.endWrite(); t+=n; } return t; } const char *NeuroLibParam::name(int i) { static SString t; t=Neuro::getClass(i)->getLongName(); t+=" ("; t+=Neuro::getClassName(i); t+=")"; return t; } const char *NeuroLibParam::help(int i) { static SString t; t=Neuro::getClass(i)->getSummary(); return t; } int NeuroLibParam::grmember(int gi,int n) { return (gi==0)? ((n>=getPropCount())?-9999:n) : -9999; }