From 603b2ad0c009aa138275955bad61b9159d2cf187 Mon Sep 17 00:00:00 2001
From: Xavier Elattaoui <xavier.elattaoui@synchrotron-soleil.fr>
Date: Thu, 7 Oct 2004 09:21:19 +0000
Subject: [PATCH] xavier : no cout now.

---
 src/AcquireWaveformLecroy.cpp      | 51 ++++++------------------------
 src/AcquireWaveformLecroy.h        |  8 +++--
 src/AcquireWaveformLecroyClass.cpp |  7 ++--
 src/AcquireWaveformLecroyClass.h   |  5 ++-
 src/ClassFactory.cpp               |  9 ++++--
 src/Makefile                       |  5 ++-
 src/SocketLecroy.cpp               |  7 ++--
 src/Waveform.cpp                   |  8 ++++-
 src/main.cpp                       |  7 ++--
 9 files changed, 49 insertions(+), 58 deletions(-)

diff --git a/src/AcquireWaveformLecroy.cpp b/src/AcquireWaveformLecroy.cpp
index 787c528..a2b3b71 100644
--- a/src/AcquireWaveformLecroy.cpp
+++ b/src/AcquireWaveformLecroy.cpp
@@ -1,4 +1,4 @@
-static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/AcquireWaveformLecroy.cpp,v 1.3 2004-10-05 13:11:11 xavela Exp $";
+static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/AcquireWaveformLecroy.cpp,v 1.4 2004-10-07 09:21:18 xavela Exp $";
 //+=============================================================================
 //
 // file :	  AcquireWaveformLecroy.cpp
@@ -13,9 +13,12 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
 //
 // $Author: xavela $
 //
-// $Revision: 1.3 $
+// $Revision: 1.4 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.3  2004/10/05 13:11:11  xavela
+// Xavier : previous commit failed.
+//
 // Revision 1.2  2004/10/05 13:09:10  xavela
 // Xavier : memory allocation in read_attr_hardware() method.
 // calculation of offset of the begining of the struct, which contains the context of the waveform acquisition, in the received block data.
@@ -192,6 +195,7 @@ void AcquireWaveformLecroy::init_device()
 	//- Initialise variables to default values
 	//--------------------------------------------
 	data_value=0;
+	data_length = 0;
 	ptr_com = 0;
 
 	get_device_property();
@@ -335,8 +339,6 @@ void AcquireWaveformLecroy::read_attr_hardware(vector<long> &attr_list)
 	DEBUG_STREAM << "In read_attr_hardware for " << attr_list.size();
 	DEBUG_STREAM << " attribute(s)" << endl;
 	
-	long data_length = 0;
-
 	//- delete previous allocation
 	if(attr_rawWaveformData_read)
 	{
@@ -465,25 +467,8 @@ void AcquireWaveformLecroy::read_attr(Tango::Attribute &attr)
 	//---------------------------------
 	if (attr_name == "rawWaveformData")
 	{
-		try
-		{
-			//-	Add your own code here
-			long data_length = waveform_ptr->get_wavedesc_descriptor()->wave_array_count;
-			attr.set_value(attr_rawWaveformData_read, data_length);
-		}
-		catch(const lecroy::WaveformException &we)
-		{
-				set_state(Tango::ALARM);
-				set_status("Cannot acquire the descriptor on the WAVEDESC_BLOC structure.");
-				Tango::DevFailed df = lecroy_to_tango_exception(we);
-				
-				Tango::Except::re_throw_exception(df,
-					(const char*) "GET_FAILED",
-					(const char*) "Failed to get the raw data.",
-					(const char*) "AcquireWaveformLecroy::read_attr_hardware()",
-					Tango::ERR
-					);
-		}	
+		//-	Add your own code here
+		attr.set_value(attr_rawWaveformData_read, data_length);
 	}
 	else
 	if (attr_name == "waveArray1")
@@ -537,25 +522,7 @@ void AcquireWaveformLecroy::read_attr(Tango::Attribute &attr)
 	if (attr_name == "verticalScaledData")
 	{
 		//	Add your own code here
-		try
-		{
-			//-	Add your own code here
-			long data_length = waveform_ptr->get_wavedesc_descriptor()->wave_array_count;
-			attr.set_value(attr_verticalScaledData_read, data_length);
-		}
-		catch(const lecroy::WaveformException &we)
-		{
-				set_state(Tango::ALARM);
-				set_status("Cannot acquire the descriptor on the WAVEDESC_BLOC structure.");
-				Tango::DevFailed df = lecroy_to_tango_exception(we);
-				
-				Tango::Except::re_throw_exception(df,
-					(const char*) "GET_FAILED",
-					(const char*) "Failed to get the scaled data.",
-					(const char*) "AcquireWaveformLecroy::read_attr_hardware()",
-					Tango::ERR
-					);
-		}	
+		attr.set_value(attr_verticalScaledData_read, data_length);
 	}
 
 }
