lsst.afw  13.0-91-g2a3e2ee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
persistable.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  * Copyright 2008-2016 AURA/LSST.
4  *
5  * This product includes software developed by the
6  * LSST Project (http://www.lsst.org/).
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 LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <https://www.lsstcorp.org/LegalNotices/>.
21  */
22 
23 #include "pybind11/pybind11.h"
24 
26 #include "lsst/afw/fits.h"
27 
28 namespace py = pybind11;
29 using namespace py::literals;
30 
31 namespace lsst {
32 namespace afw {
33 namespace table {
34 namespace io {
35 
36 using PyPersistable = py::class_<Persistable, std::shared_ptr<Persistable>>;
37 
38 PYBIND11_PLUGIN(persistable) {
39  py::module mod("persistable");
40  py::module::import("lsst.afw.fits");
41 
42  PyPersistable cls(mod, "Persistable");
43  cls.def("writeFits",
44  (void (Persistable::*)(std::string const &, std::string const &) const) & Persistable::writeFits,
45  "fileName"_a, "mode"_a = "w");
46  cls.def("writeFits", (void (Persistable::*)(fits::MemFileManager &, std::string const &) const) &
47  Persistable::writeFits,
48  "manager"_a, "mode"_a = "w");
49  cls.def("isPersistable", &Persistable::isPersistable);
50 
51  return mod.ptr();
52 }
53 }
54 }
55 }
56 } // namespace lsst::afw::table::io
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:73
PYBIND11_PLUGIN(_cameraPoint)
Definition: cameraPoint.cc:35
Lifetime-management for memory that goes into FITS memory files.
Definition: fits.h:100
py::class_< Persistable, std::shared_ptr< Persistable >> PyPersistable
Definition: persistable.cc:36
double const _a
Definition: RandomImage.cc:77