Ignore:
Timestamp:
05/29/18 15:46:35 (6 years ago)
Author:
Maciej Komosinski
Message:

Code formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/neuro/neurolibparam.cpp

    r348 r790  
    88
    99NeuroLibParam::NeuroLibParam(const char* gr, const char* name, const char* pref)
    10         :mygroup(gr),myname(name),myprefix(pref)
     10        :mygroup(gr), myname(name), myprefix(pref)
    1111{
    12 anode=NeuroLibrary::staticlibrary.classes.l_add.add(
    13         STATRICKCALLBACK(this,&NeuroLibParam::neuroclassAdded,0));
    14 dnode=NeuroLibrary::staticlibrary.classes.l_postdel.add(
    15         STATRICKCALLBACK(this,&NeuroLibParam::neuroclassRemoved,0));
     12        anode = NeuroLibrary::staticlibrary.classes.l_add.add(
     13                STATRICKCALLBACK(this, &NeuroLibParam::neuroclassAdded, 0));
     14        dnode = NeuroLibrary::staticlibrary.classes.l_postdel.add(
     15                STATRICKCALLBACK(this, &NeuroLibParam::neuroclassRemoved, 0));
    1616}
    1717
    1818NeuroLibParam::~NeuroLibParam()
    1919{
    20 NeuroLibrary::staticlibrary.classes.l_add.removeNode(anode);// remove(anode) tez powinno byc ok - do sprawdzenia
    21 NeuroLibrary::staticlibrary.classes.l_postdel.removeNode(dnode);
     20        NeuroLibrary::staticlibrary.classes.l_add.removeNode(anode);// remove(anode) tez powinno byc ok - do sprawdzenia
     21        NeuroLibrary::staticlibrary.classes.l_postdel.removeNode(dnode);
    2222}
    2323
    24 void NeuroLibParam::neuroclassAdded(void* data,intptr_t i)
    25 {onadd.action(i);}
    26 void NeuroLibParam::neuroclassRemoved(void* data,intptr_t i)
    27 {ondelete.action(i);}
     24void NeuroLibParam::neuroclassAdded(void* data, intptr_t i)
     25{
     26        onadd.action(i);
     27}
     28void NeuroLibParam::neuroclassRemoved(void* data, intptr_t i)
     29{
     30        ondelete.action(i);
     31}
    2832
    2933static bool isGoodName(const SString& name)
    3034{
    31 for(int i=0;i<name.len();i++)
    32         if (!isalnum(name[i])) return false;
    33 return true;
     35        for (int i = 0; i < name.len(); i++)
     36                if (!isalnum(name[i])) return false;
     37        return true;
    3438}
    3539
    3640const char *NeuroLibParam::id(int i)
    3741{
    38 static SString t;
    39 if (i>=Neuro::getClassCount()) return 0;
    40 t=myprefix;
    41 SString n=Neuro::getClass(i)->getName();
    42 if (isGoodName(n))
    43         t+=n;
    44 else
     42        static SString t;
     43        if (i >= Neuro::getClassCount()) return 0;
     44        t = myprefix;
     45        SString n = Neuro::getClass(i)->getName();
     46        if (isGoodName(n))
     47                t += n;
     48        else
    4549        {//jezeli w nazwie klasy neuronu sa "dziwne" znaki to zamiast tego uzywamy long name
    46         // * -> Constant, | -> Bend_muscle, @ -> Rotation_muscle
    47         n=Neuro::getClass(i)->getLongName();
    48         for(char* p=n.directWrite();*p;p++)
    49                 if (*p==' ') *p='_';
    50         n.endWrite();
    51         t+=n;
     50                // * -> Constant, | -> Bend_muscle, @ -> Rotation_muscle
     51                n = Neuro::getClass(i)->getLongName();
     52                for (char* p = n.directWrite(); *p; p++)
     53                        if (*p == ' ') *p = '_';
     54                n.endWrite();
     55                t += n;
    5256        }
    53 return t.c_str();
     57        return t.c_str();
    5458}
    5559
    5660const char *NeuroLibParam::name(int i)
    5761{
    58 static SString t;
    59 t=Neuro::getClass(i)->getLongName();
    60 t+=" ("; t+=Neuro::getClassName(i); t+=")";
    61 return t.c_str();
     62        static SString t;
     63        t = Neuro::getClass(i)->getLongName();
     64        t += " ("; t += Neuro::getClassName(i); t += ")";
     65        return t.c_str();
    6266}
    6367
    6468const char *NeuroLibParam::help(int i)
    6569{
    66 static SString t;
    67 t=Neuro::getClass(i)->getSummary();
    68 return t.c_str();
     70        static SString t;
     71        t = Neuro::getClass(i)->getSummary();
     72        return t.c_str();
    6973}
    7074
    71 int NeuroLibParam::grmember(int gi,int n)
     75int NeuroLibParam::grmember(int gi, int n)
    7276{
    73 return (gi==0)?
    74         ((n>=getPropCount())?-9999:n)
    75         :
    76         -9999;
     77        return (gi == 0) ?
     78                ((n >= getPropCount()) ? -9999 : n)
     79                :
     80                -9999;
    7781}
    78 
Note: See TracChangeset for help on using the changeset viewer.