23 #include <pybind11/pybind11.h> 27 #include "lsst/pex/exceptions/Exception.h" 28 #include "lsst/pex/exceptions/Runtime.h" 29 #include "lsst/pex/exceptions/python/Exception.h" 33 namespace py = pybind11;
38 py::module mod(
"_fits",
"Python wrapper for afw _fits library");
40 py::class_<MemFileManager> clsMemFileManager(mod,
"MemFileManager");
42 lsst::pex::exceptions::python::declareException<FitsError, lsst::pex::exceptions::IoError>(
43 mod,
"FitsError",
"IoError");
47 clsMemFileManager.def(py::init<>());
48 clsMemFileManager.def(py::init<size_t>());
57 clsMemFileManager.def(
"setData", [](
MemFileManager &m, py::bytes
const &d,
size_t size) {
58 memcpy(m.
getData(), PyBytes_AsString(d.ptr()), size);
Lifetime-management for memory that goes into FITS memory files.
void * getData() const
Return the buffer.
std::size_t getLength() const
Return the buffer length.