From 22eeda2b413c88130287b7fcf32f43797aba00f3 Mon Sep 17 00:00:00 2001
From: Sonia Minolli <sonia.minolli@synchrotron-soleil.fr>
Date: Tue, 12 Jul 2016 14:01:36 +0000
Subject: [PATCH] Created tag release_2_0_1.

---
 pom.xml                       |  4 ++--
 src/BufferedCounterDt.cpp     | 22 ++++++++++++++++++----
 src/BufferedCounterEvt.cpp    | 24 +++++++++++++++++++-----
 src/BufferedCounterPeriod.cpp | 22 ++++++++++++++++++----
 src/BufferedCounterPos.cpp    | 22 ++++++++++++++++++----
 5 files changed, 75 insertions(+), 19 deletions(-)

diff --git a/pom.xml b/pom.xml
index b7d84d9..103e57f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
    
    <groupId>fr.soleil.device</groupId>
    <artifactId>PulseCounting-${aol}-${mode}</artifactId>
-   <version>2.0.1-SNAPSHOT</version>
+   <version>2.0.1</version>
    
    <packaging>nar</packaging>
    <name>PulseCounting</name>
@@ -56,7 +56,7 @@
 			<dependency>
 				<groupId>fr.soleil.lib</groupId>
 				<artifactId>NexusCPPV2-${aol}-${library}-${mode}</artifactId>
-				<version>2.3.1</version>
+				<version>2.3.2</version>
 			</dependency>
    </dependencies>
    <scm>
diff --git a/src/BufferedCounterDt.cpp b/src/BufferedCounterDt.cpp
index 176f383..386b9d5 100644
--- a/src/BufferedCounterDt.cpp
+++ b/src/BufferedCounterDt.cpp
@@ -248,6 +248,10 @@ void BufferedCounterDt::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer, l
 			}
 			DEBUG_STREAM << "NB to copy : " << nb_to_copy << endl;
 
+			// add number to copy to current data
+			data.capacity(data.length() + nb_to_copy, true);
+			data.force_length(data.length() + nb_to_copy);
+
       // tempo buffer for storage
       RawData_t bufNx;
       if (data_to_be_stored)
@@ -329,15 +333,25 @@ void BufferedCounterDt::startCnt()
     // check if infinite mode
     if (this->m_cfg.acq.samplesNumber == 0)
     {
-      // set data length to buffer depth
+      // 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);
     }
     else
     {
-      // set data length to samples nber
-	    this->m_data.capacity(this->m_cfg.acq.samplesNumber);
-	    this->m_data.force_length(this->m_cfg.acq.samplesNumber);
+      // check if continuous mode
+      if (this->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);
+      }
+      else
+      {
+        // set data capacity & length to 0
+	      this->m_data.capacity(0);
+	      this->m_data.force_length(0);
+      }
     }
 	  this->m_data.fill(yat::IEEE_NAN);
 
diff --git a/src/BufferedCounterEvt.cpp b/src/BufferedCounterEvt.cpp
index 0ab68ba..f62e115 100644
--- a/src/BufferedCounterEvt.cpp
+++ b/src/BufferedCounterEvt.cpp
@@ -264,6 +264,10 @@ void BufferedCounterEvt::handle_raw_buffer(ni660Xsl::InRawBuffer* buffer, long&
 			}
 			DEBUG_STREAM << "NB to copy : " << nb_to_copy << endl;
 
+      // add number to copy to current data
+	  data.capacity(data.length() + nb_to_copy, true);
+	  data.force_length(data.length() + nb_to_copy);
+
       // tempo buffer for storage
       RawData_t bufNx;
       if (data_to_be_stored)
@@ -362,15 +366,25 @@ void BufferedCounterEvt::startCnt()
     // check if infinite mode
     if (this->m_cfg.acq.samplesNumber == 0)
     {
-      // set data length to buffer depth
-	    this->m_data.capacity(this->m_cfg.acq.bufferDepth);
+      // 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);
     }
     else
     {
-      // set data length to samples nber
-	    this->m_data.capacity(this->m_cfg.acq.samplesNumber);
-	    this->m_data.force_length(this->m_cfg.acq.samplesNumber);
+      // check if continuous mode
+      if (this->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);
+      }
+      else
+      {
+        // set data capacity & length to 0
+	      this->m_data.capacity(0);
+	      this->m_data.force_length(0);
+      }
     }
     this->m_data.fill(yat::IEEE_NAN);
 
diff --git a/src/BufferedCounterPeriod.cpp b/src/BufferedCounterPeriod.cpp
index 1cb9777..0ade753 100644
--- a/src/BufferedCounterPeriod.cpp
+++ b/src/BufferedCounterPeriod.cpp
@@ -249,6 +249,10 @@ void BufferedCounterPeriod::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffe
 			}
 			DEBUG_STREAM << "NB to copy : " << nb_to_copy << endl;
 
+			// add number to copy to current data
+			data.capacity(data.length() + nb_to_copy, true);
+			data.force_length(data.length() + nb_to_copy);
+			
       // tempo buffer for storage
       RawData_t bufNx;
       if (data_to_be_stored)
@@ -330,15 +334,25 @@ void BufferedCounterPeriod::startCnt()
     // check if infinite mode
     if (this->m_cfg.acq.samplesNumber == 0)
     {
-      // set data length to buffer depth
+      // 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);
     }
     else
     {
-      // set data length to samples nber
-	    this->m_data.capacity(this->m_cfg.acq.samplesNumber);
-	    this->m_data.force_length(this->m_cfg.acq.samplesNumber);
+      // check if continuous mode
+      if (this->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);
+      }
+      else
+      {
+        // set data capacity & length to 0
+	      this->m_data.capacity(0);
+	      this->m_data.force_length(0);
+      }
     }
 	  this->m_data.fill(yat::IEEE_NAN);
 
diff --git a/src/BufferedCounterPos.cpp b/src/BufferedCounterPos.cpp
index ff55b66..7762b12 100644
--- a/src/BufferedCounterPos.cpp
+++ b/src/BufferedCounterPos.cpp
@@ -296,6 +296,10 @@ void BufferedCounterPos::handle_scaled_buffer(ni660Xsl::InScaledBuffer* buffer,
 			}
 			DEBUG_STREAM << "NB to copy : " << nb_to_copy << endl;
 
+			// add number to copy to current data
+			pos.capacity(pos.length() + nb_to_copy, true);
+			pos.force_length(pos.length() + nb_to_copy);
+			
       // tempo buffer for storage
       RawData_t bufNx;
       if (data_to_be_stored)
@@ -397,15 +401,25 @@ void BufferedCounterPos::startCnt()
     // check if infinite mode
     if (this->m_cfg.acq.samplesNumber == 0)
     {
-      // set data length to buffer depth
+      // 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);
     }
     else
     {
-      // set data length to samples nber
-	    this->m_data.capacity(this->m_cfg.acq.samplesNumber);
-	    this->m_data.force_length(this->m_cfg.acq.samplesNumber);
+      // check if continuous mode
+      if (this->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);
+      }
+      else
+      {
+        // set data capacity & length to 0
+	      this->m_data.capacity(0);
+	      this->m_data.force_length(0);
+      }
     }
 		this->m_data.fill(yat::IEEE_NAN);
 
-- 
GitLab