BmnRoot
Loading...
Searching...
No Matches
L1Portion.h
Go to the documentation of this file.
1#ifndef L1Portion_H
2#define L1Portion_H
3
4#include <vector>
5using std::vector;
6// class for portions organization
7
8template <typename T> class L1Portion;
9
10template <>
12{
13 public:
14 typedef L1TrackPar T;
15// typedef vector<T> vType;
17
18 L1Portion():a(),dataSize(0){};
19 L1Portion(int size):a(),dataSize(0) { reserve(size); };
20 L1Portion(int size, int size2):a(),dataSize(size2) {
21 reserve(size);
22// reserve2(size2);
23 };
24 vType& operator[] (int i) { return a[i];}
25 void resize(int size) { a.resize(size); };
26 void reserve(int size) { a.reserve(size); };
27 void reserve2(int size) { for(unsigned int i = 0; i < a.size(); i++) a[i].reserve(size); };
28 void push_back(vType &v) { a.push_back(v); };
29 void add_void(){
30 vType v;
31// v.resize(dataSize);
32 a.push_back(v);
33 a[a.size()-1].reserve(dataSize);
34 };
35 void add_void(int i) {
36 T t;
37 a[i].push_back(t);
38 };
39
40 int CalcSize() {
41 int size = 0;
42 for(unsigned int i = 0; i < a.size(); i++) size += a[i].size();
43 return size*sizeof(T);
44 };
45
46 private:
47 vector<vType> a;
48// int mainSize; // size of a
49 int dataSize; // size of vType
50};
51
52template <>
54{
55 public:
58// typedef std::vector<T, nsL1::SimdAlloc<T> > vType;
59
60 L1Portion():a(),dataSize(0){};
61 L1Portion(int size):a(),dataSize(0) { reserve(size); };
62 L1Portion(int size, int size2):a(),dataSize(size2) {
63 reserve(size);
64// reserve2(size2);
65 };
66
67 vType& operator[] (int i) { return a[i];}
68 void resize(int size) { a.resize(size); };
69 void reserve(int size) { a.reserve(size); };
70 void reserve2(int size) { for(unsigned int i = 0; i < a.size(); i++) a[i].reserve(size); };
71 void push_back(vType &v) { a.push_back(v); };
72 void add_void(){
73 vType v;
74// v.resize(dataSize);
75 a.push_back(v);
76 a[a.size()-1].reserve(dataSize);
77 };
78 void add_void(int i) {
79 T t;
80 a[i].push_back(t);
81 };
82
83 int CalcSize() {
84 int size = 0;
85 for(unsigned int i = 0; i < a.size(); i++) size += a[i].size();
86 return size*sizeof(T);
87 };
88
89 private:
90 vector<vType> a;
91// int mainSize; // size of a
92 int dataSize; // size of vType
93};
94
95
96template <typename T>
98{
99 public:
100 typedef vector<T> vType;
101
102 L1Portion():a(),dataSize(0) { };
103 L1Portion(int size):a(),dataSize(0) { reserve(size); };
104 L1Portion(int size, int size2):a(),dataSize(size2) {
105 reserve(size);
106// reserve2(size2);
107 };
108 vType& operator[] (int i) { return a[i];}
109 void resize(int size) { a.resize(size); };
110 void reserve(int size) { a.reserve(size); };
111 void reserve2(int size) { for(int i = 0; i < a.size(); i++) a[i].reserve(size); };
112 void push_back(vType &v) { a.push_back(v); };
113 void add_void(){
114 vType v;
115// v.resize(dataSize);
116 a.push_back(v);
117 a[a.size()-1].reserve(dataSize);
118 };
119 void add_void(int i) {
120 T t;
121 a[i].push_back(t);
122 };
123
124 int CalcSize() {
125 int size = 0;
126 for(int i = 0; i < a.size(); i++) size += a[i].size();
127 return size*sizeof(T);
128 };
129
130 private:
131 vector<vType> a;
132// int mainSize; // size of a
133 int dataSize; // size of vType
134};
135
136#endif // L1Portion_H
__m128 v
Definition P4_F32vec4.h:1
int i
Definition P4_F32vec4.h:22
nsL1::vector< T >::TSimd vType
Definition L1Portion.h:57
void reserve2(int size)
Definition L1Portion.h:70
void push_back(vType &v)
Definition L1Portion.h:71
void reserve(int size)
Definition L1Portion.h:69
void resize(int size)
Definition L1Portion.h:68
L1Portion(int size, int size2)
Definition L1Portion.h:62
void resize(int size)
Definition L1Portion.h:25
L1Portion(int size, int size2)
Definition L1Portion.h:20
nsL1::vector< T >::TSimd vType
Definition L1Portion.h:16
void reserve(int size)
Definition L1Portion.h:26
void push_back(vType &v)
Definition L1Portion.h:28
void reserve2(int size)
Definition L1Portion.h:27
vType & operator[](int i)
Definition L1Portion.h:108
void push_back(vType &v)
Definition L1Portion.h:112
vector< T > vType
Definition L1Portion.h:100
void reserve(int size)
Definition L1Portion.h:110
L1Portion(int size)
Definition L1Portion.h:103
void add_void(int i)
Definition L1Portion.h:119
void reserve2(int size)
Definition L1Portion.h:111
void resize(int size)
Definition L1Portion.h:109
void add_void()
Definition L1Portion.h:113
L1Portion(int size, int size2)
Definition L1Portion.h:104
int CalcSize()
Definition L1Portion.h:124
std::vector< T > TSimd