IBR-DTNSuite  0.10
AcknowledgementSet.h
Go to the documentation of this file.
1 /*
2  * AcknowledgementSet.h
3  *
4  * Created on: 11.01.2013
5  * Author: morgenro
6  */
7 
8 #ifndef ACKNOWLEDGEMENTSET_H_
9 #define ACKNOWLEDGEMENTSET_H_
10 
11 #include "routing/NodeHandshake.h"
12 #include <ibrdtn/data/BundleList.h>
13 #include <ibrcommon/thread/Mutex.h>
14 #include <iostream>
15 #include <set>
16 
17 namespace dtn
18 {
19  namespace routing
20  {
25  {
26  public:
29 
33  void add(const dtn::data::MetaBundle &bundle) throw ();
34 
38  void expire(const dtn::data::Timestamp &timestamp) throw ();
39 
43  void merge(const AcknowledgementSet&) throw ();
44 
48  bool has(const dtn::data::BundleID &id) const throw ();
49 
50  /* virtual methods from NodeHandshakeItem */
51  virtual const dtn::data::Number& getIdentifier() const;
52  virtual dtn::data::Length getLength() const;
53  virtual std::ostream& serialize(std::ostream& stream) const;
54  virtual std::istream& deserialize(std::istream& stream);
56 
57  friend std::ostream& operator<<(std::ostream&, const AcknowledgementSet&);
58  friend std::istream& operator>>(std::istream&, AcknowledgementSet&);
59 
61  const_iterator begin() const { return _bundles.begin(); };
62  const_iterator end() const { return _bundles.end(); };
63 
64  private:
65  dtn::data::BundleList _bundles;
66  };
67  } /* namespace routing */
68 } /* namespace dtn */
69 #endif /* ACKNOWLEDGEMENTSET_H_ */