lsst.afw  13.0-110-ge674a0930
python.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * LSST Data Management System
4  * See COPYRIGHT file at the top of the source tree.
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 
24 #ifndef LSST_AFW_TABLE_IO_PYTHON_H
25 #define LSST_AFW_TABLE_IO_PYTHON_H
26 
27 #include "pybind11/pybind11.h"
28 
29 #include <memory>
30 #include <string>
31 
32 #include "lsst/afw/fits.h"
34 
35 namespace lsst {
36 namespace afw {
37 namespace table {
38 namespace io {
39 namespace python {
40 
57 template <typename T>
58 void declarePersistableFacade(pybind11::module &module, std::string const &suffix) {
59  using namespace pybind11::literals;
60 
61  pybind11::class_<PersistableFacade<T>, std::shared_ptr<PersistableFacade<T>>> cls(
62  module, ("PersistableFacade" + suffix).c_str());
63  cls.def_static("readFits",
64  (std::shared_ptr<T>(*)(std::string const &, int)) & PersistableFacade<T>::readFits,
65  "fileName"_a, "hdu"_a = INT_MIN);
66  cls.def_static("readFits",
67  (std::shared_ptr<T>(*)(fits::MemFileManager &, int)) & PersistableFacade<T>::readFits,
68  "manager"_a, "hdu"_a = INT_MIN);
69 }
70 }
71 }
72 }
73 }
74 } // lsst::afw::table::io::python
75 
76 #endif
void declarePersistableFacade(pybind11::module &module, std::string const &suffix)
Wraps an instantiation of PersistableFacade.
Definition: python.h:58
A base class for image defects.
Definition: cameraGeom.dox:3
Lifetime-management for memory that goes into FITS memory files.
Definition: fits.h:101
A CRTP facade class for subclasses of Persistable.
Definition: Persistable.h:173