Remove warnings
[anna.git] / include / anna / comm / LiteTransport.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_LiteTransport_hpp
10 #define anna_comm_LiteTransport_hpp
11
12 #include <anna/comm/Transport.hpp>
13 #include <anna/comm/TransportFactory.hpp>
14 #include <anna/comm/TransportFactoryImpl.hpp>
15
16 namespace anna {
17
18 namespace comm {
19
20 /**
21   Protocol oriented to internal network messages interchange, supposing no errors in transmision and short-sized
22   messages which allows length representation in only two bytes. No synchronization mechanisms are provided, then
23   a single error could cause problems in our process.
24
25   @warning Encode mode does not provide enough information to allow re-synchronization in case of error
26
27   \see Transport.
28 */
29 class LiteTransport : public comm::Transport {
30 public:
31   static const int headerSize = sizeof(short int);  /**< Tamao de la cabezera del mensaje */
32
33   /**
34     Destructor.
35   */
36   virtual ~LiteTransport();
37
38   /**
39     Returns the class name literal.
40     @return class name literal.
41   */
42   static const char* className() throw() { return "anna::comm::LiteTransport"; }
43
44   /**
45     Returns the transport factory associated to this class
46     @return transport factory associated to this class
47   */
48   static TransportFactory& getFactory() throw() { return st_transportFactory; }
49
50 private:
51   static TransportFactoryImpl <LiteTransport> st_transportFactory;
52
53   LiteTransport();
54
55   int calculeSize(const DataBlock&) throw(RuntimeException);
56   const Message* decode(const DataBlock&) throw(RuntimeException);
57   const DataBlock& code(Message&) throw(RuntimeException);
58
59   friend class anna::Allocator <LiteTransport>;
60 };
61
62 }
63 }
64 #endif
65