Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
agg::pod_vector< T > Class Template Reference

#include <src/agg/agg_array.h>

+ Inheritance diagram for agg::pod_vector< T >:

Public Types

typedef T value_type
 

Public Member Functions

 ~pod_vector ()
 
 pod_vector ()
 
 pod_vector (unsigned cap, unsigned extra_tail=0)
 
 pod_vector (const pod_vector< T > &)
 
const pod_vector< T > & operator= (const pod_vector< T > &)
 
void capacity (unsigned cap, unsigned extra_tail=0)
 
unsigned capacity () const
 
void allocate (unsigned size, unsigned extra_tail=0)
 
void resize (unsigned new_size)
 
void zero ()
 
void add (const T &v)
 
void push_back (const T &v)
 
void insert_at (unsigned pos, const T &val)
 
void inc_size (unsigned size)
 
unsigned size () const
 
unsigned byte_size () const
 
void serialize (int8u *ptr) const
 
void deserialize (const int8u *data, unsigned byte_size)
 
const T & operator[] (unsigned i) const
 
T & operator[] (unsigned i)
 
const T & at (unsigned i) const
 
T & at (unsigned i)
 
value_at (unsigned i) const
 
const T * data () const
 
T * data ()
 
void remove_all ()
 
void clear ()
 
void cut_at (unsigned num)
 

Private Attributes

unsigned m_size
 
unsigned m_capacity
 
T * m_array
 

Detailed Description

template<class T>
class agg::pod_vector< T >

Member Typedef Documentation

◆ value_type

template<class T >
typedef T agg::pod_vector< T >::value_type

Constructor & Destructor Documentation

◆ ~pod_vector()

template<class T >
agg::pod_vector< T >::~pod_vector ( )
inline
unsigned m_capacity
Definition agg_array.h:214
T * m_array
Definition agg_array.h:215
static void deallocate(T *ptr, unsigned)
Definition agg_basics.h:39

References agg::pod_allocator< T >::deallocate(), agg::pod_vector< T >::m_array, and agg::pod_vector< T >::m_capacity.

+ Here is the call graph for this function:

◆ pod_vector() [1/3]

template<class T >
agg::pod_vector< T >::pod_vector ( )
inline
168: m_size(0), m_capacity(0), m_array(0) {}
unsigned m_size
Definition agg_array.h:213

◆ pod_vector() [2/3]

template<class T >
agg::pod_vector< T >::pod_vector ( unsigned  cap,
unsigned  extra_tail = 0 
)
261 :
262 m_size(0),
263 m_capacity(cap + extra_tail),
static T * allocate(unsigned num)
Definition agg_basics.h:38

◆ pod_vector() [3/3]

template<class T >
agg::pod_vector< T >::pod_vector ( const pod_vector< T > &  v)
267 :
268 m_size(v.m_size),
269 m_capacity(v.m_capacity),
270 m_array(v.m_capacity ? pod_allocator<T>::allocate(v.m_capacity) : 0)
271 {
272 memcpy(m_array, v.m_array, sizeof(T) * v.m_size);
273 }

References agg::pod_vector< T >::m_array, and agg::pod_vector< T >::m_size.

Member Function Documentation

◆ add()

template<class T >
void agg::pod_vector< T >::add ( const T &  v)
inline

◆ allocate()

template<class T >
void agg::pod_vector< T >::allocate ( unsigned  size,
unsigned  extra_tail = 0 
)
234 {
235 capacity(size, extra_tail);
236 m_size = size;
237 }
unsigned capacity() const
Definition agg_array.h:177
unsigned size() const
Definition agg_array.h:195

◆ at() [1/2]

template<class T >
T & agg::pod_vector< T >::at ( unsigned  i)
inline
202{ return m_array[i]; }

References agg::pod_vector< T >::m_array.

◆ at() [2/2]

template<class T >
const T & agg::pod_vector< T >::at ( unsigned  i) const
inline
201{ return m_array[i]; }

References agg::pod_vector< T >::m_array.

◆ byte_size()

template<class T >
unsigned agg::pod_vector< T >::byte_size ( ) const
inline
196{ return m_size * sizeof(T); }

References agg::pod_vector< T >::m_size.

◆ capacity() [1/2]

template<class T >
unsigned agg::pod_vector< T >::capacity ( ) const
inline
177{ return m_capacity; }

References agg::pod_vector< T >::m_capacity.

◆ capacity() [2/2]

template<class T >
void agg::pod_vector< T >::capacity ( unsigned  cap,
unsigned  extra_tail = 0 
)
221 {
222 m_size = 0;
223 if(cap > m_capacity)
224 {
226 m_capacity = cap + extra_tail;
228 }
229 }

References agg::pod_allocator< T >::allocate(), and agg::pod_allocator< T >::deallocate().

