Show
Ignore:
Timestamp:
01/16/08 16:07:40 (1 year ago)
Author:
cneumann
Message:

changed: - factory functions return a TransitPtr? that can not be implicitly

converted to C Ptr. Should help with porting.

added: - GlobalRefPtr?, needed for cases where upon return from main

a RefPtr? goes out of scope (it would attempt to access the
FCFactory which is already shutdown at that point).

status: - vrml loader does not compile (needs porting to ref ptr)

  • tutorials compile, run and exit cleanly
  • multithreading and cluster are untested, yet
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Carsten_PtrWork2/Source/System/FileIO/Base/OSGSceneFileHandler.cpp

    r908 r1039  
    162162 
    163163 
    164 NodePtr SceneFileHandlerBase::read(      std::istream &is, 
    165                                    const Char8        *fileNameOrExtension, 
    166                                          GraphOpSeq   *graphOpSeq         ) 
     164NodeTransitPtr SceneFileHandlerBase::read(      std::istream &is, 
     165                                         const Char8        *fileNameOrExtension, 
     166                                               GraphOpSeq   *graphOpSeq         ) 
    167167{ 
    168168    SceneFileType *type  = getFileType(fileNameOrExtension); 
    169     NodePtr        scene = NullFC
     169    NodeRefPtr     scene
    170170 
    171171    if(!fileNameOrExtension) 
    172172    { 
    173173        SWARNING << "cannot read NULL extension" << std::endl; 
    174         return scene
     174        return NodeTransitPtr(scene)
    175175    } 
    176176 
     
    247247    } 
    248248 
    249     return scene
     249    return NodeTransitPtr(scene)
    250250} 
    251251 
     
    256256          GraphOpSeq   *graphOpSeq         ) 
    257257{ 
    258     std::vector<FieldContainerPtr> nodeVec; 
    259     NodePtr                        scene = read(is, fileNameOrExtension); 
     258    FCPtrStore nodeVec; 
     259    NodeRefPtr scene(read(is, fileNameOrExtension)); 
    260260 
    261261    if(scene == NullFC) 
     
    264264    while(scene->getNChildren() > 0) 
    265265    { 
    266         NodePtr child    = scene->getChild(0); 
    267         NodePtr newChild = Node::create(); 
     266        NodeRefPtr child   (scene->getChild(0)); 
     267        NodeRefPtr newChild(Node::create()    ); 
    268268 
    269269        while(child->getNChildren() > 0) 
     
    277277                graphOpSeq->run(newChild); 
    278278 
    279         nodeVec.push_back(newChild); 
     279        nodeVec.push_back(FieldContainerRefPtr(newChild)); 
    280280 
    281281        scene->subChild(child); 
     
    285285} 
    286286 
    287 NodePtr SceneFileHandlerBase::read(const Char8      *fileName, 
    288                                          GraphOpSeq *graphOpSeq) 
     287NodeTransitPtr SceneFileHandlerBase::read(const Char8      *fileName, 
     288                                                GraphOpSeq *graphOpSeq) 
    289289{ 
    290290    if(fileName == NULL) 
    291291    { 
    292292        SWARNING << "cannot read NULL file" << std::endl; 
    293         return NullFC
     293        return NodeTransitPtr()
    294294    } 
    295295 
     
    313313            { 
    314314                SWARNING << "Couldn't open file " << fileName << std::endl; 
    315                 return NullFC
     315                return NodeTransitPtr()
    316316            } 
    317317        } 
     
    319319        { 
    320320            SWARNING << "Couldn't open file " << fileName << std::endl; 
    321             return NullFC
     321            return NodeTransitPtr()
    322322        } 
    323323    } 
    324324 
    325325    SceneFileType *type  = getFileType(fullFilePath.c_str()); 
    326     NodePtr        scene = NullFC
     326    NodeRefPtr     scene
    327327 
    328328    if(type != NULL) 
     
    378378    } 
    379379 
    380     return scene
     380    return NodeTransitPtr(scene)
    381381} 
    382382 
     
    385385          GraphOpSeq *graphOpSeq) 
    386386{ 
    387     std::vector<FieldContainerPtr> nodeVec; 
     387    FCPtrStore nodeVec; 
    388388 
    389389    if(fileName == NULL) 
     
    419419    if(nodeVec.empty() == true) 
    420420    { 
    421         NodePtr scene = read(fullFilePath.c_str()); 
     421        NodeRefPtr scene(read(fullFilePath.c_str())); 
    422422 
    423423        if(scene == NullFC) 
     
    426426        while(scene->getNChildren() > 0) 
    427427        { 
    428             NodePtr child    = scene->getChild(0); 
    429             NodePtr newChild = Node::create(); 
     428            NodeRefPtr child   (scene->getChild(0)); 
     429            NodeRefPtr newChild(Node::create()    ); 
    430430 
    431431            while(child->getNChildren() > 0) 
     
    439439                graphOpSeq->run(newChild); 
    440440 
    441             nodeVec.push_back(newChild); 
     441            nodeVec.push_back(FieldContainerRefPtr(newChild)); 
    442442 
    443443            scene->subChild(child);