• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

daemon/src/core/AbstractWorker.h

Go to the documentation of this file.
00001 #ifndef ABSTRACTWORKER_H_
00002 #define ABSTRACTWORKER_H_
00003 
00004 #include <ibrdtn/data/Bundle.h>
00005 #include <ibrdtn/data/BundleID.h>
00006 #include <ibrdtn/data/EID.h>
00007 #include "core/EventReceiver.h"
00008 #include <ibrcommon/thread/Mutex.h>
00009 #include <ibrcommon/thread/Conditional.h>
00010 #include <ibrcommon/thread/Thread.h>
00011 #include "net/ConvergenceLayer.h"
00012 
00013 #include <ibrcommon/thread/Queue.h>
00014 
00015 using namespace dtn::data;
00016 
00017 namespace dtn
00018 {
00019         namespace core
00020         {
00021                 class AbstractWorker : public ibrcommon::Mutex
00022                 {
00023                         class AbstractWorkerAsync : public ibrcommon::JoinableThread, public dtn::core::EventReceiver
00024                         {
00025                         public:
00026                                 AbstractWorkerAsync(AbstractWorker &worker);
00027                                 virtual ~AbstractWorkerAsync();
00028                                 void shutdown();
00029 
00030                                 virtual void raiseEvent(const dtn::core::Event *evt);
00031 
00032                         protected:
00033                                 void run();
00034                                 bool __cancellation();
00035 
00036                         private:
00037                                 AbstractWorker &_worker;
00038                                 bool _running;
00039 
00040                                 ibrcommon::Queue<dtn::data::BundleID> _receive_bundles;
00041                         };
00042 
00043                         public:
00044                                 AbstractWorker();
00045 
00046                                 virtual ~AbstractWorker();
00047 
00048                                 virtual const EID getWorkerURI() const;
00049 
00050                                 virtual void callbackBundleReceived(const Bundle &b) = 0;
00051 
00052                         protected:
00053                                 void initialize(const string uri, bool async = false);
00054                                 void transmit(const Bundle &bundle);
00055                                 //dtn::data::Bundle receive();
00056 
00057                                 EID _eid;
00058 
00059                                 void shutdown();
00060 
00061                         private:
00062                                 AbstractWorkerAsync _thread;
00063                 };
00064         }
00065 }
00066 
00067 #endif /*ABSTRACTWORKER_H_*/

Generated on Thu Nov 11 2010 09:49:46 for IBR-DTNSuite by  doxygen 1.7.1