1 #include "pybind11/pybind11.h"
2 #include "pybind11/stl.h"
12 using namespace pybind11::literals;
19 template <
typename T,
typename C>
24 "name"_a,
"defaultValue"_a);
27 cls.def(getArrayName.
c_str(),
31 cls.def(setName.
c_str(), (void (PropertySet::*)(
std::string const&,
T const&)) & PropertySet::set<T>,
33 cls.def(setName.
c_str(),
38 cls.def(addName.
c_str(), (void (PropertySet::*)(
std::string const&,
T const&)) & PropertySet::add<T>,
40 cls.def(addName.
c_str(),
45 cls.attr(typeName.
c_str()) = py::cast(PropertySet::typeOfT<T>(), py::return_value_policy::reference);
51 py::module::import(
"lsst.daf.base.persistable");
53 py::class_<std::type_info>(mod,
"TypeInfo")
61 py::class_<PropertySet, std::shared_ptr<PropertySet>> cls(mod,
"PropertySet");
63 cls.def(py::init<bool>(),
"flat"_a =
false);
65 cls.def(
"deepCopy", &PropertySet::deepCopy);
66 cls.def(
"nameCount", &PropertySet::nameCount,
"topLevelOnly"_a =
true);
67 cls.def(
"names", &PropertySet::names,
"topLevelOnly"_a =
true);
68 cls.def(
"paramNames", &PropertySet::paramNames,
"topLevelOnly"_a =
true);
69 cls.def(
"propertySetNames", &PropertySet::propertySetNames,
"topLevelOnly"_a =
true);
70 cls.def(
"exists", &PropertySet::exists);
71 cls.def(
"isArray", &PropertySet::isArray);
72 cls.def(
"isUndefined", &PropertySet::isUndefined);
73 cls.def(
"isPropertySetPtr", &PropertySet::isPropertySetPtr);
75 py::overload_cast<>(&PropertySet::valueCount, py::const_));
77 py::overload_cast<std::string const&>(&PropertySet::valueCount,
79 cls.def(
"typeOf", &PropertySet::typeOf, py::return_value_policy::reference);
80 cls.def(
"toString", &PropertySet::toString,
"topLevelOnly"_a =
false,
"indent"_a =
"");
81 cls.def(
"copy", &PropertySet::copy,
"dest"_a,
"source"_a,
"name"_a,
"asScalar"_a=
false);
82 cls.def(
"combine", &PropertySet::combine);
83 cls.def(
"remove", &PropertySet::remove);
84 cls.def(
"getAsBool", &PropertySet::getAsBool);
85 cls.def(
"getAsInt", &PropertySet::getAsInt);
86 cls.def(
"getAsInt64", &PropertySet::getAsInt64);
87 cls.def(
"getAsUInt64", &PropertySet::getAsUInt64);
88 cls.def(
"getAsDouble", &PropertySet::getAsDouble);
89 cls.def(
"getAsString", &PropertySet::getAsString);
90 cls.def(
"getAsPropertySetPtr", &PropertySet::getAsPropertySetPtr);
91 cls.def(
"getAsPersistablePtr", &PropertySet::getAsPersistablePtr);
93 declareAccessors<bool>(cls,
"Bool");
94 declareAccessors<short>(cls,
"Short");
95 declareAccessors<int>(cls,
"Int");
96 declareAccessors<long>(cls,
"Long");
97 declareAccessors<long long>(cls,
"LongLong");
98 declareAccessors<unsigned long long>(cls,
"UnsignedLongLong");
99 declareAccessors<float>(cls,
"Float");
100 declareAccessors<double>(cls,
"Double");
101 declareAccessors<std::nullptr_t>(cls,
"Undef");
102 declareAccessors<std::string>(cls,
"String");
103 declareAccessors<DateTime>(cls,
"DateTime");
104 declareAccessors<std::shared_ptr<PropertySet>>(cls,
"PropertySet");
table::Key< std::string > name
Interface for DateTime class.
std::string const & getName() const noexcept
Return a filter's name.
PYBIND11_MODULE(propertySet, mod)
A base class for image defects.