-// 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 //
#include <typeinfo>
// caso se ha reusado.
//------------------------------------------------------------------------------------------------
Object* StorageArea::instance(Connection* connection, Loader& loader)
-throw(RuntimeException, DatabaseException) {
+noexcept(false) {
const Index index = loader.getIndex();
Object* result(NULL);
Instance* instance(NULL);
}
Object* StorageArea::instance(Connection* connection, CrossedLoader& crossedLoader, Loader& loader)
-throw(RuntimeException, DatabaseException) {
+noexcept(false) {
Object* result = NULL;
crossedLoader.a_connection = connection;
// Si el seek devuelve 'true' es que ya tiene cargada la correspondencia entre la clave alternativa y la
// Crea un nuevo objeto en el area de almacenamiento.
//-------------------------------------------------------------------------
Object* StorageArea::create(Connection* connection, Creator& creator)
-throw(RuntimeException, DatabaseException) {
+noexcept(false) {
const Index index = creator.getIndex();
Instance* instance = NULL;
Object* result = NULL;
// lo sacamos de ah�
//-------------------------------------------------------------------------
Object* StorageArea::find(Loader& loader)
-throw(RuntimeException) {
+noexcept(false) {
const Index index = loader.getIndex();
Instance* instance = NULL;
Object* result = NULL;
}
Object* StorageArea::duplicate(const Object* object)
-throw(RuntimeException) {
+noexcept(false) {
if(object == NULL) return NULL;
std::string name("dbos::StorageArea::duplicate with ");
}
bool StorageArea::isLoaded(const Loader& loader)
-throw(RuntimeException) {
+noexcept(false) {
const Index index = loader.getIndex();
std::string name("dbos::StorageArea::isLoaded with ");
name += typeid(loader).name();
}
void StorageArea::apply(Connection& connection, Recorder& recorder)
-throw(RuntimeException, DatabaseException) {
+noexcept(false) {
ResultCode resultCode = connection.execute(recorder.getStatement());
if(resultCode.successful() == false)
// instancia en cuanto pueda.
//------------------------------------------------------------------------------------------------
void StorageArea::apply(Connection& connection, Eraser& eraser)
-throw(RuntimeException, DatabaseException) {
+noexcept(false) {
if(a_accessMode == AccessMode::ReadOnly) {
string msg(asString());
msg += " | Cannot erase object with AccessMode::ReadOnly";
// memoria alcance un numero tal que implique comenzar a reusar objetos liberados.
//------------------------------------------------------------------------------------------------
void StorageArea::release(Object** object)
-throw(RuntimeException) {
+noexcept(false) {
if(object == NULL) return;
if(*object == NULL) return;
// si fuera necesario invocara al 'destroy'.
//------------------------------------------------------------------------------------------------
void StorageArea::erase(Object** object)
-throw(RuntimeException) {
+noexcept(false) {
if(object == NULL) return;
if(*object == NULL) return;
}
void StorageArea::dirty(Object* object)
-throw(RuntimeException) {
+noexcept(false) {
if(object == NULL) return;
std::string name("dbos::StorageArea::dirty with ");
// expulsarla de cache.
//--------------------------------------------------------------------------------------------
void StorageArea::clear()
-throw(RuntimeException) {
+noexcept(false) {
Guard guard(this, "dbos::StorageArea::clear");
Instance* instance;
int n = 0;
// y se libera su memoria.
//---------------------------------------------------------------------------------------------------
Object* StorageArea::reload(dbms::Connection* connection, Loader& loader, StorageArea::Instance* instance)
-throw(RuntimeException, dbms::DatabaseException) {
+noexcept(false) {
const bool enableUpdate = (instance->flags & Flag::Dirty) ? true : instance->object->enableUpdate();
bool hasChanges(false);
// a instanciar, etc, etc
//------------------------------------------------------------------------------------------------
void StorageArea::checkIncoherence(StorageArea::Instance* instance)
-throw() {
+{
if(quickReusing(instance) == true) {
LOGWARNING(
string msg("dbos::StorageArea::checkIncoherence | ");
// esta, cambiarle el msHoleTime y volverlo a grabar.
//------------------------------------------------------------------------------------------------
bool StorageArea::quickReusing(StorageArea::Instance* instance)
-throw() {
+{
bool result(false);
if(a_holes.insert(instance, Holes::Mode::ReadyToReuse) == true) { // (1)
}
void StorageArea::verifyStatus(StorageArea::Instance* instance, const bool ignoreDirty)
-throw(RuntimeException) {
+noexcept(false) {
if(instance->flags & Flag::Incoherent) {
string msg(asString());
msg += " | ";
}
string StorageArea::asString() const
-throw() {
+{
string result("dbos::StorageArea { Name: ");
const int ratio = (a_hit == 0) ? 0 : (a_hit * 100) / (a_fault + a_hit);
/* Nº real de objetos en uso. En el directorio también se mantienen los que tienen la cuenta de utilización a 0 */
}
xml::Node* StorageArea::asXML(xml::Node* parent) const
-throw() {
+{
xml::Node* result = parent->createChild("dbos.StorageArea");
xml::Node* node;
const int ratio = (a_hit == 0) ? 0 : (a_hit * 100) / (a_fault + a_hit);
}
string StorageArea::asMemorySize(const Size size)
-throw() {
+{
string result;
if(size < 1024) {
}
StorageArea::Instance* StorageArea::allocate()
-throw() {
+{
Instance* result = NULL;
if((result = reuse()) == NULL) {
// (2) Si el primero de los registros disponibles no es suficientemente antiguo => no hay huecos libres
//-----------------------------------------------------------------------------------------------------
StorageArea::Instance* StorageArea::reuse()
-throw() {
+{
if(a_holes.empty() == true)
return NULL;
}
std::string StorageArea::asString(const Instance* instance)
-throw() {
+{
std::string result("Instance { ");
if(instance == NULL)
}
const char* StorageArea::AccessMode::asString(const AccessMode::_v v)
-throw() {
+{
static const char* text [] = { "ReadOnly", "ReadWrite", "ReadEver" };
return text [v];
}
a_maxSize = std::min(8U, std::max(256U, maxSize >> 7));
a_instances = new Instance [a_maxSize];
- for(register int i = 0; i < a_maxSize; i ++)
+ for(int i = 0; i < a_maxSize; i ++)
a_instances [i].object = (*objectAllocator)();
}
bool StorageArea::Holes::insert(Instance* instance, const StorageArea::Holes::Mode::_v mode)
-throw() {
+{
if(instance->copyCounter > 0)
return false;
}
void StorageArea::Holes::erase(Instance* instance)
-throw() {
+{
// instance->msHoleTime = 0;
instance->flags |= Flag::Ready;