| 1 | /* |
| 2 | * |
| 3 | * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * Further, this software is distributed without any warranty that it is |
| 16 | * free of the rightful claim of any third person regarding infringement |
| 17 | * or the like. Any license provided herein, whether implied or |
| 18 | * otherwise, applies only to this software file. Patent licenses, if |
| 19 | * any, provided herein do not apply to combinations of this program with |
| 20 | * other software, or any other product whatsoever. |
| 21 | * |
| 22 | * You should have received a copy of the GNU Lesser General Public |
| 23 | * License along with this library; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 | * |
| 26 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, |
| 27 | * Mountain View, CA 94043, or: |
| 28 | * |
| 29 | * http://www.sgi.com |
| 30 | * |
| 31 | * For further information regarding this notice, see: |
| 32 | * |
| 33 | * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ |
| 34 | * |
| 35 | */ |
| 36 | |
| 37 | /* |
| 38 | * Copyright (C) 1990,91 Silicon Graphics, Inc. |
| 39 | * |
| 40 | _______________________________________________________________________ |
| 41 | ______________ S I L I C O N G R A P H I C S I N C . ____________ |
| 42 | | |
| 43 | | $Revision: 1.2 $ |
| 44 | | |
| 45 | | Classes: |
| 46 | | SoBaseList |
| 47 | | |
| 48 | | Author(s) : Nick Thompson |
| 49 | | |
| 50 | ______________ S I L I C O N G R A P H I C S I N C . ____________ |
| 51 | _______________________________________________________________________ |
| 52 | */ |
| 53 | |
| 54 | #include <cstdlib> |
| 55 | #include <Inventor/SoLists.h>cxx . . $ `<file>/lib/database/include/Inventor/SoLists.h`/ |
| 56 | #include <Inventor/SoPath.h>cxx . . $ `<file>/lib/database/include/Inventor/SoPath.h`/ |
| 57 | #include <Inventor/SoPickedPoint.h>cxx . . $ `<file>/lib/database/include/Inventor/SoPickedPoint.h`/ |
| 58 | #include <Inventor/details/SoDetail.h>cxx . . $ `<file>/lib/database/include/Inventor/details/SoDetail.h`/ |
| 59 | #include <Inventor/misc/SoBase.h>cxx . . $ `<file>/lib/database/include/Inventor/misc/SoBase.h`/ |
| 60 | |
| 61 | //////////////////////////////////////////////////////////////////////// |
| 62 | // |
| 63 | // Description: |
| 64 | // Default constructor. |
| 65 | // |
| 66 | // Use: public |
| 67 | |
| 68 | SoBaseListcxx . . $ SoBaseList#::SoBaseListcxx . . $ SoBaseList#SoBaseList(49f6e7a06ebc5aa8).() : SbPListcxx . . $ SbPList#() |
| 69 | // |
| 70 | //////////////////////////////////////////////////////////////////////// |
| 71 | { |
| 72 | // By default, this adds references to things in the list when |
| 73 | // they are added |
| 74 | addRefscxx . . $ SoBaseList#addRefs. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!; |
| 75 | } |
| 76 | |
| 77 | //////////////////////////////////////////////////////////////////////// |
| 78 | // |
| 79 | // Description: |
| 80 | // Constructor that takes initial approximate size (number of items |
| 81 | // in list). |
| 82 | // |
| 83 | // Use: public |
| 84 | |
| 85 | SoBaseListcxx . . $ SoBaseList#::SoBaseListcxx . . $ SoBaseList#SoBaseList(d4f767463ce0a6b3).(int size) : SbPListcxx . . $ SbPList#(size) |
| 86 | // |
| 87 | //////////////////////////////////////////////////////////////////////// |
| 88 | { |
| 89 | // By default, this adds references to things in the list when |
| 90 | // they are added |
| 91 | addRefscxx . . $ SoBaseList#addRefs. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!; |
| 92 | } |
| 93 | |
| 94 | //////////////////////////////////////////////////////////////////////// |
| 95 | // |
| 96 | // Description: |
| 97 | // Constructor that takes another list to copy values from. |
| 98 | // |
| 99 | // Use: public |
| 100 | |
| 101 | SoBaseListcxx . . $ SoBaseList#::SoBaseListcxx . . $ SoBaseList#SoBaseList(10364c8f87345983).(const SoBaseListcxx . . $ SoBaseList# &l) |
| 102 | // |
| 103 | //////////////////////////////////////////////////////////////////////// |
| 104 | { |
| 105 | // By default, this adds references to things in the list when |
| 106 | // they are added |
| 107 | addRefscxx . . $ SoBaseList#addRefs. = TRUEcxx . . $ `lib/database/include/Inventor/SbBasic.h:80:12`!; |
| 108 | |
| 109 | copycxx . . $ SoBaseList#copy(10364c8f87345983).(l); |
| 110 | } |
| 111 | |
| 112 | //////////////////////////////////////////////////////////////////////// |
| 113 | // |
| 114 | // Description: |
| 115 | // Add a pointer to the end of the list |
| 116 | // |
| 117 | // Use: public |
| 118 | |
| 119 | void |
| 120 | SoBaseListcxx . . $ SoBaseList#::appendcxx . . $ SoBaseList#append(2ca869ab50d3357c).(SoBasecxx . . $ SoBase# * ptr) // pointer to append |
| 121 | // |
| 122 | //////////////////////////////////////////////////////////////////////// |
| 123 | { |
| 124 | SbPListcxx . . $ SbPList#::appendcxx . . $ SbPList#append(5d22bdacc48458e8).((void *) ptr); |
| 125 | if (addRefscxx . . $ SoBaseList#addRefs. && ptr) |
| 126 | ptr->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 127 | } |
| 128 | |
| 129 | //////////////////////////////////////////////////////////////////////// |
| 130 | // |
| 131 | // Description: |
| 132 | // Insert given pointer into list before pointer with given index |
| 133 | // |
| 134 | // Use: public |
| 135 | |
| 136 | void |
| 137 | SoBaseListcxx . . $ SoBaseList#::insertcxx . . $ SoBaseList#insert(333ccdd0a86c894f).(SoBasecxx . . $ SoBase# *ptr, // pointer to insert |
| 138 | int addBefore) // index to add before |
| 139 | // |
| 140 | //////////////////////////////////////////////////////////////////////// |
| 141 | { |
| 142 | if (addRefscxx . . $ SoBaseList#addRefs. && ptr) |
| 143 | ptr->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 144 | SbPListcxx . . $ SbPList#::insertcxx . . $ SbPList#insert(d0320739773070f2).((void *) ptr, addBefore); |
| 145 | } |
| 146 | |
| 147 | //////////////////////////////////////////////////////////////////////// |
| 148 | // |
| 149 | // Description: |
| 150 | // Remove pointer with given index |
| 151 | // |
| 152 | // Use: public |
| 153 | |
| 154 | void |
| 155 | SoBaseListcxx . . $ SoBaseList#::removecxx . . $ SoBaseList#remove(d4f767463ce0a6b3).(int which) // index of pointer to remove |
| 156 | // |
| 157 | //////////////////////////////////////////////////////////////////////// |
| 158 | { |
| 159 | if (addRefscxx . . $ SoBaseList#addRefs. && (*this)[cxx . . $ SoBaseList#`operator[]`(71259b488a9e3f20).which]) |
| 160 | (*this)[cxx . . $ SoBaseList#`operator[]`(71259b488a9e3f20).which]->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 161 | SbPListcxx . . $ SbPList#::removecxx . . $ SbPList#remove(d4f767463ce0a6b3).(which); |
| 162 | } |
| 163 | |
| 164 | //////////////////////////////////////////////////////////////////////// |
| 165 | // |
| 166 | // Description: |
| 167 | // Remove all pointers from one with given index on, inclusive |
| 168 | // |
| 169 | // Use: public |
| 170 | |
| 171 | void |
| 172 | SoBaseListcxx . . $ SoBaseList#::truncatecxx . . $ SoBaseList#truncate(d4f767463ce0a6b3).(int start) // first index to remove |
| 173 | // |
| 174 | //////////////////////////////////////////////////////////////////////// |
| 175 | { |
| 176 | int i; |
| 177 | |
| 178 | if (addRefscxx . . $ SoBaseList#addRefs.) { |
| 179 | for ( i = start; i < getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) { |
| 180 | if ( (*this)[cxx . . $ SoBaseList#`operator[]`(71259b488a9e3f20).i] ) { |
| 181 | (*this)[cxx . . $ SoBaseList#`operator[]`(71259b488a9e3f20).i]->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | SbPListcxx . . $ SbPList#::truncatecxx . . $ SbPList#truncate(d4f767463ce0a6b3).(start); |
| 187 | } |
| 188 | |
| 189 | //////////////////////////////////////////////////////////////////////// |
| 190 | // |
| 191 | // Description: |
| 192 | // Copy a list, keeping all reference counts correct |
| 193 | // |
| 194 | // Use: public |
| 195 | |
| 196 | void |
| 197 | SoBaseListcxx . . $ SoBaseList#::copycxx . . $ SoBaseList#copy(10364c8f87345983).(const SoBaseListcxx . . $ SoBaseList# &bList) // list to copy from |
| 198 | // |
| 199 | //////////////////////////////////////////////////////////////////////// |
| 200 | { |
| 201 | int i; |
| 202 | |
| 203 | truncatecxx . . $ SoBaseList#truncate(d4f767463ce0a6b3).(0); |
| 204 | |
| 205 | if (addRefscxx . . $ SoBaseList#addRefs.) { |
| 206 | for (i = 0; i < bList.getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) { |
| 207 | if ( bList[cxx . . $ SoBaseList#`operator[]`(71259b488a9e3f20).i] ) { |
| 208 | bList[cxx . . $ SoBaseList#`operator[]`(71259b488a9e3f20).i]->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | SbPListcxx . . $ SbPList#::copycxx . . $ SbPList#copy(77684fc585f5010a).(bList); |
| 214 | } |
| 215 | |
| 216 | //////////////////////////////////////////////////////////////////////// |
| 217 | // |
| 218 | // Description: |
| 219 | // Set an element of a list |
| 220 | // |
| 221 | // Use: public |
| 222 | |
| 223 | void |
| 224 | SoBaseListcxx . . $ SoBaseList#::setcxx . . $ SoBaseList#set(1216a0bcb603e99b).(int i, // index to set |
| 225 | SoBasecxx . . $ SoBase# *ptr) // new pointer value |
| 226 | // |
| 227 | //////////////////////////////////////////////////////////////////////// |
| 228 | { |
| 229 | if (addRefscxx . . $ SoBaseList#addRefs.) { |
| 230 | if ( ptr ) { |
| 231 | ptr->refcxx . . $ SoBase#ref(83f5f38750778ac8).() ; |
| 232 | } |
| 233 | if ( (*this)[cxx . . $ SoBaseList#`operator[]`(71259b488a9e3f20).i] ) { |
| 234 | (*this)[cxx . . $ SoBaseList#`operator[]`(71259b488a9e3f20).i]->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 235 | } |
| 236 | } |
| 237 | (*(const SbPListcxx . . $ SbPList# *) this) [cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i] = (void *) ptr; |
| 238 | } |
| 239 | |
| 240 | //////////////////////////////////////////////////////////////////////// |
| 241 | // |
| 242 | // Description: |
| 243 | // Looks in the SoPathList for a path that matches a given one, using the |
| 244 | // == operator. If it is found, return that index, otherwise retun -1 |
| 245 | // |
| 246 | // Use: public |
| 247 | |
| 248 | int |
| 249 | SoPathListcxx . . $ SoPathList#::findPathcxx . . $ SoPathList#findPath(323054a74e381ab6).(const SoPathcxx . . $ SoPath# &path) |
| 250 | // |
| 251 | //////////////////////////////////////////////////////////////////////// |
| 252 | { |
| 253 | int i; |
| 254 | SoPathcxx . . $ SoPath# *testPath; |
| 255 | |
| 256 | for(i = 0; i < getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) { |
| 257 | testPath = (*this)[cxx . . $ SoPathList#`operator[]`(81b2b9099fcfac9c).i]; |
| 258 | if (*testPath ==cxx . . $ `operator==`(2fef70290af29791). path) |
| 259 | return i; |
| 260 | } |
| 261 | return -1; // not found |
| 262 | } |
| 263 | |
| 264 | //////////////////////////////////////////////////////////////////////// |
| 265 | // |
| 266 | // Description: |
| 267 | // Sorts path list in place based on (1) increasing address of head |
| 268 | // node, then (2) increasing indices of children. |
| 269 | // |
| 270 | // Use: public |
| 271 | |
| 272 | void |
| 273 | SoPathListcxx . . $ SoPathList#::sortcxx . . $ SoPathList#sort(49f6e7a06ebc5aa8).() |
| 274 | // |
| 275 | //////////////////////////////////////////////////////////////////////// |
| 276 | { |
| 277 | SoPathcxx . . $ SoPath# **paths = new SoPathcxx . . $ SoPath# *[getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).()]; |
| 278 | int i; |
| 279 | |
| 280 | // Use qsort to do the work |
| 281 | for (i = 0; i < getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) { |
| 282 | paths[i] = (*this)[cxx . . $ SoPathList#`operator[]`(81b2b9099fcfac9c).i]; |
| 283 | paths[i]->refcxx . . $ SoBase#ref(83f5f38750778ac8).(); |
| 284 | } |
| 285 | |
| 286 | qsort(paths, getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(), sizeof(SoPathcxx . . $ SoPath# *), comparePathscxx . . $ SoPathList#comparePaths(9148c8c3ff42c9d8).); |
| 287 | |
| 288 | // Move the paths back into this list |
| 289 | for (i = 0; i < getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) |
| 290 | setcxx . . $ SoBaseList#set(1216a0bcb603e99b).(i, paths[i]); |
| 291 | |
| 292 | // Get rid of the array |
| 293 | for (i = 0; i < getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) |
| 294 | paths[i]->unrefcxx . . $ SoBase#unref(83f5f38750778ac8).(); |
| 295 | delete [] paths; |
| 296 | } |
| 297 | |
| 298 | //////////////////////////////////////////////////////////////////////// |
| 299 | // |
| 300 | // Description: |
| 301 | // Given a sorted list, removes any path that (1) is a duplicate, |
| 302 | // or (2) goes through a node that is the tail of another path. |
| 303 | // |
| 304 | // Use: public |
| 305 | |
| 306 | void |
| 307 | SoPathListcxx . . $ SoPathList#::uniquifycxx . . $ SoPathList#uniquify(49f6e7a06ebc5aa8).() |
| 308 | // |
| 309 | //////////////////////////////////////////////////////////////////////// |
| 310 | { |
| 311 | int i, lastSame; |
| 312 | const SoPathcxx . . $ SoPath# *p1; |
| 313 | const SoPathcxx . . $ SoPath# *p2; |
| 314 | |
| 315 | // Remove duplicates from the end to minimize array shuffling |
| 316 | for (i = getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).() - 2; i >= 0; i--) { |
| 317 | |
| 318 | // Use the SoPath::findFork() method to determine the last |
| 319 | // node that is on a common chain for both paths. Since the |
| 320 | // paths are sorted, we can just check if this node is at the |
| 321 | // end of the first path. If it is, the second one is a |
| 322 | // duplicate and can be removed. |
| 323 | |
| 324 | p1 = (*this)[cxx . . $ SoPathList#`operator[]`(81b2b9099fcfac9c).i]; |
| 325 | p2 = (*this)[cxx . . $ SoPathList#`operator[]`(81b2b9099fcfac9c).i + 1]; |
| 326 | |
| 327 | lastSame = p1->findForkcxx . . $ SoPath#findFork(25dc08a856ac72d7).(p2); |
| 328 | |
| 329 | if (lastSame == p1->getLengthcxx . . $ SoPath#getLength(455f465bc33b4cdf).() - 1) |
| 330 | removecxx . . $ SoBaseList#remove(d4f767463ce0a6b3).(i + 1); |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | //////////////////////////////////////////////////////////////////////// |
| 335 | // |
| 336 | // Description: |
| 337 | // Comparison method for path list sorting. |
| 338 | // |
| 339 | // Use: private |
| 340 | |
| 341 | int |
| 342 | SoPathListcxx . . $ SoPathList#::comparePathscxx . . $ SoPathList#comparePaths(9148c8c3ff42c9d8).(const void *p1Ptr, const void *p2Ptr) |
| 343 | // |
| 344 | //////////////////////////////////////////////////////////////////////// |
| 345 | { |
| 346 | const SoPathcxx . . $ SoPath# *p1, *p2; |
| 347 | |
| 348 | p1 = * (const SoPathcxx . . $ SoPath# * const *) p1Ptr; |
| 349 | p2 = * (const SoPathcxx . . $ SoPath# * const *) p2Ptr; |
| 350 | |
| 351 | // Most likely, the head nodes will be the same, so test this first |
| 352 | if (p1->getHeadcxx . . $ SoPath#getHead(b794963b450d51b3).() == p2->getHeadcxx . . $ SoPath#getHead(b794963b450d51b3).()) { |
| 353 | |
| 354 | // Test indices in order. A missing child comes before an |
| 355 | // existing child |
| 356 | |
| 357 | int depth; |
| 358 | for (depth = 1; depth < p1->getLengthcxx . . $ SoPath#getLength(455f465bc33b4cdf).(); depth++) { |
| 359 | if (depth >= p2->getLengthcxx . . $ SoPath#getLength(455f465bc33b4cdf).()) |
| 360 | return 1; |
| 361 | if (p1->getIndexcxx . . $ SoPath#getIndex(7ccb52b1bfe01045).(depth) < p2->getIndexcxx . . $ SoPath#getIndex(7ccb52b1bfe01045).(depth)) |
| 362 | return -1; |
| 363 | if (p1->getIndexcxx . . $ SoPath#getIndex(7ccb52b1bfe01045).(depth) > p2->getIndexcxx . . $ SoPath#getIndex(7ccb52b1bfe01045).(depth)) |
| 364 | return 1; |
| 365 | } |
| 366 | |
| 367 | // If we get here, then the paths are the same up to the end |
| 368 | // of path 1. If path2 is longer, then it comes after |
| 369 | if (p2->getLengthcxx . . $ SoPath#getLength(455f465bc33b4cdf).() > p1->getLengthcxx . . $ SoPath#getLength(455f465bc33b4cdf).()) |
| 370 | return -1; |
| 371 | |
| 372 | // Exact same paths |
| 373 | return 0; |
| 374 | } |
| 375 | |
| 376 | else if (p1->getHeadcxx . . $ SoPath#getHead(b794963b450d51b3).() < p2->getHeadcxx . . $ SoPath#getHead(b794963b450d51b3).()) |
| 377 | return -1; |
| 378 | else |
| 379 | return 1; |
| 380 | } |
| 381 | |
| 382 | //////////////////////////////////////////////////////////////////////// |
| 383 | // |
| 384 | // Description: |
| 385 | // Add a typeId to the end of the list |
| 386 | // |
| 387 | // Use: public |
| 388 | |
| 389 | void |
| 390 | SoTypeListcxx . . $ SoTypeList#::appendcxx . . $ SoTypeList#append(3e4432a9d5c0ee1c).(SoTypecxx . . $ SoType# typeId) // typeId to append |
| 391 | // |
| 392 | //////////////////////////////////////////////////////////////////////// |
| 393 | { |
| 394 | // we have to do some hackage to cast an SoType into a void *... |
| 395 | void *hackage = (void*)(unsigned long)(*(int32_tcxx . . $ int32_t# *)&typeId); |
| 396 | SbPListcxx . . $ SbPList#::appendcxx . . $ SbPList#append(5d22bdacc48458e8).(hackage); |
| 397 | } |
| 398 | |
| 399 | //////////////////////////////////////////////////////////////////////// |
| 400 | // |
| 401 | // Description: |
| 402 | // Returns index of given typeId in list, or -1 if not found. |
| 403 | // |
| 404 | // Use: public |
| 405 | |
| 406 | int |
| 407 | SoTypeListcxx . . $ SoTypeList#::findcxx . . $ SoTypeList#find(1fd66475a268b64e).(SoTypecxx . . $ SoType# typeId) const |
| 408 | // |
| 409 | //////////////////////////////////////////////////////////////////////// |
| 410 | { |
| 411 | // we have to do some hackage to cast an SoType into a void *... |
| 412 | void *hackage = (void*)(unsigned long)(*(int32_tcxx . . $ int32_t# *)&typeId); |
| 413 | return SbPListcxx . . $ SbPList#::findcxx . . $ SbPList#find(bca04c809f7da908).(hackage); |
| 414 | } |
| 415 | |
| 416 | //////////////////////////////////////////////////////////////////////// |
| 417 | // |
| 418 | // Description: |
| 419 | // Insert given typeId into list before typeId with given index |
| 420 | // |
| 421 | // Use: public |
| 422 | |
| 423 | void |
| 424 | SoTypeListcxx . . $ SoTypeList#::insertcxx . . $ SoTypeList#insert(a368ce5ca5a50910).(SoTypecxx . . $ SoType# typeId, // typeId to insert |
| 425 | int addBefore) // index to add before |
| 426 | // |
| 427 | //////////////////////////////////////////////////////////////////////// |
| 428 | { |
| 429 | // we have to do some hackage to cast an SoType into a void *... |
| 430 | void *hackage = (void*)(unsigned long)(*(int32_tcxx . . $ int32_t# *)&typeId); |
| 431 | SbPListcxx . . $ SbPList#::insertcxx . . $ SbPList#insert(d0320739773070f2).(hackage, addBefore); |
| 432 | } |
| 433 | |
| 434 | |
| 435 | //////////////////////////////////////////////////////////////////////// |
| 436 | // |
| 437 | // Description: |
| 438 | // Access an element of a list |
| 439 | // |
| 440 | // Use: public |
| 441 | |
| 442 | SoTypecxx . . $ SoType# |
| 443 | SoTypeListcxx . . $ SoTypeList#::operatorcxx . . $ SoTypeList#`operator[]`(eb1adc4f4b160d08). [](int i) const |
| 444 | // |
| 445 | //////////////////////////////////////////////////////////////////////// |
| 446 | { |
| 447 | // we have to do some hackage to cast our void * back to an SoType... |
| 448 | int32_tcxx . . $ int32_t# hackage = (long)(* (const SbPListcxx . . $ SbPList# *) this)[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i]; |
| 449 | return *(SoTypecxx . . $ SoType#*)&hackage; |
| 450 | } |
| 451 | |
| 452 | //////////////////////////////////////////////////////////////////////// |
| 453 | // |
| 454 | // Description: |
| 455 | // Set an element of a list |
| 456 | // |
| 457 | // Use: public |
| 458 | |
| 459 | void |
| 460 | SoTypeListcxx . . $ SoTypeList#::setcxx . . $ SoTypeList#set(545f701697a13eb0).(int i, // index to set |
| 461 | SoTypecxx . . $ SoType# typeId) // new typeId value |
| 462 | // |
| 463 | //////////////////////////////////////////////////////////////////////// |
| 464 | { |
| 465 | // we have to do some hackage to cast an SoType into a void *... |
| 466 | void *hackage = (void*)(unsigned long)(*(int32_tcxx . . $ int32_t# *)&typeId); |
| 467 | (*(const SbPListcxx . . $ SbPList# *) this) [cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i] = hackage; |
| 468 | } |
| 469 | |
| 470 | //////////////////////////////////////////////////////////////////////// |
| 471 | // |
| 472 | // Description: |
| 473 | // Copy constructor. |
| 474 | // |
| 475 | // Use: public |
| 476 | |
| 477 | SoDetailListcxx . . $ SoDetailList#::SoDetailListcxx . . $ SoDetailList#SoDetailList(39e24bd28dc66fed).(const SoDetailListcxx . . $ SoDetailList# &l) : SbPListcxx . . $ SbPList#(l) |
| 478 | { |
| 479 | // We need to copy the details, since we delete them when we |
| 480 | // truncate the list |
| 481 | for (int i = 0; i < getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) |
| 482 | (* (const SbPListcxx . . $ SbPList# *) this)[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i] = (void *) (*this)[cxx . . $ SoDetailList#`operator[]`(993cc39d8658011c).i]->copycxx . . $ SoDetail#copy(80c8f62bb24ac92d).(); |
| 483 | } |
| 484 | |
| 485 | //////////////////////////////////////////////////////////////////////// |
| 486 | // |
| 487 | // Description: |
| 488 | // Delete all details on the list from one with given index on, |
| 489 | // inclusive. |
| 490 | // |
| 491 | // Use: public |
| 492 | |
| 493 | void |
| 494 | SoDetailListcxx . . $ SoDetailList#::truncatecxx . . $ SoDetailList#truncate(d4f767463ce0a6b3).(int start) |
| 495 | // |
| 496 | //////////////////////////////////////////////////////////////////////// |
| 497 | { |
| 498 | int i; |
| 499 | |
| 500 | for ( i = start; i < getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) { |
| 501 | if ( (*this)[cxx . . $ SoDetailList#`operator[]`(993cc39d8658011c).i] ) { |
| 502 | delete (*this)[cxx . . $ SoDetailList#`operator[]`(993cc39d8658011c).i]; |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | SbPListcxx . . $ SbPList#::truncatecxx . . $ SbPList#truncate(d4f767463ce0a6b3).(start); |
| 507 | } |
| 508 | |
| 509 | //////////////////////////////////////////////////////////////////////// |
| 510 | // |
| 511 | // Description: |
| 512 | // Copies list, making copy instances of each detail in list. |
| 513 | // |
| 514 | // Use: public |
| 515 | |
| 516 | void |
| 517 | SoDetailListcxx . . $ SoDetailList#::copycxx . . $ SoDetailList#copy(39e24bd28dc66fed).(const SoDetailListcxx . . $ SoDetailList# &l) |
| 518 | // |
| 519 | //////////////////////////////////////////////////////////////////////// |
| 520 | { |
| 521 | truncatecxx . . $ SoDetailList#truncate(d4f767463ce0a6b3).(0); |
| 522 | |
| 523 | int num = l.getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); |
| 524 | for (int i = 0; i < num; i ++) { |
| 525 | SoDetailcxx . . $ SoDetail#* detail = l[cxx . . $ SoDetailList#`operator[]`(993cc39d8658011c).i]; |
| 526 | if (detail) |
| 527 | appendcxx . . $ SoDetailList#append(277973889a58f695).(detail->copycxx . . $ SoDetail#copy(80c8f62bb24ac92d).()); |
| 528 | } |
| 529 | } |
| 530 | |
| 531 | //////////////////////////////////////////////////////////////////////// |
| 532 | // |
| 533 | // Description: |
| 534 | // Sets an element of a list, deleting old entry. |
| 535 | // |
| 536 | // Use: public |
| 537 | |
| 538 | void |
| 539 | SoDetailListcxx . . $ SoDetailList#::setcxx . . $ SoDetailList#set(5f18fcbd799bd437).(int i, SoDetailcxx . . $ SoDetail# *detail) |
| 540 | // |
| 541 | //////////////////////////////////////////////////////////////////////// |
| 542 | { |
| 543 | if ((*this)[cxx . . $ SoDetailList#`operator[]`(993cc39d8658011c).i] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 544 | delete (*this)[cxx . . $ SoDetailList#`operator[]`(993cc39d8658011c).i]; |
| 545 | |
| 546 | (* (const SbPListcxx . . $ SbPList# *) this)[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i] = (void *) detail; |
| 547 | } |
| 548 | |
| 549 | //////////////////////////////////////////////////////////////////////// |
| 550 | // |
| 551 | // Description: |
| 552 | // Copy constructor. |
| 553 | // |
| 554 | // Use: public |
| 555 | |
| 556 | SoPickedPointListcxx . . $ SoPickedPointList#::SoPickedPointListcxx . . $ SoPickedPointList#SoPickedPointList(da432b7d8d2cf082).(const SoPickedPointListcxx . . $ SoPickedPointList# &l) : SbPListcxx . . $ SbPList#(l) |
| 557 | { |
| 558 | // We need to copy the pickedPoints, since we delete them when we |
| 559 | // truncate the list |
| 560 | for (int i = 0; i < getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) |
| 561 | (* (const SbPListcxx . . $ SbPList# *) this)[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i] = (void *) (*this)[cxx . . $ SoPickedPointList#`operator[]`(5412072a3cb7e313).i]->copycxx . . $ SoPickedPoint#copy(513d025ed9dfd4e5).(); |
| 562 | } |
| 563 | |
| 564 | //////////////////////////////////////////////////////////////////////// |
| 565 | // |
| 566 | // Description: |
| 567 | // Delete all pickedPoints on the list from one with given index on, |
| 568 | // inclusive. |
| 569 | // |
| 570 | // Use: public |
| 571 | |
| 572 | void |
| 573 | SoPickedPointListcxx . . $ SoPickedPointList#::truncatecxx . . $ SoPickedPointList#truncate(d4f767463ce0a6b3).(int start) |
| 574 | // |
| 575 | //////////////////////////////////////////////////////////////////////// |
| 576 | { |
| 577 | int i; |
| 578 | |
| 579 | for (i = start; i < getLengthcxx . . $ SbPList#getLength(455f465bc33b4cdf).(); i++) |
| 580 | if ((*this)[cxx . . $ SoPickedPointList#`operator[]`(5412072a3cb7e313).i] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 581 | delete (*this)[cxx . . $ SoPickedPointList#`operator[]`(5412072a3cb7e313).i]; |
| 582 | |
| 583 | SbPListcxx . . $ SbPList#::truncatecxx . . $ SbPList#truncate(d4f767463ce0a6b3).(start); |
| 584 | } |
| 585 | |
| 586 | //////////////////////////////////////////////////////////////////////// |
| 587 | // |
| 588 | // Description: |
| 589 | // Sets an element of a list, deleting old entry. |
| 590 | // |
| 591 | // Use: public |
| 592 | |
| 593 | void |
| 594 | SoPickedPointListcxx . . $ SoPickedPointList#::setcxx . . $ SoPickedPointList#set(7b5532656f710f10).(int i, SoPickedPointcxx . . $ SoPickedPoint# *pickedPoint) |
| 595 | // |
| 596 | //////////////////////////////////////////////////////////////////////// |
| 597 | { |
| 598 | if ((*this)[cxx . . $ SoPickedPointList#`operator[]`(5412072a3cb7e313).i] != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!) |
| 599 | delete (*this)[cxx . . $ SoPickedPointList#`operator[]`(5412072a3cb7e313).i]; |
| 600 | |
| 601 | (* (const SbPListcxx . . $ SbPList# *) this)[cxx . . $ SbPList#`operator[]`(5f9a4f363ac2f591).i] = (void *) pickedPoint; |
| 602 | } |
| 603 |