BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
DArray< T, N > Class Template Reference

#include <pointer.h>

Public Types

typedef NIter< T, N > iterator
 

Public Member Functions

 DArray ()
 
iterator begin ()
 
iterator end ()
 
T & insert (const T &el)
 
void reset ()
 
const T & operator[] (const int idx) const
 
T & operator[] (const int idx)
 

Static Public Attributes

static const int size = N
 

Detailed Description

template<typename T, int N>
class DArray< T, N >

Definition at line 79 of file pointer.h.

Member Typedef Documentation

◆ iterator

template<typename T , int N>
typedef NIter<T, N> DArray< T, N >::iterator

Definition at line 84 of file pointer.h.

Constructor & Destructor Documentation

◆ DArray()

template<typename T , int N>
DArray< T, N >::DArray ( )
inline

Definition at line 82 of file pointer.h.

82: last(N), len(0) {}

Member Function Documentation

◆ begin()

template<typename T , int N>
iterator DArray< T, N >::begin ( )
inline

Definition at line 85 of file pointer.h.

85{ return iterator(elems, last); }
NIter< T, N > iterator
Definition: pointer.h:84

Referenced by getMinorN(), and MCache::smartinsertMinor3().

◆ end()

template<typename T , int N>
iterator DArray< T, N >::end ( )
inline

Definition at line 86 of file pointer.h.

86{ return iterator(elems, last+len); }

Referenced by getMinorN(), and MCache::smartinsertMinor3().

◆ insert()

template<typename T , int N>
T & DArray< T, N >::insert ( const T &  el)
inline

Definition at line 88 of file pointer.h.

88 {
89 len = (len == N ? len : len+1);
90 last=((last-1)+N)%N;
91 elems[last]=el;
92 return elems[last];
93 }

Referenced by getMinorN().

◆ operator[]() [1/2]

template<typename T , int N>
T & DArray< T, N >::operator[] ( const int  idx)
inline

Definition at line 124 of file pointer.h.

124{ return elems[idx]; }

◆ operator[]() [2/2]

template<typename T , int N>
const T & DArray< T, N >::operator[] ( const int  idx) const
inline

Definition at line 123 of file pointer.h.

123{ return elems[idx]; }

◆ reset()

template<typename T , int N>
void DArray< T, N >::reset ( )
inline

Definition at line 112 of file pointer.h.

112 {
113#ifndef USE_DIRTY_RESET
114 for (int i=0; i<len; i++) {
115 elems[i]=T();
116 }
117#endif
118 last=N;
119 len=0;
120 }

Referenced by MCache::Clear(), ICache::ClearCC(), and ICache::ClearIC().

Member Data Documentation

◆ size

template<typename T , int N>
const int DArray< T, N >::size = N
static

Definition at line 122 of file pointer.h.


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