+ Here is the call graph for this function:

◆ clear()

template<class T >
void agg::pod_vector< T >::clear ( )
inline
209{ m_size = 0; }

References agg::pod_vector< T >::m_size.

◆ cut_at()

template<class T >
void agg::pod_vector< T >::cut_at ( unsigned  num)
inline
210{ if(num < m_size) m_size = num; }

References agg::pod_vector< T >::m_size.

◆ data() [1/2]

template<class T >
T * agg::pod_vector< T >::data ( )
inline
206{ return m_array; }

References agg::pod_vector< T >::m_array.

◆ data() [2/2]

template<class T >
const T * agg::pod_vector< T >::data ( ) const
inline
205{ return m_array; }

References agg::pod_vector< T >::m_array.

Referenced by agg::rasterizer_cells_aa< Cell >::scanline_cells().

+ Here is the caller graph for this function:

◆ deserialize()

template<class T >
void agg::pod_vector< T >::deserialize ( const int8u data,
unsigned  byte_size 
)
293 {
294 byte_size /= sizeof(T);
296 if(byte_size) memcpy(m_array, data, byte_size * sizeof(T));
297 }
const T * data() const
Definition agg_array.h:205
void allocate(unsigned size, unsigned extra_tail=0)
Definition agg_array.h:233
unsigned byte_size() const
Definition agg_array.h:196

◆ inc_size()

template<class T >
void agg::pod_vector< T >::inc_size ( unsigned  size)
inline
194{ m_size += size; }

References agg::pod_vector< T >::m_size, and agg::pod_vector< T >::size().

+ Here is the call graph for this function:

◆ insert_at()

template<class T >
void agg::pod_vector< T >::insert_at ( unsigned  pos,
const T &  val 
)
302 {
303 if(pos >= m_size)
304 {
305 m_array[m_size] = val;
306 }
307 else
308 {
309 memmove(m_array + pos + 1, m_array + pos, (m_size - pos) * sizeof(T));
310 m_array[pos] = val;
311 }
312 ++m_size;
313 }
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:14

◆ operator=()

template<class T >
const pod_vector< T > & agg::pod_vector< T >::operator= ( const pod_vector< T > &  v)
278 {
279 allocate(v.m_size);
280 if(v.m_size) memcpy(m_array, v.m_array, sizeof(T) * v.m_size);
281 return *this;
282 }

References agg::pod_vector< T >::m_array, and agg::pod_vector< T >::m_size.

◆ operator[]() [1/2]

template<class T >
T & agg::pod_vector< T >::operator[] ( unsigned  i)
inline
200{ return m_array[i]; }

References agg::pod_vector< T >::m_array.

◆ operator[]() [2/2]

template<class T >
const T & agg::pod_vector< T >::operator[] ( unsigned  i) const
inline
199{ return m_array[i]; }

References agg::pod_vector< T >::m_array.

◆ push_back()

template<class T >
void agg::pod_vector< T >::push_back ( const T &  v)
inline

◆ remove_all()

template<class T >
void agg::pod_vector< T >::remove_all ( )
inline
208{ m_size = 0; }

References agg::pod_vector< T >::m_size.

◆ resize()

template<class T >
void agg::pod_vector< T >::resize ( unsigned  new_size)
243 {
244 if(new_size > m_size)
245 {
246 if(new_size > m_capacity)
247 {
248 T* data = pod_allocator<T>::allocate(new_size);
249 memcpy(data, m_array, m_size * sizeof(T));
251 m_array = data;
252 }
253 }
254 else
255 {
256 m_size = new_size;
257 }
258 }

References agg::pod_allocator< T >::allocate(), and agg::pod_allocator< T >::deallocate().

+ Here is the call graph for this function:

◆ serialize()

template<class T >
void agg::pod_vector< T >::serialize ( int8u ptr) const
286 {
287 if(m_size) memcpy(ptr, m_array, m_size * sizeof(T));
288 }

◆ size()

template<class T >
unsigned agg::pod_vector< T >::size ( ) const
inline
195{ return m_size; }

References agg::pod_vector< T >::m_size.

Referenced by agg::pod_vector< T >::inc_size().

+ Here is the caller graph for this function:

◆ value_at()

template<class T >
T agg::pod_vector< T >::value_at ( unsigned  i) const
inline
203{ return m_array[i]; }

References agg::pod_vector< T >::m_array.

◆ zero()

template<class T >
void agg::pod_vector< T >::zero ( )
inline
187 {
188 memset(m_array, 0, sizeof(T) * m_size);
189 }

References agg::pod_vector< T >::m_array, and agg::pod_vector< T >::m_size.

Member Data Documentation

◆ m_array

◆ m_capacity

template<class T >
unsigned agg::pod_vector< T >::m_capacity
private

◆ m_size


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