lsst.afw  22.0.1-24-g2e899d296+b05a4897c9
Public Types | Public Member Functions | Protected Member Functions | List of all members
lsst::afw::cameraGeom::DetectorCollectionBase< T > Class Template Referenceabstract

An abstract base class for collections of Detectors and specific subclasses thereof. More...

#include <DetectorCollection.h>

Public Types

using NameMap = std::unordered_map< std::string, std::shared_ptr< T > >
 
using IdMap = std::map< int, std::shared_ptr< T > >
 
using List = std::vector< std::shared_ptr< T > >
 

Public Member Functions

virtual ~DetectorCollectionBase () noexcept=0
 
NameMap const & getNameMap () const noexcept
 Get a map keyed and ordered by name. More...
 
IdMap const & getIdMap () const noexcept
 Get a map keyed and ordered by ID. More...
 
std::size_t size () const noexcept
 Get the number of detectors. More...
 
bool empty () const noexcept
 Determine if the collection contains any detectors. More...
 
std::shared_ptr< T > operator[] (std::string const &name) const
 Implement the [name] operator. More...
 
std::shared_ptr< T > operator[] (int id) const
 Implement the [id] operator. More...
 
std::shared_ptr< T > get (std::string const &name, std::shared_ptr< T > def=nullptr) const
 Retrieve a detector by name, or fall back to a default. More...
 
std::shared_ptr< T > get (int id, std::shared_ptr< T > def=nullptr) const
 Retrieve a detector by ID, or fall back to a default. More...
 

Protected Member Functions

 DetectorCollectionBase (List const &detectorList)
 
 DetectorCollectionBase () noexcept=default
 
 DetectorCollectionBase (DetectorCollectionBase const &)=default
 
 DetectorCollectionBase (DetectorCollectionBase &&)=default
 
DetectorCollectionBaseoperator= (DetectorCollectionBase const &)=default
 
DetectorCollectionBaseoperator= (DetectorCollectionBase &&)=default
 
void add (std::shared_ptr< T > detector)
 Add a detector to the collection. More...
 
void remove (std::string const &name)
 
void remove (int id)
 

Detailed Description

template<typename T>
class lsst::afw::cameraGeom::DetectorCollectionBase< T >

An abstract base class for collections of Detectors and specific subclasses thereof.

Template Parameters
TElement type; either Detector or a subclass thereof.

This class provides the common interface and implementation for DetectorCollection (which holds true Detector instances) and Camera::Builder (which holds Detector::InCameraBuilder instances). It is not intended to define an interface independent of those classes.

Definition at line 49 of file DetectorCollection.h.

Member Typedef Documentation

◆ IdMap

template<typename T >
using lsst::afw::cameraGeom::DetectorCollectionBase< T >::IdMap = std::map<int, std::shared_ptr<T> >

Definition at line 53 of file DetectorCollection.h.

◆ List

Definition at line 54 of file DetectorCollection.h.

◆ NameMap

Definition at line 52 of file DetectorCollection.h.

Constructor & Destructor Documentation

◆ ~DetectorCollectionBase()

template<typename T >
lsst::afw::cameraGeom::DetectorCollectionBase< T >::~DetectorCollectionBase ( )
pure virtualdefaultnoexcept

◆ DetectorCollectionBase() [1/4]

template<typename T >
lsst::afw::cameraGeom::DetectorCollectionBase< T >::DetectorCollectionBase ( List const &  detectorList)
explicitprotected

Definition at line 74 of file DetectorCollection.cc.

◆ DetectorCollectionBase() [2/4]

template<typename T >
lsst::afw::cameraGeom::DetectorCollectionBase< T >::DetectorCollectionBase ( )
protecteddefaultnoexcept

◆ DetectorCollectionBase() [3/4]

template<typename T >
lsst::afw::cameraGeom::DetectorCollectionBase< T >::DetectorCollectionBase ( DetectorCollectionBase< T > const &  )
protecteddefault

◆ DetectorCollectionBase() [4/4]

template<typename T >
lsst::afw::cameraGeom::DetectorCollectionBase< T >::DetectorCollectionBase ( DetectorCollectionBase< T > &&  )
protecteddefault

