| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

SbIntList.h
1 #ifndef COIN_SBINTLIST_H
2 #define COIN_SBINTLIST_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/lists/SbPList.h>
28
29 // *************************************************************************
30
31 class COIN_DLL_API SbIntList : public SbPList {
32 public:
33 SbIntList(void) : SbPList () { }
34 SbIntList(const int sizehint) : SbPList(sizehint) { }
35
36 void append(const int item) {
37 this->SbPList::append(reinterpret_cast<void*>(static_cast<uintptr_t>(item)));
38 }
39 int find(const int item) {
40 return this->SbPList::find(reinterpret_cast<void *>(static_cast<uintptr_t>(item)));
41 }
42 void insert(const int item, const int addbefore) {
43 this->SbPList::insert(reinterpret_cast<void *>(static_cast<uintptr_t>(item)), addbefore);
44 }
45 int & operator[](const int idx) const {
46 return reinterpret_cast<int&>(((*static_cast<const SbPList *>(this))[idx]));
47 }
48 };
49
50 // *************************************************************************
51
52 // Internally, we should use the SbList template class, since it
53 // provides a better interface than SbIntList, and since the interface
54 // of SbIntList may have issues with casting type safety.
55 //
56 // This class is provided for two reasons: 1) to be compatible with
57 // SGI/TGS Inventor, 2) there are a few places in the public API where
58 // it is used (these are all our own doing, not from the original SGI
59 // Inventor, and could be taken out for any new major release).
60
61 #if defined(COIN_INTERNAL) && !defined(COIN_ALLOW_SBINTLIST)
62 #error prefer SbList over SbIntList for internal code
63 #endif // COIN_INTERNAL
64
65 // *************************************************************************
66
67 #endif // !COIN_SBINTLIST_H

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.