libjmmcg  release_579_6_g8cffd
A C++ library containing an eclectic mix of useful, advanced components.
messages.hpp File Reference
#include "conversions.hpp"
#include "core/memops.hpp"
#include "core/ttypes.hpp"
#include <boost/mpl/assert.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <numeric>
#include <cassert>
#include <cstring>
#include "messages_impl.hpp"
Include dependency graph for messages.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  isimud::ISIMUD_VER_NAMESPACE::exchanges::FIX::common::logon_args_t
 
struct  isimud::ISIMUD_VER_NAMESPACE::exchanges::FIX::common::logoff_args_t
 
class  isimud::ISIMUD_VER_NAMESPACE::exchanges::FIX::common::Header< MsgVer >
 
class  isimud::ISIMUD_VER_NAMESPACE::exchanges::FIX::common::Message< MsgVer >
 The basic, underlying type used to implement FIX message reading. More...
 

Namespaces

namespace  isimud
 
namespace  isimud::ISIMUD_VER_NAMESPACE
 
namespace  isimud::ISIMUD_VER_NAMESPACE::exchanges
 
namespace  isimud::ISIMUD_VER_NAMESPACE::exchanges::FIX
 
namespace  isimud::ISIMUD_VER_NAMESPACE::exchanges::FIX::common
 

Typedefs

using msg_version_t = MsgVer
 
using element_type = char
 
using pointer = element_type *
 
using const_pointer = element_type const *
 
using size_type = std::size_t
 
using MsgTypes_t = common::MsgTypes_t
 
using Header_t = Header< MsgVer >
 
using RejectCode_t = int
 

Enumerations

enum  : bool { has_static_size =false }
 
enum  : std::size_t { header_t_size =msg_version_t::fix_template_body_length_offset+sizeof(JMMCG_FIX_MSG_BODY_LENGTH_NULL)+1 }
 

Functions

template<class MsgVer >
class isimud::ISIMUD_VER_NAMESPACE::exchanges::FIX::common::Header isimud::ISIMUD_VER_NAMESPACE::exchanges::FIX::common::__attribute__ ((packed))
 
constexpr __stdcall Header () noexcept(true)
 Create a FIX message from an array of chars read from a socket or elsewhere. More...
 
constexpr size_type length () const noexcept(true)
 Determine the total size of the referenced message. More...
 
template<FieldsFast field>
constexpr field_str_range_t __fastcall find () noexcept(true)
 Determine if the specified tag is in the referenced message. More...
 
template<FieldsFast field>
constexpr field_str_const_range_t __fastcall find () const noexcept(true)
 Determine if the specified tag is in the referenced message. More...
 
constexpr field_str_const_range_t __fastcall find_ExDestination () const noexcept(true)
 
constexpr ExDestination_t __fastcall find_MIC () const noexcept(true)
 
MsgTypes type () const noexcept(true) __attribute__((pure))
 
constexpr bool is_valid () const noexcept(true)
 Verify that the referenced FIX message is valid. More...
 
checksum_t generate_checksum (size_type body_len) const noexcept(true)
 Generate the checksum for the referenced FIX message. More...
 
constexpr bool is_checksum_valid (size_type body_len, const_pointer start_of_checksum_value) const noexcept(true)
 Verify that the checksum of the referenced FIX message is valid. More...
 
template<MsgTypes MsgType>
constexpr underlying_fix_data_buffer::iterator set_header () noexcept(true)
 
template<MsgTypes MsgType>
constexpr underlying_fix_data_buffer::iterator set_sequence_num_int (SeqNum_t seq_num) noexcept(true)
 
template<MsgTypes MsgType, class SrcMsg , class Ret = typename std::enable_if<std::is_class<SrcMsg>::value, underlying_fix_data_buffer::iterator>::type>
constexpr Ret set_sequence_num (SrcMsg const &msg) noexcept(true)
 
template<class MsgVer >
isimud::ISIMUD_VER_NAMESPACE::exchanges::FIX::common::Message Header isimud::ISIMUD_VER_NAMESPACE::exchanges::FIX::common::__attribute__ ((packed))
 
constexpr __stdcall Message () noexcept(true)
 Wrap a FIX message contained in an array of chars that has been written into from a socket or elsewhere. More...
 
constexpr __stdcall Message (logon_args_t const &) noexcept(true)
 
constexpr __stdcall Message (logoff_args_t const &) noexcept(true)
 
constexpr __stdcall Message (RejectCode_t const &) noexcept(true)
 
