IBR-DTNSuite  0.12
BundleSetImpl.h
Go to the documentation of this file.
1 /*
2  * BundleSetImpl.h
3  *
4  * Copyright (C) 2013 IBR, TU Braunschweig
5  *
6  * Written-by: David Goltzsche <goltzsch@ibr.cs.tu-bs.de>
7  * Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Created on: 04.04.2013
22  */
23 
24 #ifndef BUNDLESETIMPL_H_
25 #define BUNDLESETIMPL_H_
26 
27 #include "ibrdtn/data/MetaBundle.h"
29 #include <set>
30 
31 namespace dtn
32 {
33  namespace data
34  {
36  {
37  public:
41  virtual ~BundleSetImpl() = 0;
42 
46  virtual refcnt_ptr<BundleSetImpl> copy() const = 0;
47 
52  virtual void assign(const refcnt_ptr<BundleSetImpl>&) = 0;
53 
54  virtual void add(const dtn::data::MetaBundle &bundle) throw () = 0;
55  virtual void clear() throw () = 0;
56  virtual bool has(const dtn::data::BundleID &bundle) const throw () = 0;
57 
58  virtual void expire(const Timestamp timestamp) = 0;
59 
63  virtual Size size() const throw() = 0;
64 
68  virtual Length getLength() const throw () = 0;
69 
70  virtual const ibrcommon::BloomFilter& getBloomFilter() const throw() = 0;
71 
72  virtual std::set<dtn::data::MetaBundle> getNotIn(const ibrcommon::BloomFilter &filter) const throw () = 0;
73 
77  virtual void sync() throw () { };
78 
79  virtual std::ostream& serialize(std::ostream &stream) const = 0;
80  virtual std::istream& deserialize(std::istream &stream) = 0;
81 
82  protected:
84  {
85  public:
86  ExpiringBundle(const MetaBundle &b);
87  virtual ~ExpiringBundle();
88 
89  bool operator!=(const ExpiringBundle& other) const;
90  bool operator==(const ExpiringBundle& other) const;
91  bool operator<(const ExpiringBundle& other) const;
92  bool operator>(const ExpiringBundle& other) const;
93 
95  };
96  };
97  } /* namespace data */
98 } /* namespace dtn */
99 #endif /* BUNDLESETIMPL_H_ */