BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
dchain::PartialCandidateItr< CandidateClass > Class Template Reference

#include <PartialCandidateItr.h>

Public Types

typedef LabeledCandidate< CandidateClass > value_type
 
typedef dchain::candidateitr::difference_type difference_type
 
typedef dchain::candidateitr::size_type size_type
 
typedef value_typereference
 
typedef value_typepointer
 
typedef std::bidirectional_iterator_tag iterator_category
 

Public Member Functions

 PartialCandidateItr ()
 
 PartialCandidateItr (const PartialCandidateItr< CandidateClass > &aOtherItr)
 
virtual ~PartialCandidateItr ()
 
const PartialCandidateItr< CandidateClass > & operator= (const PartialCandidateItr< CandidateClass > &aOtherItr)
 
PartialCandidateItr< CandidateClass > & operator++ ()
 
PartialCandidateItr< CandidateClass > operator++ (int)
 
PartialCandidateItr< CandidateClass > & operator-- ()
 
PartialCandidateItr< CandidateClass > operator-- (int)
 
const LabeledCandidate< CandidateClass > & operator* () const
 
bool operator== (const PartialCandidateItr< CandidateClass > &aOtherItr) const
 
bool operator!= (const PartialCandidateItr< CandidateClass > &aOtherItr) const
 

Protected Member Functions

 PartialCandidateItr (const IndexedLabeledCandidates< CandidateClass > *aList, const size_type aIndex, const conjugation::Label aLabel)
 
IndexedLabeledCandidates< CandidateClass > * indexedCandidates () const
 
size_type index () const
 
conjugation::Label label () const
 

Friends

class LabeledCandidateList< CandidateClass >
 

Detailed Description

template<class CandidateClass>
class dchain::PartialCandidateItr< CandidateClass >

Definition at line 47 of file PartialCandidateItr.h.

Member Typedef Documentation

◆ difference_type

template<class CandidateClass >
typedef dchain::candidateitr::difference_type dchain::PartialCandidateItr< CandidateClass >::difference_type

Definition at line 56 of file PartialCandidateItr.h.

◆ iterator_category

template<class CandidateClass >
typedef std::bidirectional_iterator_tag dchain::PartialCandidateItr< CandidateClass >::iterator_category

Definition at line 61 of file PartialCandidateItr.h.

◆ pointer

template<class CandidateClass >
typedef value_type* dchain::PartialCandidateItr< CandidateClass >::pointer

Definition at line 59 of file PartialCandidateItr.h.

◆ reference

template<class CandidateClass >
typedef value_type& dchain::PartialCandidateItr< CandidateClass >::reference

Definition at line 58 of file PartialCandidateItr.h.

◆ size_type

template<class CandidateClass >
typedef dchain::candidateitr::size_type dchain::PartialCandidateItr< CandidateClass >::size_type

Definition at line 57 of file PartialCandidateItr.h.

◆ value_type

template<class CandidateClass >
typedef LabeledCandidate<CandidateClass> dchain::PartialCandidateItr< CandidateClass >::value_type

Definition at line 55 of file PartialCandidateItr.h.

Constructor & Destructor Documentation

◆ PartialCandidateItr() [1/3]

template<class CandidateClass >
dchain::PartialCandidateItr< CandidateClass >::PartialCandidateItr
inline

Definition at line 150 of file PartialCandidateItr.h.

151{
152}

◆ PartialCandidateItr() [2/3]

template<class CandidateClass >
dchain::PartialCandidateItr< CandidateClass >::PartialCandidateItr ( const PartialCandidateItr< CandidateClass > &  aOtherItr)
inline

Definition at line 156 of file PartialCandidateItr.h.

156 :
157 m_indexedCandidates( aOtherItr.indexedCandidates() ) ,
158 m_index( aOtherItr.index() ) ,
159 m_label( aOtherItr.label() )
160{
161}

◆ ~PartialCandidateItr()

template<class CandidateClass >
virtual dchain::PartialCandidateItr< CandidateClass >::~PartialCandidateItr ( )
inlinevirtual

Definition at line 67 of file PartialCandidateItr.h.

