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

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