IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
IBR-DTNSuite
Namespaces
Classes
Files
File List
daemon
ibrcommon
ibrdtn
ibrdtn
api
data
AdministrativeBlock.cpp
AdministrativeBlock.h
AgeBlock.cpp
AgeBlock.h
Block.cpp
Block.h
Bundle.cpp
Bundle.h
BundleBuilder.cpp
BundleBuilder.h
BundleFragment.cpp
BundleFragment.h
BundleID.cpp
BundleID.h
BundleList.cpp
BundleList.h
BundleMerger.cpp
BundleMerger.h
BundleSet.cpp
BundleSet.h
BundleSetImpl.cpp
BundleSetImpl.h
BundleString.cpp
BundleString.h
CompressedPayloadBlock.cpp
CompressedPayloadBlock.h
CustodySignalBlock.cpp
CustodySignalBlock.h
Dictionary.cpp
Dictionary.h
DTNTime.cpp
DTNTime.h
EID.cpp
EID.h
Endianess.cpp
Endianess.h
Exceptions.h
ExtensionBlock.cpp
ExtensionBlock.h
MemoryBundleSet.cpp
MemoryBundleSet.h
MetaBundle.cpp
MetaBundle.h
Number.h
PayloadBlock.cpp
PayloadBlock.h
PrimaryBlock.cpp
PrimaryBlock.h
SchedulingBlock.cpp
SchedulingBlock.h
ScopeControlHopLimitBlock.cpp
ScopeControlHopLimitBlock.h
SDNV.cpp
SDNV.h
Serializer.cpp
Serializer.h
StatusReportBlock.cpp
StatusReportBlock.h
StreamBlock.cpp
StreamBlock.h
TrackingBlock.cpp
TrackingBlock.h
security
streams
utils
config.h
dummy.cpp
ibrdtn.h
tools
File Members
MemoryBundleSet.h
Go to the documentation of this file.
1
/*
2
* MemoryBundleSet.h
3
*
4
* Copyright (C) 2013 IBR, TU Braunschweig
5
*
6
* Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*
20
* Created on: 18.12.2012
21
* renamed from BundleSet.h 04.04.2013
22
*/
23
24
#ifndef MEMORYBUNDLESET_H_
25
#define MEMORYBUNDLESET_H_
26
27
#include "
ibrdtn/data/BundleSetImpl.h
"
28
#include "
ibrdtn/data/BundleSet.h
"
29
#include "
ibrdtn/data/MetaBundle.h
"
30
#include <
ibrcommon/data/BloomFilter.h
>
31
#include <
ibrcommon/data/File.h
>
32
#include <set>
33
34
namespace
dtn
35
{
36
namespace
data
37
{
38
class
MemoryBundleSet
:
public
BundleSetImpl
39
{
40
public
:
46
MemoryBundleSet
(
BundleSet::Listener
*listener = NULL,
Length
bf_size = 1024);
47
54
MemoryBundleSet
(
const
std::string &name,
BundleSet::Listener
*listener = NULL,
Length
bf_size = 1024);
55
59
virtual
~MemoryBundleSet
();
60
64
virtual
refcnt_ptr<BundleSetImpl>
copy
()
const
;
65
70
virtual
void
assign
(
const
refcnt_ptr<BundleSetImpl>
&);
71
75
virtual
void
add
(
const
dtn::data::MetaBundle
&bundle)
throw
();
76
80
virtual
void
clear
()
throw
();
81
85
virtual
bool
has
(
const
dtn::data::BundleID
&bundle)
const
throw
();
86
90
virtual
void
expire
(
const
Timestamp
timestamp)
throw
();
91
95
virtual
Size
size
()
const
throw
();
96
100
Length
getLength
()
const
throw
();
101
105
const
ibrcommon::BloomFilter
&
getBloomFilter
()
const
throw
();
106
110
std::set<dtn::data::MetaBundle>
getNotIn
(
const
ibrcommon::BloomFilter
&filter)
const
throw
();
111
115
virtual
std::ostream &
serialize
(std::ostream &stream)
const
;
116
120
virtual
std::istream &
deserialize
(std::istream &stream);
121
125
static
void
setPath
(
const
ibrcommon::File
&path);
126
130
virtual
void
sync
()
throw
();
131
132
private
:
136
void
store();
137
141
void
restore();
142
143
// If this is a named bundle-set the name is stored here
144
const
std::string _name;
145
146
// All meta-bundles are stored in this set of bundles
147
typedef
std::set<dtn::data::MetaBundle> bundle_set;
148
bundle_set _bundles;
149
150
// Bundles are sorted in this set to find expired bundles easily
151
typedef
std::set<BundleSetImpl::ExpiringBundle> expire_set;
152
expire_set _expire;
153
154
// The initial size of the bloom-filter
155
Length
_bf_size;
156
157
// The bloom-filter with all the bundles
158
ibrcommon::BloomFilter
_bf;
159
160
// The assigned listener
161
BundleSet::Listener
*_listener;
162
163
// Mark the bloom-filter and set of bundles as consistent
164
bool
_consistent;
165
166
static
ibrcommon::File
__store_path__;
167
static
bool
__store_path_set__;
168
};
169
}
/* namespace data */
170
}
/* namespace dtn */
171
#endif
/* MEMORYBUNDLESET_H_ */
ibrdtn
ibrdtn
data
MemoryBundleSet.h
Generated on Thu Mar 27 2014 09:26:21 for IBR-DTNSuite by
1.8.4