67{}

◆ PartialCandidateItr() [3/3]

template<class CandidateClass >
dchain::PartialCandidateItr< CandidateClass >::PartialCandidateItr ( const IndexedLabeledCandidates< CandidateClass > *  aList,
const size_type  aIndex,
const conjugation::Label  aLabel 
)
inlineprotected

Definition at line 165 of file PartialCandidateItr.h.

167 :
168 // cast away const as const_iterator can be assocciated with a non-const list,
169 // but only const lists use this constructor
170 m_indexedCandidates( (IndexedLabeledCandidates< CandidateClass >*)aList ) ,
171 m_index( aIndex ) ,
172 m_label( aLabel )
173{
174 // move to first entry with correct label
175 if ( ( m_index < size_type( (*m_indexedCandidates).size() ) ) &&
176 ( (*m_indexedCandidates).labeledCandidateClass( m_index ) != m_label )
177 ) {
178 operator++() ;
179 }
180}
dchain::candidateitr::size_type size_type
PartialCandidateItr< CandidateClass > & operator++()

Member Function Documentation

◆ index()

template<class CandidateClass >
PartialCandidateItr< CandidateClass >::size_type dchain::PartialCandidateItr< CandidateClass >::index
inlineprotected

◆ indexedCandidates()

template<class CandidateClass >
IndexedLabeledCandidates< CandidateClass > * dchain::PartialCandidateItr< CandidateClass >::indexedCandidates
inlineprotected

Definition at line 124 of file PartialCandidateItr.h.

125{
126 return ( m_indexedCandidates ) ;
127}

Referenced by dchain::PartialCandidateItr< CandidateClass >::operator=(), and dchain::PartialCandidateItr< CandidateClass >::operator==().

◆ label()

template<class CandidateClass >
conjugation::Label dchain::PartialCandidateItr< CandidateClass >::label
inlineprotected

◆ operator!=()

template<class CandidateClass >
bool dchain::PartialCandidateItr< CandidateClass >::operator!= ( const PartialCandidateItr< CandidateClass > &  aOtherItr) const
inline

Definition at line 311 of file PartialCandidateItr.h.

312{
313 // There needs to be a final test on the label as itrs with two different labels
314 // have the same values for the past-the-end value
315 return ( ( m_index != aOtherItr.index() ) ||
316 ( m_indexedCandidates != aOtherItr.indexedCandidates() ) ||
317 ( m_label != aOtherItr.label() ) ) ;
318}

◆ operator*()

template<class CandidateClass >
const LabeledCandidate< CandidateClass > & dchain::PartialCandidateItr< CandidateClass >::operator*
inline

Definition at line 293 of file PartialCandidateItr.h.

294{
295 return ( (*m_indexedCandidates).labeledCandidateClass( m_index ) ) ;
296}

◆ operator++() [1/2]

template<class CandidateClass >
PartialCandidateItr< CandidateClass > & dchain::PartialCandidateItr< CandidateClass >::operator++
inline

Definition at line 202 of file PartialCandidateItr.h.

203{
204 ++m_index ;
205 // This while loop find next match to label.
206 // The order is done for efficiency reasons. It is more likely a label
207 // will match than the end of the list has been reached. However this
208 // will can cause an access to an uninitiallized location, but the
209 // loop will still terminate correctly.
210 // update: the efficiency doesn't matter but reading invalid memory
211 // makes our automated memory checkers have fits
212 while (
213 ( m_index < size_type( (*m_indexedCandidates).size() ) &&
214 ( (*m_indexedCandidates).labeledCandidateClass( m_index ) != m_label )
215 ) ) {
216 ++m_index ;
217 }
218 return ( *this ) ;
219}

Referenced by dchain::PartialItr< T >::operator++(), and dchain::PartialCandidateItr< CandidateClass >::PartialCandidateItr().

◆ operator++() [2/2]

template<class CandidateClass >
PartialCandidateItr< CandidateClass > dchain::PartialCandidateItr< CandidateClass >::operator++ ( int  )
inline

Definition at line 223 of file PartialCandidateItr.h.

