BUG: Code after exceptions is unreachable

When throwing exceptions all the work necessary
to clean up memory or put the program in a good
state must occur prior to the exception being
thrown.  Additionally, nothing should be returned
after the exception.

Change-Id: I9c5b862dfa3b8884d058dffc85994cc9ee9dc408
BUG: Function should have const signature

Two functions GetValue() and  GetCurrentPosition() return a const
reference to the parameters and do not change any ivars, so they
should be const functions.  These changes facilitates accessing a
const version of the optimizers for the purpose of printing
diagnostics.
Also, these functions should be defined as virtual to have a
similar singnature with those that are defined in itk::Optimizer
and itk::RegularStepGradientDescentBaseOptimizer classes.
To explain more, we consider "GetCurrentPosition" function, and
exactly the same situation holds for "GetValue" function.
GetCurrentPosition function is defined by a macro in itk::Optimzer
class:

  itkGetConstReferenceMacro(CurrentPosition,ParametersType);

This definition is equvalent to:

  virtual const ParametersType&
      GetCurrentPosition() const;
  {
  return m_CurrentPosition;
  }

In itk::ObjectToObjectOptimizerBaseTemplate the GetCurrentPosition()
function is defined again for Optimizerv4 set of classes with a new
implementation and the following signature:

  const ParametersType& GetCurrentPosition();

As the implementation is different, the macro definition cannot be
used anymore, but the above signature of function should be changed
to be consistent with the aforementioned one in itk::Optimizer class.
Also, defined as a virtual, helps possible overwriting of this function
by derived optimizer classes in future.

Change-Id: Id26c6751c6015bc0a0ee3dabb72c1ed0d3b13b66
Merge topic 'ConstFunction'

210b81b BUG: Function should have const signature
Merge topic 'RemoveUnreachableCode'

a2bd408 BUG: Code after exceptions is unreachable