19 : _bf(bf_size * 8), _listener(listener), _consistent(true)
30 pair<std::set<dtn::data::MetaBundle>::iterator,
bool> ret = _bundles.insert(bundle);
32 ExpiringBundle exb(*ret.first);
36 _bf.insert(bundle.toString());
50 if (_bf.contains(bundle.toString())) {
53 if (!_consistent)
return true;
56 return (iter != _bundles.end());
64 return _bundles.size();
72 if (timestamp == 0)
return;
74 std::set<ExpiringBundle>::iterator iter = _expire.begin();
76 while (iter != _expire.end())
78 const ExpiringBundle &b = (*iter);
80 if ( b.bundle.expiretime >= timestamp )
break;
83 if (_listener != NULL)
84 _listener->eventBundleExpired( b.bundle );
87 _bundles.erase( b.bundle );
90 _expire.erase( iter++ );
100 for (std::set<dtn::data::MetaBundle>::const_iterator iter = _bundles.begin(); iter != _bundles.end(); ++iter)
102 _bf.insert( (*iter).toString() );
114 std::set<dtn::data::MetaBundle> ret;
120 for (std::set<dtn::data::MetaBundle>::const_iterator iter = _bundles.begin(); iter != _bundles.end(); ++iter)
122 if (!filter.contains( (*iter).toString() ) )
124 ret.insert( (*iter) );
131 BundleSet::ExpiringBundle::ExpiringBundle(
const MetaBundle &b)
135 BundleSet::ExpiringBundle::~ExpiringBundle()
138 bool BundleSet::ExpiringBundle::operator!=(
const ExpiringBundle& other)
const
140 return !(other == *
this);
143 bool BundleSet::ExpiringBundle::operator==(
const ExpiringBundle& other)
const
145 return (other.bundle == this->bundle);
148 bool BundleSet::ExpiringBundle::operator<(
const ExpiringBundle& other)
const
150 if (bundle.expiretime < other.bundle.expiretime)
return true;
151 if (bundle.expiretime != other.bundle.expiretime)
return false;
153 if (bundle < other.bundle)
return true;
158 bool BundleSet::ExpiringBundle::operator>(
const ExpiringBundle& other)
const
160 return !(((*this) < other) || ((*
this) == other));
173 const char *data =
reinterpret_cast<const char*
>(obj._bf.
table());
174 stream.write(data, obj._bf.
size());
184 std::vector<char> buffer(count.get<
size_t>());
186 stream.read(&buffer[0], buffer.size());
189 obj._bf.
load((
unsigned char*)&buffer[0], buffer.size());
192 obj._consistent =
false;