Salome HOME
updated copyright message
[modules/kernel.git] / src / SALOMESDS / SALOMESDS_Transaction.hxx
index c7fced70e0acedb42b34165b688d7742904156f4..7f4499613a9669e9cc9da6136b0537fe2d496855 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023  CEA, EDF, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -27,6 +27,7 @@
 #include "SALOMESDS_Defines.hxx"
 #include "SALOMESDS_Exception.hxx"
 #include "SALOMESDS_DataServerManager.hxx"
+#include "SALOMESDS_Auto.hxx"
 
 #include <string>
 #include <vector>
@@ -62,9 +63,9 @@ namespace SALOMESDS
   {
   public:
     TransactionVarCreate(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& constValue);
-    void prepareRollBackInCaseOfFailure();
-    void rollBack();
-    void notify();
+    void prepareRollBackInCaseOfFailure() override;
+    void rollBack() override;
+    void notify() override;
   protected:
     std::vector<unsigned char> _data;
   };
@@ -80,31 +81,44 @@ namespace SALOMESDS
   {
   public:
     TransactionRdExtVarCreate(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& constValue):TransactionVarCreate(dsct,varName,constValue) { }
-    void perform();
+    void perform() override;
+  };
+
+  class TransactionRdExtVarFreeStyleCreate : public TransactionRdExtVarCreate
+  {
+  public:
+    TransactionRdExtVarFreeStyleCreate(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& constValue, const char *compareFuncContent);
+    void prepareRollBackInCaseOfFailure() override;
+    void rollBack() override;
+    void perform() override;
+  protected:
+    bool _null_rollback = false;
+    std::string _cmp_func_content;
+    SALOME::AutoPyRef _cmp_func;
   };
 
   class TransactionRdExtInitVarCreate : public TransactionVarCreate
   {
   public:
     TransactionRdExtInitVarCreate(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& constValue):TransactionVarCreate(dsct,varName,constValue) { }
-    void perform();
+    void perform() override;
   };
 
   class TransactionRdWrVarCreate : public TransactionVarCreate
   {
   public:
     TransactionRdWrVarCreate(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& constValue):TransactionVarCreate(dsct,varName,constValue) { }
-    void perform();
+    void perform() override;
   };
 
   class TransactionKillVar : public Transaction
   {
   public:
     TransactionKillVar(DataScopeServerTransaction *dsct, const std::string& varName);
-    void prepareRollBackInCaseOfFailure();
-    void perform();
-    void rollBack();
-    void notify();
+    void prepareRollBackInCaseOfFailure() override;
+    void perform() override;
+    void rollBack() override;
+    void notify() override;
   };
 
   class PickelizedPyObjServer;
@@ -114,8 +128,8 @@ namespace SALOMESDS
   public:
     TransactionDictModify(DataScopeServerTransaction *dsct, const std::string& varName);
     PickelizedPyObjServer *checkVarExistingAndDict() { return _dsct->checkVarExistingAndDict(_var_name); }
-    void prepareRollBackInCaseOfFailure();
-    void rollBack();
+    void prepareRollBackInCaseOfFailure() override;
+    void rollBack() override;
   protected:
     std::string _zeDataBefore;
     PickelizedPyObjServer *_varc;
@@ -125,8 +139,8 @@ namespace SALOMESDS
   {
   public:
     TransactionAddKeyValue(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& key, const SALOME::ByteVec& value);
-    void prepareRollBackInCaseOfFailure();
-    void notify();
+    void prepareRollBackInCaseOfFailure() override;
+    void notify() override;
     ~TransactionAddKeyValue();
   protected:
     PyObject *_key;
@@ -137,22 +151,22 @@ namespace SALOMESDS
   {
   public:
     TransactionAddKeyValueHard(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& key, const SALOME::ByteVec& value);
-    void perform();
+    void perform() override;
   };
 
   class TransactionAddKeyValueErrorIfAlreadyExisting : public TransactionAddKeyValue
   {
   public:
     TransactionAddKeyValueErrorIfAlreadyExisting(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& key, const SALOME::ByteVec& value);
-    void perform();
+    void perform() override;
   };
 
   class TransactionRemoveKeyInVarErrorIfNotAlreadyExisting : public TransactionDictModify
   {
   public:
     TransactionRemoveKeyInVarErrorIfNotAlreadyExisting(DataScopeServerTransaction *dsct, const std::string& varName, const SALOME::ByteVec& key);
-    void perform();
-    void notify();
+    void perform() override;
+    void notify() override;
     ~TransactionRemoveKeyInVarErrorIfNotAlreadyExisting();
   private:
     PyObject *_key;
@@ -166,9 +180,9 @@ namespace SALOMESDS
     SALOME::PickelizedPyObjRdWrServer_ptr getVar();
   public:
     void prepareRollBackInCaseOfFailure();
-    void perform();
-    void rollBack();
-    void notify();
+    void perform() override;
+    void rollBack() override;
+    void notify() override;
   };
 
   /*!
@@ -181,10 +195,10 @@ namespace SALOMESDS
   public://remotely callable
     void addKeyValueInVarErrorIfAlreadyExistingNow(const SALOME::ByteVec& key, const SALOME::ByteVec& value);
   public:
-    void prepareRollBackInCaseOfFailure();
-    void perform();
-    void rollBack();
-    void notify();
+    void prepareRollBackInCaseOfFailure() override;
+    void perform() override;
+    void rollBack() override;
+    void notify() override;
   };
 }