LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
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 159 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 240 of file SpatialCell.cc.

242  : _iterator(iterator), _end(end), _ignoreBad(ignoreBad) {
243  for (; _iterator != _end; ++_iterator) {
244  (*_iterator)->instantiate();
245 
246  if (!(_ignoreBad && (*_iterator)->isBad())) { // found a good candidate, or don't care
247  return;
248  }
249  }
250 }
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 252 of file SpatialCell.cc.

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

Member Function Documentation

◆ operator!=()

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

Are two SpatialCellCandidateIterators unequal?

Definition at line 186 of file SpatialCell.h.

186 { return _iterator != rhs._iterator; }

◆ operator*() [1/2]

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

Return the std::shared_ptr<CellCandidate>

Definition at line 294 of file SpatialCell.cc.

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

◆ operator*() [2/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 286 of file SpatialCell.cc.

286  {
287  if (_iterator == _end) {
288  throw LSST_EXCEPT(lsst::pex::exceptions::NotFoundError, "Iterator points to end");
289  }
290 
291  return *_iterator;
292 }

◆ operator++()

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

Advance the iterator, maybe skipping over candidates labelled BAD.

Definition at line 261 of file SpatialCell.cc.

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

◆ operator-()

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

Return the number of candidate between this and rhs.

Definition at line 275 of file SpatialCell.cc.

275  {
276  size_t n = 0;
277  for (SpatialCellCandidateIterator ptr = rhs; ptr != *this; ++ptr) {
278  if (!(_ignoreBad && (*ptr)->isBad())) { // found a good candidate, or don't care
279  ++n;
280  }
281  }
282 
283  return n;
284 }
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:240

◆ operator==()

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

Are two SpatialCellCandidateIterators equal?

Definition at line 184 of file SpatialCell.h.

184 { return _iterator == rhs._iterator; }

Friends And Related Function Documentation

◆ SpatialCell

friend class SpatialCell
friend

Definition at line 160 of file SpatialCell.h.


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