Show
Ignore:
Timestamp:
04/07/08 02:50:33 (8 months ago)
Author:
vossg
Message:

changed: merged some merge changes back to have a running reference

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Carsten_PtrWork2/Source/System/FieldContainer/Fields/Base/OSGPointerMFieldBase.h

    r1072 r1138  
     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" 
     46#include "OSGSystemDef.h" 
     47#include "OSGMField.h" 
     48#include "OSGFieldContainerFieldTraits.h" 
     49 
     50#include "OSGGetPointerMFieldBaseHandle.h" 
     51#include "OSGGetPointerMFieldHandle.h" 
    1252#include "OSGEditPointerMFieldBaseHandle.h" 
    13 #include "OSGGetPointerMFieldBaseHandle.h" 
     53#include "OSGEditPointerMFieldHandle.h" 
    1454 
    1555#ifdef OSG_DOC_FILES_IN_MODULE 
     
    1959#endif 
    2060 
    21  
    2261OSG_BEGIN_NAMESPACE 
    2362 
    24 class PointerMFieldBase : public Field 
     63class OSG_SYSTEM_DLLMAPPING PointerMFieldBase : public Field 
    2564{ 
    2665    /*==========================  PUBLIC  =================================*/ 
     66 
    2767  public: 
     68 
    2869    /*---------------------------------------------------------------------*/ 
    2970    /*! \name Public Types                                                 */ 
    3071    /*! \{                                                                 */ 
    3172     
    32     typedef Field                                   Inherited; 
    33     typedef PointerMFieldBase                       Self; 
     73    typedef       Field                               Inherited; 
     74    typedef       PointerMFieldBase                   Self; 
    3475     
    3576    // 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; 
     77    typedef       FieldContainerPtr                   StoredType; 
     78    typedef       MFieldVector<StoredType>            StorageType; 
     79 
     80    typedef       StorageType::const_iterator         const_iterator; 
     81    typedef       StorageType::const_reverse_iterator const_reverse_iterator; 
     82 
     83    typedef       StorageType::const_iterator         StorageConstIt; 
     84 
     85    typedef const FieldContainerPtr                   const_value; 
     86 
     87    typedef       StorageType::size_type              size_type; 
     88    typedef       StorageType::difference_type        difference_type; 
     89 
     90 
     91    typedef       FieldTraits<FieldContainerPtr, 0>   MFieldTraits; 
     92 
     93 
     94    // handles 
     95    typedef       EditMFieldHandle <Self      >       EditHandle; 
     96    typedef       boost::shared_ptr<EditHandle>       EditHandlePtr; 
     97 
     98    typedef       GetMFieldHandle  <Self     >        GetHandle; 
     99    typedef       boost::shared_ptr<GetHandle>        GetHandlePtr; 
     100     
     101    /*---------------------------------------------------------------------*/ 
     102 
     103    static const bool isSField       = false; 
     104    static const bool isMField       = true; 
     105 
     106    static const bool isPointerField = true; 
     107 
     108    /*---------------------------------------------------------------------*/ 
     109    /*! \name                   Class Get                                  */ 
     110    /*! \{                                                                 */ 
     111 
     112    static const FieldType &getClassType(void); 
     113 
     114    /*! \}                                                                 */ 
     115    /*---------------------------------------------------------------------*/ 
     116    /*! \name                   Binary Interface                           */ 
     117    /*! \{                                                                 */ 
     118 
     119    UInt32 getBinSize(void                   ) const; 
     120     
     121    void   copyToBin (BinaryDataHandler &pMem) const; 
     122 
     123    /*! \}                                                                 */ 
     124    /*---------------------------------------------------------------------*/ 
     125    /*! \name Std Library Const Interface                                  */ 
     126    /*! \{                                                                 */ 
     127     
     128    const_iterator         begin    (void             ) const; 
     129    const_iterator         end      (void             ) const; 
     130     
     131    const_reverse_iterator rbegin   (void             ) const; 
     132    const_reverse_iterator rend     (void             ) const; 
     133     
     134    const_value            front    (void             ) const; 
     135    const_value            back     (void             ) const; 
     136 
     137    bool                   empty    (void             ) const; 
     138    size_type              size     (void             ) const; 
     139    size_type              max_size (void             ) const; 
     140    size_type              capacity (void             ) const; 
     141     
     142    Int32                  findIndex(const_value value) const; 
     143 
     144    /*! \}                                                                 */ 
     145    /*---------------------------------------------------------------------*/ 
     146    /*! \name                  Index Operator                              */ 
     147    /*! \{                                                                 */ 
     148 
     149    const_value operator[](const UInt32 index) const; 
     150    const_value at        (const UInt32 index) const; 
     151     
     152    /*! \}                                                                 */ 
     153    /*---------------------------------------------------------------------*/ 
     154    /*! \name Raw Store Access                                             */ 
     155    /*! \{                                                                 */ 
     156 
     157    bool operator ==(const Self &source) const; 
     158 
     159    /*! \}                                                                 */ 
     160    /*---------------------------------------------------------------------*/ 
     161    /*! \name                      MT Sync                                 */ 
     162    /*! \{                                                                 */ 
     163 
     164    void dump(      UInt32    uiIndent = 0,  
     165              const BitVector bvFlags  = 0) const; 
     166 
     167    /*! \}                                                                 */ 
     168    /*---------------------------------------------------------------------*/ 
     169    /*! \name                      MT Sync                                 */ 
     170    /*! \{                                                                 */ 
     171 
     172#ifdef OSG_MT_CPTR_ASPECT 
     173    void beginEdit      (UInt32              uiAspect, 
     174                         AspectOffsetStore  &oOffsets    ); 
     175 
     176    Self *resolveShare  (UInt32              uiAspect,  
     177                         AspectOffsetStore  &oOffsets    ); 
     178 
     179    void  terminateShare(UInt32              uiAspect,  
     180                         AspectOffsetStore  &oOffsets    ); 
     181 
     182    bool  isShared      (void                            ); 
     183#endif 
     184 
     185    /*! \}                                                                 */ 
     186    /*=========================  PROTECTED  ===============================*/ 
     187 
     188  protected: 
     189 
     190    typedef StorageType::iterator iterator; 
     191    typedef StorageType::iterator StorageIt; 
     192 
     193    /*---------------------------------------------------------------------*/ 
     194    /*! \name Members                                                      */ 
     195    /*! \{                                                                 */ 
     196     
     197    static FieldType   _fieldType; 
     198           StorageType _ptrStore; 
     199     
     200    /*! \}                                                                 */ 
     201    /*---------------------------------------------------------------------*/ 
     202    /*! \name Constructors                                                 */ 
     203    /*! \{                                                                 */ 
     204     
     205    PointerMFieldBase(void); 
     206              
     207    /*! \}                                                                 */ 
     208    /*---------------------------------------------------------------------*/ 
     209    /*! \name Destructor                                                   */ 
     210    /*! \{                                                                 */ 
     211     
     212    ~PointerMFieldBase(void); 
     213     
     214    /*! \}                                                                 */ 
     215    /*---------------------------------------------------------------------*/ 
     216    /*! \name                  Assignment                                  */ 
     217    /*! \{                                                                 */ 
     218 
     219    void operator =(const Self &source); 
     220 
     221    /*! \}                                                                 */ 
     222    /*---------------------------------------------------------------------*/ 
     223    /*! \name Cast Store Access                                            */ 
     224    /*! \{                                                                 */ 
    48225     
    49226    template <class TargetStoredTypeT> 
    50227    struct rebindStore 
    51228    { 
    52         typedef typename  
    53             AllocatorType::template rebind<TargetStoredTypeT>::other 
    54                 TargetAllocatorType; 
    55      
    56         typedef MFieldVector<TargetStoredTypeT, 
    57                              TargetAllocatorType> type; 
     229        typedef MFieldVector<TargetStoredTypeT> type; 
    58230    }; 
    59231 
    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      
    127232    template <class TargetStoredTypeT> 
    128233    typename rebindStore<TargetStoredTypeT>::type       &editStore(void); 
     
    130235    template <class TargetStoredTypeT> 
    131236    typename rebindStore<TargetStoredTypeT>::type const &getStore (void) const; 
    132      
     237 
     238    StorageType       &editRawStore(void); 
     239    StorageType const &getRawStore (void) const; 
     240 
    133241    /*! \}                                                                 */ 
    134242    /*==========================  PRIVATE  ================================*/ 
     243 
    135244  private: 
     245 
     246    PointerMFieldBase(const Self &obj); 
    136247}; 
    137248 
     249typedef PointerMFieldBase FieldContainerPtrMFieldBase; 
     250 
    138251OSG_END_NAMESPACE 
    139252