MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/openvdb / items

Method items

openvdb/openvdb/python/pyutil.h:106–128  ·  view source on GitHub ↗

Return the (key, value) map as a Python dict.

Source from the content-addressed store, hash-verified

104{
105 /// Return the (key, value) map as a Python dict.
106 static nb::dict items()
107 {
108 static std::mutex sMutex;
109 static nb::dict itemDict;
110 if (!itemDict) {
111 // The first time this function is called, populate
112 // the static dict with (key, value) pairs.
113 std::lock_guard<std::mutex> lock(sMutex);
114 if (!itemDict) {
115 for (int i = 0; ; ++i) {
116 const CStringPair item = Descr::item(i);
117 OPENVDB_START_THREADSAFE_STATIC_WRITE
118 if (item.first) {
119 itemDict[nb::str(*item.first)] =
120 nb::str(*item.second);
121 }
122 OPENVDB_FINISH_THREADSAFE_STATIC_WRITE
123 else break;
124 }
125 }
126 }
127 return itemDict;
128 }
129
130 /// Return the keys as a Python list of strings.
131 static nb::object keys() { return items().attr("keys")(); }

Callers 3

pythonrc.pyFile · 0.80
update_filesFunction · 0.80

Calls 1

strFunction · 0.50

Tested by

no test coverage detected