IBR-DTNSuite  0.8
daemon/src/routing/BundleSummary.cpp
Go to the documentation of this file.
00001 /*
00002  * BundleList.cpp
00003  *
00004  *  Created on: 26.07.2010
00005  *      Author: morgenro
00006  */
00007 
00008 #include "routing/BundleSummary.h"
00009 
00010 namespace dtn
00011 {
00012         namespace routing
00013         {
00014                 BundleSummary::BundleSummary()
00015                 {
00016                 }
00017 
00018                 BundleSummary::~BundleSummary()
00019                 {
00020                 }
00021 
00022                 void BundleSummary::add(const dtn::data::MetaBundle bundle)
00023                 {
00024                         _vector.add(bundle);
00025                         dtn::data::BundleList::add(bundle);
00026                 }
00027 
00028                 void BundleSummary::remove(const dtn::data::MetaBundle bundle)
00029                 {
00030                         _vector.remove(bundle);
00031                         dtn::data::BundleList::remove(bundle);
00032                 }
00033 
00034                 void BundleSummary::clear()
00035                 {
00036                         _vector.clear();
00037                         dtn::data::BundleList::clear();
00038                 }
00039 
00040                 void BundleSummary::eventBundleExpired(const ExpiringBundle &bundle)
00041                 {
00042                         _vector.remove(bundle.bundle);
00043                 }
00044 
00045                 void BundleSummary::eventCommitExpired()
00046                 {
00047                         _vector.commit();
00048                 }
00049 
00050                 bool BundleSummary::contains(const dtn::data::BundleID &bundle) const
00051                 {
00052                         // quick check
00053                         if (_vector.contains(bundle))
00054                         {
00055                                 // do a deeper inspection
00056                                 return dtn::data::BundleList::contains(bundle);
00057                         }
00058 
00059                         return false;
00060                 }
00061 
00062                 const SummaryVector& BundleSummary::getSummaryVector() const
00063                 {
00064                         return _vector;
00065                 }
00066         }
00067 }