Remove dynamic exceptions
[anna.git] / include / anna / core / util / Average.hpp
index b8712bd..e70d1b6 100644 (file)
@@ -1,37 +1,9 @@
-// ANNA - Anna is Not Nothingness Anymore
-//
-// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
-//
-// https://bitbucket.org/testillano/anna
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-//     * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//     * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-// Authors: eduardo.ramos.testillano@gmail.com
-//          cisco.tierra@gmail.com
+// ANNA - Anna is Not Nothingness Anymore                                                         //
+//                                                                                                //
+// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
+//                                                                                                //
+// See project site at http://redmine.teslayout.com/projects/anna-suite                           //
+// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
 
 
 #ifndef anna_core_util_Average_hpp
@@ -63,45 +35,45 @@ public:
      Devuelve el indicador de validez de esta media.
      \return \em true Si la media no tiene ningun valor o \em false en caso contrario.
   */
-  bool isEmpty() const throw()  { return (a_n == 0); }
+  bool isEmpty() const   { return (a_n == 0); }
 
   /**
      Devuelve \em true si el valor de la media es cero, bien por no tener valores o
      bien porque todos ellos eran cero.
      \return \em true el valor de la media es cero o \em false en otro caso.
   */
-  bool isZero() const throw() { return a_n == 0 || a_accumulator == 0; }
+  bool isZero() const { return a_n == 0 || a_accumulator == 0; }
 
   /**
      Devuelve el numero de elementos de contiene la media.
      \return el numero de elementos de contiene la media.
   */
-  int size() const throw() { return a_n; }
+  int size() const { return a_n; }
 
   /**
      Devuelve el valor acumulado.
      \return el valor acumulado.
   */
-  T getAccumulator() const throw() { return a_accumulator; }
+  T getAccumulator() const { return a_accumulator; }
 
   /**
      Devuelve la media de la sucesion de valores numericos asociados a esta.
      \return La media de la sucesion de valores numericos asociados a esta.
      \warning Antes de invocar a este operador hay que verificar que #isEmpty devuelve \em false.
   */
-  T value() const throw() { return (isEmpty() == true) ? T(0) : (a_accumulator / a_n);  }
+  T value() const { return (isEmpty() == true) ? T(0) : (a_accumulator / a_n);  }
 
   /**
      Inicializa el valor de la media.
   */
-  void clear() throw() {  a_accumulator = 0; a_n = 0; }
+  void clear() {  a_accumulator = 0; a_n = 0; }
 
   /**
    * Establece manualmente el valor de la estadística.
    * \param value Valor que tomará el acumulador de este instancia.
    * \param _n valor que tomará el conteador de esta instancia.
    */
-  void setValue(const T& value, const unsigned int _n) throw() {
+  void setValue(const T& value, const unsigned int _n) {
     a_accumulator = value;
     a_n = _n;
   }
@@ -111,7 +83,7 @@ public:
      \return La media de la sucesion de valores numericos asociados a esta.
      \warning Antes de invocar a este operador hay que verificar que #isEmpty devuelve \em false.
   */
-  operator T() const throw() { return value(); }
+  operator T() const { return value(); }
 
   /**
      Inicializa el valor de esta media.
@@ -119,7 +91,7 @@ public:
      \return La referencia a esta instancia.
   */
   Average<T>& operator = (const T value)
-  throw() {
+  {
     a_accumulator = value;
     a_n = 1;
     return *this;
@@ -131,7 +103,7 @@ public:
      \return La referencia a esta instancia.
   */
   Average<T>& operator = (const Average<T>& other)
-  throw() {
+  {
     a_accumulator = other.a_accumulator;
     a_n = other.a_n;
     return *this;
@@ -143,7 +115,7 @@ public:
      \return La referencia a esta instancia.
   */
   Average<T>& operator += (const T& v)
-  throw() {
+  {
     const T backup(a_accumulator);
 
     if((a_accumulator += v) < backup) {
@@ -161,7 +133,7 @@ public:
      \return La referencia a esta instancia.
   */
   Average<T>& operator -= (const T v)
-  throw() {
+  {
     if(a_accumulator > v && a_n > 1) {
       a_accumulator -= v;
       a_n --;
@@ -178,7 +150,7 @@ public:
      \return Una cadena con la informacion referente a esta clase.
   */
   std::string asString() const
-  throw() {
+  {
     std::string msg(a_name);
     msg += " { Accumulate: ";
     msg += functions::asString(a_accumulator);