diff --git a/include/DoocsProcessArray.h b/include/DoocsProcessArray.h index 7b2013a5a3c33e5fff09248ced14c10e45aafeba..bddd9ff52c309d1f493d0c62ee82c66c60cb0ee1 100644 --- a/include/DoocsProcessArray.h +++ b/include/DoocsProcessArray.h @@ -4,7 +4,7 @@ #include <D_spectrum.h> #include <boost/noncopyable.hpp> -#include <ChimeraTK/ControlSystemAdapter/ProcessArray.h> +#include <mtca4u/NDRegisterAccessor.h> #include <ChimeraTK/ControlSystemAdapter/ProcessVariableListener.h> #include <ChimeraTK/ControlSystemAdapter/ControlSystemSynchronizationUtility.h> @@ -40,9 +40,7 @@ namespace ChimeraTK { * The notification that is executed updates of the doocs process variable */ void notify(boost::shared_ptr< ProcessVariable > processVariable) { - // It is safe to static cast because the DoocsArrayListener is inside a - // DoocsProcessArray, which always holds a ProcessArray, never a ProcessScalar - ProcessArray<T> & processArray = static_cast< ProcessArray<T> & >(*processVariable); + auto & processArray = static_cast< mtca4u::NDRegisterAccessor<T> & >(*processVariable); // Brute force implementation. Works for all data types T. // always get a fresh reference @@ -59,7 +57,7 @@ namespace ChimeraTK { }; - boost::shared_ptr< ProcessArray<T> > _processArray; + boost::shared_ptr< mtca4u::NDRegisterAccessor<T> > _processArray; // Internal function which copies the content from the DOOCS container into the // ChimeraTK ProcessArray and calls the send method. Factored out to allow unit testing. @@ -77,7 +75,7 @@ namespace ChimeraTK { public: DoocsProcessArray( EqFct *eqFct, - boost::shared_ptr< typename ChimeraTK::ProcessArray<T> > const &processArray, + boost::shared_ptr< typename mtca4u::NDRegisterAccessor<T> > const &processArray, ControlSystemSynchronizationUtility & syncUtility ) : D_spectrum( splitStringAtFirstSlash(processArray->getName()).second.c_str(), processArray->getNumberOfSamples(), eqFct), diff --git a/include/DoocsProcessScalar.h b/include/DoocsProcessScalar.h index 8579f59cecee3f76e590d69ca810408906ff8cee..e2b1663a4969f5002d986f001d3f31b166cdc3a7 100644 --- a/include/DoocsProcessScalar.h +++ b/include/DoocsProcessScalar.h @@ -2,7 +2,7 @@ #define __DOOCS_PROCESS_SCALAR_H__ #include <string> -#include <ChimeraTK/ControlSystemAdapter/ProcessArray.h> +#include <mtca4u/NDRegisterAccessor.h> #include <ChimeraTK/ControlSystemAdapter/ProcessVariableListener.h> #include <ChimeraTK/ControlSystemAdapter/ControlSystemSynchronizationUtility.h> #include <boost/shared_ptr.hpp> @@ -44,7 +44,7 @@ namespace ChimeraTK { void notify(boost::shared_ptr< ProcessVariable > processVariable) { // It is safe to static cast because the DoocsScalarListener is inside a // DoocsProcessScalar, which always holds the right type - auto data = (static_cast< ProcessArray<T> & >(*processVariable)).accessData(0); + auto data = (static_cast< mtca4u::NDRegisterAccessor<T> & >(*processVariable)).accessData(0); // we must not call set_and_archive if there is no history (otherwise it will be activated), but we have to if it is there. -> Abstraction, please! if (_doocsVariable->get_histPointer()){ _doocsVariable->set_and_archive(data); @@ -58,7 +58,7 @@ namespace ChimeraTK { DOOCS_T * _doocsVariable; }; - boost::shared_ptr<ProcessArray<T>> _processScalar; + boost::shared_ptr<mtca4u::NDRegisterAccessor<T> > _processScalar; private: @@ -69,7 +69,7 @@ namespace ChimeraTK { public: DoocsProcessScalar( EqFct *eqFct, std::string doocsPropertyName, - boost::shared_ptr< typename ChimeraTK::ProcessArray<T> > const &processScalar, + boost::shared_ptr< typename mtca4u::NDRegisterAccessor<T> > const &processScalar, ControlSystemSynchronizationUtility &syncUtility ) : DOOCS_T(eqFct, doocsPropertyName.c_str()), _processScalar(processScalar) { @@ -78,7 +78,7 @@ namespace ChimeraTK { } DoocsProcessScalar( std::string doocsPropertyName, EqFct *eqFct, - boost::shared_ptr< typename ChimeraTK::ProcessArray<T> > const &processScalar, + boost::shared_ptr< typename mtca4u::NDRegisterAccessor<T> > const &processScalar, ControlSystemSynchronizationUtility &syncUtility ) : DOOCS_T(doocsPropertyName.c_str(), eqFct), _processScalar(processScalar) { diff --git a/include/DoocsSpectrum.h b/include/DoocsSpectrum.h index 73520124ebf36372236aafb2256d3b23a09eb69d..36d2fb142263b89b5d9df3375a985615d894d118 100644 --- a/include/DoocsSpectrum.h +++ b/include/DoocsSpectrum.h @@ -4,7 +4,7 @@ #include <D_spectrum.h> #include <boost/noncopyable.hpp> -#include <ChimeraTK/ControlSystemAdapter/ProcessArray.h> +#include <mtca4u/NDRegisterAccessor.h> #include <ChimeraTK/ControlSystemAdapter/ProcessVariableListener.h> #include <ChimeraTK/ControlSystemAdapter/ControlSystemSynchronizationUtility.h> @@ -40,9 +40,7 @@ namespace ChimeraTK { * The notification that is executed updates of the doocs process variable */ void notify(boost::shared_ptr< ProcessVariable > processVariable) { - // It is safe to static cast because the DoocsArrayListener is inside a - // DoocsSpectrum, which always holds a ProcessArray, never a ProcessScalar - ProcessArray<T> & processArray = static_cast< ProcessArray<T> & >(*processVariable); + auto & processArray = static_cast< mtca4u::NDRegisterAccessor<T> & >(*processVariable); // Brute force implementation. Works for all data types T. // always get a fresh reference @@ -59,7 +57,7 @@ namespace ChimeraTK { }; - boost::shared_ptr< ProcessArray<T> > _processArray; + boost::shared_ptr< mtca4u::NDRegisterAccessor<T> > _processArray; // Internal function which copies the content from the DOOCS container into the // ChimeraTK ProcessArray and calls the send method. Factored out to allow unit testing. @@ -77,7 +75,7 @@ namespace ChimeraTK { public: DoocsSpectrum( EqFct *eqFct, std::string const & doocsPropertyName, - boost::shared_ptr< typename ChimeraTK::ProcessArray<T> > const &processArray, + boost::shared_ptr< typename mtca4u::NDRegisterAccessor<T> > const &processArray, ControlSystemSynchronizationUtility & syncUtility ) : D_spectrum( doocsPropertyName.c_str(), processArray->getNumberOfSamples(), eqFct), diff --git a/src/DoocsPVFactory.cc b/src/DoocsPVFactory.cc index 847cee60fa223644f7b5263cc1d5dedad0e21043..146ed2c4d02a9c3bfc2b8779db9bda603083a809 100644 --- a/src/DoocsPVFactory.cc +++ b/src/DoocsPVFactory.cc @@ -20,8 +20,8 @@ namespace ChimeraTK { template<class T, class DOOCS_T> typename boost::shared_ptr<D_fct> DoocsPVFactory::createDoocsProperty(typename ProcessVariable::SharedPtr & processVariable) { // the DoocsProcessArray needs the real ProcessScalar type, not just ProcessVariable - typename ProcessArray<T>::SharedPtr processArray - = boost::dynamic_pointer_cast< ProcessArray<T> >(processVariable); + typename boost::shared_ptr< mtca4u::NDRegisterAccessor<T> > processArray + = boost::dynamic_pointer_cast< mtca4u::NDRegisterAccessor<T> >(processVariable); if (!processArray){ throw std::invalid_argument(std::string("DoocsPVFactory::createDoocsArray : processArray is of the wrong type ") + processVariable->getValueType().name()); @@ -71,8 +71,8 @@ namespace ChimeraTK { boost::shared_ptr<D_fct> DoocsPVFactory::createDoocsProperty<std::string, D_string>( boost::shared_ptr<ProcessVariable> & processVariable) { // the DoocsProcessArray needs the real ProcessScalar type, not just ProcessVariable - boost::shared_ptr<ProcessArray<std::string>> processArray - = boost::dynamic_pointer_cast< ProcessArray<std::string> >(processVariable); + boost::shared_ptr< mtca4u::NDRegisterAccessor<std::string> > processArray + = boost::dynamic_pointer_cast< mtca4u::NDRegisterAccessor<std::string> >(processVariable); if (!processArray){ throw std::invalid_argument(std::string("DoocsPVFactory::createDoocsArray : processArray is of the wrong type ") + processVariable->getValueType().name()); diff --git a/tests/src/testDoocsAdapter.cpp b/tests/src/testDoocsAdapter.cpp index 5988b5db57baec0c66254b46bdcd0a21e1496375..01bb42a74dc68badb4cb43ef6bbd621221060b8a 100644 --- a/tests/src/testDoocsAdapter.cpp +++ b/tests/src/testDoocsAdapter.cpp @@ -7,7 +7,6 @@ #include "emptyServerFunctions.h" #include <ChimeraTK/ControlSystemAdapter/DevicePVManager.h> -#include <ChimeraTK/ControlSystemAdapter/ProcessArray.h> #include <ChimeraTK/ControlSystemAdapter/SynchronizationDirection.h> using namespace boost::unit_test_framework;