LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
Public Member Functions | Protected Member Functions | Friends | List of all members
lsst::afw::math::SpatialCellCandidateIterator Class Reference

An iterator that only returns usable members of the SpatialCell. More...

#include <SpatialCell.h>

Public Member Functions

void operator++ ()
 Advance the iterator, maybe skipping over candidates labelled BAD. More...
 
size_t operator- (SpatialCellCandidateIterator const &rhs) const
 Return the number of candidate between this and rhs. More...
 
std::shared_ptr< SpatialCellCandidate const > operator* () const
 Dereference the iterator to return the Candidate (if there is one) More...
 
std::shared_ptr< SpatialCellCandidateoperator* ()
 Return the std::shared_ptr<CellCandidate> More...
 
bool operator== (SpatialCellCandidateIterator const &rhs) const
 Are two SpatialCellCandidateIterators equal? More...
 
bool operator!= (SpatialCellCandidateIterator const &rhs) const
 Are two SpatialCellCandidateIterators unequal? More...
 

Protected Member Functions

 SpatialCellCandidateIterator (CandidateList::iterator iterator, CandidateList::iterator end, bool ignoreBad)
 ctor; designed to be used to pass begin to SpatialCellCandidateIterator More...
 
 SpatialCellCandidateIterator (CandidateList::iterator iterator, CandidateList::iterator end, bool ignoreBad, bool)
 ctor; designed to be used to pass end to SpatialCellCandidateIterator More...
 

Friends

class SpatialCell
 

Detailed Description

An iterator that only returns usable members of the SpatialCell.

Definition at line 163 of file SpatialCell.h.

Constructor & Destructor Documentation

◆ SpatialCellCandidateIterator() [1/2]

lsst::afw::math::SpatialCellCandidateIterator::SpatialCellCandidateIterator ( CandidateList::iterator  iterator,
CandidateList::iterator  end,
bool  ignoreBad 
)
protected

ctor; designed to be used to pass begin to SpatialCellCandidateIterator

Parameters
iteratorWhere this iterator should start
endOne-past-the-end of iterator's range
ignoreBadShould we pass over bad Candidates?

Definition at line 241 of file SpatialCell.cc.

243  : _iterator(iterator), _end(end), _ignoreBad(ignoreBad) {
244  for (; _iterator != _end; ++_iterator) {
245  (*_iterator)->instantiate();
246 
247  if (!(_ignoreBad && (*_iterator)->isBad())) { // found a good candidate, or don't care
248  return;
249  }
250  }
251 }
int end

◆ SpatialCellCandidateIterator() [2/2]

lsst::afw::math::SpatialCellCandidateIterator::SpatialCellCandidateIterator ( CandidateList::iterator  iterator,
CandidateList::iterator  end,
bool  ignoreBad,
bool   
)
protected

ctor; designed to be used to pass end to SpatialCellCandidateIterator

Parameters
iteratorstart of of iterator's range; not used
endWhere this iterator should start
ignoreBadShould we pass over bad Candidates?

Definition at line 253 of file SpatialCell.cc.

255  : _iterator(end), _end(end), _ignoreBad(ignoreBad) {
256  if (ignoreBad) {
257  // We could decrement end if there are bad Candidates at the end of the list, but it's probably
258  // not worth the trouble
259  }
260 }
int end

Member Function Documentation

◆ operator!=()

bool lsst::afw::math::SpatialCellCandidateIterator::operator!= ( SpatialCellCandidateIterator const &  rhs) const
inline

Are two SpatialCellCandidateIterators unequal?

Definition at line 190 of file SpatialCell.h.

190 { return _iterator != rhs._iterator; }

◆ operator*() [1/2]

std::shared_ptr< SpatialCellCandidate const > lsst::afw::math::SpatialCellCandidateIterator::operator* ( ) const

Dereference the iterator to return the Candidate (if there is one)

Exceptions
lsst::pex::exceptions::NotFoundErrorif no candidate is available

Definition at line 287 of file SpatialCell.cc.

287  {
288  if (_iterator == _end) {
289  throw LSST_EXCEPT(lsst::pex::exceptions::NotFoundError, "Iterator points to end");
290  }
291 
292  return *_iterator;
293 }
Reports attempts to access elements using an invalid key.
Definition: Runtime.h:151
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ operator*() [2/2]

std::shared_ptr< SpatialCellCandidate > lsst::afw::math::SpatialCellCandidateIterator::operator* ( )

Return the std::shared_ptr<CellCandidate>

Definition at line 295 of file SpatialCell.cc.

295  {
296  if (_iterator == _end) {
297  throw LSST_EXCEPT(lsst::pex::exceptions::NotFoundError, "Iterator points to end");
298  }
299 
300  return *_iterator;
301 }
Reports attempts to access elements using an invalid key.
Definition: Runtime.h:151
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ operator++()

void lsst::afw::math::SpatialCellCandidateIterator::operator++ ( )

Advance the iterator, maybe skipping over candidates labelled BAD.

Definition at line 262 of file SpatialCell.cc.

262  {
263  if (_iterator != _end) {
264  ++_iterator;
265  }
266 
267  for (; _iterator != _end; ++_iterator) {
268  (*_iterator)->instantiate();
269 
270  if (!(_ignoreBad && (*_iterator)->isBad())) { // found a good candidate, or don't care
271  return;
272  }
273  }
274 }

◆ operator-()

size_t lsst::afw::math::SpatialCellCandidateIterator::operator- ( SpatialCellCandidateIterator const &  rhs) const

Return the number of candidate between this and rhs.

Definition at line 276 of file SpatialCell.cc.

276  {
277  size_t n = 0;
278  for (SpatialCellCandidateIterator ptr = rhs; ptr != *this; ++ptr) {
279  if (!(_ignoreBad && (*ptr)->isBad())) { // found a good candidate, or don't care
280  ++n;
281  }
282  }
283 
284  return n;
285 }
uint64_t * ptr
Definition: RangeSet.cc:88
SpatialCellCandidateIterator(CandidateList::iterator iterator, CandidateList::iterator end, bool ignoreBad)
ctor; designed to be used to pass begin to SpatialCellCandidateIterator
Definition: SpatialCell.cc:241

◆ operator==()

bool lsst::afw::math::SpatialCellCandidateIterator::operator== ( SpatialCellCandidateIterator const &  rhs) const
inline

Are two SpatialCellCandidateIterators equal?

Definition at line 188 of file SpatialCell.h.

188 { return _iterator == rhs._iterator; }

Friends And Related Function Documentation

◆ SpatialCell

friend class SpatialCell
friend

Definition at line 164 of file SpatialCell.h.


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