diff --git a/include/LecroyException.h b/include/LecroyException.h
index 4a4c1ee2268572e21a485a6f0f6ee7e9c5e6551b..0d82a90ad892b405cdc5292c43454eb2f4645a99 100644
--- a/include/LecroyException.h
+++ b/include/LecroyException.h
@@ -90,7 +90,6 @@ public:
 // ============================================================================
 typedef std::vector<Error> ErrorList;
 
-
 // ============================================================================
 //! The lecroy exception abstraction base class.  
 // ============================================================================
@@ -169,11 +168,8 @@ public:
    * The errors list
    */
    ErrorList errors;
-  
 
 };
 
 } // end namspace lecroy
 #endif //__LECROYEXCEPTION
-
-
diff --git a/include/SocketException.h b/include/SocketException.h
index 7f06595033a70a6b57f7509e3a844982b10b84e7..a5f79b25052c453cee2f71134137d0a191142626 100644
--- a/include/SocketException.h
+++ b/include/SocketException.h
@@ -20,8 +20,8 @@
 // ============================================================================
 #include "LecroyException.h"
 
-namespace lecroy {
-
+namespace lecroy 
+{
 // ============================================================================
 //! Socket exception class.  
 // ============================================================================
@@ -42,17 +42,17 @@ public:
    * TODO: remove this constructor
    */
   SocketException (const char *reason,
-					      const char *desc,
-					      const char *origin,
-                int severity = lecroy::ERR);
+					         const char *desc,
+					         const char *origin,
+                   int severity = lecroy::ERR);
 
   /**
    * Initialization. 
    */
   SocketException (const std::string& reason,
-					      const std::string& desc,
-					      const std::string& origin,
-                int severity = lecroy::ERR);
+					         const std::string& desc,
+					         const std::string& origin,
+                   int severity = lecroy::ERR);
   
   /**
    * Copy constructor 
@@ -73,4 +73,3 @@ public:
 } // end namespace
 
 #endif // _SOCKET_EXCEPTION_H_
-
diff --git a/include/SocketLecroy.h b/include/SocketLecroy.h
index 00f9cd8ccab433fcb27515c6c21c00ed0825947b..2e44a0e9664ba8328550e6508bb54e0183f2cfea 100644
--- a/include/SocketLecroy.h
+++ b/include/SocketLecroy.h
@@ -21,22 +21,12 @@
 #endif
 #include "SocketException.h"
 
-
 ////////////////////////////////////////////////////////////////////
 //
 //		SocketLecroy :: DEFINITION
 //
 ////////////////////////////////////////////////////////////////////
 
-//static int	hSocket;
-//static int	sTimeout = 15;
-//static int	sWinsockInitFlag = FALSE;
-//static char	sCurrentAddress[256];
-//static int 	sConnectedFlag = FALSE;
-
-//const int	CMD_BUF_LEN	= 8192;
-//static char sCommandBuffer[CMD_BUF_LEN];
-
 //- Structure of the command Header
 typedef struct 
 {
@@ -45,9 +35,6 @@ typedef struct
 	int				iLength;
 } TCP_HEADER;
 
-
-
-
  //-	Constants definitions 
  //-----------------------------------------------
 const int SERVER_PORT	= 1861;			//- It's the same port number for all Lecroy scope's.
@@ -55,7 +42,7 @@ const int SERVER_PORT	= 1861;			//- It's the same port number for all Lecroy sco
 const int EOI_FLAG		= 0x01;
 const int SRQ_FLAG		= 0x08;
 const int CLEAR_FLAG	= 0x10;
-const int LOCKOUT_FLAG	= 0x20;
+const int LOCKOUT_FLAG= 0x20;
 const int REMOTE_FLAG	= 0x40;
 const int DATA_FLAG		= 0x80;
 
@@ -71,18 +58,16 @@ private:
 	static SocketLecroy* SL_instance;	//- ptr on the SocketLecroy instance
 
 public:
-
 	
 	static SocketLecroy* get_instance(void);
 	static void delete_instance(SocketLecroy*);
 	
-	void TCP_WriteDevice	(char *buf, int length,bool eoi_flag)	throw (lecroy::SocketException);		//- send a cmd to the device
+	void TCP_WriteDevice	(char *buf, int length,bool eoi_flag)	         throw (lecroy::SocketException);	//- send a cmd to the device
 	void TCP_ReadDevice		(char *buf, int length, int* nb_byte_received) throw (lecroy::SocketException);	//- read the device replie
-	void TCP_Connect		(char *ip_address)						throw (lecroy::SocketException);		//- build TCP/IP connection
+	void TCP_Connect		  (char *ip_address)			throw (lecroy::SocketException);		//- build TCP/IP connection
 	void TCP_Disconnect		(void)									throw (lecroy::SocketException);		//- disconnect the device
 	void TCP_ClearDevice	(void)									throw (lecroy::SocketException);		//- disconnect and reconnect the device
 
 };
 
 #endif // _SocketLecroy_H
-
diff --git a/include/Waveform.h b/include/Waveform.h
index b11057a00765a251b7cb45044c7092b827a43d72..5547b331c6d607bee3f30cffe2292ef2da7ba12a 100644
--- a/include/Waveform.h
+++ b/include/Waveform.h
@@ -9,14 +9,11 @@
 //
 //******************************************************************************************
 
-
-
 #ifndef _WaveForm_data_H
 #define _WaveForm_data_H
 
-#include <cstring>
+#include <string>
 #include "WaveformException.h"
-#include <Xstring.h>
 
 const long MAX_WAVEFORM_DATA_LENGTH = 150000;
 
@@ -38,54 +35,52 @@ const long MAX_WAVEFORM_DATA_LENGTH = 150000;
 //- Structure to store the acquired data
 typedef struct
 {
-	char	descriptor_name [16];		//- descriptor name (always begin with WAVEDESC string)
+	char	descriptor_name [16];   //- descriptor name (always begin with WAVEDESC string)
 	char	template_name	[16];
-	short	comm_type;					//- 0 = BYTE ; 1 = WORD  format
-	short	comm_order;					//- 0 = HIFIRST ; 1 = LOFIRST
+	short	comm_type;              //- 0 = BYTE ; 1 = WORD  format
+	short	comm_order;             //- 0 = HIFIRST ; 1 = LOFIRST
 //- Blocks :
-	long	wave_descriptor;			//- length (in bytes) of block WAVEDESC
-	long	user_text;					//- length (in bytes) of block USERTEXT
+	long	wave_descriptor;        //- length (in bytes) of block WAVEDESC
+	long	user_text;              //- length (in bytes) of block USERTEXT
 	long	reserved_res_desc1;			//- RESERVED
 //- Arrays :
-	long	trigtime_array; 			//- length (in bytes) of TRIGTIME
-	long	ris_time_array; 			//- length (in bytes) of RIS_TIME
-	long	res_array1;					//- RESERVED
-	long	wave_array_1;				//- length (in bytes) of 1st simple data array
-	long	wave_array_2;				//- length (in bytes) of 2nd simple data array
+	long	trigtime_array;         //- length (in bytes) of TRIGTIME
+	long	ris_time_array;         //- length (in bytes) of RIS_TIME
+	long	res_array1;             //- RESERVED
+	long	wave_array_1;           //- length (in bytes) of 1st simple data array
+	long	wave_array_2;           //- length (in bytes) of 2nd simple data array
 //- Instrument identification : NOT USED
-	char	reserved_1[48]; 			//- RESERVED
+	char	reserved_1[48];         //- RESERVED
 //- Waveform description and time at which the waveform was generated
-	long	wave_array_count;			//- nb of data points in the data array
-	long	points_per_screen;			//- nominal number of data points on the screen
-	long	res_first_pnt_val;			//- RESERVED
-	long	res_last_pnt_val;			//- RESERVED
-	long	first_point;				//- indicates the offset relative to the beginning of the trace buffer
-	char	reserved_2[20]; 			//- RESERVED
-	float	vertical_gain;				//- 
-	float	vertical_offset;			//- to get floating value from raw data : V_gain * data - V_offset
-	char	reserved_3[8];				//- RESERVED
-	short	nominal_bits;				//- intrinsic presision
-	char	reserved_4[2];				//- RESERVED
-	float	horizontal_interval;		//- sampling interval for time domain waveforms
-	double	horizontal_offset;			//- trigger offset for the first sweep of the trigger, seconds between 
-											//- the trigger and the first data point
-	double	pixel_offset;				//- needed to know how to display the waveform
-	char	vertical_unit[48];			//- units of the vertical axis
-	char	horizontal_unit[48];		//- units of the horizontal axis
+	long	wave_array_count;       //- nb of data points in the data array
+	long	points_per_screen;      //- nominal number of data points on the screen
+	long	res_first_pnt_val;      //- RESERVED
+	long	res_last_pnt_val;       //- RESERVED
+	long	first_point;            //- indicates the offset relative to the beginning of the trace buffer
+	char	reserved_2[20];         //- RESERVED
+	float	vertical_gain;          //- 
+	float	vertical_offset;        //- to get floating value from raw data : V_gain * data - V_offset
+	char	reserved_3[8];          //- RESERVED
+	short	nominal_bits;           //- intrinsic presision
+	char	reserved_4[2];          //- RESERVED
+	float	horizontal_interval;    //- sampling interval for time domain waveforms
+	double	horizontal_offset;    //- trigger offset for the first sweep of the trigger, seconds between 
+											             //- the trigger and the first data point
+	double	pixel_offset;         //- needed to know how to display the waveform
+	char	vertical_unit[48];      //- units of the vertical axis
+	char	horizontal_unit[48];    //- units of the horizontal axis
 	float	reserved_5;
 //- Trigger infos
-	double	trigger_time_seconds;		//- time (in sec) of the trigger
-	char	trigger_time_minutes;		//- time (in min) of the trigger
-	char	trigger_time_hours;			//- time (in hours) of the trigger
-	char	trigger_time_days;			//- day of the trigger
-	char	trigger_time_months;		//- month of the trigger
-	short	trigger_time_year;			//- year of the trigger
-	short	trigger_time_unused;		//- RESERVED
-	float	acq_duration;				//- duration of the acquisition (in sec) in multi-trigger waveforms
-	char	reserved_6[30]; 			//- RESERVED for the moment
+	double	trigger_time_seconds; //- time (in sec) of the trigger
+	char	trigger_time_minutes;   //- time (in min) of the trigger
+	char	trigger_time_hours;     //- time (in hours) of the trigger
+	char	trigger_time_days;      //- day of the trigger
+	char	trigger_time_months;    //- month of the trigger
+	short	trigger_time_year;      //- year of the trigger
+	short	trigger_time_unused;    //- RESERVED
+	float	acq_duration;           //- duration of the acquisition (in sec) in multi-trigger waveforms
+	char	reserved_6[30];         //- RESERVED for the moment
 	//- TODO :  timebase, ... till wavesource (from the lecroy doc).
-
-
 } WAVEDESC_BLOCK;
 
 //- RESTORE DEFAULT ALIGNEMENT
@@ -95,16 +90,19 @@ class WaveForm_data
 {
 private:
 
-	char		*ptrRawData;				//- ptr on the received waveform data
+	char ptrRawData[MAX_WAVEFORM_DATA_LENGTH];   //- ptr on the received waveform data
+	
 	std::string	channel_name;
 
 	//- Waveform data :
-	short		*sh_raw_waveform_data;
-	double		*vertical_scaled_waveform_data;
-	std::string	trigger_time_value;			//- time of the trigger in format "Date = month, day, year ; Time = hours:minutes:seconds"
+	short*  sh_raw_waveform_data;
+	double* vertical_scaled_waveform_data;
+	
+	//- time of the trigger in format "Date = month, day, year ; Time = hours:minutes:seconds"
+	std::string	trigger_time_value;
 
 	//- Waveform description :
-	WAVEDESC_BLOCK *waveBlockData;			//- ptr on the struct WAVEDESC_BLOCK
+	WAVEDESC_BLOCK *waveBlockData;               //- ptr on the struct WAVEDESC_BLOCK
 
 public:
 
@@ -113,18 +111,25 @@ public:
 	//- DTOR
 	~WaveForm_data();
 
-	std::string	get_channel_name					(void) throw (lecroy::WaveformException);
-	void		set_channel_name					(std::string);
-	WAVEDESC_BLOCK *get_wavedesc_descriptor			(void) throw (lecroy::WaveformException);
-	void		get_waveform_data					(void) throw (lecroy::WaveformException);	//- acquire the waveform data from the scope
-	short*		get_raw_waveform_data				(void) throw (lecroy::WaveformException);	     //- return the ptr on sh_raw_waveform_data
-	double* 	get_vertical_scaled_waveform_data	(void) throw (lecroy::WaveformException);
-	std::string	get_trigger_time_value				(void);
+	//- Getters & Setters
+	std::string	get_channel_name () 
+		throw (lecroy::WaveformException);
 
+	void set_channel_name (std::string);
 	
-
+	WAVEDESC_BLOCK *get_wavedesc_descriptor	() 
+		throw (lecroy::WaveformException);
+	
+	void get_waveform_data () 
+		throw (lecroy::WaveformException);         //- acquire the waveform data from the scope
+	
+	short*	get_raw_waveform_data	() 
+		throw (lecroy::WaveformException);         //- return the ptr on sh_raw_waveform_data
+	
+	double* get_vertical_scaled_waveform_data	() 
+		throw (lecroy::WaveformException);
+	
+	std::string	get_trigger_time_value ();
 };
 
-
-
 #endif //- _WaveForm_data_H
diff --git a/include/WaveformException.h b/include/WaveformException.h
index 556eabdc475c5f130c14c2c602f07826595ecced..2fae4677c9932391de0e5291d065d7c4e51eb28e 100644
--- a/include/WaveformException.h
+++ b/include/WaveformException.h
@@ -20,8 +20,8 @@
 // ============================================================================
 #include "LecroyException.h"
 
-namespace lecroy {
-
+namespace lecroy 
+{
 // ============================================================================
 //! Waveform exception class.  
 // ============================================================================
@@ -42,17 +42,17 @@ public:
    * TODO: remove this constructor
    */
   WaveformException (const char *reason,
-					      const char *desc,
-					      const char *origin,
-                int severity = lecroy::ERR);
+					           const char *desc,
+					           const char *origin,
+                     int severity = lecroy::ERR);
 
   /**
    * Initialization. 
    */
   WaveformException (const std::string& reason,
-					      const std::string& desc,
-					      const std::string& origin,
-                int severity = lecroy::ERR);
+					           const std::string& desc,
+					           const std::string& origin,
+                     int severity = lecroy::ERR);
   
   /**
    * Copy constructor 
@@ -72,4 +72,3 @@ public:
 } // end namespace
 
 #endif // _WAVEFORM_EXCEPTION_H_
-
diff --git a/pom.xml b/pom.xml
index 0e305cda243d5f7c2b3cc11d68ec91b18b60330c..d93cc6b50abe598529880c9d46f1573ed136a13e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
    </parent>
    <groupId>fr.soleil.device</groupId>
    <artifactId>AcquireWaveformLecroy-${aol}-${mode}</artifactId>
-   <version>1.1.11</version>
+   <version>1.1.12</version>
    <packaging>nar</packaging>
    <name>AcquireWaveformLecroy</name>
    <description>AcquireWaveformLecroy device</description>
diff --git a/src/AcquireWaveformLecroy.cpp b/src/AcquireWaveformLecroy.cpp
index ea2c299283c6edcc01336605731c49a4ff32c3f5..a89e8a027af8c62fda35f1be703c120099500030 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.13 2010-03-26 09:11:31 vince_soleil Exp $";
+static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentation/AcquireWaveformLecroy/src/AcquireWaveformLecroy.cpp,v 1.14 2012-02-28 13:28:25 xavela Exp $";
 //+=============================================================================
 //
 // file :         AcquireWaveformLecroy.cpp
@@ -11,11 +11,14 @@ static const char *RcsId = "$Header: /users/chaize/newsvn/cvsroot/Instrumentatio
 //
 // project :      TANGO Device Server
 //
-// $Author: vince_soleil $
+// $Author: xavela $
 //
-// $Revision: 1.13 $
+// $Revision: 1.14 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.13  2010/03/26 09:11:31  vince_soleil
+// "Migration_Tango7_Part2"
+//
 // Revision 1.12  2008/04/24 14:59:23  xavela
 // xavier :
 // - SocketLecroy file splitted for Win32 and Linux like platforms
@@ -132,14 +135,14 @@ AcquireWaveformLecroy::AcquireWaveformLecroy(Tango::DeviceClass *cl,const char *
 void AcquireWaveformLecroy::delete_device()
 {
 	//-	Delete device's allocated object
-	if (attr_rawWaveformData_read) {
-	 delete [] attr_rawWaveformData_read;
-	 attr_rawWaveformData_read = 0;
-	}
-	if (attr_verticalScaledData_read) {
-	 delete [] attr_verticalScaledData_read;
-	 attr_verticalScaledData_read = 0;
-	}
+	//if (attr_rawWaveformData_read) {
+	// delete [] attr_rawWaveformData_read;
+	// attr_rawWaveformData_read = 0;
+	//}
+	//if (attr_verticalScaledData_read) {
+	// delete [] attr_verticalScaledData_read;
+	// attr_verticalScaledData_read = 0;
+	//}
 	if (attr_waveArray1_read) {
 	 delete attr_waveArray1_read;
 	 attr_waveArray1_read = 0;
@@ -252,7 +255,7 @@ void AcquireWaveformLecroy::init_device()
 	//--------------------------------------------
 	data_value	= 0;
 	data_length = 0;
-	ptr_com		= 0;
+	ptr_com     = 0;
 	waveform_ptr= 0;
 
 	get_device_property();
@@ -260,6 +263,12 @@ void AcquireWaveformLecroy::init_device()
 	//- create the com obj
 	ptr_com = SocketLecroy::get_instance();
 
+	if ( !ptr_com )
+	{
+		set_state(Tango::FAULT);
+		set_status("OUT OF MEMORY : communication link cannot be created !");
+	}
+
 	_is_communication_opened = false;
 	
 	//- create the waveform obj
@@ -332,15 +341,15 @@ void AcquireWaveformLecroy::get_device_property()
 	Tango::DbData data_put;
 	if (dev_prop[0].is_empty())
 	{
-		Tango::DbDatum	property("IPaddress");
-		property	<<	iPaddress;
-		data_put.push_back(property);
+		Tango::DbDatum	propert("IPaddress");
+		propert	<<	iPaddress;
+		data_put.push_back(propert);
 	}
 	if (dev_prop[1].is_empty())
 	{
-		Tango::DbDatum	property("ChannelName");
-		property	<<	channelName;
-		data_put.push_back(property);
+		Tango::DbDatum	propert("ChannelName");
+		propert	<<	channelName;
+		data_put.push_back(propert);
 	}
 
 	//	End of Automatic code generation
@@ -358,11 +367,10 @@ void AcquireWaveformLecroy::get_device_property()
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::always_executed_hook()
 {
-
 	//- init communication
 	if ( !_is_communication_opened )
 	{
-		cout<<"always!"<<endl;
+		std::cout << "always!" << std::endl;
 		try
 		{
 			ptr_com->TCP_Connect( (char*)iPaddress.c_str() );
@@ -376,7 +384,7 @@ void AcquireWaveformLecroy::always_executed_hook()
 			set_state(Tango::FAULT);
 			set_status("The communication is not well opened.");
 			Tango::DevFailed df = lecroy_to_tango_exception(se);
-			
+			FATAL_STREAM << df << std::endl;
 			Tango::Except::re_throw_exception(df,
 				(const char*) "TCP_CONNECTION_FAILED",
 				(const char*) "Cannot built a socket connection.",
@@ -385,6 +393,7 @@ void AcquireWaveformLecroy::always_executed_hook()
 				);
 		}
 	}
+	
 	//- Get the waveform data and description( ADC resolution, horizontal and vertical infos, data length ...)
 	try
 	{
@@ -399,7 +408,7 @@ void AcquireWaveformLecroy::always_executed_hook()
 		set_state(Tango::ALARM);
 		set_status("Failed to acquire waveform.");
 		Tango::DevFailed df = lecroy_to_tango_exception(we);
-		
+		FATAL_STREAM << df << std::endl;
 		Tango::Except::re_throw_exception(df,
 			(const char*) "COMMUNICATION_BROKEN",
 			(const char*) "Cannot call get_waveform_data.",
@@ -407,7 +416,7 @@ void AcquireWaveformLecroy::always_executed_hook()
 			Tango::ERR
 			);
 	}
-	cout<<"always end!"<<endl;
+	std::cout << "always end!" << std::endl;
 }
 
 //+----------------------------------------------------------------------------
@@ -419,27 +428,16 @@ void AcquireWaveformLecroy::always_executed_hook()
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_attr_hardware(vector<long> &attr_list)
 {
-	DEBUG_STREAM << "In read_attr_hardware for " << attr_list.size();
-	DEBUG_STREAM << " attribute(s)" << endl;
-	
-	//- delete previous allocation
-	if(attr_rawWaveformData_read)
-	{
-		delete [] attr_rawWaveformData_read;
-		attr_rawWaveformData_read = 0;
-	}
-	if(attr_verticalScaledData_read)
-	{
-		delete [] attr_verticalScaledData_read;
-		attr_verticalScaledData_read = 0;
-	}
+	//- DEBUG_STREAM << "In read_attr_hardware for " << attr_list.size();
+	//- DEBUG_STREAM << " attribute(s)" << endl;
 	
 	//- get the waveform length
 	try
 	{
+		//- TODO : retirer les copies dans les attr !!!!
 		data_length = waveform_ptr->get_wavedesc_descriptor()->wave_array_count;
-		data_value  = waveform_ptr->get_raw_waveform_data();
-		data_scaled_value = waveform_ptr->get_vertical_scaled_waveform_data();
+		attr_rawWaveformData_read    = waveform_ptr->get_raw_waveform_data();
+		attr_verticalScaledData_read = waveform_ptr->get_vertical_scaled_waveform_data();
 	}
 	catch(const lecroy::WaveformException &we)
 	{
@@ -455,84 +453,24 @@ void AcquireWaveformLecroy::read_attr_hardware(vector<long> &attr_list)
 				);
 	}	
 
-	try
-	{
-		//- allocate memory for the two attributes
-		DEBUG_STREAM << "data_length = " << data_length << endl;
-		attr_rawWaveformData_read =		new Tango::DevShort[data_length];
-		attr_verticalScaledData_read =	new Tango::DevDouble[data_length];
-	}
-	catch(std::bad_alloc)
-	{
-		set_state(Tango::ALARM);
-		set_status("Memory not allocated to receive data.");
-		Tango::Except::throw_exception(
-			(const char *) "OUT_OF_MEMORY",
-			(const char *) "Cannot allocate memory to receive the data.",
-			(const char *) "AcquireWaveformLecroy::read_attr_hardware()",
-			Tango::ERR
-			);
-	}
+	*attr_waveArray1_read = waveform_ptr->get_wavedesc_descriptor()->wave_array_1;
+	
+	*attr_waveArray2_read = waveform_ptr->get_wavedesc_descriptor()->wave_array_2;
 
-	//-	Add your own code here
-	//---------------------------------
-//	for (int i=0; i< attr_list.size(); i++)
-//	{
-//		string attr_name = dev_attr->get_attr_by_ind(attr_list[i]).get_name();
+	*attr_waveArrayCount_read = data_length;
 
-//		if (attr_name == "rawWaveformData")
-		{
-			for( long j = 0 ; j < data_length ; j++)
-			{
-				attr_rawWaveformData_read[j] = data_value[j];
-				attr_verticalScaledData_read[j] = data_scaled_value[j];
-			}
-		}
-//		if (attr_name == "verticalScaledData")
-//		{
-//			for( long j = 0 ; j < data_length ; j++)
-//			{
-//			}
-//		}
-//		if (attr_name == "waveArray1")
-		{
-			*attr_waveArray1_read = waveform_ptr->get_wavedesc_descriptor()->wave_array_1;
-		}
-//		if (attr_name == "waveArray2")
-		{
-			*attr_waveArray2_read = waveform_ptr->get_wavedesc_descriptor()->wave_array_2;
-		}
-//		if (attr_name == "waveArrayCount")
-		{
-			*attr_waveArrayCount_read = data_length;
-		}
-//		if (attr_name == "nominalBits")
-		{
-			*attr_nominalBits_read = waveform_ptr->get_wavedesc_descriptor()->nominal_bits;
-		}
-//		if (attr_name == "horizontalInterval")
-		{
-			*attr_horizontalInterval_read = (double) (waveform_ptr->get_wavedesc_descriptor()->horizontal_interval);
-		}
-//		if (attr_name == "horizontalOffset")
-		{
-			*attr_horizontalOffset_read = waveform_ptr->get_wavedesc_descriptor()->horizontal_offset;
-		}
-//		if (attr_name == "verticalGain")
-		{
-			*attr_verticalGain_read = (double) (waveform_ptr->get_wavedesc_descriptor()->vertical_gain);
-		}
-//		if (attr_name == "verticalOffset")
-		{
-			*attr_verticalOffset_read = waveform_ptr->get_wavedesc_descriptor()->vertical_offset;
-		}
-//		if (attr_name == "triggerTime")
-		{
-			std::string response = waveform_ptr->get_trigger_time_value();
-			strcpy(*attr_triggerTime_read, response.c_str());
-		}
+	*attr_nominalBits_read = waveform_ptr->get_wavedesc_descriptor()->nominal_bits;
+
+	*attr_horizontalInterval_read = (double) (waveform_ptr->get_wavedesc_descriptor()->horizontal_interval);
+
+	*attr_horizontalOffset_read = waveform_ptr->get_wavedesc_descriptor()->horizontal_offset;
+
+	*attr_verticalGain_read = (double) (waveform_ptr->get_wavedesc_descriptor()->vertical_gain);
+
+	*attr_verticalOffset_read = waveform_ptr->get_wavedesc_descriptor()->vertical_offset;
 
-//	}
+	std::string response = waveform_ptr->get_trigger_time_value();
+	strcpy(*attr_triggerTime_read, response.c_str());
 }
 //+----------------------------------------------------------------------------
 //
@@ -543,7 +481,7 @@ void AcquireWaveformLecroy::read_attr_hardware(vector<long> &attr_list)
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_verticalScaledData(Tango::Attribute &attr)
 {
-	DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalScaledData(Tango::Attribute &attr) entering... "<< endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalScaledData(Tango::Attribute &attr) entering... "<< endl;
 	//	Add your own code here
 	attr.set_value(attr_verticalScaledData_read, data_length);
 }
@@ -557,7 +495,7 @@ void AcquireWaveformLecroy::read_verticalScaledData(Tango::Attribute &attr)
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_triggerTime(Tango::Attribute &attr)
 {
-	DEBUG_STREAM << "AcquireWaveformLecroy::read_triggerTime(Tango::Attribute &attr) entering... "<< endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::read_triggerTime(Tango::Attribute &attr) entering... "<< endl;
 	//	Add your own code here
 	attr.set_value(attr_triggerTime_read);
 }
@@ -571,7 +509,7 @@ void AcquireWaveformLecroy::read_triggerTime(Tango::Attribute &attr)
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_verticalOffset(Tango::Attribute &attr)
 {
-	DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalOffset(Tango::Attribute &attr) entering... "<< endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalOffset(Tango::Attribute &attr) entering... "<< endl;
 	//-	Add your own code here
 	attr.set_value(attr_verticalOffset_read);
 }
@@ -585,7 +523,7 @@ void AcquireWaveformLecroy::read_verticalOffset(Tango::Attribute &attr)
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_verticalGain(Tango::Attribute &attr)
 {
-	DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalGain(Tango::Attribute &attr) entering... "<< endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::read_verticalGain(Tango::Attribute &attr) entering... "<< endl;
 	//-	Add your own code here
 	attr.set_value(attr_verticalGain_read);
 }
@@ -599,7 +537,7 @@ void AcquireWaveformLecroy::read_verticalGain(Tango::Attribute &attr)
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_horizontalOffset(Tango::Attribute &attr)
 {
-	DEBUG_STREAM << "AcquireWaveformLecroy::read_horizontalOffset(Tango::Attribute &attr) entering... "<< endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::read_horizontalOffset(Tango::Attribute &attr) entering... "<< endl;
 	//-	Add your own code here
 	attr.set_value(attr_horizontalOffset_read);
 }
@@ -613,7 +551,7 @@ void AcquireWaveformLecroy::read_horizontalOffset(Tango::Attribute &attr)
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_horizontalInterval(Tango::Attribute &attr)
 {
-	DEBUG_STREAM << "AcquireWaveformLecroy::read_horizontalInterval(Tango::Attribute &attr) entering... "<< endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::read_horizontalInterval(Tango::Attribute &attr) entering... "<< endl;
 	//-	Add your own code here
 	attr.set_value(attr_horizontalInterval_read);
 }
@@ -627,7 +565,7 @@ void AcquireWaveformLecroy::read_horizontalInterval(Tango::Attribute &attr)
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_nominalBits(Tango::Attribute &attr)
 {
-	DEBUG_STREAM << "AcquireWaveformLecroy::read_nominalBits(Tango::Attribute &attr) entering... "<< endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::read_nominalBits(Tango::Attribute &attr) entering... "<< endl;
 	//-	Add your own code here
 	attr.set_value(attr_nominalBits_read);
 }
@@ -641,7 +579,7 @@ void AcquireWaveformLecroy::read_nominalBits(Tango::Attribute &attr)
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_waveArrayCount(Tango::Attribute &attr)
 {
-	DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArrayCount(Tango::Attribute &attr) entering... "<< endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArrayCount(Tango::Attribute &attr) entering... "<< endl;
 	//-	Add your own code here
 	attr.set_value(attr_waveArrayCount_read);
 }
@@ -655,7 +593,7 @@ void AcquireWaveformLecroy::read_waveArrayCount(Tango::Attribute &attr)
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_waveArray2(Tango::Attribute &attr)
 {
-	DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArray2(Tango::Attribute &attr) entering... "<< endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArray2(Tango::Attribute &attr) entering... "<< endl;
 	//	Add your own code here
 	attr.set_value(attr_waveArray2_read);
 }
@@ -669,7 +607,7 @@ void AcquireWaveformLecroy::read_waveArray2(Tango::Attribute &attr)
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_waveArray1(Tango::Attribute &attr)
 {
-	DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArray1(Tango::Attribute &attr) entering... "<< endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::read_waveArray1(Tango::Attribute &attr) entering... "<< endl;
 	//-	Add your own code here
 	attr.set_value(attr_waveArray1_read);
 }
@@ -683,106 +621,11 @@ void AcquireWaveformLecroy::read_waveArray1(Tango::Attribute &attr)
 //-----------------------------------------------------------------------------
 void AcquireWaveformLecroy::read_rawWaveformData(Tango::Attribute &attr)
 {
-	DEBUG_STREAM << "AcquireWaveformLecroy::read_rawWaveformData(Tango::Attribute &attr) entering... "<< endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::read_rawWaveformData(Tango::Attribute &attr) entering... "<< endl;
 	//-	Add your own code here
 	attr.set_value(attr_rawWaveformData_read, data_length);
 }
 
-
-//+----------------------------------------------------------------------------
-//
-// method :		AcquireWaveformLecroy::read_attr()
-// 
-// description :	Extract real attribute values from
-//					hardware acquisition result.
-//
-//-----------------------------------------------------------------------------
-/*#ifdef DEV_IMPL_2
-#ifdef DEV_IMPL_2
-#ifdef DEV_IMPL_2
-#ifdef DEV_IMPL_2
-#ifdef DEV_IMPL_2
-void AcquireWaveformLecroy::read_attr(Tango::Attribute &attr)
-{
-	string &attr_name = attr.get_name();
-
-	DEBUG_STREAM << "In read_attr for attribute " << attr_name << endl;
-
-	//	Switch on attribute name
-	//---------------------------------
-	if (attr_name == "rawWaveformData")
-	{
-		//-	Add your own code here
-		attr.set_value(attr_rawWaveformData_read, data_length);
-	}
-	else
-	if (attr_name == "waveArray1")
-	{
-		//-	Add your own code here
-		attr.set_value(attr_waveArray1_read);
-	}
-	else
-	if (attr_name == "waveArray2")
-	{
-		//	Add your own code here
-		attr.set_value(attr_waveArray2_read);
-	}
-	else
-	if (attr_name == "waveArrayCount")
-	{
-		//-	Add your own code here
-		attr.set_value(attr_waveArrayCount_read);
-	}
-	else
-	if (attr_name == "nominalBits")
-	{
-		//-	Add your own code here
-		attr.set_value(attr_nominalBits_read);
-	}
-	else
-	if (attr_name == "horizontalInterval")
-	{
-		//-	Add your own code here
-		attr.set_value(attr_horizontalInterval_read);
-	}
-	else
-	if (attr_name == "horizontalOffset")
-	{
-		//-	Add your own code here
-		attr.set_value(attr_horizontalOffset_read);
-	}
-	else
-	if (attr_name == "verticalGain")
-	{
-		//-	Add your own code here
-		attr.set_value(attr_verticalGain_read);
-	}
-	else
-	if (attr_name == "verticalOffset")
-	{
-		//-	Add your own code here
-		attr.set_value(attr_verticalOffset_read);
-	}
-	else
-	if (attr_name == "triggerTime")
-	{
-		//	Add your own code here
-		attr.set_value(attr_triggerTime_read);
-	}
-	else
-	if (attr_name == "verticalScaledData")
-	{
-		//	Add your own code here
-		attr.set_value(attr_verticalScaledData_read, data_length);
-	}
-
-}
-#endif
-#endif
-#endif
-#endif
-#endif
-*/
 //+----------------------------------------------------------------------------
 //
 // method : AcquireWaveformLecroy::lecroy_to_tango_exception()
