]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Last commit before refactoring.
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 13 Jul 2015 06:57:00 +0000 (08:57 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 13 Jul 2015 06:57:00 +0000 (08:57 +0200)
src/SALOMESDS/SALOMESDS_Transaction.hxx
src/SALOMESDS/SALOMESDS_TransactionFactory.cxx

index 8d1bfee4b5511d1e2f33e5afff4d903474f690e2..446803d5d27c9744097b14ba9b77c13c5f8d0450 100644 (file)
@@ -37,6 +37,8 @@ namespace SALOMESDS
   {
   public:
     Transaction(TransactionFactory *tf, const std::string& varName, const std::string& scopeName):_tf(tf),_var_name(varName),_scope_name(scopeName) { }
+    std::string getScopeName() const { return _scope_name; }
+    std::string getVarName() const { return _var_name; }
     virtual void checkAliveAndKicking();
     virtual void prepareRollBackInCaseOfFailure() = 0;
   public:
index 3c97b447a40ad4589ede072ff685702dd5045d8a..01a581e36c31cae2505e481d67bbda35701264a7 100644 (file)
@@ -59,7 +59,9 @@ SALOME::Transaction_ptr TransactionFactory::createRdOnlyVar(const char *varName,
 void TransactionFactory::atomicApply(const SALOME::ListOfTransaction& transactions)
 {
   std::size_t sz(transactions.length());
-  std::vector< AutoServantPtr<Transaction> > transactionsCpp;
+  if(sz==0)
+    return ;
+  std::vector< AutoServantPtr<Transaction> > transactionsCpp(sz);
   for(std::size_t i=0;i<sz;i++)
     {
       PortableServer::ServantBase *eltBase(0);
@@ -83,6 +85,10 @@ void TransactionFactory::atomicApply(const SALOME::ListOfTransaction& transactio
       transactionsCpp[i]=elt;
       transactionsCpp[i].setHolder(this);
     }
+  std::string scopeName(transactionsCpp[0]->getScopeName());
+  for(std::size_t i=0;i<sz;i++)
+    if(transactionsCpp[i]->getScopeName()!=scopeName)
+      throw Exception("TransactionFactory::atomicApply : all transactions must refer the same scope !");
   for(std::size_t i=0;i<sz;i++)
     transactionsCpp[i]->checkAliveAndKicking();
 }