1 #include "pybind11/pybind11.h" 2 #include "pybind11/stl.h" 16 template <
typename T,
typename C>
19 cls.def(getName.
c_str(), (T (PropertyList::*)(
std::string const&)
const) & PropertyList::get<T>,
21 cls.def(getName.
c_str(), (T (PropertyList::*)(
std::string const&, T
const&)
const) & PropertyList::get<T>,
22 "name"_a,
"defaultValue"_a);
30 cls.def(getArrayName.
c_str(),
35 cls.def(setName.
c_str(), (void (PropertyList::*)(
std::string const&, T
const&)) & PropertyList::set<T>);
36 cls.def(setName.
c_str(),
39 PropertyList::set<T>);
40 cls.def(setName.
c_str(),
42 PropertyList::set<T>);
45 cls.def(addName.
c_str(), (void (PropertyList::*)(
std::string const&, T
const&)) & PropertyList::add<T>);
46 cls.def(addName.
c_str(),
47 (void (PropertyList::*)(
std::string const&, std::vector<T>
const&)) & PropertyList::add<T>);
49 PropertyList::add<T>);
50 cls.def(addName.
c_str(),
52 PropertyList::add<T>);
55 cls.attr(typeName.
c_str()) = py::cast(
typeid(T), py::return_value_policy::reference);
61 py::module::import(
"lsst.daf.base.persistable");
63 py::class_<PropertyList, std::shared_ptr<PropertyList>,
PropertySet,
Citizen>
cls(mod,
"PropertyList");
65 cls.def(py::init<>());
67 cls.def(
"getComment", &PropertyList::getComment);
68 cls.def(
"getOrderedNames", &PropertyList::getOrderedNames);
71 declareAccessors<bool>(
cls,
"Bool");
72 declareAccessors<short>(
cls,
"Short");
73 declareAccessors<int>(
cls,
"Int");
74 declareAccessors<long>(
cls,
"Long");
75 declareAccessors<long long>(
cls,
"LongLong");
76 declareAccessors<float>(
cls,
"Float");
77 declareAccessors<double>(
cls,
"Double");
78 declareAccessors<nullptr_t>(
cls,
"Undef");
79 declareAccessors<std::string>(
cls,
"String");
80 declareAccessors<DateTime>(
cls,
"DateTime");
82 cls.def(
"setPropertySet",
PYBIND11_MODULE(propertyList, mod)
Class for storing ordered metadata with comments.
daf::base::PropertySet * set
A base class for image defects.
T static_pointer_cast(T... args)
Interface for DateTime class.
Class for storing generic metadata.
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...