Show
Ignore:
Timestamp:
12/03/07 15:48:13 (1 year ago)
Author:
cneumann
Message:

fixed: compile errors

reference counting


It compiles on linux (when disabling the VRML Loader) and the first
ref counting tests seem to work.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Carsten_PtrWork2/Source/System/Cluster/Base/OSGRemoteAspect.cpp

    r835 r1030  
    101101RemoteAspect::~RemoteAspect(void) 
    102102{ 
    103     FieldContainerFactoryBase *pFactory = FieldContainerFactory::the(); 
    104     IdSetT::iterator           i; 
    105  
    106     FieldContainerPtr       fcPtr; 
    107  
    108     // subRef received field container 
    109     for(i = _receivedFC.begin(); i != _receivedFC.end(); i++) 
    110     { 
    111         fcPtr = pFactory->getContainer(*i); 
    112  
    113         if(fcPtr != NullFC) 
    114         { 
    115             callDestroyed(fcPtr); 
    116  
    117             do 
    118             { 
    119  
    120                 fcPtr->subReferenceUnresolved(); 
    121                 fcPtr = pFactory->getContainer(*i); 
    122  
    123             } while(fcPtr != NullFC); 
    124         } 
    125     } 
    126103} 
    127104 
     
    129106/*                          Remote aspect functionaliy                     */ 
    130107 
    131 /*! <EM>receiveSync</EM> reads changes from the given connection and 
     108/*! \e receiveSync reads changes from the given connection and 
    132109 *  applies them to the current thread aspect. 
    133  *  Functors for registered types are called, if they occure in the 
     110 *  Functors for registered types are called, if they occur in the 
    134111 *  sync stream. 
    135112 *  
     
    209186                if(localTypeI == _localType.end()) 
    210187                { 
    211                     SWARNING << "Unknown TypeID: "  
     188                    SWARNING << "RemoteAspect::receiveSync: Unknown TypeID: "  
    212189                             << remoteTypeId  
    213190                             << " for remote id "  
     
    238215                    else 
    239216                    { 
    240                         FDEBUG(("FC already created %d\n",remoteId)); 
     217                        FWARNING(("RemoteAspect::receiveSync: FC already " 
     218                                  "created %d\n",remoteId)); 
    241219                    } 
    242220                } 
     
    250228                connection.getValue(len); 
    251229                 
    252                 if(getLocalId(remoteId,localId)) 
     230                if(getLocalId(remoteId, localId)) 
    253231                { 
    254232                    fcPtr = factory->getContainer(localId); 
     
    257235 
    258236                    callChanged(fcPtr); 
    259  
    260237                } 
    261238                else 
     
    263240                    char dummy; 
    264241 
    265                     SWARNING << "Can't change unknown FC:"  
     242                    SWARNING << "RemoteAspect::receiveSync: " 
     243                             << "Can't change unknown FC: "  
    266244                             << remoteId 
    267                              << " skip "  
     245                             << " skiping "  
    268246                             << len 
    269247                             << " bytes."  
     
    282260            } 
    283261 
    284             case ADDREFED: 
     262            case ADDEXTERNALREFED: 
    285263            { 
    286264                connection.getValue(remoteId); 
     
    290268                    fcPtr = factory->getContainer(localId); 
    291269 
    292                     FDEBUG(("AddRef: %s ID:%d\n",  
     270                    FDEBUG(("RemoteAspect::receiveSync: AddExternalRef: %s ID:%d\n",  
    293271                            fcPtr->getType().getName().str(), 
    294272                            getContainerId(fcPtr))); 
    295273 
    296                     addRef(fcPtr); 
     274                    fcPtr->addExternalReference(); 
    297275                } 
    298276                else 
    299277                { 
    300                     FDEBUG(("Can't addref unknown FC:%d\n", remoteId)); 
     278                    FWARNING(("RemoteAspect::receiveSync: Can't addref unknown " 
     279                              "FC:%d\n", remoteId)); 
    301280                } 
    302281                break; 
    303282            } 
    304283 
    305             case SUBREFED: 
     284            case SUBEXTERNALREFED: 
    306285            { 
    307286                connection.getValue(remoteId); 
     
    311290                    fcPtr = factory->getContainer(localId); 
    312291 
    313                     FDEBUG(("SubRef: %s ID:%d\n",  
     292                    FDEBUG(("RemoteAspect::receiveSync: SubExternalRef: %s ID:%d\n",  
    314293                            fcPtr->getType().getName().str(), 
    315294                            getContainerId(fcPtr))); 
    316295                     
    317                     subRef(fcPtr); 
     296                    fcPtr->subExternalReference(); 
    318297                } 
    319298                else 
    320299                { 
    321                     FDEBUG(("Can't subref unknown FC:%d\n", remoteId)); 
     300                    FWARNING(("RemoteAspect::receiveSync: Can't subref unknown " 
     301                              "FC:%d\n", remoteId)); 
    322302                } 
    323303                break; 
     
    332312                if(localAspect != _aspectId) 
    333313                { 
    334                     SFATAL << "ID mapping for wrong aspect" << std::endl; 
     314                    SFATAL << "RemoteAspect::receiveSync: " 
     315                           << "ID mapping for wrong aspect" << endLog; 
    335316                } 
    336317                 
     
    344325            default: 
    345326            { 
    346                 SFATAL << "Unknown tag:" << (int) cmd << std::endl
     327                SFATAL << "Unknown tag:" << (int) cmd << endLog
    347328                throw RemoteSyncError(); 
    348329            } 
     
    373354 *  of local states. e.g. GL variables.  
    374355 */ 
    375  
    376356void RemoteAspect::sendSync(Connection &connection, ChangeList *changeList) 
    377357{ 
     
    507487            } 
    508488        } 
    509         else if((*changedI)->uiEntryDesc == ContainerChangeEntry::AddReference) 
     489        else if((*changedI)->uiEntryDesc == ContainerChangeEntry::AddExternalReference) 
    510490        { 
    511491            UInt32  id = (*changedI)->uiContainerId; 
     
    514494                continue; 
    515495 
    516             cmd = ADDREFED; 
     496            cmd = ADDEXTERNALREFED; 
    517497            connection.putValue(cmd); 
    518498            connection.putValue(id); 
    519499        }    
    520         else if((*changedI)->uiEntryDesc == ContainerChangeEntry::SubReference) 
     500        else if((*changedI)->uiEntryDesc == ContainerChangeEntry::SubExternalReference) 
    521501        { 
    522502            UInt32  id = (*changedI)->uiContainerId; 
    523503             
    524             // ignore addrefs for unknown fcs 
    525             if(_mappedFC.count(id)==0) 
     504            // ignore subrefs for unknown fcs 
     505            if(_mappedFC.count(id) == 0) 
    526506                continue; 
    527507 
    528             cmd = SUBREFED; 
     508            cmd = SUBEXTERNALREFED; 
    529509            connection.putValue(cmd); 
    530510            connection.putValue(id); 
     
    707687        ++remoteFCI) 
    708688    { 
    709         remoteId     = (UInt32)(remoteFCI->second); 
    710         remoteAspect = (UInt32)(remoteFCI->second>>32); 
     689        remoteId     = (UInt32)(remoteFCI->second      ); 
     690        remoteAspect = (UInt32)(remoteFCI->second >> 32); 
    711691 
    712692        cmd = IDMAPPING; 
     
    726706 */ 
    727707 
    728 void RemoteAspect::clearFCMapping(UInt32 localId,UInt32 remoteId) 
     708void RemoteAspect::clearFCMapping(UInt32 localId, UInt32 remoteId) 
    729709{ 
    730710    _mappedFC.erase(localId); 
     
    763743    if( localFCI != _localFC.end() ) 
    764744    { 
    765         localId=localFCI->second; 
     745        localId = localFCI->second; 
    766746        return true; 
    767747    }