lsst.afw
g3a5ebb7d8a+28b83bf6a5
Toggle main menu visibility
Loading...
Searching...
No Matches
include
lsst
afw
cameraGeom
DetectorCollection.h
Go to the documentation of this file.
1
/*
2
* Developed for the LSST Data Management System.
3
* This product includes software developed by the LSST Project
4
* (https://www.lsst.org).
5
* See the COPYRIGHT file at the top-level directory of this distribution
6
* for details of code ownership.
7
*
8
* This program is free software: you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20
*/
21
22
#ifndef LSST_AFW_CAMERAGEOM_DETECTORCOLLECTION_H
23
#define LSST_AFW_CAMERAGEOM_DETECTORCOLLECTION_H
24
25
#include <map>
26
#include <string>
27
#include <memory>
28
29
#include "
lsst/geom/Box.h
"
30
#include "
lsst/afw/table/io/Persistable.h
"
31
#include "
lsst/afw/cameraGeom/Detector.h
"
32
33
namespace
lsst
{
34
namespace
afw
{
35
namespace
cameraGeom
{
36
48
template
<
typename
T>
49
class
DetectorCollectionBase
{
50
public
:
51
52
using
NameMap
=
std::unordered_map<std::string, std::shared_ptr<T>
>;
53
using
IdMap
=
std::map<int, std::shared_ptr<T>
>;
54
using
List
=
std::vector<std::shared_ptr<T>
>;
55
56
virtual
~DetectorCollectionBase
() noexcept = 0;
57
59
NameMap
const &
getNameMap
() const noexcept {
return
_nameDict; }
60
62
IdMap
const
&
getIdMap
() const noexcept {
return
_idDict; }
63
67
std::size_t
size
() const noexcept {
return
_idDict.size(); }
68
72
bool
empty
() const noexcept {
return
_idDict.empty(); }
73
80
std::shared_ptr<T>
operator[]
(
std::string
const
& name)
const
;
81
88
std::shared_ptr<T>
operator[]
(
int
id
)
const
;
89
99
std::shared_ptr<T>
get
(
std::string
const
& name,
std::shared_ptr<T>
def=
nullptr
)
const
;
100
110
std::shared_ptr<T>
get
(
int
id
,
std::shared_ptr<T>
def=
nullptr
)
const
;
111
112
protected
:
113
114
explicit
DetectorCollectionBase
(
List
const
& detectorList);
115
116
DetectorCollectionBase
() noexcept = default;
117
118
DetectorCollectionBase
(
DetectorCollectionBase
const &) = default;
119
DetectorCollectionBase
(
DetectorCollectionBase
&&) = default;
120
121
DetectorCollectionBase
& operator=(
DetectorCollectionBase
const &) = default;
122
DetectorCollectionBase
& operator=(
DetectorCollectionBase
&&) = default;
123
135
void
add
(
std
::shared_ptr<T> detector);
136
137
void
remove
(
std
::
string
const & name);
138
void
remove
(
int
id
);
139
140
private:
141
NameMap
_nameDict;
//< map keyed on name
142
IdMap
_idDict;
//< map keyed on id
143
};
144
145
149
class
DetectorCollection
: public
DetectorCollectionBase
<
Detector
const>,
150
public
table
::io::
PersistableFacade
<
DetectorCollection
>,
151
public
table
::io::
Persistable
{
152
public
:
153
154
DetectorCollection
(
List
const
& list);
155
156
virtual
~DetectorCollection
() noexcept;
157
159
lsst
::
geom
::Box2D const &
getFpBBox
() const noexcept {
return
_fpBBox; }
160
161
// DetectorCollection is immutable, so it cannot be moveable. It is also
162
// always held by shared_ptr, so there is no good reason to copy it.
163
DetectorCollection
(
DetectorCollection
const
&) =
delete
;
164
DetectorCollection
(
DetectorCollection
&&) =
delete
;
165
166
// DetectorCollection is immutable, so it cannot be assignable.
167
DetectorCollection
&
operator=
(
DetectorCollection
const
&) =
delete
;
168
DetectorCollection
&
operator=
(
DetectorCollection
&&) =
delete
;
169
171
bool
isPersistable
() const noexcept
override
{
172
return
true
;
173
}
174
175
protected
:
176
177
DetectorCollection
(
table::io::InputArchive
const
& archive,
table::io::CatalogVector
const
& catalogs);
178
179
std::string
getPersistenceName()
const override
;
180
181
std::string
getPythonModule()
const override
;
182
183
void
write(OutputArchiveHandle& handle)
const override
;
184
185
private
:
186
187
class
Factory;
188
189
lsst::geom::Box2D
_fpBBox;
//< bounding box of collection
190
};
191
192
}
// namespace cameraGeom
193
}
// namespace afw
194
}
// namespace lsst
195
196
197
#endif
// LSST_AFW_CAMERAGEOM_DETECTORCOLLECTION_H
Box.h
Detector.h
Persistable.h
std::string
lsst::afw::cameraGeom::DetectorCollectionBase< Detector::InCameraBuilder >::NameMap
std::unordered_map< std::string, std::shared_ptr< Detector::InCameraBuilder > > NameMap
Definition
DetectorCollection.h:52
lsst::afw::cameraGeom::DetectorCollectionBase< Detector::InCameraBuilder >::remove
void remove(std::string const &name)
lsst::afw::cameraGeom::DetectorCollectionBase::size
std::size_t size() const noexcept
Get the number of detectors.
Definition
DetectorCollection.h:67
lsst::afw::cameraGeom::DetectorCollectionBase< Detector::InCameraBuilder >::List
std::vector< std::shared_ptr< Detector::InCameraBuilder > > List
Definition
DetectorCollection.h:54
lsst::afw::cameraGeom::DetectorCollectionBase::operator[]
std::shared_ptr< T > operator[](int id) const
Implement the [id] operator.
Definition
DetectorCollection.cc:46
lsst::afw::cameraGeom::DetectorCollectionBase::DetectorCollectionBase
DetectorCollectionBase() noexcept=default
lsst::afw::cameraGeom::DetectorCollectionBase::operator[]
std::shared_ptr< T > operator[](std::string const &name) const
Implement the [name] operator.
Definition
DetectorCollection.cc:36
lsst::afw::cameraGeom::DetectorCollectionBase::get
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.
Definition
DetectorCollection.cc:65
lsst::afw::cameraGeom::DetectorCollectionBase::~DetectorCollectionBase
virtual ~DetectorCollectionBase() noexcept=0
lsst::afw::cameraGeom::DetectorCollectionBase::DetectorCollectionBase
DetectorCollectionBase(List const &detectorList)
Definition
DetectorCollection.cc:74
lsst::afw::cameraGeom::DetectorCollectionBase::getIdMap
IdMap const & getIdMap() const noexcept
Get a map keyed and ordered by ID.
Definition
DetectorCollection.h:62
lsst::afw::cameraGeom::DetectorCollectionBase< Detector::InCameraBuilder >::getNameMap
NameMap const & getNameMap() const noexcept
Definition
DetectorCollection.h:59
lsst::afw::cameraGeom::DetectorCollectionBase::get
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.
Definition
DetectorCollection.cc:56
lsst::afw::cameraGeom::DetectorCollectionBase< Detector::InCameraBuilder >::add
void add(std::shared_ptr< Detector::InCameraBuilder > detector)
lsst::afw::cameraGeom::DetectorCollectionBase< Detector::InCameraBuilder >::IdMap
std::map< int, std::shared_ptr< Detector::InCameraBuilder > > IdMap
Definition
DetectorCollection.h:53
lsst::afw::cameraGeom::DetectorCollectionBase::empty
bool empty() const noexcept
Determine if the collection contains any detectors.
Definition
DetectorCollection.h:72
lsst::afw::cameraGeom::DetectorCollection
An immutable collection of Detectors that can be accessed by name or ID.
Definition
DetectorCollection.h:151
lsst::afw::cameraGeom::DetectorCollection::DetectorCollection
DetectorCollection(DetectorCollection const &)=delete
lsst::afw::cameraGeom::DetectorCollection::DetectorCollection
DetectorCollection(List const &list)
Definition
DetectorCollection.cc:207
lsst::afw::cameraGeom::DetectorCollection::getFpBBox
lsst::geom::Box2D const & getFpBBox() const noexcept
Return a focal plane bounding box that encompasses all detectors.
Definition
DetectorCollection.h:159
lsst::afw::cameraGeom::DetectorCollection::~DetectorCollection
virtual ~DetectorCollection() noexcept
lsst::afw::cameraGeom::DetectorCollection::isPersistable
bool isPersistable() const noexcept override
DetectorCollections are always persistable.
Definition
DetectorCollection.h:171
lsst::afw::cameraGeom::DetectorCollection::operator=
DetectorCollection & operator=(DetectorCollection &&)=delete
lsst::afw::cameraGeom::DetectorCollection::DetectorCollection
DetectorCollection(DetectorCollection &&)=delete
lsst::afw::cameraGeom::DetectorCollection::operator=
DetectorCollection & operator=(DetectorCollection const &)=delete
lsst::afw::cameraGeom::Detector
A representation of a detector in a mosaic camera.
Definition
Detector.h:184
lsst::afw::table::io::CatalogVector
A vector of catalogs used by Persistable.
Definition
CatalogVector.h:29
lsst::afw::table::io::InputArchive
A multi-catalog archive object used to load table::io::Persistable objects.
Definition
InputArchive.h:31
lsst::afw::table::io::Persistable::Persistable
Persistable() noexcept=default
lsst::afw::table::io::Persistable::PersistableFacade
friend class PersistableFacade
Definition
Persistable.h:149
lsst::geom::Box2D
std::map
lsst::afw::cameraGeom
Definition
Amplifier.h:33
lsst::afw::table
Definition
table.dox:3
lsst::afw
Definition
imageAlgorithm.dox:1
lsst::geom
lsst
std
STL namespace.
std::shared_ptr
std::size_t
std::unordered_map
std::vector
Generated on
for lsst.afw by
1.17.0