__stdcall Message (SeqNum_t seqNum, ClientOrderID_t const &clID, OrderType const oT, TIF const t, Side const s, SecurityID_t instID, Quantity_t ordQty, Price_t p, ExDestination_t mic) noexcept(true)
 Create a NewOrderSIngle. More...
 
__stdcall Message (SeqNum_t seqNum, ClientOrderID_t const &clID, ExecType eT, Price_t const price, SecurityID_t instID, Side s, Quantity_t execdQty, Quantity_t leavesQty, ExDestination_t mic) noexcept(true)
 Create an ExecutionReport. More...
 
template<class SrcMsg >
__stdcall Message (SrcMsg const &msg)=delete
 Create a message from the source message, into the underlying buffer. More...
 
template<class SrcMsg , class RefData >
__stdcall Message (SrcMsg const &msg, RefData const &ref_data)=delete
 Create a message from the source message, into the underlying buffer. More...
 
template<class RefData , class ... Fields>
 Message (RefData const &ref_data, Fields ... fields)
 
constexpr size_type __fastcall size () const noexcept(true)
 Determine the size of the referenced message. More...
 
template<FieldsFast field>
constexpr bool __fastcall search () const noexcept(true)
 Determine if the specified tag is in the referenced message. More...
 
std::string to_string () const noexcept(false)
 
constexpr ClientOrderID_t clientOrderID () const noexcept(true)
 
constexpr Side side () const noexcept(true)
 
constexpr Price_t limitPrice () const noexcept(true)
 
constexpr Quantity_t orderQty () const noexcept(true)
 
constexpr void orderQty (Quantity_t q) noexcept(true)
 
constexpr SecurityID_t instrumentID () const noexcept(true)
 
template<class OutIter >
OutIter write_ClOrdID (ClientOrderID_t const &clID, OutIter data) noexcept(true)
 
template<class OutIter >
OutIter write_TransactTime (OutIter data) noexcept(true)
 
template<class OutIter >
OutIter write_ExDest (ExDestination_t mic, OutIter data) noexcept(true)
 
template<FieldsFast field>
constexpr underlying_fix_data_buffer::iterator add_field_tag (underlying_fix_data_buffer::iterator data) noexcept(true)
 
constexpr void finalise_msg (underlying_fix_data_buffer::iterator) noexcept(true)
 
template<class MsgVer >
std::ostream & isimud::ISIMUD_VER_NAMESPACE::exchanges::FIX::common::operator<< (std::ostream &os, Message< MsgVer > const &m)
 

Variables

ALIGN_TO_L1_CACHE char begin_string [sizeof(msg_version_t::MsgVer) -1]
 
libjmmcg::enum_tags::mpl::to_array< FieldsFast, FieldsFast::BodyLength >::element_type_no_null body_length_tag
 
char body_length_value [sizeof(JMMCG_FIX_MSG_BODY_LENGTH_NULL) -1]
 
libjmmcg::enum_tags::mpl::to_array< FieldsFast, FieldsFast::MsgType >::element_type_no_null msg_type_tag
 
underlying_fix_data_buffer data_
 

Typedef Documentation

◆ const_pointer

typedef typename Header_t::const_pointer const_pointer

Definition at line 4 of file messages.hpp.

◆ element_type

typedef typename Header_t::element_type element_type

Definition at line 2 of file messages.hpp.

◆ Header_t

using Header_t = Header<MsgVer>

Definition at line 1 of file messages.hpp.

◆ msg_version_t

typedef typename Header_t::msg_version_t msg_version_t

Definition at line 1 of file messages.hpp.

◆ MsgTypes_t

using MsgTypes_t = common::MsgTypes_t

Definition at line 6 of file messages.hpp.

◆ pointer

typedef typename Header_t::pointer pointer

Definition at line 3 of file messages.hpp.

◆ RejectCode_t

using RejectCode_t = int

Definition at line 7 of file messages.hpp.

◆ size_type

using size_type = typename Header_t::size_type

Definition at line 5 of file messages.hpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : bool
Enumerator
has_static_size 

The message is statically-sized, not dynamically, so sizeof(the derived message-type) is the amount to copy, i.e. length() returns sizeof(the derived message-type).

Definition at line 8 of file messages.hpp.

◆ anonymous enum

anonymous enum : std::size_t
Enumerator
header_t_size 

Definition at line 11 of file messages.hpp.

Function Documentation

◆ add_field_tag()

template<FieldsFast field>
constexpr underlying_fix_data_buffer::iterator __attribute__::add_field_tag ( underlying_fix_data_buffer::iterator  data)
constexprnoexcept

