LSST Applications g034a557a3c+dd8dd8f11d,g0afe43252f+b86e4b8053,g11f7dcd041+017865fdd3,g1cd03abf6b+8446defddb,g1ce3e0751c+f991eae79d,g28da252d5a+ca8a1a9fb3,g2bbee38e9b+b6588ad223,g2bc492864f+b6588ad223,g2cdde0e794+8523d0dbb4,g347aa1857d+b6588ad223,g35bb328faa+b86e4b8053,g3a166c0a6a+b6588ad223,g461a3dce89+b86e4b8053,g52b1c1532d+b86e4b8053,g7f3b0d46df+ad13c1b82d,g80478fca09+f29c5d6c70,g858d7b2824+293f439f82,g8cd86fa7b1+af721d2595,g965a9036f2+293f439f82,g979bb04a14+51ed57f74c,g9ddcbc5298+f24b38b85a,gae0086650b+b86e4b8053,gbb886bcc26+b97e247655,gc28159a63d+b6588ad223,gc30aee3386+a2f0f6cab9,gcaf7e4fdec+293f439f82,gcd45df26be+293f439f82,gcdd4ae20e8+70b5def7e6,gce08ada175+da9c58a417,gcf0d15dbbd+70b5def7e6,gdaeeff99f8+006e14e809,gdbce86181e+6a170ce272,ge3d4d395c2+224150c836,ge5f7162a3a+bb2241c923,ge6cb8fbbf7+d119aed356,ge79ae78c31+b6588ad223,gf048a9a2f4+40ffced2b8,gf0baf85859+b4cca3d10f,w.2024.30
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: