source: XIOS/trunk/src/filter/garbage_collector.cpp @ 1704

Last change on this file since 1704 was 1704, checked in by yushan, 5 years ago

Introducing the new graph functionality. Attribute build_workflow_graph=.TRUE. is used in the field definition section in the xml file to enable the workflow graph of the field and other fields referecing to it. A more detailed document will be available soon on the graph fuctionality.

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