◆ clientOrderID()

constexpr ClientOrderID_t __attribute__::clientOrderID ( ) const
constexprnoexcept

Definition at line 17 of file messages.hpp.

◆ finalise_msg()

constexpr void __attribute__::finalise_msg ( underlying_fix_data_buffer::iterator  )
constexprprotectednoexcept

◆ find() [1/2]

template<FieldsFast field>
constexpr field_str_const_range_t __fastcall __attribute__::find ( ) const
constexprnoexcept

Determine if the specified tag is in the referenced message.

Parameters
fieldThe field to be found. Note that the range must contain the field otherwise the behaviour shall be undefined.
Returns
True if the specified tag was found in the referenced message.

◆ find() [2/2]

template<FieldsFast field>
constexpr field_str_range_t __fastcall __attribute__::find ( )
constexprnoexcept

Determine if the specified tag is in the referenced message.

Parameters
fieldThe field to be found. Note that the range must contain the field otherwise the behaviour shall be undefined.
Returns
True if the specified tag was found in the referenced message.

◆ find_ExDestination()

constexpr field_str_const_range_t __fastcall __attribute__::find_ExDestination ( ) const
constexprnoexcept

◆ find_MIC()

constexpr ExDestination_t __fastcall __attribute__::find_MIC ( ) const
constexprnoexcept

◆ generate_checksum()

checksum_t __attribute__::generate_checksum ( size_type  body_len) const
noexcept

Generate the checksum for the referenced FIX message.

Parameters
body_lenThe length of the body of the referenced FIX message.
Returns
The computed check sum.

◆ Header()

constexpr __stdcall __attribute__::Header ( )
constexprnoexcept

Create a FIX message from an array of chars read from a socket or elsewhere.

In debug builds the validity of the FIX message is checked.

Parameters
bThe array of chars that must comprise a valid FIX message.

◆ instrumentID()

constexpr SecurityID_t __attribute__::instrumentID ( ) const
constexprnoexcept

Definition at line 7 of file messages.hpp.

◆ is_checksum_valid()

constexpr bool __attribute__::is_checksum_valid ( size_type  body_len,
const_pointer  start_of_checksum_value 
) const
constexprnoexcept

Verify that the checksum of the referenced FIX message is valid.

Parameters
body_lenThe length of the body of the referenced FIX message.
start_of_checksum_valueA pointer to that start of the checksum value embedded in the referenced FIX message.
Returns
True is the checksum of the referenced FIX message is valid, false otherwise.

◆ is_valid()

constexpr bool __attribute__::is_valid ( ) const
constexprnoexcept

Verify that the referenced FIX message is valid.

Returns
True is the referenced FIX message is valid, false otherwise.

Definition at line 9 of file socket_server.cpp.

◆ length()

constexpr size_type __attribute__::length ( ) const
constexprnoexcept

Determine the total size of the referenced message.

The referenced message must be valid.

Returns
The size of the whole the message, including the version, size (itself) and checksum fields.
See also
size()

Determine the total size of the referenced message.

Definition at line 9 of file socket_server.cpp.

◆ limitPrice()

constexpr Price_t __attribute__::limitPrice ( ) const
constexprnoexcept

Definition at line 64 of file messages.hpp.

◆ Message() [1/9]

constexpr __stdcall __attribute__::Message ( )
explicitconstexprnoexcept

Wrap a FIX message contained in an array of chars that has been written into from a socket or elsewhere.

Parameters
bThe array of chars that must comprise a valid FIX message which is not automatically checked.

◆ Message() [2/9]

constexpr __stdcall __attribute__::Message ( logoff_args_t const &  )
explicitconstexprnoexcept

◆ Message() [3/9]

constexpr __stdcall __attribute__::Message ( logon_args_t const &  )
explicitconstexprnoexcept

◆ Message() [4/9]

template<class RefData , class ... Fields>
__attribute__::Message ( RefData const &  ref_data,
Fields ...  fields 
)

◆ Message() [5/9]

constexpr __stdcall __attribute__::Message ( RejectCode_t const &  )
explicitconstexprnoexcept

◆ Message() [6/9]

__stdcall __attribute__::Message ( SeqNum_t  seqNum,
ClientOrderID_t const &  clID,
ExecType  eT,
Price_t const  price,
SecurityID_t  instID,
Side  s,
Quantity_t  execdQty,
Quantity_t  leavesQty,
ExDestination_t  mic 
)
noexcept

Create an ExecutionReport.

◆ Message() [7/9]

