Remove dynamic exceptions
[anna.git] / include / anna / app / Component.hpp
index e8a7768..7258012 100644 (file)
@@ -1,47 +1,16 @@
-// 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_app_Component_hpp
 #define anna_app_Component_hpp
 
 #include <vector>
-
-#include <anna/core/RuntimeException.hpp>
-#include <anna/core/mt/Mutex.hpp>
-
+#include <anna/core/util/Component.hpp>
 #include <anna/app/Application.hpp>
 
 namespace anna {
@@ -72,38 +41,32 @@ namespace app {
    Si el componente \em 'Clase' no hubiera sido registrado (instanciado) en nuestra aplicacion el metodo
    template anna::component lanzara una excepcion.
 */
-class Component : public Mutex {
+class Component : public anna::Component {
 public:
   /**
      Destructor.
   */
   virtual ~Component();
 
-  /**
-     Devuelve el nombre de esta clase indicado en el constructor.
-     \return El nombre de la clase indicado en el constructor.
-  */
-  const char* getClassName() const throw() { return a_className.c_str(); }
-
   /**
      Conecta explicitamente este componente con la aplicacion. Sera necesario invocar a este metodo
      cuando instanciemos un componentes despues de comenzar la ejecucion de nuestra aplicacion y
      cuando el nuevo componente este completamente listo para su inicializacion.
   */
-  void attach() throw(RuntimeException);
+  void attach() noexcept(false);
 
   /**
      Devuelve una cadena con la informacion mas relevante de esta instancia.
      \return Una cadena con la informacion mas relevante de esta instancia.
   */
-  virtual std::string asString() const throw();
+  virtual std::string asString() const ;
 
   /**
      Devuelve un documento XML con la informacion mas relevante de esta instancia.
      \param parent Nodo XML del que colgar la informacion referente a esta instancia.
      \return Un documento XML con la informacion mas relevante de esta instancia.
   */
-  virtual xml::Node* asXML(xml::Node* parent) const throw();
+  virtual xml::Node* asXML(xml::Node* parent) const ;
 
 protected:
   /**
@@ -122,20 +85,20 @@ protected:
      Devuelve el estado de este componente.
      \return el estado de este componente.
   */
-  State::_v getState() const throw() { return a_state; }
+  State::_v getState() const { return a_state; }
 
   /**
      Indica que el nombre de un componente que debe ser initializa antes que este.
      \param componentName Nombre de componente requerido por esta instancia.
      \warning Solo tendra efecto antes de inicializar el componente.
   */
-  void addPredecessor(const char* componentName) throw();
+  void addPredecessor(const char* componentName) ;
 
   /**
      metodo que debemos implementar si la clase heredada necesita algn tipo de inicializacin.
      Este metodo se invocara automaticamente desde anna::Application::start.
   */
-  void initialize() throw(RuntimeException);
+  void initialize() noexcept(false);
 
   /**
      metodo que debemos implementar en la clase heredada para implementar el proceso de parada de
@@ -144,7 +107,7 @@ protected:
      Este metodo debe implementar un metodo de parada controlada. Se invocara automaticamente
      desde el nucleo
   */
-  void stop() throw() { a_state = State::Stopped; do_stop(); }
+  void stop() { a_state = State::Stopped; do_stop(); }
 
   /**
      metodo que debemos implementar en la clase heredada para implementar el proceso de parada de
@@ -152,25 +115,24 @@ protected:
 
      Este metodo implementa un metodo de parada no controlada.
   */
-  virtual void kill() throw() { stop(); }
+  virtual void kill() { stop(); }
 
 private:
   typedef std::vector <std::string>::iterator iterator;
 
-  const std::string a_className;
   State::_v a_state;
   std::vector <std::string> a_predecessors;
 
   Component(const Component& other);
-  iterator begin() throw() { return a_predecessors.begin(); }
-  iterator end() throw() { return a_predecessors.end(); }
-  const std::string& data(iterator& ii) throw() { return *ii; }
+  iterator begin() { return a_predecessors.begin(); }
+  iterator end() { return a_predecessors.end(); }
+  const std::string& data(iterator& ii) { return *ii; }
 
   /**
      metodo que debemos implementar si la clase heredada necesita algn tipo de inicializacin.
      Este metodo se invocara automaticamente desde anna::Application::start.
   */
-  virtual void do_initialize() throw(RuntimeException) = 0;
+  virtual void do_initialize() noexcept(false) = 0;
 
   /**
      Metodo que debemos implementar en la clase heredada para tratar el proceso de parada de
@@ -178,26 +140,26 @@ private:
      Este metodo debe implementar un metodo de parada controlada. Se invocara automaticamente
      desde el nucleo
   */
-  virtual void do_stop() throw() = 0;
+  virtual void do_stop()  = 0;
 
   /**
    * Metodo que debemos implementar en la clase heredada para tratar el proceso de clonado de
    * esta clase desde el punto de vista del proceso original.
    * \warning Si se detecta algun error terminara abortara la ejecucion del proceso hijo.
    */
-  virtual void do_cloneParent() throw(RuntimeException) { ; }
+  virtual void do_cloneParent() noexcept(false) { ; }
 
   /**
    * Metodo que debemos implementar en la clase heredada para tratar el proceso de clonado de
    * esta clase desde el punto de vista del proceso hijo.
    * \warning Si se detecta algun error terminara abortara la ejecucion de este proceso.
    */
-  virtual void do_cloneChild() throw(RuntimeException) { ; }
+  virtual void do_cloneChild() noexcept(false) { ; }
 
-  friend void Application::startComponents() throw(RuntimeException);
-  friend void Application::stopComponents() throw(RuntimeException);
-  friend void Application::attach(Component*) throw(RuntimeException);
-  friend Application& Application::clone() throw(RuntimeException);
+  friend void Application::startComponents() noexcept(false);
+  friend void Application::stopComponents() noexcept(false);
+  friend void Application::attach(Component*) noexcept(false);
+  friend Application& Application::clone() noexcept(false);
 };
 
 }