xmscore  1.0
vector.h
Go to the documentation of this file.
1 #pragma once
2 //------------------------------------------------------------------------------
8 //------------------------------------------------------------------------------
9 
10 // 3. Standard library headers
11 #include <iostream>
12 #include <vector>
13 
14 // 4. External Library Headers
15 
16 // 5. Shared code headers
17 #include <xmscore/points/pt.h>
18 
19 namespace xms
20 {
21 // 1d arrays
22 typedef std::vector<bool> VecBool;
23 typedef std::vector<char> VecChar;
24 typedef std::vector<unsigned char> VecUchar;
25 typedef std::vector<double> VecDbl;
26 typedef std::vector<float> VecFlt;
27 typedef std::vector<int> VecInt;
28 typedef std::vector<unsigned int> VecUint;
29 typedef std::vector<short> VecShort;
30 typedef std::vector<std::string> VecStr;
31 typedef std::vector<void*> VecVoid;
32 typedef std::vector<std::size_t> VecSizet;
33 
34 // 2d arrays
35 typedef std::vector<VecFlt> VecFlt2d;
36 typedef std::vector<VecInt> VecInt2d;
37 typedef std::vector<VecDbl> VecDbl2d;
38 typedef std::vector<VecStr> VecStr2d;
39 typedef std::vector<VecSizet> VecSizet2d;
40  // 3d arrays
41 typedef std::vector<VecFlt2d> VecFlt3d;
42 typedef std::vector<VecInt2d> VecInt3d;
43 typedef std::vector<VecDbl2d> VecDbl3d;
44 typedef std::vector<VecStr2d> VecStr3d;
45  // 4d arrays
46 typedef std::vector<VecDbl3d> VecDbl4d;
47 typedef std::vector<VecFlt3d> VecFlt4d;
48 
49 // 1d arrays
50 typedef std::vector<Pt4d> VecPt4d;
51 typedef std::vector<Pt3d> VecPt3d;
52 typedef std::vector<Pt3f> VecPt3f;
53 typedef std::vector<Pt2d> VecPt2d;
54 typedef std::vector<Pt2f> VecPt2f;
55 typedef std::vector<Pt2i> VecPt2i;
56 
57 // 2d arrays
58 typedef std::vector<VecPt2d> VecPt2d2d;
59 typedef std::vector<VecPt2f> VecPt2f2d;
60 typedef std::vector<VecPt3d> VecPt3d2d;
61 typedef std::vector<VecPt3f> VecPt3f2d;
62 
63 // 3d arrays
64 typedef std::vector<VecPt3d2d> VecPt3d3d;
65 // 4d arrays
66 
67 //----- Template functions -----------------------------------------------------
68 
69 //------------------------------------------------------------------------------
74 //------------------------------------------------------------------------------
75 template <class _T>
76 std::ostream& operator<<(std::ostream& a_output, const std::vector<_T>& a_value)
77 {
78  a_output << ",size=" << a_value.size();
79  for (unsigned int ii = 0; ii < a_value.size(); ++ii)
80  {
81  a_output << "," << ii << "=" << a_value[ii];
82  }
83  return a_output;
84 }
85 //------------------------------------------------------------------------------
88 //------------------------------------------------------------------------------
89 template <class T>
90 void stShrinkCapacity(std::vector<T>& v)
91 {
92  std::vector<T> tmp(v);
93  v.swap(tmp);
94 } // stShrinkCapacity
95 
96 //----- Functions --------------------------------------------------------------
97 
98 } // namespace xms
std::vector< Pt2d > VecPt2d
short rename
Definition: vector.h:53
std::vector< VecPt3d2d > VecPt3d3d
short rename
Definition: vector.h:64
std::vector< int > VecInt
short rename
Definition: vector.h:27
std::vector< VecStr2d > VecStr3d
short rename
Definition: vector.h:44
std::vector< bool > VecBool
short rename
Definition: vector.h:22
std::vector< VecStr > VecStr2d
short rename
Definition: vector.h:38
std::vector< double > VecDbl
short rename
Definition: vector.h:25
std::vector< Pt2i > VecPt2i
short rename
Definition: vector.h:55
std::vector< float > VecFlt
short rename
Definition: vector.h:26
std::vector< std::string > VecStr
short rename
Definition: vector.h:30
std::vector< unsigned int > VecUint
short rename
Definition: vector.h:28
std::vector< VecPt3f > VecPt3f2d
short rename
Definition: vector.h:61
std::vector< VecDbl2d > VecDbl3d
short rename
Definition: vector.h:43
std::vector< void * > VecVoid
short rename
Definition: vector.h:31
std::vector< VecInt > VecInt2d
short rename
Definition: vector.h:36
std::vector< unsigned char > VecUchar
short rename
Definition: vector.h:24
std::vector< std::size_t > VecSizet
short rename
Definition: vector.h:32
std::vector< VecDbl3d > VecDbl4d
short rename
Definition: vector.h:46
std::vector< Pt3f > VecPt3f
short rename
Definition: vector.h:52
std::vector< VecFlt3d > VecFlt4d
short rename
Definition: vector.h:47
std::vector< VecPt3d > VecPt3d2d
short rename
Definition: vector.h:60
std::vector< short > VecShort
short rename
Definition: vector.h:29
std::vector< VecPt2f > VecPt2f2d
short rename
Definition: vector.h:59
std::vector< VecDbl > VecDbl2d
short rename
Definition: vector.h:37
void stShrinkCapacity(std::vector< T > &v)
removes any excess capacity in a vector (size() will equal capacity())
Definition: vector.h:90
std::vector< VecInt2d > VecInt3d
short rename
Definition: vector.h:42
std::vector< VecFlt2d > VecFlt3d
short rename
Definition: vector.h:41
std::vector< Pt2f > VecPt2f
short rename
Definition: vector.h:54
std::vector< VecFlt > VecFlt2d
short rename
Definition: vector.h:35
std::vector< VecSizet > VecSizet2d
short rename
Definition: vector.h:39
std::vector< char > VecChar
short rename
Definition: vector.h:23
std::vector< Pt4d > VecPt4d
short rename
Definition: vector.h:50
std::vector< VecPt2d > VecPt2d2d
short rename
Definition: vector.h:58
std::vector< Pt3d > VecPt3d
short rename
Definition: vector.h:51