From: Anthony Geay Date: Thu, 29 Oct 2015 18:34:07 +0000 (+0100) Subject: In SDS add killVar transaction. X-Git-Tag: V8_0_pre~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ac4cf280deabb0347a434e3ba267b16feabb4a07;p=modules%2Fkernel.git In SDS add killVar transaction. --- diff --git a/idl/SALOME_SDS.idl b/idl/SALOME_SDS.idl index 43b5e2514..4e1f5621a 100644 --- a/idl/SALOME_SDS.idl +++ b/idl/SALOME_SDS.idl @@ -125,6 +125,7 @@ module SALOME TransactionMultiKeyAddSession addMultiKeyValueSession(in string varName) raises (SALOME::SALOME_Exception); Transaction removeKeyInVarErrorIfNotAlreadyExisting(in string varName, in ByteVec keyValue) raises (SALOME::SALOME_Exception); TransactionRdWrAccess createWorkingVarTransac(in string varName, in ByteVec constValue) raises (SALOME::SALOME_Exception); + Transaction killVarTransac(in string varName) raises (SALOME::SALOME_Exception); KeyWaiter waitForKeyInVar(in string varName, in ByteVec keyVal) raises (SALOME::SALOME_Exception); KeyWaiter waitForKeyInVarAndKillIt(in string varName, in ByteVec keyVal, out Transaction transac) raises (SALOME::SALOME_Exception); void atomicApply(in ListOfTransaction transactions) raises (SALOME::SALOME_Exception); diff --git a/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx b/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx index 9d1fe0df8..409fdf623 100644 --- a/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx +++ b/src/SALOMESDS/SALOMESDS_DataScopeServer.cxx @@ -717,6 +717,16 @@ SALOME::TransactionRdWrAccess_ptr DataScopeServerTransaction::createWorkingVarTr return SALOME::TransactionRdWrAccess::_narrow(obj2); } +SALOME::Transaction_ptr DataScopeServerTransaction::killVarTransac(const char *varName) +{ + std::string varNameCpp(varName); + checkExistingVar(varNameCpp); + // + TransactionKillVar *ret(new TransactionKillVar(this,varName)); + CORBA::Object_var obj2(ret->activate()); + return SALOME::Transaction::_narrow(obj2); +} + SALOME::KeyWaiter_ptr DataScopeServerTransaction::waitForKeyInVar(const char *varName, const SALOME::ByteVec& keyVal) { PickelizedPyObjServer *pickelObj(checkVarExistingAndDict(varName)); diff --git a/src/SALOMESDS/SALOMESDS_DataScopeServer.hxx b/src/SALOMESDS/SALOMESDS_DataScopeServer.hxx index bdca97cf8..eafc2900a 100644 --- a/src/SALOMESDS/SALOMESDS_DataScopeServer.hxx +++ b/src/SALOMESDS/SALOMESDS_DataScopeServer.hxx @@ -141,6 +141,7 @@ namespace SALOMESDS SALOME::TransactionMultiKeyAddSession_ptr addMultiKeyValueSession(const char *varName); SALOME::Transaction_ptr removeKeyInVarErrorIfNotAlreadyExisting(const char *varName, const SALOME::ByteVec& key); SALOME::TransactionRdWrAccess_ptr createWorkingVarTransac(const char *varName, const SALOME::ByteVec& constValue); + SALOME::Transaction_ptr killVarTransac(const char *varName); SALOME::KeyWaiter_ptr waitForKeyInVar(const char *varName, const SALOME::ByteVec& keyVal); SALOME::KeyWaiter_ptr waitForKeyInVarAndKillIt(const char *varName, const SALOME::ByteVec& keyVal, SALOME::Transaction_out transac); void atomicApply(const SALOME::ListOfTransaction& transactions); diff --git a/src/SALOMESDS/SALOMESDS_Transaction.cxx b/src/SALOMESDS/SALOMESDS_Transaction.cxx index 6b4577cfa..445623f8c 100644 --- a/src/SALOMESDS/SALOMESDS_Transaction.cxx +++ b/src/SALOMESDS/SALOMESDS_Transaction.cxx @@ -101,6 +101,39 @@ void TransactionRdWrVarCreate::perform() _dsct->createRdWrVarInternal(_var_name,data2); } +TransactionKillVar::TransactionKillVar(DataScopeServerTransaction *dsct, const std::string& varName):Transaction(dsct,varName) +{ +} + +/*! + * TODO + */ +void TransactionKillVar::prepareRollBackInCaseOfFailure() +{ + checkVarExisting(); + //BasicDataServer *bds(_dsct->retrieveVarInternal2(_var_name); + //bds->clone(); +} + +void TransactionKillVar::perform() +{ + _dsct->deleteVar(_var_name.c_str()); +} + +/*! + * TODO + */ +void TransactionKillVar::rollBack() +{ +} + +/*! + * no implementation it is not a bug ! killVar is not an event. + */ +void TransactionKillVar::notify() +{ +} + TransactionDictModify::TransactionDictModify(DataScopeServerTransaction *dsct, const std::string& varName):Transaction(dsct,varName),_varc(0) { _varc=checkVarExistingAndDict(); diff --git a/src/SALOMESDS/SALOMESDS_Transaction.hxx b/src/SALOMESDS/SALOMESDS_Transaction.hxx index c58ccd929..bc94d9f78 100644 --- a/src/SALOMESDS/SALOMESDS_Transaction.hxx +++ b/src/SALOMESDS/SALOMESDS_Transaction.hxx @@ -97,6 +97,16 @@ namespace SALOMESDS void perform(); }; + class TransactionKillVar : public Transaction + { + public: + TransactionKillVar(DataScopeServerTransaction *dsct, const std::string& varName); + void prepareRollBackInCaseOfFailure(); + void perform(); + void rollBack(); + void notify(); + }; + class PickelizedPyObjServer; class TransactionDictModify : public Transaction