Ticket #49: NFIO_Attachment_unfinished.diff

File NFIO_Attachment_unfinished.diff, 5.6 kB (added by cneumann, 2 years ago)

Incomplete patch - do NOT commit

  • Source/System/FieldContainer/Base/OSGFieldContainerAttachment.h

    old new  
    140140    /*! \name                   Binary Access                              */ 
    141141    /*! \{                                                                 */ 
    142142 
     143    virtual UInt32 getBinSize (ConstFieldMaskArg  whichField); 
     144    virtual void   copyToBin  (BinaryDataHandler &pMem, 
     145                               ConstFieldMaskArg  whichField); 
     146    virtual void   copyFromBin(BinaryDataHandler &pMem, 
     147                               ConstFieldMaskArg  whichField); 
     148     
    143149    /*! \}                                                                 */ 
    144150    /*---------------------------------------------------------------------*/ 
    145151    /*! \name                   your_operators                             */ 
  • Source/System/FieldContainer/Base/OSGFieldContainerAttachment.cpp

    old new  
    4949 
    5050OSG_USING_NAMESPACE 
    5151 
     52/*-------------------------------------------------------------------------*/ 
     53/*                           Binary Access                                 */ 
     54 
     55UInt32  
     56FieldContainerAttachment::getBinSize(ConstFieldMaskArg whichField) 
     57{ 
     58    UInt32 returnValue = Inherited::getBinSize(whichField); 
     59     
     60    if(FieldBits::NoField != (ParentsFieldMask & whichField)) 
     61    { 
     62        returnValue += _mfParents.getBinSize(); 
     63    } 
     64     
     65    if(FieldBits::NoField != (InternalFieldMask & whichField)) 
     66    { 
     67        returnValue += _sfInternal.getBinSize(); 
     68    } 
     69     
     70    return returnValue; 
     71} 
     72 
     73void 
     74FieldContainerAttachment::copyToBin(BinaryDataHandler &pMem, 
     75                                    ConstFieldMaskArg  whichField) 
     76{ 
     77    Inherited::copyToBin(pMem, whichField); 
     78 
     79    if(FieldBits::NoField != (ParentsFieldMask & whichField)) 
     80    { 
     81        _mfParents.copyToBin(pMem); 
     82    } 
     83     
     84    if(FieldBits::NoField != (InternalFieldMask & whichField)) 
     85    { 
     86        _sfInternal.copyToBin(pMem); 
     87    } 
     88} 
     89 
     90void 
     91FieldContainerAttachment::copyFromBin(BinaryDataHandler &pMem, 
     92                                      ConstFieldMaskArg  whichField) 
     93{ 
     94    Inherited::copyFromBin(pMem, whichField); 
     95 
     96    if(FieldBits::NoField != (ParentsFieldMask & whichField)) 
     97    { 
     98        _mfParents.copyFromBin(pMem); 
     99    } 
     100 
     101    if(FieldBits::NoField != (InternalFieldMask & whichField)) 
     102    { 
     103        _sfInternal.copyFromBin(pMem); 
     104    } 
     105} 
     106 
     107/*-------------------------------------------------------------------------*/ 
     108/*                               Fields                                    */ 
     109 
    52110void FieldContainerAttachment::classDescInserter(TypeObject &oType) 
    53111{ 
    54112    Inherited::classDescInserter(oType); 
  • 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/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)