| | 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 | \*---------------------------------------------------------------------------*/ |
|---|
| | 58 | inline |
|---|
| | 59 | UInt32 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 | |
|---|
| | 68 | inline |
|---|
| | 69 | void 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 | |
|---|
| | 86 | inline |
|---|
| | 87 | PointerMFieldBase::const_iterator PointerMFieldBase::begin(void) const |
|---|
| | 88 | { |
|---|
| | 89 | return _ptrStore.begin(); |
|---|
| | 90 | } |
|---|
| | 91 | |
|---|
| | 92 | inline |
|---|
| | 93 | PointerMFieldBase::const_iterator PointerMFieldBase::end(void) const |
|---|
| | 94 | { |
|---|
| | 95 | return _ptrStore.end(); |
|---|
| | 96 | } |
|---|
| | 97 | |
|---|
| | 98 | inline |
|---|
| | 99 | PointerMFieldBase::const_reverse_iterator PointerMFieldBase::rbegin(void) const |
|---|
| | 100 | { |
|---|
| | 101 | return _ptrStore.rbegin(); |
|---|
| | 102 | } |
|---|
| | 103 | |
|---|
| | 104 | inline |
|---|
| | 105 | PointerMFieldBase::const_reverse_iterator PointerMFieldBase::rend(void) const |
|---|
| | 106 | { |
|---|
| | 107 | return _ptrStore.rend(); |
|---|
| | 108 | } |
|---|
| | 109 | |
|---|
| | 110 | inline |
|---|
| | 111 | PointerMFieldBase::const_value PointerMFieldBase::front(void) const |
|---|
| | 112 | { |
|---|
| | 113 | return _ptrStore.front(); |
|---|
| | 114 | } |
|---|
| | 115 | |
|---|
| | 116 | inline |
|---|
| | 117 | PointerMFieldBase::const_value PointerMFieldBase::back(void) const |
|---|
| | 118 | { |
|---|
| | 119 | return _ptrStore.back(); |
|---|
| | 120 | } |
|---|
| | 121 | |
|---|
| | 122 | inline |
|---|
| | 123 | bool PointerMFieldBase::empty(void) const |
|---|
| | 124 | { |
|---|
| | 125 | return _ptrStore.empty(); |
|---|
| | 126 | } |
|---|
| | 127 | |
|---|
| | 128 | inline |
|---|
| | 129 | PointerMFieldBase::size_type PointerMFieldBase::size(void) const |
|---|
| | 130 | { |
|---|
| | 131 | return _ptrStore.size(); |
|---|
| | 132 | } |
|---|
| | 133 | |
|---|
| | 134 | inline |
|---|
| | 135 | PointerMFieldBase::size_type PointerMFieldBase::max_size(void) const |
|---|
| | 136 | { |
|---|
| | 137 | return _ptrStore.max_size(); |
|---|
| | 138 | } |
|---|
| | 139 | |
|---|
| | 140 | inline |
|---|
| | 141 | PointerMFieldBase::size_type PointerMFieldBase::capacity(void) const |
|---|
| | 142 | { |
|---|
| | 143 | return _ptrStore.capacity(); |
|---|
| | 144 | } |
|---|
| | 145 | |
|---|
| | 146 | inline |
|---|
| | 147 | Int32 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 | |
|---|
| | 161 | inline |
|---|
| | 162 | PointerMFieldBase::const_value |
|---|
| | 163 | PointerMFieldBase::operator[](UInt32 const index) const |
|---|
| | 164 | { |
|---|
| | 165 | return _ptrStore[index]; |
|---|
| | 166 | } |
|---|
| | 167 | |
|---|
| | 168 | inline |
|---|
| | 169 | PointerMFieldBase::const_value |
|---|
| | 170 | PointerMFieldBase::at(UInt32 const index) const |
|---|
| | 171 | { |
|---|
| | 172 | return _ptrStore.at(index); |
|---|
| | 173 | } |
|---|
| | 174 | |
|---|
| | 175 | inline |
|---|
| | 176 | bool PointerMFieldBase::operator ==(const Self &source) const |
|---|
| | 177 | { |
|---|
| | 178 | return _ptrStore == source._ptrStore; |
|---|
| | 179 | } |
|---|
| | 180 | |
|---|
| | 181 | |
|---|
| | 182 | #ifdef OSG_MT_CPTR_ASPECT |
|---|
| | 183 | inline |
|---|
| | 184 | void PointerMFieldBase::beginEdit(UInt32 , |
|---|
| | 185 | AspectOffsetStore &) |
|---|
| | 186 | { |
|---|
| | 187 | } |
|---|
| | 188 | |
|---|
| | 189 | inline |
|---|
| | 190 | PointerMFieldBase::Self * |
|---|
| | 191 | PointerMFieldBase::resolveShare(UInt32 , |
|---|
| | 192 | AspectOffsetStore &) |
|---|
| | 193 | { |
|---|
| | 194 | return NULL; |
|---|
| | 195 | } |
|---|
| | 196 | |
|---|
| | 197 | inline |
|---|
| | 198 | void PointerMFieldBase::terminateShare(UInt32 , |
|---|
| | 199 | AspectOffsetStore &) |
|---|
| | 200 | { |
|---|
| | 201 | |
|---|
| | 202 | } |
|---|
| | 203 | |
|---|
| | 204 | inline |
|---|
| | 205 | bool PointerMFieldBase::isShared(void) |
|---|
| | 206 | { |
|---|
| | 207 | return false; |
|---|
| | 208 | } |
|---|
| | 209 | #endif |
|---|
| | 210 | |
|---|
| 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 | | } |
|---|
| | 225 | PointerMFieldBase::~PointerMFieldBase(void) |
|---|
| | 226 | { |
|---|
| | 227 | } |
|---|
| | 228 | |
|---|