Remove warnings
[anna.git] / include / anna / comm / SureTransport.hpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #ifndef anna_comm_SureTransport_hpp
10 #define anna_comm_SureTransport_hpp
11
12 #include <anna/core/RuntimeException.hpp>
13 #include <anna/core/DataBlock.hpp>
14
15 #include <anna/comm/Transport.hpp>
16 #include <anna/comm/TransportFactoryImpl.hpp>
17
18 namespace anna {
19
20 namespace comm {
21
22 class Communicator;
23
24 /**
25    Class to define main transport layer: message analysis received from any source. Protocol
26    knows about message semantics when this message is completed: the main problem is find
27    out the size.
28 */
29 class SureTransport : public Transport {
30 public:
31   /**
32      Destructor.
33   */
34   virtual ~SureTransport();
35
36   /**
37     Class name literal
38     \return Class name literal
39   */
40   static const char* className() throw() { return "anna::comm::SureTransport"; }
41
42   /**
43     Returns the transport layer manager associated to this class.
44     \return transport layer manager associated to this class.
45   */
46   static TransportFactory& getFactory() throw() { return st_transportFactory; }
47
48 protected:
49   static const short int headerSize = (sizeof(short int) + sizeof(int));
50   static const short int initTag = 0xaaaa;
51   static TransportFactoryImpl <SureTransport> st_transportFactory;
52
53   /**
54      Constructor.
55   */
56   SureTransport();
57
58 private:
59   DataBlock a_precodec;
60
61   int calculeSize(const DataBlock& dataBlock) throw(RuntimeException);
62   const Message* decode(const DataBlock& message) throw(RuntimeException);
63   virtual const DataBlock& code(Message&) throw(RuntimeException);
64
65   friend class anna::Allocator <SureTransport>;
66 };
67
68 }
69 }
70
71 #endif