ATLAS Offline Software
Loading...
Searching...
No Matches
TPIntegerVector_p1 Class Reference

#include <TPIntegerVector_p1.h>

Collaboration diagram for TPIntegerVector_p1:

Public Types

typedef unsigned int value_type
typedef value_typeiterator
typedef const value_typeconst_iterator

Public Member Functions

 TPIntegerVector_p1 (TPIntegerVectorStorage_p1 *storage, int idx)
size_t size () const
void resize (size_t new_size)
void reserve (size_t new_size)
value_typeoperator[] (size_t idx)
const value_typeoperator[] (size_t idx) const
void push_back (const value_type &val)
void push_int (const int &val)
void push_float (const float &val)
void push_double (const double val)
void push_TPObjRef (const TPObjRef &val)
void push_vTPObjRef (const std::vector< TPObjRef > &val)
value_type front_UI (const_iterator i) const
int front_int (const_iterator &i) const
float front_float (const_iterator &i) const
double front_double (const_iterator &i) const
TPObjRef front_TPObjRef (const_iterator &i) const
std::vector< TPObjReffront_vTPObjRef (const_iterator &i) const
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const

Protected Attributes

TPIntegerVectorStorage_p1m_storage
unsigned int m_position

Detailed Description

Definition at line 25 of file TPIntegerVector_p1.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 30 of file TPIntegerVector_p1.h.

◆ iterator

Definition at line 29 of file TPIntegerVector_p1.h.

◆ value_type

typedef unsigned int TPIntegerVector_p1::value_type

Definition at line 28 of file TPIntegerVector_p1.h.

Constructor & Destructor Documentation

◆ TPIntegerVector_p1()

TPIntegerVector_p1::TPIntegerVector_p1 ( TPIntegerVectorStorage_p1 * storage,
int idx )
inline

Definition at line 32 of file TPIntegerVector_p1.h.

33 : m_storage(storage), m_position(idx)
34 {}
TPIntegerVectorStorage_p1 * m_storage

Member Function Documentation

◆ begin() [1/2]

iterator TPIntegerVector_p1::begin ( )
inline

Definition at line 57 of file TPIntegerVector_p1.h.

57{ return &operator[](0); }
value_type & operator[](size_t idx)

◆ begin() [2/2]

const_iterator TPIntegerVector_p1::begin ( ) const
inline

Definition at line 60 of file TPIntegerVector_p1.h.

60{ return &operator[](0); }

◆ end() [1/2]

iterator TPIntegerVector_p1::end ( )
inline

Definition at line 58 of file TPIntegerVector_p1.h.

58{ return &operator[](size()); };

◆ end() [2/2]

const_iterator TPIntegerVector_p1::end ( ) const
inline

Definition at line 61 of file TPIntegerVector_p1.h.

61{ return &operator[](size()); };

◆ front_double()

double TPIntegerVector_p1::front_double ( const_iterator & i) const
inline

Definition at line 217 of file TPIntegerVector_p1.h.

217 {
218 union { double d; struct{unsigned int i1; unsigned int i2;}c; } m_union;
219 m_union.c.i1 = (*i); i++;
220 m_union.c.i2 = (*i); i++;
221 return m_union.d;
222}

◆ front_float()

float TPIntegerVector_p1::front_float ( const_iterator & i) const
inline

Definition at line 210 of file TPIntegerVector_p1.h.

210 {
211 union { float f; unsigned int i;} m_union;
212 m_union.i = (*i); i++;
213 return m_union.f;
214}

◆ front_int()

int TPIntegerVector_p1::front_int ( const_iterator & i) const
inline

Definition at line 203 of file TPIntegerVector_p1.h.

203 {
204 union { int f; unsigned int i;} m_union;
205 m_union.i = (*i); i++;
206 return m_union.f;
207}

◆ front_TPObjRef()

TPObjRef TPIntegerVector_p1::front_TPObjRef ( const_iterator & i) const
inline

Definition at line 225 of file TPIntegerVector_p1.h.

225 {
226 union {struct{unsigned short i1;unsigned short i2;} c; unsigned int I;} m_union;
227 m_union.I = (*i); i++;
228 TPObjRef res(TPObjRef::typeID_t(m_union.c.i2, m_union.c.i1),(int) (*i)); i++;
229 return res;
230}
std::pair< std::vector< unsigned int >, bool > res
#define I(x, y, z)
Definition MD5.cxx:116

◆ front_UI()

value_type TPIntegerVector_p1::front_UI ( const_iterator i) const
inline

Definition at line 50 of file TPIntegerVector_p1.h.

50{value_type res=(*i); i++; return res;}

◆ front_vTPObjRef()

std::vector< TPObjRef > TPIntegerVector_p1::front_vTPObjRef ( const_iterator & i) const
inline

Definition at line 233 of file TPIntegerVector_p1.h.

233 {
234 int size = (*i); i++;
235 union {struct{unsigned short i1;unsigned short i2;} c; unsigned int I;} m_union;
236 std::vector<TPObjRef> res;
237 res.reserve(size);
238 for(int it=0;it<size;it++){
239 m_union.I = (*i); i++;
240 res.push_back( TPObjRef(TPObjRef::typeID_t(m_union.c.i2, m_union.c.i1),(int) (*i)) ); i++;
241 }
242 return res;
243}

