Show
Ignore:
Timestamp:
04/02/08 14:18:07 (8 months ago)
Author:
cneumann
Message:

replaced pointer field implementation
split FieldContainer/Fields? directory into Base and Handle subdir

Status: - ref counting seems to work (mt, cluster)

  • new OSB loader works (well, the unittest does)
  • VRML loader is deactivated
  • get/edit handle for dynamic (pointer) fields missing
  • need to remove some more old files - they get moved in this commit
  • generated (i.e. base) code in following commit
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Carsten_PtrWork2/Source/System/FieldContainer/Base/OSGFieldContainerAttachment.cpp

    r1032 r1072  
    180180} 
    181181 
     182/*-------------------------------------------------------------------------*/ 
     183/*  Child Linking                                                          */ 
     184 
    182185bool 
    183186FieldContainerAttachment::linkParent( 
    184     ReflexiveContainer * const pParent, 
    185     UInt16               const childrenFieldId, 
    186     UInt16               const parentFieldId   ) 
    187 
    188     bool retVal = Inherited::linkParent(pParent, childrenFieldId, parentFieldId); 
    189  
     187    FieldContainerPtrConst pParent, 
     188    UInt16 const           childFieldId, 
     189    UInt16 const           parentFieldId   ) 
     190
    190191    if(parentFieldId == ParentsFieldId) 
    191192    { 
    192         FieldContainerParentPtr pTypedParent( 
    193             dynamic_cast<FieldContainerParentPtr::Object *>(pParent), 
    194             childrenFieldId                                          ); 
    195                  
    196         if(pTypedParent.getPointer() != NullFC) 
     193        FieldContainerPtr pTypedParent = 
     194             dynamic_cast< FieldContainerPtr >(pParent); 
     195         
     196        if(pTypedParent != NullFC) 
    197197        { 
    198             _mfParents.push_back(pTypedParent); 
     198            editMField(ParentsFieldMask, _mfParents); 
     199            _mfParents.ptrStoreAppend(pParent     ); 
     200            _mfParents.idStoreAppend (childFieldId); 
     201             
     202            return true; 
    199203        } 
    200         else 
    201         { 
    202             retVal = false; 
    203         } 
    204     } 
    205      
    206     return retVal; 
     204     
     205        return false; 
     206    } 
     207     
     208    return Inherited::linkParent(pParent, childFieldId, parentFieldId); 
    207209} 
    208210 
    209211bool 
    210 FieldContainerAttachment::unlinkParent( 
    211     ReflexiveContainer * const pParent, 
    212     UInt16               const childrenFieldId, 
    213     UInt16               const parentFieldId   ) 
    214 
    215     bool retVal = Inherited::unlinkParent(pParent, childrenFieldId, parentFieldId); 
    216      
     212    FieldContainerAttachment::unlinkParent( 
     213        FieldContainerPtrConst pParent, 
     214        UInt16 const           parentFieldId   ) 
     215
    217216    if(parentFieldId == ParentsFieldId) 
    218217    { 
    219         FieldContainerParentPtr pTypedParent( 
    220             dynamic_cast<FieldContainerParentPtr::Object *>(pParent), 
    221             childrenFieldId                                          ); 
     218        FieldContainerPtr pTypedParent = 
     219            dynamic_cast< FieldContainerPtr >(pParent); 
    222220             
    223221        if(pTypedParent != NullFC) 
    224222        { 
    225             MFFieldContainerParentPtr::iterator pI = 
    226                  _mfParents.find(pTypedParent); 
    227                   
    228             if(pI != _mfParents.end()) 
     223            Int32 index = _mfParents.ptrStoreFindIndex(pParent); 
     224                 
     225            if(index != -1) 
    229226            { 
    230                 _mfParents.erase(pI); 
     227                editMField(ParentsFieldMask, _mfParents); 
     228                 
     229                _mfParents.ptrStoreErase(index); 
     230                _mfParents.idStoreErase (index); 
     231                 
     232                return true; 
    231233            } 
     234              
     235            FWARNING(("FieldContainerAttachment::unlinkParent: Child <-> Parent link inconsistent.\n")); 
     236             
     237            return false; 
    232238        } 
    233         else 
    234         { 
    235             retVal = false; 
    236         } 
    237     } 
    238      
    239     return retVal; 
     239 
     240        return false; 
     241    } 
     242         
     243    return Inherited::unlinkParent(pParent, parentFieldId); 
    240244} 
    241245