Print

Print


Commit in lcio/src/cpp/src on MAIN
EXAMPLE/simjob.cc+61.50 -> 1.51
SIO/SIOLCParameters.cc+7-71.3 -> 1.4
UTIL/LCTOOLS.cc+22-181.48 -> 1.49
+35-25
3 modified files
bug fix for proper handling of empty parameter vectors

lcio/src/cpp/src/EXAMPLE
simjob.cc 1.50 -> 1.51
diff -u -r1.50 -r1.51
--- simjob.cc	24 Mar 2006 11:58:53 -0000	1.50
+++ simjob.cc	25 Apr 2006 08:47:19 -0000	1.51
@@ -115,6 +115,12 @@
 	evt->parameters().setValue("Description"," event can have it's own set of parameters" ) ;
 	evt->parameters().setValue("Thrust", (float) 0.671 ) ;
 
+ 	FloatVec fv ;
+ 	fv.push_back( 1.1 ) ;
+ 	fv.push_back( 2.2 ) ;
+ 	fv.push_back( 3.3 ) ;
+	evt->parameters().setValues( "SomeNumbers" , fv ) ; 
+	
 	// create and add some mc particles 
 	LCCollectionVec* mcVec = new LCCollectionVec( LCIO::MCPARTICLE )  ;
 	

lcio/src/cpp/src/SIO
SIOLCParameters.cc 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- SIOLCParameters.cc	15 Apr 2005 08:37:49 -0000	1.3
+++ SIOLCParameters.cc	25 Apr 2006 08:47:19 -0000	1.4
@@ -103,7 +103,7 @@
 
       int nInt  = intVec.size()  ;     // = params.getNInt( intKeys[i] ) ;
 
-      if( nInt > 0 ){ 
+//       if( nInt > 0 ){ 
 
 	LCSIO_WRITE( stream, intKeys[i]  ) ;
 	SIO_DATA( stream , &nInt , 1 ) ;
@@ -111,8 +111,8 @@
 
 	for(int j=0; j< nInt ; j++ ){
 	  LCSIO_WRITE( stream, intVec[j]  ) ;
-	}
-      }
+ 	}
+//       }
     }
 
     StringVec floatKeys ;
@@ -128,7 +128,7 @@
 
       int nFloat  = floatVec.size()  ;     // = params.getNFloat( floatKeys[i] ) ;
 
-      if( nFloat > 0 ){ 
+//       if( nFloat > 0 ){ 
 
 	LCSIO_WRITE( stream, floatKeys[i]  ) ;
 	SIO_DATA( stream , &nFloat , 1 ) ;
@@ -137,7 +137,7 @@
 	for(int j=0; j< nFloat ; j++ ){
 	  LCSIO_WRITE( stream, floatVec[j]  ) ;
 	}
-      }
+//       }
     }
     
     StringVec stringKeys ;
@@ -153,7 +153,7 @@
       
       int nString  = stringVec.size()  ;     // = params.getNString( stringKeys[i] ) ;
       
-      if( nString > 0 ){ 
+//       if( nString > 0 ){ 
 	
 	LCSIO_WRITE( stream, stringKeys[i]  ) ;
 	SIO_DATA( stream , &nString , 1 ) ;
@@ -162,7 +162,7 @@
 	for(int j=0; j< nString ; j++ ){
 	  LCSIO_WRITE( stream, stringVec[j]  ) ;
 	}
-      }
+//       }
     }
 
 

lcio/src/cpp/src/UTIL
LCTOOLS.cc 1.48 -> 1.49
diff -u -r1.48 -r1.49
--- LCTOOLS.cc	24 Mar 2006 11:57:33 -0000	1.48
+++ LCTOOLS.cc	25 Apr 2006 08:47:20 -0000	1.49
@@ -1758,13 +1758,15 @@
       IntVec intVec ;
       params.getIntVals(  intKeys[i], intVec ) ;
       int nInt  = intVec.size()  ;   
-      if( nInt > 0 ){ 
-	cout << " parameter " << intKeys[i] << " [int]: " ; 
-	for(int j=0; j< nInt ; j++ ){
-	  cout << intVec[j] << ", " ;
-	}
-	cout << endl ;
+      cout << " parameter " << intKeys[i] << " [int]: " ; 
+      
+      if( nInt == 0 ){ 
+	cout << " [empty] " << std::endl ;
+      }
+      for(int j=0; j< nInt ; j++ ){
+	cout << intVec[j] << ", " ;
       }
+      cout << endl ;
     }
     StringVec floatKeys ;
     int nFloatParameters = params.getFloatKeys( floatKeys ).size() ;
@@ -1772,13 +1774,14 @@
       FloatVec floatVec ;
       params.getFloatVals(  floatKeys[i], floatVec ) ;
       int nFloat  = floatVec.size()  ;   
-      if( nFloat > 0 ){ 
-	cout << " parameter " << floatKeys[i] << " [float]: " ; 
-	for(int j=0; j< nFloat ; j++ ){
-	  cout << floatVec[j] << ", " ;
-	}
-	cout << endl ;
+      cout << " parameter " << floatKeys[i] << " [float]: " ; 
+      if( nFloat == 0 ){ 
+	cout << " [empty] " << std::endl ;
       }
+      for(int j=0; j< nFloat ; j++ ){
+	cout << floatVec[j] << ", " ;
+      }
+      cout << endl ;
     }
     StringVec stringKeys ;
     int nStringParameters = params.getStringKeys( stringKeys ).size() ;
@@ -1786,13 +1789,14 @@
       StringVec stringVec ;
       params.getStringVals(  stringKeys[i], stringVec ) ;
       int nString  = stringVec.size()  ;   
-      if( nString > 0 ){ 
-	cout << " parameter " << stringKeys[i] << " [string]: " ; 
-	for(int j=0; j< nString ; j++ ){
-	  cout << stringVec[j] << ", " ;
-	}
-	cout << endl ;
+      cout << " parameter " << stringKeys[i] << " [string]: " ; 
+      if( nString == 0 ){ 
+	cout << " [empty] " << std::endl ;
+      }
+      for(int j=0; j< nString ; j++ ){
+	cout << stringVec[j] << ", " ;
       }
+      cout << endl ;
     }
 
   }
CVSspam 0.2.8