00001 /* 00002 * BundleStorage.h 00003 * 00004 * Created on: 24.03.2009 00005 * Author: morgenro 00006 */ 00007 00008 #ifndef BUNDLESTORAGE_H_ 00009 #define BUNDLESTORAGE_H_ 00010 00011 #include <ibrdtn/data/Bundle.h> 00012 #include <ibrdtn/data/BundleID.h> 00013 #include <ibrcommon/data/BloomFilter.h> 00014 00015 #include <stdexcept> 00016 #include <iterator> 00017 00018 namespace dtn 00019 { 00020 namespace core 00021 { 00022 class BundleStorage 00023 { 00024 public: 00025 class NoBundleFoundException : public dtn::MissingObjectException 00026 { 00027 public: 00028 NoBundleFoundException(string what = "No bundle match the specified criteria.") throw() : dtn::MissingObjectException(what) 00029 { 00030 }; 00031 }; 00032 00033 class StorageSizeExeededException : public ibrcommon::Exception 00034 { 00035 public: 00036 StorageSizeExeededException(string what = "No space left in the storage.") throw() : ibrcommon::Exception(what) 00037 { 00038 }; 00039 }; 00040 00044 virtual ~BundleStorage() = 0; 00045 00050 virtual void store(const dtn::data::Bundle &bundle) = 0; 00051 00057 virtual dtn::data::Bundle get(const ibrcommon::BloomFilter &filter) = 0; 00058 00065 virtual dtn::data::Bundle get(const dtn::data::BundleID &id) = 0; 00066 00072 virtual dtn::data::Bundle get(const dtn::data::EID &eid) = 0; 00073 00079 virtual void remove(const dtn::data::BundleID &id) = 0; 00080 00086 void remove(const dtn::data::Bundle &b); 00087 00091 virtual void clear() {}; 00092 00096 virtual bool empty() { return true; }; 00097 00101 virtual unsigned int count() { return 0; }; 00102 00108 virtual void releaseCustody(dtn::data::BundleID &bundle) = 0; 00109 00116 void acceptCustody(dtn::data::Bundle &bundle); 00117 00123 void rejectCustody(const dtn::data::Bundle &bundle); 00124 00125 protected: 00129 BundleStorage(); 00130 }; 00131 } 00132 } 00133 00134 #endif /* BUNDLESTORAGE_H_ */
1.6.3