◆ operator[]() [1/2]

TPIntegerVector_p1::value_type & TPIntegerVector_p1::operator[] ( size_t idx)
inline

Definition at line 132 of file TPIntegerVector_p1.h.

132 {
133 return const_cast<value_type&>(((const TPIntegerVector_p1*)this)->operator[](idx));
134}
TPIntegerVector_p1(TPIntegerVectorStorage_p1 *storage, int idx)

◆ operator[]() [2/2]

const TPIntegerVector_p1::value_type & TPIntegerVector_p1::operator[] ( size_t idx) const
inline

Definition at line 138 of file TPIntegerVector_p1.h.

◆ push_back()

void TPIntegerVector_p1::push_back ( const value_type & val)
inline

Definition at line 144 of file TPIntegerVector_p1.h.

145{
146 m_storage->m_data.push_back( val );
147 m_storage->m_endPos[m_position]++;
148}

◆ push_double()

void TPIntegerVector_p1::push_double ( const double val)
inline

Definition at line 168 of file TPIntegerVector_p1.h.

168 {
169 union {struct{unsigned int i1;unsigned int i2;} c; double d;} m_union;
170 m_union.d = val;
171 m_storage->m_data.push_back( m_union.c.i1 );
172 m_storage->m_data.push_back( m_union.c.i2 );
173 m_storage->m_endPos[m_position]+=2;
174}

◆ push_float()

void TPIntegerVector_p1::push_float ( const float & val)
inline

Definition at line 159 of file TPIntegerVector_p1.h.

159 {
160 union {unsigned int i; float f;} m_union;
161 m_union.f = val;
162 m_storage->m_data.push_back( m_union.i );
163 m_storage->m_endPos[m_position]++;
164}

◆ push_int()

void TPIntegerVector_p1::push_int ( const int & val)
inline

Definition at line 151 of file TPIntegerVector_p1.h.

151 {
152 union {unsigned int i; int f;} m_union;
153 m_union.f = val;
154 m_storage->m_data.push_back( m_union.i );
155 m_storage->m_endPos[m_position]++;
156}

◆ push_TPObjRef()

void TPIntegerVector_p1::push_TPObjRef ( const TPObjRef & val)
inline

Definition at line 177 of file TPIntegerVector_p1.h.

177 {
178 union {struct{unsigned short i1;unsigned short i2;} c; unsigned int I;} m_union;
179 m_union.c.i1 = val.typeID();
180 m_union.c.i2 = val.topLevelCnvID();
181 m_storage->m_data.push_back( m_union.I );
182 m_storage->m_data.push_back( val.index());
183 m_storage->m_endPos[m_position]+=2;
184}

◆ push_vTPObjRef()

void TPIntegerVector_p1::push_vTPObjRef ( const std::vector< TPObjRef > & val)
inline

Definition at line 187 of file TPIntegerVector_p1.h.

187 {
188 m_storage->m_data.push_back( val.size());
189 m_storage->m_endPos[m_position]++;
190 union {struct{unsigned short i1;unsigned short i2;} c; unsigned int I;} m_union;
191 std::vector<TPObjRef>::const_iterator it=val.begin();
192 for (;it!=val.end();it++){
193 TPObjRef v = (*it);
194 m_union.c.i1 = v.typeID();
195 m_union.c.i2 = v.topLevelCnvID();
196 m_storage->m_data.push_back( m_union.I );
197 m_storage->m_data.push_back( v.index());
198 }
199 m_storage->m_endPos[m_position]+= 2*val.size();
200}

◆ reserve()

void TPIntegerVector_p1::reserve ( size_t new_size)
inline

Definition at line 123 of file TPIntegerVector_p1.h.

123 {
124 if( m_position != m_storage->size() - 1 )
125 throw std::runtime_error("TPIntegerVector_p1::reserve() only supported on the last element");
126 size_t change = new_size - size();
127 m_storage->m_data.reserve( m_storage->m_endPos[m_position] + change );
128}

◆ resize()

void TPIntegerVector_p1::resize ( size_t new_size)
inline

Definition at line 114 of file TPIntegerVector_p1.h.

114 {
115 if( m_position != m_storage->size() - 1 )
116 throw std::runtime_error("TPIntegerVector_p1::resize() only supported on the last element");
117 size_t change = new_size - size();
118 m_storage->m_endPos[m_position] += change;
119 m_storage->m_data.resize( m_storage->m_endPos[m_position] );
120}

◆ size()

size_t TPIntegerVector_p1::size ( ) const
inline

Definition at line 108 of file TPIntegerVector_p1.h.

108 {
109 if( m_position == 0 ) return m_storage->m_endPos[0];
110 return m_storage->m_endPos[m_position] - m_storage->m_endPos[m_position-1];
111}

Member Data Documentation

◆ m_position

unsigned int TPIntegerVector_p1::m_position
protected

Definition at line 65 of file TPIntegerVector_p1.h.

◆ m_storage

TPIntegerVectorStorage_p1* TPIntegerVector_p1::m_storage
protected

Definition at line 64 of file TPIntegerVector_p1.h.


The documentation for this class was generated from the following file: