Show
Ignore:
Timestamp:
12/12/07 18:00:42 (10 months ago)
Author:
cneumann
Message:

added: generic interface
changed: factory functions return RefPtr?

The unittests don't pass right now, because of the change
to the factory functions, which leads to containers
being immediately destroyed as they are not assigned to
a RefPtr?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Carsten_PtrWork2/Source/System/FieldContainer/Attachments/OSGStringAttributeMapBase.cpp

    r1020 r1032  
    9292*/ 
    9393 
    94  
     94     
    9595void StringAttributeMapBase::classDescInserter(TypeObject &oType) 
    9696{ 
    9797    FieldDescriptionBase *pDesc = NULL; 
    98  
    9998 
    10099    pDesc = new MFString::Description( 
     
    102101        "keys", 
    103102        "", 
    104         KeysFieldId, KeysFieldMask, 
     103        KeysFieldId, 
     104        KeysFieldMask, 
    105105        false, 
    106106        Field::MFDefaultFlags, 
    107107        static_cast<FieldEditMethodSig>(&StringAttributeMapBase::editHandleKeys), 
    108         static_cast<FieldGetMethodSig >(&StringAttributeMapBase::getHandleKeys)); 
    109  
    110     oType.addInitialDesc(pDesc); 
    111  
     108        static_cast<FieldGetMethodSig >(&StringAttributeMapBase::getHandleKeys ) ); 
     109         
     110        oType.addInitialDesc(pDesc); 
     111         
     112         
    112113    pDesc = new MFString::Description( 
    113114        MFString::getClassType(), 
    114115        "values", 
    115116        "", 
    116         ValuesFieldId, ValuesFieldMask, 
     117        ValuesFieldId, 
     118        ValuesFieldMask, 
    117119        false, 
    118120        Field::MFDefaultFlags, 
    119121        static_cast<FieldEditMethodSig>(&StringAttributeMapBase::editHandleValues), 
    120         static_cast<FieldGetMethodSig >(&StringAttributeMapBase::getHandleValues)); 
    121  
    122     oType.addInitialDesc(pDesc); 
    123 
    124  
     122        static_cast<FieldGetMethodSig >(&StringAttributeMapBase::getHandleValues ) ); 
     123         
     124        oType.addInitialDesc(pDesc); 
     125         
     126         
     127
    125128 
    126129StringAttributeMapBase::TypeObject StringAttributeMapBase::_type( 
     
    173176    "whatever ways are appropriate.\n" 
    174177    ); 
    175  
     178     
    176179/*------------------------------ get -----------------------------------*/ 
    177180 
     
    249252 
    250253//! create a new instance of the class 
    251 StringAttributeMapPtr StringAttributeMapBase::create(void) 
    252 
    253     StringAttributeMapPtr fc; 
     254StringAttributeMapBase::ObjRefPtr 
     255StringAttributeMapBase::create(void) 
     256
     257    ObjRefPtr pFC; 
    254258 
    255259    if(getClassType().getPrototype() != NullFC) 
    256260    { 
    257         fc = dynamic_cast<StringAttributeMap::ObjPtr>( 
    258             getClassType().getPrototype()-> shallowCopy()); 
    259     } 
    260  
    261     return fc
     261        pFC = boost::dynamic_pointer_cast<StringAttributeMap>( 
     262            getClassType().getPrototype()->shallowCopy()); 
     263    } 
     264 
     265    return pFC
    262266} 
    263267 
     
    272276} 
    273277 
    274 FieldContainerPtr StringAttributeMapBase::shallowCopy(void) const 
    275 
    276     StringAttributeMapPtr returnValue; 
     278FieldContainerRefPtr 
     279StringAttributeMapBase::shallowCopy(void) const 
     280
     281    ObjPtr returnValue; 
    277282 
    278283    newPtr(returnValue, dynamic_cast<const StringAttributeMap *>(this)); 
    279284 
    280     return returnValue
     285    return FieldContainerRefPtr(returnValue)
    281286} 
    282287