Skip to content
Snippets Groups Projects
Commit cf2974e2 authored by Éric Béchet's avatar Éric Béchet
Browse files

Cosmetic change.

parent 2cb2b3db
Branches
No related tags found
No related merge requests found
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
void dataCache::addMeAsDependencyOf (dataCache *newDep) void dataCache::addMeAsDependencyOf (dataCache *newDep)
{ {
_dependOnMe.insert(&newDep->_valid); _dependOnMe.insert(newDep);
newDep->_iDependOn.insert(this); newDep->_iDependOn.insert(this);
for(std::set<dataCache*>::iterator it = _iDependOn.begin(); for(std::set<dataCache*>::iterator it = _iDependOn.begin();
it != _iDependOn.end(); it++) { it != _iDependOn.end(); it++) {
(*it)->_dependOnMe.insert(&newDep->_valid); (*it)->_dependOnMe.insert(newDep);
newDep->_iDependOn.insert(*it); newDep->_iDependOn.insert(*it);
} }
} }
......
...@@ -30,8 +30,8 @@ class binding; ...@@ -30,8 +30,8 @@ class binding;
// a node in the dependency tree. The usefull field is _dependOnMe which is the set of every other nodes that depend on me. When the value of this node change all nodes depending on this one are marked as "invalid" and will be recomputed the next time their data are accessed. To be able to maintain _dependOnMe up to date when a new node is inserted in the tree, we need _iDependOn list. So we do not really store a tree but instead each node contain a complete list of all it's parents and all it's children (and the parents of the parents of ... of its parents and the children of the children of ... of it's children). This way invalidate all the dependencies of a node is really fast and does not involve a complex walk accross the tree structure. // a node in the dependency tree. The usefull field is _dependOnMe which is the set of every other nodes that depend on me. When the value of this node change all nodes depending on this one are marked as "invalid" and will be recomputed the next time their data are accessed. To be able to maintain _dependOnMe up to date when a new node is inserted in the tree, we need _iDependOn list. So we do not really store a tree but instead each node contain a complete list of all it's parents and all it's children (and the parents of the parents of ... of its parents and the children of the children of ... of it's children). This way invalidate all the dependencies of a node is really fast and does not involve a complex walk accross the tree structure.
class dataCache { class dataCache {
friend class dataCacheMap; friend class dataCacheMap;
// pointers to the "_valid" flag of all dataCache depending on me // pointers to all of the dataCache depending on me
std::set<bool*> _dependOnMe; std::set<dataCache*> _dependOnMe;
std::set<dataCache*> _iDependOn; std::set<dataCache*> _iDependOn;
protected : protected :
bool _valid; bool _valid;
...@@ -39,9 +39,9 @@ protected : ...@@ -39,9 +39,9 @@ protected :
inline void _invalidateDependencies() inline void _invalidateDependencies()
{ {
// if this is too slow we can keep a C array cache of the _dependOnMe set // if this is too slow we can keep a C array cache of the _dependOnMe set
for(std::set<bool*>::iterator it = _dependOnMe.begin(); for(std::set<dataCache*>::iterator it = _dependOnMe.begin();
it!=_dependOnMe.end(); it++) it!=_dependOnMe.end(); it++)
**it=false; (*it)->_valid=false;
} }
dataCache() : _valid(false) {} dataCache() : _valid(false) {}
virtual ~dataCache(){}; virtual ~dataCache(){};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment