LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
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:378
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("isPropertySetPtr", &PropertySet::isPropertySetPtr);
73  cls.def("valueCount", &PropertySet::valueCount);
74  cls.def("typeOf", &PropertySet::typeOf, py::return_value_policy::reference);
75  cls.def("toString", &PropertySet::toString, "topLevelOnly"_a = false, "indent"_a = "");
76  cls.def("copy", &PropertySet::copy, "dest"_a, "source"_a, "name"_a, "asScalar"_a=false);
77  cls.def("combine", &PropertySet::combine);
78  cls.def("remove", &PropertySet::remove);
79  cls.def("getAsBool", &PropertySet::getAsBool);
80  cls.def("getAsInt", &PropertySet::getAsInt);
81  cls.def("getAsInt64", &PropertySet::getAsInt64);
82  cls.def("getAsDouble", &PropertySet::getAsDouble);
83  cls.def("getAsString", &PropertySet::getAsString);
84  cls.def("getAsPropertySetPtr", &PropertySet::getAsPropertySetPtr);
85  cls.def("getAsPersistablePtr", &PropertySet::getAsPersistablePtr);
86 
87  declareAccessors<bool>(cls, "Bool");
88  declareAccessors<short>(cls, "Short");
89  declareAccessors<int>(cls, "Int");
90  declareAccessors<long>(cls, "Long");
91  declareAccessors<long long>(cls, "LongLong");
92  declareAccessors<float>(cls, "Float");
93  declareAccessors<double>(cls, "Double");
94  declareAccessors<std::string>(cls, "String");
95  declareAccessors<DateTime>(cls, "DateTime");
96  declareAccessors<std::shared_ptr<PropertySet>>(cls, "PropertySet");
97 }
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<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 }
daf::base::PropertySet * set
Definition: fits.cc:832
STL class.
T static_pointer_cast(T... args)