22 #include <pybind11/pybind11.h> 47 ObjectMaker() =
default;
48 ~ObjectMaker() =
default;
57 py::module::import(
"astshim.base");
59 py::class_<ObjectMaker, std::shared_ptr<ObjectMaker>> makerCls(mod,
"ObjectMaker");
60 makerCls.def(py::init<>());
61 makerCls.def(
"__call__", &ObjectMaker::operator());
62 makerCls.def(
"__reduce__",
63 [makerCls](ObjectMaker
const &
self) {
return py::make_tuple(makerCls, py::tuple()); });
65 py::class_<Object, std::shared_ptr<Object>>
cls(mod,
"Object");
67 cls.def_static(
"fromString", &Object::fromString);
71 cls.def(
"__repr__", [](Object
const &
self) {
return "astshim." +
self.getClassName(); });
72 cls.def(
"__eq__", &Object::operator==, py::is_operator());
73 cls.def(
"__ne__", &Object::operator!=, py::is_operator());
76 cls.def_property(
"id", &Object::getID, &Object::setID);
77 cls.def_property(
"ident", &Object::getIdent, &Object::setIdent);
78 cls.def_property_readonly(
"objSize", &Object::getObjSize);
79 cls.def_property(
"useDefs", &Object::getUseDefs, &Object::setUseDefs);
81 cls.def(
"copy", &Object::copy);
82 cls.def(
"clear", &Object::clear,
"attrib"_a);
83 cls.def(
"hasAttribute", &Object::hasAttribute,
"attrib"_a);
84 cls.def(
"getNObject", &Object::getNObject);
85 cls.def(
"getRefCount", &Object::getRefCount);
86 cls.def(
"lock", &Object::lock,
"wait"_a);
87 cls.def(
"same", &Object::same,
"other"_a);
89 cls.def(
"show", py::overload_cast<bool>(&
Object::show, py::const_),
"showComments"_a =
true);
91 cls.def(
"test", &Object::test,
"attrib"_a);
92 cls.def(
"unlock", &Object::unlock,
"report"_a =
false);
96 cls.def(
"__reduce__", [makerCls](Object
const &
self) {
98 auto unpickleArgs = py::make_tuple(state);
99 return py::make_tuple(makerCls(), unpickleArgs);
AST wrapper classes and functions.
PYBIND11_MODULE(camera, mod)
Channel provides input/output of AST objects.
std::string getClassName(AstObject const *rawObj)
Get the AST class name, changing CmpMap to SeriesMap or ParallelMap as appropriate.
String-based source and sink for channels.