diff --git a/pom.xml b/pom.xml index c38a23a8a5638760071cce5017a7fa939d113d24..56a839d93bb11f0112fb7b79d77575e22768f6cc 100755 --- a/pom.xml +++ b/pom.xml @@ -1,78 +1,78 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>fr.soleil</groupId> - <artifactId>super-pom-C-CPP-device</artifactId> - <version>RELEASE</version> - </parent> - - <groupId>fr.soleil.device</groupId> - <artifactId>PulseCounting-${aol}-${mode}</artifactId> - <version>2.1.5</version> - - <packaging>nar</packaging> - <name>PulseCounting</name> - <description>PulseCounting device</description> - - <build> - <plugins> - <plugin> - <groupId>org.freehep</groupId> - <artifactId>freehep-nar-plugin</artifactId> - <configuration> - <os>Windows</os> - <cpp> - <defines> - <define>USE_NX_DS_FINALIZER</define> - <define>USE_CALLBACK</define> - <define>PROJECT_NAME=${project.name}</define> - <define>PROJECT_VERSION=${project.version}</define> - </defines> - </cpp> - </configuration> - </plugin> - </plugins> - </build> - <dependencies> - <dependency> - <groupId>com.ni</groupId> - <artifactId>NIDAQmx-${aol}-shared-${mode}</artifactId> - <version>8.7.1</version> - </dependency> - <dependency> - <groupId>fr.soleil.lib</groupId> - <artifactId>NI660Xsl-${aol}-${library}-${mode}</artifactId> - </dependency> - <dependency> - <groupId>fr.soleil.lib</groupId> - <artifactId>YAT4Tango-${aol}-${library}-${mode}</artifactId> - </dependency> - <dependency> - <groupId>fr.soleil.lib</groupId> - <artifactId>YAT-${aol}-${library}-${mode}</artifactId> - </dependency> - <dependency> - <groupId>fr.soleil.lib</groupId> - <artifactId>NexusCPP-${aol}-${library}-${mode}</artifactId> - </dependency> - </dependencies> - <scm> - <connection>${scm.connection.svn.tango-ds}/DeviceClasses/CounterTimer/NI/PulseCounting/trunk</connection> - <developerConnection>${scm.connection.svn.tango-ds}/DeviceClasses/CounterTimer/NI/PulseCounting/trunk</developerConnection> - <url>${scm.connection.svn.tango-ds}/DeviceClasses/CounterTimer/NI/PulseCounting/trunk</url> - </scm> - <developers> - <developer> - <id>gara</id> - <name>gara</name> - <url>http://controle/</url> - <organization>Synchrotron Soleil</organization> - <organizationUrl>http://www.synchrotron-soleil.fr</organizationUrl> - <roles> - <role>developer</role> - </roles> - <timezone>1</timezone> - </developer> - </developers> -</project> \ No newline at end of file +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>fr.soleil</groupId> + <artifactId>super-pom-C-CPP-device</artifactId> + <version>RELEASE</version> + </parent> + + <groupId>fr.soleil.device</groupId> + <artifactId>PulseCounting-${aol}-${mode}</artifactId> + <version>2.1.5</version> + + <packaging>nar</packaging> + <name>PulseCounting</name> + <description>PulseCounting device</description> + + <build> + <plugins> + <plugin> + <groupId>org.freehep</groupId> + <artifactId>freehep-nar-plugin</artifactId> + <configuration> + <os>Windows</os> + <cpp> + <defines> + <define>USE_NX_DS_FINALIZER</define> + <define>USE_CALLBACK</define> + <define>PROJECT_NAME=${project.name}</define> + <define>PROJECT_VERSION=${project.version}</define> + </defines> + </cpp> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>com.ni</groupId> + <artifactId>NIDAQmx-${aol}-shared-${mode}</artifactId> + <version>8.7.1</version> + </dependency> + <dependency> + <groupId>fr.soleil.lib</groupId> + <artifactId>NI660Xsl-${aol}-${library}-${mode}</artifactId> + </dependency> + <dependency> + <groupId>fr.soleil.lib</groupId> + <artifactId>YAT4Tango-${aol}-${library}-${mode}</artifactId> + </dependency> + <dependency> + <groupId>fr.soleil.lib</groupId> + <artifactId>YAT-${aol}-${library}-${mode}</artifactId> + </dependency> + <dependency> + <groupId>fr.soleil.lib</groupId> + <artifactId>NexusCPP-${aol}-${library}-${mode}</artifactId> + </dependency> + </dependencies> + <scm> + <connection>${scm.connection.svn.tango-ds}/DeviceClasses/CounterTimer/NI/PulseCounting/trunk</connection> + <developerConnection>${scm.connection.svn.tango-ds}/DeviceClasses/CounterTimer/NI/PulseCounting/trunk</developerConnection> + <url>${scm.connection.svn.tango-ds}/DeviceClasses/CounterTimer/NI/PulseCounting/trunk</url> + </scm> + <developers> + <developer> + <id>gara</id> + <name>gara</name> + <url>http://controle/</url> + <organization>Synchrotron Soleil</organization> + <organizationUrl>http://www.synchrotron-soleil.fr</organizationUrl> + <roles> + <role>developer</role> + </roles> + <timezone>1</timezone> + </developer> + </developers> +</project> diff --git a/src/BufferedCounterDt.cpp b/src/BufferedCounterDt.cpp old mode 100644 new mode 100755 index 8dc470b4d5654d45643f75469837cf9d436e5b08..5f7bd120c92473c7bc0444c02054cee542a295cd --- a/src/BufferedCounterDt.cpp +++ b/src/BufferedCounterDt.cpp @@ -22,11 +22,11 @@ namespace PulseCounting_ns BufferedCounterDt::BufferedCounterDt (BCEconfig p_conf, NexusManager * storage) : yat4tango::TangoLogAdapter(p_conf.hostDevice) { - this->m_bufferNbToReceive = 0; - this->m_currentBufferNb = 0; - this->m_firstPtReceivedBuff = 0; - this->m_acquisitionDone = true; - this->m_dataBuffer_thread = NULL; + m_bufferNbToReceive = 0; + m_currentBufferNb = 0; + m_firstPtReceivedBuff = 0; + m_acquisitionDone = true; + m_dataBuffer_thread = NULL; m_cntOverrun = false; m_cntTimedout = false; m_storageError = false; @@ -47,40 +47,39 @@ BufferedCounterDt::~BufferedCounterDt () // BufferedCounterDt::updateScaledBuffer // ============================================================================ void BufferedCounterDt::updateScaledBuffer() - throw(Tango::DevFailed) { // Delete "buffer recover" thread if exists and if data recovery is over - if (this->m_dataBuffer_thread) + if (m_dataBuffer_thread) { - if (this->m_dataBuffer_thread->updateDone()) + if (m_dataBuffer_thread->updateDone()) { yat::Thread::IOArg ioa; - this->m_dataBuffer_thread->exit(); - this->m_dataBuffer_thread->join(&ioa); + m_dataBuffer_thread->exit(); + m_dataBuffer_thread->join(&ioa); //std::cout << "BufferedCounterDt::updateScaledBuffer - BR thread exited for counter " - // << this->m_cfg.cnt.number << std::endl; - this->m_dataBuffer_thread = NULL; + // << m_cfg.cnt.number << std::endl; + m_dataBuffer_thread = NULL; } } // Task the buffer reception if acquisition is on & if previous buffer recovery is over - if ((!this->m_acquisitionDone) && - (this->m_dataBuffer_thread == NULL)) + if ((!m_acquisitionDone) && + (m_dataBuffer_thread == NULL)) { - this->m_dataBuffer_thread = new BRDThread(m_cfg.hostDevice, static_cast<yat::Thread::IOArg>(this)); + m_dataBuffer_thread = new BRDThread(m_cfg.hostDevice, static_cast<yat::Thread::IOArg>(this)); DEBUG_STREAM << "BufferedCounterDt Thread created ..." << endl; - if (this->m_dataBuffer_thread == NULL) + if (m_dataBuffer_thread == NULL) { ERROR_STREAM << "Buffer recovery cannot be tasked for counter " - << this->m_cfg.cnt.number << std::endl; + << m_cfg.cnt.number << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start buffer recover task!"), - _CPTC("BufferedCounterDt::updateScaledBuffer")); + "DEVICE_ERROR", + "Failed to start buffer recover task!", + "BufferedCounterDt::updateScaledBuffer"); } //std::cout << "BufferedCounterDt::updateScaledBuffer - starting Buffer recovery thread for counter " - // << this->m_cfg.cnt.number << std::endl; - this->m_dataBuffer_thread->start_undetached(); + // << m_cfg.cnt.number << std::endl; + m_dataBuffer_thread->start_undetached(); } } @@ -91,7 +90,7 @@ void BufferedCounterDt::getScaledBuffer() { // call "get scaled buffer" to compose the whole buffer. // In "polling" mode, the client has to poll to compose the acquisition buffer. - if (!this->m_acquisitionDone) + if (!m_acquisitionDone) { DEBUG_STREAM << "BufferedCounterDt::getScaledBuffer entering..." << endl; //- from NI660Xsl - calls ni660Xsl::handle_xxx methods @@ -110,27 +109,24 @@ void BufferedCounterDt::getScaledBuffer() // BufferedCounterDt::handle_timeout () // ============================================================================ void BufferedCounterDt::handle_timeout() - throw (Tango::DevFailed) { ERROR_STREAM << "BufferedCounterDt::handle_timeout() entering..." << endl; - this->m_cntTimedout = true; + m_cntTimedout = true; } // ============================================================================ // BufferedCounterDt::handle_data_lost () // ============================================================================ void BufferedCounterDt::handle_data_lost() - throw (Tango::DevFailed) { ERROR_STREAM << "BufferedCounterDt::handle_data_lost() entering..." << endl; - this->m_cntOverrun = true; + m_cntOverrun = true; } // ============================================================================ // BufferedCounterDt::handle_raw_buffer () // ============================================================================ void BufferedCounterDt::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed) { //- DT values are not raw !!! delete buffer; @@ -140,7 +136,6 @@ void BufferedCounterDt::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _ // BufferedCounterDt::handle_scaled_buffer () // ============================================================================ void BufferedCounterDt::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed) { DEBUG_STREAM << "BufferedCounterDt::handle_scaled_buffer() entering..." << std::endl; DEBUG_STREAM << "BufferedCounterDt::handle_scaled_buffer() - samples to read = " << _samples_read << std::endl; @@ -149,17 +144,17 @@ void BufferedCounterDt::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, l if (_samples_read <= 0) { ERROR_STREAM << "BufferedCounterDt::handle_scaled_buffer-> samples to read negative or null value!" << std::endl; - this->stopCnt(); + stopCnt(); return; } - yat::AutoMutex<> guard(this->m_buffLock); + yat::AutoMutex<> guard(m_buffLock); ni660Xsl::InScaledBuffer& buf = *buffer; - RawData_t & data = this->m_data; - bool data_to_be_stored = (this->m_cfg.acq.nexusFileGeneration && this->m_cfg.cnt.nexus); + RawData_t & data = m_data; + bool data_to_be_stored = (m_cfg.acq.nexusFileGeneration && m_cfg.cnt.nexus); //- Continuous acquisition: only one buffer is received !! - if (this->m_cfg.acq.continuousAcquisition) + if (m_cfg.acq.continuousAcquisition) { DEBUG_STREAM << "continuous acquisition: nb buffer to receive = 1!" << std::endl; @@ -169,32 +164,32 @@ void BufferedCounterDt::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, l } // store received buffer in Nexus, if nx storage enabled - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &data[0], (unsigned long)_samples_read); + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &data[0], (unsigned long)_samples_read); } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterDt::handle_raw_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterDt::handle_raw_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } // stop acquisition - this->stopCnt(); + stopCnt(); } - else if (this->m_bufferNbToReceive == 0) //- infinite mode + else if (m_bufferNbToReceive == 0) //- infinite mode { DEBUG_STREAM << "one buffer received." << std::endl; @@ -208,39 +203,39 @@ void BufferedCounterDt::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, l } // store received buffer in Nexus, if nx storage enabled for this counter - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &data[0], nb_to_copy); + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &data[0], nb_to_copy); } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterDt::handle_raw_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterDt::handle_raw_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } } else //- not continuous nor infinite { //- All buffers have not been yet received - if (this->m_currentBufferNb < this->m_bufferNbToReceive) + if (m_currentBufferNb < m_bufferNbToReceive) { - DEBUG_STREAM << "buffer currently received = " << this->m_currentBufferNb + 1 << " on " << this->m_bufferNbToReceive << std::endl; + DEBUG_STREAM << "buffer currently received = " << m_currentBufferNb + 1 << " on " << m_bufferNbToReceive << std::endl; unsigned long nb_to_copy; - if (((unsigned long)this->m_cfg.acq.samplesNumber - this->m_firstPtReceivedBuff) < (unsigned long)_samples_read) + if (((unsigned long)m_cfg.acq.samplesNumber - m_firstPtReceivedBuff) < (unsigned long)_samples_read) { - nb_to_copy = (unsigned long)this->m_cfg.acq.samplesNumber - this->m_firstPtReceivedBuff; + nb_to_copy = (unsigned long)m_cfg.acq.samplesNumber - m_firstPtReceivedBuff; } else { @@ -262,49 +257,49 @@ void BufferedCounterDt::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, l for (unsigned long idx = 1; idx < nb_to_copy; idx++ ) { - data[idx + this->m_firstPtReceivedBuff] = (data_t)(buf[idx]); + data[idx + m_firstPtReceivedBuff] = (data_t)(buf[idx]); if (data_to_be_stored) - bufNx[idx] = data[idx + this->m_firstPtReceivedBuff]; + bufNx[idx] = data[idx + m_firstPtReceivedBuff]; } //- at start, m_firstPtReceivedBuff equals 0. //- m_firstPtReceivedBuff is the position of the 1st point of the buffer - data[this->m_firstPtReceivedBuff] = (data_t)(buf[0]); + data[m_firstPtReceivedBuff] = (data_t)(buf[0]); if (data_to_be_stored) - bufNx[0] = data[this->m_firstPtReceivedBuff]; + bufNx[0] = data[m_firstPtReceivedBuff]; - this->m_currentBufferNb++; - this->m_firstPtReceivedBuff += nb_to_copy; + m_currentBufferNb++; + m_firstPtReceivedBuff += nb_to_copy; // store received buffer in Nexus, if nx storage enabled for this counter - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterDt::handle_raw_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterDt::handle_raw_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } } // if all requested buffers are received - if (this->m_currentBufferNb == this->m_bufferNbToReceive) + if (m_currentBufferNb == m_bufferNbToReceive) { // stop acquisition - this->stopCnt(); + stopCnt(); } } @@ -315,55 +310,54 @@ void BufferedCounterDt::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, l // BufferedCounterDt::startCnt // ============================================================================ void BufferedCounterDt::startCnt() - throw (Tango::DevFailed) { DEBUG_STREAM << "BufferedCounterDt::startCnt() entering..." << endl; - this->m_cntOverrun = false; - this->m_cntTimedout = false; - this->m_storageError = false; + m_cntOverrun = false; + m_cntTimedout = false; + m_storageError = false; { - yat::AutoMutex<> guard(this->m_buffLock); + yat::AutoMutex<> guard(m_buffLock); // reset current counters & buffers - this->m_currentBufferNb = 0; - this->m_firstPtReceivedBuff = 0; - this->m_acquisitionDone = false; + m_currentBufferNb = 0; + m_firstPtReceivedBuff = 0; + m_acquisitionDone = false; // check if infinite mode - if (this->m_cfg.acq.samplesNumber == 0) + if (m_cfg.acq.samplesNumber == 0) { // set data length & capacity to buffer depth - this->m_data.capacity(this->m_cfg.acq.bufferDepth); - this->m_data.force_length(this->m_cfg.acq.bufferDepth); + m_data.capacity(m_cfg.acq.bufferDepth); + m_data.force_length(m_cfg.acq.bufferDepth); } else { // check if continuous mode - if (this->m_cfg.acq.continuousAcquisition) + if (m_cfg.acq.continuousAcquisition) { // set data length & capacity to samples nber - this->m_data.capacity(this->m_cfg.acq.samplesNumber); - this->m_data.force_length(this->m_cfg.acq.samplesNumber); + m_data.capacity(m_cfg.acq.samplesNumber); + m_data.force_length(m_cfg.acq.samplesNumber); } else { // set data capacity & length to 0 - this->m_data.capacity(0); - this->m_data.force_length(0); + m_data.capacity(0); + m_data.force_length(0); } } - this->m_data.fill(yat::IEEE_NAN); + m_data.fill(yat::IEEE_NAN); unsigned long buffer_depth_nbpts = 0; - if (this->m_cfg.acq.continuousAcquisition) + if (m_cfg.acq.continuousAcquisition) { - buffer_depth_nbpts = this->m_cfg.acq.samplesNumber; + buffer_depth_nbpts = m_cfg.acq.samplesNumber; } else { - buffer_depth_nbpts = static_cast<unsigned long>(this->m_cfg.acq.bufferDepth); + buffer_depth_nbpts = static_cast<unsigned long>(m_cfg.acq.bufferDepth); } m_bufferNbToReceive = (m_cfg.acq.samplesNumber + buffer_depth_nbpts - 1) / buffer_depth_nbpts; DEBUG_STREAM << "Buffer to receive : " << m_bufferNbToReceive << endl; @@ -381,7 +375,7 @@ void BufferedCounterDt::startCnt() #if !defined (USE_CALLBACK) // start the data buffer waiting task for the 1st time - this->updateScaledBuffer(); + updateScaledBuffer(); #endif } @@ -389,35 +383,35 @@ void BufferedCounterDt::startCnt() // BufferedCounterDt::stopCnt // ============================================================================ void BufferedCounterDt::stopCnt() - throw (Tango::DevFailed) { DEBUG_STREAM << "BufferedCounterDt::stopCnt() entering..." << endl; - this->m_acquisitionDone = true; + m_acquisitionDone = true; - try - { - //- from NI660Xsl - // we use abort to stop counting immediately - // sets an UNKNOWN state in NI660Xsl lib ! - ni660Xsl::BufferedDTMeasurement::abort_and_release(); - } - catch(ni660Xsl::DAQException & nie) - { - if (nie.errors[0].code > 0) - { - WARN_STREAM << "BufferedCounterDt::stopCnt() - Trying to abort during buffer acquisition, retry once..." << std::endl; - ni660Xsl::BufferedDTMeasurement::abort_and_release(); - } - else - { - // DAQmx 9.x abort pb workaround - WARN_STREAM << "BufferedCounterDt::stopCnt() - Aborting counter generates exception, do nothing..." << std::endl; - } - } - catch(...) + try + { + //- from NI660Xsl + // we use abort to stop counting immediately + // sets an UNKNOWN state in NI660Xsl lib ! + ni660Xsl::BufferedDTMeasurement::abort_and_release(); + } + catch(ni660Xsl::DAQException & nie) + { + if (nie.errors[0].code > 0) + { + WARN_STREAM << "BufferedCounterDt::stopCnt() - Trying to abort during buffer acquisition, retry once..." << std::endl; + ni660Xsl::BufferedDTMeasurement::abort_and_release(); + } + else + { + // Bug in DAQmx 9.x: Aborting counter generates exception + // An effective workaround is to catch and clear the error + } + } + catch(...) { - // DAQmx 9.x abort pb workaround - WARN_STREAM << "BufferedCounterDt::stopCnt() - Aborting counter generates exception, do nothing..." << std::endl; + // One more time: + // Bug in DAQmx 9.x: Aborting counter generates exception + // An effective workaround is to catch and clear the error } } @@ -426,8 +420,8 @@ void BufferedCounterDt::stopCnt() // ============================================================================ RawData_t & BufferedCounterDt::get_value() { - yat::AutoMutex<> guard(this->m_buffLock); - return this->m_data; + yat::AutoMutex<> guard(m_buffLock); + return m_data; } // ============================================================================ @@ -505,7 +499,7 @@ yat::Thread::IOArg BRDThread::run_undetached (yat::Thread::IOArg ioa) // ============================================================================ void BRDThread::exit (void) { - this->m_goOn = false; + m_goOn = false; } } // namespace PulseCounting_ns diff --git a/src/BufferedCounterDt.h b/src/BufferedCounterDt.h old mode 100644 new mode 100755 index 9dda787b89b439c332dab5147da55dd3c526b89d..c3638052eeb49a0d684fa4907f572c13ade30098 --- a/src/BufferedCounterDt.h +++ b/src/BufferedCounterDt.h @@ -83,30 +83,23 @@ public: // called after wait task ends in "polling" mode. //- handle timeout - void handle_timeout() - throw (Tango::DevFailed); + void handle_timeout(); //- handle data lost - void handle_data_lost() - throw (Tango::DevFailed); + void handle_data_lost(); //- handle raw buffer - void handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed); + void handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read); //- handle scaled buffer - void handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed); - + void handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read); //********** local members **************** // start counter - void startCnt() - throw (Tango::DevFailed); + void startCnt(); // stop counter - void stopCnt() - throw (Tango::DevFailed); + void stopCnt(); //- set local value void set_value(); @@ -117,43 +110,40 @@ public: // Acquisition done info bool isAcquisitionDone() { - yat::AutoMutex<> guard(this->m_buffLock); - return this->m_acquisitionDone; + yat::AutoMutex<> guard(m_buffLock); + return m_acquisitionDone; } // updates scaled buffer <=> starts waiting task if not already running // (used in "polling" mode) - void updateScaledBuffer() - throw(Tango::DevFailed); + void updateScaledBuffer(); // updates last scaled buffer <=> force buffer reading // (used with trigger listener option) - void updateLastScaledBuffer() - throw(Tango::DevFailed); + void updateLastScaledBuffer(); // gets scaled buffer <=> calls the driver waiting task (used in "polling" mode) void getScaledBuffer(); //- release counter - void deleteObject() - throw (Tango::DevFailed); + void deleteObject(); // is counter in overrun ? bool isOverrun() { - return this->m_cntOverrun; + return m_cntOverrun; } // has counter timed out ? bool isTimedout() { - return this->m_cntTimedout; + return m_cntTimedout; } // has counter stopped on storage error? bool isStorageKO() { - return this->m_storageError; + return m_storageError; } protected: diff --git a/src/BufferedCounterEvt.cpp b/src/BufferedCounterEvt.cpp old mode 100644 new mode 100755 index 38977ed3f5fcdcd71a96d45a3166caed948dd549..32d172281e7f77079741d7b946ad79925780090c --- a/src/BufferedCounterEvt.cpp +++ b/src/BufferedCounterEvt.cpp @@ -22,12 +22,12 @@ namespace PulseCounting_ns BufferedCounterEvt::BufferedCounterEvt (BCEconfig p_conf, NexusManager * storage) : yat4tango::TangoLogAdapter(p_conf.hostDevice) { - this->m_bufferNbToReceive = 0; - this->m_currentBufferNb = 0; - this->m_firstPtReceivedBuff = 0; - this->m_lastReceivedValue = 0.0; - this->m_acquisitionDone = true; - this->m_dataBuffer_thread = NULL; + m_bufferNbToReceive = 0; + m_currentBufferNb = 0; + m_firstPtReceivedBuff = 0; + m_lastReceivedValue = 0.0; + m_acquisitionDone = true; + m_dataBuffer_thread = NULL; m_cntOverrun = false; m_cntTimedout = false; m_storageError = false; @@ -48,40 +48,39 @@ BufferedCounterEvt::~BufferedCounterEvt () // BufferedCounterEvt::updateRawBuffer // ============================================================================ void BufferedCounterEvt::updateRawBuffer() - throw(Tango::DevFailed) { // Delete "buffer recover" thread if exists and if data recovery is over - if (this->m_dataBuffer_thread) + if (m_dataBuffer_thread) { - if (this->m_dataBuffer_thread->updateDone()) + if (m_dataBuffer_thread->updateDone()) { yat::Thread::IOArg ioa; - this->m_dataBuffer_thread->exit(); - this->m_dataBuffer_thread->join(&ioa); + m_dataBuffer_thread->exit(); + m_dataBuffer_thread->join(&ioa); //std::cout << "BufferedCounterEvt::updateRawBuffer - BR thread exited for counter " - // << this->m_cfg.cnt.number << std::endl; - this->m_dataBuffer_thread = NULL; + // << m_cfg.cnt.number << std::endl; + m_dataBuffer_thread = NULL; } } // Task the buffer reception if acquisition is on & if previous buffer recovery is over - if ((!this->m_acquisitionDone) && - (this->m_dataBuffer_thread == NULL)) + if ((!m_acquisitionDone) && + (m_dataBuffer_thread == NULL)) { - this->m_dataBuffer_thread = new BREThread(m_cfg.hostDevice, static_cast<yat::Thread::IOArg>(this)); + m_dataBuffer_thread = new BREThread(m_cfg.hostDevice, static_cast<yat::Thread::IOArg>(this)); DEBUG_STREAM << "BufferedCounterEvt Thread created ..." << endl; - if (this->m_dataBuffer_thread == NULL) + if (m_dataBuffer_thread == NULL) { ERROR_STREAM << "Buffer recovery cannot be tasked for counter " - << this->m_cfg.cnt.number << std::endl; + << m_cfg.cnt.number << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start buffer recover task!"), - _CPTC("BufferedCounterEvt::updateRawBuffer")); + "DEVICE_ERROR", + "Failed to start buffer recover task!", + "BufferedCounterEvt::updateRawBuffer"); } //std::cout << "BufferedCounterEvt::updateRawBuffer - starting Buffer recovery thread for counter " - // << this->m_cfg.cnt.number << std::endl; - this->m_dataBuffer_thread->start_undetached(); + // << m_cfg.cnt.number << std::endl; + m_dataBuffer_thread->start_undetached(); } } @@ -92,7 +91,7 @@ void BufferedCounterEvt::getRawBuffer() { // call "get raw buffer" to compose the whole buffer. // In "polling" mode, the client has to poll to compose the acquisition buffer. - if (!this->m_acquisitionDone) + if (!m_acquisitionDone) { DEBUG_STREAM << "BufferedCounterEvt::GetRawBuffer entering..." << endl; //- from NI660Xsl - calls ni660Xsl::handle_xxx methods @@ -111,47 +110,44 @@ void BufferedCounterEvt::getRawBuffer() // BufferedCounterEvt::handle_timeout () // ============================================================================ void BufferedCounterEvt::handle_timeout() - throw (Tango::DevFailed) { ERROR_STREAM << "BufferedCounterEvt::handle_timeout() entering..." << endl; - this->m_cntTimedout = true; + m_cntTimedout = true; } // ============================================================================ // BufferedCounterEvt::handle_data_lost () // ============================================================================ void BufferedCounterEvt::handle_data_lost() - throw (Tango::DevFailed) { ERROR_STREAM << "BufferedCounterEvt::handle_data_lost() entering..." << endl; - this->m_cntOverrun = true; + m_cntOverrun = true; } // ============================================================================ // BufferedCounterEvt::handle_raw_buffer () // ============================================================================ void BufferedCounterEvt::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed) { - DEBUG_STREAM << "BufferedCounterEvt::handle_raw_buffer() entering for counter: " << this->m_cfg.cnt.name << " ... " + DEBUG_STREAM << "BufferedCounterEvt::handle_raw_buffer() entering for counter: " << m_cfg.cnt.name << " ... " << " - samples to read = " << _samples_read << std::endl; // check samples number is > 0 if (_samples_read <= 0) { ERROR_STREAM << "BufferedCounterEvt::handle_raw_buffer-> samples to read negative or null value!" << std::endl; - this->stopCnt(); + stopCnt(); return; } - yat::AutoMutex<> guard(this->m_buffLock); + yat::AutoMutex<> guard(m_buffLock); ni660Xsl::InRawBuffer& buf = *buffer; - RawData_t & data = this->m_data; - bool data_to_be_stored = (this->m_cfg.acq.nexusFileGeneration && this->m_cfg.cnt.nexus); + RawData_t & data = m_data; + bool data_to_be_stored = (m_cfg.acq.nexusFileGeneration && m_cfg.cnt.nexus); //- Continuous acquisition: only one buffer is received !! - if (this->m_cfg.acq.continuousAcquisition) + if (m_cfg.acq.continuousAcquisition) { DEBUG_STREAM << "continuous acquisition: nb buffer to receive = 1!" << std::endl; data[0] = (data_t)buf[0]; @@ -160,36 +156,36 @@ void BufferedCounterEvt::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& //- because the counts are cumulated for (unsigned long idx = 1; idx < (unsigned long)_samples_read; idx++) { - data[idx + this->m_firstPtReceivedBuff] = (data_t)(buf[idx] - buf[idx - 1]); + data[idx + m_firstPtReceivedBuff] = (data_t)(buf[idx] - buf[idx - 1]); } // store received buffer in Nexus, if nx storage enabled - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &data[0], (unsigned long)_samples_read); + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &data[0], (unsigned long)_samples_read); } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterEvt::handle_raw_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterEvt::handle_raw_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } // stop acquisition - this->stopCnt(); + stopCnt(); } - else if (this->m_bufferNbToReceive == 0) //- infinite mode + else if (m_bufferNbToReceive == 0) //- infinite mode { DEBUG_STREAM << "one buffer received." << std::endl; @@ -216,54 +212,54 @@ void BufferedCounterEvt::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& //- at start, m_lastReceivedValue equals 0. //- m_lastReceivedValue is the last value of the n-1 buffer - data[0] = (data_t)(buf[0] - this->m_lastReceivedValue); + data[0] = (data_t)(buf[0] - m_lastReceivedValue); if (data_to_be_stored) bufNx[0] = data[0]; //- memorize the last value of buf (will be used for the next buf) - this->m_lastReceivedValue = (data_t)buf[nb_to_copy - 1]; + m_lastReceivedValue = (data_t)buf[nb_to_copy - 1]; // store received buffer in Nexus, if nx storage enabled for this counter - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterEvt::handle_raw_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterEvt::handle_raw_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } } else //- not continuous nor infinite { //- All buffers have not been yet received - if (this->m_currentBufferNb < this->m_bufferNbToReceive) + if (m_currentBufferNb < m_bufferNbToReceive) { - DEBUG_STREAM << "buffer currently received for counter " << this->m_cfg.cnt.name << " = " << this->m_currentBufferNb + 1 - << " on " << this->m_bufferNbToReceive << std::endl; + DEBUG_STREAM << "buffer currently received for counter " << m_cfg.cnt.name << " = " << m_currentBufferNb + 1 + << " on " << m_bufferNbToReceive << std::endl; unsigned long nb_to_copy; - if (((unsigned long)this->m_cfg.acq.samplesNumber - this->m_firstPtReceivedBuff) < (unsigned long)_samples_read) + if (((unsigned long)m_cfg.acq.samplesNumber - m_firstPtReceivedBuff) < (unsigned long)_samples_read) { - nb_to_copy = (unsigned long)this->m_cfg.acq.samplesNumber - this->m_firstPtReceivedBuff; + nb_to_copy = (unsigned long)m_cfg.acq.samplesNumber - m_firstPtReceivedBuff; } else { nb_to_copy = (unsigned long)_samples_read; } - DEBUG_STREAM << "NB to copy for counter " << this->m_cfg.cnt.name << ": " << nb_to_copy << endl; + DEBUG_STREAM << "NB to copy for counter " << m_cfg.cnt.name << ": " << nb_to_copy << endl; // add number to copy to current data data.capacity(data.length() + nb_to_copy, true); @@ -281,54 +277,54 @@ void BufferedCounterEvt::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& //- because the counts are cumulated for (unsigned long idx = 1; idx < nb_to_copy; idx++ ) { - data[idx + this->m_firstPtReceivedBuff] = (data_t)(buf[idx] - buf[idx - 1]); + data[idx + m_firstPtReceivedBuff] = (data_t)(buf[idx] - buf[idx - 1]); if (data_to_be_stored) - bufNx[idx] = data[idx + this->m_firstPtReceivedBuff]; + bufNx[idx] = data[idx + m_firstPtReceivedBuff]; } //- at start, m_firstPtReceivedBuff and m_lastReceivedValue equal 0. //- m_firstPtReceivedBuff is the position of the 1st point of the buffer //- m_lastReceivedValue is the last value of the n-1 buffer - data[this->m_firstPtReceivedBuff] = (data_t)(buf[0] - this->m_lastReceivedValue); + data[m_firstPtReceivedBuff] = (data_t)(buf[0] - m_lastReceivedValue); if (data_to_be_stored) - bufNx[0] = data[this->m_firstPtReceivedBuff]; + bufNx[0] = data[m_firstPtReceivedBuff]; //- memorize the last value of buf (will be used for the next buf) - this->m_lastReceivedValue = (data_t)buf[nb_to_copy - 1]; + m_lastReceivedValue = (data_t)buf[nb_to_copy - 1]; - this->m_currentBufferNb++; - this->m_firstPtReceivedBuff += nb_to_copy; + m_currentBufferNb++; + m_firstPtReceivedBuff += nb_to_copy; // store received buffer in Nexus, if nx storage enabled for this counter - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); - DEBUG_STREAM << "Push data ok for counter: " << this->m_cfg.cnt.name << endl; + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); + DEBUG_STREAM << "Push data ok for counter: " << m_cfg.cnt.name << endl; } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterEvt::handle_raw_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterEvt::handle_raw_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } } // if all requested buffers are received - if (this->m_currentBufferNb == this->m_bufferNbToReceive) + if (m_currentBufferNb == m_bufferNbToReceive) { // stop acquisition - this->stopCnt(); + stopCnt(); } } @@ -339,7 +335,6 @@ void BufferedCounterEvt::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& // BufferedCounterEvt::handle_scaled_buffer () // ============================================================================ void BufferedCounterEvt::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed) { //- Event values are not scaled !!! delete buffer; @@ -349,56 +344,55 @@ void BufferedCounterEvt::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, // BufferedCounterEvt::startCnt // ============================================================================ void BufferedCounterEvt::startCnt() - throw (Tango::DevFailed) { DEBUG_STREAM << "BufferedCounterEvt::startCnt() entering..." << endl; - this->m_cntOverrun = false; - this->m_cntTimedout = false; - this->m_storageError = false; + m_cntOverrun = false; + m_cntTimedout = false; + m_storageError = false; { - yat::AutoMutex<> guard(this->m_buffLock); + yat::AutoMutex<> guard(m_buffLock); // reset current counters & buffers - this->m_currentBufferNb = 0; - this->m_firstPtReceivedBuff = 0; - this->m_lastReceivedValue = 0; - this->m_acquisitionDone = false; + m_currentBufferNb = 0; + m_firstPtReceivedBuff = 0; + m_lastReceivedValue = 0; + m_acquisitionDone = false; // check if infinite mode - if (this->m_cfg.acq.samplesNumber == 0) + if (m_cfg.acq.samplesNumber == 0) { // set data length & capacity to buffer depth - this->m_data.capacity(this->m_cfg.acq.bufferDepth); - this->m_data.force_length(this->m_cfg.acq.bufferDepth); + m_data.capacity(m_cfg.acq.bufferDepth); + m_data.force_length(m_cfg.acq.bufferDepth); } else { // check if continuous mode - if (this->m_cfg.acq.continuousAcquisition) + if (m_cfg.acq.continuousAcquisition) { // set data length & capacity to samples nber - this->m_data.capacity(this->m_cfg.acq.samplesNumber); - this->m_data.force_length(this->m_cfg.acq.samplesNumber); + m_data.capacity(m_cfg.acq.samplesNumber); + m_data.force_length(m_cfg.acq.samplesNumber); } else { // set data capacity & length to 0 - this->m_data.capacity(0); - this->m_data.force_length(0); + m_data.capacity(0); + m_data.force_length(0); } } - this->m_data.fill(yat::IEEE_NAN); + m_data.fill(yat::IEEE_NAN); unsigned long buffer_depth_nbpts = 0; - if (this->m_cfg.acq.continuousAcquisition) + if (m_cfg.acq.continuousAcquisition) { - buffer_depth_nbpts = this->m_cfg.acq.samplesNumber; + buffer_depth_nbpts = m_cfg.acq.samplesNumber; } else { - buffer_depth_nbpts = static_cast<unsigned long>(this->m_cfg.acq.bufferDepth); + buffer_depth_nbpts = static_cast<unsigned long>(m_cfg.acq.bufferDepth); } m_bufferNbToReceive = (m_cfg.acq.samplesNumber + buffer_depth_nbpts - 1) / buffer_depth_nbpts; DEBUG_STREAM << "Buffer to receive : " << m_bufferNbToReceive << endl; @@ -416,7 +410,7 @@ void BufferedCounterEvt::startCnt() #if !defined (USE_CALLBACK) // start the data buffer waiting task for the 1st time - this->updateRawBuffer(); + updateRawBuffer(); #endif } @@ -424,10 +418,9 @@ void BufferedCounterEvt::startCnt() // BufferedCounterEvt::stopCnt // ============================================================================ void BufferedCounterEvt::stopCnt() - throw (Tango::DevFailed) { DEBUG_STREAM << "BufferedCounterEvt::stopCnt() entering..." << endl; - this->m_acquisitionDone = true; + m_acquisitionDone = true; try { @@ -445,14 +438,15 @@ void BufferedCounterEvt::stopCnt() } else { - // DAQmx 9.x abort pb workaround - WARN_STREAM << "BufferedCounterEvt::stopCnt() - Aborting counter generates exception, do nothing..." << std::endl; + // Bug in DAQmx 9.x: Aborting counter generates exception + // An effective workaround is to catch and clear the error } } catch(...) { - // DAQmx 9.x abort pb workaround - WARN_STREAM << "BufferedCounterEvt::stopCnt() - Aborting counter generates exception, do nothing..." << std::endl; + // One more time: + // Bug in DAQmx 9.x: Aborting counter generates exception + // An effective workaround is to catch and clear the error } } @@ -461,8 +455,8 @@ void BufferedCounterEvt::stopCnt() // ============================================================================ RawData_t & BufferedCounterEvt::get_value() { - yat::AutoMutex<> guard(this->m_buffLock); - return this->m_data; + yat::AutoMutex<> guard(m_buffLock); + return m_data; } // ============================================================================ @@ -542,7 +536,7 @@ yat::Thread::IOArg BREThread::run_undetached (yat::Thread::IOArg ioa) // ============================================================================ void BREThread::exit (void) { - this->m_goOn = false; + m_goOn = false; } } // namespace PulseCounting_ns diff --git a/src/BufferedCounterEvt.h b/src/BufferedCounterEvt.h old mode 100644 new mode 100755 index 710b250356b546c856f2b51477144dc99276a4ed..c48189e6318872bfd77324b7658675ef4e79900b --- a/src/BufferedCounterEvt.h +++ b/src/BufferedCounterEvt.h @@ -83,30 +83,24 @@ public: // called after wait task ends in "polling" mode. //- handle timeout - void handle_timeout() - throw (Tango::DevFailed); + void handle_timeout(); //- handle data lost - void handle_data_lost() - throw (Tango::DevFailed); + void handle_data_lost(); //- handle raw buffer - void handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed); + void handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read); //- handle scaled buffer - void handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed); + void handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read); //********** local members **************** // start counter - void startCnt() - throw (Tango::DevFailed); + void startCnt(); // stop counter - void stopCnt() - throw (Tango::DevFailed); + void stopCnt(); //- set local value void set_value(); @@ -117,43 +111,40 @@ public: // Acquisition done info bool isAcquisitionDone() { - yat::AutoMutex<> guard(this->m_buffLock); - return this->m_acquisitionDone; + yat::AutoMutex<> guard(m_buffLock); + return m_acquisitionDone; } // updates raw buffer <=> starts waiting task if not already running // (used in "polling" mode) - void updateRawBuffer() - throw(Tango::DevFailed); + void updateRawBuffer(); // updates last scaled buffer <=> force buffer reading // (used with trigger listener option) - void updateLastRawBuffer() - throw(Tango::DevFailed); + void updateLastRawBuffer(); // gets raw buffer <=> calls the driver waiting task (used in "polling" mode) void getRawBuffer(); //- release counter - void deleteObject() - throw (Tango::DevFailed); + void deleteObject(); // is counter in overrun ? bool isOverrun() { - return this->m_cntOverrun; + return m_cntOverrun; } // has counter timed out ? bool isTimedout() { - return this->m_cntTimedout; + return m_cntTimedout; } // has counter stopped on storage error? bool isStorageKO() { - return this->m_storageError; + return m_storageError; } protected: diff --git a/src/BufferedCounterPeriod.cpp b/src/BufferedCounterPeriod.cpp old mode 100644 new mode 100755 index 49a977c87ffe25fbf7041e5025e3e2e163188ddb..266967db5152ec21fb1bba133891b24d44eb5ddf --- a/src/BufferedCounterPeriod.cpp +++ b/src/BufferedCounterPeriod.cpp @@ -22,11 +22,11 @@ namespace PulseCounting_ns BufferedCounterPeriod::BufferedCounterPeriod (BCEconfig p_conf, NexusManager * storage) : yat4tango::TangoLogAdapter(p_conf.hostDevice) { - this->m_bufferNbToReceive = 0; - this->m_currentBufferNb = 0; - this->m_firstPtReceivedBuff = 0; - this->m_acquisitionDone = true; - this->m_dataBuffer_thread = NULL; + m_bufferNbToReceive = 0; + m_currentBufferNb = 0; + m_firstPtReceivedBuff = 0; + m_acquisitionDone = true; + m_dataBuffer_thread = NULL; m_cntOverrun = false; m_cntTimedout = false; m_storageError = false; @@ -47,40 +47,39 @@ BufferedCounterPeriod::~BufferedCounterPeriod () // BufferedCounterPeriod::updateScaledBuffer // ============================================================================ void BufferedCounterPeriod::updateScaledBuffer() - throw(Tango::DevFailed) { // Delete "buffer recover" thread if exists and if data recovery is over - if (this->m_dataBuffer_thread) + if (m_dataBuffer_thread) { - if (this->m_dataBuffer_thread->updateDone()) + if (m_dataBuffer_thread->updateDone()) { yat::Thread::IOArg ioa; - this->m_dataBuffer_thread->exit(); - this->m_dataBuffer_thread->join(&ioa); + m_dataBuffer_thread->exit(); + m_dataBuffer_thread->join(&ioa); //std::cout << "BufferedCounterPeriod::updateScaledBuffer - BR thread exited for counter " - // << this->m_cfg.cnt.number << std::endl; - this->m_dataBuffer_thread = NULL; + // << m_cfg.cnt.number << std::endl; + m_dataBuffer_thread = NULL; } } // Task the buffer reception if acquisition is on & if previous buffer recovery is over - if ((!this->m_acquisitionDone) && - (this->m_dataBuffer_thread == NULL)) + if ((!m_acquisitionDone) && + (m_dataBuffer_thread == NULL)) { - this->m_dataBuffer_thread = new BRPRThread(m_cfg.hostDevice, static_cast<yat::Thread::IOArg>(this)); + m_dataBuffer_thread = new BRPRThread(m_cfg.hostDevice, static_cast<yat::Thread::IOArg>(this)); DEBUG_STREAM << "BufferedCounterPeriod Thread created ..." << endl; - if (this->m_dataBuffer_thread == NULL) + if (m_dataBuffer_thread == NULL) { ERROR_STREAM << "Buffer recovery cannot be tasked for counter " - << this->m_cfg.cnt.number << std::endl; + << m_cfg.cnt.number << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start buffer recover task!"), - _CPTC("BufferedCounterPeriod::updateScaledBuffer")); + "DEVICE_ERROR", + "Failed to start buffer recover task!", + "BufferedCounterPeriod::updateScaledBuffer"); } //std::cout << "BufferedCounterPeriod::updateScaledBuffer - starting Buffer recovery thread for counter " - // << this->m_cfg.cnt.number << std::endl; - this->m_dataBuffer_thread->start_undetached(); + // << m_cfg.cnt.number << std::endl; + m_dataBuffer_thread->start_undetached(); } } @@ -91,7 +90,7 @@ void BufferedCounterPeriod::getScaledBuffer() { // call "get scaled buffer" to compose the whole buffer. // In "polling" mode, the client has to poll to compose the acquisition buffer. - if (!this->m_acquisitionDone) + if (!m_acquisitionDone) { DEBUG_STREAM << "BufferedCounterPeriod::getScaledBuffer entering..." << endl; //- from NI660Xsl - calls ni660Xsl::handle_xxx methods @@ -110,27 +109,24 @@ void BufferedCounterPeriod::getScaledBuffer() // BufferedCounterPeriod::handle_timeout () // ============================================================================ void BufferedCounterPeriod::handle_timeout() - throw (Tango::DevFailed) { ERROR_STREAM << "BufferedCounterPeriod::handle_timeout() entering..." << endl; - this->m_cntTimedout = true; + m_cntTimedout = true; } // ============================================================================ // BufferedCounterPeriod::handle_data_lost () // ============================================================================ void BufferedCounterPeriod::handle_data_lost() - throw (Tango::DevFailed) { ERROR_STREAM << "BufferedCounterPeriod::handle_data_lost() entering..." << endl; - this->m_cntOverrun = true; + m_cntOverrun = true; } // ============================================================================ // BufferedCounterPeriod::handle_raw_buffer () // ============================================================================ void BufferedCounterPeriod::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed) { //- PERIOD values are not raw !!! delete buffer; @@ -140,7 +136,6 @@ void BufferedCounterPeriod::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, lon // BufferedCounterPeriod::handle_scaled_buffer () // ============================================================================ void BufferedCounterPeriod::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed) { DEBUG_STREAM << "BufferedCounterPeriod::handle_scaled_buffer() entering..." << std::endl; DEBUG_STREAM << "BufferedCounterPeriod::handle_scaled_buffer() - samples to read = " << _samples_read << std::endl; @@ -149,18 +144,18 @@ void BufferedCounterPeriod::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffe if (_samples_read <= 0) { ERROR_STREAM << "BufferedCounterPeriod::handle_scaled_buffer-> samples to read negative or null value!" << std::endl; - this->stopCnt(); + stopCnt(); return; } - yat::AutoMutex<> guard(this->m_buffLock); + yat::AutoMutex<> guard(m_buffLock); ni660Xsl::InScaledBuffer& buf = *buffer; - RawData_t & data = this->m_data; - bool data_to_be_stored = (this->m_cfg.acq.nexusFileGeneration && this->m_cfg.cnt.nexus); + RawData_t & data = m_data; + bool data_to_be_stored = (m_cfg.acq.nexusFileGeneration && m_cfg.cnt.nexus); //- Continuous acquisition: only one buffer is received !! - if (this->m_cfg.acq.continuousAcquisition) + if (m_cfg.acq.continuousAcquisition) { DEBUG_STREAM << "continuous acquisition: nb buffer to receive = 1!" << std::endl; @@ -170,32 +165,32 @@ void BufferedCounterPeriod::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffe } // store received buffer in Nexus, if nx storage enabled - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &data[0], (unsigned long)_samples_read); + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &data[0], (unsigned long)_samples_read); } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterPeriod::handle_raw_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterPeriod::handle_raw_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } // stop acquisition - this->stopCnt(); + stopCnt(); } - else if (this->m_bufferNbToReceive == 0) //- infinite mode + else if (m_bufferNbToReceive == 0) //- infinite mode { DEBUG_STREAM << "one buffer received." << std::endl; @@ -209,39 +204,39 @@ void BufferedCounterPeriod::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffe } // store received buffer in Nexus, if nx storage enabled for this counter - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &data[0], nb_to_copy); + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &data[0], nb_to_copy); } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterPeriod::handle_raw_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterPeriod::handle_raw_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } } else //- not continuous nor infinite { //- All buffers have not been yet received - if (this->m_currentBufferNb < this->m_bufferNbToReceive) + if (m_currentBufferNb < m_bufferNbToReceive) { - DEBUG_STREAM << "buffer currently received = " << this->m_currentBufferNb + 1 << " on " << this->m_bufferNbToReceive << std::endl; + DEBUG_STREAM << "buffer currently received = " << m_currentBufferNb + 1 << " on " << m_bufferNbToReceive << std::endl; unsigned long nb_to_copy; - if (((unsigned long)this->m_cfg.acq.samplesNumber - this->m_firstPtReceivedBuff) < (unsigned long)_samples_read) + if (((unsigned long)m_cfg.acq.samplesNumber - m_firstPtReceivedBuff) < (unsigned long)_samples_read) { - nb_to_copy = (unsigned long)this->m_cfg.acq.samplesNumber - this->m_firstPtReceivedBuff; + nb_to_copy = (unsigned long)m_cfg.acq.samplesNumber - m_firstPtReceivedBuff; } else { @@ -263,49 +258,49 @@ void BufferedCounterPeriod::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffe for (unsigned long idx = 1; idx < nb_to_copy; idx++ ) { - data[idx + this->m_firstPtReceivedBuff] = (data_t)(buf[idx]); + data[idx + m_firstPtReceivedBuff] = (data_t)(buf[idx]); if (data_to_be_stored) - bufNx[idx] = data[idx + this->m_firstPtReceivedBuff]; + bufNx[idx] = data[idx + m_firstPtReceivedBuff]; } //- at start, m_firstPtReceivedBuff equals 0. //- m_firstPtReceivedBuff is the position of the 1st point of the buffer - data[this->m_firstPtReceivedBuff] = (data_t)(buf[0]); + data[m_firstPtReceivedBuff] = (data_t)(buf[0]); if (data_to_be_stored) - bufNx[0] = data[this->m_firstPtReceivedBuff]; + bufNx[0] = data[m_firstPtReceivedBuff]; - this->m_currentBufferNb++; - this->m_firstPtReceivedBuff += nb_to_copy; + m_currentBufferNb++; + m_firstPtReceivedBuff += nb_to_copy; // store received buffer in Nexus, if nx storage enabled for this counter - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterPeriod::handle_raw_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterPeriod::handle_raw_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } } // if all requested buffers are received - if (this->m_currentBufferNb == this->m_bufferNbToReceive) + if (m_currentBufferNb == m_bufferNbToReceive) { // stop acquisition - this->stopCnt(); + stopCnt(); } } @@ -316,55 +311,54 @@ void BufferedCounterPeriod::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffe // BufferedCounterPeriod::startCnt // ============================================================================ void BufferedCounterPeriod::startCnt() - throw (Tango::DevFailed) { DEBUG_STREAM << "BufferedCounterPeriod::startCnt() entering..." << endl; - this->m_cntOverrun = false; - this->m_cntTimedout = false; - this->m_storageError = false; + m_cntOverrun = false; + m_cntTimedout = false; + m_storageError = false; { - yat::AutoMutex<> guard(this->m_buffLock); + yat::AutoMutex<> guard(m_buffLock); // reset current counters & buffers - this->m_currentBufferNb = 0; - this->m_firstPtReceivedBuff = 0; - this->m_acquisitionDone = false; + m_currentBufferNb = 0; + m_firstPtReceivedBuff = 0; + m_acquisitionDone = false; // check if infinite mode - if (this->m_cfg.acq.samplesNumber == 0) + if (m_cfg.acq.samplesNumber == 0) { // set data length & capacity to buffer depth - this->m_data.capacity(this->m_cfg.acq.bufferDepth); - this->m_data.force_length(this->m_cfg.acq.bufferDepth); + m_data.capacity(m_cfg.acq.bufferDepth); + m_data.force_length(m_cfg.acq.bufferDepth); } else { // check if continuous mode - if (this->m_cfg.acq.continuousAcquisition) + if (m_cfg.acq.continuousAcquisition) { // set data length & capacity to samples nber - this->m_data.capacity(this->m_cfg.acq.samplesNumber); - this->m_data.force_length(this->m_cfg.acq.samplesNumber); + m_data.capacity(m_cfg.acq.samplesNumber); + m_data.force_length(m_cfg.acq.samplesNumber); } else { // set data capacity & length to 0 - this->m_data.capacity(0); - this->m_data.force_length(0); + m_data.capacity(0); + m_data.force_length(0); } } - this->m_data.fill(yat::IEEE_NAN); + m_data.fill(yat::IEEE_NAN); unsigned long buffer_depth_nbpts = 0; - if (this->m_cfg.acq.continuousAcquisition) + if (m_cfg.acq.continuousAcquisition) { - buffer_depth_nbpts = this->m_cfg.acq.samplesNumber; + buffer_depth_nbpts = m_cfg.acq.samplesNumber; } else { - buffer_depth_nbpts = static_cast<unsigned long>(this->m_cfg.acq.bufferDepth); + buffer_depth_nbpts = static_cast<unsigned long>(m_cfg.acq.bufferDepth); } m_bufferNbToReceive = (m_cfg.acq.samplesNumber + buffer_depth_nbpts - 1) / buffer_depth_nbpts; DEBUG_STREAM << "Buffer to receive : " << m_bufferNbToReceive << endl; @@ -382,7 +376,7 @@ void BufferedCounterPeriod::startCnt() #if !defined (USE_CALLBACK) // start the data buffer waiting task for the 1st time - this->updateScaledBuffer(); + updateScaledBuffer(); #endif } @@ -390,10 +384,9 @@ void BufferedCounterPeriod::startCnt() // BufferedCounterPeriod::stopCnt // ============================================================================ void BufferedCounterPeriod::stopCnt() - throw (Tango::DevFailed) { DEBUG_STREAM << "BufferedCounterPeriod::stopCnt() entering..." << endl; - this->m_acquisitionDone = true; + m_acquisitionDone = true; try { @@ -411,14 +404,15 @@ void BufferedCounterPeriod::stopCnt() } else { - // DAQmx 9.x abort pb workaround - WARN_STREAM << "BufferedCounterPeriod::stopCnt() - Aborting counter generates exception, do nothing..." << std::endl; + // Bug in DAQmx 9.x: Aborting counter generates exception + // An effective workaround is to catch and clear the error } } catch(...) { - // DAQmx 9.x abort pb workaround - WARN_STREAM << "BufferedCounterPeriod::stopCnt() - Aborting counter generates exception, do nothing..." << std::endl; + // One more time: + // Bug in DAQmx 9.x: Aborting counter generates exception + // An effective workaround is to catch and clear the error } } @@ -427,8 +421,8 @@ void BufferedCounterPeriod::stopCnt() // ============================================================================ RawData_t & BufferedCounterPeriod::get_value() { - yat::AutoMutex<> guard(this->m_buffLock); - return this->m_data; + yat::AutoMutex<> guard(m_buffLock); + return m_data; } // ============================================================================ @@ -506,7 +500,7 @@ yat::Thread::IOArg BRPRThread::run_undetached (yat::Thread::IOArg ioa) // ============================================================================ void BRPRThread::exit (void) { - this->m_goOn = false; + m_goOn = false; } } // namespace PulseCounting_ns diff --git a/src/BufferedCounterPeriod.h b/src/BufferedCounterPeriod.h old mode 100644 new mode 100755 index f65ea5311bec9f28740682efad65215b94787ae8..1975579ce4f1cebdefce7b33d24d3486f2359fc7 --- a/src/BufferedCounterPeriod.h +++ b/src/BufferedCounterPeriod.h @@ -83,30 +83,24 @@ public: // called after wait task ends in "polling" mode. //- handle timeout - void handle_timeout() - throw (Tango::DevFailed); + void handle_timeout(); //- handle data lost - void handle_data_lost() - throw (Tango::DevFailed); + void handle_data_lost(); //- handle raw buffer - void handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed); + void handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read); //- handle scaled buffer - void handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed); + void handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read); //********** local members **************** // start counter - void startCnt() - throw (Tango::DevFailed); + void startCnt(); // stop counter - void stopCnt() - throw (Tango::DevFailed); + void stopCnt(); //- set local value void set_value(); @@ -117,43 +111,40 @@ public: // Acquisition done info bool isAcquisitionDone() { - yat::AutoMutex<> guard(this->m_buffLock); - return this->m_acquisitionDone; + yat::AutoMutex<> guard(m_buffLock); + return m_acquisitionDone; } // updates scaled buffer <=> starts waiting task if not already running // (used in "polling" mode) - void updateScaledBuffer() - throw(Tango::DevFailed); + void updateScaledBuffer(); // updates last scaled buffer <=> force buffer reading // (used with trigger listener option) - void updateLastScaledBuffer() - throw(Tango::DevFailed); + void updateLastScaledBuffer(); // gets scaled buffer <=> calls the driver waiting task (used in "polling" mode) void getScaledBuffer(); //- release counter - void deleteObject() - throw (Tango::DevFailed); + void deleteObject(); // is counter in overrun ? bool isOverrun() { - return this->m_cntOverrun; + return m_cntOverrun; } // has counter timed out ? bool isTimedout() { - return this->m_cntTimedout; + return m_cntTimedout; } // has counter stopped on storage error? bool isStorageKO() { - return this->m_storageError; + return m_storageError; } protected: diff --git a/src/BufferedCounterPos.cpp b/src/BufferedCounterPos.cpp old mode 100644 new mode 100755 index 359bbdd81c3cfd5f1a499923a8432129dda412a9..611537e2b74be4c088a1697d90542f358b56cfb4 --- a/src/BufferedCounterPos.cpp +++ b/src/BufferedCounterPos.cpp @@ -22,15 +22,15 @@ namespace PulseCounting_ns BufferedCounterPos::BufferedCounterPos (BCEconfig p_conf, NexusManager * storage) : yat4tango::TangoLogAdapter(p_conf.hostDevice) { - this->m_bufferNbToReceive = 0; - this->m_currentBufferNb = 0; - this->m_firstPtReceivedBuff = 0; - this->m_lastReceivedValue = 0.0; - this->m_acquisitionDone = true; - this->m_dataBuffer_thread = NULL; - this->m_cntOverrun = false; - this->m_cntTimedout = false; - this->m_storageError = false; + m_bufferNbToReceive = 0; + m_currentBufferNb = 0; + m_firstPtReceivedBuff = 0; + m_lastReceivedValue = 0.0; + m_acquisitionDone = true; + m_dataBuffer_thread = NULL; + m_cntOverrun = false; + m_cntTimedout = false; + m_storageError = false; m_data.clear(); m_cfg = p_conf; m_storage_mgr = storage; @@ -48,40 +48,39 @@ BufferedCounterPos::~BufferedCounterPos () // BufferedCounterPos::updateScaledBuffer // ============================================================================ void BufferedCounterPos::updateScaledBuffer() - throw(Tango::DevFailed) { // Delete "buffer recover" thread if exists and if data recovery is over - if (this->m_dataBuffer_thread) + if (m_dataBuffer_thread) { - if (this->m_dataBuffer_thread->updateDone()) + if (m_dataBuffer_thread->updateDone()) { yat::Thread::IOArg ioa; - this->m_dataBuffer_thread->exit(); - this->m_dataBuffer_thread->join(&ioa); + m_dataBuffer_thread->exit(); + m_dataBuffer_thread->join(&ioa); //std::cout << "BufferedCounterPos::updateScaledBuffer - BR thread exited for counter " - // << this->m_cfg.cnt.number << std::endl; - this->m_dataBuffer_thread = NULL; + // << m_cfg.cnt.number << std::endl; + m_dataBuffer_thread = NULL; } } // Task the buffer reception if acquisition is on & if previous buffer recovery is over - if ((!this->m_acquisitionDone) && - (this->m_dataBuffer_thread == NULL)) + if ((!m_acquisitionDone) && + (m_dataBuffer_thread == NULL)) { - this->m_dataBuffer_thread = new BRPThread(m_cfg.hostDevice, static_cast<yat::Thread::IOArg>(this)); + m_dataBuffer_thread = new BRPThread(m_cfg.hostDevice, static_cast<yat::Thread::IOArg>(this)); DEBUG_STREAM << "BufferedCounterPos Thread created ..." << endl; - if (this->m_dataBuffer_thread == NULL) + if (m_dataBuffer_thread == NULL) { ERROR_STREAM << "Buffer recovery cannot be tasked for counter " - << this->m_cfg.cnt.number << std::endl; + << m_cfg.cnt.number << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start buffer recover task!"), - _CPTC("BufferedCounterPos::updateScaledBuffer")); + "DEVICE_ERROR", + "Failed to start buffer recover task!", + "BufferedCounterPos::updateScaledBuffer"); } //std::cout << "BufferedCounterPos::updateScaledBuffer - starting Buffer recovery thread for counter " - // << this->m_cfg.cnt.number << std::endl; - this->m_dataBuffer_thread->start_undetached(); + // << m_cfg.cnt.number << std::endl; + m_dataBuffer_thread->start_undetached(); } } @@ -92,7 +91,7 @@ void BufferedCounterPos::getScaledBuffer() { // call "get scaled buffer" to compose the whole buffer. // In "polling" mode, the client has to poll to compose the acquisition buffer. - if (!this->m_acquisitionDone) + if (!m_acquisitionDone) { DEBUG_STREAM << "BufferedCounterPos::getScaledBuffer ..." << endl; //- from NI660Xsl - calls ni660Xsl::handle_xxx methods @@ -111,27 +110,24 @@ void BufferedCounterPos::getScaledBuffer() // BufferedCounterPos::handle_timeout () // ============================================================================ void BufferedCounterPos::handle_timeout() - throw (Tango::DevFailed) { ERROR_STREAM << "BufferedCounterPos::handle_timeout() entering..." << endl; - this->m_cntTimedout = true; + m_cntTimedout = true; } // ============================================================================ // BufferedCounterPos::handle_data_lost () // ============================================================================ void BufferedCounterPos::handle_data_lost() - throw (Tango::DevFailed) { ERROR_STREAM << "BufferedCounterPos::handle_data_lost() entering..." << endl; - this->m_cntOverrun = true; + m_cntOverrun = true; } // ============================================================================ // BufferedCounterPos::handle_raw_buffer () // ============================================================================ void BufferedCounterPos::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed) { //- Event values are not raw !!! delete buffer; @@ -141,24 +137,23 @@ void BufferedCounterPos::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& // BufferedCounterPos::handle_scaled_buffer () // ============================================================================ void BufferedCounterPos::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed) { - DEBUG_STREAM << "BufferedCounterPos::handle_scaled_buffer() entering for counter: " << this->m_cfg.cnt.name << " ... " + DEBUG_STREAM << "BufferedCounterPos::handle_scaled_buffer() entering for counter: " << m_cfg.cnt.name << " ... " << " - samples to read = " << _samples_read << std::endl; // check samples number is > 0 if (_samples_read <= 0) { ERROR_STREAM << "BufferedCounterPos::handle_scaled_buffer-> samples to read negative or null value!" << std::endl; - this->stopCnt(); + stopCnt(); return; } - yat::AutoMutex<> guard(this->m_buffLock); + yat::AutoMutex<> guard(m_buffLock); ni660Xsl::InScaledBuffer& buf = *buffer; - RawData_t & pos = this->m_data; - bool data_to_be_stored = (this->m_cfg.acq.nexusFileGeneration && this->m_cfg.cnt.nexus); + RawData_t & pos = m_data; + bool data_to_be_stored = (m_cfg.acq.nexusFileGeneration && m_cfg.cnt.nexus); //- Continuous acquisition: only one buffer is received !! if (m_cfg.acq.continuousAcquisition) @@ -166,8 +161,8 @@ void BufferedCounterPos::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, DEBUG_STREAM << "continuous acquisition: nb buffer to receive = 1!" << std::endl; // Take initial position into account for 1st point when requested - if (this->m_cfg.cnt.applyInitPos) - pos[0] = (this->m_cfg.cnt.absInitPos + buf[0]) / 2; + if (m_cfg.cnt.applyInitPos) + pos[0] = (m_cfg.cnt.absInitPos + buf[0]) / 2; else pos[0] = buf[0]; @@ -179,32 +174,32 @@ void BufferedCounterPos::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, } // store received buffer in Nexus, if nx storage enabled for this counter - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &pos[0], (unsigned long)_samples_read); + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &pos[0], (unsigned long)_samples_read); } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterPos::handle_scaled_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterPos::handle_scaled_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } // stop acquisition - this->stopCnt(); + stopCnt(); } - else if (this->m_bufferNbToReceive == 0) //- infinite mode + else if (m_bufferNbToReceive == 0) //- infinite mode { DEBUG_STREAM << "one buffer received." << std::endl; @@ -236,8 +231,8 @@ void BufferedCounterPos::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, if (m_firstPtReceivedBuff == 0) { // Take initial position into account for 1st point when requested - if (this->m_cfg.cnt.applyInitPos) - pos[0] = (this->m_cfg.cnt.absInitPos + buf[0]) / 2; + if (m_cfg.cnt.applyInitPos) + pos[0] = (m_cfg.cnt.absInitPos + buf[0]) / 2; else pos[0] = buf[0]; @@ -245,57 +240,57 @@ void BufferedCounterPos::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, } else { - pos[0] = (buf[0] + this->m_lastReceivedValue) / 2; + pos[0] = (buf[0] + m_lastReceivedValue) / 2; } if (data_to_be_stored) bufNx[0] = pos[0]; //- memorize the last value of buf (will be used for the next buf) - this->m_lastReceivedValue = buf[nb_to_copy - 1]; + m_lastReceivedValue = buf[nb_to_copy - 1]; // store received buffer in Nexus, if nx storage enabled for this counter - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterPos::handle_scaled_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterPos::handle_scaled_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } } else //- not continuous nor infinite { //- All buffers have not been yet received - if (this->m_currentBufferNb < this->m_bufferNbToReceive) + if (m_currentBufferNb < m_bufferNbToReceive) { - DEBUG_STREAM << "buffer currently received for counter " << this->m_cfg.cnt.name << " = " << this->m_currentBufferNb + 1 - << " on " << this->m_bufferNbToReceive << std::endl; + DEBUG_STREAM << "buffer currently received for counter " << m_cfg.cnt.name << " = " << m_currentBufferNb + 1 + << " on " << m_bufferNbToReceive << std::endl; unsigned long nb_to_copy; - if (((unsigned long)this->m_cfg.acq.samplesNumber - this->m_firstPtReceivedBuff) < (unsigned long)_samples_read) + if (((unsigned long)m_cfg.acq.samplesNumber - m_firstPtReceivedBuff) < (unsigned long)_samples_read) { - nb_to_copy = (unsigned long)this->m_cfg.acq.samplesNumber - this->m_firstPtReceivedBuff; + nb_to_copy = (unsigned long)m_cfg.acq.samplesNumber - m_firstPtReceivedBuff; } else { nb_to_copy = (unsigned long)_samples_read; } - DEBUG_STREAM << "NB to copy for counter " << this->m_cfg.cnt.name << ": " << nb_to_copy << endl; + DEBUG_STREAM << "NB to copy for counter " << m_cfg.cnt.name << ": " << nb_to_copy << endl; // add number to copy to current data pos.capacity(pos.length() + nb_to_copy, true); @@ -313,9 +308,9 @@ void BufferedCounterPos::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, //- mean = (X(n-1) + Xn ) / 2 for (unsigned long idx = 1; idx < nb_to_copy; idx++) { - pos[idx + this->m_firstPtReceivedBuff] = (buf[idx-1] + buf[idx]) / 2; + pos[idx + m_firstPtReceivedBuff] = (buf[idx-1] + buf[idx]) / 2; if (data_to_be_stored) - bufNx[idx] = pos[idx + this->m_firstPtReceivedBuff]; + bufNx[idx] = pos[idx + m_firstPtReceivedBuff]; } //- Compute 1st point: @@ -325,55 +320,55 @@ void BufferedCounterPos::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, if (m_firstPtReceivedBuff == 0) { // Take initial position into account for 1st point when requested - if (this->m_cfg.cnt.applyInitPos) - pos[this->m_firstPtReceivedBuff] = (this->m_cfg.cnt.absInitPos + buf[0]) / 2; + if (m_cfg.cnt.applyInitPos) + pos[m_firstPtReceivedBuff] = (m_cfg.cnt.absInitPos + buf[0]) / 2; else - pos[this->m_firstPtReceivedBuff] = buf[0]; + pos[m_firstPtReceivedBuff] = buf[0]; } else { - pos[this->m_firstPtReceivedBuff] = (buf[0] + this->m_lastReceivedValue) / 2; + pos[m_firstPtReceivedBuff] = (buf[0] + m_lastReceivedValue) / 2; } if (data_to_be_stored) - bufNx[0] = pos[this->m_firstPtReceivedBuff]; + bufNx[0] = pos[m_firstPtReceivedBuff]; //- memorize the last value of buf (will be used for the next buf) - this->m_lastReceivedValue = buf[nb_to_copy - 1]; + m_lastReceivedValue = buf[nb_to_copy - 1]; - this->m_currentBufferNb++; - this->m_firstPtReceivedBuff += nb_to_copy; + m_currentBufferNb++; + m_firstPtReceivedBuff += nb_to_copy; // store received buffer in Nexus, if nx storage enabled for this counter - if (data_to_be_stored && this->m_storage_mgr) + if (data_to_be_stored && m_storage_mgr) { try { - this->m_storage_mgr->pushNexusData(this->m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); - DEBUG_STREAM << "Push data ok for counter: " << this->m_cfg.cnt.name << endl; + m_storage_mgr->pushNexusData(m_cfg.cnt.dataset, &bufNx[0], nb_to_copy); + DEBUG_STREAM << "Push data ok for counter: " << m_cfg.cnt.name << endl; } catch (Tango::DevFailed & df) { ERROR_STREAM << "BufferedCounterPos::handle_scaled_buffer-> pushNexusData caught DevFailed: " << df << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } catch (...) { ERROR_STREAM << "BufferedCounterPos::handle_scaled_buffer-> pushNexusData caugth unknown exception!" << std::endl; // We should stop acquisition if nx problem! - this->m_storageError = true; - this->stopCnt(); + m_storageError = true; + stopCnt(); } } } // if all requested buffers are received - if (this->m_currentBufferNb == this->m_bufferNbToReceive) + if (m_currentBufferNb == m_bufferNbToReceive) { // Stop acquisition - this->stopCnt(); + stopCnt(); } } @@ -384,56 +379,55 @@ void BufferedCounterPos::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, // BufferedCounterPos::startCnt // ============================================================================ void BufferedCounterPos::startCnt() - throw (Tango::DevFailed) { DEBUG_STREAM << "BufferedCounterPos::startCnt() entering..." << endl; - this->m_cntOverrun = false; - this->m_cntTimedout = false; - this->m_storageError = false; + m_cntOverrun = false; + m_cntTimedout = false; + m_storageError = false; { - yat::AutoMutex<> guard(this->m_buffLock); + yat::AutoMutex<> guard(m_buffLock); // reset current counters & buffers - this->m_currentBufferNb = 0; - this->m_acquisitionDone = false; - this->m_firstPtReceivedBuff = 0; - this->m_lastReceivedValue = 0; + m_currentBufferNb = 0; + m_acquisitionDone = false; + m_firstPtReceivedBuff = 0; + m_lastReceivedValue = 0; // check if infinite mode - if (this->m_cfg.acq.samplesNumber == 0) + if (m_cfg.acq.samplesNumber == 0) { // set data length & capacity to buffer depth - this->m_data.capacity(this->m_cfg.acq.bufferDepth); - this->m_data.force_length(this->m_cfg.acq.bufferDepth); + m_data.capacity(m_cfg.acq.bufferDepth); + m_data.force_length(m_cfg.acq.bufferDepth); } else { // check if continuous mode - if (this->m_cfg.acq.continuousAcquisition) + if (m_cfg.acq.continuousAcquisition) { // set data length & capacity to samples nber - this->m_data.capacity(this->m_cfg.acq.samplesNumber); - this->m_data.force_length(this->m_cfg.acq.samplesNumber); + m_data.capacity(m_cfg.acq.samplesNumber); + m_data.force_length(m_cfg.acq.samplesNumber); } else { // set data capacity & length to 0 - this->m_data.capacity(0); - this->m_data.force_length(0); + m_data.capacity(0); + m_data.force_length(0); } } - this->m_data.fill(yat::IEEE_NAN); + m_data.fill(yat::IEEE_NAN); unsigned long buffer_depth_nbpts = 0; - if (this->m_cfg.acq.continuousAcquisition) + if (m_cfg.acq.continuousAcquisition) { - buffer_depth_nbpts = this->m_cfg.acq.samplesNumber; + buffer_depth_nbpts = m_cfg.acq.samplesNumber; } else { - buffer_depth_nbpts = static_cast<unsigned long>(this->m_cfg.acq.bufferDepth); + buffer_depth_nbpts = static_cast<unsigned long>(m_cfg.acq.bufferDepth); } m_bufferNbToReceive = (m_cfg.acq.samplesNumber + buffer_depth_nbpts - 1) /buffer_depth_nbpts; @@ -452,7 +446,7 @@ void BufferedCounterPos::startCnt() #if !defined (USE_CALLBACK) // start the data buffer waiting task for the 1st time - this->updateScaledBuffer(); + updateScaledBuffer(); #endif } @@ -460,10 +454,9 @@ void BufferedCounterPos::startCnt() // BufferedCounterPos::stopCnt // ============================================================================ void BufferedCounterPos::stopCnt() - throw (Tango::DevFailed) { DEBUG_STREAM << "BufferedCounterPos::stopCnt() entering..." << endl; - this->m_acquisitionDone = true; + m_acquisitionDone = true; try { @@ -481,14 +474,15 @@ void BufferedCounterPos::stopCnt() } else { - // DAQmx 9.x abort pb workaround - WARN_STREAM << "BufferedCounterPos::stopCnt() - Aborting counter generates exception, do nothing..." << std::endl; + // Bug in DAQmx 9.x: Aborting counter generates exception + // An effective workaround is to catch and clear the error } } catch(...) { - // DAQmx 9.x abort pb workaround - WARN_STREAM << "BufferedCounterPos::stopCnt() - Aborting counter generates exception, do nothing..." << std::endl; + // One more time: + // Bug in DAQmx 9.x: Aborting counter generates exception + // An effective workaround is to catch and clear the error } } @@ -497,7 +491,7 @@ void BufferedCounterPos::stopCnt() // ============================================================================ RawData_t & BufferedCounterPos::get_value() { - yat::AutoMutex<> guard(this->m_buffLock); + yat::AutoMutex<> guard(m_buffLock); return m_data; } @@ -576,7 +570,7 @@ yat::Thread::IOArg BRPThread::run_undetached (yat::Thread::IOArg ioa) // ============================================================================ void BRPThread::exit (void) { - this->m_goOn = false; + m_goOn = false; } } // namespace PulseCounting_ns diff --git a/src/BufferedCounterPos.h b/src/BufferedCounterPos.h old mode 100644 new mode 100755 index 01176b47bc06ee349ff185838f34760a4d38b51c..65ac045594598ba32be6531088c592b1203ebf60 --- a/src/BufferedCounterPos.h +++ b/src/BufferedCounterPos.h @@ -82,74 +82,64 @@ public: // called after wait task ends in "polling" mode. //- handle timeout - void handle_timeout() - throw (Tango::DevFailed); + void handle_timeout(); //- handle data lost - void handle_data_lost() - throw (Tango::DevFailed); + void handle_data_lost(); //- handle raw buffer - void handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed); + void handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long& _samples_read); //- handle scaled buffer - void handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read) - throw (Tango::DevFailed); - + void handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, long& _samples_read); //********** local members **************** // start counter - void startCnt() - throw (Tango::DevFailed); + void startCnt(); // stop counter - void stopCnt() - throw (Tango::DevFailed); - + void stopCnt(); + //- get value RawData_t & get_value(); // Acquisition done info bool isAcquisitionDone() { - yat::AutoMutex<> guard(this->m_buffLock); - return this->m_acquisitionDone; + yat::AutoMutex<> guard(m_buffLock); + return m_acquisitionDone; } // updates scaled buffer <=> starts waiting task if not already running // (used in "polling" mode) - void updateScaledBuffer() - throw(Tango::DevFailed); + void updateScaledBuffer(); // updates last scaled buffer <=> force buffer reading // (used with trigger listener option) - void updateLastScaledBuffer() - throw(Tango::DevFailed); + void updateLastScaledBuffer(); // gets scaled buffer <=> calls the driver waiting task (used in "polling" mode) void getScaledBuffer(); //- release counter - void deleteObject() - throw (Tango::DevFailed); + void deleteObject(); // is counter in overrun ? bool isOverrun() { - return this->m_cntOverrun; + return m_cntOverrun; } // has counter timed out ? bool isTimedout() { - return this->m_cntTimedout; + return m_cntTimedout; } // has counter stopped on storage error? bool isStorageKO() { - return this->m_storageError; + return m_storageError; } diff --git a/src/ClockGenerator.cpp b/src/ClockGenerator.cpp old mode 100644 new mode 100755 index 975923b0355a6de6b6045c588125374e6b04d20e..4865f541449657ac9e062a2552329e743e3e3a00 --- a/src/ClockGenerator.cpp +++ b/src/ClockGenerator.cpp @@ -22,9 +22,9 @@ namespace PulseCounting_ns do \ { \ if (! m_counting_board) \ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("request aborted - the counting board isn't accessible "), \ - _CPTC("PulseCountingManager::check_counting_board")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the counting board isn't accessible ", \ + "PulseCountingManager::check_counting_board"); \ } while (0) // ============================================================================ @@ -48,7 +48,6 @@ ClockGenerator::~ClockGenerator () // ClockGenerator::init () // ============================================================================ void ClockGenerator::init(ClockConfig p_config) - throw (Tango::DevFailed) { INFO_STREAM << "ClockGenerator::init OK" << endl; m_cfg = p_config; @@ -63,17 +62,17 @@ void ClockGenerator::init(ClockConfig p_config) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start clock generator"), - _CPTC("ClockGenerator::start")); + "DEVICE_ERROR", + "Failed to start clock generator", + "ClockGenerator::start"); } catch (...) { ERROR_STREAM << "Failed to start clock generator" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start clock generator"), - _CPTC("ClockGenerator::start")); + "DEVICE_ERROR", + "Failed to start clock generator", + "ClockGenerator::start"); } } @@ -81,7 +80,6 @@ void ClockGenerator::init(ClockConfig p_config) // ClockGenerator::start () // ============================================================================ void ClockGenerator::start() - throw (Tango::DevFailed) { CHECK_CNT_BOARD(); @@ -93,17 +91,17 @@ void ClockGenerator::start() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start clock generator"), - _CPTC("ClockGenerator::start")); + "DEVICE_ERROR", + "Failed to start clock generator", + "ClockGenerator::start"); } catch (...) { ERROR_STREAM << "Failed to start clock generator" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start clock generator"), - _CPTC("ClockGenerator::start")); + "DEVICE_ERROR", + "Failed to start clock generator", + "ClockGenerator::start"); } } @@ -111,7 +109,6 @@ void ClockGenerator::start() // ClockGenerator::abort () // ============================================================================ void ClockGenerator::abort() - throw (Tango::DevFailed) { CHECK_CNT_BOARD(); @@ -123,17 +120,17 @@ void ClockGenerator::abort() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to abort clock generator"), - _CPTC("ClockGenerator::abort")); + "DEVICE_ERROR", + "Failed to abort clock generator", + "ClockGenerator::abort"); } catch (...) { ERROR_STREAM << "Failed to abort clock generator" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to abort clock generator"), - _CPTC("ClockGenerator::abort")); + "DEVICE_ERROR", + "Failed to abort clock generator", + "ClockGenerator::abort"); } } @@ -141,7 +138,6 @@ void ClockGenerator::abort() // ClockGenerator::waitEndOfClock () // ============================================================================ void ClockGenerator::waitEndOfClock() - throw (Tango::DevFailed) { CHECK_CNT_BOARD(); @@ -153,17 +149,17 @@ void ClockGenerator::waitEndOfClock() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to waitEndOfClock clock generator"), - _CPTC("ClockGenerator::waitEndOfClock")); + "DEVICE_ERROR", + "Failed to waitEndOfClock clock generator", + "ClockGenerator::waitEndOfClock"); } catch (...) { ERROR_STREAM << "Failed to waitEndOfClock clock generator" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to waitEndOfClock clock generator"), - _CPTC("ClockGenerator::waitEndOfClock")); + "DEVICE_ERROR", + "Failed to waitEndOfClock clock generator", + "ClockGenerator::waitEndOfClock"); } } @@ -171,7 +167,6 @@ void ClockGenerator::waitEndOfClock() // ClockGenerator::deleteObject () // ============================================================================ void ClockGenerator::deleteObject() - throw (Tango::DevFailed) { CHECK_CNT_BOARD(); diff --git a/src/ClockGenerator.h b/src/ClockGenerator.h old mode 100644 new mode 100755 index 706cd35722e326ab9672cac436388bbd810f0959..0efa55248fb30574af089b9941b8399d217f2b4e --- a/src/ClockGenerator.h +++ b/src/ClockGenerator.h @@ -34,25 +34,20 @@ public: ~ClockGenerator (); //- init - void init(ClockConfig p_cfg) - throw (Tango::DevFailed); + void init(ClockConfig p_cfg); //- starts the clock - void start() - throw (Tango::DevFailed); + void start(); //- abort the clock - void abort() - throw (Tango::DevFailed); + void abort(); //- wait end of clock - void waitEndOfClock() - throw (Tango::DevFailed); - - //- delete clock object - void deleteObject() - throw (Tango::DevFailed); + void waitEndOfClock(); + //- delete clock object + void deleteObject(); + protected: //- counting board interface CountingBoardInterface * m_counting_board; diff --git a/src/ConfigurationParser.cpp b/src/ConfigurationParser.cpp index fc9f0565960aa7636f669e049fd82074eaa3c55d..6a8843ce90ea0a515caa62425ad7078b6d40f7d0 100755 --- a/src/ConfigurationParser.cpp +++ b/src/ConfigurationParser.cpp @@ -37,7 +37,6 @@ ConfigurationParser::~ConfigurationParser () // ConfigurationParser::parseConfigProperty // ====================================================================== CounterKeys_t ConfigurationParser::parseConfigProperty (std::vector<std::string> config_property) - throw (Tango::DevFailed) { DEBUG_STREAM << "ConfigurationParser::parseConfigProperty ==>" << std::endl; @@ -50,7 +49,7 @@ CounterKeys_t ConfigurationParser::parseConfigProperty (std::vector<std::string> // Parse config vector and extract KEY::value fields for (std::vector<std::string>::iterator it = config_property.begin() ; it != config_property.end(); ++it) { - std::vector<std::string> tokenList = this->splitLine(*it, kKEY_VALUE_SEPARATOR); + std::vector<std::string> tokenList = splitLine(*it, kKEY_VALUE_SEPARATOR); if (tokenList.size() != 2) { @@ -58,9 +57,9 @@ CounterKeys_t ConfigurationParser::parseConfigProperty (std::vector<std::string> yat::OSStream oss; oss << "Bad configuration syntax: " << *it << " - check device property"; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::parseConfigProperty")); + "ConfigurationParser::parseConfigProperty"); } // insert <key,value> in map acqKeyList.insert(CounterKey_pair_t(tokenList[0], tokenList[1])); @@ -77,7 +76,6 @@ CounterKeys_t ConfigurationParser::parseConfigProperty (std::vector<std::string> // ====================================================================== std::vector<std::string> ConfigurationParser::splitLine(std::string line, std::string separator, yat::uint16 min_token, yat::uint16 max_tokens) - throw (Tango::DevFailed) { //- result : the split line std::vector<std::string> tokenList; @@ -98,9 +96,9 @@ std::vector<std::string> ConfigurationParser::splitLine(std::string line, std::s yat::OSStream oss; oss << "Bad value: " << line << " - check device property"; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::splitLine")); + "ConfigurationParser::splitLine"); } // checks maximum expected number of tokens if not set to a null value @@ -111,9 +109,9 @@ std::vector<std::string> ConfigurationParser::splitLine(std::string line, std::s yat::OSStream oss; oss << "Bad value: " << line << " - check device property"; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::splitLine")); + "ConfigurationParser::splitLine"); } return tokenList; @@ -125,10 +123,9 @@ std::vector<std::string> ConfigurationParser::splitLine(std::string line, std::s bool ConfigurationParser::testKey(std::string line, std::string separator, std::string key) - throw (Tango::DevFailed) { bool isWrightKey = false; - std::vector<std::string> tokenList = this->splitLine(line, separator); + std::vector<std::string> tokenList = splitLine(line, separator); if (tokenList.size() != 2) { @@ -136,9 +133,9 @@ bool ConfigurationParser::testKey(std::string line, yat::OSStream oss; oss << "Bad configuration syntax: " << line << " - check device property"; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::getKeyValue")); + "ConfigurationParser::getKeyValue"); } if (0 == tokenList[0].compare(key)) @@ -154,7 +151,6 @@ bool ConfigurationParser::testKey(std::string line, // ConfigurationParser::getBoolean // ====================================================================== bool ConfigurationParser::getBoolean(std::string token) - throw (Tango::DevFailed) { bool result; yat::String ytoken(token); @@ -170,9 +166,9 @@ bool ConfigurationParser::getBoolean(std::string token) else { // bad boolean value ==> fatal error - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), - _CPTC("Bad boolean value"), - _CPTC("ConfigurationParser::parseConfigProperty")); + THROW_DEVFAILED("CONFIGURATION_ERROR", + "Bad boolean value", + "ConfigurationParser::parseConfigProperty"); } return result; @@ -182,7 +178,6 @@ bool ConfigurationParser::getBoolean(std::string token) // ConfigurationParser::extractName // ====================================================================== std::string ConfigurationParser::extractName (CounterKeys_t acq_config) - throw (Tango::DevFailed) { std::string name = ""; @@ -195,9 +190,9 @@ std::string ConfigurationParser::extractName (CounterKeys_t acq_config) oss << "Name not found in configuration - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractName")); + "ConfigurationParser::extractName"); } name = it->second; @@ -210,7 +205,6 @@ std::string ConfigurationParser::extractName (CounterKeys_t acq_config) // ConfigurationParser::extractProxy // ====================================================================== std::string ConfigurationParser::extractProxy (CounterKeys_t acq_config) - throw (Tango::DevFailed) { std::string proxy = ""; @@ -223,9 +217,9 @@ std::string ConfigurationParser::extractProxy (CounterKeys_t acq_config) oss << "Proxy not found in configuration - check device property"; INFO_STREAM << oss.str() << std::endl; return ""; - /*THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + /*THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractProxy"));*/ + "ConfigurationParser::extractProxy");*/ } proxy = it->second; @@ -238,7 +232,6 @@ std::string ConfigurationParser::extractProxy (CounterKeys_t acq_config) // ConfigurationParser::extractMode // ====================================================================== E_CounterMode_t ConfigurationParser::extractMode (CounterKeys_t acq_config) - throw (Tango::DevFailed) { E_CounterMode_t mode = UNDEFINED_COUNTER_MODE; @@ -250,9 +243,9 @@ E_CounterMode_t ConfigurationParser::extractMode (CounterKeys_t acq_config) yat::OSStream oss; oss << "Mode not found in configuration - check device property"; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractTriggerMode")); + "ConfigurationParser::extractTriggerMode"); } std::string tokenValue = it->second; @@ -279,9 +272,9 @@ E_CounterMode_t ConfigurationParser::extractMode (CounterKeys_t acq_config) yat::OSStream oss; oss << "Bad mode value: " << tokenValue << " - check device property"; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractMode")); + "ConfigurationParser::extractMode"); } return mode; @@ -291,7 +284,6 @@ E_CounterMode_t ConfigurationParser::extractMode (CounterKeys_t acq_config) // ConfigurationParser::extractFormat // ====================================================================== std::string ConfigurationParser::extractFormat (CounterKeys_t acq_config) - throw (Tango::DevFailed) { std::string format = "%f"; @@ -310,7 +302,6 @@ std::string ConfigurationParser::extractFormat (CounterKeys_t acq_config) // ConfigurationParser::extractEdge // ====================================================================== E_CountingEdge_t ConfigurationParser::extractEdge (CounterKeys_t acq_config, size_t nb) - throw (Tango::DevFailed) { E_CountingEdge_t edge; std::string key = kKEY_EDGE; @@ -326,9 +317,9 @@ E_CountingEdge_t ConfigurationParser::extractEdge (CounterKeys_t acq_config, siz yat::OSStream oss; oss << "Mising edge value: - check device property"; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractEdge")); + "ConfigurationParser::extractEdge"); } std::string tokenValue = it->second; @@ -347,9 +338,9 @@ E_CountingEdge_t ConfigurationParser::extractEdge (CounterKeys_t acq_config, siz yat::OSStream oss; oss << "Bad edge value: " << tokenValue << " - check device property"; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractEdge")); + "ConfigurationParser::extractEdge"); } DEBUG_STREAM << "Edge: " << edge << std::endl; @@ -361,7 +352,6 @@ E_CountingEdge_t ConfigurationParser::extractEdge (CounterKeys_t acq_config, siz // ConfigurationParser::extractMemoryTransfer // ====================================================================== E_MemoryTransfer_t ConfigurationParser::extractMemoryTransfer (CounterKeys_t acq_config) - throw (Tango::DevFailed) { E_MemoryTransfer_t transfer; @@ -391,9 +381,9 @@ E_MemoryTransfer_t ConfigurationParser::extractMemoryTransfer (CounterKeys_t acq yat::OSStream oss; oss << "Bad transfer value: " << tokenValue << " - check device property"; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractMemoryTransfer")); + "ConfigurationParser::extractMemoryTransfer"); } } @@ -406,7 +396,6 @@ E_MemoryTransfer_t ConfigurationParser::extractMemoryTransfer (CounterKeys_t acq // ConfigurationParser::extractDirection // ====================================================================== E_CountingDirection_t ConfigurationParser::extractDirection (CounterKeys_t acq_config) - throw (Tango::DevFailed) { E_CountingDirection_t direction; @@ -419,9 +408,9 @@ E_CountingDirection_t ConfigurationParser::extractDirection (CounterKeys_t acq_c oss << "No direction value: - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractDirection")); + "ConfigurationParser::extractDirection"); } std::string tokenValue = it->second; @@ -445,9 +434,9 @@ E_CountingDirection_t ConfigurationParser::extractDirection (CounterKeys_t acq_c oss << "Bad direction value: " << tokenValue << " - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractDirection")); + "ConfigurationParser::extractDirection"); } DEBUG_STREAM << "Direction: " << direction << std::endl; @@ -459,7 +448,6 @@ E_CountingDirection_t ConfigurationParser::extractDirection (CounterKeys_t acq_c // ConfigurationParser::extractDecodingMode // ====================================================================== E_DecodingMode_t ConfigurationParser::extractDecodingMode (CounterKeys_t acq_config) - throw (Tango::DevFailed) { E_DecodingMode_t decodingMode; @@ -472,9 +460,9 @@ E_DecodingMode_t ConfigurationParser::extractDecodingMode (CounterKeys_t acq_con oss << "No Decoding value: - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractDecodingMode")); + "ConfigurationParser::extractDecodingMode"); } std::string tokenValue = it->second; @@ -502,9 +490,9 @@ E_DecodingMode_t ConfigurationParser::extractDecodingMode (CounterKeys_t acq_con oss << "Bad decoding mode value: " << tokenValue << " - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractDecodingMode")); + "ConfigurationParser::extractDecodingMode"); } DEBUG_STREAM << "Decoding mode: " << decodingMode << std::endl; @@ -516,7 +504,6 @@ E_DecodingMode_t ConfigurationParser::extractDecodingMode (CounterKeys_t acq_con // ConfigurationParser::extractZIndexPhase // ====================================================================== E_ZIndexPhase_t ConfigurationParser::extractZIndexPhase (CounterKeys_t acq_config) - throw (Tango::DevFailed) { E_ZIndexPhase_t zIndexPhase; @@ -529,9 +516,9 @@ E_ZIndexPhase_t ConfigurationParser::extractZIndexPhase (CounterKeys_t acq_confi oss << "No ZIndexPhase value: - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractZIndexPhase")); + "ConfigurationParser::extractZIndexPhase"); } std::string tokenValue = it->second; @@ -559,9 +546,9 @@ E_ZIndexPhase_t ConfigurationParser::extractZIndexPhase (CounterKeys_t acq_confi oss << "Bad Z Index Phase value: " << tokenValue << " - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractZIndexPhase")); + "ConfigurationParser::extractZIndexPhase"); } DEBUG_STREAM << "Z Index Phase: " << zIndexPhase << std::endl; @@ -573,7 +560,6 @@ E_ZIndexPhase_t ConfigurationParser::extractZIndexPhase (CounterKeys_t acq_confi // ConfigurationParser::extractEncoderMode // ====================================================================== E_EncoderMode_t ConfigurationParser::extractEncoderMode (CounterKeys_t acq_config) - throw (Tango::DevFailed) { E_EncoderMode_t encoderMode; @@ -586,9 +572,9 @@ E_EncoderMode_t ConfigurationParser::extractEncoderMode (CounterKeys_t acq_confi oss << "No EcoderMode value: - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractDecodingMode")); + "ConfigurationParser::extractDecodingMode"); } std::string tokenValue = it->second; @@ -608,9 +594,9 @@ E_EncoderMode_t ConfigurationParser::extractEncoderMode (CounterKeys_t acq_confi oss << "Bad encoder mode value: " << tokenValue << " - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractDecodingMode")); + "ConfigurationParser::extractDecodingMode"); } DEBUG_STREAM << "Encoder mode: " << encoderMode << std::endl; @@ -622,7 +608,6 @@ E_EncoderMode_t ConfigurationParser::extractEncoderMode (CounterKeys_t acq_confi // ConfigurationParser::extractUnitStr // ====================================================================== std::string ConfigurationParser::extractUnitStr (CounterKeys_t acq_config) - throw (Tango::DevFailed) { std::string unitStr; @@ -635,9 +620,9 @@ std::string ConfigurationParser::extractUnitStr (CounterKeys_t acq_config) oss << "No Unit value: - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractUnit")); + "ConfigurationParser::extractUnit"); } unitStr = it->second; @@ -649,7 +634,6 @@ std::string ConfigurationParser::extractUnitStr (CounterKeys_t acq_config) // ConfigurationParser::extractUnit // ====================================================================== E_EncoderUnit_t ConfigurationParser::extractUnit (CounterKeys_t acq_config) - throw (Tango::DevFailed) { E_EncoderUnit_t unit; @@ -662,9 +646,9 @@ E_EncoderUnit_t ConfigurationParser::extractUnit (CounterKeys_t acq_config) oss << "No Unit value: - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractUnit")); + "ConfigurationParser::extractUnit"); } std::string tokenValue = it->second; @@ -700,9 +684,9 @@ E_EncoderUnit_t ConfigurationParser::extractUnit (CounterKeys_t acq_config) oss << "Bad unit value: " << tokenValue << " - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractUnit")); + "ConfigurationParser::extractUnit"); } DEBUG_STREAM << "Unit: " << unit << std::endl; @@ -714,7 +698,6 @@ E_EncoderUnit_t ConfigurationParser::extractUnit (CounterKeys_t acq_config) // ConfigurationParser::extractZIndexValue // ====================================================================== yat::uint32 ConfigurationParser::extractZIndexValue (CounterKeys_t acq_config) - throw (Tango::DevFailed) { yat::uint32 zval = 0; @@ -738,9 +721,9 @@ yat::uint32 ConfigurationParser::extractZIndexValue (CounterKeys_t acq_config) yat::OSStream oss; oss << "Bad ZIndexValue value: " << it->second << " - check device property"; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractZIndexValue")); + "ConfigurationParser::extractZIndexValue"); } } @@ -753,7 +736,6 @@ yat::uint32 ConfigurationParser::extractZIndexValue (CounterKeys_t acq_config) // ConfigurationParser::extractDistPerPulse // ====================================================================== double ConfigurationParser::extractDistPerPulse (CounterKeys_t acq_config) - throw (Tango::DevFailed) { double val = 0; @@ -767,9 +749,9 @@ double ConfigurationParser::extractDistPerPulse (CounterKeys_t acq_config) oss << "DistPerPulse value not found in configuration - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractDistPerPulse")); + "ConfigurationParser::extractDistPerPulse"); } else { @@ -785,9 +767,9 @@ double ConfigurationParser::extractDistPerPulse (CounterKeys_t acq_config) oss << "Bad DistPerPulse value: " << it->second << " - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractDistPerPulse")); + "ConfigurationParser::extractDistPerPulse"); } } @@ -800,7 +782,6 @@ double ConfigurationParser::extractDistPerPulse (CounterKeys_t acq_config) // ConfigurationParser::extractPulsePerRev // ====================================================================== yat::uint32 ConfigurationParser::extractPulsePerRev (CounterKeys_t acq_config) - throw (Tango::DevFailed) { yat::uint32 val = 0; @@ -814,9 +795,9 @@ yat::uint32 ConfigurationParser::extractPulsePerRev (CounterKeys_t acq_config) oss << "PulsePerRev value not found in configuration - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractPulsePerRev")); + "ConfigurationParser::extractPulsePerRev"); } else { @@ -832,9 +813,9 @@ yat::uint32 ConfigurationParser::extractPulsePerRev (CounterKeys_t acq_config) oss << "Bad PulsePerRev value: " << it->second << " - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractPulsePerRev")); + "ConfigurationParser::extractPulsePerRev"); } } @@ -847,7 +828,6 @@ yat::uint32 ConfigurationParser::extractPulsePerRev (CounterKeys_t acq_config) // ConfigurationParser::extractZIndexEnabled // ====================================================================== bool ConfigurationParser::extractZIndexEnabled (CounterKeys_t acq_config) - throw (Tango::DevFailed) { bool enabled; @@ -863,7 +843,7 @@ bool ConfigurationParser::extractZIndexEnabled (CounterKeys_t acq_config) { try { - enabled = this->getBoolean(it->second); + enabled = getBoolean(it->second); } catch(Tango::DevFailed & df) { @@ -871,9 +851,9 @@ bool ConfigurationParser::extractZIndexEnabled (CounterKeys_t acq_config) yat::OSStream oss; oss << "Bad value for ZIndexEnabled property: " << it->second << " - check device property"; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), + THROW_DEVFAILED("CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractZIndexEnabled")); + "ConfigurationParser::extractZIndexEnabled"); } } @@ -884,7 +864,6 @@ bool ConfigurationParser::extractZIndexEnabled (CounterKeys_t acq_config) // ConfigurationParser::extractNexus // ====================================================================== bool ConfigurationParser::extractNexus (CounterKeys_t acq_config) - throw (Tango::DevFailed) { bool enabled; @@ -900,7 +879,7 @@ bool ConfigurationParser::extractNexus (CounterKeys_t acq_config) { try { - enabled = this->getBoolean(it->second); + enabled = getBoolean(it->second); } catch(Tango::DevFailed & df) { @@ -909,9 +888,9 @@ bool ConfigurationParser::extractNexus (CounterKeys_t acq_config) oss << "Bad value for Nexus property: " << it->second << " - check device property"; ERROR_STREAM << oss.str() << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("ConfigurationParser::extractNexus")); + "ConfigurationParser::extractNexus"); } } diff --git a/src/ConfigurationParser.h b/src/ConfigurationParser.h index 6dbe1aab33841ffff3265530f64e63672e3209c3..26a3d93fe724ec84ab000941602e69e1a5eaffa7 100755 --- a/src/ConfigurationParser.h +++ b/src/ConfigurationParser.h @@ -96,98 +96,77 @@ public: //- <key,value> defining the acquisition. //- For channel definition, the method adds the number of the channel //- (in definition order) to make a unique key. - CounterKeys_t parseConfigProperty (std::vector<std::string> config_property) - throw (Tango::DevFailed); + CounterKeys_t parseConfigProperty (std::vector<std::string> config_property); //- Extracts name from counter definition. - std::string extractName (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + std::string extractName (CounterKeys_t ctr_config); //- Extracts proxy from counter definition. - std::string extractProxy (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + std::string extractProxy (CounterKeys_t ctr_config); //- Extracts mode from counter definition. - E_CounterMode_t extractMode (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + E_CounterMode_t extractMode (CounterKeys_t ctr_config); //- Extracts mode from counter definition. - std::string extractFormat (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + std::string extractFormat (CounterKeys_t ctr_config); //- Extracts edge from counter definition. //- @param nb edge number: 1st (1) or 2nd (2) - E_CountingEdge_t extractEdge (CounterKeys_t ctr_config, size_t nb = 1) - throw (Tango::DevFailed); + E_CountingEdge_t extractEdge (CounterKeys_t ctr_config, size_t nb = 1); //- Extracts memory transfer from counter definition. - E_MemoryTransfer_t extractMemoryTransfer (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + E_MemoryTransfer_t extractMemoryTransfer (CounterKeys_t ctr_config); //- Extracts direction from counter definition. - E_CountingDirection_t extractDirection (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + E_CountingDirection_t extractDirection (CounterKeys_t ctr_config); //- Extracts decoding mode from counter definition. - E_DecodingMode_t extractDecodingMode (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + E_DecodingMode_t extractDecodingMode (CounterKeys_t ctr_config); //- Extracts ZIndexPhase mode from counter definition. - E_ZIndexPhase_t extractZIndexPhase (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + E_ZIndexPhase_t extractZIndexPhase (CounterKeys_t ctr_config); //- Extracts encoder mode from counter definition. - E_EncoderMode_t extractEncoderMode (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + E_EncoderMode_t extractEncoderMode (CounterKeys_t ctr_config); //- Extracts unit from counter definition. - E_EncoderUnit_t extractUnit (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + E_EncoderUnit_t extractUnit (CounterKeys_t ctr_config); //- Extracts unit string from counter definition. - std::string extractUnitStr (CounterKeys_t acq_config) - throw (Tango::DevFailed); + std::string extractUnitStr (CounterKeys_t acq_config); //- Extracts z index value from counter definition. - yat::uint32 extractZIndexValue (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + yat::uint32 extractZIndexValue (CounterKeys_t ctr_config); //- Extracts dist per pulse from counter definition. - double extractDistPerPulse (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + double extractDistPerPulse (CounterKeys_t ctr_config); //- Extracts pulse per revolution from counter definition. - yat::uint32 extractPulsePerRev (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + yat::uint32 extractPulsePerRev (CounterKeys_t ctr_config); //- Extracts z index enabled from counter definition. - bool extractZIndexEnabled (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + bool extractZIndexEnabled (CounterKeys_t ctr_config); //- Extracts nexus from counter definition. //- OBSOLETE function - to be deleted in NEXT version - - bool extractNexus (CounterKeys_t ctr_config) - throw (Tango::DevFailed); + bool extractNexus (CounterKeys_t ctr_config); private: //- Splits a line using the specifed separator and returns the //- result in a string vector. //- Checks expected minimum & maximum number of tokens if not null. std::vector<std::string> splitLine(std::string line, std::string separator, - yat::uint16 min_token = 0, yat::uint16 max_token = 0) - throw (Tango::DevFailed); + yat::uint16 min_token = 0, yat::uint16 max_token = 0); //- Gets {key,value} from line using the specified separator and tells if //- the key word equals the specified key - bool testKey(std::string line, std::string separator, std::string key) - throw (Tango::DevFailed); + bool testKey(std::string line, std::string separator, std::string key); //- Tells if token is "true" or "false". //- Sends exception if neither one of those strings. //- Not case sensitive. - bool getBoolean(std::string token) - throw (Tango::DevFailed); - + bool getBoolean(std::string token); + }; } // namespace PulseCounting_ns diff --git a/src/CounterFactory.cpp b/src/CounterFactory.cpp old mode 100644 new mode 100755 index e555c5c937e685082fb6f62988415689617f0784..14df55a8306a49b86a575b8c58ea1f9abb84f0d8 --- a/src/CounterFactory.cpp +++ b/src/CounterFactory.cpp @@ -23,7 +23,6 @@ namespace PulseCounting_ns // CounterFactory::instanciate // ====================================================================== GenericCounterInterface * CounterFactory::instanciate (Tango::DeviceImpl * hostDevice, CounterConfig p_ctr_cfg, E_AcquisitionMode_t p_acq_mode, CountingBoardInterface * p_board) - throw (Tango::DevFailed) { GenericCounterInterface * l_counter; diff --git a/src/CounterFactory.h b/src/CounterFactory.h old mode 100644 new mode 100755 index 3f7a196eb0c3abae522f63083f4ebe0e05302d06..ecbbc308d6c3c86c7a072220d5ec28130df38909 --- a/src/CounterFactory.h +++ b/src/CounterFactory.h @@ -24,9 +24,8 @@ class CounterFactory { public: //- instanciate a specialized GenericCounterInterface - static GenericCounterInterface * instanciate (Tango::DeviceImpl * hostDevice, CounterConfig p_ctr_cfg, E_AcquisitionMode_t p_acq_mode, CountingBoardInterface * p_board) - throw (Tango::DevFailed); - + static GenericCounterInterface * instanciate (Tango::DeviceImpl * hostDevice, CounterConfig p_ctr_cfg, E_AcquisitionMode_t p_acq_mode, CountingBoardInterface * p_board); + private: CounterFactory (); ~CounterFactory (); diff --git a/src/CountingBoardFactory.cpp b/src/CountingBoardFactory.cpp old mode 100644 new mode 100755 index 8484bbf3c8d9d4bea4fba23d3ef3a28625c9eafb..8fb82343379a764b17500d6a1e6b2714d3244b1a --- a/src/CountingBoardFactory.cpp +++ b/src/CountingBoardFactory.cpp @@ -24,7 +24,6 @@ CountingBoardInterface * CountingBoardFactory::instanciate ( E_BoardType_t p_board, E_AcquisitionMode_t p_acqMode, NexusManager * p_storage) - throw (Tango::DevFailed) { CountingBoardInterface * l_board; diff --git a/src/CountingBoardFactory.h b/src/CountingBoardFactory.h old mode 100644 new mode 100755 index 84891b02757340c740b53ee9bfd6505325d7c9e7..51d3b261eb3e89160a2728463b9881da43cdb8e0 --- a/src/CountingBoardFactory.h +++ b/src/CountingBoardFactory.h @@ -25,9 +25,8 @@ class CountingBoardFactory public: //- instanciate a specialized CountingBoard static CountingBoardInterface * instanciate (Tango::DeviceImpl * hostDevice, - E_BoardType_t p_board, E_AcquisitionMode_t p_acqMode, NexusManager * p_storage) - throw (Tango::DevFailed); - + E_BoardType_t p_board, E_AcquisitionMode_t p_acqMode, NexusManager * p_storage); + private: CountingBoardFactory (); ~CountingBoardFactory (); diff --git a/src/CountingBoardInterface.h b/src/CountingBoardInterface.h old mode 100644 new mode 100755 index 7b592828cf969d72d71d4d89b1b40b89809db0ee..1d204dc2b9655d0c7bdc1d13d0e194477a36246a --- a/src/CountingBoardInterface.h +++ b/src/CountingBoardInterface.h @@ -44,48 +44,37 @@ public: virtual ~CountingBoardInterface (){}; //- init counter - virtual void initCounter(CounterConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual void initCounter(CounterConfig p_cfg) = 0; //- init clock - virtual void initClock(ClockConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual void initClock(ClockConfig p_cfg) = 0; //- configure counter - virtual void configureCounter(CounterConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual void configureCounter(CounterConfig p_cfg) = 0; //- start counter - virtual void startCounter(CounterConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual void startCounter(CounterConfig p_cfg) = 0; //- stop counter - virtual void stopCounter(CounterConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual void stopCounter(CounterConfig p_cfg) = 0; //- start clock - virtual void startClock() - throw (Tango::DevFailed) = 0; + virtual void startClock() = 0; //- abort clock - virtual void abortClock() - throw (Tango::DevFailed) = 0; + virtual void abortClock() = 0; //- wait end of clock - virtual void waitEndOfClock() - throw (Tango::DevFailed) = 0; + virtual void waitEndOfClock() = 0; //- delete counter object - virtual void releaseCounter(CounterConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual void releaseCounter(CounterConfig p_cfg) = 0; //- delete clock object - virtual void releaseClock() - throw (Tango::DevFailed) = 0; + virtual void releaseClock() = 0; //- getDriverVersion - virtual std::string getDriverVersion() - throw (Tango::DevFailed) = 0; + virtual std::string getDriverVersion() = 0; //- get max counter number virtual unsigned int getMaxCounterNumber() = 0; @@ -115,20 +104,16 @@ public: virtual Tango::DevState getCounterState(CounterConfig p_cfg) = 0; //- get counter scalar value - virtual data_t getCounterScalarValue(CounterConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual data_t getCounterScalarValue(CounterConfig p_cfg) = 0; //- get counter Buffer value - virtual RawData_t & getCounterBufferValue(CounterConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual RawData_t & getCounterBufferValue(CounterConfig p_cfg) = 0; //- update counter Buffer value (used in "polling" mode) - virtual void updateCounterBufferValue(CounterConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual void updateCounterBufferValue(CounterConfig p_cfg) = 0; //- update last counter Buffer value (used with trigger listener option) - virtual void updateCounterLastBufferValue(CounterConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual void updateCounterLastBufferValue(CounterConfig p_cfg) = 0; protected: // acquisition mode diff --git a/src/DeltaTimeCounter.cpp b/src/DeltaTimeCounter.cpp old mode 100644 new mode 100755 index b1973d6801267352bac8216d7bc2a8367a91e42e..f4d3ba24d77c4c8696d8182017fc5f642eddff43 --- a/src/DeltaTimeCounter.cpp +++ b/src/DeltaTimeCounter.cpp @@ -21,9 +21,9 @@ namespace PulseCounting_ns do \ { \ if (! m_interface) \ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("request aborted - the interface isn't accessible "), \ - _CPTC("DeltaTimeCounter::check_interface")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the interface isn't accessible ", \ + "DeltaTimeCounter::check_interface"); \ } while (0) @@ -54,7 +54,7 @@ DeltaTimeCounter::~DeltaTimeCounter () bool DeltaTimeCounter::is_available() { // cannot use counter 0 with DT counter (does not count...) - if (this->m_cfg.number == 0) + if (m_cfg.number == 0) m_is_available = false; return m_is_available; @@ -64,7 +64,6 @@ bool DeltaTimeCounter::is_available() // DeltaTimeCounter::init () // ============================================================================ void DeltaTimeCounter::init(CounterConfig p_cfg) - throw (Tango::DevFailed) { m_cfg = p_cfg; @@ -78,17 +77,17 @@ void DeltaTimeCounter::init(CounterConfig p_cfg) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to initialize dt counter!"), - _CPTC("DeltaTimeCounter::init")); + "DEVICE_ERROR", + "Failed to initialize dt counter!", + "DeltaTimeCounter::init"); } catch (...) { ERROR_STREAM << "Failed to initialize dt counter!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to initialize dt counter!"), - _CPTC("DeltaTimeCounter::init")); + "DEVICE_ERROR", + "Failed to initialize dt counter!", + "DeltaTimeCounter::init"); } } @@ -96,7 +95,6 @@ void DeltaTimeCounter::init(CounterConfig p_cfg) // DeltaTimeCounter::configure () // ============================================================================ void DeltaTimeCounter::configure(CounterConfig p_cfg) - throw (Tango::DevFailed) { m_cfg = p_cfg; @@ -110,17 +108,17 @@ void DeltaTimeCounter::configure(CounterConfig p_cfg) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to configure dt counter!"), - _CPTC("DeltaTimeCounter::configure")); + "DEVICE_ERROR", + "Failed to configure dt counter!", + "DeltaTimeCounter::configure"); } catch (...) { ERROR_STREAM << "Failed to configure dt counter!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to configure dt counter!"), - _CPTC("DeltaTimeCounter::configure")); + "DEVICE_ERROR", + "Failed to configure dt counter!", + "DeltaTimeCounter::configure"); } } @@ -128,7 +126,6 @@ void DeltaTimeCounter::configure(CounterConfig p_cfg) // DeltaTimeCounter::start () // ============================================================================ void DeltaTimeCounter::start() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -140,17 +137,17 @@ void DeltaTimeCounter::start() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start dt counter"), - _CPTC("DeltaTimeCounter::start")); + "DEVICE_ERROR", + "Failed to start dt counter", + "DeltaTimeCounter::start"); } catch (...) { ERROR_STREAM << "Failed to start dt counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start dt counter"), - _CPTC("DeltaTimeCounter::start")); + "DEVICE_ERROR", + "Failed to start dt counter", + "DeltaTimeCounter::start"); } m_state = Tango::RUNNING; } @@ -159,7 +156,6 @@ void DeltaTimeCounter::start() // DeltaTimeCounter::stop () // ============================================================================ void DeltaTimeCounter::stop() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -171,17 +167,17 @@ void DeltaTimeCounter::stop() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to stop dt counter"), - _CPTC("DeltaTimeCounter::stop")); + "DEVICE_ERROR", + "Failed to stop dt counter", + "DeltaTimeCounter::stop"); } catch (...) { ERROR_STREAM << "Failed to stop dt counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to stop dt counter"), - _CPTC("DeltaTimeCounter::stop")); + "DEVICE_ERROR", + "Failed to stop dt counter", + "DeltaTimeCounter::stop"); } m_state = Tango::STANDBY; } @@ -190,7 +186,6 @@ void DeltaTimeCounter::stop() // DeltaTimeCounter::get_state () // ============================================================================ Tango::DevState DeltaTimeCounter::get_state() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -202,17 +197,17 @@ Tango::DevState DeltaTimeCounter::get_state() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get dt counter state!"), - _CPTC("DeltaTimeCounter::get_state")); + "DEVICE_ERROR", + "Failed to get dt counter state!", + "DeltaTimeCounter::get_state"); } catch (...) { ERROR_STREAM << "Failed to get dt counter state!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get dt counter state!"), - _CPTC("DeltaTimeCounter::get_state")); + "DEVICE_ERROR", + "Failed to get dt counter state!", + "DeltaTimeCounter::get_state"); } } @@ -220,30 +215,29 @@ Tango::DevState DeltaTimeCounter::get_state() // DeltaTimeCounter::update_scalar_value () // ============================================================================ void DeltaTimeCounter::update_scalar_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); try { - yat::AutoMutex<> guard(this->m_dataLock); + yat::AutoMutex<> guard(m_dataLock); m_value = m_interface->getCounterScalarValue(m_cfg); } catch (Tango::DevFailed &e) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update scalar dt counter value!"), - _CPTC("DeltaTimeCounter::update_scalar_value")); + "DEVICE_ERROR", + "Failed to update scalar dt counter value!", + "DeltaTimeCounter::update_scalar_value"); } catch (...) { ERROR_STREAM << "Failed to update scalar dt counter value!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update scalar dt counter value!"), - _CPTC("DeltaTimeCounter::update_scalar_value")); + "DEVICE_ERROR", + "Failed to update scalar dt counter value!", + "DeltaTimeCounter::update_scalar_value"); } } @@ -251,7 +245,6 @@ void DeltaTimeCounter::update_scalar_value() // DeltaTimeCounter::update_buffer_value () // ============================================================================ void DeltaTimeCounter::update_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -263,17 +256,17 @@ void DeltaTimeCounter::update_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update buffer dt counter value!"), - _CPTC("DeltaTimeCounter::update_buffer_value")); + "DEVICE_ERROR", + "Failed to update buffer dt counter value!", + "DeltaTimeCounter::update_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to update buffer dt counter value!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update buffer dt counter value!"), - _CPTC("DeltaTimeCounter::update_buffer_value")); + "DEVICE_ERROR", + "Failed to update buffer dt counter value!", + "DeltaTimeCounter::update_buffer_value"); } } @@ -282,7 +275,7 @@ void DeltaTimeCounter::update_buffer_value() // ============================================================================ data_t DeltaTimeCounter::get_scalar_value() { - yat::AutoMutex<> guard(this->m_dataLock); + yat::AutoMutex<> guard(m_dataLock); return m_value; } @@ -290,7 +283,6 @@ data_t DeltaTimeCounter::get_scalar_value() // DeltaTimeCounter::get_buffer_value () // ============================================================================ RawData_t DeltaTimeCounter::get_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -302,17 +294,17 @@ RawData_t DeltaTimeCounter::get_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get dt counter buffer value"), - _CPTC("DeltaTimeCounter::get_buffer_value")); + "DEVICE_ERROR", + "Failed to get dt counter buffer value", + "DeltaTimeCounter::get_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to get dt counter buffer value" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get dt counter buffer value"), - _CPTC("DeltaTimeCounter::get_buffer_value")); + "DEVICE_ERROR", + "Failed to get dt counter buffer value", + "DeltaTimeCounter::get_buffer_value"); } } @@ -336,7 +328,6 @@ CounterConfig DeltaTimeCounter::get_config() // DeltaTimeCounter::deleteObject () // ============================================================================ void DeltaTimeCounter::deleteObject() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -353,7 +344,6 @@ void DeltaTimeCounter::deleteObject() // DeltaTimeCounter::update_last_buffer_value () // ============================================================================ void DeltaTimeCounter::update_last_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -365,17 +355,17 @@ void DeltaTimeCounter::update_last_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update last buffer dt counter value!"), - _CPTC("DeltaTimeCounter::update_last_buffer_value")); + "DEVICE_ERROR", + "Failed to update last buffer dt counter value!", + "DeltaTimeCounter::update_last_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to update last buffer dt counter value!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update last buffer dt counter value!"), - _CPTC("DeltaTimeCounter::update_last_buffer_value")); + "DEVICE_ERROR", + "Failed to update last buffer dt counter value!", + "DeltaTimeCounter::update_last_buffer_value"); } } diff --git a/src/DeltaTimeCounter.h b/src/DeltaTimeCounter.h old mode 100644 new mode 100755 index 0eec35263435b7fe36cd84e6661d434a30764fb2..de5ff26097ccd93413feacd5905a78a605922829 --- a/src/DeltaTimeCounter.h +++ b/src/DeltaTimeCounter.h @@ -37,55 +37,43 @@ public: bool is_available(); //- init - void init(CounterConfig p_cfg) - throw (Tango::DevFailed); + void init(CounterConfig p_cfg); //- configure - void configure(CounterConfig p_cfg) - throw (Tango::DevFailed); + void configure(CounterConfig p_cfg); //- start - void start() - throw (Tango::DevFailed); + void start(); //- stop - void stop() - throw (Tango::DevFailed); + void stop(); //- release counter - void deleteObject() - throw (Tango::DevFailed); + void deleteObject(); //- get State - Tango::DevState get_state() - throw (Tango::DevFailed); + Tango::DevState get_state(); //- update scalar value - void update_scalar_value() - throw (Tango::DevFailed); + void update_scalar_value(); //- update buffer value (used in "polling" mode) - void update_buffer_value() - throw (Tango::DevFailed); + void update_buffer_value(); //- force last incomplete buffer update (used with trigger listener option) - void update_last_buffer_value() - throw (Tango::DevFailed); + void update_last_buffer_value(); //- get scalar value data_t get_scalar_value(); //- get buffer value - RawData_t get_buffer_value() - throw (Tango::DevFailed); + RawData_t get_buffer_value(); //- get name - std::string get_name() - throw (Tango::DevFailed); + std::string get_name(); //- get config - CounterConfig get_config() - throw (Tango::DevFailed); + CounterConfig get_config(); protected: }; diff --git a/src/EventCounter.cpp b/src/EventCounter.cpp old mode 100644 new mode 100755 index ed87886a905b70b600109b1fcf2db2b76fb37c7c..3f248acf448db3558d6b9ea42600fa5a2ef34c7c --- a/src/EventCounter.cpp +++ b/src/EventCounter.cpp @@ -21,9 +21,9 @@ namespace PulseCounting_ns do \ { \ if (! m_interface) \ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("request aborted - the interface isn't accessible "), \ - _CPTC("EventCounter::check_interface")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the interface isn't accessible ", \ + "EventCounter::check_interface"); \ } while (0) @@ -64,7 +64,6 @@ bool EventCounter::is_available() // EventCounter::init () // ============================================================================ void EventCounter::init(CounterConfig p_cfg) - throw (Tango::DevFailed) { m_cfg = p_cfg; @@ -78,17 +77,17 @@ void EventCounter::init(CounterConfig p_cfg) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to initialize evt counter!"), - _CPTC("EventCounter::init")); + "DEVICE_ERROR", + "Failed to initialize evt counter!", + "EventCounter::init"); } catch (...) { ERROR_STREAM << "Failed to initialize evt counter!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to initialize evt counter!"), - _CPTC("EventCounter::init")); + "DEVICE_ERROR", + "Failed to initialize evt counter!", + "EventCounter::init"); } } @@ -96,7 +95,6 @@ void EventCounter::init(CounterConfig p_cfg) // EventCounter::configure () // ============================================================================ void EventCounter::configure(CounterConfig p_cfg) - throw (Tango::DevFailed) { m_cfg = p_cfg; @@ -110,17 +108,17 @@ void EventCounter::configure(CounterConfig p_cfg) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to configure evt counter!"), - _CPTC("EventCounter::configure")); + "DEVICE_ERROR", + "Failed to configure evt counter!", + "EventCounter::configure"); } catch (...) { ERROR_STREAM << "Failed to configure evt counter!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to configure evt counter!"), - _CPTC("EventCounter::configure")); + "DEVICE_ERROR", + "Failed to configure evt counter!", + "EventCounter::configure"); } } @@ -128,7 +126,6 @@ void EventCounter::configure(CounterConfig p_cfg) // EventCounter::start () // ============================================================================ void EventCounter::start() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -140,17 +137,17 @@ void EventCounter::start() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start evt counter"), - _CPTC("EventCounter::start")); + "DEVICE_ERROR", + "Failed to start evt counter", + "EventCounter::start"); } catch (...) { ERROR_STREAM << "Failed to start evt counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start evt counter"), - _CPTC("EventCounter::start")); + "DEVICE_ERROR", + "Failed to start evt counter", + "EventCounter::start"); } m_state = Tango::RUNNING; } @@ -159,7 +156,6 @@ void EventCounter::start() // EventCounter::stop () // ============================================================================ void EventCounter::stop() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -171,17 +167,17 @@ void EventCounter::stop() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to stop evt counter"), - _CPTC("EventCounter::stop")); + "DEVICE_ERROR", + "Failed to stop evt counter", + "EventCounter::stop"); } catch (...) { ERROR_STREAM << "Failed to stop evt counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to stop evt counter"), - _CPTC("EventCounter::stop")); + "DEVICE_ERROR", + "Failed to stop evt counter", + "EventCounter::stop"); } m_state = Tango::STANDBY; } @@ -190,7 +186,6 @@ void EventCounter::stop() // EventCounter::get_state () // ============================================================================ Tango::DevState EventCounter::get_state() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -202,17 +197,17 @@ Tango::DevState EventCounter::get_state() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get evt counter state!"), - _CPTC("EventCounter::get_state")); + "DEVICE_ERROR", + "Failed to get evt counter state!", + "EventCounter::get_state"); } catch (...) { ERROR_STREAM << "Failed to get evt counter state!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get evt counter state!"), - _CPTC("EventCounter::get_state")); + "DEVICE_ERROR", + "Failed to get evt counter state!", + "EventCounter::get_state"); } } @@ -220,30 +215,29 @@ Tango::DevState EventCounter::get_state() // EventCounter::update_scalar_value () // ============================================================================ void EventCounter::update_scalar_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); try { - yat::AutoMutex<> guard(this->m_dataLock); + yat::AutoMutex<> guard(m_dataLock); m_value = m_interface->getCounterScalarValue(m_cfg); } catch (Tango::DevFailed &e) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update scalar evt counter value!"), - _CPTC("EventCounter::update_scalar_value")); + "DEVICE_ERROR", + "Failed to update scalar evt counter value!", + "EventCounter::update_scalar_value"); } catch (...) { ERROR_STREAM << "Failed to update scalar evt counter value!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update scalar evt counter value!"), - _CPTC("EventCounter::update_scalar_value")); + "DEVICE_ERROR", + "Failed to update scalar evt counter value!", + "EventCounter::update_scalar_value"); } } @@ -251,7 +245,6 @@ void EventCounter::update_scalar_value() // EventCounter::update_buffer_value () // ============================================================================ void EventCounter::update_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -263,17 +256,17 @@ void EventCounter::update_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update buffer evt counter value!"), - _CPTC("EventCounter::update_buffer_value")); + "DEVICE_ERROR", + "Failed to update buffer evt counter value!", + "EventCounter::update_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to update buffer evt counter value!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update buffer evt counter value!"), - _CPTC("EventCounter::update_buffer_value")); + "DEVICE_ERROR", + "Failed to update buffer evt counter value!", + "EventCounter::update_buffer_value"); } } @@ -282,7 +275,7 @@ void EventCounter::update_buffer_value() // ============================================================================ data_t EventCounter::get_scalar_value() { - yat::AutoMutex<> guard(this->m_dataLock); + yat::AutoMutex<> guard(m_dataLock); return m_value; } @@ -290,7 +283,6 @@ data_t EventCounter::get_scalar_value() // EventCounter::get_buffer_value () // ============================================================================ RawData_t EventCounter::get_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -302,17 +294,17 @@ RawData_t EventCounter::get_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get evt counter buffer value"), - _CPTC("EventCounter::get_buffer_value")); + "DEVICE_ERROR", + "Failed to get evt counter buffer value", + "EventCounter::get_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to get evt counter buffer value" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get evt counter buffer value"), - _CPTC("EventCounter::get_buffer_value")); + "DEVICE_ERROR", + "Failed to get evt counter buffer value", + "EventCounter::get_buffer_value"); } } @@ -336,7 +328,6 @@ CounterConfig EventCounter::get_config() // EventCounter::deleteObject () // ============================================================================ void EventCounter::deleteObject() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -353,7 +344,6 @@ void EventCounter::deleteObject() // EventCounter::update_last_buffer_value () // ============================================================================ void EventCounter::update_last_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -365,17 +355,17 @@ void EventCounter::update_last_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update last buffer dt counter value!"), - _CPTC("EventCounter::update_last_buffer_value")); + "DEVICE_ERROR", + "Failed to update last buffer dt counter value!", + "EventCounter::update_last_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to update last buffer dt counter value!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update last buffer dt counter value!"), - _CPTC("EventCounter::update_last_buffer_value")); + "DEVICE_ERROR", + "Failed to update last buffer dt counter value!", + "EventCounter::update_last_buffer_value"); } } diff --git a/src/EventCounter.h b/src/EventCounter.h old mode 100644 new mode 100755 index 23911bfd41bbbb38be49e1f8761836043988818e..bd71b3e7469c5f61390e13c53e2999a60b005557 --- a/src/EventCounter.h +++ b/src/EventCounter.h @@ -37,55 +37,43 @@ public: bool is_available(); //- init - void init(CounterConfig p_cfg) - throw (Tango::DevFailed); + void init(CounterConfig p_cfg); //- configure - void configure(CounterConfig p_cfg) - throw (Tango::DevFailed); + void configure(CounterConfig p_cfg); //- start - void start() - throw (Tango::DevFailed); + void start(); //- stop - void stop() - throw (Tango::DevFailed); + void stop(); //- release counter - void deleteObject() - throw (Tango::DevFailed); + void deleteObject(); //- get State - Tango::DevState get_state() - throw (Tango::DevFailed); + Tango::DevState get_state(); //- update scalar value - void update_scalar_value() - throw (Tango::DevFailed); + void update_scalar_value(); //- update buffer value (used in "polling" mode) - void update_buffer_value() - throw (Tango::DevFailed); + void update_buffer_value(); //- force last incomplete buffer update (used with trigger listener option) - void update_last_buffer_value() - throw (Tango::DevFailed); + void update_last_buffer_value(); //- get scalar value data_t get_scalar_value(); //- get buffer value - RawData_t get_buffer_value() - throw (Tango::DevFailed); + RawData_t get_buffer_value(); //- get name - std::string get_name() - throw (Tango::DevFailed); + std::string get_name(); //- get config - CounterConfig get_config() - throw (Tango::DevFailed); + CounterConfig get_config(); protected: }; diff --git a/src/GenericCounterInterface.h b/src/GenericCounterInterface.h old mode 100644 new mode 100755 index 2492961799119bd6e7033a2ed4ebfe9ef2726858..0a19ede90b4d19af1a9e9c7328c07d3f6dc75325 --- a/src/GenericCounterInterface.h +++ b/src/GenericCounterInterface.h @@ -37,54 +37,43 @@ public: virtual ~GenericCounterInterface (){}; //- init - virtual void init(CounterConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual void init(CounterConfig p_cfg) = 0; //- configure - virtual void configure(CounterConfig p_cfg) - throw (Tango::DevFailed) = 0; + virtual void configure(CounterConfig p_cfg) = 0; //- start - virtual void start() - throw (Tango::DevFailed) = 0; + virtual void start() = 0; //- stop - virtual void stop() - throw (Tango::DevFailed) = 0; + virtual void stop() = 0; //- delete counter object - virtual void deleteObject() - throw (Tango::DevFailed) = 0; + virtual void deleteObject() = 0; //- is available? virtual bool is_available() = 0; //- get state - virtual Tango::DevState get_state() - throw (Tango::DevFailed) = 0; + virtual Tango::DevState get_state() = 0; //- update scalar value - virtual void update_scalar_value() - throw (Tango::DevFailed) = 0; + virtual void update_scalar_value() = 0; //- update buffer value - virtual void update_buffer_value() - throw (Tango::DevFailed) = 0; + virtual void update_buffer_value() = 0; //- force last incomplete buffer update - virtual void update_last_buffer_value() - throw (Tango::DevFailed) = 0; + virtual void update_last_buffer_value() = 0; //- get scalar value virtual data_t get_scalar_value() = 0; //- get buffer value - virtual RawData_t get_buffer_value() - throw (Tango::DevFailed) = 0; + virtual RawData_t get_buffer_value() = 0; //- get name - virtual std::string get_name() - throw (Tango::DevFailed) = 0; + virtual std::string get_name() = 0; //- get config virtual CounterConfig get_config() = 0; diff --git a/src/ManagerFactory.cpp b/src/ManagerFactory.cpp old mode 100644 new mode 100755 index 4b5a8327518bba267b2ce902843d158842f75fd8..3c73750e5d84064faa46125a5bc9aea0e36b26c9 --- a/src/ManagerFactory.cpp +++ b/src/ManagerFactory.cpp @@ -21,7 +21,6 @@ namespace PulseCounting_ns // ManagerFactory::instanciate // ====================================================================== PulseCountingManager * ManagerFactory::instanciate (Tango::DeviceImpl * hostDevice, E_AcquisitionMode_t p_mode) - throw (Tango::DevFailed) { PulseCountingManager * l_manager = NULL; diff --git a/src/ManagerFactory.h b/src/ManagerFactory.h old mode 100644 new mode 100755 index 99b71d164d5554d60ea7cfa9ecf35d033c96d23b..20677c8f7c00ad2fbb037fff7b9d2119d79bddc9 --- a/src/ManagerFactory.h +++ b/src/ManagerFactory.h @@ -24,9 +24,8 @@ class ManagerFactory { public: //- instanciate a specialized GenericManagerInterface - static PulseCountingManager * instanciate (Tango::DeviceImpl * hostDevice, E_AcquisitionMode_t p_mode) - throw (Tango::DevFailed); - + static PulseCountingManager * instanciate (Tango::DeviceImpl * hostDevice, E_AcquisitionMode_t p_mode); + private: ManagerFactory (); ~ManagerFactory (); diff --git a/src/NI6602_Interface.cpp b/src/NI6602_Interface.cpp old mode 100644 new mode 100755 index 71e5a7c5e9e5b4c3521cb57d5260f16b8c8df3be..bb35b65bbc037b2157453c08d814c39c4d62ebb1 --- a/src/NI6602_Interface.cpp +++ b/src/NI6602_Interface.cpp @@ -34,16 +34,16 @@ NI6602_Interface::NI6602_Interface (Tango::DeviceImpl * hostDevice, NI6602_Interface::~NI6602_Interface () { - if (this->m_scalar_finite_clock) + if (m_scalar_finite_clock) { - delete this->m_scalar_finite_clock; - this->m_scalar_finite_clock = NULL; + delete m_scalar_finite_clock; + m_scalar_finite_clock = NULL; } - if (this->m_buffer_continuous_clock) + if (m_buffer_continuous_clock) { - delete this->m_buffer_continuous_clock; - this->m_buffer_continuous_clock = NULL; + delete m_buffer_continuous_clock; + m_buffer_continuous_clock = NULL; } } @@ -51,7 +51,6 @@ NI6602_Interface::~NI6602_Interface () // NI6602_Interface::initCounter () // ============================================================================ void NI6602_Interface::initCounter(CounterConfig p_cfg) - throw (Tango::DevFailed) { switch (m_acq_mode) { @@ -136,7 +135,6 @@ void NI6602_Interface::initCounter(CounterConfig p_cfg) // NI6602_Interface::initClock () // ============================================================================ void NI6602_Interface::initClock(ClockConfig p_cfg) - throw (Tango::DevFailed) { m_clk_cfg = p_cfg; @@ -146,65 +144,65 @@ void NI6602_Interface::initClock(ClockConfig p_cfg) const double time_limit_80M = double(0x7FFFFFFF) / 8E7; // SCALAR mode - if (this->m_acq_mode == ACQ_MODE_SCAL) + if (m_acq_mode == ACQ_MODE_SCAL) { ni660Xsl::OutClockTicksChan chan; // if clock object already exists, release and delete - if (this->m_scalar_finite_clock) + if (m_scalar_finite_clock) { - this->m_scalar_finite_clock->release(); - delete this->m_scalar_finite_clock; - this->m_scalar_finite_clock = NULL; + m_scalar_finite_clock->release(); + delete m_scalar_finite_clock; + m_scalar_finite_clock = NULL; } DEBUG_STREAM << "NI6602_Interface::initClock Finite clock" << std::endl; // Configure finite clock - this->m_scalar_finite_clock = new ni660Xsl::FinitePulseTrainGeneration(); + m_scalar_finite_clock = new ni660Xsl::FinitePulseTrainGeneration(); - chan.chan_name = std::string("/") + this->m_clk_cfg.boardName + std::string("/ctr0"); + chan.chan_name = std::string("/") + m_clk_cfg.boardName + std::string("/ctr0"); chan.idle_state = ni::low; chan.initial_delay = 0; // Automatic configuration according to integration time value - if (this->m_cfg.integrationTime <= time_limit_80M) + if (m_cfg.integrationTime <= time_limit_80M) { DEBUG_STREAM << "Using 80 MHz timebase"; - chan.clk_source = std::string("/") + this->m_clk_cfg.boardName + std::string("/80MHzTimebase"); + chan.clk_source = std::string("/") + m_clk_cfg.boardName + std::string("/80MHzTimebase"); chan.low_ticks = 3; - chan.high_ticks = static_cast<long>(this->m_cfg.integrationTime * 8E7); //secs + chan.high_ticks = static_cast<long>(m_cfg.integrationTime * 8E7); //secs } - else if (this->m_cfg.integrationTime <= time_limit_20M) + else if (m_cfg.integrationTime <= time_limit_20M) { DEBUG_STREAM << "Using 20 MHz timebase"; - chan.clk_source = std::string("/") + this->m_clk_cfg.boardName + std::string("/20MHzTimebase"); + chan.clk_source = std::string("/") + m_clk_cfg.boardName + std::string("/20MHzTimebase"); chan.low_ticks = 3; - chan.high_ticks = static_cast<long>(this->m_cfg.integrationTime * 2E7); //secs + chan.high_ticks = static_cast<long>(m_cfg.integrationTime * 2E7); //secs } - else if (this->m_cfg.integrationTime <= time_limit_100k) + else if (m_cfg.integrationTime <= time_limit_100k) { DEBUG_STREAM << "Using 100 kHz timebase"; - chan.clk_source = std::string("/") + this->m_clk_cfg.boardName + std::string("/100kHzTimebase"); + chan.clk_source = std::string("/") + m_clk_cfg.boardName + std::string("/100kHzTimebase"); chan.low_ticks = 3; - chan.high_ticks = static_cast<long>(this->m_cfg.integrationTime * 1E5); //secs + chan.high_ticks = static_cast<long>(m_cfg.integrationTime * 1E5); //secs } else { ERROR_STREAM << "Finite clock configuration error!" << std::endl; THROW_DEVFAILED( - _CPTC("OUT_OF_RANGE"), - _CPTC("Failed to configure finite clock! Integration time out of range!"), - _CPTC("NI6602_Interface::initClock")); + "OUT_OF_RANGE", + "Failed to configure finite clock! Integration time out of range!", + "NI6602_Interface::initClock"); } // Initiliazing and configuring clock try { - this->m_scalar_finite_clock->add_clock_ticks_channel(chan); - this->m_scalar_finite_clock->set_nb_pulses(1); - this->m_scalar_finite_clock->init(); - this->m_scalar_finite_clock->configure(); + m_scalar_finite_clock->add_clock_ticks_channel(chan); + m_scalar_finite_clock->set_nb_pulses(1); + m_scalar_finite_clock->init(); + m_scalar_finite_clock->configure(); } catch(ni660Xsl::DAQException & nie) { @@ -212,24 +210,24 @@ void NI6602_Interface::initClock(ClockConfig p_cfg) } } // BUFFERED mode - else if (this->m_acq_mode == ACQ_MODE_BUFF) + else if (m_acq_mode == ACQ_MODE_BUFF) { ni660Xsl::OutClockTicksChan chan; // if clock object already exists, release and delete - if (this->m_buffer_continuous_clock) + if (m_buffer_continuous_clock) { - this->m_buffer_continuous_clock->release(); - delete this->m_buffer_continuous_clock; - this->m_buffer_continuous_clock = NULL; + m_buffer_continuous_clock->release(); + delete m_buffer_continuous_clock; + m_buffer_continuous_clock = NULL; } DEBUG_STREAM << "NI6602_Interface::configure continuous clock" << std::endl; DEBUG_STREAM << "NI6602_Interface::initClock timebase scaling: " << m_clk_cfg.timebaseScaling << std::endl; // Configure continous clock - this->m_buffer_continuous_clock = new ni660Xsl::ContinuousPulseTrainGeneration(); - chan.chan_name = std::string("/") + this->m_clk_cfg.boardName + std::string("/ctr0"); + m_buffer_continuous_clock = new ni660Xsl::ContinuousPulseTrainGeneration(); + chan.chan_name = std::string("/") + m_clk_cfg.boardName + std::string("/ctr0"); chan.idle_state = ni::low; chan.initial_delay = 0; @@ -237,34 +235,34 @@ void NI6602_Interface::initClock(ClockConfig p_cfg) if (m_clk_cfg.timebaseScaling.compare("AUTO") == 0) { DEBUG_STREAM << "AUTO timebasScaling" << endl; - if (this->m_cfg.integrationTime <= time_limit_80M) + if (m_cfg.integrationTime <= time_limit_80M) { DEBUG_STREAM << "Using 80 MHz timebase"; - chan.clk_source = std::string("/") + this->m_clk_cfg.boardName + std::string("/80MHzTimebase"); + chan.clk_source = std::string("/") + m_clk_cfg.boardName + std::string("/80MHzTimebase"); chan.low_ticks = 3; - chan.high_ticks = static_cast<long>(this->m_cfg.integrationTime * 8E7); //secs + chan.high_ticks = static_cast<long>(m_cfg.integrationTime * 8E7); //secs } - else if (this->m_cfg.integrationTime <= time_limit_20M) + else if (m_cfg.integrationTime <= time_limit_20M) { DEBUG_STREAM << "Using 20 MHz timebase"; - chan.clk_source = std::string("/") + this->m_clk_cfg.boardName + std::string("/20MHzTimebase"); + chan.clk_source = std::string("/") + m_clk_cfg.boardName + std::string("/20MHzTimebase"); chan.low_ticks = 3; - chan.high_ticks = static_cast<long>(this->m_cfg.integrationTime * 2E7); //secs + chan.high_ticks = static_cast<long>(m_cfg.integrationTime * 2E7); //secs } - else if (this->m_cfg.integrationTime <= time_limit_100k) + else if (m_cfg.integrationTime <= time_limit_100k) { DEBUG_STREAM << "Using 100 kHz timebase"; - chan.clk_source = std::string("/") + this->m_clk_cfg.boardName + std::string("/100kHzTimebase"); + chan.clk_source = std::string("/") + m_clk_cfg.boardName + std::string("/100kHzTimebase"); chan.low_ticks = 3; - chan.high_ticks = static_cast<long>(this->m_cfg.integrationTime * 1E5); //secs + chan.high_ticks = static_cast<long>(m_cfg.integrationTime * 1E5); //secs } else { ERROR_STREAM << "Continuous clock configuration error!" << std::endl; THROW_DEVFAILED( - _CPTC("OUT_OF_RANGE"), - _CPTC("Failed to configure continuous clock! Integration time out of range!"), - _CPTC("NI6602_Interface::initClock")); + "OUT_OF_RANGE", + "Failed to configure continuous clock! Integration time out of range!", + "NI6602_Interface::initClock"); } } else @@ -273,30 +271,30 @@ void NI6602_Interface::initClock(ClockConfig p_cfg) if (m_clk_cfg.timebaseScaling.compare("20M") == 0) { DEBUG_STREAM << "Using 20 MHz timebase"; - chan.clk_source = std::string("/") + this->m_clk_cfg.boardName + std::string("/20MHzTimebase"); + chan.clk_source = std::string("/") + m_clk_cfg.boardName + std::string("/20MHzTimebase"); chan.low_ticks = 3; - chan.high_ticks = static_cast<long>(this->m_cfg.integrationTime * 2E7); //secs + chan.high_ticks = static_cast<long>(m_cfg.integrationTime * 2E7); //secs } else if (m_clk_cfg.timebaseScaling.compare("80M") == 0) { DEBUG_STREAM << "Using 80 MHz timebase"; - chan.clk_source = std::string("/") + this->m_clk_cfg.boardName + std::string("/80MHzTimebase"); + chan.clk_source = std::string("/") + m_clk_cfg.boardName + std::string("/80MHzTimebase"); chan.low_ticks = 3; - chan.high_ticks = static_cast<long>(this->m_cfg.integrationTime * 8E7); //secs + chan.high_ticks = static_cast<long>(m_cfg.integrationTime * 8E7); //secs } else if (m_clk_cfg.timebaseScaling.compare("100k") == 0) { DEBUG_STREAM << "Using 100 kHz timebase"; - chan.clk_source = std::string("/") + this->m_clk_cfg.boardName + std::string("/100kHzTimebase"); + chan.clk_source = std::string("/") + m_clk_cfg.boardName + std::string("/100kHzTimebase"); chan.low_ticks = 3; - chan.high_ticks = static_cast<long>(this->m_cfg.integrationTime * 1E5); //secs + chan.high_ticks = static_cast<long>(m_cfg.integrationTime * 1E5); //secs } else { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Failed to configure continuous clock! TimebasScaling value is not correct!"), - _CPTC("NI6602_Interface::initClock")); + "CONFIGURATION_ERROR", + "Failed to configure continuous clock! TimebasScaling value is not correct!", + "NI6602_Interface::initClock"); } } @@ -304,9 +302,9 @@ void NI6602_Interface::initClock(ClockConfig p_cfg) try { // Initiliazing and configuring clock - this->m_buffer_continuous_clock->add_clock_ticks_channel(chan); - this->m_buffer_continuous_clock->init(); - this->m_buffer_continuous_clock->configure(); + m_buffer_continuous_clock->add_clock_ticks_channel(chan); + m_buffer_continuous_clock->init(); + m_buffer_continuous_clock->configure(); } catch(ni660Xsl::DAQException & nie) { @@ -318,9 +316,9 @@ void NI6602_Interface::initClock(ClockConfig p_cfg) // bad value ERROR_STREAM << "Clock cannot be started! Bad acquisition mode!" << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Failed to start clock, bad acquisition mode value!"), - _CPTC("NI6602_Interface::initClock")); + "CONFIGURATION_ERROR", + "Failed to start clock, bad acquisition mode value!", + "NI6602_Interface::initClock"); } } @@ -328,7 +326,6 @@ void NI6602_Interface::initClock(ClockConfig p_cfg) // NI6602_Interface::configureCounter () // ============================================================================ void NI6602_Interface::configureCounter(CounterConfig p_cfg) - throw (Tango::DevFailed) { ni660Xsl::EventCountChan l_evtConfig; ni660Xsl::PositionChan l_posConfig; @@ -355,17 +352,17 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) { ERROR_STREAM << "Failed to create AttributeProxy: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("AttributeProxy creation failed"), - _CPTC("PulseCountingManagerScalar::configureCounter")); + "SOFTWARE_FAILURE", + "AttributeProxy creation failed", + "PulseCountingManagerScalar::configureCounter"); } catch(...) { ERROR_STREAM << "Failed to create AttributeProxy." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("AttributeProxy creation failed"), - _CPTC("PulseCountingManagerScalar::configureCounter")); + "SOFTWARE_FAILURE", + "AttributeProxy creation failed", + "PulseCountingManagerScalar::configureCounter"); } try { @@ -376,17 +373,17 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) { ERROR_STREAM << "Failed to read AttributeProxy value: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("AttributeProxy read failed"), - _CPTC("PulseCountingManagerScalar::configureCounter")); + "SOFTWARE_FAILURE", + "AttributeProxy read failed", + "PulseCountingManagerScalar::configureCounter"); } catch(...) { ERROR_STREAM << "Failed to read AttributeProxy value." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("AttributeProxy read failed"), - _CPTC("PulseCountingManagerScalar::configureCounter")); + "SOFTWARE_FAILURE", + "AttributeProxy read failed", + "PulseCountingManagerScalar::configureCounter"); } if (l_attr_proxy) @@ -699,8 +696,8 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) { std::string pause_trigger; // Check board - if ((this->m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && - (this->m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) + if ((m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && + (m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) { // Master board: generates clock on ctr0 = trigger pause_trigger = "/" + p_cfg.boardName + "/ctr0InternalOutput"; @@ -738,8 +735,8 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) { std::string pause_trigger; // Check board - if ((this->m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && - (this->m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) + if ((m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && + (m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) { // Master board: generates clock on ctr0 = trigger pause_trigger = "/" + p_cfg.boardName + "/ctr0InternalOutput"; @@ -772,8 +769,8 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) { std::string pause_trigger; // Check board - if ((this->m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && - (this->m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) + if ((m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && + (m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) { // Master board: generates clock on ctr0 = trigger pause_trigger = "/" + p_cfg.boardName + "/ctr0InternalOutput"; @@ -811,11 +808,11 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) unsigned long buffer_depth_nbpts = 0; if (m_cfg.continuousAcquisition) { - buffer_depth_nbpts = this->m_cfg.samplesNumber; + buffer_depth_nbpts = m_cfg.samplesNumber; } else { - buffer_depth_nbpts = static_cast<unsigned long>(this->m_cfg.bufferDepth); + buffer_depth_nbpts = static_cast<unsigned long>(m_cfg.bufferDepth); } INFO_STREAM << "Buffered mode - computed buffer depth in nb of points = " << buffer_depth_nbpts << endl; @@ -859,8 +856,8 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) std::string pause_trigger; // Check board - if ((this->m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && - (this->m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) + if ((m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && + (m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) { // Master board: generates clock on ctr0 = trigger pause_trigger = "/" + p_cfg.boardName + "/ctr0InternalOutput"; @@ -874,7 +871,7 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) double max_rate = 1.1 / m_cfg.integrationTime; m_buffer_pos_ct_list[p_cfg.name]->set_sample_clock(pause_trigger, ni::rising_edge, max_rate); - if (this->m_cfg.startTriggerUse) + if (m_cfg.startTriggerUse) { m_buffer_pos_ct_list[p_cfg.name]->set_start_trigger(pause_trigger, ni::rising_edge); } @@ -882,7 +879,7 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) #if defined (USE_CALLBACK) DEBUG_STREAM << "Position counter - Callback mode set" << std::endl; m_buffer_pos_ct_list[p_cfg.name]->set_callback_mode(true); - m_buffer_pos_ct_list[p_cfg.name]->set_total_nb_pts(this->m_cfg.samplesNumber); + m_buffer_pos_ct_list[p_cfg.name]->set_total_nb_pts(m_cfg.samplesNumber); #endif m_buffer_pos_ct_list[p_cfg.name]->init(); m_buffer_pos_ct_list[p_cfg.name]->configure(); @@ -924,8 +921,8 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) std::string pause_trigger; // Check board - if ((this->m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && - (this->m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) + if ((m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && + (m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) { // Master board: generates clock on ctr0 = trigger pause_trigger = "/" + p_cfg.boardName + "/ctr0InternalOutput"; @@ -939,7 +936,7 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) double max_rate = 1.1 / m_cfg.integrationTime; m_buffer_evt_ct_list[p_cfg.name]->set_sample_clock(pause_trigger, ni::rising_edge, max_rate); - if (this->m_cfg.startTriggerUse) + if (m_cfg.startTriggerUse) { m_buffer_evt_ct_list[p_cfg.name]->set_start_trigger(pause_trigger, ni::rising_edge); } @@ -947,7 +944,7 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) #if defined (USE_CALLBACK) DEBUG_STREAM << "Event counter - Callback mode set" << std::endl; m_buffer_evt_ct_list[p_cfg.name]->set_callback_mode(true); - m_buffer_evt_ct_list[p_cfg.name]->set_total_nb_pts(this->m_cfg.samplesNumber); + m_buffer_evt_ct_list[p_cfg.name]->set_total_nb_pts(m_cfg.samplesNumber); #endif m_buffer_evt_ct_list[p_cfg.name]->add_input_channel(l_evtConfig); @@ -986,8 +983,8 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) std::string pause_trigger; // Check board - if ((this->m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && - (this->m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) + if ((m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && + (m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) { // Master board: generates clock on ctr0 = trigger pause_trigger = "/" + p_cfg.boardName + "/ctr0InternalOutput"; @@ -1001,7 +998,7 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) double max_rate = 1.1 / m_cfg.integrationTime; m_buffer_dt_ct_list[p_cfg.name]->set_sample_clock(pause_trigger, ni::rising_edge, max_rate); - if (this->m_cfg.startTriggerUse) + if (m_cfg.startTriggerUse) { m_buffer_dt_ct_list[p_cfg.name]->set_start_trigger(pause_trigger, ni::rising_edge); } @@ -1009,7 +1006,7 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) #if defined (USE_CALLBACK) DEBUG_STREAM << "DeltaTime counter - Callback mode set" << std::endl; m_buffer_dt_ct_list[p_cfg.name]->set_callback_mode(true); - m_buffer_dt_ct_list[p_cfg.name]->set_total_nb_pts(this->m_cfg.samplesNumber); + m_buffer_dt_ct_list[p_cfg.name]->set_total_nb_pts(m_cfg.samplesNumber); #endif m_buffer_dt_ct_list[p_cfg.name]->add_input_channel(l_dtConfig); @@ -1048,8 +1045,8 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) std::string pause_trigger; // Check board - if ((this->m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && - (this->m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) + if ((m_clk_cfg.channelName.compare(CLOCK_INTERNAL) == 0) && + (m_clk_cfg.boardName.compare(p_cfg.boardName) == 0)) { // Master board: generates clock on ctr0 = trigger pause_trigger = "/" + p_cfg.boardName + "/ctr0InternalOutput"; @@ -1063,7 +1060,7 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) double max_rate = 1.1 / m_cfg.integrationTime; m_buffer_prd_ct_list[p_cfg.name]->set_sample_clock(pause_trigger, ni::rising_edge, max_rate); - if (this->m_cfg.startTriggerUse) + if (m_cfg.startTriggerUse) { m_buffer_prd_ct_list[p_cfg.name]->set_start_trigger(pause_trigger, ni::rising_edge); } @@ -1071,7 +1068,7 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) #if defined (USE_CALLBACK) DEBUG_STREAM << "Period counter - Callback mode set" << std::endl; m_buffer_prd_ct_list[p_cfg.name]->set_callback_mode(true); - m_buffer_prd_ct_list[p_cfg.name]->set_total_nb_pts(this->m_cfg.samplesNumber); + m_buffer_prd_ct_list[p_cfg.name]->set_total_nb_pts(m_cfg.samplesNumber); #endif m_buffer_prd_ct_list[p_cfg.name]->add_input_channel(l_prdConfig); @@ -1099,7 +1096,6 @@ void NI6602_Interface::configureCounter(CounterConfig p_cfg) // NI6602_Interface::startCounter () // ============================================================================ void NI6602_Interface::startCounter(CounterConfig p_cfg) - throw (Tango::DevFailed) { try { @@ -1159,7 +1155,6 @@ void NI6602_Interface::startCounter(CounterConfig p_cfg) // NI6602_Interface::stopCounter () // ============================================================================ void NI6602_Interface::stopCounter(CounterConfig p_cfg) - throw (Tango::DevFailed) { try { @@ -1227,13 +1222,12 @@ void NI6602_Interface::stopCounter(CounterConfig p_cfg) // NI6602_Interface::startClock () // ============================================================================ void NI6602_Interface::startClock() - throw (Tango::DevFailed) { - if (this->m_acq_mode == ACQ_MODE_SCAL) + if (m_acq_mode == ACQ_MODE_SCAL) { try { - this->m_scalar_finite_clock->start(); + m_scalar_finite_clock->start(); } catch(ni660Xsl::DAQException & nie) { @@ -1242,16 +1236,16 @@ void NI6602_Interface::startClock() catch(...) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start finite clock."), - _CPTC("NI6602_Interface::startClock")); + "DEVICE_ERROR", + "Failed to start finite clock.", + "NI6602_Interface::startClock"); } } - else if (this->m_acq_mode == ACQ_MODE_BUFF) + else if (m_acq_mode == ACQ_MODE_BUFF) { try { - this->m_buffer_continuous_clock->start(); + m_buffer_continuous_clock->start(); } catch(ni660Xsl::DAQException & nie) { @@ -1260,9 +1254,9 @@ void NI6602_Interface::startClock() catch(...) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start continuous clock."), - _CPTC("NI6602_Interface::startClock")); + "DEVICE_ERROR", + "Failed to start continuous clock.", + "NI6602_Interface::startClock"); } } else @@ -1270,9 +1264,9 @@ void NI6602_Interface::startClock() // bad value ERROR_STREAM << "Clock cannot be started! Bad acquisition mode: " << m_acq_mode << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Failed to start clock - bad acquisition mode!"), - _CPTC("NI6602_Interface::startClock")); + "CONFIGURATION_ERROR", + "Failed to start clock - bad acquisition mode!", + "NI6602_Interface::startClock"); } } @@ -1280,46 +1274,45 @@ void NI6602_Interface::startClock() // NI6602_Interface::abortClock () // ============================================================================ void NI6602_Interface::abortClock() - throw (Tango::DevFailed) { - if (this->m_acq_mode == ACQ_MODE_SCAL) + if (m_acq_mode == ACQ_MODE_SCAL) { if (m_scalar_finite_clock) { try { - this->m_scalar_finite_clock->abort(); + m_scalar_finite_clock->abort(); } catch(...) { - // DAQmx 9.x abort pb workaround - ERROR_STREAM << "NI6602_Interface::abortClock() - Aborting previous clock generates exception, do nothing..." << std::endl; + // Bug in DAQmx 9.x: Aborting counter generates exception + // An effective workaround is to catch and clear the error } } } - else if (this->m_acq_mode == ACQ_MODE_BUFF) + else if (m_acq_mode == ACQ_MODE_BUFF) { if (m_buffer_continuous_clock) { try { - this->m_buffer_continuous_clock->abort(); + m_buffer_continuous_clock->abort(); } catch(...) { - // DAQmx 9.x abort pb workaround - ERROR_STREAM << "NI6602_Interface::abortClock() - Aborting previous clock generates exception, do nothing..." << std::endl; + // Bug in DAQmx 9.x: Aborting counter generates exception + // An effective workaround is to catch and clear the error } } } else { // bad value - ERROR_STREAM << "Clock cannot be aborted! Bad acquisition mode: " << this->m_acq_mode << std::endl; + ERROR_STREAM << "Clock cannot be aborted! Bad acquisition mode: " << m_acq_mode << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Failed to abort clock: bad acquisition mode!"), - _CPTC("NI6602_Interface::abortClock")); + "CONFIGURATION_ERROR", + "Failed to abort clock: bad acquisition mode!", + "NI6602_Interface::abortClock"); } } @@ -1327,13 +1320,12 @@ void NI6602_Interface::abortClock() // NI6602_Interface::waitEndOfClock () // ============================================================================ void NI6602_Interface::waitEndOfClock() - throw (Tango::DevFailed) { - if (this->m_acq_mode == ACQ_MODE_SCAL) + if (m_acq_mode == ACQ_MODE_SCAL) { try { - this->m_scalar_finite_clock->wait_finished(-1); + m_scalar_finite_clock->wait_finished(-1); } catch(ni660Xsl::DAQException & nie) { @@ -1342,16 +1334,16 @@ void NI6602_Interface::waitEndOfClock() catch(...) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to wait for finite clock!"), - _CPTC("NI6602_Interface::waitEndOfClock")); + "DEVICE_ERROR", + "Failed to wait for finite clock!", + "NI6602_Interface::waitEndOfClock"); } } - else if (this->m_acq_mode == ACQ_MODE_BUFF) + else if (m_acq_mode == ACQ_MODE_BUFF) { try { - this->m_buffer_continuous_clock->wait_finished(-1); + m_buffer_continuous_clock->wait_finished(-1); } catch(ni660Xsl::DAQException & nie) { @@ -1360,9 +1352,9 @@ void NI6602_Interface::waitEndOfClock() catch(...) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to wait for continuous clock!"), - _CPTC("NI6602_Interface::waitEndOfClock")); + "DEVICE_ERROR", + "Failed to wait for continuous clock!", + "NI6602_Interface::waitEndOfClock"); } } } @@ -1371,7 +1363,6 @@ void NI6602_Interface::waitEndOfClock() // NI6602_Interface::getDriverVersion () // ============================================================================ std::string NI6602_Interface::getDriverVersion() - throw (Tango::DevFailed) { std::string l_version; try @@ -1385,9 +1376,9 @@ std::string NI6602_Interface::getDriverVersion() catch(...) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to wait for continuous clock!"), - _CPTC("NI6602_Interface::getDriverVersion")); + "DEVICE_ERROR", + "Failed to wait for continuous clock!", + "NI6602_Interface::getDriverVersion"); } return l_version; } @@ -1460,7 +1451,6 @@ void NI6602_Interface::setStorageUse(bool p_use) // NI6602_Interface::getCounterState () // ============================================================================ Tango::DevState NI6602_Interface::getCounterState(CounterConfig p_cfg) - throw (Tango::DevFailed) { Tango::DevState l_val = Tango::UNKNOWN; int l_state = -1; @@ -1672,8 +1662,8 @@ Tango::DevState NI6602_Interface::getCounterState(CounterConfig p_cfg) break; case ni660Xsl::InputOperation::UNKNOWN: // TODO state problem: in the NI660XSl lib, the UNKNOWN state is : - // � either associated to a device error (with exception thrown), - // � either a normal state, like a STANDBY state (after a release or abort command, for example. + // � either associated to a device error (with exception thrown), + // � either a normal state, like a STANDBY state (after a release or abort command, for example. // For now, we say that it's a normal state => STANDBY l_val = Tango::STANDBY; break; @@ -1699,7 +1689,6 @@ Tango::DevState NI6602_Interface::getCounterState(CounterConfig p_cfg) // NI6602_Interface::getCounterScalarValue () // ============================================================================ data_t NI6602_Interface::getCounterScalarValue(CounterConfig p_cfg) - throw (Tango::DevFailed) { data_t l_val = 0; @@ -1755,7 +1744,6 @@ data_t NI6602_Interface::getCounterScalarValue(CounterConfig p_cfg) // NI6602_Interface::getCounterBufferValue () // ============================================================================ RawData_t & NI6602_Interface::getCounterBufferValue(CounterConfig p_cfg) - throw (Tango::DevFailed) { switch (p_cfg.mode) { @@ -1785,24 +1773,22 @@ RawData_t & NI6602_Interface::getCounterBufferValue(CounterConfig p_cfg) break; default: THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Bad counter mode!"), - _CPTC("NI6602_Interface::getCounterBufferValue")); - break; - } + "CONFIGURATION_ERROR", + "Bad counter mode!", + "NI6602_Interface::getCounterBufferValue"); + break; } // if not defined pters (before a start command) THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Not initialized counter!"), - _CPTC("NI6602_Interface::getCounterBufferValue")); + "DEVICE_ERROR", + "Not initialized counter!", + "NI6602_Interface::getCounterBufferValue"); } // ============================================================================ // NI6602_Interface::updateCounterBufferValue () // ============================================================================ void NI6602_Interface::updateCounterBufferValue(CounterConfig p_cfg) - throw (Tango::DevFailed) { switch (p_cfg.mode) { @@ -1839,46 +1825,45 @@ void NI6602_Interface::updateCounterBufferValue(CounterConfig p_cfg) // NI6602_Interface::releaseClock () // ============================================================================ void NI6602_Interface::releaseClock() - throw (Tango::DevFailed) { // SCALAR mode - if (this->m_acq_mode == ACQ_MODE_SCAL) + if (m_acq_mode == ACQ_MODE_SCAL) { - if (this->m_scalar_finite_clock) + if (m_scalar_finite_clock) { // stop & release clock object try { - this->m_scalar_finite_clock->abort(); - this->m_scalar_finite_clock->release(); + m_scalar_finite_clock->abort(); + m_scalar_finite_clock->release(); } catch(...) { } // delete clock object - delete this->m_scalar_finite_clock; - this->m_scalar_finite_clock = NULL; + delete m_scalar_finite_clock; + m_scalar_finite_clock = NULL; } } else { // BUFFERED mode - if (this->m_buffer_continuous_clock) + if (m_buffer_continuous_clock) { // stop & release clock object try { - this->m_buffer_continuous_clock->abort(); - this->m_buffer_continuous_clock->release(); + m_buffer_continuous_clock->abort(); + m_buffer_continuous_clock->release(); } catch(...) { } // delete clock object - delete this->m_buffer_continuous_clock; - this->m_buffer_continuous_clock = NULL; + delete m_buffer_continuous_clock; + m_buffer_continuous_clock = NULL; } } } @@ -1887,10 +1872,9 @@ void NI6602_Interface::releaseClock() // NI6602_Interface::releaseCounter () // ============================================================================ void NI6602_Interface::releaseCounter(CounterConfig p_cfg) - throw (Tango::DevFailed) { // SCALAR mode - if (this->m_acq_mode == ACQ_MODE_SCAL) + if (m_acq_mode == ACQ_MODE_SCAL) { switch (p_cfg.mode) { @@ -1989,7 +1973,6 @@ void NI6602_Interface::releaseCounter(CounterConfig p_cfg) // NI6602_Interface::updateCounterLastBufferValue () // ============================================================================ void NI6602_Interface::updateCounterLastBufferValue(CounterConfig p_cfg) - throw (Tango::DevFailed) { switch (p_cfg.mode) { diff --git a/src/NI6602_Interface.h b/src/NI6602_Interface.h old mode 100644 new mode 100755 index e1dd8795f50fbb1cac5f0eb9fe57a34318b00e2b..3ae6128deb97e9ea8def1ea23c1873af74a1a0bc --- a/src/NI6602_Interface.h +++ b/src/NI6602_Interface.h @@ -43,40 +43,31 @@ public: ~NI6602_Interface (); //- initCounter - void initCounter(CounterConfig p_cfg) - throw (Tango::DevFailed); + void initCounter(CounterConfig p_cfg); //- init clock - void initClock(ClockConfig p_cfg) - throw (Tango::DevFailed); + void initClock(ClockConfig p_cfg); //- configure counter - void configureCounter(CounterConfig p_cfg) - throw (Tango::DevFailed); + void configureCounter(CounterConfig p_cfg); //- start counter - void startCounter(CounterConfig p_cfg) - throw (Tango::DevFailed); + void startCounter(CounterConfig p_cfg); //- stop counter - void stopCounter(CounterConfig p_cfg) - throw (Tango::DevFailed); + void stopCounter(CounterConfig p_cfg); //- start clock - void startClock() - throw (Tango::DevFailed); + void startClock(); //- abort clock - void abortClock() - throw (Tango::DevFailed); + void abortClock(); //- wait end of clock - void waitEndOfClock() - throw (Tango::DevFailed); + void waitEndOfClock(); //- getDriverVersion - std::string getDriverVersion() - throw (Tango::DevFailed); + std::string getDriverVersion() ; //- get max counter number unsigned int getMaxCounterNumber(); @@ -103,32 +94,25 @@ public: void setStorageUse(bool p_use); //- gets state - Tango::DevState getCounterState(CounterConfig p_cfg) - throw (Tango::DevFailed); + Tango::DevState getCounterState(CounterConfig p_cfg); //- get counter scalar value - data_t getCounterScalarValue(CounterConfig p_cfg) - throw (Tango::DevFailed); + data_t getCounterScalarValue(CounterConfig p_cfg); //- get counter Buffer value - RawData_t & getCounterBufferValue(CounterConfig p_cfg) - throw (Tango::DevFailed); + RawData_t & getCounterBufferValue(CounterConfig p_cfg); //- update counter Buffer value (used in "polling" mode) - virtual void updateCounterBufferValue(CounterConfig p_cfg) - throw (Tango::DevFailed); + virtual void updateCounterBufferValue(CounterConfig p_cfg); //- update last counter Buffer value (used with trigger listener option) - virtual void updateCounterLastBufferValue(CounterConfig p_cfg) - throw (Tango::DevFailed); + virtual void updateCounterLastBufferValue(CounterConfig p_cfg); //- delete counter object - void releaseCounter(CounterConfig p_cfg) - throw (Tango::DevFailed); + void releaseCounter(CounterConfig p_cfg); //- release clock object - void releaseClock() - throw (Tango::DevFailed); + void releaseClock(); private: // buffer position counter diff --git a/src/NexusManager.cpp b/src/NexusManager.cpp old mode 100644 new mode 100755 index a4e8232d55a49b14b4ede1f9fbea7019953ea0af..b78c3e941bf7d560b2c47aea12f3e8d726e75823 --- a/src/NexusManager.cpp +++ b/src/NexusManager.cpp @@ -59,10 +59,10 @@ NexusManager::~NexusManager () try { // delete data buffer if previously allocated - if (this->m_pAcqWriter) + if (m_pAcqWriter) { - delete this->m_pAcqWriter; - this->m_pAcqWriter = NULL; + delete m_pAcqWriter; + m_pAcqWriter = NULL; } } catch (nxcpp::NexusException &n) @@ -79,8 +79,8 @@ NexusManager::~NexusManager () #if defined (USE_NX_DS_FINALIZER) try { - if (this->m_NexusDataStreamerFinalizer) - this->m_NexusDataStreamerFinalizer->stop(); + if (m_NexusDataStreamerFinalizer) + m_NexusDataStreamerFinalizer->stop(); delete m_NexusDataStreamerFinalizer; m_NexusDataStreamerFinalizer = NULL; @@ -99,7 +99,6 @@ void NexusManager::initNexusAcquisition(std::string nexus_file_path, yat::uint32 acquisition_size, yat::uint16 nx_number_per_file, nxItemList_t item_list) - throw (Tango::DevFailed) { m_finalizeDone = false; m_excptOccured = false; @@ -107,55 +106,55 @@ void NexusManager::initNexusAcquisition(std::string nexus_file_path, try { //---- delete data buffer if previously allocated - if (this->m_pAcqWriter ) + if (m_pAcqWriter ) { - delete this->m_pAcqWriter; - this->m_pAcqWriter = NULL; + delete m_pAcqWriter; + m_pAcqWriter = NULL; } //---- create data buffer for new acquisition - if (!this->m_pAcqWriter) + if (!m_pAcqWriter) { //- check nx_number_per_file value if (0 == nx_number_per_file) { ERROR_STREAM << "Number of nx storage per file should not be null!" << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), - _CPTC("Number of nx storage per file should not be null!"), - _CPTC("NexusManager::initNexusAcquisition")); + THROW_DEVFAILED("CONFIGURATION_ERROR", + "Number of nx storage per file should not be null!", + "NexusManager::initNexusAcquisition"); } //- finite nx generation file if (acquisition_size != 0) { - this->m_finiteStorage = true; + m_finiteStorage = true; //- check that acquisition_size >= m_nxNumberPerFile if (acquisition_size >= nx_number_per_file) { - this->m_pAcqWriter = new nxcpp::DataStreamer(nexus_file_name, acquisition_size, nx_number_per_file); + m_pAcqWriter = new nxcpp::DataStreamer(nexus_file_name, acquisition_size, nx_number_per_file); } else { ERROR_STREAM << "Number of acquisition must be greater than number of nx storage per file" << std::endl; - THROW_DEVFAILED(_CPTC("CONFIGURATION_ERROR"), - _CPTC("Nexus file configuration error - see logs for details"), - _CPTC("NexusManager::initNexusAcquisition")); + THROW_DEVFAILED("CONFIGURATION_ERROR", + "Nexus file configuration error - see logs for details", + "NexusManager::initNexusAcquisition"); } } else //- infinite nx generation file { - this->m_finiteStorage = false; - this->m_pAcqWriter = new nxcpp::DataStreamer(nexus_file_name, nx_number_per_file); + m_finiteStorage = false; + m_pAcqWriter = new nxcpp::DataStreamer(nexus_file_name, nx_number_per_file); } } else { // de-allocation pb ==> exception ERROR_STREAM << "Memory problem during nexus buffer de-allocation" << std::endl; - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Memory problem during nexus buffer de-allocation"), - _CPTC("NexusManager::initNexusAcquisition")); + THROW_DEVFAILED("DEVICE_ERROR", + "Memory problem during nexus buffer de-allocation", + "NexusManager::initNexusAcquisition"); } } catch(nxcpp::NexusException &n) @@ -169,23 +168,23 @@ void NexusManager::initNexusAcquisition(std::string nexus_file_path, ERROR_STREAM << "Nexus storage ABORTED." << std::endl; - Tango::DevFailed df = this->nexusToTangoException(n); + Tango::DevFailed df = nexusToTangoException(n); throw df; } catch(Tango::DevFailed & df) { ERROR_STREAM << "NexusManager::initNexusAcquisition caught DevFailed : " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to prepare Nexus storage (caught DevFailed)!"), - _CPTC("NexusManager::initNexusAcquisition")); + "DEVICE_ERROR", + "Failed to prepare Nexus storage (caught DevFailed)!", + "NexusManager::initNexusAcquisition"); } catch(...) { ERROR_STREAM << "NexusManager::initNexusAcquisition caught [...]" << std::endl; - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Failed to prepare Nexus storage (caught [...])!"), - _CPTC("NexusManager::initNexusAcquisition")); + THROW_DEVFAILED("DEVICE_ERROR", + "Failed to prepare Nexus storage (caught [...])!", + "NexusManager::initNexusAcquisition"); } DEBUG_STREAM << "Store Nexus files in: " << nexus_file_path << std::endl; @@ -196,13 +195,13 @@ void NexusManager::initNexusAcquisition(std::string nexus_file_path, try { - if (this->m_pAcqWriter) + if (m_pAcqWriter) { bool cleanFolders = true; - this->m_pAcqWriter->Initialize(nexus_file_path, ""); + m_pAcqWriter->Initialize(nexus_file_path, ""); // set exception handler - this->m_pAcqWriter->SetExceptionHandler(this); + m_pAcqWriter->SetExceptionHandler(this); // parse the list of items to store in nexus file for (size_t idx = 0; idx < m_itemList.size(); idx++) @@ -215,20 +214,20 @@ void NexusManager::initNexusAcquisition(std::string nexus_file_path, switch (storageType) { case NX_DATA_TYPE_0D: - this->m_pAcqWriter->AddDataItem0D(itemName); + m_pAcqWriter->AddDataItem0D(itemName); break; case NX_DATA_TYPE_1D: - this->m_pAcqWriter->AddDataItem1D(itemName, dim1); + m_pAcqWriter->AddDataItem1D(itemName, dim1); break; case NX_DATA_TYPE_2D: - this->m_pAcqWriter->AddDataItem2D(itemName, dim1, dim2); + m_pAcqWriter->AddDataItem2D(itemName, dim1, dim2); break; default: // not supported type => fatal error ERROR_STREAM << "Bad data type for nexus storage" << std::endl; - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Bad data type for nexus storage"), - _CPTC("NexusManager::initNexusAcquisition")); + THROW_DEVFAILED("DEVICE_ERROR", + "Bad data type for nexus storage", + "NexusManager::initNexusAcquisition"); break; } } @@ -237,9 +236,9 @@ void NexusManager::initNexusAcquisition(std::string nexus_file_path, { // allocation pb ==> exception ERROR_STREAM << "Memory problem during nexus buffer allocation" << std::endl; - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Memory problem during nexus buffer allocation"), - _CPTC("NexusManager::initNexusAcquisition")); + THROW_DEVFAILED("DEVICE_ERROR", + "Memory problem during nexus buffer allocation", + "NexusManager::initNexusAcquisition"); } } catch(nxcpp::NexusException &n4te) @@ -248,23 +247,23 @@ void NexusManager::initNexusAcquisition(std::string nexus_file_path, << n4te.to_string() << std::endl; - Tango::DevFailed df = this->nexusToTangoException(n4te); + Tango::DevFailed df = nexusToTangoException(n4te); throw df; } catch(Tango::DevFailed & df) { ERROR_STREAM << "NexusManager::initNexusAcquisition caught DevFailed : " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to initialize Nexus storage (caught DevFailed)!"), - _CPTC("NexusManager::initNexusAcquisition")); + "DEVICE_ERROR", + "Failed to initialize Nexus storage (caught DevFailed)!", + "NexusManager::initNexusAcquisition"); } catch(...) { ERROR_STREAM << "NexusManager::initNexusAcquisition caught [...]" << std::endl; - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Failed to initialize Nexus storage (caught [...])!"), - _CPTC("NexusManager::initNexusAcquisition")); + THROW_DEVFAILED("DEVICE_ERROR", + "Failed to initialize Nexus storage (caught [...])!", + "NexusManager::initNexusAcquisition"); } } @@ -272,24 +271,23 @@ void NexusManager::initNexusAcquisition(std::string nexus_file_path, // NexusManager::finalizeNxGeneration // ====================================================================== void NexusManager::finalizeNexusGeneration() - throw (Tango::DevFailed) { //- Ends nexus generation file. //- This method can be called from two ways //- in the same time, and in some cases can //- cause a CRASH !!! - if (this->m_pAcqWriter) + if (m_pAcqWriter) { - if (!this->m_finalizeDone) + if (!m_finalizeDone) { - yat::AutoMutex<> guard(this->m_finalizeNxLock); + yat::AutoMutex<> guard(m_finalizeNxLock); try { //- if infinite Nx generation, call Stop before Finalize !!! - if (!this->m_finiteStorage) - this->m_pAcqWriter->Stop(); + if (!m_finiteStorage) + m_pAcqWriter->Stop(); //- in all cases call Finalize #if defined (USE_NX_DS_FINALIZER) @@ -297,19 +295,19 @@ void NexusManager::finalizeNexusGeneration() { DEBUG_STREAM << "NexusManager::finalizeNexusGeneration -> Passing DataStreamer to the NexusDataStreamerFinalizer" << std::endl; nxcpp::NexusDataStreamerFinalizer::Entry * e = new nxcpp::NexusDataStreamerFinalizer::Entry(); - e->data_streamer = this->m_pAcqWriter; - this->m_pAcqWriter = 0; - this->m_NexusDataStreamerFinalizer->push(e); + e->data_streamer = m_pAcqWriter; + m_pAcqWriter = 0; + m_NexusDataStreamerFinalizer->push(e); } else #endif { DEBUG_STREAM <<"NexusManager::finalizeNexusGeneration -> use DataStreamer::Finalize" << std::endl; - this->m_pAcqWriter->Finalize(); + m_pAcqWriter->Finalize(); } //- now Nx file generation is done ! - this->m_finalizeDone = true; + m_finalizeDone = true; } catch(nxcpp::NexusException &n) { @@ -321,7 +319,7 @@ void NexusManager::finalizeNexusGeneration() m_pAcqWriter->Abort(); ERROR_STREAM << "Nexus storage ABORTED." << std::endl; - Tango::DevFailed df = this->nexusToTangoException(n); + Tango::DevFailed df = nexusToTangoException(n); throw df; } catch(yat::Exception &n) @@ -329,17 +327,17 @@ void NexusManager::finalizeNexusGeneration() ERROR_STREAM << "NexusManager::finalizeNxGeneration -> yat::Exception caught: " << n.to_string() << std::endl; - this->manageNexusAbort(); + manageNexusAbort(); ERROR_STREAM << "Nexus storage ABORTED." << std::endl; } catch(...) { ERROR_STREAM << "NexusManager::finalizeNxGeneration -> caught [...] Exception" << std::endl; - this->manageNexusAbort(); + manageNexusAbort(); ERROR_STREAM << "Nexus stotage ABORTED." << std::endl; - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Failed to finilize Nexus storage (caught [...])!"), - _CPTC("NexusManager::finalizeNxGeneration")); + THROW_DEVFAILED("DEVICE_ERROR", + "Failed to finilize Nexus storage (caught [...])!", + "NexusManager::finalizeNxGeneration"); } } } @@ -349,18 +347,17 @@ void NexusManager::finalizeNexusGeneration() // NexusManager::manageNexusAbort // ====================================================================== void NexusManager::manageNexusAbort() - throw (Tango::DevFailed) { - if (this->m_pAcqWriter) + if (m_pAcqWriter) { ERROR_STREAM << "NexusManager::manageNexusAbort <- ..." << std::endl; - this->m_pAcqWriter->Abort(); + m_pAcqWriter->Abort(); - this->m_pAcqWriter->Finalize(); + m_pAcqWriter->Finalize(); - delete this->m_pAcqWriter; - this->m_pAcqWriter = 0; + delete m_pAcqWriter; + m_pAcqWriter = 0; ERROR_STREAM << "NexusManager::manageNexusAbort ->" << std::endl; } diff --git a/src/NexusManager.h b/src/NexusManager.h old mode 100644 new mode 100755 index 654697ffd95175a85d7384cd02aa4b6b881e5151..8c143c3f310a5e8c3f388d0d03561aef72bf49fd --- a/src/NexusManager.h +++ b/src/NexusManager.h @@ -68,10 +68,10 @@ typedef struct nxItem if (this == & src) return *this; - this->name = src.name; - this->storageType = src.storageType; - this->dim1 = src.dim1; - this->dim2 = src.dim2; + name = src.name; + storageType = src.storageType; + dim1 = src.dim1; + dim2 = src.dim2; return *this; } @@ -105,26 +105,22 @@ public: std::string nexus_file_name, yat::uint32 acquisition_size, yat::uint16 nx_number_per_file, - nxItemList_t item_list) - throw (Tango::DevFailed); + nxItemList_t item_list); //- normally ends nexus storage - void finalizeNexusGeneration() - throw (Tango::DevFailed); + void finalizeNexusGeneration(); //- aborts nexus storage - void manageNexusAbort() - throw (Tango::DevFailed); + void manageNexusAbort(); //- reset buffer index void resetNexusBufferIndex() { - this->m_pAcqWriter->ResetBufferIndex(); + m_pAcqWriter->ResetBufferIndex(); } //- stores a T data in a nexus file template <class T> void pushNexusData(std::string item_name, T * data, unsigned long size_to_copy = 0) - throw (Tango::DevFailed) { if (m_pAcqWriter) { @@ -145,19 +141,19 @@ public: if (!itemFound) { ERROR_STREAM << "Bad item name:" << item_name << std::endl; - this->manageNexusAbort(); - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Bad item name, cannot store data in Nexus file"), - _CPTC("NexusManager::pushNexusData")); + manageNexusAbort(); + THROW_DEVFAILED("DEVICE_ERROR", + "Bad item name, cannot store data in Nexus file", + "NexusManager::pushNexusData"); } if (!data) { ERROR_STREAM << "Try to send null data to Nexus!" << std::endl; - this->manageNexusAbort(); - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Cannot store data in Nexus file: null data!"), - _CPTC("NexusManager::pushNexusData")); + manageNexusAbort(); + THROW_DEVFAILED("DEVICE_ERROR", + "Cannot store data in Nexus file: null data!", + "NexusManager::pushNexusData"); } try @@ -167,7 +163,7 @@ public: { // 1D DEBUG_STREAM << "NexusManager::pushNexusData - send pushData 1D for: " << item_name << " - size to copy = " << size_to_copy << std::endl; - this->m_pAcqWriter->PushData(item_name, data); // case: BUFFERED mode + m_pAcqWriter->PushData(item_name, data); // case: BUFFERED mode } else { @@ -175,9 +171,9 @@ public: // check size DEBUG_STREAM << "NexusManager::pushNexusData - send pushData 0D for: " << item_name << " - size to copy = " << size_to_copy << std::endl; if (size_to_copy == 0) - this->m_pAcqWriter->PushData(item_name, data); // case: SCALAR mode + m_pAcqWriter->PushData(item_name, data); // case: SCALAR mode else - this->m_pAcqWriter->PushData(item_name, data, size_to_copy); // case: BUFFERED mode + m_pAcqWriter->PushData(item_name, data, size_to_copy); // case: BUFFERED mode } } catch(nxcpp::NexusException &n) @@ -190,33 +186,33 @@ public: m_pAcqWriter->Abort(); ERROR_STREAM << "Nexus storage ABORTED." << std::endl; - Tango::DevFailed df = this->nexusToTangoException(n); + Tango::DevFailed df = nexusToTangoException(n); throw df; } catch(yat::Exception &e) { ERROR_STREAM << "NexusManager::pushNexusData -> caught YAT Exception: " << std::endl; YAT_LOG_EXCEPTION(e); - this->manageNexusAbort(); - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Failed to store data in Nexus file (caught YAT exception)!"), - _CPTC("NexusManager::pushNexusData")); + manageNexusAbort(); + THROW_DEVFAILED("DEVICE_ERROR", + "Failed to store data in Nexus file (caught YAT exception)!", + "NexusManager::pushNexusData"); } catch(std::exception &f) { ERROR_STREAM << "NexusManager::pushNexusData -> caught std Exception: " << f.what() << std::endl; - this->manageNexusAbort(); - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Failed to store data in Nexus file (caught std exception)!"), - _CPTC("NexusManager::pushNexusData")); + manageNexusAbort(); + THROW_DEVFAILED("DEVICE_ERROR", + "Failed to store data in Nexus file (caught std exception)!", + "NexusManager::pushNexusData"); } catch(...) { ERROR_STREAM << "NexusManager::pushData -> caught [...] Exception" << std::endl; - this->manageNexusAbort(); - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Failed to store data in Nexus file (caught [...])!"), - _CPTC("NexusManager::pushNexusData")); + manageNexusAbort(); + THROW_DEVFAILED("DEVICE_ERROR", + "Failed to store data in Nexus file (caught [...])!", + "NexusManager::pushNexusData"); } } } @@ -224,7 +220,7 @@ public: //- Gets Nexus storage state: if true, storage in progress bool getNexusStorageState() { - return !(this->m_finalizeDone); + return !(m_finalizeDone); } //- Gets Nexus storage exception diff --git a/src/PeriodCounter.cpp b/src/PeriodCounter.cpp old mode 100644 new mode 100755 index 3ce62ab17cb1b9060b986268660cf9b8ca7a02a9..9e7bfc9c08b48f597030c6684eafa5e440450c5b --- a/src/PeriodCounter.cpp +++ b/src/PeriodCounter.cpp @@ -21,9 +21,9 @@ namespace PulseCounting_ns do \ { \ if (! m_interface) \ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("request aborted - the interface isn't accessible "), \ - _CPTC("PeriodCounter::check_interface")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the interface isn't accessible ", \ + "PeriodCounter::check_interface"); \ } while (0) @@ -60,7 +60,6 @@ bool PeriodCounter::is_available() // PeriodCounter::init () // ============================================================================ void PeriodCounter::init(CounterConfig p_cfg) - throw (Tango::DevFailed) { m_cfg = p_cfg; @@ -74,17 +73,17 @@ void PeriodCounter::init(CounterConfig p_cfg) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to initialize period counter!"), - _CPTC("PeriodCounter::init")); + "DEVICE_ERROR", + "Failed to initialize period counter!", + "PeriodCounter::init"); } catch (...) { ERROR_STREAM << "Failed to initialize period counter!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to initialize period counter!"), - _CPTC("PeriodCounter::init")); + "DEVICE_ERROR", + "Failed to initialize period counter!", + "PeriodCounter::init"); } } @@ -92,7 +91,6 @@ void PeriodCounter::init(CounterConfig p_cfg) // PeriodCounter::configure () // ============================================================================ void PeriodCounter::configure(CounterConfig p_cfg) - throw (Tango::DevFailed) { m_cfg = p_cfg; @@ -106,17 +104,17 @@ void PeriodCounter::configure(CounterConfig p_cfg) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to configure period counter!"), - _CPTC("PeriodCounter::configure")); + "DEVICE_ERROR", + "Failed to configure period counter!", + "PeriodCounter::configure"); } catch (...) { ERROR_STREAM << "Failed to configure period counter!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to configure period counter!"), - _CPTC("PeriodCounter::configure")); + "DEVICE_ERROR", + "Failed to configure period counter!", + "PeriodCounter::configure"); } } @@ -124,7 +122,6 @@ void PeriodCounter::configure(CounterConfig p_cfg) // PeriodCounter::start () // ============================================================================ void PeriodCounter::start() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -136,17 +133,17 @@ void PeriodCounter::start() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start period counter"), - _CPTC("PeriodCounter::start")); + "DEVICE_ERROR", + "Failed to start period counter", + "PeriodCounter::start"); } catch (...) { ERROR_STREAM << "Failed to start period counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start period counter"), - _CPTC("PeriodCounter::start")); + "DEVICE_ERROR", + "Failed to start period counter", + "PeriodCounter::start"); } m_state = Tango::RUNNING; } @@ -155,7 +152,6 @@ void PeriodCounter::start() // PeriodCounter::stop () // ============================================================================ void PeriodCounter::stop() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -167,17 +163,17 @@ void PeriodCounter::stop() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to stop period counter"), - _CPTC("PeriodCounter::stop")); + "DEVICE_ERROR", + "Failed to stop period counter", + "PeriodCounter::stop"); } catch (...) { ERROR_STREAM << "Failed to stop period counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to stop period counter"), - _CPTC("PeriodCounter::stop")); + "DEVICE_ERROR", + "Failed to stop period counter", + "PeriodCounter::stop"); } m_state = Tango::STANDBY; } @@ -186,7 +182,6 @@ void PeriodCounter::stop() // PeriodCounter::get_state () // ============================================================================ Tango::DevState PeriodCounter::get_state() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -198,17 +193,17 @@ Tango::DevState PeriodCounter::get_state() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get period counter state!"), - _CPTC("PeriodCounter::get_state")); + "DEVICE_ERROR", + "Failed to get period counter state!", + "PeriodCounter::get_state"); } catch (...) { ERROR_STREAM << "Failed to get period counter state!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get period counter state!"), - _CPTC("PeriodCounter::get_state")); + "DEVICE_ERROR", + "Failed to get period counter state!", + "PeriodCounter::get_state"); } } @@ -216,30 +211,29 @@ Tango::DevState PeriodCounter::get_state() // PeriodCounter::update_scalar_value () // ============================================================================ void PeriodCounter::update_scalar_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); try { - yat::AutoMutex<> guard(this->m_dataLock); + yat::AutoMutex<> guard(m_dataLock); m_value = m_interface->getCounterScalarValue(m_cfg); } catch (Tango::DevFailed &e) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update scalar period counter value!"), - _CPTC("PeriodCounter::update_scalar_value")); + "DEVICE_ERROR", + "Failed to update scalar period counter value!", + "PeriodCounter::update_scalar_value"); } catch (...) { ERROR_STREAM << "Failed to update scalar period counter value!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update scalar period counter value!"), - _CPTC("PeriodCounter::update_scalar_value")); + "DEVICE_ERROR", + "Failed to update scalar period counter value!", + "PeriodCounter::update_scalar_value"); } } @@ -247,7 +241,6 @@ void PeriodCounter::update_scalar_value() // PeriodCounter::update_buffer_value () // ============================================================================ void PeriodCounter::update_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -259,17 +252,17 @@ void PeriodCounter::update_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update buffer period counter value!"), - _CPTC("PeriodCounter::update_buffer_value")); + "DEVICE_ERROR", + "Failed to update buffer period counter value!", + "PeriodCounter::update_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to update buffer period counter value!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update buffer period counter value!"), - _CPTC("PeriodCounter::update_buffer_value")); + "DEVICE_ERROR", + "Failed to update buffer period counter value!", + "PeriodCounter::update_buffer_value"); } } @@ -278,7 +271,7 @@ void PeriodCounter::update_buffer_value() // ============================================================================ data_t PeriodCounter::get_scalar_value() { - yat::AutoMutex<> guard(this->m_dataLock); + yat::AutoMutex<> guard(m_dataLock); return m_value; } @@ -286,7 +279,6 @@ data_t PeriodCounter::get_scalar_value() // PeriodCounter::get_buffer_value () // ============================================================================ RawData_t PeriodCounter::get_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -298,17 +290,17 @@ RawData_t PeriodCounter::get_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get period counter buffer value"), - _CPTC("PeriodCounter::get_buffer_value")); + "DEVICE_ERROR", + "Failed to get period counter buffer value", + "PeriodCounter::get_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to get period counter buffer value" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get period counter buffer value"), - _CPTC("PeriodCounter::get_buffer_value")); + "DEVICE_ERROR", + "Failed to get period counter buffer value", + "PeriodCounter::get_buffer_value"); } } @@ -332,7 +324,6 @@ CounterConfig PeriodCounter::get_config() // PeriodCounter::deleteObject () // ============================================================================ void PeriodCounter::deleteObject() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -349,7 +340,6 @@ void PeriodCounter::deleteObject() // PeriodCounter::update_last_buffer_value () // ============================================================================ void PeriodCounter::update_last_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -361,17 +351,17 @@ void PeriodCounter::update_last_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update last buffer period counter value!"), - _CPTC("PeriodCounter::update_last_buffer_value")); + "DEVICE_ERROR", + "Failed to update last buffer period counter value!", + "PeriodCounter::update_last_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to update last buffer period counter value!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update last buffer period counter value!"), - _CPTC("PeriodCounter::update_last_buffer_value")); + "DEVICE_ERROR", + "Failed to update last buffer period counter value!", + "PeriodCounter::update_last_buffer_value"); } } diff --git a/src/PeriodCounter.h b/src/PeriodCounter.h old mode 100644 new mode 100755 index 9d57daa6fb65b0cf0c842c6b262ce5a7ca7b2641..ea7f2d9cdc6d01e6a8080b585aebeff23b6a4200 --- a/src/PeriodCounter.h +++ b/src/PeriodCounter.h @@ -37,55 +37,43 @@ public: bool is_available(); //- init - void init(CounterConfig p_cfg) - throw (Tango::DevFailed); + void init(CounterConfig p_cfg); //- configure - void configure(CounterConfig p_cfg) - throw (Tango::DevFailed); + void configure(CounterConfig p_cfg); //- start - void start() - throw (Tango::DevFailed); + void start(); //- stop - void stop() - throw (Tango::DevFailed); + void stop(); //- release counter - void deleteObject() - throw (Tango::DevFailed); + void deleteObject(); //- get State - Tango::DevState get_state() - throw (Tango::DevFailed); + Tango::DevState get_state(); //- update scalar value - void update_scalar_value() - throw (Tango::DevFailed); + void update_scalar_value(); //- update buffer value (used in "polling" mode) - void update_buffer_value() - throw (Tango::DevFailed); + void update_buffer_value(); //- force last incomplete buffer update (used with trigger listener option) - void update_last_buffer_value() - throw (Tango::DevFailed); + void update_last_buffer_value(); //- get scalar value data_t get_scalar_value(); //- get buffer value - RawData_t get_buffer_value() - throw (Tango::DevFailed); + RawData_t get_buffer_value(); //- get name - std::string get_name() - throw (Tango::DevFailed); + std::string get_name(); //- get config - CounterConfig get_config() - throw (Tango::DevFailed); + CounterConfig get_config(); protected: }; diff --git a/src/PositionCounter.cpp b/src/PositionCounter.cpp old mode 100644 new mode 100755 index 5e5c8bafc9e0f1583d1ac588c487042e3a0f3d76..60b7fac075035107865fe75347e84b3d8562fc29 --- a/src/PositionCounter.cpp +++ b/src/PositionCounter.cpp @@ -21,9 +21,9 @@ namespace PulseCounting_ns do \ { \ if (! m_interface) \ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("request aborted - the interface isn't accessible "), \ - _CPTC("PositionCounter::check_interface")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the interface isn't accessible ", \ + "PositionCounter::check_interface"); \ } while (0) @@ -64,7 +64,6 @@ bool PositionCounter::is_available() // PositionCounter::init () // ============================================================================ void PositionCounter::init(CounterConfig p_cfg) - throw (Tango::DevFailed) { m_cfg = p_cfg; @@ -78,17 +77,17 @@ void PositionCounter::init(CounterConfig p_cfg) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to init counter"), - _CPTC("PositionCounter::init")); + "DEVICE_ERROR", + "Failed to init counter", + "PositionCounter::init"); } catch (...) { ERROR_STREAM << "Failed to init counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to init counter"), - _CPTC("PositionCounter::init")); + "DEVICE_ERROR", + "Failed to init counter", + "PositionCounter::init"); } } @@ -96,7 +95,6 @@ void PositionCounter::init(CounterConfig p_cfg) // PositionCounter::configure () // ============================================================================ void PositionCounter::configure(CounterConfig p_cfg) - throw (Tango::DevFailed) { m_cfg = p_cfg; @@ -110,17 +108,17 @@ void PositionCounter::configure(CounterConfig p_cfg) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to configure counter"), - _CPTC("PositionCounter::configure")); + "DEVICE_ERROR", + "Failed to configure counter", + "PositionCounter::configure"); } catch (...) { ERROR_STREAM << "Failed to configure counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to configure counter"), - _CPTC("PositionCounter::configure")); + "DEVICE_ERROR", + "Failed to configure counter", + "PositionCounter::configure"); } } @@ -128,7 +126,6 @@ void PositionCounter::configure(CounterConfig p_cfg) // PositionCounter::start () // ============================================================================ void PositionCounter::start() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -140,16 +137,16 @@ void PositionCounter::start() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to start counter"), - _CPTC("PositionCounter::start")); + "DEVICE_ERROR", + "Failed to start counter", + "PositionCounter::start"); } catch (...) { ERROR_STREAM << "Failed to start counter" << std::endl; - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Failed to start counter"), - _CPTC("PositionCounter::start")); + THROW_DEVFAILED("DEVICE_ERROR", + "Failed to start counter", + "PositionCounter::start"); } m_state = Tango::RUNNING; } @@ -158,7 +155,6 @@ void PositionCounter::start() // PositionCounter::stop () // ============================================================================ void PositionCounter::stop() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -170,17 +166,17 @@ void PositionCounter::stop() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to stop counter"), - _CPTC("PositionCounter::stop")); + "DEVICE_ERROR", + "Failed to stop counter", + "PositionCounter::stop"); } catch (...) { ERROR_STREAM << "Failed to stop counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to stop counter"), - _CPTC("PositionCounter::stop")); + "DEVICE_ERROR", + "Failed to stop counter", + "PositionCounter::stop"); } m_state = Tango::STANDBY; } @@ -189,7 +185,6 @@ void PositionCounter::stop() // PositionCounter::get_state () // ============================================================================ Tango::DevState PositionCounter::get_state() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -201,17 +196,17 @@ Tango::DevState PositionCounter::get_state() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get evt counter state!"), - _CPTC("PositionCounter::get_state")); + "DEVICE_ERROR", + "Failed to get evt counter state!", + "PositionCounter::get_state"); } catch (...) { ERROR_STREAM << "Failed to get evt counter state!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get evt counter state!"), - _CPTC("PositionCounter::get_state")); + "DEVICE_ERROR", + "Failed to get evt counter state!", + "PositionCounter::get_state"); } } @@ -219,30 +214,29 @@ Tango::DevState PositionCounter::get_state() // PositionCounter::update_scalar_value () // ============================================================================ void PositionCounter::update_scalar_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); try { - yat::AutoMutex<> guard(this->m_dataLock); + yat::AutoMutex<> guard(m_dataLock); m_value = m_interface->getCounterScalarValue(m_cfg); } catch (Tango::DevFailed &e) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update scalar counter value"), - _CPTC("PositionCounter::update_scalar_value")); + "DEVICE_ERROR", + "Failed to update scalar counter value", + "PositionCounter::update_scalar_value"); } catch (...) { ERROR_STREAM << "Failed to update scalar counter value" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update scalar counter value"), - _CPTC("PositionCounter::update_scalar_value")); + "DEVICE_ERROR", + "Failed to update scalar counter value", + "PositionCounter::update_scalar_value"); } } @@ -250,7 +244,6 @@ void PositionCounter::update_scalar_value() // PositionCounter::update_buffer_value () // ============================================================================ void PositionCounter::update_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -262,17 +255,17 @@ void PositionCounter::update_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update buffer evt counter value!"), - _CPTC("PositionCounter::update_buffer_value")); + "DEVICE_ERROR", + "Failed to update buffer evt counter value!", + "PositionCounter::update_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to update buffer evt counter value!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update buffer evt counter value!"), - _CPTC("PositionCounter::update_buffer_value")); + "DEVICE_ERROR", + "Failed to update buffer evt counter value!", + "PositionCounter::update_buffer_value"); } } @@ -281,7 +274,7 @@ void PositionCounter::update_buffer_value() // ============================================================================ data_t PositionCounter::get_scalar_value() { - yat::AutoMutex<> guard(this->m_dataLock); + yat::AutoMutex<> guard(m_dataLock); return m_value; } @@ -289,7 +282,6 @@ data_t PositionCounter::get_scalar_value() // PositionCounter::get_buffer_value () // ============================================================================ RawData_t PositionCounter::get_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -301,17 +293,17 @@ RawData_t PositionCounter::get_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get counter buffer value"), - _CPTC("PositionCounter::get_buffer_value")); + "DEVICE_ERROR", + "Failed to get counter buffer value", + "PositionCounter::get_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to get counter buffer value" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get counter buffer value"), - _CPTC("PositionCounter::get_buffer_value")); + "DEVICE_ERROR", + "Failed to get counter buffer value", + "PositionCounter::get_buffer_value"); } } @@ -334,7 +326,6 @@ CounterConfig PositionCounter::get_config() // PositionCounter::deleteObject () // ============================================================================ void PositionCounter::deleteObject() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -351,7 +342,6 @@ void PositionCounter::deleteObject() // PositionCounter::update_last_buffer_value () // ============================================================================ void PositionCounter::update_last_buffer_value() - throw (Tango::DevFailed) { CHECK_INTERFACE(); @@ -363,17 +353,17 @@ void PositionCounter::update_last_buffer_value() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update last buffer dt counter value!"), - _CPTC("PositionCounter::update_last_buffer_value")); + "DEVICE_ERROR", + "Failed to update last buffer dt counter value!", + "PositionCounter::update_last_buffer_value"); } catch (...) { ERROR_STREAM << "Failed to update last buffer dt counter value!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to update last buffer dt counter value!"), - _CPTC("PositionCounter::update_last_buffer_value")); + "DEVICE_ERROR", + "Failed to update last buffer dt counter value!", + "PositionCounter::update_last_buffer_value"); } } diff --git a/src/PositionCounter.h b/src/PositionCounter.h old mode 100644 new mode 100755 index 22cb22d675fe5077bae7c670780bcfe4e574c873..f4827dfec16544675caf8ddca10e110449a3315c --- a/src/PositionCounter.h +++ b/src/PositionCounter.h @@ -37,55 +37,44 @@ public: bool is_available(); //- init - void init(CounterConfig p_cfg) - throw (Tango::DevFailed); + void init(CounterConfig p_cfg); //- configure - void configure(CounterConfig p_cfg) - throw (Tango::DevFailed); + void configure(CounterConfig p_cfg); //- start - void start() - throw (Tango::DevFailed); + void start(); //- stop - void stop() - throw (Tango::DevFailed); + void stop(); //- release counter - void deleteObject() - throw (Tango::DevFailed); + void deleteObject(); //- get State - Tango::DevState get_state() - throw (Tango::DevFailed); + Tango::DevState get_state(); //- update scalar value - void update_scalar_value() - throw (Tango::DevFailed); + void update_scalar_value(); //- update buffer value (used in "polling" mode) - void update_buffer_value() - throw (Tango::DevFailed); + void update_buffer_value(); //- force last incomplete buffer update (used with trigger listener option) - void update_last_buffer_value() - throw (Tango::DevFailed); + void update_last_buffer_value(); //- get scalar value data_t get_scalar_value(); //- get buffer value - RawData_t get_buffer_value() - throw (Tango::DevFailed); + RawData_t get_buffer_value(); //- get name - std::string get_name() - throw (Tango::DevFailed); + std::string get_name(); //- get config - CounterConfig get_config() - throw (Tango::DevFailed); + CounterConfig get_config(); + protected: }; diff --git a/src/PulseCounting.cpp b/src/PulseCounting.cpp index 7ce93d926ecf40b9a88cbf7410257bf26725d090..e0d2182a62d4c59a10962c797846764c21a3e18e 100755 --- a/src/PulseCounting.cpp +++ b/src/PulseCounting.cpp @@ -75,9 +75,9 @@ namespace PulseCounting_ns do \ { \ if (! m_manager) \ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("request aborted - the manager isn't accessible "), \ - _CPTC("PulseCounting::check_manager")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the manager isn't accessible ", \ + "PulseCounting::check_manager"); \ } while (0) //+---------------------------------------------------------------------------- @@ -132,6 +132,8 @@ void PulseCounting::delete_device() //- remove the inner appender yat4tango::InnerAppender::release(this); + //- remove the Device Info + yat4tango::DeviceInfo::release(this); } //+---------------------------------------------------------------------------- @@ -153,7 +155,11 @@ void PulseCounting::init_device() //- initialize the inner appender (first thing to do) try { + INFO_STREAM << "Create the InnerAppender in order to manage logs." << std::endl; yat4tango::InnerAppender::initialize(this); + + INFO_STREAM << "Create the DeviceInfo in order to display dependencies versions." << std::endl; + yat4tango::DeviceInfo::initialize(this, YAT_XSTR(PROJECT_NAME), YAT_XSTR(PROJECT_VERSION)); } catch( Tango::DevFailed& df ) { @@ -186,7 +192,7 @@ void PulseCounting::init_device() //-------------------------------------------- try { - this->get_device_property(); + get_device_property(); } catch (Tango::DevFailed & df) { @@ -581,14 +587,14 @@ void PulseCounting::get_device_property() //-- Check mandatory properties: - if (this->boardType.empty()) + if (boardType.empty()) { // add predefined property Tango::DbDatum prop("BoardType"); prop << "PXI-6602:8"; data_put.push_back(prop); } - if (this->boards.empty()) + if (boards.empty()) { // add predefined property Tango::DbDatum prop("Boards"); @@ -606,9 +612,9 @@ void PulseCounting::get_device_property() if (boardType.size() == 0) { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("The boardType property is empty. Please use one of the following value: PXI-6602:<nb chan>"), - _CPTC("PulseCounting::get_device_property")); + "CONFIGURATION_ERROR", + "The boardType property is empty. Please use one of the following value: PXI-6602:<nb chan>", + "PulseCounting::get_device_property"); } else { @@ -623,21 +629,21 @@ void PulseCounting::get_device_property() else { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("The BoardType property is not properly defined. Please use one of the following value: PXI-6602:<nb chan>"), - _CPTC("PulseCounting::get_device_property")); + "CONFIGURATION_ERROR", + "The BoardType property is not properly defined. Please use one of the following value: PXI-6602:<nb chan>", + "PulseCounting::get_device_property"); } // extract number of channels unsigned int l_cts = atoi(l_vect[1].c_str()); // max number of channels per board - this->m_board_arch.chanNb = l_cts; + m_board_arch.chanNb = l_cts; } else { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("The BoardType property is not properly defined. Please use one of the following value : PXI-6602:<nb chan>"), - _CPTC("PulseCounting::get_device_property")); + "CONFIGURATION_ERROR", + "The BoardType property is not properly defined. Please use one of the following value : PXI-6602:<nb chan>", + "PulseCounting::get_device_property"); } } @@ -649,20 +655,20 @@ void PulseCounting::get_device_property() else { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("The Boards property is empty! Please define at least one board!"), - _CPTC("PulseCounting::get_device_property")); + "CONFIGURATION_ERROR", + "The Boards property is empty! Please define at least one board!", + "PulseCounting::get_device_property"); } // 1st: parse board list property and set total number of channels - unsigned int l_maxi_counter_nb = m_board_arch.boardList.size() * this->m_board_arch.chanNb; + unsigned int l_maxi_counter_nb = m_board_arch.boardList.size() * m_board_arch.chanNb; if (l_maxi_counter_nb == 0) { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Total number of channels is null! Check Boards and BoardType properties."), - _CPTC("PulseCounting::get_device_property")); + "CONFIGURATION_ERROR", + "Total number of channels is null! Check Boards and BoardType properties.", + "PulseCounting::get_device_property"); } m_board_arch.counterConfiguration.clear(); @@ -673,7 +679,7 @@ void PulseCounting::get_device_property() { CounterConfig l_cfg; - l_curr_board_cpt = l_current_ctr_nb/this->m_board_arch.chanNb; + l_curr_board_cpt = l_current_ctr_nb/m_board_arch.chanNb; // try to read properties for CounterXX char num_ctr[3]; @@ -747,28 +753,28 @@ void PulseCounting::get_device_property() } } l_cfg.ctNumber = l_current_ctr_nb; - l_cfg.number = l_current_ctr_nb - (l_curr_board_cpt * this->m_board_arch.chanNb); // to take into account multi board configs + l_cfg.number = l_current_ctr_nb - (l_curr_board_cpt * m_board_arch.chanNb); // to take into account multi board configs } catch (Tango::DevFailed & df) { ERROR_STREAM << l_ct << " property is not well defined! : " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("COMMAND_FAILED"), - _CPTC("Failed to read properties"), - _CPTC("PulseCounting::get_device_property")); + "COMMAND_FAILED", + "Failed to read properties", + "PulseCounting::get_device_property"); } catch (...) { ERROR_STREAM << l_ct << " property is not well defined!" << std::endl; THROW_DEVFAILED( - _CPTC("UNKNOWN_ERROR"), - _CPTC("Failed to read properties"), - _CPTC("PulseCounting::get_device_property")); + "UNKNOWN_ERROR", + "Failed to read properties", + "PulseCounting::get_device_property"); } // set apply flag for initial value computing // i.e., if external clock, apply initial value - l_cfg.applyInitPos = !this->isMaster; + l_cfg.applyInitPos = !isMaster; l_cfg.dump(); m_board_arch.counterConfiguration[l_current_ctr_nb] = l_cfg; @@ -793,15 +799,15 @@ void PulseCounting::get_device_property() try { - this->get_db_device()->put_property(l_db_data); + get_db_device()->put_property(l_db_data); } catch (Tango::DevFailed &df) { ERROR_STREAM << "Failed to create default property" << l_str_ct_0 << endl; RETHROW_DEVFAILED(df, - _CPTC("TANGO_DEVICE_ERROR"), - _CPTC(std::string(df.errors[0].desc).c_str()), - _CPTC("PulseCounting::get_device_property")); + "TANGO_DEVICE_ERROR", + (std::string(df.errors[0].desc).c_str()), + "PulseCounting::get_device_property"); } } @@ -820,9 +826,9 @@ void PulseCounting::get_device_property() { ERROR_STREAM << "PollingPeriod property should not be null!" << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("PollingPeriod property should not be null!"), - _CPTC("PulseCounting::get_device_property")); + "CONFIGURATION_ERROR", + "PollingPeriod property should not be null!", + "PulseCounting::get_device_property"); } m_acq_param.pollingPeriod = pollingPeriod; @@ -831,9 +837,9 @@ void PulseCounting::get_device_property() { ERROR_STREAM << "Bad value for NexusMeasureDimension property: should be 0 or 1!" << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Bad value for NexusMeasureDimension property: should be 0 or 1!"), - _CPTC("PulseCounting::get_device_property")); + "CONFIGURATION_ERROR", + "Bad value for NexusMeasureDimension property: should be 0 or 1!", + "PulseCounting::get_device_property"); } m_acq_param.nexusMeasDim = nexusMeasureDimension; @@ -843,9 +849,9 @@ void PulseCounting::get_device_property() yat::OSStream oss; oss << "TimeoutSec property is too large. Maximum value is " << kTMO_MAX_SEC << " seconds!" << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), + "CONFIGURATION_ERROR", oss.str().c_str(), - _CPTC("PulseCounting::get_device_property")); + "PulseCounting::get_device_property"); } // get all the memorized values @@ -968,9 +974,9 @@ void PulseCounting::write_acquisitionMode(Tango::WAttribute &attr) if (dev_state() == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCounting::write_acquisitionMode")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCounting::write_acquisitionMode"); } DEBUG_STREAM << "PulseCounting::write_acquisitionMode(Tango::WAttribute &attr) entering... "<< endl; @@ -992,9 +998,9 @@ void PulseCounting::write_acquisitionMode(Tango::WAttribute &attr) else { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("The acqMode attribute value isn't correct. Please use one of the following value : SCALAR, BUFFERED"), - _CPTC("PulseCounting::write_acquisitionMode")); + "CONFIGURATION_ERROR", + "The acqMode attribute value isn't correct. Please use one of the following value : SCALAR, BUFFERED", + "PulseCounting::write_acquisitionMode"); } } @@ -1017,9 +1023,9 @@ void PulseCounting::write_acquisitionMode(Tango::WAttribute &attr) { ERROR_STREAM << "failed to create manager" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to create manager"), - _CPTC("PulseCounting::write_acquisitionMode")); + "DEVICE_ERROR", + "Failed to create manager", + "PulseCounting::write_acquisitionMode"); } // test the manager @@ -1027,9 +1033,9 @@ void PulseCounting::write_acquisitionMode(Tango::WAttribute &attr) { ERROR_STREAM << "failed to access manager" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to access manager"), - _CPTC("PulseCounting::write_acquisitionMode")); + "DEVICE_ERROR", + "Failed to access manager", + "PulseCounting::write_acquisitionMode"); } // initialize the manager @@ -1042,17 +1048,17 @@ void PulseCounting::write_acquisitionMode(Tango::WAttribute &attr) { ERROR_STREAM << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to init manager"), - _CPTC("PulseCounting::write_acquisitionMode")); + "DEVICE_ERROR", + "Failed to init manager", + "PulseCounting::write_acquisitionMode"); } catch (...) { ERROR_STREAM << "failed to init manager" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to init manager"), - _CPTC("PulseCounting::write_acquisitionMode")); + "DEVICE_ERROR", + "Failed to init manager", + "PulseCounting::write_acquisitionMode"); } //- set acquisition parameters @@ -1064,17 +1070,17 @@ void PulseCounting::write_acquisitionMode(Tango::WAttribute &attr) { ERROR_STREAM << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to set acquisition parameters"), - _CPTC("PulseCounting::write_acquisitionMode")); + "DEVICE_ERROR", + "Failed to set acquisition parameters", + "PulseCounting::write_acquisitionMode"); } catch (...) { ERROR_STREAM << "failed to set acquisition parameters" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to set acquisition parameters"), - _CPTC("PulseCounting::write_acquisitionMode")); + "DEVICE_ERROR", + "Failed to set acquisition parameters", + "PulseCounting::write_acquisitionMode"); } //- GO for Manager @@ -1086,17 +1092,17 @@ void PulseCounting::write_acquisitionMode(Tango::WAttribute &attr) { ERROR_STREAM << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to go for manager"), - _CPTC("PulseCounting::write_acquisitionMode")); + "DEVICE_ERROR", + "Failed to go for manager", + "PulseCounting::write_acquisitionMode"); } catch (...) { ERROR_STREAM << "failed to go for manager" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to go for manager"), - _CPTC("PulseCounting::write_acquisitionMode")); + "DEVICE_ERROR", + "Failed to go for manager", + "PulseCounting::write_acquisitionMode"); } //- configure clock @@ -1149,9 +1155,9 @@ void PulseCounting::write_continuous(Tango::WAttribute &attr) if (dev_state() == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCounting::write_continuous")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCounting::write_continuous"); } DEBUG_STREAM << "PulseCounting::write_continuous(Tango::WAttribute &attr) entering... "<< endl; @@ -1169,17 +1175,17 @@ void PulseCounting::write_continuous(Tango::WAttribute &attr) { ERROR_STREAM << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("DEVICE_ERROR"), - _CPTC("write_continuous failed"), - _CPTC("PulseCounting::write_continuous")); + "DEVICE_ERROR", + "write_continuous failed", + "PulseCounting::write_continuous"); } catch (...) { ERROR_STREAM << "failed to write continuous mode" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("write_continuous failed"), - _CPTC("PulseCounting::write_continuous")); + "DEVICE_ERROR", + "write_continuous failed", + "PulseCounting::write_continuous"); } // memorize new value @@ -1211,9 +1217,9 @@ void PulseCounting::write_nexusFileGeneration(Tango::WAttribute &attr) if (dev_state() == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCounting::write_nexusFileGeneration")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCounting::write_nexusFileGeneration"); } DEBUG_STREAM << "PulseCounting::write_nexusFileGeneration(Tango::WAttribute &attr) entering... "<< endl; @@ -1260,9 +1266,9 @@ void PulseCounting::write_nexusTargetPath(Tango::WAttribute &attr) if (dev_state() == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCounting::write_nexusTargetPath")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCounting::write_nexusTargetPath"); } DEBUG_STREAM << "PulseCounting::write_nexusTargetPath(Tango::WAttribute &attr) entering... "<< endl; @@ -1303,9 +1309,9 @@ void PulseCounting::write_nexusNbAcqPerFile(Tango::WAttribute &attr) if (dev_state() == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCounting::write_nexusNbAcqPerFile")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCounting::write_nexusNbAcqPerFile"); } DEBUG_STREAM << "PulseCounting::write_nexusNbAcqPerFile(Tango::WAttribute &attr) entering... "<< endl; @@ -1315,9 +1321,9 @@ void PulseCounting::write_nexusNbAcqPerFile(Tango::WAttribute &attr) if (0 == l_val) { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Value should not be null!"), - _CPTC("PulseCounting::write_nexusNbAcqPerFile")); + "CONFIGURATION_ERROR", + "Value should not be null!", + "PulseCounting::write_nexusNbAcqPerFile"); } CHECK_MANAGER(); @@ -1344,27 +1350,27 @@ void PulseCounting::start() DEBUG_STREAM << "PulseCounting::start(): entering... !" << endl; // Add your own code to control device here - Tango::DevState st = this->dev_state(); + Tango::DevState st = dev_state(); if ((st == Tango::RUNNING) || (st == Tango::FAULT)) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Start is not allowed when the device is running or fault."), - _CPTC("PulseCounting::start")); + "DEVICE_ERROR", + "Start is not allowed when the device is running or fault.", + "PulseCounting::start"); } // Add your own code to control device here CHECK_MANAGER(); // check configuration mode and slave mode - DEBUG_STREAM << "**** acq mode = " << m_acq_param.acqMode << " - master? " << this->isMaster << std::endl; - if ((m_acq_param.acqMode == ACQ_MODE_SCAL) && (!this->isMaster)) + DEBUG_STREAM << "**** acq mode = " << m_acq_param.acqMode << " - master? " << isMaster << std::endl; + if ((m_acq_param.acqMode == ACQ_MODE_SCAL) && (!isMaster)) { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Cannot use slave configuration in SCALAR mode: check IsMaster property first!"), - _CPTC("PulseCounting::start")); + "CONFIGURATION_ERROR", + "Cannot use slave configuration in SCALAR mode: check IsMaster property first!", + "PulseCounting::start"); } try @@ -1375,17 +1381,17 @@ void PulseCounting::start() { ERROR_STREAM << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("DEVICE_ERROR"), - _CPTC("Start failed! Caught DevFailed!"), - _CPTC("PulseCounting::start")); + "DEVICE_ERROR", + "Start failed! Caught DevFailed!", + "PulseCounting::start"); } catch (...) { ERROR_STREAM << "Failed to start acquisition! Caught [...]" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Start failed! Caught [...]!"), - _CPTC("PulseCounting::start")); + "DEVICE_ERROR", + "Start failed! Caught [...]!", + "PulseCounting::start"); } if (!m_auto_start_ok) @@ -1412,8 +1418,8 @@ void PulseCounting::stop() CHECK_MANAGER(); - if ((this->dev_state() == Tango::STANDBY) && - (!this->m_acq_param.continuousAcquisition)) + if ((dev_state() == Tango::STANDBY) && + (!m_acq_param.continuousAcquisition)) { // do nothing } @@ -1427,17 +1433,17 @@ void PulseCounting::stop() { ERROR_STREAM << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("DEVICE_ERROR"), - _CPTC("Stop failed"), - _CPTC("PulseCounting::stop")); + "DEVICE_ERROR", + "Stop failed", + "PulseCounting::stop"); } catch (...) { ERROR_STREAM << "failed to Stop" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Stop failed"), - _CPTC("PulseCounting::stop")); + "DEVICE_ERROR", + "Stop failed", + "PulseCounting::stop"); } } } @@ -1478,18 +1484,18 @@ Tango::DevString PulseCounting::get_driver_version() { ERROR_STREAM << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("DEVICE_ERROR"), - _CPTC("Start failed"), - _CPTC("PulseCounting::get_driver_version")); + "DEVICE_ERROR", + "Start failed", + "PulseCounting::get_driver_version"); } catch (...) { ERROR_STREAM << "failed to get driver version" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Start failed"), - _CPTC("PulseCounting::get_driver_version")); + "DEVICE_ERROR", + "Start failed", + "PulseCounting::get_driver_version"); } return Tango::string_dup(l_driver_version.c_str()); @@ -1568,7 +1574,7 @@ Tango::DevState PulseCounting::dev_state() { try { - m_state = this->m_manager->get_state(); + m_state = m_manager->get_state(); } catch(...) { @@ -1610,16 +1616,16 @@ Tango::ConstDevString PulseCounting::dev_status() { try { - this->m_status = this->m_manager->get_status(); + m_status = m_manager->get_status(); } catch(...) { - this->m_status = std::string("Device status creation failed!\nCheck <logs> attribute for details..."); + m_status = std::string("Device status creation failed!\nCheck <logs> attribute for details..."); } } } - argout = this->m_status.c_str(); + argout = m_status.c_str(); return argout; } @@ -1649,7 +1655,7 @@ Tango::DevString PulseCounting::check_configuration(Tango::DevBoolean argin) CHECK_MANAGER(); - std::string check_str = this->m_manager->check_configuration((bool)argin); + std::string check_str = m_manager->check_configuration((bool)argin); return Tango::string_dup(check_str.c_str());; } @@ -1686,24 +1692,24 @@ void PulseCounting::set_dataset_name(const Tango::DevVarLongStringArray *argin) if (argin->svalue.length() != argin->lvalue.length()) { ERROR_STREAM << "Bad number of arguments: should have same number of strings & longs!" << endl; - THROW_DEVFAILED(_CPTC("DATA_OUT_OF_RANGE"), - _CPTC("Bad number of arguments: should have same number of strings & longs!"), - _CPTC("PulseCounting::set_dataset_name")); + THROW_DEVFAILED("DATA_OUT_OF_RANGE", + "Bad number of arguments: should have same number of strings & longs!", + "PulseCounting::set_dataset_name"); } if (argin->svalue.length() == 0) { ERROR_STREAM << "Empty list of (counter number, dataset name)!" << endl; - THROW_DEVFAILED(_CPTC("DATA_OUT_OF_RANGE"), - _CPTC("Empty list of (counter number, dataset name)!"), - _CPTC("PulseCounting::set_dataset_name")); + THROW_DEVFAILED("DATA_OUT_OF_RANGE", + "Empty list of (counter number, dataset name)!", + "PulseCounting::set_dataset_name"); } // check Device state if (dev_state() == Tango::RUNNING) { - THROW_DEVFAILED(_CPTC("BAD_STATE"), - _CPTC("request aborted - dataset not writable in this state"), - _CPTC("PulseCounting::set_dataset_name")); + THROW_DEVFAILED("BAD_STATE", + "request aborted - dataset not writable in this state", + "PulseCounting::set_dataset_name"); } CHECK_MANAGER(); @@ -1719,12 +1725,12 @@ void PulseCounting::set_dataset_name(const Tango::DevVarLongStringArray *argin) if (dataset.empty()) { ERROR_STREAM << "Empty dataset for counter number: " << ct_nb << endl; - THROW_DEVFAILED(_CPTC("DATA_OUT_OF_RANGE"), - _CPTC("Empty dataset name!"), - _CPTC("PulseCounting::set_dataset_name")); + THROW_DEVFAILED("DATA_OUT_OF_RANGE", + "Empty dataset name!", + "PulseCounting::set_dataset_name"); } - this->m_manager->change_nx_dataset(ct_nb, dataset); + m_manager->change_nx_dataset(ct_nb, dataset); } } @@ -1762,7 +1768,7 @@ Tango::DevVarLongStringArray *PulseCounting::get_channel_info() // get channel information as a map: // <channel id, string> where string has the required format - std::map<yat::uint16, std::string> infos = this->m_manager->get_channel_info(); + std::map<yat::uint16, std::string> infos = m_manager->get_channel_info(); size_t number_of_channels = infos.size(); diff --git a/src/PulseCounting.h b/src/PulseCounting.h old mode 100644 new mode 100755 index 89d0ae2139f341483d1d68bb1357c3853d0e833b..e453056b630416b8ef11c7aa8e9acdae978de5d9 --- a/src/PulseCounting.h +++ b/src/PulseCounting.h @@ -39,6 +39,8 @@ #include <yat4tango/YatLogAdapter.h> #include <yat4tango/PropertyHelper.h> #include "CountingBoardInterface.h" +#include <yat4tango/DeviceInfo.h> + /** * @author $Author: $ * @version $Revision: $ @@ -54,11 +56,11 @@ namespace PulseCounting_ns /** * Class Description: * The PulseCounting Device manage 2 counting functions: - * � Basic event counting, - * � Encoder position measurement. + * � Basic event counting, + * � Encoder position measurement. * The Device can count in 2 possible modes: - * � scalar event counting, - * � buffered event counting. + * � scalar event counting, + * � buffered event counting. */ /* diff --git a/src/PulseCountingManager.cpp b/src/PulseCountingManager.cpp index 274116554880e906d9a8ad1be12168c351f5b30b..868d6228cc3d518111194ccf3f10d3b8f65b5289 100755 --- a/src/PulseCountingManager.cpp +++ b/src/PulseCountingManager.cpp @@ -19,12 +19,12 @@ namespace PulseCounting_ns { //- Check nexus manager macro: #define CHECK_NX_MANAGER() \ - if (! this->m_nexus_manager) \ + if (! m_nexus_manager) \ { \ m_status = "Internal error."; \ - THROW_DEVFAILED(_CPTC("INTERNAL_ERROR"), \ - _CPTC("request aborted - the Nexus manager isn't properly initialized"), \ - _CPTC("PulseCountingManager::check_nx_manager")); \ + THROW_DEVFAILED("INTERNAL_ERROR", \ + "request aborted - the Nexus manager isn't properly initialized", \ + "PulseCountingManager::check_nx_manager"); \ } while (0) //- check macro: @@ -32,9 +32,9 @@ namespace PulseCounting_ns do \ { \ if (! m_dyn_attr_manager)\ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("The dynamic attribute manager object isn't accessible "), \ - _CPTC("PulseCountingManager::check_manager_dyn_attr_manager")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "The dynamic attribute manager object isn't accessible ", \ + "PulseCountingManager::check_manager_dyn_attr_manager"); \ } while (0) //- check counting boerd macro: @@ -42,9 +42,9 @@ namespace PulseCounting_ns do \ { \ if (! m_counting_board) \ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("request aborted - the counting board isn't accessible "), \ - _CPTC("PulseCountingManager::check_counting_board")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the counting board isn't accessible ", \ + "PulseCountingManager::check_counting_board"); \ } while (0) // ============================================================================ @@ -56,11 +56,11 @@ PulseCountingManager::PulseCountingManager (Tango::DeviceImpl * hostDevice) //- trace/profile this method yat4tango::TraceHelper t("PulseCountingManager::PulseCountingManager", this); - this->set_timeout_msg_period (0xFFFF); - this->enable_timeout_msg (false); + set_timeout_msg_period (0xFFFF); + enable_timeout_msg (false); - this->set_periodic_msg_period (0xFFFF); - this->enable_periodic_msg (false); + set_periodic_msg_period (0xFFFF); + enable_periodic_msg (false); m_dyn_attr_manager = NULL; m_nexus_manager = NULL; @@ -82,16 +82,16 @@ PulseCountingManager::PulseCountingManager (Tango::DeviceImpl * hostDevice) catch (Tango::DevFailed &e) { ERROR_STREAM << e << std::endl; - RETHROW_DEVFAILED(e, _CPTC("DEVICE_ERROR"), - _CPTC("Failed to create Dynamic Attribute Manager"), - _CPTC("PulseCountingManager::PulseCountingManager")); + RETHROW_DEVFAILED(e, "DEVICE_ERROR", + "Failed to create Dynamic Attribute Manager", + "PulseCountingManager::PulseCountingManager"); } catch (...) { ERROR_STREAM << "Failed to create Dynamic Attribute Manager" << std::endl; - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Failed to create Dynamic Attribute Manager"), - _CPTC("PulseCountingManager::PulseCountingManager")); + THROW_DEVFAILED("DEVICE_ERROR", + "Failed to create Dynamic Attribute Manager", + "PulseCountingManager::PulseCountingManager"); } } @@ -100,13 +100,13 @@ PulseCountingManager::PulseCountingManager (Tango::DeviceImpl * hostDevice) // ============================================================================ PulseCountingManager::~PulseCountingManager () { - this->enable_periodic_msg(false); + enable_periodic_msg(false); // delete clock generator if exists - if (this->m_clock_generator) + if (m_clock_generator) { - delete this->m_clock_generator; - this->m_clock_generator = NULL; + delete m_clock_generator; + m_clock_generator = NULL; } // delete counting board @@ -145,7 +145,7 @@ PulseCountingManager::~PulseCountingManager () // ============================================================================ Tango::DevState PulseCountingManager::get_state() { - yat::AutoMutex<> guard(this->m_flagLock); + yat::AutoMutex<> guard(m_flagLock); return m_state; } @@ -154,7 +154,7 @@ Tango::DevState PulseCountingManager::get_state() // ============================================================================ std::string PulseCountingManager::get_status() { - yat::AutoMutex<> guard(this->m_flagLock); + yat::AutoMutex<> guard(m_flagLock); return m_status; } @@ -162,7 +162,6 @@ std::string PulseCountingManager::get_status() // PulseCountingManager::init () // ============================================================================ void PulseCountingManager::init(BoardArchitecture p_board_arch) - throw (Tango::DevFailed) { INFO_STREAM << "PulseCountingManager::init" << endl; m_state = Tango::STANDBY; @@ -178,65 +177,65 @@ void PulseCountingManager::init(BoardArchitecture p_board_arch) ERROR_STREAM << "Problem occurred during Nexus manager allocation" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Problem during Nexus manager allocation"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Problem during Nexus manager allocation", + "PulseCountingManager::init"); } //construct all the objects depending on the configuration try { m_counting_board = CountingBoardFactory::instanciate(m_board_arch.hostDevice, m_board_arch.boardType, - m_acq_param.acqMode, this->m_nexus_manager); + m_acq_param.acqMode, m_nexus_manager); } catch (Tango::DevFailed &e) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to create counting board"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to create counting board", + "PulseCountingManager::init"); } catch (...) { ERROR_STREAM << "Failed to create counting board" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to create counting board"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to create counting board", + "PulseCountingManager::init"); } if (!m_counting_board) { ERROR_STREAM << "Failed to access counting board" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to access counting board"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to access counting board", + "PulseCountingManager::init"); } // Create acquisition attributes if internal clock generation - if (this->m_board_arch.clockGeneration) + if (m_board_arch.clockGeneration) { try { - this->add_common_attributes(); + add_common_attributes(); } catch (Tango::DevFailed &e) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to create acquisition attributes!"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to create acquisition attributes!", + "PulseCountingManager::init"); } catch (...) { ERROR_STREAM << "Failed to init counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to create acquisition attributes!"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to create acquisition attributes!", + "PulseCountingManager::init"); } } @@ -251,7 +250,7 @@ void PulseCountingManager::init(BoardArchitecture p_board_arch) double val = 0.0; try { - val = get_value_as_property<double>(this->m_board_arch.hostDevice, prop_name); + val = get_value_as_property<double>(m_board_arch.hostDevice, prop_name); l_cfg.minPulseWidth = val; } catch(...) @@ -264,7 +263,7 @@ void PulseCountingManager::init(BoardArchitecture p_board_arch) bool tof = false; try { - tof = get_value_as_property<bool>(this->m_board_arch.hostDevice, prop_name); + tof = get_value_as_property<bool>(m_board_arch.hostDevice, prop_name); l_cfg.minPulseWidthEnabled = tof; } catch(...) @@ -277,7 +276,7 @@ void PulseCountingManager::init(BoardArchitecture p_board_arch) tof = false; try { - tof = get_value_as_property<bool>(this->m_board_arch.hostDevice, prop_name); + tof = get_value_as_property<bool>(m_board_arch.hostDevice, prop_name); l_cfg.nexus = tof; } catch(...) @@ -287,7 +286,7 @@ void PulseCountingManager::init(BoardArchitecture p_board_arch) DEBUG_STREAM << "PulseCountingManager::init() - no memorized value found for " << prop_name << std::endl; DEBUG_STREAM << "Initialize from property Nexus:" << l_cfg.nexus << std::endl; // memorize this value - yat4tango::PropertyHelper::set_property<bool>(this->m_board_arch.hostDevice, prop_name, l_cfg.nexus); + yat4tango::PropertyHelper::set_property<bool>(m_board_arch.hostDevice, prop_name, l_cfg.nexus); // <- end of OBSOLETE code // code to be enabled in NEXT version: @@ -308,17 +307,17 @@ void PulseCountingManager::init(BoardArchitecture p_board_arch) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to init counter"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to init counter", + "PulseCountingManager::init"); } catch (...) { ERROR_STREAM << "Failed to init counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to init counter"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to init counter", + "PulseCountingManager::init"); } } } @@ -326,17 +325,17 @@ void PulseCountingManager::init(BoardArchitecture p_board_arch) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to instantiate counter"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to instantiate counter", + "PulseCountingManager::init"); } catch (...) { ERROR_STREAM << "Failed to instantiate counter" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to instantiate counter"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to instantiate counter", + "PulseCountingManager::init"); } // check counters validity @@ -349,31 +348,31 @@ void PulseCountingManager::init(BoardArchitecture p_board_arch) { ERROR_STREAM << "Counter not available: " << l_cfg.number << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("The counter is not available!"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "The counter is not available!", + "PulseCountingManager::init"); } // Create the associated dynamic attributes (except counter value) try { - this->add_attributes(l_cfg); + add_attributes(l_cfg); } catch (Tango::DevFailed &e) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to add attributes"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to add attributes", + "PulseCountingManager::init"); } catch (...) { ERROR_STREAM << "Failed to add attributes" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to add attributes"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to add attributes", + "PulseCountingManager::init"); } } @@ -389,17 +388,17 @@ void PulseCountingManager::init(BoardArchitecture p_board_arch) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to create clock generator"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to create clock generator", + "PulseCountingManager::init"); } catch (...) { ERROR_STREAM << "Failed to create clock generator" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to create clock generator"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to create clock generator", + "PulseCountingManager::init"); } // check clock @@ -407,9 +406,9 @@ void PulseCountingManager::init(BoardArchitecture p_board_arch) { ERROR_STREAM << "Failed to create clock generator" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to create clock generator"), - _CPTC("PulseCountingManager::init")); + "DEVICE_ERROR", + "Failed to create clock generator", + "PulseCountingManager::init"); } } else @@ -433,21 +432,20 @@ void PulseCountingManager::init(BoardArchitecture p_board_arch) // PulseCountingManager::start () // ============================================================================ void PulseCountingManager::start() - throw (Tango::DevFailed) { // initialize flags { - yat::AutoMutex<> guard(this->m_flagLock); - this->m_firstStart = true; - this->m_requestedStop = false; + yat::AutoMutex<> guard(m_flagLock); + m_firstStart = true; + m_requestedStop = false; } yat::Message * msg = yat::Message::allocate(kSTART_MSG, DEFAULT_MSG_PRIORITY, true); // force internal state to RUNNING because configuring board may take a long time - this->wait_msg_handled(msg, 5000); + wait_msg_handled(msg, 5000); { - yat::AutoMutex<> guard(this->m_flagLock); + yat::AutoMutex<> guard(m_flagLock); m_state = Tango::RUNNING; } } @@ -456,17 +454,15 @@ void PulseCountingManager::start() // PulseCountingManager::stop () // ============================================================================ void PulseCountingManager::stop() - throw (Tango::DevFailed) { yat::Message * msg = yat::Message::allocate(kSTOP_MSG, DEFAULT_MSG_PRIORITY, true); - this->wait_msg_handled(msg, 2500); + wait_msg_handled(msg, 2500); } // ============================================================================ // PulseCountingManager::get_driver_version () // ============================================================================ std::string PulseCountingManager::get_driver_version() - throw (Tango::DevFailed) { std::string l_driver_version; @@ -480,17 +476,17 @@ std::string PulseCountingManager::get_driver_version() { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get driver version"), - _CPTC("PulseCountingManager::get_driver_version")); + "DEVICE_ERROR", + "Failed to get driver version", + "PulseCountingManager::get_driver_version"); } catch (...) { ERROR_STREAM << "Failed to get driver version" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to get driver version"), - _CPTC("PulseCountingManager::get_driver_version")); + "DEVICE_ERROR", + "Failed to get driver version", + "PulseCountingManager::get_driver_version"); } return l_driver_version; @@ -514,10 +510,10 @@ std::vector<std::string> PulseCountingManager::get_data_streams() std::vector<std::string> l_vect; // if no nexus recording, return empty list - if (this->m_acq_param.nexusFileGeneration) + if (m_acq_param.nexusFileGeneration) { // Re-built nexus item list - this->build_nexus_item_list(); + build_nexus_item_list(); // data stream = <nexus basename>:<coma separated nexus data items>@<flyscan spool> yat::OSStream oss; @@ -532,7 +528,7 @@ std::vector<std::string> PulseCountingManager::get_data_streams() } oss << "@" - << this->m_acq_param.flyscanSpool; + << m_acq_param.flyscanSpool; l_vect.push_back(oss.str()); } return l_vect; @@ -551,7 +547,6 @@ void PulseCountingManager::set_acquisition_parameters(AcquisitionDefinition p_pa // PulseCountingManager::set_integration_time // ====================================================================== void PulseCountingManager::set_integration_time(double p_time) - throw (Tango::DevFailed) { CHECK_CNT_BOARD(); @@ -563,7 +558,6 @@ void PulseCountingManager::set_integration_time(double p_time) // PulseCountingManager::set_countinuous_mode // ====================================================================== void PulseCountingManager::set_countinuous_mode(bool p_continuous) - throw (Tango::DevFailed) { CHECK_CNT_BOARD(); @@ -575,7 +569,6 @@ void PulseCountingManager::set_countinuous_mode(bool p_continuous) // PulseCountingManager::set_acquisition_mode // ====================================================================== void PulseCountingManager::set_acquisition_mode(E_AcquisitionMode_t p_acq_mode) - throw (Tango::DevFailed) { if (p_acq_mode == ACQ_MODE_BUFF) { @@ -589,9 +582,9 @@ void PulseCountingManager::set_acquisition_mode(E_AcquisitionMode_t p_acq_mode) { ERROR_STREAM << "Acquisition mode is not correct" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to set acquisition mode: use SCALAR or BUFFERED"), - _CPTC("PulseCountingManager::set_acquisition_mode")); + "DEVICE_ERROR", + "Failed to set acquisition mode: use SCALAR or BUFFERED", + "PulseCountingManager::set_acquisition_mode"); } } @@ -599,19 +592,18 @@ void PulseCountingManager::set_acquisition_mode(E_AcquisitionMode_t p_acq_mode) // PulseCountingManager::set_nexus_file_path // ====================================================================== void PulseCountingManager::set_nexus_file_path(std::string path) - throw (Tango::DevFailed) { if (!path.empty()) { - this->m_acq_param.nexusTargetPath = path; + m_acq_param.nexusTargetPath = path; } else { ERROR_STREAM << "Bad path name: " << path << std::endl; THROW_DEVFAILED( - _CPTC("COMMAND_FAILED"), - _CPTC("Failed to set new Nexus file path!"), - _CPTC("PulseCountingManager::set_nexus_file_path")); + "COMMAND_FAILED", + "Failed to set new Nexus file path!", + "PulseCountingManager::set_nexus_file_path"); } } @@ -619,18 +611,16 @@ void PulseCountingManager::set_nexus_file_path(std::string path) // PulseCountingManager::set_nexus_file_generation // ====================================================================== void PulseCountingManager::set_nexus_file_generation(bool enable) - throw (Tango::DevFailed) { - this->m_acq_param.nexusFileGeneration = enable; + m_acq_param.nexusFileGeneration = enable; } // ====================================================================== // PulseCountingManager::set_nexus_nb_acq_per_file // ====================================================================== void PulseCountingManager::set_nexus_nb_acq_per_file(unsigned int p_nb) - throw (Tango::DevFailed) { - this->m_acq_param.nexusNbPerFile = p_nb; + m_acq_param.nexusNbPerFile = p_nb; } // ============================================================================ @@ -648,12 +638,12 @@ void PulseCountingManager::read_counter_pulse_width(yat4tango::DynamicAttributeR // ============================================================================ void PulseCountingManager::write_counter_pulse_width(yat4tango::DynamicAttributeWriteCallbackData & cbd) { - if (this->m_state == Tango::RUNNING) + if (m_state == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCountingManager::write_counter_pulse_width")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCountingManager::write_counter_pulse_width"); } Tango::DevDouble l_val; @@ -665,16 +655,16 @@ void PulseCountingManager::write_counter_pulse_width(yat4tango::DynamicAttribute if (l_val < 0) { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Pulse width should be a positive value!"), - _CPTC("PulseCountingManager::write_counter_pulse_width")); + "CONFIGURATION_ERROR", + "Pulse width should be a positive value!", + "PulseCountingManager::write_counter_pulse_width"); } m_counterListConfig[m_counterList[l_id]].minPulseWidth = l_val; // memorize new value std::string prop_name = std::string("__") + cbd.tga->get_name(); - yat4tango::PropertyHelper::set_property<double>(this->m_board_arch.hostDevice, prop_name, l_val); + yat4tango::PropertyHelper::set_property<double>(m_board_arch.hostDevice, prop_name, l_val); } // ============================================================================ @@ -692,12 +682,12 @@ void PulseCountingManager::read_counter_pulse_width_enabled(yat4tango::DynamicAt // ============================================================================ void PulseCountingManager::write_counter_pulse_width_enabled(yat4tango::DynamicAttributeWriteCallbackData & cbd) { - if (this->m_state == Tango::RUNNING) + if (m_state == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCountingManager::write_counter_pulse_width_enabled")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCountingManager::write_counter_pulse_width_enabled"); } Tango::DevBoolean l_val; @@ -708,7 +698,7 @@ void PulseCountingManager::write_counter_pulse_width_enabled(yat4tango::DynamicA // memorize new value std::string prop_name = std::string("__") + cbd.tga->get_name(); - yat4tango::PropertyHelper::set_property<bool>(this->m_board_arch.hostDevice, prop_name, l_val); + yat4tango::PropertyHelper::set_property<bool>(m_board_arch.hostDevice, prop_name, l_val); } // ============================================================================ @@ -726,12 +716,12 @@ void PulseCountingManager::read_counter_dataset_enabled(yat4tango::DynamicAttrib // ============================================================================ void PulseCountingManager::write_counter_dataset_enabled(yat4tango::DynamicAttributeWriteCallbackData & cbd) { - if (this->m_state == Tango::RUNNING) + if (m_state == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCountingManager::write_counter_dataset_enabled")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCountingManager::write_counter_dataset_enabled"); } Tango::DevBoolean l_val; @@ -743,14 +733,13 @@ void PulseCountingManager::write_counter_dataset_enabled(yat4tango::DynamicAttri // memorize new value std::string prop_name = std::string("__") + cbd.tga->get_name(); - yat4tango::PropertyHelper::set_property<bool>(this->m_board_arch.hostDevice, prop_name, l_val); + yat4tango::PropertyHelper::set_property<bool>(m_board_arch.hostDevice, prop_name, l_val); } // ============================================================================ // PulseCountingManager::add_attributes () // ============================================================================ void PulseCountingManager::add_attributes(CounterConfig p_cfg) - throw (Tango::DevFailed) { CHECK_MANAGER_DYN_ATTR_MANAGER(); @@ -832,23 +821,23 @@ void PulseCountingManager::add_attributes(CounterConfig p_cfg) try { //- add all dynamic attributes to the device interface - this->m_dyn_attr_manager->add_attributes(dai_list); + m_dyn_attr_manager->add_attributes(dai_list); } catch (Tango::DevFailed &df) { ERROR_STREAM << "Dynamic attribute addition failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Dynamic attribute addition failed."), - _CPTC("PulseManager::add_attributes")); + "SOFTWARE_FAILURE", + "Dynamic attribute addition failed.", + "PulseManager::add_attributes"); } catch(...) { ERROR_STREAM << "Dynamic attribute addition failed." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Dynamic attribute addition failed."), - _CPTC("PulseManager::add_attribute")); + "SOFTWARE_FAILURE", + "Dynamic attribute addition failed.", + "PulseManager::add_attribute"); } } @@ -863,7 +852,7 @@ void PulseCountingManager::build_nexus_item_list() } // 1D item in BUFFERED mode with meas dim = 1 - if ((m_acq_param.acqMode == ACQ_MODE_BUFF) && (this->m_acq_param.nexusMeasDim == 1)) + if ((m_acq_param.acqMode == ACQ_MODE_BUFF) && (m_acq_param.nexusMeasDim == 1)) { // 1D GenericCounterMap_t::iterator l_it; @@ -877,7 +866,7 @@ void PulseCountingManager::build_nexus_item_list() // in continuous mode, 1 buffer received, with size = samplesNumber // otherwise, N buffers received, with size = bufferDepth - if (this->m_acq_param.continuousAcquisition) + if (m_acq_param.continuousAcquisition) item.dim1 = m_acq_param.samplesNumber; else item.dim1 = m_acq_param.bufferDepth; @@ -910,7 +899,6 @@ void PulseCountingManager::build_nexus_item_list() // PulseCountingManager::add_common_attributes () // ============================================================================ void PulseCountingManager::add_common_attributes() - throw (Tango::DevFailed) { // Create integration time attributes std::vector<yat4tango::DynamicAttributeInfo> dai(2); @@ -958,23 +946,23 @@ void PulseCountingManager::add_common_attributes() try { //- add all dynamic attributes to the device interface - this->m_dyn_attr_manager->add_attributes(dai); + m_dyn_attr_manager->add_attributes(dai); } catch(Tango::DevFailed &df) { ERROR_STREAM << "Acquisition dynamic attributes creation failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Acquisition dynamic attributes creation failed."), - _CPTC("PulseCountingManager::add_common_attributes")); + "SOFTWARE_FAILURE", + "Acquisition dynamic attributes creation failed.", + "PulseCountingManager::add_common_attributes"); } catch(...) { ERROR_STREAM << "Acquisition dynamic attributes creation failed." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Acquisition dynamic attributes creation failed."), - _CPTC("PulseCountingManager::add_common_attributes")); + "SOFTWARE_FAILURE", + "Acquisition dynamic attributes creation failed.", + "PulseCountingManager::add_common_attributes"); } } @@ -984,7 +972,7 @@ void PulseCountingManager::add_common_attributes() void PulseCountingManager::read_frequency(yat4tango::DynamicAttributeReadCallbackData & cbd) { //DEBUG_STREAM << "PulseCountingManager::read_frequency() entering... "<< endl; - this->m_acq_param.frequency = 1 / m_acq_param.integrationTime; + m_acq_param.frequency = 1 / m_acq_param.integrationTime; cbd.tga->set_value(&m_acq_param.frequency); } @@ -994,12 +982,12 @@ void PulseCountingManager::read_frequency(yat4tango::DynamicAttributeReadCallbac // ============================================================================ void PulseCountingManager::write_frequency(yat4tango::DynamicAttributeWriteCallbackData & cbd) { - if (this->m_state == Tango::RUNNING) + if (m_state == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCountingManager::write_frequency")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCountingManager::write_frequency"); } DEBUG_STREAM << "PulseCountingManager::write_frequency() entering... "<< endl; @@ -1010,35 +998,35 @@ void PulseCountingManager::write_frequency(yat4tango::DynamicAttributeWriteCallb if (l_freq <= 0.0) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Frequency should be a strictly positive value!"), - _CPTC("PulseCountingManager::write_frequency")); + "DEVICE_ERROR", + "Frequency should be a strictly positive value!", + "PulseCountingManager::write_frequency"); } try { - this->set_integration_time(1/l_freq); - this->m_isHwInitNeeded = true; + set_integration_time(1/l_freq); + m_isHwInitNeeded = true; } catch (Tango::DevFailed & df) { ERROR_STREAM << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("DEVICE_ERROR"), - _CPTC("write frequency failed"), - _CPTC("PulseCountingManager::write_frequency")); + "DEVICE_ERROR", + "write frequency failed", + "PulseCountingManager::write_frequency"); } catch (...) { ERROR_STREAM << "failed to write frequency" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("write frequency failed"), - _CPTC("PulseCountingManager::write_frequency")); + "DEVICE_ERROR", + "write frequency failed", + "PulseCountingManager::write_frequency"); } // memorize new value - yat4tango::PropertyHelper::set_property<double>(this->m_board_arch.hostDevice, "__integrationTime", m_acq_param.integrationTime); + yat4tango::PropertyHelper::set_property<double>(m_board_arch.hostDevice, "__integrationTime", m_acq_param.integrationTime); } // ============================================================================ @@ -1055,12 +1043,12 @@ void PulseCountingManager::read_integration_time(yat4tango::DynamicAttributeRead // ============================================================================ void PulseCountingManager::write_integration_time(yat4tango::DynamicAttributeWriteCallbackData & cbd) { - if (this->m_state == Tango::RUNNING) + if (m_state == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCountingManager::write_integration_time")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCountingManager::write_integration_time"); } DEBUG_STREAM << "PulseCountingManager::write_integration_time() entering... "<< endl; @@ -1071,38 +1059,38 @@ void PulseCountingManager::write_integration_time(yat4tango::DynamicAttributeWri if (l_time <= 0.0) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Integration time should be a strictly positive value!"), - _CPTC("PulseCountingManager::write_integration_time")); + "DEVICE_ERROR", + "Integration time should be a strictly positive value!", + "PulseCountingManager::write_integration_time"); } try { if (m_stored_it != l_time) { - this->set_integration_time(l_time); - this->m_isHwInitNeeded = true; + set_integration_time(l_time); + m_isHwInitNeeded = true; m_stored_it = l_time; // memorize new value - yat4tango::PropertyHelper::set_property<double>(this->m_board_arch.hostDevice, "__integrationTime", m_acq_param.integrationTime); + yat4tango::PropertyHelper::set_property<double>(m_board_arch.hostDevice, "__integrationTime", m_acq_param.integrationTime); } } catch (Tango::DevFailed & df) { ERROR_STREAM << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("DEVICE_ERROR"), - _CPTC("write integration time failed"), - _CPTC("PulseCountingManager::write_integration_time")); + "DEVICE_ERROR", + "write integration time failed", + "PulseCountingManager::write_integration_time"); } catch (...) { ERROR_STREAM << "failed to write integration time" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("write integration time failed"), - _CPTC("PulseCountingManager::write_integration_time")); + "DEVICE_ERROR", + "write integration time failed", + "PulseCountingManager::write_integration_time"); } } @@ -1136,7 +1124,6 @@ void PulseCountingManager::clean_dyn_attr() // PulseCountingManager::configure_clock () // ============================================================================ void PulseCountingManager::configure_clock() - throw (Tango::DevFailed) { if (m_board_arch.clockGeneration) { @@ -1148,24 +1135,24 @@ void PulseCountingManager::configure_clock() try { - this->m_clock_generator->init(l_cfg); + m_clock_generator->init(l_cfg); m_isHwInitNeeded = false; } catch( Tango::DevFailed &df ) { ERROR_STREAM << "Init clock failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Init clock failed."), - _CPTC("PulseCountingManager::configure_clock")); + "SOFTWARE_FAILURE", + "Init clock failed.", + "PulseCountingManager::configure_clock"); } catch(...) { ERROR_STREAM << "Init clock failed." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Init clock failed."), - _CPTC("PulseCountingManager::configure_clock")); + "SOFTWARE_FAILURE", + "Init clock failed.", + "PulseCountingManager::configure_clock"); } } } @@ -1174,18 +1161,17 @@ void PulseCountingManager::configure_clock() // PulseCountingManager::change_nx_dataset // ====================================================================== void PulseCountingManager::change_nx_dataset(yat::uint16 chan_nb, std::string dataset) - throw (Tango::DevFailed) { // check counter number - if (this->m_counterList.count(chan_nb) == 0) + if (m_counterList.count(chan_nb) == 0) { // bad value ==> fatal error yat::OSStream oss; oss << "Undefined counter number: " << chan_nb; ERROR_STREAM << oss.str() << std::endl; - THROW_DEVFAILED(_CPTC("DATA_OUT_OF_RANGE"), + THROW_DEVFAILED("DATA_OUT_OF_RANGE", oss.str().c_str(), - _CPTC("PulseCountingManager::change_nx_dataset")); + "PulseCountingManager::change_nx_dataset"); } // update internal map with new dataset diff --git a/src/PulseCountingManager.h b/src/PulseCountingManager.h old mode 100644 new mode 100755 index fa900c904ba0b156382f1a9d16ce03678e6e2554..513b0aa0c9ebfd2f01336545c920bacc9dd9a864 --- a/src/PulseCountingManager.h +++ b/src/PulseCountingManager.h @@ -46,28 +46,22 @@ public: std::string get_status (); //- init - virtual void init(BoardArchitecture p_board_arch) - throw (Tango::DevFailed); + virtual void init(BoardArchitecture p_board_arch); //- starts the pulse generation - void start() - throw (Tango::DevFailed); + void start(); //- stop the pulse generation - void stop() - throw (Tango::DevFailed); + void stop(); //- get driver version - std::string get_driver_version() - throw (Tango::DevFailed); + std::string get_driver_version(); //- get data streams - std::vector<std::string> get_data_streams() - throw (Tango::DevFailed); + std::vector<std::string> get_data_streams(); //- Sets nexus dataset name for specified channel number - void change_nx_dataset(yat::uint16 chan_nb, std::string dataset) - throw (Tango::DevFailed); + void change_nx_dataset(yat::uint16 chan_nb, std::string dataset); // Get all channel dataset information as a map:<channel id, info string> /* NAME:{channel label} @@ -79,54 +73,44 @@ public: std::map<yat::uint16, std::string> get_channel_info(); //- set acquisition mode - void set_acquisition_mode(E_AcquisitionMode_t p_acq_mode) - throw (Tango::DevFailed); + void set_acquisition_mode(E_AcquisitionMode_t p_acq_mode); //- Sets acquisition parameters void set_acquisition_parameters (AcquisitionDefinition p_param); //- reset buffer index - void reset_nexus_buffer_index() - throw (Tango::DevFailed); + void reset_nexus_buffer_index(); //- set continuous mode - void set_countinuous_mode(bool p_continuous) - throw (Tango::DevFailed); + void set_countinuous_mode(bool p_continuous); //- set integration time - void set_integration_time(double p_time) - throw (Tango::DevFailed); + void set_integration_time(double p_time); //- Sets new nexus file path - void set_nexus_file_path (std::string path) - throw (Tango::DevFailed); + void set_nexus_file_path (std::string path); //- Sets new nexus file generation flag - void set_nexus_file_generation (bool enable) - throw (Tango::DevFailed); + void set_nexus_file_generation (bool enable); //- Sets new nexus nb acq per file - void set_nexus_nb_acq_per_file (unsigned int p_nb) - throw (Tango::DevFailed); + void set_nexus_nb_acq_per_file (unsigned int p_nb); //- Checks current acquisition configuration - virtual std::string check_configuration(bool excpt) - throw (Tango::DevFailed) = 0; + virtual std::string check_configuration(bool excpt) = 0; // clean dynamic interface void clean_dyn_attr(); // configure clock (if needed) - void configure_clock() - throw (Tango::DevFailed); + void configure_clock(); protected: //- add dynamic attributes - void add_attributes(CounterConfig p_cfg) - throw (Tango::DevFailed); - void add_common_attributes() - throw (Tango::DevFailed); + void add_attributes(CounterConfig p_cfg); + + void add_common_attributes(); //- read callback for attr counterPulseWidthEnabled void read_counter_pulse_width_enabled(yat4tango::DynamicAttributeReadCallbackData & cbd); @@ -154,8 +138,7 @@ protected: void write_frequency(yat4tango::DynamicAttributeWriteCallbackData & cbd); //- process_message (implements yat4tango::DeviceTask pure virtual method) - virtual void process_message (yat::Message& msg) - throw (Tango::DevFailed) = 0; + virtual void process_message (yat::Message& msg) = 0; //- Build Nexus item list void build_nexus_item_list(); @@ -163,8 +146,7 @@ protected: //- Configure trigger listener (for external clock) //- use address & port specified in parameters // default implementation: do nothing. - virtual void configure_trigger_listener(std::string addr, yat::uint32 port) - throw (Tango::DevFailed) {} + virtual void configure_trigger_listener(std::string addr, yat::uint32 port){} //- dynamic attributes manager yat4tango::DynamicAttributeManager * m_dyn_attr_manager; diff --git a/src/PulseCountingManagerBuffered.cpp b/src/PulseCountingManagerBuffered.cpp index 60068cbc911118b230b7624c4828fdcad9bd9795..7edefdeb23108895f90d79a4de7b3324d3beb461 100755 --- a/src/PulseCountingManagerBuffered.cpp +++ b/src/PulseCountingManagerBuffered.cpp @@ -18,12 +18,12 @@ namespace PulseCounting_ns //- Check nexus manager macro: #define CHECK_NX_MANAGER() \ - if (! this->m_nexus_manager) \ + if (! m_nexus_manager) \ { \ m_status = "Internal error."; \ - THROW_DEVFAILED(_CPTC("INTERNAL_ERROR"), \ - _CPTC("request aborted - the Nexus manager isn't properly initialized"), \ - _CPTC("PulseCountingManagerBuffered::check_nx_manager")); \ + THROW_DEVFAILED("INTERNAL_ERROR", \ + "request aborted - the Nexus manager isn't properly initialized", \ + "PulseCountingManagerBuffered::check_nx_manager"); \ } while (0) //- check clock generator macro: @@ -31,9 +31,9 @@ namespace PulseCounting_ns do \ { \ if (! m_clock_generator) \ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("request aborted - the clock generator isn't accessible "), \ - _CPTC("PulseCountingManagerBuffered::check_clk_gen")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the clock generator isn't accessible ", \ + "PulseCountingManagerBuffered::check_clk_gen"); \ } while (0) //- check counting boerd macro: @@ -41,9 +41,9 @@ namespace PulseCounting_ns do \ { \ if (! m_counting_board) \ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("request aborted - the counting board isn't accessible "), \ - _CPTC("PulseCountingManagerBuffered::check_counting_board")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the counting board isn't accessible ", \ + "PulseCountingManagerBuffered::check_counting_board"); \ } while (0) // ============================================================================ @@ -64,10 +64,10 @@ PulseCountingManagerBuffered::PulseCountingManagerBuffered (Tango::DeviceImpl * // ============================================================================ PulseCountingManagerBuffered::~PulseCountingManagerBuffered () { - this->set_periodic_msg_period (0xFFFF); - this->enable_periodic_msg (false); + set_periodic_msg_period (0xFFFF); + enable_periodic_msg (false); - this->releaseObjects(); + releaseObjects(); if (m_trigListener) m_trigListener->exit(); @@ -77,7 +77,6 @@ PulseCountingManagerBuffered::~PulseCountingManagerBuffered () // PulseCountingManagerBuffered::init () // ============================================================================ void PulseCountingManagerBuffered::init(BoardArchitecture p_board_arch) - throw (Tango::DevFailed) { // Call init from mother class PulseCountingManager::init(p_board_arch); @@ -99,17 +98,17 @@ void PulseCountingManagerBuffered::init(BoardArchitecture p_board_arch) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to add specific dynamic attributes"), - _CPTC("PulseCountingManagerBuffered::init")); + "DEVICE_ERROR", + "Failed to add specific dynamic attributes", + "PulseCountingManagerBuffered::init"); } catch (...) { ERROR_STREAM << "Failed to add specific dynamic attributes" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to add specific dynamic attributes"), - _CPTC("PulseCountingManagerBuffered::init")); + "DEVICE_ERROR", + "Failed to add specific dynamic attributes", + "PulseCountingManagerBuffered::init"); } m_counting_board->setAcquisitionTimeout(m_acq_param.timeout); @@ -120,7 +119,6 @@ void PulseCountingManagerBuffered::init(BoardArchitecture p_board_arch) // PulseCountingManagerBuffered::process_message // ============================================================================ void PulseCountingManagerBuffered::process_message (yat::Message& msg) -throw (Tango::DevFailed) { //- handle msg @@ -130,7 +128,7 @@ throw (Tango::DevFailed) case yat::TASK_INIT: { DEBUG_STREAM << "PulseCountingManagerBuffered::handle_message::THREAD_INIT::thread is starting up" << std::endl; - this->init_i(); + init_i(); } break; @@ -145,7 +143,7 @@ throw (Tango::DevFailed) case yat::TASK_PERIODIC: { //DEBUG_STREAM << "PulseCountingManagerBuffered::handle_message::THREAD_PERIODIC" << std::endl; - this->periodic_job_i(); + periodic_job_i(); } break; @@ -160,19 +158,19 @@ throw (Tango::DevFailed) //- kSTART_MSG case kSTART_MSG: { - this->start_i(); + start_i(); } break; //- kSTOP_MSG case kSTOP_MSG: { { - yat::AutoMutex<> guard(this->m_flagLock); - this->m_requestedStop = true; + yat::AutoMutex<> guard(m_flagLock); + m_requestedStop = true; } - if (this->m_acq_running) - this->stop_i(); + if (m_acq_running) + stop_i(); } break; //- kEND_OF_SEQ_MSG @@ -183,8 +181,8 @@ throw (Tango::DevFailed) // we have to force the reading of the last incomplete buffer on each counter. // If samples number is a multiple of buffer depth, the callback is naturally called // at the end of acquisition. - if ((this->m_acq_param.samplesNumber % this->m_acq_param.bufferDepth) != 0) - this->get_last_buffer_i(); + if ((m_acq_param.samplesNumber % m_acq_param.bufferDepth) != 0) + get_last_buffer_i(); } break; //- kTRIGGER_RECEIVED_MSG @@ -212,26 +210,26 @@ void PulseCountingManagerBuffered::init_i() double val = 1.0; try { - val = get_value_as_property<double>(this->m_board_arch.hostDevice, prop_name); - this->set_integration_time(val); + val = get_value_as_property<double>(m_board_arch.hostDevice, prop_name); + set_integration_time(val); } catch(...) { // no value in db, use default value - this->set_integration_time(1.0); + set_integration_time(1.0); } m_stored_it = val; } else { // set integration time to default value - this->set_integration_time(1.0); + set_integration_time(1.0); } // get memorized value for samples nb try { - m_acq_param.samplesNumber = get_value_as_property<long>(this->m_board_arch.hostDevice, "__samplesNumber"); + m_acq_param.samplesNumber = get_value_as_property<long>(m_board_arch.hostDevice, "__samplesNumber"); } catch(...) { @@ -242,7 +240,7 @@ void PulseCountingManagerBuffered::init_i() // get memorized value for buffer depth try { - m_acq_param.bufferDepth = get_value_as_property<long>(this->m_board_arch.hostDevice, "__bufferDepth"); + m_acq_param.bufferDepth = get_value_as_property<long>(m_board_arch.hostDevice, "__bufferDepth"); } catch(...) { @@ -251,31 +249,30 @@ void PulseCountingManagerBuffered::init_i() } // start periodic msg - this->set_periodic_msg_period((size_t)this->m_acq_param.pollingPeriod); //ms - this->enable_periodic_msg(true); + set_periodic_msg_period((size_t)m_acq_param.pollingPeriod); //ms + enable_periodic_msg(true); } // ============================================================================ // PulseCountingManagerBuffered::periodic_job_i () // ============================================================================ void PulseCountingManagerBuffered::periodic_job_i() - throw (Tango::DevFailed) { std::vector<Tango::DevState> l_vect_state; Tango::DevState l_state; std::string countersStatus = ""; - yat::AutoMutex<> guard(this->m_flagLock); + yat::AutoMutex<> guard(m_flagLock); // evaluate state if manager not already in fault - if (this->m_state != Tango::FAULT) + if (m_state != Tango::FAULT) { - if (!this->m_acq_param.continuousAcquisition) + if (!m_acq_param.continuousAcquisition) { l_state = Tango::STANDBY; - if (this->m_acq_running) + if (m_acq_running) { - this->m_state = Tango::STANDBY; + m_state = Tango::STANDBY; // read current counters value & state from board GenericCounterMap_t::iterator l_it; @@ -326,18 +323,18 @@ void PulseCountingManagerBuffered::periodic_job_i() } // check nexus error - if (this->m_nexus_manager->hasStorageError()) + if (m_nexus_manager->hasStorageError()) { m_status = "Nexus exception handled, acquisition stopped!\n"; } // if one counter in FAULT or ALARM, // or if nexus error, stop counting process - if (acq_error || (this->m_nexus_manager->hasStorageError())) + if (acq_error || (m_nexus_manager->hasStorageError())) { m_state = Tango::FAULT; - this->m_requestedStop = true; - this->stop_i(); + m_requestedStop = true; + stop_i(); } else { @@ -346,7 +343,7 @@ void PulseCountingManagerBuffered::periodic_job_i() { DEBUG_STREAM << "Stop acquisition 'cause all counters finished!" << std::endl; m_status = "Device is up and ready.\n"; - this->stop_i(); + stop_i(); } } @@ -371,9 +368,9 @@ void PulseCountingManagerBuffered::periodic_job_i() else { // Continuous mode - if (this->m_acq_running) + if (m_acq_running) { - this->m_state = Tango::STANDBY; + m_state = Tango::STANDBY; // read current counters state from board GenericCounterMap_t::iterator l_it; @@ -420,18 +417,18 @@ void PulseCountingManagerBuffered::periodic_job_i() } // check nexus error - if (this->m_nexus_manager->hasStorageError()) + if (m_nexus_manager->hasStorageError()) { m_status = "Nexus exception handled, acquisition stopped!\n"; } // if one counter in FAULT or ALARM, // or if nexus error, stop counting process - if (acq_error || (this->m_nexus_manager->hasStorageError())) + if (acq_error || (m_nexus_manager->hasStorageError())) { m_state = Tango::FAULT; - this->m_requestedStop = true; - this->stop_i(); + m_requestedStop = true; + stop_i(); } else { @@ -447,7 +444,7 @@ void PulseCountingManagerBuffered::periodic_job_i() DEBUG_STREAM << "Stop acquisition 'cause all counters finished!" << std::endl; m_status = "Device is up and ready.\n"; - this->stop_i(); + stop_i(); } } @@ -479,26 +476,26 @@ void PulseCountingManagerBuffered::start_i() { // Check that buffer depth is not above samples number // if not continuous mode and not infinite mode - if (!this->m_acq_param.continuousAcquisition && - (this->m_acq_param.samplesNumber != 0) && - (this->m_acq_param.bufferDepth > this->m_acq_param.samplesNumber)) + if (!m_acq_param.continuousAcquisition && + (m_acq_param.samplesNumber != 0) && + (m_acq_param.bufferDepth > m_acq_param.samplesNumber)) { ERROR_STREAM << "Start buffered acquisition failed! Buffer depth cannot be above samples number!" << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Start error: buffer depth cannot be above samples number!"), - _CPTC("PulseCountingManagerBuffered::start_i")); + "CONFIGURATION_ERROR", + "Start error: buffer depth cannot be above samples number!", + "PulseCountingManagerBuffered::start_i"); } // Check that continuous & infinite modes are not set together - if (this->m_acq_param.continuousAcquisition && - (this->m_acq_param.samplesNumber == 0)) + if (m_acq_param.continuousAcquisition && + (m_acq_param.samplesNumber == 0)) { ERROR_STREAM << "Start buffered acquisition failed! Continuous and infinite modes are exclusive!" << std::endl; THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Start error: Continuous and infinite modes are exclusive!"), - _CPTC("PulseCountingManagerBuffered::start_i")); + "CONFIGURATION_ERROR", + "Start error: Continuous and infinite modes are exclusive!", + "PulseCountingManagerBuffered::start_i"); } // set current acquisition parameters (it, continuous mode, ...) @@ -524,7 +521,7 @@ void PulseCountingManagerBuffered::start_i() // then configure new clock (if needed) if (m_isHwInitNeeded) - this->configure_clock(); + configure_clock(); if (!m_board_arch.clockGeneration) { @@ -540,14 +537,14 @@ void PulseCountingManagerBuffered::start_i() if (m_acq_param.nexusFileGeneration && m_firstStart) { // re-build nexus item list - this->build_nexus_item_list(); + build_nexus_item_list(); //start nexus manager try { // check nexus dimension: // - if 1D => we store buffers infinitely - if (this->m_acq_param.nexusMeasDim == 1) + if (m_acq_param.nexusMeasDim == 1) { m_nexus_manager->initNexusAcquisition( m_acq_param.nexusTargetPath, @@ -556,16 +553,16 @@ void PulseCountingManagerBuffered::start_i() m_acq_param.nexusNbPerFile, m_nx_items); } - else if ((this->m_acq_param.nexusMeasDim == 0) && - !this->m_acq_param.continuousAcquisition && - (this->m_acq_param.samplesNumber != 0)) + else if ((m_acq_param.nexusMeasDim == 0) && + !m_acq_param.continuousAcquisition && + (m_acq_param.samplesNumber != 0)) { // - if 0D and classical mode (i.e. not continuous nor infinite) // => we store each value as a single scalar until samples number m_nexus_manager->initNexusAcquisition( m_acq_param.nexusTargetPath, m_acq_param.nexusFileName, - this->m_acq_param.samplesNumber, // finite storage + m_acq_param.samplesNumber, // finite storage m_acq_param.nexusNbPerFile, m_nx_items); } @@ -583,21 +580,21 @@ void PulseCountingManagerBuffered::start_i() } catch( Tango::DevFailed &df ) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Init Nexus manager failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Init Nexus manager failed."), - _CPTC("PulseCountingManagerBuffered::start_i")); + "SOFTWARE_FAILURE", + "Init Nexus manager failed.", + "PulseCountingManagerBuffered::start_i"); } catch(...) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Init Nexus manager failed: caught[...]" << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Init Nexus manager failed."), - _CPTC("PulseCountingManagerBuffered::start_i")); + "SOFTWARE_FAILURE", + "Init Nexus manager failed.", + "PulseCountingManagerBuffered::start_i"); } } @@ -616,21 +613,21 @@ void PulseCountingManagerBuffered::start_i() } catch( Tango::DevFailed &df ) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Counter configuration failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter configuration failed."), - _CPTC("PulseCountingManagerBuffered::start_i")); + "SOFTWARE_FAILURE", + "Counter configuration failed.", + "PulseCountingManagerBuffered::start_i"); } catch(...) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Counter configure failed: caught [...]" << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter configuration failed."), - _CPTC("PulseCountingManagerBuffered::start_i")); + "SOFTWARE_FAILURE", + "Counter configuration failed.", + "PulseCountingManagerBuffered::start_i"); } } @@ -643,21 +640,21 @@ void PulseCountingManagerBuffered::start_i() } catch( Tango::DevFailed &df ) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Counter start failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter start failed."), - _CPTC("PulseCountingManagerBuffered::start_i")); + "SOFTWARE_FAILURE", + "Counter start failed.", + "PulseCountingManagerBuffered::start_i"); } catch(...) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Counter start failed." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter start failed."), - _CPTC("PulseCountingManagerBuffered::start_i")); + "SOFTWARE_FAILURE", + "Counter start failed.", + "PulseCountingManagerBuffered::start_i"); } } @@ -666,25 +663,25 @@ void PulseCountingManagerBuffered::start_i() { try { - this->m_clock_generator->start(); + m_clock_generator->start(); } catch( Tango::DevFailed &df ) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Start clock failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Start clock failed."), - _CPTC("PulseCountingManagerBuffered::start_i")); + "SOFTWARE_FAILURE", + "Start clock failed.", + "PulseCountingManagerBuffered::start_i"); } catch(...) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Start clock failed: caught [...]" << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Start clock failed."), - _CPTC("PulseCountingManagerBuffered::start_i")); + "SOFTWARE_FAILURE", + "Start clock failed.", + "PulseCountingManagerBuffered::start_i"); } } @@ -703,23 +700,23 @@ void PulseCountingManagerBuffered::stop_i() try { DEBUG_STREAM << "Trying to stop clock" << endl; - this->m_clock_generator->abort(); + m_clock_generator->abort(); } catch( Tango::DevFailed &df ) { ERROR_STREAM << "Abort clock failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Abort clock failed."), - _CPTC("PulseCountingManagerBuffered::stop_i")); + "SOFTWARE_FAILURE", + "Abort clock failed.", + "PulseCountingManagerBuffered::stop_i"); } catch(...) { ERROR_STREAM << "Abort clock failed." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Abort clock failed."), - _CPTC("PulseCountingManagerBuffered::stop_i")); + "SOFTWARE_FAILURE", + "Abort clock failed.", + "PulseCountingManagerBuffered::stop_i"); } } else // stop trigger listener (if defined) @@ -740,16 +737,16 @@ void PulseCountingManagerBuffered::stop_i() { ERROR_STREAM << "Counter stop failed " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter stop failed."), - _CPTC("PulseCountingManagerBuffered::stop_i")); + "SOFTWARE_FAILURE", + "Counter stop failed.", + "PulseCountingManagerBuffered::stop_i"); } catch(...) { ERROR_STREAM << "Counter stop failed." << std::endl; - THROW_DEVFAILED(_CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter stop failed."), - _CPTC("PulseCountingManagerBuffered::stop_i")); + THROW_DEVFAILED("SOFTWARE_FAILURE", + "Counter stop failed.", + "PulseCountingManagerBuffered::stop_i"); } } @@ -767,12 +764,12 @@ void PulseCountingManagerBuffered::stop_i() } // Finalize Nexus file if (!m_acq_param.continuousAcquisition || - (this->m_requestedStop && m_acq_param.continuousAcquisition)) + (m_requestedStop && m_acq_param.continuousAcquisition)) { try { INFO_STREAM << "Finalize NEXUS generation..." << std::endl; - this->m_nexus_manager->finalizeNexusGeneration(); + m_nexus_manager->finalizeNexusGeneration(); } catch (Tango::DevFailed & df) { @@ -784,10 +781,10 @@ void PulseCountingManagerBuffered::stop_i() m_acq_running = false; // check continuous mode to restart acquisition if not requested stop - if (!this->m_requestedStop && m_acq_param.continuousAcquisition) + if (!m_requestedStop && m_acq_param.continuousAcquisition) { m_firstStart = false; - this->start_i(); + start_i(); } } @@ -795,14 +792,13 @@ void PulseCountingManagerBuffered::stop_i() // PulseCountingManagerBuffered::manage_dyn_attr () // ============================================================================ void PulseCountingManagerBuffered::manage_specific_dyn_attr() - throw (Tango::DevFailed) { if (! m_dyn_attr_manager) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("The dynamic attribute manager object isn't accessible "), - _CPTC("PulseCountingManagerBuffered::check_manager_dyn_attr_manager")); + "DEVICE_ERROR", + "The dynamic attribute manager object isn't accessible ", + "PulseCountingManagerBuffered::check_manager_dyn_attr_manager"); } // Buffered mode associated attributes: @@ -825,7 +821,7 @@ void PulseCountingManagerBuffered::manage_specific_dyn_attr() dai[0].tai.disp_level = Tango::OPERATOR; dai[0].tai.description = "Intermediate buffer depth, as a multiple of integration time (if defined), or in number of points (if integration time not defined)."; //- attribute properties: - if (this->m_board_arch.clockGeneration) + if (m_board_arch.clockGeneration) { // buffer depth is defined as a multiple of integration time dai[0].tai.unit = "x integration time"; @@ -909,23 +905,23 @@ void PulseCountingManagerBuffered::manage_specific_dyn_attr() try { //- add all dynamic attributes to the device interface - this->m_dyn_attr_manager->add_attributes(dai); + m_dyn_attr_manager->add_attributes(dai); } catch( Tango::DevFailed &df ) { ERROR_STREAM << "Dynamic attribute addition failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Dynamic attribute addition failed."), - _CPTC("PulseCountingManagerBuffered::manage_specific_dyn_attr")); + "SOFTWARE_FAILURE", + "Dynamic attribute addition failed.", + "PulseCountingManagerBuffered::manage_specific_dyn_attr"); } catch(...) { ERROR_STREAM << "Dynamic attribute addition failed." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Dynamic attribute addition failed."), - _CPTC("PulseCountingManagerBuffered::manage_specific_dyn_attr")); + "SOFTWARE_FAILURE", + "Dynamic attribute addition failed.", + "PulseCountingManagerBuffered::manage_specific_dyn_attr"); } // Counters associated attributes: @@ -959,23 +955,23 @@ void PulseCountingManagerBuffered::manage_specific_dyn_attr() try { //- add all dynamic attributes to the device interface - this->m_dyn_attr_manager->add_attribute(dai); + m_dyn_attr_manager->add_attribute(dai); } catch( Tango::DevFailed &df ) { ERROR_STREAM << "Dynamic attribute addition failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Dynamic attribute addition failed."), - _CPTC("PulseCountingManagerBuffered::manage_specific_dyn_attr")); + "SOFTWARE_FAILURE", + "Dynamic attribute addition failed.", + "PulseCountingManagerBuffered::manage_specific_dyn_attr"); } catch(...) { ERROR_STREAM << "Dynamic attribute addition failed." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Dynamic attribute addition failed."), - _CPTC("PulseCountingManagerBuffered::manage_specific_dyn_attr")); + "SOFTWARE_FAILURE", + "Dynamic attribute addition failed.", + "PulseCountingManagerBuffered::manage_specific_dyn_attr"); } } } @@ -1016,7 +1012,7 @@ void PulseCountingManagerBuffered::read_buffer_depth(yat4tango::DynamicAttribute { static Tango::DevLong l_attr; - if (this->m_acq_param.continuousAcquisition) + if (m_acq_param.continuousAcquisition) { // in this case, buffer depth is not useful cbd.tga->set_quality(Tango::ATTR_INVALID); @@ -1034,7 +1030,7 @@ void PulseCountingManagerBuffered::read_buffer_depth(yat4tango::DynamicAttribute // ============================================================================ void PulseCountingManagerBuffered::write_buffer_depth(yat4tango::DynamicAttributeWriteCallbackData & cbd) { - if (this->m_acq_param.continuousAcquisition) + if (m_acq_param.continuousAcquisition) { // in this case, buffer depth is not useful cbd.tga->set_quality(Tango::ATTR_INVALID); @@ -1045,21 +1041,21 @@ void PulseCountingManagerBuffered::write_buffer_depth(yat4tango::DynamicAttribut cbd.tga->get_write_value(l_val); // check device state - if (this->m_state == Tango::RUNNING) + if (m_state == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCountingManagerBuffered::write_buffer_depth")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCountingManagerBuffered::write_buffer_depth"); } // check if null or negative value if (l_val <= 0) { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Buffer depth should be a strictly positive value!"), - _CPTC("PulseCountingManagerBuffered::write_buffer_depth")); + "CONFIGURATION_ERROR", + "Buffer depth should be a strictly positive value!", + "PulseCountingManagerBuffered::write_buffer_depth"); } m_acq_param.bufferDepth = l_val; @@ -1089,21 +1085,21 @@ void PulseCountingManagerBuffered::write_samples_number(yat4tango::DynamicAttrib cbd.tga->get_write_value(l_val); // check device state - if (this->m_state == Tango::RUNNING) + if (m_state == Tango::RUNNING) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Attribute not writable while acquisition is running!"), - _CPTC("PulseCountingManagerBuffered::write_samples_number")); + "DEVICE_ERROR", + "Attribute not writable while acquisition is running!", + "PulseCountingManagerBuffered::write_samples_number"); } // check if negative value (null value = infinite mode) if (l_val < 0) { THROW_DEVFAILED( - _CPTC("CONFIGURATION_ERROR"), - _CPTC("Samples number should be a strictly positive value!"), - _CPTC("PulseCountingManagerBuffered::write_samples_number")); + "CONFIGURATION_ERROR", + "Samples number should be a strictly positive value!", + "PulseCountingManagerBuffered::write_samples_number"); } try @@ -1118,16 +1114,16 @@ void PulseCountingManagerBuffered::write_samples_number(yat4tango::DynamicAttrib { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to set samples number"), - _CPTC("PulseCountingManagerBuffered::write_samples_number")); + "DEVICE_ERROR", + "Failed to set samples number", + "PulseCountingManagerBuffered::write_samples_number"); } catch (...) { ERROR_STREAM << "Failed to set samples number" << std::endl; - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Failed to set samples number"), - _CPTC("PulseCountingManagerBuffered::write_samples_number")); + THROW_DEVFAILED("DEVICE_ERROR", + "Failed to set samples number", + "PulseCountingManagerBuffered::write_samples_number"); } } @@ -1150,10 +1146,10 @@ void PulseCountingManagerBuffered::releaseObjects() // release clock try { - if (this->m_clock_generator) + if (m_clock_generator) { - this->m_clock_generator->deleteObject(); - this->m_isHwInitNeeded = true; + m_clock_generator->deleteObject(); + m_isHwInitNeeded = true; } } catch(...) @@ -1182,13 +1178,12 @@ void PulseCountingManagerBuffered::releaseObjects() // PulseCountingManagerBuffered::check_configuration // ============================================================================ std::string PulseCountingManagerBuffered::check_configuration(bool excpt) - throw (Tango::DevFailed) { yat::OSStream oss; // First check if valid configuration - if ((this->m_acq_param.continuousAcquisition) && - (this->m_acq_param.samplesNumber == 0)) + if ((m_acq_param.continuousAcquisition) && + (m_acq_param.samplesNumber == 0)) { oss << "WARNING! Configuration is NOT approved!" << std::endl; oss << "Continuous and infinite acquisition cannot be set together!" << std::endl; @@ -1198,14 +1193,14 @@ std::string PulseCountingManagerBuffered::check_configuration(bool excpt) { // send exception THROW_DEVFAILED( - _CPTC("CONFIGURATION_WARNING"), + "CONFIGURATION_WARNING", oss.str().c_str(), - _CPTC("PulseCountingManagerBuffered::check_configuration")); + "PulseCountingManagerBuffered::check_configuration"); } } // Check if continuous acquisition - if (this->m_acq_param.continuousAcquisition) + if (m_acq_param.continuousAcquisition) { // In this case, buffer depth will be set to samples number automatically, // so no problem @@ -1213,36 +1208,36 @@ std::string PulseCountingManagerBuffered::check_configuration(bool excpt) oss << "Continuous acquisition, so buffer depth will be set to samples number:" << std::endl; oss << "no intermediate buffers will be received." << std::endl; - if (this->m_board_arch.clockGeneration) + if (m_board_arch.clockGeneration) { - oss << "buffers will be received every " << this->m_acq_param.samplesNumber * this->m_acq_param.integrationTime << " seconds." << std::endl; + oss << "buffers will be received every " << m_acq_param.samplesNumber * m_acq_param.integrationTime << " seconds." << std::endl; } // compute the number of needed clock ticks for whole acquisition - unsigned long nb_clock = this->m_acq_param.samplesNumber; + unsigned long nb_clock = m_acq_param.samplesNumber; // add one tick if start trigger used - if (this->m_acq_param.startTriggerUse) + if (m_acq_param.startTriggerUse) nb_clock += 1; oss << "Number of clock ticks needed for each acquisition is: " << nb_clock << std::endl; } // Check if infinite acquisition - else if (this->m_acq_param.samplesNumber == 0) + else if (m_acq_param.samplesNumber == 0) { // Infinite acquisition, to be stopped by Stop command oss << "Configuration is APPROVED!" << std::endl; oss << "Infinite acquisition." << std::endl; - if (this->m_board_arch.clockGeneration) + if (m_board_arch.clockGeneration) { - oss << "Buffers will be received every " << this->m_acq_param.bufferDepth * this->m_acq_param.integrationTime << " seconds." << std::endl; + oss << "Buffers will be received every " << m_acq_param.bufferDepth * m_acq_param.integrationTime << " seconds." << std::endl; } // compute the number of needed clock ticks for whole acquisition - unsigned long nb_clock = this->m_acq_param.bufferDepth; + unsigned long nb_clock = m_acq_param.bufferDepth; // add one tick if start trigger used - if (this->m_acq_param.startTriggerUse) + if (m_acq_param.startTriggerUse) nb_clock += 1; oss << "Number of clock ticks needed for each buffer is: " << nb_clock << std::endl; } @@ -1251,26 +1246,26 @@ std::string PulseCountingManagerBuffered::check_configuration(bool excpt) // Check if the current value of samples number is a multiple of current buffer depth value // If not multiple, if external clock & trigger listener option set, config is approved // because last buffer will be read, even if not complete. - if ( ((this->m_acq_param.samplesNumber % this->m_acq_param.bufferDepth) == 0) || - ( ((this->m_acq_param.samplesNumber % this->m_acq_param.bufferDepth) != 0) && - (!this->m_board_arch.clockGeneration) && - (this->m_board_arch.udp_address.size() != 0) && - (this->m_board_arch.udp_port != 0)) + if ( ((m_acq_param.samplesNumber % m_acq_param.bufferDepth) == 0) || + ( ((m_acq_param.samplesNumber % m_acq_param.bufferDepth) != 0) && + (!m_board_arch.clockGeneration) && + (m_board_arch.udp_address.size() != 0) && + (m_board_arch.udp_port != 0)) ) { // buffer depth divides samples number, configuration is approved oss << "Configuration is APPROVED!" << std::endl; - if ((this->m_acq_param.samplesNumber % this->m_acq_param.bufferDepth) == 0) + if ((m_acq_param.samplesNumber % m_acq_param.bufferDepth) == 0) oss << "Buffer depth divides samples number." << std::endl; else oss << "UDP listener option activated, last incomplete buffer will be received without extra triggers." << std::endl; - oss << "Intermediate buffers will be received every " << this->m_acq_param.bufferDepth << " points"; + oss << "Intermediate buffers will be received every " << m_acq_param.bufferDepth << " points"; - if (this->m_board_arch.clockGeneration) + if (m_board_arch.clockGeneration) { - oss << " (= every " << this->m_acq_param.bufferDepth * this->m_acq_param.integrationTime << " seconds)." << std::endl; - oss << " Whole acquisition will last " << this->m_acq_param.samplesNumber * this->m_acq_param.integrationTime << " seconds." << std::endl; + oss << " (= every " << m_acq_param.bufferDepth * m_acq_param.integrationTime << " seconds)." << std::endl; + oss << " Whole acquisition will last " << m_acq_param.samplesNumber * m_acq_param.integrationTime << " seconds." << std::endl; } else { @@ -1278,10 +1273,10 @@ std::string PulseCountingManagerBuffered::check_configuration(bool excpt) } // compute the number of needed clock ticks for whole acquisition - unsigned long nb_clock = this->m_acq_param.samplesNumber; + unsigned long nb_clock = m_acq_param.samplesNumber; // add one tick if start trigger used - if (this->m_acq_param.startTriggerUse) + if (m_acq_param.startTriggerUse) nb_clock += 1; oss << "Number of clock ticks needed for whole acquisition is: " << nb_clock << std::endl; } @@ -1290,15 +1285,15 @@ std::string PulseCountingManagerBuffered::check_configuration(bool excpt) // buffer depth does not divides samples number, configuration is not approved oss << "WARNING! Configuration is NOT approved!" << std::endl; oss << "Buffer depth does not divide samples number." << std::endl; - oss << "Intermediate buffers will be received every " << this->m_acq_param.bufferDepth << " points"; + oss << "Intermediate buffers will be received every " << m_acq_param.bufferDepth << " points"; unsigned long nb_buffers - = (unsigned long)((this->m_acq_param.samplesNumber + this->m_acq_param.bufferDepth - 1) / this->m_acq_param.bufferDepth); + = (unsigned long)((m_acq_param.samplesNumber + m_acq_param.bufferDepth - 1) / m_acq_param.bufferDepth); - if (this->m_board_arch.clockGeneration) + if (m_board_arch.clockGeneration) { - oss << " (= every " << this->m_acq_param.bufferDepth * this->m_acq_param.integrationTime << " seconds)." << std::endl; - oss << " Whole acquisition will last " << nb_buffers * this->m_acq_param.bufferDepth * this->m_acq_param.integrationTime << " seconds." << std::endl; + oss << " (= every " << m_acq_param.bufferDepth * m_acq_param.integrationTime << " seconds)." << std::endl; + oss << " Whole acquisition will last " << nb_buffers * m_acq_param.bufferDepth * m_acq_param.integrationTime << " seconds." << std::endl; } else { @@ -1307,10 +1302,10 @@ std::string PulseCountingManagerBuffered::check_configuration(bool excpt) } // compute the number of needed clock ticks for whole acquisition - unsigned long nb_clocks = nb_buffers * this->m_acq_param.bufferDepth; + unsigned long nb_clocks = nb_buffers * m_acq_param.bufferDepth; // add one tick if start trigger used - if (this->m_acq_param.startTriggerUse) + if (m_acq_param.startTriggerUse) nb_clocks += 1; oss << "Number of clock ticks needed for whole acquisition is: " << nb_clocks << std::endl; @@ -1318,9 +1313,9 @@ std::string PulseCountingManagerBuffered::check_configuration(bool excpt) { // send exception THROW_DEVFAILED( - _CPTC("CONFIGURATION_WARNING"), + "CONFIGURATION_WARNING", oss.str().c_str(), - _CPTC("PulseCountingManagerBuffered::check_configuration")); + "PulseCountingManagerBuffered::check_configuration"); } } } @@ -1332,7 +1327,6 @@ std::string PulseCountingManagerBuffered::check_configuration(bool excpt) // PulseCountingManagerBuffered::configure_trigger_listener // ============================================================================ void PulseCountingManagerBuffered::configure_trigger_listener(std::string addr, yat::uint32 port) - throw (Tango::DevFailed) { DEBUG_STREAM << "PulseCountingManagerBuffered::configure_trigger_listener() entering..." << std::endl; DEBUG_STREAM << " UDP listener on addr: " << addr << " - port: " << port << std::endl; @@ -1350,9 +1344,9 @@ void PulseCountingManagerBuffered::configure_trigger_listener(std::string addr, DEBUG_STREAM << "Failed to create UDP listener object! Check UDPaddress & UDPPort properties!" << std::endl; // send exception THROW_DEVFAILED( - _CPTC("CONFIGURATION_FAILURE"), - _CPTC("Failed to create UDP listener object! Check UDPaddress & UDPPort properties!"), - _CPTC("PulseCountingManagerBuffered::configure_trigger_listener")); + "CONFIGURATION_FAILURE", + "Failed to create UDP listener object! Check UDPaddress & UDPPort properties!", + "PulseCountingManagerBuffered::configure_trigger_listener"); } m_trigListener->start_undetached(); @@ -1361,8 +1355,8 @@ void PulseCountingManagerBuffered::configure_trigger_listener(std::string addr, // (better to ask on timeout the current trigger number // than manage the ues messages when acquisition freq // is high : avoid task message queue overflow) - this->set_timeout_msg_period (kTIMEOUT_MSG_PERIOD_MS); - this->enable_timeout_msg (true); + set_timeout_msg_period (kTIMEOUT_MSG_PERIOD_MS); + enable_timeout_msg (true); DEBUG_STREAM << "PulseCountingManagerBuffered::configure_trigger_listener() ok" << std::endl; } @@ -1386,17 +1380,17 @@ void PulseCountingManagerBuffered::get_last_buffer_i() { ERROR_STREAM << "Counter get last buffer failed " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter get last buffer failed."), - _CPTC("PulseCountingManagerBuffered::get_last_buffer_i")); + "SOFTWARE_FAILURE", + "Counter get last buffer failed.", + "PulseCountingManagerBuffered::get_last_buffer_i"); } catch(...) { ERROR_STREAM << "Counter get last buffer failed." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter get last buffer failed."), - _CPTC("PulseCountingManagerBuffered::get_last_buffer_i")); + "SOFTWARE_FAILURE", + "Counter get last buffer failed.", + "PulseCountingManagerBuffered::get_last_buffer_i"); } } } diff --git a/src/PulseCountingManagerBuffered.h b/src/PulseCountingManagerBuffered.h old mode 100644 new mode 100755 index c45d63bdf7faed40c3244615c9e630e804f762c1..2c9ec5224bf03d64bdb34455fdddb23d75eb23ea --- a/src/PulseCountingManagerBuffered.h +++ b/src/PulseCountingManagerBuffered.h @@ -36,18 +36,15 @@ public: virtual ~PulseCountingManagerBuffered (); //- init - void init(BoardArchitecture p_board_arch) - throw (Tango::DevFailed); + void init(BoardArchitecture p_board_arch); //- Checks current acquisition configuration - std::string check_configuration(bool excpt) - throw (Tango::DevFailed); + std::string check_configuration(bool excpt); protected: //- process_message (implements yat4tango::DeviceTask pure virtual method) - virtual void process_message (yat::Message& msg) - throw (Tango::DevFailed); + virtual void process_message (yat::Message& msg); //- read callback for attr counterX void read_counter(yat4tango::DynamicAttributeReadCallbackData & cbd); @@ -63,35 +60,29 @@ protected: void read_current_point(yat4tango::DynamicAttributeReadCallbackData & cbd); //- manage dynamics attribute - void manage_specific_dyn_attr () - throw (Tango::DevFailed); + void manage_specific_dyn_attr (); //- start - void start_i () - throw (Tango::DevFailed); + void start_i (); //- stop - void stop_i () - throw (Tango::DevFailed); + void stop_i (); //- initialization void init_i (); //- periodic job - void periodic_job_i () - throw (Tango::DevFailed); + void periodic_job_i (); //- get last incomplete buffer (for trigger listener option) - void get_last_buffer_i() - throw (Tango::DevFailed); + void get_last_buffer_i(); //- release internal objects (clock & counters) void releaseObjects(); //- Configure trigger listener (for external clock) //- use address & port specified in parameters - void configure_trigger_listener(std::string addr, yat::uint32 port) - throw (Tango::DevFailed); + void configure_trigger_listener(std::string addr, yat::uint32 port); // map for counters value storage (common callback function) //- key = counter id in device (0 -> N), value = buffered counter value diff --git a/src/PulseCountingManagerScalar.cpp b/src/PulseCountingManagerScalar.cpp index 1352a393b50a992752abd373c6e4848c3a25f4be..8120521942dae429fb5c745328898b8f48249aca 100755 --- a/src/PulseCountingManagerScalar.cpp +++ b/src/PulseCountingManagerScalar.cpp @@ -20,12 +20,12 @@ namespace PulseCounting_ns //- Check nexus manager macro: #define CHECK_NX_MANAGER() \ - if (! this->m_nexus_manager) \ + if (! m_nexus_manager) \ { \ m_status = "Internal error."; \ - THROW_DEVFAILED(_CPTC("INTERNAL_ERROR"), \ - _CPTC("request aborted - the Nexus manager isn't properly initialized"), \ - _CPTC("PulseCountingManagerScalar::check_nx_manager")); \ + THROW_DEVFAILED("INTERNAL_ERROR", \ + "request aborted - the Nexus manager isn't properly initialized", \ + "PulseCountingManagerScalar::check_nx_manager"); \ } while (0) //- check clock generator macro: @@ -33,9 +33,9 @@ namespace PulseCounting_ns do \ { \ if (! m_clock_generator) \ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("request aborted - the clock generator isn't accessible "), \ - _CPTC("PulseCountingManagerScalar::check_clk_gen")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the clock generator isn't accessible ", \ + "PulseCountingManagerScalar::check_clk_gen"); \ } while (0) //- check counting boerd macro: @@ -43,9 +43,9 @@ namespace PulseCounting_ns do \ { \ if (! m_counting_board) \ - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), \ - _CPTC("request aborted - the counting board isn't accessible "), \ - _CPTC("PulseCountingManagerScalar::check_counting_board")); \ + THROW_DEVFAILED("DEVICE_ERROR", \ + "request aborted - the counting board isn't accessible ", \ + "PulseCountingManagerScalar::check_counting_board"); \ } while (0) //***************************************************************************** @@ -83,7 +83,7 @@ yat::Thread::IOArg ECThread::run_undetached (yat::Thread::IOArg ioa) DEBUG_STREAM << "Wait end of clock..." << std::endl; - this->m_cfg.clockGen->waitEndOfClock(); // the driver waits for the clock to end... + m_cfg.clockGen->waitEndOfClock(); // the driver waits for the clock to end... // when function returns, the clock is over DEBUG_STREAM << "Clock has stopped!" << std::endl; @@ -109,7 +109,7 @@ yat::Thread::IOArg ECThread::run_undetached (yat::Thread::IOArg ioa) // ============================================================================ void ECThread::exit (void) { - this->m_goOn = false; + m_goOn = false; } // ============================================================================ @@ -128,10 +128,10 @@ PulseCountingManagerScalar::PulseCountingManagerScalar (Tango::DeviceImpl * host // ============================================================================ PulseCountingManagerScalar::~PulseCountingManagerScalar () { - this->set_periodic_msg_period (0xFFFF); - this->enable_periodic_msg (false); + set_periodic_msg_period (0xFFFF); + enable_periodic_msg (false); - this->releaseObjects(); + releaseObjects(); if (m_endOfClock_thread) { @@ -144,7 +144,6 @@ PulseCountingManagerScalar::~PulseCountingManagerScalar () // PulseCountingManagerScalar::init () // ============================================================================ void PulseCountingManagerScalar::init(BoardArchitecture p_board_arch) - throw (Tango::DevFailed) { // Call init from mother class PulseCountingManager::init(p_board_arch); @@ -166,17 +165,17 @@ void PulseCountingManagerScalar::init(BoardArchitecture p_board_arch) { ERROR_STREAM << e << std::endl; RETHROW_DEVFAILED(e, - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to add specific dynamic attributes"), - _CPTC("PulseCountingManagerScalar::init")); + "DEVICE_ERROR", + "Failed to add specific dynamic attributes", + "PulseCountingManagerScalar::init"); } catch (...) { ERROR_STREAM << "Failed to add specific dynamic attributes" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("Failed to add specific dynamic attributes"), - _CPTC("PulseCountingManagerScalar::init")); + "DEVICE_ERROR", + "Failed to add specific dynamic attributes", + "PulseCountingManagerScalar::init"); } } @@ -184,7 +183,6 @@ void PulseCountingManagerScalar::init(BoardArchitecture p_board_arch) // PulseCountingManagerScalar::process_message // ============================================================================ void PulseCountingManagerScalar::process_message (yat::Message& msg) - throw (Tango::DevFailed) { //- handle msg switch (msg.type()) @@ -193,7 +191,7 @@ void PulseCountingManagerScalar::process_message (yat::Message& msg) case yat::TASK_INIT: { DEBUG_STREAM << "PulseCountingManagerScalar::handle_message::THREAD_INIT::thread is starting up" << std::endl; - this->init_i(); + init_i(); } break; @@ -208,7 +206,7 @@ void PulseCountingManagerScalar::process_message (yat::Message& msg) case yat::TASK_PERIODIC: { //DEBUG_STREAM << "PulseCountingManagerScalar::handle_message::THREAD_PERIODIC" << std::endl; - this->periodic_job_i(); + periodic_job_i(); } break; @@ -221,46 +219,46 @@ void PulseCountingManagerScalar::process_message (yat::Message& msg) //- kSTART_MSG case kSTART_MSG: { - this->start_i(); + start_i(); } break; //- kSTOP_MSG case kSTOP_MSG: { { - yat::AutoMutex<> guard(this->m_flagLock); - this->m_requestedStop = true; + yat::AutoMutex<> guard(m_flagLock); + m_requestedStop = true; } - if (this->m_acq_running) - this->stop_i(); + if (m_acq_running) + stop_i(); // force state & status update - this->periodic_job_i(); + periodic_job_i(); } break; //- kEND_OF_CLOCK_MSG case kEND_OF_CLOCK_MSG: { // internal stop only if "natural end" (not requested) - if (!this->m_requestedStop) + if (!m_requestedStop) { - this->stop_i(); + stop_i(); } // Delete "waiting end of clock" thread DEBUG_STREAM << "PulseCountingManagerScalar::process_message - Asking EC thread to quit" << std::endl; - if (this->m_endOfClock_thread) + if (m_endOfClock_thread) { yat::Thread::IOArg ioa; - this->m_endOfClock_thread->exit(); - this->m_endOfClock_thread->join(&ioa); + m_endOfClock_thread->exit(); + m_endOfClock_thread->join(&ioa); DEBUG_STREAM << "PulseCountingManagerScalar::process_message - EC thread exited" << std::endl; - this->m_endOfClock_thread = NULL; + m_endOfClock_thread = NULL; } // force state & status update - this->periodic_job_i(); + periodic_job_i(); } break; //- UNHANDLED MSG -------------------- @@ -282,45 +280,44 @@ void PulseCountingManagerScalar::init_i() double val = 1.0; try { - val = get_value_as_property<double>(this->m_board_arch.hostDevice, prop_name); - this->set_integration_time(val); + val = get_value_as_property<double>(m_board_arch.hostDevice, prop_name); + set_integration_time(val); } catch(...) { // no value in db, use default value - this->set_integration_time(1.0); + set_integration_time(1.0); } m_stored_it = val; } else { // set integration time to default value - this->set_integration_time(1.0); + set_integration_time(1.0); } // start periodic msg - this->set_periodic_msg_period((size_t)this->m_acq_param.pollingPeriod); //ms - this->enable_periodic_msg(true); + set_periodic_msg_period((size_t)m_acq_param.pollingPeriod); //ms + enable_periodic_msg(true); } // ============================================================================ // PulseCountingManagerScalar::periodic_job_i () // ============================================================================ void PulseCountingManagerScalar::periodic_job_i() - throw (Tango::DevFailed) { std::vector<Tango::DevState> l_vect_state; std::string countersStatus = ""; - yat::AutoMutex<> guard(this->m_flagLock); + yat::AutoMutex<> guard(m_flagLock); // evaluate state if manager not already in fault - if (this->m_state != Tango::FAULT) + if (m_state != Tango::FAULT) { - if (!this->m_acq_param.continuousAcquisition) + if (!m_acq_param.continuousAcquisition) { Tango::DevState l_state = Tango::STANDBY; - if (this->m_acq_running) + if (m_acq_running) { // read current counters value & state from board GenericCounterMap_t::iterator l_it; @@ -374,8 +371,8 @@ void PulseCountingManagerScalar::periodic_job_i() if (acq_error) { m_state = Tango::FAULT; - this->m_requestedStop = true; - this->stop_i(); + m_requestedStop = true; + stop_i(); } } else @@ -404,7 +401,7 @@ void PulseCountingManagerScalar::periodic_job_i() countersStatus += std::string("\n") + l_it->second->get_name() + ": " + std::string(Tango::DevStateName[l_state]); } - if (this->m_acq_running) + if (m_acq_running) { m_state = Tango::RUNNING; m_status = "Acquisition in progress...\n"; @@ -433,14 +430,14 @@ void PulseCountingManagerScalar::start_i() // then configure new clock (if needed) if (m_isHwInitNeeded) - this->configure_clock(); + configure_clock(); // init nexus manager (if needed) // do not re-initialize nexus file in continuous acquisition (except in 1st start) if (m_acq_param.nexusFileGeneration && m_firstStart) { // re-build nexus item list - this->build_nexus_item_list(); + build_nexus_item_list(); try { @@ -454,21 +451,21 @@ void PulseCountingManagerScalar::start_i() } catch( Tango::DevFailed &df ) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Init Nexus manager failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Init Nexus manager failed."), - _CPTC("PulseCountingManagerScalar::start_i")); + "SOFTWARE_FAILURE", + "Init Nexus manager failed.", + "PulseCountingManagerScalar::start_i"); } catch(...) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Init Nexus manager failed: caught[...]" << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Init Nexus manager failed."), - _CPTC("PulseCountingManagerScalar::start_i")); + "SOFTWARE_FAILURE", + "Init Nexus manager failed.", + "PulseCountingManagerScalar::start_i"); } } @@ -487,21 +484,21 @@ void PulseCountingManagerScalar::start_i() } catch( Tango::DevFailed &df ) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Counter configuration failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter configuration failed!"), - _CPTC("PulseCountingManagerScalar::start_i")); + "SOFTWARE_FAILURE", + "Counter configuration failed!", + "PulseCountingManagerScalar::start_i"); } catch(...) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Counter configure failed: caught [...]" << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter configuration failed!"), - _CPTC("PulseCountingManagerScalar::start_i")); + "SOFTWARE_FAILURE", + "Counter configuration failed!", + "PulseCountingManagerScalar::start_i"); } } @@ -514,21 +511,21 @@ void PulseCountingManagerScalar::start_i() } catch( Tango::DevFailed &df ) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Counter start failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter start failed."), - _CPTC("PulseCountingManagerScalar::start_i")); + "SOFTWARE_FAILURE", + "Counter start failed.", + "PulseCountingManagerScalar::start_i"); } catch(...) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Counter start failed: caught [...]" << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter start failed."), - _CPTC("PulseCountingManagerScalar::start_i")); + "SOFTWARE_FAILURE", + "Counter start failed.", + "PulseCountingManagerScalar::start_i"); } } @@ -537,29 +534,29 @@ void PulseCountingManagerScalar::start_i() { try { - this->m_clock_generator->start(); + m_clock_generator->start(); } catch( Tango::DevFailed &df ) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Start clock failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Start clock failed."), - _CPTC("PulseCountingManagerScalar::start_i")); + "SOFTWARE_FAILURE", + "Start clock failed.", + "PulseCountingManagerScalar::start_i"); } catch(...) { - this->releaseObjects(); + releaseObjects(); ERROR_STREAM << "Start clock failed: caught [...]" << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Start clock failed."), - _CPTC("PulseCountingManagerScalar::start_i")); + "SOFTWARE_FAILURE", + "Start clock failed.", + "PulseCountingManagerScalar::start_i"); } // Waits for the end of clock - this->wait_end_clock_i(); + wait_end_clock_i(); } m_acq_running = true; @@ -577,23 +574,23 @@ void PulseCountingManagerScalar::stop_i() try { DEBUG_STREAM << "Trying to stop clock" << endl; - this->m_clock_generator->abort(); + m_clock_generator->abort(); } catch( Tango::DevFailed &df ) { ERROR_STREAM << "Abort clock failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Abort clock failed."), - _CPTC("PulseCountingManagerScalar::start_i")); + "SOFTWARE_FAILURE", + "Abort clock failed.", + "PulseCountingManagerScalar::start_i"); } catch(...) { ERROR_STREAM << "Abort clock failed." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Abort clock failed."), - _CPTC("PulseCountingManagerScalar::start_i")); + "SOFTWARE_FAILURE", + "Abort clock failed.", + "PulseCountingManagerScalar::start_i"); } } @@ -610,16 +607,16 @@ void PulseCountingManagerScalar::stop_i() { ERROR_STREAM << "Counter stop failed " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter stop failed."), - _CPTC("PulseCountingManagerScalar::stop_i")); + "SOFTWARE_FAILURE", + "Counter stop failed.", + "PulseCountingManagerScalar::stop_i"); } catch(...) { ERROR_STREAM << "Counter stop failed." << std::endl; - THROW_DEVFAILED(_CPTC("SOFTWARE_FAILURE"), - _CPTC("Counter stop failed."), - _CPTC("PulseCountingManagerScalar::stop_i")); + THROW_DEVFAILED("SOFTWARE_FAILURE", + "Counter stop failed.", + "PulseCountingManagerScalar::stop_i"); } } @@ -635,7 +632,7 @@ void PulseCountingManagerScalar::stop_i() CHECK_NX_MANAGER(); try { - this->m_nexus_manager->pushNexusData(l_it->second->get_config().dataset, &l_val); + m_nexus_manager->pushNexusData(l_it->second->get_config().dataset, &l_val); } catch (Tango::DevFailed & df) { @@ -650,12 +647,12 @@ void PulseCountingManagerScalar::stop_i() // Finalize Nexus file if (!m_acq_param.continuousAcquisition || - (this->m_requestedStop && m_acq_param.continuousAcquisition)) + (m_requestedStop && m_acq_param.continuousAcquisition)) { try { INFO_STREAM << "Finalize NEXUS generation..." << std::endl; - this->m_nexus_manager->finalizeNexusGeneration(); + m_nexus_manager->finalizeNexusGeneration(); } catch (Tango::DevFailed & df) { @@ -667,10 +664,10 @@ void PulseCountingManagerScalar::stop_i() m_acq_running = false; // check continuous mode to restart acquisition if not requested stop - if (!this->m_requestedStop && m_acq_param.continuousAcquisition) + if (!m_requestedStop && m_acq_param.continuousAcquisition) { m_firstStart = false; - this->start_i(); + start_i(); } } @@ -678,14 +675,13 @@ void PulseCountingManagerScalar::stop_i() // PulseCountingManagerScalar::manage_specific_dyn_attr () // ============================================================================ void PulseCountingManagerScalar::manage_specific_dyn_attr() - throw (Tango::DevFailed) { if (! m_dyn_attr_manager) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("The dynamic attribute manager object isn't accessible "), - _CPTC("PulseCountingManagerScalar::check_manager_dyn_attr_manager")); + "DEVICE_ERROR", + "The dynamic attribute manager object isn't accessible ", + "PulseCountingManagerScalar::check_manager_dyn_attr_manager"); } // Create SCALAR counting attributes @@ -718,23 +714,23 @@ void PulseCountingManagerScalar::manage_specific_dyn_attr() try { //- add all dynamic attributes to the device interface - this->m_dyn_attr_manager->add_attribute(dai); + m_dyn_attr_manager->add_attribute(dai); } catch( Tango::DevFailed &df ) { ERROR_STREAM << "Dynamic attribute addition failed: " << df << std::endl; RETHROW_DEVFAILED(df, - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Dynamic attribute addition failed."), - _CPTC("PulseCountingManagerScalar::manage_specific_dyn_attr")); + "SOFTWARE_FAILURE", + "Dynamic attribute addition failed.", + "PulseCountingManagerScalar::manage_specific_dyn_attr"); } catch(...) { ERROR_STREAM << "Dynamic attribute addition failed." << std::endl; THROW_DEVFAILED( - _CPTC("SOFTWARE_FAILURE"), - _CPTC("Dynamic attribute addition failed."), - _CPTC("PulseCountingManagerScalar::manage_specific_dyn_attr")); + "SOFTWARE_FAILURE", + "Dynamic attribute addition failed.", + "PulseCountingManagerScalar::manage_specific_dyn_attr"); } } } @@ -761,35 +757,34 @@ void PulseCountingManagerScalar::read_counter(yat4tango::DynamicAttributeReadCal // PulseCountingManagerScalar::wait_end_clock_i // ============================================================================ void PulseCountingManagerScalar::wait_end_clock_i () - throw (Tango::DevFailed) { // Task the waiting for end of clock in a different thread, // otherwise, the current thread blocks ! ECConfig ec_cfg; - ec_cfg.hostDevice = this->m_board_arch.hostDevice; - ec_cfg.clockGen = this->m_clock_generator; + ec_cfg.hostDevice = m_board_arch.hostDevice; + ec_cfg.clockGen = m_clock_generator; - this->m_endOfClock_thread = new ECThread(ec_cfg, static_cast<yat::Thread::IOArg>(this)); + m_endOfClock_thread = new ECThread(ec_cfg, static_cast<yat::Thread::IOArg>(this)); - if (this->m_endOfClock_thread == NULL) + if (m_endOfClock_thread == NULL) { ERROR_STREAM << "Waiting end of clock cannot be tasked!" << std::endl; THROW_DEVFAILED( - _CPTC("DEVICEN_ERROR"), - _CPTC("Failed to start waiting task!"), - _CPTC("PulseCountingManagerScalar::wait_end_clock_i")); + "DEVICEN_ERROR", + "Failed to start waiting task!", + "PulseCountingManagerScalar::wait_end_clock_i"); } try { - this->m_endOfClock_thread->start_undetached(); + m_endOfClock_thread->start_undetached(); } catch (...) { ERROR_STREAM << "Failed to start End Of Clock thread." << std::endl; - THROW_DEVFAILED(_CPTC("DEVICE_ERROR"), - _CPTC("Failed to start End Of Clock thread."), - _CPTC("PulseCountingManagerScalar::start_i")); + THROW_DEVFAILED("DEVICE_ERROR", + "Failed to start End Of Clock thread.", + "PulseCountingManagerScalar::start_i"); } } @@ -801,10 +796,10 @@ void PulseCountingManagerScalar::releaseObjects() // release clock try { - if (this->m_clock_generator) + if (m_clock_generator) { - this->m_clock_generator->deleteObject(); - this->m_isHwInitNeeded = true; + m_clock_generator->deleteObject(); + m_isHwInitNeeded = true; } } catch(...) @@ -833,28 +828,27 @@ void PulseCountingManagerScalar::releaseObjects() // PulseCountingManagerScalar::check_configuration // ============================================================================ std::string PulseCountingManagerScalar::check_configuration(bool excpt) - throw (Tango::DevFailed) { yat::OSStream oss; - if (this->m_acq_param.continuousAcquisition) + if (m_acq_param.continuousAcquisition) { oss << "Configuration is APPROVED!" << std::endl; oss << "Continuous acquisition, so acquisition is infinite. Must be stopped by user." << std::endl; - if (this->m_board_arch.clockGeneration) + if (m_board_arch.clockGeneration) { - oss << "One value will be computed every " << this->m_acq_param.integrationTime << " seconds." << std::endl; + oss << "One value will be computed every " << m_acq_param.integrationTime << " seconds." << std::endl; } } else { oss << "Configuration is APPROVED!" << std::endl; - if (this->m_board_arch.clockGeneration) + if (m_board_arch.clockGeneration) { oss << "One acquisition will be done." << std::endl; - oss << "The value will be available after " << this->m_acq_param.integrationTime << " seconds." << std::endl; + oss << "The value will be available after " << m_acq_param.integrationTime << " seconds." << std::endl; } else { diff --git a/src/PulseCountingManagerScalar.h b/src/PulseCountingManagerScalar.h old mode 100644 new mode 100755 index 2128d22e94a37088d2aee79cb01b0b4994c44ccb..09cb2ebc5393f351d2f83da11bd6a9a62d511904 --- a/src/PulseCountingManagerScalar.h +++ b/src/PulseCountingManagerScalar.h @@ -48,8 +48,8 @@ namespace PulseCounting_ns { if (&src == this) return *this; - this->hostDevice = src.hostDevice; - this->clockGen = src.clockGen; + hostDevice = src.hostDevice; + clockGen = src.clockGen; return *this; } @@ -101,43 +101,35 @@ public: virtual ~PulseCountingManagerScalar (); //- init - void init(BoardArchitecture p_board_arch) - throw (Tango::DevFailed); + void init(BoardArchitecture p_board_arch); //- Checks current acquisition configuration - std::string check_configuration(bool excpt) - throw (Tango::DevFailed); + std::string check_configuration(bool excpt); protected: //- process_message (implements yat4tango::DeviceTask pure virtual method) - virtual void process_message (yat::Message& msg) - throw (Tango::DevFailed); + virtual void process_message (yat::Message& msg); //- read callback for attr counterX void read_counter(yat4tango::DynamicAttributeReadCallbackData & cbd); //- manage dynamics attribute - void manage_specific_dyn_attr () - throw (Tango::DevFailed); + void manage_specific_dyn_attr (); //- initialization void init_i (); //- start - void start_i () - throw (Tango::DevFailed); + void start_i (); //- stop - void stop_i () - throw (Tango::DevFailed); + void stop_i (); //- periodic job - void periodic_job_i () - throw (Tango::DevFailed); + void periodic_job_i (); //- wait end of finite clock - void wait_end_clock_i () - throw (Tango::DevFailed); + void wait_end_clock_i (); //- release internal objects (clock & counters) void releaseObjects(); diff --git a/src/PulseCountingTypesAndConsts.h b/src/PulseCountingTypesAndConsts.h index e998b2fdfad1540088e2b4aa126b75cc6d9462f3..5828b8d35de0adf371e1124b78ce2329399fdc78 100755 --- a/src/PulseCountingTypesAndConsts.h +++ b/src/PulseCountingTypesAndConsts.h @@ -349,34 +349,34 @@ typedef struct CounterConfig if (this == & src) return *this; - this->number = src.number; - this->ctNumber = src.ctNumber; - this->name = src.name; - this->format = src.format; - this->boardName = src.boardName; - this->direction = src.direction; - this->edge = src.edge; - this->scdEdge = src.scdEdge; - this->initProxy = src.initProxy; - this->absInitPos = src.absInitPos; - this->applyInitPos = src.applyInitPos; - this->memTranfer = src.memTranfer; - this->mode = src.mode; - this->pos_decodingMode = src.pos_decodingMode; - this->pos_distPerPulse = src.pos_distPerPulse; - this->pos_encoderMode = src.pos_encoderMode; - this->pos_encoderUnit = src.pos_encoderUnit; - this->pos_unitStr = src.pos_unitStr; - this->pos_pulsePerRevolution = src.pos_pulsePerRevolution; - this->pos_ZindexEnabled = src.pos_ZindexEnabled; - this->pos_ZindexPhase = src.pos_ZindexPhase; - this->pos_ZindexValue = src.pos_ZindexValue; - this->minPulseWidthEnabled = src.minPulseWidthEnabled; - this->minPulseWidth = src.minPulseWidth; - this->dt_unit = src.dt_unit; - this->dt_unitStr = src.dt_unitStr; - this->nexus = src.nexus; - this->dataset = src.dataset; + number = src.number; + ctNumber = src.ctNumber; + name = src.name; + format = src.format; + boardName = src.boardName; + direction = src.direction; + edge = src.edge; + scdEdge = src.scdEdge; + initProxy = src.initProxy; + absInitPos = src.absInitPos; + applyInitPos = src.applyInitPos; + memTranfer = src.memTranfer; + mode = src.mode; + pos_decodingMode = src.pos_decodingMode; + pos_distPerPulse = src.pos_distPerPulse; + pos_encoderMode = src.pos_encoderMode; + pos_encoderUnit = src.pos_encoderUnit; + pos_unitStr = src.pos_unitStr; + pos_pulsePerRevolution = src.pos_pulsePerRevolution; + pos_ZindexEnabled = src.pos_ZindexEnabled; + pos_ZindexPhase = src.pos_ZindexPhase; + pos_ZindexValue = src.pos_ZindexValue; + minPulseWidthEnabled = src.minPulseWidthEnabled; + minPulseWidth = src.minPulseWidth; + dt_unit = src.dt_unit; + dt_unitStr = src.dt_unitStr; + nexus = src.nexus; + dataset = src.dataset; return *this; } @@ -385,85 +385,85 @@ typedef struct CounterConfig void dump () const { std::cout << "CounterConfig::number........." - << this->number + << number << std::endl; std::cout << "CounterConfig::ctNumber........." - << this->ctNumber + << ctNumber << std::endl; std::cout << "CounterConfig::name........." - << this->name + << name << std::endl; std::cout << "CounterConfig::boardName........." - << this->boardName + << boardName << std::endl; std::cout << "CounterConfig::mode........." - << this->mode + << mode << std::endl; std::cout << "CounterConfig::edge........." - << this->edge + << edge << std::endl; std::cout << "CounterConfig::scdEdge........." - << this->scdEdge + << scdEdge << std::endl; std::cout << "CounterConfig::memTranfer........." - << this->memTranfer + << memTranfer << std::endl; std::cout << "CounterConfig::direction........." - << this->direction + << direction << std::endl; std::cout << "CounterConfig::initProxy........." - << this->initProxy + << initProxy << std::endl; std::cout << "CounterConfig::absInitPos........." - << this->absInitPos + << absInitPos << std::endl; std::cout << "CounterConfig::applyInitPos........." - << this->applyInitPos + << applyInitPos << std::endl; std::cout << "CounterConfig::pos_decodingMode........." - << this->pos_decodingMode + << pos_decodingMode << std::endl; std::cout << "CounterConfig::pos_ZindexEnabled........." - << this->pos_ZindexEnabled + << pos_ZindexEnabled << std::endl; std::cout << "CounterConfig::pos_ZindexPhase........." - << this->pos_ZindexPhase + << pos_ZindexPhase << std::endl; std::cout << "CounterConfig::pos_ZindexValue........." - << this->pos_ZindexValue + << pos_ZindexValue << std::endl; std::cout << "CounterConfig::pos_encoderUnit........." - << this->pos_encoderUnit + << pos_encoderUnit << std::endl; std::cout << "CounterConfig::pos_unitStr........." - << this->pos_unitStr + << pos_unitStr << std::endl; std::cout << "CounterConfig::pos_distPerPulse........." - << this->pos_distPerPulse + << pos_distPerPulse << std::endl; std::cout << "CounterConfig::pos_pulsePerRevolution........." - << this->pos_pulsePerRevolution + << pos_pulsePerRevolution << std::endl; std::cout << "CounterConfig::minPulseWidthEnabled........." - << this->minPulseWidthEnabled + << minPulseWidthEnabled << std::endl; std::cout << "CounterConfig::minPulseWidth........." - << this->minPulseWidth + << minPulseWidth << std::endl; std::cout << "CounterConfig::dt_unit........." - << this->dt_unit + << dt_unit << std::endl; std::cout << "CounterConfig::dt_unitStr........." - << this->dt_unitStr + << dt_unitStr << std::endl; std::cout << "CounterConfig::nexus........." - << this->nexus + << nexus << std::endl; std::cout << "CounterConfig::dataset........." - << this->dataset + << dataset << std::endl; std::cout << "CounterConfig::format........." - << this->format + << format << std::endl; } @@ -568,22 +568,22 @@ typedef struct AcquisitionDefinition if (this == & src) return *this; - this->nexusFileGeneration = src.nexusFileGeneration; - this->nexusTargetPath = src.nexusTargetPath; - this->nexusFileName = src.nexusFileName; - this->nexusNbPerFile = src.nexusNbPerFile; - this->nexusMeasDim = src.nexusMeasDim; - this->flyscanSpool = src.flyscanSpool; - this->acqMode = src.acqMode; - this->continuousAcquisition = src.continuousAcquisition; - this->integrationTime = src.integrationTime; - this->frequency = src.frequency; - this->timeout = src.timeout; - this->samplesNumber = src.samplesNumber; - this->bufferDepth = src.bufferDepth; - this->startTriggerUse = src.startTriggerUse; - this->timebaseScaling = src.timebaseScaling; - this->pollingPeriod = src.pollingPeriod; + nexusFileGeneration = src.nexusFileGeneration; + nexusTargetPath = src.nexusTargetPath; + nexusFileName = src.nexusFileName; + nexusNbPerFile = src.nexusNbPerFile; + nexusMeasDim = src.nexusMeasDim; + flyscanSpool = src.flyscanSpool; + acqMode = src.acqMode; + continuousAcquisition = src.continuousAcquisition; + integrationTime = src.integrationTime; + frequency = src.frequency; + timeout = src.timeout; + samplesNumber = src.samplesNumber; + bufferDepth = src.bufferDepth; + startTriggerUse = src.startTriggerUse; + timebaseScaling = src.timebaseScaling; + pollingPeriod = src.pollingPeriod; return *this; } @@ -592,52 +592,52 @@ typedef struct AcquisitionDefinition void dump () const { std::cout << "AcquisitionDefinition::nexusFileGeneration........." - << this->nexusFileGeneration + << nexusFileGeneration << std::endl; std::cout << "AcquisitionDefinition::nexusTargetPath........." - << this->nexusTargetPath + << nexusTargetPath << std::endl; std::cout << "AcquisitionDefinition::nexusFileName........." - << this->nexusFileName + << nexusFileName << std::endl; std::cout << "AcquisitionDefinition::flyscanSpool........." - << this->flyscanSpool + << flyscanSpool << std::endl; std::cout << "AcquisitionDefinition::nexusNbPerFile........." - << this->nexusNbPerFile + << nexusNbPerFile << std::endl; std::cout << "AcquisitionDefinition::nexusMeasDim........." - << this->nexusMeasDim + << nexusMeasDim << std::endl; std::cout << "AcquisitionDefinition::acqMode........." - << this->acqMode + << acqMode << std::endl; std::cout << "AcquisitionDefinition::continuousAcquisition........." - << this->continuousAcquisition + << continuousAcquisition << std::endl; std::cout << "AcquisitionDefinition::integrationTime........." - << this->integrationTime + << integrationTime << std::endl; std::cout << "AcquisitionDefinition::frequency........." - << this->frequency + << frequency << std::endl; std::cout << "AcquisitionDefinition::timeout........." - << this->nexusNbPerFile + << nexusNbPerFile << std::endl; std::cout << "AcquisitionDefinition::samplesNumber........." - << this->samplesNumber + << samplesNumber << std::endl; std::cout << "AcquisitionDefinition::bufferDepth........." - << this->bufferDepth + << bufferDepth << std::endl; std::cout << "AcquisitionDefinition::startTriggerUse........." - << this->startTriggerUse + << startTriggerUse << std::endl; std::cout << "AcquisitionDefinition::timebaseScaling........." - << this->timebaseScaling + << timebaseScaling << std::endl; std::cout << "AcquisitionDefinition::pollingPeriod........." - << this->pollingPeriod + << pollingPeriod << std::endl; } @@ -680,9 +680,9 @@ typedef struct BCEconfig if (this == & src) return *this; - this->acq = src.acq; - this->cnt = src.cnt; - this->hostDevice = src.hostDevice; + acq = src.acq; + cnt = src.cnt; + hostDevice = src.hostDevice; return *this; } @@ -692,11 +692,11 @@ typedef struct BCEconfig { std::cout << "BCEconfig::acquisition........." << std::endl; - this->acq.dump(); + acq.dump(); std::cout << "BCEconfig::counter........." << std::endl; - this->cnt.dump(); + cnt.dump(); std::cout << "BCEconfig::hostDevice........." << hostDevice << endl; @@ -762,13 +762,13 @@ typedef struct ClockConfig if (this == & src) return *this; - this->clockType = src.clockType; - this->boardName = src.boardName; - this->channelName = src.channelName; - this->frequency = src.frequency; - this->lowDurationTicks = src.lowDurationTicks; - this->highDurationTicks = src.highDurationTicks; - this->timebaseScaling = src.timebaseScaling; + clockType = src.clockType; + boardName = src.boardName; + channelName = src.channelName; + frequency = src.frequency; + lowDurationTicks = src.lowDurationTicks; + highDurationTicks = src.highDurationTicks; + timebaseScaling = src.timebaseScaling; return *this; } @@ -777,25 +777,25 @@ typedef struct ClockConfig void dump () const { std::cout << "ClockConfig::clockType........." - << this->clockType + << clockType << std::endl; std::cout << "ClockConfig::boardName........." - << this->boardName + << boardName << std::endl; std::cout << "ClockConfig::channelName........." - << this->channelName + << channelName << std::endl; std::cout << "ClockConfig::frequency........." - << this->frequency + << frequency << std::endl; std::cout << "ClockConfig::lowDurationTicks........." - << this->lowDurationTicks + << lowDurationTicks << std::endl; std::cout << "ClockConfig::highDurationTicks........." - << this->highDurationTicks + << highDurationTicks << std::endl; std::cout << "ClockConfig::timebaseScaling........." - << this->timebaseScaling + << timebaseScaling << std::endl; } @@ -866,14 +866,14 @@ typedef struct BoardArchitecture if (this == & src) return *this; - this->hostDevice = src.hostDevice; - this->clockGeneration = src.clockGeneration; - this->boardType = src.boardType; - this->chanNb = src.chanNb; - this->boardList = src.boardList; - this->counterConfiguration = src.counterConfiguration; - this->udp_address = src.udp_address; - this->udp_port = src.udp_port; + hostDevice = src.hostDevice; + clockGeneration = src.clockGeneration; + boardType = src.boardType; + chanNb = src.chanNb; + boardList = src.boardList; + counterConfiguration = src.counterConfiguration; + udp_address = src.udp_address; + udp_port = src.udp_port; return *this; } @@ -882,19 +882,19 @@ typedef struct BoardArchitecture void dump () const { std::cout << "BoardArchitecture::clockGeneration........." - << this->clockGeneration + << clockGeneration << std::endl; std::cout << "BoardArchitecture::boardType........." - << this->boardType + << boardType << std::endl; std::cout << "BoardArchitecture::chanNb........." - << this->chanNb + << chanNb << std::endl; std::cout << "BoardArchitecture::udp_address........." - << this->udp_address + << udp_address << std::endl; std::cout << "BoardArchitecture::udp_port........." - << this->udp_port + << udp_port << std::endl; } @@ -958,14 +958,13 @@ static std::vector<std::string> define_config_counter_example() //- get stored value in Device property template <class T> static T get_value_as_property(Tango::DeviceImpl* dev_p, const std::string& property_name) - throw (Tango::DevFailed) { if (!Tango::Util::instance()->_UseDb) { THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("NO DB"), - _CPTC("PulseCounting::get_value_as_property")); + "DEVICE_ERROR", + "NO DB", + "PulseCounting::get_value_as_property"); } T value; @@ -982,9 +981,9 @@ static T get_value_as_property(Tango::DeviceImpl* dev_p, const std::string& prop { RETHROW_DEVFAILED( df, - _CPTC("DEVICE_ERROR"), - _CPTC(std::string(df.errors[0].desc).c_str()), - _CPTC("PulseCounting::get_value_as_property")); + "DEVICE_ERROR", + (std::string(df.errors[0].desc).c_str()), + "PulseCounting::get_value_as_property"); } //- Try to extract saved property from database @@ -996,9 +995,9 @@ static T get_value_as_property(Tango::DeviceImpl* dev_p, const std::string& prop { // no value stored in data base THROW_DEVFAILED( - _CPTC("DEVICE_ERROR"), - _CPTC("No value in database"), - _CPTC("PulseCounting::get_value_as_property")); + "DEVICE_ERROR", + "No value in database", + "PulseCounting::get_value_as_property"); } return value; diff --git a/src/UDPListener.cpp b/src/UDPListener.cpp old mode 100644 new mode 100755 index cfde2d2c361927d0ae8b3debcba679d87434e25e..bf2a6c7ced32a64fc43dc3539b7a1b5025c253f0 --- a/src/UDPListener.cpp +++ b/src/UDPListener.cpp @@ -65,7 +65,7 @@ void UDPListener::exit () { m_go_on = false; yat::Thread::IOArg tmp = 0; - this->join(&tmp); + join(&tmp); } //============================================================================= @@ -151,7 +151,7 @@ yat::Thread::IOArg UDPListener::run_undetached (yat::Thread::IOArg) //- this is set by SpiUdpTimebase (i.e. the UDP event emitter) yat::uint32 udp_evt_number = *(reinterpret_cast<yat::uint32*>(ib.base())); { - yat::AutoMutex<> guard(this->m_evtsLock); + yat::AutoMutex<> guard(m_evtsLock); ++m_total_events; } diff --git a/src/UDPListener.h b/src/UDPListener.h old mode 100644 new mode 100755 index 3add4be3b8c03bdb09e75e2b0c3407237374879b..4c10745e97e945bf64daf008b5d3ece97e5dc634 --- a/src/UDPListener.h +++ b/src/UDPListener.h @@ -131,7 +131,7 @@ public: //- total number of received UDP events since call to yat::Thread::start inline yat::uint32 total_events () //const { - yat::AutoMutex<> guard(this->m_evtsLock); + yat::AutoMutex<> guard(m_evtsLock); return m_total_events; }