00001 /* 00002 * BundleList.h 00003 * 00004 * Created on: 19.02.2010 00005 * Author: morgenro 00006 */ 00007 00008 #ifndef BUNDLELIST_H_ 00009 #define BUNDLELIST_H_ 00010 00011 #include <ibrdtn/data/MetaBundle.h> 00012 #include <set> 00013 00014 namespace dtn 00015 { 00016 namespace data 00017 { 00018 class BundleList : public std::set<dtn::data::MetaBundle> 00019 { 00020 public: 00021 BundleList(); 00022 ~BundleList(); 00023 00024 virtual void add(const dtn::data::MetaBundle bundle); 00025 virtual void remove(const dtn::data::MetaBundle bundle); 00026 virtual void clear(); 00027 00028 void expire(const size_t timestamp); 00029 00030 protected: 00031 class ExpiringBundle 00032 { 00033 public: 00034 ExpiringBundle(const MetaBundle b); 00035 ~ExpiringBundle(); 00036 00037 bool operator!=(const ExpiringBundle& other) const; 00038 bool operator==(const ExpiringBundle& other) const; 00039 bool operator<(const ExpiringBundle& other) const; 00040 bool operator>(const ExpiringBundle& other) const; 00041 00042 const MetaBundle bundle; 00043 const size_t expiretime; 00044 }; 00045 00046 virtual void eventBundleExpired(const ExpiringBundle&) {}; 00047 00048 std::set<ExpiringBundle> _bundles; 00049 }; 00050 00051 } 00052 } 00053 00054 #endif /* BUNDLELIST_H_ */
1.6.3