Member Function Documentation

◆ add()

template<typename T >
void lsst::afw::cameraGeom::DetectorCollectionBase< T >::add ( std::shared_ptr< T >  detector)
protected

Add a detector to the collection.

Parameters
[in]detectorNew detector to add to the collection.
Exceptions
pex::exceptions::RuntimeErrorThrown if the ID and/or name conflict with those of detectors already in the collection.
Exception Safety
Strong for pex::exceptions::RuntimeError, weak (collection is made empty) otherwise.

Definition at line 89 of file DetectorCollection.cc.

◆ empty()

template<typename T >
bool lsst::afw::cameraGeom::DetectorCollectionBase< T >::empty ( ) const
inlinenoexcept

Determine if the collection contains any detectors.

Definition at line 72 of file DetectorCollection.h.

◆ get() [1/2]

template<typename T >
std::shared_ptr< T > lsst::afw::cameraGeom::DetectorCollectionBase< T >::get ( int  id,
std::shared_ptr< T >  def = nullptr 
) const

Retrieve a detector by ID, or fall back to a default.

Parameters
[in]iddetector id
[in]defdefault detector to return. This defaults to nullptr.
Returns
pointer to detector entry if the entry exists, else return the default value

Definition at line 65 of file DetectorCollection.cc.

◆ get() [2/2]

template<typename T >
std::shared_ptr< T > lsst::afw::cameraGeom::DetectorCollectionBase< T >::get ( std::string const &  name,
std::shared_ptr< T >  def = nullptr 
) const

Retrieve a detector by name, or fall back to a default.

Parameters
[in]namedetector name
[in]defdefault detector to return. This defaults to nullptr.
Returns
pointer to detector entry if the entry exists, else return the default value

Definition at line 56 of file DetectorCollection.cc.

◆ getIdMap()

template<typename T >
IdMap const& lsst::afw::cameraGeom::DetectorCollectionBase< T >::getIdMap ( ) const
inlinenoexcept

Get a map keyed and ordered by ID.

Definition at line 62 of file DetectorCollection.h.

◆ getNameMap()

template<typename T >
NameMap const& lsst::afw::cameraGeom::DetectorCollectionBase< T >::getNameMap ( ) const
inlinenoexcept

Get a map keyed and ordered by name.

Definition at line 59 of file DetectorCollection.h.

◆ operator=() [1/2]

template<typename T >
DetectorCollectionBase& lsst::afw::cameraGeom::DetectorCollectionBase< T >::operator= ( DetectorCollectionBase< T > &&  )
protecteddefault

◆ operator=() [2/2]

template<typename T >
DetectorCollectionBase& lsst::afw::cameraGeom::DetectorCollectionBase< T >::operator= ( DetectorCollectionBase< T > const &  )
protecteddefault

◆ operator[]() [1/2]

template<typename T >
std::shared_ptr< T > lsst::afw::cameraGeom::DetectorCollectionBase< T >::operator[] ( int  id) const

Implement the [id] operator.

Parameters
[in]iddetector name
Returns
pointer to detector entry

Definition at line 46 of file DetectorCollection.cc.

◆ operator[]() [2/2]

template<typename T >
std::shared_ptr< T > lsst::afw::cameraGeom::DetectorCollectionBase< T >::operator[] ( std::string const &  name) const

Implement the [name] operator.

Parameters
[in]namedetector name
Returns
pointer to detector entry

Definition at line 36 of file DetectorCollection.cc.

◆ remove() [1/2]

template<typename T >
void lsst::afw::cameraGeom::DetectorCollectionBase< T >::remove ( int  id)
protected

Definition at line 144 of file DetectorCollection.cc.

◆ remove() [2/2]

template<typename T >
void lsst::afw::cameraGeom::DetectorCollectionBase< T >::remove ( std::string const &  name)
protected

Definition at line 129 of file DetectorCollection.cc.

◆ size()

template<typename T >
std::size_t lsst::afw::cameraGeom::DetectorCollectionBase< T >::size ( ) const
inlinenoexcept

Get the number of detectors.

Renamed to __len__ in Python.

Definition at line 67 of file DetectorCollection.h.


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