ChimeraTK-ApplicationCore
04.01.00
|
Helper class to facilitate tests of applications based on ApplicationCore. More...
#include <TestFacility.h>
Public Member Functions | |
TestFacility (Application &app, bool enableTestableMode=true) | |
The passed application will automatically be put into the testable mode and initialised. More... | |
void | runApplication () const |
Start the application in testable mode. More... | |
bool | canStepApplication () const |
Check whether data has been sent to the application so stepApplication() can be called. More... | |
void | stepApplication (bool waitForDeviceInitialisation=true) const |
Perform a "step" of the application. More... | |
ChimeraTK::VoidRegisterAccessor | getVoid (const ChimeraTK::RegisterPath &name) const |
Obtain a void process variable from the application, which is published to the control system. More... | |
template<typename T > | |
ChimeraTK::ScalarRegisterAccessor< T > | getScalar (const ChimeraTK::RegisterPath &name) const |
Obtain a scalar process variable from the application, which is published to the control system. More... | |
template<typename T > | |
ChimeraTK::OneDRegisterAccessor< T > | getArray (const ChimeraTK::RegisterPath &name) const |
Obtain an array-type process variable from the application, which is published to the control system. More... | |
template<typename TYPE > | |
void | writeScalar (const std::string &name, TYPE value) |
Convenience function to write a scalar process variable in a single call. More... | |
template<typename TYPE > | |
void | writeArray (const std::string &name, const std::vector< TYPE > &value) |
Convenience function to write an array process variable in a single call. More... | |
template<typename TYPE > | |
TYPE | readScalar (const std::string &name) |
Convenience function to read the latest value of a scalar process variable in a single call. More... | |
template<typename TYPE > | |
std::vector< TYPE > | readArray (const std::string &name) |
Convenience function to read the latest value of an array process variable in a single call. More... | |
template<typename T > | |
void | setScalarDefault (const ChimeraTK::RegisterPath &name, const T &value) |
Set default value for scalar process variable. More... | |
template<typename T > | |
void | setArrayDefault (const ChimeraTK::RegisterPath &name, const std::vector< T > &value) |
Set default value for array process variable. More... | |
template<typename T > | |
boost::shared_ptr< ChimeraTK::NDRegisterAccessor< T > > | getAccessor (const ChimeraTK::RegisterPath &name) const |
Function to obtain a process variable from the control system. More... | |
boost::shared_ptr< ControlSystemPVManager > | getPvManager () const |
Static Public Member Functions | |
template<typename T > | |
static void | setConfigScalar (const ChimeraTK::RegisterPath &name, const T &value) |
Set ConfigReader scalar variable for the next instantiated Applicaton. More... | |
template<typename T > | |
static void | setConfigArray (const ChimeraTK::RegisterPath &name, const std::vector< T > &value) |
Set ConfigReader array variable for the next instantiated Applicaton. More... | |
Protected Types | |
template<typename UserType > | |
using | AccessorMap = std::map< std::string, boost::shared_ptr< ChimeraTK::NDRegisterAccessor< UserType > >> |
template<typename UserType > | |
using | Defaults = std::map< std::string, std::vector< UserType > > |
template<typename UserType > | |
using | Vector = std::vector< UserType > |
Protected Attributes | |
boost::shared_ptr< ControlSystemPVManager > | _pvManager |
ChimeraTK::TemplateUserTypeMap< AccessorMap > | _accessorMap |
ChimeraTK::TemplateUserTypeMap< Defaults > | _defaults |
Application & | _app |
Static Protected Attributes | |
static std::map< ChimeraTK::RegisterPath, ChimeraTK::UserTypeVariantNoVoid > | _configScalars |
static std::map< ChimeraTK::RegisterPath, ChimeraTK::UserTypeTemplateVariantNoVoid< Vector > > | _configArrays |
Friends | |
class | ConfigReader |
Helper class to facilitate tests of applications based on ApplicationCore.
Definition at line 36 of file TestFacility.h.
|
protected |
Definition at line 129 of file TestFacility.h.
|
protected |
Definition at line 134 of file TestFacility.h.
|
protected |
Definition at line 143 of file TestFacility.h.
|
explicit |
The passed application will automatically be put into the testable mode and initialised.
Definition at line 16 of file TestFacility.cc.
bool ChimeraTK::TestFacility::canStepApplication | ( | ) | const |
Check whether data has been sent to the application so stepApplication() can be called.
Definition at line 107 of file TestFacility.cc.
boost::shared_ptr< ChimeraTK::NDRegisterAccessor< T > > ChimeraTK::TestFacility::getAccessor | ( | const ChimeraTK::RegisterPath & | name | ) | const |
Function to obtain a process variable from the control system.
For conveniently creating arrays and scalars, see getArray, getScalar and getVoid
Definition at line 254 of file TestFacility.h.
ChimeraTK::OneDRegisterAccessor< T > ChimeraTK::TestFacility::getArray | ( | const ChimeraTK::RegisterPath & | name | ) | const |
Obtain an array-type process variable from the application, which is published to the control system.
Definition at line 162 of file TestFacility.h.
|
inline |
Definition at line 107 of file TestFacility.h.
ChimeraTK::ScalarRegisterAccessor< T > ChimeraTK::TestFacility::getScalar | ( | const ChimeraTK::RegisterPath & | name | ) | const |
Obtain a scalar process variable from the application, which is published to the control system.
Definition at line 155 of file TestFacility.h.
ChimeraTK::VoidRegisterAccessor ChimeraTK::TestFacility::getVoid | ( | const ChimeraTK::RegisterPath & | name | ) | const |
Obtain a void process variable from the application, which is published to the control system.
Definition at line 119 of file TestFacility.cc.
std::vector< TYPE > ChimeraTK::TestFacility::readArray | ( | const std::string & | name | ) |
Convenience function to read the latest value of an array process variable in a single call.
Definition at line 202 of file TestFacility.h.
TYPE ChimeraTK::TestFacility::readScalar | ( | const std::string & | name | ) |
Convenience function to read the latest value of a scalar process variable in a single call.
Definition at line 193 of file TestFacility.h.
void ChimeraTK::TestFacility::runApplication | ( | ) | const |
Start the application in testable mode.
Since pv_casted is the undecorated PV (lacking the TestableModeAccessorDecorator), we need to copy the value also to the decorator. We still have to write through the undecorated PV, otherwise the tests are stalled.
Definition at line 28 of file TestFacility.cc.
void ChimeraTK::TestFacility::setArrayDefault | ( | const ChimeraTK::RegisterPath & | name, |
const std::vector< T > & | value | ||
) |
Set default value for array process variable.
Definition at line 223 of file TestFacility.h.
|
static |
Set ConfigReader array variable for the next instantiated Applicaton.
Definition at line 291 of file TestFacility.h.
|
static |
Set ConfigReader scalar variable for the next instantiated Applicaton.
Definition at line 284 of file TestFacility.h.
void ChimeraTK::TestFacility::setScalarDefault | ( | const ChimeraTK::RegisterPath & | name, |
const T & | value | ||
) |
Set default value for scalar process variable.
Definition at line 211 of file TestFacility.h.
void ChimeraTK::TestFacility::stepApplication | ( | bool | waitForDeviceInitialisation = true | ) | const |
Perform a "step" of the application.
This runs the application until all input provided to it has been processed and all application modules wait for new data in blocking read calls. This function returns only after the application has reached that stated and was paused again. After returning from this function, the result can be checked and new data can be provided to the application. The new data will not be processed until the next call to step().
Definition at line 113 of file TestFacility.cc.
void ChimeraTK::TestFacility::writeArray | ( | const std::string & | name, |
const std::vector< TYPE > & | value | ||
) |
Convenience function to write an array process variable in a single call.
Definition at line 178 of file TestFacility.h.
void ChimeraTK::TestFacility::writeScalar | ( | const std::string & | name, |
TYPE | value | ||
) |
Convenience function to write a scalar process variable in a single call.
Definition at line 169 of file TestFacility.h.
|
friend |
Definition at line 148 of file TestFacility.h.
|
mutableprotected |
Definition at line 130 of file TestFacility.h.
|
protected |
Definition at line 137 of file TestFacility.h.
|
staticprotected |
Definition at line 146 of file TestFacility.h.
|
staticprotected |
Definition at line 140 of file TestFacility.h.
|
protected |
Definition at line 135 of file TestFacility.h.
|
protected |
Definition at line 122 of file TestFacility.h.