LSST Applications g04c3c9f7ca+2075667efa,g1e125bf412+5f448d5fcf,g2079a07aa2+3e9fd84d81,g2305ad1205+b635cf1488,g2bbee38e9b+6c6beb4891,g337abbeb29+6c6beb4891,g33d1c0ed96+6c6beb4891,g3a166c0a6a+6c6beb4891,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+42f171e1e6,g5c3423f6d4+d536b04327,g607f77f49a+d536b04327,g6f43f06aed+ca1339dc19,g858d7b2824+d536b04327,g8ee334c5b4+d7f9608c2f,g9963eaa53e+b3dc1655d3,g998f4353bf+d536b04327,g99cad8db69+8ef2408349,g9ddcbc5298+9a081db1e4,ga1e77700b3+2cbb763275,gadfd92a7e4+aec2f3b930,gae0086650b+585e252eca,gb0e22166c9+0e73c8378f,gb3b7280ab2+cb5fdb229e,gbb8dafda3b+a327199e22,gc120e1dc64+88074880ea,gc28159a63d+6c6beb4891,gcdd4ae20e8+bd241b2308,gcde1bda545+903e937d91,gcf0d15dbbd+bd241b2308,gdaeeff99f8+f9a426f77a,gddc38dedce+585e252eca,ge79ae78c31+6c6beb4891,gfbcc870c63+b310236976,w.2024.23
LSST Data Management Base Package
Loading...
Searching...
No Matches
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.
 
size_t operator- (SpatialCellCandidateIterator const &rhs) const
 Return the number of candidate between this and rhs.
 
std::shared_ptr< SpatialCellCandidate const > operator* () const
 Dereference the iterator to return the Candidate (if there is one)
 
std::shared_ptr< SpatialCellCandidateoperator* ()
 Return the std::shared_ptr<CellCandidate>
 
bool operator== (SpatialCellCandidateIterator const &rhs) const
 Are two SpatialCellCandidateIterators equal?
 
bool operator!= (SpatialCellCandidateIterator const &rhs) const
 Are two SpatialCellCandidateIterators unequal?
 

Protected Member Functions

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

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 239 of file SpatialCell.cc.

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

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

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 293 of file SpatialCell.cc.

293 {
294 if (_iterator == _end) {
295 throw LSST_EXCEPT(lsst::pex::exceptions::NotFoundError, "Iterator points to end");
296 }
297
298 return *_iterator;
299}
#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 285 of file SpatialCell.cc.

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

◆ operator++()

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

Advance the iterator, maybe skipping over candidates labelled BAD.

Definition at line 260 of file SpatialCell.cc.

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

◆ operator-()

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

Return the number of candidate between this and rhs.

Definition at line 274 of file SpatialCell.cc.

274 {
275 size_t n = 0;
276 for (SpatialCellCandidateIterator ptr = rhs; ptr != *this; ++ptr) {
277 if (!(_ignoreBad && (*ptr)->isBad())) { // found a good candidate, or don't care
278 ++n;
279 }
280 }
281
282 return n;
283}
uint64_t * ptr
Definition RangeSet.cc:95

◆ 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 Symbol 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: