Changeset 1140

Show
Ignore:
Timestamp:
04/09/08 04:05:35 (1 month ago)
Author:
vossg
Message:

merged: osb loader changes from carstens branch
added: field class to field and field type
changed: clean delayed subref naming

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/Base/Base/OSGExportDefines.h

    r1126 r1140  
    118118    SFieldTraits::getSPName(),                           \ 
    119119    SFieldTraits::getType (),                            \ 
    120     FieldType::SINGLE_FIELD) 
     120    FieldType::SINGLE_FIELD,                             \ 
     121    Self::Class) 
    121122 
    122123#define OSG_MFIELDTYPE_SPEZ_INST(T1, T2)                 \ 
     
    125126    MFieldTraits::getMPName(),                           \ 
    126127    MFieldTraits::getType (),                            \ 
    127     FieldType::MULTI_FIELD) 
     128    FieldType::MULTI_FIELD,                              \ 
     129    Self::Class) 
    128130 
    129131#define OSG_SFIELDTYPE_INST(CLASSNAME, T1, T2, T3)           \ 
     
    133135    SFieldTraits::getSPName(),                               \ 
    134136    SFieldTraits::getType (),                                \ 
    135     FieldType::SINGLE_FIELD) 
     137    FieldType::SINGLE_FIELD,                                 \ 
     138    Self::Class) 
    136139 
    137140#define OSG_SFIELDTYPE_INST_X(CLASSNAME, T1, T2, T3)        \ 
     
    141144    SFieldTraits::getSPName(),                              \ 
    142145    SFieldTraits::getType (),                               \ 
    143     FieldType::SINGLE_FIELD) 
     146    FieldType::SINGLE_FIELD,                                \ 
     147    Self::Class) 
    144148 
    145149#define OSG_MFIELDTYPE_INST(CLASSNAME, T1, T2, T3)          \ 
     
    149153    MFieldTraits::getMPName(),                              \ 
    150154    MFieldTraits::getType (),                               \ 
    151     FieldType::MULTI_FIELD) 
     155    FieldType::MULTI_FIELD,                                 \ 
     156    Self::Class) 
    152157 
    153158#define OSG_MFIELDTYPE_INST_X(CLASSNAME, T1, T2, T3)        \ 
     
    157162    MFieldTraits::getMPName(),                              \ 
    158163    MFieldTraits::getType (),                               \ 
    159     FieldType::MULTI_FIELD) 
     164    FieldType::MULTI_FIELD,                                 \ 
     165    Self::Class) 
    160166 
    161167#else 
     
    166172    SFieldTraits::getSPName(),                           \ 
    167173    SFieldTraits::getType (),                            \ 
    168     FieldType::SINGLE_FIELD) 
     174    FieldType::SINGLE_FIELD,                             \ 
     175    Self::Class) 
    169176 
    170177#define OSG_MFIELDTYPE_SPEZ_INST(T1, T2)                 \ 
     
    173180    MFieldTraits::getMPName(),                           \ 
    174181    MFieldTraits::getType (),                            \ 
    175     FieldType::MULTI_FIELD) 
     182    FieldType::MULTI_FIELD,                              \ 
     183    Self::Class) 
    176184 
    177185#define OSG_SFIELDTYPE_INST(CLASSNAME, T1, T2, T3)       \ 
     
    181189    SFieldTraits::getSPName(),                           \ 
    182190    SFieldTraits::getType (),                            \ 
    183     FieldType::SINGLE_FIELD) 
     191    FieldType::SINGLE_FIELD,                             \ 
     192    Self::Class) 
    184193 
    185194#define OSG_SFIELDTYPE_INST_X(CLASSNAME, T1, T2, T3)     \ 
     
    189198    SFieldTraits::getSPName(),                           \ 
    190199    SFieldTraits::getType (),                            \ 
    191     FieldType::SINGLE_FIELD) 
     200    FieldType::SINGLE_FIELD,                             \ 
     201    Self::Class) 
    192202 
    193203 
     
    198208    MFieldTraits::getMPName(),                           \ 
    199209    MFieldTraits::getType (),                            \ 
    200     FieldType::MULTI_FIELD) 
     210    FieldType::MULTI_FIELD,                              \ 
     211    Self::Class) 
    201212 
    202213#define OSG_MFIELDTYPE_INST_X(CLASSNAME, T1, T2, T3)     \ 
     
    206217    MFieldTraits::getMPName(),                           \ 
    207218    MFieldTraits::getType (),                            \ 
    208     FieldType::MULTI_FIELD) 
     219    FieldType::MULTI_FIELD,                              \ 
     220    Self::Class) 
    209221 
    210222#endif 
  • trunk/Source/Base/Field/OSGField.h

    r785 r1140  
    4444 
    4545#include "OSGBaseTypes.h" 
     46#include "OSGFieldForwards.h" 
    4647 
    4748#include <string> 
  • trunk/Source/Base/Field/OSGFieldType.cpp

    r785 r1140  
    5858                     const DataType          &contentType, 
    5959                           Cardinality        cardinality, 
     60                           Class              fieldClass, 
    6061                     const UInt32             uiNameSpace) : 
    6162     Inherited   (szName,  
     
    6364                  uiNameSpace ), 
    6465    _cardinality (cardinality ), 
     66    _fieldClass  (fieldClass  ), 
    6567    _contentType (contentType ), 
    6668    _pScanAsType (NULL        ) 
     
    7274                     const DataType           &contentType, 
    7375                           Cardinality         cardinality, 
     76                           Class              fieldClass, 
    7477                     const FieldType          &pScanAsType, 
    7578                     const UInt32             uiNameSpace ) : 
     
    7881                   uiNameSpace ), 
    7982    _cardinality ( cardinality ), 
     83    _fieldClass  ( fieldClass  ), 
    8084    _contentType ( contentType ), 
    8185    _pScanAsType (&pScanAsType ) 
  • trunk/Source/Base/Field/OSGFieldType.h

    r785 r1140  
    4545#include <typeinfo> 
    4646#include "OSGDataType.h" 
     47#include "OSGFieldForwards.h" 
    4748 
    4849OSG_BEGIN_NAMESPACE 
     
    6768    enum Cardinality  
    6869    {  
    69         SINGLE_FIELD,  
    70         MULTI_FIELD  
     70        SINGLE_FIELD = SingleField,  
     71        MULTI_FIELD  = MultiField  
     72    }; 
     73 
     74    enum Class 
     75    { 
     76        ValueField      = OSG::ValueField, 
     77        PtrField        = OSG::PtrField, 
     78        ParentPtrField  = OSG::ParentPtrField, 
     79        ChildPtrField   = OSG::ChildPtrField 
    7180    }; 
    7281 
     
    7988              const DataType          &contentType, 
    8089                    Cardinality        cardinality, 
     90                    Class              fieldClass, 
    8191              const UInt32             uiNameSpace = GlobalNamespace); 
    8292 
     
    8595              const DataType          &contentType , 
    8696                    Cardinality        cardinality , 
     97                    Class              fieldClass, 
    8798              const FieldType         &pScanAsType, 
    8899              const UInt32             uiNameSpace = GlobalNamespace); 
     
    109120    const DataType    &getContentType(void) const; 
    110121          Cardinality  getCardinality(void) const; 
     122          Class        getClass      (void) const; 
    111123 
    112124          UInt32       getScanTypeId (void) const; 
     
    130142    /*                             Member                                  */ 
    131143 
    132           Cardinality        _cardinality; 
    133           UInt32             _uiLoadTypeId; 
     144          Cardinality  _cardinality; 
     145          UInt32       _uiLoadTypeId; 
     146          Class        _fieldClass; 
    134147 
    135     const DataType          &_contentType; 
    136     const FieldType         *_pScanAsType; 
     148    const DataType    &_contentType; 
     149    const FieldType   *_pScanAsType; 
    137150 
    138151    /*==========================  PRIVATE  ================================*/ 
  • trunk/Source/Base/Field/OSGFieldType.inl

    r785 r1140  
    5252 
    5353inline 
     54FieldType::Class FieldType::getClass(void) const 
     55{ 
     56    return _fieldClass; 
     57} 
     58 
     59inline 
    5460UInt32 FieldType::getScanTypeId(void) const 
    5561{ 
  • trunk/Source/Base/Field/OSGMField.h

    r928 r1140  
    114114    /*---------------------------------------------------------------------*/ 
    115115 
    116     static const Int32 Namespace     = iNamespace; 
    117  
    118     static const bool isSField       = false; 
    119     static const bool isMField       = true; 
    120  
    121     static const bool isPointerField = false; 
     116    static const Int32            Namespace      = iNamespace; 
     117 
     118    static const bool             isSField       = false; 
     119    static const bool             isMField       = true; 
     120 
     121    static const bool             isPointerField = false; 
     122 
     123    static const FieldType::Class Class          = FieldType::ValueField; 
    122124 
    123125    /*---------------------------------------------------------------------*/ 
  • trunk/Source/Base/Field/OSGMField.ins

    r1083 r1140  
    4646    MFieldTraits::getMPName(), 
    4747    MFieldTraits::getType  (), 
    48     FieldType::MULTI_FIELD); 
     48    FieldType::MULTI_FIELD, 
     49    Self::Class); 
    4950 
    5051#else 
     
    5556    MFieldTraits::getMPName(), 
    5657    MFieldTraits::getType  (), 
    57     FieldType::MULTI_FIELD); 
     58    FieldType::MULTI_FIELD, 
     59    Self::Class); 
    5860 
    5961#endif 
  • trunk/Source/Base/Field/OSGSField.h

    r890 r1140  
    9292    /*---------------------------------------------------------------------*/ 
    9393 
    94     static const Int32 Namespace     = iNamespace; 
    95  
    96     static const bool isSField       = true; 
    97     static const bool isMField       = false; 
    98  
    99     static const bool isPointerField = false; 
     94    static const Int32            Namespace     = iNamespace; 
     95 
     96    static const bool             isSField       = true; 
     97    static const bool             isMField       = false; 
     98 
     99    static const bool             isPointerField = false; 
     100 
     101    static const FieldType::Class Class          = FieldType::ValueField; 
    100102 
    101103    /*---------------------------------------------------------------------*/ 
  • trunk/Source/Base/Field/OSGSField.ins

    r1083 r1140  
    4646    SFieldTraits::getSPName(), 
    4747    SFieldTraits::getType  (), 
    48     FieldType::SINGLE_FIELD); 
     48    FieldType::SINGLE_FIELD, 
     49    Self::Class); 
    4950 
    5051#else 
     
    5556    SFieldTraits::getSPName(), 
    5657    SFieldTraits::getType  (), 
    57     FieldType::SINGLE_FIELD); 
     58    FieldType::SINGLE_FIELD, 
     59    Self::Class); 
    5860 
    5961#endif 
  • trunk/Source/System/Cluster/Base/OSGRemoteAspect.cpp

    r1119 r1140  
    384384    while(!finish); 
    385385 
    386     Thread::getCurrentChangeList()->clearSyncAddRef(); 
     386    Thread::getCurrentChangeList()->commitDelayedSubRefs(); 
    387387 
    388388    if(applyToChangelist) 
  • trunk/Source/System/FieldContainer/Base/OSGChangeList.cpp

    r1137 r1140  
    208208 
    209209ChangeList::ChangeList(void) : 
    210      Inherited         (                   ), 
    211     _entryPool         (                   ), 
    212     _currentPoolElement(                   ), 
    213     _currentEntry      (                   ), 
    214     _changedStore      (                   ), 
    215     _createdStore      (                   ), 
    216     _uncommitedChanges (                   ), 
    217     _workStore         (                   ), 
    218     _uiAspect          (                  0), 
    219     _iSubRefLevel      (                  0), 
    220     _bExternal         (false              ), 
    221     _vSyncUnrecAddRef  (                   ), 
    222     _vSyncRecAddRef    (                   ), 
    223     _vSyncWeakAddRef  (                   ) 
     210     Inherited           (                   ), 
     211    _entryPool           (                   ), 
     212    _currentPoolElement  (                   ), 
     213    _currentEntry        (                   ), 
     214    _changedStore        (                   ), 
     215    _createdStore        (                   ), 
     216    _uncommitedChanges   (                   ), 
     217    _workStore           (                   ), 
     218    _uiAspect            (                  0), 
     219    _iSubRefLevel        (                  0), 
     220    _bExternal           (false              ), 
     221    _vDelayedUnrecSubRefs(                   ), 
     222    _vDelayedRecSubRefs  (                   ), 
     223    _vDelayedWeakSubRefs (                   ) 
    224224{ 
    225225    _entryPool.push_back(ChangeEntryStore()); 
     
    559559        ++cIt; 
    560560    } 
     561 
     562    commitDelayedSubRefs(); 
    561563#endif 
    562564} 
     
    695697 
    696698template<> OSG_DLL_EXPORT  
    697 void ChangeList::addSyncAddRef<NoRefCountPolicy>(FieldContainerPtr) 
     699void ChangeList::addDelayedSubRef<NoRefCountPolicy>(FieldContainerPtr) 
    698700{ 
    699701} 
    700702 
    701703template<> OSG_DLL_EXPORT  
    702 void ChangeList::addSyncAddRef<RecordedRefCountPolicy>(FieldContainerPtr pFC) 
    703 { 
    704     _vSyncRecAddRef.push_back(pFC); 
     704void ChangeList::addDelayedSubRef<RecordedRefCountPolicy>(FieldContainerPtr pFC) 
     705{ 
     706    _vDelayedRecSubRefs.push_back(pFC); 
    705707} 
    706708 
    707709template<> OSG_DLL_EXPORT  
    708 void ChangeList::addSyncAddRef<UnrecordedRefCountPolicy>(FieldContainerPtr pFC) 
    709 
    710     _vSyncUnrecAddRef.push_back(pFC); 
     710void ChangeList::addDelayedSubRef<UnrecordedRefCountPolicy>( 
     711    FieldContainerPtr pFC) 
     712
     713    _vDelayedUnrecSubRefs.push_back(pFC); 
    711714} 
    712715 
    713716template<> OSG_DLL_EXPORT  
    714 void ChangeList::addSyncAddRef<WeakRefCountPolicy>(FieldContainerPtr pFC) 
    715 
    716     _vSyncWeakAddRef.push_back(pFC); 
    717 
    718  
    719 void ChangeList::clearSyncAddRef(void) 
    720 
     717void ChangeList::addDelayedSubRef<WeakRefCountPolicy>(FieldContainerPtr pFC) 
     718
     719    _vDelayedWeakSubRefs.push_back(pFC); 
     720
     721 
     722void ChangeList::commitDelayedSubRefs(void) 
     723
     724    // Unrec 
    721725    std::vector<FieldContainerPtr>::      iterator vIt  =  
    722         _vSyncUnrecAddRef.begin(); 
     726        _vDelayedUnrecSubRefs.begin(); 
    723727 
    724728    std::vector<FieldContainerPtr>::const_iterator vEnd =  
    725         _vSyncUnrecAddRef.end  (); 
     729        _vDelayedUnrecSubRefs.end  (); 
    726730 
    727731    while(vIt != vEnd) 
     
    732736    } 
    733737 
    734     _vSyncUnrecAddRef.clear(); 
    735  
    736  
    737     vIt  = _vSyncRecAddRef.begin(); 
    738     vEnd = _vSyncRecAddRef.end  (); 
     738    _vDelayedUnrecSubRefs.clear(); 
     739 
     740    // Rec 
     741    vIt  = _vDelayedRecSubRefs.begin(); 
     742    vEnd = _vDelayedRecSubRefs.end  (); 
    739743 
    740744    while(vIt != vEnd) 
     
    745749    } 
    746750 
    747     _vSyncRecAddRef.clear(); 
    748  
    749  
    750     vIt  = _vSyncWeakAddRef.begin(); 
    751     vEnd = _vSyncWeakAddRef.end  (); 
     751    _vDelayedRecSubRefs.clear(); 
     752 
     753     
     754    // Weak 
     755    vIt  = _vDelayedWeakSubRefs.begin(); 
     756    vEnd = _vDelayedWeakSubRefs.end  (); 
    752757 
    753758    while(vIt != vEnd) 
     
    758763    } 
    759764 
    760     _vSyncWeakAddRef.clear(); 
     765    _vDelayedWeakSubRefs.clear(); 
    761766} 
    762767 
  • trunk/Source/System/FieldContainer/Base/OSGChangeList.h

    r1126 r1140  
    226226 
    227227    template<typename RefCountPolicy> 
    228     void addSyncAddRef  (FieldContainerPtr pFC); 
    229  
    230     void clearSyncAddRef(void                 ); 
     228    void addDelayedSubRef    (FieldContainerPtr pFC); 
     229 
     230    void commitDelayedSubRefs(void                 ); 
    231231 
    232232    /*! \}                                                                 */ 
     
    269269    bool                           _bExternal; 
    270270     
    271     std::vector<FieldContainerPtr> _vSyncUnrecAddRef
    272     std::vector<FieldContainerPtr> _vSyncRecAddRef
    273     std::vector<FieldContainerPtr> _vSyncWeakAddRef
     271    std::vector<FieldContainerPtr> _vDelayedUnrecSubRefs
     272    std::vector<FieldContainerPtr> _vDelayedRecSubRefs
     273    std::vector<FieldContainerPtr> _vDelayedWeakSubRefs
    274274 
    275275    /*! \}                                                                 */ 
  • trunk/Source/System/FieldContainer/Base/OSGFieldContainer.h

    r1136 r1140  
    560560#include "OSGFieldContainer.inl" 
    561561 
     562#include "OSGRefCountPolicies.h" 
     563 
    562564#endif /* _OSGFIELDCONTAINER_H_ */ 
    563565 
  • trunk/Source/System/FieldContainer/Fields/Base/OSGFieldContainerPtrChildMField.h

    r1126 r1140  
    100100    /*---------------------------------------------------------------------*/ 
    101101 
    102     static const Int32 Namespace     = iNamespace; 
     102    static const Int32            Namespace = iNamespace; 
     103 
     104    static const FieldType::Class Class     = FieldType::ChildPtrField; 
    103105 
    104106    /*---------------------------------------------------------------------*/ 
  • trunk/Source/System/FieldContainer/Fields/Base/OSGFieldContainerPtrChildMField.inl

    r1125 r1140  
    197197                if(*sIt != NULL) 
    198198                { 
    199                     Thread::getCurrentChangeList()->addSyncAddRef 
     199                    Thread::getCurrentChangeList()->addDelayedSubRef 
    200200                        <RefCountPolicy>(*sIt); 
    201201                } 
     
    217217                    if(*sIt != NULL) 
    218218                    { 
    219                         Thread::getCurrentChangeList()->addSyncAddRef< 
     219                        Thread::getCurrentChangeList()->addDelayedSubRef< 
    220220                            RefCountPolicy>(*sIt); 
    221221                    } 
     
    521521    ConstFieldMaskArg   syncMode, 
    522522    UInt32              uiSyncInfo, 
    523     AspectOffsetStore  &oOffsets    ) 
    524 
     523    AspectOffsetStore  &oOffsets  ) 
     524
     525    size_type n = source.size(); 
     526 
     527    if(n != 0) 
     528    { 
     529        if(_values.size() == 0) 
     530        { 
     531            _values.resize(n, NULL); 
     532 
     533            Inherited::iterator sIt  = source._values.begin(); 
     534            Inherited::iterator sEnd = source._values.end  (); 
     535 
     536            Inherited::iterator fIt  = _values.begin(); 
     537         
     538            while(sIt != sEnd) 
     539            { 
     540                *fIt = convertToCurrentAspect(*sIt); 
     541 
     542                RefCountPolicy::addRef(*fIt); 
     543                 
     544                ++sIt; 
     545                ++fIt; 
     546            } 
     547        } 
     548        else 
     549        { 
     550            if(n > _values.size()) 
     551            { 
     552                _values.resize(n, NullFC); 
     553            } 
     554 
     555            Inherited::      iterator sIt  =  source._values.begin(); 
     556 
     557            Inherited::iterator       fIt  = _values.begin(); 
     558            Inherited::const_iterator fEnd = _values.end  (); 
     559 
     560            for(UInt32 i = 0; i < n; ++i) 
     561            { 
     562                if(*fIt != NULL) 
     563                { 
     564                    Thread::getCurrentChangeList()->addDelayedSubRef< 
     565                        RefCountPolicy>(*fIt); 
     566                } 
     567 
     568                *fIt = convertToCurrentAspect(*sIt); 
     569 
     570                RefCountPolicy::addRef(*fIt); 
     571 
     572                ++sIt; 
     573                ++fIt; 
     574            } 
     575 
     576            if(n < _values.size()) 
     577            { 
     578                while(fIt != fEnd) 
     579                { 
     580                    if(*fIt != NULL) 
     581                    { 
     582                        Thread::getCurrentChangeList()->addDelayedSubRef 
     583                            <RefCountPolicy>(*fIt); 
     584                    } 
     585 
     586                    ++fIt; 
     587                }; 
     588 
     589                _values.resize(n); 
     590            } 
     591        } 
     592    } 
     593    else 
     594    { 
     595        this->clear(); 
     596    } 
     597 
     598#if 0 
    525599    if(source.size() != 0) 
    526600    { 
     
    548622        this->clear(); 
    549623    } 
     624#endif 
    550625} 
    551626 
  • trunk/Source/System/FieldContainer/Fields/Base/OSGFieldContainerPtrChildSField.h

    r1126 r1140  
    8787    /*---------------------------------------------------------------------*/ 
    8888 
    89     static const Int32 Namespace     = iNamespace; 
     89    static const Int32            Namespace = iNamespace; 
     90 
     91    static const FieldType::Class Class     = FieldType::ChildPtrField; 
    9092 
    9193    /*---------------------------------------------------------------------*/ 
  • trunk/Source/System/FieldContainer/Fields/Base/OSGFieldContainerPtrChildSField.inl

    r1125 r1140  
    214214    if(_fieldValue != NullFC) 
    215215    { 
    216         Thread::getCurrentChangeList()->addSyncAddRef< 
     216        Thread::getCurrentChangeList()->addDelayedSubRef< 
    217217            RefCountPolicy>(_fieldValue); 
    218218    } 
     
    233233    if(_fieldValue != NullFC) 
    234234    { 
    235         Thread::getCurrentChangeList()->addSyncAddRef< 
     235        Thread::getCurrentChangeList()->addDelayedSubRef< 
    236236            RefCountPolicy>(_fieldValue); 
    237237    } 
  • trunk/Source/System/FieldContainer/Fields/Base/OSGFieldContainerPtrMField.h

    r1126 r1140  
    9797    /*---------------------------------------------------------------------*/ 
    9898 
    99     static const Int32 Namespace = iNamespace; 
     99    static const Int32            Namespace = iNamespace; 
     100 
     101    static const FieldType::Class Class     = FieldType::PtrField; 
    100102 
    101103    /*---------------------------------------------------------------------*/ 
  • trunk/Source/System/FieldContainer/Fields/Base/OSGFieldContainerPtrMField.inl

    r1125 r1140  
    177177                if(*sIt != NULL) 
    178178                { 
    179                     Thread::getCurrentChangeList()->addSyncAddRef< 
     179                    Thread::getCurrentChangeList()->addDelayedSubRef< 
    180180                        RefCountPolicy>(*sIt); 
    181181                } 
     
    197197                    if(*sIt != NULL) 
    198198                    { 
    199                         Thread::getCurrentChangeList()->addSyncAddRef 
     199                        Thread::getCurrentChangeList()->addDelayedSubRef 
    200200                            <RefCountPolicy>(*sIt); 
    201201                    } 
     
    447447    AspectOffsetStore  &oOffsets    ) 
    448448{ 
    449     if(source.size() != 0) 
    450     { 
    451         this->resize(source.size(), NullFC); 
    452  
    453         Inherited::iterator sIt  = source._values.begin(); 
    454         Inherited::iterator sEnd = source._values.end  (); 
    455  
    456         Inherited::iterator fIt  = _values.begin(); 
     449    size_type n = source.size(); 
     450 
     451    if(n != 0) 
     452    { 
     453        if(_values.size() == 0) 
     454        { 
     455            _values.resize(n, NULL); 
     456 
     457            Inherited::iterator sIt  = source._values.begin(); 
     458            Inherited::iterator sEnd = source._values.end  (); 
     459 
     460            Inherited::iterator fIt  = _values.begin(); 
    457461         
    458         while(sIt != sEnd) 
     462            while(sIt != sEnd) 
     463            { 
     464                *fIt = convertToCurrentAspect(*sIt); 
     465                 
     466                RefCountPolicy::addRef(*fIt); 
     467 
     468                ++sIt; 
     469                ++fIt; 
     470            } 
     471        } 
     472        else 
    459473        { 
    460             RefCountPolicy::setRefd((*fIt), 
    461                                     convertToCu