lsst.afw g5c39d4753b+2b91704afc
Public Types | Public Member Functions | Protected Member Functions | List of all members
lsst::afw::cameraGeom::Camera::Builder Class Reference

A helper class for creating and modifying cameras. More...

#include <Camera.h>

Inheritance diagram for lsst::afw::cameraGeom::Camera::Builder:
lsst::afw::cameraGeom::DetectorCollectionBase< Detector::InCameraBuilder >

Public Types

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

Public Member Functions

virtual ~Builder () noexcept
 
 Builder (std::string const &name)
 Construct a Builder for a completely new Camera with the given name. More...
 
 Builder (Camera const &camera)
 Construct a Builder with the state of an existing Camera. More...
 
std::shared_ptr< Camera const > finish () const
 Construct a new Camera from the state of the Builder. More...
 
std::string getName () const
 Return the name of the camera. More...
 
void setName (std::string const &name)
 Set the name of the camera. More...
 
std::string getPupilFactoryName () const
 Return the fully-qualified name of the Python class that provides this Camera's PupilFactory. More...
 
void setPupilFactoryName (std::string const &pupilFactoryName)
 Set the fully-qualified name of the Python class that provides this Camera's PupilFactory. More...
 
void setTransformFromFocalPlaneTo (CameraSys const &toSys, std::shared_ptr< afw::geom::TransformPoint2ToPoint2 const > transform)
 Set the transformation from FOCAL_PLANE to the given coordinate system. More...
 
bool discardTransformFromFocalPlaneTo (CameraSys const &toSys)
 Remove any transformation from FOCAL_PLANE to the given coordinate system. More...
 
std::shared_ptr< Detector::InCameraBuilderadd (std::string const &name, int id)
 Add a new Detector with the given name and ID. More...
 
void remove (std::string const &name)
 Remove the detector with the given name or ID. More...
 
void remove (int id)
 
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< Detector::InCameraBuilderoperator[] (std::string const &name) const
 Implement the [name] operator. More...
 
std::shared_ptr< Detector::InCameraBuilderoperator[] (int id) const
 Implement the [id] operator. More...
 
std::shared_ptr< Detector::InCameraBuilderget (std::string const &name, std::shared_ptr< Detector::InCameraBuilder > def=nullptr) const
 Retrieve a detector by name, or fall back to a default. More...
 
std::shared_ptr< Detector::InCameraBuilderget (int id, std::shared_ptr< Detector::InCameraBuilder > def=nullptr) const
 Retrieve a detector by ID, or fall back to a default. More...
 

Protected Member Functions

void add (std::shared_ptr< Detector::InCameraBuilder > detector)
 Add a detector to the collection. More...
 

Detailed Description

A helper class for creating and modifying cameras.

Camera and Camera::Builder have no direct inheritance relationship, but both inherit from different specializations of DetectorCollectionBase, so their container-of-detectors interfaces can generally be used the same way in both Python and templated C++.

Definition at line 208 of file Camera.h.

Member Typedef Documentation

◆ IdMap

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

◆ ~Builder()

lsst::afw::cameraGeom::Camera::Builder::~Builder ( )
virtualdefaultnoexcept

◆ Builder() [1/2]

lsst::afw::cameraGeom::Camera::Builder::Builder ( std::string const &  name)
explicit

Construct a Builder for a completely new Camera with the given name.

Definition at line 204 of file Camera.cc.

◆ Builder() [2/2]

lsst::afw::cameraGeom::Camera::Builder::Builder ( Camera const &  camera)
explicit

Construct a Builder with the state of an existing Camera.

Definition at line 206 of file Camera.cc.

Member Function Documentation

◆ add() [1/2]

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 135 of file DetectorCollection.cc.

◆ add() [2/2]

std::shared_ptr< Detector::InCameraBuilder > lsst::afw::cameraGeom::Camera::Builder::add ( std::string const &  name,
int  id 
)

Add a new Detector with the given name and ID.

This is the only way to create a completely new detector (as opposed to a copy of an existing one), and it permanently sets that Detector's name and ID.

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, none otherwise.

