IBR-DTNSuite  0.10
SchedulingBundleIndex.cpp
Go to the documentation of this file.
1 /*
2  * SchedulingBundleIndex.cpp
3  *
4  * Created on: 21.01.2013
5  * Author: morgenro
6  */
7 
9 
10 namespace dtn
11 {
12  namespace routing
13  {
15  {
16  }
17 
19  {
20  }
21 
23  {
24  _priority_index.insert(b);
25  }
26 
28  {
29  for (priority_index::const_iterator iter = _priority_index.begin(); iter != _priority_index.end(); ++iter)
30  {
31  const dtn::data::MetaBundle &b = (*iter);
32  if (id == (const dtn::data::BundleID&)b) {
33  _priority_index.erase(iter);
34  return;
35  }
36  }
37  }
38 
40  {
41  bool unlimited = (cb.limit() <= 0);
42  size_t added = 0;
43 
44  for (priority_index::const_iterator iter = _priority_index.begin(); iter != _priority_index.end(); ++iter)
45  {
46  const dtn::data::MetaBundle &b = (*iter);
47  if (cb.shouldAdd(b)) {
48  result.put(b);
49  added++;
50  }
51 
52  if (!unlimited && (added >= cb.limit())) break;
53  }
54 
55  if (added == 0)
57  }
58 
59  const std::set<dtn::data::EID> SchedulingBundleIndex::getDistinctDestinations()
60  {
61  std::set<dtn::data::EID> ret;
62  return ret;
63  }
64  } /* namespace routing */
65 } /* namespace dtn */