]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
In SDS add killVar transaction.
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 29 Oct 2015 18:34:07 +0000 (19:34 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 29 Oct 2015 18:34:07 +0000 (19:34 +0100)
idl/SALOME_SDS.idl
src/SALOMESDS/SALOMESDS_DataScopeServer.cxx
src/SALOMESDS/SALOMESDS_DataScopeServer.hxx
src/SALOMESDS/SALOMESDS_Transaction.cxx
src/SALOMESDS/SALOMESDS_Transaction.hxx

index 43b5e25141dd6b7249c00d66e987d804c093ba7f..4e1f5621abb71cf274cd5c25f5faf2bb0b39dbb6 100644 (file)
@@ -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);
index 9d1fe0df89919f6854523210df513f3a9a4b2028..409fdf623b67b4e845d19854020fb6f562c5cd36 100644 (file)
@@ -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));
index bdca97cf85ba39a81bd832ee17c98a636bfe0de4..eafc2900aa01b0b015f0a009f9f596bb6e034682 100644 (file)
@@ -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);
index 6b4577cfab09fb0fce42bba60d7359ef88971273..445623f8c9d5f48d7f88ab513a19aa4fb46fe1c4 100644 (file)
@@ -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();
index c58ccd9294af5d873328a5c2fbdd3e49e213d948..bc94d9f78b346db4cd0ee9345396a22eebd10104 100644 (file)
@@ -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