__stdcall __attribute__::Message ( SeqNum_t  seqNum,
ClientOrderID_t const &  clID,
OrderType const  oT,
TIF const  t,
Side const  s,
SecurityID_t  instID,
Quantity_t  ordQty,
Price_t  p,
ExDestination_t  mic 
)
noexcept

Create a NewOrderSIngle.

◆ Message() [8/9]

template<class SrcMsg >
__stdcall __attribute__::Message ( SrcMsg const &  msg)
explicitdelete

Create a message from the source message, into the underlying buffer.

In debug builds the validity of the FIX message is checked.

If an error is generated, then this function will need to be specialised for the particular SrcMsg.

Parameters
msgThe source message from which the target message should be created.

◆ Message() [9/9]

template<class SrcMsg , class RefData >
__stdcall __attribute__::Message ( SrcMsg const &  msg,
RefData const &  ref_data 
)
delete

Create a message from the source message, into the underlying buffer.

In debug builds the validity of the FIX message is checked.

If an error is generated, then this function will need to be specialised for the particular SrcMsg.

Parameters
msgThe source message from which the target message should be created.
ref_dataThe reference data to map from exchange-based instrument identifiers to client-based symbology.

◆ orderQty() [1/2]

constexpr Quantity_t __attribute__::orderQty ( ) const
constexprnoexcept

Definition at line 24 of file messages.hpp.

◆ orderQty() [2/2]

constexpr void __attribute__::orderQty ( Quantity_t  q)
constexprnoexcept

◆ search()

template<FieldsFast field>
constexpr bool __fastcall __attribute__::search ( ) const
constexprnoexcept

Determine if the specified tag is in the referenced message.

Parameters
fieldThe field to be found. Note that the range must contain the field otherwise the behaviour shall be undefined.
Returns
True if the specified tag was found in the referenced message.

◆ set_header()

template<MsgTypes MsgType>
constexpr underlying_fix_data_buffer::iterator __attribute__::set_header ( )
constexprprotectednoexcept

◆ set_sequence_num()

template<MsgTypes MsgType, class SrcMsg , class Ret = typename std::enable_if<std::is_class<SrcMsg>::value, underlying_fix_data_buffer::iterator>::type>
constexpr Ret __attribute__::set_sequence_num ( SrcMsg const &  msg)
constexprprotectednoexcept

◆ set_sequence_num_int()

template<MsgTypes MsgType>
constexpr underlying_fix_data_buffer::iterator __attribute__::set_sequence_num_int ( SeqNum_t  seq_num)
constexprprotectednoexcept

◆ side()

constexpr Side __attribute__::side ( ) const
constexprnoexcept

Definition at line 50 of file messages.hpp.

◆ size()

constexpr size_type __fastcall __attribute__::size ( ) const
constexprnoexcept

Determine the size of the referenced message.

The referenced message must be valid.

Returns
The size of the body of the message, excluding the version, size (itself) and checksum fields.
See also
length()

◆ to_string()

std::string __attribute__::to_string ( ) const
noexcept

◆ type()

MsgTypes __attribute__::type ( ) const
noexcept

Definition at line 23 of file messages.hpp.

◆ write_ClOrdID()

template<class OutIter >
OutIter __attribute__::write_ClOrdID ( ClientOrderID_t const &  clID,
OutIter  data 
)
noexcept

◆ write_ExDest()

template<class OutIter >
OutIter __attribute__::write_ExDest ( ExDestination_t  mic,
OutIter  data 
)
noexcept

◆ write_TransactTime()

template<class OutIter >
OutIter __attribute__::write_TransactTime ( OutIter  data)
noexcept

Variable Documentation

◆ begin_string

ALIGN_TO_L1_CACHE char begin_string[sizeof(msg_version_t::MsgVer) -1]
protected

Definition at line 77 of file messages.hpp.

◆ body_length_tag

libjmmcg::enum_tags::mpl::to_array<FieldsFast, FieldsFast::BodyLength>::element_type_no_null body_length_tag
protected

Definition at line 78 of file messages.hpp.

◆ body_length_value

char body_length_value[sizeof(JMMCG_FIX_MSG_BODY_LENGTH_NULL) -1]
protected

Definition at line 79 of file messages.hpp.

◆ data_

underlying_fix_data_buffer data_
protected

Definition at line 81 of file messages.hpp.

◆ msg_type_tag

libjmmcg::enum_tags::mpl::to_array<FieldsFast, FieldsFast::MsgType>::element_type_no_null msg_type_tag
protected

Definition at line 80 of file messages.hpp.