Changeset 1132

Show
Ignore:
Timestamp:
04/06/08 23:02:21 (3 months ago)
Author:
vossg
Message:

changed: adjusted names to fit the remaining system

: removed direct public access to storage

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/System/FieldContainer/Fields/PointerFields/OSGPointerMFieldBase.h

    r1122 r1132  
     1/*---------------------------------------------------------------------------*\ 
     2 *                                OpenSG                                     * 
     3 *                                                                           * 
     4 *                                                                           * 
     5 *           Copyright (C) 2008 by the OpenSG Forum                          * 
     6 *                                                                           * 
     7 *                            www.opensg.org                                 * 
     8 *                                                                           * 
     9 *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          * 
     10 *                                                                           * 
     11\*---------------------------------------------------------------------------*/ 
     12/*---------------------------------------------------------------------------*\ 
     13 *                                License                                    * 
     14 *                                                                           * 
     15 * This library is free software; you can redistribute it and/or modify it   * 
     16 * under the terms of the GNU Library General Public License as published    * 
     17 * by the Free Software Foundation, version 2.                               * 
     18 *                                                                           * 
     19 * This library is distributed in the hope that it will be useful, but       * 
     20 * WITHOUT ANY WARRANTY; without even the implied warranty of                * 
     21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         * 
     22 * Library General Public License for more details.                          * 
     23 *                                                                           * 
     24 * You should have received a copy of the GNU Library General Public         * 
     25 * License along with this library; if not, write to the Free Software       * 
     26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 * 
     27 *                                                                           * 
     28\*---------------------------------------------------------------------------*/ 
     29/*---------------------------------------------------------------------------*\ 
     30 *                                Changes                                    * 
     31 *                                                                           * 
     32 *                                                                           * 
     33 *                                                                           * 
     34 *                                                                           * 
     35 *                                                                           * 
     36 *                                                                           * 
     37\*---------------------------------------------------------------------------*/ 
    138 
    239#ifndef _OSGPOINTERMFIELDBASE_H_ 
     
    744#endif 
    845 
    9 #include "OSGConfig.h" 
    10 #include "OSGField.h" 
    11 #include "OSGContainerForwards.h" 
    12 #include "OSGEditPointerMFieldBaseHandle.h" 
    13 #include "OSGGetPointerMFieldBaseHandle.h" 
     46#include "OSGSystemDef.h" 
     47#include "OSGMField.h" 
     48#include "OSGFieldContainerFieldTraits.h" 
    1449 
    1550#ifdef OSG_DOC_FILES_IN_MODULE 
     
    1954#endif 
    2055 
    21  
    2256OSG_BEGIN_NAMESPACE 
    2357 
    24 class PointerMFieldBase : public Field 
     58class OSG_SYSTEM_DLLMAPPING PointerMFieldBase : public Field 
    2559{ 
    2660    /*==========================  PUBLIC  =================================*/ 
     61 
    2762  public: 
     63 
    2864    /*---------------------------------------------------------------------*/ 
    2965    /*! \name Public Types                                                 */ 
    3066    /*! \{                                                                 */ 
    3167     
    32     typedef Field                                   Inherited; 
    33     typedef PointerMFieldBase                       Self; 
     68    typedef       Field                               Inherited; 
     69    typedef       PointerMFieldBase                   Self; 
    3470     
    3571    // storage 
    36     typedef FieldContainerPtr                       StoredType; 
    37     typedef std::allocator<StoredType>              AllocatorType; 
    38      
    39     typedef MFieldVector<StoredType, AllocatorType> PtrStoreType; 
    40     typedef PtrStoreType::iterator                  PtrStoreItType; 
    41     typedef PtrStoreType::const_iterator            PtrStoreConstItType; 
    42      
    43     typedef PtrStoreType::const_iterator            const_iterator; 
    44     typedef PtrStoreType::const_reverse_iterator    const_reverse_iterator; 
    45     typedef PtrStoreType::const_reference           const_reference; 
    46     typedef PtrStoreType::size_type                 size_type; 
    47     typedef PtrStoreType::difference_type           difference_type; 
     72    typedef       FieldContainerPtr                   StoredType; 
     73    typedef       MFieldVector<StoredType>            StorageType; 
     74 
     75    typedef       StorageType::const_iterator         const_iterator; 
     76    typedef       StorageType::const_reverse_iterator const_reverse_iterator; 
     77 
     78    typedef       StorageType::const_iterator         StorageConstIt; 
     79 
     80    typedef const FieldContainerPtr                   const_value; 
     81 
     82    typedef       StorageType::size_type              size_type; 
     83    typedef       StorageType::difference_type        difference_type; 
     84 
     85 
     86    typedef       FieldTraits<FieldContainerPtr, 0>   MFieldTraits; 
     87 
     88 
     89    // handles 
     90    typedef       EditMFieldHandle <Self      >       EditHandle; 
     91    typedef       boost::shared_ptr<EditHandle>       EditHandlePtr; 
     92 
     93    typedef       GetMFieldHandle  <Self     >        GetHandle; 
     94    typedef       boost::shared_ptr<GetHandle>        GetHandlePtr; 
     95     
     96    /*---------------------------------------------------------------------*/ 
     97 
     98    static const bool isSField       = false; 
     99    static const bool isMField       = true; 
     100 
     101    static const bool isPointerField = true; 
     102 
     103    /*---------------------------------------------------------------------*/ 
     104    /*! \name                   Class Get                                  */ 
     105    /*! \{                                                                 */ 
     106 
     107    static const FieldType &getClassType(void); 
     108 
     109    /*! \}                                                                 */ 
     110    /*---------------------------------------------------------------------*/ 
     111    /*! \name                   Binary Interface                           */ 
     112    /*! \{                                                                 */ 
     113 
     114    UInt32 getBinSize(void                   ) const; 
     115     
     116    void   copyToBin (BinaryDataHandler &pMem) const; 
     117 
     118    /*! \}                                                                 */ 
     119    /*---------------------------------------------------------------------*/ 
     120    /*! \name Std Library Const Interface                                  */ 
     121    /*! \{                                                                 */ 
     122     
     123    const_iterator         begin    (void             ) const; 
     124    const_iterator         end      (void             ) const; 
     125     
     126    const_reverse_iterator rbegin   (void             ) const; 
     127    const_reverse_iterator rend     (void             ) const; 
     128     
     129    const_value            front    (void             ) const; 
     130    const_value            back     (void             ) const; 
     131 
     132    bool                   empty    (void             ) const; 
     133    size_type              size     (void             ) const; 
     134    size_type              max_size (void             ) const; 
     135    size_type              capacity (void             ) const; 
     136     
     137    Int32                  findIndex(const_value value) const; 
     138 
     139    /*! \}                                                                 */ 
     140    /*---------------------------------------------------------------------*/ 
     141    /*! \name                  Index Operator                              */ 
     142    /*! \{                                                                 */ 
     143 
     144    const_value operator[](const UInt32 index) const; 
     145    const_value at        (const UInt32 index) const; 
     146     
     147    /*! \}                                                                 */ 
     148    /*---------------------------------------------------------------------*/ 
     149    /*! \name Raw Store Access                                             */ 
     150    /*! \{                                                                 */ 
     151 
     152    bool operator ==(const Self &source) const; 
     153 
     154    /*! \}                                                                 */ 
     155    /*---------------------------------------------------------------------*/ 
     156    /*! \name                      MT Sync                                 */ 
     157    /*! \{                                                                 */ 
     158 
     159    void dump(      UInt32    uiIndent = 0,  
     160              const BitVector bvFlags  = 0) const; 
     161 
     162    /*! \}                                                                 */ 
     163    /*---------------------------------------------------------------------*/ 
     164    /*! \name                      MT Sync                                 */ 
     165    /*! \{                                                                 */ 
     166 
     167#ifdef OSG_MT_CPTR_ASPECT 
     168    void beginEdit      (UInt32              uiAspect, 
     169                         AspectOffsetStore  &oOffsets    ); 
     170 
     171    Self *resolveShare  (UInt32              uiAspect,  
     172                         AspectOffsetStore  &oOffsets    ); 
     173 
     174    void  terminateShare(UInt32              uiAspect,  
     175                         AspectOffsetStore  &oOffsets    ); 
     176 
     177    bool  isShared      (void                            ); 
     178#endif 
     179 
     180    /*! \}                                                                 */ 
     181    /*=========================  PROTECTED  ===============================*/ 
     182 
     183  protected: 
     184 
     185    typedef StorageType::iterator iterator; 
     186    typedef StorageType::iterator StorageIt; 
     187 
     188    /*---------------------------------------------------------------------*/ 
     189    /*! \name Members                                                      */ 
     190    /*! \{                                                                 */ 
     191     
     192    static FieldType   _fieldType; 
     193           StorageType _ptrStore; 
     194     
     195    /*! \}                                                                 */ 
     196    /*---------------------------------------------------------------------*/ 
     197    /*! \name Constructors                                                 */ 
     198    /*! \{                                                                 */ 
     199     
     200    PointerMFieldBase(void); 
     201              
     202    /*! \}                                                                 */ 
     203    /*---------------------------------------------------------------------*/ 
     204    /*! \name Destructor                                                   */ 
     205    /*! \{                                                                 */ 
     206     
     207    ~PointerMFieldBase(void); 
     208     
     209    /*! \}                                                                 */ 
     210    /*---------------------------------------------------------------------*/ 
     211    /*! \name                  Assignment                                  */ 
     212    /*! \{                                                                 */ 
     213 
     214    void operator =(const Self &source); 
     215 
     216    /*! \}                                                                 */ 
     217    /*---------------------------------------------------------------------*/ 
     218    /*! \name Cast Store Access                                            */ 
     219    /*! \{                                                                 */ 
    48220     
    49221    template <class TargetStoredTypeT> 
    50222    struct rebindStore 
    51223    { 
    52         typedef typename  
    53             AllocatorType::template rebind<TargetStoredTypeT>::other 
    54                 TargetAllocatorType; 
    55      
    56         typedef MFieldVector<TargetStoredTypeT, 
    57                              TargetAllocatorType> type; 
     224        typedef MFieldVector<TargetStoredTypeT> type; 
    58225    }; 
    59226 
    60     // handles 
    61     typedef EditMFieldHandle<PointerMFieldBase>      EditHandle; 
    62     typedef EditMFieldHandle<PointerMFieldBase>::Ptr EditHandlePtr; 
    63      
    64     typedef GetMFieldHandle <PointerMFieldBase>      GetHandle; 
    65     typedef GetMFieldHandle <PointerMFieldBase>::Ptr GetHandlePtr; 
    66      
    67     /*! \}                                                                 */ 
    68     /*---------------------------------------------------------------------*/ 
    69     /*! \name Constructors                                                 */ 
    70     /*! \{                                                                 */ 
    71      
    72              PointerMFieldBase(void                ); 
    73              PointerMFieldBase(Self   const &source); 
    74     explicit PointerMFieldBase(UInt32 const  size  ); 
    75      
    76     /*! \}                                                                 */ 
    77     /*---------------------------------------------------------------------*/ 
    78     /*! \name Destructor                                                   */ 
    79     /*! \{                                                                 */ 
    80      
    81     ~PointerMFieldBase(void); 
    82      
    83     /*! \}                                                                 */ 
    84     /*---------------------------------------------------------------------*/ 
    85     /*! \name Std Library Const Interface                                  */ 
    86     /*! \{                                                                 */ 
    87      
    88     const_iterator         begin (void) const; 
    89     const_iterator         end   (void) const; 
    90      
    91     const_reverse_iterator rbegin(void) const; 
    92     const_reverse_iterator rend  (void) const; 
    93      
    94     bool      empty   (void) const; 
    95     size_type size    (void) const; 
    96     size_type max_size(void) const; 
    97     size_type capacity(void) const; 
    98      
    99     const_reference operator[](UInt32 const index); 
    100     const_reference at        (UInt32 const index); 
    101      
    102     const_reference front     (void              ) const; 
    103     const_reference back      (void              ) const; 
    104      
    105     /*! \}                                                                 */ 
    106     /*---------------------------------------------------------------------*/ 
    107     /*! \name Raw Store Access                                             */ 
    108     /*! \{                                                                 */ 
    109      
    110     PtrStoreType       &editRawStore(void); 
    111     PtrStoreType const &getRawStore (void) const; 
    112      
    113     /*! \}                                                                 */ 
    114     /*=========================  PROTECTED  ===============================*/ 
    115   protected: 
    116     /*---------------------------------------------------------------------*/ 
    117     /*! \name Members                                                      */ 
    118     /*! \{                                                                 */ 
    119      
    120     PtrStoreType _ptrStore; 
    121      
    122     /*! \}                                                                 */ 
    123     /*---------------------------------------------------------------------*/ 
    124     /*! \name Cast Store Access                                            */ 
    125     /*! \{                                                                 */ 
    126      
    127227    template <class TargetStoredTypeT> 
    128228    typename rebindStore<TargetStoredTypeT>::type       &editStore(void); 
     
    130230    template <class TargetStoredTypeT> 
    131231    typename rebindStore<TargetStoredTypeT>::type const &getStore (void) const; 
    132      
     232 
     233    StorageType       &editRawStore(void); 
     234    StorageType const &getRawStore (void) const; 
     235 
    133236    /*! \}                                                                 */ 
    134237    /*==========================  PRIVATE  ================================*/ 
     238 
    135239  private: 
     240 
     241    PointerMFieldBase(const Self &obj); 
    136242}; 
    137243 
     244typedef PointerMFieldBase FieldContainerPtrMFieldBase; 
     245 
    138246OSG_END_NAMESPACE 
    139247 
  • trunk/Source/System/FieldContainer/Fields/PointerFields/OSGPointerMFieldBase.inl

    r1122 r1132  
     1/*---------------------------------------------------------------------------*\ 
     2 *                                OpenSG                                     * 
     3 *                                                                           * 
     4 *                                                                           * 
     5 *           Copyright (C) 2008 by the OpenSG Forum                          * 
     6 *                                                                           * 
     7 *                            www.opensg.org                                 * 
     8 *                                                                           * 
     9 *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          * 
     10 *                                                                           * 
     11\*---------------------------------------------------------------------------*/ 
     12/*---------------------------------------------------------------------------*\ 
     13 *                                License                                    * 
     14 *                                                                           * 
     15 * This library is free software; you can redistribute it and/or modify it   * 
     16 * under the terms of the GNU Library General Public License as published    * 
     17 * by the Free Software Foundation, version 2.                               * 
     18 *                                                                           * 
     19 * This library is distributed in the hope that it will be useful, but       * 
     20 * WITHOUT ANY WARRANTY; without even the implied warranty of                * 
     21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         * 
     22 * Library General Public License for more details.                          * 
     23 *                                                                           * 
     24 * You should have received a copy of the GNU Library General Public         * 
     25 * License along with this library; if not, write to the Free Software       * 
     26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 * 
     27 *                                                                           * 
     28\*---------------------------------------------------------------------------*/ 
     29/*---------------------------------------------------------------------------*\ 
     30 *                                Changes                                    * 
     31 *                                                                           * 
     32 *                                                                           * 
     33 *                                                                           * 
     34 *                                                                           * 
     35 *                                                                           * 
     36 *                                                                           * 
     37\*---------------------------------------------------------------------------*/ 
    138 
    239#ifdef OSG_DOC_FILES_IN_MODULE 
     
    1956 */ 
    2057 
     58inline 
     59UInt32 PointerMFieldBase::getBinSize(void) const 
     60{ 
     61    return  
     62        sizeof(UInt32) + // num elements 
     63        (_ptrStore.size() ?  
     64         MFieldTraits::getBinSize(&(_ptrStore[0]), _ptrStore.size()) : 0); 
     65} 
     66 
     67 
     68inline 
     69void PointerMFieldBase::copyToBin(BinaryDataHandler &pMem) const 
     70{ 
     71    UInt32 n = _ptrStore.size(); 
     72 
     73    pMem.putValue(n); 
     74 
     75    if(n != 0) 
     76    { 
     77        MFieldTraits::copyToBin(   pMem,  
     78                                &(_ptrStore[0]), 
     79                                  _ptrStore.size()); 
     80    } 
     81} 
     82 
     83/*-------------------------------------------------------------------------*/ 
     84/* Std Library Const Interface                                             */ 
     85 
     86inline  
     87PointerMFieldBase::const_iterator PointerMFieldBase::begin(void) const 
     88{ 
     89    return _ptrStore.begin(); 
     90} 
     91 
     92inline  
     93PointerMFieldBase::const_iterator PointerMFieldBase::end(void) const 
     94{ 
     95    return _ptrStore.end(); 
     96} 
     97     
     98inline  
     99PointerMFieldBase::const_reverse_iterator PointerMFieldBase::rbegin(void) const 
     100{ 
     101    return _ptrStore.rbegin(); 
     102} 
     103 
     104inline  
     105PointerMFieldBase::const_reverse_iterator PointerMFieldBase::rend(void) const 
     106{ 
     107    return _ptrStore.rend(); 
     108} 
     109 
     110inline  
     111PointerMFieldBase::const_value PointerMFieldBase::front(void) const 
     112{ 
     113    return _ptrStore.front(); 
     114} 
     115 
     116inline  
     117PointerMFieldBase::const_value PointerMFieldBase::back(void) const 
     118{ 
     119    return _ptrStore.back(); 
     120} 
     121 
     122inline  
     123bool PointerMFieldBase::empty(void) const 
     124{ 
     125    return _ptrStore.empty(); 
     126} 
     127 
     128inline  
     129PointerMFieldBase::size_type PointerMFieldBase::size(void) const 
     130{ 
     131    return _ptrStore.size(); 
     132} 
     133 
     134inline  
     135PointerMFieldBase::size_type PointerMFieldBase::max_size(void) const 
     136{ 
     137    return _ptrStore.max_size(); 
     138} 
     139 
     140inline  
     141PointerMFieldBase::size_type PointerMFieldBase::capacity(void) const 
     142{ 
     143    return _ptrStore.capacity(); 
     144} 
     145     
     146inline 
     147Int32 PointerMFieldBase::findIndex(const_value value) const 
     148{ 
     149    const_iterator it = std::find(_ptrStore.begin(), _ptrStore.end(), value); 
     150 
     151    if(it != _ptrStore.end()) 
     152    { 
     153        return it - _ptrStore.begin(); 
     154    } 
     155    else 
     156    { 
     157        return -1; 
     158    } 
     159} 
     160 
     161inline  
     162PointerMFieldBase::const_value  
     163    PointerMFieldBase::operator[](UInt32 const index) const 
     164{ 
     165    return _ptrStore[index]; 
     166} 
     167 
     168inline  
     169PointerMFieldBase::const_value  
     170    PointerMFieldBase::at(UInt32 const index) const 
     171{ 
     172    return _ptrStore.at(index); 
     173} 
     174     
     175inline 
     176bool PointerMFieldBase::operator ==(const Self &source) const 
     177{ 
     178    return _ptrStore == source._ptrStore; 
     179} 
     180 
     181 
     182#ifdef OSG_MT_CPTR_ASPECT 
     183inline 
     184void PointerMFieldBase::beginEdit(UInt32              , 
     185                                  AspectOffsetStore  &) 
     186{ 
     187} 
     188 
     189inline 
     190PointerMFieldBase::Self * 
     191    PointerMFieldBase::resolveShare(UInt32              ,  
     192                                    AspectOffsetStore  &) 
     193{ 
     194    return NULL; 
     195} 
     196 
     197inline 
     198void PointerMFieldBase::terminateShare(UInt32              ,  
     199                                       AspectOffsetStore  &) 
     200{ 
     201     
     202} 
     203 
     204inline 
     205bool PointerMFieldBase::isShared(void) 
     206{ 
     207    return false; 
     208} 
     209#endif 
     210 
    21211/*-------------------------------------------------------------------------*/ 
    22212/* Constructors                                                            */ 
    23213 
    24214inline 
    25     PointerMFieldBase::PointerMFieldBase(void) 
    26      
    27     : _ptrStore() 
    28 
    29 
    30  
    31 inline 
    32     PointerMFieldBase::PointerMFieldBase(Self const &source) 
    33      
    34     : _ptrStore(source._ptrStore) 
    35 
    36 
    37  
    38 inline 
    39     PointerMFieldBase::PointerMFieldBase(UInt32 const size) 
    40      
    41     : _ptrStore(size) 
     215PointerMFieldBase::PointerMFieldBase(void) : 
     216     Inherited(), 
     217    _ptrStore () 
    42218{ 
    43219} 
     
    47223 
    48224inline 
    49     PointerMFieldBase::~PointerMFieldBase(void) 
    50 
    51 
    52  
    53 /*-------------------------------------------------------------------------*/ 
    54 /* Std Library Const Interface                                             */ 
    55  
    56 inline PointerMFieldBase::const_iterator 
    57     PointerMFieldBase::begin(void) const 
    58 
    59     return _ptrStore.begin(); 
    60 
    61  
    62 inline PointerMFieldBase::const_iterator 
    63     PointerMFieldBase::end(void) const 
    64 
    65     return _ptrStore.end(); 
    66 
    67      
    68 inline PointerMFieldBase::const_reverse_iterator 
    69     PointerMFieldBase::rbegin(void) const 
    70 
    71     return _ptrStore.rbegin(); 
    72 
    73  
    74 inline PointerMFieldBase::const_reverse_iterator 
    75     PointerMFieldBase::rend(void) const 
    76 
    77     return _ptrStore.rend(); 
    78 
    79  
    80 inline bool 
    81     PointerMFieldBase::empty(void) const 
    82 
    83     return _ptrStore.empty(); 
    84 
    85  
    86 inline PointerMFieldBase::size_type 
    87     PointerMFieldBase::size(void) const 
    88 
    89     return _ptrStore.size(); 
    90 
    91  
    92 inline PointerMFieldBase::size_type 
    93     PointerMFieldBase::max_size(void) const 
    94 
    95     return _ptrStore.max_size(); 
    96 
    97  
    98 inline PointerMFieldBase::size_type 
    99     PointerMFieldBase::capacity(void) const 
    100 
    101     return _ptrStore.capacity(); 
    102 
    103      
    104 inline PointerMFieldBase::const_reference 
    105     PointerMFieldBase::operator[](UInt32 const index) 
    106 
    107     return _ptrStore[index]; 
    108 
    109  
    110 inline PointerMFieldBase::const_reference 
    111     PointerMFieldBase::at(UInt32 const index) 
    112 
    113     return _ptrStore.at(index); 
    114 
    115      
    116 inline PointerMFieldBase::const_reference 
    117     PointerMFieldBase::front(void) const 
    118 
    119     return _ptrStore.front(); 
    120 
    121  
    122 inline PointerMFieldBase::const_reference 
    123     PointerMFieldBase::back(void) const 
    124 
    125     return _ptrStore.back(); 
    126 
     225PointerMFieldBase::~PointerMFieldBase(void) 
     226
     227
     228 
    127229 
    128230/*-------------------------------------------------------------------------*/ 
    129231/* Raw Store Access                                                        */ 
    130232 
    131 inline PointerMFieldBase::PtrStoreType & 
     233inline  
     234PointerMFieldBase::StorageType & 
    132235    PointerMFieldBase::editRawStore(void) 
    133236{ 
     
    135238} 
    136239 
    137 inline PointerMFieldBase::PtrStoreType const & 
     240inline  
     241PointerMFieldBase::StorageType const & 
    138242    PointerMFieldBase::getRawStore(void) const 
    139243{ 
     
    144248/* Cast Store Access                                                       */ 
    145249 
    146 template <class TargetStoredTypeT> 
    147 inline typename PointerMFieldBase::rebindStore<TargetStoredTypeT>::type & 
     250template <class TargetStoredTypeT> inline  
     251typename PointerMFieldBase::rebindStore<TargetStoredTypeT>::type & 
    148252    PointerMFieldBase::editStore(void) 
    149253{ 
     
    153257} 
    154258 
    155 template <class TargetStoredTypeT> 
    156 inline typename PointerMFieldBase::rebindStore<TargetStoredTypeT>::type const & 
     259template <class TargetStoredTypeT> inline  
     260typename PointerMFieldBase::rebindStore<TargetStoredTypeT>::type const & 
    157261    PointerMFieldBase::getStore(void) const 
    158262{ 
  • trunk/Source/System/FieldContainer/Fields/PointerFields/OSGPointerSFieldBase.h

    r1122 r1132  
     1/*---------------------------------------------------------------------------*\ 
     2 *                                OpenSG                                     * 
     3 *                                                                           * 
     4 *                                                                           * 
     5 *           Copyright (C) 2008 by the OpenSG Forum                          * 
     6 *                                                                           * 
     7 *                            www.opensg.org                                 * 
     8 *                                                                           * 
     9 *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          * 
     10 *                                                                           * 
     11\*---------------------------------------------------------------------------*/ 
     12/*---------------------------------------------------------------------------*\ 
     13 *                                License                                    * 
     14 *                                                                           * 
     15 * This library is free software; you can redistribute it and/or modify it   * 
     16 * under the terms of the GNU Library General Public License as published    * 
     17 * by the Free Software Foundation, version 2.                               * 
     18 *                                                                           * 
     19 * This library is distributed in the hope that it will be useful, but       * 
     20 * WITHOUT ANY WARRANTY; without even the implied warranty of                * 
     21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         * 
     22 * Library General Public License for more details.                          * 
     23 *                                                                           * 
     24 * You should have received a copy of the GNU Library General Public         * 
     25 * License along with this library; if not, write to the Free Software       * 
     26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 * 
     27 *                                                                           * 
     28\*---------------------------------------------------------------------------*/ 
     29/*---------------------------------------------------------------------------*\ 
     30 *                                Changes                                    * 
     31 *                                                                           * 
     32 *                                                                           * 
     33 *                                                                           * 
     34 *                                                                           * 
     35 *                                                                           * 
     36 *                                                                           * 
     37\*---------------------------------------------------------------------------*/ 
    138 
    239#ifndef _OSGPOINTERSFIELDBASE_H_ 
     
    744#endif 
    845 
    9 #include "OSGConfig.h" 
    10 #include "OSGField.h" 
    11 #include "OSGContainerForwards.h" 
    12 #include "OSGEditPointerSFieldBaseHandle.h" 
    13 #include "OSGGetPointerSFieldBaseHandle.h" 
     46#include "OSGSystemDef.h" 
     47#include "OSGSField.h" 
     48#include "OSGFieldContainerFieldTraits.h" 
    1449 
    1550 
     
    2257OSG_BEGIN_NAMESPACE 
    2358 
    24 class PointerSFieldBase : public Field 
     59class OSG_SYSTEM_DLLMAPPING PointerSFieldBase : public Field 
    2560{ 
    2661    /*==========================  PUBLIC  =================================*/ 
     62 
    2763  public: 
     64 
    2865    /*---------------------------------------------------------------------*/ 
    2966    /*! \name Public Types                                                 */ 
    3067    /*! \{                                                                 */ 
    3168     
    32     typedef Field             Inherited; 
    33     typedef PointerSFieldBase Self; 
     69    typedef       Field                                    Inherited; 
     70 
     71    typedef       PointerSFieldBase                        Self; 
     72    typedef       FieldTraits      <FieldContainerPtr, 0>  SFieldTraits; 
    3473     
    3574    // storage 
    36     typedef FieldContainerPtr StoredType; 
     75    typedef       FieldContainerPtr                        StoredType; 
     76    typedef const FieldContainerPtr                        const_value; 
     77 
     78    typedef       EditSFieldHandle <Self      >            EditHandle; 
     79    typedef       boost::shared_ptr<EditHandle>            EditHandlePtr; 
     80 
     81    typedef       GetSFieldHandle  <Self     >             GetHandle; 
     82    typedef       boost::shared_ptr<GetHandle>             GetHandlePtr; 
    3783     
    38     typedef StoredType       &StoredTypeRef; 
    39     typedef StoredType const &StoredTypeConstRef; 
     84    /*---------------------------------------------------------------------*/ 
     85 
     86    static const bool isSField       = true; 
     87    static const bool isMField       = false; 
     88 
     89    static const bool isPointerField = true; 
     90 
     91    /*! \}                                                                 */ 
     92    /*---------------------------------------------------------------------*/ 
     93    /*! \name                   Class Get                                  */ 
     94    /*! \{                                                                 */ 
     95 
     96    static const FieldType &getClassType(void); 
     97 
     98    /*! \}                                                                 */ 
     99    /*---------------------------------------------------------------------*/ 
     100    /*! \name Raw Store Access                                             */ 
     101    /*! \{                                                                 */ 
    40102     
    41     // handles 
    42     typedef EditSFieldHandle<PointerSFieldBase>      EditHandle; 
    43     typedef EditSFieldHandle<PointerSFieldBase>::Ptr EditHandlePtr; 
     103    const_value getValue(void) const; 
    44104     
    45     typedef GetSFieldHandle <PointerSFieldBase>      GetHandle; 
    46     typedef GetSFieldHandle <PointerSFieldBase>::Ptr GetHandlePtr; 
     105    /*! \}                                                                 */ 
     106    /*---------------------------------------------------------------------*/ 
     107    /*! \name                   Binary Interface                           */ 
     108    /*! \{                                                                 */ 
     109 
     110    UInt32 getBinSize(void                   ) const; 
     111     
     112    void   copyToBin (BinaryDataHandler &pMem) const; 
     113 
     114    /*! \}                                                                 */ 
     115    /*---------------------------------------------------------------------*/ 
     116    /*! \name Raw Store Access                                             */