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/Cluster/Window/Base/OSGClusterWindowBase.cpp

    r1020 r1032  
    136136*/ 
    137137 
    138  
     138     
    139139void ClusterWindowBase::classDescInserter(TypeObject &oType) 
    140140{ 
    141141    FieldDescriptionBase *pDesc = NULL; 
    142  
    143142 
    144143    pDesc = new MFString::Description( 
     
    146145        "servers", 
    147146        "List of all symbolic server names\n", 
    148         ServersFieldId, ServersFieldMask, 
     147        ServersFieldId, 
     148        ServersFieldMask, 
    149149        false, 
    150150        Field::MFDefaultFlags, 
    151151        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleServers), 
    152         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleServers)); 
    153  
    154     oType.addInitialDesc(pDesc); 
    155  
     152        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleServers ) ); 
     153         
     154        oType.addInitialDesc(pDesc); 
     155         
     156         
    156157    pDesc = new SFString::Description( 
    157158        SFString::getClassType(), 
    158159        "connectionType", 
    159160        "How to connect to the servers\n", 
    160         ConnectionTypeFieldId, ConnectionTypeFieldMask, 
     161        ConnectionTypeFieldId, 
     162        ConnectionTypeFieldMask, 
    161163        false, 
    162164        Field::SFDefaultFlags, 
    163165        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleConnectionType), 
    164         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleConnectionType)); 
    165  
    166     oType.addInitialDesc(pDesc); 
    167  
     166        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleConnectionType ) ); 
     167         
     168        oType.addInitialDesc(pDesc); 
     169         
     170         
    168171    pDesc = new SFString::Description( 
    169172        SFString::getClassType(), 
    170173        "connectionInterface", 
    171174        "Which network interface to use for communication\n", 
    172         ConnectionInterfaceFieldId, ConnectionInterfaceFieldMask, 
     175        ConnectionInterfaceFieldId, 
     176        ConnectionInterfaceFieldMask, 
    173177        false, 
    174178        Field::SFDefaultFlags, 
    175179        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleConnectionInterface), 
    176         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleConnectionInterface)); 
    177  
    178     oType.addInitialDesc(pDesc); 
    179  
     180        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleConnectionInterface ) ); 
     181         
     182        oType.addInitialDesc(pDesc); 
     183         
     184         
    180185    pDesc = new SFString::Description( 
    181186        SFString::getClassType(), 
    182187        "connectionDestination", 
    183188        "Multicast address for multicast connections\n", 
    184         ConnectionDestinationFieldId, ConnectionDestinationFieldMask, 
     189        ConnectionDestinationFieldId, 
     190        ConnectionDestinationFieldMask, 
    185191        false, 
    186192        Field::SFDefaultFlags, 
    187193        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleConnectionDestination), 
    188         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleConnectionDestination)); 
    189  
    190     oType.addInitialDesc(pDesc); 
    191  
     194        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleConnectionDestination ) ); 
     195         
     196        oType.addInitialDesc(pDesc); 
     197         
     198         
    192199    pDesc = new SFString::Description( 
    193200        SFString::getClassType(), 
    194201        "connectionParams", 
    195202        "Optional parameters e.g. \"TTL=2\"\n", 
    196         ConnectionParamsFieldId, ConnectionParamsFieldMask, 
     203        ConnectionParamsFieldId, 
     204        ConnectionParamsFieldMask, 
    197205        false, 
    198206        Field::SFDefaultFlags, 
    199207        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleConnectionParams), 
    200         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleConnectionParams)); 
    201  
    202     oType.addInitialDesc(pDesc); 
    203  
     208        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleConnectionParams ) ); 
     209         
     210        oType.addInitialDesc(pDesc); 
     211         
     212         
    204213    pDesc = new SFUInt32::Description( 
    205214        SFUInt32::getClassType(), 
    206215        "servicePort", 
    207216        "Broadcastport used for server search\n", 
    208         ServicePortFieldId, ServicePortFieldMask, 
     217        ServicePortFieldId, 
     218        ServicePortFieldMask, 
    209219        false, 
    210220        Field::SFDefaultFlags, 
    211221        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleServicePort), 
    212         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleServicePort)); 
    213  
    214     oType.addInitialDesc(pDesc); 
    215  
     222        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleServicePort ) ); 
     223         
     224        oType.addInitialDesc(pDesc); 
     225         
     226         
    216227    pDesc = new SFString::Description( 
    217228        SFString::getClassType(), 
    218229        "serviceAddress", 
    219230        "Broadcast or Multicast address used for server search\n", 
    220         ServiceAddressFieldId, ServiceAddressFieldMask, 
     231        ServiceAddressFieldId, 
     232        ServiceAddressFieldMask, 
    221233        false, 
    222234        Field::SFDefaultFlags, 
    223235        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleServiceAddress), 
    224         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleServiceAddress)); 
    225  
    226     oType.addInitialDesc(pDesc); 
    227  
     236        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleServiceAddress ) ); 
     237         
     238        oType.addInitialDesc(pDesc); 
     239         
     240         
    228241    pDesc = new SFString::Description( 
    229242        SFString::getClassType(), 
    230243        "serviceInterface", 
    231244        "Ethernet interface to be used for server search\n", 
    232         ServiceInterfaceFieldId, ServiceInterfaceFieldMask, 
     245        ServiceInterfaceFieldId, 
     246        ServiceInterfaceFieldMask, 
    233247        false, 
    234248        Field::SFDefaultFlags, 
    235249        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleServiceInterface), 
    236         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleServiceInterface)); 
    237  
    238     oType.addInitialDesc(pDesc); 
    239  
     250        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleServiceInterface ) ); 
     251         
     252        oType.addInitialDesc(pDesc); 
     253         
     254         
    240255    pDesc = new SFWindowInternalPtr::Description( 
    241256        SFWindowInternalPtr::getClassType(), 
    242257        "clientWindow", 
    243258        "Window for client rendering\n", 
    244         ClientWindowFieldId, ClientWindowFieldMask, 
     259        ClientWindowFieldId, 
     260        ClientWindowFieldMask, 
    245261        false, 
    246262        Field::SFDefaultFlags, 
    247263        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleClientWindow), 
    248         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleClientWindow)); 
    249  
    250     oType.addInitialDesc(pDesc); 
    251  
     264        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleClientWindow ) ); 
     265         
     266        oType.addInitialDesc(pDesc); 
     267         
     268         
    252269    pDesc = new SFUInt32::Description( 
    253270        SFUInt32::getClassType(), 
    254271        "interleave", 
    255272        "", 
    256         InterleaveFieldId, InterleaveFieldMask, 
     273        InterleaveFieldId, 
     274        InterleaveFieldMask, 
    257275        false, 
    258276        Field::SFDefaultFlags, 
    259277        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleInterleave), 
    260         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleInterleave)); 
    261  
    262     oType.addInitialDesc(pDesc); 
    263  
     278        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleInterleave ) ); 
     279         
     280        oType.addInitialDesc(pDesc); 
     281         
     282         
    264283    pDesc = new SFUInt32::Description( 
    265284        SFUInt32::getClassType(), 
    266285        "frameCount", 
    267286        "", 
    268         FrameCountFieldId, FrameCountFieldMask, 
     287        FrameCountFieldId, 
     288        FrameCountFieldMask, 
    269289        false, 
    270290        Field::SFDefaultFlags, 
    271291        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleFrameCount), 
    272         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleFrameCount)); 
    273  
    274     oType.addInitialDesc(pDesc); 
    275  
     292        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleFrameCount ) ); 
     293         
     294        oType.addInitialDesc(pDesc); 
     295         
     296         
    276297    pDesc = new SFImageComposerInternalPtr::Description( 
    277298        SFImageComposerInternalPtr::getClassType(), 
    278299        "composer", 
    279300        "", 
    280         ComposerFieldId, ComposerFieldMask, 
     301        ComposerFieldId, 
     302        ComposerFieldMask, 
    281303        false, 
    282304        Field::SFDefaultFlags, 
    283305        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleComposer), 
    284         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleComposer)); 
    285  
    286     oType.addInitialDesc(pDesc); 
    287  
     306        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleComposer ) ); 
     307         
     308        oType.addInitialDesc(pDesc); 
     309         
     310         
    288311    pDesc = new MFString::Description( 
    289312        MFString::getClassType(), 
    290313        "autostart", 
    291314        "", 
    292         AutostartFieldId, AutostartFieldMask, 
     315        AutostartFieldId, 
     316        AutostartFieldMask, 
    293317        false, 
    294318        Field::MFDefaultFlags, 
    295319        static_cast<FieldEditMethodSig>(&ClusterWindowBase::editHandleAutostart), 
    296         static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleAutostart)); 
    297  
    298     oType.addInitialDesc(pDesc); 
    299 
    300  
     320        static_cast<FieldGetMethodSig >(&ClusterWindowBase::getHandleAutostart ) ); 
     321         
     322        oType.addInitialDesc(pDesc); 
     323         
     324         
     325
    301326 
    302327ClusterWindowBase::TypeObject ClusterWindowBase::_type( 
     
    483508    "The base class for all windows.\n" 
    484509    ); 
    485  
     510     
    486511/*------------------------------ get -----------------------------------*/ 
    487512 
     
    691716 
    692717//! create a new instance of the class 
    693 ClusterWindowPtr ClusterWindowBase::create(void) 
    694 
    695     ClusterWindowPtr fc; 
     718ClusterWindowBase::ObjRefPtr 
     719ClusterWindowBase::create(void) 
     720
     721    ObjRefPtr pFC; 
    696722 
    697723    if(getClassType().getPrototype() != NullFC) 
    698724    { 
    699         fc = dynamic_cast<ClusterWindow::ObjPtr>( 
    700             getClassType().getPrototype()-> shallowCopy()); 
    701     } 
    702  
    703     return fc
     725        pFC = boost::dynamic_pointer_cast<ClusterWindow>( 
     726            getClassType().getPrototype()->shallowCopy()); 
     727    } 
     728 
     729    return pFC
    704730} 
    705731 
     
    714740} 
    715741 
    716 FieldContainerPtr ClusterWindowBase::shallowCopy(void) const 
    717 
    718     ClusterWindowPtr returnValue; 
     742FieldContainerRefPtr 
     743ClusterWindowBase::shallowCopy(void) const 
     744
     745    ObjPtr returnValue; 
    719746 
    720747    newPtr(returnValue, dynamic_cast<const ClusterWindow *>(this)); 
    721748 
    722     return returnValue
     749    return FieldContainerRefPtr(returnValue)
    723750} 
    724751 
     
    777804    { 
    778805        this->setClientWindow(source->getClientWindow()); 
     806         
    779807        this->setComposer(source->getComposer()); 
     808         
    780809    } 
    781810} 
     
    9741003             this->getType().getFieldDesc(ClientWindowFieldId))); 
    9751004 
    976 //    returnValue->setSetMethod(boost::bind(&ClusterWindow::setClientWindow,  
    977 //                                          static_cast<ClusterWindow *>(this), _1)); 
     1005    returnValue->setSetFunc( 
     1006        boost::bind( 
     1007            &ClusterWindow::setClientWindow, 
     1008            static_cast<ClusterWindow *>(this), _1)); 
    9781009 
    9791010    editSField(ClientWindowFieldMask); 
     
    10431074             this->getType().getFieldDesc(ComposerFieldId))); 
    10441075 
    1045 //    returnValue->setSetMethod(boost::bind(&ClusterWindow::setComposer,  
    1046 //                                          static_cast<ClusterWindow *>(this), _1)); 
     1076    returnValue->setSetFunc( 
     1077        boost::bind( 
     1078            &ClusterWindow::setComposer, 
     1079            static_cast<ClusterWindow *>(this), _1)); 
    10471080 
    10481081    editSField(ComposerFieldMask);