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

TestFacility: throw exception if attempting to set default value after start of application

parent e9d6578e
No related branches found
No related tags found
No related merge requests found
...@@ -229,6 +229,9 @@ namespace ChimeraTK { ...@@ -229,6 +229,9 @@ namespace ChimeraTK {
/** Set default value for scalar process variable. */ /** Set default value for scalar process variable. */
template<typename T> template<typename T>
void setScalarDefault(const ChimeraTK::RegisterPath& name, const T& value) { void setScalarDefault(const ChimeraTK::RegisterPath& name, const T& value) {
if(Application::getInstance().testFacilityRunApplicationCalled) {
throw ChimeraTK::logic_error("TestFacility::setScalarDefault() called after runApplication().");
}
std::vector<T> vv; std::vector<T> vv;
vv.push_back(value); vv.push_back(value);
setArrayDefault(name, vv); setArrayDefault(name, vv);
...@@ -237,6 +240,9 @@ namespace ChimeraTK { ...@@ -237,6 +240,9 @@ namespace ChimeraTK {
/** Set default value for array process variable. */ /** Set default value for array process variable. */
template<typename T> template<typename T>
void setArrayDefault(const ChimeraTK::RegisterPath& name, const std::vector<T>& value) { void setArrayDefault(const ChimeraTK::RegisterPath& name, const std::vector<T>& value) {
if(Application::getInstance().testFacilityRunApplicationCalled) {
throw ChimeraTK::logic_error("TestFacility::setArrayDefault() called after runApplication().");
}
// check if PV exists // check if PV exists
auto pv = pvManager->getProcessArray<T>(name); auto pv = pvManager->getProcessArray<T>(name);
if(pv == nullptr) { if(pv == nullptr) {
......
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