Skip to content
Snippets Groups Projects
Commit 440c8450 authored by Martin Christoph Hierholzer's avatar Martin Christoph Hierholzer
Browse files

enforce to set default values correctly when using TestFacility

parent b26544bf
No related branches found
Tags 01.10.00
No related merge requests found
...@@ -42,6 +42,11 @@ namespace ChimeraTK { ...@@ -42,6 +42,11 @@ namespace ChimeraTK {
for(auto& pv : pvManager->getAllProcessVariables()) { for(auto& pv : pvManager->getAllProcessVariables()) {
callForType(pv->getValueType(), [&pv, this](auto arg) { callForType(pv->getValueType(), [&pv, this](auto arg) {
if(!pv->isWriteable()) return; if(!pv->isWriteable()) return;
if(pv->getVersionNumber() != VersionNumber(nullptr)) {
throw ChimeraTK::logic_error("The variable '" + pv->getName() +
"' has been written before TestFacility::runApplication() was called. Instead use "
"TestFacility::setScalarDefault() resp. setArrayDefault() to set initial values.");
}
typedef decltype(arg) T; typedef decltype(arg) T;
auto pv_casted = boost::dynamic_pointer_cast<NDRegisterAccessor<T>>(pv); auto pv_casted = boost::dynamic_pointer_cast<NDRegisterAccessor<T>>(pv);
auto table = boost::fusion::at_key<T>(defaults.table); auto table = boost::fusion::at_key<T>(defaults.table);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment