Remove dynamic exceptions
[anna.git] / include / anna / core / mt / Runnable.hpp
index d3da7d5..369fdd8 100644 (file)
@@ -1,37 +1,9 @@
-// ANNA - Anna is Not 'N' 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_mt_Runnable_hpp
@@ -59,7 +31,7 @@ public:
      Devuelve el nombre logico de esta instancia.
      @return El nombre logico de esta instancia.
   */
-  const std::string& getId() const throw() { return a_id; }
+  const std::string& getId() const { return a_id; }
 
   /**
      Devuelve el valor del indicador de parada.
@@ -67,25 +39,25 @@ public:
      \warning La implementacion particular del metodo run deberia comprobar este valor
      periodicamente.
   */
-  bool hasRequestedStop() const throw() { return a_requestedStop == true; }
+  bool hasRequestedStop() const { return a_requestedStop == true; }
 
   /**
      Devuelve \em true si la instancia esta en ejecucion dentro de su propio thread o \em false en otro caso.
      \return \em true si la instancia esta en ejecucion dentro de su propio thread o \em false en otro caso.
   */
-  bool isRunning() const throw() { return a_isRunning; }
+  bool isRunning() const { return a_isRunning; }
 
   /**
      Solicita la parada de esta instancia.
   */
-  void requestStop() throw(RuntimeException);
+  void requestStop() noexcept(false);
 
   /**
      Devuelve una cadena con la informacion relevante de este objeto.
      \return Una cadena con la informacion relevante de este objeto.
   */
   virtual std::string asString() const
-  throw() {
+  {
     std::string result("anna::Runnable { Id: ");
     result += a_id;
     result += functions::asText(" | Running: ", a_isRunning);
@@ -115,38 +87,38 @@ protected:
      Establece el nombre logico de esta instancia.
      \param id Nuevo nombre logico de esta instancia.
   */
-  void setId(const std::string& id) throw() { a_id = id; }
+  void setId(const std::string& id) { a_id = id; }
 
   /**
      Establece el indicador que informa sobre si esta instancia esta en ejecucion o no.
      \param isRunning Indicador que informa sobre si esta instancia esta en ejecucion.
      \warning Uso interno. Se invoca automaticamente desde Thread.
   */
-  void setIsRunning(const bool isRunning) throw() {  a_isRunning = isRunning; }
+  void setIsRunning(const bool isRunning) {  a_isRunning = isRunning; }
 
   /**
      Metodo que se debe reescribir para inicializar el contenido de la clase justo antes de comenzar
      su ejecucion.
   */
-  virtual void initialize() throw(RuntimeException) {;}
+  virtual void initialize() noexcept(false) {;}
 
   /**
      Metodo que debe reescribir para realizar la accion concreta. Por defecto invocara do_action mientras
      que no se invoque la metodo requestStop de la instancia.
   */
-  virtual void run() throw(RuntimeException);
+  virtual void run() noexcept(false);
 
   /**
      Metodo que se debe reescribir para finalizar la ejecucion de esta instancia.
      \warning La re-implementacion de este metodo siempre debera invocar a la implementacion
      original que esta re-escribiiendo.
   */
-  virtual void terminate() throw() { a_requestedStop = false; }
+  virtual void terminate() { a_requestedStop = false; }
 
   /**
      Metodo indicado por Runnable::run en tanto en cuanto no se invoque a requestStop.
   */
-  virtual void do_action() throw(RuntimeException) = 0;
+  virtual void do_action() noexcept(false) = 0;
 
 private:
   std::string a_id;
@@ -156,7 +128,7 @@ private:
   friend class Thread;
 };
 
-#define anna_complete_runnable(Class) void do_action () throw () {;}
+#define anna_complete_runnable(Class) void do_action () {;}
 
 } //namespace anna