Definition at line 329 of file Camera.cc.

◆ discardTransformFromFocalPlaneTo()

bool lsst::afw::cameraGeom::Camera::Builder::discardTransformFromFocalPlaneTo ( CameraSys const &  toSys)

Remove any transformation from FOCAL_PLANE to the given coordinate system.

Parameters
toSysCoordinate system this transform returns points in.
Returns
true if a transform was removed; false otherwise.

Definition at line 320 of file Camera.cc.

◆ empty()

bool lsst::afw::cameraGeom::DetectorCollectionBase< Detector::InCameraBuilder >::empty ( ) const
inlinenoexceptinherited

Determine if the collection contains any detectors.

Definition at line 72 of file DetectorCollection.h.

◆ finish()

std::shared_ptr< Camera const > lsst::afw::cameraGeom::Camera::Builder::finish ( ) const

Construct a new Camera from the state of the Builder.

Definition at line 246 of file Camera.cc.

◆ get() [1/2]

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 110 of file DetectorCollection.cc.

◆ get() [2/2]

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 99 of file DetectorCollection.cc.

◆ getIdMap()

IdMap const & lsst::afw::cameraGeom::DetectorCollectionBase< Detector::InCameraBuilder >::getIdMap ( ) const
inlinenoexceptinherited

Get a map keyed and ordered by ID.

Definition at line 62 of file DetectorCollection.h.

◆ getName()

std::string lsst::afw::cameraGeom::Camera::Builder::getName ( ) const
inline

Return the name of the camera.

Definition at line 230 of file Camera.h.

◆ getNameMap()

NameMap const & lsst::afw::cameraGeom::DetectorCollectionBase< Detector::InCameraBuilder >::getNameMap ( ) const
inlinenoexceptinherited

Get a map keyed and ordered by name.

Definition at line 59 of file DetectorCollection.h.

◆ getPupilFactoryName()

std::string lsst::afw::cameraGeom::Camera::Builder::getPupilFactoryName ( ) const
inline

Return the fully-qualified name of the Python class that provides this Camera's PupilFactory.

Definition at line 236 of file Camera.h.

◆ operator[]() [1/2]

Implement the [id] operator.

Parameters
[in]iddetector name
Returns
pointer to detector entry

Definition at line 88 of file DetectorCollection.cc.

◆ operator[]() [2/2]

Implement the [name] operator.

Parameters
[in]namedetector name
Returns
pointer to detector entry

Definition at line 80 of file DetectorCollection.cc.

◆ remove() [1/2]

void lsst::afw::cameraGeom::Camera::Builder::remove ( int  id)
inline

Definition at line 284 of file Camera.h.

◆ remove() [2/2]

void lsst::afw::cameraGeom::Camera::Builder::remove ( std::string const &  name)
inline

Remove the detector with the given name or ID.

Wrapped as __delitem__ in Python.

Exceptions
pex::exceptions::NotFoundErrorif no such detector exists.

Definition at line 283 of file Camera.h.

◆ setName()

void lsst::afw::cameraGeom::Camera::Builder::setName ( std::string const &  name)
inline

Set the name of the camera.

Definition at line 233 of file Camera.h.

◆ setPupilFactoryName()

void lsst::afw::cameraGeom::Camera::Builder::setPupilFactoryName ( std::string const &  pupilFactoryName)
inline

Set the fully-qualified name of the Python class that provides this Camera's PupilFactory.

Definition at line 239 of file Camera.h.

◆ setTransformFromFocalPlaneTo()

void lsst::afw::cameraGeom::Camera::Builder::setTransformFromFocalPlaneTo ( CameraSys const &  toSys,
std::shared_ptr< afw::geom::TransformPoint2ToPoint2 const >  transform 
)

Set the transformation from FOCAL_PLANE to the given coordinate system.

Parameters
toSysCoordinate system this transform returns points in.
transformTransform from FOCAL_PLANE to toSys.

If a transform already exists from FOCAL_PLANE to toSys, it is overwritten.

Definition at line 299 of file Camera.cc.

◆ size()

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: