-// ANNA - Anna is Not Nothingness Anymore
-//
-// (c) Copyright 2005-2014 Eduardo Ramos Testillano & Francisco Ruiz Rayo
-//
-// http://redmine.teslayout.com/projects/anna-suite
-//
-// 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 the copyright holder 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_timex_Context_hpp
* \return La nueva transación que ya habrá sido activada.
*/
Transaction* open(const Tid& tid, const int classType = 0)
- throw(RuntimeException) {
+ noexcept(false) {
Transaction* result = NULL;
{
Guard guard(a_mutex, "timex::Context::open");
* \return La transación correspondiente al identificador recibido. Puede ser NULL.
*/
Transaction* find(const Tid& tid, const Exception::Mode::_v emode = Exception::Mode::Throw)
- throw(RuntimeException) {
+ noexcept(false) {
Guard guard(a_mutex, "timex::Context::find");
transaction_iterator ii = a_transactions.find(tid);
Transaction* result = (ii != a_transactions.end()) ? transaction(ii) : NULL;
if(result == NULL) {
- if(Exception::Mode::Throw) {
+ if(emode == Exception::Mode::Throw) {
std::string msg("Transaction: ");
msg += identifierAsString(tid);
msg += " | Tid not found";
throw RuntimeException(msg, ANNA_FILE_LOCATION);
- } else if(Exception::Mode::Trace && Logger::isActive(Logger::Warning)) {
+ } else if(emode == Exception::Mode::Trace && Logger::isActive(Logger::Warning)) {
std::string msg("Transaction: ");
msg += identifierAsString(tid);
msg += " | Tid not found";
* \return El identificador de aplicación indicado en el método #open.
*/
const Tid& getIdentifier(const Transaction* transaction) const
- throw(RuntimeException) {
+ noexcept(false) {
if(transaction == NULL)
throw RuntimeException("timex::Context::getIdentifier | Can not work with NULL transaction", ANNA_FILE_LOCATION);
* \param transaction Transación a terminar. Si fuera NULL este método no tiene ningún efecto.
*/
void close(Transaction* transaction)
- throw() {
+ {
if(transaction == NULL)
return;
* \return Un documento XML con la información relevante de esta clase.
*/
virtual xml::Node* asXML(xml::Node* parent) const
- throw() {
+ {
xml::Node* result = parent->createChild("timex.Context");
result->createAttribute("Size", a_transactions.size());
result->createAttribute("AvgSize", (a_counter == 0) ? 0 : a_accSize / a_counter);
* Puede ser NULL.
*/
static const Context* getInstance(const Transaction* transaction)
- throw(RuntimeException) {
+ noexcept(false) {
if(transaction == NULL)
throw RuntimeException("timex::Context::getInstance | Can not work with NULL transaction", ANNA_FILE_LOCATION);
* tenga que gestionar varios tipos de transaciones u operaciones.
* \return Una nueva transación que puede ser usada por este contexto.
*/
- virtual Transaction* createTransaction(const int classType) throw() = 0;
+ virtual Transaction* createTransaction(const int classType) = 0;
/**
* Método virtual puro que liberá el espacio asociado a la transación recibida como parámetro.
* Lo más adecuado sería implementar este método mediate el uso del patrón #anna::Recycler.
* \param transaction Transación a liberar.
*/
- virtual void releaseTransaction(Transaction* transaction) throw() = 0;
+ virtual void releaseTransaction(Transaction* transaction) = 0;
/**
* Método virtual puro que debe devolver una \em std::string correspondiente al valor del identificador
* \param tid Identificador único que la transación.
* \return una \em std::string correspondiente al valor del identificador recibido como parámetro.
*/
- virtual std::string identifierAsString(const Tid& tid) const throw() = 0;
+ virtual std::string identifierAsString(const Tid& tid) const = 0;
/**
* Método virtual puro que debe devolver la clave de aplicación asociada a una transación
* \param tid Puntero que apunta a la clave de aplicación usada para acceder a una transacción.
* \return La clave de aplicación correspondiente al puntero recibido como parámetro.
*/
- virtual const Tid& contextAsIdentifier(const void* tid) const throw() = 0;
+ virtual const Tid& contextAsIdentifier(const void* tid) const = 0;
private:
typedef typename std::map <Tid, Transaction*> transaction_container;
/* Método re-implementado de timex::TimeEventObserver */
void release(timex::TimeEvent* event)
- throw() {
+ {
Transaction* tt = static_cast <Transaction*>(event);
Guard guard(a_mutex, "timex::Context::release");
// Calcula la duración media de las transaciones de este contexto.
a_accSize += a_transactions.size();
}
- static Transaction* transaction(transaction_iterator ii) throw() { return ii->second; }
+ static Transaction* transaction(transaction_iterator ii) { return ii->second; }
};
}