diff --git a/src/AcquireWaveformLecroy.h b/src/AcquireWaveformLecroy.h
index 7c5dbd3..7dac097 100644
--- a/src/AcquireWaveformLecroy.h
+++ b/src/AcquireWaveformLecroy.h
@@ -8,9 +8,12 @@
 //
 // $Author: xavela $
 //
-// $Revision: 1.3 $
+// $Revision: 1.4 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.3  2004/10/05 13:11:11  xavela
+// Xavier : previous commit failed.
+//
 // Revision 1.2  2004/10/05 13:09:10  xavela
 // Xavier : memory allocation in read_attr_hardware() method.
 // calculation of offset of the begining of the struct, which contains the context of the waveform acquisition, in the received block data.
@@ -43,7 +46,7 @@
 
 /**
  * @author	$Author: xavela $
- * @version	$Revision: 1.3 $ $
+ * @version	$Revision: 1.4 $ $
  */
 
  //	Add your own constants definitions here.
@@ -214,6 +217,7 @@ protected :
 	WaveForm_data	*waveform_ptr;
 	short*	data_value;
 	double* data_scaled_value;
+	long data_length;
 
 	//- Method to convert all lecroy exceptions (type Waveform or Socket exceptions) on Tango exception
 	Tango::DevFailed lecroy_to_tango_exception(const lecroy::LecroyException& de);
diff --git a/src/AcquireWaveformLecroyClass.cpp b/src/AcquireWaveformLecroyClass.cpp
index e45bdee..a770dce 100644
--- a/src/AcquireWaveformLecroyClass.cpp
+++ b/src/AcquireWaveformLecroyClass.cpp
@@ -1,4 +1,4 @@
-static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/AcquireWaveformLecroyClass.cpp,v 1.3 2004-10-05 13:11:11 xavela Exp $";
+static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/AcquireWaveformLecroyClass.cpp,v 1.4 2004-10-07 09:21:18 xavela Exp $";
 
 static const char *TagName = "$Name: not supported by cvs2svn $";
 
@@ -20,9 +20,12 @@ static const char *RCSfile = "$RCSfile: AcquireWaveformLecroyClass.cpp,v $";
 //
 // $Author: xavela $
 //
-// $Revision: 1.3 $
+// $Revision: 1.4 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.3  2004/10/05 13:11:11  xavela
+// Xavier : previous commit failed.
+//
 // Revision 1.2  2004/10/05 13:09:10  xavela
 // Xavier : memory allocation in read_attr_hardware() method.
 // calculation of offset of the begining of the struct, which contains the context of the waveform acquisition, in the received block data.
diff --git a/src/AcquireWaveformLecroyClass.h b/src/AcquireWaveformLecroyClass.h
index ccdd411..a174c87 100644
--- a/src/AcquireWaveformLecroyClass.h
+++ b/src/AcquireWaveformLecroyClass.h
@@ -12,9 +12,12 @@
 //
 // $Author: xavela $
 //
-// $Revision: 1.3 $
+// $Revision: 1.4 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.3  2004/10/05 13:11:11  xavela
+// Xavier : previous commit failed.
+//
 // Revision 1.2  2004/10/05 13:09:10  xavela
 // Xavier : memory allocation in read_attr_hardware() method.
 // calculation of offset of the begining of the struct, which contains the context of the waveform acquisition, in the received block data.
