187 py::class_<PyArrayAccessor, PyTransferElementBase, std::unique_ptr<PyArrayAccessor, py::nodelete>> arrayacc(
188 m,
"ArrayAccessor", py::buffer_protocol(), py::module_local());
189 arrayacc.def(py::init<>())
192 "Read the data from the device.\n\nIf AccessMode::wait_for_new_data was set, this function will block "
193 "until new data has arrived. Otherwise it still might block for a short time until the data transfer was "
196 "Read the next value, if available in the input buffer.\n\nIf AccessMode::wait_for_new_data was set, this "
197 "function returns immediately and the return value indicated if a new value was available (true) or not "
198 "(false).\n\nIf AccessMode::wait_for_new_data was not set, this function is identical to read(), which "
199 "will still return quickly. Depending on the actual transfer implementation, the backend might need to "
200 "transfer data to obtain the current value before returning. Also this function is not guaranteed to be "
201 "lock free. The return value will be always true in this mode.")
203 "Read the latest value, discarding any other update since the last read if present.\n\nOtherwise this "
204 "function is identical to readNonBlocking(), i.e. it will never wait for new values and it will return "
205 "whether a new value was available if AccessMode::wait_for_new_data is set.")
207 "Write the data to device.\n\nThe return value is true, old data was lost on the write transfer (e.g. due "
208 "to an buffer overflow). In case of an unbuffered write transfer, the return value will always be false.")
210 "Just like write(), but allows the implementation to destroy the content of the user buffer in the "
211 "process.\n\nThis is an optional optimisation, hence there is a default implementation which just calls "
212 "the normal doWriteTransfer(). In any case, the application must expect the user buffer of the "
213 "TransferElement to contain undefined data after calling this function.")
216 "Returns the engineering unit.\n\nIf none was specified, it will default to ' n./ a.'")
219 "Returns the std::type_info for the value type of this transfer element.\n\nThis can be used to determine "
220 "the type at runtime.")
222 "Returns the version number that is associated with the last transfer (i.e. last read or write)")
224 "Check if transfer element is read only, i.e. it is readable but not writeable.")
228 "Obtain unique ID for the actual implementation of this TransferElement.\n\nThis means that e.g. two "
229 "instances of ScalarRegisterAccessor created by the same call to Device::getScalarRegisterAccessor() (e.g. "
230 "by copying the accessor to another using NDRegisterAccessorBridge::replace()) will have the same ID, "
231 "while two instances obtained by to difference calls to Device::getScalarRegisterAccessor() will have a "
232 "different ID even when accessing the very same register.")
234 "Return current validity of the data.\n\nWill always return DataValidity.ok if the backend does not "
238 .def(
"set", &
PyArrayAccessor::set,
"Set the values of the array of UserType.", py::arg(
"newValue"))
240 "Convenience function to set and write new value.\n\nThe given version number. If versionNumber == {}, a "
241 "new version number is generated.",
251 arrayacc.def(fn.c_str(),
254 fn.c_str(), [fn](
PyArrayAccessor& acc, py::object& other) {
return acc.
get().attr(fn.c_str())(other); });
257 arrayacc.def(fn.c_str(), [fn](
PyArrayAccessor& acc) {
return acc.get().attr(fn.c_str())(); });
265 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
266 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
267 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
270 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
271 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
275 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
276 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
277 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
280 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
281 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
289 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
290 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
291 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
294 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
295 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
299 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
300 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
301 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
304 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
305 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
313 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
314 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
315 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
318 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
319 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
323 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
324 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
325 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
328 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
329 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
337 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
338 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
339 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
342 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
343 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
347 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
348 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
349 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
352 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
353 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
361 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
362 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
363 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
366 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
367 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
371 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
372 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
373 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
376 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
377 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
384 "ArrayOutputReverseRecovery",
385 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
386 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
387 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
390 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
391 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
394 "ArrayOutputReverseRecovery",
395 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
396 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
397 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
401 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
402 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
409 "ArrayPushInputNoInitialValue",
410 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
411 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
412 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
415 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
416 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
419 "ArrayPushInputNoInitialValue",
420 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
421 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
422 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
426 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
427 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
434 "ArrayPollInputNoInitialValue",
435 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
436 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
437 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
440 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
441 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
444 "ArrayPollInputNoInitialValue",
445 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
446 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
447 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
451 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
452 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,