LSSTApplications  18.1.0
LSSTDataManagementBasePackage
Namespaces | Classes | Functions
lsst::daf::base Namespace Reference

Namespaces

 citizen
 
 dateTime
 
 propertyContainer
 
 version
 
 yaml
 

Classes

class  Citizen
 Citizen is a class that should be among all LSST classes base classes, and handles basic memory management. More...
 
class  DateTime
 Class for handling dates/times, including MJD, UTC, and TAI. More...
 
class  Persistable
 Base class for all persistable classes. More...
 
class  PersistentCitizenScope
 A PersistentCitizenScope object causes all Citizen objects created during its lifetime to be marked as persistent. More...
 
class  PropertyList
 Class for storing ordered metadata with comments. More...
 
class  PropertySet
 Class for storing generic metadata. More...
 

Functions

template<>
void PropertySet::add< PropertySet::Ptr > (std::string const &name, Ptr const &value)
 
template<>
void PropertySet::add< PropertySet::Ptr > (std::string const &name, std::vector< Ptr > const &value)
 
 PYBIND11_MODULE (citizen, mod)
 
 PYBIND11_MODULE (dateTime, mod)
 
 PYBIND11_MODULE (persistable, mod)
 
 PYBIND11_MODULE (propertyList, mod)
 
 PYBIND11_MODULE (propertySet, mod)
 

Function Documentation

◆ PropertySet::add< PropertySet::Ptr >() [1/2]

template<>
void lsst::daf::base::PropertySet::add< PropertySet::Ptr > ( std::string const &  name,
Ptr const &  value 
)

◆ PropertySet::add< PropertySet::Ptr >() [2/2]

template<>
void lsst::daf::base::PropertySet::add< PropertySet::Ptr > ( std::string const &  name,
std::vector< Ptr > const &  value 
)

◆ PYBIND11_MODULE() [1/5]

lsst::daf::base::PYBIND11_MODULE ( dateTime  ,
mod   
)

Definition at line 12 of file dateTime.cc.

12  {
13  py::class_<DateTime> cls(mod, "DateTime");
14 
15  py::enum_<DateTime::Timescale>(cls, "Timescale")
16  .value("TAI", DateTime::Timescale::TAI)
17  .value("UTC", DateTime::Timescale::UTC)
18  .value("TT", DateTime::Timescale::TT)
19  .export_values();
20 
21  py::enum_<DateTime::DateSystem>(cls, "DateSystem")
22  .value("JD", DateTime::DateSystem::JD)
23  .value("MJD", DateTime::DateSystem::MJD)
24  .value("EPOCH", DateTime::DateSystem::EPOCH)
25  .export_values();
26 
27  cls.def(py::init<>())
28  .def_readonly_static("invalid_nsecs", &DateTime::invalid_nsecs)
29  .def(py::init<long long, DateTime::Timescale>(), "nsecs"_a, "scale"_a = DateTime::Timescale::TAI)
30  .def(py::init<double, DateTime::DateSystem, DateTime::Timescale>(), "date"_a,
31  "system"_a = DateTime::DateSystem::MJD, "scale"_a = DateTime::Timescale::TAI)
32  .def(py::init<int, int, int, int, int, int, DateTime::Timescale>())
33  .def(py::init<const std::string &, DateTime::Timescale>())
34  .def("nsecs", &DateTime::nsecs, "scale"_a = DateTime::Timescale::TAI)
35  .def("get", &DateTime::get, "system"_a = DateTime::DateSystem::MJD,
36  "scale"_a = DateTime::Timescale::TAI)
37  .def("toString", &DateTime::toString)
38  .def("gmtime", &DateTime::gmtime)
39  .def("timespec", &DateTime::timespec)
40  .def("timeval", &DateTime::timeval)
41  .def("isValid", &DateTime::isValid)
42  .def_static("now", &DateTime::now)
43  .def_static("initializeLeapSeconds", &DateTime::initializeLeapSeconds)
44  .def("__eq__", [](DateTime const &self, DateTime const &other) { return self == other; },
45  py::is_operator());
46 }
bool isValid
Definition: fits.cc:380
ItemVariant const * other
Definition: Schema.cc:56

◆ PYBIND11_MODULE() [2/5]

lsst::daf::base::PYBIND11_MODULE ( citizen  ,
mod   
)

Definition at line 12 of file citizen.cc.

