Ticket #49: NFIO_Attachment_01.diff

File NFIO_Attachment_01.diff, 12.4 kB (added by cneumann, 2 years ago)

patch - needs review

  • Source/System/FieldContainer/Mixins/OSGAttachmentMixin.inl

    old new  
    9696{ 
    9797} 
    9898 
     99/*-------------------------------------------------------------------------*/ 
     100/*                             Destructor                                  */ 
     101 
    99102template <class ParentT> inline 
    100103AttachmentMixin<ParentT>::~AttachmentMixin(void) 
    101104{ 
    102105} 
    103106 
    104107/*-------------------------------------------------------------------------*/ 
    105 /*                             Destructor                                  */ 
     108/*                                 Get                                     */ 
    106109 
    107110template <class ParentT> inline 
    108111SFBool &AttachmentMixin<ParentT>::editInternal(void) 
     
    147150} 
    148151 
    149152/*-------------------------------------------------------------------------*/ 
    150 /*                             Assignment                                  */ 
     153/*                               Set                                       */ 
    151154 
    152155template <class ParentT> inline 
    153156void AttachmentMixin<ParentT>::setInternal(bool bVal) 
     
    157160    _sfInternal.setValue(bVal); 
    158161} 
    159162 
     163/*-------------------------------------------------------------------------*/ 
     164/*                          your_category                              */ 
     165 
    160166template <class ParentT> inline 
    161167void AttachmentMixin<ParentT>::addParent( 
    162168          ParentPtrConst &parent, 
     
    186192} 
    187193 
    188194/*-------------------------------------------------------------------------*/ 
    189 /*                             Comparison                                  */ 
     195/*                           Binary Access                                 */ 
    190196 
     197template <class ParentT> 
     198UInt32  
     199AttachmentMixin<ParentT>::getBinSize(ConstFieldMaskArg whichField) 
     200{ 
     201    UInt32 returnValue = Inherited::getBinSize(whichField); 
     202     
     203    if(FieldBits::NoField != (ParentsFieldMask & whichField)) 
     204    { 
     205        returnValue += _mfParents.getBinSize(); 
     206    } 
     207     
     208    if(FieldBits::NoField != (InternalFieldMask & whichField)) 
     209    { 
     210        returnValue += _sfInternal.getBinSize(); 
     211    } 
     212     
     213    return returnValue; 
     214} 
     215 
     216template <class ParentT> 
     217void 
     218AttachmentMixin<ParentT>::copyToBin(BinaryDataHandler &pMem, 
     219                                    ConstFieldMaskArg  whichField) 
     220{ 
     221    Inherited::copyToBin(pMem, whichField); 
     222 
     223    if(FieldBits::NoField != (ParentsFieldMask & whichField)) 
     224    { 
     225        _mfParents.copyToBin(pMem); 
     226    } 
     227     
     228    if(FieldBits::NoField != (InternalFieldMask & whichField)) 
     229    { 
     230        _sfInternal.copyToBin(pMem); 
     231    } 
     232} 
     233 
     234template <class ParentT> 
     235void 
     236AttachmentMixin<ParentT>::copyFromBin(BinaryDataHandler &pMem, 
     237                                      ConstFieldMaskArg  whichField) 
     238{ 
     239    Inherited::copyFromBin(pMem, whichField); 
     240 
     241    if(FieldBits::NoField != (ParentsFieldMask & whichField)) 
     242    { 
     243        _mfParents.copyFromBin(pMem); 
     244    } 
     245 
     246    if(FieldBits::NoField != (InternalFieldMask & whichField)) 
     247    { 
     248        _sfInternal.copyFromBin(pMem); 
     249    } 
     250} 
     251 
     252 
    191253OSG_END_NAMESPACE 
    192254 
    193255#define OSGATTACHMENTMIXIN_INLINE_CVSID "@(#)$Id$" 
  • Source/System/FieldContainer/Mixins/OSGAttachmentContainerMixin.inl

    old new  
    6060    oType.addInitialDesc(pDesc); 
    6161} 
    6262 
     63/*-------------------------------------------------------------------------*/ 
     64/*                                Set                                      */ 
    6365 
     66template <class ParentT> 
     67void 
     68AttachmentContainerMixin<ParentT>::pushToField( 
     69          FieldContainerPtrConstArg pNewElement, 
     70    const UInt32                    uiFieldId   ) 
     71{ 
     72    Inherited::pushToField(pNewElement, uiFieldId); 
     73 
     74    if(uiFieldId == AttachmentsFieldId) 
     75    { 
     76        addAttachment(cast_dynamic<AttachmentObjPtr>(pNewElement)); 
     77    } 
     78} 
     79 
     80template <class ParentT> 
     81void 
     82AttachmentContainerMixin<ParentT>::insertIntoMField( 
     83    const UInt32                    uiIndex, 
     84          FieldContainerPtrConstArg pNewElement, 
     85    const UInt32                    uiFieldId   ) 
     86{ 
     87    Inherited::insertIntoMField(uiIndex, pNewElement, uiFieldId); 
     88     
     89    FWARNING(("AttachmentContainerMixin::insertIntoMField: NIY\n")); 
     90} 
     91 
     92template <class ParentT> 
     93void 
     94AttachmentContainerMixin<ParentT>::replaceInMField ( 
     95    const UInt32                    uiIndex, 
     96          FieldContainerPtrConstArg pNewElement, 
     97    const UInt32                    uiFieldId   ) 
     98{ 
     99    Inherited::replaceInMField(uiIndex, pNewElement, uiFieldId); 
     100 
     101    FWARNING(("AttachmentContainerMixin::replaceInMField: NIY\n")); 
     102} 
     103 
     104template <class ParentT> 
     105void 
     106AttachmentContainerMixin<ParentT>::replaceInMField ( 
     107          FieldContainerPtrConstArg pOldElement, 
     108          FieldContainerPtrConstArg pNewElement, 
     109    const UInt32                    uiFieldId  ) 
     110{ 
     111    Inherited::replaceInMField(pOldElement, pNewElement, uiFieldId); 
     112     
     113    FWARNING(("AttachmentContainerMixin::replaceInMField: NIY\n")); 
     114} 
     115 
     116template <class ParentT> 
     117void 
     118AttachmentContainerMixin<ParentT>::removeFromMField( 
     119    const UInt32                    uiIndex, 
     120    const UInt32                    uiFieldId ) 
     121{ 
     122    Inherited::removeFromMField(uiIndex, uiFieldId); 
     123     
     124    FWARNING(("AttachmentContainerMixin::removeFromMField: NIY\n")); 
     125} 
     126 
     127template <class ParentT> 
     128void 
     129AttachmentContainerMixin<ParentT>::removeFromMField( 
     130          FieldContainerPtrConstArg pElement, 
     131    const UInt32                    uiFieldId ) 
     132{ 
     133    Inherited::removeFromMField(pElement, uiFieldId); 
     134     
     135    FWARNING(("AttachmentContainerMixin::removeFromMField: NIY\n")); 
     136} 
     137 
     138template <class ParentT> 
     139void 
     140AttachmentContainerMixin<ParentT>::clearField( 
     141    const UInt32                    uiFieldId ) 
     142{ 
     143    Inherited::clearField(uiFieldId); 
     144     
     145    FWARNING(("AttachmentContainerMixin::clearField: NIY\n")); 
     146} 
     147 
     148/*-------------------------------------------------------------------------*/ 
     149/*                             Assignment                                  */ 
     150 
    64151/** 
    65152 * Add an attachment at the binding point. 
    66153 * 
  • Source/System/FieldContainer/Mixins/OSGSimpleAttachment.inl

    old new  
    194194UInt32 SimpleAttachment<AttachmentDescT>::getBinSize( 
    195195    ConstFieldMaskArg  whichField) 
    196196{ 
    197     return 0; 
     197    UInt32 returnValue = Inherited::getBinSize(whichField); 
     198     
     199    if(FieldBits::NoField != (SimpleFieldMask & whichField)) 
     200    { 
     201        returnValue += _field.getBinSize(); 
     202    } 
     203 
     204    return returnValue; 
    198205} 
    199206 
    200207 
     
    203210    BinaryDataHandler &pMem,  
    204211    ConstFieldMaskArg  whichField) 
    205212{ 
     213    Inherited::copyToBin(pMem, whichField); 
     214     
     215    if(FieldBits::NoField != (SimpleFieldMask & whichField)) 
     216    { 
     217        _field.copyToBin(pMem); 
     218    } 
    206219} 
    207220 
    208221template <class AttachmentDescT> inline 
     
    210223    BinaryDataHandler &pMem,  
    211224    ConstFieldMaskArg  whichField) 
    212225{ 
     226    Inherited::copyFromBin(pMem, whichField); 
     227     
     228    if(FieldBits::NoField != (SimpleFieldMask & whichField)) 
     229    { 
     230        _field.copyFromBin(pMem); 
     231    } 
    213232} 
    214233 
    215234template <class AttachmentDescT> inline 
  • Source/System/FieldContainer/Mixins/OSGAttachmentMixin.h

    old new  
    145145    /*! \name                   Binary Access                              */ 
    146146    /*! \{                                                                 */ 
    147147 
     148    virtual UInt32 getBinSize (ConstFieldMaskArg  whichField); 
     149    virtual void   copyToBin  (BinaryDataHandler &pMem, 
     150                               ConstFieldMaskArg  whichField); 
     151    virtual void   copyFromBin(BinaryDataHandler &pMem, 
     152                               ConstFieldMaskArg  whichField); 
     153     
    148154    /*! \}                                                                 */ 
    149155    /*---------------------------------------------------------------------*/ 
    150156    /*! \name                   your_operators                             */ 
  • Source/System/FieldContainer/Mixins/OSGAttachmentContainerMixin.h

    old new  
    117117    /*! \name                      Set                                     */ 
    118118    /*! \{                                                                 */ 
    119119 
     120    virtual void pushToField     (      FieldContainerPtrConstArg pNewElement, 
     121                                  const UInt32                    uiFieldId  ); 
     122 
     123    virtual void insertIntoMField(const UInt32                    uiIndex, 
     124                                        FieldContainerPtrConstArg pNewElement, 
     125                                  const UInt32                    uiFieldId  ); 
     126 
     127    virtual void replaceInMField (const UInt32                    uiIndex, 
     128                                        FieldContainerPtrConstArg pNewElement, 
     129                                  const UInt32                    uiFieldId  ); 
     130 
     131    virtual void replaceInMField (      FieldContainerPtrConstArg pOldElement, 
     132                                        FieldContainerPtrConstArg pNewElement, 
     133                                  const UInt32                    uiFieldId  ); 
     134 
     135    virtual void removeFromMField(const UInt32                    uiIndex, 
     136                                  const UInt32                    whichField ); 
     137 
     138    virtual void removeFromMField(      FieldContainerPtrConstArg pElement, 
     139                                  const UInt32                    whichField ); 
     140 
     141    virtual void clearField      (const UInt32                    whichField ); 
     142     
    120143    /*! \}                                                                 */ 
    121144    /*---------------------------------------------------------------------*/ 
    122145    /*! \name                   your_category                              */ 
  • Source/System/FieldContainer/Base/OSGFieldContainerAttachment.cpp

    old new  
    4949 
    5050OSG_USING_NAMESPACE 
    5151 
     52/*-------------------------------------------------------------------------*/ 
     53/*                               Fields                                    */ 
     54 
    5255void FieldContainerAttachment::classDescInserter(TypeObject &oType) 
    5356{ 
    5457    Inherited::classDescInserter(oType); 
  • Source/Base/Field/OSGSysFieldTraits.h

    old new  
    576576    static Char8    *getMName     (void) { return "MFVoidP";           } 
    577577 
    578578    static void     *getDefault   (void) { return NULL;                } 
     579     
     580    // Binary 
     581     
     582    // TODO Is it correct to just ignore these for binary ?? 
     583     
     584    static UInt32 getBinSize(void * const &) 
     585    { 
     586        return 0; 
     587    } 
     588 
     589    static UInt32 getBinSize(void* const*, 
     590                                   UInt32     ) 
     591    { 
     592        return 0; 
     593    } 
     594 
     595    static void copyToBin(BinaryDataHandler &, 
     596                          void              * const & ) 
     597    { 
     598    } 
     599 
     600    static void copyToBin(BinaryDataHandler &, 
     601                          void              * const *, 
     602                          UInt32                      ) 
     603    { 
     604    } 
     605 
     606    static void copyFromBin(BinaryDataHandler &, 
     607                            void              * const & ) 
     608    { 
     609    } 
     610 
     611    static void copyFromBin(BinaryDataHandler &, 
     612                            void              * const *, 
     613                            UInt32                      ) 
     614    { 
     615    } 
    579616}; 
    580617 
    581618#endif // !defined(OSG_DO_DOC) || (OSG_DOC_LEVEL >= 3)