LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+13f3999e92,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+5700dc9eac,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+d730eedb7d,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+5e831397f4,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+41c94011de,gf3fb38a9a8+8f07a9901b,gfb92a5be7c+9c285cab97,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
Namespaces | Classes | Functions
lsst::daf::base Namespace Reference

Namespaces

namespace  dateTime
 
namespace  propertyContainer
 
namespace  version
 
namespace  yaml
 

Classes

class  DateTime
 Class for handling dates/times, including MJD, UTC, and TAI. More...
 
class  Persistable
 Base class for all persistable classes. More...
 
class  PropertyList
 Class for storing ordered metadata with comments. More...
 
class  PropertySet
 Class for storing generic metadata. More...
 

Functions

template<>
void PropertySet::add< std::shared_ptr< PropertySet > > (std::string const &name, std::shared_ptr< PropertySet > const &value)
 
template<>
void PropertySet::add< std::shared_ptr< PropertySet > > (std::string const &name, std::vector< std::shared_ptr< PropertySet > > const &value)
 
void wrapPersistable (WrapperCollection &wrappers)
 
void wrapDateTime (WrapperCollection &wrappers)
 
void wrapPropertyList (WrapperCollection &wrappers)
 
void wrapPropertySet (WrapperCollection &wrappers)
 
 PYBIND11_MODULE (_dafBaseLib, mod)
 

Function Documentation

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

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

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

◆ PYBIND11_MODULE()

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

Definition at line 37 of file _dafBaseLib.cc.

