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/neurofactory.cpp

    r375 r790  
    1313NeuroImpl* NeuroFactory::getImplementation(NeuroClass *nc)
    1414{
    15 if (nc!=NULL)
     15        if (nc != NULL)
    1616        {
    17         std::map<NeuroClass*,NeuroImpl*>::iterator it=impl.find(nc);
    18         if (it!=impl.end())
    19                 return it->second;
     17                std::map<NeuroClass*, NeuroImpl*>::iterator it = impl.find(nc);
     18                if (it != impl.end())
     19                        return it->second;
    2020        }
    21 return NULL;
     21        return NULL;
    2222}
    2323
    2424NeuroImpl* NeuroFactory::createNeuroImpl(NeuroClass *nc)
    2525{
    26 if (!nc) return 0;
    27 if (!nc->active) return 0;
    28 NeuroImpl* ni=getImplementation(nc);
    29 if (!ni) return 0;
    30 ni=ni->makeNew();
    31 if (ni) ni->neuroclass=nc;
    32 return ni;
     26        if (!nc) return 0;
     27        if (!nc->active) return 0;
     28        NeuroImpl* ni = getImplementation(nc);
     29        if (!ni) return 0;
     30        ni = ni->makeNew();
     31        if (ni) ni->neuroclass = nc;
     32        return ni;
    3333}
    3434
    35 NeuroImpl* NeuroFactory::setImplementation(const SString& classname,NeuroImpl *ni,bool deleteold)
     35NeuroImpl* NeuroFactory::setImplementation(const SString& classname, NeuroImpl *ni, bool deleteold)
    3636{
    37 NeuroClass *nc=Neuro::getClass(classname);
    38 if (!nc) return ni;
    39 return setImplementation(nc,ni,deleteold);
     37        NeuroClass *nc = Neuro::getClass(classname);
     38        if (!nc) return ni;
     39        return setImplementation(nc, ni, deleteold);
    4040}
    4141
    42 NeuroImpl* NeuroFactory::setImplementation(NeuroClass *nc,NeuroImpl *ni,bool deleteold)
     42NeuroImpl* NeuroFactory::setImplementation(NeuroClass *nc, NeuroImpl *ni, bool deleteold)
    4343{
    44 if (nc==NULL) return NULL;
    45 std::map<NeuroClass*,NeuroImpl*>::iterator it=impl.find(nc);
    46 NeuroImpl* old_ni=NULL;
    47 if (it==impl.end())
     44        if (nc == NULL) return NULL;
     45        std::map<NeuroClass*, NeuroImpl*>::iterator it = impl.find(nc);
     46        NeuroImpl* old_ni = NULL;
     47        if (it == impl.end())
    4848        {
    49         if (ni!=NULL)
     49                if (ni != NULL)
    5050                {
    51                 impl[nc]=ni;
    52                 nc->impl_count++;
     51                        impl[nc] = ni;
     52                        nc->impl_count++;
    5353                }
    54         return NULL;
     54                return NULL;
    5555        }
    56 else
     56        else
    5757        {
    58         old_ni=it->second;
    59         if (ni)
    60                 it->second=ni;
    61         else
     58                old_ni = it->second;
     59                if (ni)
     60                        it->second = ni;
     61                else
    6262                {
    63                 impl.erase(it);
    64                 nc->impl_count--;
     63                        impl.erase(it);
     64                        nc->impl_count--;
    6565                }
    6666        }
    67 if (deleteold && old_ni) delete old_ni;
    68 return old_ni;
     67        if (deleteold && old_ni) delete old_ni;
     68        return old_ni;
    6969}
    7070
     
    7373void NeuroFactory::setStandardImplementation()
    7474{
    75 SETIMPLEMENTATION
     75        SETIMPLEMENTATION
    7676}
    7777
    7878void NeuroFactory::freeImplementation()
    7979{
    80 for(int i=0;i<Neuro::getClassCount();i++)
    81         setImplementation(Neuro::getClass(i),0);
     80        for (int i = 0; i < Neuro::getClassCount(); i++)
     81                setImplementation(Neuro::getClass(i), 0);
    8282}
    8383
    8484void NeuroFactory::removeUnimplemented()
    8585{
    86 SString removed;
    87 for(int i=0;i<Neuro::getClassCount();i++)
     86        SString removed;
     87        for (int i = 0; i < Neuro::getClassCount(); i++)
    8888        {
    89         NeuroClass *nc=Neuro::getClass(i);
    90         if (nc->impl_count==0)
     89                NeuroClass *nc = Neuro::getClass(i);
     90                if (nc->impl_count == 0)
    9191                {
    92                 removed+=nc->getName();
    93                 removed+=" ";
    94                 NeuroLibrary::staticlibrary.classes-=i;
    95                 i--;
    96                 delete nc;
     92                        removed += nc->getName();
     93                        removed += " ";
     94                        NeuroLibrary::staticlibrary.classes -= i;
     95                        i--;
     96                        delete nc;
    9797                }
    9898        }
    99 if (removed.len())
    100         logPrintf("NeuroFactory","removeUninmplemented",LOG_INFO,
    101          "Removed Neuro classes: %s",removed.c_str());
     99        if (removed.len())
     100                logPrintf("NeuroFactory", "removeUninmplemented", LOG_INFO,
     101                "Removed Neuro classes: %s", removed.c_str());
    102102}
    103 
Note: See TracChangeset for help on using the changeset viewer.