| | 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 | \*---------------------------------------------------------------------------*/ |
|---|
| 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 | /*! \{ */ |
|---|
| 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 | | |
|---|