IBR-DTNSuite  0.10
TrackingBlock.h
Go to the documentation of this file.
1 /*
2  * TrackingBlock.h
3  *
4  * Created on: 15.01.2013
5  * Author: morgenro
6  */
7 
8 #ifndef TRACKINGBLOCK_H_
9 #define TRACKINGBLOCK_H_
10 
11 #include <ibrdtn/data/Block.h>
12 #include <ibrdtn/data/Number.h>
13 #include <ibrdtn/data/DTNTime.h>
15 
16 namespace dtn
17 {
18  namespace data
19  {
21  {
22  public:
24  {
25  public:
27  virtual ~Factory() {};
28  virtual dtn::data::Block* create();
29  };
30 
32 
33  TrackingBlock();
34  virtual ~TrackingBlock();
35 
36  virtual Length getLength() const;
37  virtual std::ostream &serialize(std::ostream &stream, Length &length) const;
38  virtual std::istream &deserialize(std::istream &stream, const Length &length);
39 
40  virtual std::ostream &serialize_strict(std::ostream &stream, Length &length) const;
41  virtual Length getLength_strict() const;
42 
44  {
45  public:
46  enum Flags
47  {
50  };
51 
52  TrackingEntry();
53  TrackingEntry(const dtn::data::EID &eid);
55 
56  bool getFlag(Flags f) const;
57  void setFlag(Flags f, bool value);
58 
62 
63  friend std::ostream& operator<<(std::ostream &stream, const TrackingEntry &entry);
64  friend std::istream& operator>>(std::istream &stream, TrackingEntry &entry);
65 
66  Length getLength() const;
67  };
68 
69  typedef std::list<TrackingEntry> tracking_list;
70 
71  const tracking_list& getTrack() const;
72 
73  void append(const dtn::data::EID &eid);
74 
75  private:
76  tracking_list _entries;
77  };
78 
82  static TrackingBlock::Factory __TrackingBlockFactory__;
83  } /* namespace data */
84 } /* namespace dtn */
85 #endif /* TRACKINGBLOCK_H_ */