X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=include%2Fanna%2Fcore%2Futil%2FDelayMeter.hpp;h=752eb746eb27c24df171efb472aa634289e26e91;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hp=4080ce341a449eb4b113840e6fa950f8e60a9e2d;hpb=3e258840b15577cb8bda3cdedd0b9b88e16404b3;p=anna.git diff --git a/include/anna/core/util/DelayMeter.hpp b/include/anna/core/util/DelayMeter.hpp index 4080ce3..752eb74 100644 --- a/include/anna/core/util/DelayMeter.hpp +++ b/include/anna/core/util/DelayMeter.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_core_util_DelayMeter_hpp @@ -87,7 +59,7 @@ public: * \warning Elimina el punto de referencia temporal que puediera haberse establecido con #setTopReference. * \return El número de milisegundos transcurridos desde la última vez que inicializamos la cuenta de temporizacion. */ - void setControlPoint() throw() { + void setControlPoint() { a_timestamp = _TimeUnit::getTime(); clearTopReference(); } @@ -100,7 +72,7 @@ public: * * \param timestamp Valor de referencia a establecer. */ - void setControlPoint(const _TimeUnit& timestamp) throw() { + void setControlPoint(const _TimeUnit& timestamp) { a_timestamp = timestamp; clearTopReference(); } @@ -117,17 +89,17 @@ public: * la marca de tiempo) y el núcleo y demás partes pueden tener conocimiento de que * esa tarea ha sido finalidad. */ - void setTopReference(const _TimeUnit& topReference) throw() { a_topReference = topReference; } + void setTopReference(const _TimeUnit& topReference) { a_topReference = topReference; } /** * Elimina el punto de referencia temporal. */ - void clearTopReference() throw() { a_topReference = _TimeUnit(0); } + void clearTopReference() { a_topReference = _TimeUnit(0); } /** * Inicializa el valor del punto de referencia. */ - void clear() throw() { a_timestamp = 0; } + void clear() { a_timestamp = 0; } /** * Devuelve el número de milisegundos transcurridos desde la última vez que inicializamos la cuenta de temporización. @@ -137,7 +109,7 @@ public: * \return El número de milisegundos transcurridos desde la última vez que inicializamos la cuenta de temporizacion. * \warning Si detecta algun fallo devolvera 0. */ - _TimeUnit getValue() const throw() { + _TimeUnit getValue() const { a_now = (a_topReference == _TimeUnit(0)) ? _TimeUnit::getTime() : a_topReference; return (a_now > a_timestamp) ? (a_now - a_timestamp) : _TimeUnit(0); } @@ -151,7 +123,7 @@ public: * \return El número de milisegundos transcurridos desde la última vez que inicializamos la cuenta de temporizacion. * \warning Si detecta algun fallo devolvera 0. */ - _TimeUnit getValue(const _TimeUnit& now) const throw() { + _TimeUnit getValue(const _TimeUnit& now) const { return ((a_now = now) > a_timestamp) ? (a_now - a_timestamp) : _TimeUnit(0); } @@ -159,40 +131,40 @@ public: * Devuelve el tiempo que se usó como referencia al calcular el retardo en #getValue * \return El tiempo que se usó como referencia al calcular el retardo en #getValue */ - const _TimeUnit& getNow() const throw() { return a_now; } + const _TimeUnit& getNow() const { return a_now; } /** * Operador copia. * \param other Instancia de la que copiar. */ - DelayMeter& operator= (const DelayMeter& other) throw() { a_timestamp = other.a_timestamp; a_topReference = other.a_topReference; return *this; } + DelayMeter& operator= (const DelayMeter& other) { a_timestamp = other.a_timestamp; a_topReference = other.a_topReference; return *this; } /** * Compara el retardo acumulado por esta instancia con el valor recibido. * \param left Valor numérico con el comparar. * \return \em true si el retardo acumulado es mayor que el parámetro recibido o \em false en otro caso. */ - bool operator> (const _TimeUnit& left) const throw() { return getValue() > left; } + bool operator> (const _TimeUnit& left) const { return getValue() > left; } /** * Compara el retardo acumulado por esta instancia con el valor recibido. * \param left Valor numérico con el comparar. * \return \em true si el retardo acumulado es mayor que el parámetro recibido o \em false en otro caso. */ - bool operator< (const _TimeUnit& left) const throw() { return getValue() < left; } + bool operator< (const _TimeUnit& left) const { return getValue() < left; } /** * Devuelve la cadena que muestra el tiempo medido por esta instancia. * \return la cadena que muestra el tiempo medido por esta instancia. */ - std::string asString() const throw() { return getValue().asString(); } + std::string asString() const { return getValue().asString(); } /** * Devuelve la cadena de depuración de esta instancia. * \param whatis Texto con el nombre lógico de esta instancia. * \return la cadena de depuración de esta instancia. */ - std::string asDebugString(const char* whatis) const throw() { + std::string asDebugString(const char* whatis) const { std::string result(whatis); result += " { TopReference: "; result += a_topReference.asString();