source: XIOS/dev/dev_olga/src/filter/garbage_collector.cpp @ 1653

Last change on this file since 1653 was 1653, checked in by oabramkina, 5 years ago

Developments for visualization of XIOS workflow.

Branch is spawned from trunk r1649.

Boost library is used for producing Graphviz DOT files. Current results: a DOT file representing a static workflow. For a complete proof of concept, DOT files for each timestamp should be generated. The necessary information has been collected by XIOS, it only requires rearranging the information for graphing (changes in classes CWorkflowGraph and CGraphviz).

File size: 1.1 KB
Line 
1#include "garbage_collector.hpp"
2
3namespace xios
4{
5
6  int InvalidableObject::count = 0;
7 
8  void CGarbageCollector::registerObject(InvalidableObject* Object, Time timestamp)
9  {
10    registeredObjects[timestamp].insert(Object);
11  }
12
13  void CGarbageCollector::unregisterObject(InvalidableObject* Object, Time timestamp)
14  {
15    std::map<Time, std::set<InvalidableObject*> >::iterator it = registeredObjects.find(timestamp);
16    if (it != registeredObjects.end())
17      it->second.erase(Object);
18  }
19
20  void CGarbageCollector::invalidate(Time timestamp)
21  {
22    std::map<Time, std::set<InvalidableObject*> >::iterator it    = registeredObjects.begin(),
23                                                            itEnd = registeredObjects.lower_bound(timestamp);
24    for (; it != itEnd; ++it)
25    {
26      std::set<InvalidableObject*>::iterator itObject    = it->second.begin(),
27                                             itObjectEnd = it->second.end();
28      for (; itObject != itObjectEnd; ++itObject)
29        (*itObject)->invalidate(timestamp);
30    }
31    registeredObjects.erase(registeredObjects.begin(), itEnd);
32  }
33} // namespace xios
Note: See TracBrowser for help on using the repository browser.