Show
Ignore:
Timestamp:
12/12/07 18:00:42 (9 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/Cluster/Window/BalancedMultiWindow/OSGBalancedMultiWindowBase.cpp

    r1020 r1032  
    102102*/ 
    103103 
    104  
     104     
    105105void BalancedMultiWindowBase::classDescInserter(TypeObject &oType) 
    106106{ 
    107107    FieldDescriptionBase *pDesc = NULL; 
    108  
    109108 
    110109    pDesc = new SFBool::Description( 
     
    112111        "balance", 
    113112        "If true load balancing is eanbled. If falst it behaves like a MultiDisplayWindow\n", 
    114         BalanceFieldId, BalanceFieldMask, 
     113        BalanceFieldId, 
     114        BalanceFieldMask, 
    115115        false, 
    116116        Field::SFDefaultFlags, 
    117117        static_cast<FieldEditMethodSig>(&BalancedMultiWindowBase::editHandleBalance), 
    118         static_cast<FieldGetMethodSig >(&BalancedMultiWindowBase::getHandleBalance)); 
    119  
    120     oType.addInitialDesc(pDesc); 
    121  
     118        static_cast<FieldGetMethodSig >(&BalancedMultiWindowBase::getHandleBalance ) ); 
     119         
     120        oType.addInitialDesc(pDesc); 
     121         
     122         
    122123    pDesc = new SFBool::Description( 
    123124        SFBool::getClassType(), 
    124125        "bestCut", 
    125126        "If true horizontal and vertical cuts are testet. Otherwise the longes side of a viewport is split.\n", 
    126         BestCutFieldId, BestCutFieldMask, 
     127        BestCutFieldId, 
     128        BestCutFieldMask, 
    127129        false, 
    128130        Field::SFDefaultFlags, 
    129131        static_cast<FieldEditMethodSig>(&BalancedMultiWindowBase::editHandleBestCut), 
    130         static_cast<FieldGetMethodSig >(&BalancedMultiWindowBase::getHandleBestCut)); 
    131  
    132     oType.addInitialDesc(pDesc); 
    133  
     132        static_cast<FieldGetMethodSig >(&BalancedMultiWindowBase::getHandleBestCut ) ); 
     133         
     134        oType.addInitialDesc(pDesc); 
     135         
     136         
    134137    pDesc = new SFBool::Description( 
    135138        SFBool::getClassType(), 
    136139        "showBalancing", 
    137140        "Mark regions rendered by other hosts\n", 
    138         ShowBalancingFieldId, ShowBalancingFieldMask, 
     141        ShowBalancingFieldId, 
     142        ShowBalancingFieldMask, 
    139143        false, 
    140144        Field::SFDefaultFlags, 
    141145        static_cast<FieldEditMethodSig>(&BalancedMultiWindowBase::editHandleShowBalancing), 
    142         static_cast<FieldGetMethodSig >(&BalancedMultiWindowBase::getHandleShowBalancing)); 
    143  
    144     oType.addInitialDesc(pDesc); 
    145  
     146        static_cast<FieldGetMethodSig >(&BalancedMultiWindowBase::getHandleShowBalancing ) ); 
     147         
     148        oType.addInitialDesc(pDesc); 
     149         
     150         
    146151    pDesc = new SFUInt32::Description( 
    147152        SFUInt32::getClassType(), 
    148153        "tileSize", 
    149154        "", 
    150         TileSizeFieldId, TileSizeFieldMask, 
     155        TileSizeFieldId, 
     156        TileSizeFieldMask, 
    151157        false, 
    152158        Field::SFDefaultFlags, 
    153159        static_cast<FieldEditMethodSig>(&BalancedMultiWindowBase::editHandleTileSize), 
    154         static_cast<FieldGetMethodSig >(&BalancedMultiWindowBase::getHandleTileSize)); 
    155  
    156     oType.addInitialDesc(pDesc); 
    157  
     160        static_cast<FieldGetMethodSig >(&BalancedMultiWindowBase::getHandleTileSize ) ); 
     161         
     162        oType.addInitialDesc(pDesc); 
     163         
     164         
    158165    pDesc = new SFBool::Description( 
    159166        SFBool::getClassType(), 
    160167        "short", 
    161168        "", 
    162         ShortFieldId, ShortFieldMask, 
     169        ShortFieldId, 
     170        ShortFieldMask, 
    163171        false, 
    164172        Field::SFDefaultFlags, 
    165173        static_cast<FieldEditMethodSig>(&BalancedMultiWindowBase::editHandleShort), 
    166         static_cast<FieldGetMethodSig >(&BalancedMultiWindowBase::getHandleShort)); 
    167  
    168     oType.addInitialDesc(pDesc); 
    169 
    170  
     174        static_cast<FieldGetMethodSig >(&BalancedMultiWindowBase::getHandleShort ) ); 
     175         
     176        oType.addInitialDesc(pDesc); 
     177         
     178         
     179
    171180 
    172181BalancedMultiWindowBase::TypeObject BalancedMultiWindowBase::_type( 
     
    245254    "Load balanced sort first rendering for multiple windows\n" 
    246255    ); 
    247  
     256     
    248257/*------------------------------ get -----------------------------------*/ 
    249258 
     
    353362 
    354363//! create a new instance of the class 
    355 BalancedMultiWindowPtr BalancedMultiWindowBase::create(void) 
    356 
    357     BalancedMultiWindowPtr fc; 
     364BalancedMultiWindowBase::ObjRefPtr 
     365BalancedMultiWindowBase::create(void) 
     366
     367    ObjRefPtr pFC; 
    358368 
    359369    if(getClassType().getPrototype() != NullFC) 
    360370    { 
    361         fc = dynamic_cast<BalancedMultiWindow::ObjPtr>( 
    362             getClassType().getPrototype()-> shallowCopy()); 
    363     } 
    364  
    365     return fc
     371        pFC = boost::dynamic_pointer_cast<BalancedMultiWindow>( 
     372            getClassType().getPrototype()->shallowCopy()); 
     373    } 
     374 
     375    return pFC
    366376} 
    367377 
     
    376386} 
    377387 
    378 FieldContainerPtr BalancedMultiWindowBase::shallowCopy(void) const 
    379 
    380     BalancedMultiWindowPtr returnValue; 
     388FieldContainerRefPtr 
     389BalancedMultiWindowBase::shallowCopy(void) const 
     390
     391    ObjPtr returnValue; 
    381392 
    382393    newPtr(returnValue, dynamic_cast<const BalancedMultiWindow *>(this)); 
    383394 
    384     return returnValue
     395    return FieldContainerRefPtr(returnValue)
    385396} 
    386397