X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fcomm%2FCompatCodec.hpp;h=cb168381b892f3e74428353c96a3f754cf925d27;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hp=ccc61d3208f50aefa1bee7ef33965fd20b4dd474;hpb=4e12ac57e93c052f716a6305ad8fc099c45899d1;p=anna.git diff --git a/include/anna/comm/CompatCodec.hpp b/include/anna/comm/CompatCodec.hpp index ccc61d3..cb16838 100644 --- a/include/anna/comm/CompatCodec.hpp +++ b/include/anna/comm/CompatCodec.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_comm_CompatCodec_hpp @@ -118,7 +90,7 @@ namespace comm { */ class CompatCodec : public Message { struct SortById { - static short int value(const comm::Variable* variable) throw() { + static short int value(const comm::Variable* variable) { return variable->getId(); } }; @@ -132,21 +104,21 @@ class CompatCodec : public Message { VariableContainer(); - void clear() throw(); - void add(comm::Variable* variable) throw(); - comm::Variable* find(const int id) throw(); - const comm::Variable* find(const int id) const throw(); + void clear() ; + void add(comm::Variable* variable) ; + comm::Variable* find(const int id) ; + const comm::Variable* find(const int id) const ; - int size() const throw() { return a_size; } + int size() const { return a_size; } - iterator begin() throw() { return a_variables; } - iterator end() throw() { return a_variables + a_size; } + iterator begin() { return a_variables; } + iterator end() { return a_variables + a_size; } - const_iterator begin() const throw() { return a_variables; } - const_iterator end() const throw() { return a_variables + a_size; } + const_iterator begin() const { return a_variables; } + const_iterator end() const { return a_variables + a_size; } - static comm::Variable* data(iterator ii) throw() { return *ii; } - static const comm::Variable* data(const_iterator ii) throw() { return *ii; } + static comm::Variable* data(iterator ii) { return *ii; } + static const comm::Variable* data(const_iterator ii) { return *ii; } private: comm::Variable** a_variables; @@ -182,7 +154,7 @@ public: Devuelve el identificador del mensaje indicado en el constructor. @return El identificador de este mensaje. */ - Type getType() const throw() { return a_type; } + Type getType() const { return a_type; } // Metodos /** @@ -197,7 +169,7 @@ public: al mensaje y viceversa. @return Un puntero que hace referencia al nuevo dato interno que ha sido creado. */ - const Variable* attach(const char* name, const short int id, std::string& value) throw(RuntimeException); + const Variable* attach(const char* name, const short int id, std::string& value) noexcept(false); /** Asocia el valor recibido como parametro al dato interno identificado por `id'. Esta clase @@ -211,7 +183,7 @@ public: al mensaje y viceversa. @return Un puntero que hace referencia al nuevo dato interno que ha sido creado. */ - const Variable* attach(const char* name, const short int id, const char*& value) throw(RuntimeException); + const Variable* attach(const char* name, const short int id, const char*& value) noexcept(false); /** Asocia el valor recibido como parametro al dato interno identificado por `id'. Esta clase @@ -225,7 +197,7 @@ public: al mensaje y viceversa. @return Un puntero que hace referencia al nuevo dato interno que ha sido creado. */ - const Variable* attach(const char* name, const short int id, int& value) throw(RuntimeException); + const Variable* attach(const char* name, const short int id, int& value) noexcept(false); /** Asocia el valor recibido como parametro al dato interno identificado por `id'. Esta clase @@ -239,7 +211,7 @@ public: al mensaje y viceversa. @return Un puntero que hace referencia al nuevo dato interno que ha sido creado. */ - const Variable* attach(const char* name, const short int id, Integer64& value) throw(RuntimeException); + const Variable* attach(const char* name, const short int id, S64& value) noexcept(false); /** Asocia el valor recibido como parametro al dato interno identificado por `id'. Esta clase @@ -253,7 +225,7 @@ public: al mensaje y viceversa. @return Un puntero que hace referencia al nuevo dato interno que ha sido creado. */ - const Variable* attach(const char* name, const short int id, bool& value) throw(RuntimeException); + const Variable* attach(const char* name, const short int id, bool& value) noexcept(false); /** Asocia el valor recibido como parametro al dato interno identificado por `id'. Esta clase @@ -267,7 +239,7 @@ public: al mensaje y viceversa. Debe tener activado el sistema de copia profunda. @return Un puntero que hace referencia al nuevo dato interno que ha sido creado. */ - const Variable* attach(const char* name, const short int id, DataBlock& value) throw(RuntimeException); + const Variable* attach(const char* name, const short int id, DataBlock& value) noexcept(false); /** Asocia el valor recibido como parametro al dato interno identificado por `id'. Esta clase @@ -281,7 +253,7 @@ public: al mensaje y viceversa. Debe tener activado el sistema de copia profunda. @return Un puntero que hace referencia al nuevo dato interno que ha sido creado. */ - const Variable* attach(const char* name, const short int id, float& value) throw(RuntimeException); + const Variable* attach(const char* name, const short int id, float& value) noexcept(false); /** Asocia el valor recibido como parametro al dato interno identificado por `id'. Esta clase @@ -295,11 +267,11 @@ public: al mensaje y viceversa. Debe tener activado el sistema de copia profunda. @return Un puntero que hace referencia al nuevo dato interno que ha sido creado. */ - const Variable* attach(const char* name, const short int id, double& value) throw(RuntimeException); + const Variable* attach(const char* name, const short int id, double& value) noexcept(false); - const Variable* attach(const char* name, const short int id, Second& value) throw(RuntimeException); - const Variable* attach(const char* name, const short int id, Millisecond& value) throw(RuntimeException); - const Variable* attach(const char* name, const short int id, Microsecond& value) throw(RuntimeException); + const Variable* attach(const char* name, const short int id, Second& value) noexcept(false); + const Variable* attach(const char* name, const short int id, Millisecond& value) noexcept(false); + const Variable* attach(const char* name, const short int id, Microsecond& value) noexcept(false); /** * Asocia el mensaje recibido como un parámetro interno especificado por \em id. @@ -307,7 +279,7 @@ public: * \param id Identificador del dato asignado. * \param value Instancia del mensaje que se codificará/decodificará de forma recursiva. */ - const Variable* attach(const char* name, const short int id, comm::CompatCodec& value) throw(RuntimeException); + const Variable* attach(const char* name, const short int id, comm::CompatCodec& value) noexcept(false); /** Devuelve la referencia al dato interno identificado por el `id' recibido como parametro. @@ -316,7 +288,7 @@ public: @return La referencia de la variable identificada por 'id'. Si no existe se lanzar�una excepcin. */ - const Variable& find(const short int id) const throw(RuntimeException); + const Variable& find(const short int id) const noexcept(false); /** Marca el dato asociado al identificador recibido como nulo, lo cual conlleva que el dato no seria @@ -325,7 +297,7 @@ public: @param id Identificador asignado al dato. @param isNull Indica la nueva marca de la variable. */ - void setNull(const short int id, const bool isNull = true) throw(RuntimeException); + void setNull(const short int id, const bool isNull = true) noexcept(false); /** Marca el dato recibido como nulo, lo cual conlleva que el dato no seria transferido al bloque @@ -334,7 +306,7 @@ public: @param variable Instancia de Varaible obtenida al invocar al método #attach @param isNull Indica la nueva marca de la variable. */ - void setNull(const Variable* variable, const bool isNull = true) throw(); + void setNull(const Variable* variable, const bool isNull = true) ; /** @param id Identificador asignado al dato. @@ -344,37 +316,37 @@ public: Un dato puede tener un value nulo, bien por que se ha invocado a la funcin @ref setNull o bien porque se recibio un mensaje en el que no venia contenido el identificador del dato. */ - bool isNull(const short int id) const throw(RuntimeException); + bool isNull(const short int id) const noexcept(false); /** Devuelve un iterador al comienzo de la lista de variables asociados a este mensaje. \return Un iterador al comienzo de la lista de variables asociados a este mensaje. */ - iterator begin() throw() { return a_variables.begin(); } + iterator begin() { return a_variables.begin(); } /** Devuelve un iterador al comienzo de la lista de variables asociados a este mensaje. \return Un iterador al comienzo de la lista de variables asociados a este mensaje. */ - const_iterator begin() const throw() { return a_variables.begin(); } + const_iterator begin() const { return a_variables.begin(); } /** Devuelve un iterador al comienzo de la lista de variables asociados a este mensaje. \return Un iterador al final de la lista de variables asociados a este mensaje. */ - iterator end() throw() { return a_variables.end(); } + iterator end() { return a_variables.end(); } /** Devuelve un iterador al comienzo de la lista de variables asociados a este mensaje. \return Un iterador al final de la lista de variables asociados a este mensaje. */ - const_iterator end() const throw() { return a_variables.end(); } + const_iterator end() const { return a_variables.end(); } /** Devuelve el número de enginees asociados a.esta instancia. \return el número de enginees asociados a.esta instancia. */ - int size() const throw() { return a_variables.size(); } + int size() const { return a_variables.size(); } /** Devuelve la instancia de la variable sobre el que esta posicionado el iterador recibido @@ -382,7 +354,7 @@ public: \param ii Iterador que debera estar comprendido entre begin y end. \return La instancia de la variable sobre el que esta posicionado el iterador recibido */ - static Variable* variable(iterator ii) throw() { return container::data(ii); } + static Variable* variable(iterator ii) { return container::data(ii); } /** Devuelve la instancia de la variable sobre el que esta posicionado el iterador recibido @@ -390,13 +362,13 @@ public: \param ii Iterador que debera estar comprendido entre begin y end. \return La instancia de la variable sobre el que esta posicionado el iterador recibido */ - static const Variable* variable(const_iterator ii) throw() { return container::data(ii); } + static const Variable* variable(const_iterator ii) { return container::data(ii); } /** Transfiene los datos establecidos en este mensaje interno a un bloque de memoria cuya instancia es devuelta por este metodo. @return Bloque de memoria que contiene la informacion del mensaje. */ - virtual const DataBlock& code() throw(RuntimeException); + virtual const DataBlock& code() noexcept(false); /** Transfiene la informacion contenida en el bloque de memoria recibido hacia las variables asociadas a este mensaje interno. @@ -404,7 +376,7 @@ public: @param dataBlock Bloque de memoria que contiene las variables codificadas. */ - virtual void decode(const DataBlock& dataBlock) throw(RuntimeException); + virtual void decode(const DataBlock& dataBlock) noexcept(false); /** Permite conocer el identificador del mensaje que viene contenido en el bloque de memoria @@ -414,7 +386,7 @@ public: @return El tipo del mensaje contenido en el bloque de memoria. */ - static Type getType(const DataBlock& dataBlock) throw(RuntimeException); + static Type getType(const DataBlock& dataBlock) noexcept(false); protected: bool a_scramble; @@ -429,8 +401,8 @@ private: CompatCodec(const CompatCodec&); CompatCodec& operator = (const CompatCodec&); - void normalDecode(const char* data, const int size, const int maxdata) throw(RuntimeException); - bool optimizedDecode(const char* data, const int size) throw(RuntimeException); + void normalDecode(const char* data, const int size, const int maxdata) noexcept(false); + bool optimizedDecode(const char* data, const int size) noexcept(false); }; }