188 py::class_<PyArrayAccessor, PyTransferElementBase, std::unique_ptr<PyArrayAccessor, py::nodelete>> arrayacc(
189 m,
"ArrayAccessor", py::buffer_protocol(), py::module_local());
190 arrayacc.def(py::init<>())
193 "Read the data from the device.\n\nIf AccessMode::wait_for_new_data was set, this function will block "
194 "until new data has arrived. Otherwise it still might block for a short time until the data transfer was "
197 "Read the next value, if available in the input buffer.\n\nIf AccessMode::wait_for_new_data was set, this "
198 "function returns immediately and the return value indicated if a new value was available (true) or not "
199 "(false).\n\nIf AccessMode::wait_for_new_data was not set, this function is identical to read(), which "
200 "will still return quickly. Depending on the actual transfer implementation, the backend might need to "
201 "transfer data to obtain the current value before returning. Also this function is not guaranteed to be "
202 "lock free. The return value will be always true in this mode.")
204 "Read the latest value, discarding any other update since the last read if present.\n\nOtherwise this "
205 "function is identical to readNonBlocking(), i.e. it will never wait for new values and it will return "
206 "whether a new value was available if AccessMode::wait_for_new_data is set.")
208 "Write the data to device.\n\nThe return value is true, old data was lost on the write transfer (e.g. due "
209 "to an buffer overflow). In case of an unbuffered write transfer, the return value will always be false.")
211 "Just like write(), but allows the implementation to destroy the content of the user buffer in the "
212 "process.\n\nThis is an optional optimisation, hence there is a default implementation which just calls "
213 "the normal doWriteTransfer(). In any case, the application must expect the user buffer of the "
214 "TransferElement to contain undefined data after calling this function.")
217 "Returns the engineering unit.\n\nIf none was specified, it will default to ' n./ a.'")
220 "Returns the std::type_info for the value type of this transfer element.\n\nThis can be used to determine "
221 "the type at runtime.")
223 "Returns the version number that is associated with the last transfer (i.e. last read or write)")
225 "Check if transfer element is read only, i.e. it is readable but not writeable.")
229 "Obtain unique ID for the actual implementation of this TransferElement.\n\nThis means that e.g. two "
230 "instances of ScalarRegisterAccessor created by the same call to Device::getScalarRegisterAccessor() (e.g. "
231 "by copying the accessor to another using NDRegisterAccessorBridge::replace()) will have the same ID, "
232 "while two instances obtained by to difference calls to Device::getScalarRegisterAccessor() will have a "
233 "different ID even when accessing the very same register.")
235 "Return current validity of the data.\n\nWill always return DataValidity.ok if the backend does not "
239 .def(
"set", &
PyArrayAccessor::set,
"Set the values of the array of UserType.", py::arg(
"newValue"))
241 "Convenience function to set and write new value.\n\nThe given version number. If versionNumber == {}, a "
242 "new version number is generated.",
252 arrayacc.def(fn.c_str(),
255 fn.c_str(), [fn](
PyArrayAccessor& acc, py::object& other) {
return acc.
get().attr(fn.c_str())(other); });
258 arrayacc.def(fn.c_str(), [fn](
PyArrayAccessor& acc) {
return acc.get().attr(fn.c_str())(); });
266 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
267 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
268 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
271 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
272 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
276 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
277 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
278 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
281 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
282 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
290 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
291 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
292 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
295 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
296 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
300 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
301 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
302 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
305 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
306 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
314 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
315 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
316 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
319 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
320 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
324 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
325 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
326 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
329 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
330 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
338 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
339 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
340 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
343 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
344 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
348 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
349 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
350 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
353 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
354 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
362 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
363 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
364 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
367 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
368 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
372 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
373 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
374 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
377 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
378 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
385 "ArrayOutputReverseRecovery",
386 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
387 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
388 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
391 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
392 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
395 "ArrayOutputReverseRecovery",
396 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
397 size_t nElements,
const std::string& description,
const std::unordered_set<std::string>& tags) {
398 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyArrayAccessor>(
402 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"nElements"),
403 py::arg(
"description"), py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,