IBR-DTNSuite  0.8
daemon/src/routing/SummaryVector.h
Go to the documentation of this file.
00001 /*
00002  * SummaryVector.h
00003  *
00004  *  Created on: 02.03.2010
00005  *      Author: morgenro
00006  */
00007 
00008 #ifndef SUMMARYVECTOR_H_
00009 #define SUMMARYVECTOR_H_
00010 
00011 #include <ibrdtn/data/BundleID.h>
00012 #include <ibrdtn/data/MetaBundle.h>
00013 #include <ibrdtn/data/BundleString.h>
00014 #include <ibrcommon/data/BloomFilter.h>
00015 #include <iostream>
00016 #include <set>
00017 
00018 namespace dtn
00019 {
00020         namespace routing
00021         {
00022                 class SummaryVector
00023                 {
00024                 public:
00025                         SummaryVector(const std::set<dtn::data::MetaBundle> &list);
00026                         SummaryVector();
00027                         virtual ~SummaryVector();
00028 
00029                         virtual void commit();
00030                         virtual bool contains(const dtn::data::BundleID &id) const;
00031                         virtual void add(const dtn::data::BundleID &id);
00032                         virtual void remove(const dtn::data::BundleID &id);
00033 
00034                         virtual void clear();
00035                         virtual void add(const std::set<dtn::data::MetaBundle> &list);
00036 
00037                         size_t getLength() const;
00038 
00039                         const ibrcommon::BloomFilter& getBloomFilter() const;
00040 
00041                         std::set<dtn::data::BundleID> getNotIn(ibrcommon::BloomFilter &filter) const;
00042 
00043                         friend std::ostream &operator<<(std::ostream &stream, const SummaryVector &obj);
00044                         friend std::istream &operator>>(std::istream &stream, SummaryVector &obj);
00045 
00046                 private:
00047                         std::set<dtn::data::BundleID> _ids;
00048                         ibrcommon::BloomFilter _bf;
00049                 };
00050         }
00051 }
00052 
00053 
00054 #endif /* SUMMARYVECTOR_H_ */