1#include "pybind11/pybind11.h"
2#include "pybind11/stl.h"
12using namespace pybind11::literals;
19template <
typename T,
typename C>
22 cls.def(getName.
c_str(), (
T (PropertySet::*)(
std::string const&)
const) & PropertySet::get<T>,
"name"_a);
23 cls.def(getName.
c_str(), (
T (PropertySet::*)(
std::string const&,
T const&)
const) & PropertySet::get<T>,
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);
83 py::overload_cast<std::string const &, PropertySet const &, std::string const &, bool>(
86 "dest"_a,
"source"_a,
"name"_a,
"asScalar"_a=
false
99 declareAccessors<bool>(cls,
"Bool");
100 declareAccessors<short>(cls,
"Short");
101 declareAccessors<int>(cls,
"Int");
102 declareAccessors<long>(cls,
"Long");
103 declareAccessors<long long>(cls,
"LongLong");
104 declareAccessors<unsigned long long>(cls,
"UnsignedLongLong");
105 declareAccessors<float>(cls,
"Float");
106 declareAccessors<double>(cls,
"Double");
107 declareAccessors<std::nullptr_t>(cls,
"Undef");
108 declareAccessors<std::string>(cls,
"String");
109 declareAccessors<DateTime>(cls,
"DateTime");
110 declareAccessors<std::shared_ptr<PropertySet>>(cls,
"PropertySet");
table::Key< std::string > name
Interface for DateTime class.
std::string getAsString(std::string const &name) const
Get the last value for a string property name (possibly hierarchical).
size_t nameCount(bool topLevelOnly=true) const
Get the number of names in the PropertySet, optionally including those in subproperties.
int getAsInt(std::string const &name) const
Get the last value for a bool/char/short/int property name (possibly hierarchical).
virtual void remove(std::string const &name)
Remove all values for a property name (possibly hierarchical).
bool isArray(std::string const &name) const
Determine if a name (possibly hierarchical) has multiple values.
int64_t getAsInt64(std::string const &name) const
Get the last value for a bool/char/short/int/int64_t property name (possibly hierarchical).
bool isUndefined(std::string const &name) const
Determine if a name (possibly hierarchical) has a defined value.
bool exists(std::string const &name) const
Determine if a name (possibly hierarchical) exists.
std::vector< std::string > names(bool topLevelOnly=true) const
Get the names in the PropertySet, optionally including those in subproperties.
size_t valueCount() const
Get the number of values in the entire PropertySet, counting each element of a vector.
bool isPropertySetPtr(std::string const &name) const
Determine if a name (possibly hierarchical) is a subproperty.
virtual void copy(std::string const &dest, PropertySet const &source, std::string const &name, bool asScalar=false)
Replace a single value vector in the destination with one from the source.
virtual void combine(PropertySet const &source)
Append all value vectors from the source to their corresponding properties.
std::shared_ptr< PropertySet > getAsPropertySetPtr(std::string const &name) const
Get the last value for a subproperty name (possibly hierarchical).
std::type_info const & typeOf(std::string const &name) const
Get the type of values for a property name (possibly hierarchical).
double getAsDouble(std::string const &name) const
Get the last value for any arithmetic property name (possibly hierarchical).
Persistable::Ptr getAsPersistablePtr(std::string const &name) const
Get the last value for a Persistable name (possibly hierarchical).
uint64_t getAsUInt64(std::string const &name) const
Get the last value for an bool/char/short/int/int64_t property name (possibly hierarchical).
virtual std::shared_ptr< PropertySet > deepCopy() const
Make a deep copy of the PropertySet and all of its contents.
std::vector< std::string > propertySetNames(bool topLevelOnly=true) const
A variant of names that only returns the names of subproperties.
virtual std::string toString(bool topLevelOnly=false, std::string const &indent="") const
Generate a string representation of the PropertySet.
std::vector< std::string > paramNames(bool topLevelOnly=true) const
A variant of names that excludes the names of subproperties.
bool getAsBool(std::string const &name) const
Get the last value for a bool property name (possibly hierarchical).
PYBIND11_MODULE(dateTime, mod)
A base class for image defects.