203 py::class_<PyArrayAccessor, PyTransferElementBase, std::unique_ptr<PyArrayAccessor, py::nodelete>> arrayacc(
204 m,
"ArrayAccessor", py::buffer_protocol(), py::module_local());
205 arrayacc.def(py::init<>())
208 "Read the data from the device.\n\nIf AccessMode::wait_for_new_data was set, this function will block "
209 "until new data has arrived. Otherwise it still might block for a short time until the data transfer was "
212 "Read the next value, if available in the input buffer.\n\nIf AccessMode::wait_for_new_data was set, this "
213 "function returns immediately and the return value indicated if a new value was available (true) or not "
214 "(false).\n\nIf AccessMode::wait_for_new_data was not set, this function is identical to read(), which "
215 "will still return quickly. Depending on the actual transfer implementation, the backend might need to "
216 "transfer data to obtain the current value before returning. Also this function is not guaranteed to be "
217 "lock free. The return value will be always true in this mode.")
219 "Read the latest value, discarding any other update since the last read if present.\n\nOtherwise this "
220 "function is identical to readNonBlocking(), i.e. it will never wait for new values and it will return "
221 "whether a new value was available if AccessMode::wait_for_new_data is set.")
223 "Write the data to device.\n\nThe return value is true, old data was lost on the write transfer (e.g. due "
224 "to an buffer overflow). In case of an unbuffered write transfer, the return value will always be false.")
226 "Just like write(), but allows the implementation to destroy the content of the user buffer in the "
227 "process.\n\nThis is an optional optimisation, hence there is a default implementation which just calls "
228 "the normal doWriteTransfer(). In any case, the application must expect the user buffer of the "
229 "TransferElement to contain undefined data after calling this function.")
232 "Returns the engineering unit.\n\nIf none was specified, it will default to ' n./ a.'")
235 "Returns the std::type_info for the value type of this transfer element.\n\nThis can be used to determine "
236 "the type at runtime.")
238 "Returns the version number that is associated with the last transfer (i.e. last read or write)")
240 "Check if transfer element is read only, i.e. it is readable but not writeable.")
244 "Obtain unique ID for the actual implementation of this TransferElement.\n\nThis means that e.g. two "
245 "instances of ScalarRegisterAccessor created by the same call to Device::getScalarRegisterAccessor() (e.g. "
246 "by copying the accessor to another using NDRegisterAccessorBridge::replace()) will have the same ID, "
247 "while two instances obtained by to difference calls to Device::getScalarRegisterAccessor() will have a "
248 "different ID even when accessing the very same register.")
250 "Return current validity of the data.\n\nWill always return DataValidity.ok if the backend does not "
254 .def(
"set", &
PyArrayAccessor::set,
"Set the values of the array of UserType.", py::arg(
"newValue"))
256 "Convenience function to set and write new value.\n\nThe given version number. If versionNumber == {}, a "
257 "new version number is generated.",
267 arrayacc.def(fn.c_str(),
270 fn.c_str(), [fn](
PyArrayAccessor& acc, py::object& other) {
return acc.
get().attr(fn.c_str())(other); });
273 arrayacc.def(fn.c_str(), [fn](
PyArrayAccessor& acc) {
return acc.get().attr(fn.c_str())(); });
281 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
282 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
283 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
286 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
287 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
291 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
292 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
293 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
296 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
297 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
305 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
306 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
307 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
310 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
311 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
315 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
316 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
317 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
320 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
321 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
329 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
330 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
331 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
334 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
335 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
339 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
340 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
341 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
344 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
345 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
353 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
354 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
355 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
358 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
359 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
363 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
364 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
365 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
368 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
369 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
377 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
378 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
379 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
382 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
383 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
387 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
388 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
389 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
392 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
393 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
400 "ArrayOutputReverseRecovery",
401 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
402 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
403 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
406 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
407 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
410 "ArrayOutputReverseRecovery",
411 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
412 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
413 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
417 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
418 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
425 "ArrayPushInputNoInitialValue",
426 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
427 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
428 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
431 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
432 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
435 "ArrayPushInputNoInitialValue",
436 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
437 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
438 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
442 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
443 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
450 "ArrayPollInputNoInitialValue",
451 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
452 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
453 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
456 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
457 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
460 "ArrayPollInputNoInitialValue",
461 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
462 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
463 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
467 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
468 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,