Coin Logo http://www.sim.no
http://www.coin3d.org

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) 1998-2007 by Systems in Motion. All rights reserved.
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 Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, 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  ((SbPList*)this)->append((void*)((uintptr_t)item));
38  }
39  int find(const int item) {
40  return ((SbPList*)this)->find((void *)((uintptr_t)item));
41  }
42  void insert(const int item, const int addbefore) {
43  ((SbPList*)this)->insert((void *)((uintptr_t)item), addbefore);
44  }
45  int & operator[](const int idx) const {
46  return (int&) ((*(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
int find(const int item)
Definition: SbIntList.h:39
The SbPList class is a container class for void pointers.
Definition: SbPList.h:31
void append(const int item)
Definition: SbIntList.h:36
int & operator[](const int idx) const
Definition: SbIntList.h:45
void insert(const int item, const int addbefore)
Definition: SbIntList.h:42
SbIntList(void)
Definition: SbIntList.h:33
SbIntList(const int sizehint)
Definition: SbIntList.h:34
The SbIntList class is a container for integer list arrays.
Definition: SbIntList.h:31

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Fri Jul 20 2018 for Coin by Doxygen. 1.8.14