LSST Applications g0603fd7c41+501e3db9f9,g0aad566f14+23d8574c86,g0dd44d6229+a1a4c8b791,g2079a07aa2+86d27d4dc4,g2305ad1205+a62672bbc1,g2bbee38e9b+047b288a59,g337abbeb29+047b288a59,g33d1c0ed96+047b288a59,g3a166c0a6a+047b288a59,g3d1719c13e+23d8574c86,g487adcacf7+cb7fd919b2,g4be5004598+23d8574c86,g50ff169b8f+96c6868917,g52b1c1532d+585e252eca,g591dd9f2cf+4a9e435310,g63cd9335cc+585e252eca,g858d7b2824+23d8574c86,g88963caddf+0cb8e002cc,g99cad8db69+43388bcaec,g9ddcbc5298+9a081db1e4,ga1e77700b3+a912195c07,gae0086650b+585e252eca,gb0e22166c9+60f28cb32d,gb2522980b2+793639e996,gb3a676b8dc+b4feba26a1,gb4b16eec92+63f8520565,gba4ed39666+c2a2e4ac27,gbb8dafda3b+a5d255a82e,gc120e1dc64+d820f8acdb,gc28159a63d+047b288a59,gc3e9b769f7+f4f1cc6b50,gcf0d15dbbd+a1a4c8b791,gdaeeff99f8+f9a426f77a,gdb0af172c8+b6d5496702,ge79ae78c31+047b288a59,w.2024.19
LSST Data Management Base Package
Loading...
Searching...
No Matches
_slots.cc
Go to the documentation of this file.
1/*
2 * This file is part of afw.
3 *
4 * Developed for the LSST Data Management System.
5 * This product includes software developed by the LSST Project
6 * (https://www.lsst.org).
7 * See the COPYRIGHT file at the top-level directory of this distribution
8 * for details of code ownership.
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#include "pybind11/pybind11.h"
25#include "pybind11/eigen.h"
26
27#include "lsst/utils/python.h"
28
30
31namespace py = pybind11;
32using namespace pybind11::literals;
33
34namespace lsst {
35namespace afw {
36namespace table {
37
38using utils::python::WrapperCollection;
39
40namespace {
41
42// tiny classes only used in afw::table: no need for shared_ptr.
43using PySlotDefinition = py::class_<SlotDefinition>;
44
45void declareSlotDefinition(WrapperCollection &wrappers) {
46 wrappers.wrapType(PySlotDefinition(wrappers.module, "SlotDefinition"), [](auto &mod, auto &cls) {
47 cls.def("getName", &SlotDefinition::getName);
48 cls.def("getAlias", &SlotDefinition::getAlias);
49 });
50}
51
52/*
53Declare standard methods for subclasses of SlotDefinition (but not SlotDefinition itself).
54*/
55template <typename Class>
56void declareSlotDefinitionSubclass(WrapperCollection &wrappers, std::string const &name) {
57 wrappers.wrapType(py::class_<Class, SlotDefinition>(wrappers.module, name.c_str()),
58 [](auto &mod, auto &cls) {
59 cls.def(py::init<std::string const &>(), "name"_a);
60 cls.def("isValid", &Class::isValid);
61 cls.def("getMeasKey", &Class::getMeasKey);
62 cls.def("getErrKey", &Class::getErrKey);
63 cls.def("getFlagKey", &Class::getFlagKey);
64 cls.def("setKeys", &Class::setKeys, "alias"_a, "schema"_a);
65 });
66}
67
68} // namespace
69
70void wrapSlots(WrapperCollection &wrappers) {
71 // TODO: uncomment once afw.geom uses WrapperCollection
72 // wrappers.addSignatureDependency("lsst.afw.geom.ellipses");
73
74 declareSlotDefinition(wrappers);
78}
79
80} // namespace table
81} // namespace afw
82} // namespace lsst
Tag types used to declare specialized field types.
Definition misc.h:31
void wrapSlots(WrapperCollection &wrappers)
Definition _slots.cc:70