diff --git a/src/ClassFactory.cpp b/src/ClassFactory.cpp
index eedd686..1dbdcb7 100644
--- a/src/ClassFactory.cpp
+++ b/src/ClassFactory.cpp
@@ -1,4 +1,4 @@
-static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/ClassFactory.cpp,v 1.2 2004-10-05 13:11:11 xavela Exp $";
+static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/ClassFactory.cpp,v 1.3 2004-10-07 09:21:18 xavela Exp $";
 //+=============================================================================
 //
 // file :        ClassFactory.cpp
@@ -12,9 +12,12 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
 //
 // $Author: xavela $
 //
-// $Revision: 1.2 $
+// $Revision: 1.3 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.2  2004/10/05 13:11:11  xavela
+// Xavier : previous commit failed.
+//
 // Revision 1.1.1.1  2004/09/29 15:42:14  syldup
 // Initial import.
 //
@@ -39,7 +42,7 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
  *	Create AcquireWaveformLecroyClass singleton and store it in DServer object.
  *
  * @author	$Author: xavela $
- * @version	$Revision: 1.2 $ $
+ * @version	$Revision: 1.3 $ $
  */
 
 void Tango::DServer::class_factory()
diff --git a/src/Makefile b/src/Makefile
index c5229ed..65ed919 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -18,11 +18,14 @@
 
 #
 
-# $Revision: 1.2 $
+# $Revision: 1.3 $
 
 #
 
 # $Log: not supported by cvs2svn $
+# Revision 1.2  2004/10/05 13:11:11  xavela
+# Xavier : previous commit failed.
+#
 # Revision 1.1.1.1  2004/09/29 15:42:14  syldup
 # Initial import.
 #
diff --git a/src/SocketLecroy.cpp b/src/SocketLecroy.cpp
index da6c700..66747d5 100644
--- a/src/SocketLecroy.cpp
+++ b/src/SocketLecroy.cpp
@@ -62,7 +62,7 @@ const int resp = 1;
 fd_set wr_set = {1, {0}};
 TIMEVAL tval;
 unsigned long argp;
-char* tmpStr = 0;
+char tmpStr[256];
 	
 	
 	//- connection test
@@ -131,9 +131,8 @@ void SocketLecroy::TCP_Disconnect(void)
 	
 	if (sConnectedFlag == TRUE)
 	{
-   
-    closesocket(hSocket);
-	sConnectedFlag = FALSE;
+		closesocket(hSocket);
+		sConnectedFlag = FALSE;
 	}
 
 }
diff --git a/src/Waveform.cpp b/src/Waveform.cpp
index d49d3d8..0e72c23 100644
--- a/src/Waveform.cpp
+++ b/src/Waveform.cpp
@@ -106,6 +106,13 @@ short	OFFSET_STRUCT = 0;
 
 	//- send the request
 	SocketLecroy::get_instance( )->TCP_WriteDevice(cmdStr,length,true);
+
+	//- delete cmd allocation
+	if(cmdStr)
+	{
+		delete [] cmdStr;
+		cmdStr = 0;
+	}
 	
 	//- first desallocate previous data 
 	if (ptrRawData)
@@ -179,7 +186,6 @@ short	OFFSET_STRUCT = 0;
 		{
 			//- the offset of the structure which contains the context of the waveform acquisition
 			OFFSET_STRUCT = i;
-			cout << "****** OFFSET STRUCTURE = " << i << "\n" << endl;
 		}
 	}
 
diff --git a/src/main.cpp b/src/main.cpp
index d3de32a..931317b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,4 +1,4 @@
-static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/main.cpp,v 1.2 2004-10-05 13:11:11 xavela Exp $";
+static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/main.cpp,v 1.3 2004-10-07 09:21:19 xavela Exp $";
 //+=============================================================================
 //
 // file :        main.cpp
@@ -12,9 +12,12 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
 //
 // $Author: xavela $
 //
-// $Revision: 1.2 $ $
+// $Revision: 1.3 $ $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.2  2004/10/05 13:11:11  xavela
+// Xavier : previous commit failed.
+//
 // Revision 1.1.1.1  2004/09/29 15:42:14  syldup
 // Initial import.
 //
-- 
GitLab