sender.h

Go to the documentation of this file.
00001 /*
00002  * sender.h
00003  *
00004  *  Created on: Jan 10, 2012
00005  *      Author: sushil
00006  */
00007 
00008 #ifndef SENDER_H_
00009 #define SENDER_H_
00010 
00011 #include <boost/asio.hpp>
00012 #include <boost/thread.hpp>
00013 using boost::asio::ip::udp;
00014 
00015 #include <deque>
00016 
00017 #include <messages.h>
00018 
00019 namespace FastEcslent {
00020 
00021         class Engine;
00022 
00023         class Sender { //receive update
00024         private:
00025 
00026                 boost::thread senderThread;
00027                 udp::socket   *socket;//(netService);
00028                 udp::endpoint myIP;;
00029                 int           port;
00030                 bool          isServer;
00031                 void runThread();
00032                 bool quit;
00033 
00034                 boost::posix_time::milliseconds *sleepTime;
00035                 boost::mutex                     quitLock;
00036                 // helpers
00037 
00038                 //ThreadTester *gimPtr;
00039 
00040         public:
00041                 std::deque<Message *> sendBuffer;
00042                 Sender(udp::endpoint ip, int prt, bool isserv){
00043                         myIP = ip;
00044                         port = prt;
00045                         isServer = isserv;
00046                 }
00047                 void init();
00048                 void run();
00049                 void join();
00050                 void stop();
00051                 void kill();
00052 
00053                 //helpers
00054                 //threadsafe helpers
00055                 void addMessage(Message *);
00056                 Message* dequeMessage();
00057         };
00058 
00059 }
00060 
00061 #endif /* SENDER_H_ */

Generated on Fri Dec 13 14:54:16 2013 for FastECSLent by  doxygen 1.5.4