RTFX  0.3
Real time special effects collaborative visualization and production library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
RTFXSession.h
1 #ifndef __RTFX_SESSION__
2 #define __RTFX_SESSION__
3 
4 #pragma warning(disable: 4996)
5 
15 #include <boost/bind.hpp>
16 #include <boost/shared_ptr.hpp>
17 #include <boost/enable_shared_from_this.hpp>
18 #include <boost/asio.hpp>
19 
20 #include "RTFXParticipant.h"
21 #include "RTFXPostOffice.h"
22 #include "RTFXDebug.h"
23 
24 using boost::asio::ip::tcp;
25 
26 namespace RTFX
27 {
31  class RTFXAPI RTFXSession : public RTFXParticipant, public boost::enable_shared_from_this<RTFXSession>
32  {
33  public:
34 
36  RTFXSession( boost::asio::io_service &_ioService, RTFXPostOffice &_postOffice );
37 
39  tcp::socket& Socket();
40 
42  void Start();
43 
45  void Deliver( const RTFXParcel &_parcel );
46 
48  void HandleReadHeader( const boost::system::error_code &_error );
49 
51  void HandleReadBody( const boost::system::error_code &_error );
52 
54  void HandleWrite( const boost:: system::error_code &_error );
55 
57  void SetOwnerID( boost::uuids::uuid _id )
58  {
59  ownerID = _id;
60  }
61 
63  boost::uuids::uuid GetOwnerID()
64  {
65  return ownerID;
66  }
67 
69  void SetP2P( bool _isP2P )
70  {
71  isP2P = _isP2P;
72  }
73 
75  bool GetP2P()
76  {
77  return isP2P;
78  }
79 
80  private:
84  bool isP2P;
85 
87  boost::uuids::uuid ownerID;
88 
90  tcp::socket socket;
91 
94 
97 
100  };
101 }
102 
103 #endif