132 py::class_<PyScalarAccessor, PyTransferElementBase, std::unique_ptr<PyScalarAccessor, py::nodelete>> scalaracc(
133 m,
"ScalarAccessor", py::buffer_protocol(), py::module_local());
134 scalaracc.def(py::init<>())
136 "Read the data from the device.\n\nIf AccessMode::wait_for_new_data was set, this function will block "
137 "until new data has arrived. Otherwise it still might block for a short time until the data transfer was "
140 "Read the next value, if available in the input buffer.\n\nIf AccessMode::wait_for_new_data was set, this "
141 "function returns immediately and the return value indicated if a new value was available (true) or not "
142 "(false).\n\nIf AccessMode::wait_for_new_data was not set, this function is identical to read(), which "
143 "will still return quickly. Depending on the actual transfer implementation, the backend might need to "
144 "transfer data to obtain the current value before returning. Also this function is not guaranteed to be "
145 "lock free. The return value will be always true in this mode.")
147 "Read the latest value, discarding any other update since the last read if present.\n\nOtherwise this "
148 "function is identical to readNonBlocking(), i.e. it will never wait for new values and it will return "
149 "whether a new value was available if AccessMode::wait_for_new_data is set.")
152 "Returns the engineering unit.\n\nIf none was specified, it will default to ' n./ a.'")
155 "Returns the std::type_info for the value type of this transfer element.\n\nThis can be used to determine "
156 "the type at runtime.")
158 "Returns the version number that is associated with the last transfer (i.e. last read or write)")
160 "Check if transfer element is read only, i.e. it is readable but not writeable.")
164 "Obtain unique ID for the actual implementation of this TransferElement.\n\nThis means that e.g. two "
165 "instances of ScalarRegisterAccessor created by the same call to Device::getScalarRegisterAccessor() (e.g. "
166 "by copying the accessor to another using NDRegisterAccessorBridge::replace()) will have the same ID, "
167 "while two instances obtained by to difference calls to Device::getScalarRegisterAccessor() will have a "
168 "different ID even when accessing the very same register.")
170 "Return current validity of the data.\n\nWill always return DataValidity.ok if the backend does not "
177 "Write the data to device.\n\nThe return value is true, old data was lost on the write transfer (e.g. due "
178 "to an buffer overflow). In case of an unbuffered write transfer, the return value will always be false.")
180 "Just like write(), but allows the implementation to destroy the content of the user buffer in the "
181 "process.\n\nThis is an optional optimisation, hence there is a default implementation which just calls "
182 "the normal doWriteTransfer(). In any case, the application must expect the user buffer of the "
183 "TransferElement to contain undefined data after calling this function.")
185 "Convenience function to set and write new value if it differes from the current value.\n\nThe given "
186 "version number is only used in case the value differs. If versionNumber == {nullptr}, a new version "
187 "number is generated only if the write actually takes place.",
190 "Convenience function to set and write new value.\n\nThe given version number. If versionNumber == {}, a "
191 "new version number is generated.",
197 return py::cast<py::object>(py::cast(acc).attr(
"get")()).attr(fn.c_str())(py::cast(other).attr(
"get")());
200 return py::cast<py::object>(py::cast(acc).attr(
"get")()).attr(fn.c_str())(other);
205 scalaracc.def(fn.c_str(),
206 [fn](
PyScalarAccessor& acc) {
return py::cast<py::object>(py::cast(acc).attr(
"get")()).attr(fn.c_str())(); });
214 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
215 const std::string& description,
const std::unordered_set<std::string>& tags) {
216 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
219 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
220 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
223 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
224 const std::string& description,
const std::unordered_set<std::string>& tags) {
225 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
228 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
229 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
236 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
237 const std::string& description,
const std::unordered_set<std::string>& tags) {
238 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
241 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
242 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
245 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
246 const std::string& description,
const std::unordered_set<std::string>& tags) {
247 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
250 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
251 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
258 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
259 const std::string& description,
const std::unordered_set<std::string>& tags) {
260 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
263 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
264 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
267 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
268 const std::string& description,
const std::unordered_set<std::string>& tags) {
269 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
272 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
273 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
280 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
281 const std::string& description,
const std::unordered_set<std::string>& tags) {
282 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
285 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
286 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
289 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
290 const std::string& description,
const std::unordered_set<std::string>& tags) {
291 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
294 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
295 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
301 "ScalarOutputPushRB",
302 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
303 const std::string& description,
const std::unordered_set<std::string>& tags) {
304 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
307 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
308 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
310 "ScalarOutputPushRB",
311 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
312 const std::string& description,
const std::unordered_set<std::string>& tags) {
313 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
316 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
317 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
323 "ScalarOutputReverseRecovery",
324 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
325 const std::string& description,
const std::unordered_set<std::string>& tags) {
326 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
329 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
330 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
332 "ScalarOutputReverseRecovery",
333 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
334 const std::string& description,
const std::unordered_set<std::string>& tags) {
335 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
338 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
339 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
345 "ScalarPushInputNoInitialValue",
346 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
347 const std::string& description,
const std::unordered_set<std::string>& tags) {
348 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
351 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
352 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
354 "ScalarPushInputNoInitialValue",
355 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
356 const std::string& description,
const std::unordered_set<std::string>& tags) {
357 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
360 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
361 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
367 "ScalarPollInputNoInitialValue",
368 [](ChimeraTK::DataType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
369 const std::string& description,
const std::unordered_set<std::string>& tags) {
370 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
373 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
374 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");
376 "ScalarPollInputNoInitialValue",
377 [](ChimeraTK::DataType::TheType type,
VariableGroup& owner,
const std::string& name,
const std::string& unit,
378 const std::string& description,
const std::unordered_set<std::string>& tags) {
379 return dynamic_cast<PyOwningObject&
>(owner).make_child<PyScalarAccessor>(
382 py::arg(
"type"), py::arg(
"owner"), py::arg(
"name"), py::arg(
"unit"), py::arg(
"description"),
383 py::arg(
"tags") = std::unordered_set<std::string>{}, py::return_value_policy::reference,
"");