// 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.
classdataCache{
classdataCache{
friendclassdataCacheMap;
friendclassdataCacheMap;
// 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 :
inlinevoid_invalidateDependencies()
inlinevoid_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