JayBeams  0.1
Another project to have fun coding.
decoder.hpp
Go to the documentation of this file.
1 #ifndef jb_itch5_decoder_hpp
2 #define jb_itch5_decoder_hpp
3 
5 
6 namespace jb {
7 namespace itch5 {
8 
9 /**
10  * Define the interface to decode ITCH-5.0 messages and message
11  * fields.
12  *
13  * This class is specialized for every message type used to represent
14  * ITCH-5.0 messages and their fields.
15  *
16  * @tparam validate if true the fields and message lengths are
17  * validated. When false, the decoding is faster, but more likely to
18  * crash.
19  * @tparam T the type of message or field to decode.
20  *
21  * TODO(#19) all this code should be replaced with Boost.Endian.
22  */
23 template <bool validate, typename T>
24 struct decoder {
25  /**
26  * Read a single message or field.
27  *
28  * @param size the size of the message
29  * @param msg the contents of the message
30  * @param offset where in the message to start decoding
31  *
32  * @return An object of type T representing the contents of the
33  * message.
34  *
35  * @throws std::runtime_error if the message cannot be parsed.
36  */
37  static T r(std::size_t size, void const* msg, std::size_t offset);
38 };
39 
40 } // namespace itch5
41 } // namespace jb
42 
43 #endif // jb_itch5_decoder_hpp
static T r(std::size_t size, void const *msg, std::size_t offset)
Read a single message or field.
Define the interface to decode ITCH-5.0 messages and message fields.
Definition: decoder.hpp:24
The top-level namespace for the JayBeams library.
Definition: as_hhmmss.hpp:7