Last change
on this file since 2321 was
1021,
checked in by oabramkina, 8 years ago
|
Intermeadiate version for merging with new server functionalities.
|
File size:
1.1 KB
|
Line | |
---|
1 | #include "garbage_collector.hpp" |
---|
2 | |
---|
3 | namespace xios |
---|
4 | { |
---|
5 | void CGarbageCollector::registerObject(InvalidableObject* Object, Time timestamp) |
---|
6 | { |
---|
7 | registeredObjects[timestamp].insert(Object); |
---|
8 | } |
---|
9 | |
---|
10 | void CGarbageCollector::unregisterObject(InvalidableObject* Object, Time timestamp) |
---|
11 | { |
---|
12 | std::map<Time, std::set<InvalidableObject*> >::iterator it = registeredObjects.find(timestamp); |
---|
13 | if (it != registeredObjects.end()) |
---|
14 | it->second.erase(Object); |
---|
15 | } |
---|
16 | |
---|
17 | void CGarbageCollector::invalidate(Time timestamp) |
---|
18 | { |
---|
19 | std::map<Time, std::set<InvalidableObject*> >::iterator it = registeredObjects.begin(), |
---|
20 | itEnd = registeredObjects.lower_bound(timestamp); |
---|
21 | for (; it != itEnd; ++it) |
---|
22 | { |
---|
23 | std::set<InvalidableObject*>::iterator itObject = it->second.begin(), |
---|
24 | itObjectEnd = it->second.end(); |
---|
25 | for (; itObject != itObjectEnd; ++itObject) |
---|
26 | (*itObject)->invalidate(timestamp); |
---|
27 | } |
---|
28 | registeredObjects.erase(registeredObjects.begin(), itEnd); |
---|
29 | } |
---|
30 | } // namespace xios |
---|
Note: See
TracBrowser
for help on using the repository browser.