LSSTApplications  17.0+11,17.0+34,17.0+56,17.0+57,17.0+59,17.0+7,17.0-1-g377950a+33,17.0.1-1-g114240f+2,17.0.1-1-g4d4fbc4+28,17.0.1-1-g55520dc+49,17.0.1-1-g5f4ed7e+52,17.0.1-1-g6dd7d69+17,17.0.1-1-g8de6c91+11,17.0.1-1-gb9095d2+7,17.0.1-1-ge9fec5e+5,17.0.1-1-gf4e0155+55,17.0.1-1-gfc65f5f+50,17.0.1-1-gfc6fb1f+20,17.0.1-10-g87f9f3f+1,17.0.1-11-ge9de802+16,17.0.1-16-ga14f7d5c+4,17.0.1-17-gc79d625+1,17.0.1-17-gdae4c4a+8,17.0.1-2-g26618f5+29,17.0.1-2-g54f2ebc+9,17.0.1-2-gf403422+1,17.0.1-20-g2ca2f74+6,17.0.1-23-gf3eadeb7+1,17.0.1-3-g7e86b59+39,17.0.1-3-gb5ca14a,17.0.1-3-gd08d533+40,17.0.1-30-g596af8797,17.0.1-4-g59d126d+4,17.0.1-4-gc69c472+5,17.0.1-6-g5afd9b9+4,17.0.1-7-g35889ee+1,17.0.1-7-gc7c8782+18,17.0.1-9-gc4bbfb2+3,w.2019.22
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("getAsDouble", &PropertySet::getAsDouble);
84  cls.def("getAsString", &PropertySet::getAsString);
85  cls.def("getAsPropertySetPtr", &PropertySet::getAsPropertySetPtr);
86  cls.def("getAsPersistablePtr", &PropertySet::getAsPersistablePtr);
87 
88  declareAccessors<bool>(cls, "Bool");
89  declareAccessors<short>(cls, "Short");
90  declareAccessors<int>(cls, "Int");
91  declareAccessors<long>(cls, "Long");
92  declareAccessors<long long>(cls, "LongLong");
93  declareAccessors<float>(cls, "Float");
94  declareAccessors<double>(cls, "Double");
95  declareAccessors<nullptr_t>(cls, "Undef");
96  declareAccessors<std::string>(cls, "String");
97  declareAccessors<DateTime>(cls, "DateTime");
98  declareAccessors<std::shared_ptr<PropertySet>>(cls, "PropertySet");
99 }
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)