Show
Ignore:
Timestamp:
03/26/09 12:53:27 (15 years ago)
Author:
bhilburn
Message:

Simply whitespace fixes.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vtcross/trunk/src/shell/CognitiveRadioShell.cpp

    r208 r209  
    6262    radio_info = new Radio_Info; 
    6363 
    64  
    6564    LoadRadioConfiguration(radioConfig,p,u,o,radio_info); 
    6665 
     
    7877} 
    7978 
     79 
    8080void  
    8181CognitiveRadioShell::Shutdown() 
     
    9898} 
    9999 
     100 
    100101void 
    101102CognitiveRadioShell::SendRadioExperience(int32_t socketFD) 
     
    104105    LOG("Cognitive Radio Shell:: Sending radio experience to Cognitive Engine.\n"); 
    105106} 
     107 
    106108 
    107109void 
     
    117119} 
    118120 
     121 
    119122void  
    120123CognitiveRadioShell::DeregisterCognitiveEngine(int32_t socketFD) 
     
    124127    numberOfCognitiveEngines--; 
    125128    if(numberOfCognitiveEngines == 0) 
    126     CE_present = false; 
     129        CE_present = false; 
    127130 
    128131    SendMessage(socketFD, "deregister_ack"); 
     
    132135} 
    133136 
     137 
    134138void 
    135139CognitiveRadioShell::RegisterPolicyEngine(int32_t socketFD) 
     
    138142    PE_present = true; 
    139143} 
     144 
    140145 
    141146void  
     
    152157} 
    153158 
     159 
    154160void 
    155161CognitiveRadioShell::RegisterSML(int32_t socketFD) 
     
    159165    SML_present = true; 
    160166} 
     167 
    161168 
    162169void  
     
    173180} 
    174181 
     182 
    175183int32_t  
    176 CognitiveRadioShell::LoadRadioConfiguration(const char* radioConfig, Parameter* &pList, \ 
    177     Utility* &uList, Observable* &oList, Radio_Info * radioInfo) 
     184CognitiveRadioShell::LoadRadioConfiguration(const char* radioConfig, \ 
     185        Parameter* &pList, Utility* &uList, Observable* &oList, \ 
     186        Radio_Info* radioInfo) 
    178187{ 
    179188    TiXmlElement *pElem; 
     
    193202    TiXmlDocument doc( radioConfig ); 
    194203    bool loadOkay = doc.LoadFile(); 
    195     if(!loadOkay) 
    196     { 
     204    if(!loadOkay) { 
    197205        ERROR(1,"Loading radio configuration failed: %s\n", radioConfig); 
    198206        return -1; 
     
    212220 
    213221    for(pChild = pChild1->FirstChildElement("utility"); pChild; \ 
    214         pChild = pChild->NextSiblingElement())  
    215     { 
     222        pChild = pChild->NextSiblingElement()) { 
     223 
    216224        const char *uName = pChild->Attribute("name"); 
    217225        if(uName) 
     
    240248 
    241249    for(pChild = pChild1->FirstChildElement("observable"); pChild; \ 
    242         pChild = pChild->NextSiblingElement())  
    243     { 
     250        pChild = pChild->NextSiblingElement()) { 
     251 
    244252        const char *oName = pChild->Attribute("name"); 
    245253        if(oName)  
     
    248256        affect_count = 0; 
    249257        for(pSecondChild = pChild->FirstChildElement("affect"); pSecondChild; \ 
    250             pSecondChild = pSecondChild->NextSiblingElement())  
    251         { 
     258            pSecondChild = pSecondChild->NextSiblingElement()) { 
     259 
    252260            const char *oUtilName = pSecondChild->Attribute("utility"); 
    253             if(oUtilName)  
    254             { 
    255                 for(attribute_count = 0; attribute_count < radio_info->numUtilities; attribute_count++ )  
    256                 { 
    257                     if(uList[attribute_count].name == oUtilName)  
    258                     { 
     261            if(oUtilName) { 
     262                for(attribute_count = 0; attribute_count < radio_info->numUtilities; attribute_count++ ) { 
     263                    if(uList[attribute_count].name == oUtilName) { 
     264 
    259265                        oList[item_count].affection_list[affect_count].u = &uList[attribute_count]; 
    260266                        const char *oRelate = pSecondChild->Attribute("relationship"); 
    261267                        if(oRelate)  
    262268                            oList[item_count].affection_list[affect_count].relation = oRelate; 
     269 
    263270                        affect_count++; 
    264271                        match_found = true; 
     
    287294    item_count = 0; 
    288295    for(pChild = pChild1->FirstChildElement("parameter"); pChild; \ 
    289         pChild = pChild->NextSiblingElement())  
    290     { 
     296        pChild = pChild->NextSiblingElement()) { 
     297 
    291298        const char *pName = pChild->Attribute("name"); 
    292299        if(pName)  
     
    308315        affect_count = 0; 
    309316        for(pSecondChild = pChild->FirstChildElement("affect"); pSecondChild; \ 
    310             pSecondChild = pSecondChild->NextSiblingElement())  
    311         { 
     317 
     318            pSecondChild = pSecondChild->NextSiblingElement()) { 
    312319            const char *pUtilName = pSecondChild->Attribute("utility"); 
    313             if(pUtilName)  
    314             { 
    315                 for(attribute_count = 0; attribute_count < radio_info->numUtilities; attribute_count++)  
    316                 { 
    317                     if(uList[attribute_count].name == pUtilName)  
    318                     { 
     320            if(pUtilName) { 
     321                for(attribute_count = 0; attribute_count < radio_info->numUtilities; attribute_count++) { 
     322                    if(uList[attribute_count].name == pUtilName) { 
    319323                        pList[item_count].affection_list[affect_count].u = &uList[attribute_count];     
    320324 
     
    332336            } 
    333337 
    334             if(!match_found)  
    335             { 
     338            if(!match_found) { 
    336339                ERROR(1, "Error: %s: %s is not a valid utility.\n", \ 
    337340                    pList[item_count].name.c_str(), pUtilName); 
     
    352355} 
    353356 
     357 
    354358void 
    355359CognitiveRadioShell::GetOptimalParameters(int32_t socketFD) 
    356360{ 
    357  
    358  
    359 } 
     361} 
     362 
    360363 
    361364void 
     
    384387} 
    385388 
     389 
    386390void 
    387391CognitiveRadioShell::StartShellServer() 
     
    421425    } 
    422426 
    423     while (running) 
    424     { 
     427    while (running) { 
    425428        /* Zero socket descriptor vector and set for server sockets */ 
    426429        /* This must be reset every time select() is called */ 
     
    437440        /* Suspend program until descriptor is ready or timeout */ 
    438441        rc = select(maxDescriptor + 1, &sockSet, NULL, NULL, &selTimeout);  
    439         if (rc == 0) 
     442        if(rc == 0) 
    440443            LOG("No echo requests for %i secs...Server still alive\n", timeout); 
    441         else  
    442         { 
     444        else { 
    443445            desc_ready = rc; 
    444446 
    445             for (port = 0; port <= maxDescriptor && desc_ready > 0; port++) { 
    446                 if (FD_ISSET(port, &sockSet)) 
    447                 { 
    448                 desc_ready -= 1; 
     447            for(port = 0; port <= maxDescriptor && desc_ready > 0; port++) { 
     448                if(FD_ISSET(port, &sockSet)) { 
     449                    desc_ready -= 1; 
    449450 
    450451                    /* Check if request is new or on an existing open descriptor */ 
    451                     if( (port == servSock[primary]) || (port == servSock[policy]) || (port == servSock[command])) {  
    452                         do 
    453                         {  
     452                    if((port == servSock[primary]) || (port == servSock[policy]) || (port == servSock[command])) {  
     453                        do { 
    454454                            new_sd = AcceptTCPConnection(port); 
    455455                            if(new_sd < 0)  
    456                             { 
    457456                                break; 
    458                             } 
    459457                             
    460458                            HandleMessage(new_sd); 
     
    464462                            //LOG("New incoming connection - %i\n\n",new_sd); 
    465463                        } while(new_sd != -1); 
    466                     } else { 
    467                          
     464                    }  
     465                    else { 
    468466                        //LOG("Request on already open descriptor.\n\n"); 
    469467                        HandleMessage(port);