fix8
version 1.4.0
Open Source C++ FIX Framework
|
A complete Fix message with header, body and trailer. More...
#include <message.hpp>
Public Member Functions | |
template<typename InputIterator > | |
Message (const F8MetaCntx &ctx, const f8String &msgType, const InputIterator begin, const size_t cnt, const FieldTrait_Hash_Array *ftha) | |
virtual | ~Message () |
Dtor. More... | |
MessageBase * | Header () const |
MessageBase * | Trailer () const |
MessageBase * | Header () |
MessageBase * | Trailer () |
unsigned | decode (const f8String &from, unsigned offset=0, unsigned ignore=0, bool permissive_mode=false) |
F8API size_t | encode (f8String &to) const |
F8API size_t | encode (char **to) const |
Encode message with minimal copying. More... | |
F8API Message * | clone () const |
virtual bool | process (Router &rt) const |
virtual bool | is_admin () const |
virtual void | clear (bool reuse=true) |
virtual void | set_custom_seqnum (unsigned seqnum) |
unsigned | get_custom_seqnum () const |
virtual void | set_no_increment (bool flag=true) |
virtual bool | get_no_increment () const |
bool | get_end_of_batch () const |
void | set_end_of_batch (bool is_end_of_batch) |
void | setup_reuse () |
void | push_unknown (Message *to) const |
BaseField * | get_field_flattened (const unsigned short fnum) const |
BaseField * | get_field_by_name_flattened (const char *tag) const |
virtual F8API void | print (std::ostream &os, int depth=0) const |
Public Member Functions inherited from FIX8::MessageBase | |
template<typename InputIterator > | |
MessageBase (const struct F8MetaCntx &ctx, const f8String &msgType, const InputIterator begin, const size_t cnt, const FieldTrait_Hash_Array *ftha) | |
F8API | MessageBase (const MessageBase &from) |
Copy ctor. More... | |
F8API MessageBase & | operator= (const MessageBase &that) |
Assignment operator. More... | |
virtual | ~MessageBase () |
Dtor. More... | |
void | clear_positions () |
empty the positions map More... | |
size_t | size () const |
F8API unsigned | decode (const f8String &from, unsigned offset, unsigned ignore=0, bool permissive_mode=false) |
unsigned | decode_group (GroupBase *grpbase, const unsigned short fnum, const f8String &from, unsigned s_offset, unsigned ignore) |
F8API size_t | encode (std::ostream &to) const |
F8API size_t | encode (char *to) const |
F8API size_t | encode_group (const unsigned short fnum, std::ostream &to) const |
F8API size_t | encode_group (const unsigned short fnum, char *to) const |
virtual GroupBase * | create_nested_group (unsigned short fnum) const |
F8API unsigned | check_positions () |
F8API unsigned | copy_legal (MessageBase *to, bool force=false) const |
F8API unsigned | move_legal (MessageBase *to, bool force=false) |
void | push_unknown (MessageBase *to) const |
void | check_set_rlm (BaseField *where) const |
const f8String & | get_msgtype () const |
void | add_field_decoder (const unsigned short fnum, const unsigned pos, BaseField *what) |
void | add_field (const unsigned short fnum, Presence::const_iterator itr, const unsigned pos, BaseField *what, bool check) |
void | add_field (const unsigned short fnum, Fields::iterator fitr, const unsigned pos, BaseField *what, bool check=true) |
void | add_field (const unsigned short fnum, const unsigned pos, BaseField *what, bool check=true) |
void | set (const unsigned short field, FieldTrait::TraitTypes type=FieldTrait::present) |
template<typename T > | |
bool | add_field (T *what) |
bool | add_field (BaseField *what) |
Groups & | get_groups () |
template<typename T > | |
bool | operator+= (T *what) |
template<typename T > | |
MessageBase & | operator<< (T *what) |
template<typename T > | |
bool | get (T &to) const |
template<typename T > | |
bool | has () const |
bool | is_legal (unsigned short fnum) const |
template<typename T > | |
bool | is_legal () const |
template<typename T > | |
const T * | get () const |
template<typename T > | |
bool | operator() (T &to) const |
template<typename T > | |
const T * | operator() () const |
bool | have (const unsigned short fnum) const |
Fields::const_iterator | find_field (const unsigned short fnum) const |
BaseField * | get_field (const unsigned short fnum) const |
BaseField * | get_field_by_name (const char *tag) const |
Fields::const_iterator | fields_begin () const |
Fields::const_iterator | fields_end () const |
F8API BaseField * | replace (const unsigned short fnum, Presence::const_iterator itr, BaseField *with) |
F8API BaseField * | replace (const unsigned short fnum, BaseField *with) |
F8API GroupBase * | replace (const unsigned short fnum, GroupBase *with) |
F8API BaseField * | remove (const unsigned short fnum, Presence::const_iterator itr) |
F8API BaseField * | remove (const unsigned short fnum) |
template<typename T > | |
GroupBase * | find_group () const |
GroupBase * | find_group (const unsigned short fnum) const |
template<typename T > | |
GroupBase * | find_add_group (GroupBase *grpbase=nullptr) |
GroupBase * | find_add_group (const unsigned short fnum, GroupBase *grpbase=nullptr) |
template<typename T > | |
void | append_group (T *what) |
void | add_group (GroupBase *what) |
MessageBase & | operator<< (GroupBase *what) |
void | operator+= (GroupBase *what) |
unsigned short | getPos (const unsigned short field) const |
bool | add_trait (const FieldTrait &what) |
template<typename InputIterator > | |
void | add_trait (const InputIterator begin, const size_t cnt) |
virtual F8API void | print_field (const unsigned short fnum, std::ostream &os) const |
virtual F8API void | print_group (const unsigned short fnum, std::ostream &os, int depth=0) const |
const FieldTraits & | get_fp () const |
void | print_fp (std::ostream &os) |
virtual begin_string * | get_begin_string () |
virtual body_length * | get_body_length () |
virtual msg_type * | get_msg_type () |
virtual check_sum * | get_check_sum () |
const f8String & | get_unknown () const |
Static Public Member Functions | |
static unsigned | calc_chksum (const char *from, const size_t sz, const unsigned offset=0, const int len=-1) |
static unsigned | calc_chksum (const f8String &from, const unsigned offset=0, const int len=-1) |
static f8String | fmt_chksum (const unsigned val) |
static Message * | factory (const F8MetaCntx &ctx, const char *from, bool no_chksum=false, bool permissive_mode=false) |
static F8API Message * | factory (const F8MetaCntx &ctx, const f8String &from, bool no_chksum=false, bool permissive_mode=false) |
Static Public Member Functions inherited from FIX8::MessageBase | |
static unsigned | extract_element (const char *from, const unsigned sz, char *tag, char *val) |
static unsigned | extract_element_fixed_width (const char *from, const unsigned sz, const unsigned val_sz, char *tag, char *val) |
static unsigned | extract_element (const char *from, const unsigned sz, f8String &tag, f8String &val) |
static void | set_tabsize (unsigned tabsize) |
static unsigned | get_tabsize () |
static bool | has_group_count (const BaseField *bf) |
Protected Attributes | |
MessageBase * | _header |
MessageBase * | _trailer |
unsigned | _custom_seqnum |
bool | _no_increment |
bool | _end_of_batch |
Protected Attributes inherited from FIX8::MessageBase | |
Fields | _fields |
FieldTraits | _fp |
Positions | _pos |
Groups | _groups |
const f8String & | _msgType |
const F8MetaCntx & | _ctx |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Message &what) |
Additional Inherited Members | |
Static Protected Member Functions inherited from FIX8::MessageBase | |
static unsigned | extract_header (const f8String &from, char *len, char *mtype) |
static unsigned | extract_trailer (const f8String &from, f8String &chksum) |
Static Protected Attributes inherited from FIX8::MessageBase | |
static F8API unsigned | _tabsize = defaults::tabsize |
A complete Fix message with header, body and trailer.
Definition at line 1058 of file message.hpp.
|
inline |
Ctor.
InputIterator | input iterator type |
ctx | - reference to generated metadata |
msgType | - reference to Fix message type |
begin | - InputIterator pointing to begining of field trait table |
cnt | - number of elements in field trait table |
ftha | field trait hash array |
Definition at line 1087 of file message.hpp.
|
inlinevirtual |
|
inlinestatic |
Generate a checksum from an encoded buffer, ULL version.
from | char *buffer encoded Fix message |
sz | size of msg |
offset | starting offset |
len | maximum length |
Definition at line 1170 of file message.hpp.
Referenced by calc_chksum().
|
inlinestatic |
Generate a checksum from an encoded buffer, string version.
from | source buffer encoded Fix message |
offset | starting offset |
len | maximum length |
Definition at line 1218 of file message.hpp.
References calc_chksum().
|
inlinevirtual |
Empty messages from container
reuse | if true clear vector |
Reimplemented from FIX8::MessageBase.
Definition at line 1155 of file message.hpp.
References FIX8::MessageBase::clear().
Message * Message::clone | ( | ) | const |
Clone this message. Performs a deep copy.
Definition at line 668 of file message.cpp.
References FIX8::BaseMsgEntry::_create, and FIX8::Minst::_do.
Referenced by FIX8::ConsoleMenu::RemoveMsg().
|
inline |
Decode from string.
from | source string |
offset | in bytes to decode from |
ignore | bytes to ignore counting back from end of message |
permissive_mode | if true, ignore unknown fields |
Definition at line 1118 of file message.hpp.
References FIX8::MessageBase::decode().
size_t Message::encode | ( | f8String & | to | ) | const |
Encode message to stream.
to | stream to encode to |
Definition at line 500 of file message.cpp.
References FIX8_MAX_MSG_LENGTH, and FIX8::HEADER_CALC_OFFSET().
size_t Message::encode | ( | char ** | to | ) | const |
Encode message with minimal copying.
Encode message to stream. Perform absolutely minimal copying of output buffer.
to | pointer to pointer to buffer |
Definition at line 422 of file message.cpp.
References FIX8::IntervalTimer::AsDouble(), FIX8::IntervalTimer::Calculate(), FIX8::Common_BeginString(), FIX8::Common_BodyLength(), FIX8::Common_CheckSum(), FIX8::MessageBase::encode(), FIX8::HEADER_CALC_OFFSET(), and FIX8::FieldTrait::suppress.
|
inlinestatic |
Using supplied metatdata context and raw input buffer, decode and create appropriate Fix message
ctx | reference to metadata object |
from | pointer to raw buffer containing one complete FIX message string only, no trailing or leading characters |
no_chksum | if true, do not perform chksum verification |
permissive_mode | if true, ignore unknown fields |
Definition at line 1238 of file message.hpp.
Referenced by FIX8::Session::process(), and FIX8::Session::retrans_callback().
|
static |
Using supplied metatdata context and raw input buffer, decode and create appropriate Fix message
ctx | reference to metadata object |
from | reference to string raw buffer containing one complete FIX message string only, no trailing or leading characters |
no_chksum | if true, do not perform chksum verification |
permissive_mode | if true, ignore unknown fields |
Definition at line 224 of file message.cpp.
References FIX8::F8MetaCntx::_bme, FIX8::IntervalTimer::AsDouble(), FIX8::IntervalTimer::Calculate(), FILE_LINE, FIX8::GeneratedTable< Key, Val >::find_ptr(), glout_debug, and FIX8::MAX_MSGTYPE_FIELD_LEN().
|
inlinestatic |
Format a checksum into the required 3 digit, 0 padded string.
val | checksum value |
Definition at line 1224 of file message.hpp.
|
inline |
Get the custom sequence number.
Definition at line 1259 of file message.hpp.
References _custom_seqnum.
Referenced by FIX8::Session::send_process().
|
inline |
Get the end of batch flag
Definition at line 1271 of file message.hpp.
References _end_of_batch.
|
inline |
Search for field by longname in this message (either header, body or trailer).
tag | field longname |
Definition at line 1315 of file message.hpp.
References FIX8::MessageBase::_ctx, get_field_flattened(), and FIX8::F8MetaCntx::reverse_find_fnum().
|
inline |
Search for field in this message (either header, body or trailer).
fnum | field number |
Definition at line 1304 of file message.hpp.
References FIX8::MessageBase::_fields.
Referenced by get_field_by_name_flattened().
|
inlinevirtual |
Get the no increment flag.
Definition at line 1267 of file message.hpp.
References _no_increment.
|
inline |
Get a pointer to the message header.
Definition at line 1098 of file message.hpp.
References _header.
Referenced by FIX8::Session::compid_check(), FIX8::Session::handle_logon(), MyMenu::load_msgs(), FIX8::Session::send_process(), and FIX8::Session::sequence_check().
|
inline |
Get a pointer to the message header, non const version.
Definition at line 1106 of file message.hpp.
References _header.
|
inlinevirtual |
Test whether this message is administrative.
Reimplemented in FIX8::TEX::Logon, FIX8::TEX::Logon, FIX8::TEX::Logout, FIX8::TEX::Logout, FIX8::TEX::SequenceReset, FIX8::TEX::SequenceReset, FIX8::TEX::Reject, FIX8::TEX::Reject, FIX8::TEX::ResendRequest, FIX8::TEX::ResendRequest, FIX8::TEX::TestRequest, FIX8::TEX::TestRequest, FIX8::TEX::Heartbeat, and FIX8::TEX::Heartbeat.
Definition at line 1151 of file message.hpp.
Referenced by MyMenu::load_msgs(), and FIX8::Session::process().
|
virtual |
Print the message to the specified stream.
os | refererence to stream to print to |
depth | not used |
Reimplemented from FIX8::MessageBase.
Definition at line 680 of file message.cpp.
References FIX8::MessageBase::print().
|
inlinevirtual |
Initiate callback to appropriate process method from metadata.
rt | reference to router instance |
Reimplemented in FIX8::TEX::DerivativeSecurityListRequest, FIX8::TEX::SecurityList, FIX8::TEX::SecurityListRequest, FIX8::TEX::SecurityTypes, FIX8::TEX::SecurityTypeRequest, FIX8::TEX::CrossOrderCancelRequest, FIX8::TEX::CrossOrderCancelReplaceRequest, FIX8::TEX::NewOrderCross, FIX8::TEX::OrderMassCancelReport, FIX8::TEX::OrderMassCancelRequest, FIX8::TEX::RegistrationInstructionsResponse, FIX8::TEX::RegistrationInstructions, FIX8::TEX::ListStrikePrice, FIX8::TEX::BidResponse, FIX8::TEX::BidRequest, FIX8::TEX::BusinessMessageReject, FIX8::TEX::MassQuote, FIX8::TEX::TradingSessionStatus, FIX8::TEX::TradingSessionStatusRequest, FIX8::TEX::SecurityStatus, FIX8::TEX::SecurityStatusRequest, FIX8::TEX::SecurityDefinition, FIX8::TEX::SecurityDefinitionRequest, FIX8::TEX::MassQuoteAcknowledgement, FIX8::TEX::QuoteStatusRequest, FIX8::TEX::QuoteCancel, FIX8::TEX::MarketDataRequestReject, FIX8::TEX::MarketDataIncrementalRefresh, FIX8::TEX::MarketDataSnapshotFullRefresh, FIX8::TEX::MarketDataRequest, FIX8::TEX::SettlementInstructions, FIX8::TEX::Quote, FIX8::TEX::QuoteRequest, FIX8::TEX::DontKnowTrade, FIX8::TEX::AllocationInstructionAck, FIX8::TEX::ListStatus, FIX8::TEX::ListStatusRequest, FIX8::TEX::ListExecute, FIX8::TEX::ListCancelRequest, FIX8::TEX::AllocationInstruction, FIX8::TEX::OrderStatusRequest, FIX8::TEX::OrderCancelReplaceRequest, FIX8::TEX::OrderCancelRequest, FIX8::TEX::NewOrderList, FIX8::TEX::NewOrderSingle, FIX8::TEX::PartyDetailsListReport, FIX8::TEX::PartyDetailsListRequest, FIX8::TEX::StreamAssignmentReportACK, FIX8::TEX::StreamAssignmentReport, FIX8::TEX::StreamAssignmentRequest, FIX8::TEX::UserNotification, FIX8::TEX::OrderMassActionRequest, FIX8::TEX::Email, FIX8::TEX::OrderMassActionReport, FIX8::TEX::ApplicationMessageReport, FIX8::TEX::ApplicationMessageRequestAck, FIX8::TEX::ApplicationMessageRequest, FIX8::TEX::MarketDefinitionUpdateReport, FIX8::TEX::MarketDefinition, FIX8::TEX::MarketDefinitionRequest, FIX8::TEX::TradingSessionListUpdateReport, FIX8::TEX::DerivativeSecurityListUpdateReport, FIX8::TEX::SettlementObligationReport, FIX8::TEX::SecurityDefinitionUpdateReport, FIX8::TEX::ContraryIntentionReport, FIX8::TEX::ExecutionAcknowledgement, FIX8::TEX::AllocationInstructionAlert, FIX8::TEX::AdjustedPositionReport, FIX8::TEX::SecurityListUpdateReport, FIX8::TEX::TradingSessionList, FIX8::TEX::TradingSessionListRequest, FIX8::TEX::ConfirmationRequest, FIX8::TEX::CollateralInquiryAck, FIX8::TEX::UserResponse, FIX8::TEX::UserRequest, FIX8::TEX::NetworkCounterpartySystemStatusResponse, FIX8::TEX::NetworkCounterpartySystemStatusRequest, FIX8::TEX::CollateralInquiry, FIX8::TEX::CollateralReport, FIX8::TEX::News, FIX8::TEX::CollateralResponse, FIX8::TEX::CollateralAssignment, FIX8::TEX::CollateralRequest, FIX8::TEX::AssignmentReport, FIX8::TEX::SettlementInstructionRequest, FIX8::TEX::ConfirmationAck, FIX8::TEX::AllocationReportAck, FIX8::TEX::AllocationReport, FIX8::TEX::TradeCaptureReportAck, FIX8::TEX::TradeCaptureReportRequestAck, FIX8::TEX::PositionReport, FIX8::TEX::RequestForPositionsAck, FIX8::TEX::RequestForPositions, FIX8::TEX::PositionMaintenanceReport, FIX8::TEX::PositionMaintenanceRequest, FIX8::TEX::Confirmation, FIX8::TEX::QuoteResponse, FIX8::TEX::QuoteStatusReport, FIX8::TEX::RFQRequest, FIX8::TEX::QuoteRequestReject, FIX8::TEX::OrderMassStatusRequest, FIX8::TEX::TradeCaptureReport, FIX8::TEX::TradeCaptureReportRequest, FIX8::TEX::MultilegOrderCancelReplace, FIX8::TEX::NewOrderMultileg, FIX8::TEX::DerivativeSecurityList, FIX8::TEX::Logon, FIX8::TEX::OrderCancelReject, FIX8::TEX::ExecutionReport, FIX8::TEX::Advertisement, FIX8::TEX::NewOrderSingle, FIX8::TEX::Logon, FIX8::TEX::IOI, FIX8::TEX::ExecutionReport, FIX8::TEX::Logout, FIX8::TEX::Logout, FIX8::TEX::SequenceReset, FIX8::TEX::SequenceReset, FIX8::TEX::Reject, FIX8::TEX::Reject, FIX8::TEX::ResendRequest, FIX8::TEX::ResendRequest, FIX8::TEX::TestRequest, FIX8::TEX::TestRequest, FIX8::TEX::Heartbeat, and FIX8::TEX::Heartbeat.
Definition at line 1147 of file message.hpp.
Referenced by myfix_session_client::handle_application(), hf_session_client::handle_application(), myfix_session_server::handle_application(), and hf_session_server::handle_application().
|
inline |
Copy _unknown string from this message to given message
Definition at line 1292 of file message.hpp.
References _header, _trailer, and FIX8::MessageBase::push_unknown().
|
inlinevirtual |
Set the custom sequence number. Used to override and suppress automatic seqnum assignment.
seqnum | the outbound sequence number to use for this message. |
Definition at line 1255 of file message.hpp.
Referenced by FIX8::Session::send().
|
inline |
Set the end of batch flag
is_end_of_batch | true or false |
Definition at line 1275 of file message.hpp.
Referenced by FIX8::FIXWriter::write_batch().
|
inlinevirtual |
Set the no increment flag.
flag | true means don't increment the seqnum after sending |
Definition at line 1263 of file message.hpp.
Referenced by FIX8::Session::send().
|
inline |
Setup this message to allow it to be resused This feature is experimental; do not use with pipelined mode
Definition at line 1279 of file message.hpp.
References FIX8::MessageBase::_fp, FIX8::Common_BeginString(), FIX8::Common_BodyLength(), FIX8::Common_CheckSum(), FIX8::Common_MsgSeqNum(), FIX8::MessageBase::remove(), FIX8::FieldTraits::set(), and FIX8::FieldTrait::suppress.
Referenced by MyMenu::load_msgs(), and MyMenu::new_order_single_recycled().
|
inline |
Get a pointer to the message trailer.
Definition at line 1102 of file message.hpp.
References _trailer.
|
inline |
Get a pointer to the message trailer, non const version.
Definition at line 1110 of file message.hpp.
References _trailer.
|
friend |
Inserter friend.
os | stream to send to |
what | message |
Definition at line 1364 of file message.hpp.
|
protected |
Definition at line 1066 of file message.hpp.
Referenced by get_custom_seqnum().
|
protected |
Definition at line 1067 of file message.hpp.
Referenced by get_end_of_batch().
|
protected |
Definition at line 1065 of file message.hpp.
Referenced by Header(), push_unknown(), and ~Message().
|
protected |
Definition at line 1067 of file message.hpp.
Referenced by get_no_increment().
|
protected |
Definition at line 1065 of file message.hpp.
Referenced by push_unknown(), Trailer(), and ~Message().