IBR-DTNSuite  0.8
daemon/src/core/BundleEvent.h
Go to the documentation of this file.
00001 /*
00002  * BundleEvent.h
00003  *
00004  *  Created on: 06.03.2009
00005  *      Author: morgenro
00006  */
00007 
00008 #ifndef BUNDLEEVENT_H_
00009 #define BUNDLEEVENT_H_
00010 
00011 #include <string>
00012 #include "ibrdtn/data/Bundle.h"
00013 #include "ibrdtn/data/MetaBundle.h"
00014 #include "core/Event.h"
00015 #include "ibrdtn/data/StatusReportBlock.h"
00016 
00017 namespace dtn
00018 {
00019         namespace core
00020         {
00021                 enum EventBundleAction
00022                 {
00023                         BUNDLE_DELETED = 0,
00024                         BUNDLE_CUSTODY_ACCEPTED = 1,
00025                         BUNDLE_FORWARDED = 2,
00026                         BUNDLE_DELIVERED = 3,
00027                         BUNDLE_RECEIVED = 4,
00028                         BUNDLE_STORED = 5
00029                 };
00030 
00031                 class BundleEvent : public Event
00032                 {
00033                 public:
00034                         virtual ~BundleEvent();
00035 
00036                         dtn::data::StatusReportBlock::REASON_CODE getReason() const;
00037                         EventBundleAction getAction() const;
00038                         const dtn::data::MetaBundle& getBundle() const;
00039                         const std::string getName() const;
00040                         
00041                         std::string toString() const;
00042 
00043                         static void raise(const dtn::data::MetaBundle &bundle, EventBundleAction action, dtn::data::StatusReportBlock::REASON_CODE reason = dtn::data::StatusReportBlock::NO_ADDITIONAL_INFORMATION);
00044 
00045                         static const std::string className;
00046 
00047                 private:
00048                         BundleEvent(const dtn::data::MetaBundle &bundle, EventBundleAction action, dtn::data::StatusReportBlock::REASON_CODE reason = dtn::data::StatusReportBlock::NO_ADDITIONAL_INFORMATION);
00049                         const dtn::data::MetaBundle m_bundle;
00050                         EventBundleAction m_action;
00051                         dtn::data::StatusReportBlock::REASON_CODE m_reason;
00052                 };
00053         }
00054 }
00055 
00056 #endif /* BUNDLEEVENT_H_ */