Skip to content
Snippets Groups Projects
Commit c4357fdc authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

better parameterSpace::setChanged(bool changed, client) behaviour:

- if no client is given, set the changed flag for all the parameters;
- if a client name is given and "changed" is false, affect only the
 parameters that are owned exclusively by the client;
- if "changed" is true, affect all parameters that depend on this client
parent 423a8b02
No related branches found
No related tags found
No related merge requests found
...@@ -100,6 +100,7 @@ namespace onelab{ ...@@ -100,6 +100,7 @@ namespace onelab{
{ {
return (_clients.find(client) != _clients.end()); return (_clients.find(client) != _clients.end());
} }
int getNumClients() { return (int)_clients.size(); };
virtual std::string getType() const = 0; virtual std::string getType() const = 0;
const std::string &getName() const { return _name; } const std::string &getName() const { return _name; }
const std::string &getLabel() const { return _label; } const std::string &getLabel() const { return _label; }
...@@ -769,15 +770,17 @@ namespace onelab{ ...@@ -769,15 +770,17 @@ namespace onelab{
} }
return false; return false;
} }
// set the changed flag for all parameters (optionnally only affect those // if no client name is given, set the changed flag for all the parameters;
// parameters that depend on a given client) // if a client name is given and "changed" is false, affect only the
// parameters that are owned exclusively by the client; if "changed" is
// true, affect all parameters that depend on this client
bool setChanged(bool changed, const std::string &client="") bool setChanged(bool changed, const std::string &client="")
{ {
std::set<parameter*, parameterLessThan> ps; std::set<parameter*, parameterLessThan> ps;
_getAllParameters(ps); _getAllParameters(ps);
for(std::set<parameter*, parameterLessThan>::iterator it = ps.begin(); for(std::set<parameter*, parameterLessThan>::iterator it = ps.begin();
it != ps.end(); it++) it != ps.end(); it++)
if(client.empty() || (*it)->hasClient(client)) if(client.empty() || ((*it)->hasClient(client) && (changed || (*it)->getNumClients() == 1)))
(*it)->setChanged(changed); (*it)->setChanged(changed);
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment