1 #include "pybind11/pybind11.h"
2 #include "pybind11/stl.h"
8 using namespace pybind11::literals;
15 template <
typename T,
typename C>
18 cls.def(getName.
c_str(), (T (PropertyList::*)(
std::string const&)
const) & PropertyList::get<T>,
20 cls.def(getName.
c_str(), (T (PropertyList::*)(
std::string const&, T
const&)
const) & PropertyList::get<T>,
21 "name"_a,
"defaultValue"_a);
34 cls.def(setName.
c_str(), (void (PropertyList::*)(
std::string const&, T
const&)) & PropertyList::set<T>);
38 PropertyList::set<T>);
41 PropertyList::set<T>);
44 cls.def(addName.
c_str(), (void (PropertyList::*)(
std::string const&, T
const&)) & PropertyList::add<T>);
48 PropertyList::add<T>);
51 PropertyList::add<T>);
54 cls.attr(typeName.
c_str()) = py::cast(
typeid(T), py::return_value_policy::reference);
60 py::module::import(
"lsst.daf.base.persistable");
62 py::class_<PropertyList, std::shared_ptr<PropertyList>,
PropertySet>
cls(mod,
"PropertyList");
64 cls.def(py::init<>());
66 cls.def(
"getComment", &PropertyList::getComment);
67 cls.def(
"getOrderedNames", &PropertyList::getOrderedNames);
69 [](
PropertyList const&
self) {
return std::static_pointer_cast<PropertySet>(
self.deepCopy()); });
70 declareAccessors<bool>(
cls,
"Bool");
71 declareAccessors<short>(
cls,
"Short");
72 declareAccessors<int>(
cls,
"Int");
73 declareAccessors<long>(
cls,
"Long");
74 declareAccessors<long long>(
cls,
"LongLong");
75 declareAccessors<float>(
cls,
"Float");
76 declareAccessors<double>(
cls,
"Double");
77 declareAccessors<nullptr_t>(
cls,
"Undef");
78 declareAccessors<std::string>(
cls,
"String");
79 declareAccessors<DateTime>(
cls,
"DateTime");
81 cls.def(
"setPropertySet",