From bf957f3c5c85a5d335807de7b8ff9d4f191b1628 Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Sun, 17 Oct 2010 19:32:08 +0200
Subject: [PATCH] WRG: unused parameter

---
 .../Code/Learning/otbSVMClassifierImage.cxx   | 32 +++++++++++++------
 ...leKernelFunctorImageClassificationTest.cxx |  6 ++++
 ...leKernelFunctorImageModelEstimatorTest.cxx |  6 ++++
 .../otbSVMModelCopyComposedKernelTest.cxx     |  7 ++++
 .../otbSVMModelCopyGenericKernelTest.cxx      |  6 ++++
 5 files changed, 48 insertions(+), 9 deletions(-)

diff --git a/Testing/Code/Learning/otbSVMClassifierImage.cxx b/Testing/Code/Learning/otbSVMClassifierImage.cxx
index 91108d8e4e..3c30b81e99 100644
--- a/Testing/Code/Learning/otbSVMClassifierImage.cxx
+++ b/Testing/Code/Learning/otbSVMClassifierImage.cxx
@@ -22,15 +22,7 @@
 
 #include <fstream>
 
-/*#include "itkPoint.h"
-#include "itkPointSet.h"
-
-
-#include "itkPointSetToListAdaptor.h"
-#include "itkSubsample.h"*/
-
 #include "itkListSample.h"
-
 #include "otbImage.h"
 #include "otbVectorImage.h"
 #include "itkImageToListAdaptor.h"
@@ -46,13 +38,35 @@ namespace otb
 class Linear : public GenericKernelFunctorBase
 {
 public:
+  typedef Linear                              Self;
+  typedef GenericKernelFunctorBase            Superclass;
+
   Linear() : GenericKernelFunctorBase() {}
   virtual ~Linear() {}
 
-  virtual double operator ()(const svm_node *x, const svm_node *y, const svm_parameter& param) const
+  // Deep copy operator
+  virtual GenericKernelFunctorBase* Clone() const
+  {
+    return new Self(*this);
+  }
+
+  virtual double operator ()(const svm_node *x, const svm_node *y, const svm_parameter&) const
   {
     return this->dot(x, y);
   }
+
+protected:
+  Linear(const Self& copy)
+  : Superclass(copy)
+  {
+    *this = copy;
+  }
+
+  Linear& operator=(const Self& copy)
+  {
+    Superclass::operator =(copy);
+    return *this;
+  }
 };
 
 }
diff --git a/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx b/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx
index 0de7effa0a..2e0cd998ab 100644
--- a/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx
+++ b/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx
@@ -35,6 +35,12 @@
 
 int otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest(int argc, char* argv[])
 {
+  if (argc != 4)
+    {
+    std::cerr << "Wrong number of arguments" << std::endl;
+    return EXIT_FAILURE;
+    }
+
   const char* inputImageFileName = argv[1];
   const char* trainingImageFileName = argv[2];
   const char* outputModelFileName = argv[3];
diff --git a/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx b/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx
index 2b353ecc18..288d374cef 100644
--- a/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx
+++ b/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx
@@ -34,6 +34,12 @@
 
 int otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest(int argc, char* argv[])
 {
+  if (argc != 4)
+    {
+    std::cerr << "Wrong number of arguments" << std::endl;
+    return EXIT_FAILURE;
+    }
+
   const char* inputImageFileName = argv[1];
   const char* trainingImageFileName = argv[2];
   const char* outputModelFileName = argv[3];
diff --git a/Testing/Code/Learning/otbSVMModelCopyComposedKernelTest.cxx b/Testing/Code/Learning/otbSVMModelCopyComposedKernelTest.cxx
index 83ee260244..7cde85c271 100644
--- a/Testing/Code/Learning/otbSVMModelCopyComposedKernelTest.cxx
+++ b/Testing/Code/Learning/otbSVMModelCopyComposedKernelTest.cxx
@@ -27,6 +27,13 @@
 
 int otbSVMModelCopyComposedKernelTest(int argc, char* argv[])
 {
+  if (argc != 3)
+    {
+    std::cerr << "Wrong number of arguments" << std::endl;
+    return EXIT_FAILURE;
+    }
+
+
   typedef unsigned char InputPixelType;
   typedef unsigned char LabelPixelType;
 
diff --git a/Testing/Code/Learning/otbSVMModelCopyGenericKernelTest.cxx b/Testing/Code/Learning/otbSVMModelCopyGenericKernelTest.cxx
index c72b41096b..a3a3f80680 100644
--- a/Testing/Code/Learning/otbSVMModelCopyGenericKernelTest.cxx
+++ b/Testing/Code/Learning/otbSVMModelCopyGenericKernelTest.cxx
@@ -27,6 +27,12 @@
 
 int otbSVMModelCopyGenericKernelTest(int argc, char* argv[])
 {
+  if (argc != 3)
+    {
+    std::cerr << "Wrong number of arguments" << std::endl;
+    return EXIT_FAILURE;
+    }
+
   typedef unsigned char InputPixelType;
   typedef unsigned char LabelPixelType;
 
-- 
GitLab