TORCS  1.3.9
The Open Racing Car Simulator
IndexArray.h
Go to the documentation of this file.
1 /*
2  SOLID - Software Library for Interference Detection
3  Copyright (C) 1997-1998 Gino van den Bergen
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 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  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public
16  License along with this library; if not, write to the Free
17  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 
19  Please send remarks, questions and bug reports to gino@win.tue.nl,
20  or write to:
21  Gino van den Bergen
22  Department of Mathematics and Computing Science
23  Eindhoven University of Technology
24  P.O. Box 513, 5600 MB Eindhoven, The Netherlands
25 */
26 
27 #ifndef _INDEXARRAY_H_
28 #define _INDEXARRAY_H_
29 
30 #ifdef _MSC_VER
31 #pragma warning(disable:4786) // identifier was truncated to '255'
32 #endif // _MSC_VER
33 
34 #include <algorithm>
35 
36 class IndexArray {
37 public:
38  IndexArray() : indices(0), count(0) {}
39  IndexArray(int n) : indices(new unsigned int[n]), count(n) {}
40  IndexArray(int n, const unsigned int v[]) :
41  indices(new unsigned int[n]), count(n) { copy(&v[0], &v[n], &indices[0]); }
42 
43  ~IndexArray() { delete [] indices; }
44 
45  int operator[](int i) const { return indices[i]; }
46  int size() const { return count; }
47 
48 private:
49  IndexArray(const IndexArray&);
51 
52  unsigned int *indices;
53  int count;
54 };
55 
56 #endif
57 
int size() const
Definition: IndexArray.h:46
int operator[](int i) const
Definition: IndexArray.h:45
IndexArray(int n, const unsigned int v[])
Definition: IndexArray.h:40
IndexArray(int n)
Definition: IndexArray.h:39
IndexArray & operator=(const IndexArray &)
unsigned int * indices
Definition: IndexArray.h:52