message.hpp
Go to the documentation of this file.
1 
6 /*****************************************************************************
7 ** Ifdefs
8 *****************************************************************************/
9 
10 #ifndef mm_messages_MESSAGES_HPP_
11 #define mm_messages_MESSAGES_HPP_
12 
13 /*****************************************************************************
14 ** Includes
15 *****************************************************************************/
16 
17 #include <ecl/containers.hpp>
18 #include <iostream>
19 #include <vector>
20 #include "exceptions.hpp"
21 
22 /*****************************************************************************
23 ** Namespaces
24 *****************************************************************************/
25 
26 namespace mm_messages {
27 
28 //typedef ecl::Array<unsigned char> ByteArray;
29 typedef std::vector<unsigned char> ByteArray;
33 
34 /*****************************************************************************
35 ** Interfaces
36 *****************************************************************************/
37 
45 template <typename T>
46 struct Message {
47  static void encode(const T& msg, ByteArray& buffer) {
48  throw FailedToFindMessageSpecialisation("Failed to find the specialisation to encode this message type, did you include the message header?");
49  }
50  static T decode(const unsigned char* buffer, const unsigned int& size) {
51  throw FailedToFindMessageSpecialisation("Failed to find the specialisation to decode this message type, did you include the message header?");
52  //return T();
53  }
54 };
55 
56 } // namespace mm_messages
57 
58 #endif /* mmmessages_MESSAGES_HPP_ */
Template parent and default pass-through encoding/decoding.
Definition: message.hpp:46
Short description of this file.
static void encode(const T &msg, ByteArray &buffer)
Definition: message.hpp:47
ecl::Stencil< const unsigned char * > ConstRawByteStencil
Definition: message.hpp:32
ecl::Stencil< unsigned char * > RawByteStencil
Definition: message.hpp:31
std::vector< unsigned char > ByteArray
Definition: message.hpp:29
ecl::Stencil< ByteArray > ByteStencil
Definition: message.hpp:30
static T decode(const unsigned char *buffer, const unsigned int &size)
Definition: message.hpp:50


mm_messages
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 13:52:10