12  {
13  py::class_<Citizen, std::shared_ptr<Citizen>> cls(mod, "Citizen");
14 
15  cls.def("repr", &Citizen::repr);
16  cls.def("markPersistent", &Citizen::markPersistent);
17  cls.def_static("census", (int (*)(int, Citizen::memId)) & Citizen::census);
18  cls.def_static("census", (const std::vector<const Citizen *> *(*)()) & Citizen::census,
19  py::return_value_policy::reference);
20  /* It is strange to expose cout to Python, so instead make a new wrapper */
21  cls.def_static("census", [](Citizen::memId id) { Citizen::census(std::cout, id); });
22  // TODO: pybind11 can't handle an owning pointer to a container of non-owning pointers
23  // ::reference is a temporary workaround until we figure out a better way
24  cls.def_static("census", (std::vector<Citizen const *> const *(*)()) & Citizen::census,
25  py::return_value_policy::reference);
26  cls.def("getId", &Citizen::getId);
27  cls.def("markPersistent", &Citizen::markPersistent);
28  cls.def_static("getNextMemId", &Citizen::getNextMemId);
29  cls.def_static("setNewCallbackId", &Citizen::setNewCallbackId);
30  cls.def_static("setDeleteCallbackId", &Citizen::setDeleteCallbackId);
31 }
STL class.

◆ PYBIND11_MODULE() [3/5]

lsst::daf::base::PYBIND11_MODULE ( persistable  ,
mod   
)

Definition at line 14 of file persistable.cc.

14  {
15  py::class_<Persistable, std::shared_ptr<Persistable>> cls(mod, "Persistable");
16 }

◆ PYBIND11_MODULE() [4/5]

lsst::daf::base::PYBIND11_MODULE ( propertySet  ,
mod   
)

Definition at line 50 of file propertySet.cc.

50  {
51  py::module::import("lsst.daf.base.persistable");
52 
53  py::class_<std::type_info>(mod, "TypeInfo")
54  .def("__eq__",
55  [](std::type_info const& self, std::type_info const& other) { return self == other; })
56  .def("__ne__",
57  [](std::type_info const& self, std::type_info const& other) { return self != other; })
58  .def("name", &std::type_info::name)
59  .def("__hash__", &std::type_info::hash_code);
60 
61  py::class_<PropertySet, std::shared_ptr<PropertySet>, Citizen> cls(mod, "PropertySet");
62 
63  cls.def(py::init<bool>(), "flat"_a = false);
64 
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);
74  cls.def("valueCount", &PropertySet::valueCount);
75  cls.def("typeOf", &PropertySet::typeOf, py::return_value_policy::reference);
76  cls.def("toString", &PropertySet::toString, "topLevelOnly"_a = false, "indent"_a = "");
77  cls.def("copy", &PropertySet::copy, "dest"_a, "source"_a, "name"_a, "asScalar"_a=false);
78  cls.def("combine", &PropertySet::combine);
79  cls.def("remove", &PropertySet::remove);
80  cls.def("getAsBool", &PropertySet::getAsBool);
81  cls.def("getAsInt", &PropertySet::getAsInt);
82  cls.def("getAsInt64", &PropertySet::getAsInt64);
83  cls.def("getAsUInt64", &PropertySet::getAsUInt64);
84  cls.def("getAsDouble", &PropertySet::getAsDouble);
85  cls.def("getAsString", &PropertySet::getAsString);
86  cls.def("getAsPropertySetPtr", &PropertySet::getAsPropertySetPtr);
87  cls.def("getAsPersistablePtr", &PropertySet::getAsPersistablePtr);
88 
89  declareAccessors<bool>(cls, "Bool");
90  declareAccessors<short>(cls, "Short");
91  declareAccessors<int>(cls, "Int");
92  declareAccessors<long>(cls, "Long");
93  declareAccessors<long long>(cls, "LongLong");
94  declareAccessors<unsigned long long>(cls, "UnsignedLongLong");
95  declareAccessors<float>(cls, "Float");
96  declareAccessors<double>(cls, "Double");
97  declareAccessors<nullptr_t>(cls, "Undef");
98  declareAccessors<std::string>(cls, "String");
99  declareAccessors<DateTime>(cls, "DateTime");
100  declareAccessors<std::shared_ptr<PropertySet>>(cls, "PropertySet");
101 }
T hash_code(T... args)
T name(T... args)
ItemVariant const * other
Definition: Schema.cc:56

◆ PYBIND11_MODULE() [5/5]

lsst::daf::base::PYBIND11_MODULE ( propertyList  ,
mod   
)

Definition at line 60 of file propertyList.cc.

60  {
61  py::module::import("lsst.daf.base.persistable");
62 
63  py::class_<PropertyList, std::shared_ptr<PropertyList>, PropertySet, Citizen> cls(mod, "PropertyList");
64 
65  cls.def(py::init<>());
66 
67  cls.def("getComment", &PropertyList::getComment);
68  cls.def("getOrderedNames", &PropertyList::getOrderedNames);
69  cls.def("deepCopy",
70  [](PropertyList const& self) { return std::static_pointer_cast<PropertySet>(self.deepCopy()); });
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");
81 
82  cls.def("setPropertySet",
83  (void (PropertyList::*)(std::string const&, PropertySet::Ptr const&)) & PropertyList::set);
84 }
daf::base::PropertySet * set
Definition: fits.cc:884
STL class.
T static_pointer_cast(T... args)