@@ -797,7 +640,7 @@ Tango::DevFailed AcquireWaveformLecroy::lecroy_to_tango_exception(const lecroy::
 	Tango::DevErrorList error_list(de.errors.size());
 	error_list.length(de.errors.size());
 	
-	for(int i = 0; i < de.errors.size(); i++)
+	for(size_t i = 0; i < de.errors.size(); i++)
 	{
 		error_list[i].reason = CORBA::string_dup(de.errors[i].reason.c_str());
 		error_list[i].desc	 = CORBA::string_dup(de.errors[i].desc.c_str());
@@ -826,38 +669,6 @@ Tango::DevFailed AcquireWaveformLecroy::lecroy_to_tango_exception(const lecroy::
 	
 }
 
-//+------------------------------------------------------------------
-/**
- *	method:	AcquireWaveformLecroy::write_read
- *
- *	description:	method to execute "WriteRead"
- *	Command to send a specific command to the Lecroy device
- *
- * @param	argin	char command, int lentgh, int bytes_written
- * @return	bytes written
- *
- */
-//+------------------------------------------------------------------
-//Tango::DevLong AcquireWaveformLecroy::write_read(const Tango::DevVarLongStringArray *argin)
-//{
-//	DEBUG_STREAM << "AcquireWaveformLecroy::write_read(): entering... !" << endl;
-//
-//	//	Add your own code to control device here
-//	std::string	cmd_to_send(argin->svalue[0]);
-//	int length = (*argin)dvalue[0];
-//	int bytes_written = -1;
-//
-//	ptr_com->TCP_WriteDevice(cmd_to_send.c_str(), cmd_to_send.size(), true);
-//
-//	//- check if a response is expected (must found ? character)
-//	if(cmd_to_send.find('?')
-//	{
-//		ptr_com->TCP_ReadDevice(response, max_length, &bytes_written);
-//	}
-//
-//	return bytes_written;
-//}
-
 //+------------------------------------------------------------------
 /**
  *	method:	AcquireWaveformLecroy::write_read
@@ -877,7 +688,7 @@ Tango::DevString AcquireWaveformLecroy::write_read(Tango::DevString argin)
 	//	See "TANGO Device Server Programmer's Manual"
 	//		(chapter : Writing a TANGO DS / Exchanging data)
 	//------------------------------------------------------------
-	DEBUG_STREAM << "AcquireWaveformLecroy::write_read(): entering... !" << endl;
+	//- DEBUG_STREAM << "AcquireWaveformLecroy::write_read(): entering... !" << endl;
 
 	//	Add your own code to control device here
 	std::string	cmd_to_send(argin);
diff --git a/src/AcquireWaveformLecroy.h b/src/AcquireWaveformLecroy.h
index 2eb8336e658e699fc1f9e95e458b7deae8d7c036..ef1a359fde680406fa54e545d5c164c58ff52838 100644
--- a/src/AcquireWaveformLecroy.h
+++ b/src/AcquireWaveformLecroy.h
@@ -6,11 +6,14 @@
 //
 // project :	Acquire_Waveform_Lecroy_Prj
 //
-// $Author: vince_soleil $
+// $Author: xavela $
 //
-// $Revision: 1.9 $
+// $Revision: 1.10 $
 //
 // $Log: not supported by cvs2svn $
+// Revision 1.9  2010/03/25 17:02:18  vince_soleil
+// "Migration_Tango7"
+//
 // Revision 1.8  2008/04/24 13:08:44  syldup
 // no message
 //
@@ -60,8 +63,8 @@
 #include "WaveformException.h"
 
 /**
- * @author	$Author: vince_soleil $
- * @version	$Revision: 1.9 $ $
+ * @author	$Author: xavela $
+ * @version	$Revision: 1.10 $ $
  */
 
  //	Add your own constants definitions here.
@@ -324,13 +327,13 @@ public :
 protected :	
 	//	Add your own data members here
 	//-----------------------------------------
-	SocketLecroy*	ptr_com;
+	SocketLecroy*	  ptr_com;
 	WaveForm_data*	waveform_ptr;
-	char*			_deviceResponse;
-	short*			data_value;
-	double*			data_scaled_value;
-	long			data_length;
-	bool			_is_communication_opened;
+	char*			      _deviceResponse;
+	short*			    data_value;
+	double*			    data_scaled_value;
+	long			      data_length;
+	bool			      _is_communication_opened;
 
 	//- 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/LecroyException.cpp b/src/LecroyException.cpp
index bda46fd67e910fe347dbefa191a2cf0a0422a3ff..204cf3b3e509e2fb4ee9495e128e81a15b3f102d 100644
--- a/src/LecroyException.cpp
+++ b/src/LecroyException.cpp
@@ -16,14 +16,14 @@
 // DEPENDENCIES
 #include "LecroyException.h"
 
-namespace lecroy {
-
+namespace lecroy 
+{
 // ============================================================================
 // Error::Error
 // ============================================================================
 Error::Error (void)
   :  reason ("unknown"),
-     desc ("unknown error"),
+     desc   ("unknown error"),
      origin ("unknown"),
      severity (lecroy::ERR)
 {
@@ -38,7 +38,7 @@ Error::Error (const char *_reason,
               const char *_origin,
               int _severity)
   :  reason (_reason),
-     desc (_desc),
+     desc   (_desc),
      origin (_origin),
      severity (_severity)
 {
@@ -49,8 +49,8 @@ Error::Error (const char *_reason,
 // Error::Error
 // ============================================================================
 Error::Error (const std::string& _reason,
-	      const std::string& _desc,
-	      const std::string& _origin,
+	            const std::string& _desc,
+	            const std::string& _origin,
               int _severity)
   :  reason (_reason),
      desc (_desc),
@@ -65,7 +65,7 @@ Error::Error (const std::string& _reason,
 // ============================================================================
 Error::Error (const Error& _src)
   :  reason (_src.reason),
-     desc (_src.desc),
+     desc   (_src.desc),
      origin (_src.origin),
      severity (_src.severity)
 {
@@ -111,12 +111,11 @@ LecroyException::LecroyException (void)
 // LecroyException::LecroyException
 // ============================================================================
 LecroyException::LecroyException (const char *_reason,
-                      const char *_desc,
-                      const char *_origin,
-                      int _severity) 
+                                  const char *_desc,
+                                  const char *_origin,
+                                  int _severity) 
   : errors(0)
 {
-
   this->push_error(Error(_reason, _desc, _origin, _severity));
 }
 
@@ -124,9 +123,9 @@ LecroyException::LecroyException (const char *_reason,
 // LecroyException::LecroyException
 // ============================================================================
 LecroyException::LecroyException (const std::string& _reason,
-                      const std::string& _desc,
-                      const std::string& _origin,
-                      int _severity) 
+                                  const std::string& _desc,
+                                  const std::string& _origin,
+                                  int _severity) 
   : errors(0)
 {
   this->push_error(_reason, _desc, _origin,_severity);
@@ -170,14 +169,13 @@ LecroyException::~LecroyException (void)
   this->errors.clear();
 }
 
-
 // ============================================================================
 // LecroyException::push_error
 // ============================================================================
 void LecroyException::push_error (const char *_reason,
-    					              const char *_desc,
-					                  const char *_origin, 
-                            int _severity)
+    					                    const char *_desc,
+					                        const char *_origin, 
+                                  int _severity)
 {
   this->errors.push_back(Error(_reason, _desc, _origin, _severity));
 }
@@ -201,7 +199,4 @@ void LecroyException::push_error (const Error& _error)
   this->errors.push_back(_error);
 }
 
-
 } // namespace lecroy
-
-
diff --git a/src/SocketException.cpp b/src/SocketException.cpp
index a22291bd424419cc81839182f1e50baeb392f174..3eb1e4347c85d5b528d90ff9c4f7f739a1cbb729 100644
--- a/src/SocketException.cpp
+++ b/src/SocketException.cpp
@@ -17,9 +17,8 @@
 // ============================================================================
 #include "SocketException.h"
 
-
-namespace lecroy {
-
+namespace lecroy 
+{
 // ============================================================================
 // SocketException::SocketException
 // ============================================================================
@@ -33,9 +32,9 @@ SocketException::SocketException (void)
 // SocketException::SocketException
 // ============================================================================
 SocketException::SocketException (const char *_reason,
-					                  const char *_desc,
-					                  const char *_origin,
-									  int _severity)
+					                        const char *_desc,
+					                        const char *_origin,
+									                int _severity)
  : LecroyException(_reason, _desc, _origin, _severity)
 {
 
@@ -45,9 +44,9 @@ SocketException::SocketException (const char *_reason,
 // SocketException::SocketException
 // ============================================================================
 SocketException::SocketException (const std::string& _reason,
-					                  const std::string& _desc,
-					                  const std::string& _origin,
-                            int _severity)
+					                        const std::string& _desc,
+					                        const std::string& _origin,
+                                  int _severity)
  : LecroyException(_reason, _desc, _origin, _severity)
 {
 
@@ -79,7 +78,4 @@ SocketException& SocketException::operator= (const SocketException& _src)
   return *this;
 }
 
-
 } // namespace lecroy
-
-
diff --git a/src/Waveform.cpp b/src/Waveform.cpp
index 3b703eca325a858e7a8cffd5e2533baed8fdf817..800a0b055188b98757698e66c384279af8d6abc1 100644
--- a/src/Waveform.cpp
+++ b/src/Waveform.cpp
@@ -9,35 +9,26 @@
 //
 //******************************************************************************************
 
-
-
-//- INCLUDE
+//- INCLUDES
+#include <iostream>
+#include <Xstring.h>
 #include "Waveform.h"
 #include "SocketLecroy.h"
-#include <iostream>
-#include <string.h>
-
-//using namespace std;
 
 //- CTOR
 WaveForm_data::WaveForm_data(std::string ch_name)
 {
 	//- initialisation of all Waveform attributes
+	::memset (ptrRawData, 0, MAX_WAVEFORM_DATA_LENGTH);
 	channel_name = ch_name;
 	sh_raw_waveform_data = 0;
 	vertical_scaled_waveform_data = 0;
 	trigger_time_value = "Not available";
-	//- the memory allocation is done in the get_waveform_data( ) method
-	ptrRawData = 0;
+	waveBlockData = 0;
 }
 //- DTOR
 WaveForm_data::~WaveForm_data()
 {
-	if(ptrRawData)
-	{
-		delete [] ptrRawData;
-		ptrRawData = 0;
-	}
 	if(sh_raw_waveform_data)
 	{
 		delete [] sh_raw_waveform_data;
@@ -54,13 +45,14 @@ WaveForm_data::~WaveForm_data()
 //- Method to return the channel name
 std::string  WaveForm_data::get_channel_name( ) throw (lecroy::WaveformException)
 {
-	if( !channel_name.empty() )
-		return channel_name;
-	else
+	if( channel_name.empty() )
 		throw lecroy::WaveformException("DATA_OUT_OF_RANGE ", 
 										"get_channel_name( ) failed : channel_name is not initialized.",
 										"WaveForm_data::get_channel_name( ).");
+
+	return channel_name;
 }
+
 //- Method to set the channel name
 void WaveForm_data::set_channel_name (std::string name)
 {
@@ -72,12 +64,11 @@ void WaveForm_data::set_channel_name (std::string name)
 WAVEDESC_BLOCK* WaveForm_data::get_wavedesc_descriptor( ) throw (lecroy::WaveformException)
 {
 	if(waveBlockData)
-		return waveBlockData;
-	else
 		throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", 
 										"get_waveform_data( ) method must be called before.",
 										"WaveForm_data::get_wavedesc_descriptor( ).");
 
+	return waveBlockData;
 }
 
 //- Method to return the raw data of the acquired waveform
@@ -87,7 +78,7 @@ std::string	cmd("");
 char*	cmdStr = 0;
 //int	ulTrace_Size = 0;
 int		response_length=0;
-short	OFFSET_STRUCT = 0;
+unsigned short	OFFSET_STRUCT = 0;
 
 	//- init ptr WaveBlocData which point on WAVEDESC_BLOCS structure
 	waveBlockData = 0;
@@ -98,9 +89,9 @@ short	OFFSET_STRUCT = 0;
 	ch_name = get_channel_name();
 	//- prepare the cmd to get the waveform data
 	cmd = ch_name + ":WF? ALL";
-	cmdStr = new char[cmd.size()+1];
-	std:strcpy(cmdStr, cmd.c_str());
-	int length = strlen(cmdStr);
+	int length = cmd.size()+1;
+	cmdStr = new(std::nothrow) char[length];
+	::strcpy(cmdStr, cmd.c_str());
 
 	//- send the request
 	SocketLecroy::get_instance( )->TCP_WriteDevice(cmdStr,length,true);
@@ -112,13 +103,9 @@ short	OFFSET_STRUCT = 0;
 		cmdStr = 0;
 	}
 	
-	//- first desallocate previous data 
-	if (ptrRawData)
-	{
-		delete [] ptrRawData;
-		ptrRawData = 0;
-	}
-
+	//- erase previsous data
+	::memset (ptrRawData, 0, MAX_WAVEFORM_DATA_LENGTH);
+	
 	//- delete previous raw data
 	if(sh_raw_waveform_data)
 	{
@@ -133,13 +120,13 @@ short	OFFSET_STRUCT = 0;
 			vertical_scaled_waveform_data = 0;
 	}
 
-	//- allocate memory for the receive data (WaveDesc + data)
-	ptrRawData = new char[MAX_WAVEFORM_DATA_LENGTH];
-	length = MAX_WAVEFORM_DATA_LENGTH;
 	if(!ptrRawData)
 		throw lecroy::WaveformException("OUT_OF_MEMORY", 
 										"The pointer (ptrRawData) for the receive data can't be allocated before the read operation.",
 										"WaveForm_data::get_waveform_data( ).");
+	
+	length = MAX_WAVEFORM_DATA_LENGTH;
+	
 	//- read the response
 	try
 	{
@@ -154,7 +141,7 @@ short	OFFSET_STRUCT = 0;
 	}
 
 	//- calculation of the offset of the structure (it can be 15 or 21)
-	long i = 0;
+	unsigned short i = 0;
 	for(i=0; i < 22 ; i++)
 	{
 		if(ptrRawData[i] == 'W' && ptrRawData[i+1] == 'A')
@@ -179,14 +166,14 @@ short	OFFSET_STRUCT = 0;
 										"WaveForm_data::get_waveform_data( ).");
 
 	//- allocate memory for the raw data
-	sh_raw_waveform_data = new short[waveBlockData->wave_array_count];
+	sh_raw_waveform_data = new(std::nothrow) short[waveBlockData->wave_array_count];
 	if(!sh_raw_waveform_data)
 		throw lecroy::WaveformException("OUT_OF_MEMORY", 
 										"The pointer for the receive data can't be allocated before the read operation.",
 										"WaveForm_data::get_waveform_data( ).");
 
 	//- allocate memory for the vertical scaled data
-	vertical_scaled_waveform_data = new double[waveBlockData->wave_array_count];
+	vertical_scaled_waveform_data = new(std::nothrow) double[waveBlockData->wave_array_count];
 	if(!vertical_scaled_waveform_data)
 		throw lecroy::WaveformException("OUT_OF_MEMORY", 
 										"The pointer for the scaled data can't be allocated before the read operation.",
@@ -205,33 +192,30 @@ short	OFFSET_STRUCT = 0;
 //- return the ptr on sh_raw_waveform_data ( = the waveform data acquired)
 short* WaveForm_data::get_raw_waveform_data () throw (lecroy::WaveformException)
 {
-	if(sh_raw_waveform_data)
-		return sh_raw_waveform_data;
-	else
+	if ( !sh_raw_waveform_data )
 		throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", 
 										"get_waveform_data( ) method must be called before.",
 										"WaveForm_data::get_raw_waveform_data( ).");
 
+	return sh_raw_waveform_data;
 }
 
 
 //- Method to return the scaled data of the acquired waveform
 double* WaveForm_data::get_vertical_scaled_waveform_data( ) throw (lecroy::WaveformException)
 {
-	
-	if(vertical_scaled_waveform_data)
-		return vertical_scaled_waveform_data;
-	else
+	if ( !vertical_scaled_waveform_data )
 		throw lecroy::WaveformException("DESCRIPTOR_MEMORY_ ", 
 										"get_waveform_data( ) method must be called before.",
 										"WaveForm_data::get_vertical_scaled_waveform_data( ).");
+
+	return vertical_scaled_waveform_data;
 }
 
 //- Method to return the trigger time of the acquired waveform
 
 std::string	WaveForm_data::get_trigger_time_value ( )
 {
-	
 	//- The format is : "Date = month, day, year ; Time = hours:minutes:seconds"
 	std::string str_seconds("");
 	std::string str_minutes("");
@@ -262,4 +246,3 @@ std::string	WaveForm_data::get_trigger_time_value ( )
 	
 	return trigger_time_value;
 }
-
diff --git a/src/WaveformException.cpp b/src/WaveformException.cpp
index f9946fb6e0d636d38737a3b6f29c0df9bed47440..17e6124020d096788cc00309df365d15f933e776 100644
--- a/src/WaveformException.cpp
+++ b/src/WaveformException.cpp
@@ -17,9 +17,8 @@
 // ============================================================================
 #include "WaveformException.h"
 
-
-namespace lecroy {
-
+namespace lecroy 
+{
 // ============================================================================
 // WaveformException::WaveformException
 // ============================================================================
@@ -79,7 +78,4 @@ WaveformException& WaveformException::operator= (const WaveformException& _src)
   return *this;
 }
 
-
 } // namespace lecroy
-
-
diff --git a/src/Win32SocketLecroy.cpp b/src/Win32SocketLecroy.cpp
index cae38c0fb00da51f3ca094082d4b3da1e5bf934b..f0296f73c984f8e830385733854f90a79bf6623a 100644
--- a/src/Win32SocketLecroy.cpp
+++ b/src/Win32SocketLecroy.cpp
@@ -31,7 +31,6 @@ SocketLecroy* SocketLecroy::get_instance()
 		SL_instance = new SocketLecroy();
 
 	return SL_instance;
-	
 }
 
 void SocketLecroy::delete_instance(SocketLecroy* SL_instance)
@@ -41,26 +40,22 @@ void SocketLecroy::delete_instance(SocketLecroy* SL_instance)
 		delete SL_instance ;
 		SL_instance = 0;
 	}
-
 }
 
 //- CTOR
 SocketLecroy::SocketLecroy()
 {
-	sConnectedFlag=false;
-
+	sConnectedFlag = false;
 }
 //- DTOR
 SocketLecroy::~SocketLecroy()
 {
    TCP_Disconnect();
-
 }
 
 //- Build the connection
 void SocketLecroy::TCP_Connect(char *ip_address) throw (lecroy::SocketException)
 {
-
 SOCKADDR_IN	serverAddr;
 int sockAddrSize = sizeof (SOCKADDR), result;
 const int resp = 1;
@@ -69,12 +64,11 @@ TIMEVAL tval;
 unsigned long argp;
 char tmpStr[256];
 	
-	
 	//- connection test
 	if (sConnectedFlag)
 		return;
 
-	strcpy(sCurrentAddress, ip_address);
+	::strcpy(sCurrentAddress, ip_address);
 	
 	tval.tv_sec = sTimeout;
 	tval.tv_usec = 0;	
@@ -83,7 +77,7 @@ char tmpStr[256];
 	serverAddr.sin_family = AF_INET;
 	serverAddr.sin_port = htons (SERVER_PORT);
 			
-	if ((serverAddr.sin_addr.s_addr = inet_addr(ip_address)) == -1) 
+	if ( (serverAddr.sin_addr.s_addr = inet_addr(ip_address)) == -1 ) 
 	{
 		throw lecroy::SocketException("COMMUNICATION_BROKEN ", 
 										"Bad server address.",
@@ -91,14 +85,14 @@ char tmpStr[256];
 	}
 
     //- create client's socket
-  	if ((hSocket = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
+	if ( (hSocket = socket(AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET )
 	{
 		throw lecroy::SocketException("COMMUNICATION_BROKEN ", 
 										"Unable to create client's socket.",
 										"SocketLecroy::TCP_Connect( ).");
 	}
 
-    if (setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (char*)&resp, sizeof(resp)) != 0)
+	if ( setsockopt(hSocket, IPPROTO_TCP, TCP_NODELAY, (char*)&resp, sizeof(resp)) != 0 )
 	{
 		throw lecroy::SocketException("COMMUNICATION_BROKEN ", 
 										"Unable to set socket option to TCP_NODELAY.",
@@ -114,29 +108,34 @@ char tmpStr[256];
 	int error_code = WSAGetLastError();
 
 	//- already connected !
-	if(status && error_code == WSAEISCONN)
+	if ( status && error_code == WSAEISCONN )
 		return;
-	if(status != 0)  // We are not connected : so retry
+	if( status != 0 )  // We are not connected : so retry
 	{
-      		if(error_code == WSAEINPROGRESS || error_code == WSAEWOULDBLOCK) // But the connection is in progress
+		if ( error_code == WSAEINPROGRESS || error_code == WSAEWOULDBLOCK ) // But the connection is in progress
+		{
+			int nb = 0;
+			while ( nb++ < 5 ) // We will attempt to connect every 150 ms for 5 times max.
 			{
-				int nb = 0;
-				
-				while(nb++ < 5) // We will attempt to connect every 100 ms for 5 times max.
+				status = ::connect(hSocket, ( sockaddr *)&serverAddr, sizeof(serverAddr));
+				error_code = WSAGetLastError();
+				if ( status != 0 ) // Still not connected
 				{
-					status = ::connect (hSocket, ( sockaddr *)&serverAddr, sizeof(serverAddr));
-					error_code = WSAGetLastError();
-					if(status != 0) // Still not connected
+					if ( errno == WSAEISCONN ) // This is the right error !
 					{
-						if(errno == WSAEISCONN) // This is the right error !
-						{
-							Sleep(150);  // Sleep for 150 ms
-						}
-					}// Connection is OK.
-					else
-						break;
-				}//TODO : throw ; // Too much attempts, so failure !
-			}// TODO : throw ; // Not the right error, so failure !
+						Sleep(150);  // Sleep for 150 ms
+					}
+				}// Connection is OK.
+				else
+					break;
+			} //- end while // Too much attempts, so failure !
+			if ( nb >= 5 )
+			{
+				throw lecroy::SocketException("COMMUNICATION_BROKEN ", 
+					"Too much attempt to (re)build socket connection.",
+					"SocketLecroy::TCP_Connect( ).");
+			}
+		}// TODO : throw ; // Not the right error, so failure !
 	}// Connected at first attempt !
 	
 	result = select(hSocket, NULL, &wr_set, NULL, &tval);
@@ -147,32 +146,29 @@ char tmpStr[256];
 	//- connect to server (scope)
 	if (result == SOCKET_ERROR)
 	{
-  	    sprintf(tmpStr, "Unable to make connection to IP:%s", ip_address);
+		sprintf(tmpStr, "Unable to make connection to IP:%s", ip_address);
 		throw lecroy::SocketException("COMMUNICATION_BROKEN ", 
 										tmpStr,
 										"SocketLecroy::TCP_Connect( ).");
 	}
 
-	sConnectedFlag = TRUE;
+	sConnectedFlag = true;
 }
 
 
 //- DisconnectFromScope: disconnect from a network device
 void SocketLecroy::TCP_Disconnect(void) 
 {
-	
 	if (sConnectedFlag)
 	{
 		closesocket(hSocket);
 		sConnectedFlag = FALSE;
 	}
-
 }
 
 //- Clear a connection
 void SocketLecroy::TCP_ClearDevice(void) throw (lecroy::SocketException)
 {
-
 	if ( !sConnectedFlag )
 		throw lecroy::SocketException("COMMUNICATION_BROKEN", 
 										"Disconnection already done.",
@@ -180,13 +176,11 @@ void SocketLecroy::TCP_ClearDevice(void) throw (lecroy::SocketException)
 	
 	TCP_Disconnect();
 	TCP_Connect(sCurrentAddress);	
-
 }
 
 //- Send commands to the remote device
 void SocketLecroy::TCP_WriteDevice(char *buf, int len, bool eoi_flag) throw (lecroy::SocketException)
 {
-
 TCP_HEADER header;
 int result, bytes_more, bytes_xferd;
 char *idxPtr;
@@ -208,7 +202,6 @@ char *idxPtr;
 	header.reserved[2] = 0;
 	header.iLength = htonl(len);
 	
-	
 	//- write the header first
 	if (send(hSocket, (char *) &header, sizeof(TCP_HEADER), 0) != sizeof(TCP_HEADER))
 	{
@@ -237,13 +230,11 @@ char *idxPtr;
 		if (bytes_more <= 0)
 			break;
 	}
-
 }
 
 //- Read the device answer
 void SocketLecroy::TCP_ReadDevice(char *buf, int len, int *recv_count) throw (lecroy::SocketException)
 {
-
 TCP_HEADER header;
 int result, accum, space_left, bytes_more, buf_count;
 char tmpStr[256];
@@ -268,7 +259,7 @@ TIMEVAL tval;
 	tval.tv_sec = sTimeout;
 	tval.tv_usec = 0;	
 	
-	memset(buf, 0, len);
+	::memset(buf, 0, len);
 	buf_count = 0;
 	space_left = len;
 		
@@ -286,9 +277,8 @@ TIMEVAL tval;
 		accum = 0;
 		while (1)
 		{
-			memset(&header, 0, sizeof(TCP_HEADER));
-			
-			if ((result = recv(hSocket, (char *) &header + accum, sizeof(header) - accum, 0)) < 0)
+			::memset(&header, 0, sizeof(TCP_HEADER));
+			if ( (result = recv(hSocket, (char *) &header + accum, sizeof(header) - accum, 0)) < 0 )
 			{
 				TCP_ClearDevice();
 				throw lecroy::SocketException("COMMUNICATION_BROKEN ", 
@@ -306,7 +296,7 @@ TIMEVAL tval;
 //			return 0;
 	
 		//- only read to len amount
-		if (header.iLength > space_left)
+		if ( header.iLength > space_left )
 		{
 			header.iLength = space_left;
 			throw lecroy::SocketException("COMMUNICATION_BROKEN ", 
@@ -329,7 +319,7 @@ TIMEVAL tval;
 												"SocketLecroy::TCP_ReadDevice( ).");
 			}
 			
-			if ((result = recv(hSocket, (char *) idxPtr, (bytes_more>2048)?2048:bytes_more, 0)) < 0)
+			if ( (result = recv(hSocket, (char *) idxPtr, (bytes_more>2048)?2048:bytes_more, 0)) < 0 )
 			{
 				TCP_ClearDevice();
 				//-MessageBox(0, "Unable to receive data from the server.", "ERROR", MB_OK);
@@ -355,4 +345,3 @@ TIMEVAL tval;
 	
 	*recv_count = buf_count;
 }
-