X-Git-Url: https://git.teslayout.com/public/public/public/?p=anna.git;a=blobdiff_plain;f=source%2Fdbos%2FStorageArea.cpp;h=66ee16bc61944c2566322ea50ff964d8904da55b;hp=830f64777845bac0a646ee627c3c2189bdb63f2b;hb=5a6cba5fde2b2f538a7515f8293cc0a8d9589dfa;hpb=af9c86ffb0e28d35ad94d99c5f77e41578c972b4 diff --git a/source/dbos/StorageArea.cpp b/source/dbos/StorageArea.cpp index 830f647..66ee16b 100644 --- a/source/dbos/StorageArea.cpp +++ b/source/dbos/StorageArea.cpp @@ -58,7 +58,7 @@ StorageArea::~StorageArea() { // 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); @@ -157,7 +157,7 @@ throw(RuntimeException, DatabaseException) { } 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 @@ -183,7 +183,7 @@ throw(RuntimeException, DatabaseException) { // 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; @@ -266,7 +266,7 @@ throw(RuntimeException, DatabaseException) { // lo sacamos de ah� //------------------------------------------------------------------------- Object* StorageArea::find(Loader& loader) -throw(RuntimeException) { +noexcept(false) { const Index index = loader.getIndex(); Instance* instance = NULL; Object* result = NULL; @@ -303,7 +303,7 @@ throw(RuntimeException) { } Object* StorageArea::duplicate(const Object* object) -throw(RuntimeException) { +noexcept(false) { if(object == NULL) return NULL; std::string name("dbos::StorageArea::duplicate with "); @@ -336,7 +336,7 @@ throw(RuntimeException) { } 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(); @@ -356,7 +356,7 @@ throw(RuntimeException) { } void StorageArea::apply(Connection& connection, Recorder& recorder) -throw(RuntimeException, DatabaseException) { +noexcept(false) { ResultCode resultCode = connection.execute(recorder.getStatement()); if(resultCode.successful() == false) @@ -373,7 +373,7 @@ throw(RuntimeException, DatabaseException) { // 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"; @@ -424,7 +424,7 @@ throw(RuntimeException, DatabaseException) { // 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; @@ -468,7 +468,7 @@ throw(RuntimeException) { // si fuera necesario invocara al 'destroy'. //------------------------------------------------------------------------------------------------ void StorageArea::erase(Object** object) -throw(RuntimeException) { +noexcept(false) { if(object == NULL) return; if(*object == NULL) return; @@ -505,7 +505,7 @@ throw(RuntimeException) { } void StorageArea::dirty(Object* object) -throw(RuntimeException) { +noexcept(false) { if(object == NULL) return; std::string name("dbos::StorageArea::dirty with "); @@ -544,7 +544,7 @@ throw(RuntimeException) { // expulsarla de cache. //-------------------------------------------------------------------------------------------- void StorageArea::clear() -throw(RuntimeException) { +noexcept(false) { Guard guard(this, "dbos::StorageArea::clear"); Instance* instance; int n = 0; @@ -594,7 +594,7 @@ throw(RuntimeException) { // 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); @@ -658,7 +658,7 @@ throw(RuntimeException, dbms::DatabaseException) { // a instanciar, etc, etc //------------------------------------------------------------------------------------------------ void StorageArea::checkIncoherence(StorageArea::Instance* instance) -throw() { +{ if(quickReusing(instance) == true) { LOGWARNING( string msg("dbos::StorageArea::checkIncoherence | "); @@ -693,7 +693,7 @@ throw() { // 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) @@ -722,7 +722,7 @@ throw() { } void StorageArea::verifyStatus(StorageArea::Instance* instance, const bool ignoreDirty) -throw(RuntimeException) { +noexcept(false) { if(instance->flags & Flag::Incoherent) { string msg(asString()); msg += " | "; @@ -757,7 +757,7 @@ throw(RuntimeException) { } 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 */ @@ -785,7 +785,7 @@ throw() { } 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); @@ -808,7 +808,7 @@ throw() { } string StorageArea::asMemorySize(const Size size) -throw() { +{ string result; if(size < 1024) { @@ -825,7 +825,7 @@ throw() { } StorageArea::Instance* StorageArea::allocate() -throw() { +{ Instance* result = NULL; if((result = reuse()) == NULL) { @@ -858,7 +858,7 @@ throw() { // (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; @@ -913,7 +913,7 @@ throw() { } std::string StorageArea::asString(const Instance* instance) -throw() { +{ std::string result("Instance { "); if(instance == NULL) @@ -955,7 +955,7 @@ throw() { } const char* StorageArea::AccessMode::asString(const AccessMode::_v v) -throw() { +{ static const char* text [] = { "ReadOnly", "ReadWrite", "ReadEver" }; return text [v]; } @@ -973,7 +973,7 @@ StorageArea::Block::Block(ObjectAllocator objectAllocator, const Size maxSize) : } bool StorageArea::Holes::insert(Instance* instance, const StorageArea::Holes::Mode::_v mode) -throw() { +{ if(instance->copyCounter > 0) return false; @@ -1007,7 +1007,7 @@ throw() { } void StorageArea::Holes::erase(Instance* instance) -throw() { +{ // instance->msHoleTime = 0; instance->flags |= Flag::Ready;