00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _BUNDLEINFOCACHE_H_
00018 #define _BUNDLEINFOCACHE_H_
00019
00020 #include <oasys/debug/Logger.h>
00021 #include <oasys/util/Cache.h>
00022 #include <oasys/util/CacheCapacityHelper.h>
00023 #include "Bundle.h"
00024 #include "GbofId.h"
00025
00026 namespace dtn {
00027
00033 class BundleInfoCache {
00034 public:
00039 BundleInfoCache(const std::string& logpath, size_t capacity);
00040
00045 bool add_entry(const Bundle* bundle, const EndpointID& prevhop);
00046
00051 bool lookup(const Bundle* bundle, EndpointID* prevhop);
00052
00056 void evict_all();
00057
00058 protected:
00059 typedef oasys::CacheCapacityHelper<GbofId, EndpointID> CacheCapacityHelper;
00060 typedef oasys::Cache<GbofId, EndpointID, CacheCapacityHelper> Cache;
00061 Cache cache_;
00062 };
00063
00064 }
00065
00066
00067 #endif