224{
225 PartialCandidateItr< CandidateClass > tmp( *this ) ;
226 ++m_index ;
227 // This while loop find next match to label.
228 // The order is done for efficiency reasons. It is more likely a label
229 // will match than the end of the list has been reached. However this
230 // will can cause an access to an uninitiallized location, but the
231 // loop will still terminate correctly.
232 while (
233 ( (*m_indexedCandidates).labeledCandidateClass( m_index ) != m_label ) &&
234 ( m_index < size_type( (*m_indexedCandidates).size() ) ) ) {
235 ++m_index ;
236 }
237 return ( tmp ) ;
238}

◆ operator--() [1/2]

template<class CandidateClass >
PartialCandidateItr< CandidateClass > & dchain::PartialCandidateItr< CandidateClass >::operator--
inline

Definition at line 242 of file PartialCandidateItr.h.

243{
244 // As the index is 'unsigned' it should not go below zero. This behavior is completely
245 // consistent with the STL reverse_iterator adaptor. (See pp254 of Musser & Saini)
246 //
247 if ( 0 != m_index ) {
248 --m_index ;
249 }
250 // This while loop find next match to label.
251 // The order is done for efficiency reasons. It is more likely a label
252 // will match than the end of the list has been reached. However this
253 // will can cause an access to an uninitiallized location, but the
254 // loop will still terminate correctly.
255 while (
256 ( (*m_indexedCandidates).labeledCandidateClass( m_index ) != m_label ) &&
257 ( m_index != 0 ) ) {
258 --m_index ;
259 }
260 return ( *this ) ;
261}

Referenced by dchain::PartialItr< T >::operator--().

◆ operator--() [2/2]

template<class CandidateClass >
PartialCandidateItr< CandidateClass > dchain::PartialCandidateItr< CandidateClass >::operator-- ( int  )
inline

Definition at line 265 of file PartialCandidateItr.h.

266{
267 PartialCandidateItr< CandidateClass > tmp( *this ) ;
268 // As the index is 'unsigned' it should not go below zero. This behavior is completely
269 // consistent with the STL reverse_iterator adaptor. (See pp254 of Musser & Saini)
270 //
271 if ( 0 != m_index ) {
272 --m_index ;
273 }
274 // This while loop find next match to label.
275 // The order is done for efficiency reasons. It is more likely a label
276 // will match than the end of the list has been reached. However this
277 // will can cause an access to an uninitiallized location, but the
278 // loop will still terminate correctly.
279 while (
280 ( (*m_indexedCandidates).labeledCandidateClass( m_index ) != m_label ) &&
281 ( m_index != 0 ) ) {
282 --m_index ;
283 }
284 return ( tmp ) ;
285}

◆ operator=()

template<class CandidateClass >
const PartialCandidateItr< CandidateClass > & dchain::PartialCandidateItr< CandidateClass >::operator= ( const PartialCandidateItr< CandidateClass > &  aOtherItr)
inline

Definition at line 188 of file PartialCandidateItr.h.

189{
190 m_indexedCandidates = aOtherItr.indexedCandidates() ;
191 m_index = aOtherItr.index() ;
192 m_label = aOtherItr.label() ;
193 return ( *this ) ;
194}

Referenced by dchain::PartialItr< T >::operator=().

◆ operator==()

template<class CandidateClass >
bool dchain::PartialCandidateItr< CandidateClass >::operator== ( const PartialCandidateItr< CandidateClass > &  aOtherItr) const
inline

Definition at line 300 of file PartialCandidateItr.h.

301{
302 // There needs to be a final test on the label as itrs with two different labels
303 // have the same values for the past-the-end value
304 return ( ( m_index == aOtherItr.index() ) &&
305 ( m_indexedCandidates == aOtherItr.indexedCandidates() ) &&
306 ( m_label == aOtherItr.label() ) ) ;
307}

Friends And Related Function Documentation

◆ LabeledCandidateList< CandidateClass >

template<class CandidateClass >
friend class LabeledCandidateList< CandidateClass >
friend

Definition at line 311 of file PartialCandidateItr.h.


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