{
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:
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);
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();
}