00001 00006 /***************************************************************************** 00007 ** Ifdefs 00008 *****************************************************************************/ 00009 00010 #ifndef mm_messages_MESSAGES_HPP_ 00011 #define mm_messages_MESSAGES_HPP_ 00012 00013 /***************************************************************************** 00014 ** Includes 00015 *****************************************************************************/ 00016 00017 #include <ecl/containers.hpp> 00018 #include <iostream> 00019 #include <vector> 00020 #include "exceptions.hpp" 00021 00022 /***************************************************************************** 00023 ** Namespaces 00024 *****************************************************************************/ 00025 00026 namespace mm_messages { 00027 00028 //typedef ecl::Array<unsigned char> ByteArray; 00029 typedef std::vector<unsigned char> ByteArray; 00030 typedef ecl::Stencil<ByteArray> ByteStencil; 00031 typedef ecl::Stencil<unsigned char*> RawByteStencil; 00032 typedef ecl::Stencil<const unsigned char*> ConstRawByteStencil; 00033 00034 /***************************************************************************** 00035 ** Interfaces 00036 *****************************************************************************/ 00037 00045 template <typename T> 00046 struct Message { 00047 static void encode(const T& msg, ByteArray& buffer) { 00048 throw FailedToFindMessageSpecialisation("Failed to find the specialisation to encode this message type, did you include the message header?"); 00049 } 00050 static T decode(const unsigned char* buffer, const unsigned int& size) { 00051 throw FailedToFindMessageSpecialisation("Failed to find the specialisation to decode this message type, did you include the message header?"); 00052 //return T(); 00053 } 00054 }; 00055 00056 } // namespace mm_messages 00057 00058 #endif /* mmmessages_MESSAGES_HPP_ */