High Frequency FIX Parser
C++ library for high frequency messaging with the Financial Information Exchange (FIX) protocol.
Namespaces | Classes | Functions
hffix Namespace Reference

Namespace for all types and functions of High Frequency FIX Parser. More...

Namespaces

namespace  msg_type
 Namespace for message type constant strings.
 
namespace  tag
 Namespace for all field tag name enums.
 

Classes

class  field
 A FIX field for hffix::message_reader, with tag and hffix::field_value. More...
 
class  field_value
 FIX field value for hffix::message_reader. More...
 
class  message_reader
 One FIX message for reading. More...
 
class  message_reader_const_iterator
 The iterator type for hffix::message_reader. Typedef'd as hffix::message_reader::const_iterator. More...
 
class  message_writer
 One FIX message for writing. More...
 
struct  tag_equal
 A predicate constructed with a FIX tag which returns true if the tag of the hffix::field passed to the predicate is equal. More...
 

Functions

template<typename ForwardIterator , typename UnaryPredicate >
bool find_with_hint (ForwardIterator begin, ForwardIterator end, UnaryPredicate predicate, ForwardIterator &i)
 An algorithm similar to std::find_if for forward-searching over a range and finding items which match a predicate.
 
template<typename AssociativeContainer >
details::field_name_streamer< AssociativeContainer > field_name (int tag, AssociativeContainer const &field_dictionary, bool or_number=true)
 Given a field tag number and a field name dictionary, returns a type which provides operator<< to write the name of the field to an std::ostream.
 
template<typename AssociativeContainer >
void dictionary_init_field (AssociativeContainer &dictionary)
 Populate an AssociativeContainer with the names of all the FIX fields.
 
template<typename AssociativeContainer >
void dictionary_init_message (AssociativeContainer &dictionary)
 Populate an AssociativeContainer with the names of all the FIX message types.
 

Detailed Description

Namespace for all types and functions of High Frequency FIX Parser.

Function Documentation

◆ dictionary_init_field()

template<typename AssociativeContainer >
void hffix::dictionary_init_field ( AssociativeContainer &  dictionary)

Populate an AssociativeContainer with the names of all the FIX fields.

Parameters
dictionaryA reference to an AssociativeContainer<int, std::string>

Definition at line 7945 of file hffix_fields.hpp.

◆ dictionary_init_message()

template<typename AssociativeContainer >
void hffix::dictionary_init_message ( AssociativeContainer &  dictionary)

Populate an AssociativeContainer with the names of all the FIX message types.

Parameters
dictionaryA reference to an AssociativeContainer<std::string, std::string>

Definition at line 14045 of file hffix_fields.hpp.

◆ field_name()

template<typename AssociativeContainer >
details::field_name_streamer< AssociativeContainer > hffix::field_name ( int  tag,
AssociativeContainer const &  field_dictionary,
bool  or_number = true 
)

Given a field tag number and a field name dictionary, returns a type which provides operator<< to write the name of the field to an std::ostream.

Template Parameters
AssociativeContainerThe type of the field name dictionary. Must satisfy concept AssociativeContainer<int, std::string>, for example std::map<int, std::string> or std::unordered_map<int, std::string>. See https://en.cppreference.com/w/cpp/named_req/AssociativeContainer
Parameters
tagThe field number.
field_dictionaryThe field dictionary.
or_numberSpecifies behavior if the tag is not found in the dictionary. If true, then the string representation of the flag will be written to the std::ostream. If false, then nothing will be written to the std::ostream. Default is false.

Example usage:

std::map<int, std::string> dictionary;
std::cout << hffix::field_name(hffix::tag::SenderCompID, dictionary) << '\n'; // Will print "SenderCompID\n".
std::cout << hffix::field_name(1000000, dictionary) << '\n'; // Unknown field tag, will print "1000000\n".
std::cout << hffix::field_name(1000000, dictionary, false) << '\n'; // Unknown field tag, will print "\n".
details::field_name_streamer< AssociativeContainer > field_name(int tag, AssociativeContainer const &field_dictionary, bool or_number=true)
Given a field tag number and a field name dictionary, returns a type which provides operator<< to wri...
Definition hffix.hpp:2974
void dictionary_init_field(AssociativeContainer &dictionary)
Populate an AssociativeContainer with the names of all the FIX fields.

Definition at line 2974 of file hffix.hpp.

◆ find_with_hint()

template<typename ForwardIterator , typename UnaryPredicate >
bool hffix::find_with_hint ( ForwardIterator  begin,
ForwardIterator  end,
UnaryPredicate  predicate,
ForwardIterator &  i 
)
inline

An algorithm similar to std::find_if for forward-searching over a range and finding items which match a predicate.

Instead of searching from begin to end, searches from i to end, then searches from begin to i. Efficient for finding multiple items when the expected ordering of the items is known.

This expression:

find_with_hint(begin, end, i, predicate)
bool find_with_hint(ForwardIterator begin, ForwardIterator end, UnaryPredicate predicate, ForwardIterator &i)
An algorithm similar to std::find_if for forward-searching over a range and finding items which match...
Definition hffix.hpp:2352

will behave exactly the same as this expression:

end != (i = std::find_if(begin, end, predicate))

except for these two differences:

  • In the first expression, i is not modifed if no item is found.
  • The first expression is faster if the found item is a near successor of i.

Example usage:

if (hffix::find_with_hint(reader.begin(), reader.end(), hffix::tag_equal(hffix::tag::MsgSeqNum), i)
int seqnum = i++->as_int<int>();
if (hffix::find_with_hint(reader.begin(), reader.end(), hffix::tag_equal(hffix::tag::TargetCompID), i)
std::string targetcompid = i++->as_string();
The iterator type for hffix::message_reader. Typedef'd as hffix::message_reader::const_iterator.
Definition hffix.hpp:2181
A predicate constructed with a FIX tag which returns true if the tag of the hffix::field passed to th...
Definition hffix.hpp:2305

See also the convenience method hffix::message_reader::find_with_hint.

Parameters
beginThe beginning of the range to search.
endThe end of the range to search.
predicateA predicate which provides function bool operator() (ForwardIterator::value_type const &v) const.
iIf an item is found which satisfies predicate, then i is modified to point to the found item. Else i is unmodified.
Returns
True if an item was found which matched predicate, and i was modified to point to the found item.

Definition at line 2352 of file hffix.hpp.