X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fcomm%2FHandler.hpp;h=cc38ea16bb006f963d4a5c1e4b1fbb92aac21359;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hp=b35cca5d49a908752b5a7aeef5390348fad83568;hpb=3e258840b15577cb8bda3cdedd0b9b88e16404b3;p=anna.git diff --git a/include/anna/comm/Handler.hpp b/include/anna/comm/Handler.hpp index b35cca5..cc38ea1 100644 --- a/include/anna/comm/Handler.hpp +++ b/include/anna/comm/Handler.hpp @@ -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_Handler_hpp @@ -88,13 +60,13 @@ public: Devuelve el tipo de controlador. \return el tipo de controlador. */ - Type::_v getType() const throw() { return a_type; } + Type::_v getType() const { return a_type; } /** Devuelve el descriptor de fichero asociado a este controlador. \return el descriptor de fichero asociado a este controlador. */ - int getfd() const throw() { return a_fd; } + int getfd() const { return a_fd; } /** Devuelve \em true si el descriptor de fichero asociado a este controlador soporta @@ -102,7 +74,7 @@ public: \return \em true si el descriptor de fichero asociado a este controlador soporta control de congestion o \em false en otro caso. */ - bool supportCongestionControl() const throw() { return (a_support & Support::CongestionControl) != 0; } + bool supportCongestionControl() const { return (a_support & Support::CongestionControl) != 0; } /** Devuelve \em true si este manejador soporta control de temporizacion o \em false en otro @@ -110,45 +82,45 @@ public: \return \em true si este manejador soporta control de temporizacion o \em false en otro caso. */ - bool supportTimeout() const throw() { return a_timeout > 0; } + bool supportTimeout() const { return a_timeout > 0; } /** Operador de comparacion. \param fd Descriptor de fichero con el que comparar. \return \em true si el fd recibido es igual al establecido con #setfd o \em false en caso contrario. */ - bool operator == (const int fd) const throw() { return a_fd == fd; } + bool operator == (const int fd) const { return a_fd == fd; } /** Metodo invocado por el comunicador cuando detectado actividad en el descriptor de fichero asociado a este controlador. */ - virtual void apply() throw(RuntimeException) = 0; + virtual void apply() noexcept(false) = 0; /** Devuelve el ClientSocket asociado a este manejador de conexiones. \return El ClientSocket asociado a este manejador de conexiones. Puede ser NULL. \warning Uso interno. Se necesita para poder cooperar con el anna::comm::CongestionController. */ - virtual ClientSocket* getClientSocket() throw() { return NULL; } + virtual ClientSocket* getClientSocket() { return NULL; } /** Devuelve una cadena con la informacion referente a esta instancia. \return una cadena con la informacion referente a esta instancia. */ - virtual std::string asString() const throw(); + virtual std::string asString() const ; /** Devuelve un documento XML con la informacion referente a esta instancia. \return un documento XML con la informacion referente a esta instancia. */ - virtual xml::Node* asXML(xml::Node* parent) const throw(RuntimeException); + virtual xml::Node* asXML(xml::Node* parent) const noexcept(false); /** Amplia la informacion XML del nodo recibido como parametro. \param node Nodo XML en el que incorporar los atributos. */ - void asAttribute(xml::Node* node) const throw(RuntimeException); + void asAttribute(xml::Node* node) const noexcept(false); protected: /** @@ -193,14 +165,14 @@ protected: \warning La implementacion del metodo initialize debe invocar a este metodo con descriptor de fichero valido. */ - void setfd(const int fd) throw() { setId(anna::functions::asText("Handler", a_fd = fd)); } + void setfd(const int fd) { setId(anna::functions::asText("Handler", a_fd = fd)); } /** Establece el numero de milisegundos maximo que puede estar este manejador sin recibir mensajes antes de ser cerrado por el nucleo. \param timeout Numero de milisegundos maximo sin recibir mensajes. */ - void setTimeout(const Millisecond &timeout) throw() { + void setTimeout(const Millisecond &timeout) { a_timeout = timeout; a_maxTime = functions::hardwareClock() + a_timeout; } @@ -209,7 +181,7 @@ protected: En los manejadores que pueden recibir mas de una peticion en cada llamada a apply este metodo debe ser invocado para saber si debe dejar de procesar mensajes. */ - bool canContinue() const throw() { return hasRequestedStop() == false; } + bool canContinue() const { return hasRequestedStop() == false; } /** Metodo con el que podemos redefinir el comportamiento cuando recibe la notificacion de @@ -217,7 +189,7 @@ protected: \param address Direccion IP que ha dejado de estar disponible. \warning Se invoca automaticamente desde el comunicador. */ - virtual void breakAddress(const in_addr_t& address) throw() {;} + virtual void breakAddress(const in_addr_t& address) {;} /** Metodo con el que podemos redefinir el comportamiento cuando recibe la notificacion de @@ -225,7 +197,7 @@ protected: \param address Direccion IP que ha pasado a estar disponible. \warning Se invoca automaticamente desde el comunicador. */ - virtual void recoverAddress(const in_addr_t& address) throw() {;} + virtual void recoverAddress(const in_addr_t& address) {;} /** * Método que se invoca periódicamente para comprobar si tenemos pendiente el cierre de la conexión @@ -233,7 +205,7 @@ protected: * * \return \em true Si termina la conexión o \em false en otro caso. */ - virtual bool testClose() throw(RuntimeException) { return false;} + virtual bool testClose() noexcept(false) { return false;} /** Metodo con el que podemos redefinir el comportamiento cuando recibe la notificacion de @@ -241,14 +213,14 @@ protected: \warning Se invoca automaticamente desde el comunicador al invocar al metodo \em detach correspondiente. */ - virtual void finalize() throw() {;} + virtual void finalize() {;} /** * Metodo con el que podemos redefinir el comportamiento cuando recibe la notificacion de * que el componente asociado a este controlador ha sido duplicado en un proceso hijo. * \warning Exclusivamente uso interno. */ - virtual void clone() throw(RuntimeException) {;} + virtual void clone() noexcept(false) {;} private: const Type::_v a_type; @@ -259,8 +231,8 @@ private: int a_loop; Handler(const Handler&); - void do_action() throw(RuntimeException); - void beat(const Microsecond& now) throw() { a_maxTime = now + a_timeout; } + void do_action() noexcept(false); + void beat(const Microsecond& now) { a_maxTime = now + a_timeout; } bool isTimeout(const Microsecond& now) { return a_maxTime > 0 && a_maxTime <= now; } friend class Communicator;