22 #include "pybind11/pybind11.h" 38 static XPA
get(
bool reset =
false) {
39 static myXPA *singleton = NULL;
41 if (reset && singleton != NULL) {
46 if (singleton == NULL) {
47 singleton =
new myXPA(
"w");
50 return singleton->_xpa;
54 myXPA(myXPA &) =
delete;
55 myXPA operator=(myXPA
const &) =
delete;
57 myXPA(
char const *mode) {
58 _xpa = XPAOpen((
char *)mode);
65 ~myXPA() { XPAClose(_xpa); }
70 XPA myXPA::_xpa = NULL;
75 const char *XPAGet1(XPA
xpa,
char *xtemplate,
char *paramlist,
char *mode) {
84 int n = XPAGet(xpa, xtemplate, paramlist, mode, &buf, &len, NULL, &error, 1);
99 const char *XPASet1(XPA xpa,
char *xtemplate,
char *paramlist,
char *mode,
112 int n = XPASet(xpa, xtemplate, paramlist, mode, buf, len, NULL, &error, 1);
124 const char *XPASetFd1(XPA xpa,
char *xtemplate,
char *paramlist,
char *mode,
133 int n = XPASetFd(xpa, xtemplate, paramlist, mode, fd, NULL, &error, 1);
144 void reset() { myXPA::get(
true); }
149 py::module::import(
"lsst.pex.exceptions");
151 py::class_<xparec>
cls(mod,
"xparec");
152 cls.def(py::init<>());
154 mod.def(
"get", &XPAGet1,
"xpa"_a,
"xtemplate"_a,
"paramList"_a,
"mode"_a);
155 mod.def(
"reset", &reset);
156 mod.def(
"set", &XPASet1,
"xpa"_a,
"xtemplate"_a,
"paramList"_a,
"mode"_a,
"buf"_a,
"len"_a = -1);
157 mod.def(
"setFd1", &XPASetFd1,
"xpa"_a,
"xtemplate"_a,
"paramList"_a,
"mode"_a,
"fd"_a);
PYBIND11_MODULE(xpa, mod)
Reports errors in external input/output operations.
A base class for image defects.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.