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/Contrib/Manipulators/OSGManipulatorBase.cpp

    r1020 r1032  
    159159*/ 
    160160 
    161  
     161     
    162162void ManipulatorBase::classDescInserter(TypeObject &oType) 
    163163{ 
    164164    FieldDescriptionBase *pDesc = NULL; 
    165  
    166165 
    167166    pDesc = new SFNodeInternalPtr::Description( 
     
    169168        "target", 
    170169        "", 
    171         TargetFieldId, TargetFieldMask, 
     170        TargetFieldId, 
     171        TargetFieldMask, 
    172172        false, 
    173173        Field::SFDefaultFlags, 
    174174        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleTarget), 
    175         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleTarget)); 
    176  
    177     oType.addInitialDesc(pDesc); 
    178  
     175        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleTarget ) ); 
     176         
     177        oType.addInitialDesc(pDesc); 
     178         
     179         
    179180    pDesc = new SFNodeInternalPtr::Description( 
    180181        SFNodeInternalPtr::getClassType(), 
    181182        "activeSubHandle", 
    182183        "the active sub handle\n", 
    183         ActiveSubHandleFieldId, ActiveSubHandleFieldMask, 
     184        ActiveSubHandleFieldId, 
     185        ActiveSubHandleFieldMask, 
    184186        true, 
    185187        Field::SFDefaultFlags, 
    186188        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleActiveSubHandle), 
    187         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleActiveSubHandle)); 
    188  
    189     oType.addInitialDesc(pDesc); 
    190  
     189        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleActiveSubHandle ) ); 
     190         
     191        oType.addInitialDesc(pDesc); 
     192         
     193         
    191194    pDesc = new SFPnt2f::Description( 
    192195        SFPnt2f::getClassType(), 
    193196        "lastMousePos", 
    194197        "Last mouse position (in pixel, although 2f is used!)\n", 
    195         LastMousePosFieldId, LastMousePosFieldMask, 
     198        LastMousePosFieldId, 
     199        LastMousePosFieldMask, 
    196200        false, 
    197201        Field::SFDefaultFlags, 
    198202        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleLastMousePos), 
    199         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleLastMousePos)); 
    200  
    201     oType.addInitialDesc(pDesc); 
    202  
     203        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleLastMousePos ) ); 
     204         
     205        oType.addInitialDesc(pDesc); 
     206         
     207         
    203208    pDesc = new SFViewportInternalPtr::Description( 
    204209        SFViewportInternalPtr::getClassType(), 
    205210        "viewport", 
    206211        "", 
    207         ViewportFieldId, ViewportFieldMask, 
     212        ViewportFieldId, 
     213        ViewportFieldMask, 
    208214        true, 
    209215        Field::SFDefaultFlags, 
    210216        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleViewport), 
    211         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleViewport)); 
    212  
    213     oType.addInitialDesc(pDesc); 
    214  
     217        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleViewport ) ); 
     218         
     219        oType.addInitialDesc(pDesc); 
     220         
     221         
    215222    pDesc = new SFBool::Description( 
    216223        SFBool::getClassType(), 
    217224        "active", 
    218225        "", 
    219         ActiveFieldId, ActiveFieldMask, 
     226        ActiveFieldId, 
     227        ActiveFieldMask, 
    220228        false, 
    221229        Field::SFDefaultFlags, 
    222230        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleActive), 
    223         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleActive)); 
    224  
    225     oType.addInitialDesc(pDesc); 
    226  
     231        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleActive ) ); 
     232         
     233        oType.addInitialDesc(pDesc); 
     234         
     235         
    227236    pDesc = new SFVec3f::Description( 
    228237        SFVec3f::getClassType(), 
    229238        "length", 
    230239        "The length of the three axes in one vector\n", 
    231         LengthFieldId, LengthFieldMask, 
     240        LengthFieldId, 
     241        LengthFieldMask, 
    232242        false, 
    233243        Field::SFDefaultFlags, 
    234244        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleLength), 
    235         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleLength)); 
    236  
    237     oType.addInitialDesc(pDesc); 
    238  
     245        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleLength ) ); 
     246         
     247        oType.addInitialDesc(pDesc); 
     248         
     249         
    239250    pDesc = new SFNodeInternalPtr::Description( 
    240251        SFNodeInternalPtr::getClassType(), 
    241252        "handleXNode", 
    242253        "The node for the x-handle geometry\n", 
    243         HandleXNodeFieldId, HandleXNodeFieldMask, 
     254        HandleXNodeFieldId, 
     255        HandleXNodeFieldMask, 
    244256        true, 
    245257        Field::SFDefaultFlags, 
    246258        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleHandleXNode), 
    247         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleHandleXNode)); 
    248  
    249     oType.addInitialDesc(pDesc); 
    250  
     259        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleHandleXNode ) ); 
     260         
     261        oType.addInitialDesc(pDesc); 
     262         
     263         
    251264    pDesc = new SFNodeInternalPtr::Description( 
    252265        SFNodeInternalPtr::getClassType(), 
    253266        "handleYNode", 
    254267        "The node for the y-handle geometry\n", 
    255         HandleYNodeFieldId, HandleYNodeFieldMask, 
     268        HandleYNodeFieldId, 
     269        HandleYNodeFieldMask, 
    256270        true, 
    257271        Field::SFDefaultFlags, 
    258272        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleHandleYNode), 
    259         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleHandleYNode)); 
    260  
    261     oType.addInitialDesc(pDesc); 
    262  
     273        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleHandleYNode ) ); 
     274         
     275        oType.addInitialDesc(pDesc); 
     276         
     277         
    263278    pDesc = new SFNodeInternalPtr::Description( 
    264279        SFNodeInternalPtr::getClassType(), 
    265280        "handleZNode", 
    266281        "The node for the z-handle geometry\n", 
    267         HandleZNodeFieldId, HandleZNodeFieldMask, 
     282        HandleZNodeFieldId, 
     283        HandleZNodeFieldMask, 
    268284        true, 
    269285        Field::SFDefaultFlags, 
    270286        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleHandleZNode), 
    271         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleHandleZNode)); 
    272  
    273     oType.addInitialDesc(pDesc); 
    274  
     287        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleHandleZNode ) ); 
     288         
     289        oType.addInitialDesc(pDesc); 
     290         
     291         
    275292    pDesc = new SFNodeInternalPtr::Description( 
    276293        SFNodeInternalPtr::getClassType(), 
    277294        "transXNode", 
    278295        "The node for the x-handle transform\n", 
    279         TransXNodeFieldId, TransXNodeFieldMask, 
     296        TransXNodeFieldId, 
     297        TransXNodeFieldMask, 
    280298        true, 
    281299        Field::SFDefaultFlags, 
    282300        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleTransXNode), 
    283         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleTransXNode)); 
    284  
    285     oType.addInitialDesc(pDesc); 
    286  
     301        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleTransXNode ) ); 
     302         
     303        oType.addInitialDesc(pDesc); 
     304         
     305         
    287306    pDesc = new SFNodeInternalPtr::Description( 
    288307        SFNodeInternalPtr::getClassType(), 
    289308        "transYNode", 
    290309        "The node for the y-handle transform\n", 
    291         TransYNodeFieldId, TransYNodeFieldMask, 
     310        TransYNodeFieldId, 
     311        TransYNodeFieldMask, 
    292312        true, 
    293313        Field::SFDefaultFlags, 
    294314        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleTransYNode), 
    295         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleTransYNode)); 
    296  
    297     oType.addInitialDesc(pDesc); 
    298  
     315        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleTransYNode ) ); 
     316         
     317        oType.addInitialDesc(pDesc); 
     318         
     319         
    299320    pDesc = new SFNodeInternalPtr::Description( 
    300321        SFNodeInternalPtr::getClassType(), 
    301322        "transZNode", 
    302323        "The node for the z-handle transform\n", 
    303         TransZNodeFieldId, TransZNodeFieldMask, 
     324        TransZNodeFieldId, 
     325        TransZNodeFieldMask, 
    304326        true, 
    305327        Field::SFDefaultFlags, 
    306328        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleTransZNode), 
    307         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleTransZNode)); 
    308  
    309     oType.addInitialDesc(pDesc); 
    310  
     329        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleTransZNode ) ); 
     330         
     331        oType.addInitialDesc(pDesc); 
     332         
     333         
    311334    pDesc = new SFMaterialInternalPtr::Description( 
    312335        SFMaterialInternalPtr::getClassType(), 
    313336        "materialX", 
    314337        "material for the x-axis geometry\n", 
    315         MaterialXFieldId, MaterialXFieldMask, 
     338        MaterialXFieldId, 
     339        MaterialXFieldMask, 
    316340        true, 
    317341        Field::SFDefaultFlags, 
    318342        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleMaterialX), 
    319         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleMaterialX)); 
    320  
    321     oType.addInitialDesc(pDesc); 
    322  
     343        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleMaterialX ) ); 
     344         
     345        oType.addInitialDesc(pDesc); 
     346         
     347         
    323348    pDesc = new SFMaterialInternalPtr::Description( 
    324349        SFMaterialInternalPtr::getClassType(), 
    325350        "materialY", 
    326351        "material for the y-axis geometry\n", 
    327         MaterialYFieldId, MaterialYFieldMask, 
     352        MaterialYFieldId, 
     353        MaterialYFieldMask, 
    328354        true, 
    329355        Field::SFDefaultFlags, 
    330356        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleMaterialY), 
    331         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleMaterialY)); 
    332  
    333     oType.addInitialDesc(pDesc); 
    334  
     357        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleMaterialY ) ); 
     358         
     359        oType.addInitialDesc(pDesc); 
     360         
     361         
    335362    pDesc = new SFMaterialInternalPtr::Description( 
    336363        SFMaterialInternalPtr::getClassType(), 
    337364        "materialZ", 
    338365        "material for the z-axis geometry\n", 
    339         MaterialZFieldId, MaterialZFieldMask, 
     366        MaterialZFieldId, 
     367        MaterialZFieldMask, 
    340368        true, 
    341369        Field::SFDefaultFlags, 
    342370        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleMaterialZ), 
    343         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleMaterialZ)); 
    344  
    345     oType.addInitialDesc(pDesc); 
    346  
     371        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleMaterialZ ) ); 
     372         
     373        oType.addInitialDesc(pDesc); 
     374         
     375         
    347376    pDesc = new SFNodeInternalPtr::Description( 
    348377        SFNodeInternalPtr::getClassType(), 
    349378        "axisLinesN", 
    350379        "", 
    351         AxisLinesNFieldId, AxisLinesNFieldMask, 
     380        AxisLinesNFieldId, 
     381        AxisLinesNFieldMask, 
    352382        true, 
    353383        Field::SFDefaultFlags, 
    354384        static_cast<FieldEditMethodSig>(&ManipulatorBase::editHandleAxisLinesN), 
    355         static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleAxisLinesN)); 
    356  
    357     oType.addInitialDesc(pDesc); 
    358 
    359  
     385        static_cast<FieldGetMethodSig >(&ManipulatorBase::getHandleAxisLinesN ) ); 
     386         
     387        oType.addInitialDesc(pDesc); 
     388         
     389         
     390
    360391 
    361392ManipulatorBase::TypeObject ManipulatorBase::_type( 
     
    545576    "Baseclass for all Manipulators\n" 
    546577    ); 
    547  
     578     
    548579/*------------------------------ get -----------------------------------*/ 
    549580 
     
    844875    { 
    845876        this->setTarget(source->getTarget()); 
     877         
    846878        this->setActiveSubHandle(source->getActiveSubHandle()); 
     879         
    847880        this->setViewport(source->getViewport()); 
     881         
    848882        this->setHandleXNode(source->getHandleXNode()); 
     883         
    849884        this->setHandleYNode(source->getHandleYNode()); 
     885         
    850886        this->setHandleZNode(source->getHandleZNode()); 
     887         
    851888        this->setTransXNode(source->getTransXNode()); 
     889         
    852890        this->setTransYNode(source->getTransYNode()); 
     891         
    853892        this->setTransZNode(source->getTransZNode()); 
     893         
    854894        this->setMaterialX(source->getMaterialX()); 
     895         
    855896        this->setMaterialY(source->getMaterialY()); 
     897         
    856898        this->setMaterialZ(source->getMaterialZ()); 
     899         
    857900        this->setAxisLinesN(source->getAxisLinesN()); 
     901         
    858902    } 
    859903} 
     
    876920             this->getType().getFieldDesc(TargetFieldId))); 
    877921 
    878 //    returnValue->setSetMethod(boost::bind(&Manipulator::setTarget,  
    879 //                                          static_cast<Manipulator *>(this), _1)); 
     922    returnValue->setSetFunc( 
     923        boost::bind( 
     924            &Manipulator::setTarget, 
     925            static_cast<Manipulator *>(this), _1)); 
    880926 
    881927    editSField(TargetFieldMask); 
     
    901947             this->getType().getFieldDesc(ActiveSubHandleFieldId))); 
    902948 
    903 //    returnValue->setSetMethod(boost::bind(&Manipulator::setActiveSubHandle,  
    904 //                                          static_cast<Manipulator *>(this), _1)); 
     949    returnValue->setSetFunc( 
     950        boost::bind( 
     951            &Manipulator::setActiveSubHandle, 
     952            static_cast<Manipulator *>(this), _1)); 
    905953 
    906954    editSField(ActiveSubHandleFieldMask); 
     
    948996             this->getType().getFieldDesc(ViewportFieldId))); 
    949997 
    950 //    returnValue->setSetMethod(boost::bind(&Manipulator::setViewport,  
    951 //                                          static_cast<Manipulator *>(this), _1)); 
     998    returnValue->setSetFunc( 
     999        boost::bind( 
     1000            &Manipulator::setViewport, 
     1001            static_cast<Manipulator *>(this), _1)); 
    9521002 
    9531003    editSField(ViewportFieldMask); 
     
    10171067             this->getType().getFieldDesc(HandleXNodeFieldId))); 
    10181068 
    1019 //    returnValue->setSetMethod(boost::bind(&Manipulator::setHandleXNode,  
    1020 //                                          static_cast<Manipulator *>(this), _1)); 
     1069    returnValue->setSetFunc( 
     1070        boost::bind( 
     1071            &Manipulator::setHandleXNode, 
     1072            static_cast<Manipulator *>(this), _1)); 
    10211073 
    10221074    editSField(HandleXNodeFieldMask); 
     
    10421094             this->getType().getFieldDesc(HandleYNodeFieldId))); 
    10431095 
    1044 //    returnValue->setSetMethod(boost::bind(&Manipulator::setHandleYNode,  
    1045 //                                          static_cast<Manipulator *>(this), _1)); 
     1096    returnValue->setSetFunc( 
     1097        boost::bind( 
     1098            &Manipulator::setHandleYNode, 
     1099            static_cast<Manipulator *>(this), _1)); 
    10461100 
    10471101    editSField(HandleYNodeFieldMask); 
     
    10671121             this->getType().getFieldDesc(HandleZNodeFieldId))); 
    10681122 
    1069 //    returnValue->setSetMethod(boost::bind(&Manipulator::setHandleZNode,  
    1070 //                                          static_cast<Manipulator *>(this), _1)); 
     1123    returnValue->setSetFunc( 
     1124        boost::bind( 
     1125            &Manipulator::setHandleZNode, 
     1126            static_cast<Manipulator *>(this), _1)); 
    10711127 
    10721128    editSField(HandleZNodeFieldMask); 
     
    10921148             this->getType().getFieldDesc(TransXNodeFieldId))); 
    10931149 
    1094 //    returnValue->setSetMethod(boost::bind(&Manipulator::setTransXNode,  
    1095 //                                          static_cast<Manipulator *>(this), _1)); 
     1150    returnValue->setSetFunc( 
     1151        boost::bind( 
     1152            &Manipulator::setTransXNode, 
     1153            static_cast<Manipulator *>(this), _1)); 
    10961154 
    10971155    editSField(TransXNodeFieldMask); 
     
    11171175             this->getType().getFieldDesc(TransYNodeFieldId))); 
    11181176 
    1119 //    returnValue->setSetMethod(boost::bind(&Manipulator::setTransYNode,  
    1120 //                                          static_cast<Manipulator *>(this), _1)); 
     1177    returnValue->setSetFunc( 
     1178        boost::bind( 
     1179            &Manipulator::setTransYNode, 
     1180            static_cast<Manipulator *>(this), _1)); 
    11211181 
    11221182    editSField(TransYNodeFieldMask); 
     
    11421202             this->getType().getFieldDesc(TransZNodeFieldId))); 
    11431203 
    1144 //    returnValue->setSetMethod(boost::bind(&Manipulator::setTransZNode,  
    1145 //                                          static_cast<Manipulator *>(this), _1)); 
     1204    returnValue->setSetFunc( 
     1205        boost::bind( 
     1206            &Manipulator::setTransZNode, 
     1207            static_cast<Manipulator *>(this), _1)); 
    11461208 
    11471209    editSField(TransZNodeFieldMask); 
     
    11671229             this->getType().getFieldDesc(MaterialXFieldId))); 
    11681230 
    1169 //    returnValue->setSetMethod(boost::bind(&Manipulator::setMaterialX,  
    1170 //                                          static_cast<Manipulator *>(this), _1)); 
     1231    returnValue->setSetFunc( 
     1232        boost::bind( 
     1233            &Manipulator::setMaterialX, 
     1234            static_cast<Manipulator *>(this), _1)); 
    11711235 
    11721236    editSField(MaterialXFieldMask); 
     
    11921256             this->getType().getFieldDesc(MaterialYFieldId))); 
    11931257 
    1194 //    returnValue->setSetMethod(boost::bind(&Manipulator::setMaterialY,  
    1195 //                                          static_cast<Manipulator *>(this), _1)); 
     1258    returnValue->setSetFunc( 
     1259        boost::bind( 
     1260            &Manipulator::setMaterialY, 
     1261            static_cast<Manipulator *>(this), _1)); 
    11961262 
    11971263    editSField(MaterialYFieldMask); 
     
    12171283             this->getType().getFieldDesc(MaterialZFieldId))); 
    12181284 
    1219 //    returnValue->setSetMethod(boost::bind(&Manipulator::setMaterialZ,  
    1220 //                                          static_cast<Manipulator *>(this), _1)); 
     1285    returnValue->setSetFunc( 
     1286        boost::bind( 
     1287            &Manipulator::setMaterialZ, 
     1288            static_cast<Manipulator *>(this), _1)); 
    12211289 
    12221290    editSField(MaterialZFieldMask); 
     
    12421310             this->getType().getFieldDesc(AxisLinesNFieldId))); 
    12431311 
    1244 //    returnValue->setSetMethod(boost::bind(&Manipulator::setAxisLinesN,  
    1245 //                                          static_cast<Manipulator *>(this), _1)); 
     1312    returnValue->setSetFunc( 
     1313        boost::bind( 
     1314            &Manipulator::setAxisLinesN, 
     1315            static_cast<Manipulator *>(this), _1)); 
    12461316 
    12471317    editSField(AxisLinesNFieldMask);