Remove dynamic exceptions
[anna.git] / include / anna / comm / CongestionController.hpp
index c879331..8d5e613 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_comm_CongestionController_hpp
@@ -133,31 +105,31 @@ public:
      Devuelve el modo que estamos usando para calcular la carga.
      \return El modo que estamos usando para calcular la carga.
   */
-  Mode::_v getMode() const throw() { return a_mode; }
+  Mode::_v getMode() const { return a_mode; }
 
   /**
    * Devuelve el número total de mensajes recibididos.
    * \return el número total de mensajes recibididos.
    */
-  int getMessageCounter() const throw() { return a_messageCounter; }
+  int getMessageCounter() const { return a_messageCounter; }
 
   /**
    * Devuelve el número de mensajes tratados correctamente.
    * \return el número de mensajes tratados correctamente.
    */
-  int getSuccessCounter() const throw() { return a_messageCounter - a_discardedCounter; }
+  int getSuccessCounter() const { return a_messageCounter - a_discardedCounter; }
 
   /**
      Establece el limite de carga que vamos a imponer.
      \param limit Limite de carga. Debe ser un valor entre 0 y 100.
   */
-  void setLimit(const int limit) throw();
+  void setLimit(const int limit) ;
 
   /**
      Establece el modo en que vamos a calcular la carga.
      \param mode Modo usado para calcular la carga.
   */
-  void setMode(const Mode::_v mode) throw() {
+  void setMode(const Mode::_v mode) {
     if((a_mode = mode) == Mode::Auto) {
       WHEN_MULTITHREAD(a_effectiveMode = Mode::Local);
       WHEN_SINGLETHREAD(a_effectiveMode = Mode::Global);
@@ -169,7 +141,7 @@ public:
      Devuelve \em true si esta instancia ha recibido datos o \em false en otro caso.
      \return \em true si esta instancia ha recibido datos o \em false en otro caso.
   */
-  bool isEmpty() const throw() { return a_avgWorkload.isEmpty(); }
+  bool isEmpty() const { return a_avgWorkload.isEmpty(); }
 
   /**
    *  Establece el nº máximo de bytes que deberían tener los socket en la cola de entrada.
@@ -179,7 +151,7 @@ public:
    * [#comm::Communicator::getReadingChunkSize, min (#comm::Communicator::getReadingChunkSize * 4, #MaxPendingBytes)]
    * \endcode
    */
-  void setMaxPendingBytes(const int maxPendingBytes) throw(RuntimeException);
+  void setMaxPendingBytes(const int maxPendingBytes) noexcept(false);
 
   /**
      Devuelve el consejo sobre si debemos tratar/o no el ultimo mensaje recibido
@@ -189,7 +161,7 @@ public:
      , Advice::None para indicar que todavia no tiene datos para tomar una
      decision clara o Advice::Discard para indicar que debemos descartar.
   */
-  Advice::_v getAdvice(const ClientSocket& clientSocket) throw();
+  Advice::_v getAdvice(const ClientSocket& clientSocket) ;
 
   /**
      Devuelve el consejo sobre si debemos tratar/o no el ultimo mensaje recibido
@@ -199,7 +171,7 @@ public:
      , Advice::None para indicar que todavia no tiene datos para tomar una
      decision clara o Advice::Discard para indicar que debemos descartar.
   */
-  Advice::_v getAdvice(const ClientSocket* clientSocket) throw() {
+  Advice::_v getAdvice(const ClientSocket* clientSocket) {
     return (clientSocket == NULL) ? Advice::Process : getAdvice(*clientSocket);
   }
 
@@ -215,7 +187,7 @@ public:
    * \see #getLoad
    * \see #getLevel
    */
-  Workload getAccumulatedWorkload() const throw();
+  Workload getAccumulatedWorkload() const ;
 
   /**
    * Devuelve información sobre las estadísticas de carga del socket recibido como parámetro.
@@ -231,25 +203,25 @@ public:
    * \see #getLoad
    * \see #getLevel
    */
-  Workload getCurrentWorkload(const ClientSocket& clientSocket) const throw();
+  Workload getCurrentWorkload(const ClientSocket& clientSocket) const ;
 
   /**
      Devuelve un documento XML con la informacion relevante sobre esta clase.
      \return un documento XML con la informacion relevante sobre esta clase.
   */
-  xml::Node* asXML(xml::Node* parent) const throw();
+  xml::Node* asXML(xml::Node* parent) const ;
 
   /**
    * Extrae la carga media que soporta es proceso. La carga es un número en [0, 100].
    * \return la carga media que soporta es proceso. La carga es un número en [0, 100].
    */
-  static int getLoad(const Workload& workload) throw() { return workload.second; }
+  static int getLoad(const Workload& workload) { return workload.second; }
 
   /**
    * Extrae el nivel de carga en la que está el proceso. El nivel de carga es un número en [0, 4].
    * \return el nivel de carga en la que está el proceso. El nivel de carga es un número en [0, 4].
    */
-  static int getLevel(const Workload& workload) throw() { return workload.first; }
+  static int getLevel(const Workload& workload) { return workload.first; }
 
 private:
   static const Millisecond DelayTrace;
@@ -275,13 +247,13 @@ private:
   int a_incomingSocketCounter;
   Millisecond a_tickTime;
 
-  void incrementIncomingSocket() throw(RuntimeException);
-  void decrementIncomingSocket() throw(RuntimeException);
+  void incrementIncomingSocket() noexcept(false);
+  void decrementIncomingSocket() noexcept(false);
 
   CongestionController();
   CongestionController(const CongestionController&);
 
-  int calculeWorkload(const ClientSocket&) const throw();
+  int calculeWorkload(const ClientSocket&) const ;
 
   friend class Singleton <CongestionController>;