37 {
38 lsst::cpputils::python::WrapperCollection wrappers(mod, "lsst.daf.base");
39 wrapPersistable(wrappers);
40 wrapDateTime(wrappers);
41 wrapPropertySet(wrappers);
42 wrapPropertyList(wrappers);
43 wrappers.finish();
44}
A helper class for subdividing pybind11 module across multiple translation units (i....
Definition python.h:242
void wrapPropertySet(WrapperCollection &wrappers)
void wrapPropertyList(WrapperCollection &wrappers)
void wrapDateTime(WrapperCollection &wrappers)
Definition dateTime.cc:12

◆ wrapDateTime()

void lsst::daf::base::wrapDateTime ( WrapperCollection & wrappers)

Definition at line 12 of file dateTime.cc.

12 {
13 auto clsDef = wrappers.wrapType(py::class_<DateTime>(wrappers.module, "DateTime"), [](auto &mod, auto &cls) {
14 cls.def(py::init<>());
15 cls.def_readonly_static("invalid_nsecs", &DateTime::invalid_nsecs);
16 cls.def(py::init<long long, DateTime::Timescale>(), "nsecs"_a, "scale"_a = DateTime::Timescale::TAI);
17 cls.def(py::init<double, DateTime::DateSystem, DateTime::Timescale>(), "date"_a,
18 "system"_a = DateTime::DateSystem::MJD, "scale"_a = DateTime::Timescale::TAI);
19 cls.def(py::init<int, int, int, int, int, int, DateTime::Timescale>());
20 cls.def(py::init<const std::string &, DateTime::Timescale>());
21 cls.def("nsecs", &DateTime::nsecs, "scale"_a = DateTime::Timescale::TAI);
22 cls.def("get", &DateTime::get, "system"_a = DateTime::DateSystem::MJD,
23 "scale"_a = DateTime::Timescale::TAI);
24 cls.def("toString", &DateTime::toString);
25 cls.def("gmtime", &DateTime::gmtime);
26 cls.def("timespec", &DateTime::timespec);
27 cls.def("timeval", &DateTime::timeval);
28 cls.def("isValid", &DateTime::isValid);
29 cls.def_static("now", &DateTime::now);
30 cls.def_static("initializeLeapSeconds", &DateTime::initializeLeapSeconds);
31 cls.def("__eq__", [](DateTime const &self, DateTime const &other) { return self == other; },
32 py::is_operator());
33 });
34
35 wrappers.wrapType(py::enum_<DateTime::Timescale>(clsDef, "Timescale"), [](auto &mod, auto &enm) {
36 enm.value("TAI", DateTime::Timescale::TAI);
37 enm.value("UTC", DateTime::Timescale::UTC);
38 enm.value("TT", DateTime::Timescale::TT);
39 enm.export_values();
40 });
41
42 wrappers.wrapType(py::enum_<DateTime::DateSystem>(clsDef, "DateSystem"), [](auto &mod, auto &enm) {
43 enm.value("JD", DateTime::DateSystem::JD);
44 enm.value("MJD", DateTime::DateSystem::MJD);
45 enm.value("EPOCH", DateTime::DateSystem::EPOCH);
46 enm.export_values();
47 });
48
49}
PyType wrapType(PyType cls, ClassWrapperCallback function, bool setModuleName=true)
Add a type (class or enum) wrapper, deferring method and other attribute definitions until finish() i...
Definition python.h:391

◆ wrapPersistable()

void lsst::daf::base::wrapPersistable ( WrapperCollection & wrappers)

Definition at line 12 of file persistable.cc.

12 {
13 using PyPersistable = py::class_<Persistable, std::shared_ptr<Persistable>>;
14 wrappers.wrapType(PyPersistable(wrappers.module, "Persistable"), [] (auto &mod, auto &cls) {
15 });
16}

◆ wrapPropertyList()

void lsst::daf::base::wrapPropertyList ( WrapperCollection & wrappers)

Definition at line 61 of file propertyList.cc.

61 {
62 using PyPropertyList = py::class_<PropertyList, std::shared_ptr<PropertyList>, PropertySet>;
63 wrappers.wrapType(PyPropertyList(wrappers.module, "PropertyList"), [](auto &mod, auto &cls) {
64 cls.def(py::init<>());
65
66 cls.def("getComment", &PropertyList::getComment);
67 cls.def("getOrderedNames", &PropertyList::getOrderedNames);
68 cls.def("deepCopy",
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<std::nullptr_t>(cls, "Undef");
78 declareAccessors<std::string>(cls, "String");
79 declareAccessors<DateTime>(cls, "DateTime");
80
81 cls.def("setPropertySet",
82 (void (PropertyList::*)(std::string const &, PropertySet::Ptr const &)) &PropertyList::set);
83 });
84}
Class for storing ordered metadata with comments.
Class for storing generic metadata.
Definition PropertySet.h:66
STL namespace.

◆ wrapPropertySet()

void lsst::daf::base::wrapPropertySet ( WrapperCollection & wrappers)

Definition at line 51 of file propertySet.cc.

51 {
52 wrappers.wrapType(py::class_<std::type_info>(wrappers.module, "TypeInfo"), [](auto &mod, auto &cls) {
53 cls.def("__eq__",
54 [](std::type_info const &self, std::type_info const &other) { return self == other; });
55 cls.def("__ne__",
56 [](std::type_info const &self, std::type_info const &other) { return self != other; });
57 cls.def("name", &std::type_info::name);
58 cls.def("__hash__", &std::type_info::hash_code);
59 });
60
61 using PyPropertySet = py::class_<PropertySet, std::shared_ptr<PropertySet>>;
62 wrappers.wrapType(PyPropertySet(wrappers.module, "PropertySet"), [](auto &mod, auto &cls) {
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",
75 py::overload_cast<>(&PropertySet::valueCount, py::const_));
76 cls.def("valueCount",
77 py::overload_cast<std::string const &>(&PropertySet::valueCount,
78 py::const_));
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(
82 "copy",
83 py::overload_cast<std::string const &, PropertySet const &, std::string const &, bool>(
84 &PropertySet::copy
85 ),
86 "dest"_a, "source"_a, "name"_a, "asScalar"_a = false
87 );
88 cls.def("combine", py::overload_cast<PropertySet const &>(&PropertySet::combine));
89 cls.def("remove", &PropertySet::remove);
90 cls.def("getAsBool", &PropertySet::getAsBool);
91 cls.def("getAsInt", &PropertySet::getAsInt);
92 cls.def("getAsInt64", &PropertySet::getAsInt64);
93 cls.def("getAsUInt64", &PropertySet::getAsUInt64);
94 cls.def("getAsDouble", &PropertySet::getAsDouble);
95 cls.def("getAsString", &PropertySet::getAsString);
96 cls.def("getAsPropertySetPtr", &PropertySet::getAsPropertySetPtr);
97 cls.def("getAsPersistablePtr", &PropertySet::getAsPersistablePtr);
98
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");
111 });
112}
T hash_code(T... args)
T name(T... args)