X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fapp%2FApplication.hpp;h=e4754cf26d12aa226e47c38e8fb3982fc16bf302;hb=7ee10b64f4c116460ffef5784eb9ef87d3f2339c;hp=c34c46a32a92ea933e49a0a8445af1bb3bc55016;hpb=bebea4009ed5a273fbf9ed3644a2140a8f477f99;p=anna.git diff --git a/include/anna/app/Application.hpp b/include/anna/app/Application.hpp index c34c46a..e4754cf 100644 --- a/include/anna/app/Application.hpp +++ b/include/anna/app/Application.hpp @@ -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_app_Application_hpp @@ -53,13 +25,12 @@ class Component; struct functions; /** - Abstraccion de la aplicacion. + Application abstraction. - Mantiene la informacion de todos los recursos usados (version, titulo, linea de comandos, - threads, etc ...) por nuestras aplicaciones. + Gather all the information of resources (version, title, command line, + threads, etc ...) used by our applications. - Slo puede haber una nica instancia de la aplicacio, que seria accesible mediante el - metodo anna::functions::getApp. + Only one single instance could exists for the application, accessed by mean anna::functions::getApp. */ class Application { public: @@ -72,12 +43,11 @@ public: /** Constructor. - @param shortName Nombre logico de esta instancia. - @param title Titulo de la aplicacion que aparecera al arrancar. - @param version version de este programa. Aconsejamos el forma X.YRZZ. Donde X es la - version principal, Y la version secundaria y ZZ es el numero de entrega realizada. - \param date Fecha de realizacion del componente. Normalmente sera el contenido de la macro __DATE__. - \param time Hora de realizacion del componente. Normalmente sera el contenido de la macro __TIME__. + @param shortName Instance logical name. + @param title Application title (appears when the application starts). + @param version Program version (recommended X.YRZZn with X = main version, Y = secondary version, ZZ = delivery number + \param date Component build date. Normally the macro __DATE__. + \param time Component build time. Normally the macro __TIME__. */ Application(const char* shortName, const char* title, const char* version, const char* date = NULL, const char* time = NULL); @@ -86,16 +56,16 @@ public: */ virtual ~Application() { a_components.clear(); } - // Accesores + // Getters /** - Devuelve el nombre corto indicado en el constructor. - \return El nombre corto indicado en el constructor. + Short name given in constructor. + \return Short name given in constructor. */ const char* getShortName() const throw() { return a_shortName; } /** - Devuelve la version indicado en el contructor de esta aplicacion. - \return La version indicado en el contructor de esta aplicacion. + Version given in constructor. + \return Version given in constructor. */ const std::string& getVersion() const throw() { return a_version; } @@ -191,13 +161,13 @@ public: virtual bool supportCommunication() const throw() { return false; } /** - * Este método se invocará cuando alguna capa superior a ésta detecte un problema tan grave - * como para parar la aplicación de forma súbita. + * Este m�todo se invocar� cuando alguna capa superior a �sta detecte un problema tan grave + * como para parar la aplicaci�n de forma s�bita. * \param className Nombre de la clase que genera el evento. * - * \warning En el momento de invocar a este método la aplicación puede estar en un estado - * no muy estable por lo que se deberían minizar las operaciones a realizar para evitar - * bloquear la aplicación. + * \warning En el momento de invocar a este m�todo la aplicaci�n puede estar en un estado + * no muy estable por lo que se deber�an minizar las operaciones a realizar para evitar + * bloquear la aplicaci�n. */ virtual void eventAbnormalTermination(const char* className) throw() { ; } @@ -231,11 +201,15 @@ protected: virtual void run() throw(RuntimeException) = 0; /** - Metodo manejador que podemos re-escribir para tratar la recepcion de la senhal USR1. - Por defecto + Handler for SIGUSR1. Application context written by default. */ virtual void signalUSR1() throw(RuntimeException); + /** + Handler for SIGUSR2. Nothing done by default. + */ + virtual void signalUSR2() throw(RuntimeException); + /** Metodo manejador que podemos re-escribir para tratar la recepcion de la senhal SIGTERM. */ @@ -300,12 +274,12 @@ protected: static pid_t pid(const_pid_iterator& ii) throw() { return *ii; } private: - bool a_running; - std::string a_version; const std::string a_title; std::vector a_components; pid_t a_pid; const char* a_shortName; + bool a_running; + std::string a_version; bool a_enableGPL; pid_container a_pids; @@ -316,7 +290,8 @@ private: void stopComponents() throw(RuntimeException); void sendSignalToChilds(const int signal) throw(); - static void handlerSignalUSR1(int) throw(); + void signalUSR(int) throw(RuntimeException); + static void handlerSignalUSR(int) throw(); static void handlerSignalTerminate(int) throw(); static void handlerChildTerminate(int sig) throw();